Browse Source

项目报验状态报表

wangming 1 year ago
parent
commit
eb65b45548

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

@@ -0,0 +1,16 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateDo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 项目各机号报验点状态 Mapper 接口
+ * </p>
+ *
+ * @author fpy
+ * @since 2024-03-29
+ */
+public interface ZhcxItpProjectNodeStateDao extends BaseMapper<ZhcxItpProjectNodeStateDo> {
+
+}

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

@@ -0,0 +1,28 @@
+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.ZhcxItpProjectNodeStateResultDto;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 项目各机号报验点状态 服务类
+ * </p>
+ *
+ * @author fpy
+ * @since 2024-03-29
+ */
+public interface ZhcxItpProjectNodeStateService extends IService<ZhcxItpProjectNodeStateDo> {
+
+    /**
+     * 获取项目各机号报验点状态
+     *
+     * @param itpDo
+     * @param operType 操作类型 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 70:修改检验开始结束时间
+     * @return
+     */
+    List<ZhcxItpProjectNodeStateResultDto> getByItp(ZhcxOutsideInspectionItpDo itpDo, String operType);
+}

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

@@ -0,0 +1,113 @@
+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.bsentity.domain.ZhcxItpProjectNodeStateDo;
+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.ZhcxItpProjectNodeStateResultDto;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * <p>
+ * 项目各机号报验点状态 服务实现类
+ * </p>
+ *
+ * @author fpy
+ * @since 2024-03-29
+ */
+@Service
+public class ZhcxItpProjectNodeStateServiceImpl extends ServiceImpl<ZhcxItpProjectNodeStateDao, ZhcxItpProjectNodeStateDo> implements ZhcxItpProjectNodeStateService {
+
+    /**
+     * 获取项目各机号报验点状态
+     *
+     * @param itpDo
+     * @param operType 操作类型 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 70:修改检验开始结束时间
+     * @return
+     */
+    @Override
+    public List<ZhcxItpProjectNodeStateResultDto> getByItp(ZhcxOutsideInspectionItpDo itpDo, String operType) {
+
+        if(ObjectUtil.isNull(itpDo)) {
+            return Collections.emptyList();
+        }
+
+        //非itp不做处理
+        if("unitp".equals(itpDo.getLaunchtype())) {
+            return Collections.emptyList();
+        }
+
+        //机号选择
+        String machinesNo = getMachinesNoByItp(itpDo);
+        String[] machinenos = machinesNo.split(",");
+
+        List<ZhcxItpProjectNodeStateResultDto> list = new ArrayList<>(machinenos.length);
+
+        for(String mn : machinenos) {
+            LambdaQueryWrapper<ZhcxItpProjectNodeStateDo> queryWrapper = Wrappers.lambdaQuery();
+            queryWrapper.eq(ZhcxItpProjectNodeStateDo::getPrjid, itpDo.getProjectid())
+                    .eq(ZhcxItpProjectNodeStateDo::getMathinecode, mn)
+                    .eq(ZhcxItpProjectNodeStateDo::getNodeid, itpDo.getInspectioncontentid());
+            ZhcxItpProjectNodeStateDo stateDo = getOne(queryWrapper);
+
+            ZhcxItpProjectNodeStateResultDto dto = new ZhcxItpProjectNodeStateResultDto();
+            ZhcxItpProjectNodeStateDo entity = new ZhcxItpProjectNodeStateDo();
+            if(ObjectUtil.isNull(stateDo)) {
+                entity.setId(SecurityUtil.getUUID());
+                dto.setSaveType("update");
+            } else {
+                entity.setId(stateDo.getId());
+                entity.setMathinecode(mn);
+                entity.setPrjid(itpDo.getProjectid());
+                entity.setNodeid(itpDo.getInspectioncontentid());
+                entity.setDeleted("0");
+                dto.setSaveType("insert");
+            }
+
+            entity.setOuttimes(itpDo.getInspectioncount());
+
+            //拒收
+            if("20".equals(operType)) {
+                entity.setOutstate("20");
+            }
+
+            //接收
+            if("50".equals(operType)) {
+                entity.setOutstate("10");
+            }
+
+            //有条件接收
+            if ("60".equals(operType)) {
+                entity.setOutstate("30");
+            }
+
+            dto.setEntity(entity);
+            list.add(dto);
+        }
+
+        return list;
+    }
+
+    /**
+     * 选择机号
+     *
+     * @param itpDo
+     * @return
+     */
+    private String getMachinesNoByItp(ZhcxOutsideInspectionItpDo itpDo) {
+        if(ObjectUtil.isNotEmpty(itpDo.getMachineno())) {
+            return itpDo.getMachineno();
+        }
+
+        return itpDo.getStructuremachineno();
+    }
+}

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

@@ -14,13 +14,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.rongwei.bscommon.sys.feign.SysNotifyFeginService;
 import com.rongwei.bscommon.sys.service.*;
 import com.rongwei.bscommon.sys.utils.ZhcxCommon;
-import com.rongwei.bsentity.domain.ZhcxOutsideInspectionComponentTrackDo;
-import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
+import com.rongwei.bsentity.domain.*;
 import com.rongwei.bscommon.sys.dao.ZhcxOutsideInspectionItpDao;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpOperLogDo;
-import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpSupervisionDispatchDo;
 import com.rongwei.bsentity.dto.NotifyDto;
+import com.rongwei.bsentity.dto.ZhcxItpProjectNodeStateResultDto;
 import com.rongwei.bsentity.vo.*;
 import com.rongwei.commonservice.serial.service.SysSerialNumberService;
 import com.rongwei.rwadmincommon.system.domain.PagePartDo;
@@ -103,6 +101,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
     @Autowired
     private ZhcxOutsideInspectionItpOperLogService zhcxOutsideInspectionItpOperLogService;
 
+    @Autowired
+    private ZhcxItpProjectNodeStateService zhcxItpProjectNodeStateService;
+
     /**
      * 拆单
      *
@@ -170,6 +171,8 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
 //        }
 
         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++){
@@ -260,7 +263,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
                 dispatchDo.setDispatchstatus("30");
                 inspectionItpDo.setInspectionstatus("40");
 
-            } else if ("20".equals(operType)) {
+            }
+            //拒收
+            else if ("20".equals(operType)) {
                 if("task".equals(vo.get(i).getPageType()) && !user.getId().equals(dispatchDo.getSupervisionuserid())){
                     sb.append("单据号:"+inspectioncode+"已被改派,不能拒收,请刷新数据查看<br>");
                     continue;
@@ -275,7 +280,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
                 if(ObjectUtil.isNull(inspectionItpDo.getInspectioncomplatetime())) {
                     inspectionItpDo.setInspectioncomplatetime(new Date());
                 }
-            } else if (Arrays.asList("30", "40").contains(operType)) {
+            }
+            //30:派单  40:转派
+            else if (Arrays.asList("30", "40").contains(operType)) {
                 //监理检验员只能操作自己的数据
 //                if(!user.getId().equals(dispatchDo.getSupervisionuserid())){
 //                    sb.append("单据号:"+inspectioncode+"已被改派,不能取消,请刷新数据查看<br>");
@@ -321,6 +328,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
                     inspectionItpDo.setInspectioncomplatetime(new Date());
                 }
             }
+            //报验完成时修改
             /* 检验员拒收和接收时会传回检验开始/结束时间和文件 */
             if (Arrays.asList("20", "50", "60").contains(operType)) {
                 dispatchDo.setCheckstarttime(vo.get(i).getStartDate());
@@ -328,6 +336,20 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
                 dispatchDo.setSfiles(vo.get(i).getFiles());
                 dispatchDo.setCanvas(vo.get(i).getCanvas());
                 dispatchDo.setSignature(vo.get(i).getSignature());
+
+                //添加项目各机号报验点状态
+                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());
+                        }
+                    }
+                }
+
             }
             /* 当前操作人 */
             if (user != null && user.getId() != null) {
@@ -385,6 +407,14 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
             }
         }
 
+        //添加项目各机号报验点状态
+        if(ObjectUtil.isNotEmpty(insertNodeStateList)) {
+            zhcxItpProjectNodeStateService.saveBatch(insertNodeStateList);
+        }
+        if(ObjectUtil.isNotEmpty(updateNodeStateList)) {
+            zhcxItpProjectNodeStateService.updateBatchById(updateNodeStateList);
+        }
+
         //操作记录
         zhcxOutsideInspectionItpOperLogService.saveBatch(logList);
 

+ 86 - 0
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxItpProjectNodeStateDo.java

@@ -0,0 +1,86 @@
+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 fpy
+ * @since 2024-03-29
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("ZHCX_ITP_PROJECT_NODE_STATE")
+public class ZhcxItpProjectNodeStateDo extends BaseDo {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableField("ID")
+    private String id;
+    @TableField("TENANTID")
+    private String tenantid;
+    /**
+     * 扩展json格式配置
+     */
+    @TableField("ROPTION")
+    private String roption;
+    /**
+     * 关联机号
+     */
+    @TableField("MATHINECODE")
+    private String mathinecode;
+    /**
+     * 关联项目ID
+     */
+    @TableField("PRJID")
+    private String prjid;
+    /**
+     * 内部报验状态
+     */
+    @TableField("INSTATE")
+    private String instate;
+    /**
+     * 外部报验状态
+     */
+    @TableField("OUTSTATE")
+    private String outstate;
+    /**
+     * 报验点ID
+     */
+    @TableField("NODEID")
+    private String nodeid;
+    /**
+     * 内部报验次数
+     */
+    @TableField("INTIMES")
+    private Integer intimes;
+    /**
+     * 外部报验次数
+     */
+    @TableField("OUTTIMES")
+    private Integer outtimes;
+    /**
+     * 内部报验结果
+     */
+    @TableField("INRESULT")
+    private String inresult;
+    /**
+     * 外部报验结果
+     */
+    @TableField("OUTRESULT")
+    private String outresult;
+
+
+}

+ 24 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/ZhcxItpProjectNodeStateResultDto.java

@@ -0,0 +1,24 @@
+package com.rongwei.bsentity.dto;
+
+import com.rongwei.bsentity.domain.ZhcxItpProjectNodeStateDo;
+import lombok.*;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class ZhcxItpProjectNodeStateResultDto {
+
+    /**
+     * 项目各机号状态
+     */
+    private ZhcxItpProjectNodeStateDo entity;
+
+    /**
+     * 保存类型
+     * insert 保存
+     * update 修改
+     */
+    private String saveType;
+}