Browse Source

modify:

1. 增加项目内容变更提交时忽略get方法;
tags/24081601
WendyYang 5 months ago
parent
commit
a167a2ad7e
2 changed files with 4 additions and 3 deletions
  1. +2
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectDetailDiffUtil.java
  2. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitProjectChangeApplyReq.java

+ 2
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectDetailDiffUtil.java View File

@@ -4,10 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ClassUtil;
import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.ObjUtil;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import org.apache.commons.collections4.MapUtils;


import java.util.*; import java.util.*;


@@ -95,8 +95,7 @@ public final class ProjectDetailDiffUtil {
Class<?> clazz = oldVal == null ? newVal.getClass() : oldVal.getClass(); Class<?> clazz = oldVal == null ? newVal.getClass() : oldVal.getClass();
oldVal = formatDate(MapUtil.get(oldObjMap, key, clazz)); oldVal = formatDate(MapUtil.get(oldObjMap, key, clazz));
newVal = formatDate(MapUtil.get(newObjMap, key, clazz)); newVal = formatDate(MapUtil.get(newObjMap, key, clazz));
// 如果是嵌套对象,则递归比较
if (!BeanUtil.isBean(clazz) && ObjUtil.notEqual(oldVal, newVal)) {
if (ClassUtil.isSimpleValueType(clazz) && ObjUtil.notEqual(oldVal, newVal)) {
result.add(FieldDiff.builder() result.add(FieldDiff.builder()
.fieldName(key) .fieldName(key)
.fieldType(clazz.getTypeName()) .fieldType(clazz.getTypeName())


+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitProjectChangeApplyReq.java View File

@@ -2,6 +2,7 @@ package com.hz.pm.api.projectlib.model.req;


import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hz.pm.api.projectdeclared.model.dto.EditProjectDetailDTO; import com.hz.pm.api.projectdeclared.model.dto.EditProjectDetailDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -26,6 +27,7 @@ public class SubmitProjectChangeApplyReq {
@ApiModelProperty("项目信息") @ApiModelProperty("项目信息")
private JSONObject projectEditDetail; private JSONObject projectEditDetail;


@JsonIgnore
public EditProjectDetailDTO getProjectDetail() { public EditProjectDetailDTO getProjectDetail() {
return BeanUtil.toBean(projectEditDetail, EditProjectDetailDTO.class); return BeanUtil.toBean(projectEditDetail, EditProjectDetailDTO.class);
} }


Loading…
Cancel
Save