Переглянути джерело

工单问题 工单小程序接口调整

tags/v1.3.4
陈璐 4 місяці тому
джерело
коміт
86df1ff367
8 змінених файлів з 135 додано та 17 видалено
  1. +1
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java
  2. +15
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/InspectionFileHandle.java
  3. +5
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/dto/UploadResultDto.java
  4. +31
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/AuditEnum.java
  5. +1
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderStatusEnum.java
  6. +25
    -14
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileHandleServiceImpl.java
  7. +43
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java
  8. +14
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/WorkOrderHandleVo.java

+ 1
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java Переглянути файл

@@ -71,8 +71,7 @@ public class QueryInspectionFilePageListByWorkOrderIdService {
return result;
}

//String tenantId = CurrentUserUtil.getTenantId();
String tenantId = "f9c3de911d228b6e51eafb510aeaea7d";
String tenantId = CurrentUserUtil.getTenantId();

// 设置分页参数
IPage<WorkOrderFile> page = new Page<>(request.getPage(), request.getLimit());

+ 15
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/InspectionFileHandle.java Переглянути файл

@@ -55,6 +55,21 @@ public class InspectionFileHandle extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date handlerTime;

/**
* 审核结果 0未审核 1合适 2不合适
*/
private Integer audit;

/**
* 审核意见
*/
private String auditView;

/**
* 审核时间
*/
private Date auditTime;



}

+ 5
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/dto/UploadResultDto.java Переглянути файл

@@ -24,6 +24,11 @@ public class UploadResultDto {
*/
private String tenantId;

/**
* 巡检问题处理结果表ID
*/
private String inspectionFileHandleId;

/**
* 处理结果的图片,多张用,隔开
*/

+ 31
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/AuditEnum.java Переглянути файл

@@ -0,0 +1,31 @@
package com.tuoheng.miniprogram.enums;

import lombok.Getter;

/**
* 工单状态类型
*
* @author chenlu
* @team tuoheng
* @date 2022-12-07
* 审核结果 0未审核 1合适 2不合适
*/
public enum AuditEnum {

ZERO(0,"未审核"),
ONE(1,"合适"),

TWO(2,"不合适");

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

@Getter
private int code;

@Getter
private String description;

}

+ 1
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderStatusEnum.java Переглянути файл

@@ -9,6 +9,7 @@ public enum WorkOrderStatusEnum {
STATUS_ALLOCATED(5, "工单待分配"),
STATUS_ASSIGNED(10, "工单处理中已分配"),
STATUS_PENDING_REVIEW(11,"待审核"),
PENDING_REJECT(12,"审核驳回"),
STATUS_COMPLETED(15, "工单已完成");

/**

+ 25
- 14
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileHandleServiceImpl.java Переглянути файл

@@ -11,6 +11,7 @@ import com.tuoheng.common.core.utils.StringUtils;
import com.tuoheng.miniprogram.dao.*;
import com.tuoheng.miniprogram.entity.*;
import com.tuoheng.miniprogram.entity.dto.UploadResultDto;
import com.tuoheng.miniprogram.enums.AuditEnum;
import com.tuoheng.miniprogram.enums.InspectionFileHandleEnum;
import com.tuoheng.miniprogram.enums.MarkEnum;
import com.tuoheng.miniprogram.enums.ServiceExceptionEnum;
@@ -64,30 +65,40 @@ public class InspectionFileHandleServiceImpl implements IInspectionFileHandleSer
if(StringUtils.isEmpty(user.getTenantId())){
return JsonResult.error(InspectionFileHandleEnum.TENANT_ID_IS_NULL.getCode(),InspectionFileHandleEnum.TENANT_ID_IS_NULL.getMsg());
}

//查询工单信息
WorkOrder workOrder = workOrderMapper.selectById(dto.getWorkOrderId());
InspectionFileHandle inspectionFileHandleTmp = inspectionFileHandleMapper.selectOne(new LambdaQueryWrapper<InspectionFileHandle>()
.eq(InspectionFileHandle::getInspectionFileId, dto.getId())
.eq(InspectionFileHandle::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotEmpty(inspectionFileHandleTmp)) {
if (ObjectUtil.isNotEmpty(inspectionFileHandleTmp) && !workOrder.getStatus().equals(WorkOrderStatusEnum.PENDING_REJECT.getCode())) {
log.info("该问题已处理,不能重复提交,inspectionFileHandleId:{}", inspectionFileHandleTmp.getId());
return JsonResult.error(InspectionFileHandleEnum.INSPECTION_FILE_HANDLE_IS_EXIST.getCode(), InspectionFileHandleEnum.INSPECTION_FILE_HANDLE_IS_EXIST.getMsg());
}
//更新问题处理表
InspectionFileHandle inspectionFileHandle = new InspectionFileHandle();
inspectionFileHandle.setInspectionFileId(dto.getId());
inspectionFileHandle.setTenantId(user.getTenantId());
inspectionFileHandle.setHandlerImage(dto.getHandlerImage());
inspectionFileHandle.setHandlerResult(dto.getHandlerResult());
inspectionFileHandle.setHandlerTime(DateUtils.now());
inspectionFileHandle.setHandlerUser(user.getId());
inspectionFileHandle.setCreateUser(user.getId());
inspectionFileHandle.setCreateTime(DateUtils.now());
inspectionFileHandle.setMark(1);


int count = inspectionFileHandleMapper.insert(inspectionFileHandle);
if(count<=0){
return JsonResult.error();
//逻辑修改 工单是审核驳回时问题处理单是修改 其他是新增
if ( workOrder.getStatus().equals(WorkOrderStatusEnum.PENDING_REJECT.getCode()) ){
inspectionFileHandle.setId(dto.getInspectionFileHandleId());
inspectionFileHandle.setAudit(AuditEnum.ZERO.getCode());
inspectionFileHandle.setAuditView("");
int count = inspectionFileHandleMapper.updateById(inspectionFileHandle);
if(count<=0){
return JsonResult.error();
}
}else {
inspectionFileHandle.setInspectionFileId(dto.getId());
inspectionFileHandle.setTenantId(user.getTenantId());
inspectionFileHandle.setCreateUser(user.getId());
inspectionFileHandle.setCreateTime(DateUtils.now());
int count = inspectionFileHandleMapper.insert(inspectionFileHandle);
if(count<=0){
return JsonResult.error();
}
}
//更新问题表问题状态为已处理
InspectionFile inspectionFile = inspectionFileMapper.selectById(dto.getId());
@@ -112,11 +123,11 @@ public class InspectionFileHandleServiceImpl implements IInspectionFileHandleSer
}
List<String> inspectionFileList = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());
Integer inspectionFileHandleCount = inspectionFileHandleMapper.selectCount(new LambdaQueryWrapper<InspectionFileHandle>()
.in(InspectionFileHandle::getInspectionFileId, inspectionFileList));
if(workOrderFiles.size()>inspectionFileHandleCount){
.in(InspectionFileHandle::getInspectionFileId, inspectionFileList)
.in(InspectionFileHandle::getAudit, AuditEnum.ZERO.getCode(), AuditEnum.ONE.getCode()));
if(workOrder.getStatus().equals(WorkOrderStatusEnum.PENDING_REJECT.getCode()) && workOrderFiles.size()>inspectionFileHandleCount){
return JsonResult.success();
}
WorkOrder workOrder = workOrderMapper.selectById(dto.getWorkOrderId());
//此处修改 现阶段问题处理完后 状态改为 11待审核
workOrder.setStatus(WorkOrderStatusEnum.STATUS_PENDING_REVIEW.getCode());
workOrder.setUpdateUser(user.getId());

+ 43
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java Переглянути файл

@@ -8,6 +8,7 @@ import cn.hutool.core.util.ArrayUtil;
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.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.common.core.common.BaseServiceImpl;
@@ -57,6 +58,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private InspectionFileHandleMapper inspectionFileHandleMapper;

@Autowired
private InspectionFileCheckRecordMapper inspectionFileCheckRecordMapper;

@Autowired
private DeptMapper deptMapper;

@@ -287,7 +294,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//获取当前分配人对应的工单分页数据
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getAssignDeptId, deptId)
.in(WorkOrder::getStatus,10)
.in(WorkOrder::getStatus,10,12)
.like(StringUtils.isNotEmpty(user.getId()), WorkOrder::getAssignUser, user.getId())
.eq(WorkOrder::getTenantId, user.getTenantId())
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime())
@@ -420,11 +427,46 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//获取当前分配人对应的工单分页数据
IPage<InspectionFile> inspectionFilePageData = inspectionFileMapper.selectPage(page, Wrappers.<InspectionFile>lambdaQuery()
.in(InspectionFile::getId, inspectionFiledIds));
//获取工单对应的审核结果和历史审核记录
List<InspectionFileHandle> inspectionFileHandles =
inspectionFileHandleMapper.selectList(new LambdaQueryWrapper<InspectionFileHandle>().in(InspectionFileHandle::getInspectionFileId, inspectionFiledIds));
//子表信息处理
Map<String, InspectionFileHandle> detailMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(inspectionFileHandles)){

}
List<InspectionFileCheckRecord> inspectionFileCheckRecords =
inspectionFileCheckRecordMapper.selectList(new LambdaQueryWrapper<InspectionFileCheckRecord>().in(InspectionFileCheckRecord::getInspectionFileId, inspectionFiledIds)
.orderByDesc(InspectionFileCheckRecord::getCreateTime));
//历史审核记录
Map<String, List<InspectionFileCheckRecord>> checkRecordMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(inspectionFileCheckRecords)){

}

List<WorkOrderHandleVo> list = inspectionFilePageData.getRecords().stream().map(t -> {
WorkOrderHandleVo vo = new WorkOrderHandleVo();
BeanUtils.copyProperties(t, vo);
//工单id
vo.setWorkOrderId(query.getId());

//处理审核结果
if(CollectionUtils.isNotEmpty(inspectionFileHandles)){
List<InspectionFileHandle> inspectionFileHandleList =
inspectionFileHandles.stream().filter(item -> item.getInspectionFileId().equals(t.getId())).collect(Collectors.toList());
if (Objects.nonNull(inspectionFileHandleList.get(0) )){
vo.setAudit(inspectionFileHandleList.get(0).getAudit());
}
}
if ( CollectionUtils.isNotEmpty(inspectionFileCheckRecords) ){
List<InspectionFileCheckRecord> inspectionFileCheckRecordList =
inspectionFileCheckRecords.stream().filter(item -> item.getInspectionFileId().equals(t.getId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(inspectionFileCheckRecordList)){
vo.setList(inspectionFileCheckRecordList);
}
}
t.getId();

//缩略图处理
if (StringUtils.isNotEmpty(t.getFileThumbnail())) {
vo.setFileThumbnail(CommonConfig.imageURL + t.getFileThumbnail());

+ 14
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/WorkOrderHandleVo.java Переглянути файл

@@ -1,10 +1,12 @@
package com.tuoheng.miniprogram.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.miniprogram.entity.InspectionFileCheckRecord;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
* @Author ChengWang
@@ -79,4 +81,16 @@ public class WorkOrderHandleVo {
* 状态:20已生成工单 25问题已处理
*/
private Integer status;

/**
* 审核结果 0未审核 1合适 2不合适
*/
private Integer audit;

/**
* 历史审核记录
*/
private List<InspectionFileCheckRecord> list;


}

Завантаження…
Відмінити
Зберегти