Commit 6e9c82db509e6b4f7a00701332e5a271de7ae282

Authored by 杨鸣坤
1 parent 0a131981

联调设备巡检记录

... ... @@ -42,7 +42,8 @@ public class TkInspectionRecordController extends BaseController {
42 42 @RequestParam(value = "inspectorId", required = false) String inspectorId,
43 43 @RequestParam(value = "startTime", required = false) Long startTime,
44 44 @RequestParam(value = "endTime", required = false) Long endTime,
45   - @RequestParam(value = "recordResult", required = false) Boolean recordResult
  45 + @RequestParam(value = "recordResult", required = false) Boolean recordResult,
  46 + @RequestParam(value = "deviceId", required = false) String deviceId
46 47 ) throws ThingsboardException {
47 48 Map<String, Object> queryMap = new HashMap<>();
48 49 queryMap.put(PAGE_SIZE, pageSize);
... ... @@ -63,6 +64,10 @@ public class TkInspectionRecordController extends BaseController {
63 64 queryMap.put("recordResult", recordResult);
64 65 }
65 66
  67 + if (recordResult != null) {
  68 + queryMap.put("deviceId", deviceId);
  69 + }
  70 +
66 71 checkTimeAndPut(queryMap, startTime, endTime);
67 72 return tkInspectionRecordService.page(queryMap, getCurrentUser().getCurrentTenantId());
68 73 }
... ...
... ... @@ -124,4 +124,19 @@ public class TkInspectionDetailsServiceImpl extends AbstractBaseService<TkInspec
124 124 lambda.eq(TkInspectionDetailsEntity::getInspectionRecordId, inspectionRecordId);
125 125 baseMapper.delete(wrapper);
126 126 }
  127 +
  128 + @Override
  129 + public List<String> getDeviceRetaInspectionRecordId(String deviceId) {
  130 + if (StringUtils.isBlank(deviceId)) {
  131 + return new ArrayList<>(0);
  132 + }
  133 +
  134 + QueryWrapper<TkInspectionDetailsEntity> wrapper = new QueryWrapper<>();
  135 + LambdaQueryWrapper<TkInspectionDetailsEntity> lambda = wrapper.lambda();
  136 + lambda.eq(TkInspectionDetailsEntity::getCheckDeviceId, deviceId);
  137 + List<TkInspectionDetailsEntity> tkInspectionDetailsEntityList = baseMapper.selectList(wrapper);
  138 + return CollectionUtils.emptyIfNull(tkInspectionDetailsEntityList).stream()
  139 + .map(TkInspectionDetailsEntity::getInspectionRecordId)
  140 + .collect(Collectors.toList());
  141 + }
127 142 }
... ...
... ... @@ -72,6 +72,16 @@ public class TkInspectionRecordServiceImpl extends AbstractBaseService<TkInspect
72 72 lambda.le(TkInspectionRecordEntity::getCheckDate, endTime);
73 73 }
74 74
  75 + if (queryMap != null && queryMap.get("deviceId") != null) {
  76 + String deviceId = queryMap.get("deviceId").toString();
  77 + List<String> inspectionRecordIdList = tkInspectionDetailsService.getDeviceRetaInspectionRecordId(deviceId);
  78 + if (CollectionUtils.isEmpty(inspectionRecordIdList)) {
  79 + return new TkPageData<>();
  80 + }
  81 +
  82 + lambda.in(TkInspectionRecordEntity::getId, inspectionRecordIdList);
  83 + }
  84 +
75 85 IPage<TkInspectionRecordEntity> page = baseMapper.selectPage(getPage(queryMap, "create_time", false),
76 86 wrapper);
77 87
... ...
... ... @@ -12,4 +12,6 @@ public interface TkInspectionDetailsService extends BaseService<TkInspectionDeta
12 12 List<TkInspectionDetailsDTO> listByInspectionRecordId(String inspectionRecordId);
13 13
14 14 void deleteByInspectionRecordId(String inspectionRecordId);
  15 +
  16 + List<String> getDeviceRetaInspectionRecordId(String deviceId);
15 17 }
... ...