Commit 033c4d21 authored by wujipeng's avatar wujipeng
Browse files

道路详情优化

parent 9c56ffa8
......@@ -17,4 +17,6 @@ import java.util.List;
public interface DefectMapper extends BaseMapper<DefectEntity> {
List<DefectEntity> roadDetail(@Param("relIds") List<String> relIds, @Param("defectType") String defectType, @Param("lev") String lev);
List<DefectEntity> queryByRoadName(@Param("relIds") List<String> relIds, @Param("lev") String lev);
}
......@@ -18,4 +18,6 @@ public interface RepairMapper extends BaseMapper<RepairEntity> {
List<RepairEntity> roadDetail(@Param("relIds") List<String> relIds, @Param("defectType") String defectType, @Param("lev") String lev);
List<RepairEntity> queryByRoadName(@Param("relIds") List<String> relIds, @Param("lev") String lev);
}
......@@ -19,4 +19,6 @@ public interface DefectService extends IService<DefectEntity> {
List<DefectEntity> roadDetail(@Param("relIds") List<String> relIds, @Param("defectType") String defectType, @Param("lev") String lev);
List<DefectEntity> queryByRoadName(@Param("relIds") List<String> relIds, @Param("lev") String lev);
}
......@@ -19,4 +19,5 @@ public interface RepairService extends IService<RepairEntity> {
List<RepairEntity> roadDetail(List<String> relIds, String defectType, String lev);
List<RepairEntity> queryByRoadName(List<String> relIds, String lev);
}
......@@ -47,6 +47,11 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
return baseMapper.roadDetail(relIds, defectType, lev);
}
@Override
public List<DefectEntity> queryByRoadName(List<String> relIds, String lev) {
return baseMapper.queryByRoadName(relIds, lev);
}
/**
* 安全获取字符串单元格值
*/
......
......@@ -48,6 +48,11 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, RepairEntity> i
return baseMapper.roadDetail(relIds, defectType, lev);
}
@Override
public List<RepairEntity> queryByRoadName(List<String> relIds, String lev) {
return baseMapper.queryByRoadName(relIds, lev);
}
/**
* 安全获取字符串单元格值
*/
......
package com.example.pipelinenetwork.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.pipelinenetwork.mapper.RoadMapper;
......@@ -21,6 +22,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
......@@ -82,10 +84,10 @@ public class RoadServiceImpl extends ServiceImpl<RoadMapper, RoadEntity> impleme
List<String> relIds = new ArrayList<>();
for (BasicEntity basicEntity : list) {
relIds.add(basicEntity.getRelId());
if(basicEntity.getPipeNum() != null){
if (basicEntity.getPipeNum() != null) {
pipeNum += basicEntity.getPipeNum();
}
if(basicEntity.getDetectionLength() != null){
if (basicEntity.getDetectionLength() != null) {
length += basicEntity.getDetectionLength();
}
}
......@@ -93,16 +95,14 @@ public class RoadServiceImpl extends ServiceImpl<RoadMapper, RoadEntity> impleme
return Result.error("未找到该名称的路段");
}
if ("检测".equals(roadDTO.getType())) {
List<DefectEntity> defectList = defectService.list(new LambdaQueryWrapper<DefectEntity>()
.in(DefectEntity::getRelId, relIds).eq(DefectEntity::getLevel, roadDTO.getLev())
);
List<DefectEntity> defectList = defectService.queryByRoadName(relIds, roadDTO.getLev());
for (DefectEntity defectEntity : defectList) {
if ("结构性".equals(defectEntity.getType())) {
structuralDefect++;
} else if ("功能性".equals(defectEntity.getType())) {
functionalDefect++;
}
if(roadDTO.getDefectType().equals(defectEntity.getType())){
if (StrUtil.isNotEmpty(roadDTO.getDefectType()) && roadDTO.getDefectType().equals(defectEntity.getType())) {
RoadVO roadVO = new RoadVO();
roadVO.setDefectType(defectEntity.getType());
roadVO.setDefectName(defectEntity.getName());
......@@ -112,16 +112,14 @@ 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())
);
List<RepairEntity> repairList = repairService.queryByRoadName(relIds, roadDTO.getLev());
for (RepairEntity repairEntity : repairList) {
if ("结构性".equals(repairEntity.getType())) {
structuralDefect++;
} else if ("功能性".equals(repairEntity.getType())) {
functionalDefect++;
}
if(roadDTO.getDefectType().equals(repairEntity.getType())){
if (StrUtil.isNotEmpty(roadDTO.getDefectType()) && roadDTO.getDefectType().equals(repairEntity.getType())) {
RoadVO roadVO = new RoadVO();
roadVO.setDefectType(repairEntity.getType());
roadVO.setDefectName(repairEntity.getName());
......
......@@ -26,4 +26,24 @@
and level = #{lev}
</if>
</select>
<select id="queryByRoadName" resultType="com.example.pipelinenetwork.pojo.entity.DefectEntity">
select
id,
type,
name,
level,
num,
rel_id
from
defect
where
rel_id
in
<foreach item="item" index="index" collection="relIds" open="(" separator="," close=")">
#{item}
</foreach>
<if test="lev != null and lev != ''">
and level = #{lev}
</if>
</select>
</mapper>
......@@ -27,4 +27,24 @@
and level = #{lev}
</if>
</select>
<select id="queryByRoadName" resultType="com.example.pipelinenetwork.pojo.entity.RepairEntity">
select
id,
type,
name,
level,
num,
rel_id
from
repair
where
rel_id
in
<foreach item="item" index="index" collection="relIds" open="(" separator="," close=")">
#{item}
</foreach>
<if test="lev != null and lev != ''">
and level = #{lev}
</if>
</select>
</mapper>
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