yxk-20260527-巡视整改提升台账,任务清单新增
1、任务清单 dq_inspect_task.problem_id 必须关联 dq_inspect_problem.id,且被关联的问题节点 node_type = specific。 2、前端把当前手填“具体问题ID”改成树形选择,只允许选择“具体问题”节点。 后端在新增、编辑、导入时统一校验,防止绕过前端提交非法 problemId。
This commit is contained in:
+9
@@ -204,6 +204,15 @@ public class DqInspectProblemController extends JeecgController<DqInspectProblem
|
|||||||
public Result<List<Map<String, Object>>> parentOptions(@RequestParam(name = "nodeType") String nodeType) {
|
public Result<List<Map<String, Object>>> parentOptions(@RequestParam(name = "nodeType") String nodeType) {
|
||||||
return Result.OK(dqInspectProblemService.queryParentOptions(nodeType));
|
return Result.OK(dqInspectProblemService.queryParentOptions(nodeType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务清单选择具体问题时使用,分类和面上问题仅用于分组展示,不可选择。
|
||||||
|
*/
|
||||||
|
@Operation(summary="dq_inspect_problem-具体问题候选")
|
||||||
|
@GetMapping(value = "/specificOptions")
|
||||||
|
public Result<List<Map<String, Object>>> specificOptions() {
|
||||||
|
return Result.OK(dqInspectProblemService.querySpecificOptions());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 添加
|
||||||
|
|||||||
+7
@@ -86,4 +86,11 @@ public interface IDqInspectProblemService extends IService<DqInspectProblem> {
|
|||||||
*/
|
*/
|
||||||
List<Map<String, Object>> queryParentOptions(String nodeType);
|
List<Map<String, Object>> queryParentOptions(String nodeType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回任务清单可选择的具体问题树:问题分类 -> 面上问题 -> 具体问题。
|
||||||
|
*
|
||||||
|
* @return 具体问题候选树
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> querySpecificOptions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+42
@@ -156,6 +156,11 @@ public class DqInspectProblemServiceImpl extends ServiceImpl<DqInspectProblemMap
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> querySpecificOptions() {
|
||||||
|
return querySpecificProblemTree();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 问题清单固定为三层:问题分类 -> 面上问题 -> 具体问题。
|
* 问题清单固定为三层:问题分类 -> 面上问题 -> 具体问题。
|
||||||
* 服务层兜底校验层级,避免绕过前端直接提交非法关系。
|
* 服务层兜底校验层级,避免绕过前端直接提交非法关系。
|
||||||
@@ -264,6 +269,43 @@ public class DqInspectProblemServiceImpl extends ServiceImpl<DqInspectProblemMap
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Map<String, Object>> querySpecificProblemTree() {
|
||||||
|
List<DqInspectProblem> categories = baseMapper.selectList(
|
||||||
|
new QueryWrapper<DqInspectProblem>()
|
||||||
|
.eq("node_type", NODE_TYPE_CATEGORY)
|
||||||
|
.orderByAsc("sort_no", "create_time")
|
||||||
|
);
|
||||||
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
for (DqInspectProblem category : categories) {
|
||||||
|
Map<String, Object> categoryOption = toTreeOption(category, true);
|
||||||
|
List<DqInspectProblem> surfaces = baseMapper.selectList(
|
||||||
|
new QueryWrapper<DqInspectProblem>()
|
||||||
|
.eq("pid", category.getId())
|
||||||
|
.eq("node_type", NODE_TYPE_SURFACE)
|
||||||
|
.orderByAsc("sort_no", "create_time")
|
||||||
|
);
|
||||||
|
List<Map<String, Object>> surfaceOptions = new ArrayList<>();
|
||||||
|
for (DqInspectProblem surface : surfaces) {
|
||||||
|
Map<String, Object> surfaceOption = toTreeOption(surface, true);
|
||||||
|
List<DqInspectProblem> specifics = baseMapper.selectList(
|
||||||
|
new QueryWrapper<DqInspectProblem>()
|
||||||
|
.eq("pid", surface.getId())
|
||||||
|
.eq("node_type", NODE_TYPE_SPECIFIC)
|
||||||
|
.orderByAsc("sort_no", "create_time")
|
||||||
|
);
|
||||||
|
List<Map<String, Object>> specificOptions = new ArrayList<>();
|
||||||
|
for (DqInspectProblem specific : specifics) {
|
||||||
|
specificOptions.add(toTreeOption(specific, false));
|
||||||
|
}
|
||||||
|
surfaceOption.put("children", specificOptions);
|
||||||
|
surfaceOptions.add(surfaceOption);
|
||||||
|
}
|
||||||
|
categoryOption.put("children", surfaceOptions);
|
||||||
|
result.add(categoryOption);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, Object> toTreeOption(DqInspectProblem node, boolean disabled) {
|
private Map<String, Object> toTreeOption(DqInspectProblem node, boolean disabled) {
|
||||||
Map<String, Object> option = new HashMap<>();
|
Map<String, Object> option = new HashMap<>();
|
||||||
option.put("key", node.getId());
|
option.put("key", node.getId());
|
||||||
|
|||||||
+2
-1
@@ -53,7 +53,8 @@ public class DqInspectTask implements Serializable {
|
|||||||
@Schema(description = "所属部门")
|
@Schema(description = "所属部门")
|
||||||
private java.lang.String sysOrgCode;
|
private java.lang.String sysOrgCode;
|
||||||
/**具体问题ID*/
|
/**具体问题ID*/
|
||||||
@Excel(name = "具体问题ID", width = 15)
|
@Excel(name = "具体问题", width = 15, dictTable = "dq_inspect_problem", dicText = "problem_name", dicCode = "id")
|
||||||
|
@Dict(dictTable = "dq_inspect_problem", dicText = "problem_name", dicCode = "id")
|
||||||
@Schema(description = "具体问题ID")
|
@Schema(description = "具体问题ID")
|
||||||
private java.lang.String problemId;
|
private java.lang.String problemId;
|
||||||
/**密级*/
|
/**密级*/
|
||||||
|
|||||||
+24
@@ -1,5 +1,9 @@
|
|||||||
package org.jeecg.modules.demo.dqinspecttask.service.impl;
|
package org.jeecg.modules.demo.dqinspecttask.service.impl;
|
||||||
|
|
||||||
|
import org.jeecg.common.exception.JeecgBootException;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.demo.dqinspectproblem.entity.DqInspectProblem;
|
||||||
|
import org.jeecg.modules.demo.dqinspectproblem.service.IDqInspectProblemService;
|
||||||
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectTask;
|
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectTask;
|
||||||
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectProgress;
|
import org.jeecg.modules.demo.dqinspecttask.entity.DqInspectProgress;
|
||||||
import org.jeecg.modules.demo.dqinspecttask.mapper.DqInspectProgressMapper;
|
import org.jeecg.modules.demo.dqinspecttask.mapper.DqInspectProgressMapper;
|
||||||
@@ -26,10 +30,13 @@ public class DqInspectTaskServiceImpl extends ServiceImpl<DqInspectTaskMapper, D
|
|||||||
private DqInspectTaskMapper dqInspectTaskMapper;
|
private DqInspectTaskMapper dqInspectTaskMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DqInspectProgressMapper dqInspectProgressMapper;
|
private DqInspectProgressMapper dqInspectProgressMapper;
|
||||||
|
@Autowired
|
||||||
|
private IDqInspectProblemService dqInspectProblemService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void saveMain(DqInspectTask dqInspectTask, List<DqInspectProgress> dqInspectProgressList) {
|
public void saveMain(DqInspectTask dqInspectTask, List<DqInspectProgress> dqInspectProgressList) {
|
||||||
|
validateProblemId(dqInspectTask);
|
||||||
dqInspectTaskMapper.insert(dqInspectTask);
|
dqInspectTaskMapper.insert(dqInspectTask);
|
||||||
if(dqInspectProgressList!=null && dqInspectProgressList.size()>0) {
|
if(dqInspectProgressList!=null && dqInspectProgressList.size()>0) {
|
||||||
for(DqInspectProgress entity:dqInspectProgressList) {
|
for(DqInspectProgress entity:dqInspectProgressList) {
|
||||||
@@ -43,6 +50,7 @@ public class DqInspectTaskServiceImpl extends ServiceImpl<DqInspectTaskMapper, D
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateMain(DqInspectTask dqInspectTask,List<DqInspectProgress> dqInspectProgressList) {
|
public void updateMain(DqInspectTask dqInspectTask,List<DqInspectProgress> dqInspectProgressList) {
|
||||||
|
validateProblemId(dqInspectTask);
|
||||||
dqInspectTaskMapper.updateById(dqInspectTask);
|
dqInspectTaskMapper.updateById(dqInspectTask);
|
||||||
|
|
||||||
//1.先删除子表数据
|
//1.先删除子表数据
|
||||||
@@ -73,5 +81,21 @@ public class DqInspectTaskServiceImpl extends ServiceImpl<DqInspectTaskMapper, D
|
|||||||
dqInspectTaskMapper.deleteById(id);
|
dqInspectTaskMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改任务必须挂在问题清单的“具体问题”节点下,避免接口绕过前端产生非法层级数据。
|
||||||
|
*/
|
||||||
|
private void validateProblemId(DqInspectTask dqInspectTask) {
|
||||||
|
if (dqInspectTask == null || oConvertUtils.isEmpty(dqInspectTask.getProblemId())) {
|
||||||
|
throw new JeecgBootException("请选择具体问题");
|
||||||
|
}
|
||||||
|
DqInspectProblem problem = dqInspectProblemService.getById(dqInspectTask.getProblemId());
|
||||||
|
if (problem == null) {
|
||||||
|
throw new JeecgBootException("选择的具体问题不存在");
|
||||||
|
}
|
||||||
|
if (!IDqInspectProblemService.NODE_TYPE_SPECIFIC.equals(problem.getNodeType())) {
|
||||||
|
throw new JeecgBootException("整改任务只能挂在具体问题节点下");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -49,7 +49,8 @@ public class DqInspectTaskPage {
|
|||||||
@Schema(description = "所属部门")
|
@Schema(description = "所属部门")
|
||||||
private java.lang.String sysOrgCode;
|
private java.lang.String sysOrgCode;
|
||||||
/**具体问题ID*/
|
/**具体问题ID*/
|
||||||
@Excel(name = "具体问题ID", width = 15)
|
@Excel(name = "具体问题", width = 15, dictTable = "dq_inspect_problem", dicText = "problem_name", dicCode = "id")
|
||||||
|
@Dict(dictTable = "dq_inspect_problem", dicText = "problem_name", dicCode = "id")
|
||||||
@Schema(description = "具体问题ID")
|
@Schema(description = "具体问题ID")
|
||||||
private java.lang.String problemId;
|
private java.lang.String problemId;
|
||||||
/**密级*/
|
/**密级*/
|
||||||
|
|||||||
Reference in New Issue
Block a user