Browse Source

add:模型数据获取向量

zhongwei
luyie 2 months ago
parent
commit
6f1c4393bc
  1. 26
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java
  2. 3
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java
  3. 21
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java

26
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<List<ModelAttrVO>> getModelAttributeData() {
return R.data(vectorDataService.getModelAttributeData());
}
@GetMapping("/getModelEventData")
@ApiOperation(value = "获取模型事件数据")
@ApiOperationSupport(order = 12)
@ApiOperationSupport(order = 2)
@ApiInterface
public R getModelEventData() {
public R<List<ModelEventVO>> getModelEventData() {
return R.data(vectorDataService.getModelEventData());
}
@GetMapping("/getModelFunctionData")
@ApiOperation(value = "获取模型功能数据")
@ApiOperationSupport(order = 13)
@ApiOperationSupport(order = 3)
@ApiInterface
public R getModelFunctionData() {
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());
}
}

3
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<ModelFuncVO> getModelFunctionData();
List<ModelEventVO> getModelEventData();
List<DeviceModelData> getModelData();
}

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

Loading…
Cancel
Save