Merge remote-tracking branch 'origin/master'
正在显示
15 个修改的文件
包含
251 行增加
和
39 行删除
1 | package com.skua.common.constant; | ||
2 | |||
3 | /** | ||
4 | * <pre> | ||
5 | * 常量 | ||
6 | * </pre> | ||
7 | * | ||
8 | * @author sonin | ||
9 | * @version 1.0 2023/3/9 10:12 | ||
10 | */ | ||
11 | public interface BusinessConstant { | ||
12 | |||
13 | String dateFormat = "yyyy-MM-dd HH:mm:ss"; | ||
14 | |||
15 | String startTimeSuffix = " 00:00:00"; | ||
16 | |||
17 | String endTimeSuffix = " 23:59:59"; | ||
18 | |||
19 | String countSuffix = "Count"; | ||
20 | |||
21 | String sumSuffix = "Sum"; | ||
22 | |||
23 | } |
1 | package com.skua.modules.biz.impl; | ||
2 | |||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
4 | import com.skua.modules.base.service.IBaseService; | ||
5 | import com.skua.modules.biz.IBusinessService; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.stereotype.Service; | ||
8 | |||
9 | import java.util.Collection; | ||
10 | import java.util.HashMap; | ||
11 | import java.util.List; | ||
12 | import java.util.Map; | ||
13 | |||
14 | /** | ||
15 | * @Author:sonin | ||
16 | * @Date:2025/2/18 15:35 | ||
17 | */ | ||
18 | @Service | ||
19 | public class BusinessServiceImpl implements IBusinessService { | ||
20 | |||
21 | @Autowired | ||
22 | private IBaseService baseService; | ||
23 | |||
24 | @Override | ||
25 | public Map<String, String> dictMap(String dictCode, Collection<?> inCol) { | ||
26 | String key0, value0, table0; | ||
27 | QueryWrapper<?> queryWrapper0 = new QueryWrapper<>(); | ||
28 | if ("equipment_info".equals(dictCode)) { | ||
29 | key0 = "id"; | ||
30 | value0 = "equipment_name"; | ||
31 | table0 = dictCode; | ||
32 | } else if ("sys_user".equals(dictCode)) { | ||
33 | key0 = "id"; | ||
34 | value0 = "realname"; | ||
35 | table0 = dictCode; | ||
36 | } else if ("sys_struct_dict".equals(dictCode)) { | ||
37 | key0 = "id"; | ||
38 | value0 = "struct_name"; | ||
39 | table0 = dictCode; | ||
40 | } else if ("equipment_category".equals(dictCode)) { | ||
41 | key0 = "id"; | ||
42 | value0 = "des"; | ||
43 | table0 = dictCode; | ||
44 | } else if ("evaluate_score_desc".equals(dictCode)) { | ||
45 | key0 = "id"; | ||
46 | value0 = "score_desc"; | ||
47 | table0 = dictCode; | ||
48 | } else if ("carbon_qualitative_desc".equals(dictCode)) { | ||
49 | key0 = "id"; | ||
50 | value0 = "qualitative_desc"; | ||
51 | table0 = dictCode; | ||
52 | } else if ("sys_depart".equals(dictCode)) { | ||
53 | key0 = "id"; | ||
54 | value0 = "depart_name"; | ||
55 | table0 = dictCode; | ||
56 | } else { | ||
57 | // 数据字典查询 | ||
58 | queryWrapper0.eq("sys_dict.dict_code", dictCode); | ||
59 | key0 = "sys_dict_item.item_value"; | ||
60 | value0 = "sys_dict_item.item_text"; | ||
61 | table0 = "sys_dict inner join sys_dict_item on sys_dict.id = sys_dict_item.dict_id"; | ||
62 | } | ||
63 | String sqlSelect = "select " + key0 + " as key0, " + value0 + " as value0 from " + table0; | ||
64 | if (inCol != null && !inCol.isEmpty()) { | ||
65 | queryWrapper0.in(key0, inCol); | ||
66 | } | ||
67 | List<Map<String, Object>> queryMapList0 = baseService.queryForList(sqlSelect, queryWrapper0); | ||
68 | Map<String, String> dictMap = new HashMap<>(10); | ||
69 | for (Map<String, Object> item : queryMapList0) { | ||
70 | dictMap.put(String.valueOf(item.get("key0")), String.valueOf(item.get("value0"))); | ||
71 | } | ||
72 | return dictMap; | ||
73 | } | ||
74 | |||
75 | |||
76 | } |
... | @@ -6,9 +6,9 @@ | ... | @@ -6,9 +6,9 @@ |
6 | <select id="topCensus" resultType="java.util.Map"> | 6 | <select id="topCensus" resultType="java.util.Map"> |
7 | select | 7 | select |
8 | '年度安全隐患统计(起)' as 'name','yh' as 'code', | 8 | '年度安全隐患统计(起)' as 'name','yh' as 'code', |
9 | ifnull( SUM( CASE WHEN LEFT ( sr.rec_ord_whenlong, 7 ) = #{nowMonth} THEN 1 ELSE 0 END ),0) as now, | 9 | ifnull( SUM( CASE WHEN LEFT ( sr.rec_ord_report_date, 7 ) = #{nowMonth} THEN 1 ELSE 0 END ),0) as now, |
10 | ifnull( SUM( CASE WHEN LEFT ( sr.rec_ord_whenlong, 4 ) = #{nowYear} THEN 1 ELSE 0 END),0) as nowYear, | 10 | ifnull( SUM( CASE WHEN LEFT ( sr.rec_ord_report_date, 4 ) = #{nowYear} THEN 1 ELSE 0 END),0) as nowYear, |
11 | ifnull( SUM( CASE WHEN LEFT ( sr.rec_ord_whenlong, 4 ) = #{lastYear} THEN 1 ELSE 0 END ),0) as last_year | 11 | ifnull( SUM( CASE WHEN LEFT ( sr.rec_ord_report_date, 4 ) = #{lastYear} THEN 1 ELSE 0 END ),0) as last_year |
12 | from ajh_rectification_info sr | 12 | from ajh_rectification_info sr |
13 | UNION | 13 | UNION |
14 | select | 14 | select | ... | ... |
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; | ||
4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
5 | import com.skua.common.constant.BusinessConstant; | ||
3 | import com.skua.common.constant.ReportConstant; | 6 | import com.skua.common.constant.ReportConstant; |
4 | import com.skua.common.report.ReportViewUtil; | 7 | import com.skua.common.report.ReportViewUtil; |
5 | import com.skua.core.context.BaseContextHandler; | 8 | import com.skua.core.context.BaseContextHandler; |
6 | import com.skua.core.context.SpringContextUtils; | 9 | import com.skua.core.context.SpringContextUtils; |
7 | import com.skua.core.util.ConvertUtils; | 10 | import com.skua.core.util.ConvertUtils; |
11 | import com.skua.modules.base.service.IBaseService; | ||
12 | import com.skua.modules.biz.IBusinessService; | ||
8 | import com.skua.modules.report.mapper.OperationReportMapper; | 13 | import com.skua.modules.report.mapper.OperationReportMapper; |
9 | import com.skua.modules.report.service.IOperationReportService; | 14 | import com.skua.modules.report.service.IOperationReportService; |
10 | import com.skua.modules.report.vo.*; | 15 | import com.skua.modules.report.vo.*; |
... | @@ -22,8 +27,11 @@ import java.math.BigDecimal; | ... | @@ -22,8 +27,11 @@ import java.math.BigDecimal; |
22 | import java.math.RoundingMode; | 27 | import java.math.RoundingMode; |
23 | import java.time.LocalDate; | 28 | import java.time.LocalDate; |
24 | import java.time.format.DateTimeFormatter; | 29 | import java.time.format.DateTimeFormatter; |
30 | import java.util.ArrayList; | ||
31 | import java.util.HashMap; | ||
25 | import java.util.List; | 32 | import java.util.List; |
26 | import java.util.Map; | 33 | import java.util.Map; |
34 | import java.util.stream.Collectors; | ||
27 | 35 | ||
28 | /*** | 36 | /*** |
29 | * 运营周报 | 37 | * 运营周报 |
... | @@ -33,6 +41,10 @@ public class OperationReportServiceImpl implements IOperationReportService { | ... | @@ -33,6 +41,10 @@ public class OperationReportServiceImpl implements IOperationReportService { |
33 | 41 | ||
34 | @Resource | 42 | @Resource |
35 | private OperationReportMapper operationReportMapper; | 43 | private OperationReportMapper operationReportMapper; |
44 | @Resource | ||
45 | private IBaseService baseService; | ||
46 | @Resource | ||
47 | private IBusinessService businessService; | ||
36 | 48 | ||
37 | private JdbcTemplate getJdbcTemplate(){ | 49 | private JdbcTemplate getJdbcTemplate(){ |
38 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | 50 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); |
... | @@ -154,7 +166,7 @@ public class OperationReportServiceImpl implements IOperationReportService { | ... | @@ -154,7 +166,7 @@ public class OperationReportServiceImpl implements IOperationReportService { |
154 | productDataVO.setDrugDeptartList(yyhMonthDataList); | 166 | productDataVO.setDrugDeptartList(yyhMonthDataList); |
155 | 167 | ||
156 | 168 | ||
157 | //隐患排查完成情况 | 169 | // 隐患排查完成情况 |
158 | List<String> deptNameList = operationReportMapper.queryDepatNameList(); | 170 | List<String> deptNameList = operationReportMapper.queryDepatNameList(); |
159 | productDataVO.setDangerDeptCount( 0 ); | 171 | productDataVO.setDangerDeptCount( 0 ); |
160 | if(deptNameList != null && !deptNameList.isEmpty()){ | 172 | if(deptNameList != null && !deptNameList.isEmpty()){ |
... | @@ -162,6 +174,48 @@ public class OperationReportServiceImpl implements IOperationReportService { | ... | @@ -162,6 +174,48 @@ public class OperationReportServiceImpl implements IOperationReportService { |
162 | productDataVO.setDangerDeptNames(String.join(",",deptNameList)); | 174 | productDataVO.setDangerDeptNames(String.join(",",deptNameList)); |
163 | } | 175 | } |
164 | 176 | ||
177 | // 翻译 | ||
178 | Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null); | ||
179 | Map<String, String> sysUserDictMap = businessService.dictMap("sys_user", null); | ||
180 | // 1. 重点工作事项:取重点事项推进情况里面,当月完成的重点事项记录 | ||
181 | QueryWrapper<?> queryWrapper1 = new QueryWrapper<>(); | ||
182 | queryWrapper1.eq("status", "2") | ||
183 | .ge("end_time", startDate) | ||
184 | .le("end_time", endDate); | ||
185 | List<Map<String, Object>> queryMapList1 = baseService.queryForList("select * from f_major_issues_process", queryWrapper1); | ||
186 | List<Map<String, Object>> priorityWorkItemList = queryMapList1.stream().map(item -> { | ||
187 | Map<String, Object> entityMap = item.keySet().stream().collect(Collectors.toMap(StrUtil::toCamelCase, key -> (item.get(key) == null ? "" : item.get(key)))); | ||
188 | entityMap.put("departName", sysDepartDictMap.get(item.get("depart_id"))); | ||
189 | return entityMap; | ||
190 | }).collect(Collectors.toList()); | ||
191 | productDataVO.setPriorityWorkItemList(priorityWorkItemList); | ||
192 | // 2: 隐患排查巡检:取风险点巡检记录里面巡检类型是生产巡检的数据 | ||
193 | QueryWrapper<?> queryWrapper2 = new QueryWrapper<>(); | ||
194 | queryWrapper2.eq("inspection_type", "1") | ||
195 | .eq("status", "2") | ||
196 | .ge("end_date", startDate + BusinessConstant.startTimeSuffix) | ||
197 | .le("end_date", endDate + BusinessConstant.endTimeSuffix); | ||
198 | List<Map<String, Object>> queryMapList2 = baseService.queryForList("select * from danger_inspection_record", queryWrapper2); | ||
199 | Map<String, String> recordId2CountMap; | ||
200 | if (!queryMapList2.isEmpty()) { | ||
201 | List<String> recordIdList = queryMapList2.stream().map(item -> ConvertUtils.getString(item.get("id"))).collect(Collectors.toList()); | ||
202 | QueryWrapper<?> tmpQueryWrapper = new QueryWrapper<>(); | ||
203 | tmpQueryWrapper.in("danger_inspection_record.id", recordIdList) | ||
204 | .eq("danger_inspection_item.status", "0") | ||
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<>(); | ||
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); | ||
165 | return productDataVO; | 219 | return productDataVO; |
166 | } | 220 | } |
167 | 221 | ... | ... |
... | @@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils; | ... | @@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils; |
9 | 9 | ||
10 | import java.util.ArrayList; | 10 | import java.util.ArrayList; |
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.Map; | ||
12 | 13 | ||
13 | /** | 14 | /** |
14 | * 月度生产数据报表 | 15 | * 月度生产数据报表 |
... | @@ -60,6 +61,15 @@ public class ProductDataVO { | ... | @@ -60,6 +61,15 @@ public class ProductDataVO { |
60 | @ApiModelProperty(value = "药剂实际费用") | 61 | @ApiModelProperty(value = "药剂实际费用") |
61 | private Double drugCost;//实际发生为0.219元/吨水 | 62 | private Double drugCost;//实际发生为0.219元/吨水 |
62 | 63 | ||
64 | // 重点工作事项 | ||
65 | private List<Map<String, Object>> priorityWorkItemList = new ArrayList<>(); | ||
66 | |||
67 | // 隐患排查巡检 | ||
68 | private List<Map<String, Object>> hiddenDangerInspectionList = new ArrayList<>(); | ||
69 | |||
70 | // 运营管理抽查情况 | ||
71 | private List<Map<String, Object>> managementSpotCheckList = new ArrayList<>(); | ||
72 | |||
63 | 73 | ||
64 | @ApiModelProperty(value = "实际水量同比下降--水务公司列表") | 74 | @ApiModelProperty(value = "实际水量同比下降--水务公司列表") |
65 | private List<FReportWaterMonthDataVO> waterDeptartList = new ArrayList<>(); | 75 | private List<FReportWaterMonthDataVO> waterDeptartList = new ArrayList<>(); | ... | ... |
... | @@ -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 | ||
... | @@ -212,9 +215,9 @@ public class EquipmentController { | ... | @@ -212,9 +215,9 @@ public class EquipmentController { |
212 | if (equipmentStatisticDTO.getShowDepartId()) { | 215 | if (equipmentStatisticDTO.getShowDepartId()) { |
213 | List<Map<String, Object>> departIdMapList = WrapperFactory.joinWrapper() | 216 | List<Map<String, Object>> departIdMapList = WrapperFactory.joinWrapper() |
214 | .select("count(*) as total", "depart_id as departId") | 217 | .select("count(*) as total", "depart_id as departId") |
215 | .from(EquipmentAsset.class) | 218 | .from(EquipmentInfo.class) |
216 | .innerJoin(EquipmentInfo.class, EquipmentInfo.class.getDeclaredField("assetId"), EquipmentAsset.class.getDeclaredField("id")) | 219 | .leftJoin(EquipmentAsset.class, EquipmentInfo.class.getDeclaredField("assetId"), EquipmentAsset.class.getDeclaredField("id")) |
217 | .innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id")) | 220 | .leftJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id")) |
218 | .where() | 221 | .where() |
219 | .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial()) | 222 | .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial()) |
220 | .in(true,"depart_id", Arrays.asList(departs.split(","))) | 223 | .in(true,"depart_id", Arrays.asList(departs.split(","))) |
... | @@ -359,6 +362,7 @@ public class EquipmentController { | ... | @@ -359,6 +362,7 @@ public class EquipmentController { |
359 | .groupBy("EquipmentInfo_equipmentStatus");//EquipmentInfo_isSpecial | 362 | .groupBy("EquipmentInfo_equipmentStatus");//EquipmentInfo_isSpecial |
360 | sql = sql.replace("EquipmentInfo.maintenance_cost as EquipmentInfo_maintenanceCost,", "") | 363 | sql = sql.replace("EquipmentInfo.maintenance_cost as EquipmentInfo_maintenanceCost,", "") |
361 | .replace("EquipmentInfo.gz_count as EquipmentInfo_gzCount,", ""); | 364 | .replace("EquipmentInfo.gz_count as EquipmentInfo_gzCount,", ""); |
365 | sql = sql.replaceAll("inner join", "left join"); | ||
362 | List<Map<String, Object>> countMapList = iCommonSqlService.queryWrapperForList(sql, queryWrapper); | 366 | List<Map<String, Object>> countMapList = iCommonSqlService.queryWrapperForList(sql, queryWrapper); |
363 | for (Map<String, Object> item : countMapList) { | 367 | for (Map<String, Object> item : countMapList) { |
364 | String key = "" + item.get("EquipmentInfo_equipmentStatus"); | 368 | String key = "" + item.get("EquipmentInfo_equipmentStatus"); |
... | @@ -383,17 +387,26 @@ public class EquipmentController { | ... | @@ -383,17 +387,26 @@ public class EquipmentController { |
383 | Result<?> result = new Result<>(); | 387 | Result<?> result = new Result<>(); |
384 | Equipment equipment = EquipmentUtils.equipDTO2Entity(equipmentDTO); | 388 | Equipment equipment = EquipmentUtils.equipDTO2Entity(equipmentDTO); |
385 | // todo 前端未传,特殊处理 | 389 | // todo 前端未传,特殊处理 |
386 | equipment.getEquipmentInfo().setAssetId(equipment.getEquipmentAsset().getId()); | 390 | // equipment.getEquipmentInfo().setAssetId(equipment.getEquipmentAsset().getId()); |
387 | // equipment.getEquipmentExt().setInfoId(equipment.getEquipmentInfo().getId()); | 391 | // equipment.getEquipmentExt().setInfoId(equipment.getEquipmentInfo().getId()); |
388 | // 校验ID是否一致 | 392 | // 校验ID是否一致 |
389 | JoinSqlUtils.checkSqlIdFunc(equipment); | 393 | // JoinSqlUtils.checkSqlIdFunc(equipment); |
390 | // 与点表有关联的台账不允许删除 | 394 | // 与点表有关联的台账不允许删除 |
391 | 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())); |
392 | if (monitorMetricInfo!=null&&monitorMetricInfo.size()>0) { | 396 | if (monitorMetricInfo!=null&&monitorMetricInfo.size()>0) { |
393 | result.error500("与运行点表有关联的设备台账不允许删除"); | 397 | result.error500("与运行点表有关联的设备台账不允许删除"); |
394 | return result; | 398 | return result; |
395 | } | 399 | } |
396 | 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 | })); | ||
397 | return Result.ok("删除成功!"); | 410 | return Result.ok("删除成功!"); |
398 | } | 411 | } |
399 | 412 | ||
... | @@ -522,8 +535,8 @@ public class EquipmentController { | ... | @@ -522,8 +535,8 @@ public class EquipmentController { |
522 | .select(" (SELECT MAX(real_start_time) FROM equipment_maintain_task WHERE equipment_id = equipment_info.id and results_enforcement='4') as equipmentExt_maintainLastTime ") | 535 | .select(" (SELECT MAX(real_start_time) FROM equipment_maintain_task WHERE equipment_id = equipment_info.id and results_enforcement='4') as equipmentExt_maintainLastTime ") |
523 | .select(" (select TIMESTAMPDIFF(HOUR, NOW(),(select min(start_time) from equipment_maintain_task where start_time>NOW() and equipment_id = equipment_info.id))) as equipmentExt_maintainCountdown ") | 536 | .select(" (select TIMESTAMPDIFF(HOUR, NOW(),(select min(start_time) from equipment_maintain_task where start_time>NOW() and equipment_id = equipment_info.id))) as equipmentExt_maintainCountdown ") |
524 | .select(" (select max(repair_date) from equipment_repair where info_id=equipment_info.id) as equipmentExt_repairLastTime ") | 537 | .select(" (select max(repair_date) from equipment_repair where info_id=equipment_info.id) as equipmentExt_repairLastTime ") |
525 | .from(EquipmentAsset.class) | 538 | .from(EquipmentInfo.class) |
526 | .innerJoin(EquipmentInfo.class, EquipmentInfo::getAssetId, EquipmentAsset::getId) | 539 | .leftJoin(EquipmentAsset.class, EquipmentInfo::getAssetId, EquipmentAsset::getId) |
527 | .leftJoin(EquipmentBrand.class, EquipmentInfo::getEquipmentBrand, EquipmentBrand::getId) | 540 | .leftJoin(EquipmentBrand.class, EquipmentInfo::getEquipmentBrand, EquipmentBrand::getId) |
528 | .leftJoin(EquipmentCategory.class, EquipmentInfo::getEquipmentType, EquipmentCategory::getId) | 541 | .leftJoin(EquipmentCategory.class, EquipmentInfo::getEquipmentType, EquipmentCategory::getId) |
529 | .where() | 542 | .where() | ... | ... |
... | @@ -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; |
... | @@ -221,19 +221,19 @@ public class InspectionAnalysisController { | ... | @@ -221,19 +221,19 @@ public class InspectionAnalysisController { |
221 | @GetMapping("/getInspectionEquipIndicators") | 221 | @GetMapping("/getInspectionEquipIndicators") |
222 | public Result<InspectionEquipIndicatorsVO> getInspectionEquipIndicators(String startDate, String endDate){ | 222 | public Result<InspectionEquipIndicatorsVO> getInspectionEquipIndicators(String startDate, String endDate){ |
223 | Result<InspectionEquipIndicatorsVO> result = new Result<>(); | 223 | Result<InspectionEquipIndicatorsVO> result = new Result<>(); |
224 | InspectionEquipIndicatorsVO inspectionEquipIndicatorsVO = inspectionAnalysisService.getInspectionEquipIndicatorsNew(startDate,endDate); | 224 | InspectionEquipIndicatorsVO inspectionEquipIndicatorsVO = inspectionAnalysisService.getInspectionEquipIndicators(startDate,endDate); |
225 | result.setSuccess(true); | 225 | result.setSuccess(true); |
226 | result.setResult(inspectionEquipIndicatorsVO); | 226 | result.setResult(inspectionEquipIndicatorsVO); |
227 | return result; | 227 | return result; |
228 | } | 228 | } |
229 | @ApiOperation(value = "巡检分析-巡检设备指标-详情", notes = "巡检分析-巡检设备指标-详情") | 229 | @ApiOperation(value = "巡检分析-巡检设备指标-详情", notes = "巡检分析-巡检设备指标-详情") |
230 | @GetMapping("/getInspectionEquipIndicatorsDetail") | 230 | @GetMapping("/getInspectionEquipIndicatorsDetail") |
231 | public Result<List<InspectionEquipIndicatorsDetailVO>> getInspectionEquipIndicators(String departId,String startDate, String endDate){ | 231 | public Result<List<InspectionEquipIndicatorsVO>> getInspectionEquipIndicators(String departId,String startDate, String endDate){ |
232 | Result<List<InspectionEquipIndicatorsDetailVO>> result = new Result<>(); | 232 | Result<List<InspectionEquipIndicatorsVO>> result = new Result<>(); |
233 | if(StringUtils.isEmpty(departId)){ | 233 | if(StringUtils.isEmpty(departId)){ |
234 | departId = BaseContextHandler.getDeparts(); | 234 | departId = BaseContextHandler.getDeparts(); |
235 | } | 235 | } |
236 | List<InspectionEquipIndicatorsDetailVO> dataList = inspectionAnalysisService.getInspectionEquipIndicatorsDetail(JSUtils.quoteEach(departId,","),startDate,endDate); | 236 | List<InspectionEquipIndicatorsVO> dataList = inspectionAnalysisService.getInspectionEquipIndicatorsDetail(JSUtils.quoteEach(departId,","),startDate,endDate); |
237 | result.setSuccess(true); | 237 | result.setSuccess(true); |
238 | result.setResult(dataList); | 238 | result.setResult(dataList); |
239 | return result; | 239 | return result; |
... | @@ -251,7 +251,7 @@ public class InspectionAnalysisController { | ... | @@ -251,7 +251,7 @@ public class InspectionAnalysisController { |
251 | @GetMapping("/getInspectionEquipOverview") | 251 | @GetMapping("/getInspectionEquipOverview") |
252 | public Result<InspectionEquipOverviewVO> getInspectionEquipOverview(String startDate, String endDate){ | 252 | public Result<InspectionEquipOverviewVO> getInspectionEquipOverview(String startDate, String endDate){ |
253 | Result<InspectionEquipOverviewVO> result = new Result<>(); | 253 | Result<InspectionEquipOverviewVO> result = new Result<>(); |
254 | InspectionEquipOverviewVO inspectionEquipOverviewVO = inspectionAnalysisService.getInspectionEquipOverviewNew(startDate,endDate); | 254 | InspectionEquipOverviewVO inspectionEquipOverviewVO = inspectionAnalysisService.getInspectionEquipOverview(startDate,endDate); |
255 | result.setSuccess(true); | 255 | result.setSuccess(true); |
256 | result.setResult(inspectionEquipOverviewVO); | 256 | result.setResult(inspectionEquipOverviewVO); |
257 | return result; | 257 | return result; |
... | @@ -259,15 +259,15 @@ public class InspectionAnalysisController { | ... | @@ -259,15 +259,15 @@ public class InspectionAnalysisController { |
259 | 259 | ||
260 | @ApiOperation(value = "巡检分析-巡检设备概况-详情", notes = "巡检分析-巡检设备概况-详情") | 260 | @ApiOperation(value = "巡检分析-巡检设备概况-详情", notes = "巡检分析-巡检设备概况-详情") |
261 | @GetMapping("/getInspectionEquipOverviewDetail") | 261 | @GetMapping("/getInspectionEquipOverviewDetail") |
262 | public Result<List<InspectionEquipIndicatorsDetailVO>> getInspectionEquipOverviewDetail(String departId,String startDate, String endDate){ | 262 | public Result<List<InspectionEquipOverviewVO>> getInspectionEquipOverviewDetail(String departId,String startDate, String endDate){ |
263 | Result<List<InspectionEquipIndicatorsDetailVO>> result = new Result<>(); | 263 | Result<List<InspectionEquipOverviewVO>> result = new Result<>(); |
264 | String departIds = departId; | 264 | String departIds = departId; |
265 | if(StringUtils.isEmpty(departId)){ | 265 | if(StringUtils.isEmpty(departId)){ |
266 | departIds = BaseContextHandler.getDeparts(); | 266 | departIds = BaseContextHandler.getDeparts(); |
267 | }else{ | 267 | }else{ |
268 | departIds = sysDepartService.getChildDepartId(departId); | 268 | departIds = sysDepartService.getChildDepartId(departId); |
269 | } | 269 | } |
270 | List<InspectionEquipIndicatorsDetailVO> dataList = inspectionAnalysisService.getInspectionEquipOverviewDetail(departIds,startDate,endDate); | 270 | List<InspectionEquipOverviewVO> dataList = inspectionAnalysisService.getInspectionEquipOverviewDetail(departIds,startDate,endDate); |
271 | result.setSuccess(true); | 271 | result.setSuccess(true); |
272 | result.setResult(dataList); | 272 | result.setResult(dataList); |
273 | return result; | 273 | 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 |
... | @@ -43,7 +43,7 @@ public interface IInspectionAnalysisService { | ... | @@ -43,7 +43,7 @@ public interface IInspectionAnalysisService { |
43 | * @param endDate | 43 | * @param endDate |
44 | * @return | 44 | * @return |
45 | */ | 45 | */ |
46 | List<InspectionEquipIndicatorsDetailVO> getInspectionEquipIndicatorsDetail(String departIds,String startDate, String endDate); | 46 | List<InspectionEquipIndicatorsVO> getInspectionEquipIndicatorsDetail(String departIds,String startDate, String endDate); |
47 | 47 | ||
48 | /*** | 48 | /*** |
49 | * 巡检分析-巡检任务概况 | 49 | * 巡检分析-巡检任务概况 |
... | @@ -79,7 +79,7 @@ public interface IInspectionAnalysisService { | ... | @@ -79,7 +79,7 @@ public interface IInspectionAnalysisService { |
79 | * @param endDate | 79 | * @param endDate |
80 | * @return | 80 | * @return |
81 | */ | 81 | */ |
82 | List<InspectionEquipIndicatorsDetailVO> getInspectionEquipOverviewDetail(String departIds, String startDate, String endDate); | 82 | List<InspectionEquipOverviewVO> getInspectionEquipOverviewDetail(String departIds, String startDate, String endDate); |
83 | 83 | ||
84 | /*** | 84 | /*** |
85 | * 巡检分析-巡检任务异常项趋势 | 85 | * 巡检分析-巡检任务异常项趋势 | ... | ... |
此文件的差异被折叠,
点击展开。
... | @@ -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 | } | ... | ... |
... | @@ -28,4 +28,6 @@ public class InspectionEquipIndicatorsVO { | ... | @@ -28,4 +28,6 @@ public class InspectionEquipIndicatorsVO { |
28 | @ApiModelProperty(value = "异常项处理率") | 28 | @ApiModelProperty(value = "异常项处理率") |
29 | private String processedAbnormalRate; | 29 | private String processedAbnormalRate; |
30 | 30 | ||
31 | private String departName; | ||
32 | |||
31 | } | 33 | } | ... | ... |
... | @@ -29,4 +29,6 @@ public class InspectionEquipOverviewVO { | ... | @@ -29,4 +29,6 @@ public class InspectionEquipOverviewVO { |
29 | private Integer abnormalInspectionEquipCount; | 29 | private Integer abnormalInspectionEquipCount; |
30 | @ApiModelProperty(value = "异常项处理率") | 30 | @ApiModelProperty(value = "异常项处理率") |
31 | private String processedAbnormalRate; | 31 | private String processedAbnormalRate; |
32 | |||
33 | private String departName; | ||
32 | } | 34 | } | ... | ... |
... | @@ -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 | ... | ... |
-
请 注册 或 登录 后发表评论