|
@@ -16,6 +16,7 @@ import com.dragoninfo.dcuc.user.user.enumresources.YesNotEnum;
|
|
|
import com.dragoninfo.duceap.core.response.Result;
|
|
|
import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
import com.dragonsoft.duceap.base.entity.security.SecurityUser;
|
|
|
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
|
|
|
import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
|
import com.dragonsoft.duceap.core.context.ContextUtils;
|
|
|
import com.dragonsoft.duceap.core.search.Searchable;
|
|
@@ -24,6 +25,7 @@ import com.dragonsoft.duceap.core.search.filter.Condition;
|
|
|
import com.dragonsoft.duceap.web.annotation.Permission;
|
|
|
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;
|
|
@@ -53,6 +55,7 @@ public class RoleInfoController {
|
|
|
|
|
|
/**
|
|
|
* 角色列表
|
|
|
+ *
|
|
|
* @param searchDTO
|
|
|
* @return
|
|
|
*/
|
|
@@ -71,7 +74,7 @@ public class RoleInfoController {
|
|
|
*/
|
|
|
@ApiOperation(value = "保存菜单")
|
|
|
@Permission(value = "power_config")
|
|
|
- @PostMapping(value = "/rsGrid",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/rsGrid", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Result saveRsGrid(@RequestBody RoleFunRsRlVo roleFunRsRlVo) {
|
|
|
Result result;
|
|
|
try {
|
|
@@ -82,7 +85,7 @@ public class RoleInfoController {
|
|
|
iRoleInfoFacade.saveRsGrid(rsGridList, roleId);
|
|
|
result = Result.success("保存成功");
|
|
|
} catch (Exception e) {
|
|
|
- logger.error("saveRsGrid error:{}",e);
|
|
|
+ logger.error("saveRsGrid error:{}", e);
|
|
|
result = Result.fail("保存异常");
|
|
|
|
|
|
}
|
|
@@ -96,23 +99,25 @@ public class RoleInfoController {
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "查看角色信息")
|
|
|
- @ApiImplicitParam(name = "id", value = "角色id")
|
|
|
- @GetMapping(value = "/role/{id}",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "角色ID", required = true
|
|
|
+ , example = "40288a8b699fc2500169a33b20540000")})
|
|
|
+ @GetMapping(value = "/role/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Result<RoleInfoVo> roleInfo(@PathVariable("id") String id) {
|
|
|
RoleInfo roleInfo = iRoleInfoFacade.get(id);
|
|
|
RoleInfoVo vo = new RoleInfoVo();
|
|
|
- BeanUtils.copyProperties(roleInfo,vo);
|
|
|
+ BeanUtils.copyProperties(roleInfo, vo);
|
|
|
return Result.success(vo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存角色
|
|
|
+ *
|
|
|
* @param roleInfoVo
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "保存角色信息")
|
|
|
@Permission(value = "power_config")
|
|
|
- @PostMapping(value = "/role",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/role", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Result saveRole(@RequestBody RoleInfoVo roleInfoVo) {
|
|
|
|
|
|
Result result;
|
|
@@ -122,9 +127,9 @@ public class RoleInfoController {
|
|
|
return result;
|
|
|
}
|
|
|
Searchable searchable = Searchable.newSearchable();
|
|
|
- searchable.addSearchFilter("code", SearchOperator.eq,roleInfoVo.getCode());
|
|
|
+ searchable.addSearchFilter("code", SearchOperator.eq, roleInfoVo.getCode());
|
|
|
if (StringUtils.isNotEmpty(roleInfoVo.getId()))
|
|
|
- searchable.addSearchFilter("id",SearchOperator.ne,roleInfoVo.getId());
|
|
|
+ searchable.addSearchFilter("id", SearchOperator.ne, roleInfoVo.getId());
|
|
|
List<RoleInfo> list = iRoleInfoFacade.roleList(searchable.toSearchDTO());
|
|
|
if (list != null && list.size() > 0)
|
|
|
return Result.fail("角色代码已被使用");
|
|
@@ -132,17 +137,17 @@ public class RoleInfoController {
|
|
|
roleInfoVo.setInitNumber(0);
|
|
|
roleInfoVo.setCreator(user.getId());
|
|
|
roleInfoVo.setIsActive(YesNotEnum.YES.getValue());
|
|
|
- roleInfoVo.setPoliceCategory(StringUtils.isEmpty(roleInfoVo.getPoliceCategory())?null:roleInfoVo.getPoliceCategory());
|
|
|
+ roleInfoVo.setPoliceCategory(StringUtils.isEmpty(roleInfoVo.getPoliceCategory()) ? null : roleInfoVo.getPoliceCategory());
|
|
|
roleInfoVo.setCreateTime(new Date());
|
|
|
//TODO
|
|
|
//DTO暂未设计,沿用原来的接口参数,后期修改
|
|
|
RoleInfo roleInfo = new RoleInfo();
|
|
|
- BeanUtils.copyProperties(roleInfoVo,roleInfo);
|
|
|
+ BeanUtils.copyProperties(roleInfoVo, roleInfo);
|
|
|
iRoleInfoFacade.save(roleInfo);
|
|
|
result = Result.success("保存成功");
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- logger.error("",e);
|
|
|
+ logger.error("", e);
|
|
|
result = Result.fail("保存失败");
|
|
|
|
|
|
}
|
|
@@ -158,7 +163,7 @@ public class RoleInfoController {
|
|
|
*/
|
|
|
@ApiOperation(value = "修改角色信息")
|
|
|
@Permission(value = "power_config")
|
|
|
- @PutMapping(value = "/role",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PutMapping(value = "/role", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Result updateRole(@RequestBody RoleInfoVo roleInfoVo) {
|
|
|
Result result;
|
|
|
try {
|
|
@@ -167,9 +172,9 @@ public class RoleInfoController {
|
|
|
return result;
|
|
|
}
|
|
|
Searchable searchable = Searchable.newSearchable();
|
|
|
- searchable.addSearchFilter("code", SearchOperator.eq,roleInfoVo.getCode());
|
|
|
+ searchable.addSearchFilter("code", SearchOperator.eq, roleInfoVo.getCode());
|
|
|
if (StringUtils.isNotEmpty(roleInfoVo.getId()))
|
|
|
- searchable.addSearchFilter("id",SearchOperator.ne,roleInfoVo.getId());
|
|
|
+ searchable.addSearchFilter("id", SearchOperator.ne, roleInfoVo.getId());
|
|
|
List<RoleInfo> list = iRoleInfoFacade.roleList(searchable.toSearchDTO());
|
|
|
if (list != null && list.size() > 0)
|
|
|
return Result.fail("角色代码已被使用");
|
|
@@ -180,14 +185,14 @@ public class RoleInfoController {
|
|
|
role_info.setDetail(roleInfoVo.getDetail());
|
|
|
role_info.setModifier(ContextUtils.getUserInfo().getName());
|
|
|
role_info.setModifiedTime(new Date());
|
|
|
- role_info.setPoliceCategory(StringUtils.isEmpty(roleInfoVo.getPoliceCategory())?null:roleInfoVo.getPoliceCategory());
|
|
|
+ role_info.setPoliceCategory(StringUtils.isEmpty(roleInfoVo.getPoliceCategory()) ? null : roleInfoVo.getPoliceCategory());
|
|
|
role_info.setRoleBusiness(roleInfoVo.getRoleBusiness());
|
|
|
role_info.setIsNotLimitCount(roleInfoVo.getIsNotLimitCount());
|
|
|
iRoleInfoFacade.update(role_info);
|
|
|
result = Result.success("保存成功");
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- logger.error("",e);
|
|
|
+ logger.error("", e);
|
|
|
result = Result.fail("保存失败");
|
|
|
|
|
|
}
|
|
@@ -202,9 +207,10 @@ public class RoleInfoController {
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "删除角色信息")
|
|
|
- @ApiImplicitParam(name = "id", value = "角色id",required = true)
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "角色ID", required = true
|
|
|
+ , example = "40288a8b699fc2500169a33b20540000")})
|
|
|
@Permission(value = "power_config")
|
|
|
- @DeleteMapping(value = "/role/{id}",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @DeleteMapping(value = "/role/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Result deleteRole(@PathVariable("id") String id) {
|
|
|
Result result;
|
|
|
try {
|
|
@@ -214,7 +220,7 @@ public class RoleInfoController {
|
|
|
iRoleInfoFacade.delAllRolesInfo(id);
|
|
|
result = Result.success("删除成功");
|
|
|
} catch (Exception e) {
|
|
|
- logger.error("delete role error:{}",e);
|
|
|
+ logger.error("delete role error:{}", e);
|
|
|
result = Result.fail("删除异常");
|
|
|
|
|
|
}
|
|
@@ -224,11 +230,12 @@ public class RoleInfoController {
|
|
|
|
|
|
/**
|
|
|
* 根据角色获取选中菜单、功能
|
|
|
+ *
|
|
|
* @param roleId 角色id
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "根据角色获取选中菜单、功能")
|
|
|
- @ApiImplicitParam(name = "roleId", value = "角色id",required = true)
|
|
|
+ @ApiImplicitParam(name = "roleId", value = "角色id", required = true)
|
|
|
@GetMapping(value = "/checked/{roleId}")
|
|
|
public Result<List<RsGridCheckedVO>> checked(@PathVariable("roleId") String roleId) {
|
|
|
List<RsGridCheckedVO> rsGridCheckedVOList = iRoleInfoFacade.getRsGridChecked(roleId);
|
|
@@ -238,45 +245,48 @@ public class RoleInfoController {
|
|
|
|
|
|
/**
|
|
|
* 获取角色配额授权情况列表
|
|
|
+ *
|
|
|
* @param searchDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "获取角色配额授权情况列表")
|
|
|
- @ApiImplicitParam(name = "searchDTO", value = "查询条件,applicationId不能为空",required = true)
|
|
|
+ @ApiImplicitParam(name = "searchDTO", value = "查询条件,applicationId不能为空", required = true)
|
|
|
@PostMapping(value = "/roleQuotaList/_search")
|
|
|
public Result<List<RoleInfoVO>> getRoleQuotaList(SearchDTO searchDTO) {
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
Condition condition = searchable.getSearchFilterByKey("applicationId_eq");
|
|
|
- if(null == condition) return Result.fail("400","applicationId 不能为空");
|
|
|
+ if (null == condition) return Result.fail("400", "applicationId 不能为空");
|
|
|
String applicationId = (String) condition.getValue();
|
|
|
- if(StringUtils.isBlank(applicationId)) return Result.fail("400","applicationId 不能为空");
|
|
|
+ if (StringUtils.isBlank(applicationId)) return Result.fail("400", "applicationId 不能为空");
|
|
|
Page<RoleInfoVO> page = iRoleInfoFacade.getRoleQuotaList(searchDTO);
|
|
|
return Result.success(page.getTotalElements(), page.getContent());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取应用有限配额的角色列表
|
|
|
+ *
|
|
|
* @param searchDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "获取应用有限配额的角色列表")
|
|
|
- @ApiImplicitParam(name = "searchDTO", value = "查询条件,applicationId不能为空",required = true)
|
|
|
+ @ApiImplicitParam(name = "searchDTO", value = "查询条件,applicationId不能为空", required = true)
|
|
|
@PostMapping(value = "/orgQuotoAuthInfo/_search")
|
|
|
public Result<List<RoleInfoVO>> getOrgQuotoAuthInfo(SearchDTO searchDTO) {
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
Condition condition = searchable.getSearchFilterByKey("applicationId_eq");
|
|
|
- if(null == condition){
|
|
|
- return Result.fail("400","applicationId 不能为空");
|
|
|
+ if (null == condition) {
|
|
|
+ return Result.fail("400", "applicationId 不能为空");
|
|
|
}
|
|
|
String applicationId = (String) condition.getValue();
|
|
|
- if(StringUtils.isBlank(applicationId)){
|
|
|
- return Result.fail("400","applicationId 不能为空");
|
|
|
+ if (StringUtils.isBlank(applicationId)) {
|
|
|
+ return Result.fail("400", "applicationId 不能为空");
|
|
|
}
|
|
|
Condition roleLevel_eq = searchable.getSearchFilterByKey("roleLevel_eq");
|
|
|
- if (roleLevel_eq!=null){
|
|
|
+ if (roleLevel_eq != null) {
|
|
|
searchable.removeSearchFilter("roleLevel_eq");
|
|
|
- searchable.addSearchFilter("role_level",SearchOperator.eq,roleLevel_eq.getValue());
|
|
|
+ searchable.addSearchFilter("role_level", SearchOperator.eq, roleLevel_eq.getValue());
|
|
|
}
|
|
|
+ searchable.addSearchFilter("is_not_limit_count", SearchOperator.eq, BooleanEnum.FALSE.value);
|
|
|
Page<RoleInfoVO> page = iRoleInfoFacade.getQuotoRoles(searchable.toSearchDTO());
|
|
|
return Result.success(page.getTotalElements(), page.getContent());
|
|
|
}
|
|
@@ -289,7 +299,7 @@ public class RoleInfoController {
|
|
|
*/
|
|
|
@ApiOperation(value = "角色初始配额信息保存")
|
|
|
@Permission(value = "quota_init")
|
|
|
- @PostMapping(value = "/roleQuota",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/roleQuota", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
public Result roleQuotaSave(@RequestBody List<RoleQuotaVo> roleQuotaList) {
|
|
|
Result result;
|
|
|
try {
|
|
@@ -297,7 +307,7 @@ public class RoleInfoController {
|
|
|
iRoleInfoFacade.roleQuotaSave(listStr);
|
|
|
result = Result.success("保存成功");
|
|
|
} catch (Exception e) {
|
|
|
- logger.error("role quota save error:{}",e);
|
|
|
+ logger.error("role quota save error:{}", e);
|
|
|
result = Result.fail(e.getMessage());
|
|
|
}
|
|
|
return result;
|
|
@@ -305,21 +315,22 @@ public class RoleInfoController {
|
|
|
|
|
|
/**
|
|
|
* 用户角色列表
|
|
|
+ *
|
|
|
* @param searchDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "用户角色列表")
|
|
|
- @ApiImplicitParam(name = "searchDTO", value = "查询条件,staffId不能为空 ",required = true)
|
|
|
+ @ApiImplicitParam(name = "searchDTO", value = "查询条件,staffId不能为空 ", required = true)
|
|
|
@PostMapping(value = "/userRole/_search")
|
|
|
public Result<List<StaffAssignAuthInfoVo>> userRole(SearchDTO searchDTO) {
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
String staffId = (String) searchable.getSearchFilterByKey("staffId_eq").getValue();
|
|
|
- if(StringUtils.isBlank(staffId)) return Result.fail("300","staffId 不能为空");
|
|
|
+ if (StringUtils.isBlank(staffId)) return Result.fail("300", "staffId 不能为空");
|
|
|
Page<StaffAssignAuthInfo> page = iStaffAssignAuthInfoFacade.findForPage(searchable.toSearchDTO());
|
|
|
List<StaffAssignAuthInfoVo> vos = new ArrayList<>();
|
|
|
for (StaffAssignAuthInfo source : page.getContent()) {
|
|
|
StaffAssignAuthInfoVo vo = new StaffAssignAuthInfoVo();
|
|
|
- BeanUtils.copyProperties(source,vo);
|
|
|
+ BeanUtils.copyProperties(source, vo);
|
|
|
}
|
|
|
return Result.success(page.getTotalElements(), vos);
|
|
|
}
|