Browse Source

Merge branch 'develop' of http://192.168.11.14:51037/gitadmin/tuoheng_freeway into develop

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
c747de372f
1 changed files with 67 additions and 20 deletions
  1. +67
    -20
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java

+ 67
- 20
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java View File

} }
//工单子表获取对应的问题集合id //工单子表获取对应的问题集合id
List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());
List<InspectionFile> inspectionFilesList = inspectionFileMapper.selectBatchIds(inspectionFiledIds);
// List<InspectionFile> inspectionFilesList = inspectionFileMapper.selectBatchIds(inspectionFiledIds);
IPage<InspectionFile> IPageData = inspectionFileMapper.selectPage(page, new LambdaQueryWrapper<InspectionFile>()
.in(InspectionFile::getId, inspectionFiledIds));
//设置分页 //设置分页
IPage<InspectionFile> inspectionFilePageData = page.setRecords(inspectionFilesList);
IPage<WorkOrderHandleVo> result = inspectionFilePageData.convert(p -> {
WorkOrderHandleVo covert = Convert.convert(WorkOrderHandleVo.class, p);
//IPage<InspectionFile> inspectionFileIPage = page.setRecords(inspectionFilesList);
List<WorkOrderHandleVo> collect = IPageData.getRecords().stream().map(s -> {
WorkOrderHandleVo vo = new WorkOrderHandleVo();
//对象拷贝
BeanUtils.copyProperties(s,vo);
//缩略图处理 //缩略图处理
if (StringUtils.isNotEmpty(p.getFileThumbnail())) {
covert.setFileThumbnail(CommonConfig.imageURL + p.getFileThumbnail());
if (StringUtils.isNotEmpty(s.getFileThumbnail())) {
vo.setFileThumbnail(CommonConfig.imageURL + s.getFileThumbnail());
} }
if (StringUtils.isNotEmpty(p.getFileOriginal())) {
covert.setFileOriginal(CommonConfig.imageURL + p.getFileOriginal());
if (StringUtils.isNotEmpty(s.getFileOriginal())) {
vo.setFileOriginal(CommonConfig.imageURL + s.getFileOriginal());
} }
//任务名称 任务执行时间 道路位置编号 //任务名称 任务执行时间 道路位置编号
if (StringUtils.isEmpty(p.getInspectionId())) {
if (StringUtils.isEmpty(s.getInspectionId())) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
Inspection inspection = inspectionMapper.selectById(p.getInspectionId());
Inspection inspection = inspectionMapper.selectById(s.getInspectionId());
if (ObjectUtil.isNotNull(inspection)) { if (ObjectUtil.isNotNull(inspection)) {
covert.setName(inspection.getName());
covert.setExecutionStartTime(inspection.getExecutionStartTime());
vo.setName(inspection.getName());
vo.setExecutionStartTime(inspection.getExecutionStartTime());
RoadInformation roadInformation = roadInformationMapper.selectById(inspection.getRoadId()); RoadInformation roadInformation = roadInformationMapper.selectById(inspection.getRoadId());
if (null != roadInformation) { if (null != roadInformation) {
if (StringUtils.isEmpty(roadInformation.getCode())) { if (StringUtils.isEmpty(roadInformation.getCode())) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
covert.setCode(roadInformation.getCode());
vo.setCode(roadInformation.getCode());
} }

} }
//问题类型 //问题类型
if (StringUtils.isEmpty(p.getQuestionId())) {
if (StringUtils.isEmpty(s.getQuestionId())) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
QuestionType questionType = questionTypeMapper.selectById(p.getQuestionId());
QuestionType questionType = questionTypeMapper.selectById(s.getQuestionId());
if (ObjectUtil.isNotNull(questionType)) { if (ObjectUtil.isNotNull(questionType)) {
covert.setType(questionType.getName());
vo.setType(questionType.getName());
vo.setContent(s.getQuestionName());
} }
return covert;
return vo;


});


return JsonResult.success(result);
}).collect(Collectors.toList());
pageData.setRecords(collect);



// IPage<InspectionFile> inspectionFilePageData = page.setRecords(inspectionFilesList);
// IPage<WorkOrderHandleVo> result = inspectionFilePageData.convert(p -> {
// WorkOrderHandleVo covert = Convert.convert(WorkOrderHandleVo.class, p);
// //缩略图处理
// if (StringUtils.isNotEmpty(p.getFileThumbnail())) {
// covert.setFileThumbnail(CommonConfig.imageURL + p.getFileThumbnail());
// }
// if (StringUtils.isNotEmpty(p.getFileOriginal())) {
// covert.setFileOriginal(CommonConfig.imageURL + p.getFileOriginal());
// }
// //任务名称 任务执行时间 道路位置编号
// if (StringUtils.isEmpty(p.getInspectionId())) {
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
// }
// Inspection inspection = inspectionMapper.selectById(p.getInspectionId());
// if (ObjectUtil.isNotNull(inspection)) {
// covert.setName(inspection.getName());
// covert.setExecutionStartTime(inspection.getExecutionStartTime());
// RoadInformation roadInformation = roadInformationMapper.selectById(inspection.getRoadId());
// if (null != roadInformation) {
// if (StringUtils.isEmpty(roadInformation.getCode())) {
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
// }
// covert.setCode(roadInformation.getCode());
// }
//
// }
// //问题类型
// if (StringUtils.isEmpty(p.getQuestionId())) {
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
// }
// QuestionType questionType = questionTypeMapper.selectById(p.getQuestionId());
// if (ObjectUtil.isNotNull(questionType)) {
// covert.setType(questionType.getName());
// }
// return covert;
//
// });

return JsonResult.success(pageData);
} }


/** /**

Loading…
Cancel
Save