Explorar o código

报验单历史操作记录

wangming hai 1 ano
pai
achega
9b81dcf8c5

+ 7 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxOutsideInspectionItpOperLogDao.java

@@ -2,6 +2,9 @@ package com.rongwei.bscommon.sys.dao;
 
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpOperLogDo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Insert;
+
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +16,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ZhcxOutsideInspectionItpOperLogDao extends BaseMapper<ZhcxOutsideInspectionItpOperLogDo> {
 
+    @Insert("INSERT INTO INCONTROL.ZHCX_OUTSIDE_INSPECTION_ITP_OPER_LOG(ID,TENANTID,ROPTION,DELETED,REMARK,CREATEUSERID,CREATEUSERNAME,CREATEDATE,MODIFYUSERID,MODIFYUSERNAME,MODIFYDATE,ITPID,OPERTYPE,OPERDESCRIPTION,OPERSOURCE,OPERTIME, OPERUSERID, OPERUSERNAME) " +
+            "SELECT guid(),TENANTID,ROPTION,DELETED,REMARK,CREATEUSERID,CREATEUSERNAME,CREATEDATE,MODIFYUSERID,MODIFYUSERNAME,MODIFYDATE,#{newItpId},OPERTYPE,OPERDESCRIPTION,OPERSOURCE,OPERTIME, OPERUSERID, OPERUSERNAME FROM INCONTROL.ZHCX_OUTSIDE_INSPECTION_ITP_OPER_LOG WHERE ITPID = #{itpId}")
+    int insertBySelect(Map<String, String> map);
+
 }

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

@@ -4,6 +4,7 @@ import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpOperLogDo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -31,4 +32,12 @@ public interface ZhcxOutsideInspectionItpOperLogService extends IService<ZhcxOut
      * @return
      */
     ZhcxOutsideInspectionItpOperLogDo getNew(String itpId, String operType, Date operTime);
+
+    /**
+     * 复制itp下qc
+     *
+     * @param itpId
+     * @param newItpIdList
+     */
+    void copyByItpId(String itpId, List<String> newItpIdList);
 }

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

@@ -1,5 +1,6 @@
 package com.rongwei.bscommon.sys.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.rongwei.bscommon.sys.utils.ZhcxCommon;
 import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpOperLogDo;
 import com.rongwei.bscommon.sys.dao.ZhcxOutsideInspectionItpOperLogDao;
@@ -11,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -26,6 +30,9 @@ public class ZhcxOutsideInspectionItpOperLogServiceImpl extends ServiceImpl<Zhcx
     @Autowired
     private ZhcxCommon zhcxCommon;
 
+    @Autowired
+    private ZhcxOutsideInspectionItpOperLogDao dao;
+
     /**
      * 获取新的日志
      *
@@ -59,4 +66,24 @@ public class ZhcxOutsideInspectionItpOperLogServiceImpl extends ServiceImpl<Zhcx
         operLogDo.setOpertype(operType);
         return operLogDo;
     }
+
+    /**
+     * 复制itp下qc
+     *
+     * @param itpId
+     * @param newItpIdList
+     */
+    @Override
+    public void copyByItpId(String itpId, List<String> newItpIdList) {
+        if(ObjectUtil.isEmpty(newItpIdList)) {
+            return ;
+        }
+
+        for(String newItpId : newItpIdList) {
+            Map<String, String> map = new HashMap<>();
+            map.put("itpId", itpId);
+            map.put("newItpId", newItpId);
+            dao.insertBySelect(map);
+        }
+    }
 }

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

@@ -412,8 +412,20 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = dispatchService.getOne(dispatchLambdaQueryWrapper);
 
         //保存历史
-        saveHistory(itpDo, dispatchDo);
+        saveReHistory(itpDo, dispatchDo);
 
+        //保存新的报验单
+        saveReNewItp(itpDo, dispatchDo, masterSlaveUpdate);
+    }
+
+    /**
+     * 重新报验-保存新的报验单
+     *
+     * @param itpDo
+     * @param dispatchDo
+     * @param masterSlaveUpdate
+     */
+    private void saveReNewItp(ZhcxOutsideInspectionItpDo itpDo, ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo, MasterSlaveUpdateVo masterSlaveUpdate) {
         //新的报验单号
         String newCode = genNewCode(itpDo, dispatchDo);
         masterSlaveUpdate.getMasterUpdate().getUpdatecolumns().put("INSPECTIONCODE", newCode);
@@ -429,7 +441,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
 
         //拒收,报验次数加+1
         Map<String, String> map = new HashMap<>();
-        map.put("id", id);
+        map.put("id", itpDo.getId());
         dao.updateInspectionCount(map);
 
         if(ObjectUtil.isNotEmpty(dispatchDo.getInspectionconclusion()) && "20".equals(dispatchDo.getInspectionconclusion())) {
@@ -439,6 +451,11 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
             dispatchService.reInspection(dispatchDo.getId(), null);
         }
 
+        //报验单添加操作操作记录
+        //操作记录
+        ZhcxOutsideInspectionItpOperLogDo itpLog = zhcxOutsideInspectionItpOperLogService
+                .getNew(itpDo.getId(), "70", new Date());
+        zhcxOutsideInspectionItpOperLogService.save(itpLog);
     }
 
     /**
@@ -915,7 +932,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
      * @param itpDo
      * @param dispatchDo
      */
-    private void saveHistory(ZhcxOutsideInspectionItpDo itpDo, ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo) {
+    private void saveReHistory(ZhcxOutsideInspectionItpDo itpDo, ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo) {
 
         //保存报验单
         ZhcxOutsideInspectionItpDo entity = new ZhcxOutsideInspectionItpDo();
@@ -936,6 +953,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
         List<String> newItpIdList = new ArrayList<>();
         newItpIdList.add(entity.getId());
         insertChildren(itpDo, newItpIdList);
+
+        //保存操作记录
+        zhcxOutsideInspectionItpOperLogService.copyByItpId(itpDo.getId(), newItpIdList);
     }
 
     /**