Browse Source

海绑触发报验点状态

wangming 5 months ago
parent
commit
950490cdd2

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

@@ -3,8 +3,10 @@ package com.rongwei.bscommon.sys.service;
 import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateDo;
 import com.baomidou.mybatisplus.extension.service.IService;
 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.RelationInspectionRequest;
 
 import java.util.List;
@@ -52,4 +54,12 @@ public interface ZhcxItpProjectNodeStateService extends IService<ZhcxItpProjectN
      * 初始化-内部报验单
      */
     void initRelationInSide(String projectId);
+
+    /**
+     * 关联报验点
+     *
+     * @param list
+     * @param oper
+     */
+    void relationInspection4Init(List<RelactionNodeStateBo> list, OperDto oper);
 }

+ 8 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxSeaBindProofService.java

@@ -2,6 +2,7 @@ package com.rongwei.bscommon.sys.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwei.bsentity.domain.ZhcxSeaBindProofDo;
+import com.rongwei.bsentity.dto.seabind.PmAgreeRequest;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -15,4 +16,11 @@ public interface ZhcxSeaBindProofService extends IService<ZhcxSeaBindProofDo> {
 
      void  previewPdf(HttpServletResponse response, String id);
 
+    /**
+     * 海绑经理同意
+     *
+     * @param req
+     */
+    void pmAgree(PmAgreeRequest req);
+
 }

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

@@ -463,7 +463,8 @@ public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProje
      * @param list
      * @param oper
      */
-    private void relationInspection4Init(List<RelactionNodeStateBo> list, OperDto oper) {
+    @Override
+    public void relationInspection4Init(List<RelactionNodeStateBo> list, OperDto oper) {
         if(ObjectUtil.isEmpty(list)) {
             return ;
         }
@@ -496,13 +497,20 @@ public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProje
                 }
             }
             //外部
-            else {
+            else if("outside".equals(state.getType())) {
                 entity.setOuttimes(state.getInspectionCount());
                 entity.setOutstate(state.getConclusion());
 
                 if("10".equals(state.getConclusion()) || "30".equals(state.getConclusion())) {
                     entity.setOutcompletetime(state.getComplateTime());
                 }
+            } else if("sea".equals(state.getType())) {
+                entity.setIncompletetime(state.getComplateTime());
+                entity.setIntimes(state.getInspectionCount());
+                entity.setInstate(state.getConclusion());
+
+                entity.setOuttimes(state.getInspectionCount());
+                entity.setOutstate(state.getConclusion());
             }
 
             if(ObjectUtil.isNull(stateDo)) {
@@ -531,6 +539,10 @@ public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProje
                 prjNodeState.getUpdateList().add(entity);
             }
 
+            if(ObjectUtil.isEmpty(state.getInspectionList())) {
+                continue;
+            }
+
             if("inside".equals(state.getType())) {
                 //内部报验报验点明细
                 for(RelactionNodeStateInspectionBo nodeInspection : state.getInspectionList()) {
@@ -551,7 +563,7 @@ public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProje
 
                     prjNodeState.getInsideStateList().add(insideState);
                 }
-            } else {
+            } else if("outside".equals(state.getType())) {
                 //外部报验报验点明细
                 for(RelactionNodeStateInspectionBo nodeInspection : state.getInspectionList()) {
                     //同一个报验点,只能存一份

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

@@ -1,8 +1,10 @@
 package com.rongwei.bscommon.sys.service.impl;
 
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.aspose.cells.*;
 import com.aspose.cells.Picture;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.zxing.BarcodeFormat;
@@ -17,10 +19,18 @@ import com.lowagie.text.DocumentException;
 import com.lowagie.text.pdf.PdfReader;
 import com.lowagie.text.pdf.PdfStamper;
 import com.rongwei.bscommon.sys.dao.ZhcxSeaBindProofDao;
+import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodeStateService;
+import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodesService;
 import com.rongwei.bscommon.sys.service.ZhcxSeaBindProofDetalService;
 import com.rongwei.bscommon.sys.service.ZhcxSeaBindProofService;
+import com.rongwei.bscommon.sys.utils.ZhcxCommon;
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodesDo;
 import com.rongwei.bsentity.domain.ZhcxSeaBindProofDetalDo;
 import com.rongwei.bsentity.domain.ZhcxSeaBindProofDo;
+import com.rongwei.bsentity.dto.OperDto;
+import com.rongwei.bsentity.dto.project.node.RelactionNodeStateBo;
+import com.rongwei.bsentity.dto.seabind.PmAgreeRequest;
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.exception.CustomException;
 import com.rongwei.rwcommon.utils.StringUtils;
 import com.rongwei.rwcommoncomponent.excel.aspose.ExcelUtils;
@@ -53,6 +63,15 @@ public class ZhcxSeaBindProofServiceImpl extends ServiceImpl<ZhcxSeaBindProofDao
     @Value("${hb-provider.url}")
     private String PreviewUrl;
 
+    @Autowired
+    private ZhcxItpProjectNodeStateService zhcxItpProjectNodeStateService;
+
+    @Autowired
+    private ZhcxCommon zhcxCommon;
+
+    @Autowired
+    private ZhcxItpProjectNodesService zhcxItpProjectNodesService;
+
 
 
 
@@ -406,6 +425,46 @@ public class ZhcxSeaBindProofServiceImpl extends ServiceImpl<ZhcxSeaBindProofDao
         }
     }
 
+    /**
+     * 海绑经理同意
+     *
+     * @param req
+     */
+    @Override
+    public void pmAgree(PmAgreeRequest req) {
+        final ZhcxSeaBindProofDo bindProof = getById(req.getId());
+        final LambdaQueryWrapper<ZhcxItpProjectNodesDo> queryNodeWrapper = Wrappers.lambdaQuery();
+        queryNodeWrapper.eq(ZhcxItpProjectNodesDo::getProjectid, bindProof)
+                .eq(ZhcxItpProjectNodesDo::getNodename, "整机绑扎完工");
+        ZhcxItpProjectNodesDo nodesDo = zhcxItpProjectNodesService.getOne(queryNodeWrapper);
+
+        if(ObjectUtil.isNull(nodesDo)) {
+            throw new CustomException("项目中报验点不存在");
+        }
+
+        SysUserVo user = zhcxCommon.getCurrentUser();
+        OperDto oper = new OperDto();
+        oper.setOperTime(new Date());
+        oper.setOperUser(user);
+
+        List<RelactionNodeStateBo> list = new ArrayList<>();
+        String[] machineNos = bindProof.getCraneno().split(",");
+
+        for(int m = 0, n = machineNos.length; m < n; m++) {
+            list.add(RelactionNodeStateBo.builder()
+                    .conclusion("10")
+                    .type("sea")
+                    .complateTime(oper.getOperTime())
+                    .nodeId(nodesDo.getId())
+                    .projectId(bindProof.getProjectid())
+                    .projectCode(bindProof.getProjectcode())
+                    .projectName((bindProof.getProjectname()))
+                    .machineNo(machineNos[m])
+                    .build());
+        }
+
+        zhcxItpProjectNodeStateService.relationInspection4Init(list, oper);
+    }
 
 
 }

+ 20 - 9
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxSeaBindProofDo.java

@@ -65,19 +65,30 @@ public class ZhcxSeaBindProofDo extends BaseDo {
      */
     @TableField("SHIPPINGNO")
     private String shippingno;
-/**
- *产品机号
- */
+
+    /**
+     * 产品机号id
+     */
+    @TableField("CRANENOIDS")
+    private String cranenoids;
+    /**
+     *产品机号
+     */
     @TableField("CRANENO")
     private String craneno ;
-/**
- *产品名称
- */
+    /**
+     *产品名称
+     */
+    @TableField("PROJECTID")
+    private String projectid;
+    /**
+     *产品名称
+     */
     @TableField("PROJECTNAME")
     private String projectname;
-/**
- *产品工号
- */
+    /**
+     *产品工号
+     */
     @TableField("PROJECTCODE")
     private String projectcode;
 //    /**

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

@@ -56,6 +56,7 @@ public class RelactionNodeStateBo {
      * 报验单类型
      * inside: 内部
      * outside: 外部
+     * sea: 海绑
      */
     private String type;
 

+ 16 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/seabind/PmAgreeRequest.java

@@ -0,0 +1,16 @@
+package com.rongwei.bsentity.dto.seabind;
+
+import lombok.*;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class PmAgreeRequest {
+
+    /**
+     * 海邦证明id
+     */
+    private String id;
+}

+ 13 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxSeaBindProofController.java

@@ -3,6 +3,8 @@ package com.rongwei.bsserver.controller;
 import com.rongwei.bscommon.sys.service.ZhcxSeaBindProofService;
 import com.rongwei.bsentity.domain.ZhcxInspectionReportManageDo;
 import com.rongwei.bsentity.domain.ZhcxSeaBindProofDo;
+import com.rongwei.bsentity.dto.seabind.PmAgreeRequest;
+import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommoncomponent.file.service.SysFileItemService;
 import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -60,5 +62,16 @@ public class ZhcxSeaBindProofController {
     }
 
 
+    /**
+     * 海绑经理同意
+     *
+     * @param req
+     * @return
+     */
+    @PostMapping("/pm/agree")
+    public R previewPdf(@RequestBody PmAgreeRequest req) {
+        zhcxSeaBindProofService.pmAgree(req);
+        return R.ok();
+    }
 
 }