|
@@ -86,6 +86,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
private final CloudWalkApiService cloudWalkApiService;
|
|
private final CloudWalkApiService cloudWalkApiService;
|
|
private final AlgorithmService algorithmService;
|
|
private final AlgorithmService algorithmService;
|
|
private final CountApiService countApiService;
|
|
private final CountApiService countApiService;
|
|
|
|
+ private final TyApiService tyApiService;
|
|
/**
|
|
/**
|
|
* 质检商户code
|
|
* 质检商户code
|
|
*/
|
|
*/
|
|
@@ -111,7 +112,6 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
private final MercPlaceService mercPlaceService;
|
|
private final MercPlaceService mercPlaceService;
|
|
|
|
|
|
- private final TyApiService tyApiService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@ApiOperation("设备列表-管理员")
|
|
@ApiOperation("设备列表-管理员")
|
|
@@ -210,6 +210,61 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
return R.ok(pageBean.setRecords(builder));
|
|
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.intValue() == 1) {
|
|
|
|
+ statusList = CollUtil.newArrayList("1000", "2000", "3000", "5000");
|
|
|
|
+ }
|
|
|
|
+ // 2已审核 4000: 设备登记成功
|
|
|
|
+ if (thirdStatus != null && thirdStatus.intValue() == 2) {
|
|
|
|
+ statusList.add("4000");
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<DeviceInfo> lqw = new LambdaQueryWrapper<>();
|
|
|
|
+ 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)) {
|
|
|
|
+ ThreadPoolUtils.Execute execute = ThreadPoolUtils.excPoll(DeviceThreadPoolConfig.TY_DEVICE_STATUS, records.size());
|
|
|
|
+ records.forEach(deviceInfo -> execute.execute(() -> {
|
|
|
|
+ Long deviceId = deviceInfo.getDeviceId();
|
|
|
|
+ /**
|
|
|
|
+ * 请求状态码。
|
|
|
|
+ * 1000: 未知的设备CPUID
|
|
|
|
+ * 2000: 设备登记 审批中
|
|
|
|
+ * 3000: 设备登记已拒绝
|
|
|
|
+ * 4000: 设备登记成功
|
|
|
|
+ * 5000: 设备已禁⽤
|
|
|
|
+ */
|
|
|
|
+ String tyStatus = deviceInfo.getThirdStatus();
|
|
|
|
+ if (!"4000".equals(tyStatus)) {
|
|
|
|
+ //未登记成功的需要实时查询
|
|
|
|
+ //查询登记设备
|
|
|
|
+ DeviceQueryVO deviceQueryVO = tyApiService.deviceQuery(new DeviceQueryDTO().setCpuId(String.valueOf(deviceId)));
|
|
|
|
+ Integer status = deviceQueryVO.getStatus();
|
|
|
|
+ String message = deviceQueryVO.getMessage();
|
|
|
|
+ deviceInfo.setThirdStatus(String.valueOf(status));
|
|
|
|
+ deviceInfo.setThirdResult(message);
|
|
|
|
+ updateById(deviceInfo);
|
|
|
|
+ }
|
|
|
|
+ }));
|
|
|
|
+ execute.end();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ PageBean<DeviceInfoDto.Vo> voPageBean = toPageBean(DeviceInfoDto.Vo.class, iPage);
|
|
|
|
+
|
|
|
|
+ return R.ok(voPageBean);
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 商户设备列表分页-穿梭框用
|
|
* 商户设备列表分页-穿梭框用
|