维修月报 优化
正在显示
1 个修改的文件
包含
22 行增加
和
3 行删除
... | @@ -9,8 +9,10 @@ import com.skua.common.constant.BusinessConstant; | ... | @@ -9,8 +9,10 @@ import com.skua.common.constant.BusinessConstant; |
9 | import com.skua.core.api.vo.Result; | 9 | import com.skua.core.api.vo.Result; |
10 | import com.skua.core.aspect.annotation.AutoLog; | 10 | import com.skua.core.aspect.annotation.AutoLog; |
11 | import com.skua.core.context.BaseContextHandler; | 11 | import com.skua.core.context.BaseContextHandler; |
12 | import com.skua.core.util.ConvertUtils; | ||
12 | import com.skua.modules.base.service.IBaseService; | 13 | import com.skua.modules.base.service.IBaseService; |
13 | import com.skua.modules.common.service.ICommonSqlService; | 14 | import com.skua.modules.common.service.ICommonSqlService; |
15 | import com.skua.modules.equipment.service.IEquipmentAnalysisService; | ||
14 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; | 16 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; |
15 | import com.skua.modules.equipment.service.IEquipmentRepairService; | 17 | import com.skua.modules.equipment.service.IEquipmentRepairService; |
16 | import com.skua.modules.equipment.vo.EquipmentMaintainRepairReportVO; | 18 | import com.skua.modules.equipment.vo.EquipmentMaintainRepairReportVO; |
... | @@ -19,6 +21,7 @@ import com.skua.modules.equipment.vo.EquipmentRepairForm; | ... | @@ -19,6 +21,7 @@ import com.skua.modules.equipment.vo.EquipmentRepairForm; |
19 | import com.skua.modules.system.entity.SysDepart; | 21 | import com.skua.modules.system.entity.SysDepart; |
20 | import com.skua.modules.system.service.ISysDepartService; | 22 | import com.skua.modules.system.service.ISysDepartService; |
21 | import com.skua.tool.dfs.CaseWhen; | 23 | import com.skua.tool.dfs.CaseWhen; |
24 | import com.skua.tool.util.DigitalUtils; | ||
22 | import com.skua.tool.util.JSUtils; | 25 | import com.skua.tool.util.JSUtils; |
23 | import io.swagger.annotations.Api; | 26 | import io.swagger.annotations.Api; |
24 | import io.swagger.annotations.ApiOperation; | 27 | import io.swagger.annotations.ApiOperation; |
... | @@ -50,6 +53,8 @@ public class EquipmentInfoMonthReportController { | ... | @@ -50,6 +53,8 @@ public class EquipmentInfoMonthReportController { |
50 | private IEquipmentRepairService equipmentRepairService; | 53 | private IEquipmentRepairService equipmentRepairService; |
51 | @Autowired | 54 | @Autowired |
52 | private IBaseService baseService; | 55 | private IBaseService baseService; |
56 | @Autowired | ||
57 | private IEquipmentAnalysisService equipmentAnalysisService; | ||
53 | 58 | ||
54 | @AutoLog(value = "设备月报-设备管理情况") | 59 | @AutoLog(value = "设备月报-设备管理情况") |
55 | @ApiOperation(value = "设备月报-设备管理情况", notes = "设备月报-设备管理情况") | 60 | @ApiOperation(value = "设备月报-设备管理情况", notes = "设备月报-设备管理情况") |
... | @@ -243,7 +248,7 @@ public class EquipmentInfoMonthReportController { | ... | @@ -243,7 +248,7 @@ public class EquipmentInfoMonthReportController { |
243 | sql += " left join (select t.depart_id , (sum(t.plan_cost)/10000) 'plan_cost' from equipment_maintain_plan t where t.release_status = '1' and t.start_time >= '"+startDate+" 00:00:00' and t.end_time <='"+endDate+" 23:59:59' group by t.depart_id )bbb on bbb.depart_id = d.id "; | 248 | sql += " left join (select t.depart_id , (sum(t.plan_cost)/10000) 'plan_cost' from equipment_maintain_plan t where t.release_status = '1' and t.start_time >= '"+startDate+" 00:00:00' and t.end_time <='"+endDate+" 23:59:59' group by t.depart_id )bbb on bbb.depart_id = d.id "; |
244 | sql += " left join ( select depart_id, (ifnull(sum(total_cost),0)/10000) 'repair_cost' from equipment_repair where reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59' group by depart_id ) ccc on ccc.depart_id = d.id "; | 249 | sql += " left join ( select depart_id, (ifnull(sum(total_cost),0)/10000) 'repair_cost' from equipment_repair where reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59' group by depart_id ) ccc on ccc.depart_id = d.id "; |
245 | sql += " left join (select depart_id,count(1) 'repair_form_total_count' from equipment_repair where repair_date >= '"+startDate+" 00:00:00' and repair_date <='"+endDate+" 23:59:59' group by depart_id ) ddd on ddd.depart_id = d.id "; | 250 | sql += " left join (select depart_id,count(1) 'repair_form_total_count' from equipment_repair where repair_date >= '"+startDate+" 00:00:00' and repair_date <='"+endDate+" 23:59:59' group by depart_id ) ddd on ddd.depart_id = d.id "; |
246 | sql += " left join ( select depart_id,count(1) 'repair_form_complete_count' from equipment_repair where finish_flag in ('ywx','yys') and reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59' group by depart_id ) eee on eee.depart_id = d.id "; | 251 | sql += " left join ( select depart_id,count(1) 'repair_form_complete_count' from equipment_repair where finish_flag in ('ywx','yys') and repair_date >= '"+startDate+" 00:00:00' and repair_date <='"+endDate+" 23:59:59' group by depart_id ) eee on eee.depart_id = d.id "; |
247 | sql += " left join (select depart_id,count(1) 'complete_count' from inspection_task where task_state = '2' and task_start_time >= '"+startDate+" 00:00:00' and task_end_time <='"+endDate+" 23:59:59' group by depart_id ) fff on fff.depart_id = d.id "; | 252 | sql += " left join (select depart_id,count(1) 'complete_count' from inspection_task where task_state = '2' and task_start_time >= '"+startDate+" 00:00:00' and task_end_time <='"+endDate+" 23:59:59' group by depart_id ) fff on fff.depart_id = d.id "; |
248 | sql += " left join (select depart_id,count(1) 'total_count' from inspection_task where task_start_time >= '"+startDate+" 00:00:00' and task_end_time <='"+endDate+" 23:59:59' group by depart_id ) ggg on ggg.depart_id = d.id "; | 253 | sql += " left join (select depart_id,count(1) 'total_count' from inspection_task where task_start_time >= '"+startDate+" 00:00:00' and task_end_time <='"+endDate+" 23:59:59' group by depart_id ) ggg on ggg.depart_id = d.id "; |
249 | sql += " where d.depart_type = 1 "; | 254 | sql += " where d.depart_type = 1 "; |
... | @@ -251,8 +256,22 @@ public class EquipmentInfoMonthReportController { | ... | @@ -251,8 +256,22 @@ public class EquipmentInfoMonthReportController { |
251 | sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +") "; | 256 | sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +") "; |
252 | } | 257 | } |
253 | sql += " order by aaa.intact desc "; | 258 | sql += " order by aaa.intact desc "; |
254 | sql += " ) TTT where (TTT.intact+TTT.plan_cost+TTT.repair_cost+TTT.repair_form_complete_rate+TTT.repair_form_complete_count+TTT.inspection_complete_rate)>0"; | 259 | sql += " ) TTT where (TTT.intact+TTT.plan_cost+TTT.repair_cost+TTT.repair_form_complete_rate+TTT.repair_form_complete_count+TTT.inspection_complete_rate)>=0"; |
255 | return commonSqlService.queryForList(sql); | 260 | List<Map<String, Object>> queryMapList0 = commonSqlService.queryForList(sql); |
261 | List<Map<String, Object>> intactRateMapList = equipmentAnalysisService.equipmentInTactRateByDepart(new HashMap<String, Object>(){{ | ||
262 | put("startTime", startDate + BusinessConstant.startTimeSuffix); | ||
263 | put("endTime", endDate + BusinessConstant.endTimeSuffix); | ||
264 | put("departId", departIds); | ||
265 | }}); | ||
266 | for (Map<String, Object> item: queryMapList0) { | ||
267 | for (Map<String, Object> intactRateMap: intactRateMapList) { | ||
268 | if (item.get("depart_id").equals(intactRateMap.get("departId"))) { | ||
269 | item.put("intact", DigitalUtils.nPoint(ConvertUtils.getDouble(intactRateMap.get("intactRate"), 0) * 100, 2)); | ||
270 | break; | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | return queryMapList0; | ||
256 | } | 275 | } |
257 | //2 设备大修、更新开展情况 | 276 | //2 设备大修、更新开展情况 |
258 | private List<Map<String,Object>> equipmentMaintainList(String departIds,String startDate,String endDate){ | 277 | private List<Map<String,Object>> equipmentMaintainList(String departIds,String startDate,String endDate){ | ... | ... |
-
请 注册 或 登录 后发表评论