|
|
@@ -5,13 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.tuoheng.admin.conver.InspectionFileConverMapper; |
|
|
|
import com.tuoheng.admin.conver.ReportConverMapper; |
|
|
|
import com.tuoheng.admin.entity.InspectionFile; |
|
|
|
import com.tuoheng.admin.entity.InspectionFileHandle; |
|
|
|
import com.tuoheng.admin.entity.Report; |
|
|
|
import com.tuoheng.admin.entity.*; |
|
|
|
import com.tuoheng.admin.enums.code.report.QueryInspectionReportCodeEnum; |
|
|
|
import com.tuoheng.admin.mapper.InspectionFileHandleMapper; |
|
|
|
import com.tuoheng.admin.mapper.InspectionFileMapper; |
|
|
|
import com.tuoheng.admin.mapper.ReportMapper; |
|
|
|
import com.tuoheng.admin.mapper.UserMapper; |
|
|
|
import com.tuoheng.admin.utils.CurrentUserUtil; |
|
|
|
import com.tuoheng.admin.vo.inspection.InspectionFileHandleReportVo; |
|
|
|
import com.tuoheng.admin.vo.inspection.InspectionFileReportVo; |
|
|
@@ -41,6 +40,9 @@ import java.util.stream.Collectors; |
|
|
|
@Service |
|
|
|
public class QueryInspectionHandleReportService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private UserMapper userMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ReportMapper reportMapper; |
|
|
|
|
|
|
@@ -101,7 +103,9 @@ public class QueryInspectionHandleReportService { |
|
|
|
|
|
|
|
List<InspectionFileReportVo> inspectionFileHandleVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFileHandleVoList(inspectionFileList); |
|
|
|
|
|
|
|
Map<String, InspectionFileHandle> inspectionFileHandleMap = this.getInspectionFileHandleMap(inspectionFileList); |
|
|
|
List<InspectionFileHandle> inspectionFileHandleList = this.getInspectionFileHandleList(inspectionFileList); |
|
|
|
Map<String, InspectionFileHandle> inspectionFileHandleMap = this.getInspectionFileHandleMap(inspectionFileHandleList); |
|
|
|
Map<String, User> userMap = this.getUserMap(inspectionFileHandleList); |
|
|
|
if (null != inspectionFileHandleMap) { |
|
|
|
InspectionFileHandle inspectionFileHandle; |
|
|
|
InspectionFileHandleReportVo inspectionFileHandleReportVo; |
|
|
@@ -118,7 +122,10 @@ public class QueryInspectionHandleReportService { |
|
|
|
handlerImageList.add(CommonConfig.imageURL + str); |
|
|
|
} |
|
|
|
inspectionFileHandleReportVo = new InspectionFileHandleReportVo(); |
|
|
|
inspectionFileHandleReportVo.setHandlerUser(inspectionFileHandle.getHandlerUser()); |
|
|
|
User user = userMap.get(inspectionFileHandle.getHandlerUser()); |
|
|
|
if (null != user) { |
|
|
|
inspectionFileHandleReportVo.setHandlerUser(user.getRealname()); |
|
|
|
} |
|
|
|
inspectionFileHandleReportVo.setHandlerResult(inspectionFileHandle.getHandlerResult()); |
|
|
|
inspectionFileHandleReportVo.setHandlerTime(inspectionFileHandle.getHandlerTime()); |
|
|
|
inspectionFileHandleReportVo.setHandlerImageList(handlerImageList); |
|
|
@@ -131,7 +138,7 @@ public class QueryInspectionHandleReportService { |
|
|
|
return inspectionReportVo; |
|
|
|
} |
|
|
|
|
|
|
|
private Map<String, InspectionFileHandle> getInspectionFileHandleMap(List<InspectionFile> inspectionFileList) { |
|
|
|
private List<InspectionFileHandle> getInspectionFileHandleList(List<InspectionFile> inspectionFileList) { |
|
|
|
List<String> inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList()); |
|
|
|
List<InspectionFileHandle> inspectionFileHandleList = null; |
|
|
|
if (!CollectionUtil.isEmpty(inspectionFileIdList)) { |
|
|
@@ -143,7 +150,29 @@ public class QueryInspectionHandleReportService { |
|
|
|
if (CollectionUtil.isEmpty(inspectionFileIdList)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
return inspectionFileHandleList; |
|
|
|
} |
|
|
|
|
|
|
|
private Map<String, InspectionFileHandle> getInspectionFileHandleMap(List<InspectionFileHandle> inspectionFileHandleList) { |
|
|
|
if (CollectionUtil.isEmpty(inspectionFileHandleList)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
Map<String, InspectionFileHandle> inspectionFileHandleMap = inspectionFileHandleList.stream().collect(Collectors.toMap(InspectionFileHandle::getInspectionFileId, Function.identity())); |
|
|
|
return inspectionFileHandleMap; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取用户列表,放到map,减少循环次数 |
|
|
|
* |
|
|
|
* @param inspectionFileHandleList |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private Map<String, User> getUserMap(List<InspectionFileHandle> inspectionFileHandleList) { |
|
|
|
List<String> userIdList = inspectionFileHandleList.stream().map(o -> o.getHandlerUser()).collect(Collectors.toList()); |
|
|
|
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>() |
|
|
|
.in(User::getId, userIdList) |
|
|
|
.eq(User::getMark, 1)); |
|
|
|
Map<String, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity())); |
|
|
|
return userMap; |
|
|
|
} |
|
|
|
} |