RoleAuthInfoController.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. package com.dragoninfo.dcuc.authweb.restcontroller.auth;
  2. import com.alibaba.fastjson.JSON;
  3. import com.dragoninfo.dcuc.auth.auth.dto.RoleAuthDto;
  4. import com.dragoninfo.dcuc.auth.auth.dto.StaffAssignDTO;
  5. import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
  6. import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthInfo;
  7. import com.dragoninfo.dcuc.auth.auth.facade.IRoleAuthInfoFacade;
  8. import com.dragoninfo.dcuc.auth.auth.facade.IRoleInfoFacade;
  9. import com.dragoninfo.dcuc.auth.auth.facade.IStaffAssignAuthInfoFacade;
  10. import com.dragoninfo.dcuc.auth.auth.vo.RoleAuthParamVo;
  11. import com.dragoninfo.dcuc.auth.auth.vo.RoleInfoVO;
  12. import com.dragoninfo.dcuc.authweb.business.MtAuthBusiness;
  13. import com.dragoninfo.dcuc.authweb.common.SysConstants;
  14. import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.RoleAuthUserVo;
  15. import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.StaffAssignAuthInfoVo;
  16. import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.StaffOperateVo;
  17. import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.StaffRoleOperateVo;
  18. import com.dragoninfo.dcuc.duceap.facade.ICodeListResourceFacade;
  19. import com.dragoninfo.dcuc.duceap.facade.IDuceapCodeFacade;
  20. import com.dragoninfo.dcuc.org.entity.OrgInfo;
  21. import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
  22. import com.dragoninfo.dcuc.user.user.entity.UserInfo;
  23. import com.dragoninfo.dcuc.user.user.entity.UserInfoView;
  24. import com.dragoninfo.dcuc.user.user.enumresources.JobTypeEnum;
  25. import com.dragoninfo.dcuc.user.user.enumresources.YesNotEnum;
  26. import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
  27. import com.dragoninfo.duceap.core.enums.RoleLevelEnum;
  28. import com.dragoninfo.duceap.core.response.Result;
  29. import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
  30. import com.dragonsoft.duceap.base.entity.metadata.CodeRecord;
  31. import com.dragonsoft.duceap.base.entity.search.SearchDTO;
  32. import com.dragonsoft.duceap.base.entity.security.SecurityUser;
  33. import com.dragonsoft.duceap.commons.util.string.StringUtils;
  34. import com.dragonsoft.duceap.core.context.ContextUtils;
  35. import com.dragonsoft.duceap.core.entity.page.PageImpl;
  36. import com.dragonsoft.duceap.core.search.Searchable;
  37. import com.dragonsoft.duceap.core.search.enums.SearchOperator;
  38. import com.dragonsoft.duceap.core.search.filter.Condition;
  39. import com.dragonsoft.duceap.web.annotation.Permission;
  40. import io.swagger.annotations.Api;
  41. import io.swagger.annotations.ApiImplicitParam;
  42. import io.swagger.annotations.ApiImplicitParams;
  43. import io.swagger.annotations.ApiOperation;
  44. import org.hibernate.validator.internal.IgnoreForbiddenApisErrors;
  45. import org.springframework.beans.BeanUtils;
  46. import org.springframework.beans.factory.annotation.Autowired;
  47. import org.springframework.data.domain.Page;
  48. import org.springframework.http.MediaType;
  49. import org.springframework.web.bind.annotation.*;
  50. import java.util.*;
  51. @Api(tags = {"授权模块-角色授权管理接口"})
  52. @RestController
  53. @RequestMapping(value = "authsvr/v2/roleauthinfo")
  54. public class RoleAuthInfoController {
  55. @Autowired
  56. private IRoleAuthInfoFacade iRoleAuthInfoFacade;
  57. @Autowired
  58. private IUserInfoFacade iUserInfoFacade;
  59. @Autowired
  60. private IOrgInfoFacade iOrgInfoFacade;
  61. @Autowired
  62. private IRoleInfoFacade roleInfoFacade;
  63. @Autowired
  64. private IStaffAssignAuthInfoFacade staffAssignAuthInfoFacade;
  65. @Autowired
  66. private MtAuthBusiness mtAuthBusiness;
  67. @Autowired
  68. private ICodeListResourceFacade iCodeListResourceFacade;
  69. @Autowired
  70. private IDuceapCodeFacade iDuceapCodeFacade;
  71. /**
  72. * 角色视图 人员列表
  73. * @param
  74. * @return
  75. */
  76. @ApiOperation(value = "角色视图 人员列表")
  77. @ApiImplicitParams({@ApiImplicitParam(name = "RoleAuthUserVo", value = "角色视图-人员列表参数")
  78. })
  79. @PostMapping(value = "/roleStaffList/_search")
  80. public Result<List<UserInfoView>> roleStaffList( RoleAuthUserVo vo) {
  81. if (StringUtils.isEmpty(vo.getOrgId())) {
  82. return Result.success(new ArrayList<UserInfoView>());
  83. }
  84. OrgInfo orgInfo = iOrgInfoFacade.detail(vo.getOrgId());
  85. //找到角色id
  86. RoleInfo roleInfo = roleInfoFacade.get(vo.getRoleId());
  87. String orgLevel = null;
  88. if (StringUtils.isNotEmpty(orgInfo.getOrgLevel())) {
  89. orgLevel = orgInfo.getOrgLevel();
  90. }
  91. if (roleInfo.getRoleLevel() != null
  92. && !RoleLevelEnum.TY.getValue().equals(roleInfo.getRoleLevel())
  93. && !roleInfo.getRoleLevel().equals(orgLevel)) {
  94. return Result.success(new ArrayList<UserInfoView>());
  95. }
  96. List<UserInfoView> list = new ArrayList<UserInfoView>();
  97. Searchable searchable = Searchable.newSearchable();
  98. searchable.addSearchFilter("deleted", SearchOperator.eq,YesNotEnum.NO.getValue());
  99. searchable.addSearchFilter("name", SearchOperator.ne,iUserInfoFacade.getRootUser());
  100. searchable.addSearchFilter("org_id", SearchOperator.eq,vo.getOrgId());
  101. List<String> jobType = new ArrayList<String>();
  102. jobType.add(JobTypeEnum.LZ.getValue());
  103. jobType.add(JobTypeEnum.SW.getValue());
  104. jobType.add(JobTypeEnum.TX.getValue());
  105. searchable.addSearchFilter("jobType", SearchOperator.notIn, jobType);
  106. if(StringUtils.isNotEmpty(vo.getName())){
  107. searchable.addSearchFilter("name", SearchOperator.like,vo.getName());
  108. }
  109. //当角色有警种时候过滤警种
  110. if (StringUtils.isNotEmpty(roleInfo.getPoliceCategory())) {
  111. searchable.addSearchFilter("police_category", SearchOperator.eq, roleInfo.getPoliceCategory());
  112. }
  113. //当有业务域时候
  114. if (StringUtils.isNotEmpty(roleInfo.getRoleBusiness())) {
  115. for (String business : roleInfo.getRoleBusiness().split(",")) {
  116. searchable.addSearchFilter("police_business", SearchOperator.like,business);
  117. list.addAll(iUserInfoFacade.roleInfoList(searchable.toSearchDTO()));
  118. }
  119. //去重
  120. HashSet userInfoViewSet = new HashSet(list);
  121. list.clear();
  122. list.addAll(userInfoViewSet);
  123. } else {
  124. list.addAll(iUserInfoFacade.expList(searchable.toSearchDTO()));
  125. }
  126. Map<String, ArrayList<CodeRecord>> listCodes = iCodeListResourceFacade.listCodes("code", "DM_POLICE_BUSINESS,T_MD_ORG_LEVEL,DM_USER_TYPE");
  127. HashMap<String, Map<String, String>> map = getConvertMap(listCodes);
  128. //标码翻译
  129. for (UserInfoView userInfo : list) {
  130. if (StringUtils.isNotEmpty(userInfo.getPoliceBusiness())){
  131. String[] policeBusinessOld = userInfo.getPoliceBusiness().split(",");
  132. String policeBusinesssNew="";
  133. for (String businesss : policeBusinessOld) {
  134. policeBusinesssNew+= StringUtils.isEmpty(policeBusinesssNew)?map.get("DM_POLICE_BUSINESS").get(businesss):","+map.get("DM_POLICE_BUSINESS").get(businesss);
  135. }
  136. userInfo.setPoliceBusiness(policeBusinesssNew);
  137. }
  138. // String policeBusinessLable = map.get("DM_POLICE_BUSINESS").get(userInfo.getPoliceBusiness());
  139. String orgLevelLable = map.get("T_MD_ORG_LEVEL").get(userInfo.getOrgLevel());
  140. userInfo.setOrgLevel(orgLevelLable);
  141. String userTypeLable = map.get("DM_USER_TYPE").get(userInfo.getUserType());
  142. userInfo.setUserType(userTypeLable);
  143. }
  144. return Result.success(list);
  145. }
  146. private HashMap<String, Map<String, String>> getConvertMap(Map<String, ArrayList<CodeRecord>> listCodes) {
  147. HashMap<String, Map<String, String>> allConvertMap = new HashMap<>();
  148. for (Map.Entry<String, ArrayList<CodeRecord>> entry : listCodes.entrySet()) {
  149. String codeName = entry.getKey();
  150. ArrayList<CodeRecord> valueList = entry.getValue();
  151. HashMap<String, String> codeConvertMap = new HashMap<>();
  152. valueList.forEach(item->codeConvertMap.put(item.getValue(),item.getLabel()));
  153. allConvertMap.put(codeName,codeConvertMap);
  154. }
  155. return allConvertMap;
  156. }
  157. /**
  158. * 人员视图 人员列表
  159. *
  160. * @param
  161. * @return
  162. */
  163. @ApiOperation(value = "人员视图 人员列表")
  164. @ApiImplicitParam(name = "searchDTO", value = "查询条件(orgId必须)",required = true)
  165. @PostMapping(value = "/staffRolePage/_search")
  166. public Result<List<UserInfo>> staffRolePage(SearchDTO searchDTO) {
  167. SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
  168. Searchable searchable = Searchable.toSearchable(searchDTO);
  169. searchable.addSearchFilter("deleted",SearchOperator.eq,YesNotEnum.NO.getValue());
  170. searchable.addSearchFilter("name",SearchOperator.ne,iUserInfoFacade.getRootUser());
  171. Page<UserInfo> page = iUserInfoFacade.userList(searchDTO);
  172. if (!iUserInfoFacade.getRootUser().equals(curUser.getName())) {
  173. String mtIds = mtAuthBusiness.getMtAuth(curUser.getId(), SysConstants.MT_APP);
  174. if (StringUtils.isEmpty(mtIds)) {
  175. return Result.success(0L,null);
  176. }
  177. }
  178. return Result.success(page.getTotalElements(),page.getContent());
  179. }
  180. /**
  181. * 人员视图 人员列表
  182. * @param
  183. * @return
  184. */
  185. @ApiOperation(value = "人员视图 人员列表")
  186. @ApiImplicitParam(name = "searchDTO", value = "查询条件(orgId必须)",required = true)
  187. @PostMapping(value = "/staffUserPage/_search")
  188. public Result<List<UserInfo>> staffUserPage(SearchDTO searchDTO) {
  189. SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
  190. Searchable searchable = Searchable.toSearchable(searchDTO);
  191. searchable.addSearchFilter("deleted",SearchOperator.eq,YesNotEnum.NO.getValue());
  192. searchable.addSearchFilter("name",SearchOperator.ne,iUserInfoFacade.getRootUser());
  193. // Set jobType = new HashSet();
  194. // jobType.add(JobTypeEnum.LZ.getValue());
  195. // jobType.add(JobTypeEnum.SW.getValue());
  196. // jobType.add(JobTypeEnum.TX.getValue());
  197. // jobType.add(JobTypeEnum.FP.getValue());
  198. // searchable.addSearchFilter("jobType",SearchOperator.notIn,jobType);
  199. Page<UserInfo> page = iUserInfoFacade.userList(searchable.toSearchDTO());
  200. if (!iUserInfoFacade.getRootUser().equals(curUser.getName())) {
  201. String mtIds = mtAuthBusiness.getMtAuth(curUser.getId(), SysConstants.MT_APP);
  202. if (StringUtils.isEmpty(mtIds)) {
  203. return Result.success(0L,null);
  204. }
  205. }
  206. return Result.success(page.getTotalElements(),page.getContent());
  207. }
  208. /**
  209. * 人员视图-角色已勾选
  210. * @param userId 用户Id
  211. * @return
  212. */
  213. @ApiOperation(value = "人员视图-角色已勾选")
  214. @ApiImplicitParam(name = "userId", value = "用户id(orgId必须)",required = true)
  215. @GetMapping(value = "/roleChecked")
  216. public Result<List<StaffAssignAuthInfoVo>> getRoleChecked(@RequestParam(value = "userId", required = false) String userId) {
  217. if (StringUtils.isEmpty(userId)) {
  218. return Result.success(new ArrayList());
  219. }
  220. Searchable searchable = Searchable.newSearchable();
  221. searchable.addSearchFilter("staffId",SearchOperator.eq,userId);
  222. List<StaffAssignAuthInfo> staffAssignAuthInfoList = staffAssignAuthInfoFacade.findForList(searchable.toSearchDTO());
  223. List<StaffAssignAuthInfoVo> vos = new ArrayList<>();
  224. for (StaffAssignAuthInfo source : staffAssignAuthInfoList) {
  225. StaffAssignAuthInfoVo vo = new StaffAssignAuthInfoVo();
  226. BeanUtils.copyProperties(source,vo);
  227. vos.add(vo);
  228. }
  229. return Result.success(vos);
  230. }
  231. /**
  232. * 分页查询机构拥有的应用角色配额情况
  233. * @param
  234. * @return
  235. */
  236. @ApiOperation(value = "分页查询机构拥有的应用角色配额情况")
  237. @ApiImplicitParam(name = "searchDTO", value = "查询条件(appId必须)",required = true)
  238. @PostMapping(value = "roleRoleList/_search")
  239. public Result<List<RoleInfoVO>> getRoleList(SearchDTO searchDTO) {
  240. String appId = null;
  241. String orgId = null;
  242. Page<RoleInfoVO> page = new PageImpl();
  243. Searchable searchable = Searchable.toSearchable(searchDTO);
  244. Condition appIdCondition = searchable.getSearchFilterByKey("appId_eq");
  245. searchable.removeSearchFilter("appId_eq");
  246. Condition orgIdCondition = searchable.getSearchFilterByKey("orgId_eq");
  247. if(null == appIdCondition || StringUtils.isBlank((String) appIdCondition.getValue())){
  248. return Result.success(page.getTotalElements(),page.getContent());
  249. }
  250. if(orgIdCondition!=null && StringUtils.isNotBlank((String) orgIdCondition.getValue())){
  251. orgId = (String) orgIdCondition.getValue();
  252. }
  253. appId = (String) appIdCondition.getValue();
  254. SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
  255. if (!iUserInfoFacade.getRootUser().equals(curUser.getName())) {
  256. String mtIds = mtAuthBusiness.getMtAuth(curUser.getId(), SysConstants.MT_APP);
  257. if (StringUtils.isEmpty(mtIds)) {
  258. return Result.success(0L,null);
  259. }
  260. }
  261. RoleAuthParamVo vo=new RoleAuthParamVo();
  262. vo.setAppId(appId);
  263. vo.setOrgId(orgId);
  264. vo.setSearchDTO(searchable.toSearchDTO());
  265. page = roleInfoFacade.getOrgRoleQuota(vo);
  266. for (RoleInfoVO roleInfoVO : page.getContent()) {
  267. roleInfoVO.setRoleBusiness(getLavleValue(roleInfoVO.getRoleBusiness()));
  268. }
  269. return Result.success(page.getTotalElements(),page.getContent());
  270. }
  271. /**
  272. * 人员视图 应用角色列表
  273. * @param
  274. * @return
  275. */
  276. @ApiOperation(value = "人员视图 应用角色列表")
  277. @ApiImplicitParams({
  278. @ApiImplicitParam(name = "roleName", value = "角色名称"),
  279. @ApiImplicitParam(name = "userId", value = "用户id",required = true),
  280. @ApiImplicitParam(name = "appName", value = "应用名称")
  281. })
  282. @GetMapping(value = "/staffRoleList")
  283. public Result<List<RoleInfoVO>> staffRoleList(@RequestParam(value = "roleName",required = false) String roleName,@RequestParam("userId") String userId,
  284. @RequestParam(value = "appName",required = false) String appName) {
  285. if (StringUtils.isBlank(userId)) {
  286. return Result.success(new ArrayList<RoleInfoVO>());
  287. }
  288. Searchable roleSearchable = Searchable.newSearchable();
  289. roleSearchable.addSearchFilter("userId",SearchOperator.eq,userId);
  290. if (StringUtils.isNotEmpty(roleName)) {
  291. roleSearchable.addSearchFilter("name",SearchOperator.like,roleName);
  292. }
  293. if (StringUtils.isNotEmpty(appName)) {
  294. roleSearchable.addSearchFilter("appName",SearchOperator.like,appName);
  295. }
  296. //TODO
  297. //DTO待设计
  298. List<RoleInfoVO> roleInfoVOList = roleInfoFacade.staffRoleList(roleSearchable.toSearchDTO());
  299. Searchable staffSearchable = Searchable.newSearchable();
  300. staffSearchable.addSearchFilter("staffId",SearchOperator.eq,userId);
  301. List<StaffAssignAuthInfo> staffAssignAuthInfoList = staffAssignAuthInfoFacade.findForList(staffSearchable.toSearchDTO());
  302. Map<String, String> roleMap = new HashMap<String, String>();
  303. for (StaffAssignAuthInfo assignAuthInfo : staffAssignAuthInfoList) {
  304. roleMap.put(assignAuthInfo.getRoleId(), assignAuthInfo.getActiveTime());
  305. }
  306. Map<String, ArrayList<CodeRecord>> listCodes = iCodeListResourceFacade.listCodes("code", "DM_ROLE_LEVEL,T_MD_POLICE_TYPE");
  307. HashMap<String, Map<String, String>> map = getConvertMap(listCodes);
  308. for (RoleInfoVO roleInfoVO : roleInfoVOList) {
  309. if (roleMap.containsKey(roleInfoVO.getId())) {
  310. roleInfoVO.setCause(1);
  311. roleInfoVO.setActiveTime(roleMap.get(roleInfoVO.getId()));
  312. } else {
  313. roleInfoVO.setActiveTime("长期");
  314. }
  315. String policeBusinessLable = getLavleValue(roleInfoVO.getRoleBusiness());
  316. roleInfoVO.setRoleBusiness(policeBusinessLable);
  317. String roleLevelLable = map.get("DM_ROLE_LEVEL").get(roleInfoVO.getRoleLevel());
  318. roleInfoVO.setRoleLevel(roleLevelLable);
  319. String policeCategory = map.get("T_MD_POLICE_TYPE").get(roleInfoVO.getPoliceCategory());
  320. roleInfoVO.setPoliceCategory(policeCategory);
  321. }
  322. return Result.success(roleInfoVOList);
  323. }
  324. private String getLavleValue(String value) {
  325. HashMap<String, String> codeMap = getCodeVLMap("T_USER_LABEL");
  326. String codeValue = "";
  327. if(StringUtils.isNotEmpty(value)){
  328. String[] codeLable = value.split(",");
  329. for (String s : codeLable) {
  330. codeValue += codeMap.get(s)+",";
  331. }
  332. }
  333. return codeValue;
  334. }
  335. private HashMap<String, String> getCodeVLMap(String name) {
  336. HashMap<String, String> map = new HashMap<String, String>();
  337. List<Map<String, Object>> codeResource = iDuceapCodeFacade.getCodeResource(name);
  338. codeResource.forEach(item->{
  339. String lable = item.get("NAME").toString();
  340. String value = item.get("CODE").toString();
  341. map.put(value,lable);
  342. });
  343. return map;
  344. }
  345. /**
  346. * 角色视图保存
  347. *
  348. * @param
  349. * @return
  350. */
  351. @ApiOperation(value = "角色视图保存")
  352. @Permission(value = "auth_mge_config")
  353. @PostMapping(value = "/role", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  354. public Result saveRole(@RequestBody StaffRoleOperateVo staffRoleOperateVo) {
  355. //SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
  356. // String staffJson = staffRoleOperateVo.getStaffJson();
  357. // String delStaffJson = staffRoleOperateVo.getDelStaffJson();
  358. // String appId = staffRoleOperateVo.getAppId();
  359. // String roleId = staffRoleOperateVo.getRoleId();
  360. // String orgId = staffRoleOperateVo.getOrgId();
  361. // String appOrgId = staffRoleOperateVo.getAppOrgId();
  362. RoleAuthDto dto=new RoleAuthDto();
  363. BeanUtils.copyProperties(staffRoleOperateVo, dto);
  364. //TODO
  365. //dto待设计
  366. ResponseStatus responseStatus = staffAssignAuthInfoFacade.saveStaffRoleAuth(dto);
  367. String statusCode = responseStatus.getStatusCode();
  368. if(ResponseStatus.FAIL_CODE.equals(statusCode)){
  369. return Result.fail(responseStatus.getMessage());
  370. }else {
  371. return Result.success(responseStatus.getMessage());
  372. }
  373. }
  374. /**
  375. * 人员视图保存
  376. * @return
  377. */
  378. @ApiOperation(value = "人员视图保存")
  379. @Permission(value = "auth_mge_config")
  380. @PostMapping (value = "/staff", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  381. public Result saveStaff(@RequestBody StaffOperateVo staffOperateVo) {
  382. String userId = staffOperateVo.getUserId();
  383. String saveIds = JSON.toJSONString(staffOperateVo.getSaveIds());
  384. String deleteIds = JSON.toJSONString(staffOperateVo.getDeleteIds());
  385. StaffAssignDTO staffAssignDTO=new StaffAssignDTO(userId, saveIds, deleteIds);
  386. ResponseStatus responseStatus = staffAssignAuthInfoFacade.saveStaff(staffAssignDTO);
  387. Result result = new Result(responseStatus.getStatusCode(),responseStatus.getMessage(),null,null);
  388. return result;
  389. }
  390. /**
  391. * 获取角色视图勾选人员
  392. * 获取人员视图勾选角色
  393. *
  394. * @param
  395. * @return
  396. */
  397. @ApiOperation(value = "获取角色视图勾选人员,获取人员视图勾选角色",
  398. notes = "type表示获取类型,获取类型:role获取勾选人员 其他:获取勾选角色。type=role时appId, roleId, orgId")
  399. @ApiImplicitParams({
  400. @ApiImplicitParam(name = "type", value = "获取类型:role获取勾选人员 其他:获取勾选角色"),
  401. @ApiImplicitParam(name = "appId", value = "应用id",required = true),
  402. @ApiImplicitParam(name = "orgId", value = "机构id", required = true),
  403. @ApiImplicitParam(name = "roleId", value = "角色id"),
  404. @ApiImplicitParam(name = "staffId", value = "人员id")
  405. })
  406. @GetMapping(value = "/checked")
  407. @ResponseBody
  408. public Result<List<StaffAssignAuthInfoVo>> getCheckedStaff(@RequestParam(value = "type", required = true) String type,
  409. @RequestParam(value = "appId", required = true) String appId,
  410. @RequestParam(value = "orgId", required = false) String orgId,
  411. @RequestParam(value = "roleId", required = false) String roleId,
  412. @RequestParam(value = "staffId", required = false) String staffId) {
  413. List<StaffAssignAuthInfo> staffAssignAuthInfoList;
  414. if (type.equals("role")) {
  415. //获取勾选人员
  416. staffAssignAuthInfoList = iRoleAuthInfoFacade.getStaff(appId, roleId, orgId);
  417. } else {
  418. //获取勾选角色
  419. staffAssignAuthInfoList = iRoleAuthInfoFacade.getRole(appId, staffId);
  420. }
  421. List<StaffAssignAuthInfoVo> vos = new ArrayList<>();
  422. for (StaffAssignAuthInfo source : staffAssignAuthInfoList) {
  423. StaffAssignAuthInfoVo vo = new StaffAssignAuthInfoVo();
  424. BeanUtils.copyProperties(source,vo);
  425. vos.add(vo);
  426. }
  427. return Result.success(vos);
  428. }
  429. }