|
|
@@ -67,9 +67,10 @@ public class DeleteInspectionService { |
|
|
|
*/ |
|
|
|
@Transactional |
|
|
|
public JsonResult deleteById(String id) { |
|
|
|
log.info("进入删除任务业务接口"); |
|
|
|
String userId = CurrentUserUtil.getUserId(); |
|
|
|
String tenantId = CurrentUserUtil.getTenantId(); |
|
|
|
log.info("进入删除任务业务接口, id:{}", id); |
|
|
|
User uer = CurrentUserUtil.getUserInfo(); |
|
|
|
String userId = uer.getId(); |
|
|
|
String tenantId = uer.getTenantId(); |
|
|
|
JsonResult result = this.check(tenantId, id); |
|
|
|
if (0 != result.getCode()) { |
|
|
|
log.info("删除任务接口:校验失败:{}", result.getMsg()); |
|
|
@@ -79,10 +80,10 @@ public class DeleteInspectionService { |
|
|
|
// 在校验中,判断任务是否存在时,若任务存在,直接将任务信息返回,减少数据库查询次数 |
|
|
|
Inspection inspection = (Inspection) result.getData(); |
|
|
|
|
|
|
|
// 判断任务状态,处于飞行中的任务无法删除 |
|
|
|
// 判断任务状态,处于准备中、飞行中的任务无法删除 |
|
|
|
result = this.checkStatus(inspection); |
|
|
|
if (0 != result.getCode()) { |
|
|
|
log.info("删除任务接口:任务处于飞行中时无法删除"); |
|
|
|
log.info("删除任务接口:任务处于准备中或飞行中时无法删除"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@@ -139,7 +140,10 @@ public class DeleteInspectionService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private JsonResult checkStatus(Inspection inspection) { |
|
|
|
if (InspectionStatusEnum.PREPARING.getCode() == inspection.getStatus() || InspectionStatusEnum.IN_FLIGHT.getCode() == inspection.getStatus()) { |
|
|
|
if (InspectionStatusEnum.PREPARING.getCode() == inspection.getStatus()) { |
|
|
|
return JsonResult.error(DeleteInspectionCodeEnum.IN_PREPARING_NOT_DELETE.getCode(), DeleteInspectionCodeEnum.IN_PREPARING_NOT_DELETE.getMsg()); |
|
|
|
} |
|
|
|
if (InspectionStatusEnum.IN_FLIGHT.getCode() == inspection.getStatus()) { |
|
|
|
return JsonResult.error(DeleteInspectionCodeEnum.IN_FLIGHT_NOT_DELETE.getCode(), DeleteInspectionCodeEnum.IN_FLIGHT_NOT_DELETE.getMsg()); |
|
|
|
} |
|
|
|
return JsonResult.success(); |