Browse Source

fix:日常维护添加站点编号、名称、设备名称字段

fix:视频监控方案初始化脚本修改,json增加长度
zhongwei
haungxing 7 months ago
parent
commit
082cb8daa1
  1. 12
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceLibraryEntity.java
  2. 20
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenancePlanEntity.java
  3. 15
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceTaskEntity.java
  4. 46
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java
  5. 6
      hzims-service/operational/src/main/resources/db/1.0.0.sql
  6. 14
      hzims-service/operational/src/main/resources/db/2.0.3.sql

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 = "库编码,后台自动生成")
@QueryField(condition = SqlCondition.LIKE)
private String libraryCode;
@ApiModelProperty(value = "站点编号")
@QueryField(condition = SqlCondition.EQUAL)
private String stationCode;
@ApiModelProperty(value = "站点名称")
private String stationName;
/**
* 设备编码
*/
@ApiModelProperty(value = "设备编码,多个按,分隔")
@QueryField(condition = SqlCondition.EQUAL)
@QueryField(condition = SqlCondition.LIKE)
private String emCode;
@ApiModelProperty(value = "设备名称,多个按,分隔")
private String emName;
@ApiModelProperty(value = "维护模式 01=人员 02=值班")
@JsonSerialize(nullsUsing = NullSerializer.class)
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 lombok.Data;
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 java.util.Date;
@ -26,6 +28,16 @@ public class OperMaintenancePlanEntity extends TenantEntity {
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)
private Long messageTemplateId;
/**
* 站点code
*/
private String stationCode;
@ApiModelProperty(value = "周期(单位:小时)")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer period;
@ApiModelProperty(value = "创建用户名称")
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.EqualsAndHashCode;
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.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
@ -31,6 +33,16 @@ public class OperMaintenanceTaskEntity extends TenantEntity {
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 = "维护内容")
private String content;
@ApiModelProperty(value = "周期(单位:小时)")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer period;
/**
* 操作规范
*/

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.update.LambdaUpdateWrapper;
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.operational.constants.FlowKeyConstants;
import com.hnac.hzims.operational.constants.RedisKeyConstants;
@ -61,6 +62,7 @@ public class MaintenanceTaskSchedule {
private final IFlowClient flowClient;
private final IImsDutyMainService dutyMainService;
private final RedisTemplate redisTemplate;
private final IEmInfoClient emInfoClient;
@XxlJob(GENERATE_MAINTENANCE_TASK_SCHEDULE)
public ReturnT<String> execute(String param) throws Exception {
@ -87,24 +89,24 @@ public class MaintenanceTaskSchedule {
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(plan,OperMaintenanceTaskEntity.class);
taskEntity.setPlanId(plan.getId());
taskEntity.setDisposer(Optional.ofNullable(plan.getDisposer()).map(String::valueOf).orElse(null));
taskEntity.setDisposerName(Optional.ofNullable(plan.getDisposer()).map(s ->
{
User user = UserCache.getUser(s);
if (ObjectUtil.isNotEmpty(user)){
return user.getName();
}else {
return "";
}
}).filter(s->StringUtils.isNotBlank(s)).orElse(null));
String disposerName = Optional.ofNullable(plan.getDisposer()).map(UserCache::getUser).map(User::getName).orElse(null);
taskEntity.setDisposerName(disposerName);
LocalDateTime disposeTime = taskEntity.getDisposeTime().toInstant()
.atZone(ZoneId.systemDefault()).toLocalDateTime();
taskEntity.setPlanEndTime(disposeTime.plusHours(taskEntity.getHours()));
if(StringUtil.isNotBlank(plan.getEmCode())){
String[] emCodeList = plan.getEmCode().split(",");
for(String emCode : emCodeList){
List<String> emCodeList = Func.toStrList(",", plan.getEmCode());
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.setEmName(emInfoEntity.getName());
this.createTask(taskEntity,plan);
}
});
}
else {
this.createTask(taskEntity,plan);
@ -139,7 +141,7 @@ public class MaintenanceTaskSchedule {
Instant instant = task.getDisposeTime().toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime disposeTime = instant.atZone(zoneId).toLocalDateTime();
task.setPlanEndTime(disposeTime.plusHours(task.getHours()));
task.setPlanEndTime(disposeTime.plusHours(task.getPeriod()));
// 当模式为班次时
Integer maintenanceModel = plan.getMaintenanceModel();
if(Func.isNotEmpty(maintenanceModel) && maintenanceModel == 2 ) {
@ -149,20 +151,11 @@ public class MaintenanceTaskSchedule {
ImsDutyMainEntity entity = dutyMainService.getOne(dutyQuery);
if (ObjectUtil.isNotEmpty(entity) && StringUtils.isNotEmpty(entity.getDutyPersonIds())) {
String userId = entity.getDutyPersonIds();
String[] split = userId.split("\\^");
task.setDisposer(userId.replaceAll("\\^", ","));
if (ArrayUtils.isNotEmpty(split)){
List<String> list = Arrays.asList(split);
String disposerName= list.stream().map(s->{
User user = UserCache.getUser(Long.valueOf(s));
if (ObjectUtil.isNotEmpty(user)){
return user.getName();}
return "";
}).filter(s->StringUtils.isNotBlank(s)).collect(Collectors.joining(","));
if (StringUtils.isNotBlank(disposerName)) {
task.setDisposerName(disposerName);
}
}
List<Long> userIdList = Func.toLongList("\\^", userId);
String disposerName = userIdList.stream().map(UserCache::getUser).filter(Func::isNotEmpty)
.map(User::getName).filter(StringUtil::isNotBlank).collect(Collectors.joining(","));
task.setDisposerName(Optional.ofNullable(disposerName).filter(StringUtil::isNotBlank).orElse(null));
}
else {
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);
return Optional.ofNullable(flowResult).filter(r -> r.isSuccess()).map(R::getData).map(BladeFlow::getProcessInstanceId).orElse(null);
}
}

6
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',
`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 '时间间隔',
`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 '类型',
`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',
@ -800,9 +800,9 @@ CREATE TABLE IF NOT EXISTS `HZIMS_FLV_VIDEO_CONFIG` (
`IS_DELETED` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否删除',
`STATUS` TINYINT(4) NULL DEFAULT NULL COMMENT '状态 ',
`CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建部门',
PRIMARY KEY (`ID`) USING BTREE,
INDEX ```XCONFIG_ENTITY```(`CONFIG_ENTITY`) USING BTREE
PRIMARY KEY (`ID`) USING BTREE
) 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

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