sucheng пре 7 месеци
родитељ
комит
63fe0f06f6

+ 3 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProductionOrderDao.java

@@ -125,6 +125,9 @@ public interface ApsProductionOrderDao extends BaseMapper<ApsProductionOrderDo>
     ApsReportThProcessPhoto selectAvgThProcessPhoto(@Param("tenantId") String tenantId);
 
     List<ApsReportThProcessPhoto> selectThProcessPhoto(@Param("tenantId") String tenantId);
+
+    @Select("TRUNCATE TABLE ${tableName}")
+    void truncateByTableName(@Param("tableName") String tableName);
 }
 
 

+ 39 - 21
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductionOrderServiceImpl.java

@@ -49,6 +49,7 @@ import static com.rongwei.safecommon.utils.SaveConstans.DatePattern.DATE_PATTERN
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.*;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.*;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.*;
+import static java.lang.Thread.sleep;
 
 /**
  *
@@ -158,6 +159,8 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
 
 
     public static final String ERROR_MSG = "%s上诉订单的排程交货期大于承诺交货期";
+    @Autowired
+    private AspCheckItemsServiceImpl aspCheckItemsServiceImpl;
 
     /**
      * 发布订单排程
@@ -1159,18 +1162,21 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
             //近12月数据
             List<ApsReportThProcessPhoto> list = this.baseMapper.selectThProcessPhoto(key);
             if (ObjectUtil.isNotEmpty(list)) {
-                list.forEach(item -> {
-                    item.setId(SecurityUtil.getUUID());
+                int index = 1;
+                for (ApsReportThProcessPhoto item : list) {
+                    item.setId(key + String.format("%02d", index));
+                    index++;
                     item.setTenantid(key);
                     item.setTenantname(value);
                     item.setAvgplanproducevolume(avgApsReportThProcessPhoto.getAvgplanproducevolume());
                     item.setAvgactualproducevolume(avgApsReportThProcessPhoto.getAvgactualproducevolume());
-                });
+                }
                 resInsertList.addAll(list);
             }
         });
         if (ObjectUtil.isNotEmpty(resInsertList)) {
-            apsReportThProcessPhotoService.remove(new LambdaQueryWrapper<ApsReportThProcessPhoto>().eq(ApsReportThProcessPhoto::getDeleted, "0"));
+            this.baseMapper.truncateByTableName("aps_report_th_process_photo");
+//            apsReportThProcessPhotoService.remove(new LambdaQueryWrapper<ApsReportThProcessPhoto>().eq(ApsReportThProcessPhoto::getDeleted, "0"));
             apsReportThProcessPhotoService.saveBatch(resInsertList);
         }
     }
@@ -1204,18 +1210,21 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
             //近12月数据
             List<ApsReportZjProcessPhoto> list = this.baseMapper.selectZjProcessPhoto(key);
             if (ObjectUtil.isNotEmpty(list)) {
-                list.forEach(item -> {
-                    item.setId(SecurityUtil.getUUID());
+                int index = 1;
+                for (ApsReportZjProcessPhoto item : list) {
+                    item.setId(key + String.format("%02d", index));
+                    index++;
                     item.setTenantid(key);
                     item.setTenantname(value);
                     item.setAvgplanproducevolume(avgApsReportZjProcessPhoto.getAvgplanproducevolume());
                     item.setAvgactualproducevolume(avgApsReportZjProcessPhoto.getAvgactualproducevolume());
-                });
+                }
                 resInsertList.addAll(list);
             }
         });
         if (ObjectUtil.isNotEmpty(resInsertList)) {
-            apsReportZjProcessPhotoService.remove(new LambdaQueryWrapper<ApsReportZjProcessPhoto>().eq(ApsReportZjProcessPhoto::getDeleted, "0"));
+//            apsReportZjProcessPhotoService.remove(new LambdaQueryWrapper<ApsReportZjProcessPhoto>().eq(ApsReportZjProcessPhoto::getDeleted, "0"));
+            this.baseMapper.truncateByTableName("aps_report_zj_process_photo");
             apsReportZjProcessPhotoService.saveBatch(resInsertList);
         }
 
@@ -1250,18 +1259,21 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
             //近12月数据
             List<ApsReportJzProcessPhoto> list = this.baseMapper.selectProcessTrend(key);
             if (ObjectUtil.isNotEmpty(list)) {
-                list.forEach(item -> {
-                    item.setId(SecurityUtil.getUUID());
+                int index = 1;
+                for (ApsReportJzProcessPhoto item : list) {
+                    item.setId(key + String.format("%02d", index));
+                    index++;
                     item.setTenantid(key);
                     item.setTenantname(value);
                     item.setAvgplanproducevolume(avgApsReportJzProcessPhoto.getAvgplanproducevolume());
                     item.setAvgactualproducevolume(avgApsReportJzProcessPhoto.getAvgactualproducevolume());
-                });
+                }
                 resInsertList.addAll(list);
             }
         });
         if (ObjectUtil.isNotEmpty(resInsertList)) {
-            apsReportJzProcessPhotoService.remove(new QueryWrapper<ApsReportJzProcessPhoto>().lambda().eq(ApsReportJzProcessPhoto::getDeleted, "0"));
+//            apsReportJzProcessPhotoService.remove(new QueryWrapper<ApsReportJzProcessPhoto>().lambda().eq(ApsReportJzProcessPhoto::getDeleted, "0"));
+            this.baseMapper.truncateByTableName("aps_report_jz_process_photo");
             apsReportJzProcessPhotoService.saveBatch(resInsertList);
         }
     }
@@ -1296,19 +1308,22 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
             //近12月份值
             List<ApsReportCastRollPhoto> list = this.baseMapper.selectCastRollPhoto(key);
             if (ObjectUtil.isNotEmpty(list)) {
-                list.forEach(item -> {
-                    item.setId(SecurityUtil.getUUID());
+                int index = 1;
+                for (ApsReportCastRollPhoto item : list) {
+                    item.setId(key + String.format("%02d", index));
+                    index++;
                     item.setTenantid(key);
                     item.setTenantname(value);
                     item.setAvgplanproducevolume(apsReportCastRollPhotoAvg.getAvgplanproducevolume());
                     item.setAvgactualproducevolume(apsReportCastRollPhotoAvg.getAvgactualproducevolume());
-                });
+                }
                 resInsertList.addAll(list);
             }
         });
         //更新
         if (ObjectUtil.isNotEmpty(resInsertList)) {
-            apsReportCastRollPhotoService.remove(new LambdaQueryWrapper<ApsReportCastRollPhoto>().eq(ApsReportCastRollPhoto::getDeleted, "0"));
+//            apsReportCastRollPhotoService.remove(new LambdaQueryWrapper<ApsReportCastRollPhoto>().eq(ApsReportCastRollPhoto::getDeleted, "0"));
+            this.baseMapper.truncateByTableName("aps_report_cast_roll_photo");
             apsReportCastRollPhotoService.saveBatch(resInsertList);
         }
     }
@@ -1334,7 +1349,7 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
         }
     }
 
-    private void setOrderFinishTrend() {
+    private void setOrderFinishTrend() throws InterruptedException {
         List<ApsReportOrderFinishPhoto> resInsertList = new LinkedList<>();
         //根据工厂分别生成指定数据
         SaveConstans.COMPANY_MAP.forEach((key, value) -> {
@@ -1343,19 +1358,22 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
             //近12月值
             List<ApsReportOrderFinishPhoto> list = this.baseMapper.selectOrderFinishPhotoByMonth(key);
             if (ObjectUtil.isNotEmpty(list)) {
-                list.forEach(item -> {
-                    item.setId(SecurityUtil.getUUID());
+                int index = 1;
+                for (ApsReportOrderFinishPhoto item : list) {
+                    item.setId(key + String.format("%02d", index));
+                    index++;
                     item.setTenantid(key);
                     item.setTenantname(value);
                     item.setAvgplanproducevolume(apsReportOrderFinishPhotoAvg.getAvgplanproducevolume());
                     item.setAvgactualproducevolume(apsReportOrderFinishPhotoAvg.getAvgactualproducevolume());
-                });
+                }
                 resInsertList.addAll(list);
             }
         });
         //更新
         if (!resInsertList.isEmpty()) {
-            apsReportOrderFinishPhotoService.remove(new LambdaQueryWrapper<ApsReportOrderFinishPhoto>().eq(ApsReportOrderFinishPhoto::getDeleted, "0"));
+//            apsReportOrderFinishPhotoService.remove(new LambdaQueryWrapper<ApsReportOrderFinishPhoto>().eq(ApsReportOrderFinishPhoto::getDeleted, "0"));
+            this.baseMapper.truncateByTableName("aps_report_order_finish_photo");
             apsReportOrderFinishPhotoService.saveBatch(resInsertList);
         }
     }