Browse Source

新增任务问题处理查看接口

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
2b3d165ae5
7 changed files with 282 additions and 1 deletions
  1. +12
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +15
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileHandleConverMapper.java
  3. +49
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfilehandle/QueryInspectionFileHandleByInspectionFileIdCodeEnum.java
  4. +8
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java
  5. +16
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java
  6. +122
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/handle/QueryInspectionFileHandleByInspectionFileIdService.java
  7. +60
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileHandleVo.java

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

@@ -81,4 +81,16 @@ public class InspectionFileController {
return iInspectionFileService.ignore(idList);
}

/**
*
* 查看问题处理
*
* @param id
* @return
*/
@GetMapping("/handle/{id}")
public JsonResult getHandle(@PathVariable("id") String id) {
return iInspectionFileService.getHandle(id);
}

}

+ 15
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileHandleConverMapper.java View File

@@ -0,0 +1,15 @@
package com.tuoheng.admin.conver;

import com.tuoheng.admin.entity.InspectionFileHandle;
import com.tuoheng.admin.vo.InspectionFileHandleVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface InspectionFileHandleConverMapper {

InspectionFileHandleConverMapper INSTANCE = Mappers.getMapper(InspectionFileHandleConverMapper.class);

InspectionFileHandleVo fromInspectionFileHandleToInspectionFileHandleVo(InspectionFileHandle inspectionFileHandle);

}

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

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

/**
* 查询任务问题处理返回码
* 模块代码:25(问题管理)
* 接口代码:04 (查询任务问题处理)
*
* @author wanjing
* @team tuoheng
* @date 2022-12-06
*/
public enum QueryInspectionFileHandleByInspectionFileIdCodeEnum {

QUERY_IS_FAILED(1250400, "查询任务问题处理结果失败"),
INSPECTION_FILE_ID_IS_NULL(1250401, "任务问题id为空"),
INSPECTION_FILE_IS_NOT_EXIST(1250402, "任务问题不存在");

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

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

QueryInspectionFileHandleByInspectionFileIdCodeEnum(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;
}

}

+ 8
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java View File

@@ -52,5 +52,12 @@ public interface IInspectionFileService {
*/
JsonResult ignore(List<String> idList);


/**
*
* 获取任务问题处理结果
*
* @param id
* @return
*/
JsonResult getHandle(String id);
}

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

@@ -17,6 +17,7 @@ import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByIns
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
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.QueryInspectionFilePageListByInspectionIdService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListService;
@@ -74,6 +75,9 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
@Autowired
private InspectionFileConfirmService inspectionFileConfirmService;

@Autowired
private QueryInspectionFileHandleByInspectionFileIdService queryInspectionFileHandleByInspectionFileIdService;

/**
* 问题类型和任务名称
*
@@ -306,4 +310,16 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
public JsonResult ignore(List<String> idList) {
return inspectionFileIgnoreService.ignore(idList);
}

/**
*
* 获取任务问题处理结果
*
* @param id
* @return
*/
@Override
public JsonResult getHandle(String id) {
return queryInspectionFileHandleByInspectionFileIdService.handle(id);
}
}

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

@@ -0,0 +1,122 @@
package com.tuoheng.admin.service.inspectionfile.handle;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.InspectionFileHandleConverMapper;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.InspectionFileHandle;
import com.tuoheng.admin.entity.QuestionType;
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum;
import com.tuoheng.admin.enums.code.inspectionfilehandle.QueryInspectionFileHandleByInspectionFileIdCodeEnum;
import com.tuoheng.admin.mapper.InspectionFileHandleMapper;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.QuestionTypeMapper;
import com.tuoheng.admin.vo.InspectionFileHandleVo;
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.stream.Collectors;

/**
* 根据任务问题ID查询任务问题处理业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-06
*/
@Slf4j
@Service
public class QueryInspectionFileHandleByInspectionFileIdService {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private InspectionFileHandleMapper inspectionFileHandleMapper;

@Autowired
private QuestionTypeMapper questionTypeMapper;

public JsonResult handle(String id) {
log.info("进入根据任务问题ID查询任务问题处理业务, id:{}", id);
JsonResult result = this.check(id);
if (0 != result.getCode()) {
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);
}

/**
* 检查参数
*
* @param id
* @return
*/
private JsonResult check(String id) {
// 判断任务问题id是否为空
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)
.eq(InspectionFile::getMark, 1));

if (null == inspectionFile) {
return JsonResult.error(QueryInspectionFileHandleByInspectionFileIdCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getCode(), QueryInspectionFileHandleByInspectionFileIdCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(inspectionFile);
}

/**
* 处理字段
*/
private InspectionFileHandleVo buildInspectionFileHandleVo(InspectionFile inspectionFile, InspectionFileHandle inspectionFileHandle) {
InspectionFileHandleVo inspectionFileHandleVo = InspectionFileHandleConverMapper.INSTANCE.fromInspectionFileHandleToInspectionFileHandleVo(inspectionFileHandle);
List<String> handlerImageList = null;
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);
}

}
QuestionType questionType = questionTypeMapper.selectOne(new LambdaQueryWrapper<QuestionType>()
.eq(QuestionType::getId, inspectionFile.getQuestionId())
.eq(QuestionType::getMark, 1));
if (null != questionType) {
inspectionFileHandleVo.setQuestionName(questionType.getName());
inspectionFileHandleVo.setQuestionContent(questionType.getContent());
}
inspectionFileHandleVo.setQuestionId(inspectionFile.getQuestionId());
inspectionFileHandleVo.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());
inspectionFileHandleVo.setHandlerImageList(handlerImageList);
return inspectionFileHandleVo;
}


}

+ 60
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileHandleVo.java View File

@@ -0,0 +1,60 @@
package com.tuoheng.admin.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
* 任务问题处理返回实体类
*
* @author wanjing
* @team tuoheng
* @date 2022-12-06
*/
@Data
public class InspectionFileHandleVo {

/**
* 问题类型:1坑槽,2积水,3裂缝
*/
private String questionId;

/**
* 问题名称:1坑槽,2积水,3裂缝
*/
private Integer questionName;

/**
* 问题内容
*/
private String questionContent;

/**
* 缩略图
*/
private String fileThumbnail;

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

/**
* 处理后图片列表
*/
private List<String> handlerImageList;

/**
* 处理结果
*/
private String handlerResult;

/**
* 处理完成时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date handlerTime;

}

Loading…
Cancel
Save