Bladeren bron

fixed 特征和证据

zero 1 jaar geleden
bovenliggende
commit
d879cafaa2

+ 13 - 16
src/main/java/cn/cslg/pas/service/business/invalidReport/AssoGroupFeatureService.java

@@ -23,6 +23,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.swagger.v3.oas.annotations.Operation;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -377,28 +379,23 @@ public class AssoGroupFeatureService extends ServiceImpl<AssoGroupFeatureMapper,
                 throw new XiaoShiException("请输入值");
             }
             domainFieldDTOS.forEach(item -> {
-//                try {
-//                    if (item.getValue() != null) {
-//                        GenerateObjectUtil.setObjectProperty(assoGroupFeature, item.getField(), item.getValue());
-//                    }
-//                } catch (Exception e) {
-//                    throw new XiaoShiException("装载失败");
-//                }
-                Object value = item.getValue();
-                if (value != null && value instanceof Boolean) {
-                    LambdaUpdateWrapper<AssoGroupFeature> wrapper = new LambdaUpdateWrapper<AssoGroupFeature>()
-                            .eq(BaseEntity::getId, id)
-                            .set(AssoGroupFeature::getIfPresentOpinions1, value);
-                    assoGroupFeature.update(wrapper);
-                } else if (value != null) {
+                String value = item.getValue().toString();
+                if (item.getField().equals("ifPresentOpinions1") && StringUtils.isEmpty(value)) {
                     LambdaUpdateWrapper<AssoGroupFeature> wrapper = new LambdaUpdateWrapper<AssoGroupFeature>()
                             .eq(BaseEntity::getId, id)
                             .set(AssoGroupFeature::getIfPresentOpinions1, null);
                     assoGroupFeature.update(wrapper);
+                } else {
+                    try {
+                        if (item.getValue() != null) {
+                            GenerateObjectUtil.setObjectProperty(assoGroupFeature, item.getField(), item.getValue());
+                            assoGroupFeature.updateById();
+                        }
+                    } catch (Exception e) {
+                        throw new XiaoShiException("装载失败");
+                    }
                 }
-
             });
-//            assoGroupFeature.updateById();
         }
         return true;
     }

+ 25 - 6
src/main/java/cn/cslg/pas/service/business/invalidReport/EvidenceReasonService.java

@@ -11,15 +11,18 @@ import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.vo.invalidVO.GroupFeatureHistoryVO;
 import cn.cslg.pas.common.vo.invalidVO.QueryEvidenceReasonVO;
 import cn.cslg.pas.common.vo.invalidVO.QueryInvalidHistoryVO;
+import cn.cslg.pas.domain.BaseEntity;
 import cn.cslg.pas.domain.business.*;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.InvalidReport.EvidenceReasonMapper;
 import cn.cslg.pas.service.business.CompareLiteratureService;
 import cn.cslg.pas.service.business.FeatureService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Service;
@@ -427,15 +430,31 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
                 throw new XiaoShiException("请输入值");
             }
             domainFieldDTOS.forEach(item -> {
-                try {
-                    if (item.getValue() != null) {
-                        GenerateObjectUtil.setObjectProperty(evidenceReason, item.getField(), item.getValue());
+//                try {
+//                    if (item.getValue() != null) {
+//                        GenerateObjectUtil.setObjectProperty(evidenceReason, item.getField(), item.getValue());
+//                    }
+//                } catch (Exception e) {
+//                    throw new XiaoShiException("装载失败");
+//                }
+                String value = item.getValue().toString();
+                if (item.getField().equals("ifPresentOpinions1") && StringUtils.isEmpty(value)) {
+                    LambdaUpdateWrapper<EvidenceReason> wrapper = new LambdaUpdateWrapper<EvidenceReason>()
+                            .eq(BaseEntity::getId, id)
+                            .set(EvidenceReason::getIfPresentOpinions1, null);
+                    evidenceReason.update(wrapper);
+                } else {
+                    try {
+                        if (item.getValue() != null) {
+                            GenerateObjectUtil.setObjectProperty(evidenceReason, item.getField(), item.getValue());
+                            evidenceReason.updateById();
+                        }
+                    } catch (Exception e) {
+                        throw new XiaoShiException("装载失败");
                     }
-                } catch (Exception e) {
-                    throw new XiaoShiException("装载失败");
                 }
             });
-            evidenceReason.updateById();
+//            evidenceReason.updateById();
         }
         return true;