Merge remote-tracking branch 'origin/master' into master
正在显示
2 个修改的文件
包含
68 行增加
和
23 行删除
1 | package com.skua.modules.dataAnalysis.controller; | 1 | package com.skua.modules.dataAnalysis.controller; |
2 | 2 | ||
3 | import cn.hutool.core.bean.BeanUtil; | ||
4 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
5 | import com.skua.common.constant.BusinessConstant; | ||
3 | import com.skua.core.api.vo.Result; | 6 | import com.skua.core.api.vo.Result; |
7 | import com.skua.core.context.SpringContextUtils; | ||
4 | import com.skua.modules.dataAnalysis.service.IFactoryCenterService; | 8 | import com.skua.modules.dataAnalysis.service.IFactoryCenterService; |
5 | import com.skua.modules.dataAnalysis.service.IFactoryOperateCenterService; | 9 | import com.skua.modules.dataAnalysis.service.IFactoryOperateCenterService; |
6 | import com.skua.modules.dataAnalysis.vo.*; | 10 | import com.skua.modules.dataAnalysis.vo.*; |
11 | import com.skua.modules.flow.business.service.FlowBusinessService; | ||
12 | import com.skua.modules.flow.core.entity.BladeFlow; | ||
13 | import com.skua.modules.flow.support.Condition; | ||
14 | import com.skua.modules.flow.support.Query; | ||
15 | import com.skua.tool.util.DateUtils; | ||
7 | import io.swagger.annotations.Api; | 16 | import io.swagger.annotations.Api; |
8 | import io.swagger.annotations.ApiOperation; | 17 | import io.swagger.annotations.ApiOperation; |
9 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
... | @@ -25,6 +34,9 @@ public class FactoryOperateCenterController { | ... | @@ -25,6 +34,9 @@ public class FactoryOperateCenterController { |
25 | @Autowired | 34 | @Autowired |
26 | private IFactoryOperateCenterService factoryOperateCenterService; | 35 | private IFactoryOperateCenterService factoryOperateCenterService; |
27 | 36 | ||
37 | @Autowired | ||
38 | private FlowBusinessService flowBusinessService; | ||
39 | |||
28 | @ApiOperation(value="厂区统计数据", notes="厂区统计数据") | 40 | @ApiOperation(value="厂区统计数据", notes="厂区统计数据") |
29 | @GetMapping(value = "/getData") | 41 | @GetMapping(value = "/getData") |
30 | public Result<Map<String,Object>> getData(String departId,String month) { | 42 | public Result<Map<String,Object>> getData(String departId,String month) { |
... | @@ -100,8 +112,39 @@ public class FactoryOperateCenterController { | ... | @@ -100,8 +112,39 @@ public class FactoryOperateCenterController { |
100 | @GetMapping(value = "/flow") | 112 | @GetMapping(value = "/flow") |
101 | public Result<Map<String,Object>> getFlowData(String departId,String month) { | 113 | public Result<Map<String,Object>> getFlowData(String departId,String month) { |
102 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); | 114 | Result<Map<String,Object>> result = new Result<Map<String,Object>>(); |
103 | Map<String,Object> map = factoryOperateCenterService.getFlowData(departId,month); | 115 | // Map<String,Object> map = factoryOperateCenterService.getFlowData(departId,month); |
116 | WorkAnalysisController workAnalysisController = (WorkAnalysisController) SpringContextUtils.getBean(WorkAnalysisController.class); | ||
117 | int days = DateUtils.lengthOfSomeMonth(Integer.parseInt(month.split("-")[0]), Integer.parseInt(month.split("-")[1])); | ||
118 | String startTime = month + "-01" + BusinessConstant.startTimeSuffix; | ||
119 | String endTime = month + "-" + days + BusinessConstant.endTimeSuffix; | ||
120 | Result<List<ProcessProgressVO>> voResult = workAnalysisController.analysisByProcessProgress(1, departId, 1, startTime.substring(0, 10), endTime.substring(0 ,10)); | ||
121 | int ing = 0, no = 0, yes = 0, total = 0; | ||
122 | if (!voResult.getResult().isEmpty()) { | ||
123 | Map<String, Object> tmpMap = BeanUtil.beanToMap(voResult.getResult().get(0), false, true); | ||
124 | for (String key: tmpMap.keySet()) { | ||
125 | if (key.endsWith("TotalNum")) { | ||
126 | total += Integer.parseInt(tmpMap.get(key).toString()); | ||
127 | } else if (key.endsWith("HandleNum")) { | ||
128 | yes += Integer.parseInt(tmpMap.get(key).toString()); | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | // 查询工作流待签收 | ||
133 | BladeFlow bladeFlow = new BladeFlow(); | ||
134 | bladeFlow.setBeginDate(DateUtils.strToDate(startTime, BusinessConstant.dateFormat)); | ||
135 | bladeFlow.setEndDate(DateUtils.strToDate(endTime, BusinessConstant.dateFormat)); | ||
136 | Query query = new Query(); | ||
137 | query.setCurrent(1); | ||
138 | query.setSize(10000); | ||
139 | IPage<BladeFlow> claimPage = this.flowBusinessService.selectClaimPage(Condition.getPage(query), bladeFlow); | ||
140 | no = claimPage.getRecords().size(); | ||
104 | result.setSuccess(true); | 141 | result.setSuccess(true); |
142 | |||
143 | Map<String, Object> map = new HashMap<>(); | ||
144 | map.put("no", no); | ||
145 | map.put("ing", total - yes - no); | ||
146 | map.put("yes", yes); | ||
147 | map.put("total", total); | ||
105 | result.setResult(map); | 148 | result.setResult(map); |
106 | return result; | 149 | return result; |
107 | } | 150 | } | ... | ... |
... | @@ -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 | ... | ... |
-
请 注册 或 登录 后发表评论