diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java index cbc3b03..0d4c8d1 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java @@ -2,7 +2,11 @@ package com.hnac.gglm.bigmodel.business.controller; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.gglm.bigmodel.business.service.VectorDataService; +import com.hnac.gglm.bigmodel.business.vo.DeviceModelData; import com.hnac.hzinfo.api.annotation.ApiInterface; +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 io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -12,6 +16,8 @@ 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 @@ -28,25 +34,33 @@ public class VectorDataController { @GetMapping("/getModelAttributeData") @ApiOperation(value = "获取模型属性数据") - @ApiOperationSupport(order = 11) + @ApiOperationSupport(order = 1) @ApiInterface - public R getModelAttributeData() { + public R> getModelAttributeData() { return R.data(vectorDataService.getModelAttributeData()); } @GetMapping("/getModelEventData") @ApiOperation(value = "获取模型事件数据") - @ApiOperationSupport(order = 12) + @ApiOperationSupport(order = 2) @ApiInterface - public R getModelEventData() { + public R> getModelEventData() { return R.data(vectorDataService.getModelEventData()); } @GetMapping("/getModelFunctionData") @ApiOperation(value = "获取模型功能数据") - @ApiOperationSupport(order = 13) + @ApiOperationSupport(order = 3) @ApiInterface - public R getModelFunctionData() { + public R> getModelFunctionData() { return R.data(vectorDataService.getModelFunctionData()); } + + @GetMapping("/getModelData") + @ApiOperation(value = "获取模型数据") + @ApiOperationSupport(order = 4) + @ApiInterface + public R> getModelData() { + return R.data(vectorDataService.getModelData()); + } } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java index 24e1ebc..0c20182 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java @@ -1,5 +1,6 @@ package com.hnac.gglm.bigmodel.business.service; +import com.hnac.gglm.bigmodel.business.vo.DeviceModelData; 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; @@ -17,4 +18,6 @@ public interface VectorDataService { List getModelFunctionData(); List getModelEventData(); + + List getModelData(); } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java index 916570f..574562f 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java @@ -1,6 +1,7 @@ package com.hnac.gglm.bigmodel.business.service.impl; import com.hnac.gglm.bigmodel.business.service.VectorDataService; +import com.hnac.gglm.bigmodel.business.vo.DeviceModelData; 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; @@ -10,7 +11,9 @@ 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.stream.Collectors; /** * @Author: ypj @@ -40,4 +43,22 @@ public class VectorDataServiceImpl implements VectorDataService { R> response = modelClient.listEvent(); return response.getData(); } + + @Override + public List getModelData() { + List attrList = getModelAttributeData(); + List funcList = getModelFunctionData(); + List eventList = getModelEventData(); + List 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; + } } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java new file mode 100644 index 0000000..9385b1f --- /dev/null +++ b/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; + } +}