src/main/java/com/ruoyi/home/controller/HomeController.java
@@ -162,15 +162,15 @@ @GetMapping("/processOutputAnalysis") @Operation(summary = "工序产出分析") public R processOutputAnalysis(@DefaultType Integer type){ List<MapDto> list = homeService.processOutputAnalysis(type); public R processOutputAnalysis(@DefaultType Integer dateType){ List<MapDto> list = homeService.processOutputAnalysis(dateType); return R.ok(list); } @GetMapping("/workOrderEfficiencyAnalysis") @Operation(summary = "工单执行效率分析") public R workOrderEfficiencyAnalysis(@DefaultType Integer type){ List<WorkOrderEfficiencyDto> list = homeService.workOrderEfficiencyAnalysis(type); public R workOrderEfficiencyAnalysis(@DefaultType Integer dateType){ List<WorkOrderEfficiencyDto> list = homeService.workOrderEfficiencyAnalysis(dateType); return R.ok(list); } src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -1345,17 +1345,17 @@ String endStr = endDate.atStartOfDay() .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); // List<Map<String, Object>> inputList = productionProductInputMapper.selectInputStats(startStr, endStr); List<Map<String, Object>> inputList = null; List<Map<String, Object>> inputList = productionProductInputMapper.selectInputStats(startStr, endStr); List<Map<String, Object>> outputList = productionProductOutputMapper.selectDailyOutputStats(startStr, endStr); Map<String, InputOutputAnalysisDto> dateMap = new HashMap<>(); if (!CollectionUtils.isEmpty(inputList)) { for (Map<String, Object> map : inputList) { String date = (String) map.get("date"); if (date == null) Object dateObj = map.get("date"); if (dateObj == null) continue; String date = dateObj.toString(); InputOutputAnalysisDto dto = dateMap.getOrDefault(date, new InputOutputAnalysisDto()); dto.setDate(date); BigDecimal qty = (BigDecimal) map.get("quantity"); @@ -1366,9 +1366,10 @@ if (!CollectionUtils.isEmpty(outputList)) { for (Map<String, Object> map : outputList) { String date = (String) map.get("date"); if (date == null) Object dateObj = map.get("date"); if (dateObj == null) continue; String date = dateObj.toString(); InputOutputAnalysisDto dto = dateMap.getOrDefault(date, new InputOutputAnalysisDto()); dto.setDate(date); BigDecimal qty = (BigDecimal) map.get("quantity"); src/main/resources/mapper/production/ProductionProductInputMapper.xml
@@ -43,4 +43,14 @@ order by ppi.create_time desc </select> <select id="selectInputStats" resultType="java.util.Map"> select date(create_time) as date, sum(ifnull(input_quantity, 0)) as quantity from production_product_input where create_time >= #{startDate} and create_time <= #{endDate} group by date(create_time) order by date asc </select> </mapper> src/main/resources/mapper/production/ProductionProductOutputMapper.xml
@@ -48,14 +48,14 @@ </select> <select id="selectDailyOutputStats" resultType="java.util.Map"> select date(create_time) as statDate, select date(create_time) as date, sum(ifnull(quantity, 0)) as quantity, sum(ifnull(scrap_qty, 0)) as scrapQty from production_product_output where create_time >= #{startDate} and create_time <= #{endDate} group by date(create_time) order by statDate asc order by date asc </select> </mapper>