liwen 7 months ago
parent
commit
433b56e0c6
  1. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ActivePowerVo.java
  2. 12
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceLibraryEntity.java
  3. 20
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenancePlanEntity.java
  4. 15
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceTaskEntity.java
  5. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmDefaulConfigMapper.java
  6. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmDefaulConfigService.java
  7. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmDefaulConfigServiceImpl.java
  8. 55
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java
  9. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  10. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmDefaulConfigMapper.xml
  11. 46
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java
  12. 8
      hzims-service/operational/src/main/resources/db/1.0.0.sql
  13. 14
      hzims-service/operational/src/main/resources/db/2.0.3.sql

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ActivePowerVo.java

@ -12,6 +12,9 @@ import lombok.Data;
@ApiModel(value = "当日机组有功功率") @ApiModel(value = "当日机组有功功率")
public class ActivePowerVo { public class ActivePowerVo {
@ApiModelProperty(value = "字符串时间")
private String strHour;
@ApiModelProperty(value = "小时") @ApiModelProperty(value = "小时")
private Integer hour; private Integer hour;

12
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceLibraryEntity.java

@ -35,13 +35,23 @@ public class OperMaintenanceLibraryEntity extends TenantEntity {
@ApiModelProperty(value = "库编码,后台自动生成") @ApiModelProperty(value = "库编码,后台自动生成")
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
private String libraryCode; private String libraryCode;
@ApiModelProperty(value = "站点编号")
@QueryField(condition = SqlCondition.EQUAL)
private String stationCode;
@ApiModelProperty(value = "站点名称")
private String stationName;
/** /**
* 设备编码 * 设备编码
*/ */
@ApiModelProperty(value = "设备编码,多个按,分隔") @ApiModelProperty(value = "设备编码,多个按,分隔")
@QueryField(condition = SqlCondition.EQUAL) @QueryField(condition = SqlCondition.LIKE)
private String emCode; private String emCode;
@ApiModelProperty(value = "设备名称,多个按,分隔")
private String emName;
@ApiModelProperty(value = "维护模式 01=人员 02=值班") @ApiModelProperty(value = "维护模式 01=人员 02=值班")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Integer maintenanceModel; private Integer maintenanceModel;

20
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenancePlanEntity.java

@ -8,6 +8,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import java.util.Date; import java.util.Date;
@ -26,6 +28,16 @@ public class OperMaintenancePlanEntity extends TenantEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "站点编号")
private String stationCode;
@ApiModelProperty(value = "站点名称")
@QueryField(condition = SqlCondition.EQUAL)
private String stationName;
@ApiModelProperty(value = "设备名称,多个按,分隔")
private String emName;
/** /**
* 设备编码 * 设备编码
*/ */
@ -115,11 +127,9 @@ public class OperMaintenancePlanEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Long messageTemplateId; private Long messageTemplateId;
@ApiModelProperty(value = "周期(单位:小时)")
/** @JsonSerialize(nullsUsing = NullSerializer.class)
* 站点code private Integer period;
*/
private String stationCode;
@ApiModelProperty(value = "创建用户名称") @ApiModelProperty(value = "创建用户名称")
private String createUserName; private String createUserName;

15
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceTaskEntity.java

@ -10,6 +10,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ -31,6 +33,16 @@ public class OperMaintenanceTaskEntity extends TenantEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "站点编号")
private String stationCode;
@ApiModelProperty(value = "站点名称")
@QueryField(condition = SqlCondition.EQUAL)
private String stationName;
@ApiModelProperty(value = "设备名称,多个按,分隔")
private String emName;
/** /**
* 设备编码 * 设备编码
*/ */
@ -107,6 +119,9 @@ public class OperMaintenanceTaskEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "维护内容") @ApiModelProperty(value = "维护内容")
private String content; private String content;
@ApiModelProperty(value = "周期(单位:小时)")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer period;
/** /**
* 操作规范 * 操作规范
*/ */

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmDefaulConfigMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.mapper.alarm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity;
/**
* @author ysj
*/
public interface AlarmDefaulConfigMapper extends BaseMapper<AlarmDefaultConfigEntity> {
}

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmDefaulConfigService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.service.alarm;
import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface AlarmDefaulConfigService extends BaseService<AlarmDefaultConfigEntity> {
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmDefaulConfigServiceImpl.java

@ -0,0 +1,21 @@
package com.hnac.hzims.scheduled.service.alarm.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity;
import com.hnac.hzims.scheduled.mapper.alarm.AlarmDefaulConfigMapper;
import com.hnac.hzims.scheduled.service.alarm.AlarmDefaulConfigService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
@DS("alarm")
public class AlarmDefaulConfigServiceImpl extends BaseServiceImpl<AlarmDefaulConfigMapper, AlarmDefaultConfigEntity> implements AlarmDefaulConfigService {
}

55
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java

@ -3,12 +3,14 @@ package com.hnac.hzims.scheduled.service.alarm.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.business.interruption.constants.InterruptionConstants; import com.hnac.hzims.business.interruption.constants.InterruptionConstants;
import com.hnac.hzims.business.interruption.entity.InterruptionEntity; import com.hnac.hzims.business.interruption.entity.InterruptionEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo; import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.alarm.AlarmDefaulConfigService;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.alarm.AlarmService; import com.hnac.hzims.scheduled.service.alarm.AlarmService;
import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzims.scheduled.service.operation.station.StationService;
@ -42,6 +44,8 @@ public class AlarmServiceImpl implements AlarmService {
private final AlarmQueryService alarmQueryService; private final AlarmQueryService alarmQueryService;
private final AlarmDefaulConfigService defaulConfigService;
private final InterruptionAlarmServiceImpl interruptionAlarmService; private final InterruptionAlarmServiceImpl interruptionAlarmService;
private final ISoeClient soeClient; private final ISoeClient soeClient;
@ -68,13 +72,20 @@ public class AlarmServiceImpl implements AlarmService {
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return; return;
} }
// 查询开关机默认告警配置
AlarmDefaultConfigEntity start = defaulConfigService.getOne(Wrappers.<AlarmDefaultConfigEntity>lambdaQuery()
.eq(AlarmDefaultConfigEntity::getSource,5)
.eq(AlarmDefaultConfigEntity::getAlarmChiledType,50)
);
AlarmDefaultConfigEntity stop = defaulConfigService.getOne(Wrappers.<AlarmDefaultConfigEntity>lambdaQuery()
.eq(AlarmDefaultConfigEntity::getSource,5)
.eq(AlarmDefaultConfigEntity::getAlarmChiledType,51)
);
// 获取站点设备实时数据 // 获取站点设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if(CollectionUtil.isEmpty(reals)){ if(CollectionUtil.isEmpty(reals)){
return; return;
} }
Map<String,Integer> refresh = new HashMap<>(); Map<String,Integer> refresh = new HashMap<>();
// 实时设备遍历 // 实时设备遍历
reals.forEach(real->{ reals.forEach(real->{
@ -96,24 +107,25 @@ public class AlarmServiceImpl implements AlarmService {
return; return;
} }
// 比对开机状态 // 比对开机状态
if(Math.abs(real.getActivePower()) > 0){ if(real.getActivePower() > 0){
if(startStopMap.get(real.getDeviceCode()) == 0){ if(startStopMap.get(real.getDeviceCode()) == 0){
refresh.put(real.getDeviceCode(),1); refresh.put(real.getDeviceCode(),1);
// 记录开机告警 // 记录开机告警
this.saveStartStopAlarm(station,real,1); this.saveStartStopAlarm(station,real,start,1);
}else{ }else{
refresh.put(real.getDeviceCode(),0); refresh.put(real.getDeviceCode(),1);
} }
}else{ }else{
if(startStopMap.get(real.getDeviceCode()) == 1){ if(startStopMap.get(real.getDeviceCode()) == 1){
refresh.put(real.getDeviceCode(),0); refresh.put(real.getDeviceCode(),0);
// 记录关机告警 // 记录关机告警
this.saveStartStopAlarm(station,real,0); this.saveStartStopAlarm(station,real,stop,0);
}else{ }else{
refresh.put(real.getDeviceCode(),1); refresh.put(real.getDeviceCode(),0);
} }
} }
}); });
log.error("start_stop_alarm : {}",refresh);
redisTemplate.opsForValue().set(start_stop_cache_final,refresh); redisTemplate.opsForValue().set(start_stop_cache_final,refresh);
} }
@ -132,7 +144,7 @@ public class AlarmServiceImpl implements AlarmService {
* @param real * @param real
* @param state * @param state
*/ */
private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real, int state) { private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real,AlarmDefaultConfigEntity defaultConfig, int state) {
AlarmEntity alarm = new AlarmEntity(); AlarmEntity alarm = new AlarmEntity();
alarm.setStationId(station.getCode()); alarm.setStationId(station.getCode());
alarm.setStationName(station.getName()); alarm.setStationName(station.getName());
@ -148,14 +160,25 @@ public class AlarmServiceImpl implements AlarmService {
} }
alarm.setStatus(0); alarm.setStatus(0);
alarm.setAlarmTime(new Date()); alarm.setAlarmTime(new Date());
alarm.setIsRightTabulation(0); if(ObjectUtil.isEmpty(defaultConfig)){
alarm.setIsShowAlert(1); alarm.setIsRightTabulation(0);
alarm.setIsSmallBell(1); alarm.setIsShowAlert(1);
alarm.setIsMask(1); alarm.setIsSmallBell(1);
alarm.setIsBroadcast(1); alarm.setIsMask(1);
alarm.setIsPlatformMessage(1); alarm.setIsBroadcast(1);
alarm.setIsShortMessage(1); alarm.setIsPlatformMessage(1);
alarm.setIsWxMessage(1); alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);
}else{
alarm.setIsRightTabulation(defaultConfig.getIsRightTabulation());
alarm.setIsShowAlert(defaultConfig.getIsShowAlert());
alarm.setIsSmallBell(defaultConfig.getIsSmallBell());
alarm.setIsMask(defaultConfig.getIsMask());
alarm.setIsBroadcast(defaultConfig.getIsBroadcast());
alarm.setIsPlatformMessage(defaultConfig.getIsPlatformMessage());
alarm.setIsShortMessage(defaultConfig.getIsShortMessage());
alarm.setIsWxMessage(defaultConfig.getIsWxMessage());
}
alarm.setTenantId(station.getTenantId()); alarm.setTenantId(station.getTenantId());
alarm.setCreateDept(station.getRefDept()); alarm.setCreateDept(station.getRefDept());
alarm.setCreateUser(station.getCreateUser()); alarm.setCreateUser(station.getCreateUser());

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -1379,8 +1379,12 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return * @return
*/ */
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; // 结束日期
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); Calendar calendar = Calendar.getInstance();
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
// 开始日期
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 24);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
@ -1388,10 +1392,11 @@ public class RealTargetServiceImpl implements RealTargetService {
return records.stream().map(record -> { return records.stream().map(record -> {
ActivePowerVo load = new ActivePowerVo(); ActivePowerVo load = new ActivePowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH"));
load.setHour(time.getHours()); load.setHour(time.getHours());
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0"));
return load; return load;
}).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList()); }).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList());
} }
/** /**

5
hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmDefaulConfigMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.alarm.AlarmDefaulConfigMapper">
</mapper>

46
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.maintenance.scheduled;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.operational.constants.FlowKeyConstants; import com.hnac.hzims.operational.constants.FlowKeyConstants;
import com.hnac.hzims.operational.constants.RedisKeyConstants; import com.hnac.hzims.operational.constants.RedisKeyConstants;
@ -61,6 +62,7 @@ public class MaintenanceTaskSchedule {
private final IFlowClient flowClient; private final IFlowClient flowClient;
private final IImsDutyMainService dutyMainService; private final IImsDutyMainService dutyMainService;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final IEmInfoClient emInfoClient;
@XxlJob(GENERATE_MAINTENANCE_TASK_SCHEDULE) @XxlJob(GENERATE_MAINTENANCE_TASK_SCHEDULE)
public ReturnT<String> execute(String param) throws Exception { public ReturnT<String> execute(String param) throws Exception {
@ -87,24 +89,24 @@ public class MaintenanceTaskSchedule {
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(plan,OperMaintenanceTaskEntity.class); OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(plan,OperMaintenanceTaskEntity.class);
taskEntity.setPlanId(plan.getId()); taskEntity.setPlanId(plan.getId());
taskEntity.setDisposer(Optional.ofNullable(plan.getDisposer()).map(String::valueOf).orElse(null)); taskEntity.setDisposer(Optional.ofNullable(plan.getDisposer()).map(String::valueOf).orElse(null));
taskEntity.setDisposerName(Optional.ofNullable(plan.getDisposer()).map(s -> String disposerName = Optional.ofNullable(plan.getDisposer()).map(UserCache::getUser).map(User::getName).orElse(null);
{ taskEntity.setDisposerName(disposerName);
User user = UserCache.getUser(s);
if (ObjectUtil.isNotEmpty(user)){
return user.getName();
}else {
return "";
}
}).filter(s->StringUtils.isNotBlank(s)).orElse(null));
LocalDateTime disposeTime = taskEntity.getDisposeTime().toInstant() LocalDateTime disposeTime = taskEntity.getDisposeTime().toInstant()
.atZone(ZoneId.systemDefault()).toLocalDateTime(); .atZone(ZoneId.systemDefault()).toLocalDateTime();
taskEntity.setPlanEndTime(disposeTime.plusHours(taskEntity.getHours())); taskEntity.setPlanEndTime(disposeTime.plusHours(taskEntity.getHours()));
if(StringUtil.isNotBlank(plan.getEmCode())){ if(StringUtil.isNotBlank(plan.getEmCode())){
String[] emCodeList = plan.getEmCode().split(","); List<String> emCodeList = Func.toStrList(",", plan.getEmCode());
for(String emCode : emCodeList){ emCodeList.stream().filter(StringUtil::isNotBlank).forEach(emCode -> {
EmInfoEntity emInfoEntity = emInfoClient.getByCode(emCode);
if(ObjectUtil.isEmpty(emInfoEntity)) {
log.error( "[{}]设备编号未查询到相关设备,生成任务失败!",emCode);
XxlJobLogger.log("[" + emCode + "]设备编号未查询到相关设备,生成任务失败!");
return;
}
taskEntity.setEmCode(emCode); taskEntity.setEmCode(emCode);
taskEntity.setEmName(emInfoEntity.getName());
this.createTask(taskEntity,plan); this.createTask(taskEntity,plan);
} });
} }
else { else {
this.createTask(taskEntity,plan); this.createTask(taskEntity,plan);
@ -139,7 +141,7 @@ public class MaintenanceTaskSchedule {
Instant instant = task.getDisposeTime().toInstant(); Instant instant = task.getDisposeTime().toInstant();
ZoneId zoneId = ZoneId.systemDefault(); ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime disposeTime = instant.atZone(zoneId).toLocalDateTime(); LocalDateTime disposeTime = instant.atZone(zoneId).toLocalDateTime();
task.setPlanEndTime(disposeTime.plusHours(task.getHours())); task.setPlanEndTime(disposeTime.plusHours(task.getPeriod()));
// 当模式为班次时 // 当模式为班次时
Integer maintenanceModel = plan.getMaintenanceModel(); Integer maintenanceModel = plan.getMaintenanceModel();
if(Func.isNotEmpty(maintenanceModel) && maintenanceModel == 2 ) { if(Func.isNotEmpty(maintenanceModel) && maintenanceModel == 2 ) {
@ -149,20 +151,11 @@ public class MaintenanceTaskSchedule {
ImsDutyMainEntity entity = dutyMainService.getOne(dutyQuery); ImsDutyMainEntity entity = dutyMainService.getOne(dutyQuery);
if (ObjectUtil.isNotEmpty(entity) && StringUtils.isNotEmpty(entity.getDutyPersonIds())) { if (ObjectUtil.isNotEmpty(entity) && StringUtils.isNotEmpty(entity.getDutyPersonIds())) {
String userId = entity.getDutyPersonIds(); String userId = entity.getDutyPersonIds();
String[] split = userId.split("\\^");
task.setDisposer(userId.replaceAll("\\^", ",")); task.setDisposer(userId.replaceAll("\\^", ","));
if (ArrayUtils.isNotEmpty(split)){ List<Long> userIdList = Func.toLongList("\\^", userId);
List<String> list = Arrays.asList(split); String disposerName = userIdList.stream().map(UserCache::getUser).filter(Func::isNotEmpty)
String disposerName= list.stream().map(s->{ .map(User::getName).filter(StringUtil::isNotBlank).collect(Collectors.joining(","));
User user = UserCache.getUser(Long.valueOf(s)); task.setDisposerName(Optional.ofNullable(disposerName).filter(StringUtil::isNotBlank).orElse(null));
if (ObjectUtil.isNotEmpty(user)){
return user.getName();}
return "";
}).filter(s->StringUtils.isNotBlank(s)).collect(Collectors.joining(","));
if (StringUtils.isNotBlank(disposerName)) {
task.setDisposerName(disposerName);
}
}
} }
else { else {
XxlJobLogger.log("ID为:"+plan.getId()+"的日常维护计划未获取到值班人员,未生成任务。"); XxlJobLogger.log("ID为:"+plan.getId()+"的日常维护计划未获取到值班人员,未生成任务。");
@ -205,5 +198,4 @@ public class MaintenanceTaskSchedule {
R<BladeFlow> flowResult = flowClient.startProcessInstanceContainNameByKey(FlowKeyConstants.MAINTENANCE_TASK_FLOW_KEY, String.valueOf(task.getId()), task.getTitle(), params); R<BladeFlow> flowResult = flowClient.startProcessInstanceContainNameByKey(FlowKeyConstants.MAINTENANCE_TASK_FLOW_KEY, String.valueOf(task.getId()), task.getTitle(), params);
return Optional.ofNullable(flowResult).filter(r -> r.isSuccess()).map(R::getData).map(BladeFlow::getProcessInstanceId).orElse(null); return Optional.ofNullable(flowResult).filter(r -> r.isSuccess()).map(R::getData).map(BladeFlow::getProcessInstanceId).orElse(null);
} }
} }

8
hzims-service/operational/src/main/resources/db/1.0.0.sql

@ -789,7 +789,7 @@ CREATE TABLE IF NOT EXISTS `HZIMS_FLV_VIDEO_CONFIG` (
`ID` BIGINT(20) NOT NULL COMMENT '主键ID', `ID` BIGINT(20) NOT NULL COMMENT '主键ID',
`NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '视频源名称', `NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '视频源名称',
`TIME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '时间间隔', `TIME` VARCHAR(50) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '时间间隔',
`CONFIG_ENTITY` VARCHAR(1000) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '配置JSON', `CONFIG_ENTITY` TEXT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '配置JSON',
`TYPE` TINYINT(4) NULL DEFAULT 1 COMMENT '类型', `TYPE` TINYINT(4) NULL DEFAULT 1 COMMENT '类型',
`SAVE_PEOPLE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '保存人姓名', `SAVE_PEOPLE` VARCHAR(100) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '保存人姓名',
`TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID', `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID',
@ -800,9 +800,9 @@ CREATE TABLE IF NOT EXISTS `HZIMS_FLV_VIDEO_CONFIG` (
`IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除', `IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除',
`STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 ', `STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 ',
`CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建部门', `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建部门',
PRIMARY KEY (`ID`) USING BTREE, PRIMARY KEY (`ID`) USING BTREE
INDEX ```XCONFIG_ENTITY```(`CONFIG_ENTITY`) USING BTREE ) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; ALTER TABLE HZIMS_FLV_VIDEO_CONFIG ADD FULLTEXT(`CONFIG_ENTITY`);
-- ---------------------------- -- ----------------------------
-- TABLE STRUCTURE FOR HZIMS_FOCUS_ATTRIBUTE -- TABLE STRUCTURE FOR HZIMS_FOCUS_ATTRIBUTE

14
hzims-service/operational/src/main/resources/db/2.0.3.sql

@ -0,0 +1,14 @@
-- 设备维护库添加站点、设备名称
alter table `hzims_oper_maintenance_library` add column `station_code` varchar(20) comment '站点编号';
alter table `hzims_oper_maintenance_library` add column `station_name` varchar(100) comment '站点名称';
alter table `hzims_oper_maintenance_library` add column `em_name` varchar(255) comment '设备名称';
-- 日常维护计划添加站点、设备名称
alter table `hzims_oper_maintenance_plan` add column `station_name` varchar(100) comment '站点名称';
alter table `hzims_oper_maintenance_plan` add column `em_name` varchar(255) comment '设备名称';
-- 日常维护任务添加站点、设备名称
alter table `hzims_oper_maintenance_task` add column `station_code` varchar(20) comment '站点编号';
alter table `hzims_oper_maintenance_task` add column `station_name` varchar(100) comment '站点名称';
alter table `hzims_oper_maintenance_task` add column `em_name` varchar(255) comment '设备名称';
-- 日常维护计划、任务添加周期字段
alter table `hzims_oper_maintenance_plan` add column `period` int(11) comment '周期(单位:小时)';
alter table `hzims_oper_maintenance_task` add column `period` int(11) comment '周期(单位:小时)';
Loading…
Cancel
Save