Ver código fonte

设备列表返回算法别名

谭斌 1 ano atrás
pai
commit
48a8c8b3b3

+ 9 - 0
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -77,6 +77,7 @@ import static com.xy.utils.PlusBeans.*;
 public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements DeviceInfoService {
 
     private final CloudWalkApiService cloudWalkApiService;
+    private final AlgorithmService algorithmService;
     /**
      * 质检商户code
      */
@@ -761,6 +762,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
             List<GoodsDeviceDto.Vo> goodsDeviceList = R.feignCheckData(goodsService.queryGoodsDeviceInfo(new GoodsDto.QueryGoodsDeviceInfo().setMercId(mercId).setDeviceIds(deviceIds)));
             Map<Long, List<GoodsDeviceDto.Vo>> deviceIdGoodsMap = goodsDeviceList.stream()
                     .collect(Collectors.groupingBy(GoodsDeviceDto.Vo::getDeviceId));
+            List<AlgorithmDto.ListNameId> algorithmList = R.feignCheckData(algorithmService.ListNameId());
+            Map<Long, String> algorithmListMap = algorithmList.stream().collect(Collectors.toMap(AlgorithmDto.ListNameId::getId, AlgorithmDto.ListNameId::getAlias));
 
             for (DeviceInfoDto.MercHomeDeviceVo device : deviceInfos) {
                 Long dId = device.getDeviceId();
@@ -783,6 +786,12 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
                         device.setFillNum(goodsDevice.stream().mapToInt(GoodsDeviceDto.Vo::getFillCount).sum());
                     }
                 }
+                //算法類型
+                Long algorithmId = device.getAlgorithmId();
+                if (algorithmId != null) {
+                    String name = algorithmListMap.get(algorithmId);
+                    device.setAlgorithmAlias(name);
+                }
 
                 //联网状态
                 Integer netState = deviceStatus == null ? DeviceNetSateType.DISCONNECT.getCode() : deviceStatus.getNetState();

+ 7 - 0
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -721,6 +721,13 @@ public class DeviceInfoDto {
         @ApiModelProperty("设备类型")
         private Integer deviceType;
 
+        @ApiModelProperty(value = "算法平台ID")
+        private Long algorithmId;
+
+        @ApiModelProperty(value = "算法类型别名")
+        private String algorithmAlias;
+
+
         @ApiModelProperty("设备类型名称")
         private String deviceTypeName;