yang_shj
2 months ago
500 changed files with 12186 additions and 9092 deletions
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.api.constants; |
||||
package com.hnac.gglm.bigmodel.api.constants; |
||||
|
||||
/** |
||||
* @Author: huangxing |
@ -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.ApiModelProperty; |
@ -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.ApiModelProperty; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.api.dto; |
||||
package com.hnac.gglm.bigmodel.api.dto; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import lombok.Data; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.api.dto; |
||||
package com.hnac.gglm.bigmodel.api.dto; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import lombok.Data; |
@ -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 io.swagger.annotations.ApiModel; |
@ -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 io.swagger.annotations.ApiModel; |
@ -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; |
||||
|
||||
} |
@ -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; |
||||
|
||||
} |
@ -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.hzims.bigmodel.api.dto.BigModelAnalysisRequestDTO; |
||||
import com.hnac.hzims.bigmodel.api.dto.BigModelAnalysisResponseDTO; |
||||
import com.hnac.gglm.bigmodel.BigModelConstants; |
||||
import com.hnac.gglm.bigmodel.api.dto.BigModelAnalysisRequestDTO; |
||||
import com.hnac.gglm.bigmodel.api.dto.BigModelAnalysisResponseDTO; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
@ -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 |
@ -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 |
@ -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.hzims.bigmodel.business.dto.RunReportAnalyseRequest; |
||||
import com.hnac.hzims.bigmodel.business.dto.RunReportDataAnalyseDTO; |
||||
import com.hnac.gglm.bigmodel.BigModelConstants; |
||||
import com.hnac.gglm.bigmodel.business.dto.RunReportAnalyseRequest; |
||||
import com.hnac.gglm.bigmodel.business.dto.RunReportDataAnalyseDTO; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
@ -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.springframework.web.bind.annotation.RequestBody; |
||||
|
@ -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.hzims.bigmodel.api.dto.SyncDTO; |
||||
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; |
||||
import com.hnac.gglm.bigmodel.BigModelConstants; |
||||
import com.hnac.gglm.bigmodel.api.dto.SyncDTO; |
||||
import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.*; |
@ -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); |
||||
|
||||
} |
@ -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.stream.Collectors; |
@ -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.ApiModelProperty; |
||||
import lombok.Data; |
@ -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 io.swagger.annotations.ApiModel; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.business.dto; |
||||
package com.hnac.gglm.bigmodel.business.dto; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
@ -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 lombok.Data; |
@ -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.ApiModelProperty; |
@ -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.ApiModelProperty; |
@ -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 java.util.List; |
@ -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 io.swagger.annotations.ApiModel; |
@ -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.ApiModelProperty; |
@ -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 io.swagger.annotations.ApiModel; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.interactive.vo; |
||||
package com.hnac.gglm.bigmodel.interactive.vo; |
||||
|
||||
import lombok.Data; |
||||
|
@ -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 lombok.Data; |
@ -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 lombok.Data; |
@ -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.fasterxml.jackson.annotation.JsonIgnore; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.interactive.vo; |
||||
package com.hnac.gglm.bigmodel.interactive.vo; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
@ -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 lombok.Data; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.interactive.vo; |
||||
package com.hnac.gglm.bigmodel.interactive.vo; |
||||
|
||||
import java.io.Serializable; |
||||
|
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.interactive.vo; |
||||
package com.hnac.gglm.bigmodel.interactive.vo; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
@ -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 lombok.Data; |
@ -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 java.io.Serializable; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.interactive.vo; |
||||
package com.hnac.gglm.bigmodel.interactive.vo; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
@ -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.baomidou.mybatisplus.annotation.SqlCondition; |
@ -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 lombok.Data; |
@ -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); |
||||
} |
||||
} |
||||
} |
@ -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); |
||||
|
||||
} |
@ -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"); |
||||
} |
||||
|
||||
} |
@ -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; |
||||
|
||||
} |
@ -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; |
||||
|
||||
} |
@ -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()); |
||||
} |
||||
|
||||
} |
@ -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(); |
||||
|
||||
} |
@ -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; |
||||
} |
||||
|
||||
} |
@ -1,26 +1,17 @@
|
||||
package com.hnac.hzims.bigmodel; |
||||
package com.hnac.gglm.bigmodel; |
||||
|
||||
import org.mybatis.spring.annotation.MapperScan; |
||||
import org.springblade.core.cloud.feign.EnableBladeFeign; |
||||
import org.springblade.core.launch.BladeApplication; |
||||
import org.springframework.boot.SpringApplication; |
||||
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.context.annotation.ComponentScan; |
||||
import org.springframework.scheduling.annotation.EnableScheduling; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
@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"}) |
||||
public class HzimsBigModelApplication { |
||||
public class GglmBigModelApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
BladeApplication.run(BigModelConstants.APP_NAME, HzimsBigModelApplication.class, args); |
||||
BladeApplication.run(BigModelConstants.APP_NAME, GglmBigModelApplication.class, args); |
||||
} |
||||
|
||||
// @Override
|
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.api.constants; |
||||
package com.hnac.gglm.bigmodel.api.constants; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Getter; |
@ -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.hzims.bigmodel.api.dto.BigModelAnalysisResponseDTO; |
||||
import com.hnac.hzims.bigmodel.zhipuai.service.ZhipuAnalysisService; |
||||
import com.hnac.gglm.bigmodel.api.dto.BigModelAnalysisRequestDTO; |
||||
import com.hnac.gglm.bigmodel.api.dto.BigModelAnalysisResponseDTO; |
||||
import com.hnac.gglm.bigmodel.zhipuai.service.ZhipuAnalysisService; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
@ -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.hnac.hzims.bigmodel.business.dto.RunReportAnalyseRequest; |
||||
import com.hnac.hzims.bigmodel.business.dto.RunReportDataAnalyseDTO; |
||||
import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; |
||||
import com.hnac.gglm.bigmodel.business.dto.RunReportAnalyseRequest; |
||||
import com.hnac.gglm.bigmodel.business.dto.RunReportDataAnalyseDTO; |
||||
import com.hnac.gglm.bigmodel.interactive.service.IHznlmInvokeService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.api.R; |
@ -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.hzims.bigmodel.api.dto.VideoSyncDTO; |
||||
import com.hnac.hzims.bigmodel.api.service.SyncService; |
||||
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi; |
||||
import com.hnac.gglm.bigmodel.api.constants.SyncTableEnum; |
||||
import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO; |
||||
import com.hnac.gglm.bigmodel.api.service.SyncService; |
||||
import com.hnac.gglm.bigmodel.configuration.BigModelInvokeApi; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
@ -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())); |
||||
} |
||||
} |
@ -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.hnac.hzims.bigmodel.api.constants.SyncTableEnum; |
||||
import com.hnac.hzims.bigmodel.api.dto.SyncDTO; |
||||
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; |
||||
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi; |
||||
import com.hnac.hzims.bigmodel.utils.RequestClientUtil; |
||||
import com.hnac.gglm.bigmodel.api.constants.SyncTableEnum; |
||||
import com.hnac.gglm.bigmodel.api.dto.SyncDTO; |
||||
import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO; |
||||
import com.hnac.gglm.bigmodel.configuration.BigModelInvokeApi; |
||||
import com.hnac.gglm.bigmodel.utils.RequestClientUtil; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.utils.BeanUtil; |
@ -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; |
||||
} |
||||
} |
@ -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.hnac.hzims.bigmodel.api.constants.MqttTopicConstants; |
||||
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; |
||||
import com.hnac.hzims.bigmodel.api.feign.VideoSyncClient; |
||||
import com.hnac.gglm.bigmodel.api.constants.MqttTopicConstants; |
||||
import com.hnac.gglm.bigmodel.api.dto.VideoSyncDTO; |
||||
import com.hnac.gglm.bigmodel.api.feign.VideoSyncClient; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.utils.Func; |
@ -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.hnac.hzims.bigmodel.business.service.DataSourceService; |
||||
import com.hnac.hzims.bigmodel.business.vo.SqlVO; |
||||
import com.hnac.gglm.bigmodel.business.service.DataSourceService; |
||||
import com.hnac.gglm.bigmodel.business.vo.SqlVO; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.tool.api.R; |
@ -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.hnac.hzims.bigmodel.business.service.RemoteService; |
||||
import com.hnac.gglm.bigmodel.business.service.RemoteService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
@ -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()); |
||||
} |
||||
|
||||
} |
@ -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.hzims.bigmodel.business.service.AuthenticationService; |
||||
import com.hnac.gglm.bigmodel.business.dto.ControlDeviceAuthDTO; |
||||
import com.hnac.gglm.bigmodel.business.service.AuthenticationService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.api.R; |
@ -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.google.common.collect.Lists; |
||||
import com.hnac.hzims.bigmodel.interactive.constants.DataMethodEnum; |
||||
import com.hnac.hzims.bigmodel.interactive.constants.DateEnum; |
||||
import com.hnac.hzims.bigmodel.interactive.vo.HistoryDataSearchVO; |
||||
import com.hnac.gglm.bigmodel.interactive.constants.DataMethodEnum; |
||||
import com.hnac.gglm.bigmodel.interactive.constants.DateEnum; |
||||
import com.hnac.gglm.bigmodel.interactive.vo.HistoryDataSearchVO; |
||||
import com.hnac.hzinfo.sdk.core.response.Result; |
||||
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; |
||||
import com.hnac.hzinfo.sdk.v5.device.dto.ReductionAttrDataDTO; |
@ -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(); |
||||
} |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.business.service; |
||||
package com.hnac.gglm.bigmodel.business.service; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
@ -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(); |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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.ApiModelProperty; |
@ -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.ApiModelProperty; |
@ -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.hzims.bigmodel.api.wrapper.BaseSyncWrapper; |
||||
import com.hnac.gglm.bigmodel.api.dto.CanvasSyncDTO; |
||||
import com.hnac.gglm.bigmodel.api.wrapper.BaseSyncWrapper; |
||||
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasVO; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springframework.stereotype.Component; |
@ -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.stereotype.Component; |
@ -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.WeaviateAuthClient; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.configuration; |
||||
package com.hnac.gglm.bigmodel.configuration; |
||||
|
||||
import lombok.Data; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.database.dto; |
||||
package com.hnac.gglm.bigmodel.database.dto; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.database.util; |
||||
package com.hnac.gglm.bigmodel.database.util; |
||||
|
||||
/** |
||||
* @Author: huangxing |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.interactive.constants; |
||||
package com.hnac.gglm.bigmodel.interactive.constants; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.interactive.constants; |
||||
package com.hnac.gglm.bigmodel.interactive.constants; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Getter; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.bigmodel.interactive.constants; |
||||
package com.hnac.gglm.bigmodel.interactive.constants; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Getter; |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue