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/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/service/impl/HznlmInteractiveServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/service/impl/HznlmInteractiveServiceImpl.java index 3677b0b..c712395 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/service/impl/HznlmInteractiveServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/service/impl/HznlmInteractiveServiceImpl.java @@ -17,8 +17,8 @@ import com.hnac.gglm.bigmodel.interactive.vo.AuthDataVO; import com.hnac.gglm.bigmodel.interactive.vo.ExtraVO; import com.hnac.gglm.bigmodel.interactive.vo.SessionContentVO; import com.hnac.gglm.bigmodel.manager.SessionRedisManager; -import groovy.util.logging.Slf4j; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; @@ -97,6 +97,7 @@ public class HznlmInteractiveServiceImpl implements IHznlmInteractiveService { } String levelAuth = ParamCache.getValue(ParamKeyConstants.LIBRARY_AUTH_LEVEL); result.put("levelAuth",Optional.ofNullable(levelAuth).map(Integer::valueOf).orElse(0)); + log.info("知识库鉴权:{}",result); return result; } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java index 04d3510..34ee1ec 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java @@ -13,10 +13,15 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; +import java.util.Map; + /** * @Author: ypj * @Date: 2024/9/9 10:37 @@ -40,7 +45,11 @@ public class AgentLogController { @ApiOperation(value = "查看详情") @ApiOperationSupport(order = 2) public R detail(@RequestParam @ApiParam("主键ID") Long id) { - return R.data(agentLogService.getById(id)); + AgentLogEntity result = agentLogService.getById(id); + if (result != null) { + result.setLabelOperator(agentLogService.getUsername(result.getLabelOperatorId())); + } + return R.data(result); } @PostMapping("/save") @@ -77,4 +86,13 @@ public class AgentLogController { public R label(@RequestBody LabelRequest req) { return R.status(agentLogService.label(req)); } + + @GetMapping("/test") + public R test(@RequestHeader("Hzinfo-Auth") String token) { + BladeUser user = AuthUtil.getUser(); + Map result = new HashMap<>(); + result.put("user", user); + result.put("token", token); + return R.data(result); + } } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java index 0df71b8..aa31bc1 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java @@ -82,9 +82,14 @@ public class AgentLogEntity extends TenantEntity implements Serializable { @TableField("label_content") private String labelContent; + @ApiModelProperty("标注人id") + @QueryField(condition = SqlCondition.EQUAL) + @TableField("label_operator") + private String labelOperatorId; + @ApiModelProperty("标注人名称") @QueryField(condition = SqlCondition.LIKE) - @TableField("label_operator") + @TableField(exist = false) private String labelOperator; @ApiModelProperty("标注时间") diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java index 7a1ede1..332a7de 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java @@ -1,5 +1,6 @@ package com.hnac.gglm.bigmodel.maintenance.mapper; +import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity; @@ -7,5 +8,7 @@ import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity; * @Author: ypj * @Date: 2024/9/9 11:07 */ + +@DS("hznlm") public interface AgentLogMapper extends BaseMapper { } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java index 3f9a059..e7dc769 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java @@ -16,4 +16,6 @@ public interface AgentLogService extends IService { Boolean label(LabelRequest req); IPage listPage(IPage page, AgentLogEntity req); + + String getUsername(String userIdStr); } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java index f12b37a..eb9049f 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java @@ -58,7 +58,7 @@ public class DataInstructService extends BaseServiceImpl list = baseMapper.selectList(null); List deviceFuncDTOS = BeanUtil.copyProperties(list, DeviceFuncDTO.class); if(Func.isNotEmpty(deviceFuncDTOS)) { - deviceFuncDTOS.forEach(deviceFuncDTO -> deviceFuncDTO.setType("业务")); + deviceFuncDTOS.forEach(deviceFuncDTO -> deviceFuncDTO.setType("数据中心")); result.addAll(deviceFuncDTOS); } List deviceFuncList = vectorDataService.getDeviceFunc(); diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java index 64b1848..cdb7a6f 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java @@ -1,6 +1,5 @@ package com.hnac.gglm.bigmodel.maintenance.service.impl; -import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -13,8 +12,11 @@ import com.hnac.gglm.bigmodel.maintenance.vo.LabelRequest; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import java.util.Date; @@ -26,8 +28,8 @@ import java.util.Date; @Service @Slf4j @AllArgsConstructor -@DS("hznlm") public class AgentLogServiceImpl extends ServiceImpl implements AgentLogService { + private final IUserClient userClient; @Override public Boolean BatchLabel(IdsRequest ids) { @@ -35,7 +37,7 @@ public class AgentLogServiceImpl extends ServiceImpllambdaUpdate() .set(AgentLogEntity::getLabelStatus, 1) .set(AgentLogEntity::getLabelResult, 1) - .set(AgentLogEntity::getLabelOperator, AuthUtil.getUserName()) + .set(AgentLogEntity::getLabelOperatorId, AuthUtil.getUserId()) .set(AgentLogEntity::getLabelTime, now) .set(AgentLogEntity::getUpdateTime, now) .in(AgentLogEntity::getId, ids.getIds())); @@ -51,7 +53,7 @@ public class AgentLogServiceImpl extends ServiceImpl pageResult = baseMapper.selectPage(page, queryWrapper); + pageResult.getRecords().forEach(item -> { + String userIdStr = item.getLabelOperatorId(); + String userName = getUsername(userIdStr); + item.setLabelOperator(userName == null ? userIdStr : userName); + }); + return pageResult; + } + + @Override + public String getUsername(String userIdStr) { + String userName = null; + if (null != userIdStr) { + try { + Long userId = Long.parseLong(userIdStr); + R userR = userClient.userInfoById(userId); + if (userR.isSuccess() && userR.getData() != null) { + userName = userR.getData().getName(); + } + } catch (Exception ignore) { + } + } + return userName; } } 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`;