Browse Source

更新ProjectNodeState表写入逻辑

sola 1 year ago
parent
commit
f6a59b8aef

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

@@ -1406,6 +1406,7 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
      * @param operType 操作类型 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 70:修改检验开始结束时间
      */
     private void saveResultToNodeState(ZhcxInsideInspectionDo itpDoPa, String operType) {
+        SysUserVo currUser = zhcxCommon.getCurrentUser();
         ZhcxInsideInspectionDo itpDo = getById(itpDoPa.getId());
 
         if("unitp".equals(itpDo.getLaunchtype())) {
@@ -1429,26 +1430,52 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
             ZhcxItpProjectNodeStateDo stateDo = itpProjectNodeStateService.getOne(queryWrapper);
 
             ZhcxItpProjectNodeStateDo entity = new ZhcxItpProjectNodeStateDo();
+
             if(ObjectUtil.isNull(stateDo)) {
                 entity.setId(SecurityUtil.getUUID());
                 entity.setMathinecode(mn);
                 entity.setPrjid(itpDo.getProjectid());
                 entity.setNodeid(itpDo.getInspectioncontentid());
                 entity.setDeleted("0");
-                entity.setInstate(operType);
                 entity.setIncompletetime(itpDoPa.getInspectioncomplatetime());
                 entity.setIntimes(itpDo.getInspectioncount());
                 entity.setCreatedate(new Date());
-                entity.setModifydate(new Date());
-//                itpProjectNodeStateService.save(entity);
+                entity.setCreateuserid(currUser.getId());
+                entity.setCreateusername(currUser.getName());
+                updateNodeState(entity, operType);
+                itpProjectNodeStateService.save(entity);
             } else {
-                stateDo.setInstate(operType);
                 stateDo.setIncompletetime(itpDoPa.getInspectioncomplatetime());
                 stateDo.setIntimes(itpDo.getInspectioncount());
-                stateDo.setModifydate(new Date());
-//                itpProjectNodeStateService.updateById(stateDo);
+                updateNodeState(stateDo, operType);
+                itpProjectNodeStateService.updateById(stateDo);
             }
         }
     }
 
+    private void updateNodeState(ZhcxItpProjectNodeStateDo entity, String operType) {
+        SysUserVo currUser = zhcxCommon.getCurrentUser();
+        entity.setModifydate(new Date());
+        entity.setModifyuserid(currUser.getId());
+        entity.setModifyusername(currUser.getName());
+        //取消
+        if("10".equals(operType)) {
+            entity.setInstate("40");
+        }
+        //拒收
+        if("20".equals(operType)) {
+            entity.setInstate("20");
+        }
+
+        //接收
+        if("50".equals(operType)) {
+            entity.setInstate("10");
+        }
+
+        //有条件接收
+        if ("60".equals(operType)) {
+            entity.setInstate("30");
+        }
+    }
+
 }

+ 4 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxItpProjectNodeStateServiceImpl.java

@@ -73,7 +73,10 @@ public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProje
                 dto.setSaveType("update");
             }
             entity.setOuttimes(itpDo.getInspectioncount());
-
+//取消
+            if("10".equals(operType)) {
+                entity.setOutstate("40");
+            }
             //拒收
             if("20".equals(operType)) {
                 entity.setOutstate("20");

+ 13 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxOutsideInspectionItpServiceImpl.java

@@ -317,6 +317,19 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
                 dispatchDo.setDispatchstatus("30");
                 inspectionItpDo.setInspectionstatus("40");
 
+                //添加项目各机号报验点状态
+                List<ZhcxItpProjectNodeStateResultDto> nodeStateResultList = zhcxItpProjectNodeStateService.getByItp(inspectionItpDo, "10");
+
+                if(ObjectUtil.isNotEmpty(nodeStateResultList)) {
+                    for(ZhcxItpProjectNodeStateResultDto resultDto : nodeStateResultList) {
+                        if("insert".equals(resultDto.getSaveType())) {
+                            insertNodeStateList.add(resultDto.getEntity());
+                        } else if("update".equals(resultDto.getSaveType())) {
+                            updateNodeStateList.add(resultDto.getEntity());
+                        }
+                    }
+                }
+
             }
             //拒收
             else if ("20".equals(operType)) {