From 092f60d9159fc3484c116493e71631982d3c0bda Mon Sep 17 00:00:00 2001
From: huangjiayang <5265313@qq.com>
Date: 星期日, 27 四月 2025 17:59:31 +0800
Subject: [PATCH] 【UPDATE-定时任务】修改工序抓取定时任务,增加创建时间创建人字段
---
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java | 111 ++++++++++++++++++-------------------------------------
1 files changed, 37 insertions(+), 74 deletions(-)
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java
index 0522a73..4858d9e 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java
@@ -24,6 +24,7 @@
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@@ -257,14 +258,13 @@
}
apsGasPipingRouteStats = apsGasPipingRouteStatMapper.selectApsGasPipingRouteStatList(apsGasPipingRouteStat);
//鏍规嵁寮�宸ユ棩杩涜鍗囧簭鎺掑簭
- apsGasPipingRouteStats.sort((a, b)->a.getPlanStartDay().compareTo(b.getPlanStartDay()));
+ apsGasPipingRouteStats.sort((a, b)->a.getProcessPlanStartDay().compareTo(b.getProcessPlanStartDay()));
//宸ュ簭鍒嗙粍缁熻
HashMap<String, List<ApsResourceDateStat>> processMap = new HashMap<>();
List<HashMap<String, List<ApsResourceDateStat>>> processList = new ArrayList<>();
- HashMap<String, List<ApsResourceDateStat>> processMapMonth = new HashMap<>();
- List<HashMap<String, List<ApsResourceDateStat>>> processListMonth = new ArrayList<>();
//宸ュ簭寮�宸ユ棩鏈�
String planStartDate = "";
+ //缁熻鎵�鏈夊伐搴忓搴旂殑寮�宸ユ椂闂�
for (ApsGasPipingRouteStat apsGasPipingRouteStatTemp : apsGasPipingRouteStats) {
planStartDate = simpleDateFormat.format(apsGasPipingRouteStatTemp.getProcessPlanStartDay());
if("month".equals(apsGasPipingRouteStat.getSearchType())){
@@ -278,7 +278,9 @@
//鏌ヨ鏂欏彿宸ュ簭浜ц兘琛�
apsResourceDateStat.setRequireTimes(apsGasPipingRouteStatTemp.getProcessTotalTime().intValue());
if(apsResourceDateStat.getDesignTimes()!=0){
- apsResourceDateStat.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStat.getRequireTimes()/apsResourceDateStat.getDesignTimes()* 100L));
+ apsResourceDateStat.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStat.getRequireTimes())
+ .divide(BigDecimal.valueOf(apsResourceDateStat.getDesignTimes()), 2, RoundingMode.HALF_UP)
+ .multiply(BigDecimal.valueOf(100)));
}else{
apsResourceDateStat.setCapacityLoad(BigDecimal.valueOf(0));
}
@@ -289,86 +291,47 @@
apsResourceDateStatList.add(apsResourceDateStat);
processMap.put(apsGasPipingRouteStatTemp.getProcessName(), apsResourceDateStatList);
}
+ //鑱氬悎姣忛亾宸ュ簭鐨勫紑宸ユ椂闂村拰浜ц兘
processMap.forEach((processName, apsResourceDateStatList) -> {
- HashMap<String, ApsResourceDateStat> dayMap = new HashMap<>();
+ LinkedHashMap<String, ApsResourceDateStat> dayMap = new LinkedHashMap<>();
apsResourceDateStatList.forEach(apsResourceDateStat -> {
startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString());
- if("month".equals(apsGasPipingRouteStat.getSearchType())){
- if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){
- ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString());
- apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum().intValue():0);
- apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes()+apsResourceDateStat.getRequireTimes());
- if(apsResourceDateStatTemp.getDesignTimes()!=0){
- apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStatTemp.getRequireTimes()/apsResourceDateStatTemp.getDesignTimes()* 100L));
- }else{
- apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(0));
- }
- apsResourceDateStatTemp.setResourceGroupName(processName);
- apsResourceDateStatTemp.setPlanDay(apsResourceDateStat.getPlanDay());
- dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStatTemp);
+ if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){
+ ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString());
+ apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum().intValue():0);
+ apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes()+apsResourceDateStat.getRequireTimes());
+ if(apsResourceDateStatTemp.getDesignTimes()!=0){
+ apsResourceDateStat.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStat.getRequireTimes())
+ .divide(BigDecimal.valueOf(apsResourceDateStat.getDesignTimes()), 2, RoundingMode.HALF_UP)
+ .multiply(BigDecimal.valueOf(100)));
}else{
- dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStat);
+ apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(0));
}
+ apsResourceDateStatTemp.setResourceGroupName(processName);
+ apsResourceDateStatTemp.setPlanDay(apsResourceDateStat.getPlanDay());
+ dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStatTemp);
+ }else{
+ dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStat);
}
});
- if("month".equals(apsGasPipingRouteStat.getSearchType())){
- List<ApsResourceDateStat> tempList = new ArrayList<>();
- dayMap.forEach((key, value) -> {
- tempList.add(value);
- });
- processMapMonth.put(processName, tempList);
- }
+ List<ApsResourceDateStat> tempList = new ArrayList<>();
+ dayMap.forEach((key, value) -> {
+ tempList.add(value);
+ });
+// processMap.put(processName, tempList);
+ HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>();
+ temp.put(processName, tempList);
+ processList.add(temp);
});
+// for (String key : processMap.keySet()) {
+// HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>();
+// temp.put(key, processMap.get(key));
+// processList.add(temp);
+// }
+ //鎺掑簭鏃堕棿鏍囬
List<String> sortedStartPlanTimeList = new ArrayList<>(startPlanTimeSet);
Collections.sort(sortedStartPlanTimeList);
-// processMap.forEach((processName, apsResourceDateStatList) -> {
-// HashMap<String, ApsResourceDateStat> dayMap = new HashMap<>();
-// apsResourceDateStatList.forEach(apsResourceDateStat -> {
-// startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString());
-// if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){
-// ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString());
-// if("day".equals(apsGasPipingRouteStat.getSearchType())){
-// apsResourceDateStatTemp.setDesignTimes(apsResourceDateStatTemp.getDesignTimes()+apsResourceDateStat.getDesignTimes());
-// }else if("month".equals(apsGasPipingRouteStat.getSearchType())){
-// apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum().intValue():0);
-// }
-// apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes()+apsResourceDateStat.getRequireTimes());
-// if(apsResourceDateStatTemp.getDesignTimes()!=0){
-// apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStatTemp.getRequireTimes()/apsResourceDateStatTemp.getDesignTimes()* 100L));
-// }
-// apsResourceDateStatTemp.setResourceGroupName(processName);
-// dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStatTemp);
-// }else{
-// dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStat);
-// }
-// });
-// JSONArray tempList = new JSONArray();
-// dayMap.forEach((key, value) -> {
-// JSONObject temp = new JSONObject();
-// temp.put("planDay", key);
-// temp.put("designTimes", value.getDesignTimes());
-// temp.put("requireTimes", value.getRequireTimes());
-// temp.put("capacityLoad", value.getCapacityLoad());
-// temp.put("resourceGroupName", value.getResourceGroupName());
-// tempList.add(temp);
-// });
-// processData.add(new JSONObject().put(processName, tempList));
-// });
- if("month".equals(apsGasPipingRouteStat.getSearchType())){
- for (String key : processMapMonth.keySet()) {
- HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>();
- temp.put(key, processMapMonth.get(key));
- processListMonth.add(temp);
- }
- result.put("planTable", processListMonth);
- }else{
- for (String key : processMap.keySet()) {
- HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>();
- temp.put(key, processMap.get(key));
- processList.add(temp);
- }
- result.put("planTable", processList);
- }
+ result.put("planTable", processList);
result.put("planTitle", sortedStartPlanTimeList);
} catch (Exception e) {
e.printStackTrace();
--
Gitblit v1.9.3