fix: 政策课题修改记录代码修改

This commit is contained in:
wxyclub
2023-11-26 12:43:28 +08:00
parent 24746a13c1
commit b43b4fe103
6 changed files with 131 additions and 28 deletions
@@ -1,6 +1,7 @@
package com.adc.da.slrs.sarLawsTopic.entity; package com.adc.da.slrs.sarLawsTopic.entity;
import com.adc.da.att.entity.AttFileEO; import com.adc.da.att.entity.AttFileEO;
import com.adc.da.utils.annotation.CompareField;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@@ -30,6 +31,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题名称 * 课题名称
*/ */
@CompareField(fieldName = "课题名称")
@ApiModelProperty(value = "课题名称") @ApiModelProperty(value = "课题名称")
@TableField(value = "TOPIC_NAME") @TableField(value = "TOPIC_NAME")
private String topicName; private String topicName;
@@ -37,6 +39,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题承办单位 * 课题承办单位
*/ */
@CompareField(fieldName = "课题承办单位")
@ApiModelProperty(value = "课题承办单位") @ApiModelProperty(value = "课题承办单位")
@TableField(value = "ORGANIZER") @TableField(value = "ORGANIZER")
private String organizer; private String organizer;
@@ -44,6 +47,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题指导单位 * 课题指导单位
*/ */
@CompareField(fieldName = "课题指导单位")
@ApiModelProperty(value = "课题指导单位") @ApiModelProperty(value = "课题指导单位")
@TableField(value = "GUIDANCE_UNIT") @TableField(value = "GUIDANCE_UNIT")
private String guidanceUnit; private String guidanceUnit;
@@ -51,6 +55,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题参与单位 * 课题参与单位
*/ */
@CompareField(fieldName = "课题参与单位")
@ApiModelProperty(value = "课题参与单位") @ApiModelProperty(value = "课题参与单位")
@TableField(value = "PARTICIPATING_UNIT") @TableField(value = "PARTICIPATING_UNIT")
private String participatingUnit; private String participatingUnit;
@@ -58,6 +63,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 开始时间 * 开始时间
*/ */
@CompareField(fieldName = "启动时间")
@ApiModelProperty(value = "启动时间") @ApiModelProperty(value = "启动时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@TableField(value = "START_TIME") @TableField(value = "START_TIME")
@@ -66,6 +72,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 结题时间 * 结题时间
*/ */
@CompareField(fieldName = "结题时间")
@ApiModelProperty(value = "结题时间") @ApiModelProperty(value = "结题时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@TableField(value = "CLOSE_TIME") @TableField(value = "CLOSE_TIME")
@@ -74,6 +81,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题状态 * 课题状态
*/ */
@CompareField(fieldName = "课题状态")
@ApiModelProperty(value = "课题状态") @ApiModelProperty(value = "课题状态")
@TableField(value = "TOPIC_STATUS") @TableField(value = "TOPIC_STATUS")
private String topicStatus; private String topicStatus;
@@ -81,6 +89,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题费用(万元) * 课题费用(万元)
*/ */
@CompareField(fieldName = "课题费用")
@ApiModelProperty(value = "课题费用") @ApiModelProperty(value = "课题费用")
@TableField(value = "TOPIC_COST") @TableField(value = "TOPIC_COST")
private String topicCost; private String topicCost;
@@ -88,6 +97,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 协议 * 协议
*/ */
@CompareField(fieldName = "协议文件")
@ApiModelProperty("协议文件") @ApiModelProperty("协议文件")
@TableField(value = "AGREEMENT") @TableField(value = "AGREEMENT")
private String agreement; private String agreement;
@@ -99,6 +109,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题组会议列表 * 课题组会议列表
*/ */
@CompareField(fieldName = "课题组会议列表")
@ApiModelProperty(value = "课题组会议列表") @ApiModelProperty(value = "课题组会议列表")
@TableField(exist = false) @TableField(exist = false)
private List<SarLawsTopicMeeting> meetingList; private List<SarLawsTopicMeeting> meetingList;
@@ -106,6 +117,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题组研究方案 * 课题组研究方案
*/ */
@CompareField(fieldName = "researchPlan")
@ApiModelProperty(value = "课题研究方案") @ApiModelProperty(value = "课题研究方案")
@TableField(value = "RESEARCH_PLAN") @TableField(value = "RESEARCH_PLAN")
private String researchPlan; private String researchPlan;
@@ -117,6 +129,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题组研究成果 * 课题组研究成果
*/ */
@CompareField(fieldName = "课题组研究成果")
@ApiModelProperty(value = "课题组研究成果") @ApiModelProperty(value = "课题组研究成果")
@TableField(value = "RESEARCH_FINDINGS") @TableField(value = "RESEARCH_FINDINGS")
private String researchFindings; private String researchFindings;
@@ -131,6 +144,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题组其他 * 课题组其他
*/ */
@CompareField(fieldName = "课题组其他文件")
@ApiModelProperty(value = "课题组其他文件") @ApiModelProperty(value = "课题组其他文件")
@TableField(value = "RESEARCH_GROUP_OTHER") @TableField(value = "RESEARCH_GROUP_OTHER")
private String researchGroupOther; private String researchGroupOther;
@@ -142,6 +156,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题组会议资料 * 课题组会议资料
*/ */
@CompareField(fieldName = "课题组会议资料")
@ApiModelProperty(value = "课题组会议资料") @ApiModelProperty(value = "课题组会议资料")
@TableField(value = "CONFERENCE_MATERIALS") @TableField(value = "CONFERENCE_MATERIALS")
private String conferenceMaterials; private String conferenceMaterials;
@@ -153,6 +168,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 课题组联系方式 * 课题组联系方式
*/ */
@CompareField(fieldName = "课题组联系方式")
@ApiModelProperty(value = "课题组联系方式列表") @ApiModelProperty(value = "课题组联系方式列表")
@TableField(exist = false) @TableField(exist = false)
private List<SarLawsContactInformation> topicContactInformationList; private List<SarLawsContactInformation> topicContactInformationList;
@@ -160,6 +176,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 内部资料立项报告 * 内部资料立项报告
*/ */
@CompareField(fieldName = "内部资料立项报告")
@ApiModelProperty(value = "内部资料立项报告") @ApiModelProperty(value = "内部资料立项报告")
@TableField(value = "INSIDE_PROJECT_PROPOSAL_REPORT") @TableField(value = "INSIDE_PROJECT_PROPOSAL_REPORT")
private String insideProjectProposalRepost; private String insideProjectProposalRepost;
@@ -171,6 +188,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 内部资料研究方案 * 内部资料研究方案
*/ */
@CompareField(fieldName = "内部资料研究方案")
@ApiModelProperty(value = "内部资料研究方案") @ApiModelProperty(value = "内部资料研究方案")
@TableField(value = "INSIDE_RESEARCH_PLAN") @TableField(value = "INSIDE_RESEARCH_PLAN")
private String insideResearchPlan; private String insideResearchPlan;
@@ -182,6 +200,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 内部资料会议资料 * 内部资料会议资料
*/ */
@CompareField(fieldName = "内部资料会议资料")
@ApiModelProperty(value = "内部资料会议资料") @ApiModelProperty(value = "内部资料会议资料")
@TableField(value = "INSIDE_CONFERENCE_MATERIALS") @TableField(value = "INSIDE_CONFERENCE_MATERIALS")
private String insideConferenceMaterials; private String insideConferenceMaterials;
@@ -193,6 +212,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 内部会议研究成果 * 内部会议研究成果
*/ */
@CompareField(fieldName = "内部会议研究成果")
@ApiModelProperty(value = "内部会议研究成果") @ApiModelProperty(value = "内部会议研究成果")
@TableField(value = "INSIDE_RESEARCH_FINDINGS") @TableField(value = "INSIDE_RESEARCH_FINDINGS")
private String insideResearchFindings; private String insideResearchFindings;
@@ -204,6 +224,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 内部会议其他 * 内部会议其他
*/ */
@CompareField(fieldName = "内部会议其他文件")
@ApiModelProperty(value = "内部会议其他文件") @ApiModelProperty(value = "内部会议其他文件")
@TableField(value = "INSIDE_OTHER") @TableField(value = "INSIDE_OTHER")
private String insideOther; private String insideOther;
@@ -215,6 +236,7 @@ public class SarLawsTopic implements Serializable {
/** /**
* 内部联系方式 * 内部联系方式
*/ */
@CompareField(fieldName = "内部联系方式列表")
@ApiModelProperty(value = "内部联系方式列表") @ApiModelProperty(value = "内部联系方式列表")
@TableField(exist = false) @TableField(exist = false)
private List<SarLawsContactInformation> insideContactInformationList; private List<SarLawsContactInformation> insideContactInformationList;
@@ -1,6 +1,7 @@
package com.adc.da.slrs.sarLawsTopic.entity; package com.adc.da.slrs.sarLawsTopic.entity;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.adc.da.utils.annotation.CompareField;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@@ -31,6 +32,7 @@ public class SarLawsTopicMeeting implements Serializable {
/** /**
* 会议名称 * 会议名称
*/ */
@CompareField(fieldName = "会议名称")
@TableField(value = "MEETING_NAME") @TableField(value = "MEETING_NAME")
@Excel(name = "会议名称", orderNum = "0", type = 1) @Excel(name = "会议名称", orderNum = "0", type = 1)
private String meetingName; private String meetingName;
@@ -38,6 +40,7 @@ public class SarLawsTopicMeeting implements Serializable {
/** /**
* 会议时间 * 会议时间
*/ */
@CompareField(fieldName = "会议时间")
@TableField(value = "MEETING_TIME") @TableField(value = "MEETING_TIME")
@Excel(name = "会议时间", orderNum = "1", type = 1) @Excel(name = "会议时间", orderNum = "1", type = 1)
private String meetingTime; private String meetingTime;
@@ -45,6 +48,7 @@ public class SarLawsTopicMeeting implements Serializable {
/** /**
* 会议地点 * 会议地点
*/ */
@CompareField(fieldName = "会议地点")
@TableField(value = "MEETING_ADDRESS") @TableField(value = "MEETING_ADDRESS")
@Excel(name = "会议地点", orderNum = "2", type = 1) @Excel(name = "会议地点", orderNum = "2", type = 1)
private String meetingAddress; private String meetingAddress;
@@ -52,6 +56,7 @@ public class SarLawsTopicMeeting implements Serializable {
/** /**
* 参会人员(内部) * 参会人员(内部)
*/ */
@CompareField(fieldName = "参会人员(内部)")
@TableField(value = "PARTICIPANTS") @TableField(value = "PARTICIPANTS")
@Excel(name = "参会人员(内部)", orderNum = "3", type = 1) @Excel(name = "参会人员(内部)", orderNum = "3", type = 1)
private String participants; private String participants;
@@ -59,6 +64,7 @@ public class SarLawsTopicMeeting implements Serializable {
/** /**
* 会议主要内容 * 会议主要内容
*/ */
@CompareField(fieldName = "会议主要内容")
@TableField(value = "MEETING_CONTENT") @TableField(value = "MEETING_CONTENT")
@Excel(name = "会议主要内容", orderNum = "4", type = 1) @Excel(name = "会议主要内容", orderNum = "4", type = 1)
private String meetingContent; private String meetingContent;
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarLawsTopic.service;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicMeeting; import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicMeeting;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/** /**
* @author tjzdw * @author tjzdw
* @description 针对表【sar_laws_topic_meeting(政策课题组会议)】的数据库操作Service * @description 针对表【sar_laws_topic_meeting(政策课题组会议)】的数据库操作Service
@@ -10,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface SarLawsTopicMeetingService extends IService<SarLawsTopicMeeting> { public interface SarLawsTopicMeetingService extends IService<SarLawsTopicMeeting> {
public List<String> compareTopicMeeting(SarLawsTopicMeeting oldTopicMeeting, SarLawsTopicMeeting newTopicMeeting);
} }
@@ -1,11 +1,17 @@
package com.adc.da.slrs.sarLawsTopic.service.impl; package com.adc.da.slrs.sarLawsTopic.service.impl;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopic;
import com.adc.da.utils.annotation.CompareField;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicMeeting; import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicMeeting;
import com.adc.da.slrs.sarLawsTopic.service.SarLawsTopicMeetingService; import com.adc.da.slrs.sarLawsTopic.service.SarLawsTopicMeetingService;
import com.adc.da.slrs.sarLawsTopic.dao.SarLawsTopicMeetingMapper; import com.adc.da.slrs.sarLawsTopic.dao.SarLawsTopicMeetingMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
/** /**
* @author tjzdw * @author tjzdw
* @description 针对表【sar_laws_topic_meeting(政策课题组会议)】的数据库操作Service实现 * @description 针对表【sar_laws_topic_meeting(政策课题组会议)】的数据库操作Service实现
@@ -15,6 +21,35 @@ import org.springframework.stereotype.Service;
public class SarLawsTopicMeetingServiceImpl extends ServiceImpl<SarLawsTopicMeetingMapper, SarLawsTopicMeeting> public class SarLawsTopicMeetingServiceImpl extends ServiceImpl<SarLawsTopicMeetingMapper, SarLawsTopicMeeting>
implements SarLawsTopicMeetingService{ implements SarLawsTopicMeetingService{
public List<String> compareTopicMeeting(SarLawsTopicMeeting oldTopicMeeting, SarLawsTopicMeeting newTopicMeeting) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<String> changes = new ArrayList<>();
// 获取TopicMeeting类的所有字段
Field[] fields = SarLawsTopic.class.getDeclaredFields();
for (Field field : fields) {
boolean annotationPresent = field.isAnnotationPresent(CompareField.class);
if (annotationPresent) {
try {
field.setAccessible(true);
Object oldValue = field.get(oldTopicMeeting);
Object newValue = field.get(newTopicMeeting);
if (oldValue instanceof Date && newValue instanceof Date) {
oldValue = sdf.format((Date)oldValue);
newValue = sdf.format((Date)newValue);
}
if (!Objects.equals(oldValue, newValue)) {
// 对比其他字段
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "由\"" + oldValue + "\"改为\"" + newValue + "\"");
}
} catch (IllegalAccessException e) {
// 处理异常
e.printStackTrace();
}
}
}
return changes;
}
} }
@@ -17,6 +17,7 @@ import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService; import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.util.LoginUserUtil; import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils; import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.annotation.CompareField;
import com.adc.da.utils.util.FieldConvertUtil; import com.adc.da.utils.util.FieldConvertUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -168,6 +169,9 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
return true; return true;
} }
lawsTopic.setModifyTime(new Date()); lawsTopic.setModifyTime(new Date());
for (String s : compareList) {
log.error("====================变更项====================" + s);
}
int update = this.baseMapper.updateById(lawsTopic); int update = this.baseMapper.updateById(lawsTopic);
// 比较列表字段是否经过修改,如果经过修改,先删除,再添加 // 比较列表字段是否经过修改,如果经过修改,先删除,再添加
if (compareList.contains("课题组会议列表被变更")) { if (compareList.contains("课题组会议列表被变更")) {
@@ -512,23 +516,25 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
* @return 差异 * @return 差异
*/ */
public List<String> compareLawsTopic(SarLawsTopic oldLawsTopic, SarLawsTopic newLawsTopic) { public List<String> compareLawsTopic(SarLawsTopic oldLawsTopic, SarLawsTopic newLawsTopic) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<String> changes = new ArrayList<>(); List<String> changes = new ArrayList<>();
// 不需要比较的字段 // 文件字段
String[] ignoreFields = {"id","validFlag","createTime","modifyTime","agreementList","researchPlanList",
"researchFindingsList","researchGroupOtherList","conferenceMaterialsList","insideProjectProposalRepostList",
"insideResearchPlanList","insideConferenceMaterialsList","insideResearchFindingsList","insideOtherList","serialVersionUID"};
String[] fileAttIdFields = {"agreement","researchPlan","researchFindings","researchGroupOther","conferenceMaterials", String[] fileAttIdFields = {"agreement","researchPlan","researchFindings","researchGroupOther","conferenceMaterials",
"insideProjectProposalRepost","insideResearchPlan","insideConferenceMaterials","insideResearchFindings","insideOther"}; "insideProjectProposalRepost","insideResearchPlan","insideConferenceMaterials","insideResearchFindings","insideOther"};
List<String> ignoreFieldList = Arrays.asList(ignoreFields);
List<String> fileAttIdFieldList = Arrays.asList(fileAttIdFields); List<String> fileAttIdFieldList = Arrays.asList(fileAttIdFields);
// 获取SarLawsTopic类的所有字段 // 获取SarLawsTopic类的所有字段
Field[] fields = SarLawsTopic.class.getDeclaredFields(); Field[] fields = SarLawsTopic.class.getDeclaredFields();
for (Field field : fields) { for (Field field : fields) {
if (!ignoreFieldList.contains(field.getName())) { boolean annotationPresent = field.isAnnotationPresent(CompareField.class);
if (annotationPresent) {
try { try {
field.setAccessible(true); field.setAccessible(true);
Object oldValue = field.get(oldLawsTopic); Object oldValue = field.get(oldLawsTopic);
Object newValue = field.get(newLawsTopic); Object newValue = field.get(newLawsTopic);
if (oldValue instanceof Date && newValue instanceof Date) {
oldValue = sdf.format((Date)oldValue);
newValue = sdf.format((Date)newValue);
}
if (!Objects.equals(oldValue, newValue)) { if (!Objects.equals(oldValue, newValue)) {
// 对比文件字段 // 对比文件字段
if (fileAttIdFieldList.contains(field.getName())) { if (fileAttIdFieldList.contains(field.getName())) {
@@ -555,31 +561,27 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
} }
} }
// 获取字段名称 // 获取字段名称
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.value() + "由\"" + String.join(",",oldFileNameList) + "\"改为\"" + String.join(",",fileNameList) + "\""); changes.add(annotationsByType.fieldName() + "由\"" + String.join(",",oldFileNameList) + "\"改为\"" + String.join(",",fileNameList) + "\"");
// 对比列表字段 // 对比列表字段
} else if ("meetingList".equals(field.getName()) || "topicContactInformationList".equals(field.getName()) } else if ("meetingList".equals(field.getName())) {
|| "insideContactInformationList".equals(field.getName())) { String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; Method method = SarLawsTopic.class.getMethod("get" + fieldName + "List");
changes.add(annotationsByType.value() + "被变更"); Object oldInvoke = method.invoke(oldLawsTopic);
} else if ("startTime".equals(field.getName()) || "closeTime".equals(field.getName())) { Object newInvoke = method.invoke(newLawsTopic);
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; if (oldInvoke == null && newInvoke == null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); continue;
String oldDateStr = null;
String newDateStr = null;
if (oldValue != null) {
Date oldDate = (Date) oldValue;
oldDateStr = sdf.format(oldDate);
} }
if (newValue!= null) { List<SarLawsTopicMeeting> oldLawsTopicList = (List<SarLawsTopicMeeting>) oldInvoke;
Date newDate = (Date) newValue; List<SarLawsTopicMeeting> newLawsTopicList = (List<SarLawsTopicMeeting>) newInvoke;
newDateStr = sdf.format(newDate); isListEqual(oldLawsTopicList, newLawsTopicList);
} } else if ("topicContactInformationList".equals(field.getName()) || "insideContactInformationList".equals(field.getName())) {
changes.add(annotationsByType.value() + "由\"" + oldDateStr + "\"改为\"" + newDateStr + "\""); CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
}else { changes.add(annotationsByType.fieldName() + "被变更");
} else {
// 对比其他字段 // 对比其他字段
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.value() + "由\"" + oldValue + "\"改为\"" + newValue + "\""); changes.add(annotationsByType.fieldName() + "由\"" + oldValue + "\"改为\"" + newValue + "\"");
} }
} }
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
@@ -635,6 +637,27 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
} }
return null; return null;
} }
public boolean isListEqual(List l0, List l1){
if (l0 == l1)
return true;
if (l0 == null && l1 == null)
return true;
if (l0 == null || l1 == null)
return false;
if (l0.size() != l1.size())
return false;
for (Object o : l0) {
if (!l1.contains(o))
return false;
}
for (Object o : l1) {
if (!l0.contains(o))
return false;
}
return true;
}
} }
@@ -0,0 +1,13 @@
package com.adc.da.utils.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface CompareField {
String fieldName() default "";
}