|
@@ -3,9 +3,15 @@ package com.fdkankan.fusion.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
|
+import com.fdkankan.fusion.entity.CaseEntity;
|
|
|
import com.fdkankan.fusion.entity.TmDepartment;
|
|
|
+import com.fdkankan.fusion.entity.TmProject;
|
|
|
+import com.fdkankan.fusion.exception.BusinessException;
|
|
|
+import com.fdkankan.fusion.service.ICaseService;
|
|
|
import com.fdkankan.fusion.service.ITmDepartmentService;
|
|
|
+import com.fdkankan.fusion.service.ITmProjectService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -30,6 +36,10 @@ public class TmDepartmentController {
|
|
|
|
|
|
@Autowired
|
|
|
private ITmDepartmentService departmentService;
|
|
|
+ @Autowired
|
|
|
+ private ICaseService caseService;
|
|
|
+ @Autowired
|
|
|
+ ITmProjectService tmProjectService;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -45,8 +55,20 @@ public class TmDepartmentController {
|
|
|
* 获取部门下拉树列表
|
|
|
*/
|
|
|
@GetMapping("/treeselect")
|
|
|
- public ResultData treeselect(@RequestParam(required = false) String deptId) {
|
|
|
- if(StringUtils.isNotBlank(deptId)){
|
|
|
+ public ResultData treeselect(@RequestParam(required = false) String caseId) {
|
|
|
+ if(StringUtils.isNotBlank(caseId)){
|
|
|
+ CaseEntity caseEntity = caseService.getById(caseId);
|
|
|
+ if(caseEntity == null ){
|
|
|
+ throw new BusinessException(ResultCode.CASE_NOT_EXIST);
|
|
|
+ }
|
|
|
+ String deptId = caseEntity.getDeptId();
|
|
|
+ if(caseEntity.getType() == 1){
|
|
|
+ TmProject tmProject = tmProjectService.getById(caseEntity.getTmProjectId());
|
|
|
+ if(tmProject == null || StringUtils.isBlank(tmProject.getDeptId())){
|
|
|
+ throw new BusinessException(ResultCode.CASE_NOT_EXIST);
|
|
|
+ }
|
|
|
+ deptId = tmProject.getDeptId();
|
|
|
+ }
|
|
|
return ResultData.ok(departmentService.getDeptList(deptId));
|
|
|
}
|
|
|
return ResultData.ok(departmentService.getDeptList());
|