|
@@ -10,6 +10,7 @@ import com.jy.framework.model.annotation.RecordAudit;
|
|
|
import com.jy.framework.model.base.BaseIdPo;
|
|
|
import com.jy.framework.model.enums.LogTagExtendedType;
|
|
|
import com.jy.framework.satoken.LoginContext;
|
|
|
+import com.jy.framework.utils.AssertUtil;
|
|
|
import com.jy.log.model.entity.LogUserOperation;
|
|
|
import com.jy.log.utils.LogTagUtil;
|
|
|
import com.jy.log.model.wrapper.ClazzWrapper;
|
|
@@ -88,10 +89,18 @@ public class RecordAuditAspect {
|
|
|
if (result instanceof BaseIdPo baseIdPo) {
|
|
|
logUserOperation.setBusinessId(baseIdPo.getId());
|
|
|
}
|
|
|
+
|
|
|
+ if (args != null && args.length == 1) {
|
|
|
+ Object newObject = JSON.parseObject(JSON.toJSONString(args[0]), parameterTypes[0]);
|
|
|
+ String description = LogTagUtil.getObjectAllLogTag(newObject);
|
|
|
+ logUserOperation.setDescription(description);
|
|
|
+ }
|
|
|
}
|
|
|
case UPDATE -> {
|
|
|
if (args != null && args.length == 1 && args[0] instanceof BaseIdPo) {
|
|
|
logUserOperation.setBusinessId(((BaseIdPo) args[0]).getId());
|
|
|
+ boolean hasPendingAudit = logUserOperationService.hasPendingAuditByBusinessId(logUserOperation.getBusinessId());
|
|
|
+ AssertUtil.eqFalse(hasPendingAudit, "已存在待修改记录,操作失败!");
|
|
|
}
|
|
|
|
|
|
logUserOperation.setAuditStatus(0);
|
|
@@ -112,6 +121,21 @@ public class RecordAuditAspect {
|
|
|
logUserOperation.setAuditStatus(0);
|
|
|
Object oldData = getOldData(point, signature, recordAudit);
|
|
|
logUserOperation.setSourceData(JSONObject.toJSONString(oldData));
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(oldData)) {
|
|
|
+ if (oldData instanceof Collection<?> oldDataCollection) {
|
|
|
+ String description = oldDataCollection.stream().map(LogTagUtil::getObjectAllLogTag).collect(Collectors.joining("; ", "删除数据:{", "}"));
|
|
|
+ logUserOperation.setDescription(description);
|
|
|
+ } else {
|
|
|
+ String description = LogTagUtil.getObjectAllLogTag(oldData);
|
|
|
+ logUserOperation.setDescription("删除数据:" + description);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ case OTHER -> {
|
|
|
+ logUserOperation.setAuditStatus(1);
|
|
|
+ point.proceed();
|
|
|
}
|
|
|
}
|
|
|
|