diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/entity/RunTemplateEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/entity/RunTemplateEntity.java index 179e6d9..b2df40c 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/entity/RunTemplateEntity.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/entity/RunTemplateEntity.java @@ -1,5 +1,6 @@ package com.hnac.hzims.electric.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -27,4 +28,8 @@ public class RunTemplateEntity extends TenantEntity { @ApiModelProperty(value = "标识数据") private String signages; + + @ApiModelProperty(value = "是否为当前用户创建模板") + @TableField(exist = false) + private Boolean isUserCreate; } \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java index 32dce82..9052498 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java @@ -9,10 +9,13 @@ import com.hnac.hzims.electric.service.IRunTemplateService; import com.hnac.hzims.history.entity.HistoryTemplateEntity; import com.hnac.hzims.history.vo.HistoryTemplateParamVo; import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; +import java.util.stream.Collectors; + /** * @author ysj */ @@ -29,11 +32,17 @@ public class RunTemplateServiceImpl extends ServiceImpl pageCondition(HistoryTemplateParamVo params, IPage page) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); - wrapper.eq(RunTemplateEntity::getCreateUser, AuthUtil.getUserId()); wrapper.orderByDesc(RunTemplateEntity::getCreateTime); if(StringUtil.isNotBlank(params.getStationId())){ wrapper.eq(RunTemplateEntity::getStationId,params.getStationId()); } - return super.page(page,wrapper); + IPage ipages = super.page(page,wrapper); + if(CollectionUtil.isNotEmpty(ipages.getRecords())){ + Long userId = AuthUtil.getUserId(); + ipages.setRecords(ipages.getRecords().stream().peek(record->{ + record.setIsUserCreate(record.getCreateUser().equals(userId)); + }).collect(Collectors.toList())); + } + return ipages; } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java index 404e5ef..671afea 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java @@ -393,6 +393,6 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService { } } return entity; - }).collect(Collectors.toList())); + }).filter(o-> StringUtil.isNotBlank(o.getHistoryPoint()) && StringUtil.isNotBlank(o.getHistoryPointName())).collect(Collectors.toList())); } } diff --git a/hzims-service/equipment/src/main/resources/db/2.0.2.sql b/hzims-service/equipment/src/main/resources/db/2.0.2.sql new file mode 100644 index 0000000..f059a29 --- /dev/null +++ b/hzims-service/equipment/src/main/resources/db/2.0.2.sql @@ -0,0 +1,86 @@ +-- 历史曲线模板表 +CREATE TABLE IF NOT EXISTS `hzims_history_template` ( + `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `TEMPLATE_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板名称', + `STATION_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点编码', + `STATION_NAME` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点名称', + `FACTORY_ID1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '厂租点ID1', + `REAL_ID1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性I', + `REAL_NAME1` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性1名称', + `FACTORY_ID2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '厂租点ID2', + `REAL_ID2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性2', + `REAL_NAME2` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性2名称', + `FACTORY_ID3` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '厂租点ID3', + `REAL_ID3` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性3', + `REAL_NAME3` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性3名称', + `FACTORY_ID4` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '厂租点ID4', + `REAL_ID4` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性I', + `REAL_NAME4` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性1名称', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '租户ID', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门ID', + `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1833037921308483587 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +-- 历史曲线常用点位记录表 +CREATE TABLE IF NOT EXISTS `hzims_history_point_record` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `STATION_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点ID', + `STATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点名称', + `HISTORY_POINT` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '点位ID', + `HISTORY_POINT_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '点位名称', + `NUMBER` int(6) NULL DEFAULT NULL COMMENT '查询次数', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- 开关机时长单日统计表 +CREATE TABLE IF NOT EXISTS `hzims_em_start_stop_duration` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `STATION_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '站点编码', + `STATION_NAME` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点名称', + `DEVICE_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编号', + `DEVICE_NAME` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称', + `STR_DAY` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期: yyyy-MM-dd', + `START_DURATION` double(6, 2) NULL DEFAULT NULL COMMENT '开机时长', + `STOP_DURATION` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '停机时长', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '租户ID', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门ID', + `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- 运行报表模板表 +CREATE TABLE IF NOT EXISTS `hzims_run_template` ( + `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `TEMPLATE_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板名称', + `STATION_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点编码', + `STATION_NAME` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点名称', + `SIGNAGES` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性点json对象', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '租户ID', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门ID', + `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1839133347595427843 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; \ No newline at end of file diff --git a/hzims-service/operational/src/main/resources/db/3.0.4.sql b/hzims-service/operational/src/main/resources/db/3.0.4.sql new file mode 100644 index 0000000..f7f54cb --- /dev/null +++ b/hzims-service/operational/src/main/resources/db/3.0.4.sql @@ -0,0 +1,76 @@ +-- 用户实时画面记录表 +CREATE TABLE IF NOT EXISTS `hzims_station_frame_record` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `STATION_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点ID', + `STATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点名称', + `FRAME_ID` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实时画面ID', + `FRAME_NAME` varchar(516) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实时画面名称', + `FRAME_ADDRESS` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实时画面地址', + `TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点类型: 区分站点v3、v4', + `PIC_SOURCE` tinyint(2) NULL DEFAULT NULL COMMENT '画面来源: 0云组态 、1 hz3000v3.0、 2 hz3000v4.0', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- 用户站点视频记录 +CREATE TABLE IF NOT EXISTS `hzims_station_video_record` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `STATION_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点ID', + `STATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点名称', + `VIDEO_IDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频保存配置ID,用逗号分割', + `VIDEO_NAMES` varchar(516) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频保存名称,用逗号分割', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- 用户站点视频轮播方案表 +CREATE TABLE IF NOT EXISTS `hzims_station_video_carousel` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `CAROUSEL_ID` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频轮播保存配置ID', + `CAROUSEL_NAME` varchar(516) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '视频轮播保存配置名称', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- 用户默认机构配置表 +CREATE TABLE IF NOT EXISTS `hzims_user_dept_config` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `DEPT_ID` bigint(20) NULL DEFAULT NULL COMMENT '机构ID', + `DEPT_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构名称', + `DEPT_CATEGORY` int(2) NULL DEFAULT NULL COMMENT '机构类型', + `STATION_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点编号', + `STATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '站点名称', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- 站点表增加离线状态 +ALTER TABLE `hzims_operation`.`hzims_station` ADD COLUMN `ON_LINE` tinyint(1) UNSIGNED ZEROFILL NULL DEFAULT 0 COMMENT '站点在线状态 0-在线 1-离线' AFTER `DISCHARGE`;