add 会议发布提醒
This commit is contained in:
@@ -4,13 +4,15 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.util.SpringContextUtils;
|
||||
import com.jero.util.module.ObjRecordUtilModule;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -25,7 +27,8 @@ public class ObjRecordUtil {
|
||||
* @param newObj 修改后数据对象
|
||||
* @return
|
||||
*/
|
||||
public static String addRecord(Object oldObj, Object newObj) {
|
||||
public static ObjRecordUtilModule addRecord(Object oldObj, Object newObj) {
|
||||
ObjRecordUtilModule objRecordUtilModule = new ObjRecordUtilModule();
|
||||
try {
|
||||
// 得到类对象
|
||||
Class<?> class1 = oldObj.getClass();
|
||||
@@ -37,6 +40,7 @@ public class ObjRecordUtil {
|
||||
Field[] fields1 = class1.getDeclaredFields();
|
||||
Field[] fields2 = class2.getDeclaredFields();
|
||||
StringBuilder info = new StringBuilder();
|
||||
List<String> fieldNames = new ArrayList<>();
|
||||
String id = null;
|
||||
for (Field field1 : fields1) {
|
||||
field1.setAccessible(true); // 设置属性是可以访问的(私有的也可以)
|
||||
@@ -77,6 +81,7 @@ public class ObjRecordUtil {
|
||||
} else {
|
||||
info.append(pn.value()).append(":\"").append(old).append("\" 改成 \"").append(newo).append("\",");
|
||||
}
|
||||
fieldNames.add(field1.getName());
|
||||
}
|
||||
}
|
||||
break; // 属性名称一样就退出二级循环
|
||||
@@ -85,11 +90,15 @@ public class ObjRecordUtil {
|
||||
}
|
||||
if (info.length() != 0) {
|
||||
// 设置日志信息
|
||||
return info.substring(0, info.length() - 1);
|
||||
objRecordUtilModule.setInfo(info.substring(0, info.length() - 1));
|
||||
objRecordUtilModule.setFieldNames(fieldNames);
|
||||
return objRecordUtilModule;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
objRecordUtilModule.setInfo(null);
|
||||
objRecordUtilModule.setFieldNames(new ArrayList<>());
|
||||
return objRecordUtilModule;
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.jero.util.module;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
* @date 2021-09-26 15:04
|
||||
*/
|
||||
@Data
|
||||
public class ObjRecordUtilModule {
|
||||
private List<String> fieldNames;
|
||||
private String info;
|
||||
}
|
||||
Reference in New Issue
Block a user