Browse Source

add:向量同步增加记录,模型向量数据修改类型

zhongwei
luyie 2 months ago
parent
commit
5d68b198de
  1. 28
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java
  2. 9
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/VectorParamEntity.java
  3. 8
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java

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

@ -17,7 +17,7 @@ public class DeviceModelData {
* 模型id * 模型id
*/ */
@JsonProperty("model_id") @JsonProperty("model_id")
private Long modelId; private String modelId;
/** /**
* 名称 * 名称
@ -45,13 +45,13 @@ public class DeviceModelData {
* 保留位数 * 保留位数
*/ */
@JsonProperty("keep_figures") @JsonProperty("keep_figures")
private Integer keepFigures; private String keepFigures;
/** /**
* 取数规则 0 平均值1 最大值2 最小值3 最后值4 最早值5 和值6 差值 * 取数规则 0 平均值1 最大值2 最小值3 最后值4 最早值5 和值6 差值
*/ */
@JsonProperty("access_rules") @JsonProperty("access_rules")
private Integer accessRules; private String accessRules;
/** /**
* 描述 * 描述
@ -67,12 +67,12 @@ public class DeviceModelData {
/** /**
* 告警等级 * 告警等级
*/ */
private Integer level; private String level;
/** /**
* 告警频率 * 告警频率
*/ */
private Integer duration; private String duration;
/** /**
* 参数名称 * 参数名称
@ -90,25 +90,25 @@ public class DeviceModelData {
* 单点控制状态0:1: * 单点控制状态0:1:
*/ */
@JsonProperty("control_status") @JsonProperty("control_status")
private Integer controlStatus; private String controlStatus;
/** /**
* 是否弹窗 * 是否弹窗
*/ */
@JsonProperty("is_popup") @JsonProperty("is_popup")
private Integer isPopup; private String isPopup;
/** /**
* 是否反校 * 是否反校
*/ */
@JsonProperty("is_check") @JsonProperty("is_check")
private Integer isCheck; private String isCheck;
/** /**
* 参数来源0:默认1:属性值 * 参数来源0:默认1:属性值
*/ */
@JsonProperty("parameter_source") @JsonProperty("parameter_source")
private Integer parameterSource; private String parameterSource;
/** /**
* 来源属性标识 * 来源属性标识
@ -120,7 +120,7 @@ public class DeviceModelData {
* 控制参数0:/1:退/2:停止/启动 * 控制参数0:/1:退/2:停止/启动
*/ */
@JsonProperty("control_parameter") @JsonProperty("control_parameter")
private Integer controlParameter; private String controlParameter;
/** /**
* 参数json * 参数json
@ -132,24 +132,24 @@ public class DeviceModelData {
* 间隔时长 * 间隔时长
*/ */
@JsonProperty("interval_length") @JsonProperty("interval_length")
private Integer intervalLength; private String intervalLength;
/** /**
* 参数范围最小值 * 参数范围最小值
*/ */
@JsonProperty("min_value") @JsonProperty("min_value")
private Integer minValue; private String minValue;
/** /**
* 参数范围最大值 * 参数范围最大值
*/ */
@JsonProperty("max_value") @JsonProperty("max_value")
private Integer maxValue; private String maxValue;
/** /**
* 参数系数 * 参数系数
*/ */
private Integer coefficient; private String coefficient;
/** /**
* 类型0:属性1:功能2:事件 * 类型0:属性1:功能2:事件

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

@ -10,6 +10,7 @@ import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* @Author: ypj * @Author: ypj
@ -50,4 +51,12 @@ public class VectorParamEntity extends TenantEntity implements Serializable {
@TableField("REMARK") @TableField("REMARK")
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
private String remark; private String remark;
@ApiModelProperty("同步时间")
@TableField("SYNCHRONIZATION_TIME")
private Date synchronizationTime;
@ApiModelProperty("同步说明")
@TableField("SYNCHRONIZATION_REMARK")
private String synchronizationRemark;
} }

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

@ -5,7 +5,6 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
@ -159,8 +158,11 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto
attrMap.put(key, rootNode.findValue(key).textValue()); attrMap.put(key, rootNode.findValue(key).textValue());
} }
String tableName = entity.getTableName().replace(entity.getProjectPrefix() + "_", ""); String tableName = entity.getTableName().replace(entity.getProjectPrefix() + "_", "");
weaviateService.saveBatch(response.getOriginalData(), tableName, attrMap); String syncResult = weaviateService.saveBatch(response.getOriginalData(), tableName, attrMap);
if (this.update(Wrappers.<VectorParamEntity>lambdaUpdate().eq(VectorParamEntity::getId, id).set(VectorParamEntity::getUpdateTime, new Date()))) { if (this.update(Wrappers.<VectorParamEntity>lambdaUpdate()
.eq(VectorParamEntity::getId, id)
.set(VectorParamEntity::getSynchronizationRemark, syncResult)
.set(VectorParamEntity::getSynchronizationTime, new Date()))) {
return vectorParamLogService.synchronization(VectorParamLogEntity.builder() return vectorParamLogService.synchronization(VectorParamLogEntity.builder()
.vectorParamId(id) .vectorParamId(id)
.type(DataOperateType.SYNCHRONIZATION.getCode()).build()); .type(DataOperateType.SYNCHRONIZATION.getCode()).build());

Loading…
Cancel
Save