瀏覽代碼

拓元算法设备列表

谭斌 1 年之前
父節點
當前提交
5ad7b55631

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

@@ -125,5 +125,14 @@ public class DeviceInfo {
      * 商户名称
      */
     private String mercName;
+    /**
+     * 第三方设备登记状态
+     */
+    private String thirdStatus;
+
+    /**
+     * 第三方设备审核结果
+     */
+    private String thirdResult;
 
 }

+ 55 - 1
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -86,6 +86,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
     private final CloudWalkApiService cloudWalkApiService;
     private final AlgorithmService algorithmService;
     private final CountApiService countApiService;
+    private final TyApiService tyApiService;
     /**
      * 质检商户code
      */
@@ -111,7 +112,6 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
 
     private final MercPlaceService mercPlaceService;
 
-    private final TyApiService tyApiService;
 
     @Override
     @ApiOperation("设备列表-管理员")
@@ -210,6 +210,60 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         return R.ok(pageBean.setRecords(builder));
     }
 
+    @ApiOperation("拓元算法设备列表")
+    @PostMapping("tyDeviceList")
+    public R<PageBean<DeviceInfoDto.Vo>> tyDeviceList(@RequestBody @Validated DeviceInfoDto.TyDeviceDTO dto) {
+        PageBean pageBean = dto.getPage();
+        String searchKey = dto.getSearchKey();
+        Integer thirdStatus = dto.getThirdStatus();
+        List<String> statusList = new ArrayList<>();
+        //1待审核,2已审核
+        if (thirdStatus != null && thirdStatus == 1) {
+            statusList = CollUtil.newArrayList("1000", "2000", "3000", "5000");
+        }
+        // 2已审核  4000: 设备登记成功
+        if (thirdStatus != null && thirdStatus == 2) {
+            statusList.add("4000");
+        }
+        LambdaQueryWrapper<DeviceInfo> lqw = new MybatisPlusQuery().eqWrapper(dto, DeviceInfo.class)
+                .build();
+        lqw.eq(DeviceInfo::getAlgorithmId, AlgorithmTypeEnum.TY.getId());
+        lqw.in(CollUtil.isNotEmpty(statusList), DeviceInfo::getThirdStatus, statusList);
+        lqw.and(StrUtil.isNotEmpty(searchKey), wrapper -> wrapper
+                .eq(DeviceInfo::getDeviceId, searchKey)
+                .or()
+                .likeRight(DeviceInfo::getDeviceName, searchKey));
+        IPage<DeviceInfo> iPage = page(toIPage(pageBean), lqw);
+        List<DeviceInfo> records = iPage.getRecords();
+        if (CollUtil.isNotEmpty(records)) {
+            records.forEach(r -> {
+                Long deviceId = r.getDeviceId();
+                /**
+                 * 请求状态码。
+                 * 1000: 未知的设备CPUID
+                 * 2000: 设备登记 审批中
+                 * 3000: 设备登记已拒绝
+                 * 4000: 设备登记成功
+                 * 5000: 设备已禁⽤
+                 */
+                String tyStatus = r.getThirdStatus();
+                if (!"4000".equals(tyStatus)) {
+                    //未登记成功的需要实时查询
+                    //查询登记设备
+                    DeviceQueryVO deviceQueryVO = tyApiService.deviceQuery(new DeviceQueryDTO().setCpuId(String.valueOf(deviceId)));
+                    Integer status = deviceQueryVO.getStatus();
+                    String message = deviceQueryVO.getMessage();
+                    r.setThirdStatus(String.valueOf(status));
+                    r.setThirdResult(message);
+                    updateById(r);
+                }
+
+            });
+        }
+        PageBean<DeviceInfoDto.Vo> voPageBean = toPageBean(DeviceInfoDto.Vo.class, iPage);
+
+        return R.ok(voPageBean);
+    }
 
     /**
      * 商户设备列表分页-穿梭框用

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

@@ -24,10 +24,11 @@ import java.util.List;
 
 @Data
 @Accessors(chain = true)
-public class DeviceInfoDto {/**
- * 删除线路\点位时时指定 传入 wherePlaceLineId\wherePlaceId
- */
-public final static String DEL = "del";
+public class DeviceInfoDto {
+    /**
+     * 删除线路\点位时时指定 传入 wherePlaceLineId\wherePlaceId
+     */
+    public final static String DEL = "del";
     /**
      * 更新线\点位时指定 传入 deviceIds、placeLineId\placeId
      */
@@ -42,7 +43,7 @@ public final static String DEL = "del";
     @Accessors(chain = true)
     public static class PageByAdminNameDto extends GroupByAdminNameDto {
         @NotNull(message = "分页信息不能为空")
-        @ApiModelProperty(value = "商户ID",required = true)
+        @ApiModelProperty(value = "商户ID", required = true)
         private PageBean page;
 
         @ApiModelProperty("设备类型")
@@ -61,7 +62,7 @@ public final static String DEL = "del";
     @Data
     @Accessors(chain = true)
     public static class GroupByAdminNameDto {
-        @ApiModelProperty(value = "商户ID",required = true)
+        @ApiModelProperty(value = "商户ID", required = true)
         private Long mercId;
 
         @ApiModelProperty("设备id集合")
@@ -72,7 +73,6 @@ public final static String DEL = "del";
     }
 
 
-
     @Data
     @Accessors(chain = true)
     public static class GroupByAdminNameVo {
@@ -117,6 +117,25 @@ public final static String DEL = "del";
         private String mercCode;
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class TyDeviceDTO {
+        @NotNull(message = "分页对象不能空")
+        @ApiModelProperty(value = "分页对象", required = true)
+        private PageBean page;
+
+        @ApiModelProperty(value = "设备ID或名称搜索")
+        private String searchKey;
+
+        /**
+         * 第三方设备登记状态
+         */
+        @ApiModelProperty(value = "第三方设备登记状态1待审核,2已审核")
+        private Integer thirdStatus;
+
+
+    }
+
     @Data
     @Accessors(chain = true)
     public static class MyDeviceDTO {
@@ -558,6 +577,18 @@ public final static String DEL = "del";
         @ApiModelProperty("管理员名字")
         private String adminName;
 
+        /**
+         * 第三方设备登记状态
+         */
+        @ApiModelProperty("第三方设备登记状态")
+        private String thirdStatus;
+
+        /**
+         * 第三方设备审核结果
+         */
+        @ApiModelProperty("第三方设备审核结果")
+        private String thirdResult;
+
     }
 
     @Data