Browse Source

Merge branch 'wanjing' into develop

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
da7fe7f47e
11 changed files with 376 additions and 11 deletions
  1. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFileHandle.java
  3. +49
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfile/QueryInspectionFilePageListByWorkOrderIdCodeEnum.java
  4. +23
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileWorkOrderPageListRequest.java
  5. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java
  6. +17
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java
  7. +0
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/handle/QueryInspectionFileHandleByInspectionFileIdService.java
  8. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java
  9. +237
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java
  10. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileDistributionListVo.java
  11. +26
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileHandleVo.java

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java View File

@@ -4,6 +4,7 @@ import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileWorkOrderPageListRequest;
import com.tuoheng.admin.service.IInspectionFileService;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
@@ -102,4 +103,14 @@ public class InspectionFileController {
public JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request){
return iInspectionFileService.getDistributionList(request);
}

/**
* 查询工单问题列表
*
* @return
*/
@GetMapping("/page/list/workorker")
public JsonResult getListByWorkOrderId(QueryInspectionFileWorkOrderPageListRequest request){
return iInspectionFileService.getPageListByWorkOrderId(request);
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFileHandle.java View File

@@ -35,7 +35,7 @@ public class InspectionFileHandle extends BaseEntity {
private String inspectionFileId;
/**
* 处理人
* 处理人ID
*/
private String handlerUser;

+ 49
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfile/QueryInspectionFilePageListByWorkOrderIdCodeEnum.java View File

@@ -0,0 +1,49 @@
package com.tuoheng.admin.enums.code.inspectionfile;

/**
* 根据工单ID查询巡检任务问题分页列表返回码
* 模块代码:24(问题管理)
* 接口代码:07 (根据工单ID查询巡检任务问题分页列表)
*
* @author wanjing
* @team tuoheng
* @date 2022-12-01
*/
public enum QueryInspectionFilePageListByWorkOrderIdCodeEnum {

QUERY_IS_FAILED(1240700, "获取数据失败"),
WORK_ORDER_ID_IS_NULL(1240701, "工单id为空"),
WORK_ORDER_IS_NOT_EXIST(1240702, "工单不存在");

/**
* 错误码
*/
private int code;

/**
* 错误信息
*/
private String msg;

QueryInspectionFilePageListByWorkOrderIdCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}

+ 23
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileWorkOrderPageListRequest.java View File

@@ -0,0 +1,23 @@
package com.tuoheng.admin.request.inspectionfile;

import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

import java.util.List;

/**
* 根据工单ID查询任务问题分页列表请求实体
*
* @author wanjing
* @team tuoheng
* @date 2022-12-09
*/
@Data
public class QueryInspectionFileWorkOrderPageListRequest extends BaseQuery {

/**
* 工单ID
*/
private String workOrderId;

}

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java View File

@@ -4,6 +4,7 @@ import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileWorkOrderPageListRequest;
import com.tuoheng.common.core.utils.JsonResult;

import java.util.List;
@@ -70,4 +71,13 @@ public interface IInspectionFileService {
* @return
*/
JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request);

/**
*
* 根据工单ID查询工单问题列表
*
* @param request
* @return
*/
JsonResult getPageListByWorkOrderId(QueryInspectionFileWorkOrderPageListRequest request);
}

+ 17
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java View File

@@ -16,12 +16,14 @@ import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileWorkOrderPageListRequest;
import com.tuoheng.admin.service.IInspectionFileService;
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService;
import com.tuoheng.admin.service.inspectionfile.handle.QueryInspectionFileHandleByInspectionFileIdService;
import com.tuoheng.admin.service.inspectionfile.ignore.InspectionFileIgnoreService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFileDistributionListService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByInspectionIdService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByWorkOrderIdService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListService;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.InspectionFileVo;
@@ -83,6 +85,9 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
@Autowired
private QueryInspectionFileDistributionListService queryInspectionFileDistributionListService;

@Autowired
private QueryInspectionFilePageListByWorkOrderIdService queryInspectionFilePageListByWorkOrderIdService;

/**
* 问题类型和任务名称
*
@@ -339,4 +344,16 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
public JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request) {
return queryInspectionFileDistributionListService.getList(request);
}

/**
*
* 根据工单ID查询工单问题列表
*
* @param request
* @return
*/
@Override
public JsonResult getPageListByWorkOrderId(QueryInspectionFileWorkOrderPageListRequest request) {
return queryInspectionFilePageListByWorkOrderIdService.getPageList(request);
}
}

+ 0
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/handle/QueryInspectionFileHandleByInspectionFileIdService.java View File

@@ -54,14 +54,12 @@ public class QueryInspectionFileHandleByInspectionFileIdService {
log.info("进入根据任务ID查询巡检任务问题分页列表业务:校验失败:{}", result.getMsg());
return result;
}

InspectionFile inspectionFile = (InspectionFile) result.getData();

InspectionFileHandle inspectionFileHandle = inspectionFileHandleMapper.selectOne(new LambdaQueryWrapper<InspectionFileHandle>()
.eq(InspectionFileHandle::getInspectionFileId, id)
.eq(InspectionFileHandle::getMark, 1));


InspectionFileHandleVo inspectionFileHandleVo = buildInspectionFileHandleVo(inspectionFile, inspectionFileHandle);

return JsonResult.success(inspectionFileHandleVo);
@@ -78,7 +76,6 @@ public class QueryInspectionFileHandleByInspectionFileIdService {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(QueryInspectionFileHandleByInspectionFileIdCodeEnum.INSPECTION_FILE_ID_IS_NULL.getCode(), QueryInspectionFileHandleByInspectionFileIdCodeEnum.INSPECTION_FILE_ID_IS_NULL.getMsg());
}

// 判断任务是否存在
InspectionFile inspectionFile = inspectionFileMapper.selectOne(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getId, id)
@@ -106,12 +103,10 @@ public class QueryInspectionFileHandleByInspectionFileIdService {
for (String str : list) {
handlerImageList.add(CommonConfig.imageURL + str);
}

}
} else {
inspectionFileHandleVo = new InspectionFileHandleVo();
}

QuestionType questionType = questionTypeMapper.selectOne(new LambdaQueryWrapper<QuestionType>()
.eq(QuestionType::getId, inspectionFile.getQuestionId())
.eq(QuestionType::getMark, 1));
@@ -124,6 +119,4 @@ public class QueryInspectionFileHandleByInspectionFileIdService {
inspectionFileHandleVo.setHandlerImageList(handlerImageList);
return inspectionFileHandleVo;
}


}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java View File

@@ -128,7 +128,7 @@ public class QueryInspectionFileDistributionListService {
for (InspectionFileDistributionListVo inspectionFileDistributionListVo : inspectionFileDistributionListVoList) {
questionType = questionTypeMap.get(inspectionFileDistributionListVo.getQuestionId());
if (null != questionType) {
inspectionFileDistributionListVo.setQuestionName(Integer.toString(questionType.getName()));
inspectionFileDistributionListVo.setQuestionName(questionType.getName());
inspectionFileDistributionListVo.setQuestionContent(questionType.getContent());
}
inspectionFileDistributionListVo.setFileThumbnail(CommonConfig.imageURL + inspectionFileDistributionListVo.getFileThumbnail());

+ 237
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java View File

@@ -0,0 +1,237 @@
package com.tuoheng.admin.service.inspectionfile.query;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.InspectionFileConverMapper;
import com.tuoheng.admin.conver.InspectionFileHandleConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.UserTypeEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByWorkOrderIdCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileWorkOrderPageListRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.InspectionFileDistributionListVo;
import com.tuoheng.admin.vo.InspectionFileHandleVo;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* 根据工单ID查询工单问题列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-08
*/
@Slf4j
@Service
public class QueryInspectionFilePageListByWorkOrderIdService {

@Autowired
private UserMapper userMapper;
@Autowired
private DeptMapper deptMapper;

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private InspectionFileHandleMapper inspectionFileHandleMapper;

@Autowired
private QuestionTypeMapper questionTypeMapper;

@Autowired
private WorkOrderMapper workOrderMapper;

@Autowired
private WorkOrderFileMapper workOrderFileMapper;

public JsonResult getPageList(QueryInspectionFileWorkOrderPageListRequest request) {
log.info("进入根据工单ID查询工单问题列表表业务, workOrderId:{}", request.getWorkOrderId());

String userId = ShiroUtils.getUserId();

JsonResult result = this.check(request.getWorkOrderId());
if (0 != result.getCode()) {
log.info("根据工单ID查询工单问题列表业务:校验失败:{}", result.getMsg());
return result;
}

// 设置分页参数
IPage<WorkOrderFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<WorkOrderFile> pageData = workOrderFileMapper.selectPage(page, new LambdaQueryWrapper<WorkOrderFile>()
.eq(WorkOrderFile::getWorkOrderId, request.getWorkOrderId()));

if (null == pageData || pageData.getTotal() == 0) {
log.info("根据工单ID查询工单问题列表业务:获取任务分页列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
}

List<WorkOrderFile> workOrderFileList = pageData.getRecords();

List<String> inspectionFileIdList = workOrderFileList.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());

List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.in(InspectionFile::getId, inspectionFileIdList)
.eq(InspectionFile::getMark, 1));

// 构造返回结果对象
List<InspectionFileHandleVo> inspectionFileHandleVoList = this.buildInspectionFileHandleVoList(inspectionFileIdList, inspectionFileList);

// 重写返回结果对象
IPage<InspectionFileHandleVo> inspectionFilePageListVoPageData = new Page<>();
inspectionFilePageListVoPageData.setPages(pageData.getPages());
inspectionFilePageListVoPageData.setCurrent(pageData.getCurrent());
inspectionFilePageListVoPageData.setSize(pageData.getSize());
inspectionFilePageListVoPageData.setTotal(pageData.getTotal());
inspectionFilePageListVoPageData.setRecords(inspectionFileHandleVoList);

return JsonResult.success(inspectionFilePageListVoPageData);
}

/**
* 检查参数
*
* @param workOrderId
* @return
*/
private JsonResult check(String workOrderId) {
if (StringUtils.isEmpty(workOrderId)) {
return JsonResult.error(QueryInspectionFilePageListByWorkOrderIdCodeEnum.WORK_ORDER_ID_IS_NULL.getCode(), QueryInspectionFilePageListByWorkOrderIdCodeEnum.WORK_ORDER_ID_IS_NULL.getMsg());
}
WorkOrder workOrder = workOrderMapper.selectOne( new LambdaQueryWrapper<WorkOrder>()
.eq(WorkOrder::getId, workOrderId)
.eq(WorkOrder::getMark, 1));
if (null == workOrder) {
return JsonResult.error(QueryInspectionFilePageListByWorkOrderIdCodeEnum.WORK_ORDER_IS_NOT_EXIST.getCode(), QueryInspectionFilePageListByWorkOrderIdCodeEnum.WORK_ORDER_IS_NOT_EXIST.getMsg());
}
return JsonResult.success();
}

/**
* 1)、设置问题类型字段
* 2)、设置缩略图字段
*
* @param inspectionFileIdList
* @param inspectionFileList
*
* @return
*/
private List<InspectionFileHandleVo> buildInspectionFileHandleVoList(List<String> inspectionFileIdList, List<InspectionFile> inspectionFileList) {
Map<String, QuestionType> questionTypeMap = this.getQuestionTypeMap();
List<InspectionFileHandle> inspectionFileHandleList = this.getInspectionFileHandleList(inspectionFileIdList);
Map<String, InspectionFileHandle> inspectionFileHandleMap = this.getInspectionFileHandleMap(inspectionFileHandleList);
Map<String, User> inspectionFileHandleUserMap = this.getInspectionFileHandleUserMap(inspectionFileHandleList);

List<InspectionFileHandleVo> inspectionFileHandleVoList = new ArrayList<>();
InspectionFileHandleVo inspectionFileHandleVo;
User user;
QuestionType questionType;
List<String> handlerImageList = null;
InspectionFileHandle inspectionFileHandle;
for (InspectionFile inspectionFile : inspectionFileList) {
inspectionFileHandleVo = new InspectionFileHandleVo();
inspectionFileHandleVo.setStatus(inspectionFile.getStatus());
inspectionFileHandleVo.setLatitude(inspectionFile.getLatitude());
inspectionFileHandleVo.setLongitude(inspectionFile.getLongitude());
inspectionFileHandleVo.setLocation(inspectionFile.getLocation());
inspectionFileHandleVo.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());

questionType = questionTypeMap.get(inspectionFile.getQuestionId());
if (null != questionType) {
inspectionFileHandleVo.setQuestionId(questionType.getId());
inspectionFileHandleVo.setQuestionName(questionType.getName());
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);
}
}

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());
}
inspectionFileHandleVoList.add(inspectionFileHandleVo);
}
return inspectionFileHandleVoList;
}

/**
*
* 获取问题类型列表,放到map,减少循环次数
*
* @return
*/
private Map<String, QuestionType> getQuestionTypeMap() {
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>()
.eq(QuestionType::getMark, 1));
Map<String, QuestionType> questionTypeMap = questionTypeList.stream().collect(Collectors.toMap(QuestionType::getId, Function.identity()));
return questionTypeMap;
}

/**
*
* 获取问题处理结果
*
* @param inspectionFileIdList
* @return
*/
private List<InspectionFileHandle> getInspectionFileHandleList(List<String> inspectionFileIdList) {
List<InspectionFileHandle> inspectionFileHandleList = inspectionFileHandleMapper.selectList(new LambdaQueryWrapper<InspectionFileHandle>()
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList));

if (CollectionUtil.isEmpty(inspectionFileHandleList)) {
return null;
}
return inspectionFileHandleList;
}

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

private Map<String, User> getInspectionFileHandleUserMap(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;
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileDistributionListVo.java View File

@@ -28,7 +28,7 @@ public class InspectionFileDistributionListVo {
/**
* 问题名称:1坑槽,2积水,3裂缝
*/
private String questionName;
private Integer questionName;

/**
* 问题内容

+ 26
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileHandleVo.java View File

@@ -37,10 +37,15 @@ public class InspectionFileHandleVo {
private String fileThumbnail;

/**
* 处理人
* 处理人ID
*/
private String handlerUser;

/**
* 处理人姓名
*/
private String handlerUsername;

/**
* 处理后图片列表
*/
@@ -57,4 +62,24 @@ public class InspectionFileHandleVo {
@JsonFormat(pattern = "yyyy-MM-dd")
private Date handlerTime;

/**
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理
*/
private Integer status;

/**
* 纬度(原始图片纬度)
*/
private String latitude;

/**
* 经度(原始图片经度)
*/
private String longitude;

/**
* 位置信息
*/
private String location;

}

Loading…
Cancel
Save