Browse Source

#预警处理过滤

zhongwei
yang_shj 1 year ago
parent
commit
230745e4a6
  1. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java
  2. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java
  3. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java
  4. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
  5. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

@ -25,6 +25,7 @@ import com.hnac.hzims.operational.config.service.StAlamRecordService;
import com.hnac.hzims.operational.config.service.StFocusPropertiesService;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.vo.RealDeviceVo;
import com.hnac.hzims.operational.main.vo.SoeDataVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
@ -750,7 +751,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
}else{
record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(record.getFaultId())));
}
}).collect(Collectors.toList());
}).sorted(Comparator.comparing((FaultVo::getIsHandle)).reversed().thenComparing(FaultVo::getCreateTime).reversed()).collect(Collectors.toList());
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java

@ -94,7 +94,7 @@ public class MaintenanceTaskCreateTask {
//生成日常巡检任务并插入数据库
for (int i = startIndex; i < endIndex; i++) {
this.generateTaskByPlan(planEntities.get(i));
this.generateTaskByPlan(planEntities.get(i),true);
}
Thread.sleep(1000);
@ -110,18 +110,18 @@ public class MaintenanceTaskCreateTask {
* @param planEntity
* @return
*/
public void generateTaskByPlan(OperMaintenancePlanEntity planEntity) {
public void generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) {
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class);
//拆分设备 每个设备生成一条任务
if(StringUtil.isNotBlank(planEntity.getEmCode())){
List<String> emCodeList = Arrays.asList(planEntity.getEmCode().split(","));
for(String emCode : emCodeList){
taskEntity.setEmCode(emCode);
maintenanceService.fillTask(taskEntity,planEntity);
maintenanceService.fillTask(taskEntity,planEntity,flag);
}
}
else {
maintenanceService.fillTask(taskEntity,planEntity);
maintenanceService.fillTask(taskEntity,planEntity,flag);
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java

@ -38,5 +38,5 @@ public interface MaintenanceService {
* @param taskEntity
* @param finalPlanEntity
*/
void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity);
void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag);
}

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java

@ -271,10 +271,10 @@ public class MaintenanceServiceImpl implements MaintenanceService {
String[] emCodeList = finalPlanEntity.getEmCode().split(",");
for (String emCode : emCodeList) {
taskEntity.setEmCode(emCode);
this.fillTask(taskEntity, finalPlanEntity);
this.fillTask(taskEntity, finalPlanEntity,false);
}
} else {
this.fillTask(taskEntity, finalPlanEntity);
this.fillTask(taskEntity, finalPlanEntity,false);
}
}
@ -286,7 +286,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @param taskEntity
* @param finalPlanEntity
*/
public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity) {
public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag) {
DefaultTransactionDefinition defaultTransactionDefinition = new DefaultTransactionDefinition();
defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition);
@ -322,7 +322,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
taskService.save(taskEntity);
dataSourceTransactionManager.commit(transaction);
//启动流程
String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity);
String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity,flag);
//推送消息
CompletableFuture<Void> operMaintenanceTaskEntityCompletableFuture =
CompletableFuture.runAsync(() -> {
@ -349,19 +349,24 @@ public class MaintenanceServiceImpl implements MaintenanceService {
*
* @author xiashandong
**/
private String startProcess(String processDefinitionKey, OperMaintenanceTaskEntity taskEntity) {
private String startProcess(String processDefinitionKey, OperMaintenanceTaskEntity taskEntity,Boolean flag) {
OperMaintenanceTaskEntityVo operMaintenanceTaskEntityVo = new OperMaintenanceTaskEntityVo();
BeanUtils.copyProperties(taskEntity, operMaintenanceTaskEntityVo);
Map<String, Object> params = new HashMap<>();
params.put("taskId", taskEntity.getId());
int index = 1;
for(String userId :taskEntity.getDisposer().split(",")){
if(index > 1){
params.put("initUserIds" + index , "taskUser_".concat(userId));
if(flag){
params.put("startFlowUserId", taskEntity.getCreateUser().toString());
}
String[] userArr = taskEntity.getDisposer().split(",");
for(int index = 0; index < userArr.length ; index++){
if(index > 4){
continue;
}
if(index > 0){
params.put("initUserIds" + index , "taskUser_".concat(userArr[index]));
}else{
params.put("initUserIds", "taskUser_".concat(userId));
params.put("initUserIds", "taskUser_".concat(userArr[index]));
}
index++;
}
params.put("operMaintenanceTaskEntityVo", operMaintenanceTaskEntityVo);
return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params).getData().getProcessInstanceId();

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java

@ -108,7 +108,7 @@ public class OperMaintenancePlanServiceImpl extends BaseServiceImpl<OperMaintena
MaintenanceTaskCreateTask schedule = SpringUtil.getBean(MaintenanceTaskCreateTask.class);
finalPlanEntities.forEach(planEntity -> {
try{
schedule.generateTaskByPlan(planEntity);
schedule.generateTaskByPlan(planEntity,false);
//更新任务派发时间
this.update(new LambdaUpdateWrapper<OperMaintenancePlanEntity>().set(OperMaintenancePlanEntity::getCreateTaskTime,new Date())
.eq(OperMaintenancePlanEntity::getId,planEntity.getId()));

Loading…
Cancel
Save