瀏覽代碼

问题处理,判断重复提交

tags/v1.0.0^2
wanjing 1 年之前
父節點
當前提交
de2d6defd4
共有 2 個檔案被更改,包括 12 行新增3 行删除
  1. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfilehandle/InspectionFileProcessingCodeEnum.java
  2. +10
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/processing/InspectionFileProcessingService.java

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfilehandle/InspectionFileProcessingCodeEnum.java 查看文件

@@ -15,7 +15,8 @@ public enum InspectionFileProcessingCodeEnum {
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, "任务问题不存在");
INSPECTION_FILE_IS_NOT_EXIST(1250104, "任务问题不存在"),
INSPECTION_FILE_Handle_IS_EXIST(1250105, "该问题已处理");

/**
* 错误码

+ 10
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/processing/InspectionFileProcessingService.java 查看文件

@@ -1,5 +1,6 @@
package com.tuoheng.admin.service.inspectionfile.processing;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.InspectionFileStatusEnum;
@@ -92,7 +93,7 @@ public class InspectionFileProcessingService {
WorkOrder workOrder = workOrderMapper.selectOne(new LambdaQueryWrapper<WorkOrder>()
.eq(WorkOrder::getId, request.getWorkOrderId())
.eq(WorkOrder::getMark, MarkEnum.VALID.getCode()));
if (null == workOrder) {
if (ObjectUtil.isEmpty(workOrder)) {
return JsonResult.error(InspectionFileProcessingCodeEnum.WORK_ORDER_IS_NOT_EXIST.getCode(), InspectionFileProcessingCodeEnum.WORK_ORDER_IS_NOT_EXIST.getMsg());
}
// 判断任务问题id是否为空
@@ -103,10 +104,17 @@ public class InspectionFileProcessingService {
InspectionFile inspectionFile = inspectionFileMapper.selectOne(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getId, request.getInspectionFileId())
.eq(InspectionFile::getMark, MarkEnum.VALID.getCode()));
if (null == inspectionFile) {
if (ObjectUtil.isEmpty(inspectionFile)) {
log.info("任务问题不存在,inspectionFileId:{}", request.getInspectionFileId());
return JsonResult.error(InspectionFileProcessingCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getCode(), InspectionFileProcessingCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getMsg());
}
InspectionFileHandle inspectionFileHandle = inspectionFileHandleMapper.selectOne(new LambdaQueryWrapper<InspectionFileHandle>()
.eq(InspectionFileHandle::getInspectionFileId, request.getInspectionFileId())
.eq(InspectionFileHandle::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotEmpty(inspectionFileHandle)) {
log.info("该问题已处理,不能重复提交,inspectionFileHandleId:{}", inspectionFileHandle.getId());
return JsonResult.error(InspectionFileProcessingCodeEnum.INSPECTION_FILE_Handle_IS_EXIST.getCode(), InspectionFileProcessingCodeEnum.INSPECTION_FILE_Handle_IS_EXIST.getMsg());
}
return JsonResult.success(inspectionFile);
}


Loading…
取消
儲存