Browse Source

#预警处理过滤

zhongwei
yang_shj 1 year ago
parent
commit
910f6ec019
  1. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskReportClient.java
  2. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java
  3. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml
  4. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java
  5. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java
  6. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/FaultVo.java
  7. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java
  8. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java

2
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<TaskEntity> finshList = taskList.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(3)).collect(Collectors.toList());

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.java

@ -20,5 +20,5 @@ public interface AlarmHandleMapper extends UserDataScopeBaseMapper<AlarmHandleEn
@UserDataAuth
IPage<AlarmHandleVo> selectHandlePage(IPage<Object> page,@Param("param") HandleQueryVo param);
List<AlarmHandleEntity> handles(@Param("types") List<Long> types,@Param("alarm") Integer alarm,@Param("start") String start,@Param("end") String end);
List<AlarmHandleEntity> handles(@Param("types") List<Long> types,@Param("start") String start,@Param("end") String end);
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/AlarmHandleMapper.xml

@ -51,9 +51,6 @@
<if test="start != null and end != null">
and handler.create_time between #{start} and #{end}
</if>
<if test="alarm != null">
and type = #{alarm}
</if>
and (detail.DELAY_TIME &gt; #{end} or detail.DELAY_TIME is null)
</where>
</select>

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java

@ -151,9 +151,13 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
* @return
*/
@Override
public List<AlarmHandleEntity> handles(List<Long> types,Integer alarm) {
public List<AlarmHandleEntity> handles(List<Long> 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);
}
}

14
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<StAlarmRecordMapper
if(CollectionUtil.isEmpty(list)){
return null;
}
log.error("fault_list_stations: {}",stations);
log.error("fault_list_list: {}",list);
// 过滤已处理预警信息
List<AlarmHandleEntity> handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING),AbnormalAlarmConstant.INTELLIGENCE_ALARM);
Map<String,String> 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());
}

2
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;
}

1
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();

32
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<String> 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<String, Object> params = new HashMap<>();
params.put("taskId", taskEntity.getId());
List<String> 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<MessageTemplateEntity> templateR = messageClient.getMsgTemplateById(taskEntity.getMessageTemplateId());

Loading…
Cancel
Save