|
@@ -6,16 +6,20 @@ import com.dragoninfo.dcuc.auth.auth.entity.OrgQuotaAuthInfo;
|
|
|
import com.dragoninfo.dcuc.auth.auth.facade.IOrgQuotaAuthFacade;
|
|
|
import com.dragoninfo.dcuc.auth.sub.dto.AuthOrgDTO;
|
|
|
import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.dto.OrgQuotaNumDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
|
|
|
import com.dragoninfo.dcuc.auth.sub.facade.IAuthOrgInfoFacade;
|
|
|
import com.dragoninfo.dcuc.auth.sub.facade.IAuthUserInfoFacade;
|
|
|
import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.OrgQuotaAuthInfoVo;
|
|
|
import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.OrgQuotaOperateVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org.OrgTreeNodeVo;
|
|
|
import com.dragoninfo.dcuc.duceap.facade.ICodeListResourceFacade;
|
|
|
import com.dragoninfo.duceap.core.response.Result;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
import com.dragonsoft.duceap.base.entity.metadata.CodeRecord;
|
|
|
import com.dragonsoft.duceap.base.entity.security.SecurityUser;
|
|
|
import com.dragonsoft.duceap.base.exception.ApplicationException;
|
|
|
+import com.dragonsoft.duceap.base.utils.UserContextUtils;
|
|
|
import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
|
import com.dragonsoft.duceap.core.context.ContextUtils;
|
|
|
import com.dragonsoft.duceap.web.annotation.Permission;
|
|
@@ -34,6 +38,7 @@ import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Api(tags = {"授权模块-机构配额管理"})
|
|
|
@RestController
|
|
@@ -64,6 +69,88 @@ public class OrgQuotaAuthController {
|
|
|
// Map<String, Integer> orgMgeNum = authOrgInfoFacade.getOrgMgeNum(orgId);
|
|
|
// return Result.success(orgMgeNum);
|
|
|
// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 本级权限收回
|
|
|
+// *
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "本级权限收回")
|
|
|
+// @ApiImplicitParams({@ApiImplicitParam(name = "appId",required = true),
|
|
|
+// @ApiImplicitParam(name = "roleId", value = "角色id",required = true),
|
|
|
+// @ApiImplicitParam(name = "orgId", value = "机构id",required = true),
|
|
|
+// })
|
|
|
+// @Permission(value = "org_quota")
|
|
|
+// @PutMapping(value = "/authCancelSelf",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+// public Result authCancelSelf(@RequestBody OrgQuotaOperateVo orgQuotaOperateVo) {
|
|
|
+// String appId = orgQuotaOperateVo.getAppId();
|
|
|
+// String roleId = orgQuotaOperateVo.getRoleId();
|
|
|
+// String orgId = orgQuotaOperateVo.getAppOrgId();
|
|
|
+// String appMtAuthOrgIds = iAppMtAuthFacade.appMtList(ContextUtils.getUserInfo().getId()).get(0).getOrgId();
|
|
|
+// ResponseStatus responseMessage = iOrgQuotaAuthFacade.authCancelSelf(appId, roleId, orgId, appMtAuthOrgIds);
|
|
|
+// if(ResponseStatus.SUCCESS_CODE.equals(responseMessage.getStatusCode())){
|
|
|
+// return Result.success(responseMessage.getMessage());
|
|
|
+// }else {
|
|
|
+// return Result.fail(responseMessage.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机构配置-配额下发-计算
|
|
|
+ * @param roleLevel 角色层级
|
|
|
+ * @param unitClass 单位类别
|
|
|
+ * @param orgId 应用所属机构id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/searchOrg")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "roleLevel", value = "角色层级", required = true),
|
|
|
+ @ApiImplicitParam(name = "unitClass", value = "单位类别", required = true),
|
|
|
+ @ApiImplicitParam(name = "orgId", value = "机构id"),
|
|
|
+ })
|
|
|
+ public Result<OrgQuotaNumDTO> searchOrg(
|
|
|
+ @RequestParam(value = "orgId", required = false) String orgId,
|
|
|
+ @RequestParam(value = "unitClass") String unitClass,
|
|
|
+ @RequestParam(value = "roleLevel") String roleLevel) {
|
|
|
+ SecurityUser user = UserContextUtils.getCurrentUser();
|
|
|
+ try {
|
|
|
+ OrgQuotaNumDTO orgQuotaNumsVo = authOrgInfoFacade.searchOrgForQuota(user.getId(), orgId, unitClass, roleLevel);
|
|
|
+ return Result.success(orgQuotaNumsVo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("searchOrg异常", e);
|
|
|
+ return Result.fail("计算失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 授权管理-机构配额-配额下发-机构树
|
|
|
+ * @param unitClass
|
|
|
+ * @param roleLevel
|
|
|
+ * @param id 节点机构id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "calQuotaTreeYB")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "roleLevel", value = "角色层级",required = false),
|
|
|
+ @ApiImplicitParam(name = "unitClass", value = "单位类别",required = false),
|
|
|
+ @ApiImplicitParam(name = "id", value = "机构id",required = false)
|
|
|
+ })
|
|
|
+ public Result<List<OrgTreeNodeVo>> 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 Result.success(new ArrayList<>());
|
|
|
+ } else {
|
|
|
+ SecurityUser user = UserContextUtils.getCurrentUser();
|
|
|
+ List<OrgTreeNodeDTO> calQuotaTree = authOrgInfoFacade.getCalQuotaTree(user.getId(), id, unitClass, roleLevel);
|
|
|
+ List<OrgTreeNodeVo> collect = calQuotaTree.stream().map(e -> {
|
|
|
+ OrgTreeNodeVo nodeVo = new OrgTreeNodeVo();
|
|
|
+ BeanUtils.copyProperties(e, nodeVo);
|
|
|
+ return nodeVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return Result.success(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取指定机构配额分配信息
|
|
@@ -94,7 +181,7 @@ public class OrgQuotaAuthController {
|
|
|
@ApiOperation(value = "保存机构配额分配信息")
|
|
|
@PostMapping(value = "/orgQuota",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Result orgQuotaSave(@RequestBody List<OrgQuotaOperateVo> list) {
|
|
|
- SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+ SecurityUser curUser = UserContextUtils.getCurrentUser();
|
|
|
AuthUserDTO userInfo = authUserInfoFacade.get(curUser.getId());
|
|
|
if(null == userInfo) {
|
|
|
throw new ApplicationException("查询不到用户信息");
|
|
@@ -115,31 +202,6 @@ public class OrgQuotaAuthController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 本级权限收回
|
|
|
-// *
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @ApiOperation(value = "本级权限收回")
|
|
|
-// @ApiImplicitParams({@ApiImplicitParam(name = "appId",required = true),
|
|
|
-// @ApiImplicitParam(name = "roleId", value = "角色id",required = true),
|
|
|
-// @ApiImplicitParam(name = "orgId", value = "机构id",required = true),
|
|
|
-// })
|
|
|
-// @Permission(value = "org_quota")
|
|
|
-// @PutMapping(value = "/authCancelSelf",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
-// public Result authCancelSelf(@RequestBody OrgQuotaOperateVo orgQuotaOperateVo) {
|
|
|
-// String appId = orgQuotaOperateVo.getAppId();
|
|
|
-// String roleId = orgQuotaOperateVo.getRoleId();
|
|
|
-// String orgId = orgQuotaOperateVo.getAppOrgId();
|
|
|
-// String appMtAuthOrgIds = iAppMtAuthFacade.appMtList(ContextUtils.getUserInfo().getId()).get(0).getOrgId();
|
|
|
-// ResponseStatus responseMessage = iOrgQuotaAuthFacade.authCancelSelf(appId, roleId, orgId, appMtAuthOrgIds);
|
|
|
-// if(ResponseStatus.SUCCESS_CODE.equals(responseMessage.getStatusCode())){
|
|
|
-// return Result.success(responseMessage.getMessage());
|
|
|
-// }else {
|
|
|
-// return Result.fail(responseMessage.getMessage());
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
/**
|
|
|
* 子级权限收回
|
|
|
* @return
|
|
@@ -162,7 +224,7 @@ public class OrgQuotaAuthController {
|
|
|
@ApiOperation(value = "配额批量计算下发")
|
|
|
@PostMapping(value = "/orgQuotaCalSave",produces = MediaType.APPLICATION_JSON_UTF8_VALUE )
|
|
|
public Result orgQuotaCalSave(@RequestBody OrgQuotaOperateVo orgQuotaOperateVo) {
|
|
|
- SecurityUser userInfo = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
+ SecurityUser userInfo = UserContextUtils.getCurrentUser();
|
|
|
AuthUserDTO user = authUserInfoFacade.get(userInfo.getId());
|
|
|
userInfo.setSecurityOrg(user.getOrgId());
|
|
|
userInfo.setSecurityOrgName(user.getOrgName());
|
|
@@ -178,58 +240,6 @@ public class OrgQuotaAuthController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 机构配置-配额下发-计算
|
|
|
-// * @param roleLevel 角色层级
|
|
|
-// * @param unitClass 单位类别
|
|
|
-// * @param orgId 应用所属机构id
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @GetMapping(value = "/searchOrg")
|
|
|
-// @ApiImplicitParams({@ApiImplicitParam(name = "roleLevel", value = "角色层级", required = true),
|
|
|
-// @ApiImplicitParam(name = "unitClass", value = "单位类别", required = true),
|
|
|
-// @ApiImplicitParam(name = "orgId", value = "机构id"),
|
|
|
-// })
|
|
|
-// public Result<OrgQuotaNumDTO> searchOrg(
|
|
|
-// @RequestParam(value = "orgId", required = false) String orgId,
|
|
|
-// @RequestParam(value = "unitClass") String unitClass,
|
|
|
-// @RequestParam(value = "roleLevel") String roleLevel) {
|
|
|
-// SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
-// try {
|
|
|
-//
|
|
|
-// OrgQuotaNumDTO orgQuotaNumsVo = authOrgInfoFacade.searchOrgForQuota(user.getId(), orgId, unitClass, roleLevel);
|
|
|
-// return Result.success(orgQuotaNumsVo);
|
|
|
-// } catch (Exception e) {
|
|
|
-// logger.error("searchOrg异常", e);
|
|
|
-// return Result.fail("计算失败");
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 授权管理-机构配额-配额下发-机构树
|
|
|
-// * @param unitClass
|
|
|
-// * @param roleLevel
|
|
|
-// * @param id 节点机构id
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @GetMapping(value = "calQuotaTreeYB")
|
|
|
-// @ApiImplicitParams({@ApiImplicitParam(name = "roleLevel", value = "角色层级",required = false),
|
|
|
-// @ApiImplicitParam(name = "unitClass", value = "单位类别",required = false),
|
|
|
-// @ApiImplicitParam(name = "id", value = "机构id",required = false)
|
|
|
-// })
|
|
|
-// public Result<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 Result.success(new ArrayList<OrgTreeNode>());
|
|
|
-// } else {
|
|
|
-// SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
|
|
|
-// List<OrgTreeNode> calQuotaTree = authOrgInfoFacade.getCalQuotaTree(id, user.getId(), unitClass, roleLevel);
|
|
|
-// return Result.success(calQuotaTree);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
/**
|
|
|
* 根据筛选的条件确定分配范围可选项
|
|
|
* @param orgId
|