Browse Source

问题处理添加日志

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
94f33f8be4
1 changed files with 5 additions and 7 deletions
  1. +5
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/processing/InspectionFileProcessingService.java

+ 5
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/processing/InspectionFileProcessingService.java View File

@@ -98,11 +98,12 @@ public class InspectionFileProcessingService {
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) {
log.info("任务问题不存在,inspectionFileId:{}", request.getInspectionFileId());
return JsonResult.error(InspectionFileProcessingCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getCode(), InspectionFileProcessingCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(inspectionFile);
@@ -123,6 +124,7 @@ public class InspectionFileProcessingService {
inspectionFileHandle.setCreateTime(DateUtils.now());
Integer rowCount = inspectionFileHandleMapper.insert(inspectionFileHandle);
if (rowCount <= 0) {
log.info("任务问题处理失败,inspectionFileId:{}", request.getInspectionFileId());
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getMsg());
}
return JsonResult.success();
@@ -137,9 +139,9 @@ public class InspectionFileProcessingService {
inspectionFile.setStatus(InspectionFileStatusEnum.PROCESSED.getCode());
inspectionFile.setUpdateUser(userId);
inspectionFile.setUpdateTime(DateUtils.now());

Integer rowCount = inspectionFileMapper.updateById(inspectionFile);
if (rowCount <= 0) {
log.info("更新任务问题状态失败,inspectionFileId:{}", request.getInspectionFileId());
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getMsg());
}
return JsonResult.success();
@@ -152,24 +154,20 @@ public class InspectionFileProcessingService {
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) {
log.info("更新工单状态失败,workOrderId:{}", request.getWorkOrderId());
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getMsg());
}
return JsonResult.success();

Loading…
Cancel
Save