Commit 65ece192 authored by wujipeng's avatar wujipeng
Browse files

各路段检测修复汇总

parent a75d1380
......@@ -37,7 +37,7 @@ public class RoadController {
* 详情查询
*/
@PostMapping("/detail")
public Result<Map<String,Integer>> roadDetail(@RequestBody RoadDTO roadDTO) {
public Result<Map<String, Integer>> roadDetail(@RequestBody RoadDTO roadDTO) {
return Result.success(roadService.roadDetail(roadDTO));
}
......@@ -49,5 +49,11 @@ public class RoadController {
return Result.success(roadService.queryByRoadName(roadDTO));
}
/**
* 各路段检测修复汇总
*/
@GetMapping("/road/summary")
public Result<Map<String, Integer>> roadSummary(@RequestParam(name = "type") String type) {
return Result.success(roadService.roadSummary(type));
}
}
\ No newline at end of file
......@@ -25,4 +25,6 @@ public interface RoadService extends IService<RoadEntity> {
RoadVO queryByRoadName(RoadDTO roadDTO);
Map<String, Integer> roadSummary(String type);
}
......@@ -127,6 +127,36 @@ public class RoadServiceImpl extends ServiceImpl<RoadMapper, RoadEntity> impleme
return result;
}
@Override
public Map<String, Integer> roadSummary(String type) {
Map<String, Integer> result = new HashMap<>();
//获取基础信息
List<BasicEntity> basicList = basicService.list();
for (BasicEntity basicEntity : basicList) {
result.put(basicEntity.getRoadName(), 0);
}
if ("检测".equals(type)) {
List<DefectEntity> defectList = defectService.list();
Map<String, Integer> defectMap = new HashMap<>();
for (DefectEntity defectEntity : defectList) {
if (defectMap.containsKey(defectEntity.getRelId())) {
defectMap.put(defectEntity.getRelId(), defectMap.get(defectEntity.getRelId()) + defectEntity.getNum());
} else {
defectMap.put(defectEntity.getRelId(), defectEntity.getNum());
}
}
result.forEach((key, value) -> {
if(defectMap.containsKey(key)){
Integer i = defectMap.get(key);
result.put(key, i);
}
});
} else if ("修复".equals(type)) {
}
return result;
}
/**
* 解析Excel并生成SQL语句(不执行)
*/
......
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