ソースを参照

Merge remote-tracking branch 'origin/master'

zhuang 11 ヶ月 前
コミット
70bdf060b9
19 ファイル変更957 行追加94 行削除
  1. 16 0
      business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxItpProjectNodeStateInsideDao.java
  2. 16 0
      business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxItpProjectNodeStateOutsideDao.java
  3. 11 0
      business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxOutsideInspectionItpDao.java
  4. 16 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxItpProjectNodeStateInsideService.java
  5. 16 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxItpProjectNodeStateOutsideService.java
  6. 22 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxItpProjectNodeStateService.java
  7. 6 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxOutsideInspectionItpService.java
  8. 75 58
      business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionServiceImpl.java
  9. 20 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxItpProjectNodeStateInsideServiceImpl.java
  10. 20 0
      business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxItpProjectNodeStateOutsideServiceImpl.java
  11. 365 7
      business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxItpProjectNodeStateServiceImpl.java
  12. 50 29
      business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxOutsideInspectionItpServiceImpl.java
  13. 64 0
      business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxItpProjectNodeStateInsideDo.java
  14. 64 0
      business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxItpProjectNodeStateOutsideDo.java
  15. 36 0
      business-entity/src/main/java/com/rongwei/bsentity/dto/project/node/ProjectNodeStateBo.java
  16. 66 0
      business-entity/src/main/java/com/rongwei/bsentity/dto/project/node/RelactionNodeStateBo.java
  17. 26 0
      business-entity/src/main/java/com/rongwei/bsentity/dto/project/node/RelactionNodeStateInspectionBo.java
  18. 34 0
      business-entity/src/main/java/com/rongwei/bsentity/dto/project/node/RelationInspectionRequest.java
  19. 34 0
      business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxItpProjectNodeStateController.java

+ 16 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxItpProjectNodeStateInsideDao.java

@@ -0,0 +1,16 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateInsideDo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 项目各机号报验点状态-内部报验单 Mapper 接口
+ * </p>
+ *
+ * @author wm
+ * @since 2024-08-23
+ */
+public interface ZhcxItpProjectNodeStateInsideDao extends BaseMapper<ZhcxItpProjectNodeStateInsideDo> {
+
+}

+ 16 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxItpProjectNodeStateOutsideDao.java

@@ -0,0 +1,16 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateOutsideDo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 项目各机号报验点状态-外部报验单 Mapper 接口
+ * </p>
+ *
+ * @author wm
+ * @since 2024-08-23
+ */
+public interface ZhcxItpProjectNodeStateOutsideDao extends BaseMapper<ZhcxItpProjectNodeStateOutsideDo> {
+
+}

+ 11 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxOutsideInspectionItpDao.java

@@ -1,5 +1,6 @@
 package com.rongwei.bscommon.sys.dao;
 
+import com.alibaba.fastjson.JSONObject;
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.rongwei.bsentity.dto.OutsideInspactionSyncDto;
@@ -57,4 +58,14 @@ public interface ZhcxOutsideInspectionItpDao extends BaseMapper<ZhcxOutsideInspe
             "</where>" +
             "</script>")
     List<OutsideInspactionSyncDto> getInspection(OutsideInspactionSyncReqquest req);
+
+    @Select("SELECT " +
+            " itp.*, " +
+            " dis.INSPECTIONCONCLUSION " +
+            "FROM " +
+            " ZHCX_OUTSIDE_INSPECTION_ITP itp " +
+            "JOIN ZHCX_OUTSIDE_INSPECTION_ITP_SUPERVISION_DISPATCH dis ON dis.ITPID = itp.ID AND dis.DELETED = '0' " +
+            "WHERE itp.DELETED = '0' " +
+            "AND INSPECTIONSTATUS IN ('30', '40')")
+    List<JSONObject> getInitNodeStateInspection();
 }

+ 16 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxItpProjectNodeStateInsideService.java

@@ -0,0 +1,16 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateInsideDo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 项目各机号报验点状态-内部报验单 服务类
+ * </p>
+ *
+ * @author wm
+ * @since 2024-08-23
+ */
+public interface ZhcxItpProjectNodeStateInsideService extends IService<ZhcxItpProjectNodeStateInsideDo> {
+
+}

+ 16 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxItpProjectNodeStateOutsideService.java

@@ -0,0 +1,16 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateOutsideDo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 项目各机号报验点状态-外部报验单 服务类
+ * </p>
+ *
+ * @author wm
+ * @since 2024-08-23
+ */
+public interface ZhcxItpProjectNodeStateOutsideService extends IService<ZhcxItpProjectNodeStateOutsideDo> {
+
+}

+ 22 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxItpProjectNodeStateService.java

@@ -4,6 +4,8 @@ import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateDo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
 import com.rongwei.bsentity.dto.ZhcxItpProjectNodeStateResultDto;
+import com.rongwei.bsentity.dto.project.node.ProjectNodeStateBo;
+import com.rongwei.bsentity.dto.project.node.RelationInspectionRequest;
 
 import java.util.List;
 
@@ -25,4 +27,24 @@ public interface ZhcxItpProjectNodeStateService extends IService<ZhcxItpProjectN
      * @return
      */
     List<ZhcxItpProjectNodeStateResultDto> getByItp(ZhcxOutsideInspectionItpDo itpDo, String operType);
+
+    /**
+     * 保存报验点状态
+     *
+     * @param nodeStateBo
+     */
+    void saveNode(ProjectNodeStateBo nodeStateBo);
+
+    /**
+     * 关联报验单
+     *
+     * @param req
+     */
+    void relationInspection(RelationInspectionRequest req);
+
+    /**
+     * 初始化
+     *
+     */
+    void initRelationInspection();
 }

+ 6 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxOutsideInspectionItpService.java

@@ -1,5 +1,6 @@
 package com.rongwei.bscommon.sys.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
 import com.rongwei.bsentity.dto.OutsideInspactionSyncReqquest;
@@ -66,5 +67,10 @@ public interface ZhcxOutsideInspectionItpService extends IService<ZhcxOutsideIns
      * @param req
      */
     void sync2SubmissionPlatform(OutsideInspactionSyncReqquest req);
+
+    /**
+     * 获取初始化报验点状态报验单
+     */
+    List<JSONObject> getInitNodeStateInspection();
 }
 

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

@@ -20,6 +20,7 @@ import com.rongwei.bscommon.sys.dao.ZhcxInsideInspectionDao;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwei.bsentity.dto.*;
 import com.rongwei.bsentity.dto.inside.*;
+import com.rongwei.bsentity.dto.project.node.ProjectNodeStateBo;
 import com.rongwei.bsentity.vo.ZhcxInsideInspectionVo;
 import com.rongwei.commonservice.serial.service.SysSerialNumberService;
 import com.rongwei.rwadmincommon.system.domain.SysRoleDo;
@@ -47,7 +48,6 @@ import java.io.*;
 import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -227,11 +227,18 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         List<ZhcxInsideInspectionDispatchDo> dispatchList = new ArrayList<>();
         List<ZhcxInsideInspectionDo> inspectionList = new ArrayList<>();
         List<NotifyDto> notifyList = new ArrayList<>();
+        ProjectNodeStateBo nodeStateBo  = ProjectNodeStateBo.builder()
+                .insertList(new ArrayList<>())
+                .updateList(new ArrayList<>())
+                .insideStateList(new ArrayList<>())
+                .build();
+
 
         for(String insideId : req.getInsideIdList()) {
             InsideOperDto inOper = getInsideOperDto(insideId);
             inOper.setOperTime(operDto.getOperTime());
             inOper.setOperUser(operDto.getOperUser());
+            inOper.setOperType(operDto.getOperType());
 
             //校验
             String msg = checkParam4Cancel(inOper, req);
@@ -287,6 +294,8 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
 
             NotifyDto notify = getMailInfo4Cancel(inOper, req);
             notifyList.add(notify);
+
+            assembleResultToNodeState(inOper, nodeStateBo, null);
         }
 
         if(ObjectUtil.isNotEmpty(msgList)) {
@@ -304,10 +313,8 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         //发送提醒
         zhcxCommon.sendMsg(notifyList);
 
-        // 写入ZHCX_ITP_PROJECT_NODE_STATE表
-        for (ZhcxInsideInspectionDo row : inspectionList) {
-            saveResultToNodeState(row, "10");
-        }
+        //保存报验点状态
+        itpProjectNodeStateService.saveNode(nodeStateBo);
     }
 
     /**
@@ -677,21 +684,17 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
             throw  new CustomException("请联系管理员,暂无报验单");
         }
         // 20: 拒收 50: 接收 60: 有条件接收
-        String es = "";
         OperDto operDto;
         //接收
         if("10".equals(req.getConclusion())) {
-            es = "50";
             operDto = getOper("50");
         }
         //拒收
         else if("20".equals(req.getConclusion())) {
-            es = "20";
             operDto = getOper("20");
         }
         //有条件接收
         else if("30".equals(req.getConclusion())) {
-            es = "60";
             operDto = getOper("60");
         }
         else {
@@ -701,11 +704,17 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         List<String> msgList = new ArrayList<>();
         List<ZhcxInsideInspectionDispatchDo> dispatchList = new ArrayList<>();
         List<ZhcxInsideInspectionDo> inspectionList = new ArrayList<>();
+        ProjectNodeStateBo nodeStateBo  = ProjectNodeStateBo.builder()
+                .insertList(new ArrayList<>())
+                .updateList(new ArrayList<>())
+                .insideStateList(new ArrayList<>())
+                .build();
 
         for(String insideId : req.getInsideIdList()) {
             InsideOperDto inOper = getInsideOperDto(insideId);
             inOper.setOperTime(operDto.getOperTime());
             inOper.setOperUser(operDto.getOperUser());
+            inOper.setOperType(operDto.getOperType());
 //            if (ObjectUtil.isEmpty(inOper.getDispatch().getSupervisionid())) {
 //                log.info("单据号:".concat(inOper.getInspection().getInspectioncode()).concat("未派单,现将主表检验员覆盖到派单表上"));
 //                inOper.getDispatch().setSupervisionid(inOper.getInspection().getCheckerid());
@@ -754,6 +763,9 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
                 inspection.setInspectioncomplatetime(new Date());
             }
             inspectionList.add(inspection);
+
+            //报验点状态
+            assembleResultToNodeState(inOper, nodeStateBo, inspection.getInspectioncomplatetime());
         }
 
         if(ObjectUtil.isNotEmpty(msgList)) {
@@ -772,10 +784,8 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
             operLogService.saveOperLog(req, operDto, Collections.emptyMap());
         }
 
-        // 写入ZHCX_ITP_PROJECT_NODE_STATE表
-        for (ZhcxInsideInspectionDo row : inspectionList) {
-            saveResultToNodeState(row, es);
-        }
+        //保存报验点状态
+        itpProjectNodeStateService.saveNode(nodeStateBo);
     }
 
     /**
@@ -1585,25 +1595,23 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
 
     /**
      * 保存数据到ZHCX_ITP_PROJECT_NODE_STATE(项目各机号报验点状态)表
-     * @param operType 操作类型 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 70:修改检验开始结束时间
+     * 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(!"itp".equals(itpDo.getLaunchtype())) {
+    private void assembleResultToNodeState(InsideOperDto inOper, ProjectNodeStateBo nodeStateBo, Date complateTime) {
+        if(!"itp".equals(inOper.getInspection().getLaunchtype())) {
             return;
         }
-        String machineNo = itpDo.getMachineno();
+        ZhcxInsideInspectionDo itpDo = inOper.getInspection();
+
+        String machineNo = inOper.getInspection().getMachineno();
         if (StringUtils.isBlank(machineNo)) {
-            machineNo = itpDo.getStructuremachineno();
+            machineNo = inOper.getInspection().getStructuremachineno();
         }
         if (StringUtils.isBlank(machineNo)) {
             log.error("{}-{}:总装机号和结构机号都没有", itpDo.getId(), itpDo.getInspectioncode());
             return;
         }
         String[] machinenos = machineNo.split(",");
-        List<ZhcxItpProjectNodeStateResultDto> list = new ArrayList<>(machinenos.length);
         for (String mn : machinenos) {
             LambdaQueryWrapper<ZhcxItpProjectNodeStateDo> queryWrapper = Wrappers.lambdaQuery();
             queryWrapper.eq(ZhcxItpProjectNodeStateDo::getPrjid, itpDo.getProjectid())
@@ -1619,65 +1627,74 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
                 stateDo.setPrjid(itpDo.getProjectid());
                 stateDo.setNodeid(itpDo.getInspectioncontentid());
                 stateDo.setDeleted("0");
-//                entity.setIncompletetime(itpDoPa.getInspectioncomplatetime());
 
-                //接收
-                if("50".equals(operType)) {
-                    stateDo.setIncompletetime(itpDoPa.getInspectioncomplatetime());
-                }
-                //有条件接收
-                else if ("60".equals(operType)) {
-                    stateDo.setIncompletetime(itpDoPa.getInspectioncomplatetime());
-                }
+                stateDo.setCreatedate(inOper.getOperTime());
+                stateDo.setCreateuserid(inOper.getOperUser().getId());
+                stateDo.setCreateusername(inOper.getOperUser().getName());
+//                entity.setIncompletetime(itpDoPa.getInspectioncomplatetime());
+                assembleUpdateNodeState(stateDo, inOper, complateTime);
 
-                stateDo.setIntimes(itpDo.getInspectioncount());
-                stateDo.setCreatedate(new Date());
-                stateDo.setCreateuserid(currUser.getId());
-                stateDo.setCreateusername(currUser.getName());
-                updateNodeState(stateDo, operType);
-                itpProjectNodeStateService.save(stateDo);
+                nodeStateBo.getInsertList().add(stateDo);
             } else {
 //                stateDo.setIncompletetime(itpDoPa.getInspectioncomplatetime());
+                assembleUpdateNodeState(stateDo, inOper, complateTime);
 
-                //接收
-                if("50".equals(operType)) {
-                    stateDo.setIncompletetime(itpDoPa.getInspectioncomplatetime());
-                }
-                //有条件接收
-                else if ("60".equals(operType)) {
-                    stateDo.setIncompletetime(itpDoPa.getInspectioncomplatetime());
-                }
-
-                stateDo.setIntimes(itpDo.getInspectioncount());
-                updateNodeState(stateDo, operType);
-                itpProjectNodeStateService.updateById(stateDo);
+                nodeStateBo.getUpdateList().add(stateDo);
             }
+
+            // 报验点-内部报验单
+            ZhcxItpProjectNodeStateInsideDo stateInside = new ZhcxItpProjectNodeStateInsideDo();
+            stateInside.setId(SecurityUtil.getUUID());
+            stateInside.setDeleted("0");
+            stateInside.setInsideid(itpDo.getId());
+            stateInside.setStateid(stateDo.getId());
+            stateInside.setInspectioncode(itpDo.getInspectioncode());
+            stateInside.setLaunchtype(itpDo.getLaunchtype());
+            stateInside.setStateid(stateDo.getId());
+            nodeStateBo.getInsideStateList().add(stateInside);
         }
     }
 
-    private void updateNodeState(ZhcxItpProjectNodeStateDo entity, String operType) {
-        SysUserVo currUser = zhcxCommon.getCurrentUser();
-        entity.setModifydate(new Date());
-        entity.setModifyuserid(currUser.getId());
-        entity.setModifyusername(currUser.getName());
+    /**
+     * 组装
+     *
+     * @param entity
+     * @param inOper
+     * @param complateTime
+     */
+    private void assembleUpdateNodeState(ZhcxItpProjectNodeStateDo entity, InsideOperDto inOper, Date complateTime) {
+        entity.setModifydate(inOper.getOperTime());
+        entity.setModifyuserid(inOper.getOperUser().getId());
+        entity.setModifyusername(inOper.getOperUser().getName());
         //取消
-        if("10".equals(operType)) {
+        if("10".equals(inOper.getOperType())) {
             entity.setInstate("40");
         }
         //拒收
-        if("20".equals(operType)) {
+        if("20".equals(inOper.getOperType())) {
             entity.setInstate("20");
         }
 
         //接收
-        if("50".equals(operType)) {
+        if("50".equals(inOper.getOperType())) {
             entity.setInstate("10");
         }
 
         //有条件接收
-        if ("60".equals(operType)) {
+        if ("60".equals(inOper.getOperType())) {
             entity.setInstate("30");
         }
+
+        //接收
+        if("50".equals(inOper.getOperType())) {
+            entity.setIncompletetime(complateTime);
+        }
+        //有条件接收
+        else if ("60".equals(inOper.getOperType())) {
+            entity.setIncompletetime(complateTime);
+        }
+
+        entity.setIntimes(inOper.getInspection().getInspectioncount());
     }
 
 }

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

@@ -0,0 +1,20 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateInsideDo;
+import com.rongwei.bscommon.sys.dao.ZhcxItpProjectNodeStateInsideDao;
+import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodeStateInsideService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 项目各机号报验点状态-内部报验单 服务实现类
+ * </p>
+ *
+ * @author wm
+ * @since 2024-08-23
+ */
+@Service
+public class ZhcxItpProjectNodeStateInsideServiceImpl extends ServiceImpl<ZhcxItpProjectNodeStateInsideDao, ZhcxItpProjectNodeStateInsideDo> implements ZhcxItpProjectNodeStateInsideService {
+
+}

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

@@ -0,0 +1,20 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateOutsideDo;
+import com.rongwei.bscommon.sys.dao.ZhcxItpProjectNodeStateOutsideDao;
+import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodeStateOutsideService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 项目各机号报验点状态-外部报验单 服务实现类
+ * </p>
+ *
+ * @author wm
+ * @since 2024-08-23
+ */
+@Service
+public class ZhcxItpProjectNodeStateOutsideServiceImpl extends ServiceImpl<ZhcxItpProjectNodeStateOutsideDao, ZhcxItpProjectNodeStateOutsideDo> implements ZhcxItpProjectNodeStateOutsideService {
+
+}

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

@@ -3,20 +3,24 @@ package com.rongwei.bscommon.sys.service.impl;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.rongwei.bscommon.sys.service.*;
 import com.rongwei.bscommon.sys.utils.BusinessFunUtils;
-import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateDo;
+import com.rongwei.bscommon.sys.utils.ZhcxCommon;
+import com.rongwei.bsentity.domain.*;
 import com.rongwei.bscommon.sys.dao.ZhcxItpProjectNodeStateDao;
-import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodeStateService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
+import com.rongwei.bsentity.dto.OperDto;
 import com.rongwei.bsentity.dto.ZhcxItpProjectNodeStateResultDto;
+import com.rongwei.bsentity.dto.project.node.ProjectNodeStateBo;
+import com.rongwei.bsentity.dto.project.node.RelactionNodeStateBo;
+import com.rongwei.bsentity.dto.project.node.RelactionNodeStateInspectionBo;
+import com.rongwei.bsentity.dto.project.node.RelationInspectionRequest;
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.utils.SecurityUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
+import java.util.*;
 
 /**
  * <p>
@@ -29,6 +33,27 @@ import java.util.stream.Collectors;
 @Service
 public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProjectNodeStateDao, ZhcxItpProjectNodeStateDo> implements ZhcxItpProjectNodeStateService {
 
+    @Autowired
+    private ZhcxItpProjectNodeStateOutsideService nodeStateOutsideService;
+
+    @Autowired
+    private ZhcxItpProjectNodeStateInsideService nodeStateInsideService;
+
+    @Autowired
+    private ZhcxOutsideInspectionItpService outsideInspectionItpService;
+
+    @Autowired
+    private ZhcxOutsideInspectionItpSupervisionDispatchService outsideInspectionItpSupervisionDispatchService;
+
+    @Autowired
+    private ZhcxInsideInspectionService insideInspectionService;
+
+    @Autowired
+    private ZhcxInsideInspectionDispatchService insideInspectionDispatchService;
+
+    @Autowired
+    private ZhcxCommon zhcxCommon;
+
     /**
      * 获取项目各机号报验点状态
      *
@@ -104,6 +129,311 @@ public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProje
         return list;
     }
 
+    /**
+     * 保存报验点状态
+     *
+     * @param nodeStateBo
+     */
+    @Override
+    public void saveNode(ProjectNodeStateBo nodeStateBo) {
+        //添加项目各机号报验点状态
+        if(ObjectUtil.isNotEmpty(nodeStateBo.getInsertList())) {
+            saveBatch(nodeStateBo.getInsertList());
+        }
+        if(ObjectUtil.isNotEmpty(nodeStateBo.getUpdateList())) {
+            updateBatchById(nodeStateBo.getUpdateList());
+        }
+        if(ObjectUtil.isNotEmpty(nodeStateBo.getOutsideStateList())) {
+            nodeStateOutsideService.saveBatch(nodeStateBo.getOutsideStateList());
+        }
+
+        if(ObjectUtil.isNotEmpty(nodeStateBo.getInsideStateList())) {
+            nodeStateInsideService.saveBatch(nodeStateBo.getInsideStateList());
+        }
+    }
+
+    /**
+     * 关联报验单
+     *
+     * @param req
+     */
+    @Override
+    public void relationInspection(RelationInspectionRequest req) {
+        List<RelactionNodeStateBo> stateBoList = null;
+        if("outside".equals(req.getType())) {
+            stateBoList = assembleRelationByOutside(req);
+        } else if("inside".equals(req.getType())) {
+            stateBoList = assembleRelationByInside(req);
+        }
+
+        SysUserVo user = zhcxCommon.getCurrentUser();
+
+        OperDto oper = new OperDto();
+        oper.setOperTime(new Date());
+        oper.setOperUser(user);
+
+        //保存关联关系
+        relationInspection(stateBoList, oper);
+    }
+
+    /**
+     * 初始化
+     *
+     */
+    @Override
+    public void initRelationInspection() {
+        //外部报验单
+
+        //内部报验单
+    }
+
+    /**
+     * 保存外部报验单
+     */
+    private void saveNodeStatusOutside() {
+
+    }
+
+    /**
+     * 组装内部报验单参数
+     *
+     * @param req
+     * @return
+     */
+    private List<RelactionNodeStateBo> assembleRelationByInside(RelationInspectionRequest req) {
+
+        //外部报验单
+        Collection<ZhcxInsideInspectionDo> insideList = insideInspectionService.listByIds(req.getSideIdList());
+
+        if(ObjectUtil.isEmpty(insideList)) {
+            return Collections.emptyList();
+        }
+
+        List<RelactionNodeStateBo> result = new ArrayList<>();
+
+        List<String> machineNoList = new ArrayList<>();
+        machineNoList.addAll(splitMachineNo(req.getMachineNo()));
+
+        //外部报验单
+        for(ZhcxInsideInspectionDo inside : insideList) {
+            String machineNos = getMachinesNoByInside(inside);
+            machineNoList.addAll(splitMachineNo(machineNos));
+
+            machineNoList = new ArrayList<>(new HashSet<>(machineNoList));
+
+            ZhcxInsideInspectionDispatchDo dispatchDo = null;
+            if(!"40".equals(inside.getInspectionstatus())) {
+                LambdaQueryWrapper<ZhcxInsideInspectionDispatchDo> queryWrapper = Wrappers.lambdaQuery();
+                queryWrapper.eq(ZhcxInsideInspectionDispatchDo::getDeleted, "0")
+                        .eq(ZhcxInsideInspectionDispatchDo::getInsideid, inside.getId());
+                dispatchDo = insideInspectionDispatchService.getOne(queryWrapper);
+            }
+
+            //机号
+            for(String machineNo : machineNoList) {
+                RelactionNodeStateBo nodeStateBo = RelactionNodeStateBo.builder()
+                        .machineNo(machineNo)
+                        .projectId(inside.getProjectid())
+                        .projectCode(inside.getProjectcode())
+                        .projectName(inside.getProjectname())
+                        .nodeId(req.getNodeId())
+                        .inspectionCount(inside.getInspectioncount())
+                        .complateTime(inside.getInspectioncomplatetime())
+                        .type("inside")
+                        .build();
+
+                if("40".equals(inside.getInspectionstatus())) {
+                    nodeStateBo.setConclusion("40");
+                } else {
+                    nodeStateBo.setConclusion(dispatchDo.getInspectionconclusion());
+                }
+
+                List<RelactionNodeStateInspectionBo> inspectionList = new ArrayList<>(1);
+                inspectionList.add(RelactionNodeStateInspectionBo.builder()
+                        .inspectionCode(inside.getInspectioncode())
+                        .inspectionId(inside.getId())
+                        .launchType(inside.getLaunchtype())
+                        .build());
+                nodeStateBo.setInspectionList(inspectionList);
+
+                result.add(nodeStateBo);
+            }
+
+        }
+
+        return result;
+    }
+
+    /**
+     * 组装外部报验单参数
+     *
+     * @param req
+     * @return
+     */
+    private List<RelactionNodeStateBo> assembleRelationByOutside(RelationInspectionRequest req) {
+
+        //外部报验单
+        Collection<ZhcxOutsideInspectionItpDo> outsideList = outsideInspectionItpService.listByIds(req.getSideIdList());
+
+        if(ObjectUtil.isEmpty(outsideList)) {
+            return Collections.emptyList();
+        }
+
+        List<RelactionNodeStateBo> result = new ArrayList<>();
+
+        List<String> machineNoList = new ArrayList<>();
+        machineNoList.addAll(splitMachineNo(req.getMachineNo()));
+
+        //外部报验单
+        for(ZhcxOutsideInspectionItpDo outside : outsideList) {
+            String machineNos = getMachinesNoByItp(outside);
+            machineNoList.addAll(splitMachineNo(machineNos));
+
+            ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = null;
+            if(!"40".equals(outside.getInspectionstatus())) {
+                LambdaQueryWrapper<ZhcxOutsideInspectionItpSupervisionDispatchDo> queryWrapper = Wrappers.lambdaQuery();
+                queryWrapper.eq(ZhcxOutsideInspectionItpSupervisionDispatchDo::getDeleted, "0")
+                        .eq(ZhcxOutsideInspectionItpSupervisionDispatchDo::getItpid, outside.getId());
+                dispatchDo = outsideInspectionItpSupervisionDispatchService.getOne(queryWrapper);
+            }
+
+            //机号
+            for(String machineNo : machineNoList) {
+                RelactionNodeStateBo nodeStateBo = RelactionNodeStateBo.builder()
+                        .machineNo(machineNo)
+                        .projectId(outside.getProjectid())
+                        .projectCode(outside.getProjectcode())
+                        .projectName(outside.getProjectname())
+                        .nodeId(req.getNodeId())
+                        .inspectionCount(outside.getInspectioncount())
+                        .complateTime(outside.getInspectioncomplatetime())
+                        .type("outside")
+                        .build();
+
+                if("40".equals(outside.getInspectionstatus())) {
+                    nodeStateBo.setConclusion("40");
+                } else {
+                    nodeStateBo.setConclusion(dispatchDo.getInspectionconclusion());
+                }
+
+                List<RelactionNodeStateInspectionBo> inspectionList = new ArrayList<>(1);
+                inspectionList.add(RelactionNodeStateInspectionBo.builder()
+                        .inspectionCode(outside.getInspectioncode())
+                        .inspectionId(outside.getId())
+                        .launchType(outside.getLaunchtype())
+                        .build());
+                nodeStateBo.setInspectionList(inspectionList);
+
+                result.add(nodeStateBo);
+            }
+
+        }
+
+        return result;
+    }
+
+    /**
+     * 关联报验单
+     *
+     * @param list
+     * @param oper
+     */
+    private void relationInspection(List<RelactionNodeStateBo> list, OperDto oper) {
+        if(ObjectUtil.isEmpty(list)) {
+            return ;
+        }
+
+        ProjectNodeStateBo prjNodeState = ProjectNodeStateBo.builder()
+                .insertList(new ArrayList<>())
+                .updateList(new ArrayList<>())
+                .insideStateList(new ArrayList<>())
+                .outsideStateList(new ArrayList<>())
+                .build();
+        for(RelactionNodeStateBo state : list) {
+            LambdaQueryWrapper<ZhcxItpProjectNodeStateDo> queryWrapper = Wrappers.lambdaQuery();
+            queryWrapper.eq(ZhcxItpProjectNodeStateDo::getPrjid, state.getProjectId())
+                    .eq(ZhcxItpProjectNodeStateDo::getMathinecode, state.getMachineNo())
+                    .eq(ZhcxItpProjectNodeStateDo::getNodeid, state.getNodeId());
+            List<ZhcxItpProjectNodeStateDo> stateList = list(queryWrapper);
+            ZhcxItpProjectNodeStateDo stateDo = BusinessFunUtils.getPrjNodeState(stateList);
+
+            ZhcxItpProjectNodeStateDo entity = new ZhcxItpProjectNodeStateDo();
+            //内部报验单
+            if("inside".equals(state.getType())) {
+                entity.setIntimes(state.getInspectionCount());
+                entity.setInstate(state.getConclusion());
+
+                if("10".equals(state.getConclusion()) || "30".equals(state.getConclusion())) {
+                    entity.setIncompletetime(state.getComplateTime());
+                }
+            }
+            //外部
+            else {
+                entity.setOuttimes(state.getInspectionCount());
+                entity.setOutstate(state.getConclusion());
+
+                if("10".equals(state.getConclusion()) || "30".equals(state.getConclusion())) {
+                    entity.setOutcompletetime(state.getComplateTime());
+                }
+            }
+
+            if(ObjectUtil.isNull(stateDo)) {
+                entity.setId(SecurityUtil.getUUID());
+                entity.setMathinecode(state.getMachineNo());
+                entity.setPrjid(state.getProjectId());
+                entity.setNodeid(state.getNodeId());
+                entity.setDeleted("0");
+                prjNodeState.getInsertList().add(entity);
+            } else {
+                entity.setId(stateDo.getId());
+                prjNodeState.getUpdateList().add(entity);
+            }
+
+            if("inside".equals(state.getType())) {
+                //内部报验报验点明细
+                for(RelactionNodeStateInspectionBo nodeInspection : state.getInspectionList()) {
+                    //同一个报验点,只能存一份
+                    LambdaQueryWrapper<ZhcxItpProjectNodeStateInsideDo> delWrapper = Wrappers.lambdaQuery();
+                    delWrapper.eq(ZhcxItpProjectNodeStateInsideDo::getInsideid, nodeInspection.getInspectionId())
+                            .eq(ZhcxItpProjectNodeStateInsideDo::getStateid, entity.getId());
+                    nodeStateInsideService.remove(delWrapper);
+
+                    ZhcxItpProjectNodeStateInsideDo insideState = new ZhcxItpProjectNodeStateInsideDo();
+                    insideState.setId(SecurityUtil.getUUID());
+                    insideState.setInspectioncode(nodeInspection.getInspectionCode());
+                    insideState.setLaunchtype(nodeInspection.getLaunchType());
+                    insideState.setDeleted("0");
+                    insideState.setStateid(entity.getId());
+                    insideState.setInsideid(nodeInspection.getInspectionId());
+
+                    prjNodeState.getInsideStateList().add(insideState);
+                }
+            } else {
+                //外部报验报验点明细
+                for(RelactionNodeStateInspectionBo nodeInspection : state.getInspectionList()) {
+                    //同一个报验点,只能存一份
+                    LambdaQueryWrapper<ZhcxItpProjectNodeStateOutsideDo> delWrapper = Wrappers.lambdaQuery();
+                    delWrapper.eq(ZhcxItpProjectNodeStateOutsideDo::getOutsideid, nodeInspection.getInspectionId())
+                            .eq(ZhcxItpProjectNodeStateOutsideDo::getStateid, entity.getId());
+                    nodeStateOutsideService.remove(delWrapper);
+
+                    ZhcxItpProjectNodeStateOutsideDo outsideState = new ZhcxItpProjectNodeStateOutsideDo();
+                    outsideState.setId(SecurityUtil.getUUID());
+                    outsideState.setInspectioncode(nodeInspection.getInspectionCode());
+                    outsideState.setLaunchtype(nodeInspection.getLaunchType());
+                    outsideState.setDeleted("0");
+                    outsideState.setStateid(entity.getId());
+                    outsideState.setOutsideid(nodeInspection.getInspectionId());
+
+                    prjNodeState.getOutsideStateList().add(outsideState);
+                }
+            }
+        }
+
+        //持久化
+        saveNode(prjNodeState);
+    }
+
     /**
      * 选择机号
      *
@@ -117,4 +447,32 @@ public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProje
 
         return itpDo.getStructuremachineno();
     }
+
+    /**
+     * 选择机号
+     *
+     * @param itpDo
+     * @return
+     */
+    private String getMachinesNoByInside(ZhcxInsideInspectionDo itpDo) {
+        if(ObjectUtil.isNotEmpty(itpDo.getMachineno())) {
+            return itpDo.getMachineno();
+        }
+
+        return itpDo.getStructuremachineno();
+    }
+
+    /**
+     * 拆分机号
+     *
+     * @param machineNo
+     * @return
+     */
+    private List<String> splitMachineNo(String machineNo) {
+        if(ObjectUtil.isEmpty(machineNo)) {
+            return Collections.emptyList();
+        }
+
+        return Arrays.asList(machineNo.split(","));
+    }
 }

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

@@ -8,6 +8,7 @@ import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.ZipUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -21,6 +22,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwei.bsentity.dto.*;
 import com.rongwei.bsentity.dto.outside.OutsideInspectionInsertRequest;
 import com.rongwei.bsentity.dto.outside.OutsideInspectionUpdateRequest;
+import com.rongwei.bsentity.dto.project.node.ProjectNodeStateBo;
 import com.rongwei.bsentity.vo.*;
 import com.rongwei.commonservice.serial.service.SysSerialNumberService;
 import com.rongwei.rwadmincommon.system.service.SysGeneralCRUDService;
@@ -229,10 +231,13 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
 //                hasJjyRole = true;
 //            }
 //        }
+        ProjectNodeStateBo nodeStateBo  = ProjectNodeStateBo.builder()
+                .insertList(new ArrayList<>())
+                .updateList(new ArrayList<>())
+                .outsideStateList(new ArrayList<>())
+                .build();
 
         List<ZhcxOutsideInspectionItpOperLogDo> logList = new ArrayList<>();
-        List<ZhcxItpProjectNodeStateDo> insertNodeStateList = new ArrayList<>();
-        List<ZhcxItpProjectNodeStateDo> updateNodeStateList = new ArrayList<>();
         Date nowDate = new Date();
 
         for(int i =0;i<vo.size();i++){
@@ -325,16 +330,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
 
                 //添加项目各机号报验点状态
                 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());
-                        }
-                    }
-                }
+                assembleNodeState(nodeStateResultList, inspectionItpDo, nodeStateBo);
 
             }
             //拒收
@@ -412,16 +408,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
 
                 //添加项目各机号报验点状态
                 List<ZhcxItpProjectNodeStateResultDto> nodeStateResultList = zhcxItpProjectNodeStateService.getByItp(inspectionItpDo, operType);
-
-                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());
-                        }
-                    }
-                }
+                assembleNodeState(nodeStateResultList, inspectionItpDo, nodeStateBo);
 
             }
             /* 当前操作人 */
@@ -467,13 +454,8 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         //发送提醒
         zhcxCommon.sendMsg(notifyDtoList);
 
-        //添加项目各机号报验点状态
-        if(ObjectUtil.isNotEmpty(insertNodeStateList)) {
-            zhcxItpProjectNodeStateService.saveBatch(insertNodeStateList);
-        }
-        if(ObjectUtil.isNotEmpty(updateNodeStateList)) {
-            zhcxItpProjectNodeStateService.updateBatchById(updateNodeStateList);
-        }
+        //保存节点状态
+        zhcxItpProjectNodeStateService.saveNode(nodeStateBo);
 
         //操作记录
         zhcxOutsideInspectionItpOperLogService.saveBatch(logList);
@@ -523,6 +505,37 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         saveReNewItp(itpDo, dispatchDo, masterSlaveUpdate);
     }
 
+    /**
+     * 组装数据
+     *
+     * @param nodeStateResultList
+     * @param inspectionItpDo
+     * @param nodeStateBo
+     */
+    private void assembleNodeState(List<ZhcxItpProjectNodeStateResultDto> nodeStateResultList, ZhcxOutsideInspectionItpDo inspectionItpDo, ProjectNodeStateBo nodeStateBo) {
+        if(ObjectUtil.isEmpty(nodeStateResultList)) {
+            return ;
+        }
+
+        for(ZhcxItpProjectNodeStateResultDto resultDto : nodeStateResultList) {
+            if("insert".equals(resultDto.getSaveType())) {
+                nodeStateBo.getInsertList().add(resultDto.getEntity());
+            } else if("update".equals(resultDto.getSaveType())) {
+                nodeStateBo.getUpdateList().add(resultDto.getEntity());
+            }
+
+            ZhcxItpProjectNodeStateOutsideDo outsideState = new ZhcxItpProjectNodeStateOutsideDo();
+            outsideState.setId(SecurityUtil.getUUID());
+            outsideState.setInspectioncode(inspectionItpDo.getInspectioncode());
+            outsideState.setLaunchtype(inspectionItpDo.getLaunchtype());
+            outsideState.setDeleted("0");
+            outsideState.setStateid(resultDto.getEntity().getId());
+            outsideState.setOutsideid(inspectionItpDo.getId());
+
+            nodeStateBo.getOutsideStateList().add(outsideState);
+        }
+    }
+
     /**
      * 保存修改历史记录
      *
@@ -1236,6 +1249,14 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         syncRecordService.saveBatch(recordList);
     }
 
+    /**
+     * 获取初始化报验点状态报验单
+     */
+    @Override
+    public List<JSONObject> getInitNodeStateInspection() {
+        return dao.getInitNodeStateInspection();
+    }
+
     private void getIds(String files, List<String> fileIds) {
         String[] split = files.split("\\^_\\^");
         for(String fileItem : split){

+ 64 - 0
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxItpProjectNodeStateInsideDo.java

@@ -0,0 +1,64 @@
+package com.rongwei.bsentity.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 项目各机号报验点状态-内部报验单
+ * </p>
+ *
+ * @author wm
+ * @since 2024-08-23
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("ZHCX_ITP_PROJECT_NODE_STATE_INSIDE")
+public class ZhcxItpProjectNodeStateInsideDo extends BaseDo {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableField("ID")
+    private String id;
+    /**
+     * 租户ID
+     */
+    @TableField("TENANTID")
+    private String tenantid;
+    /**
+     * 扩展预留
+     */
+    @TableField("ROPTION")
+    private String roption;
+    /**
+     * 状态ID
+     */
+    @TableField("STATEID")
+    private String stateid;
+    /**
+     * 内部报验单ID
+     */
+    @TableField("INSIDEID")
+    private String insideid;
+    /**
+     * 发起类型(itp、unitp)
+     */
+    @TableField("LAUNCHTYPE")
+    private String launchtype;
+    /**
+     * 报验单号
+     */
+    @TableField("INSPECTIONCODE")
+    private String inspectioncode;
+
+
+}

+ 64 - 0
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxItpProjectNodeStateOutsideDo.java

@@ -0,0 +1,64 @@
+package com.rongwei.bsentity.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 项目各机号报验点状态-外部报验单
+ * </p>
+ *
+ * @author wm
+ * @since 2024-08-23
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("ZHCX_ITP_PROJECT_NODE_STATE_OUTSIDE")
+public class ZhcxItpProjectNodeStateOutsideDo extends BaseDo {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableField("ID")
+    private String id;
+    /**
+     * 租户ID
+     */
+    @TableField("TENANTID")
+    private String tenantid;
+    /**
+     * 扩展预留
+     */
+    @TableField("ROPTION")
+    private String roption;
+    /**
+     * 状态ID
+     */
+    @TableField("STATEID")
+    private String stateid;
+    /**
+     * 外部报验单ID
+     */
+    @TableField("OUTSIDEID")
+    private String outsideid;
+    /**
+     * 发起类型(itp、unitp)
+     */
+    @TableField("LAUNCHTYPE")
+    private String launchtype;
+    /**
+     * 报验单号
+     */
+    @TableField("INSPECTIONCODE")
+    private String inspectioncode;
+
+
+}

+ 36 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/project/node/ProjectNodeStateBo.java

@@ -0,0 +1,36 @@
+package com.rongwei.bsentity.dto.project.node;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateDo;
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateInsideDo;
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateOutsideDo;
+import lombok.*;
+
+import java.util.List;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class ProjectNodeStateBo {
+
+    /**
+     * insert点
+     */
+    private List<ZhcxItpProjectNodeStateDo> insertList;
+
+    /**
+     * update点
+     */
+    private List<ZhcxItpProjectNodeStateDo> updateList;
+
+    /**
+     * 外部报验点
+     */
+    private List<ZhcxItpProjectNodeStateOutsideDo> outsideStateList;
+
+    /**
+     * 外部报验单
+     */
+    private List<ZhcxItpProjectNodeStateInsideDo> insideStateList;
+}

+ 66 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/project/node/RelactionNodeStateBo.java

@@ -0,0 +1,66 @@
+package com.rongwei.bsentity.dto.project.node;
+
+import lombok.*;
+
+import java.util.Date;
+import java.util.List;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class RelactionNodeStateBo {
+
+    /**
+     * 项目id
+     */
+    private String projectId;
+
+    /**
+     * 编码
+     */
+    private String projectCode;
+
+    /**
+     * 名称
+     */
+    private String projectName;
+
+    /**
+     * 项目报验点id
+     */
+    private String nodeId;
+
+    /**
+     * 机号
+     */
+    private String machineNo;
+
+    /**
+     * 类型:40:取消,10:接收,20:拒收,30:有条件接收,
+     */
+    private String conclusion;
+
+    /**
+     * 报验次数
+     */
+    private Integer inspectionCount;
+
+    /**
+     * 报验完成时间
+     */
+    private Date complateTime;
+
+    /**
+     * 报验单类型
+     * inside: 内部
+     * outside: 外部
+     */
+    private String type;
+
+    /**
+     * 报验单列表
+     */
+    private List<RelactionNodeStateInspectionBo> inspectionList;
+}

+ 26 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/project/node/RelactionNodeStateInspectionBo.java

@@ -0,0 +1,26 @@
+package com.rongwei.bsentity.dto.project.node;
+
+import lombok.*;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class RelactionNodeStateInspectionBo {
+
+    /**
+     * 报验单id
+     */
+    private String inspectionId;
+
+    /**
+     * 报验单编码
+     */
+    private String inspectionCode;
+
+    /**
+     * 报验单发起类型
+     */
+    private String launchType;
+}

+ 34 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/project/node/RelationInspectionRequest.java

@@ -0,0 +1,34 @@
+package com.rongwei.bsentity.dto.project.node;
+
+import lombok.*;
+
+import java.util.List;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class RelationInspectionRequest {
+
+    /**
+     * 报验单id
+     */
+    private List<String> sideIdList;
+
+    /**
+     * inside: 内部
+     * outside: 外部
+     */
+    private String type;
+
+    /**
+     * 项目报验点id
+     */
+    private String nodeId;
+
+    /**
+     * 机号
+     */
+    private String machineNo;
+}

+ 34 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxItpProjectNodeStateController.java

@@ -0,0 +1,34 @@
+package com.rongwei.bsserver.controller;
+
+import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodeStateService;
+import com.rongwei.bsentity.dto.project.node.RelationInspectionRequest;
+import com.rongwei.rwcommon.base.R;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/project/node/state")
+@Api(tags = "itp地图项目报验点状态")
+public class ZhcxItpProjectNodeStateController {
+
+    @Autowired
+    private ZhcxItpProjectNodeStateService service;
+
+    /**
+     * 关联报验单
+     *
+     * @param req
+     * @return
+     */
+    @ApiOperation("关联报验单")
+    @PostMapping("/relation")
+    public R relationInspection(@RequestBody RelationInspectionRequest req){
+        service.relationInspection(req);
+        return R.ok();
+    }
+}