|
@@ -2,6 +2,8 @@ package com.rf.psychological.institution.rest;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.rf.psychological.base.rest.BaseController;
|
|
|
+import com.rf.psychological.structure.dao.model.StructureEntity;
|
|
|
+import com.rf.psychological.structure.service.StructureService;
|
|
|
import com.rf.psychological.user.dao.model.UserEntity;
|
|
|
import com.rf.psychological.dao.vo.SaveInstitutionVO;
|
|
|
import com.rf.psychological.enums.UserRole;
|
|
@@ -22,6 +24,7 @@ import com.rf.psychological.scale.dao.model.UserRecordEntity;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
@@ -50,6 +53,9 @@ public class InstitutionController extends BaseController {
|
|
|
@Autowired
|
|
|
private UserRecordService userRecordService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StructureService structureService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取机构列表
|
|
|
*
|
|
@@ -345,12 +351,15 @@ public class InstitutionController extends BaseController {
|
|
|
|
|
|
@SafetyProcess
|
|
|
@OperationLogAnnotation
|
|
|
- @GetMapping("/del/{institutionId}")
|
|
|
+ @GetMapping("/del/{institutionNo}")
|
|
|
@ApiOperation(value = "删除机构")
|
|
|
- public Result mineTest(@PathVariable String institutionId) {
|
|
|
-
|
|
|
+ public Result deleteInstitution( @PathVariable String institutionNo) {
|
|
|
try {
|
|
|
- this.institutionService.delInstitution(institutionId);
|
|
|
+ List<StructureEntity> list = structureService.findByInstitutionNo(institutionNo);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ return fail("存在组织架构不允许删除");
|
|
|
+ }
|
|
|
+ this.institutionService.delInstitution(institutionNo);
|
|
|
return success();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|