浏览代码

Merge branch 'develop' of gitadmin/tuoheng_telecomumale into release

tags/v1.3.1^2
wanjing 1年前
父节点
当前提交
8fa86e7e4a
共有 2 个文件被更改,包括 13 次插入8 次删除
  1. +3
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/DeleteInspectionCodeEnum.java
  2. +10
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java

+ 3
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/DeleteInspectionCodeEnum.java 查看文件

@@ -14,9 +14,10 @@ public enum DeleteInspectionCodeEnum {
DELETE_IS_FAILED(1230200, "删除任务失败"),
ID_IS_NULL(1230201, "任务ID为空"),
INSPECTION_IS_NOT_EXIST(1230202, "任务不存在"),
IN_FLIGHT_NOT_DELETE(1230203, "准备飞行中无法删除"),
IN_FLIGHT_NOT_DELETE(1230203, "飞行中无法删除"),
ADMIN_NOT_DELETE_CHILD_INSPECTION(1230204, "管理员不能删除子部门任务"),
ORDINARY_USER_NO_PERMISSION_TO_DELETE(1230205, "普通用户无删除任务权限");
ORDINARY_USER_NO_PERMISSION_TO_DELETE(1230205, "普通用户无删除任务权限"),
IN_PREPARING_NOT_DELETE(1230206, "准备中无法删除");

/**
* 错误码

+ 10
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java 查看文件

@@ -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();

正在加载...
取消
保存