ソースを参照

内部报验-核心检验指标-修改记录-检验员

wangming 11 ヶ月 前
コミット
c82007389f

+ 12 - 2
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxInsideInspectionCoreIndicatorsService.java

@@ -2,6 +2,7 @@ package com.rongwei.bscommon.sys.service;
 
 import com.rongwei.bsentity.domain.ZhcxInsideInspectionCoreIndicatorsDo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.rwcommon.vo.generalsql.GeneralUpdateVo;
 import com.rongwei.rwcommon.vo.generalsql.SlaveDMLVo;
 
 import java.util.List;
@@ -33,11 +34,20 @@ public interface ZhcxInsideInspectionCoreIndicatorsService extends IService<Zhcx
     void copyByInsideId(String insideId, List<String> newIinsideIdList);
 
     /**
-     * 更改记录
+     * 自检员更改记录
      *
      * @param insideId
      * @param update
      * @return
      */
-    List<String> editColsHistory(String insideId, SlaveDMLVo update);
+    List<String> editSelfColsHistory(String insideId, SlaveDMLVo update);
+
+    /**
+     * 检验员更改记录
+     *
+     * @param insideId
+     * @param coreList
+     * @return
+     */
+    List<String> editCheckerColsHistory(String insideId, List<GeneralUpdateVo> coreList);
 }

+ 7 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxInsideInspectionService.java

@@ -83,6 +83,13 @@ public interface ZhcxInsideInspectionService extends IService<ZhcxInsideInspecti
      */
     void execute(InsideInspectionDispatchRequest req);
 
+    /**
+     * 检验员暂存修改
+     *
+     * @param req
+     */
+    void saveCheckerStaging(CheckerStagingInspectionRequest req);
+
     /**
      * 再次报验
      * 1、复制一份作为历史记录

+ 211 - 3
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionCoreIndicatorsServiceImpl.java

@@ -72,13 +72,221 @@ public class ZhcxInsideInspectionCoreIndicatorsServiceImpl extends ServiceImpl<Z
      * @return
      */
     @Override
-    public List<String> editColsHistory(String insideId, SlaveDMLVo update) {
+    public List<String> editSelfColsHistory(String insideId, SlaveDMLVo update) {
         final LambdaQueryWrapper<ZhcxInsideInspectionCoreIndicatorsDo> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(ZhcxInsideInspectionCoreIndicatorsDo::getInsideid, insideId)
                 .eq(ZhcxInsideInspectionCoreIndicatorsDo::getDeleted, "0");
         final List<ZhcxInsideInspectionCoreIndicatorsDo> list = list(queryWrapper);
 
-        return editCosHistory(list, update.getSlaveUpdate());
+        return editSelfCosHistory(list, update.getSlaveUpdate());
+    }
+
+    /**
+     * 检验员更改记录
+     *
+     * @param insideId
+     * @param coreList
+     * @return
+     */
+    @Override
+    public List<String> editCheckerColsHistory(String insideId, List<GeneralUpdateVo> coreList) {
+        final LambdaQueryWrapper<ZhcxInsideInspectionCoreIndicatorsDo> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(ZhcxInsideInspectionCoreIndicatorsDo::getInsideid, insideId)
+                .eq(ZhcxInsideInspectionCoreIndicatorsDo::getDeleted, "0");
+        final List<ZhcxInsideInspectionCoreIndicatorsDo> list = list(queryWrapper);
+
+        return editCheckerCosHistory(list, coreList);
+    }
+
+    /**
+     * 检验员修改记录
+     *
+     * @param coreList
+     * @param slaveUpdate
+     * @return
+     */
+    private List<String> editCheckerCosHistory(List<ZhcxInsideInspectionCoreIndicatorsDo> coreList, List<GeneralUpdateVo> slaveUpdate) {
+
+        if(ObjectUtil.isEmpty(slaveUpdate)) {
+            return Collections.emptyList();
+        }
+
+        Map<String, ZhcxInsideInspectionCoreIndicatorsDo> coreMap = new HashMap<>(coreList.size());
+        coreList.stream().forEach(item -> coreMap.put(item.getId(), item));
+
+        List<String> result = new ArrayList<>();
+
+        for(GeneralUpdateVo update : slaveUpdate) {
+            String id = update.getUpdatecolumns().get("ID").toString();
+            ZhcxInsideInspectionCoreIndicatorsDo indicators = coreMap.get(id);
+
+            if(ObjectUtil.isNull(indicators)) {
+                continue;
+            }
+
+            difCheckercoreIndicator(indicators, update.getUpdatecolumns(), result);
+        }
+
+        return result;
+    }
+
+    /**
+     * 单个核心检验指标不同
+     *
+     * @param core
+     * @param updatecolumns
+     * @param result
+     */
+    private void difCheckercoreIndicator(ZhcxInsideInspectionCoreIndicatorsDo core, Map<String,Object> updatecolumns, List<String> result) {
+
+        List<String> updateCols = new ArrayList<>();
+        StringBuilder editRow = new StringBuilder("检查项:");
+        if(ObjectUtil.isNull(updatecolumns.get("INSPECTON_ITEMS"))) {
+            editRow.append(StringUtils.toString(core.getInspectonItems(), ""));
+        } else {
+            editRow.append(StringUtils.toString(updatecolumns.get("INSPECTON_ITEMS"), ""));
+        }
+
+        //实测记录
+        diffCheckerActualRecord(core, updatecolumns, updateCols);
+        //判定结果
+        diffCheckerResult(core, updatecolumns, updateCols);
+        //判定结果
+        diffCheckerRemark(core, updatecolumns, updateCols);
+
+        if(ObjectUtil.isEmpty(updateCols)) {
+            return ;
+        }
+
+        editRow.append(StringUtils.join(updateCols, ","));
+        result.add(editRow.toString());
+    }
+
+    /**
+     * 不同检验员备注
+     *
+     * @param core
+     * @param updatecolumns
+     * @param updateCols
+     */
+    private void diffCheckerRemark(ZhcxInsideInspectionCoreIndicatorsDo core, Map<String, Object> updatecolumns, List<String> updateCols) {
+        if(ObjectUtil.isEmpty(core.getCheckremark()) && ObjectUtil.isNull(updatecolumns.get("CHECKREMARK"))) {
+            return ;
+        }
+
+        if(ObjectUtil.isEmpty(core.getCheckremark()) && ObjectUtil.isNotNull(updatecolumns.get("CHECKREMARK"))) {
+            String reservationinspectiontime = StrUtil.concat(true, "检验员备注:"
+                    , "空变更为:"
+                    , updatecolumns.get("CHECKREMARK").toString()
+            );
+            updateCols.add(reservationinspectiontime);
+            return ;
+        }
+
+        if(ObjectUtil.isNotEmpty(core.getCheckremark()) && ObjectUtil.isNull(updatecolumns.get("CHECKREMARK"))) {
+            String reservationinspectiontime = StrUtil.concat(true, "检验员备注:"
+                    , core.getCheckremark()
+                    , "变更为空"
+            );
+            updateCols.add(reservationinspectiontime);
+            return ;
+        }
+
+        if(core.getCheckremark().equals(updatecolumns.get("CHECKREMARK").toString())) {
+            return ;
+        }
+
+        String reservationinspectiontime = StrUtil.concat(true, "检验员备注:"
+                , core.getCheckremark()
+                , "变更为"
+                , updatecolumns.get("CHECKREMARK").toString()
+        );
+        updateCols.add(reservationinspectiontime);
+    }
+
+    /**
+     *
+     * 不同检验员结果判定
+     *
+     * @param core
+     * @param updatecolumns
+     * @param updateCols
+     */
+    private void diffCheckerResult(ZhcxInsideInspectionCoreIndicatorsDo core, Map<String, Object> updatecolumns, List<String> updateCols) {
+        if(ObjectUtil.isEmpty(core.getCheckresult()) && ObjectUtil.isNull(updatecolumns.get("CHECKRESULT"))) {
+            return ;
+        }
+
+        if(ObjectUtil.isEmpty(core.getCheckresult()) && ObjectUtil.isNotNull(updatecolumns.get("CHECKRESULT"))) {
+            String reservationinspectiontime = StrUtil.concat(true, "检验员结果判定:"
+                    , "空变更为:"
+                    , updatecolumns.get("CHECKRESULT").toString()
+            );
+            updateCols.add(reservationinspectiontime);
+            return ;
+        }
+
+        if(ObjectUtil.isNotEmpty(core.getCheckresult()) && ObjectUtil.isNull(updatecolumns.get("CHECKRESULT"))) {
+            String reservationinspectiontime = StrUtil.concat(true, "检验员结果判定:"
+                    , core.getCheckresult()
+                    , "变更为空"
+            );
+            updateCols.add(reservationinspectiontime);
+            return;
+        }
+
+        if(core.getCheckresult().equals(updatecolumns.get("CHECKRESULT").toString())) {
+            return ;
+        }
+
+        String reservationinspectiontime = StrUtil.concat(true, "检验员结果判定:"
+                , core.getCheckresult()
+                , "变更为"
+                , updatecolumns.get("CHECKRESULT").toString()
+        );
+        updateCols.add(reservationinspectiontime);
+    }
+
+    /**
+     * 不同检验员实测记录
+     *
+     * @param core
+     * @param updatecolumns
+     * @param updateCols
+     */
+    private void diffCheckerActualRecord(ZhcxInsideInspectionCoreIndicatorsDo core, Map<String, Object> updatecolumns, List<String> updateCols) {
+        if(ObjectUtil.isEmpty(core.getCheckactualrecord()) && ObjectUtil.isNull(updatecolumns.get("CHECKACTUALRECORD"))) {
+            return ;
+        }
+
+        if(ObjectUtil.isEmpty(core.getCheckactualrecord()) && ObjectUtil.isNotNull(updatecolumns.get("CHECKACTUALRECORD"))) {
+            String reservationinspectiontime = StrUtil.concat(true, "检验员实测记录:"
+                    , "空变更为:"
+                    , updatecolumns.get("CHECKACTUALRECORD").toString()
+            );
+            updateCols.add(reservationinspectiontime);
+            return ;
+        }
+
+        if(ObjectUtil.isNotEmpty(core.getCheckactualrecord()) && ObjectUtil.isNull(updatecolumns.get("CHECKACTUALRECORD"))) {
+            String reservationinspectiontime = StrUtil.concat(true, "检验员实测记录:"
+                    , core.getCheckactualrecord()
+                    , "变更为空"
+            );
+            updateCols.add(reservationinspectiontime);
+            return ;
+        }
+
+        if(core.getCheckactualrecord().equals(updatecolumns.get("CHECKACTUALRECORD").toString())) {
+            return ;
+        }
+
+        String reservationinspectiontime = StrUtil.concat(true, "检验员实测记录:"
+                , core.getCheckactualrecord()
+                , "变更为"
+                , updatecolumns.get("CHECKACTUALRECORD").toString()
+        );
+        updateCols.add(reservationinspectiontime);
     }
 
     /**
@@ -88,7 +296,7 @@ public class ZhcxInsideInspectionCoreIndicatorsServiceImpl extends ServiceImpl<Z
      * @param slaveUpdate
      * @return
      */
-    private List<String> editCosHistory(List<ZhcxInsideInspectionCoreIndicatorsDo> coreList, List<GeneralUpdateVo> slaveUpdate) {
+    private List<String> editSelfCosHistory(List<ZhcxInsideInspectionCoreIndicatorsDo> coreList, List<GeneralUpdateVo> slaveUpdate) {
         if(ObjectUtil.isEmpty(coreList) && ObjectUtil.isEmpty(slaveUpdate)) {
             return Collections.emptyList();
         }

+ 71 - 9
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionServiceImpl.java

@@ -32,6 +32,7 @@ import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.exception.CustomException;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
+import com.rongwei.rwcommon.vo.generalsql.GeneralUpdateVo;
 import com.rongwei.rwcommon.vo.generalsql.MasterSlaveUpdateVo;
 import com.rongwei.rwcommon.vo.generalsql.SlaveDMLVo;
 import com.rongwei.rwcommoncomponent.excel.aspose.ExcelFormData;
@@ -429,6 +430,32 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         dispatchExecute(req);
     }
 
+    /**
+     * 检验员暂存修改
+     *
+     * @param req
+     */
+    @Override
+    public void saveCheckerStaging(CheckerStagingInspectionRequest req) {
+
+        //核心检验指标修改记录
+        final List<String> editList = insideInspectionCoreIndicatorsService.editCheckerColsHistory(req.getId(), req.getCoreUpdateList());
+
+        //没有更改,不存修改日志
+        if(ObjectUtil.isNotEmpty(editList)) {
+            saveEditLog(req, StringUtils.join(editList, "; "));
+        }
+
+        try {
+            for (GeneralUpdateVo generalUpdateVo : req.getCoreUpdateList()) {
+                generalCRUDService.generalUpdate(generalUpdateVo);
+            }
+        } catch (Exception e) {
+            log.error("保存失败: {}", e);
+            throw new CustomException("保存失败");
+        }
+    }
+
     /**
      * 再次报验
      * 1、复制一份作为历史记录
@@ -719,7 +746,6 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
      * @param req
      */
     private void saveEditHistory(ZhcxInsideInspectionDo inspection, InsideInspectionUpdateRequest req) {
-        Map<String, String> descMap = new HashMap<>();
 
         //主表单
         List<String> editList = editColsHistory(inspection, req.getUpdate().getMasterUpdate().getUpdatecolumns());
@@ -729,17 +755,28 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
             final Optional<SlaveDMLVo> first = req.getUpdate().getSlaveUpdate().stream()
                     .filter(item -> "ZHCX_INSIDE_INSPECTION_CORE_INDICATORS".equals(item.getTableName())).findFirst();
             if(first.isPresent()) {
-                final List<String> list = insideInspectionCoreIndicatorsService.editColsHistory(inspection.getId(), first.get());
+                final List<String> list = insideInspectionCoreIndicatorsService.editSelfColsHistory(inspection.getId(), first.get());
                 editList.addAll(list);
             }
         }
 
+
+        //没有更改,不存修改日志
         if(ObjectUtil.isNotEmpty(editList)) {
-            descMap.put(req.getId(), StringUtils.join(editList, "; "));
+            saveEditLog(req, StringUtils.join(editList, "; "));
         }
 
-        //没有更改,不存修改日志
-        if(ObjectUtil.isEmpty(descMap)) {
+    }
+
+    /**
+     * 保存修改日志
+     *
+     * @param req
+     * @param editColsLog
+     */
+    private void saveEditLog(InsideInspectionOperRequest req, String editColsLog) {
+
+        if(ObjectUtil.isEmpty(editColsLog)) {
             return ;
         }
 
@@ -751,6 +788,9 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         list.add(req.getId());
         operBaseDto.setInsideIdList(list);
 
+        Map<String, String> descMap = new HashMap<>();
+        descMap.put(req.getId(), editColsLog);
+
         operLogService.saveOperLog(operBaseDto, operDto, descMap);
     }
 
@@ -803,6 +843,7 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         List<String> msgList = new ArrayList<>();
         List<ZhcxInsideInspectionDispatchDo> dispatchList = new ArrayList<>();
         List<ZhcxInsideInspectionDo> inspectionList = new ArrayList<>();
+        Map<String, String> descMap = new HashMap<>();
         ProjectNodeStateBo nodeStateBo  = ProjectNodeStateBo.builder()
                 .insertList(new ArrayList<>())
                 .updateList(new ArrayList<>())
@@ -841,9 +882,30 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
                 dispatch.setCheckendtime(DateUtil.parse(req.getEndDate(), "yyyy-MM-dd HH:mm:ss"));
             }
 
+            //核心检验指标修改记录
+            if(ObjectUtil.isNotNull(req.getCoreMap())) {
+                final List<GeneralUpdateVo> generalUpdateVoList = req.getCoreMap().get(insideId);
+                if(ObjectUtil.isNotEmpty(generalUpdateVoList)) {
+                    List<String> editList = insideInspectionCoreIndicatorsService.editCheckerColsHistory(insideId, generalUpdateVoList);
+                    if(ObjectUtil.isNotEmpty(editList)) {
+                        descMap.put(insideId, StringUtils.join(editList, ","));
+                    }
+                }
+
+                try {
+                    for (GeneralUpdateVo generalUpdateVo : generalUpdateVoList) {
+                        generalCRUDService.generalUpdate(generalUpdateVo);
+                    }
+                } catch (Exception e) {
+                    log.error("保存失败: {}", e);
+                    throw new CustomException("保存失败");
+                }
+            }
+
             //报验完成,只能修改时间
             if("30".equals(inOper.getInspection().getInspectionstatus())) {
                 dispatchList.add(dispatch);
+                operDto.setOperType("80");
                 continue;
             }
 
@@ -878,11 +940,11 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         //修改
         if(ObjectUtil.isNotEmpty(inspectionList)) {
             updateBatchById(inspectionList);
-
-            //操作日志
-            operLogService.saveOperLog(req, operDto, Collections.emptyMap());
         }
 
+        //操作日志
+        operLogService.saveOperLog(req, operDto, descMap);
+
         //保存报验点状态
         itpProjectNodeStateService.saveNode(nodeStateBo);
     }
@@ -1118,7 +1180,7 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
             final Optional<SlaveDMLVo> first = masterSlaveUpdate.getSlaveUpdate().stream()
                     .filter(item -> "ZHCX_INSIDE_INSPECTION_CORE_INDICATORS".equals(item.getTableName())).findFirst();
             if(first.isPresent()) {
-                final List<String> list = insideInspectionCoreIndicatorsService.editColsHistory(id, first.get());
+                final List<String> list = insideInspectionCoreIndicatorsService.editSelfColsHistory(id, first.get());
                 editList.addAll(list);
             }
         }

+ 0 - 1
business-entity/src/main/java/com/rongwei/bsentity/dto/InsideInspectionOperBaseDto.java

@@ -1,6 +1,5 @@
 package com.rongwei.bsentity.dto;
 
-import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;

+ 26 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/inside/CheckerStagingInspectionRequest.java

@@ -0,0 +1,26 @@
+package com.rongwei.bsentity.dto.inside;
+
+import com.rongwei.bsentity.dto.InsideInspectionOperRequest;
+import com.rongwei.rwcommon.vo.generalsql.GeneralUpdateVo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.util.List;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@ApiModel("检验员暂存报验单参数")
+public class CheckerStagingInspectionRequest extends InsideInspectionOperRequest {
+
+    /**
+     * 核心检验指标
+     */
+    @ApiModelProperty("核心检验指标")
+    private List<GeneralUpdateVo> coreUpdateList;
+}

+ 11 - 3
business-entity/src/main/java/com/rongwei/bsentity/dto/inside/InsideInspectionExecuteRequest.java

@@ -1,16 +1,16 @@
 package com.rongwei.bsentity.dto.inside;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import com.rongwei.bsentity.dto.InsideInspectionOperBaseDto;
+import com.rongwei.rwcommon.vo.generalsql.GeneralUpdateVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
-import org.springframework.format.annotation.DateTimeFormat;
 
-import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 @Setter
 @Getter
@@ -67,4 +67,12 @@ public class InsideInspectionExecuteRequest extends InsideInspectionOperBaseDto
      */
     @ApiModelProperty("画布")
     private String canvas;
+
+    /**
+     * 核心检验指标
+     * key: 内部报验单id
+     * value 内部报验单下修改列表
+     */
+    @ApiModelProperty("核心检验指标")
+    private Map<String,List<GeneralUpdateVo>> coreMap;
 }

+ 14 - 2
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxInsideInspectionController.java

@@ -203,10 +203,22 @@ public class ZhcxInsideInspectionController {
         return R.ok();
     }
 
+    /**
+     * 修改-检验员暂存
+     *
+     * @param req
+     * @return
+     */
+    @ApiOperation("修改暂存内部报验")
+    @PostMapping("/updateCheckerStagingInspection")
+    public R updateCheckerStagingInspection(@RequestBody CheckerStagingInspectionRequest req){
+        service.saveCheckerStaging(req);
+        return R.ok();
+    }
+
     /**
      * 内部执行导入
-     * @param file
-     * @param request
+     * @param map
      */
     @PostMapping("/executeImport")
     @ResponseBody