Merge remote-tracking branch 'origin/master' into master
正在显示
8 个修改的文件
包含
316 行增加
和
63 行删除
1 | package com.skua.modules.report.service.impl; | 1 | package com.skua.modules.report.service.impl; |
2 | 2 | ||
3 | import cn.hutool.core.util.StrUtil; | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
4 | import com.skua.common.constant.BusinessConstant; | 5 | import com.skua.common.constant.BusinessConstant; |
5 | import com.skua.common.constant.ReportConstant; | 6 | import com.skua.common.constant.ReportConstant; |
... | @@ -175,34 +176,46 @@ public class OperationReportServiceImpl implements IOperationReportService { | ... | @@ -175,34 +176,46 @@ public class OperationReportServiceImpl implements IOperationReportService { |
175 | 176 | ||
176 | // 翻译 | 177 | // 翻译 |
177 | Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null); | 178 | Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null); |
179 | Map<String, String> sysUserDictMap = businessService.dictMap("sys_user", null); | ||
178 | // 1. 重点工作事项:取重点事项推进情况里面,当月完成的重点事项记录 | 180 | // 1. 重点工作事项:取重点事项推进情况里面,当月完成的重点事项记录 |
179 | QueryWrapper<?> queryWrapper1 = new QueryWrapper<>(); | 181 | QueryWrapper<?> queryWrapper1 = new QueryWrapper<>(); |
180 | queryWrapper1.eq("status", "2") | 182 | queryWrapper1.eq("status", "2") |
181 | .ge("end_time", startDate) | 183 | .ge("end_time", startDate) |
182 | .le("end_time", endDate); | 184 | .le("end_time", endDate); |
183 | List<Map<String, Object>> queryMapList1 = baseService.queryForList("select * from f_major_issues_process", queryWrapper1); | 185 | List<Map<String, Object>> queryMapList1 = baseService.queryForList("select * from f_major_issues_process", queryWrapper1); |
184 | for (Map<String, Object> item: queryMapList1) { | 186 | List<Map<String, Object>> priorityWorkItemList = queryMapList1.stream().map(item -> { |
185 | List<Map<String, Object>> priorityWorkItemList = new ArrayList<>(); | 187 | Map<String, Object> entityMap = item.keySet().stream().collect(Collectors.toMap(StrUtil::toCamelCase, key -> (item.get(key) == null ? "" : item.get(key)))); |
186 | priorityWorkItemList.add(new HashMap<String, Object>(){{ | 188 | entityMap.put("departName", sysDepartDictMap.get(item.get("depart_id"))); |
187 | put("key0", item.get("depart_id")); | 189 | return entityMap; |
188 | put("value0", sysDepartDictMap.get(item.get("depart_id"))); | 190 | }).collect(Collectors.toList()); |
189 | }}); | 191 | productDataVO.setPriorityWorkItemList(priorityWorkItemList); |
190 | productDataVO.setPriorityWorkItemList(priorityWorkItemList); | ||
191 | } | ||
192 | // 2: 隐患排查巡检:取风险点巡检记录里面巡检类型是生产巡检的数据 | 192 | // 2: 隐患排查巡检:取风险点巡检记录里面巡检类型是生产巡检的数据 |
193 | QueryWrapper<?> queryWrapper2 = new QueryWrapper<>(); | 193 | QueryWrapper<?> queryWrapper2 = new QueryWrapper<>(); |
194 | queryWrapper2.eq("inspection_type", "1") | 194 | queryWrapper2.eq("inspection_type", "1") |
195 | .eq("status", "2") | ||
195 | .ge("end_date", startDate + BusinessConstant.startTimeSuffix) | 196 | .ge("end_date", startDate + BusinessConstant.startTimeSuffix) |
196 | .le("end_date", endDate + BusinessConstant.endTimeSuffix); | 197 | .le("end_date", endDate + BusinessConstant.endTimeSuffix); |
197 | List<Map<String, Object>> queryMapList2 = baseService.queryForList("select * from danger_inspection_record", queryWrapper2); | 198 | List<Map<String, Object>> queryMapList2 = baseService.queryForList("select * from danger_inspection_record", queryWrapper2); |
198 | for (Map<String, Object> item: queryMapList2) { | 199 | Map<String, String> recordId2CountMap; |
199 | List<Map<String, Object>> hiddenDangerInspectionList = new ArrayList<>(); | 200 | if (!queryMapList2.isEmpty()) { |
200 | hiddenDangerInspectionList.add(new HashMap<String, Object>(){{ | 201 | List<String> recordIdList = queryMapList2.stream().map(item -> ConvertUtils.getString(item.get("id"))).collect(Collectors.toList()); |
201 | put("key0", item.get("depart_id")); | 202 | QueryWrapper<?> tmpQueryWrapper = new QueryWrapper<>(); |
202 | put("value0", sysDepartDictMap.get(item.get("depart_id"))); | 203 | tmpQueryWrapper.in("danger_inspection_record.id", recordIdList) |
203 | }}); | 204 | .eq("danger_inspection_item.status", "0") |
204 | productDataVO.setHiddenDangerInspectionList(hiddenDangerInspectionList); | 205 | .groupBy("danger_inspection_record.id"); |
206 | List<Map<String, Object>> tmpQueryMapList = baseService.queryForList("select danger_inspection_record.id as id, count(*) as total from danger_inspection_item left join danger_inspection_info on danger_inspection_item.inspection_info_id = danger_inspection_info.id left join danger_inspection_record on danger_inspection_info.inspection_record_id = danger_inspection_record.id", tmpQueryWrapper); | ||
207 | recordId2CountMap = tmpQueryMapList.stream().collect(Collectors.toMap(item -> ConvertUtils.getString(item.get("id")), item -> ConvertUtils.getString(item.get("total")))); | ||
208 | } else { | ||
209 | recordId2CountMap = new HashMap<>(); | ||
205 | } | 210 | } |
211 | List<Map<String, Object>> hiddenDangerInspectionList = queryMapList2.stream().map(item -> { | ||
212 | Map<String, Object> entityMap = item.keySet().stream().collect(Collectors.toMap(StrUtil::toCamelCase, key -> (item.get(key) == null ? "" : item.get(key)))); | ||
213 | entityMap.put("departName", sysDepartDictMap.get(item.get("depart_id"))); | ||
214 | entityMap.put("realname", sysUserDictMap.get(item.get("report_user"))); | ||
215 | entityMap.put("exceptionCount", recordId2CountMap.getOrDefault(item.get("id"), "0")); | ||
216 | return entityMap; | ||
217 | }).collect(Collectors.toList()); | ||
218 | productDataVO.setHiddenDangerInspectionList(hiddenDangerInspectionList); | ||
206 | return productDataVO; | 219 | return productDataVO; |
207 | } | 220 | } |
208 | 221 | ... | ... |
... | @@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse; | ... | @@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse; |
10 | import cn.hutool.json.JSONObject; | 10 | import cn.hutool.json.JSONObject; |
11 | import com.skua.core.context.BaseContextHandler; | 11 | import com.skua.core.context.BaseContextHandler; |
12 | import com.skua.core.query.QueryGenerator; | 12 | import com.skua.core.query.QueryGenerator; |
13 | import com.skua.modules.equipment.service.IEquipmentAssetService; | ||
13 | import org.apache.commons.lang.StringUtils; | 14 | import org.apache.commons.lang.StringUtils; |
14 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; | 15 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
15 | import org.apache.poi.ss.usermodel.Sheet; | 16 | import org.apache.poi.ss.usermodel.Sheet; |
... | @@ -109,6 +110,8 @@ public class EquipmentController { | ... | @@ -109,6 +110,8 @@ public class EquipmentController { |
109 | @Autowired | 110 | @Autowired |
110 | private IEquipmentInfoService equipmentInfoService; | 111 | private IEquipmentInfoService equipmentInfoService; |
111 | @Autowired | 112 | @Autowired |
113 | private IEquipmentAssetService equipmentAssetService; | ||
114 | @Autowired | ||
112 | private Key2ValueService key2ValueService; | 115 | private Key2ValueService key2ValueService; |
113 | 116 | ||
114 | 117 | ||
... | @@ -384,17 +387,26 @@ public class EquipmentController { | ... | @@ -384,17 +387,26 @@ public class EquipmentController { |
384 | Result<?> result = new Result<>(); | 387 | Result<?> result = new Result<>(); |
385 | Equipment equipment = EquipmentUtils.equipDTO2Entity(equipmentDTO); | 388 | Equipment equipment = EquipmentUtils.equipDTO2Entity(equipmentDTO); |
386 | // todo 前端未传,特殊处理 | 389 | // todo 前端未传,特殊处理 |
387 | equipment.getEquipmentInfo().setAssetId(equipment.getEquipmentAsset().getId()); | 390 | // equipment.getEquipmentInfo().setAssetId(equipment.getEquipmentAsset().getId()); |
388 | // equipment.getEquipmentExt().setInfoId(equipment.getEquipmentInfo().getId()); | 391 | // equipment.getEquipmentExt().setInfoId(equipment.getEquipmentInfo().getId()); |
389 | // 校验ID是否一致 | 392 | // 校验ID是否一致 |
390 | JoinSqlUtils.checkSqlIdFunc(equipment); | 393 | // JoinSqlUtils.checkSqlIdFunc(equipment); |
391 | // 与点表有关联的台账不允许删除 | 394 | // 与点表有关联的台账不允许删除 |
392 | List<SysMonitorMetricInfo> monitorMetricInfo = sysMonitorMetricInfoService.list(new QueryWrapper<SysMonitorMetricInfo>().eq("equipment_code", equipmentDTO.getEquipmentInfo().getId())); | 395 | List<SysMonitorMetricInfo> monitorMetricInfo = sysMonitorMetricInfoService.list(new QueryWrapper<SysMonitorMetricInfo>().eq("equipment_code", equipmentDTO.getEquipmentInfo().getId())); |
393 | if (monitorMetricInfo!=null&&monitorMetricInfo.size()>0) { | 396 | if (monitorMetricInfo!=null&&monitorMetricInfo.size()>0) { |
394 | result.error500("与运行点表有关联的设备台账不允许删除"); | 397 | result.error500("与运行点表有关联的设备台账不允许删除"); |
395 | return result; | 398 | return result; |
396 | } | 399 | } |
397 | iCrudSqlService.delete(equipment); | 400 | // iCrudSqlService.delete(equipment); |
401 | transactionTemplate.execute((transactionStatus -> { | ||
402 | if (StringUtils.isNotEmpty(equipment.getEquipmentInfo().getId())) { | ||
403 | equipmentInfoService.removeById(equipment.getEquipmentInfo().getId()); | ||
404 | } | ||
405 | if (StringUtils.isNotEmpty(equipment.getEquipmentAsset().getId())) { | ||
406 | equipmentAssetService.removeById(equipment.getEquipmentAsset().getId()); | ||
407 | } | ||
408 | return 1; | ||
409 | })); | ||
398 | return Result.ok("删除成功!"); | 410 | return Result.ok("删除成功!"); |
399 | } | 411 | } |
400 | 412 | ... | ... |
... | @@ -158,19 +158,19 @@ public class InspectionAnalysisController { | ... | @@ -158,19 +158,19 @@ public class InspectionAnalysisController { |
158 | @GetMapping("/getInspectionTaskIndicators") | 158 | @GetMapping("/getInspectionTaskIndicators") |
159 | public Result<InspectionTaskIndicatorsVO> getInspectionTaskIndicators(String startDate,String endDate){ | 159 | public Result<InspectionTaskIndicatorsVO> getInspectionTaskIndicators(String startDate,String endDate){ |
160 | Result<InspectionTaskIndicatorsVO> result = new Result<>(); | 160 | Result<InspectionTaskIndicatorsVO> result = new Result<>(); |
161 | InspectionTaskIndicatorsVO inspectionTaskIndicatorsVO = inspectionAnalysisService.getInspectionTaskIndicatorsNew(startDate,endDate); | 161 | InspectionTaskIndicatorsVO inspectionTaskIndicatorsVO = inspectionAnalysisService.getInspectionTaskIndicators(startDate,endDate); |
162 | result.setSuccess(true); | 162 | result.setSuccess(true); |
163 | result.setResult(inspectionTaskIndicatorsVO); | 163 | result.setResult(inspectionTaskIndicatorsVO); |
164 | return result; | 164 | return result; |
165 | } | 165 | } |
166 | @ApiOperation(value = "巡检分析-巡检任务指标-详情", notes = "巡检分析-巡检任务指标-详情") | 166 | @ApiOperation(value = "巡检分析-巡检任务指标-详情", notes = "巡检分析-巡检任务指标-详情") |
167 | @GetMapping("/getInspectionTaskIndicatorsDetail") | 167 | @GetMapping("/getInspectionTaskIndicatorsDetail") |
168 | public Result<List<InspectionEquipIndicatorsDetailVO>> getInspectionTaskIndicatorsDetail(String departId,String startDate,String endDate){ | 168 | public Result<List<InspectionTaskIndicatorsVO>> getInspectionTaskIndicatorsDetail(String departId,String startDate,String endDate){ |
169 | Result<List<InspectionEquipIndicatorsDetailVO>> result = new Result<>(); | 169 | Result<List<InspectionTaskIndicatorsVO>> result = new Result<>(); |
170 | if(StringUtils.isEmpty(departId)){ | 170 | if(StringUtils.isEmpty(departId)){ |
171 | departId = BaseContextHandler.getDeparts(); | 171 | departId = BaseContextHandler.getDeparts(); |
172 | } | 172 | } |
173 | List<InspectionEquipIndicatorsDetailVO> dataList = inspectionAnalysisService.getInspectionTaskIndicatorsDetail( JSUtils.quoteEach(departId,",") ,startDate,endDate); | 173 | List<InspectionTaskIndicatorsVO> dataList = inspectionAnalysisService.getInspectionTaskIndicatorsDetail( JSUtils.quoteEach(departId,",") ,startDate,endDate); |
174 | result.setSuccess(true); | 174 | result.setSuccess(true); |
175 | result.setResult(dataList); | 175 | result.setResult(dataList); |
176 | return result; | 176 | return result; | ... | ... |
... | @@ -28,7 +28,7 @@ public interface IInspectionAnalysisService { | ... | @@ -28,7 +28,7 @@ public interface IInspectionAnalysisService { |
28 | * @param endDate | 28 | * @param endDate |
29 | * @return | 29 | * @return |
30 | */ | 30 | */ |
31 | List<InspectionEquipIndicatorsDetailVO> getInspectionTaskIndicatorsDetail(String departIds, String startDate, String endDate); | 31 | List<InspectionTaskIndicatorsVO> getInspectionTaskIndicatorsDetail(String departIds, String startDate, String endDate); |
32 | /*** | 32 | /*** |
33 | * 巡检分析-巡检设备指标 | 33 | * 巡检分析-巡检设备指标 |
34 | * @param startDate | 34 | * @param startDate | ... | ... |
... | @@ -6,6 +6,7 @@ import com.skua.core.context.BaseContextHandler; | ... | @@ -6,6 +6,7 @@ import com.skua.core.context.BaseContextHandler; |
6 | import com.skua.core.context.SpringContextUtils; | 6 | import com.skua.core.context.SpringContextUtils; |
7 | import com.skua.core.util.ConvertUtils; | 7 | import com.skua.core.util.ConvertUtils; |
8 | import com.skua.core.util.DateUtils; | 8 | import com.skua.core.util.DateUtils; |
9 | import com.skua.modules.biz.IBusinessService; | ||
9 | import com.skua.modules.common.service.ICommonSqlService; | 10 | import com.skua.modules.common.service.ICommonSqlService; |
10 | import com.skua.modules.flow.business.service.FlowBusinessService; | 11 | import com.skua.modules.flow.business.service.FlowBusinessService; |
11 | import com.skua.modules.flow.engine.constant.FlowEngineConstant; | 12 | import com.skua.modules.flow.engine.constant.FlowEngineConstant; |
... | @@ -28,6 +29,8 @@ import java.text.NumberFormat; | ... | @@ -28,6 +29,8 @@ import java.text.NumberFormat; |
28 | import java.text.ParseException; | 29 | import java.text.ParseException; |
29 | import java.text.SimpleDateFormat; | 30 | import java.text.SimpleDateFormat; |
30 | import java.util.*; | 31 | import java.util.*; |
32 | import java.util.concurrent.CompletableFuture; | ||
33 | import java.util.concurrent.Executor; | ||
31 | import java.util.stream.Collectors; | 34 | import java.util.stream.Collectors; |
32 | 35 | ||
33 | /** | 36 | /** |
... | @@ -57,6 +60,8 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService | ... | @@ -57,6 +60,8 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService |
57 | private IInspectionTaskPointFillGroupService inspectionTaskPointFillGroupService; | 60 | private IInspectionTaskPointFillGroupService inspectionTaskPointFillGroupService; |
58 | @Autowired | 61 | @Autowired |
59 | private IInspectionTaskFillGroupFillService inspectionTaskFillGroupFillService; | 62 | private IInspectionTaskFillGroupFillService inspectionTaskFillGroupFillService; |
63 | @Autowired | ||
64 | private IBusinessService businessService; | ||
60 | 65 | ||
61 | @Autowired | 66 | @Autowired |
62 | private ICommonSqlService commonSqlService; | 67 | private ICommonSqlService commonSqlService; |
... | @@ -378,18 +383,12 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService | ... | @@ -378,18 +383,12 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService |
378 | inspectionTaskIndicatorsVO.setAbnormalRate("0"); | 383 | inspectionTaskIndicatorsVO.setAbnormalRate("0"); |
379 | inspectionTaskIndicatorsVO.setProcessedAbnormalRate("0"); | 384 | inspectionTaskIndicatorsVO.setProcessedAbnormalRate("0"); |
380 | //查询时间内巡检任务信息 | 385 | //查询时间内巡检任务信息 |
381 | InspectionTaskVO inspectionTaskVO = new InspectionTaskVO(); | ||
382 | QueryWrapper<InspectionTask> inspectionTaskQueryWrapper = new QueryWrapper(); | 386 | QueryWrapper<InspectionTask> inspectionTaskQueryWrapper = new QueryWrapper(); |
383 | if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { | 387 | if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { |
384 | inspectionTaskQueryWrapper.ge("inspection_cycle_start_date", startDate + " 00:00:00"); | 388 | inspectionTaskQueryWrapper.ge("inspection_cycle_start_date", startDate + " 00:00:00"); |
385 | inspectionTaskQueryWrapper.le("inspection_cycle_start_date", endDate + " 23:59:59"); | 389 | inspectionTaskQueryWrapper.le("inspection_cycle_start_date", endDate + " 23:59:59"); |
386 | inspectionTaskVO.setStartTime(inspectionTaskVO.getStartTime() + " 00:00:00"); | ||
387 | inspectionTaskVO.setEndTime(inspectionTaskVO.getEndTime() + " 23:59:59"); | ||
388 | } | 390 | } |
389 | // List<InspectionTask> inspectionTaskList = inspectionTaskService.list(inspectionTaskQueryWrapper); | 391 | List<InspectionTask> inspectionTaskList = inspectionTaskService.list(inspectionTaskQueryWrapper); |
390 | IPage<InspectionTask> pageList = inspectionTaskService.getPage(null, inspectionTaskVO); | ||
391 | List<InspectionTask> inspectionTaskList = pageList.getRecords(); | ||
392 | |||
393 | //各状态的数量 | 392 | //各状态的数量 |
394 | Map<String, List<InspectionTask>> taskStateMap = new HashMap<>(); | 393 | Map<String, List<InspectionTask>> taskStateMap = new HashMap<>(); |
395 | List<InspectionTask> inspectionTasks; | 394 | List<InspectionTask> inspectionTasks; |
... | @@ -408,13 +407,13 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService | ... | @@ -408,13 +407,13 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService |
408 | //未检任务 | 407 | //未检任务 |
409 | List<InspectionTask> notCheckedInspectionTaskList = taskStateMap.get("3") == null ? new ArrayList<>() : taskStateMap.get("3"); | 408 | List<InspectionTask> notCheckedInspectionTaskList = taskStateMap.get("3") == null ? new ArrayList<>() : taskStateMap.get("3"); |
410 | //进行中任务 | 409 | //进行中任务 |
411 | // List<InspectionTask> inProgressInspectionTaskList = taskStateMap.get("1") == null ? new ArrayList<>() : taskStateMap.get("1"); | 410 | List<InspectionTask> inProgressInspectionTaskList = taskStateMap.get("1") == null ? new ArrayList<>() : taskStateMap.get("1"); |
412 | //已检任务数 | 411 | //已检任务数 |
413 | int checkedInspectionTaskCount = checkedInspectionTaskList.size(); | 412 | int checkedInspectionTaskCount = checkedInspectionTaskList.size(); |
414 | //未检任务数 | 413 | //未检任务数 |
415 | int notCheckedInspectionTaskCount = notCheckedInspectionTaskList.size(); | 414 | int notCheckedInspectionTaskCount = notCheckedInspectionTaskList.size(); |
416 | //进行中任务数 | 415 | //进行中任务数 |
417 | // int inProgressInspectionTaskCount = inProgressInspectionTaskList.size(); | 416 | int inProgressInspectionTaskCount = inProgressInspectionTaskList.size(); |
418 | //已检任务ID集合 | 417 | //已检任务ID集合 |
419 | List<String> checkedInspectionTaskIdList = checkedInspectionTaskList.stream().map(InspectionTask::getId).collect(Collectors.toList()); | 418 | List<String> checkedInspectionTaskIdList = checkedInspectionTaskList.stream().map(InspectionTask::getId).collect(Collectors.toList()); |
420 | if (checkedInspectionTaskIdList.size() > 0) { | 419 | if (checkedInspectionTaskIdList.size() > 0) { |
... | @@ -457,12 +456,12 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService | ... | @@ -457,12 +456,12 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService |
457 | processInstanceStateMap.put(state, tempProcessInstanceIdList); | 456 | processInstanceStateMap.put(state, tempProcessInstanceIdList); |
458 | } | 457 | } |
459 | //异常项数量(问题上报) | 458 | //异常项数量(问题上报) |
460 | // Integer abnormalItemsCount = problemReportPlanList.size(); | 459 | Integer abnormalItemsCount = problemReportPlanList.size(); |
461 | //已处理异常项数量(问题上报) | 460 | //已处理异常项数量(问题上报) |
462 | // Integer processedAbnormalItemsCount = 0; | 461 | Integer processedAbnormalItemsCount = 0; |
463 | // if (processInstanceStateMap != null && processInstanceStateMap.get(FlowEngineConstant.STATUS_FINISHED) != null) { | 462 | if (processInstanceStateMap != null && processInstanceStateMap.get(FlowEngineConstant.STATUS_FINISHED) != null) { |
464 | // processedAbnormalItemsCount = processInstanceStateMap.get(FlowEngineConstant.STATUS_FINISHED).size(); | 463 | processedAbnormalItemsCount = processInstanceStateMap.get(FlowEngineConstant.STATUS_FINISHED).size(); |
465 | // } | 464 | } |
466 | //完成率 | 465 | //完成率 |
467 | String completionRate = "0"; | 466 | String completionRate = "0"; |
468 | if (totalInspectionTaskCount != 0) { | 467 | if (totalInspectionTaskCount != 0) { |
... | @@ -479,14 +478,14 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService | ... | @@ -479,14 +478,14 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService |
479 | abnormalRate = numberFormat.format(abnormalInspectionTaskCount / (double) checkedInspectionTaskCount * 100); | 478 | abnormalRate = numberFormat.format(abnormalInspectionTaskCount / (double) checkedInspectionTaskCount * 100); |
480 | } | 479 | } |
481 | //异常项处理率 | 480 | //异常项处理率 |
482 | // String processedAbnormalRate = "0"; | 481 | String processedAbnormalRate = "0"; |
483 | // if (abnormalItemsCount != 0) { | 482 | if (abnormalItemsCount != 0) { |
484 | // processedAbnormalRate = numberFormat.format(processedAbnormalItemsCount / (double)abnormalItemsCount * 100); | 483 | processedAbnormalRate = numberFormat.format(processedAbnormalItemsCount / (double)abnormalItemsCount * 100); |
485 | // } | 484 | } |
486 | inspectionTaskIndicatorsVO.setCompletionRate(completionRate); | 485 | inspectionTaskIndicatorsVO.setCompletionRate(completionRate); |
487 | inspectionTaskIndicatorsVO.setUnCompletionRate(unCompletionRate); | 486 | inspectionTaskIndicatorsVO.setUnCompletionRate(unCompletionRate); |
488 | inspectionTaskIndicatorsVO.setAbnormalRate(abnormalRate); | 487 | inspectionTaskIndicatorsVO.setAbnormalRate(abnormalRate); |
489 | // inspectionTaskIndicatorsVO.setProcessedAbnormalRate(processedAbnormalRate); | 488 | inspectionTaskIndicatorsVO.setProcessedAbnormalRate(processedAbnormalRate); |
490 | } | 489 | } |
491 | return inspectionTaskIndicatorsVO; | 490 | return inspectionTaskIndicatorsVO; |
492 | } | 491 | } |
... | @@ -524,8 +523,150 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService | ... | @@ -524,8 +523,150 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService |
524 | * @param endDate | 523 | * @param endDate |
525 | * @return | 524 | * @return |
526 | */ | 525 | */ |
527 | public List<InspectionEquipIndicatorsDetailVO> getInspectionTaskIndicatorsDetail(String departIds, String startDate, String endDate){ | 526 | public List<InspectionTaskIndicatorsVO> getInspectionTaskIndicatorsDetail(String departIds, String startDate, String endDate){ |
528 | return inspectionAnalysisMapper.getInspectionEquipIndicatorsDetail(departIds, startDate, endDate); | 527 | List<InspectionTaskIndicatorsVO> voList = new ArrayList<>(); |
528 | //查询时间内巡检任务信息 | ||
529 | QueryWrapper<InspectionTask> inspectionTaskQueryWrapper = new QueryWrapper(); | ||
530 | if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { | ||
531 | inspectionTaskQueryWrapper.ge("inspection_cycle_start_date", startDate + " 00:00:00"); | ||
532 | inspectionTaskQueryWrapper.le("inspection_cycle_start_date", endDate + " 23:59:59"); | ||
533 | } | ||
534 | List<InspectionTask> inspectionTaskList = inspectionTaskService.list(inspectionTaskQueryWrapper); | ||
535 | // 巡检任务按照departId分组 | ||
536 | Map<String, List<String>> departId2inspectionTaskIdMap = new LinkedHashMap<>(); | ||
537 | for (InspectionTask inspectionTask : inspectionTaskList) { | ||
538 | String departId = inspectionTask.getDepartId(); | ||
539 | List<String> inspectionTaskIdList = departId2inspectionTaskIdMap.computeIfAbsent(departId, k -> new ArrayList<>()); | ||
540 | inspectionTaskIdList.add(inspectionTask.getId()); | ||
541 | } | ||
542 | List<CompletableFuture> completableFutureList = new ArrayList<>(); | ||
543 | // 翻译 | ||
544 | Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null); | ||
545 | // 遍历departId | ||
546 | for (Map.Entry<String, List<String>> entry0: departId2inspectionTaskIdMap.entrySet()) { | ||
547 | String departId = entry0.getKey(); | ||
548 | List<String> tempInspectionTaskIdList = entry0.getValue(); | ||
549 | completableFutureList.add(CompletableFuture.supplyAsync(() -> { | ||
550 | InspectionTaskIndicatorsVO vo = new InspectionTaskIndicatorsVO(); | ||
551 | vo.setDepartName(StringUtils.isEmpty(departId) ? departId : sysDepartDictMap.get(departId)); | ||
552 | //初始化数据 | ||
553 | vo.setCompletionRate("0"); | ||
554 | vo.setUnCompletionRate("0"); | ||
555 | vo.setAbnormalRate("0"); | ||
556 | vo.setProcessedAbnormalRate("0"); | ||
557 | //各状态的数量 | ||
558 | Map<String, List<InspectionTask>> taskStateMap = new HashMap<>(); | ||
559 | List<InspectionTask> inspectionTasks; | ||
560 | List<InspectionTask> tmpInspectionTaskList = inspectionTaskList.stream().filter(item -> tempInspectionTaskIdList.contains(item.getId())).collect(Collectors.toList()); | ||
561 | for (InspectionTask inspectionTask : tmpInspectionTaskList) { | ||
562 | inspectionTasks = new ArrayList<>(); | ||
563 | if (taskStateMap.get(inspectionTask.getTaskState()) != null) { | ||
564 | inspectionTasks = taskStateMap.get(inspectionTask.getTaskState()); | ||
565 | } | ||
566 | inspectionTasks.add(inspectionTask); | ||
567 | taskStateMap.put(inspectionTask.getTaskState(), inspectionTasks); | ||
568 | } | ||
569 | //应检任务数 | ||
570 | int totalInspectionTaskCount = tmpInspectionTaskList.size(); | ||
571 | //已检任务 | ||
572 | List<InspectionTask> checkedInspectionTaskList = taskStateMap.get("2") == null ? new ArrayList<>() : taskStateMap.get("2"); | ||
573 | //未检任务 | ||
574 | List<InspectionTask> notCheckedInspectionTaskList = taskStateMap.get("3") == null ? new ArrayList<>() : taskStateMap.get("3"); | ||
575 | //进行中任务 | ||
576 | List<InspectionTask> inProgressInspectionTaskList = taskStateMap.get("1") == null ? new ArrayList<>() : taskStateMap.get("1"); | ||
577 | //已检任务数 | ||
578 | int checkedInspectionTaskCount = checkedInspectionTaskList.size(); | ||
579 | //未检任务数 | ||
580 | int notCheckedInspectionTaskCount = notCheckedInspectionTaskList.size(); | ||
581 | //进行中任务数 | ||
582 | int inProgressInspectionTaskCount = inProgressInspectionTaskList.size(); | ||
583 | //已检任务ID集合 | ||
584 | List<String> checkedInspectionTaskIdList = checkedInspectionTaskList.stream().map(InspectionTask::getId).collect(Collectors.toList()); | ||
585 | if (checkedInspectionTaskIdList.size() > 0) { | ||
586 | //通过已检任务ID查询填报内容 | ||
587 | QueryWrapper<InspectionTaskFillContent> inspectionTaskFillContentQueryWrapper = new QueryWrapper(); | ||
588 | inspectionTaskFillContentQueryWrapper.select("inspection_task_id as inspectionTaskId"); | ||
589 | inspectionTaskFillContentQueryWrapper.in("inspection_task_id", checkedInspectionTaskIdList); | ||
590 | inspectionTaskFillContentQueryWrapper.eq("choice_state", "0"); | ||
591 | inspectionTaskFillContentQueryWrapper.groupBy("inspection_task_id"); | ||
592 | List<Map<String, Object>> mapList = inspectionTaskFillContentService.listMaps(inspectionTaskFillContentQueryWrapper); | ||
593 | //异常任务数 | ||
594 | int abnormalInspectionTaskCount = mapList.size(); | ||
595 | //查询问题上报id集合 | ||
596 | QueryWrapper<InspectionTaskProblemReport> inspectionTaskProblemReportQueryWrapper = new QueryWrapper<>(); | ||
597 | inspectionTaskFillContentQueryWrapper.in("inspection_task_id", checkedInspectionTaskIdList); | ||
598 | List<InspectionTaskProblemReport> inspectionTaskProblemReportList = inspectionTaskProblemReportService.list(inspectionTaskProblemReportQueryWrapper); | ||
599 | List<String> problemReportIdList = inspectionTaskProblemReportList.stream().map(InspectionTaskProblemReport::getProblemReportPlanId).collect(Collectors.toList()); | ||
600 | List<ProblemReportPlan> problemReportPlanList = new ArrayList<>(); | ||
601 | if (problemReportIdList.size() > 0) { | ||
602 | QueryWrapper<ProblemReportPlan> problemReportPlanQueryWrapper = new QueryWrapper<>(); | ||
603 | problemReportPlanQueryWrapper.in("id", problemReportIdList); | ||
604 | problemReportPlanList = problemReportPlanService.list(problemReportPlanQueryWrapper); | ||
605 | } | ||
606 | //存放问题上报的实例ID | ||
607 | Set<String> processInstanceIdList = problemReportPlanList.stream().map(ProblemReportPlan::getProcessInstanceId).collect(Collectors.toSet()); | ||
608 | Map<String, Map<String, String>> processStateMap = new HashMap<>(); | ||
609 | if (processInstanceIdList.size() > 0) { | ||
610 | processStateMap = flowBusinessService.getProcessState(processInstanceIdList); | ||
611 | } | ||
612 | Map<String, List<String>> processInstanceStateMap = new HashMap<>(); | ||
613 | List<String> tempProcessInstanceIdList; | ||
614 | for (Map.Entry<String, Map<String, String>> entry : processStateMap.entrySet()) { | ||
615 | tempProcessInstanceIdList = new ArrayList<>(); | ||
616 | String processInstanceId = entry.getKey(); | ||
617 | String state = entry.getValue().get("state"); | ||
618 | if (processInstanceStateMap.get(state) != null) { | ||
619 | tempProcessInstanceIdList = processInstanceStateMap.get(state); | ||
620 | } | ||
621 | tempProcessInstanceIdList.add(processInstanceId); | ||
622 | processInstanceStateMap.put(state, tempProcessInstanceIdList); | ||
623 | } | ||
624 | //异常项数量(问题上报) | ||
625 | Integer abnormalItemsCount = problemReportPlanList.size(); | ||
626 | //已处理异常项数量(问题上报) | ||
627 | Integer processedAbnormalItemsCount = 0; | ||
628 | if (processInstanceStateMap != null && processInstanceStateMap.get(FlowEngineConstant.STATUS_FINISHED) != null) { | ||
629 | processedAbnormalItemsCount = processInstanceStateMap.get(FlowEngineConstant.STATUS_FINISHED).size(); | ||
630 | } | ||
631 | //完成率 | ||
632 | String completionRate = "0"; | ||
633 | if (totalInspectionTaskCount != 0) { | ||
634 | completionRate = numberFormat.format(checkedInspectionTaskCount / (double) totalInspectionTaskCount * 100); | ||
635 | } | ||
636 | //未检率 | ||
637 | String unCompletionRate = "0"; | ||
638 | if (totalInspectionTaskCount != 0) { | ||
639 | unCompletionRate = numberFormat.format(notCheckedInspectionTaskCount / (double) totalInspectionTaskCount * 100); | ||
640 | } | ||
641 | //异常率 | ||
642 | String abnormalRate = "0"; | ||
643 | if (checkedInspectionTaskCount != 0) { | ||
644 | abnormalRate = numberFormat.format(abnormalInspectionTaskCount / (double) checkedInspectionTaskCount * 100); | ||
645 | } | ||
646 | //异常项处理率 | ||
647 | String processedAbnormalRate = "0"; | ||
648 | if (abnormalItemsCount != 0) { | ||
649 | processedAbnormalRate = numberFormat.format(processedAbnormalItemsCount / (double)abnormalItemsCount * 100); | ||
650 | } | ||
651 | vo.setCompletionRate(completionRate); | ||
652 | vo.setUnCompletionRate(unCompletionRate); | ||
653 | vo.setAbnormalRate(abnormalRate); | ||
654 | vo.setProcessedAbnormalRate(processedAbnormalRate); | ||
655 | } | ||
656 | return vo; | ||
657 | }, (Executor) SpringContextUtils.getBean("taskExecutor2"))); | ||
658 | } | ||
659 | // 等待所有子线程处理完毕 | ||
660 | CompletableFuture.allOf(completableFutureList.toArray(new CompletableFuture[0])).join(); | ||
661 | for (CompletableFuture completableFuture : completableFutureList) { | ||
662 | try { | ||
663 | InspectionTaskIndicatorsVO vo = (InspectionTaskIndicatorsVO) completableFuture.get(); | ||
664 | voList.add(vo); | ||
665 | } catch (Exception e) { | ||
666 | e.printStackTrace(); | ||
667 | } | ||
668 | } | ||
669 | return voList; | ||
529 | } | 670 | } |
530 | 671 | ||
531 | /*** | 672 | /*** |
... | @@ -1075,15 +1216,11 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService | ... | @@ -1075,15 +1216,11 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService |
1075 | Integer abnormalCheckedItemsCount = 0; | 1216 | Integer abnormalCheckedItemsCount = 0; |
1076 | for (String tempInspectionTaskId : tempInspectionTaskIdList) { | 1217 | for (String tempInspectionTaskId : tempInspectionTaskIdList) { |
1077 | totalCheckeItemsCount += ConvertUtils.getInt(taskCheckeItemsCountMap.get(tempInspectionTaskId), 0); | 1218 | totalCheckeItemsCount += ConvertUtils.getInt(taskCheckeItemsCountMap.get(tempInspectionTaskId), 0); |
1078 | checkedItemsCount += ConvertUtils.getInt(taskCheckedItemsCountMap.get(tempInspectionTaskId), 0); | 1219 | checkedItemsCount += Math.min(ConvertUtils.getInt(taskCheckeItemsCountMap.get(tempInspectionTaskId), 0), ConvertUtils.getInt(taskCheckedItemsCountMap.get(tempInspectionTaskId), 0)); |
1079 | abnormalCheckedItemsCount += ConvertUtils.getInt(abnormalTaskCheckedItemsCountMap.get(tempInspectionTaskId), 0); | 1220 | abnormalCheckedItemsCount += ConvertUtils.getInt(abnormalTaskCheckedItemsCountMap.get(tempInspectionTaskId), 0); |
1080 | } | 1221 | } |
1081 | inspectionAbnormalItemsTrendVO.setInspectionTaskDate(date); | 1222 | inspectionAbnormalItemsTrendVO.setInspectionTaskDate(date); |
1082 | if(totalCheckeItemsCount - checkedItemsCount < 0){ | 1223 | inspectionAbnormalItemsTrendVO.setNotCheckedItemsCount(totalCheckeItemsCount - checkedItemsCount); |
1083 | inspectionAbnormalItemsTrendVO.setNotCheckedItemsCount(checkedItemsCount - totalCheckeItemsCount); | ||
1084 | }else{ | ||
1085 | inspectionAbnormalItemsTrendVO.setNotCheckedItemsCount(totalCheckeItemsCount - checkedItemsCount); | ||
1086 | } | ||
1087 | inspectionAbnormalItemsTrendVO.setAbnormalItemsCount(abnormalCheckedItemsCount); | 1224 | inspectionAbnormalItemsTrendVO.setAbnormalItemsCount(abnormalCheckedItemsCount); |
1088 | inspectionAbnormalItemsTrendVOList.add(inspectionAbnormalItemsTrendVO); | 1225 | inspectionAbnormalItemsTrendVOList.add(inspectionAbnormalItemsTrendVO); |
1089 | } | 1226 | } |
... | @@ -1100,7 +1237,80 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService | ... | @@ -1100,7 +1237,80 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService |
1100 | * @return | 1237 | * @return |
1101 | */ | 1238 | */ |
1102 | public List<InspectionAbnormalItemsTrendVO> getInspectionAbnormalItemsTrendDetail(String departIds, String startDate, String endDate){ | 1239 | public List<InspectionAbnormalItemsTrendVO> getInspectionAbnormalItemsTrendDetail(String departIds, String startDate, String endDate){ |
1103 | return inspectionAnalysisMapper.getInspectionAbnormalItemsTrendDetail( departIds, startDate, endDate); | 1240 | List<InspectionAbnormalItemsTrendVO> inspectionAbnormalItemsTrendVOList = new ArrayList<>(); |
1241 | //查询时间内已巡检任务信息 | ||
1242 | QueryWrapper<InspectionTask> inspectionTaskQueryWrapper = new QueryWrapper(); | ||
1243 | if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { | ||
1244 | inspectionTaskQueryWrapper.ge("inspection_cycle_start_date", startDate + " 00:00:00"); | ||
1245 | inspectionTaskQueryWrapper.le("inspection_cycle_start_date", endDate + " 23:59:59"); | ||
1246 | } | ||
1247 | inspectionTaskQueryWrapper.in("task_state", "2","3"); | ||
1248 | List<InspectionTask> inspectionTaskList = inspectionTaskService.list(inspectionTaskQueryWrapper); | ||
1249 | // 巡检任务按照departId分组 | ||
1250 | Map<String, List<String>> departId2inspectionTaskIdMap = new LinkedHashMap<>(); | ||
1251 | for (InspectionTask inspectionTask : inspectionTaskList) { | ||
1252 | String departId = inspectionTask.getDepartId(); | ||
1253 | List<String> inspectionTaskIdList = departId2inspectionTaskIdMap.computeIfAbsent(departId, k -> new ArrayList<>()); | ||
1254 | inspectionTaskIdList.add(inspectionTask.getId()); | ||
1255 | } | ||
1256 | // 使用stream对inspectionTaskList进行分组操作,按照巡检周期起始日期进行分组 | ||
1257 | Map<String, List<String>> inspectionDateMap = inspectionTaskList.stream() | ||
1258 | .collect(Collectors.groupingBy( | ||
1259 | inspectionTask -> DateUtils.format(inspectionTask.getInspectionCycleStartDate(), "yyyy-MM-dd"), | ||
1260 | Collectors.mapping(InspectionTask::getId, Collectors.toList()) | ||
1261 | )); | ||
1262 | //巡检任务ID集合 | ||
1263 | List<String> inspectionTaskIdList = inspectionTaskList.stream().map(InspectionTask::getId).collect(Collectors.toList()); | ||
1264 | Map<String, Integer> taskCheckeItemsCountMap = new HashMap<>(); | ||
1265 | Map<String, Integer> taskCheckedItemsCountMap = new HashMap<>(); | ||
1266 | Map<String, Integer> abnormalTaskCheckedItemsCountMap = new HashMap<>(); | ||
1267 | if (inspectionTaskIdList.size() > 0) { | ||
1268 | //查询每个巡检任务的填报项数量 | ||
1269 | QueryWrapper<InspectionTaskFillGroupFill> inspectionTaskFillGroupFillQueryWrapper = new QueryWrapper<>(); | ||
1270 | inspectionTaskFillGroupFillQueryWrapper.in("inspection_task_id", inspectionTaskIdList); | ||
1271 | inspectionTaskFillGroupFillQueryWrapper.select("inspection_task_id inspectionTaskId, count(inspection_task_id) count"); | ||
1272 | inspectionTaskFillGroupFillQueryWrapper.groupBy("inspection_task_id"); | ||
1273 | List<Map<String, Object>> taskCheckeItemsCountList = inspectionTaskFillGroupFillService.listMaps(inspectionTaskFillGroupFillQueryWrapper); | ||
1274 | taskCheckeItemsCountMap = taskCheckeItemsCountList.stream().collect(Collectors.toMap(map -> ConvertUtils.getString(map.get("inspectionTaskId")), map -> ConvertUtils.getInt(map.get("count")))); | ||
1275 | //查询巡检任务已填报的数据 | ||
1276 | QueryWrapper<InspectionTaskFillContent> inspectionTaskFillContentQueryWrapper = new QueryWrapper<>(); | ||
1277 | inspectionTaskFillContentQueryWrapper.in("inspection_task_id", inspectionTaskIdList); | ||
1278 | inspectionTaskFillContentQueryWrapper.groupBy("inspection_task_id"); | ||
1279 | inspectionTaskFillContentQueryWrapper.select("inspection_task_id inspectionTaskId, count(inspection_task_id) count"); | ||
1280 | inspectionTaskFillContentQueryWrapper.isNotNull("fill_content"); | ||
1281 | inspectionTaskFillContentQueryWrapper.ne("fill_content", ""); | ||
1282 | List<Map<String, Object>> taskCheckedItemsCountList = inspectionTaskFillContentService.listMaps(inspectionTaskFillContentQueryWrapper); | ||
1283 | taskCheckedItemsCountMap = taskCheckedItemsCountList.stream().collect(Collectors.toMap(map -> ConvertUtils.getString(map.get("inspectionTaskId")), map -> ConvertUtils.getInt(map.get("count")))); | ||
1284 | //查询巡检任务异常填报数量 | ||
1285 | inspectionTaskFillContentQueryWrapper.eq("choice_state", "0"); | ||
1286 | List<Map<String, Object>> abnormalTaskCheckedItemsCountList = inspectionTaskFillContentService.listMaps(inspectionTaskFillContentQueryWrapper); | ||
1287 | abnormalTaskCheckedItemsCountMap = abnormalTaskCheckedItemsCountList.stream().collect(Collectors.toMap(map -> ConvertUtils.getString(map.get("inspectionTaskId")), map -> ConvertUtils.getInt(map.get("count")))); | ||
1288 | } | ||
1289 | InspectionAbnormalItemsTrendVO inspectionAbnormalItemsTrendVO; | ||
1290 | // 翻译 | ||
1291 | Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null); | ||
1292 | for (Map.Entry<String, List<String>> entry: departId2inspectionTaskIdMap.entrySet()) { | ||
1293 | String departId = entry.getKey(); | ||
1294 | List<String> tempInspectionTaskIdList = entry.getValue(); | ||
1295 | inspectionAbnormalItemsTrendVO = new InspectionAbnormalItemsTrendVO(); | ||
1296 | //巡检任务Id集合查询对应任务填报项数量 | ||
1297 | //总的填报项数量 | ||
1298 | Integer totalCheckeItemsCount = 0; | ||
1299 | //已填报的填报项数量 | ||
1300 | Integer checkedItemsCount = 0; | ||
1301 | //异常填报项数量 | ||
1302 | Integer abnormalCheckedItemsCount = 0; | ||
1303 | for (String tempInspectionTaskId : tempInspectionTaskIdList) { | ||
1304 | totalCheckeItemsCount += ConvertUtils.getInt(taskCheckeItemsCountMap.get(tempInspectionTaskId), 0); | ||
1305 | checkedItemsCount += Math.min(ConvertUtils.getInt(taskCheckeItemsCountMap.get(tempInspectionTaskId), 0), ConvertUtils.getInt(taskCheckedItemsCountMap.get(tempInspectionTaskId), 0)); | ||
1306 | abnormalCheckedItemsCount += ConvertUtils.getInt(abnormalTaskCheckedItemsCountMap.get(tempInspectionTaskId), 0); | ||
1307 | } | ||
1308 | inspectionAbnormalItemsTrendVO.setDepartName(StringUtils.isEmpty(departId) ? departId : sysDepartDictMap.get(departId)); | ||
1309 | inspectionAbnormalItemsTrendVO.setNotCheckedItemsCount(totalCheckeItemsCount - checkedItemsCount); | ||
1310 | inspectionAbnormalItemsTrendVO.setAbnormalItemsCount(abnormalCheckedItemsCount); | ||
1311 | inspectionAbnormalItemsTrendVOList.add(inspectionAbnormalItemsTrendVO); | ||
1312 | } | ||
1313 | return inspectionAbnormalItemsTrendVOList; | ||
1104 | } | 1314 | } |
1105 | 1315 | ||
1106 | //InspectionEquipInfoListVO | 1316 | //InspectionEquipInfoListVO | ... | ... |
... | @@ -34,16 +34,4 @@ public class InspectionAbnormalItemsTrendVO { | ... | @@ -34,16 +34,4 @@ public class InspectionAbnormalItemsTrendVO { |
34 | private Integer notCheckedItemsCount; | 34 | private Integer notCheckedItemsCount; |
35 | @ApiModelProperty(value = "异常项数量") | 35 | @ApiModelProperty(value = "异常项数量") |
36 | private Integer abnormalItemsCount; | 36 | private Integer abnormalItemsCount; |
37 | |||
38 | public Integer getNotCheckedItemsCount() { | ||
39 | if (totalCount != null && checkedItemsCount != null) { | ||
40 | if (totalCount - checkedItemsCount < 0) { | ||
41 | return checkedItemsCount - totalCount; | ||
42 | } else { | ||
43 | return totalCount - checkedItemsCount; | ||
44 | } | ||
45 | } else { | ||
46 | return 0; | ||
47 | } | ||
48 | } | ||
49 | } | 37 | } | ... | ... |
... | @@ -26,4 +26,6 @@ public class InspectionTaskIndicatorsVO { | ... | @@ -26,4 +26,6 @@ public class InspectionTaskIndicatorsVO { |
26 | private String abnormalRate; | 26 | private String abnormalRate; |
27 | @ApiModelProperty(value = "异常项处理率") | 27 | @ApiModelProperty(value = "异常项处理率") |
28 | private String processedAbnormalRate; | 28 | private String processedAbnormalRate; |
29 | |||
30 | private String departName; | ||
29 | } | 31 | } | ... | ... |
... | @@ -45,4 +45,32 @@ public class TaskPoolConfig { | ... | @@ -45,4 +45,32 @@ public class TaskPoolConfig { |
45 | executor.initialize(); | 45 | executor.initialize(); |
46 | return executor; | 46 | return executor; |
47 | } | 47 | } |
48 | |||
49 | @Bean(name="taskExecutor2") | ||
50 | public ThreadPoolTaskExecutor taskExecutor2() { | ||
51 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | ||
52 | //配置核心线程数:就是线程池中的核心线程数量,这几个核心线程,只是在没有用的时候,也不会被回收 | ||
53 | executor.setCorePoolSize(50); | ||
54 | //配置最大线程数:就是线程池中可以容纳的最大线程的数量 | ||
55 | executor.setMaxPoolSize(200); | ||
56 | //配置队列大小 | ||
57 | executor.setQueueCapacity(500); | ||
58 | //线程池维护线程所允许的空闲时间:就是线程池中除了核心线程之外的其他的最长可以保留的时间,因为在线程池中,除了核心线程即使在无任务的情况下也不能被清除,其余的都是有存活时间的,意思就是非核心线程可以保留的最长的空闲时间 | ||
59 | executor.setKeepAliveSeconds(60); | ||
60 | //配置线程池中的线程的名称前缀 | ||
61 | executor.setThreadNamePrefix("task-executor2-"); | ||
62 | |||
63 | // handler,是一种拒绝策略,我们可以在任务满了之后,拒绝执行某些任务。 | ||
64 | // rejection-policy:当pool已经达到max size的时候,如何处理新任务 | ||
65 | // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行 | ||
66 | executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); | ||
67 | // AbortPolicy:用于被拒绝任务的处理程序,它将抛出RejectedExecutionException | ||
68 | // CallerRunsPolicy:用于被拒绝任务的处理程序,它直接在execute方法的调用线程中运行被拒绝的任务。 | ||
69 | // DiscardOldestPolicy:用于被拒绝任务的处理程序,它放弃最旧的未处理请求,然后重试execute。 | ||
70 | // DiscardPolicy:用于被拒绝任务的处理程序,默认情况下它将丢弃被拒绝的任务。 | ||
71 | |||
72 | //执行初始化 | ||
73 | executor.initialize(); | ||
74 | return executor; | ||
75 | } | ||
48 | } | 76 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
请 注册 或 登录 后发表评论