Browse Source

#流程bug

zhongwei
yang_shj 1 year ago
parent
commit
0efac9e1a2
  1. 20
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  2. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  3. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java
  4. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java
  5. 86
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  6. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java

20
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java

@ -435,7 +435,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
eq(ContentEntity::getTenantId, tenantId); eq(ContentEntity::getTenantId, tenantId);
}}); }});
// 返回数据 // 返回数据
return contents.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return contents.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -452,7 +452,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
eq(ObjectDangerEntity::getTenantId, tenantId); eq(ObjectDangerEntity::getTenantId, tenantId);
}}); }});
// 返回数据 // 返回数据
return dangers.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return dangers.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
@ -471,7 +471,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
eq(OfflineTaskEntity::getId, taskId); eq(OfflineTaskEntity::getId, taskId);
}}); }});
// 返回数据 // 返回数据
return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
@ -487,7 +487,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<TaskUserEntity> taskUsers = this.taskUserService.getOfflineTaskUser(taskIds); List<TaskUserEntity> taskUsers = this.taskUserService.getOfflineTaskUser(taskIds);
// 返回数据 // 返回数据
return taskUsers.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return taskUsers.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -501,7 +501,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
// 查询巡检任务 // 查询巡检任务
List<TaskOfflineVO> tasks = taskService.getTaskData(taskId,currentDate); List<TaskOfflineVO> tasks = taskService.getTaskData(taskId,currentDate);
// 返回数据 // 返回数据
return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -515,7 +515,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
} }
List<PlanOfflineVO> tasks = planService.getPlans(planIds); List<PlanOfflineVO> tasks = planService.getPlans(planIds);
// 返回数据 // 返回数据
return tasks.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return tasks.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
@ -532,7 +532,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<EventEntity> events = eventService.list(new LambdaQueryWrapper<EventEntity>() {{ List<EventEntity> events = eventService.list(new LambdaQueryWrapper<EventEntity>() {{
in(EventEntity::getTaskId, taskIds); in(EventEntity::getTaskId, taskIds);
}}); }});
return events.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return events.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -548,7 +548,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
List<EventAttachmentEntity> eventAttachments = eventAttachmentService.list(new LambdaQueryWrapper<EventAttachmentEntity>() {{ List<EventAttachmentEntity> eventAttachments = eventAttachmentService.list(new LambdaQueryWrapper<EventAttachmentEntity>() {{
in(EventAttachmentEntity::getEventId, eventIds); in(EventAttachmentEntity::getEventId, eventIds);
}}); }});
return eventAttachments.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return eventAttachments.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -564,7 +564,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
in(EventRecordEntity::getEventId, eventIds); in(EventRecordEntity::getEventId, eventIds);
}}); }});
// 返回数据 // 返回数据
return eventRecords.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return eventRecords.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**
@ -579,7 +579,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
// 查询巡检任务对象 // 查询巡检任务对象
List<TaskObjectOfflineVO> taskObjects = taskObjectService.getExObjectData(taskIds); List<TaskObjectOfflineVO> taskObjects = taskObjectService.getExObjectData(taskIds);
// 返回数据 // 返回数据
return taskObjects.stream().map(item -> this.convertFileOrVideo(item)).collect(Collectors.toList()); return taskObjects.stream().map(this::convertFileOrVideo).collect(Collectors.toList());
} }
/** /**

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -340,13 +340,13 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
* @author xiashandong * @author xiashandong
**/ **/
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateMaterials(long planId, long taskId, List<OperAccessMaterialDTO> materials) { public void updateMaterials(Long planId, Long taskId, List<OperAccessMaterialDTO> materials) {
if (CollectionUtils.isEmpty(materials)) { if (CollectionUtils.isEmpty(materials)) {
materials = new ArrayList<>(); materials = new ArrayList<>();
} }
//查询已经存在的检修库明细,并删除部分需要删除的 //查询已经存在的检修库明细,并删除部分需要删除的
List<OperAccessMaterialEntity> existsDetails = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{ List<OperAccessMaterialEntity> existsDetails = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{
eq(OperAccessMaterialEntity::getPlanId, planId); eq(Func.isNotEmpty(planId),OperAccessMaterialEntity::getPlanId, planId);
eq(OperAccessMaterialEntity::getTaskId, taskId); eq(OperAccessMaterialEntity::getTaskId, taskId);
eq(OperAccessMaterialEntity::getIsDeleted, 0L); eq(OperAccessMaterialEntity::getIsDeleted, 0L);
}}); }});

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java

@ -131,6 +131,18 @@ public class AbnormalAlarmController extends BladeController {
} }
/** /**
*
*/
@ApiLog
@ApiOperation(value = "站点")
@ApiOperationSupport(order = 7)
@RequestMapping(value = "/stations", method = {RequestMethod.GET, RequestMethod.POST})
public R stations(){
service.stations();
return R.status(true);
}
/**
* 智能告警数量: 时间范围当天 * 智能告警数量: 时间范围当天
*/ */
@ApiLog @ApiLog

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java

@ -38,4 +38,5 @@ public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormal
List<String> queryStationName(); List<String> queryStationName();
void stations();
} }

86
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -35,6 +35,7 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -59,6 +60,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
private final ISoeClient alarmClient; private final ISoeClient alarmClient;
private final RedisTemplate redisTemplate;
@Value("${hzims.operation.alarm.types}") @Value("${hzims.operation.alarm.types}")
private String types; private String types;
@ -233,44 +236,62 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){
return new AlarmReustVo(); return new AlarmReustVo();
} }
// 查询当天类型处理告警
List<AlarmHandleEntity> handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM);
// 返回数据 // 返回数据
AlarmReustVo response = new AlarmReustVo(); AlarmReustVo response = new AlarmReustVo();
List<AlarmDataVo> datas = result.getData().getRecords().stream().map(alarm -> { if(types.size() > 1){
AlarmDataVo record = new AlarmDataVo(); response.setCount((int) result.getData().getTotal());
// 继承类属性拷贝 response.setTotal(result.getData().getTotal());
BeanUtil.copyProperties(alarm, record); response.setSoeList(result.getData().getRecords().stream().map(alarm -> {
if(CollectionUtil.isEmpty(handles)){ AlarmDataVo record = new AlarmDataVo();
record.setIsHandle(false); // 继承类属性拷贝
}else{ BeanUtil.copyProperties(alarm, record);
record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(alarm.getId()))); record.setStationCode(alarm.getStation());
} record.setContent(alarm.getSoeExplain());
record.setStationCode(alarm.getStation()); record.setType(alarm.getSoeType());
record.setContent(alarm.getSoeExplain()); record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]);
record.setType(alarm.getSoeType()); record.setStationName((String) redisTemplate.opsForValue().get("alarm:station:" + alarm.getStation()));
record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); record.setServeType("2");
List<StationEntity> filter = stations.stream().filter(station -> station.getCode().equals(alarm.getStation())).collect(Collectors.toList()); record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM);
if (CollectionUtil.isEmpty(filter)) {
return record; return record;
} }).sorted(Comparator.comparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()));
record.setStationName(filter.get(0).getName()); }else{
record.setServeType(filter.get(0).getServeType()); // 查询当天类型处理告警
record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); List<AlarmHandleEntity> handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM);
return record;
}).sorted(Comparator.comparing(AlarmDataVo::getIsHandle) List<AlarmDataVo> datas = result.getData().getRecords().stream().map(alarm -> {
.thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()); AlarmDataVo record = new AlarmDataVo();
// 继承类属性拷贝
response.setCount((int) (result.getData().getTotal() - handles.size())); BeanUtil.copyProperties(alarm, record);
response.setSoeList(datas); if(CollectionUtil.isEmpty(handles)){
response.setTotal(result.getData().getTotal()); record.setIsHandle(false);
}else{
record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(alarm.getId())));
}
record.setStationCode(alarm.getStation());
record.setContent(alarm.getSoeExplain());
record.setType(alarm.getSoeType());
record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]);
List<StationEntity> filter = stations.stream().filter(station -> station.getCode().equals(alarm.getStation())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(filter)) {
return record;
}
record.setStationName(filter.get(0).getName());
record.setServeType(filter.get(0).getServeType());
record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM);
return record;
}).sorted(Comparator.comparing(AlarmDataVo::getIsHandle)
.thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList());
response.setCount((int) (result.getData().getTotal() - handles.size()));
response.setSoeList(datas);
response.setTotal(result.getData().getTotal());
}
return response; return response;
} }
/** /**
* 获取处理数据ID集合 * 获取处理数据ID集合
* @return * @return
@ -391,6 +412,11 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
return this.baseMapper.getStationName(); return this.baseMapper.getStationName();
} }
@Override
public void stations() {
List<StationEntity> stations = stationService.list();
stations.forEach(item-> redisTemplate.opsForValue().set("alarm:station:" + item.getCode(),item.getName()));
}
private Boolean entityIsNull(Object object) { private Boolean entityIsNull(Object object) {

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

@ -195,9 +195,17 @@ public class MaintenanceTaskCreateTask {
Map<String,Object> params = new HashMap<String, Object>() {{ Map<String,Object> params = new HashMap<String, Object>() {{
put("taskId", taskEntity.getId()); put("taskId", taskEntity.getId());
String userId = taskEntity.getDisposer(); String userId = taskEntity.getDisposer();
List<String> userIdList = Stream.of(userId.split(",")).collect(Collectors.toList()); String[] userArr = taskEntity.getDisposer().split(",");
String taskUsers = userIdList.stream().filter(o -> StringUtils.isNotBlank(o)).map(s -> "taskUser_".concat(s)).collect(Collectors.joining(",")); for(int index = 0; index < userArr.length ; index++){
put("initUserIds", taskUsers); if(index > 4){
continue;
}
if(index > 0){
put("initUserIds" + index , "taskUser_".concat(userArr[index]));
}else{
put("initUserIds", "taskUser_".concat(userArr[index]));
}
}
put("operMaintenanceTaskEntityVo",vo); put("operMaintenanceTaskEntityVo",vo);
}}; }};
R<BladeFlow> flowResult = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params); R<BladeFlow> flowResult = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params);

Loading…
Cancel
Save