Browse Source

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

zhongwei
haungxing 2 months ago
parent
commit
106a971354
  1. 49
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/constants/AccessRules.java
  2. 41
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java
  3. 13
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/KnowledgeDataService.java
  4. 9
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java
  5. 49
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/KnowledgeDataServiceImpl.java
  6. 33
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java
  7. 69
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java
  8. 66
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java
  9. 33
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceAttrDTO.java
  10. 28
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceFuncDTO.java
  11. 36
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/KnowledgeData.java
  12. 42
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataInstructEntity.java
  13. 40
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataRecordEntity.java
  14. 8
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataInstructMapper.java
  15. 7
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataRecordMapper.java
  16. 4
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.java
  17. 19
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.xml
  18. 68
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java
  19. 65
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java
  20. 23
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/VideoTaskSchedule.java

49
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/constants/AccessRules.java

@ -0,0 +1,49 @@
package com.hnac.gglm.bigmodel.business.constants;
import lombok.Getter;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Author: ypj
* @Date: 2024/9/20 22:39
*/
@Getter
public enum AccessRules {
MOST_EARLY("0", "最早值"),
LARGEST("1", "最大值"),
SMALLEST("2", "最小值"),
AVERAGE("3", "平均值"),
SUM("4", "累计值/和值"),
CHANGE("5", "变化值/差值"),
LAST("6", "最新值/最后值");
private final String code;
private final String desc;
private static final Map<String, AccessRules> map = new ConcurrentHashMap<>();
static {
for (AccessRules accessRules : AccessRules.values()) {
map.put(accessRules.code, accessRules);
}
}
AccessRules(String code, String desc) {
this.code = code;
this.desc = desc;
}
public static AccessRules getByCode(String code) {
return map.get(code);
}
public static String getDescByCode(String code) {
AccessRules rule = getByCode(code);
if (null != rule) {
return rule.getDesc();
}
return null;
}
}

41
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java

@ -1,12 +1,17 @@
package com.hnac.gglm.bigmodel.business.controller; package com.hnac.gglm.bigmodel.business.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.gglm.bigmodel.business.service.KnowledgeDataService;
import com.hnac.gglm.bigmodel.business.service.VectorDataService; import com.hnac.gglm.bigmodel.business.service.VectorDataService;
import com.hnac.gglm.bigmodel.business.vo.DeviceModelData; import com.hnac.gglm.bigmodel.business.vo.DeviceModelData;
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData;
import com.hnac.hzinfo.api.annotation.ApiInterface; import com.hnac.hzinfo.api.annotation.ApiInterface;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceFuncInfoDTO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -30,7 +35,7 @@ import java.util.List;
public class VectorDataController { public class VectorDataController {
private final VectorDataService vectorDataService; private final VectorDataService vectorDataService;
private final KnowledgeDataService knowledgeDataService;
@GetMapping("/getModelAttributeData") @GetMapping("/getModelAttributeData")
@ApiOperation(value = "获取模型属性数据") @ApiOperation(value = "获取模型属性数据")
@ -63,4 +68,38 @@ public class VectorDataController {
public R<List<DeviceModelData>> getModelData() { public R<List<DeviceModelData>> getModelData() {
return R.data(vectorDataService.getModelData()); return R.data(vectorDataService.getModelData());
} }
@GetMapping("/getDeviceAttr")
@ApiOperation(value = "获取设备属性数据")
@ApiOperationSupport(order = 5)
@ApiInterface
public R<List<DeviceAttrInfoDTO>> getDeviceAttr() {
return R.data(vectorDataService.getDeviceAttr());
}
@GetMapping("/getDeviceFunc")
@ApiOperation(value = "获取设备功能数据")
@ApiOperationSupport(order = 6)
@ApiInterface
public R<List<DeviceFuncInfoDTO>> getDeviceFunc() {
return R.data(vectorDataService.getDeviceFunc());
}
@GetMapping("/listKnowledgeData")
@ApiOperation(value = "获取知识库数据")
@ApiOperationSupport(order = 7)
@ApiInterface
public R<List<KnowledgeData>> listKnowledgeData() {
return R.data(knowledgeDataService.listKnowledgeData());
}
@GetMapping("/listCanvas")
@ApiOperation(value = "获取画布数据")
@ApiOperationSupport(order = 8)
@ApiInterface
public R<List<CanvasInfo>> listCanvas() {
return R.data(vectorDataService.getScadaCanvas());
}
} }

13
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/KnowledgeDataService.java

@ -0,0 +1,13 @@
package com.hnac.gglm.bigmodel.business.service;
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/20 15:04
*/
public interface KnowledgeDataService {
List<KnowledgeData> listKnowledgeData();
}

9
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java

@ -1,9 +1,12 @@
package com.hnac.gglm.bigmodel.business.service; package com.hnac.gglm.bigmodel.business.service;
import com.hnac.gglm.bigmodel.business.vo.DeviceModelData; import com.hnac.gglm.bigmodel.business.vo.DeviceModelData;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceFuncInfoDTO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasInfo;
import java.util.List; import java.util.List;
@ -20,4 +23,10 @@ public interface VectorDataService {
List<ModelEventVO> getModelEventData(); List<ModelEventVO> getModelEventData();
List<DeviceModelData> getModelData(); List<DeviceModelData> getModelData();
List<DeviceAttrInfoDTO> getDeviceAttr();
List<DeviceFuncInfoDTO> getDeviceFunc();
List<CanvasInfo> getScadaCanvas();
} }

49
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/KnowledgeDataServiceImpl.java

@ -0,0 +1,49 @@
package com.hnac.gglm.bigmodel.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hnac.gglm.bigmodel.business.service.KnowledgeDataService;
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData;
import com.hnac.gglm.bigmodel.maintenance.mapper.KnowledgeFileFragmentMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/20 15:04
*/
@Service
@Slf4j
@AllArgsConstructor
@DS("hznlm")
public class KnowledgeDataServiceImpl implements KnowledgeDataService {
KnowledgeFileFragmentMapper knowledgeFileFragmentMapper;
@Override
public List<KnowledgeData> listKnowledgeData() {
List<KnowledgeData> resourceList = knowledgeFileFragmentMapper.listKnowledgeData();
List<KnowledgeData> resultList = new ArrayList<>();
for (KnowledgeData item : resourceList) {
String question = item.getDocQs();
List<String> questionList = JSONObject.parseArray(question, String.class);
for (String q : questionList) {
KnowledgeData data = new KnowledgeData();
data.setDocId(item.getDocId());
data.setDocContent(item.getDocContent());
data.setDocPageIndex(item.getDocPageIndex());
data.setDocQs(q);
data.setArea(item.getArea());
data.setLevel(item.getLevel());
resultList.add(data);
}
}
return resultList;
}
}

33
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java

@ -1,11 +1,17 @@
package com.hnac.gglm.bigmodel.business.service.impl; package com.hnac.gglm.bigmodel.business.service.impl;
import com.hnac.gglm.bigmodel.business.constants.AccessRules;
import com.hnac.gglm.bigmodel.business.service.VectorDataService; import com.hnac.gglm.bigmodel.business.service.VectorDataService;
import com.hnac.gglm.bigmodel.business.vo.DeviceModelData; import com.hnac.gglm.bigmodel.business.vo.DeviceModelData;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceFuncInfoDTO;
import com.hnac.hzinfo.sdk.v5.model.ModelClient; import com.hnac.hzinfo.sdk.v5.model.ModelClient;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
import com.hnac.hzinfo.sdk.v5.scada.ScadaClient;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasInfo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -24,6 +30,8 @@ import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
public class VectorDataServiceImpl implements VectorDataService { public class VectorDataServiceImpl implements VectorDataService {
private final ModelClient modelClient; private final ModelClient modelClient;
private final DeviceClient deviceClient;
private final ScadaClient scadaClient;
@Override @Override
@ -61,4 +69,29 @@ public class VectorDataServiceImpl implements VectorDataService {
} }
return modelDataList; return modelDataList;
} }
@Override
public List<DeviceAttrInfoDTO> getDeviceAttr() {
List<DeviceAttrInfoDTO> list = deviceClient.listDeviceAttr().getData();
if (null != list && !list.isEmpty()) {
list.forEach(item -> {
item.setItemName(item.getProjectName() + " " + item.getDeviceName() + " " + item.getName());
String rule = AccessRules.getDescByCode(item.getRule());
if (null != rule) {
item.setRule(rule);
}
});
}
return list;
}
@Override
public List<DeviceFuncInfoDTO> getDeviceFunc() {
return deviceClient.listDeviceFunc().getData();
}
@Override
public List<CanvasInfo> getScadaCanvas() {
return scadaClient.listCanvas().getData();
}
} }

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

@ -0,0 +1,69 @@
package com.hnac.gglm.bigmodel.maintenance.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO;
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity;
import com.hnac.gglm.bigmodel.maintenance.service.DataInstructService;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzinfo.api.annotation.ApiInterface;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/dataInstruct")
@Api(value = "控制指令管理",tags = "控制指令管理")
@AllArgsConstructor
public class DataInstructController {
private DataInstructService dataInstructService;
@PostMapping("/save")
@ApiOperation("保存控制指令")
@ApiOperationSupport(order = 1)
public R save(@RequestBody @Valid DataInstructEntity req) {
return R.data(dataInstructService.save(req));
}
@PostMapping("/update")
@ApiOperation("编辑控制指令")
@ApiOperationSupport(order = 2)
public R update(@RequestBody DataInstructEntity req) {
return R.data(dataInstructService.updateById(req));
}
@GetMapping("/listPage")
@ApiOperation("控制指令列表查询")
@ApiOperationSupport(order = 3)
public R<IPage<DataInstructEntity>> listPage(Query query, DataInstructEntity req) {
return R.data(dataInstructService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda()));
}
@DeleteMapping("/removeByIds")
@ApiOperation("删除控制指令")
@ApiOperationSupport(order = 4)
public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) {
return R.status(dataInstructService.removeByIds(Func.toLongList(",",ids)));
}
@GetMapping ("/getDataInstructList")
@ApiOperationSupport(order = 210)
@ApiOperation(value = "查询指令记录")
@ApiInterface
public R<List<DeviceFuncDTO>> getDataInstructList() {
return R.data(dataInstructService.getDataInstructList());
}
}

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

@ -0,0 +1,66 @@
package com.hnac.gglm.bigmodel.maintenance.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO;
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity;
import com.hnac.gglm.bigmodel.maintenance.service.DataRecordService;
import com.hnac.hzinfo.api.annotation.ApiInterface;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/dataRecord")
@Api(value = "数据记录管理",tags = "数据记录管理")
@AllArgsConstructor
public class DataRecordController {
private DataRecordService dataRecordService;
@PostMapping("/save")
@ApiOperation("保存数据记录信息")
@ApiOperationSupport(order = 1)
public R save(@RequestBody @Valid DataRecordEntity req) {
return R.data(dataRecordService.save(req));
}
@PostMapping("/update")
@ApiOperation("编辑数据记录信息")
@ApiOperationSupport(order = 2)
public R update(@RequestBody DataRecordEntity req) {
return R.data(dataRecordService.updateById(req));
}
@GetMapping("/listPage")
@ApiOperation("数据记录列表查询")
@ApiOperationSupport(order = 3)
public R<IPage<DataRecordEntity>> listPage(Query query, DataRecordEntity req) {
return R.data(dataRecordService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda()));
}
@DeleteMapping("/removeByIds")
@ApiOperation("删除数据记录")
@ApiOperationSupport(order = 4)
public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) {
return R.status(dataRecordService.removeByIds(Func.toLongList(",",ids)));
}
@GetMapping ("/getDataRecordList")
@ApiOperationSupport(order = 200)
@ApiOperation(value = "查询数据记录记录")
@ApiInterface
public R<List<DeviceAttrDTO>> getDataRecordList() {
return R.data(dataRecordService.getDataRecordList());
}
}

33
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceAttrDTO.java

@ -0,0 +1,33 @@
package com.hnac.gglm.bigmodel.maintenance.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DeviceAttrDTO {
@ApiModelProperty("item")
private String itemId;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("站点ID")
private String stationId;
@ApiModelProperty("遥控的设备名称")
private String deviceName;
@ApiModelProperty("遥控的设备ID")
private String deviceId;
@ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称")
private String itemName;
@ApiModelProperty("记录名称")
private String recordName;
@ApiModelProperty("取数规则")
private String rule;
}

28
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceFuncDTO.java

@ -0,0 +1,28 @@
package com.hnac.gglm.bigmodel.maintenance.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DeviceFuncDTO {
@ApiModelProperty("item")
private String itemId;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("站点ID")
private String stationId;
@ApiModelProperty("遥控的设备名称")
private String deviceName;
@ApiModelProperty("遥控的设备ID")
private String deviceId;
@ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称")
private String itemName;
}

36
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/KnowledgeData.java

@ -0,0 +1,36 @@
package com.hnac.gglm.bigmodel.maintenance.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: ypj
* @Date: 2024/9/20 15:07
*/
@Data
@ApiModel(value = "知识库文件分片信息", description = "知识库文件分片信息")
public class KnowledgeData {
@ApiModelProperty("文档ID")
@TableField("DOC_ID")
private Long docId;
@ApiModelProperty("文档问题")
@TableField("DOC_QS")
private String docQs;
@ApiModelProperty("文档内容")
@TableField("DOC_CONTENT")
private String docContent;
@ApiModelProperty("文档页码")
@TableField("DOC_PAGE_INDEX")
private Integer docPageIndex;
@ApiModelProperty("知识库领域")
private String area;
@ApiModelProperty("等级")
private Integer level;
}

42
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataInstructEntity.java

@ -0,0 +1,42 @@
package com.hnac.gglm.bigmodel.maintenance.entity;
import com.baomidou.mybatisplus.annotation.TableName;
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;
@Data
@EqualsAndHashCode
@TableName("gglm_data_instruct")
@ApiModel(value = "自定义控制指令表",description = "自定义控制指令表")
public class DataInstructEntity extends TenantEntity {
@ApiModelProperty("item")
private String itemId;
@ApiModelProperty("站点名称")
@QueryField(condition = SqlCondition.LIKE)
private String stationName;
@ApiModelProperty("站点ID")
private String stationId;
@ApiModelProperty("遥控的设备名称")
@QueryField(condition = SqlCondition.LIKE)
private String deviceName;
@ApiModelProperty("遥控的设备ID")
private String deviceId;
@ApiModelProperty("遥控名称(不包含站点)")
@QueryField(condition = SqlCondition.LIKE)
private String ykName;
@ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称")
private String itemName;
}

40
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataRecordEntity.java

@ -1,6 +1,12 @@
package com.hnac.gglm.bigmodel.maintenance.entity; package com.hnac.gglm.bigmodel.maintenance.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; 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 org.springblade.core.tenant.mp.TenantEntity;
/** /**
@ -8,10 +14,42 @@ import org.springblade.core.tenant.mp.TenantEntity;
* @Date: 2024/07/04 15:45 * @Date: 2024/07/04 15:45
*/ */
@Data @Data
@EqualsAndHashCode
@TableName("gglm_data_record")
@ApiModel(value = "自定义数据查询表",description = "自定义数据查询表")
public class DataRecordEntity extends TenantEntity { public class DataRecordEntity extends TenantEntity {
private String tableId;
@ApiModelProperty("item")
@QueryField(condition = SqlCondition.EQUAL)
private String itemId;
@ApiModelProperty("站点名称")
@QueryField(condition = SqlCondition.LIKE)
private String stationName;
@ApiModelProperty("站点ID")
private String stationId;
@ApiModelProperty("遥控的设备名称")
@QueryField(condition = SqlCondition.LIKE)
private String deviceName;
@ApiModelProperty("遥控的设备ID")
private String deviceId;
@ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称")
private String itemName;
@ApiModelProperty("记录名称")
@QueryField(condition = SqlCondition.LIKE)
private String recordName;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("取数规则")
private String rule;
} }

8
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataInstructMapper.java

@ -0,0 +1,8 @@
package com.hnac.gglm.bigmodel.maintenance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity;
public interface DataInstructMapper extends BaseMapper<DataInstructEntity> {
}

7
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataRecordMapper.java

@ -0,0 +1,7 @@
package com.hnac.gglm.bigmodel.maintenance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity;
public interface DataRecordMapper extends BaseMapper<DataRecordEntity> {
}

4
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.java

@ -1,11 +1,15 @@
package com.hnac.gglm.bigmodel.maintenance.mapper; package com.hnac.gglm.bigmodel.maintenance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData;
import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment; import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment;
import java.util.List;
/** /**
* @Author: ypj * @Author: ypj
* @Date: 2024/9/11 10:49 * @Date: 2024/9/11 10:49
*/ */
public interface KnowledgeFileFragmentMapper extends BaseMapper<KnowledgeFileFragment> { public interface KnowledgeFileFragmentMapper extends BaseMapper<KnowledgeFileFragment> {
List<KnowledgeData> listKnowledgeData();
} }

19
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/KnowledgeFileFragmentMapper.xml

@ -0,0 +1,19 @@
<?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.gglm.bigmodel.maintenance.mapper.KnowledgeFileFragmentMapper">
<resultMap id="BaseResultMap" type="com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment">
</resultMap>
<select id="listKnowledgeData" resultType="com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData">
SELECT
`segment`.DOC_CONTENT,
`segment`.DOC_ID,
`segment`.DOC_QS,
`segment`.DOC_PAGE_INDEX,
`info`.AUTHORITY_CLASS AS `level`,
`info`.DOMAIN AS `area`
FROM
knowledge_file_segment AS `segment`
LEFT JOIN knowledge_file_info `info` ON `segment`.DOC_ID = `info`.ID
</select>
</mapper>

68
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java

@ -0,0 +1,68 @@
package com.hnac.gglm.bigmodel.maintenance.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hnac.gglm.bigmodel.business.service.VectorDataService;
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO;
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity;
import com.hnac.gglm.bigmodel.maintenance.mapper.DataInstructMapper;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceFuncInfoDTO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
@Service
@Slf4j
@AllArgsConstructor
public class DataInstructService extends BaseServiceImpl<DataInstructMapper, DataInstructEntity> {
private final VectorDataService vectorDataService;
public boolean save(DataInstructEntity entity) {
//对遥控名称判重
LambdaQueryWrapper<DataInstructEntity> queryWrapper = new QueryWrapper<DataInstructEntity>()
.lambda().eq(DataInstructEntity::getYkName, entity.getYkName());
Long count = baseMapper.selectCount(queryWrapper);
if (count > 0) {
return false;
}
//保存信息
return save(entity);
}
public boolean updateById(DataInstructEntity entity) {
//对遥控名称判重
LambdaQueryWrapper<DataInstructEntity> queryWrapper = new QueryWrapper<DataInstructEntity>()
.lambda().eq(DataInstructEntity::getItemName, entity.getItemName())
.ne(DataInstructEntity::getId, entity.getId());
Long count = baseMapper.selectCount(queryWrapper);
if (count > 0) {
return false;
}
//修改信息
return true;
}
public List<DeviceFuncDTO> getDataInstructList() {
List<DataInstructEntity> list = baseMapper.selectList(null);
List<DeviceFuncDTO> deviceFuncDTOS = BeanUtil.copyProperties(list, DeviceFuncDTO.class);
List<DeviceFuncInfoDTO> deviceFuncList = vectorDataService.getDeviceFunc();
for (DeviceFuncInfoDTO deviceFunc : deviceFuncList) {
DeviceFuncDTO deviceFuncDTO = new DeviceFuncDTO();
deviceFuncDTO.setDeviceId(deviceFunc.getDeviceId());
deviceFuncDTO.setDeviceName(deviceFunc.getDeviceName());
deviceFuncDTO.setItemId(deviceFunc.getSignage());
deviceFuncDTO.setItemName(deviceFunc.getItemName());
deviceFuncDTO.setStationName(deviceFunc.getProjectName());
deviceFuncDTO.setStationId(deviceFunc.getProjectId());
deviceFuncDTOS.add(deviceFuncDTO);
}
return deviceFuncDTOS;
}
}

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

@ -0,0 +1,65 @@
package com.hnac.gglm.bigmodel.maintenance.service;
import com.hnac.gglm.bigmodel.business.service.VectorDataService;
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO;
import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO;
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity;
import com.hnac.gglm.bigmodel.maintenance.mapper.DataRecordMapper;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
@AllArgsConstructor
public class DataRecordService extends BaseServiceImpl<DataRecordMapper, DataRecordEntity> {
private final VectorDataService vectorDataService;
public boolean save(DataRecordEntity entity) {
splicing(entity);
return save(entity);
}
public boolean updateById(DataRecordEntity entity) {
splicing(entity);
return updateById(entity);
}
/**
* //拼接itemName
* @param entity
*/
private void splicing(DataRecordEntity entity) {
String stationName = entity.getStationName() == null ? "" : entity.getStationName();
String deviceName = entity.getDeviceName() == null ? "" : entity.getDeviceName();
String recordName = entity.getRecordName() == null ? "" : entity.getRecordName();
entity.setItemName(new StringBuffer(stationName)
.append(" ").append(deviceName)
.append(" ").append(recordName).toString());
}
public List<DeviceAttrDTO> getDataRecordList() {
List<DataRecordEntity> list = baseMapper.selectList(null);
List<DeviceAttrDTO> deviceAttrDTOS = BeanUtil.copyProperties(list, DeviceAttrDTO.class);
List<DeviceAttrInfoDTO> deviceAttrList = vectorDataService.getDeviceAttr();
for (DeviceAttrInfoDTO deviceAttr : deviceAttrList) {
DeviceAttrDTO deviceAttrDTO = new DeviceAttrDTO();
deviceAttrDTO.setDeviceId(deviceAttr.getDeviceId());
deviceAttrDTO.setDeviceName(deviceAttr.getDeviceName());
deviceAttrDTO.setStationName(deviceAttr.getProjectName());
deviceAttrDTO.setStationId(deviceAttr.getProjectId());
deviceAttrDTO.setRecordName(deviceAttr.getName());
deviceAttrDTO.setItemId(deviceAttr.getSignage());
deviceAttrDTO.setRule(deviceAttr.getRule());
deviceAttrDTO.setItemName(deviceAttr.getItemName());
deviceAttrDTOS.add(deviceAttrDTO);
}
return deviceAttrDTOS;
}
}

23
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/VideoTaskSchedule.java

@ -172,7 +172,7 @@ public class VideoTaskSchedule {
record.setUpdateUser(task.getUpdateUser()); record.setUpdateUser(task.getUpdateUser());
record.setCurrentStatus("1"); record.setCurrentStatus("1");
CameraInfoEntity camera = this.getCameraByProIdAndConId(project.getProjectId(), content.getContentId()); CameraInfoEntity camera = this.getCameraByProIdAndConId(project.getProjectId(), content.getContentId());
log.info("【taskId:" + task.getId() + "】视频巡检任务执行,获取视频巡检结果,camera:" + Optional.of(camera).map(JsonUtil::toJson).orElse("null")); log.info("【taskId:" + task.getId() + "】视频巡检任务执行,获取视频巡检结果,camera:" + Optional.ofNullable(camera).map(JsonUtil::toJson).orElse("null"));
if (Func.isNotEmpty(camera)) { if (Func.isNotEmpty(camera)) {
// 获取计划时间段内视频的告警信息设置是否异常 // 获取计划时间段内视频的告警信息设置是否异常
if (Func.isNotEmpty(camera.getEmCode())) { if (Func.isNotEmpty(camera.getEmCode())) {
@ -182,12 +182,21 @@ public class VideoTaskSchedule {
} }
} }
String picUrl = null;
// 调用海康威视api实现手动截屏回传至fileUrl // 调用海康威视api实现手动截屏回传至fileUrl
if (Func.isNotEmpty(camera.getPointCode())) { if (Func.isNotEmpty(camera.getPointCode())) {
String picUrl = hikApiService.manualCapture(camera.getPointCode()); try {
picUrl = hikApiService.manualCapture(camera.getPointCode());
} catch (Exception e) {
log.error("get picture url fail", e);
}
}
if (Func.isNotEmpty(picUrl)) {
record.setFileUrl(picUrl); record.setFileUrl(picUrl);
record.setCurrentValue(picUrl); record.setCurrentValue(picUrl);
pictureHandle(picUrl, content.getContentId(), record, task); pictureHandle(picUrl, content.getContentId(), record, task);
} else {
record.setCurrentValue("获取视频地址失败");
} }
} }
return record; return record;
@ -250,7 +259,8 @@ public class VideoTaskSchedule {
} }
} catch (IOException e) { } catch (IOException e) {
log.error("获取截图文件失败", e); log.error("获取截图文件失败", e);
throw new HzServiceException("获取截图文件失败"); record.setCurrentValue("获取截图文件失败");
return;
} }
R<BladeFile> fileResponse = ossClient.putFileByNameAndTenantId("file", multipartFile, task.getTenantId()); R<BladeFile> fileResponse = ossClient.putFileByNameAndTenantId("file", multipartFile, task.getTenantId());
log.info("【taskId:{}}】视频巡检任务执行,上传minio结果,{}", task.getId(), Optional.ofNullable(fileResponse).map(JsonUtil::toJson).orElse("null")); log.info("【taskId:{}}】视频巡检任务执行,上传minio结果,{}", task.getId(), Optional.ofNullable(fileResponse).map(JsonUtil::toJson).orElse("null"));
@ -260,6 +270,7 @@ public class VideoTaskSchedule {
ContentEntity content = contentService.getById(contentId); ContentEntity content = contentService.getById(contentId);
if (StringUtil.isBlank(content.getMultiCheckTypeSon())) { if (StringUtil.isBlank(content.getMultiCheckTypeSon())) {
record.setCurrentValue("没有找到巡检内容");
return; return;
} }
@ -272,7 +283,9 @@ public class VideoTaskSchedule {
BigModelAnalysisResponseDTO analysisResponse = bigModelClient.analysis(analysisRequest); BigModelAnalysisResponseDTO analysisResponse = bigModelClient.analysis(analysisRequest);
log.info("【taskId:{}}】视频巡检任务执行,大模型分析结果,{}", task.getId(), Optional.ofNullable(analysisResponse).map(JsonUtil::toJson).orElse("null")); log.info("【taskId:{}}】视频巡检任务执行,大模型分析结果,{}", task.getId(), Optional.ofNullable(analysisResponse).map(JsonUtil::toJson).orElse("null"));
if (!analysisResponse.getSuccess() || CollectionUtil.isEmpty(analysisResponse.getData())) { if (!analysisResponse.getSuccess() || CollectionUtil.isEmpty(analysisResponse.getData())) {
throw new HzServiceException("大模型识别失败"); record.setCurrentValue("大模型分析失败");
log.error("【taskId:{}}】,返回消息 : {}" , task.getId(),Optional.ofNullable(analysisResponse).map(JsonUtil::toJson).orElse("null"));
return;
} }
List<BigModelAnalysisResponseDTO.BigModelAnalysisResult> results = analysisResponse.getData(); List<BigModelAnalysisResponseDTO.BigModelAnalysisResult> results = analysisResponse.getData();
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
@ -314,7 +327,7 @@ public class VideoTaskSchedule {
messageDTO.setContent(textBuilder.toString()); messageDTO.setContent(textBuilder.toString());
R booleanR = messageClient.sendAppAndWsMsgByUsers(messageDTO); R booleanR = messageClient.sendAppAndWsMsgByUsers(messageDTO);
if (!booleanR.isSuccess()) { if (!booleanR.isSuccess()) {
throw new ServiceException("消息推送失败"); log.error("【taskId:{}}】,返回的消息为{}", task.getId(), booleanR.getMsg());
} }
log.info("推送成功~"); log.info("推送成功~");
} }

Loading…
Cancel
Save