Commit 459569e6 authored by tianbo's avatar tianbo

增加防火监督检查计划删除后端校验

parent a00375f3
...@@ -1986,6 +1986,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1986,6 +1986,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
pageParam.put("governUserId", jcsUserId); pageParam.put("governUserId", jcsUserId);
} }
} }
pageParam.put("bizType", bizType);
Page page = new Page(pageParam.getParamPageCurrent(), pageParam.getParamPageSize()); Page page = new Page(pageParam.getParamPageCurrent(), pageParam.getParamPageSize());
IPage<LatentDanger> iPage = this.baseMapper.selectPageByParam(page, (Map<String, Object>) pageParam); IPage<LatentDanger> iPage = this.baseMapper.selectPageByParam(page, (Map<String, Object>) pageParam);
......
...@@ -127,7 +127,7 @@ public class PlanController extends AbstractBaseController { ...@@ -127,7 +127,7 @@ public class PlanController extends AbstractBaseController {
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return CommonResponseUtil.failure("删除巡检计划失败"); return CommonResponseUtil.failure("删除巡检计划失败" + ":" + e.getMessage());
} }
} }
......
...@@ -40,5 +40,7 @@ public interface IPlanDao extends BaseDao<Plan, Long> { ...@@ -40,5 +40,7 @@ public interface IPlanDao extends BaseDao<Plan, Long> {
@Query(value = "select * from p_plan where original_id in (?1) and is_delete = 0", nativeQuery = true) @Query(value = "select * from p_plan where original_id in (?1) and is_delete = 0", nativeQuery = true)
List<Plan> findByOriginalIds(List<String> originalIds); List<Plan> findByOriginalIds(List<String> originalIds);
@Query(value = "select count(*) from p_plan where is_delete = 0 and id in (?1) and status != (?2)", nativeQuery =
true)
int countNotDeletable(List<Long> ids, int status);
} }
\ No newline at end of file
...@@ -362,11 +362,18 @@ public class PlanServiceImpl implements IPlanService { ...@@ -362,11 +362,18 @@ public class PlanServiceImpl implements IPlanService {
@Override @Override
@Transactional @Transactional
public void delPlanById(String[] param) { public void delPlanById(String[] param) throws Exception {
List<Long> ids = new ArrayList<Long>(); List<Long> ids = new ArrayList<>();
for (int i = 0; i < param.length; i++) { for (int i = 0; i < param.length; i++) {
ids.add(Long.parseLong(param[i])); ids.add(Long.parseLong(param[i]));
} }
if (ValidationUtil.isEmpty(ids)) {
throw new Exception("参数为空");
}
// 校验是否可以删除(PlanStatusEnum.DRAFT:草稿状态可删除)
if (planDao.countNotDeletable(ids, PlanStatusEnum.DRAFT.getValue()) > 0) {
throw new Exception("非草稿状态计划不能删除");
}
planDao.updatePlanDel(ids); planDao.updatePlanDel(ids);
// 删除对应该计划今天往后的所有计划执行信息 // 删除对应该计划今天往后的所有计划执行信息
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
......
...@@ -28,7 +28,7 @@ public interface IPlanService { ...@@ -28,7 +28,7 @@ public interface IPlanService {
/** /**
* 巡检计划删除 * 巡检计划删除
*/ */
void delPlanById(String[] param); void delPlanById(String[] param) throws Exception;
/** /**
* 巡检计划另存 * 巡检计划另存
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment