Selaa lähdekoodia

新增处理任务问题接口

tags/v1.0.0^2
wanjing 1 vuosi sitten
vanhempi
commit
5cffb72297
9 muutettua tiedostoa jossa 344 lisäystä ja 11 poistoa
  1. +37
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileHandleController.java
  2. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/WorkOrderStatusEnum.java
  3. +51
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfilehandle/InspectionFileProcessingCodeEnum.java
  4. +34
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/InspectionFileProcessingRresultRequest.java
  5. +10
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java
  6. +17
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java
  7. +180
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/processing/InspectionFileProcessingService.java
  8. +4
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java
  9. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileHandleVo.java

+ 37
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileHandleController.java Näytä tiedosto

@@ -0,0 +1,37 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.request.inspectionfile.InspectionFileProcessingRresultRequest;
import com.tuoheng.admin.service.IInspectionFileService;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* 巡检问题处理结果前端控制器
*
* @author wanjing
* @team tuoheng
* @date 2022-11-16
*/
@RestController
@RequestMapping("/inspectionfile/handle")
public class InspectionFileHandleController {

@Autowired
private IInspectionFileService iInspectionFileService;

/**
* 处理结果
*
* @param request
* @return
*/
@PostMapping("/processing")
public JsonResult processing(@RequestBody InspectionFileProcessingRresultRequest request){
return iInspectionFileService.processing(request);
}

}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/WorkOrderStatusEnum.java Näytä tiedosto

@@ -13,7 +13,7 @@ public enum WorkOrderStatusEnum {

WAIT(5,"待分配"),
PROCESSING(10,"处理中(已分配)"),
COMPLETED(13,"已完成");
COMPLETED(15,"已完成");

WorkOrderStatusEnum(int code, String description){
this.code = code;

+ 51
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfilehandle/InspectionFileProcessingCodeEnum.java Näytä tiedosto

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

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

PROCESSINGIS_FAILED(1250100, "处理失败"),
WORK_ORDER_ID_IS_NULL(1250101, "工单id为空"),
WORK_ORDER_IS_NOT_EXIST(1250102, "工单不存在"),
INSPECTION_FILE_ID_IS_NULL(1250103, "任务问题id为空"),
INSPECTION_FILE_IS_NOT_EXIST(1250104, "任务问题不存在");

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

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

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

}

+ 34
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/InspectionFileProcessingRresultRequest.java Näytä tiedosto

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

import lombok.Data;

/**
* 处理任务问题结果请求实体
*
* @author wanjing
* @team tuoheng
* @date 2022-12-09
*/
@Data
public class InspectionFileProcessingRresultRequest {

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

/**
* 巡检问题文件ID
*/
private String inspectionFileId;

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

/**
* 处理后图片(多个图片逗号“,”分隔)
*/
private String handlerImage;
}

+ 10
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java Näytä tiedosto

@@ -1,10 +1,7 @@
package com.tuoheng.admin.service;

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.request.inspectionfile.*;
import com.tuoheng.common.core.utils.JsonResult;

import java.util.List;
@@ -80,4 +77,13 @@ public interface IInspectionFileService {
* @return
*/
JsonResult getPageListByWorkOrderId(QueryInspectionFileWorkOrderPageListRequest request);

/**
*
* 处理任务问题
*
* @param request
* @return
*/
JsonResult processing(InspectionFileProcessingRresultRequest request);
}

+ 17
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java Näytä tiedosto

@@ -13,14 +13,12 @@ import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum;
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum;
import com.tuoheng.admin.mapper.*;
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.request.inspectionfile.*;
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.processing.InspectionFileProcessingService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFileDistributionListService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByInspectionIdService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByWorkOrderIdService;
@@ -88,6 +86,9 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
@Autowired
private QueryInspectionFilePageListByWorkOrderIdService queryInspectionFilePageListByWorkOrderIdService;

@Autowired
private InspectionFileProcessingService inspectionFileProcessingService;

/**
* 问题类型和任务名称
*
@@ -356,4 +357,16 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
public JsonResult getPageListByWorkOrderId(QueryInspectionFileWorkOrderPageListRequest request) {
return queryInspectionFilePageListByWorkOrderIdService.getPageList(request);
}

/**
*
* 处理任务问题
*
* @param request
* @return
*/
@Override
public JsonResult processing(InspectionFileProcessingRresultRequest request) {
return inspectionFileProcessingService.processing(request);
}
}

+ 180
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/processing/InspectionFileProcessingService.java Näytä tiedosto

@@ -0,0 +1,180 @@
package com.tuoheng.admin.service.inspectionfile.processing;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.InspectionFileHandle;
import com.tuoheng.admin.entity.WorkOrder;
import com.tuoheng.admin.entity.WorkOrderFile;
import com.tuoheng.admin.enums.InspectionFileStatusEnum;
import com.tuoheng.admin.enums.WorkOrderStatusEnum;
import com.tuoheng.admin.enums.code.inspectionfilehandle.InspectionFileProcessingCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspectionfile.InspectionFileProcessingRresultRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.DateUtils;
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 org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.stream.Collectors;

/**
* 任务问题处理业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-09
*/
@Slf4j
@Service
public class InspectionFileProcessingService {

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private InspectionFileHandleMapper inspectionFileHandleMapper;

@Autowired
private WorkOrderMapper workOrderMapper;

@Autowired
private WorkOrderFileMapper workOrderFileMapper;

@Transactional
public JsonResult processing(InspectionFileProcessingRresultRequest request) {
log.info("进入任务问题处理业务:inspectionFileId:{}", request.getInspectionFileId());

String userId = ShiroUtils.getUserId();
String tenantId = ShiroUtils.getTenantId();

JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("进入任务问题处理业务:校验失败:{}", result.getMsg());
return result;
}

result = this.addInspectionFileHandle(userId, tenantId, request);
if (0 != result.getCode()) {
log.info("进入任务问题处理业务:处理失败:{}", result.getMsg());
return result;
}

result = this.updateInspectionFileStatus(userId, request);
if (0 != result.getCode()) {
log.info("进入任务问题处理业务:更新任务问题状态失败:{}", result.getMsg());
return result;
}

result = this.updateWorkOrderStatus(userId, request);
if (0 != result.getCode()) {
log.info("进入任务问题处理业务:更新工单状态失败:{}", result.getMsg());
return result;
}
return JsonResult.success();
}

/**
* 检查参数
*
* @param request
* @return
*/
private JsonResult check(InspectionFileProcessingRresultRequest request) {
// 判断工单id是否为空
if (StringUtils.isEmpty(request.getWorkOrderId())) {
return JsonResult.error(InspectionFileProcessingCodeEnum.WORK_ORDER_ID_IS_NULL.getCode(), InspectionFileProcessingCodeEnum.WORK_ORDER_ID_IS_NULL.getMsg());
}
// 判断工单是否存在
WorkOrder workOrder = workOrderMapper.selectOne(new LambdaQueryWrapper<WorkOrder>()
.eq(WorkOrder::getId, request.getWorkOrderId())
.eq(WorkOrder::getMark, 1));
if (null == workOrder) {
return JsonResult.error(InspectionFileProcessingCodeEnum.WORK_ORDER_IS_NOT_EXIST.getCode(), InspectionFileProcessingCodeEnum.WORK_ORDER_IS_NOT_EXIST.getMsg());
}
// 判断任务问题id是否为空
if (StringUtils.isEmpty(request.getInspectionFileId())) {
return JsonResult.error(InspectionFileProcessingCodeEnum.INSPECTION_FILE_ID_IS_NULL.getCode(), InspectionFileProcessingCodeEnum.INSPECTION_FILE_ID_IS_NULL.getMsg());
}
// 判断任务是否存在
InspectionFile inspectionFile = inspectionFileMapper.selectOne(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getId, request.getInspectionFileId())
.eq(InspectionFile::getMark, 1));
if (null == inspectionFile) {
return JsonResult.error(InspectionFileProcessingCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getCode(), InspectionFileProcessingCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(inspectionFile);
}

/**
* 更新任务问题处理结果
*/
private JsonResult addInspectionFileHandle(String userId, String tenantId, InspectionFileProcessingRresultRequest request) {
InspectionFileHandle inspectionFileHandle = new InspectionFileHandle();
inspectionFileHandle.setTenantId(tenantId);
inspectionFileHandle.setInspectionFileId(request.getInspectionFileId());
inspectionFileHandle.setHandlerUser(userId);
inspectionFileHandle.setHandlerImage(request.getHandlerImage());
inspectionFileHandle.setHandlerResult(request.getHandlerResult());
inspectionFileHandle.setHandlerTime(DateUtils.now());
inspectionFileHandle.setCreateUser(userId);
inspectionFileHandle.setCreateTime(DateUtils.now());
Integer rowCount = inspectionFileHandleMapper.insert(inspectionFileHandle);
if (rowCount <= 0) {
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getMsg());
}
return JsonResult.success();
}

/**
* 更新任务问题状态
*/
private JsonResult updateInspectionFileStatus(String userId, InspectionFileProcessingRresultRequest request) {
InspectionFile inspectionFile = new InspectionFile();
inspectionFile.setId(request.getInspectionFileId());
inspectionFile.setStatus(InspectionFileStatusEnum.PROCESSED.getCode());
inspectionFile.setUpdateUser(userId);
inspectionFile.setUpdateTime(DateUtils.now());

Integer rowCount = inspectionFileMapper.updateById(inspectionFile);
if (rowCount <= 0) {
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getMsg());
}
return JsonResult.success();
}

/**
* 更新工单状态
* 当工单关联的任务问题都被处理完时,将工单状态改为完成
*/
private JsonResult updateWorkOrderStatus(String userId, InspectionFileProcessingRresultRequest request) {
List<WorkOrderFile> workOrderFileList = workOrderFileMapper.selectList(new LambdaQueryWrapper<WorkOrderFile>()
.eq(WorkOrderFile::getWorkOrderId, request.getWorkOrderId()));

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

Integer count = inspectionFileHandleMapper.selectCount(new LambdaQueryWrapper<InspectionFileHandle>()
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList));

if (workOrderFileList.size() > count) {
return JsonResult.success();
}

WorkOrder workOrder = new WorkOrder();
workOrder.setId(request.getWorkOrderId());
workOrder.setStatus(WorkOrderStatusEnum.COMPLETED.getCode());
workOrder.setUpdateUser(userId);
workOrder.setUpdateTime(DateUtils.now());

Integer rowCount = workOrderMapper.update(workOrder);
if (rowCount <= 0) {
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getMsg());
}
return JsonResult.success();
}

}

+ 4
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java Näytä tiedosto

@@ -96,7 +96,7 @@ public class QueryInspectionFilePageListByWorkOrderIdService {
.eq(InspectionFile::getMark, 1));

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

// 重写返回结果对象
IPage<InspectionFileHandleVo> inspectionFilePageListVoPageData = new Page<>();
@@ -137,7 +137,7 @@ public class QueryInspectionFilePageListByWorkOrderIdService {
*
* @return
*/
private List<InspectionFileHandleVo> buildInspectionFileHandleVoList(List<String> inspectionFileIdList, List<InspectionFile> inspectionFileList) {
private List<InspectionFileHandleVo> buildInspectionFileHandleVoList(String workOrderId, 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);
@@ -151,6 +151,8 @@ public class QueryInspectionFilePageListByWorkOrderIdService {
InspectionFileHandle inspectionFileHandle;
for (InspectionFile inspectionFile : inspectionFileList) {
inspectionFileHandleVo = new InspectionFileHandleVo();
inspectionFileHandleVo.setWorkOrderId(workOrderId);
inspectionFileHandleVo.setInspectionFileId(inspectionFile.getId());
inspectionFileHandleVo.setStatus(inspectionFile.getStatus());
inspectionFileHandleVo.setLatitude(inspectionFile.getLatitude());
inspectionFileHandleVo.setLongitude(inspectionFile.getLongitude());

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileHandleVo.java Näytä tiedosto

@@ -16,6 +16,11 @@ import java.util.List;
@Data
public class InspectionFileHandleVo {

/**
* 任务问题ID
*/
private String inspectionFileId;

/**
* 问题类型:1坑槽,2积水,3裂缝
*/
@@ -82,4 +87,9 @@ public class InspectionFileHandleVo {
*/
private String location;

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

}

Loading…
Peruuta
Tallenna