092ab24d 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 74143070 9bccf323
package com.skua.modules.report.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.common.constant.BusinessConstant;
import com.skua.common.constant.ReportConstant;
......@@ -175,34 +176,46 @@ public class OperationReportServiceImpl implements IOperationReportService {
// 翻译
Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null);
Map<String, String> sysUserDictMap = businessService.dictMap("sys_user", null);
// 1. 重点工作事项:取重点事项推进情况里面,当月完成的重点事项记录
QueryWrapper<?> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("status", "2")
.ge("end_time", startDate)
.le("end_time", endDate);
List<Map<String, Object>> queryMapList1 = baseService.queryForList("select * from f_major_issues_process", queryWrapper1);
for (Map<String, Object> item: queryMapList1) {
List<Map<String, Object>> priorityWorkItemList = new ArrayList<>();
priorityWorkItemList.add(new HashMap<String, Object>(){{
put("key0", item.get("depart_id"));
put("value0", sysDepartDictMap.get(item.get("depart_id")));
}});
productDataVO.setPriorityWorkItemList(priorityWorkItemList);
}
List<Map<String, Object>> priorityWorkItemList = queryMapList1.stream().map(item -> {
Map<String, Object> entityMap = item.keySet().stream().collect(Collectors.toMap(StrUtil::toCamelCase, key -> (item.get(key) == null ? "" : item.get(key))));
entityMap.put("departName", sysDepartDictMap.get(item.get("depart_id")));
return entityMap;
}).collect(Collectors.toList());
productDataVO.setPriorityWorkItemList(priorityWorkItemList);
// 2: 隐患排查巡检:取风险点巡检记录里面巡检类型是生产巡检的数据
QueryWrapper<?> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("inspection_type", "1")
.eq("status", "2")
.ge("end_date", startDate + BusinessConstant.startTimeSuffix)
.le("end_date", endDate + BusinessConstant.endTimeSuffix);
List<Map<String, Object>> queryMapList2 = baseService.queryForList("select * from danger_inspection_record", queryWrapper2);
for (Map<String, Object> item: queryMapList2) {
List<Map<String, Object>> hiddenDangerInspectionList = new ArrayList<>();
hiddenDangerInspectionList.add(new HashMap<String, Object>(){{
put("key0", item.get("depart_id"));
put("value0", sysDepartDictMap.get(item.get("depart_id")));
}});
productDataVO.setHiddenDangerInspectionList(hiddenDangerInspectionList);
Map<String, String> recordId2CountMap;
if (!queryMapList2.isEmpty()) {
List<String> recordIdList = queryMapList2.stream().map(item -> ConvertUtils.getString(item.get("id"))).collect(Collectors.toList());
QueryWrapper<?> tmpQueryWrapper = new QueryWrapper<>();
tmpQueryWrapper.in("danger_inspection_record.id", recordIdList)
.eq("danger_inspection_item.status", "0")
.groupBy("danger_inspection_record.id");
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);
recordId2CountMap = tmpQueryMapList.stream().collect(Collectors.toMap(item -> ConvertUtils.getString(item.get("id")), item -> ConvertUtils.getString(item.get("total"))));
} else {
recordId2CountMap = new HashMap<>();
}
List<Map<String, Object>> hiddenDangerInspectionList = queryMapList2.stream().map(item -> {
Map<String, Object> entityMap = item.keySet().stream().collect(Collectors.toMap(StrUtil::toCamelCase, key -> (item.get(key) == null ? "" : item.get(key))));
entityMap.put("departName", sysDepartDictMap.get(item.get("depart_id")));
entityMap.put("realname", sysUserDictMap.get(item.get("report_user")));
entityMap.put("exceptionCount", recordId2CountMap.getOrDefault(item.get("id"), "0"));
return entityMap;
}).collect(Collectors.toList());
productDataVO.setHiddenDangerInspectionList(hiddenDangerInspectionList);
return productDataVO;
}
......
......@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.json.JSONObject;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.modules.equipment.service.IEquipmentAssetService;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Sheet;
......@@ -109,6 +110,8 @@ public class EquipmentController {
@Autowired
private IEquipmentInfoService equipmentInfoService;
@Autowired
private IEquipmentAssetService equipmentAssetService;
@Autowired
private Key2ValueService key2ValueService;
......@@ -384,17 +387,26 @@ public class EquipmentController {
Result<?> result = new Result<>();
Equipment equipment = EquipmentUtils.equipDTO2Entity(equipmentDTO);
// todo 前端未传,特殊处理
equipment.getEquipmentInfo().setAssetId(equipment.getEquipmentAsset().getId());
// equipment.getEquipmentInfo().setAssetId(equipment.getEquipmentAsset().getId());
// equipment.getEquipmentExt().setInfoId(equipment.getEquipmentInfo().getId());
// 校验ID是否一致
JoinSqlUtils.checkSqlIdFunc(equipment);
// JoinSqlUtils.checkSqlIdFunc(equipment);
// 与点表有关联的台账不允许删除
List<SysMonitorMetricInfo> monitorMetricInfo = sysMonitorMetricInfoService.list(new QueryWrapper<SysMonitorMetricInfo>().eq("equipment_code", equipmentDTO.getEquipmentInfo().getId()));
if (monitorMetricInfo!=null&&monitorMetricInfo.size()>0) {
result.error500("与运行点表有关联的设备台账不允许删除");
return result;
}
iCrudSqlService.delete(equipment);
// iCrudSqlService.delete(equipment);
transactionTemplate.execute((transactionStatus -> {
if (StringUtils.isNotEmpty(equipment.getEquipmentInfo().getId())) {
equipmentInfoService.removeById(equipment.getEquipmentInfo().getId());
}
if (StringUtils.isNotEmpty(equipment.getEquipmentAsset().getId())) {
equipmentAssetService.removeById(equipment.getEquipmentAsset().getId());
}
return 1;
}));
return Result.ok("删除成功!");
}
......
......@@ -158,19 +158,19 @@ public class InspectionAnalysisController {
@GetMapping("/getInspectionTaskIndicators")
public Result<InspectionTaskIndicatorsVO> getInspectionTaskIndicators(String startDate,String endDate){
Result<InspectionTaskIndicatorsVO> result = new Result<>();
InspectionTaskIndicatorsVO inspectionTaskIndicatorsVO = inspectionAnalysisService.getInspectionTaskIndicatorsNew(startDate,endDate);
InspectionTaskIndicatorsVO inspectionTaskIndicatorsVO = inspectionAnalysisService.getInspectionTaskIndicators(startDate,endDate);
result.setSuccess(true);
result.setResult(inspectionTaskIndicatorsVO);
return result;
}
@ApiOperation(value = "巡检分析-巡检任务指标-详情", notes = "巡检分析-巡检任务指标-详情")
@GetMapping("/getInspectionTaskIndicatorsDetail")
public Result<List<InspectionEquipIndicatorsDetailVO>> getInspectionTaskIndicatorsDetail(String departId,String startDate,String endDate){
Result<List<InspectionEquipIndicatorsDetailVO>> result = new Result<>();
public Result<List<InspectionTaskIndicatorsVO>> getInspectionTaskIndicatorsDetail(String departId,String startDate,String endDate){
Result<List<InspectionTaskIndicatorsVO>> result = new Result<>();
if(StringUtils.isEmpty(departId)){
departId = BaseContextHandler.getDeparts();
}
List<InspectionEquipIndicatorsDetailVO> dataList = inspectionAnalysisService.getInspectionTaskIndicatorsDetail( JSUtils.quoteEach(departId,",") ,startDate,endDate);
List<InspectionTaskIndicatorsVO> dataList = inspectionAnalysisService.getInspectionTaskIndicatorsDetail( JSUtils.quoteEach(departId,",") ,startDate,endDate);
result.setSuccess(true);
result.setResult(dataList);
return result;
......
......@@ -28,7 +28,7 @@ public interface IInspectionAnalysisService {
* @param endDate
* @return
*/
List<InspectionEquipIndicatorsDetailVO> getInspectionTaskIndicatorsDetail(String departIds, String startDate, String endDate);
List<InspectionTaskIndicatorsVO> getInspectionTaskIndicatorsDetail(String departIds, String startDate, String endDate);
/***
* 巡检分析-巡检设备指标
* @param startDate
......
......@@ -34,16 +34,4 @@ public class InspectionAbnormalItemsTrendVO {
private Integer notCheckedItemsCount;
@ApiModelProperty(value = "异常项数量")
private Integer abnormalItemsCount;
public Integer getNotCheckedItemsCount() {
if (totalCount != null && checkedItemsCount != null) {
if (totalCount - checkedItemsCount < 0) {
return checkedItemsCount - totalCount;
} else {
return totalCount - checkedItemsCount;
}
} else {
return 0;
}
}
}
......
......@@ -26,4 +26,6 @@ public class InspectionTaskIndicatorsVO {
private String abnormalRate;
@ApiModelProperty(value = "异常项处理率")
private String processedAbnormalRate;
private String departName;
}
......
......@@ -45,4 +45,32 @@ public class TaskPoolConfig {
executor.initialize();
return executor;
}
@Bean(name="taskExecutor2")
public ThreadPoolTaskExecutor taskExecutor2() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//配置核心线程数:就是线程池中的核心线程数量,这几个核心线程,只是在没有用的时候,也不会被回收
executor.setCorePoolSize(50);
//配置最大线程数:就是线程池中可以容纳的最大线程的数量
executor.setMaxPoolSize(200);
//配置队列大小
executor.setQueueCapacity(500);
//线程池维护线程所允许的空闲时间:就是线程池中除了核心线程之外的其他的最长可以保留的时间,因为在线程池中,除了核心线程即使在无任务的情况下也不能被清除,其余的都是有存活时间的,意思就是非核心线程可以保留的最长的空闲时间
executor.setKeepAliveSeconds(60);
//配置线程池中的线程的名称前缀
executor.setThreadNamePrefix("task-executor2-");
// handler,是一种拒绝策略,我们可以在任务满了之后,拒绝执行某些任务。
// rejection-policy:当pool已经达到max size的时候,如何处理新任务
// CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
// AbortPolicy:用于被拒绝任务的处理程序,它将抛出RejectedExecutionException
// CallerRunsPolicy:用于被拒绝任务的处理程序,它直接在execute方法的调用线程中运行被拒绝的任务。
// DiscardOldestPolicy:用于被拒绝任务的处理程序,它放弃最旧的未处理请求,然后重试execute。
// DiscardPolicy:用于被拒绝任务的处理程序,默认情况下它将丢弃被拒绝的任务。
//执行初始化
executor.initialize();
return executor;
}
}
\ No newline at end of file
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!