|
@@ -0,0 +1,816 @@
|
|
|
+package com.dragoninfo.dcuc.authweb.restcontroller.org;
|
|
|
+
|
|
|
+import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
|
+import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
|
|
|
+import com.dragoninfo.dcuc.authweb.common.MtAuthService;
|
|
|
+import com.dragoninfo.dcuc.authweb.common.SysConstants;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.org.vo.MergersVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.org.vo.OrgRangeVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.org.vo.OrgVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.org.vo.SortVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.statisics.vo.OrgTreeNodeVo;
|
|
|
+
|
|
|
+import com.dragoninfo.dcuc.authweb.util.UserUtils;
|
|
|
+import com.dragoninfo.dcuc.authweb.util.VersionUtils;
|
|
|
+import com.dragoninfo.dcuc.org.entity.OrgInfo;
|
|
|
+import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
|
|
|
+
|
|
|
+import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
|
|
|
+import com.dragoninfo.dcuc.user.admin.entity.OrgMtAuth;
|
|
|
+import com.dragoninfo.dcuc.user.admin.facade.*;
|
|
|
+import com.dragoninfo.dcuc.user.admin.vo.NoticeUserVO;
|
|
|
+import com.dragoninfo.dcuc.user.user.entity.UserInfo;
|
|
|
+import com.dragoninfo.dcuc.user.user.enumresources.YesNotEnum;
|
|
|
+import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
|
|
|
+import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
|
|
|
+import com.dragoninfo.duceap.core.enums.ResultEnum;
|
|
|
+import com.dragoninfo.duceap.core.response.Result;
|
|
|
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
|
|
|
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
+import com.dragonsoft.duceap.base.entity.security.SecurityUser;
|
|
|
+import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
|
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
|
+import com.dragonsoft.duceap.commons.util.tree.SimpleTreeNodeItemResolver;
|
|
|
+import com.dragonsoft.duceap.commons.util.tree.TreeNodeUtils;
|
|
|
+import com.dragonsoft.duceap.core.context.ContextUtils;
|
|
|
+import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
+import com.dragonsoft.duceap.core.search.enums.SearchOperator;
|
|
|
+import com.dragonsoft.duceap.web.utils.SessionUtils;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 勿删权限机构列表
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+@Api(tags = {"机构管理接口"})
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/orgsvr/"+ VersionUtils.VERSION_UID+"/")
|
|
|
+public class OrgInfoController {
|
|
|
+ @Autowired
|
|
|
+ private IOrgInfoFacade iOrgInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private IOrgMtAuthFacade iOrgMtAuthFacade;
|
|
|
+ @Autowired
|
|
|
+ private IUserInfoFacade iUserInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private IManageInfoFacade iManageInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private IUserMtAuthFacade iUserMtAuthFacade;
|
|
|
+ @Autowired
|
|
|
+ private IAppMtAuthFacade iAppMtAuthFacade;
|
|
|
+ @Autowired
|
|
|
+ private IApplyInfoFacade applyInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private MtAuthService mtAuthService;
|
|
|
+ @Autowired
|
|
|
+ private IMgeMtAuthFacade iMgeMtAuthFacade;
|
|
|
+
|
|
|
+ Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 当前用户的管理范围机构树
|
|
|
+ * @param params type:机构树类型 (ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围 ), id:异步加载的树节点
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "机构树")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "id", value = "id"),
|
|
|
+ @ApiImplicitParam(name = "type", value = "type:机构树类型(ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围)")})
|
|
|
+ @PostMapping(value = "org/tree/catalog")
|
|
|
+ public Result orgMtTreeYB(@RequestBody Map params) {
|
|
|
+ String id = (String) params.get("id");
|
|
|
+ String type = (String) params.get("type");
|
|
|
+ //获取管理范围ids
|
|
|
+ SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+ String mtAuthIds = mtAuthService.getMtAuth(curUser.getId(), type);
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
+ //获取机构树根节点列表
|
|
|
+ List<Map<String, Object>> result = this.treeRootList(mtAuthIds);
|
|
|
+ return Result.success(result);
|
|
|
+ } else {
|
|
|
+ List<Map<String, Object>> result = this.getChildTreeNode(id, YesNotEnum.NO.getValue(), mtAuthIds);
|
|
|
+ return Result.success(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取单个树节点机构信息
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "单个树节点信息")
|
|
|
+ @ApiImplicitParam(name = "id", value = "id")
|
|
|
+ @GetMapping(value = "org/tree/node/{id}")
|
|
|
+ public Result<OrgTreeNodeVo> orgTreeNode(@PathVariable("id")String id) {
|
|
|
+ OrgTreeNode orgTreeNode = iOrgInfoFacade.getOrgTreeNode(id);
|
|
|
+ OrgTreeNodeVo vo = new OrgTreeNodeVo();
|
|
|
+ BeanUtils.copyProperties(orgTreeNode,vo);
|
|
|
+ vo.setName(orgTreeNode.getLabel());
|
|
|
+ return Result.success(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 管理员管理—管理范围—分配树
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "管理员管理—管理范围—分配树")
|
|
|
+ @PostMapping(value = "org/tree/admin")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "id", value = "id"),
|
|
|
+ @ApiImplicitParam(name = "userId", value = "用户ID", required = true),
|
|
|
+ @ApiImplicitParam(name = "mtType", value = "type:机构树类型(ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围)", required = true)
|
|
|
+ })
|
|
|
+ public Result orgMtTreeWithChecked(@RequestBody OrgRangeVo orgRangeVo) {
|
|
|
+ String id = orgRangeVo.getId();
|
|
|
+ String mtType = orgRangeVo.getMtType();
|
|
|
+ String userId = orgRangeVo.getUserId();
|
|
|
+ //获取管理范围ids
|
|
|
+ SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+ String mtAuthIds = mtAuthService.getMtAuth(curUser.getId(),mtType);
|
|
|
+ //当临时表没有数据时候,获取登录人的权限范围
|
|
|
+ if (StringUtils.isEmpty(mtAuthIds)&&SysConstants.MT_TEMP.equals(orgRangeVo.getMtType())){
|
|
|
+ mtAuthIds=iAppMtAuthFacade.mgeAppRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
+ //获取机构树根节点列表
|
|
|
+ List<Map<String, Object>> treeList = this.treeRootList(mtAuthIds);
|
|
|
+ return Result.success(checkTreeNode(treeList, mtType, userId));
|
|
|
+ } else {
|
|
|
+ List<Map<String, Object>> treeList = this.getChildTreeNode(id, YesNotEnum.NO.getValue(), mtAuthIds);
|
|
|
+ return Result.success(checkTreeNode(treeList, mtType, userId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 、机构新增
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "机构新增")
|
|
|
+ @PostMapping(value = "org")
|
|
|
+ public Result save(@RequestBody OrgVo vo) {
|
|
|
+ try {
|
|
|
+ OrgInfo orgInfo = new OrgInfo();
|
|
|
+ UserUtils.copyObject(orgInfo, vo);
|
|
|
+ SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+ orgInfo = this.upSetOrg(orgInfo);
|
|
|
+ if (iOrgInfoFacade.checkCode("", orgInfo.getCode()) != null)
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "机构代码已存在");
|
|
|
+ if (iOrgInfoFacade.checkName("", orgInfo.getFullName(), "") != null)
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "机构名称已存在");
|
|
|
+
|
|
|
+ if (!iUserInfoFacade.getRootUser().equals(user.getUserName()) && StringUtils.isEmpty(orgInfo.getUpGovId()))
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "请选择机构后再新增!");
|
|
|
+ //保存机构在这
|
|
|
+ orgInfo = iOrgInfoFacade.addOrg(orgInfo);
|
|
|
+ // TODO: 2019/1/30
|
|
|
+ //维护子表
|
|
|
+ if (!iUserInfoFacade.getRootUser().equals(user.getName())) {
|
|
|
+ OrgMtAuth orgMtAuth = iOrgMtAuthFacade.getOrgMtAuthById(user.getId()).get(0);
|
|
|
+ String orgMtIds = orgMtAuth.getOrgId();
|
|
|
+ if (orgMtIds != null && orgMtIds.indexOf(orgInfo.getUpGovId() + ":0") >= 0) {
|
|
|
+ //原机构范围只勾选了父节点,需添加新增的机构节点,修改父节点记录为勾选部分子节点
|
|
|
+ orgMtIds = orgMtIds.replace(orgInfo.getUpGovId() + ":0", orgInfo.getUpGovId() + ":1," + orgInfo.getId() + ":-1");
|
|
|
+ } else if (orgMtIds != null && orgMtIds.indexOf(orgInfo.getUpGovId() + ":1") >= 0) {
|
|
|
+ //原父节点记录为勾选部分子节点,需添加新增的机构节点
|
|
|
+ orgMtIds = orgMtIds.replace(orgInfo.getUpGovId() + ":1", orgInfo.getUpGovId() + ":1," + orgInfo.getId() + ":-1");
|
|
|
+ }
|
|
|
+ if (!orgMtAuth.getOrgId().equals(orgMtIds)) {
|
|
|
+ orgMtAuth.setOrgId(orgMtIds);
|
|
|
+ iOrgMtAuthFacade.save(orgMtIds, user.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
+ return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "新增异常");
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "机构修改")
|
|
|
+ @PutMapping(value = "org/{id}")
|
|
|
+ public Result update(@RequestBody OrgVo vo) {
|
|
|
+ try {
|
|
|
+ if (iOrgInfoFacade.checkCode(vo.getId(), vo.getCode()) != null)
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "机构代码已存在");
|
|
|
+ if (iOrgInfoFacade.checkName(vo.getId(), vo.getFullName(), "") != null)
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "机构名称已存在");
|
|
|
+ OrgInfo orgInfo = iOrgInfoFacade.detail(vo.getId());
|
|
|
+ Date date = orgInfo.getOrgEndDate();
|
|
|
+ UserUtils.copyObject(orgInfo, vo);
|
|
|
+ orgInfo.setOrgStartDate(date);
|
|
|
+ iOrgInfoFacade.updateOrg(orgInfo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("修改失败", e);
|
|
|
+ return Result.fail(ResultEnum.SERVICE_FAIL.getKey(), "保存失败");
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置org更新值
|
|
|
+ * @param orgInfo
|
|
|
+ */
|
|
|
+
|
|
|
+ private OrgInfo upSetOrg(OrgInfo orgInfo) {
|
|
|
+ OrgInfo oldOrg = new OrgInfo();
|
|
|
+ if (StringUtils.isNotEmpty(orgInfo.getId())) {
|
|
|
+ oldOrg = iOrgInfoFacade.detail(orgInfo.getId());
|
|
|
+ } else {
|
|
|
+ oldOrg.setOrgStartDate(new Date());
|
|
|
+ }
|
|
|
+ oldOrg.setUpGovId(orgInfo.getUpGovId());
|
|
|
+ oldOrg.setOrgKind(orgInfo.getOrgKind());
|
|
|
+ oldOrg.setFullName(orgInfo.getFullName());
|
|
|
+ oldOrg.setShortName(orgInfo.getShortName());
|
|
|
+ oldOrg.setAreaCode(orgInfo.getAreaCode());
|
|
|
+ oldOrg.setBizType(orgInfo.getBizType());
|
|
|
+ oldOrg.setCode(orgInfo.getCode());
|
|
|
+ oldOrg.setOrgType(orgInfo.getOrgType());
|
|
|
+ oldOrg.setUnitClass(orgInfo.getUnitClass());
|
|
|
+ oldOrg.setOrgLevel(orgInfo.getOrgLevel());
|
|
|
+ oldOrg.setEmail(orgInfo.getEmail());
|
|
|
+ oldOrg.setLinkMan(orgInfo.getLinkMan());
|
|
|
+ oldOrg.setTel(orgInfo.getTel());
|
|
|
+ oldOrg.setOrgRank(orgInfo.getOrgRank());
|
|
|
+ return oldOrg;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构删除
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "机构删除")
|
|
|
+ @ApiImplicitParam(name = "id", value = "id")
|
|
|
+ @DeleteMapping(value = "org/{id}")
|
|
|
+ public Result deleteOrg(@PathVariable("id") String id) {
|
|
|
+ logger.info(id);
|
|
|
+ Searchable searchable = Searchable.newSearchable();
|
|
|
+ searchable.addSearchFilter("orgId", SearchOperator.eq, id);
|
|
|
+ searchable.addSearchFilter("deleted", SearchOperator.eq, YesNotEnum.NO.getValue());
|
|
|
+ SearchDTO searchDTO = searchable.toSearchDTO();
|
|
|
+ Page<UserInfo> page = iUserInfoFacade.userList(searchDTO);
|
|
|
+ if (page.getContent().size() > 0)
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "该机构有人员存在,不可删除");
|
|
|
+ Page<ApplyInfo> appPage = applyInfoFacade.applyInfoPage(searchDTO);
|
|
|
+ if (appPage.getContent().size() > 0)
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "该机构有应用存在,不可删除");
|
|
|
+// searchable = Searchable.newSearchable();
|
|
|
+// searchable.addSearchFilter("orgId", SearchOperator.eq, id);
|
|
|
+// searchDTO = searchable.toSearchDTO();
|
|
|
+// List<TenantOrg> tenantOrgs = tenementFacade.checkOrg(searchDTO);
|
|
|
+// if (tenantOrgs != null && tenantOrgs.size() > 0)
|
|
|
+// return ResponseStatus.fail("该机构有租户存在,不可删除");
|
|
|
+ try {
|
|
|
+ iOrgInfoFacade.deleteOrg(id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("删除失败", e);
|
|
|
+ return Result.fail(ResultEnum.SERVICE_FAIL.getKey(), "删除失败");
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "机构调动")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "orgId", value = "机构id", required = true),
|
|
|
+ @ApiImplicitParam(name = "upGovId", value = "上级机构Id", required = true),})
|
|
|
+ @PostMapping(value = "org/transfer")
|
|
|
+ public Result orgInfoMove(@RequestBody MergersVo mergersVo) {
|
|
|
+ String orgId = mergersVo.getOrgId();
|
|
|
+ String upGovId = mergersVo.getUpGovId();
|
|
|
+ if (orgId.equals(upGovId)) {
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "不能选择自身");
|
|
|
+ }
|
|
|
+ OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
|
|
|
+ if (orgInfo.getUpGovId().equals(upGovId)) {
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "不能选择同一个上级机构");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ iOrgInfoFacade.moveOrg(orgId, upGovId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("调动失败", e);
|
|
|
+ return Result.fail(ResultEnum.SERVICE_FAIL.getKey(), "调动失败");
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构合并
|
|
|
+ * @param mergersVo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "机构合并")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "orgId", value = "合并机构id", required = true),
|
|
|
+ @ApiImplicitParam(name = "targetId", value = "目标机构Id", required = true),})
|
|
|
+ @PostMapping(value = "org/mergers")
|
|
|
+ public Result orgInfoMerfe(@RequestBody MergersVo mergersVo) {
|
|
|
+ String orgId = mergersVo.getOrgId();
|
|
|
+ String targetId = mergersVo.getTargetId();
|
|
|
+ if (orgId.equals(targetId))
|
|
|
+ return Result.fail(ResultEnum.FAIL.getKey(), "不能选择自身");
|
|
|
+ ResponseStatus result = iOrgInfoFacade.orgInfoMerge(orgId, targetId);
|
|
|
+ if (result.getStatusCode().equals("200")) {
|
|
|
+ OrgInfo orgInfo = iOrgInfoFacade.detail(targetId);
|
|
|
+ iUserInfoFacade.updateByOrgId(orgId, targetId, orgInfo.getFullName());
|
|
|
+ List<NoticeUserVO> list = iManageInfoFacade.getManagerByOrgId(orgId);
|
|
|
+ for (NoticeUserVO note : list) {
|
|
|
+ if (!StringUtils.isEmpty(note.getUserId())) {
|
|
|
+ iAppMtAuthFacade.save("", note.getUserId());
|
|
|
+ iUserMtAuthFacade.save("", note.getUserId());
|
|
|
+ iOrgMtAuthFacade.save("", note.getUserId());
|
|
|
+ iManageInfoFacade.deleteAdmin(note.getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "机构拖动排序")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "startId", value = "需要拖动的机构", required = true),
|
|
|
+ @ApiImplicitParam(name = "endId", value = "拖动到目标机构", required = true),
|
|
|
+ @ApiImplicitParam(name = "moveType", value = "prev:目标机构前,next: 目标机构后", required = true)})
|
|
|
+ @PostMapping(value = "org/sort")
|
|
|
+ public Result reSort(@RequestBody SortVo sortVo) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ iOrgInfoFacade.reSort(sortVo.getStartId(), sortVo.getEndId(), sortVo.getMoveType());
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("排序失败", e);
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构详情
|
|
|
+ * @param orgId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "org/{id}")
|
|
|
+ @ApiOperation(value = "获取单个机构")
|
|
|
+ @ApiImplicitParam(name = "id", value = "id", required = true)
|
|
|
+ public Result<OrgVo> orgInfoDetail(@PathVariable(value = "id") String orgId) {
|
|
|
+ OrgInfo detail = iOrgInfoFacade.detail(orgId);
|
|
|
+ OrgVo org = new OrgVo();
|
|
|
+ UserUtils.copyObject(org, detail);
|
|
|
+ List<NoticeUserVO> managerList = this.getAdmins(orgId);
|
|
|
+ org.setAdmins(managerList);
|
|
|
+ return Result.success(org);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * orginfo转map
|
|
|
+ * @param orgInfosList
|
|
|
+ * @param orgNums
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<Map<String, Object>> orgToTreeNode(List<OrgInfo> orgInfosList, Map<String, Long> orgNums) {
|
|
|
+ //子级和自身的子级个数
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ for (OrgInfo orgInfo : orgInfosList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", orgInfo.getId());
|
|
|
+ map.put("code", orgInfo.getCode());
|
|
|
+ map.put("name", orgInfo.getFullName());
|
|
|
+ map.put("pid", orgInfo.getUpGovId());
|
|
|
+ map.put("path", orgInfo.getPath());
|
|
|
+ if (orgNums.containsKey(orgInfo.getId()) && orgNums.get(orgInfo.getId()) > 0) {
|
|
|
+ map.put("isParent", true);
|
|
|
+ } else {
|
|
|
+ map.put("isParent", false);
|
|
|
+ }
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+// @PostMapping(value = "org/tree/auth")
|
|
|
+// @ApiOperation(value = "授权管理—机构配额详情、人员授权详情机构树")
|
|
|
+// @ApiImplicitParams({
|
|
|
+// @ApiImplicitParam(name="id",value="id"),
|
|
|
+// @ApiImplicitParam(name="orgId",value="应用所属机构Id",required = true)
|
|
|
+// })
|
|
|
+// public Result<List<Map<String, Object>>> appMtTreeYB(@RequestBody Map<String,String> map) {
|
|
|
+// String orgId=map.get("orgId");
|
|
|
+// String id= map.get("id");
|
|
|
+// if (StringUtils.isEmpty(id)) {
|
|
|
+// String ids = getInitAuthTreeIds(orgId);
|
|
|
+// return Result.success(getInitMtTree(ids));
|
|
|
+// } else {
|
|
|
+// return Result.success(getChildTreeNode(id, YesNotEnum.NO.getValue()));
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 授权树的初始化
|
|
|
+// * 管理范围与应用所属机构的最小集合
|
|
|
+// *
|
|
|
+// * @param appOrgId
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// public String getInitAuthTreeIds(String appOrgId) {
|
|
|
+// SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+// if (iUserInfoFacade.getRootUser().equals(curUser.getName())) {
|
|
|
+// return appOrgId + ":2";
|
|
|
+// }
|
|
|
+// String mtIds = mtAuthService.getMtAuth(curUser.getId(), SysConstants.MT_APP);
|
|
|
+// return iOrgInfoFacade.filterMtIdsWithOrgIdAndChild(appOrgId, mtIds);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 机构配置-配额下发-计算
|
|
|
+// * @param request
|
|
|
+// * @param userId
|
|
|
+// * @param orgId 应用所属机构id
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping(value = "searchOrg")
|
|
|
+// public ResponseDTO searchOrg(HttpServletRequest request,
|
|
|
+// @RequestParam(value = "userId", required = false) String userId,
|
|
|
+// @RequestParam(value = "orgId", required = false) String orgId) {
|
|
|
+// SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+// String unitClass = request.getParameter("unitClass");
|
|
|
+// String roleLevel = request.getParameter("roleLevel");
|
|
|
+// return iOrgInfoFacade.searchOrgForQuota(user.getId(), orgId, unitClass, roleLevel);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+//
|
|
|
+// @ApiOperation(value = "批量导出机构树")
|
|
|
+// @ApiImplicitParams({
|
|
|
+// @ApiImplicitParam(name="type",value="type:机构树类型(ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围)",required = true)})
|
|
|
+// @PostMapping(value = "orgMap")
|
|
|
+// public Result orgMap(@RequestBody Map params) {
|
|
|
+// BaseSecurityUser userInfo = SessionUtils.getUserInfo();
|
|
|
+// String type = (String) params.get("type");
|
|
|
+// String mtOrgIds = mtAuthService.getMtAuth(userInfo.getId(), type);
|
|
|
+// Map<String, Object> result = iOrgInfoFacade.getUpgovIdMap(mtOrgIds);
|
|
|
+// return Result.success(result);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 机构新增、编辑
|
|
|
+// * @param orgId
|
|
|
+// * @param model
|
|
|
+// * @param type 1 跳转信息页,2 跳转新增页
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping(value = "orgInfo")
|
|
|
+// public String orgInfo(@RequestParam(value = "orgId", required = false) String orgId, Model model,
|
|
|
+// int type, String pageType) {
|
|
|
+// SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+// if (null == orgId || "0".equals(orgId) || "".equals(orgId)) {
|
|
|
+// UserInfo userInfo = iUserInfoFacade.userDetail(user.getId());
|
|
|
+// orgId = userInfo.getOrgId();
|
|
|
+// }
|
|
|
+// String fcode = "";
|
|
|
+// String scode = "";
|
|
|
+// OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
|
|
|
+// if (StringUtils.isNotEmpty(pageType)) {
|
|
|
+// model.addAttribute("pageType", pageType);
|
|
|
+// }
|
|
|
+// model.addAttribute("model", orgInfo);
|
|
|
+// if (type == 1) {
|
|
|
+// if (orgInfo != null) {
|
|
|
+// fcode = orgInfo.getCode().substring(0, orgInfo.getCode().length() - 4);
|
|
|
+// scode = orgInfo.getCode().substring(orgInfo.getCode().length() - 4, orgInfo.getCode().length());
|
|
|
+// }
|
|
|
+// model.addAttribute("fcode", fcode);
|
|
|
+// model.addAttribute("scode", scode);
|
|
|
+// List<NoticeUserVO> managerList = this.getAdmins(orgId);
|
|
|
+// if (CollectionUtils.isNotEmpty(managerList)) {//找到管理员
|
|
|
+// model.addAttribute("admins", managerList);
|
|
|
+// }
|
|
|
+// return "organization/orgInfo";
|
|
|
+// } else
|
|
|
+// return "organization/orgNew";
|
|
|
+// }
|
|
|
+
|
|
|
+ private List<NoticeUserVO> getAdmins(String orgId) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ List<NoticeUserVO> list = new ArrayList<NoticeUserVO>();
|
|
|
+ List<NoticeUserVO> targetList = iManageInfoFacade.getOrgMgeManager(orgId);
|
|
|
+ if (CollectionUtils.isEmpty(targetList)) {
|
|
|
+ OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
|
|
|
+ if (StringUtils.isNotBlank(orgInfo.getUpGovId())) {
|
|
|
+ String upGovId = orgInfo.getUpGovId();
|
|
|
+ targetList = getAdmins(upGovId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (NoticeUserVO noticeUserVO : targetList) {
|
|
|
+ if (map.get(noticeUserVO.getUserId()) == null) {
|
|
|
+ map.put(noticeUserVO.getUserId(), noticeUserVO);
|
|
|
+ list.add(noticeUserVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+//
|
|
|
+// private UserInfo getAdmin(List<NoticeUserVO> managerList) {
|
|
|
+// UserInfo adminUser = userInfoFacade.userDetail(managerList.get(0).getUserId());
|
|
|
+// adminUser.setMobileWork(managerList.get(0).getMobile());
|
|
|
+// return adminUser;
|
|
|
+// }
|
|
|
+
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 机构反馈-机构修改
|
|
|
+// * @param orgId
|
|
|
+// * @param model
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping(value = "orgInfoEdit")
|
|
|
+// public String orgInfoEdit(@RequestParam(value = "orgId", required = false) String orgId, Model model) {
|
|
|
+// OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
|
|
|
+// String fcode = "";
|
|
|
+// String scode = "";
|
|
|
+// if (orgInfo != null) {
|
|
|
+// fcode = orgInfo.getCode().substring(0, orgInfo.getCode().length() - 4);
|
|
|
+// scode = orgInfo.getCode().substring(orgInfo.getCode().length() - 4, orgInfo.getCode().length());
|
|
|
+// }
|
|
|
+// model.addAttribute("fcode", fcode);
|
|
|
+// model.addAttribute("scode", scode);
|
|
|
+// model.addAttribute("model", orgInfo);
|
|
|
+// return "organization/orgInfoEdit";
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 机构调动页面
|
|
|
+// * @param orgId
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping(value = "orgMove")
|
|
|
+// public String orgMove(@RequestParam(value = "orgId", required = true) String orgId, Model model) {
|
|
|
+// OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
|
|
|
+// model.addAttribute("model", orgInfo);
|
|
|
+// return "organization/orgMove";
|
|
|
+// }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 机构合并页面
|
|
|
+// * @param orgId
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping(value = "orgMerge")
|
|
|
+// public String orgMerge(@RequestParam(value = "orgId", required = true) String orgId, Model model) {
|
|
|
+// /* OrgInfo orgInfo = iOrgInfoFacade.detail(orgId);
|
|
|
+// String sex = CodeResourceUtils.convert("DM_SEX", "2", "null", "CODE");
|
|
|
+// logger.info(sex);
|
|
|
+// model.addAttribute("model", orgInfo);
|
|
|
+// return "organization/orgMerge";*/
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据ids获取初始树根节点
|
|
|
+ * @param mtAuthIds:管理范围ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> treeRootList(String mtAuthIds) {
|
|
|
+ if (StringUtils.isBlank(mtAuthIds)) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ StringBuffer orgIds = new StringBuffer();
|
|
|
+ for (String orgIdStr : mtAuthIds.split(",")) {
|
|
|
+ String[] orgIdStatus = orgIdStr.split(":");
|
|
|
+ orgIds.append(orgIdStatus[0] + ",");
|
|
|
+ }
|
|
|
+ List<OrgInfo> orgInfosList = iOrgInfoFacade.getOrgsByIds(orgIds.toString());
|
|
|
+ Map<String, Long> orgNums = iOrgInfoFacade.countOrgByIds(orgIds.toString());
|
|
|
+ List<Map<String, Object>> mapList = this.orgToTreeNode(orgInfosList, orgNums);
|
|
|
+ mapList = TreeNodeUtils.generateTree(mapList, new SimpleTreeNodeItemResolver("id", "pid"), 0);
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
+ map.remove("children");
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 异步获取子节点
|
|
|
+ * @param parentId 父节点id
|
|
|
+ * @param state 机构状态:0:未删除,1:已删除,null:全部
|
|
|
+ * @param mtAuthIds 管理范围,为""或null时不过滤
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> getChildTreeNode(String parentId, String state, String mtAuthIds) {
|
|
|
+ //子级机构
|
|
|
+ List<OrgInfo> childList = iOrgInfoFacade.getOrgListByUpId(parentId);
|
|
|
+ Map<String, Long> orgNums = iOrgInfoFacade.countOrgByUpOrgId(parentId, state);
|
|
|
+ if (StringUtils.isNotEmpty(mtAuthIds)) {
|
|
|
+ Iterator<OrgInfo> iterator = childList.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ OrgInfo orgInfo = iterator.next();
|
|
|
+ //不在管理范围内
|
|
|
+ if (!OrgInfoUtil.isHaveAuth(orgInfo.getId(), orgInfo.getPath(), mtAuthIds))
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> mapList = this.orgToTreeNode(childList, orgNums);
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 管理员管理-管理范围-节点状态勾选
|
|
|
+ * @param treeNodes
|
|
|
+ * @param type 机构树类型
|
|
|
+ * @param targetUserId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> checkTreeNode(List<Map<String, Object>> treeNodes, String type, String targetUserId) {
|
|
|
+ String mtAuthIds = mtAuthService.getMtAuth(targetUserId, type);
|
|
|
+ for (Map<String, Object> treeNode : treeNodes) {
|
|
|
+ String orgId = (String) treeNode.get("id");
|
|
|
+ String path = (String) treeNode.get("path");
|
|
|
+ if (StringUtils.isNotEmpty(mtAuthIds) && mtAuthIds.indexOf(orgId + ":1") > -1) {//半勾选
|
|
|
+ treeNode.put("checked", "1");
|
|
|
+ } else if (OrgInfoUtil.isHaveAuth(orgId, path, mtAuthIds)) {//全勾选
|
|
|
+ treeNode.put("checked", "2");
|
|
|
+ } else {
|
|
|
+ treeNode.put("checked", "0");//未勾选
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return treeNodes;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "完整树")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "节点机构id"),
|
|
|
+ @ApiImplicitParam(name = "type", value = "'1':顶点为自身所在机构,0:根节点", required = true)})
|
|
|
+ @PostMapping(value = "org/tree/full")
|
|
|
+ public Result fullOrgTree(@RequestBody Map<String, String> params) {
|
|
|
+ String id = params.get("id");
|
|
|
+ String type = params.get("type");
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
+ SecurityUser securityUser = SessionUtils.getUserInfo();
|
|
|
+ if (YesNotEnum.YES.getValue().equals(type) && StringUtils.isNotEmpty(securityUser.getSecurityOrg())) {
|
|
|
+ id = securityUser.getSecurityOrg();
|
|
|
+ } else {
|
|
|
+ id = iOrgInfoFacade.getRootOrgId();
|
|
|
+ }
|
|
|
+ List<OrgInfo> orgInfos = iOrgInfoFacade.getOrgsByIds(id);
|
|
|
+ Map<String, Long> orgNums = iOrgInfoFacade.countOrgByIds(id);
|
|
|
+ List<Map<String, Object>> resultList = this.orgToTreeNode(orgInfos, orgNums);
|
|
|
+ return Result.success(resultList);
|
|
|
+ } else {
|
|
|
+ List<Map<String, Object>> result = this.getChildTreeNode(id, YesNotEnum.NO.getValue(), null);
|
|
|
+ return Result.success(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构查询
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+// @PostMapping(value = "searchOrgTree")
|
|
|
+// public List<Map<String, Object>> searchOrgTree(@RequestParam(value = "orgName", required = false) String orgName,
|
|
|
+// @RequestParam(value = "orgCode", required = false) String orgCode) {
|
|
|
+// if (StringUtils.isBlank(orgName) && StringUtils.isBlank(orgCode)) {
|
|
|
+// throw new ApplicationException("orgName and orgCode can not be all Null");
|
|
|
+// }
|
|
|
+// return iOrgInfoFacade.searchOrgTree(orgName, orgCode);
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 授权管理-机构配额-配额下发-机构树
|
|
|
+ * @param unitClass
|
|
|
+ * @param roleLevel
|
|
|
+ * @param id 节点机构id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+// @PostMapping(value = "calQuotaTreeYB")
|
|
|
+// public List<OrgTreeNode> calQuotaTreeYB(
|
|
|
+// @RequestParam(value = "unitClass", required = false) String unitClass,
|
|
|
+// @RequestParam(value = "roleLevel", required = false) String roleLevel,
|
|
|
+// @RequestParam(value = "id", required = false) String id) {
|
|
|
+// if (StringUtils.isEmpty(id)) {
|
|
|
+// return new ArrayList<OrgTreeNode>();
|
|
|
+// } else {
|
|
|
+// SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+// return iOrgInfoFacade.getCalQuotaTree(id, user.getId(), unitClass, roleLevel);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审计管理—机构树
|
|
|
+ * @param type 机构树类型 ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围
|
|
|
+ * @param id 异步加载的树节点
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "审计管理—机构树")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "节点机构id", required = true),
|
|
|
+ @ApiImplicitParam(name = "type", value = "机构树类型 ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围", required = true)})
|
|
|
+ @PostMapping(value = "org/tree/audit")
|
|
|
+ public Result userAuditTree(
|
|
|
+ @RequestParam(value = "type", required = false) String type,
|
|
|
+ @RequestParam(value = "id", required = false) String id) {
|
|
|
+ //获取管理范围ids
|
|
|
+ SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+ String mtAuthIds = mtAuthService.getMtAuth(curUser.getId(), type);
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
+ List<Map<String, Object>> result = this.treeRootList(mtAuthIds);
|
|
|
+ return Result.success(result);
|
|
|
+ } else {
|
|
|
+ List<Map<String, Object>> result = this.getChildTreeNode(id, null, mtAuthIds);
|
|
|
+ return Result.success(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "机构树匹配")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "机构id", required = false),
|
|
|
+ @ApiImplicitParam(name = "mtType", value = "机构树类型 org:机构管理范围 user:用户管理范围 app:权限管理范围 mge:管理员管理范围", required = false),
|
|
|
+ @ApiImplicitParam(name = "pageNum", value = "条数", required = false),
|
|
|
+ @ApiImplicitParam(name = "pageSize", value = "页数", required = false)
|
|
|
+ })
|
|
|
+ @PostMapping(value = "org/tree/match")
|
|
|
+ public Result orgMatch(@RequestBody Map<String, Object> params) {
|
|
|
+ String mtType = (String) params.get("mtType");
|
|
|
+ String name = (String) params.get("name");
|
|
|
+ Integer pageNum = (Integer) params.get("pageNum");
|
|
|
+ Integer pageSize = (Integer) params.get("pageSize");
|
|
|
+ String mts = "";
|
|
|
+ String userName = ContextUtils.getUserInfo().getName();
|
|
|
+ if (StringUtils.isBlank(mtType)) {
|
|
|
+ mts = "";
|
|
|
+ } else if ("org".equals(mtType)) {
|
|
|
+ mts = iOrgMtAuthFacade.mgeOrgRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ } else if ("user".equals(mtType)) {
|
|
|
+ mts = iUserMtAuthFacade.mgeUserRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ } else if ("app".equals(mtType)) {
|
|
|
+ mts = iAppMtAuthFacade.mgeAppRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ } else if ("mge".equals(mtType)) {
|
|
|
+ mts = iMgeMtAuthFacade.mgeMgeRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ }
|
|
|
+ if (!iUserInfoFacade.getRootUser().equals(userName) && StringUtils.isBlank(mts) && !StringUtils.isBlank(mtType) && !"all".equals(mtType)) {
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+ ResponseDTO responseDTO = iOrgInfoFacade.orgMatch(name, mts, pageNum, pageSize);
|
|
|
+ return Result.success(StringUtils.getLong(responseDTO.getMessage()),responseDTO.getResult());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取过滤后的父节点")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "机构id", required = true),
|
|
|
+ @ApiImplicitParam(name = "type", value = "机构树类型 org:机构管理范围 user:用户管理范围 app:权限管理范围 mge:管理员管理范围", required = true),
|
|
|
+ })
|
|
|
+ @PostMapping(value = "org/tree/filter")
|
|
|
+ public Result getFilterOrgTree(@RequestParam(value = "codeId") String codeId,
|
|
|
+ @RequestParam(value = "type", required = false) String type) {
|
|
|
+ OrgTreeNode node = iOrgInfoFacade.getOrgTreeNode(codeId);
|
|
|
+ String path = node.getPath();
|
|
|
+ String[] paths = path.split("-");
|
|
|
+ List<String> levelOrder = new ArrayList<String>();
|
|
|
+ String mtIds = "";
|
|
|
+ if (StringUtils.isBlank(type)) {
|
|
|
+ mtIds = "";
|
|
|
+ } else if ("org".equals(type)) {
|
|
|
+ mtIds = iOrgMtAuthFacade.mgeOrgRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ } else if ("user".equals(type)) {
|
|
|
+ mtIds = iUserMtAuthFacade.mgeUserRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ } else if ("app".equals(type)) {
|
|
|
+ mtIds = iAppMtAuthFacade.mgeAppRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ } else if ("mge".equals(type)) {
|
|
|
+ mtIds = iMgeMtAuthFacade.mgeMgeRightRangeStr(ContextUtils.getUserInfo().getId());
|
|
|
+ } else {
|
|
|
+ mtIds = "";
|
|
|
+ }
|
|
|
+ for (String curNodeId : paths) {
|
|
|
+ OrgTreeNode curNode = iOrgInfoFacade.getOrgTreeNode(curNodeId);
|
|
|
+ if (OrgInfoUtil.isHaveAuth(curNode.getValue(), curNode.getPath(), mtIds) || StringUtils.isEmpty(mtIds)) {
|
|
|
+ levelOrder.add(curNodeId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ levelOrder.add(codeId);
|
|
|
+ return Result.success(levelOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 授权管理—机构配额详情、人员授权详情机构树
|
|
|
+// * @param id 节点机构id
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping(value = "appMtTree")
|
|
|
+// public List<Map<String, Object>> appMtTree(
|
|
|
+// @RequestParam(value = "id", required = false) String id) {
|
|
|
+// if (StringUtils.isEmpty(id)) {
|
|
|
+// SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+// String mtIds = mtAuthService.getMtAuth(curUser.getId(), SysConstants.MT_APP);
|
|
|
+// return getInitMtTree(mtIds);
|
|
|
+// } else {
|
|
|
+// return getChildTreeNode(id, YesNotEnum.NO.getValue());
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+}
|