9b05e167 sonin

设备月报 维修管理情况

1 个父辈 e8a606b6
...@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
33 import org.springframework.web.bind.annotation.RestController; 33 import org.springframework.web.bind.annotation.RestController;
34 34
35 import java.util.*; 35 import java.util.*;
36 import java.util.stream.Collectors;
36 37
37 /** 38 /**
38 * 维修维护报表 39 * 维修维护报表
...@@ -88,20 +89,20 @@ public class EquipmentInfoMonthReportController { ...@@ -88,20 +89,20 @@ public class EquipmentInfoMonthReportController {
88 // 设备管理情况 89 // 设备管理情况
89 Map<String,Object> childDataMap = equipmentDetail(childDepartIds, startDate, endDate); 90 Map<String,Object> childDataMap = equipmentDetail(childDepartIds, startDate, endDate);
90 // 设备大修、更新开展情况 91 // 设备大修、更新开展情况
91 CaseWhen caseWhen = new CaseWhen(); 92 // CaseWhen caseWhen = new CaseWhen();
92 caseWhen.selectCaseWhen("equipment_maintain_task.results_enforcement = 3", "hasFinish"); 93 // caseWhen.selectCaseWhen("equipment_maintain_task.results_enforcement = 3", "hasFinish");
93 caseWhen.selectCaseWhen("equipment_maintain_task.results_enforcement != 3", "notFinish"); 94 // caseWhen.selectCaseWhen("equipment_maintain_task.results_enforcement != 3", "notFinish");
94 QueryWrapper<?> queryWrapper0 = new QueryWrapper<>(); 95 // QueryWrapper<?> queryWrapper0 = new QueryWrapper<>();
95 queryWrapper0.ge("equipment_maintain_task.maintain_time", startDate + BusinessConstant.startTimeSuffix) 96 // queryWrapper0.ge("equipment_maintain_task.maintain_time", startDate + BusinessConstant.startTimeSuffix)
96 .le("equipment_maintain_task.maintain_time", endDate + BusinessConstant.endTimeSuffix) 97 // .le("equipment_maintain_task.maintain_time", endDate + BusinessConstant.endTimeSuffix)
97 .eq("equipment_maintain_plan.maintenance_type", "dxjg") 98 // .eq("equipment_maintain_plan.maintenance_type", "dxjg")
98 .eq("equipment_maintain_plan.release_status", "1") 99 // .eq("equipment_maintain_plan.release_status", "1")
99 .ge("equipment_maintain_plan.start_time", startDate + BusinessConstant.startTimeSuffix) 100 // .ge("equipment_maintain_plan.start_time", startDate + BusinessConstant.startTimeSuffix)
100 .le("equipment_maintain_plan.end_time", endDate + BusinessConstant.endTimeSuffix) 101 // .le("equipment_maintain_plan.end_time", endDate + BusinessConstant.endTimeSuffix)
101 .in("equipment_maintain_plan.depart_id", Arrays.asList(childDepartIds.split(","))); 102 // .in("equipment_maintain_plan.depart_id", Arrays.asList(childDepartIds.split(",")));
102 Map<String, Object> queryMap0 = baseService.queryForMap("select " + caseWhen.print() + " from equipment_maintain_task left join equipment_maintain_plan on equipment_maintain_task.plan_id = equipment_maintain_plan.id", queryWrapper0); 103 // Map<String, Object> queryMap0 = baseService.queryForMap("select " + caseWhen.print() + " from equipment_maintain_task left join equipment_maintain_plan on equipment_maintain_task.plan_id = equipment_maintain_plan.id", queryWrapper0);
103 childDataMap.put("hasFinish", queryMap0.get("hasFinish")); 104 // childDataMap.put("hasFinish", queryMap0.get("hasFinish"));
104 childDataMap.put("notFinish", queryMap0.get("notFinish")); 105 // childDataMap.put("notFinish", queryMap0.get("notFinish"));
105 // 设备更新情况 106 // 设备更新情况
106 List<Map<String,Object>> childEquipmentUpdateList = equipmentUpdateList(childDepartIds, startDate, endDate); 107 List<Map<String,Object>> childEquipmentUpdateList = equipmentUpdateList(childDepartIds, startDate, endDate);
107 childDataMap.put("equipmentUpdateList", childEquipmentUpdateList); 108 childDataMap.put("equipmentUpdateList", childEquipmentUpdateList);
...@@ -199,14 +200,15 @@ public class EquipmentInfoMonthReportController { ...@@ -199,14 +200,15 @@ public class EquipmentInfoMonthReportController {
199 //设备管理情况 200 //设备管理情况
200 private Map<String,Object> equipmentDetail(String departIds,String startDate,String endDate){ 201 private Map<String,Object> equipmentDetail(String departIds,String startDate,String endDate){
201 Map<String,Object> dataMap = new HashMap<>(); 202 Map<String,Object> dataMap = new HashMap<>();
203 String inDepartIds = Arrays.stream(departIds.split(",")).map(item -> "'" + item + "'").collect(Collectors.joining(","));
202 String sql = ""; 204 String sql = "";
203 //月度计划维修费合计XX万元 205 //月度计划维修费合计XX万元
204 sql = "select round(sum(ifnull(plan_cost,0))/10000,2) 'plan_cost' from equipment_maintain_plan where release_status = '1' and start_time >= '"+startDate+" 00:00:00' and end_time <='"+endDate+" 23:59:59'"; 206 sql = "select round(sum(ifnull(plan_cost,0))/10000,2) 'plan_cost' from equipment_maintain_plan where release_status = '1' and start_time >= '"+startDate+" 00:00:00' and end_time <='"+endDate+" 23:59:59' and depart_id in (" + inDepartIds + ")";
205 String plan_cost = commonSqlService.queryForString(sql); 207 String plan_cost = commonSqlService.queryForString(sql);
206 dataMap.put("planCost",plan_cost);//月度计划维修费合计XX万元 208 dataMap.put("planCost",plan_cost);//月度计划维修费合计XX万元
207 //执行XX万元 209 //执行XX万元
208 // sql = "select round(ifnull(sum(total_cost),0)/10000,2) 'repair_cost' from equipment_repair where reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59'"; 210 // sql = "select round(ifnull(sum(total_cost),0)/10000,2) 'repair_cost' from equipment_repair where reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59'";
209 sql = "select round(ifnull(sum(maintenance_cost),0)/10000,2) 'repair_cost' from equipment_maintain_task where real_end_time >= '"+startDate+" 00:00:00' and real_end_time <='"+endDate+" 23:59:59'"; 211 sql = "select round(ifnull(sum(maintenance_cost),0)/10000,2) 'repair_cost' from equipment_maintain_task where real_end_time >= '"+startDate+" 00:00:00' and real_end_time <='"+endDate+" 23:59:59' and depart_id in (" + inDepartIds + ")";
210 String repair_cost = commonSqlService.queryForString(sql); 212 String repair_cost = commonSqlService.queryForString(sql);
211 dataMap.put("repairCost",repair_cost);//执行XX万元 213 dataMap.put("repairCost",repair_cost);//执行XX万元
212 String expression = "100 * "+ repair_cost +" /"+plan_cost; 214 String expression = "100 * "+ repair_cost +" /"+plan_cost;
...@@ -214,21 +216,21 @@ public class EquipmentInfoMonthReportController { ...@@ -214,21 +216,21 @@ public class EquipmentInfoMonthReportController {
214 216
215 217
216 //本月计划开展大修技改项目XX项,完成XX项 218 //本月计划开展大修技改项目XX项,完成XX项
217 sql = " select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id "; 219 sql = " select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement, emt.depart_id from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
218 sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.maintenance_type = 'dxjg' "; 220 sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.maintenance_type = 'dxjg' and aaa.depart_id in (" + inDepartIds + ")";
219 String dxjg_count = commonSqlService.queryForString(sql); 221 String dxjg_count = commonSqlService.queryForString(sql);
220 dataMap.put("dxjgCount",dxjg_count);//本月计划开展大修技改项目XX项,完成XX项 222 dataMap.put("dxjgCount",dxjg_count);//本月计划开展大修技改项目XX项,完成XX项
221 223
222 sql = " select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id "; 224 sql = " select count(1) 'count' from ( select emp.maintenance_type , emt.results_enforcement, emt.depart_id from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
223 sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg' "; 225 sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg' and aaa.depart_id in (" + inDepartIds + ")";
224 String dxjg_complete_count = commonSqlService.queryForString(sql); 226 String dxjg_complete_count = commonSqlService.queryForString(sql);
225 dataMap.put("dxjg_complete_count",dxjg_complete_count);//完成XX项 227 dataMap.put("dxjg_complete_count",dxjg_complete_count);//完成XX项
226 228
227 dataMap.put("dxjg_sy_count",dxjg_complete_count);//剩余 229 dataMap.put("dxjg_sy_count",dxjg_complete_count);//剩余
228 230
229 //生产类设备资产购置XX台 231 //生产类设备资产购置XX台
230 sql = " select count(1) 'count' from (select emp.maintenance_type , emt.results_enforcement from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id "; 232 sql = " select count(1) 'count' from (select emp.maintenance_type , emt.results_enforcement, emt.depart_id from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id ";
231 sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg'"; 233 sql += " where emt.maintain_time >= '"+startDate+" 00:00:00' and emt.maintain_time <='"+endDate+" 23:59:59' ) aaa where aaa.results_enforcement >2 and aaa.maintenance_type = 'dxjg' and aaa.depart_id in (" + inDepartIds + ")";
232 String equipment_count = commonSqlService.queryForString(sql); 234 String equipment_count = commonSqlService.queryForString(sql);
233 dataMap.put("equipmentCount",equipment_count);//生产类设备资产购置XX台 235 dataMap.put("equipmentCount",equipment_count);//生产类设备资产购置XX台
234 236
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!