소스 검색

处理工单

tags/v1.0.0^2
chengwang 1 년 전
부모
커밋
bb2b2f750f
6개의 변경된 파일162개의 추가작업 그리고 5개의 파일을 삭제
  1. +12
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/WorkOrderController.java
  2. +17
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/query/HandleQuery.java
  3. +3
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderEnum.java
  4. +4
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IWorkOrderService.java
  5. +79
    -4
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java
  6. +47
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/WorkOrderHandleVo.java

+ 12
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/WorkOrderController.java 파일 보기

@@ -8,6 +8,7 @@ import com.tuoheng.miniprogram.dao.UserMapper;
import com.tuoheng.miniprogram.entity.User;
import com.tuoheng.miniprogram.entity.WorkOrder;
import com.tuoheng.miniprogram.entity.dto.WorkOrderDto;
import com.tuoheng.miniprogram.entity.query.HandleQuery;
import com.tuoheng.miniprogram.entity.query.WorkOrderQuery;
import com.tuoheng.miniprogram.service.IWorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,6 +49,17 @@ public class WorkOrderController extends BaseController {
return workOrderService.getTodoList(query);
}

/**
* 处理工单
* @param query
* @return
*/
@GetMapping("/handle")
public JsonResult handle(HandleQuery query){
return workOrderService.handle(query);
}






+ 17
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/query/HandleQuery.java 파일 보기

@@ -0,0 +1,17 @@
package com.tuoheng.miniprogram.entity.query;

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

/**
* @Author ChengWang
* @Date 2022/12/7
*/
@Data
public class HandleQuery extends BaseQuery {

/**
* 工单id
*/
private String id;
}

+ 3
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderEnum.java 파일 보기

@@ -12,7 +12,9 @@ public enum WorkOrderEnum {
USER_NAME_IS_NULL(1210103, "登录用户名为空"),
USER_IS_NOT_EXIST(1210104, "用户为空"),
DEPT_ID_IS_NULL(1210105, "部门id为空"),
DATA_IS_NULL(1210106, "数据为空");
DATA_IS_NULL(1210106, "数据为空"),
WORK_ORDER_ID_IS_NULL(1210107, "工单id为空"),
INSPECTION_ID_IS_NULL(1210108, "任务id为空");

/**
* 错误码

+ 4
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IWorkOrderService.java 파일 보기

@@ -4,6 +4,7 @@ import com.tuoheng.common.core.common.IBaseService;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.entity.WorkOrder;
import com.tuoheng.miniprogram.entity.dto.WorkOrderDto;
import com.tuoheng.miniprogram.entity.query.HandleQuery;
import com.tuoheng.miniprogram.entity.query.WorkOrderQuery;

/**
@@ -16,4 +17,7 @@ public interface IWorkOrderService extends IBaseService<WorkOrder> {
JsonResult addInfo(WorkOrderDto dto);

JsonResult getTodoList(WorkOrderQuery query);

JsonResult handle(HandleQuery query);

}

+ 79
- 4
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java 파일 보기

@@ -7,20 +7,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.common.core.common.BaseServiceImpl;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.SecurityUserUtils;
import com.tuoheng.common.core.utils.StringUtils;
import com.tuoheng.miniprogram.dao.*;
import com.tuoheng.miniprogram.entity.InspectionFile;
import com.tuoheng.miniprogram.entity.User;
import com.tuoheng.miniprogram.entity.WorkOrder;
import com.tuoheng.miniprogram.entity.WorkOrderFile;
import com.tuoheng.miniprogram.entity.*;
import com.tuoheng.miniprogram.entity.dto.WorkOrderDto;
import com.tuoheng.miniprogram.entity.query.HandleQuery;
import com.tuoheng.miniprogram.entity.query.WorkOrderQuery;
import com.tuoheng.miniprogram.enums.*;
import com.tuoheng.miniprogram.service.IWorkOrderService;
import com.tuoheng.miniprogram.vo.WorkOrderHandleVo;
import com.tuoheng.miniprogram.vo.WorkOrderInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -57,6 +57,15 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
@Autowired
private DeptMapper deptMapper;

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private QuestionTypeMapper questionTypeMapper;

@Autowired
private RoadInformationMapper roadInformationMapper;

@Override
public JsonResult addInfo(WorkOrderDto dto) {
if(StringUtils.isEmpty(dto.getTenantId())){
@@ -237,6 +246,72 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return JsonResult.success(pageData);
}
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg());
}

/**
* 处理工单
* @param query
* @return
*/
@Override
public JsonResult handle(HandleQuery query) {
if(StringUtils.isEmpty(query.getId())){
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(),WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg());
}
if(null == query.getPage() && null == query.getLimit()){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//获取分页数据
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit());
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(),query.getLimit());
//根据工单id获取对应的问题集合
List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery()
.eq(WorkOrderFile::getWorkOrderId, query.getId()));
if(null == workOrderFiles){
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg());
}
//工单子表获取对应的问题集合id
List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());
List<InspectionFile> inspectionFilesList = inspectionFileMapper.selectBatchIds(inspectionFiledIds);
//设置分页
IPage<InspectionFile> inspectionFilePageData = page.setRecords(inspectionFilesList);
List<WorkOrderHandleVo> list = inspectionFilePageData.getRecords().stream().map(t -> {
WorkOrderHandleVo vo = new WorkOrderHandleVo();
BeanUtils.copyProperties(t, vo);
//缩略图处理
vo.setFileThumbnail(CommonConfig.imageURL+t.getFileThumbnail());
//任务名称 任务执行时间 道路位置编号
if (StringUtils.isEmpty(t.getInspectionId())) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
Inspection inspection = inspectionMapper.selectById(t.getInspectionId());
if (ObjectUtil.isNotNull(inspection)) {
vo.setName(inspection.getName());
vo.setExecutionStartTime(inspection.getExecutionStartTime());
RoadInformation roadInformation = roadInformationMapper.selectById(inspection.getRoadId());
if (null != roadInformation) {
if (StringUtils.isEmpty(roadInformation.getCode())) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
vo.setCode(roadInformation.getCode());
}

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

}).collect(Collectors.toList());
pageData.setRecords(list);

return JsonResult.success(pageData);
}


}

+ 47
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/WorkOrderHandleVo.java 파일 보기

@@ -0,0 +1,47 @@
package com.tuoheng.miniprogram.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
* @Author ChengWang
* @Date 2022/12/7
*/
@Data
public class WorkOrderHandleVo {

/**
* 任务名称
*/
private String name;

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

/**
* 问题图片 缩略图
*/
private String fileThumbnail;

/**
* 位置
*/
private String code;

/**
* 任务时间(巡检执行时间)
*/
@DateTimeFormat(pattern = "yyyy/MM/dd HH:mm")
@JsonFormat(pattern = "yyyy/MM/dd HH:mm", timezone = "GMT+8")
private Date executionStartTime;

/**
* 状态:20已生成工单 25问题已处理
*/
private Integer status;
}

Loading…
취소
저장