Commit ecb1ffa0 authored by wujipeng's avatar wujipeng
Browse files

修复相关

parent 9fb61cd3
......@@ -6,8 +6,10 @@ import com.example.pipelinenetwork.mapper.BasicMapper;
import com.example.pipelinenetwork.pojo.dto.RoadDTO;
import com.example.pipelinenetwork.pojo.entity.BasicEntity;
import com.example.pipelinenetwork.pojo.entity.DefectEntity;
import com.example.pipelinenetwork.pojo.entity.RepairEntity;
import com.example.pipelinenetwork.service.BasicService;
import com.example.pipelinenetwork.service.DefectService;
import com.example.pipelinenetwork.service.RepairService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -26,6 +28,8 @@ public class BasicServiceImpl extends ServiceImpl<BasicMapper, BasicEntity> impl
@Resource
private DefectService defectService;
@Resource
private RepairService repairService;
@Override
public Map<String, Integer> roadDetail(RoadDTO roadDTO) {
......@@ -45,7 +49,17 @@ public class BasicServiceImpl extends ServiceImpl<BasicMapper, BasicEntity> impl
}
}
} else if ("修复".equals(roadDTO.getType())) {
List<RepairEntity> repairList = repairService.list(new LambdaQueryWrapper<RepairEntity>()
.in(RepairEntity::getRelId, relIds).eq(RepairEntity::getType, roadDTO.getDefectType())
.eq(RepairEntity::getLevel, roadDTO.getLev())
);
for (RepairEntity repairEntity : repairList) {
if (result.containsKey(repairEntity.getName())) {
result.put(repairEntity.getName(), result.get(repairEntity.getName()) + repairEntity.getNum());
} else {
result.put(repairEntity.getName(), repairEntity.getNum());
}
}
}
return result;
}
......@@ -78,7 +92,23 @@ public class BasicServiceImpl extends ServiceImpl<BasicMapper, BasicEntity> impl
}
});
} else if ("修复".equals(type)) {
List<RepairEntity> repairList = repairService.list();
Map<String, Integer> repairMap = new HashMap<>();
for (RepairEntity repairEntity : repairList) {
if (repairMap.containsKey(repairEntity.getRelId())) {
repairMap.put(repairEntity.getRelId(), repairMap.get(repairEntity.getRelId()) + repairEntity.getNum());
} else {
repairMap.put(repairEntity.getRelId(), repairEntity.getNum());
}
}
basicMap.forEach((key, value) -> {
if (repairMap.containsKey(key)) {
Integer i = repairMap.get(key);
result.put(value, i);
} else {
result.put(value, 0);
}
});
}
return result;
}
......
......@@ -6,11 +6,13 @@ import com.example.pipelinenetwork.mapper.RoadMapper;
import com.example.pipelinenetwork.pojo.dto.RoadDTO;
import com.example.pipelinenetwork.pojo.entity.BasicEntity;
import com.example.pipelinenetwork.pojo.entity.DefectEntity;
import com.example.pipelinenetwork.pojo.entity.RepairEntity;
import com.example.pipelinenetwork.pojo.entity.RoadEntity;
import com.example.pipelinenetwork.pojo.vo.RoadVO;
import com.example.pipelinenetwork.result.Result;
import com.example.pipelinenetwork.service.BasicService;
import com.example.pipelinenetwork.service.DefectService;
import com.example.pipelinenetwork.service.RepairService;
import com.example.pipelinenetwork.service.RoadService;
import com.example.pipelinenetwork.util.LinestringUtil;
import com.example.pipelinenetwork.util.NumberUtils;
......@@ -34,6 +36,8 @@ public class RoadServiceImpl extends ServiceImpl<RoadMapper, RoadEntity> impleme
private BasicService basicService;
@Resource
private DefectService defectService;
@Resource
private RepairService repairService;
@Override
public RoadVO match(Double lng, Double lat) {
......@@ -108,7 +112,24 @@ public class RoadServiceImpl extends ServiceImpl<RoadMapper, RoadEntity> impleme
}
}
} else if ("修复".equals(roadDTO.getType())) {
List<RepairEntity> repairList = repairService.list(new LambdaQueryWrapper<RepairEntity>()
.in(RepairEntity::getRelId, relIds).eq(RepairEntity::getLevel, roadDTO.getLev())
);
for (RepairEntity repairEntity : repairList) {
if ("结构性".equals(repairEntity.getType())) {
structuralDefect++;
} else if ("功能性".equals(repairEntity.getType())) {
functionalDefect++;
}
if(roadDTO.getDefectType().equals(repairEntity.getType())){
RoadVO roadVO = new RoadVO();
roadVO.setDefectType(repairEntity.getType());
roadVO.setDefectName(repairEntity.getName());
roadVO.setDefectNum(repairEntity.getNum());
roadVO.setDefectLev(repairEntity.getLevel());
data.add(roadVO);
}
}
}
result.setPipeNum(pipeNum);
result.setLength(length);
......
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