|
@@ -1,10 +1,11 @@
|
|
|
package com.qunzhixinxi.hnqz.admin.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.lang.tree.Tree;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.UpmsState;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.dto.SysImplementPlanDTO;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.dto.SysImplementPlanDetailsDTO;
|
|
|
-import com.qunzhixinxi.hnqz.admin.api.entity.SysImplementPlan;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.SysImplementPlanVO;
|
|
|
import com.qunzhixinxi.hnqz.admin.manager.SysImplementPlanManager;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
@@ -19,8 +20,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* 执行计划前端控制器
|
|
@@ -44,6 +47,11 @@ public class SysImplementPlanController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/plan/info/{plan_id}")
|
|
|
+ public R<SysImplementPlanVO.ToList> getPlanById(@PathVariable(value = "plan_id") Long planId) {
|
|
|
+ return R.ok(implementPlanManager.findById(planId));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@GetMapping(value = "/plan/page")
|
|
|
public R<Page<?>> pagePlans(@Validated SysImplementPlanDTO.OnPage query) {
|
|
@@ -51,6 +59,32 @@ public class SysImplementPlanController {
|
|
|
return R.ok(implementPlanManager.pagePlans(query, SecurityUtils.getUser()));
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @GetMapping(value = "/plan/children/list")
|
|
|
+ public R<List<Tree<Integer>>> listPlanChildren(@Validated SysImplementPlanDTO.OnPage query) {
|
|
|
+
|
|
|
+ Page<?> page = implementPlanManager.pagePlans(query, SecurityUtils.getUser());
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(page.getRecords())) {
|
|
|
+ return R.ok(Collections.emptyList());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Tree<Integer>> records = (List<Tree<Integer>>) page.getRecords();
|
|
|
+
|
|
|
+ for (Tree<Integer> record : records) {
|
|
|
+ Integer id = record.getId();
|
|
|
+ if (!Objects.equals(id, query.getPlanId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Tree<Integer>> children = record.getChildren();
|
|
|
+ return R.ok(children);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.ok(Collections.emptyList());
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/plan/list")
|
|
|
public R<List<SysImplementPlanVO.ToList>> listPlans(@RequestParam(value = "planState", required = false, defaultValue = "PASSED") UpmsState.ImplementPlanState planState) {
|
|
|
return R.ok(implementPlanManager.listPlans(planState, SecurityUtils.getUser()));
|