设备月报 优化
正在显示
3 个修改的文件
包含
28 行增加
和
11 行删除
... | @@ -11,6 +11,7 @@ import com.skua.core.aspect.annotation.AutoLog; | ... | @@ -11,6 +11,7 @@ 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.core.util.ConvertUtils; |
13 | import com.skua.modules.base.service.IBaseService; | 13 | import com.skua.modules.base.service.IBaseService; |
14 | import com.skua.modules.biz.IBusinessService; | ||
14 | import com.skua.modules.common.service.ICommonSqlService; | 15 | import com.skua.modules.common.service.ICommonSqlService; |
15 | import com.skua.modules.equipment.service.IEquipmentAnalysisService; | 16 | import com.skua.modules.equipment.service.IEquipmentAnalysisService; |
16 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; | 17 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; |
... | @@ -56,6 +57,8 @@ public class EquipmentInfoMonthReportController { | ... | @@ -56,6 +57,8 @@ public class EquipmentInfoMonthReportController { |
56 | private IBaseService baseService; | 57 | private IBaseService baseService; |
57 | @Autowired | 58 | @Autowired |
58 | private IEquipmentAnalysisService equipmentAnalysisService; | 59 | private IEquipmentAnalysisService equipmentAnalysisService; |
60 | @Autowired | ||
61 | private IBusinessService businessService; | ||
59 | 62 | ||
60 | @AutoLog(value = "设备月报-设备管理情况") | 63 | @AutoLog(value = "设备月报-设备管理情况") |
61 | @ApiOperation(value = "设备月报-设备管理情况", notes = "设备月报-设备管理情况") | 64 | @ApiOperation(value = "设备月报-设备管理情况", notes = "设备月报-设备管理情况") |
... | @@ -315,14 +318,28 @@ public class EquipmentInfoMonthReportController { | ... | @@ -315,14 +318,28 @@ public class EquipmentInfoMonthReportController { |
315 | sql += " left join sys_dict_item di on di.item_value = t.equipment_level where t.install_date >= '"+startDate+"' and t.install_date <= '"+endDate+"' group by t.depart_id "; | 318 | sql += " left join sys_dict_item di on di.item_value = t.equipment_level where t.install_date >= '"+startDate+"' and t.install_date <= '"+endDate+"' group by t.depart_id "; |
316 | sql += " )aaa on aaa.depart_id = d.id "; | 319 | sql += " )aaa on aaa.depart_id = d.id "; |
317 | sql += " where d.depart_type = 1 ";*/ | 320 | sql += " where d.depart_type = 1 ";*/ |
318 | String sql ="select d.depart_name, aaa.* from ("; | 321 | // String sql ="select d.depart_name, aaa.* from ("; |
319 | sql += " select t.id 'info_id', t.depart_id , t.equipment_name, t.asset_amount, di.item_text 'equipment_level' from equipment_info t "; | 322 | // sql += " select t.id 'info_id', t.depart_id , t.equipment_name, t.asset_amount, di.item_text 'equipment_level' from equipment_info t "; |
320 | sql += " left join sys_dict_item di on di.item_value = t.equipment_level "; | 323 | // sql += " left join sys_dict_item di on di.item_value = t.equipment_level "; |
321 | sql += " where t.create_time >= '"+startDate+"' and t.create_time <= '"+endDate+"' "; | 324 | // sql += " where t.create_time >= '"+startDate+"' and t.create_time <= '"+endDate+"' "; |
322 | sql += ")aaa left join sys_depart d on aaa.depart_id = d.id "; | 325 | // sql += ")aaa left join sys_depart d on aaa.depart_id = d.id "; |
323 | if(StringUtils.isNotEmpty(departIds)){ | 326 | // if(StringUtils.isNotEmpty(departIds)){ |
324 | sql += " and aaa.depart_id in ("+ JSUtils.quoteEach(departIds,",") +") "; | 327 | // sql += " and aaa.depart_id in ("+ JSUtils.quoteEach(departIds,",") +") "; |
328 | // } | ||
329 | String inDepartIds = Arrays.stream(departIds.split(",")).map(item -> "'" + item + "'").collect(Collectors.joining(",")); | ||
330 | String sql = " select equipment_id from (select emp.maintenance_type , emt.results_enforcement, emt.depart_id, emt.equipment_id from equipment_maintain_task emt left join equipment_maintain_plan emp on emt.plan_id = emp.id "; | ||
331 | 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 + ")"; | ||
332 | sql = "select * from equipment_info where id in (" + sql + ") and id is not null"; | ||
333 | List<Map<String, Object>> queryMapList0 = commonSqlService.queryForList(sql); | ||
334 | // 翻译 | ||
335 | Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null); | ||
336 | Map<String, String> equipmentLevelDictMap = businessService.dictMap("equipment-equipment_level", null); | ||
337 | for (Map<String, Object> item: queryMapList0) { | ||
338 | String departId = ConvertUtils.getString(item.get("depart_id")); | ||
339 | String equipmentLevel = ConvertUtils.getString(item.get("equipment_level")); | ||
340 | item.put("depart_name", sysDepartDictMap.get(departId)); | ||
341 | item.put("equipment_level", equipmentLevelDictMap.get(equipmentLevel)); | ||
325 | } | 342 | } |
326 | return commonSqlService.queryForList(sql); | 343 | return queryMapList0; |
327 | } | 344 | } |
328 | } | 345 | } | ... | ... |
... | @@ -929,7 +929,7 @@ | ... | @@ -929,7 +929,7 @@ |
929 | </select> | 929 | </select> |
930 | <!--维护维修费用详情 --> | 930 | <!--维护维修费用详情 --> |
931 | <select id="getContrastCostDetails" resultType="java.util.Map"> | 931 | <select id="getContrastCostDetails" resultType="java.util.Map"> |
932 | select d.id depart_id , d.depart_name ,ifnull(aaa.maintainCost,0) maintainCost,ifnull(bbb.repairCost,0) repairCost from sys_depart d | 932 | select d.id depart_id , d.depart_name ,round(ifnull(aaa.maintainCost,0) / 10000, 2) maintainCost,round(ifnull(bbb.repairCost,0) / 10000, 2) repairCost from sys_depart d |
933 | left join ( | 933 | left join ( |
934 | SELECT emt.depart_id , IFNULL(sum(emt.maintenance_cost),0) maintainCost | 934 | SELECT emt.depart_id , IFNULL(sum(emt.maintenance_cost),0) maintainCost |
935 | FROM equipment_maintain_task emt | 935 | FROM equipment_maintain_task emt | ... | ... |
... | @@ -1052,8 +1052,8 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi | ... | @@ -1052,8 +1052,8 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi |
1052 | contrastCost.forEach(c -> { | 1052 | contrastCost.forEach(c -> { |
1053 | ContrastVO contrastVO = new ContrastVO(); | 1053 | ContrastVO contrastVO = new ContrastVO(); |
1054 | String month = c.get("month").toString(); | 1054 | String month = c.get("month").toString(); |
1055 | String maintainCost = c.get("maintainCost").toString(); | 1055 | String maintainCost = DigitalUtils.nPoint(ConvertUtils.getDouble(c.get("maintainCost"), 0) / 10000, 2); |
1056 | String repairCost = c.get("repairCost").toString(); | 1056 | String repairCost = DigitalUtils.nPoint(ConvertUtils.getDouble(c.get("repairCost"), 2) / 10000, 2); |
1057 | contrastVO.setMonth(month); | 1057 | contrastVO.setMonth(month); |
1058 | contrastVO.setMaintainNum(maintainCost); | 1058 | contrastVO.setMaintainNum(maintainCost); |
1059 | contrastVO.setRepairNum(repairCost); | 1059 | contrastVO.setRepairNum(repairCost); | ... | ... |
-
请 注册 或 登录 后发表评论