wangxuan 7 hónapja
szülő
commit
9f1e629df7

+ 14 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxPMQMDao.java

@@ -1,5 +1,6 @@
 package com.rongwei.bscommon.sys.dao;
 import com.rongwei.bsentity.domain.ZhcxPmqManagementMapDo;
+import com.rongwei.bsentity.domain.ZhcxPmqManagementRecoredDo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
 
@@ -20,4 +21,17 @@ public interface ZhcxPMQMDao {
 
     @Select("SELECT * FROM INCONTROL.ZHCX_PMQ_MANAGEMENT_MAP WHERE DELETED = '0' AND DEPTTYPE IS NULL; ")
     List<ZhcxPmqManagementMapDo> getAllZhcxPmqManagementMapDoList();
+
+    @Select("SELECT\n" +
+            "\trecored.*\n" +
+            "FROM\n" +
+            "\tINCONTROL.ZHCX_PMQ_MANAGEMENT_RECORED recored\n" +
+            "\tLEFT JOIN (\n" +
+            "     SELECT DISTINCT NXDEPTID,NXDEPTNAME,PARENTNXDEPTNAME,ISFLOWERDEPT,QCUSERID,QCUSERNAME\n" +
+            "     FROM INCONTROL.ZHCX_PMQ_MANAGEMENT_MAP m\n" +
+            "     WHERE m.DELETED = '0'\n" +
+            "    ) t2 ON t2.NXDEPTID = recored.DEPTID\n" +
+            " WHERE\n" +
+            "    recored.DELETED = '0' AND recored.DISPATCHSTATUS = '0' AND t2.ISFLOWERDEPT= 'true'")
+    List<ZhcxPmqManagementRecoredDo> getAllRecoredDoListInFlowerDept();
 }

+ 33 - 4
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxPMQMServiceImpl.java

@@ -4,12 +4,10 @@ import cn.hutool.core.date.DateUtil;
 import com.rongwei.bscommon.sys.dao.*;
 import com.rongwei.bscommon.sys.service.ZhcxPMQMService;
 import com.rongwei.bscommon.sys.service.ZhcxPmqManagementDistributionDetailService;
+import com.rongwei.bscommon.sys.service.ZhcxPmqManagementDistributionService;
 import com.rongwei.bscommon.sys.service.ZhcxPmqManagementMapService;
 import com.rongwei.bscommon.sys.utils.ZhcxCommon;
-import com.rongwei.bsentity.domain.ZhcxPmqManagementDo;
-import com.rongwei.bsentity.domain.ZhcxPmqManagementMapDo;
-import com.rongwei.bsentity.domain.ZhcxPmqManagementRecoredDo;
-import com.rongwei.bsentity.domain.ZhcxPmqManagementSourceDo;
+import com.rongwei.bsentity.domain.*;
 import com.rongwei.bsentity.dto.sqlServer.ZhcxPmqManagementSource;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
@@ -69,6 +67,9 @@ public class ZhcxPMQMServiceImpl implements ZhcxPMQMService {
     @Autowired
     private ZhcxPmqManagementMapService zhcxPmqManagementMapService;
 
+    @Autowired
+    private ZhcxPmqManagementDistributionService zhcxPmqManagementDistributionService;
+
     @Override
     public List<Map<String, Object>> getPMQMData(Map<String, String> map) {
         //List<Map<String, Object>> res = new ArrayList<>();
@@ -172,10 +173,38 @@ public class ZhcxPMQMServiceImpl implements ZhcxPMQMService {
         sourceDao.updateProjectId();
         // 去更新部门
         updateDeptForMap();
+        // 职能部门去生产NA的派单数据
+        disposeFlowerDept();
         log.info("三单拉取数据执行完毕");
         return null;
     }
 
+    // 全量处理职能部门
+    private void disposeFlowerDept(){
+        try {
+        List<ZhcxPmqManagementRecoredDo> list = zhcxPMQMDao.getAllRecoredDoListInFlowerDept();
+        if(!list.isEmpty()){
+            log.info("开始全量处理职能部门");
+            for (ZhcxPmqManagementRecoredDo recoredDo : list) {
+                List<ZhcxPmqManagementDistributionDo> distributions = recoredDao.getDistributionsByPid(recoredDo.getId());
+                for (ZhcxPmqManagementDistributionDo distribution : distributions) {
+                    distribution.setId(SecurityUtil.getUUID());
+                    distribution.setRemark("职能部门设置NA");
+                    distribution.setStatus("NA");
+                }
+                zhcxPmqManagementDistributionService.saveBatch(distributions);
+                recoredDo.setDispatchstatus("1");
+                recoredDo.setClosestatus("NA");
+                recoredDo.setRemark("职能部门设置NA");
+                recoredDao.updateById(recoredDo);
+                zhcxPmqManagementDistributionDetailService.updateClosedStateInSecondFloor(recoredDo.getId());
+            }
+        }} catch (Exception e) {
+            e.printStackTrace();
+            log.error("全量处理职能部门派单数据异常!!");
+        }
+    }
+
     private void updateDeptForMap(){
         // 部门级别 一级部门:20 二级部门:10 分包商:30
         List<ZhcxPmqManagementMapDo> list = zhcxPMQMDao.getAllZhcxPmqManagementMapDoList();

+ 16 - 8
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxPmqManagementRecoredServiceImpl.java

@@ -91,24 +91,32 @@ public class ZhcxPmqManagementRecoredServiceImpl extends ServiceImpl<ZhcxPmqMana
             return R.ok("暂无需要派单");
         }
         // 第三层数据
-        List<ZhcxPmqManagementDistributionDetailDo> detailDos = new ArrayList<>();
+        //List<ZhcxPmqManagementDistributionDetailDo> detailDos = new ArrayList<>();
         for (ZhcxPmqManagementDistributionDo distribution : distributions) {
-            distribution.setId(SecurityUtil.getUUID());
+            //distribution.setId(SecurityUtil.getUUID());
             distribution.setConfirmerid(currentUser.getId());
             distribution.setConfirmer(currentUser.getName());
             distribution.setStatus(closestatus);
+            if(StringUtils.isEmpty(distribution.getId())){
+                distribution.setId(SecurityUtil.getUUID());
+                zhcxPmqManagementDistributionService.save(distribution);
+            }else {
+                zhcxPmqManagementDistributionService.updateById(distribution);
+            }
             // 生成第三层数据结构
             ZhcxPmqManagementDistributionDetailDo detailDo = new ZhcxPmqManagementDistributionDetailDo();
             BeanUtil.copyProperties(distribution,detailDo);
             detailDo.setId(SecurityUtil.getUUID());
             detailDo.setDistributid(distribution.getId());
             detailDo.setClosedata(new Date());
-            detailDos.add(detailDo);
+            zhcxPmqManagementDistributionDetailService.save(detailDo);
+            //detailDos.add(detailDo);
         }
         // 保存2.5层
-        zhcxPmqManagementDistributionService.saveBatch(distributions);
+        //zhcxPmqManagementDistributionService.saveBatch(distributions);
         // 保存第三层数据
-        zhcxPmqManagementDistributionDetailService.saveBatch(detailDos);
+        //zhcxPmqManagementDistributionDetailService.saveBatch(detailDos);
+
         // 更新第二层的派单状态
         //zhcxPmqManagementDistributionDao.updateDispatchStatus(id);
         ZhcxPmqManagementRecoredDo recoredDo = this.getById(id);
@@ -234,7 +242,7 @@ public class ZhcxPmqManagementRecoredServiceImpl extends ServiceImpl<ZhcxPmqMana
 
     @Override
     public R getListData(String id) {
-        List<ZhcxPmqManagementDistributionDo> distributions = getDistributionDataByPid(id);
+        List<ZhcxPmqManagementDistributionDo> distributions = baseMapper.getDistributionsByPid(id);
         Map<String, Object> results = new HashMap<>();
         results.put("records",distributions);
         results.put("current",1);
@@ -247,7 +255,7 @@ public class ZhcxPmqManagementRecoredServiceImpl extends ServiceImpl<ZhcxPmqMana
     }
 
     /**
-     * 构建2.5层三单数据(已保存) 不调用sqlserver查询机台状态
+     * 构建2.5层三单数据(已保存) 不调用sqlserver查询机台状态  (傻狗操作)
      * @param id record_id
      * @return 集合
      */
@@ -423,7 +431,7 @@ public class ZhcxPmqManagementRecoredServiceImpl extends ServiceImpl<ZhcxPmqMana
         String[] idSplit = id.split(",");
         for (String recordId : idSplit) {
             // 执行第2.5层保存操作
-            getDistributionDataByPid(recordId);
+            //getDistributionDataByPid(recordId);
         }
         // 查询组装