Commit af162784 authored by zhangsen's avatar zhangsen

任务23724 :消防巡检列表API优化

parent ff3abd7b
...@@ -190,24 +190,26 @@ public class CheckServiceImpl implements ICheckService { ...@@ -190,24 +190,26 @@ public class CheckServiceImpl implements ICheckService {
return new PageImpl<>(content, param, total); return new PageImpl<>(content, param, total);
} }
content = checkMapper.getPeopleCheckPage(param); content = checkMapper.getPeopleCheckPage(param);
String checkIds = String.join(",", content.stream().map(CheckInfoVo::getId).collect(Collectors.toList()));
FeignClientResult responseModel = new FeignClientResult();
List<Map<String, String>> result = new ArrayList();
try {
responseModel = idxFeign.queryDefectByCodes(new ArrayList<>(), checkIds);
result = (List) responseModel.getResult();
} catch (Exception e) {
e.printStackTrace();
}
Map<String, Map<String, String>> checkIdMap = new HashMap<>();
if (result != null && 0 < result.size()) {
checkIdMap = result.stream().collect(Collectors.toMap(t -> t.get("checkId"), t -> t, (k1, k2) -> k2));
}
for (CheckInfoVo infoVo : content) { for (CheckInfoVo infoVo : content) {
FeignClientResult responseModel = new FeignClientResult(); if (!ObjectUtils.isEmpty(checkIdMap) && checkIdMap.containsKey(infoVo.getId()) && !ObjectUtils.isEmpty(checkIdMap.get(infoVo.getId()))) {
List result = new ArrayList(); Map<String, String> map = checkIdMap.get(infoVo.getId());
try { DefectVo vo = JSON.parseObject(JSON.toJSONString(map), DefectVo.class);
responseModel = idxFeign.queryDefectByCodes(new ArrayList<>(), infoVo.getId()); infoVo.setError(vo.getDefectDescribe());
result = (List) responseModel.getResult(); infoVo.setProblemNum(vo.getDefectNum());
} catch (Exception e) { infoVo.setHandleStatus(String.valueOf(vo.getDefectStatus()));
e.printStackTrace();
}
List<DefectVo> res = new ArrayList();
if (result != null && 0 < result.size()) {
for(Object object : result) {
DefectVo vo = JSON.parseObject(JSON.toJSONString(object), DefectVo.class);
res.add(vo);
}
infoVo.setError(ObjectUtils.isEmpty(res.get(0)) ? "" : res.get(0).getDefectDescribe());
infoVo.setProblemNum(ObjectUtils.isEmpty(res.get(0)) ? "" : res.get(0).getDefectNum());
infoVo.setHandleStatus(ObjectUtils.isEmpty(res.get(0)) ? "" : String.valueOf(res.get(0).getDefectStatus()));
} }
} }
return new PageImpl<>(content, param, total); return new PageImpl<>(content, param, total);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment