Browse Source

add:设备功能数据接口

zhongwei
luyie 2 months ago
parent
commit
e6521e2392
  1. 49
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/constants/AccessRules.java
  2. 12
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java
  3. 3
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java
  4. 25
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java

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

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

@ -7,6 +7,7 @@ import com.hnac.gglm.bigmodel.business.vo.DeviceModelData;
import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData; import com.hnac.gglm.bigmodel.maintenance.dto.KnowledgeData;
import com.hnac.hzinfo.api.annotation.ApiInterface; import com.hnac.hzinfo.api.annotation.ApiInterface;
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO; 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.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
@ -76,11 +77,20 @@ public class VectorDataController {
return R.data(vectorDataService.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") @GetMapping("/listKnowledgeData")
@ApiOperation(value = "获取知识库数据") @ApiOperation(value = "获取知识库数据")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 7)
@ApiInterface @ApiInterface
public R<List<KnowledgeData>> listKnowledgeData() { public R<List<KnowledgeData>> listKnowledgeData() {
return R.data(knowledgeDataService.listKnowledgeData()); return R.data(knowledgeDataService.listKnowledgeData());
} }
} }

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

@ -2,6 +2,7 @@ package com.hnac.gglm.bigmodel.business.service;
import com.hnac.gglm.bigmodel.business.vo.DeviceModelData; 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.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.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
@ -23,4 +24,6 @@ public interface VectorDataService {
List<DeviceModelData> getModelData(); List<DeviceModelData> getModelData();
List<DeviceAttrInfoDTO> getDeviceAttr(); List<DeviceAttrInfoDTO> getDeviceAttr();
List<DeviceFuncInfoDTO> getDeviceFunc();
} }

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

@ -1,9 +1,11 @@
package com.hnac.gglm.bigmodel.business.service.impl; 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.service.VectorDataService;
import com.hnac.gglm.bigmodel.business.vo.DeviceModelData; import com.hnac.gglm.bigmodel.business.vo.DeviceModelData;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; 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.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.ModelClient;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO; 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.ModelEventVO;
@ -67,6 +69,27 @@ public class VectorDataServiceImpl implements VectorDataService {
@Override @Override
public List<DeviceAttrInfoDTO> getDeviceAttr() { public List<DeviceAttrInfoDTO> getDeviceAttr() {
return deviceClient.listDeviceAttr().getData(); List<DeviceAttrInfoDTO> list = deviceClient.listDeviceAttr().getData();
if (null != list && !list.isEmpty()) {
list.forEach(item -> {
item.setItemName(item.getProjectName() + " " + item.getDeviceName() + " " + item.getName());
String rule = AccessRules.getDescByCode(item.getRule());
if (null != rule) {
item.setRule(rule);
}
});
}
return list;
}
@Override
public List<DeviceFuncInfoDTO> getDeviceFunc() {
List<DeviceFuncInfoDTO> list = deviceClient.listDeviceFunc().getData();
if (null != list && !list.isEmpty()) {
list.forEach(item -> {
item.setItemName(item.getProjectName() + " " + item.getDeviceName() + " " + item.getName());
});
}
return list;
} }
} }

Loading…
Cancel
Save