水厂运营分析 工单统计
正在显示
1 个修改的文件
包含
44 行增加
和
1 行删除
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 | } | ... | ... |
-
请 注册 或 登录 后发表评论