From 9b677ea5c6978788d135fc15da3d78c5a93789c2 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期二, 07 五月 2024 16:52:37 +0800
Subject: [PATCH] 代码整理1

---
 smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/wrapper/StatisticsWrapper.java |   58 ++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/wrapper/StatisticsWrapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/wrapper/StatisticsWrapper.java
index 11ab9aa..e0d5b1d 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/wrapper/StatisticsWrapper.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/wrapper/StatisticsWrapper.java
@@ -31,7 +31,6 @@
 import org.springframework.stereotype.Component;
 
 @Component
-/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/mdc/wrapper/StatisticsWrapper.class */
 public class StatisticsWrapper {
     private static final Logger log = LoggerFactory.getLogger(StatisticsWrapper.class);
     private final ITimeUsedAnalysisService timeUsedAnalysisService;
@@ -49,7 +48,7 @@
         Boolean isOutput = statisticsWrapperDto.getIsOutput();
         Integer queryType = statisticsAnalysisQueryVO.getQueryType();
         List<Integer> shiftIndexList = statisticsAnalysisQueryVO.getShiftIndexList();
-        new StatisticsVO();
+        
         ProductivityTypeEnum productivityType = statisticsAnalysisQueryVO.getProductivityType();
         switch (statisticsAnalysisQueryVO.getStatisticalMethod()) {
             case DAY:
@@ -77,7 +76,7 @@
                     break;
                 }
             default:
-                List<Long> workstationIds = (List) workstationPage.getRecords().stream().map((v0) -> {
+                List<Long> workstationIds = workstationPage.getRecords().stream().map((v0) -> {
                     return v0.getId();
                 }).collect(Collectors.toList());
                 Map<Long, List<ShiftIndexNameDTO>> idToValue = this.timeUsedAnalysisService.queryWorkStationShiftIndex(workstationIds, statisticsAnalysisQueryVO.getStartDate());
@@ -89,7 +88,7 @@
 
     public StatisticsVO buildDateDataSheet(List<IntervalDateDto> intervalDates, List<SuperAggregate> superAggregates, IPage<Workstation> workstationIPage, Boolean isOutput, ProductivityTypeEnum productivityType) {
         StatisticsVO statisticsVO = new StatisticsVO();
-        Map<Long, Map<Integer, List<SuperAggregate>>> collectGroupByDate = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
+        Map<Long, Map<Integer, List<SuperAggregate>>> collectGroupByDate = superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
             return v0.getWorkstationId();
         }, Collectors.groupingBy((v0) -> {
             return v0.getFactoryDate();
@@ -102,7 +101,7 @@
             statisticsDataVO.setId(workstation.getId().toString());
             statisticsDataVO.setWorkstationCode(workstation.getCode());
             statisticsDataVO.setWorkstationName(workstation.getName());
-            Map<Integer, List<SuperAggregate>> map = (Map) collectGroupByDate.get(workstation.getId());
+            Map<Integer, List<SuperAggregate>> map = collectGroupByDate.get(workstation.getId());
             LinkedHashMap<String, String> data = new LinkedHashMap<>();
             if (Func.isEmpty(map)) {
                 dayList.forEach(day -> {
@@ -110,7 +109,7 @@
                 });
             } else {
                 dayList.forEach(day2 -> {
-                    List<SuperAggregate> superAggregateList = (List) map.get(Integer.valueOf(day2.replaceAll("-", "")));
+                    List<SuperAggregate> superAggregateList = map.get(Integer.valueOf(day2.replaceAll("-", "")));
                     String value = getValue(superAggregateList, isOutput, productivityType);
                     data.put(day2, value);
                 });
@@ -126,12 +125,12 @@
     }
 
     public StatisticsVO buildDateData(List<IntervalDateDto> intervalDates, List<SuperAggregate> superAggregates, List<Workstation> workstationList, Boolean isOutput, ProductivityTypeEnum productivityType) {
-        Map<Long, Workstation> workstationIdToValue = (Map) workstationList.stream().collect(Collectors.toMap((v0) -> {
+        Map<Long, Workstation> workstationIdToValue = workstationList.stream().collect(Collectors.toMap((v0) -> {
             return v0.getId();
         }, v -> {
             return v;
         }));
-        List<Long> workstationIdList = (List) workstationList.stream().map((v0) -> {
+        List<Long> workstationIdList = workstationList.stream().map((v0) -> {
             return v0.getId();
         }).collect(Collectors.toList());
         StatisticsVO statisticsVO = new StatisticsVO();
@@ -173,14 +172,14 @@
 
     public StatisticsVO buildMonthOrWeekDataSheet(List<IntervalDateDto> intervalDates, List<SuperAggregate> superAggregates, IPage<Workstation> workstationIPage, Boolean isMonth, Boolean isOutput, ProductivityTypeEnum productivityType) {
         StatisticsVO statisticsVO = new StatisticsVO();
-        Map<Long, Map<Integer, Map<Integer, List<SuperAggregate>>>> collectGroupByMonth = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
+        Map<Long, Map<Integer, Map<Integer, List<SuperAggregate>>>> collectGroupByMonth = superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
             return v0.getWorkstationId();
         }, Collectors.groupingBy((v0) -> {
             return v0.getFactoryYear();
         }, Collectors.groupingBy((v0) -> {
             return v0.getFactoryMonth();
         }))));
-        Map<Long, Map<Integer, Map<Integer, List<SuperAggregate>>>> collectGroupByWeek = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
+        Map<Long, Map<Integer, Map<Integer, List<SuperAggregate>>>> collectGroupByWeek = superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
             return v0.getWorkstationId();
         }, Collectors.groupingBy((v0) -> {
             return v0.getFactoryYear();
@@ -197,9 +196,9 @@
             statisticsDataVO.setWorkstationName(workstation.getName());
             LinkedHashMap<String, String> data = new LinkedHashMap<>();
             if (isMonth.booleanValue()) {
-                yearMap = (Map) collectGroupByMonth.get(workstation.getId());
+                yearMap = collectGroupByMonth.get(workstation.getId());
             } else {
-                yearMap = (Map) collectGroupByWeek.get(workstation.getId());
+                yearMap = collectGroupByWeek.get(workstation.getId());
             }
             if (Func.isEmpty(yearMap)) {
                 intervalDates.forEach(intervalDateDto -> {
@@ -257,17 +256,17 @@
 
     public StatisticsVO buildMonthOrWeekData(List<IntervalDateDto> intervalDates, List<SuperAggregate> superAggregates, List<Workstation> workstationList, Boolean isMonth, Boolean isOutput, ProductivityTypeEnum productivityType) {
         Map<Integer, Map<Integer, Map<Long, List<SuperAggregate>>>> collectGroupByMonthOrWeek;
-        Map<Long, Workstation> workstationIdToValue = (Map) workstationList.stream().collect(Collectors.toMap((v0) -> {
+        Map<Long, Workstation> workstationIdToValue = workstationList.stream().collect(Collectors.toMap((v0) -> {
             return v0.getId();
         }, v -> {
             return v;
         }));
-        List<Long> workstationIdList = (List) workstationList.stream().map((v0) -> {
+        List<Long> workstationIdList = workstationList.stream().map((v0) -> {
             return v0.getId();
         }).collect(Collectors.toList());
         StatisticsVO statisticsVO = new StatisticsVO();
         if (isMonth.booleanValue()) {
-            collectGroupByMonthOrWeek = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
+            collectGroupByMonthOrWeek =  superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
                 return v0.getFactoryYear();
             }, Collectors.groupingBy((v0) -> {
                 return v0.getFactoryMonth();
@@ -275,7 +274,7 @@
                 return v0.getWorkstationId();
             }))));
         } else {
-            collectGroupByMonthOrWeek = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
+            collectGroupByMonthOrWeek = superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
                 return v0.getFactoryYear();
             }, Collectors.groupingBy((v0) -> {
                 return v0.getFactoryWeek();
@@ -288,7 +287,7 @@
         intervalDates.forEach(intervalDateDto -> {
             List<Integer> monthOrWeekList;
             Integer year = intervalDateDto.getYear();
-            Map<Integer, Map<Long, List<SuperAggregate>>> monthOrWeekToValue = (Map) finalCollectGroupByMonthOrWeek.get(year);
+            Map<Integer, Map<Long, List<SuperAggregate>>> monthOrWeekToValue = finalCollectGroupByMonthOrWeek.get(year);
             if (isMonth.booleanValue()) {
                 monthOrWeekList = intervalDateDto.getMonthList();
             } else {
@@ -340,8 +339,18 @@
         return statisticsVO;
     }
 
+    /**
+     * 鏋勫缓鏁堢巼鍒嗘瀽鐨勭粺璁℃暟鎹�
+     * @param superAggregates
+     * @param workstationIPage
+     * @param shiftIndexList
+     * @param idToValue
+     * @param isOutput
+     * @param productivityType
+     * @return
+     */
     public StatisticsVO buildShiftData(List<SuperAggregate> superAggregates, IPage<Workstation> workstationIPage, List<Integer> shiftIndexList, Map<Long, List<ShiftIndexNameDTO>> idToValue, Boolean isOutput, ProductivityTypeEnum productivityType) {
-        Map<Long, Map<Integer, List<SuperAggregate>>> collectGroupByShift = (Map) superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
+        Map<Long, Map<Integer, List<SuperAggregate>>> collectGroupByShift = superAggregates.stream().collect(Collectors.groupingBy((v0) -> {
             return v0.getWorkstationId();
         }, Collectors.groupingBy((v0) -> {
             return v0.getShiftIndex();
@@ -354,17 +363,17 @@
             statisticsDataVO.setId(String.valueOf(workstation.getId()));
             statisticsDataVO.setWorkstationCode(workstation.getCode());
             statisticsDataVO.setWorkstationName(workstation.getName());
-            Map<Integer, List<SuperAggregate>> map = (Map) collectGroupByShift.get(workstation.getId());
+            Map<Integer, List<SuperAggregate>> map = collectGroupByShift.get(workstation.getId());
             LinkedHashMap<String, String> data = new LinkedHashMap<>();
             LinkedHashMap<String, String> shiftData = new LinkedHashMap<>();
-            List<ShiftIndexNameDTO> shiftDetails = (List) idToValue.get(workstation.getId());
+            List<ShiftIndexNameDTO> shiftDetails = idToValue.get(workstation.getId());
             List<Integer> trueShiftIndexList = new ArrayList<>();
             Map<Integer, String> shiftIndexToName = new HashMap<>();
             if (Func.isNotEmpty(shiftDetails)) {
-                trueShiftIndexList = (List) shiftDetails.stream().map((v0) -> {
+                trueShiftIndexList = shiftDetails.stream().map((v0) -> {
                     return v0.getShiftIndex();
                 }).collect(Collectors.toList());
-                shiftIndexToName = (Map) shiftDetails.stream().collect(Collectors.toMap((v0) -> {
+                shiftIndexToName = shiftDetails.stream().collect(Collectors.toMap((v0) -> {
                     return v0.getShiftIndex();
                 }, (v0) -> {
                     return v0.getIndexName();
@@ -376,18 +385,19 @@
                 shiftIndexList.forEach(shiftIndex -> {
                     if (finalTrueShiftIndexList.contains(shiftIndex)) {
                         data.put(shiftIndex.toString(), "0");
+                    	//data.put(shiftIndex.toString(), "0.88");
                         shiftData.put(shiftIndex.toString(), finalShiftIndexToName.get(shiftIndex));
                         return;
                     }
                     data.put(shiftIndex.toString(), "-");
                     shiftData.put(shiftIndex.toString(), MessageUtils.message("mdc.not.schedule", new Object[0]));
                 });
-            } else {
+            } else {//鏈夋暟鎹殑鎯呭喌涓�
                 Map<Integer, String> finalShiftIndexToName1 = shiftIndexToName;
                 List<Integer> finalTrueShiftIndexList1 = trueShiftIndexList;
                 shiftIndexList.forEach(shiftIndex2 -> {
                     if (finalTrueShiftIndexList1.contains(shiftIndex2)) {
-                        List<SuperAggregate> superAggregateList = (List) map.get(shiftIndex2);
+                        List<SuperAggregate> superAggregateList = map.get(shiftIndex2);
                         String value = getValue(superAggregateList, isOutput, productivityType);
                         data.put(shiftIndex2.toString(), value);
                         shiftData.put(shiftIndex2.toString(), finalShiftIndexToName1.get(shiftIndex2));

--
Gitblit v1.9.3