From 910f6ec019314ed17b19df8640425f46aa021559 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 25 Aug 2023 17:40:02 +0800 Subject: [PATCH] =?UTF-8?q?#=E9=A2=84=E8=AD=A6=E5=A4=84=E7=90=86=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/feign/InspectTaskReportClient.java | 2 +- .../alert/mapper/AlarmHandleMapper.java | 2 +- .../operational/alert/mapper/AlarmHandleMapper.xml | 3 -- .../alert/service/impl/AlarmHandleServiceImpl.java | 8 ++++-- .../service/impl/StAlamRecordServiceImpl.java | 14 ++++++++-- .../hnac/hzims/operational/config/vo/FaultVo.java | 2 ++ .../main/service/impl/AppHomeServiceImpl.java | 1 + .../service/impl/MaintenanceServiceImpl.java | 32 ++++++++++------------ 8 files changed, 37 insertions(+), 27 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java index b018474..1fbca6a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java @@ -131,7 +131,7 @@ public class InspectTaskReportClient implements IInspectTaskReportClient { if(CollectionUtil.isEmpty(taskList)){ return R.data(dutyInspectTaskVO); } - dutyInspectTaskVO.setInspectTaskIds(taskList.stream().map(TaskEntity::getId).map(id->id.toString()).collect(Collectors.joining(","))); + dutyInspectTaskVO.setInspectTaskIds(taskList.stream().map(TaskEntity::getId).map(Object::toString).collect(Collectors.joining(","))); dutyInspectTaskVO.setInspectTaskSum(taskList.size()); // 所有处理完成巡检任务 List finshList = taskList.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(3)).collect(Collectors.toList()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java index 0c55878..c989ecc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java @@ -20,5 +20,5 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper selectHandlePage(IPage page,@Param("param") HandleQueryVo param); - List handles(@Param("types") List types,@Param("alarm") Integer alarm,@Param("start") String start,@Param("end") String end); + List handles(@Param("types") List types,@Param("start") String start,@Param("end") String end); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml index ec557f8..18304a2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml @@ -51,9 +51,6 @@ and handler.create_time between #{start} and #{end} - - and type = #{alarm} - and (detail.DELAY_TIME > #{end} or detail.DELAY_TIME is null) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java index a151d74..73129be 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java @@ -151,9 +151,13 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl handles(List types,Integer alarm) { + public List handles(List types,Integer isEarly) { + if(AbnormalAlarmConstant.INTELLIGENCE_ALARM.equals(isEarly)){ + String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); + return this.baseMapper.handles(types,null,null); + } String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); - return this.baseMapper.handles(types,alarm,start,end); + return this.baseMapper.handles(types,start,end); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index c636df2..96c0805 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.fdp.feign.IFdpMonitorClient; @@ -739,10 +740,17 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING),AbnormalAlarmConstant.INTELLIGENCE_ALARM); Map map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName)); - return list.stream().filter(fault -> map.containsKey(fault.getStation())).peek(o-> o.setStationName(map.get(o.getStation()))).collect(Collectors.toList()); + return list.stream().filter(fault -> map.containsKey(fault.getStation())).peek(record -> { + record.setStationName(map.get(record.getStation())); + if(CollectionUtil.isEmpty(handles)){ + record.setIsHandle(false); + }else{ + record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(record.getFaultId()))); + } + }).collect(Collectors.toList()); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java index 74a0f60..a76ef46 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java @@ -27,4 +27,6 @@ public class FaultVo { private String info; private String name; + + private Boolean isHandle; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java index e750044..e9a531c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java @@ -539,6 +539,7 @@ public class AppHomeServiceImpl implements IAppHomeService { e.printStackTrace(); Thread.currentThread().interrupt(); } + pool.shutdown(); // 任务完成率 int taskSum = item.getDefectSum() + item.getInspectionTaskCount() + item.getMaintenanceTaskCount() + item.getOverhaulTaskCount(); int finishSum = item.getSolvedCount() + item.getInspectionTaskFinishCount() + item.getMaintenanceTaskFinishCount() + item.getOverhaulTaskFinishCount(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java index 8983c96..db53664 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java @@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.dto.BusinessMessageDTO; -import com.hnac.hzims.message.dto.MessagePushRecordDto; import com.hnac.hzims.message.dto.PlanMsgRecordDto; import com.hnac.hzims.message.entity.config.MessageTemplateEntity; import com.hnac.hzims.message.fegin.IMessageClient; @@ -34,8 +33,6 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.system.feign.ISysClient; -import org.springblade.system.user.cache.UserCache; -import org.springblade.system.user.entity.User; import org.springframework.beans.BeanUtils; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; @@ -51,10 +48,8 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; import java.util.concurrent.ThreadPoolExecutor; import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.springblade.core.tool.utils.DateUtil.PATTERN_DATE; @@ -273,7 +268,7 @@ public class MaintenanceServiceImpl implements MaintenanceService { //拆分设备 每个设备生成一条任务 if (StringUtil.isNotBlank(finalPlanEntity.getEmCode())) { log.info("finalPlanEntity.getEmCode() : {}", finalPlanEntity.getEmCode()); - List emCodeList = Arrays.asList(finalPlanEntity.getEmCode().split(",")); + String[] emCodeList = finalPlanEntity.getEmCode().split(","); for (String emCode : emCodeList) { taskEntity.setEmCode(emCode); this.fillTask(taskEntity, finalPlanEntity); @@ -359,23 +354,26 @@ public class MaintenanceServiceImpl implements MaintenanceService { BeanUtils.copyProperties(taskEntity, operMaintenanceTaskEntityVo); Map params = new HashMap<>(); params.put("taskId", taskEntity.getId()); - List userIdList = Stream.of(taskEntity.getDisposer().split(",")).collect(Collectors.toList()); - String taskUsers = userIdList.stream().filter(o -> StringUtils.isNotBlank(o)).map(s -> { - return "taskUser_".concat(s); - }).collect(Collectors.joining(",")); - params.put("initUserIds", taskUsers); + int index = 1; + for(String userId :taskEntity.getDisposer().split(",")){ + if(index > 1){ + params.put("initUserIds" + index , "taskUser_".concat(userId)); + }else{ + params.put("initUserIds", "taskUser_".concat(userId)); + } + index++; + } params.put("operMaintenanceTaskEntityVo", operMaintenanceTaskEntityVo); - return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params).getData().getProcessInstanceId(); } - /** - * 推送日常维护任务消息 - * - * @return void + /* + 推送日常维护任务消息 + + @return void * @Param taskEntity 日常维护任务 - **/ + */ private void pushTaskMessage(OperMaintenanceTaskEntity taskEntity) { log.info("开始保存{}的日常维护消息推送记录", taskEntity.getDisposer()); R templateR = messageClient.getMsgTemplateById(taskEntity.getMessageTemplateId());