Selaa lähdekoodia

外部报验功能,再次报验

wangming 1 vuosi sitten
vanhempi
commit
0517fccf61

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

@@ -2,6 +2,9 @@ package com.rongwei.bscommon.sys.dao;
 
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +16,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ZhcxOutsideInspectionItpDao extends BaseMapper<ZhcxOutsideInspectionItpDo> {
 
+    /**
+     * 拒收的报验单报验次数+1
+     *
+     * @param map
+     */
+    @Update("update INCONTROL.ZHCX_OUTSIDE_INSPECTION_ITP i, INCONTROL.ZHCX_OUTSIDE_INSPECTION_ITP_SUPERVISION_DISPATCH d set i.INSPECTIONCOUNT = ifnull(i.INSPECTIONCOUNT, 0) + 1" +
+            " where i.ID = d.ITPID and d.INSPECTIONCONCLUSION = '20' and i.ID = #{id}")
+    void updateInspectionCount(Map<String, String> map);
 }

+ 10 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxOutsideInspectionItpSupervisionDispatchDao.java

@@ -2,6 +2,9 @@ package com.rongwei.bscommon.sys.dao;
 
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpSupervisionDispatchDo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +16,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ZhcxOutsideInspectionItpSupervisionDispatchDao extends BaseMapper<ZhcxOutsideInspectionItpSupervisionDispatchDo> {
 
+    /**
+     * 清空
+     *
+     * @param entity
+     */
+    @Update("update INCONTROL.ZHCX_OUTSIDE_INSPECTION_ITP_SUPERVISION_DISPATCH set DISPATCHSTATUS = '10', CANCELTYPE = '', CANCELREASON = '', INSPECTIONCONCLUSION = '',REFUSEREASON='',SUPERVISIONUSERID = '',SUPERVISIONID = '',SUPERVISIONACCOUNT = '',SUPERVISION = '',SUPERVISIONPHONE = '',CHECKSTARTTIME = '', CHECKENDTIME = '' where ID = #{id}")
+    void reInspection(ZhcxOutsideInspectionItpSupervisionDispatchDo entity);
 }

+ 0 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxOutsideInspectionItpNdtResultService.java

@@ -1,6 +1,5 @@
 package com.rongwei.bscommon.sys.service;
 
-import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpNdtResultDo;
 import com.baomidou.mybatisplus.extension.service.IService;
 

+ 13 - 3
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxOutsideInspectionItpService.java

@@ -4,8 +4,6 @@ import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwei.bsentity.vo.OperOutsideInspectionVo;
 
-import java.util.Map;
-
 /**
  * <p>
  * 外部报验-ITP报验 服务类
@@ -13,6 +11,7 @@ import java.util.Map;
  *
  * @author wm
  * @since 2023-12-26
+ * @since 2024-01-06
  */
 public interface ZhcxOutsideInspectionItpService extends IService<ZhcxOutsideInspectionItpDo> {
 
@@ -23,5 +22,16 @@ public interface ZhcxOutsideInspectionItpService extends IService<ZhcxOutsideIns
      */
     void splitOrder(String id);
 
-    String OperInspectionStatus(OperOutsideInspectionVo vo);
+    String operInspectionStatus(OperOutsideInspectionVo vo);
+
+    /**
+     * 再次报验
+     * 1、报验结论拒收,报验次数+1,修改报验单号
+     * 2、清空派单信息
+     * 3、添加历史记录
+     *
+     * @param id
+     */
+    void reInspection(String id);
 }
+

+ 9 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxOutsideInspectionItpSupervisionDispatchService.java

@@ -13,4 +13,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ZhcxOutsideInspectionItpSupervisionDispatchService extends IService<ZhcxOutsideInspectionItpSupervisionDispatchDo> {
 
+    /**
+     * 重新报验
+     *
+     * 清空监理用户信息
+     * 更新派单状态
+     *
+     * @param id
+     */
+    void reInspection(String id);
 }

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

@@ -2,6 +2,8 @@ package com.rongwei.bscommon.sys.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 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.ZhcxCommon;
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
@@ -51,6 +53,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
     @Autowired
     private ZhcxCommon zhcxCommon;
 
+    @Autowired
+    private ZhcxOutsideInspectionItpDao dao;
+
     /**
      * 拆单
      *
@@ -87,17 +92,11 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         for(int m = 0, n = structurNames.length; m < n; m++) {
             for(String inspectionContent : inspectionContents) {
                 count++;
-                SysSerialVo sysSerialVo = new SysSerialVo();
-                sysSerialVo.setRuleTemplateStr("W@{date:yyyyMMdd}@{serialNumber:#0000}");
-                sysSerialVo.setModulecode("ZHCX_OUTSIDE_INSPECTION_ITP_CODE");
-                sysSerialVo.setIfautomaticreset("y");
-                sysSerialVo.setResetrule("date:yyyyMMdd");
-                sysSerialVo.setInitValue(0L);
-                String code = serialNumberService.getCodeByTemplate(sysSerialVo);
+
                 if(count == 0) { //第一个做修改
                     itpDo.setStructurename(structurNames[m]);
                     itpDo.setInspectioncontent(inspectionContent);
-                    itpDo.setInspectioncode(code);
+                    itpDo.setInspectioncode(genCode());
 //                    itpDo.setStructureid(structureIds[m]);
                     updateList.add(itpDo);
                     continue;
@@ -108,7 +107,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
                 entity.setStructurename(structurNames[m]);
                 entity.setInspectioncontent(inspectionContent);
                 entity.setId(SecurityUtil.getUUID());
-                entity.setInspectioncode(code);
+                entity.setInspectioncode(genCode());
 //                entity.setStructureid(structureIds[m]);
                 insertList.add(entity);
                 newItpIdList.add(entity.getId());
@@ -116,22 +115,14 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
             }
         }
 
-        //钢结构
-        if("10".equals(itpDo.getInspectiontype())) {
-            itpNdtResultService.copyByItpId(id, newItpIdList);
-        }
-        String[] array = {"10", "20", "30"};
-        List<String> qcTypeList = Arrays.asList(array);
-        if(qcTypeList.contains(itpDo.getInspectiontype())) {
-            qcItemResultService.copyByItpId(id, newItpIdList);
-        }
+        insertChildren(itpDo, newItpIdList);
 
         updateBatchById(updateList);
         saveBatch(insertList);
     }
 
     @Override
-    public String OperInspectionStatus(OperOutsideInspectionVo vo) {
+    public String operInspectionStatus(OperOutsideInspectionVo vo) {
         /* 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 */
         String operType = vo.getOperType();
         log.info("执行OperInspectionStatus函数的"+operType+"操作, itpId="+vo.getItpId());
@@ -231,4 +222,141 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         return "";
     }
 
+    /**
+     * 再次报验
+     * 1、报验结论拒收,报验次数+1,修改报验单号
+     * 2、清空派单信息
+     *
+     * @param id
+     */
+    @Override
+    public void reInspection(String id) {
+        ZhcxOutsideInspectionItpDo itpDo = getById(id);
+
+        //拒收,报验次数加+1
+        Map<String, String> map = new HashMap<>();
+        map.put("id", id);
+        dao.updateInspectionCount(map);
+
+        LambdaQueryWrapper<ZhcxOutsideInspectionItpSupervisionDispatchDo> dispatchLambdaQueryWrapper = Wrappers.lambdaQuery();
+        dispatchLambdaQueryWrapper.eq(ZhcxOutsideInspectionItpSupervisionDispatchDo::getItpid, id);
+        ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchServiceOne = dispatchService.getOne(dispatchLambdaQueryWrapper);
+
+        List<String> inspectionCodes = new ArrayList<>(Arrays.asList(itpDo.getInspectioncode().split("-")));;
+
+        ZhcxOutsideInspectionItpDo entity = new ZhcxOutsideInspectionItpDo();
+        BeanUtil.copyProperties(itpDo, entity);
+
+        //报验状态:取消状态
+        if("30".equals(dispatchServiceOne.getDispatchstatus())) {
+            if(inspectionCodes.size() == 1) {
+                inspectionCodes.add("C1");
+                entity.setSourceid(itpDo.getId());
+                entity.setSourcecode(itpDo.getInspectioncode());
+            } else {
+                boolean flag = false;
+                for(int m = 0, n = inspectionCodes.size(); m < n; m++) {
+                    if(inspectionCodes.get(m).startsWith("C")) {
+                        Integer c = Integer.valueOf(inspectionCodes.get(m).replace("C", ""));
+                        c += 1;
+                        inspectionCodes.set(m, "C" + c);
+                        flag = true;
+                        break;
+                    }
+                }
+
+                if(!flag) {
+                    inspectionCodes.add("C1");
+                }
+            }
+        }
+
+        //报验结论:拒收状态
+        if("20".equals(dispatchServiceOne.getInspectionconclusion())) {
+            if(inspectionCodes.size() == 1) {
+                inspectionCodes.add("R1");
+                entity.setSourceid(itpDo.getId());
+                entity.setSourcecode(itpDo.getInspectioncode());
+            } else {
+                boolean flag = false;
+                for(int m = 0, n = inspectionCodes.size(); m < n; m++) {
+                    if(inspectionCodes.get(m).startsWith("R")) {
+                        Integer c = Integer.valueOf(inspectionCodes.get(m).replace("C", ""));
+                        c += 1;
+                        inspectionCodes.set(m, "R" + c);
+                        flag = true;
+                        break;
+                    }
+                }
+
+                if(!flag) {
+                    inspectionCodes.add("R1");
+                }
+            }
+        }
+
+        //新的报验单
+        entity.setId(SecurityUtil.getUUID());
+        entity.setInspectioncode(StringUtils.join(inspectionCodes, "-"));
+        save(entity);
+
+        //指派单
+        ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchEntity = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
+        BeanUtil.copyProperties(dispatchServiceOne, dispatchEntity);
+        dispatchEntity.setId(SecurityUtil.getUUID());
+        dispatchEntity.setItpid(entity.getId());
+        dispatchService.save(dispatchEntity);
+
+        //报验单明细
+        List<String> newItpIdList = new ArrayList<>();
+        newItpIdList.add(entity.getId());
+        insertChildren(itpDo, newItpIdList);
+
+        //以前报验单弃用
+        ZhcxOutsideInspectionItpDo itpDoTemp = new ZhcxOutsideInspectionItpDo();
+        itpDoTemp.setId(id);
+        itpDoTemp.setLifecycle("99");
+        updateById(itpDoTemp);
+
+        //更新
+        dispatchService.reInspection(dispatchServiceOne.getId());
+    }
+
+    /**
+     * 生成单号
+     *
+     * @return
+     */
+    private String genCode() {
+        SysSerialVo sysSerialVo = new SysSerialVo();
+        sysSerialVo.setRuleTemplateStr("W@{date:yyyyMMdd}@{serialNumber:#0000}");
+        sysSerialVo.setModulecode("ZHCX_OUTSIDE_INSPECTION_ITP_CODE");
+        sysSerialVo.setIfautomaticreset("y");
+        sysSerialVo.setResetrule("date:yyyyMMdd");
+        sysSerialVo.setInitValue(0L);
+        return serialNumberService.getCodeByTemplate(sysSerialVo);
+    }
+
+    /**
+     * 保存子表
+     *
+     * @param itpDo
+     * @param newItpIdList
+     */
+    private void insertChildren(ZhcxOutsideInspectionItpDo itpDo, List<String> newItpIdList) {
+        if(ObjectUtil.isEmpty(newItpIdList)) {
+            return ;
+        }
+
+        //钢结构
+        if("10".equals(itpDo.getInspectiontype())) {
+            itpNdtResultService.copyByItpId(itpDo.getId(), newItpIdList);
+        }
+        String[] array = {"10", "20", "30"};
+        List<String> qcTypeList = Arrays.asList(array);
+        if(qcTypeList.contains(itpDo.getInspectiontype())) {
+            qcItemResultService.copyByItpId(itpDo.getId(), newItpIdList);
+        }
+    }
+
 }

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

@@ -4,8 +4,12 @@ import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpSupervisionDispatchDo
 import com.rongwei.bscommon.sys.dao.ZhcxOutsideInspectionItpSupervisionDispatchDao;
 import com.rongwei.bscommon.sys.service.ZhcxOutsideInspectionItpSupervisionDispatchService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * <p>
  * 外部报验-ITP报验-监理派单 服务实现类
@@ -17,4 +21,21 @@ import org.springframework.stereotype.Service;
 @Service
 public class ZhcxOutsideInspectionItpSupervisionDispatchServiceImpl extends ServiceImpl<ZhcxOutsideInspectionItpSupervisionDispatchDao, ZhcxOutsideInspectionItpSupervisionDispatchDo> implements ZhcxOutsideInspectionItpSupervisionDispatchService {
 
+    @Autowired
+    private ZhcxOutsideInspectionItpSupervisionDispatchDao dao;
+
+    /**
+     * 重新报验
+     *
+     * 清空监理用户信息
+     * 更新派单状态
+     *
+     * @param id
+     */
+    @Override
+    public void reInspection(String id) {
+        ZhcxOutsideInspectionItpSupervisionDispatchDo entity = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
+        entity.setId(id);
+        dao.reInspection(entity);
+    }
 }

+ 43 - 22
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxOutsideInspectionItpDo.java

@@ -4,7 +4,6 @@ import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.rongwei.rwcommon.base.BaseDo;
 import java.util.Date;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -16,12 +15,12 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author wm
- * @since 2023-12-26
+ * @since 2024-01-06
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
 @Accessors(chain = true)
-@TableName("zhcx_outside_inspection_itp")
+@TableName("ZHCX_OUTSIDE_INSPECTION_ITP")
 public class ZhcxOutsideInspectionItpDo extends BaseDo {
 
     private static final long serialVersionUID=1L;
@@ -29,7 +28,7 @@ public class ZhcxOutsideInspectionItpDo extends BaseDo {
     /**
      * 主键
      */
-    @TableId("ID")
+    @TableField("ID")
     private String id;
     /**
      * 租户ID
@@ -76,11 +75,6 @@ public class ZhcxOutsideInspectionItpDo extends BaseDo {
      */
     @TableField("CUSTOMERREQUIREID")
     private String customerrequireid;
-    /**
-     * 项目机号id
-     */
-    @TableField("PROJECTMACHINEID")
-    private String projectmachineid;
     /**
      * 机号
      */
@@ -91,11 +85,6 @@ public class ZhcxOutsideInspectionItpDo extends BaseDo {
      */
     @TableField("COMPANYSHORTNAME")
     private String companyshortname;
-    /**
-     * 构建Id
-     */
-    @TableField("STRUCTUREID")
-    private String structureid;
     /**
      * 构件名称
      */
@@ -106,11 +95,6 @@ public class ZhcxOutsideInspectionItpDo extends BaseDo {
      */
     @TableField("STRUCTUREDRAWING")
     private String structuredrawing;
-    /**
-     * 报验内容id
-     */
-    @TableField("INSPECTIONCONTENTID")
-    private String inspectioncontentid;
     /**
      * 报验内容
      */
@@ -221,19 +205,56 @@ public class ZhcxOutsideInspectionItpDo extends BaseDo {
      */
     @TableField("INSPECTIONSTATUS")
     private String inspectionstatus;
+    /**
+     * 附件
+     */
+    @TableField("FILES")
+    private String files;
+    /**
+     * 项目机号id
+     */
+    @TableField("PROJECTMACHINEID")
+    private String projectmachineid;
     /**
      * 发起类型(itp、unitp)
      */
     @TableField("LAUNCHTYPE")
     private String launchtype;
     /**
-     * 附件
+     * 构建Id
      */
-    @TableField("FILES")
-    private String files;
+    @TableField("STRUCTUREID")
+    private String structureid;
+    /**
+     * 报验内容id
+     */
+    @TableField("INSPECTIONCONTENTID")
+    private String inspectioncontentid;
     /**
      * 检查地点补充
      */
     @TableField("INSPECTIONLOCATIONSUPPLEMENT")
     private String inspectionlocationsupplement;
+    /**
+     * 发起源(pc,mobile)
+     */
+    @TableField("LAUNCHSOURCE")
+    private String launchsource;
+    /**
+     * 源id
+     */
+    @TableField("SOURCEID")
+    private String sourceid;
+    /**
+     * 源编码
+     */
+    @TableField("SOURCECODE")
+    private String sourcecode;
+    /**
+     * 生命周期(默认进行中,作废)
+     */
+    @TableField("LIFECYCLE")
+    private String lifecycle;
+
+
 }

+ 1 - 3
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxOperOutsideInspectionController.java

@@ -8,8 +8,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Map;
-
 @RestController
 @RequestMapping("/zhcxOperOutsideInspection")
 public class ZhcxOperOutsideInspectionController {
@@ -18,7 +16,7 @@ public class ZhcxOperOutsideInspectionController {
 
     @RequestMapping("/OperInspectionStatus")
     public R OperInspectionStatus(@RequestBody OperOutsideInspectionVo vo) {
-        String msg = inspectionService.OperInspectionStatus(vo);
+        String msg = inspectionService.operInspectionStatus(vo);
         return R.ok(msg);
     }
 }

+ 7 - 2
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxOutsideInspectionItpController.java

@@ -2,14 +2,13 @@ package com.rongwei.bsserver.controller;
 
 
 import com.rongwei.bscommon.sys.service.ZhcxOutsideInspectionItpService;
-import com.rongwei.bsentity.vo.CopyAddTemplateVo;
 import com.rongwei.rwcommon.base.R;
 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;
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -32,5 +31,11 @@ public class ZhcxOutsideInspectionItpController {
         service.splitOrder(map.get("id"));
         return R.ok();
     }
+
+    @PostMapping("/reInspection")
+    public R reInspection(@RequestBody Map<String, String> map){
+        service.reInspection(map.get("id"));
+        return R.ok();
+    }
 }