Bladeren bron

重构优化查询工单详情列表代码

tags/v1.0.0^2
wanjing 1 jaar geleden
bovenliggende
commit
e848825e42
1 gewijzigde bestanden met toevoegingen van 28 en 17 verwijderingen
  1. +28
    -17
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java

+ 28
- 17
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java Bestand weergeven

@@ -1,6 +1,7 @@
package com.tuoheng.admin.service.inspectionfile.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -160,26 +161,30 @@ public class QueryInspectionFilePageListByWorkOrderIdService {
inspectionFileHandleVo.setQuestionContent(questionType.getContent());
}

inspectionFileHandle = inspectionFileHandleMap.get(inspectionFile.getId());
if (null != inspectionFileHandle) {
if (!StringUtils.isEmpty(inspectionFileHandle.getHandlerImage())) {
handlerImageList = new ArrayList<>();
String[] arr = inspectionFileHandle.getHandlerImage().split(",");
List<String> list = Arrays.stream(arr).map(String::toString).collect(Collectors.toList());
for (String str : list) {
handlerImageList.add(CommonConfig.imageURL + str);
if (ObjectUtil.isNotNull(inspectionFileHandleMap)) {
inspectionFileHandle = inspectionFileHandleMap.get(inspectionFile.getId());
if (null != inspectionFileHandle) {
if (!StringUtils.isEmpty(inspectionFileHandle.getHandlerImage())) {
handlerImageList = new ArrayList<>();
String[] arr = inspectionFileHandle.getHandlerImage().split(",");
List<String> list = Arrays.stream(arr).map(String::toString).collect(Collectors.toList());
for (String str : list) {
handlerImageList.add(CommonConfig.imageURL + str);
}
}
}

user = inspectionFileHandleUserMap.get(inspectionFileHandle.getHandlerUser());
if (null != user) {
inspectionFileHandleVo.setHandlerUsername(user.getRealname());
}
if (ObjectUtil.isNotNull(inspectionFileHandleUserMap)) {
user = inspectionFileHandleUserMap.get(inspectionFileHandle.getHandlerUser());
if (null != user) {
inspectionFileHandleVo.setHandlerUsername(user.getRealname());
}

inspectionFileHandleVo.setHandlerUser(inspectionFileHandle.getHandlerUser());
inspectionFileHandleVo.setHandlerImageList(handlerImageList);
inspectionFileHandleVo.setHandlerTime(inspectionFileHandle.getHandlerTime());
inspectionFileHandleVo.setHandlerResult(inspectionFileHandle.getHandlerResult());
inspectionFileHandleVo.setHandlerUser(inspectionFileHandle.getHandlerUser());
inspectionFileHandleVo.setHandlerImageList(handlerImageList);
inspectionFileHandleVo.setHandlerTime(inspectionFileHandle.getHandlerTime());
inspectionFileHandleVo.setHandlerResult(inspectionFileHandle.getHandlerResult());
}
}
}
inspectionFileHandleVoList.add(inspectionFileHandleVo);
}
@@ -217,11 +222,17 @@ public class QueryInspectionFilePageListByWorkOrderIdService {
}

private Map<String, InspectionFileHandle> getInspectionFileHandleMap(List<InspectionFileHandle> inspectionFileHandleList) {
if (CollectionUtil.isEmpty(inspectionFileHandleList)) {
return null;
}
Map<String, InspectionFileHandle> inspectionFileHandleMap = inspectionFileHandleList.stream().collect(Collectors.toMap(InspectionFileHandle::getId, Function.identity()));
return inspectionFileHandleMap;
}

private Map<String, User> getInspectionFileHandleUserMap(List<InspectionFileHandle> inspectionFileHandleList) {
if (CollectionUtil.isEmpty(inspectionFileHandleList)) {
return null;
}
List<String> userIdList = inspectionFileHandleList.stream().map(o -> o.getHandlerUser()).collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getId, userIdList)

Laden…
Annuleren
Opslaan