Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
haungxing 2 months ago
parent
commit
636ebb3e0e
  1. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/entity/RunTemplateEntity.java
  2. 13
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java
  3. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java
  4. 86
      hzims-service/equipment/src/main/resources/db/2.0.2.sql
  5. 20
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java
  6. 17
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java
  7. 3
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java
  8. 7
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java
  9. 3
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java
  10. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java
  11. 17
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java
  12. 1
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java
  13. 34
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java
  14. 13
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java
  15. 76
      hzims-service/operational/src/main/resources/db/3.0.4.sql

5
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; package com.hnac.hzims.electric.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -27,4 +28,8 @@ public class RunTemplateEntity extends TenantEntity {
@ApiModelProperty(value = "标识数据") @ApiModelProperty(value = "标识数据")
private String signages; private String signages;
@ApiModelProperty(value = "是否为当前用户创建模板")
@TableField(exist = false)
private Boolean isUserCreate;
} }

13
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.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.vo.HistoryTemplateParamVo; import com.hnac.hzims.history.vo.HistoryTemplateParamVo;
import org.springblade.core.secure.utils.AuthUtil; 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.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.stream.Collectors;
/** /**
* @author ysj * @author ysj
*/ */
@ -29,11 +32,17 @@ public class RunTemplateServiceImpl extends ServiceImpl<RunTemplateMapper, RunTe
@Override @Override
public IPage<RunTemplateEntity> pageCondition(HistoryTemplateParamVo params, IPage<RunTemplateEntity> page) { public IPage<RunTemplateEntity> pageCondition(HistoryTemplateParamVo params, IPage<RunTemplateEntity> page) {
LambdaQueryWrapper<RunTemplateEntity> wrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<RunTemplateEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(RunTemplateEntity::getCreateUser, AuthUtil.getUserId());
wrapper.orderByDesc(RunTemplateEntity::getCreateTime); wrapper.orderByDesc(RunTemplateEntity::getCreateTime);
if(StringUtil.isNotBlank(params.getStationId())){ if(StringUtil.isNotBlank(params.getStationId())){
wrapper.eq(RunTemplateEntity::getStationId,params.getStationId()); wrapper.eq(RunTemplateEntity::getStationId,params.getStationId());
} }
return super.page(page,wrapper); IPage<RunTemplateEntity> 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;
} }
} }

2
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; return entity;
}).collect(Collectors.toList())); }).filter(o-> StringUtil.isNotBlank(o.getHistoryPoint()) && StringUtil.isNotBlank(o.getHistoryPointName())).collect(Collectors.toList()));
} }
} }

86
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;

20
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 lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; 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.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/** /**
* @Author: ypj * @Author: ypj
* @Date: 2024/9/9 10:37 * @Date: 2024/9/9 10:37
@ -40,7 +45,11 @@ public class AgentLogController {
@ApiOperation(value = "查看详情") @ApiOperation(value = "查看详情")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R<AgentLogEntity> detail(@RequestParam @ApiParam("主键ID") Long id) { public R<AgentLogEntity> 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") @PostMapping("/save")
@ -77,4 +86,13 @@ public class AgentLogController {
public R label(@RequestBody LabelRequest req) { public R label(@RequestBody LabelRequest req) {
return R.status(agentLogService.label(req)); return R.status(agentLogService.label(req));
} }
@GetMapping("/test")
public R test(@RequestHeader("Hzinfo-Auth") String token) {
BladeUser user = AuthUtil.getUser();
Map<String, Object> result = new HashMap<>();
result.put("user", user);
result.put("token", token);
return R.data(result);
}
} }

17
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java

@ -1,5 +1,6 @@
package com.hnac.gglm.bigmodel.maintenance.controller; package com.hnac.gglm.bigmodel.maintenance.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO; import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO;
@ -11,6 +12,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -47,7 +49,20 @@ public class DataInstructController {
@ApiOperation("控制指令列表查询") @ApiOperation("控制指令列表查询")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
public R<IPage<DataInstructEntity>> listPage(Query query, DataInstructEntity req) { public R<IPage<DataInstructEntity>> listPage(Query query, DataInstructEntity req) {
return R.data(dataInstructService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); QueryWrapper<DataInstructEntity> wrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getItemId())) {
wrapper.lambda().eq(DataInstructEntity::getItemId, req.getItemId());
}
if (StringUtils.isNotBlank(req.getStationId())) {
wrapper.lambda().eq(DataInstructEntity::getStationId, req.getStationId());
}
if (StringUtils.isNotBlank(req.getDeviceId())) {
wrapper.lambda().eq(DataInstructEntity::getDeviceId, req.getDeviceId());
}
if (StringUtils.isNotBlank(req.getYkName())) {
wrapper.lambda().like(DataInstructEntity::getYkName, req.getYkName());
}
return R.data(dataInstructService.page(Condition.getPage(query), wrapper));
} }
@DeleteMapping("/removeByIds") @DeleteMapping("/removeByIds")

3
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java

@ -1,8 +1,10 @@
package com.hnac.gglm.bigmodel.maintenance.controller; package com.hnac.gglm.bigmodel.maintenance.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO; import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO;
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity;
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity;
import com.hnac.gglm.bigmodel.maintenance.service.DataRecordService; import com.hnac.gglm.bigmodel.maintenance.service.DataRecordService;
import com.hnac.gglm.bigmodel.maintenance.vo.DataRecordVO; import com.hnac.gglm.bigmodel.maintenance.vo.DataRecordVO;
@ -11,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;

7
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") @TableField("label_content")
private String labelContent; private String labelContent;
@ApiModelProperty("标注人id")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("label_operator")
private String labelOperatorId;
@ApiModelProperty("标注人名称") @ApiModelProperty("标注人名称")
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
@TableField("label_operator") @TableField(exist = false)
private String labelOperator; private String labelOperator;
@ApiModelProperty("标注时间") @ApiModelProperty("标注时间")

3
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; package com.hnac.gglm.bigmodel.maintenance.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity; import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity;
@ -7,5 +8,7 @@ import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity;
* @Author: ypj * @Author: ypj
* @Date: 2024/9/9 11:07 * @Date: 2024/9/9 11:07
*/ */
@DS("hznlm")
public interface AgentLogMapper extends BaseMapper<AgentLogEntity> { public interface AgentLogMapper extends BaseMapper<AgentLogEntity> {
} }

2
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<AgentLogEntity> {
Boolean label(LabelRequest req); Boolean label(LabelRequest req);
IPage<AgentLogEntity> listPage(IPage<AgentLogEntity> page, AgentLogEntity req); IPage<AgentLogEntity> listPage(IPage<AgentLogEntity> page, AgentLogEntity req);
String getUsername(String userIdStr);
} }

17
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java

@ -1,6 +1,7 @@
package com.hnac.gglm.bigmodel.maintenance.service; package com.hnac.gglm.bigmodel.maintenance.service;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -14,6 +15,7 @@ import com.hnac.gglm.bigmodel.maintenance.vo.DataRecordVO;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO; import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -46,7 +48,20 @@ public class DataRecordService extends BaseServiceImpl<DataRecordMapper, DataRec
} }
public IPage<DataRecordVO> page(Query query, DataRecordEntity req) { public IPage<DataRecordVO> page(Query query, DataRecordEntity req) {
IPage<DataRecordEntity> page = super.page(Condition.getPage(query), Condition.getQueryWrapper(req).lambda()); QueryWrapper<DataRecordEntity> wrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getItemId())) {
wrapper.lambda().eq(DataRecordEntity::getItemId, req.getItemId());
}
if (StringUtils.isNotBlank(req.getStationId())) {
wrapper.lambda().eq(DataRecordEntity::getStationId, req.getStationId());
}
if (StringUtils.isNotBlank(req.getDeviceId())) {
wrapper.lambda().eq(DataRecordEntity::getDeviceId, req.getDeviceId());
}
if (StringUtils.isNotBlank(req.getRecordName())) {
wrapper.lambda().like(DataRecordEntity::getRecordName, req.getRecordName());
}
IPage<DataRecordEntity> page = super.page(Condition.getPage(query),wrapper);
if (page.getSize() == 0) { if (page.getSize() == 0) {
return new Page<>(); return new Page<>();
} }

1
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java

@ -17,6 +17,7 @@ import java.util.List;
*/ */
public interface KnowledgeFileInfoService extends IService<KnowledgeFileInfo> { public interface KnowledgeFileInfoService extends IService<KnowledgeFileInfo> {
String SEGMENT_URL = "/kn/doc_segment"; String SEGMENT_URL = "/kn/doc_segment";
String VECTOR_DATABASE_NAME = "knowledge_data";
Boolean store(IdRequest req); Boolean store(IdRequest req);

34
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; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -13,8 +12,11 @@ import com.hnac.gglm.bigmodel.maintenance.vo.LabelRequest;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil; 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.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; 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 org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
@ -26,8 +28,8 @@ import java.util.Date;
@Service @Service
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
@DS("hznlm")
public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEntity> implements AgentLogService { public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEntity> implements AgentLogService {
private final IUserClient userClient;
@Override @Override
public Boolean BatchLabel(IdsRequest ids) { public Boolean BatchLabel(IdsRequest ids) {
@ -35,7 +37,7 @@ public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEnt
return this.update(Wrappers.<AgentLogEntity>lambdaUpdate() return this.update(Wrappers.<AgentLogEntity>lambdaUpdate()
.set(AgentLogEntity::getLabelStatus, 1) .set(AgentLogEntity::getLabelStatus, 1)
.set(AgentLogEntity::getLabelResult, 1) .set(AgentLogEntity::getLabelResult, 1)
.set(AgentLogEntity::getLabelOperator, AuthUtil.getUserName()) .set(AgentLogEntity::getLabelOperatorId, AuthUtil.getUserId())
.set(AgentLogEntity::getLabelTime, now) .set(AgentLogEntity::getLabelTime, now)
.set(AgentLogEntity::getUpdateTime, now) .set(AgentLogEntity::getUpdateTime, now)
.in(AgentLogEntity::getId, ids.getIds())); .in(AgentLogEntity::getId, ids.getIds()));
@ -51,7 +53,7 @@ public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEnt
.set(AgentLogEntity::getLabelStatus, 1) .set(AgentLogEntity::getLabelStatus, 1)
.set(AgentLogEntity::getLabelResult, labelResult) .set(AgentLogEntity::getLabelResult, labelResult)
.set(StringUtil.isNotBlank(req.getLabelContent()), AgentLogEntity::getLabelContent, req.getLabelContent()) .set(StringUtil.isNotBlank(req.getLabelContent()), AgentLogEntity::getLabelContent, req.getLabelContent())
.set(AgentLogEntity::getLabelOperator, AuthUtil.getUserName()) .set(AgentLogEntity::getLabelOperatorId, AuthUtil.getUserId())
.set(AgentLogEntity::getLabelTime, now) .set(AgentLogEntity::getLabelTime, now)
.set(AgentLogEntity::getUpdateTime, now) .set(AgentLogEntity::getUpdateTime, now)
.eq(AgentLogEntity::getId, req.getId())); .eq(AgentLogEntity::getId, req.getId()));
@ -70,7 +72,29 @@ public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEnt
.eq(ObjectUtil.isNotEmpty(req.getLabelStatus()), AgentLogEntity::getLabelStatus, req.getLabelStatus()) .eq(ObjectUtil.isNotEmpty(req.getLabelStatus()), AgentLogEntity::getLabelStatus, req.getLabelStatus())
.orderByAsc(AgentLogEntity::getCreateTime) .orderByAsc(AgentLogEntity::getCreateTime)
.orderByAsc(AgentLogEntity::getChatId); .orderByAsc(AgentLogEntity::getChatId);
return this.page(page, queryWrapper); IPage<AgentLogEntity> 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<User> userR = userClient.userInfoById(userId);
if (userR.isSuccess() && userR.getData() != null) {
userName = userR.getData().getName();
}
} catch (Exception ignore) {
}
}
return userName;
} }
} }

13
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.gglm.bigmodel.database.service.WeaviateService;
import com.hnac.gglm.bigmodel.maintenance.constants.StoreStatus; import com.hnac.gglm.bigmodel.maintenance.constants.StoreStatus;
import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment; import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment;
import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileInfo; import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileInfo;
@ -45,6 +46,7 @@ public class KnowledgeFileInfoServiceImpl extends ServiceImpl<KnowledgeFileInfoM
private final KnowledgeFileInfoMapper knowledgeFileInfoMapper; private final KnowledgeFileInfoMapper knowledgeFileInfoMapper;
private final KnowledgeFileFragmentService fileFragmentService; private final KnowledgeFileFragmentService fileFragmentService;
private final IOssClient ossClient; private final IOssClient ossClient;
private final WeaviateService weaviateService;
@Value("${gglm.url}") @Value("${gglm.url}")
private String interactionUrl; private String interactionUrl;
@ -119,7 +121,16 @@ public class KnowledgeFileInfoServiceImpl extends ServiceImpl<KnowledgeFileInfoM
public Boolean removeRecursive(List<Long> idsList) { public Boolean removeRecursive(List<Long> idsList) {
Boolean result = removeByIds(idsList); Boolean result = removeByIds(idsList);
if (result) { if (result) {
fileFragmentService.remove(Wrappers.<KnowledgeFileFragment>lambdaQuery().in(KnowledgeFileFragment::getDocId, idsList)); try {
fileFragmentService.remove(Wrappers.<KnowledgeFileFragment>lambdaQuery().in(KnowledgeFileFragment::getDocId, idsList));
for (Long id : idsList) {
Map<String, String> condition = new HashMap<>();
condition.put("doc_id", id.toString());
weaviateService.deleteCondition(VECTOR_DATABASE_NAME, condition);
}
} catch (Exception e) {
log.error("删除知识库文件文件出错", e);
}
} }
return result; return result;
} }

76
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`;
Loading…
Cancel
Save