bug: 78302内外部会议,政策法规资料修改记录处理null值
This commit is contained in:
+13
-3
@@ -561,7 +561,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
Method method = InsideOutsideMeeting.class.getMethod("get" + fieldName + "Name");
|
||||
Object oldTypeName = method.invoke(oldMeeting);
|
||||
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + oldTypeName + "\"改为\"" + typeName + "\"");
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + Optional.ofNullable(oldTypeName).orElse("空") + "\"改为\"" + Optional.ofNullable(typeName).orElse("空") + "\"");
|
||||
} else if ("meetingMinutes".equals(field.getName())) {
|
||||
String oldValueStr = String.valueOf(oldValue);
|
||||
String newValueStr = String.valueOf(newValue);
|
||||
@@ -584,9 +584,19 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
oldFileNameList.add(oldFile1.getOldFileName());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(String.join(",",oldFileNameList))) {
|
||||
oldValue = "空";
|
||||
}else {
|
||||
oldValue = String.join(",",oldFileNameList);
|
||||
}
|
||||
if (StringUtils.isBlank(String.join(",",fileNameList))) {
|
||||
newValue = "空";
|
||||
}else {
|
||||
newValue = String.join(",",fileNameList);
|
||||
}
|
||||
// 获取字段名称
|
||||
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + String.join(",",oldFileNameList) + "\"改为\"" + String.join(",",fileNameList) + "\"");
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + oldValue + "\"改为\"" + newValue + "\"");
|
||||
} else if ("meetingTopicList".equals(field.getName())) {
|
||||
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
|
||||
Method method = InsideOutsideMeeting.class.getMethod("get" + fieldName);
|
||||
@@ -600,7 +610,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
}
|
||||
} else {
|
||||
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + oldValue + "\"改为\"" + newValue + "\"");
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + Optional.ofNullable(oldValue).orElse("空") + "\"改为\"" + Optional.ofNullable(newValue).orElse("空") + "\"");
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
|
||||
|
||||
+26
-26
@@ -631,34 +631,24 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
if (annotationPresent) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
String oldValue = String.valueOf(field.get(oldInfo));
|
||||
String newValue = String.valueOf(field.get(newInfo));
|
||||
// String oldValue = String.valueOf(field.get(oldInfo));
|
||||
// String newValue = String.valueOf(field.get(newInfo));
|
||||
Object oldValue = field.get(oldInfo);
|
||||
Object newValue = field.get(newInfo);
|
||||
if (oldValue instanceof Date){
|
||||
oldValue = sdf.format((Date)oldValue);
|
||||
}
|
||||
if( newValue instanceof Date) {
|
||||
newValue = sdf.format((Date)newValue);
|
||||
}
|
||||
if (!Objects.equals(oldValue, newValue)) {
|
||||
switch (field.getName()) {
|
||||
// case "firstType":
|
||||
// case "secondType":
|
||||
// case "thirdType":
|
||||
// case "fourthType": {
|
||||
// List<String> typeNameList = new ArrayList<>();
|
||||
// if (StringUtils.isNotBlank(newValue)) {
|
||||
// for (String type : newValue.split(",")) {
|
||||
// if (StringUtils.isNotBlank(type)) {
|
||||
// typeNameList.add(dicTypeService.getDicTypeNameByDicCode(type));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // 获取资料类型名称
|
||||
// String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
|
||||
// Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
|
||||
// Object oldTypeName = method.invoke(oldInfo);
|
||||
// ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
|
||||
// changes.add(annotationsByType.value() + "由\"" + oldTypeName + "\"改为\"" + String.join(",", typeNameList) + "\"");
|
||||
// break;
|
||||
// }
|
||||
case "informationFile": {
|
||||
List<String> fileNameList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(newValue)) {
|
||||
String[] split = newValue.split(",");
|
||||
String oldValueStr = String.valueOf(field.get(oldInfo));
|
||||
String newValueStr = String.valueOf(field.get(newInfo));
|
||||
if (StringUtils.isNotBlank(newValueStr)) {
|
||||
String[] split = newValueStr.split(",");
|
||||
for (String attId : split) {
|
||||
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
|
||||
fileNameList.add(fileInfo.getOldFileName());
|
||||
@@ -675,14 +665,24 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
oldFileNameList.add(oldFile1.getOldFileName());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(String.join(",",oldFileNameList))) {
|
||||
oldValue = "空";
|
||||
}else {
|
||||
oldValue = String.join(",",oldFileNameList);
|
||||
}
|
||||
if (StringUtils.isBlank(String.join(",",fileNameList))) {
|
||||
newValue = "空";
|
||||
}else {
|
||||
newValue = String.join(",",fileNameList);
|
||||
}
|
||||
// 获取字段名称
|
||||
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + String.join(",", oldFileNameList) + "\"改为\"" + String.join(",", fileNameList) + "\"");
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + oldValue + "\"改为\"" + newValue + "\"");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + oldValue + "\"改为\"" + newValue + "\"");
|
||||
changes.add(annotationsByType.fieldName() + "由\"" + Optional.ofNullable(oldValue).orElse("空") + "\"改为\"" + Optional.ofNullable(newValue).orElse("空") + "\"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user