Browse Source

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

zhongwei
yang_shj 2 months ago
parent
commit
e494257783
  1. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/BigModelConstants.java
  2. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/constants/MqttTopicConstants.java
  3. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/BigModelAnalysisRequestDTO.java
  4. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/BigModelAnalysisResponseDTO.java
  5. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/CanvasSyncDTO.java
  6. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/ControlSyncDTO.java
  7. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/SyncDTO.java
  8. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/VideoSyncDTO.java
  9. 32
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/WeaviateInsertDTO.java
  10. 32
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/WeaviateQueryDTO.java
  11. 8
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IBigModelAnalysisClient.java
  12. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/ICanvasSyncClient.java
  13. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IControlSyncClient.java
  14. 8
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IDataAnalyseClient.java
  15. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/ISyncClient.java
  16. 8
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IVideoSyncClient.java
  17. 45
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IWeaviatesClient.java
  18. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/wrapper/BaseSyncWrapper.java
  19. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/ControlDeviceAuthDTO.java
  20. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/PowerDataDTO.java
  21. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/RunReportAnalyseRequest.java
  22. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/RunReportDataAnalyseDTO.java
  23. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/RunTimeDataDTO.java
  24. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/SoeDataDTO.java
  25. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/feign/IAuthClient.java
  26. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/dto/ControlDTO.java
  27. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/dto/ControlDeviceDTO.java
  28. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/req/ModelFunctionReq.java
  29. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/AttrSelectionVO.java
  30. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/DataItemVO.java
  31. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/DataVO.java
  32. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/ExtraVO.java
  33. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/FaultSelectionVO.java
  34. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/RealDataVO.java
  35. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/RemoteSelectionVO.java
  36. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/ScadaSelectionVO.java
  37. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/SelectionVO.java
  38. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/StationSelectionVO.java
  39. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/VideoSelectionVO.java
  40. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/ControlEntity.java
  41. 3
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/FunctionEntity.java
  42. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/WeaviateEntity.java
  43. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/WhitelistEntity.java
  44. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/constants/ScheduledConstant.java
  45. 58
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultMatchVO.java
  46. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskClientFallback.java
  47. 13
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IOperAccessTaskClient.java
  48. 30
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/IDefectStatisticClient.java
  49. 4
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java
  50. 5
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java
  51. 4
      hzims-service/equipment/pom.xml
  52. 13
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  53. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java
  54. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml
  55. 90
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java
  56. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java
  57. 118
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  58. 40
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/DeviceLedgerVO.java
  59. 34
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/StationEmInfoVO.java
  60. 37
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpFaultMatchController.java
  61. 16
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpFaultMatchService.java
  62. 99
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFaultMatchServiceImpl.java
  63. 2
      hzims-service/gglm-big-model/pom.xml
  64. 17
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/GglmBigModelApplication.java
  65. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/constants/SyncTableEnum.java
  66. 8
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/feign/BigModelAnalysisClient.java
  67. 8
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/feign/DataAnalyseClient.java
  68. 10
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/feign/VideoSyncClient.java
  69. 37
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/feign/WeaviatesClient.java
  70. 13
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/service/SyncService.java
  71. 49
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/constants/AccessRules.java
  72. 10
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/consumer/VideoAddConsumer.java
  73. 8
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/consumer/VideoRemoveConsumer.java
  74. 6
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/DataSourceExecuteController.java
  75. 4
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/RemoteController.java
  76. 105
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java
  77. 6
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/feign/AuthClient.java
  78. 9
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/AuthenticationService.java
  79. 12
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/DataSourceService.java
  80. 8
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/HistoryDataService.java
  81. 13
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/KnowledgeDataService.java
  82. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/RemoteService.java
  83. 32
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java
  84. 49
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/KnowledgeDataServiceImpl.java
  85. 116
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java
  86. 161
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java
  87. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/SqlVO.java
  88. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/TableAuthVO.java
  89. 6
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/wrapper/CanvasSyncWrapper.java
  90. 22
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/configuration/BigModelInvokeApi.java
  91. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/configuration/ThreadPoolManager.java
  92. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/configuration/WeaviateConfigure.java
  93. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/configuration/WeaviateProperties.java
  94. 12
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/controller/WeaviateController.java
  95. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/dto/WeaviateSaveDTO.java
  96. 170
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/service/WeaviateService.java
  97. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/util/WeaviateUtil.java
  98. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/constants/DataAuthTypeEnum.java
  99. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/constants/DataMethodEnum.java
  100. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/constants/DateEnum.java
  101. Some files were not shown because too many files have changed in this diff Show More

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/BigModelConstants.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/BigModelConstants.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel; package com.hnac.gglm.bigmodel;
/** /**
* @Author: huangxing * @Author: huangxing
@ -7,7 +7,7 @@ package com.hnac.hzims.bigmodel;
public interface BigModelConstants { public interface BigModelConstants {
/**注册至NACOS服务名**/ /**注册至NACOS服务名**/
String APP_NAME = "hzims-big-model"; String APP_NAME = "gglm-big-model";
/**前端展示服务名**/ /**前端展示服务名**/
String MODULE_NAME = "大模型管理"; String MODULE_NAME = "大模型管理";

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/constants/MqttTopicConstants.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/constants/MqttTopicConstants.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.api.constants; package com.hnac.gglm.bigmodel.api.constants;
/** /**
* @Author: huangxing * @Author: huangxing

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/dto/BigModelAnalysisRequestDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/BigModelAnalysisRequestDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.api.dto; package com.hnac.gglm.bigmodel.api.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/dto/BigModelAnalysisResponseDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/BigModelAnalysisResponseDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.api.dto; package com.hnac.gglm.bigmodel.api.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/dto/CanvasSyncDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/CanvasSyncDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.api.dto; package com.hnac.gglm.bigmodel.api.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/dto/ControlSyncDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/ControlSyncDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.api.dto; package com.hnac.gglm.bigmodel.api.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/dto/SyncDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/SyncDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.api.dto; package com.hnac.gglm.bigmodel.api.dto;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/dto/VideoSyncDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/VideoSyncDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.api.dto; package com.hnac.gglm.bigmodel.api.dto;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;

32
hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/WeaviateInsertDTO.java

@ -0,0 +1,32 @@
package com.hnac.gglm.bigmodel.api.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @Author: huangxing
* @Date: 2024/09/18 19:50
* @Description: Weaviate新增数据对象
*/
@Data
public class WeaviateInsertDTO implements Serializable {
/**
* 实体列表
*/
private List entities;
/**
* 类名
*/
private String className;
/**
* 属性
*/
private Map<String,String> attrsMap;
}

32
hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/dto/WeaviateQueryDTO.java

@ -0,0 +1,32 @@
package com.hnac.gglm.bigmodel.api.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Map;
/**
* @Author: huangxing
* @Date: 2024/09/18 19:47
*/
@Data
@EqualsAndHashCode
public class WeaviateQueryDTO implements Serializable {
/**
* 返回结果字段
*/
private String resultFields;
/**
* 类名
*/
private String className;
/**
* 查询条件
*/
private Map<String,String> query;
}

8
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IBigModelAnalysisClient.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IBigModelAnalysisClient.java

@ -1,8 +1,8 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.gglm.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.api.dto.BigModelAnalysisRequestDTO; import com.hnac.gglm.bigmodel.api.dto.BigModelAnalysisRequestDTO;
import com.hnac.hzims.bigmodel.api.dto.BigModelAnalysisResponseDTO; import com.hnac.gglm.bigmodel.api.dto.BigModelAnalysisResponseDTO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/ICanvasSyncClient.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/ICanvasSyncClient.java

@ -1,6 +1,6 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.hzims.bigmodel.api.dto.CanvasSyncDTO; import com.hnac.gglm.bigmodel.api.dto.CanvasSyncDTO;
/** /**
* @Author: huangxing * @Author: huangxing

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IControlSyncClient.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IControlSyncClient.java

@ -1,6 +1,6 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.hzims.bigmodel.api.dto.ControlSyncDTO; import com.hnac.gglm.bigmodel.api.dto.ControlSyncDTO;
/** /**
* @Author: huangxing * @Author: huangxing

8
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IDataAnalyseClient.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IDataAnalyseClient.java

@ -1,8 +1,8 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.gglm.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.business.dto.RunReportAnalyseRequest; import com.hnac.gglm.bigmodel.business.dto.RunReportAnalyseRequest;
import com.hnac.hzims.bigmodel.business.dto.RunReportDataAnalyseDTO; import com.hnac.gglm.bigmodel.business.dto.RunReportDataAnalyseDTO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/ISyncClient.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/ISyncClient.java

@ -1,6 +1,6 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.hzims.bigmodel.api.dto.SyncDTO; import com.hnac.gglm.bigmodel.api.dto.SyncDTO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;

8
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IVideoSyncClient.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IVideoSyncClient.java

@ -1,8 +1,8 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.gglm.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.api.dto.SyncDTO; import com.hnac.gglm.bigmodel.api.dto.SyncDTO;
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

45
hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/feign/IWeaviatesClient.java

@ -0,0 +1,45 @@
package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.gglm.bigmodel.BigModelConstants;
import com.hnac.gglm.bigmodel.api.dto.WeaviateInsertDTO;
import com.hnac.gglm.bigmodel.api.dto.WeaviateQueryDTO;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* @Author: huangxing
* @Date: 2024/09/18 19:42
*/
@FeignClient(value = BigModelConstants.APP_NAME)
public interface IWeaviatesClient {
String PREFIX_API = "/feign/weaviate";
String SAVE_BATCH = PREFIX_API + "/saveBatch";
String DELETE_BY_IDS = PREFIX_API + "/deleteByIds";
String QUERY_LIST = PREFIX_API + "/queryList";
/**
* 删除
* @param ids ids,按逗号分隔
* @param className 类名
*/
@DeleteMapping(DELETE_BY_IDS)
void deleteByIds(@RequestParam("ids") String ids, @RequestParam("className") String className);
/**
* 查询
* @param query 查询参数
* @return 查询结果
*/
@PostMapping(QUERY_LIST)
R<Object> queryList(@RequestBody WeaviateQueryDTO query);
/**
* 批量保存
* @param insertDTO 插入数据
* @return 是否成功
*/
@PostMapping(SAVE_BATCH)
R saveBatch(@RequestBody WeaviateInsertDTO insertDTO);
}

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/wrapper/BaseSyncWrapper.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/api/wrapper/BaseSyncWrapper.java

@ -1,6 +1,6 @@
package com.hnac.hzims.bigmodel.api.wrapper; package com.hnac.gglm.bigmodel.api.wrapper;
import com.hnac.hzims.bigmodel.api.dto.SyncDTO; import com.hnac.gglm.bigmodel.api.dto.SyncDTO;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/business/dto/ControlDeviceAuthDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/ControlDeviceAuthDTO.java

@ -1,6 +1,6 @@
package com.hnac.hzims.bigmodel.business.dto; package com.hnac.gglm.bigmodel.business.dto;
import com.hnac.hzims.bigmodel.interactive.dto.ControlDeviceDTO; import com.hnac.gglm.bigmodel.interactive.dto.ControlDeviceDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/business/dto/PowerDataDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/PowerDataDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.dto; package com.hnac.gglm.bigmodel.business.dto;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/business/dto/RunReportAnalyseRequest.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/RunReportAnalyseRequest.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.dto; package com.hnac.gglm.bigmodel.business.dto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/business/dto/RunReportDataAnalyseDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/RunReportDataAnalyseDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.dto; package com.hnac.gglm.bigmodel.business.dto;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/business/dto/RunTimeDataDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/RunTimeDataDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.dto; package com.hnac.gglm.bigmodel.business.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/business/dto/SoeDataDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/dto/SoeDataDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.dto; package com.hnac.gglm.bigmodel.business.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/business/feign/IAuthClient.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/business/feign/IAuthClient.java

@ -1,6 +1,6 @@
package com.hnac.hzims.bigmodel.business.feign; package com.hnac.gglm.bigmodel.business.feign;
import com.hnac.hzims.bigmodel.business.dto.ControlDeviceAuthDTO; import com.hnac.gglm.bigmodel.business.dto.ControlDeviceAuthDTO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import java.util.List; import java.util.List;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/dto/ControlDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/dto/ControlDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.dto; package com.hnac.gglm.bigmodel.interactive.dto;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/dto/ControlDeviceDTO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/dto/ControlDeviceDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.dto; package com.hnac.gglm.bigmodel.interactive.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/req/ModelFunctionReq.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/req/ModelFunctionReq.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.req; package com.hnac.gglm.bigmodel.interactive.req;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AttrSelectionVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/AttrSelectionVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import lombok.Data; import lombok.Data;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/DataItemVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/DataVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/ExtraVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/FaultSelectionVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/RealDataVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteSelectionVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/RemoteSelectionVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import java.io.Serializable; import java.io.Serializable;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/ScadaSelectionVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SelectionVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/SelectionVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/StationSelectionVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/StationSelectionVO.java

@ -1,6 +1,6 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import com.hnac.hzims.bigmodel.interactive.vo.SelectionVO; import com.hnac.gglm.bigmodel.interactive.vo.SelectionVO;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/VideoSelectionVO.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/interactive/vo/VideoSelectionVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.vo; package com.hnac.gglm.bigmodel.interactive.vo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/ControlEntity.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/ControlEntity.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.maintenance.entity; package com.hnac.gglm.bigmodel.maintenance.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.SqlCondition; import com.baomidou.mybatisplus.annotation.SqlCondition;

3
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/entity/FunctionEntity.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/FunctionEntity.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.entity; package com.hnac.gglm.bigmodel.maintenance.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -17,7 +17,6 @@ import javax.validation.constraints.Size;
*/ */
@Data @Data
@ApiModel(value = "大模型函数entity",description = "大模型函数entity") @ApiModel(value = "大模型函数entity",description = "大模型函数entity")
@TableName("HZIMS_FUNCTION")
public class FunctionEntity extends TenantEntity { public class FunctionEntity extends TenantEntity {
@ApiModelProperty("函数名称") @ApiModelProperty("函数名称")

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/database/entity/WeaviateEntity.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/WeaviateEntity.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.database.entity; package com.hnac.gglm.bigmodel.maintenance.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/entity/WhitelistEntity.java → hzims-service-api/big-model-api/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/WhitelistEntity.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.entity; package com.hnac.gglm.bigmodel.maintenance.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -11,7 +11,7 @@ import org.springblade.core.tenant.mp.TenantEntity;
* @author ysj * @author ysj
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("hzims_whitelist") @TableName("gglm_whitelist")
@ApiModel(value = "白名单实体类",description = "大模型白名单") @ApiModel(value = "白名单实体类",description = "大模型白名单")
@Data @Data
public class WhitelistEntity extends TenantEntity { public class WhitelistEntity extends TenantEntity {

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/constants/ScheduledConstant.java

@ -28,4 +28,10 @@ public interface ScheduledConstant {
/**Fdp监测点与数据平台监测点绑定关系推送**/ /**Fdp监测点与数据平台监测点绑定关系推送**/
String MONITOR_BANDING_PUSH = "monitorBandingPush"; String MONITOR_BANDING_PUSH = "monitorBandingPush";
/**设备台账数据生成**/
String DEVICE_LEDGER_DATA_GENERATE = "deviceLedgerDataGenerate";
/**设备台账数据存入向量数据库表名**/
String DEVICE_LEDGER_CLASS_NAME = "Hzn_lm_deviceLedger_data";
} }

58
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultMatchVO.java

@ -0,0 +1,58 @@
package com.hnac.hzims.fdp.vo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.utils.Func;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/09/23 14:35
*/
@Data
@EqualsAndHashCode
public class FdpFaultMatchVO implements Serializable {
@JSONField(name = "item_id")
private String itemId;
@JSONField(name = "item_name")
private String itemName;
@JSONField(name = "ord")
private String ord;
@JSONField(name = "station_id")
private String stationId;
@JSONField(name = "station_name")
private String stationName;
@JSONField(name = "device_name")
private String deviceName;
@JSONField(name = "fault_name")
private String faultName;
@JSONField(name = "is_root")
private Integer isRoot;
private Integer display;
@JSONField(name = "device_fault_name")
private String deviceFaultName;
public void setItemName() {
this.itemId = String.format("%s %s", this.deviceName, this.faultName);
}
public void setDeviceFaultName() {
if(Func.isNotEmpty(this.ord)) {
this.deviceFaultName = String.format("%s %s", this.ord, this.faultName);
} else {
this.deviceFaultName = String.format("%s %s", this.deviceName, this.faultName);
}
}
}

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessTaskClientFallback.java

@ -5,6 +5,7 @@ import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -26,4 +27,9 @@ public class AccessTaskClientFallback implements IOperAccessTaskClient {
public R finishAccessTask(OperAccessTaskDTO accessTaskDTO) { public R finishAccessTask(OperAccessTaskDTO accessTaskDTO) {
return R.fail("修改失败!"); return R.fail("修改失败!");
} }
@Override
public R<List<String>> getAccessTaskOverview(String date, String emCode) {
return R.fail("获取检修任务概述失败!");
}
} }

13
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IOperAccessTaskClient.java

@ -5,9 +5,12 @@ import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -22,6 +25,7 @@ public interface IOperAccessTaskClient {
String UPDATE_BY_ID = API_PREFIX + "/updateById"; String UPDATE_BY_ID = API_PREFIX + "/updateById";
String DO_UPDATE_BY_ID = API_PREFIX + "/doUpdateById"; String DO_UPDATE_BY_ID = API_PREFIX + "/doUpdateById";
String FINISH_ACCESS_TASK = API_PREFIX + "/finishAccessTask"; String FINISH_ACCESS_TASK = API_PREFIX + "/finishAccessTask";
String GET_ACCESS_TASK_OVERVIEW = API_PREFIX + "/getAccessTaskOverview";
/** /**
* 更新检修任务状态接口 * 更新检修任务状态接口
* @param entity * @param entity
@ -46,4 +50,13 @@ public interface IOperAccessTaskClient {
@PostMapping(FINISH_ACCESS_TASK) @PostMapping(FINISH_ACCESS_TASK)
R finishAccessTask(@RequestBody OperAccessTaskDTO accessTaskDTO); R finishAccessTask(@RequestBody OperAccessTaskDTO accessTaskDTO);
/**
* 获取检修任务概览列表
* @param date 日期
* @param emCode 设备编号
* @return 检修任务概览列表
*/
@GetMapping(GET_ACCESS_TASK_OVERVIEW)
R<List<String>> getAccessTaskOverview(@RequestParam("date") String date, @RequestParam("emCode") String emCode);
} }

30
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/IDefectStatisticClient.java

@ -0,0 +1,30 @@
package com.hnac.hzims.operational.defect.feign;
import com.hnac.hzims.operational.OperationalConstants;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @Author: huangxing
* @Date: 2024/09/21 16:32
*/
@FeignClient(OperationalConstants.APP_NAME)
public interface IDefectStatisticClient {
String PREFIX_API = "/feign/defect_statistic";
String GET_DEFECT_OVERVIEW = PREFIX_API + "/getDefectOverview";
/**
* 获取缺陷概览
* @param date 日期
* @param emCode 设备编码
* @return 缺陷概览
*/
@GetMapping(GET_DEFECT_OVERVIEW)
R<List<String>> getDefectOverview(@RequestParam("date") String date, @RequestParam("emCode") String emCode);
}

4
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java

@ -38,6 +38,7 @@ public interface ITicketInfoClient {
String GET_OPERATE_TICKET_STATISTIC = API_PREFIX + "/getOperateTicketStatistic"; String GET_OPERATE_TICKET_STATISTIC = API_PREFIX + "/getOperateTicketStatistic";
String GET_OPERATE_WORK_STATISTIC = API_PREFIX + "/getOperateWorkStatistic"; String GET_OPERATE_WORK_STATISTIC = API_PREFIX + "/getOperateWorkStatistic";
String GET_WORK_TICKET_CHECK = API_PREFIX + "/getWorkTicketCheck"; String GET_WORK_TICKET_CHECK = API_PREFIX + "/getWorkTicketCheck";
String GET_WORK_TICKET_OVERVIEW = API_PREFIX + "/getWorkTicketOverview";
/** /**
* 根据ID更新票据状态为未完成 * 根据ID更新票据状态为未完成
@ -136,4 +137,7 @@ public interface ITicketInfoClient {
R<SafeCheckStatisticVO> getWorkTicketCheck(@RequestParam(value = "startDate") String startDate, R<SafeCheckStatisticVO> getWorkTicketCheck(@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "endDate") String endDate, @RequestParam(value = "endDate") String endDate,
@RequestParam(value = "dept") Long dept); @RequestParam(value = "dept") Long dept);
@GetMapping(GET_WORK_TICKET_OVERVIEW)
R<List<String>> getWorkTicketOverview(@RequestParam("date") String date, @RequestParam("emCode") String emCode);
} }

5
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java

@ -75,5 +75,10 @@ public class TicketInfoClientFallback implements ITicketInfoClient {
return R.data(new SafeCheckStatisticVO()); return R.data(new SafeCheckStatisticVO());
} }
@Override
public R<List<String>> getWorkTicketOverview(String date, String emCode) {
return R.fail("查询失败!");
}
} }

4
hzims-service/equipment/pom.xml

@ -77,6 +77,10 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId> <artifactId>commons-collections4</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>big-model-api</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

13
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java

@ -11,14 +11,12 @@ import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.equipment.dto.DeviceTreeDTO; import com.hnac.hzims.equipment.dto.DeviceTreeDTO;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.EmInfoAddVo; import com.hnac.hzims.equipment.vo.*;
import com.hnac.hzims.equipment.vo.EmInfoContentVO;
import com.hnac.hzims.equipment.vo.EmInfoTreeVO;
import com.hnac.hzims.equipment.vo.EmInfoVO;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.util.MemoryPagination; import com.hnac.hzims.util.MemoryPagination;
import com.hnac.hzinfo.api.annotation.ApiInterface;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -79,6 +77,13 @@ public class EmInfoController extends BladeController {
return R.data(pages); return R.data(pages);
} }
@GetMapping("/getStationEmList")
@ApiOperationSupport(order = 19)
@ApiInterface
public R<List<StationEmInfoVO>> getStationEmList() {
return R.data(em_infoService.getStationEmList());
}
/** /**
* 设备列表 分页 * 设备列表 分页
*/ */

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java

@ -57,4 +57,6 @@ public interface EmInfoMapper extends UserDataScopeBaseMapper<EmInfoEntity> {
List<SparePartVO> getSparePart(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime); List<SparePartVO> getSparePart(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<EmInfoTreeVO> getEmInfoTree(@Param("ew") Wrapper ew); List<EmInfoTreeVO> getEmInfoTree(@Param("ew") Wrapper ew);
List<EmInfoEntity> getAllEmInfo();
} }

3
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml

@ -174,4 +174,7 @@
</where> </where>
order by `create_time` desc order by `create_time` desc
</select> </select>
<select id="getAllEmInfo" resultType="com.hnac.hzims.equipment.entity.EmInfoEntity">
select * from `hzims_em_info` where `is_deleted` = 0
</select>
</mapper> </mapper>

90
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java

@ -0,0 +1,90 @@
package com.hnac.hzims.equipment.scheduled;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hnac.gglm.bigmodel.api.dto.WeaviateInsertDTO;
import com.hnac.gglm.bigmodel.api.dto.WeaviateQueryDTO;
import com.hnac.gglm.bigmodel.api.feign.IWeaviatesClient;
import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.DeviceLedgerVO;
import com.hnac.hzims.fdp.constants.ScheduledConstant;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @Author: huangxing
* @Date: 2024/09/18 18:33
* @Description: 设备台账定时任务
*/
@Component
@AllArgsConstructor
public class DeviceLedgerScheduledTask {
private final IEmInfoService emInfoService;
private final IWeaviatesClient weaviateClient;
@XxlJob(ScheduledConstant.DEVICE_LEDGER_DATA_GENERATE)
public ReturnT<String> execute(String param) throws Exception {
String jobParam = XxlJobHelper.getJobParam();
XxlJobHelper.log("传参为:" + jobParam);
JSONObject paramJson = JSONObject.parseObject(jobParam);
String emCode = Optional.ofNullable(paramJson).map(json -> json.getString("emCode")).orElse("");
String date = Optional.ofNullable(paramJson).map(json -> json.getString("date")).orElse(LocalDate.now().minusDays(1).format(DateUtil.DATE_FORMATTER));
List<DeviceLedgerVO> deviceLedgerList = emInfoService.getDeviceLedgerList(emCode, date);
// 向量库查询该设备的所有数据
WeaviateQueryDTO query = new WeaviateQueryDTO();
Map<String,String> queryMap = new HashMap<>();
if(Func.isNotEmpty(emCode)) {
queryMap.put("deviceCode",emCode);
}
queryMap.put("date",date);
query.setQuery(queryMap);
query.setClassName(ScheduledConstant.DEVICE_LEDGER_CLASS_NAME);
R<Object> searchResult = weaviateClient.queryList(query);
if(searchResult.isSuccess() && Func.isNotEmpty(searchResult.getData())) {
// 取出数据ID 删除数据
JSONObject queryJson = JSONObject.parseObject(JSON.toJSONString(searchResult.getData()));
JSONArray data = Optional.ofNullable(queryJson).map(json -> json.getJSONObject("Get"))
.map(json -> json.getJSONArray(ScheduledConstant.DEVICE_LEDGER_CLASS_NAME)).orElse(null);
if(Func.isNotEmpty(data)) {
List<String> ids = data.stream().map(item -> {
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(item));
return Optional.ofNullable(jsonObject)
.map(json -> json.getJSONObject("_additional"))
.map(json -> json.getString("id"))
.orElse("");
}).filter(Func::isNotEmpty).collect(Collectors.toList());
if(Func.isNotEmpty(ids)) {
weaviateClient.deleteByIds(ids.stream().collect(Collectors.joining(",")), ScheduledConstant.DEVICE_LEDGER_CLASS_NAME);
}
}
}
// 批量插入数据
WeaviateInsertDTO weaviateInsertDTO = new WeaviateInsertDTO();
weaviateInsertDTO.setEntities(deviceLedgerList);
weaviateInsertDTO.setClassName(ScheduledConstant.DEVICE_LEDGER_CLASS_NAME.replace("Hzn_lm_",""));
Map<String,String> attrMap = new HashMap<>();
attrMap.put("dataSummary","dataSummary");
weaviateInsertDTO.setAttrsMap(attrMap);
R saveResult = weaviateClient.saveBatch(weaviateInsertDTO);
if(!saveResult.isSuccess()) {
return new ReturnT<>("FAIL");
}
return new ReturnT<>("SUCCESS");
}
}

4
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java

@ -101,4 +101,8 @@ public interface IEmInfoService extends IService<EmInfoEntity> {
List<EmInfoTreeVO> getEmInfoTree(EmInfoEntity req); List<EmInfoTreeVO> getEmInfoTree(EmInfoEntity req);
List<RideDeviceVo> rideDevices(List<Long> deptIds); List<RideDeviceVo> rideDevices(List<Long> deptIds);
List<StationEmInfoVO> getStationEmList();
List<DeviceLedgerVO> getDeviceLedgerList(String emCode,String date);
} }

118
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -19,15 +19,19 @@ import com.hnac.hzims.equipment.service.*;
import com.hnac.hzims.equipment.vo.*; import com.hnac.hzims.equipment.vo.*;
import com.hnac.hzims.fdp.service.IFdpQuestionService; import com.hnac.hzims.fdp.service.IFdpQuestionService;
import com.hnac.hzims.operational.access.feign.IAccessMaterialClient; import com.hnac.hzims.operational.access.feign.IAccessMaterialClient;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO; import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import com.hnac.hzims.operational.defect.feign.IDefectStatisticClient;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.spare.feign.ISpareClient; import com.hnac.hzims.spare.feign.ISpareClient;
import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient;
import com.hnac.hzims.util.TableJsonUtils; import com.hnac.hzims.util.TableJsonUtils;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.exception.HzServiceException;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO;
import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO; import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
@ -124,6 +128,15 @@ public class EmInfoServiceImpl extends ServiceImpl<EmInfoMapper, EmInfoEntity> i
@Autowired @Autowired
private IFdpQuestionService questionService; private IFdpQuestionService questionService;
@Autowired
private IOperAccessTaskClient accessTaskClient;
@Autowired
private ITicketInfoClient ticketInfoClient;
@Autowired
private IDefectStatisticClient defectStatisticClient;
@Value("${hzims.equipment.emInfo.code}") @Value("${hzims.equipment.emInfo.code}")
public String deviceCodePath; public String deviceCodePath;
@ -996,4 +1009,109 @@ public class EmInfoServiceImpl extends ServiceImpl<EmInfoMapper, EmInfoEntity> i
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@Override
public List<StationEmInfoVO> getStationEmList() {
R<List<StationEntity>> stationsResult = stationClient.getListAll();
if(!stationsResult.isSuccess()) {
throw new HzServiceException("获取站点列表失败!");
}
List<StationEntity> stationList = stationsResult.getData();
List<EmInfoEntity> emInfoList = this.baseMapper.getAllEmInfo();
List<StationEmInfoVO> result = emInfoList.stream().map(emInfo -> {
Optional<StationEntity> stationOptional = stationList.stream().filter(station -> emInfo.getDepartment().equals(station.getRefDept())).findFirst();
if (stationOptional.isPresent()) {
StationEntity stationEntity = stationOptional.get();
StationEmInfoVO stationEmInfoVO = new StationEmInfoVO();
stationEmInfoVO.setEmId(emInfo.getId().toString());
stationEmInfoVO.setEmName(emInfo.getName());
stationEmInfoVO.setEmCode(emInfo.getNumber());
stationEmInfoVO.setStationCode(stationEntity.getCode());
stationEmInfoVO.setStationName(stationEntity.getName());
return stationEmInfoVO;
}
return null;
}).filter(Func::isNotEmpty).collect(Collectors.toList());
return result;
}
@Override
public List<DeviceLedgerVO> getDeviceLedgerList(String emCode, String date) {
// 若emCode为空,则查询出所有设备形成一个list
List<EmInfoEntity> emInfoList = new ArrayList<>();
if(Func.isNotEmpty(emCode)){
LambdaQueryWrapper<EmInfoEntity> queryWrapper = Wrappers.<EmInfoEntity>lambdaQuery().eq(EmInfoEntity::getNumber, emCode);
EmInfoEntity emInfoEntity = this.getOne(queryWrapper);
if(Func.isEmpty(emInfoEntity)) {
throw new HzServiceException("查询设备失败!");
}
emInfoList.add(emInfoEntity);
}else{
List<EmInfoEntity> emInfos = this.list();
if(Func.isEmpty(emInfos)) {
throw new HzServiceException("暂无设备数据");
}
emInfoList.addAll(emInfos);
}
// 获取站点列表
R<List<StationEntity>> stationsResult = stationClient.getListAll();
if(!stationsResult.isSuccess()) {
throw new HzServiceException("获取站点列表失败!");
}
return emInfoList.stream().flatMap(emInfo -> this.getDeviceLedgerListByEmCode(emInfo,date,stationsResult.getData()).stream().filter(Func::isNotEmpty)).collect(Collectors.toList());
}
/**
* 根据设备编号获取设备台账列表
* @param emInfo 设备实体类
* @param date 查询日期
* @return 台账列表
*/
private List<DeviceLedgerVO> getDeviceLedgerListByEmCode(EmInfoEntity emInfo, String date, List<StationEntity> stationList) {
List<DeviceLedgerVO> result = new ArrayList<>();
Optional<StationEntity> stationOptional = stationList.stream().filter(station -> emInfo.getDepartment().equals(station.getRefDept())).findFirst();
if(!stationOptional.isPresent()) {
return result;
}
DeviceLedgerVO deviceLedgerVO = new DeviceLedgerVO();
deviceLedgerVO.setDeviceCode(emInfo.getNumber());
deviceLedgerVO.setDeviceName(emInfo.getName());
deviceLedgerVO.setStationCode(stationOptional.get().getCode());
deviceLedgerVO.setStationName(stationOptional.get().getName());
deviceLedgerVO.setDate(date);
R<List<String>> accessTaskOverview = accessTaskClient.getAccessTaskOverview(date, emInfo.getNumber());
if(!accessTaskOverview.isSuccess()) {
throw new HzServiceException("获取设备台账失败!");
}
if(Func.isNotEmpty(accessTaskOverview.getData())) {
List<DeviceLedgerVO> deviceLedgerVOList = accessTaskOverview.getData().stream().map(overview -> {
DeviceLedgerVO deviceLedger = BeanUtil.copy(deviceLedgerVO, DeviceLedgerVO.class);
deviceLedger.setDataSummary(overview);
deviceLedger.setType("检修");
return deviceLedger;
}).collect(Collectors.toList());
result.addAll(deviceLedgerVOList);
}
R<List<String>> workTicketOverview = ticketInfoClient.getWorkTicketOverview(date, emInfo.getNumber());
if(Func.isNotEmpty(workTicketOverview.getData())) {
List<DeviceLedgerVO> deviceLedgerVOList = workTicketOverview.getData().stream().map(overview -> {
DeviceLedgerVO deviceLedger = BeanUtil.copy(deviceLedgerVO, DeviceLedgerVO.class);
deviceLedger.setDataSummary(overview);
deviceLedger.setType("工作票");
return deviceLedger;
}).collect(Collectors.toList());
result.addAll(deviceLedgerVOList);
}
R<List<String>> defectOverview = defectStatisticClient.getDefectOverview(date, emInfo.getNumber());
if(Func.isNotEmpty(defectOverview.getData())) {
List<DeviceLedgerVO> deviceLedgerVOList = defectOverview.getData().stream().map(overview -> {
DeviceLedgerVO deviceLedger = BeanUtil.copy(deviceLedgerVO, DeviceLedgerVO.class);
deviceLedger.setDataSummary(overview);
deviceLedger.setType("缺陷");
return deviceLedger;
}).collect(Collectors.toList());
result.addAll(deviceLedgerVOList);
}
return result;
}
} }

40
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/DeviceLedgerVO.java

@ -0,0 +1,40 @@
package com.hnac.hzims.equipment.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/09/18 18:45
*/
@Data
@ApiModel(value = "设备台账VO对象",description = "大模型使用")
@EqualsAndHashCode
public class DeviceLedgerVO implements Serializable {
@ApiModelProperty("站点编号")
private String stationCode;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("设备编号")
private String deviceCode;
@ApiModelProperty("设备名称")
private String deviceName;
@ApiModelProperty("日期")
private String date;
@ApiModelProperty("数据类型")
private String type;
@ApiModelProperty("数据概括")
private String dataSummary;
}

34
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/StationEmInfoVO.java

@ -0,0 +1,34 @@
package com.hnac.hzims.equipment.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/09/11 19:30
*/
@Data
@EqualsAndHashCode
@ApiModel(value = "站点-设备VO对象",description = "站点-设备VO对象")
public class StationEmInfoVO implements Serializable {
@ApiModelProperty("站点编号")
private String stationCode;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("设备ID")
private String emId;
@ApiModelProperty("设备编号")
private String emCode;
@ApiModelProperty("设备名称")
private String emName;
}

37
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpFaultMatchController.java

@ -0,0 +1,37 @@
package com.hnac.hzims.fdp.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.fdp.service.IFdpFaultMatchService;
import com.hnac.hzinfo.api.annotation.ApiInterface;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author: huangxing
* @Date: 2024/09/23 19:11
*/
@RestController
@AllArgsConstructor
@RequestMapping("/fdp/faultMatch")
@Api(value = "故障匹配数据接口管理",tags = "故障匹配数据接口管理")
public class FdpFaultMatchController {
private final IFdpFaultMatchService fdpFaultMatchService;
@GetMapping("/getFdpFaultMatchList")
@ApiOperation("获取故障匹配数据列表")
@ApiOperationSupport(order = 1)
@ApiInterface
public R<List<JSONObject>> getFdpFaultMatchList() {
return R.data(fdpFaultMatchService.getFdpFaultMatchList());
}
}

16
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpFaultMatchService.java

@ -0,0 +1,16 @@
package com.hnac.hzims.fdp.service;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.fdp.vo.FdpFaultMatchVO;
import java.util.List;
/**
* @Author: huangxing
* @Date: 2024/09/23 16:14
*/
public interface IFdpFaultMatchService {
List<JSONObject> getFdpFaultMatchList();
}

99
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFaultMatchServiceImpl.java

@ -0,0 +1,99 @@
package com.hnac.hzims.fdp.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.google.common.collect.Lists;
import com.hnac.hzims.fdp.service.IFdpFaultMatchService;
import com.hnac.hzims.fdp.util.HttpRequestUtil;
import com.hnac.hzims.fdp.vo.FdpFaultMatchVO;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @Author: huangxing
* @Date: 2024/09/23 16:15
*/
@Service
@RequiredArgsConstructor
public class FdpFaultMatchServiceImpl implements IFdpFaultMatchService {
@Value("${url.getStations}")
public String stationDataPath;
@Value("${url.getFaultAndMonitor}")
public String faultDataPath;
@Override
public List<JSONObject> getFdpFaultMatchList() {
List<FdpFaultMatchVO> matchVOList = Lists.newArrayList();
// 获取站点列表
String result = HttpRequestUtil.postCall(null, stationDataPath, "POST");
if (StringUtil.isNotBlank(result)) {
JSONObject resultObject = JSONObject.parseObject(result);
JSONArray dataArray = Optional.ofNullable(resultObject.getString("data")).map(JSONArray::parseArray).orElse(null);
if(Func.isNotEmpty(dataArray)) {
dataArray.forEach(jsonObject -> {
JSONObject station = JSONObject.parseObject(jsonObject.toString());
String stationId = station.getString("ID");
String stationName = station.getString("NAME");
List<FdpFaultMatchVO> faultMatchVOList = this.getFdpFaultListByStation(stationId,stationName);
if(Func.isNotEmpty(faultMatchVOList)) {
matchVOList.addAll(faultMatchVOList);
}
});
}
}
// 根据站点获取故障列表
return matchVOList.stream().map(vo -> JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue)).map(JSONObject::parseObject).collect(Collectors.toList());
}
/**
* 根据站点获取故障列表
* @param stationId 站点ID
* @param stationName 站点名称
* @return List<FdpFaultMatchVO>
*/
private List<FdpFaultMatchVO> getFdpFaultListByStation(String stationId, String stationName) {
if (StringUtil.isNotBlank(stationId)) {
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("stationId", stationId);
String result = HttpRequestUtil.postCall(paramMap, faultDataPath, "POST");
if (StringUtil.isNotBlank(result)) {
JSONObject resultObject = JSONObject.parseObject(result);
JSONArray dataArray = Optional.ofNullable(resultObject.getString("data"))
.map(JSONObject::parseObject)
.map(data -> data.getString("faults"))
.map(JSONArray::parseArray).orElse(null);
if (Func.isNotEmpty(dataArray)) {
return dataArray.stream().map(jsonObject -> {
FdpFaultMatchVO matchVO = new FdpFaultMatchVO();
JSONObject fault = JSONObject.parseObject(jsonObject.toString());
matchVO.setItemId(fault.getString("ID"));
matchVO.setOrd(fault.getString("ORD"));
matchVO.setStationId(stationId);
matchVO.setStationName(stationName);
matchVO.setFaultName(fault.getString("NAME"));
matchVO.setDeviceName(fault.getString("DEVICE_NAME"));
matchVO.setIsRoot(fault.getInteger("IS_ROOT"));
matchVO.setDisplay(fault.getInteger("DISPLAY"));
matchVO.setDeviceFaultName();
matchVO.setItemName();
return matchVO;
}).collect(Collectors.toList());
}
}
}
return null;
}
}

2
hzims-service/hzims-big-model/pom.xml → hzims-service/gglm-big-model/pom.xml

@ -7,7 +7,7 @@
<version>4.0.0-SNAPSHOT</version> <version>4.0.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>hzims-big-model</artifactId> <artifactId>gglm-big-model</artifactId>
<name>big-model</name> <name>big-model</name>
<packaging>jar</packaging> <packaging>jar</packaging>

17
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/GglmBigModelApplication.java

@ -1,26 +1,17 @@
package com.hnac.hzims.bigmodel; package com.hnac.gglm.bigmodel;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import javax.annotation.Resource;
@SpringBootApplication(scanBasePackages = {"org.springblade", "com.hnac.*"}) @SpringBootApplication(scanBasePackages = {"org.springblade", "com.hnac.*"})
@MapperScan(basePackages = {"com.hnac.hzinfo.**.mapper","com.hnac.hzims.**.mapper"}) @MapperScan(basePackages = {"com.hnac.hzinfo.**.mapper","com.hnac.gglm.**.mapper"})
@EnableFeignClients(basePackages = {"org.springblade", "com.hnac"}) @EnableFeignClients(basePackages = {"org.springblade", "com.hnac"})
public class HzimsBigModelApplication { public class GglmBigModelApplication {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(BigModelConstants.APP_NAME, HzimsBigModelApplication.class, args); BladeApplication.run(BigModelConstants.APP_NAME, GglmBigModelApplication.class, args);
} }
// @Override // @Override

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/api/constants/SyncTableEnum.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/constants/SyncTableEnum.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.api.constants; package com.hnac.gglm.bigmodel.api.constants;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/api/feign/BigModelAnalysisClient.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/feign/BigModelAnalysisClient.java

@ -1,8 +1,8 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.hzims.bigmodel.api.dto.BigModelAnalysisRequestDTO; import com.hnac.gglm.bigmodel.api.dto.BigModelAnalysisRequestDTO;
import com.hnac.hzims.bigmodel.api.dto.BigModelAnalysisResponseDTO; import com.hnac.gglm.bigmodel.api.dto.BigModelAnalysisResponseDTO;
import com.hnac.hzims.bigmodel.zhipuai.service.ZhipuAnalysisService; import com.hnac.gglm.bigmodel.zhipuai.service.ZhipuAnalysisService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/api/feign/DataAnalyseClient.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/feign/DataAnalyseClient.java

@ -1,9 +1,9 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.hnac.hzims.bigmodel.business.dto.RunReportAnalyseRequest; import com.hnac.gglm.bigmodel.business.dto.RunReportAnalyseRequest;
import com.hnac.hzims.bigmodel.business.dto.RunReportDataAnalyseDTO; import com.hnac.gglm.bigmodel.business.dto.RunReportDataAnalyseDTO;
import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; import com.hnac.gglm.bigmodel.interactive.service.IHznlmInvokeService;
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;

10
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/api/feign/VideoSyncClient.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/feign/VideoSyncClient.java

@ -1,9 +1,9 @@
package com.hnac.hzims.bigmodel.api.feign; package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.hzims.bigmodel.api.constants.SyncTableEnum; import com.hnac.gglm.bigmodel.api.constants.SyncTableEnum;
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO;
import com.hnac.hzims.bigmodel.api.service.SyncService; import com.hnac.gglm.bigmodel.api.service.SyncService;
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi; import com.hnac.gglm.bigmodel.configuration.BigModelInvokeApi;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
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;

37
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/feign/WeaviatesClient.java

@ -0,0 +1,37 @@
package com.hnac.gglm.bigmodel.api.feign;
import com.hnac.gglm.bigmodel.api.dto.WeaviateInsertDTO;
import com.hnac.gglm.bigmodel.api.dto.WeaviateQueryDTO;
import com.hnac.gglm.bigmodel.database.service.WeaviateService;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
/**
* @Author: huangxing
* @Date: 2024/09/19 19:06
*/
@RestController
@AllArgsConstructor
public class WeaviatesClient implements IWeaviatesClient {
private final WeaviateService weaviateService;
@Override
@DeleteMapping(DELETE_BY_IDS)
public void deleteByIds(@RequestParam("ids") String ids, @RequestParam("className") String className) {
weaviateService.delete(ids,className);
}
@Override
@PostMapping(QUERY_LIST)
public R<Object> queryList(@RequestBody WeaviateQueryDTO query) {
return R.data(weaviateService.query(query.getResultFields(), query.getClassName(), query.getQuery()));
}
@Override
@PostMapping(SAVE_BATCH)
public R saveBatch(@RequestBody WeaviateInsertDTO insertDTO) {
return R.status(weaviateService.saveBatch(insertDTO.getEntities(), insertDTO.getClassName(), insertDTO.getAttrsMap()));
}
}

13
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/api/service/SyncService.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/api/service/SyncService.java

@ -1,12 +1,11 @@
package com.hnac.hzims.bigmodel.api.service; package com.hnac.gglm.bigmodel.api.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.hnac.hzims.bigmodel.api.constants.SyncTableEnum; import com.hnac.gglm.bigmodel.api.constants.SyncTableEnum;
import com.hnac.hzims.bigmodel.api.dto.SyncDTO; import com.hnac.gglm.bigmodel.api.dto.SyncDTO;
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO;
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi; import com.hnac.gglm.bigmodel.configuration.BigModelInvokeApi;
import com.hnac.hzims.bigmodel.utils.RequestClientUtil; import com.hnac.gglm.bigmodel.utils.RequestClientUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;

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

10
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/consumer/VideoAddConsumer.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/consumer/VideoAddConsumer.java

@ -1,11 +1,11 @@
package com.hnac.hzims.bigmodel.business.consumer; package com.hnac.gglm.bigmodel.business.consumer;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO;
import com.hnac.hzims.bigmodel.api.feign.ISyncClient; import com.hnac.gglm.bigmodel.api.feign.ISyncClient;
import com.hnac.hzims.bigmodel.api.feign.VideoSyncClient; import com.hnac.gglm.bigmodel.api.feign.VideoSyncClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
@ -13,7 +13,7 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.mqtt.customer.IMqttReceive; import org.springblade.mqtt.customer.IMqttReceive;
import org.springblade.mqtt.customer.annotation.MqttReceive; import org.springblade.mqtt.customer.annotation.MqttReceive;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hnac.hzims.bigmodel.api.constants.MqttTopicConstants; import com.hnac.gglm.bigmodel.api.constants.MqttTopicConstants;
import java.util.List; import java.util.List;

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/consumer/VideoRemoveConsumer.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/consumer/VideoRemoveConsumer.java

@ -1,9 +1,9 @@
package com.hnac.hzims.bigmodel.business.consumer; package com.hnac.gglm.bigmodel.business.consumer;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.hnac.hzims.bigmodel.api.constants.MqttTopicConstants; import com.hnac.gglm.bigmodel.api.constants.MqttTopicConstants;
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO;
import com.hnac.hzims.bigmodel.api.feign.VideoSyncClient; import com.hnac.gglm.bigmodel.api.feign.VideoSyncClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/controller/DataSourceExecuteController.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/DataSourceExecuteController.java

@ -1,8 +1,8 @@
package com.hnac.hzims.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.hzims.bigmodel.business.service.DataSourceService; import com.hnac.gglm.bigmodel.business.service.DataSourceService;
import com.hnac.hzims.bigmodel.business.vo.SqlVO; import com.hnac.gglm.bigmodel.business.vo.SqlVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/controller/RemoteController.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/RemoteController.java

@ -1,7 +1,7 @@
package com.hnac.hzims.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.hzims.bigmodel.business.service.RemoteService; import com.hnac.gglm.bigmodel.business.service.RemoteService;
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;

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

@ -0,0 +1,105 @@
package com.hnac.gglm.bigmodel.business.controller;
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.vo.DeviceModelData;
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData;
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.ModelEventVO;
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.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/18 10:17
*/
@RestController
@RequestMapping("/data")
@Api(value = "向量数据", tags = "向量数据")
@AllArgsConstructor
@Slf4j
public class VectorDataController {
private final VectorDataService vectorDataService;
private final KnowledgeDataService knowledgeDataService;
@GetMapping("/getModelAttributeData")
@ApiOperation(value = "获取模型属性数据")
@ApiOperationSupport(order = 1)
@ApiInterface
public R<List<ModelAttrVO>> getModelAttributeData() {
return R.data(vectorDataService.getModelAttributeData());
}
@GetMapping("/getModelEventData")
@ApiOperation(value = "获取模型事件数据")
@ApiOperationSupport(order = 2)
@ApiInterface
public R<List<ModelEventVO>> getModelEventData() {
return R.data(vectorDataService.getModelEventData());
}
@GetMapping("/getModelFunctionData")
@ApiOperation(value = "获取模型功能数据")
@ApiOperationSupport(order = 3)
@ApiInterface
public R<List<ModelFuncVO>> getModelFunctionData() {
return R.data(vectorDataService.getModelFunctionData());
}
@GetMapping("/getModelData")
@ApiOperation(value = "获取模型数据")
@ApiOperationSupport(order = 4)
@ApiInterface
public R<List<DeviceModelData>> 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());
}
}

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/feign/AuthClient.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/feign/AuthClient.java

@ -1,7 +1,7 @@
package com.hnac.hzims.bigmodel.business.feign; package com.hnac.gglm.bigmodel.business.feign;
import com.hnac.hzims.bigmodel.business.dto.ControlDeviceAuthDTO; import com.hnac.gglm.bigmodel.business.dto.ControlDeviceAuthDTO;
import com.hnac.hzims.bigmodel.business.service.AuthenticationService; import com.hnac.gglm.bigmodel.business.service.AuthenticationService;
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;

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

@ -1,9 +1,9 @@
package com.hnac.hzims.bigmodel.business.service; package com.hnac.gglm.bigmodel.business.service;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.interactive.constants.ProjectRemoteTypeEnum; import com.hnac.gglm.bigmodel.interactive.constants.ProjectRemoteTypeEnum;
import com.hnac.hzims.bigmodel.interactive.vo.SessionContentVO; import com.hnac.gglm.bigmodel.interactive.vo.SessionContentVO;
import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants; import com.hnac.gglm.bigmodel.websocket.constants.RedisKeyConstants;
import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient; import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO; import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO;
@ -17,7 +17,6 @@ import org.springblade.system.dto.DeptStationDTO;
import org.springblade.system.entity.CtrlAuth; import org.springblade.system.entity.CtrlAuth;
import org.springblade.system.feign.IDeptClient; import org.springblade.system.feign.IDeptClient;
import org.springblade.system.feign.IRemoteClient; import org.springblade.system.feign.IRemoteClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;

12
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/DataSourceService.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/DataSourceService.java

@ -1,12 +1,13 @@
package com.hnac.hzims.bigmodel.business.service; package com.hnac.gglm.bigmodel.business.service;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.bigmodel.business.vo.SqlVO; import com.hnac.gglm.bigmodel.business.vo.SqlVO;
import com.hnac.hzims.bigmodel.business.vo.TableAuthVO; import com.hnac.gglm.bigmodel.business.vo.TableAuthVO;
import com.hnac.hzims.bigmodel.maintenance.entity.TablePropertyEntity; import com.hnac.gglm.bigmodel.maintenance.entity.TablePropertyEntity;
import com.hnac.hzims.bigmodel.maintenance.service.TablePropertyService; import com.hnac.gglm.bigmodel.maintenance.service.TablePropertyService;
import com.hnac.hzims.common.service.UserAuthDataService; import com.hnac.hzims.common.service.UserAuthDataService;
import com.hnac.hzinfo.exception.HzServiceException; import com.hnac.hzinfo.exception.HzServiceException;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -30,6 +31,7 @@ import java.util.regex.Pattern;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
@Slf4j @Slf4j
@DS("hznlm")
public class DataSourceService { public class DataSourceService {
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/HistoryDataService.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/HistoryDataService.java

@ -1,10 +1,10 @@
package com.hnac.hzims.bigmodel.business.service; package com.hnac.gglm.bigmodel.business.service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.interactive.constants.DataMethodEnum; import com.hnac.gglm.bigmodel.interactive.constants.DataMethodEnum;
import com.hnac.hzims.bigmodel.interactive.constants.DateEnum; import com.hnac.gglm.bigmodel.interactive.constants.DateEnum;
import com.hnac.hzims.bigmodel.interactive.vo.HistoryDataSearchVO; import com.hnac.gglm.bigmodel.interactive.vo.HistoryDataSearchVO;
import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.hnac.hzinfo.sdk.v5.device.dto.ReductionAttrDataDTO; import com.hnac.hzinfo.sdk.v5.device.dto.ReductionAttrDataDTO;

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();
}

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/RemoteService.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/RemoteService.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.service; package com.hnac.gglm.bigmodel.business.service;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

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

@ -0,0 +1,32 @@
package com.hnac.gglm.bigmodel.business.service;
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.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasInfo;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/16 18:16
*/
public interface VectorDataService {
List<ModelAttrVO> getModelAttributeData();
List<ModelFuncVO> getModelFunctionData();
List<ModelEventVO> getModelEventData();
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;
}
}

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

@ -0,0 +1,116 @@
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.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.vo.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import com.hnac.hzinfo.sdk.v5.project.vo.ProjectNameVo;
import com.hnac.hzinfo.sdk.v5.scada.ScadaClient;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author: ypj
* @Date: 2024/9/16 18:17
*/
@Service
@Slf4j
@AllArgsConstructor
public class VectorDataServiceImpl implements VectorDataService {
private final ModelClient modelClient;
private final DeviceClient deviceClient;
private final ScadaClient scadaClient;
private final ProjectClient projectClient;
@Override
public List<ModelAttrVO> getModelAttributeData() {
R<List<ModelAttrVO>> response = modelClient.listAttribute();
return response.getData();
}
@Override
public List<ModelFuncVO> getModelFunctionData() {
R<List<ModelFuncVO>> response = modelClient.listFunction();
return response.getData();
}
@Override
public List<ModelEventVO> getModelEventData() {
R<List<ModelEventVO>> response = modelClient.listEvent();
return response.getData();
}
@Override
public List<DeviceModelData> getModelData() {
List<ModelAttrVO> attrList = getModelAttributeData();
List<ModelFuncVO> funcList = getModelFunctionData();
List<ModelEventVO> eventList = getModelEventData();
List<DeviceModelData> modelDataList = new LinkedList<>();
if (null != attrList && !attrList.isEmpty()) {
modelDataList.addAll(attrList.stream().map(DeviceModelData::of).collect(Collectors.toList()));
}
if (null != funcList && !funcList.isEmpty()) {
modelDataList.addAll(funcList.stream().map(DeviceModelData::of).collect(Collectors.toList()));
}
if (null != eventList && !eventList.isEmpty()) {
modelDataList.addAll(eventList.stream().map(DeviceModelData::of).collect(Collectors.toList()));
}
return modelDataList;
}
@Override
public List<DeviceAttrInfoDTO> getDeviceAttr() {
List<DeviceAttrInfoDTO> list = deviceClient.listDeviceAttr().getData();
if (null != list && !list.isEmpty()) {
list.forEach(item -> {
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() {
List<CanvasInfo> list = scadaClient.listCanvas().getData();
if (null == list || list.isEmpty()) {
return new LinkedList<>();
}
List<String> projectIds = list.stream().map(CanvasInfo::getProjectId).collect(Collectors.toList());
List<ProjectNameVo> nameList = projectClient.getProjectNameList(projectIds).getData();
if (null == nameList || nameList.isEmpty()) {
return list;
}
Map<String, String> map = nameList.stream().collect(Collectors.toMap(ProjectNameVo::getId, ProjectNameVo::getName));
list.forEach(item -> {
String projectName = map.get(item.getProjectId());
if (null != projectName) {
item.setProjectName(projectName);
}
});
return list;
}
}

161
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java

@ -0,0 +1,161 @@
package com.hnac.gglm.bigmodel.business.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
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.ModelFuncVO;
import lombok.Data;
import org.springblade.core.tool.utils.Func;
/**
* @Author: ypj
* @Date: 2024/9/19 7:55
*/
@Data
public class DeviceModelData {
/**
* 模型id
*/
private Long modelId;
/**
* 名称
*/
private String name;
/**
* 标识
*/
private String signage;
/**
* 数据类型
*/
private String dbType;
/**
* 字段长度
*/
private String fieldLength;
/**
* 保留位数
*/
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer keepFigures;
/**
* 取数规则 0 平均值1 最大值2 最小值3 最后值4 最早值5 和值6 差值
*/
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer accessRules;
/**
* 描述
*/
private String descs;
/**
* 模型分类id
*/
private Long modelClassifyId;
/**
* 告警等级
*/
private Integer level;
/**
* 告警频率
*/
private Integer duration;
/**
* 参数名称
*/
private String parameterName;
/**
* 参数标识
*/
private String parameterTag;
/**
* 单点控制状态0:1:
*/
private Integer controlStatus;
/**
* 是否弹窗
*/
private Integer isPopup;
/**
* 是否反校
*/
private Integer isCheck;
/**
* 参数来源0:默认1:属性值
*/
private Integer parameterSource;
/**
* 来源属性标识
*/
private String sourceAttrSignage;
/**
* 控制参数0:/1:退/2:停止/启动
*/
private Integer controlParameter;
/**
* 参数json
*/
private String parameterJson;
/**
* 间隔时长
*/
private Integer intervalLength;
/**
* 参数范围最小值
*/
private Integer minValue;
/**
* 参数范围最大值
*/
private Integer maxValue;
/**
* 参数系数
*/
private Integer coefficient;
/**
* 类型0:属性1:功能2:事件
*/
private Integer type;
public static DeviceModelData of(ModelAttrVO data) {
DeviceModelData deviceModelData = Func.copyProperties(data, DeviceModelData.class);
deviceModelData.setType(0);
return deviceModelData;
}
public static DeviceModelData of(ModelFuncVO data) {
DeviceModelData deviceModelData = Func.copyProperties(data, DeviceModelData.class);
deviceModelData.setType(1);
return deviceModelData;
}
public static DeviceModelData of(ModelEventVO data) {
DeviceModelData deviceModelData = Func.copyProperties(data, DeviceModelData.class);
deviceModelData.setType(2);
return deviceModelData;
}
}

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/vo/SqlVO.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/SqlVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.vo; package com.hnac.gglm.bigmodel.business.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/vo/TableAuthVO.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/TableAuthVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.vo; package com.hnac.gglm.bigmodel.business.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/wrapper/CanvasSyncWrapper.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/wrapper/CanvasSyncWrapper.java

@ -1,7 +1,7 @@
package com.hnac.hzims.bigmodel.business.wrapper; package com.hnac.gglm.bigmodel.business.wrapper;
import com.hnac.hzims.bigmodel.api.dto.CanvasSyncDTO; import com.hnac.gglm.bigmodel.api.dto.CanvasSyncDTO;
import com.hnac.hzims.bigmodel.api.wrapper.BaseSyncWrapper; import com.hnac.gglm.bigmodel.api.wrapper.BaseSyncWrapper;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasVO; import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

22
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/configuration/BigModelInvokeApi.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.configuration; package com.hnac.gglm.bigmodel.configuration;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
@ -67,4 +67,24 @@ public class BigModelInvokeApi {
*/ */
private String compute; private String compute;
/**
* 通过图片或文字抽取表单内容进行填写
*/
private String identifyForm;
/**
* 增加向量
*/
private String insertVectors;
/**
* 新建向量表
*/
private String createTable;
/**
*
*/
private String deleteTable;
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/ThreadPoolManager.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/configuration/ThreadPoolManager.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.configuration; package com.hnac.gglm.bigmodel.configuration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/WeaviateConfigure.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/configuration/WeaviateConfigure.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.configuration; package com.hnac.gglm.bigmodel.configuration;
import io.weaviate.client.Config; import io.weaviate.client.Config;
import io.weaviate.client.WeaviateAuthClient; import io.weaviate.client.WeaviateAuthClient;

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/WeaviateProperties.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/configuration/WeaviateProperties.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.configuration; package com.hnac.gglm.bigmodel.configuration;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;

12
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/controller/WeaviateController.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/controller/WeaviateController.java

@ -1,7 +1,8 @@
package com.hnac.hzims.bigmodel.database.controller; package com.hnac.gglm.bigmodel.database.controller;
import com.hnac.hzims.bigmodel.database.dto.WeaviateSaveDTO; import com.hnac.gglm.bigmodel.api.dto.WeaviateQueryDTO;
import com.hnac.hzims.bigmodel.database.service.WeaviateService; import com.hnac.gglm.bigmodel.database.dto.WeaviateSaveDTO;
import com.hnac.gglm.bigmodel.database.service.WeaviateService;
import io.weaviate.client.v1.data.model.WeaviateObject; import io.weaviate.client.v1.data.model.WeaviateObject;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -38,4 +39,9 @@ public class WeaviateController {
public R<Boolean> removeById(@RequestParam(value = "id",required = false) String id, @RequestParam("className") String className) { public R<Boolean> removeById(@RequestParam(value = "id",required = false) String id, @RequestParam("className") String className) {
return R.status(weaviateService.delete(id,className)); return R.status(weaviateService.delete(id,className));
} }
@GetMapping("/query")
public R<Object> query(@RequestBody WeaviateQueryDTO query) {
return R.data(weaviateService.query(query.getResultFields(),query.getClassName(),query.getQuery()));
}
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/dto/WeaviateSaveDTO.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/dto/WeaviateSaveDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.database.dto; package com.hnac.gglm.bigmodel.database.dto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

170
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/service/WeaviateService.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.database.service; package com.hnac.gglm.bigmodel.database.service;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
@ -6,7 +6,8 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi; import com.hnac.gglm.bigmodel.configuration.BigModelInvokeApi;
import com.hnac.gglm.bigmodel.utils.RequestClientUtil;
import com.hnac.hzinfo.exception.HzServiceException; import com.hnac.hzinfo.exception.HzServiceException;
import io.weaviate.client.Config; import io.weaviate.client.Config;
import io.weaviate.client.WeaviateAuthClient; import io.weaviate.client.WeaviateAuthClient;
@ -18,6 +19,9 @@ import io.weaviate.client.v1.data.api.ObjectDeleter;
import io.weaviate.client.v1.data.api.ObjectUpdater; import io.weaviate.client.v1.data.api.ObjectUpdater;
import io.weaviate.client.v1.data.api.ObjectsGetter; import io.weaviate.client.v1.data.api.ObjectsGetter;
import io.weaviate.client.v1.data.model.WeaviateObject; import io.weaviate.client.v1.data.model.WeaviateObject;
import io.weaviate.client.v1.filters.Operator;
import io.weaviate.client.v1.filters.WhereFilter;
import io.weaviate.client.v1.graphql.GraphQL;
import io.weaviate.client.v1.graphql.model.GraphQLResponse; import io.weaviate.client.v1.graphql.model.GraphQLResponse;
import io.weaviate.client.v1.graphql.query.Get; import io.weaviate.client.v1.graphql.query.Get;
import io.weaviate.client.v1.graphql.query.fields.Field; import io.weaviate.client.v1.graphql.query.fields.Field;
@ -35,7 +39,6 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import java.util.stream.Stream;
/** /**
* @Author: huangxing * @Author: huangxing
@ -51,6 +54,8 @@ public class WeaviateService {
@Value("${gglm.vectorUrl}") @Value("${gglm.vectorUrl}")
private String vectorUrl; private String vectorUrl;
@Value("${gglm.url}")
private String gglmUrl;
/** /**
* 对象保存向量数据库 * 对象保存向量数据库
@ -71,44 +76,84 @@ public class WeaviateService {
return !result.hasErrors(); return !result.hasErrors();
} }
/** // /**
* 对象批量保存向量数据库 // * 对象批量保存向量数据库
* @param entities 保存对象列表 // * @param entities 保存对象列表
* @param className 保存表名 // * @param className 保存表名
* @param attrsMap 待计算的列信息 key-向量名 value-实体类对象属性,多个按逗号分隔 // * @param attrsMap 待计算的列信息 key-向量名 value-实体类对象属性,多个按逗号分隔
* @return 保存操作结果 // * @return 保存操作结果
*/ // */
// public Boolean saveBatch(List entities,String className, Map<String,String> attrsMap) {
// entities = entities.subList(0, 1);
// ObjectCreator creator = weaviateClient.data().creator().withClassName(className);
// List<String> vectorStrs = Lists.newArrayList();
// List<String> attrs = Lists.newArrayList();
// if(Func.isNotEmpty(attrsMap)) {
// // 格式化数据
// attrsMap.forEach((k,v) -> attrs.add(v));
// // 解析待计算的向量字段
// entities.forEach(entity -> {
// List<String> vectorStr = attrs.stream().map(fields -> this.getFieldValue(fields, entity)).filter(Func::isNotEmpty).collect(Collectors.toList());
// vectorStrs.addAll(vectorStr);
// });
// }
// if(Func.isNotEmpty(vectorStrs)) {
// // 若解析出来的向量存在值
// Float[] vectors = this.compute(vectorStrs);
// List<Map<String, Float[]>> vector = this.splitVector(entities.size(), attrsMap, vectors);
// for(int i = 0; i < entities.size(); i++) {
// // log.info("vector:{}",JSON.toJSONString(vector.get(i)));
// Map<String, Object> properties = this.objectToMap(entities.get(i));
// log.info("properties:{}",JSON.toJSONString(properties));
// Result<WeaviateObject> run = creator.withProperties(properties).withVectors(vector.get(i)).run();
// if(run.hasErrors()) {
// log.error("保存失败!,保存结果为:{}",JSON.toJSONString(run));
// }
// }
// } else {
// entities.forEach(entity -> creator.withProperties(this.objectToMap(entity)).run());
// return true;
// }
// return false;
// }
public Boolean saveBatch(List entities,String className, Map<String,String> attrsMap) { public Boolean saveBatch(List entities,String className, Map<String,String> attrsMap) {
ObjectCreator creator = weaviateClient.data().creator().withClassName(className); // 查询Weaviate 4.7.0表是否存在 若不存则新建表
List<String> vectorStrs = Lists.newArrayList(); Result<Boolean> existResult = weaviateClient.schema().exists().withClassName("Hzn_lm_" + className).run();
List<String> attrs = Lists.newArrayList(); if(existResult.hasErrors() || !existResult.getResult()) {
if(Func.isNotEmpty(attrsMap)) { Map<java.lang.String,Object> createTableParams = new HashMap<>(2);
// 格式化数据 Map<String,String> deleteTableParams = new HashMap<>(1);
attrsMap.forEach((k,v) -> attrs.add(v)); deleteTableParams.put("table_name",className);
// 解析待计算的向量字段 createTableParams.put("table_name",className);
entities.forEach(entity -> { List<String> vectorStr = Lists.newArrayList();
List<String> vectorStr = attrs.stream().map(fields -> this.getFieldValue(fields, entity)).filter(Func::isNotEmpty).collect(Collectors.toList()); attrsMap.keySet().forEach(key -> vectorStr.add(key));
vectorStrs.addAll(vectorStr); createTableParams.put("vector_names",vectorStr.toArray(new String[vectorStr.size()]));
}); RequestClientUtil.postCall(gglmUrl + invokeApi.getDeleteTable(),deleteTableParams);
} RequestClientUtil.postCall(gglmUrl + invokeApi.getCreateTable(),createTableParams);
if(Func.isNotEmpty(vectorStrs)) {
// 若解析出来的向量存在值
Float[] vectors = this.compute(vectorStrs);
List<Map<String, Float[]>> vector = this.splitVector(entities.size(), attrsMap, vectors);
for(int i = 0; i < entities.size(); i++) {
// log.info("vector:{}",JSON.toJSONString(vector.get(i)));
Map<String, Object> properties = this.objectToMap(entities.get(i));
log.info("properties:{}",JSON.toJSONString(properties));
Result<WeaviateObject> run = creator.withProperties(properties).withVectors(vector.get(i)).run();
if(run.hasErrors()) {
log.error("保存失败!,保存结果为:{}",JSON.toJSONString(run));
} }
} Map<String,Object> params = new HashMap<>(2);
} else { params.put("table_name", className);
entities.forEach(entity -> creator.withProperties(this.objectToMap(entity)).run()); List<Map<String, Object>> data = new ArrayList<>();
entities.forEach(entity -> data.add(this.getVectorData(entity,attrsMap)));
log.info("data:{}",JSON.toJSONString(data));
params.put("data",data);
String url = gglmUrl + invokeApi.getInsertVectors();
RequestClientUtil.postCall(url,params);
return true; return true;
} }
return false;
private Map<String,Object> getVectorData(Object entity,Map<String,String> attrsMap) {
Map<String,Object> result = new HashMap<>(2);
result.put("object", entity);
List<Map<String,String>> vectors = new ArrayList<>();
attrsMap.forEach((k,fields) -> {
Map<String,String> vector = new HashMap<>();
vector.put("key",k);
vector.put("content", this.getFieldValue(fields, entity));
vectors.add(vector);
});
result.put("vector", vectors);
return result;
} }
private Map<String,Object> objectToMap(Object object) { private Map<String,Object> objectToMap(Object object) {
@ -130,20 +175,22 @@ public class WeaviateService {
* @return 删除结果 * @return 删除结果
*/ */
public Boolean delete(String ids,String className) { public Boolean delete(String ids,String className) {
if(Func.isEmpty(ids) && Func.isNotEmpty(className)) {
// 删除className
Map<String,String> deleteTableParams = new HashMap<>(1);
deleteTableParams.put("table_name",className.replace("Hzn_lm_",""));
RequestClientUtil.postCall(gglmUrl + invokeApi.getDeleteTable(),deleteTableParams);
} else {
// 删除记录
ObjectDeleter deleter = weaviateClient.data().deleter(); ObjectDeleter deleter = weaviateClient.data().deleter();
deleter.withClassName(className); deleter.withClassName(className);
if(Func.isEmpty(ids)) {
Result<List<WeaviateObject>> allObject = weaviateClient.data().objectsGetter().withClassName(className).withLimit(10000).run();
if(!allObject.hasErrors()) {
ids = allObject.getResult().stream().map(WeaviateObject::getId).collect(Collectors.joining(","));
}
}
Func.toStrList(",",ids).forEach(id -> { Func.toStrList(",",ids).forEach(id -> {
Result<Boolean> result = deleter.withID(id).run(); Result<Boolean> result = deleter.withID(id).run();
if(result.hasErrors()) { if(result.hasErrors()) {
throw new HzServiceException(ResultCode.FAILURE,id + "记录删除失败!"); throw new HzServiceException(ResultCode.FAILURE,id + "记录删除失败!");
} }
}); });
}
return true; return true;
} }
@ -270,4 +317,41 @@ public class WeaviateService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return floats.toArray(new Float[floats.size()]); return floats.toArray(new Float[floats.size()]);
} }
/**
* 查询weaviate数据property数据
* @param resultFields 返回字段
* @param query 筛选条件 k-查询字段 v-查询值 目前仅支持String类型查询
* @return 查询结果
*/
public Object query(String resultFields,String className,Map<String,String> query) {
List<String> fieldList = Func.toStrList(",", resultFields);
Get get = weaviateClient.graphQL().get();
get.withClassName(className);
List<Field> fields = fieldList.stream().map(fieldStr -> Field.builder().name(fieldStr).build()).collect(Collectors.toList());
Field additionalId = Field.builder().name("_additional { id }").build();
fields.add(additionalId);
get.withFields(fields.toArray(new Field[fields.size()]));
if(Func.isNotEmpty(query)) {
// waeviate 多个filter查询结果
List<WhereFilter> whereFilters = query.entrySet().stream().map(e -> WhereFilter.builder()
.path(e.getKey())
.operator(Operator.Equal)
.valueString(e.getValue())
.build()).collect(Collectors.toList());
WhereFilter combinedFilter = WhereFilter.builder()
.operator(Operator.And)
.operands(whereFilters.toArray(new WhereFilter[whereFilters.size()]))
.build();
get.withWhere(combinedFilter);
}
try {
// 执行查询并返回结果
return get.run().getResult().getData();
} catch (Exception e) {
// 异常处理
System.err.println("Error occurred during query execution: " + e.getMessage());
throw new RuntimeException("Query failed.", e);
}
}
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/util/WeaviateUtil.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/database/util/WeaviateUtil.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.database.util; package com.hnac.gglm.bigmodel.database.util;
/** /**
* @Author: huangxing * @Author: huangxing

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/DataAuthTypeEnum.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/constants/DataAuthTypeEnum.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.constants; package com.hnac.gglm.bigmodel.interactive.constants;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/DataMethodEnum.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/constants/DataMethodEnum.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.constants; package com.hnac.gglm.bigmodel.interactive.constants;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/DateEnum.java → hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/constants/DateEnum.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.interactive.constants; package com.hnac.gglm.bigmodel.interactive.constants;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save