fix(iam): 完善数据校验
This commit is contained in:
@@ -145,6 +145,11 @@ public class SysPermission implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* appId
|
||||||
|
*/
|
||||||
|
private String appId;
|
||||||
|
|
||||||
/**按钮权限状态(0无效1有效)*/
|
/**按钮权限状态(0无效1有效)*/
|
||||||
private java.lang.String status;
|
private java.lang.String status;
|
||||||
|
|
||||||
|
|||||||
@@ -75,5 +75,8 @@ public class SysRole implements Serializable {
|
|||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* appId
|
||||||
|
*/
|
||||||
|
private String appId;
|
||||||
}
|
}
|
||||||
|
|||||||
+73
-40
@@ -331,7 +331,6 @@ public class SyncIamController {
|
|||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
BpmcAcceptDto bpmcAcceptDto = objectMapper.readValue(acceptDecryptPo.getMessageDecryptTabels().getHeader().getData(), BpmcAcceptDto.class);
|
BpmcAcceptDto bpmcAcceptDto = objectMapper.readValue(acceptDecryptPo.getMessageDecryptTabels().getHeader().getData(), BpmcAcceptDto.class);
|
||||||
|
|
||||||
// BpmcAcceptDto bpmcAcceptDto = acceptDecryptPo.getMessageDecryptTabels().getHeader();
|
|
||||||
MessageHeader messageHeader = acceptDecryptPo.getMessageHeader();
|
MessageHeader messageHeader = acceptDecryptPo.getMessageHeader();
|
||||||
|
|
||||||
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getType())){
|
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getType())){
|
||||||
@@ -372,50 +371,36 @@ public class SyncIamController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BpmcResponseDto bpmcResponseDto = BpmcResponseDto.success();
|
BpmcResponseDto bpmcResponseDto = BpmcResponseDto.success();
|
||||||
|
try {
|
||||||
|
switch (bpmcAcceptDto.getType()){
|
||||||
|
// 角色
|
||||||
|
case DockingConstant.BPMC_TYPE_ROLE:
|
||||||
|
bpmcResponseDto = bpmcTypeRole(objectMapper, bpmcAcceptDto, bpmcResponseDto);
|
||||||
|
break;
|
||||||
|
|
||||||
// 分接口类型分别处理
|
// 菜单
|
||||||
if (bpmcAcceptDto.getType().equals(DockingConstant.BPMC_TYPE_ROLE)){
|
case DockingConstant.BPMC_TYPE_RESOURCE:
|
||||||
RoleDto roleDto = objectMapper.readValue(bpmcAcceptDto.getEntity(), RoleDto.class);
|
bpmcResponseDto = bpmcTypeResource(objectMapper, bpmcAcceptDto, bpmcResponseDto);
|
||||||
// 根据新增/编辑/删除调用不同的业务处理代码
|
break;
|
||||||
if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_ADD)){
|
|
||||||
bpmcResponseDto = this.syncIamService.roleCreateService(roleDto);
|
|
||||||
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_UPDATE)) {
|
|
||||||
bpmcResponseDto = this.syncIamService.roleUpdateService(roleDto);
|
|
||||||
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_DELETE)) {
|
|
||||||
bpmcResponseDto = this.syncIamService.roleDeleteService(roleDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bpmcAcceptDto.getType().equals(DockingConstant.BPMC_TYPE_RESOURCE)){
|
// 用户角色关联
|
||||||
ResourceDto resourceDto = objectMapper.readValue(bpmcAcceptDto.getEntity(), ResourceDto.class);
|
case DockingConstant.BPMC_TYPE_USER_ROLE:
|
||||||
// 根据新增/编辑/删除调用不同的业务处理代码
|
bpmcResponseDto = bpmcTypeUserRole(objectMapper, bpmcAcceptDto, bpmcResponseDto);
|
||||||
if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_ADD)){
|
break;
|
||||||
bpmcResponseDto = this.syncIamService.resourceCreateService(resourceDto);
|
|
||||||
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_UPDATE)) {
|
|
||||||
bpmcResponseDto = this.syncIamService.resourceUpdateService(resourceDto);
|
|
||||||
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_DELETE)) {
|
|
||||||
bpmcResponseDto = this.syncIamService.resourceDeleteService(resourceDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bpmcAcceptDto.getType().equals(DockingConstant.BPMC_TYPE_USER_ROLE)){
|
// 角色菜单关联
|
||||||
List<UserRoleDto> userRoleDtoList = objectMapper.readValue(bpmcAcceptDto.getEntity(), new TypeReference<List<UserRoleDto>>() {});
|
case DockingConstant.BPMC_TYPE_ROLE_RESOURCE:
|
||||||
// 根据新增/删除调用不同的业务处理代码
|
bpmcResponseDto = bpmcTypeRoleResource(objectMapper, bpmcAcceptDto, bpmcResponseDto);
|
||||||
if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_ADD)){
|
break;
|
||||||
bpmcResponseDto = this.syncIamService.userRoleCreateService(userRoleDtoList);
|
|
||||||
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_DELETE)) {
|
|
||||||
bpmcResponseDto = this.syncIamService.userRoleDeleteService(userRoleDtoList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bpmcAcceptDto.getType().equals(DockingConstant.BPMC_TYPE_ROLE_RESOURCE)){
|
default:
|
||||||
List<RoleResourceDto> roleResourceDtoList = objectMapper.readValue(bpmcAcceptDto.getEntity(), new TypeReference<List<RoleResourceDto>>() {});
|
bpmcResponseDto = BpmcResponseDto.error("接口类型(type)未找到,请检查");
|
||||||
// 根据新增/删除调用不同的业务处理代码
|
break;
|
||||||
if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_ADD)){
|
|
||||||
bpmcResponseDto = this.syncIamService.roleResourceCreateService(roleResourceDtoList);
|
|
||||||
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_DELETE)) {
|
|
||||||
bpmcResponseDto = this.syncIamService.roleResourceDeleteService(roleResourceDtoList);
|
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error(e.getMessage());
|
||||||
|
bpmcResponseDto = BpmcResponseDto.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SendPoDecryptPo<BpmcResponseDto>().response(
|
return new SendPoDecryptPo<BpmcResponseDto>().response(
|
||||||
@@ -424,6 +409,54 @@ public class SyncIamController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BpmcResponseDto bpmcTypeRoleResource(ObjectMapper objectMapper, BpmcAcceptDto bpmcAcceptDto, BpmcResponseDto bpmcResponseDto) throws JsonProcessingException {
|
||||||
|
List<RoleResourceDto> roleResourceDtoList = objectMapper.readValue(bpmcAcceptDto.getEntity(), new TypeReference<List<RoleResourceDto>>() {});
|
||||||
|
// 根据新增/删除调用不同的业务处理代码
|
||||||
|
if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_ADD)){
|
||||||
|
bpmcResponseDto = this.syncIamService.roleResourceCreateService(roleResourceDtoList);
|
||||||
|
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_DELETE)) {
|
||||||
|
bpmcResponseDto = this.syncIamService.roleResourceDeleteService(roleResourceDtoList);
|
||||||
|
}
|
||||||
|
return bpmcResponseDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BpmcResponseDto bpmcTypeUserRole(ObjectMapper objectMapper, BpmcAcceptDto bpmcAcceptDto, BpmcResponseDto bpmcResponseDto) throws JsonProcessingException {
|
||||||
|
List<UserRoleDto> userRoleDtoList = objectMapper.readValue(bpmcAcceptDto.getEntity(), new TypeReference<List<UserRoleDto>>() {});
|
||||||
|
// 根据新增/删除调用不同的业务处理代码
|
||||||
|
if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_ADD)){
|
||||||
|
bpmcResponseDto = this.syncIamService.userRoleCreateService(userRoleDtoList);
|
||||||
|
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_DELETE)) {
|
||||||
|
bpmcResponseDto = this.syncIamService.userRoleDeleteService(userRoleDtoList);
|
||||||
|
}
|
||||||
|
return bpmcResponseDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BpmcResponseDto bpmcTypeResource(ObjectMapper objectMapper, BpmcAcceptDto bpmcAcceptDto, BpmcResponseDto bpmcResponseDto) throws JsonProcessingException {
|
||||||
|
ResourceDto resourceDto = objectMapper.readValue(bpmcAcceptDto.getEntity(), ResourceDto.class);
|
||||||
|
// 根据新增/编辑/删除调用不同的业务处理代码
|
||||||
|
if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_ADD)){
|
||||||
|
bpmcResponseDto = this.syncIamService.resourceCreateService(resourceDto);
|
||||||
|
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_UPDATE)) {
|
||||||
|
bpmcResponseDto = this.syncIamService.resourceUpdateService(resourceDto);
|
||||||
|
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_DELETE)) {
|
||||||
|
bpmcResponseDto = this.syncIamService.resourceDeleteService(resourceDto);
|
||||||
|
}
|
||||||
|
return bpmcResponseDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BpmcResponseDto bpmcTypeRole(ObjectMapper objectMapper, BpmcAcceptDto bpmcAcceptDto, BpmcResponseDto bpmcResponseDto) throws JsonProcessingException {
|
||||||
|
RoleDto roleDto = objectMapper.readValue(bpmcAcceptDto.getEntity(), RoleDto.class);
|
||||||
|
// 根据新增/编辑/删除调用不同的业务处理代码
|
||||||
|
if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_ADD)){
|
||||||
|
bpmcResponseDto = this.syncIamService.roleCreateService(roleDto);
|
||||||
|
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_UPDATE)) {
|
||||||
|
bpmcResponseDto = this.syncIamService.roleUpdateService(roleDto);
|
||||||
|
} else if (bpmcAcceptDto.getAction().equals(DockingConstant.BPMC_ACTION_DELETE)) {
|
||||||
|
bpmcResponseDto = this.syncIamService.roleDeleteService(roleDto);
|
||||||
|
}
|
||||||
|
return bpmcResponseDto;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询全部用户id
|
* 查询全部用户id
|
||||||
* @param iamCommon
|
* @param iamCommon
|
||||||
|
|||||||
+101
-73
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.bamboocloud.codec.BamboocloudFacade;
|
import com.bamboocloud.codec.BamboocloudFacade;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -586,6 +587,7 @@ public class SyncIamService {
|
|||||||
sysRole.setCreateTime(roleDto.getCreateTime());
|
sysRole.setCreateTime(roleDto.getCreateTime());
|
||||||
sysRole.setUpdateBy(DockingConstant.IAM_SYSTEM_NAME);
|
sysRole.setUpdateBy(DockingConstant.IAM_SYSTEM_NAME);
|
||||||
sysRole.setUpdateTime(roleDto.getModifyTime());
|
sysRole.setUpdateTime(roleDto.getModifyTime());
|
||||||
|
sysRole.setAppId(roleDto.getAppId());
|
||||||
|
|
||||||
sysRoleService.save(sysRole);
|
sysRoleService.save(sysRole);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
@@ -609,6 +611,8 @@ public class SyncIamService {
|
|||||||
|
|
||||||
if (sysRole == null){
|
if (sysRole == null){
|
||||||
return BpmcResponseDto.error("未找到对应id角色,无法更新");
|
return BpmcResponseDto.error("未找到对应id角色,无法更新");
|
||||||
|
}else {
|
||||||
|
sysRole.setId(roleDto.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CharSequenceUtil.isNotEmpty(roleDto.getName())){
|
if (CharSequenceUtil.isNotEmpty(roleDto.getName())){
|
||||||
@@ -623,6 +627,10 @@ public class SyncIamService {
|
|||||||
sysRole.setDescription(roleDto.getDescription());
|
sysRole.setDescription(roleDto.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CharSequenceUtil.isNotEmpty(roleDto.getAppId())){
|
||||||
|
sysRole.setAppId(roleDto.getAppId());
|
||||||
|
}
|
||||||
|
|
||||||
sysRole.setUpdateBy(DockingConstant.IAM_SYSTEM_NAME);
|
sysRole.setUpdateBy(DockingConstant.IAM_SYSTEM_NAME);
|
||||||
|
|
||||||
if (roleDto.getModifyTime() != null){
|
if (roleDto.getModifyTime() != null){
|
||||||
@@ -670,7 +678,13 @@ public class SyncIamService {
|
|||||||
sysPermission.setPerms(resourceDto.getCode());
|
sysPermission.setPerms(resourceDto.getCode());
|
||||||
sysPermission.setComponent(resourceDto.getComponent()); // 组件的路径
|
sysPermission.setComponent(resourceDto.getComponent()); // 组件的路径
|
||||||
sysPermission.setUrl(resourceDto.getRedirect()); // 地址栏显示的路径
|
sysPermission.setUrl(resourceDto.getRedirect()); // 地址栏显示的路径
|
||||||
sysPermission.setSortNo(Double.valueOf(resourceDto.getSort()));
|
sysPermission.setAppId(resourceDto.getAppId()); // appId
|
||||||
|
if (!Objects.isNull(resourceDto.getSort())){
|
||||||
|
sysPermission.setSortNo(Double.valueOf(resourceDto.getSort()));
|
||||||
|
}else {
|
||||||
|
sysPermission.setSortNo(1D);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO 菜单英文名数据库中没有,需要确认
|
// TODO 菜单英文名数据库中没有,需要确认
|
||||||
|
|
||||||
@@ -714,78 +728,78 @@ public class SyncIamService {
|
|||||||
* 菜单更新
|
* 菜单更新
|
||||||
*/
|
*/
|
||||||
public BpmcResponseDto resourceUpdateService(ResourceDto resourceDto){
|
public BpmcResponseDto resourceUpdateService(ResourceDto resourceDto){
|
||||||
try {
|
if (CharSequenceUtil.isEmpty(resourceDto.getId())){
|
||||||
if (CharSequenceUtil.isEmpty(resourceDto.getId())){
|
return BpmcResponseDto.error("菜单id为空,无法更新");
|
||||||
return BpmcResponseDto.error("菜单id为空,无法更新");
|
|
||||||
}
|
|
||||||
|
|
||||||
SysPermission sysPermission = sysPermissionService.getById(resourceDto.getId());
|
|
||||||
|
|
||||||
if (sysPermission == null){
|
|
||||||
return BpmcResponseDto.error("未找到对应id功能权限,无法更新");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CharSequenceUtil.isNotEmpty(resourceDto.getParentId())){
|
|
||||||
sysPermission.setParentId(resourceDto.getParentId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CharSequenceUtil.isNotEmpty(resourceDto.getName())){
|
|
||||||
sysPermission.setName(resourceDto.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CharSequenceUtil.isNotEmpty(resourceDto.getCode())){
|
|
||||||
sysPermission.setPerms(resourceDto.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CharSequenceUtil.isNotEmpty(resourceDto.getComponent())){
|
|
||||||
sysPermission.setComponent(resourceDto.getComponent()); // 组件的路径
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CharSequenceUtil.isNotEmpty(resourceDto.getRedirect())){
|
|
||||||
sysPermission.setUrl(resourceDto.getRedirect()); // 地址栏显示的路径
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resourceDto.getSort() != null){
|
|
||||||
sysPermission.setSortNo(Double.valueOf(resourceDto.getSort()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// sysPermission的 menuType (0:一级菜单;1:子菜单 ;2:按钮权限)
|
|
||||||
if (DockingConstant.BPMC_RESOURCE_TYPE_MENU == resourceDto.getMenu_type()){
|
|
||||||
if (CharSequenceUtil.isEmpty(resourceDto.getParentId())){
|
|
||||||
sysPermission.setMenuType(0);
|
|
||||||
} else {
|
|
||||||
sysPermission.setMenuType(1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sysPermission.setMenuType(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
sysPermission.setUpdateTime(resourceDto.getModifyTime());
|
|
||||||
sysPermission.setUpdateBy(DockingConstant.IAM_SYSTEM_NAME);
|
|
||||||
sysPermission.setDescription(resourceDto.getDescription());
|
|
||||||
|
|
||||||
if (resourceDto.getIs_route() != null){
|
|
||||||
sysPermission.setRoute(resourceDto.getIs_route() == 0 ? false : true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resourceDto.getKeep_alive() != null){
|
|
||||||
sysPermission.setKeepAlive(resourceDto.getKeep_alive() == 0 ? false : true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resourceDto.getHidden() != null){
|
|
||||||
sysPermission.setHidden(resourceDto.getKeep_alive() == 0 ? false : true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resourceDto.getInternal_or_external() != null){
|
|
||||||
sysPermission.setInternalOrExternal(resourceDto.getInternal_or_external() == 0 ? false : true);
|
|
||||||
}
|
|
||||||
|
|
||||||
sysPermissionService.editPermission(sysPermission);
|
|
||||||
} catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
return BpmcResponseDto.error(e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SysPermission sysPermission = sysPermissionService.getById(resourceDto.getId());
|
||||||
|
|
||||||
|
if (sysPermission == null){
|
||||||
|
return BpmcResponseDto.error("未找到对应id功能权限,无法更新");
|
||||||
|
}else {
|
||||||
|
sysPermission.setId(resourceDto.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CharSequenceUtil.isNotEmpty(resourceDto.getParentId())){
|
||||||
|
sysPermission.setParentId(resourceDto.getParentId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CharSequenceUtil.isNotEmpty(resourceDto.getName())){
|
||||||
|
sysPermission.setName(resourceDto.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CharSequenceUtil.isNotEmpty(resourceDto.getCode())){
|
||||||
|
sysPermission.setPerms(resourceDto.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CharSequenceUtil.isNotEmpty(resourceDto.getComponent())){
|
||||||
|
sysPermission.setComponent(resourceDto.getComponent()); // 组件的路径
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CharSequenceUtil.isNotEmpty(resourceDto.getRedirect())){
|
||||||
|
sysPermission.setUrl(resourceDto.getRedirect()); // 地址栏显示的路径
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resourceDto.getSort() != null){
|
||||||
|
sysPermission.setSortNo(Double.valueOf(resourceDto.getSort()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CharSequenceUtil.isNotEmpty(resourceDto.getAppId())){
|
||||||
|
sysPermission.setAppId(resourceDto.getAppId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// sysPermission的 menuType (0:一级菜单;1:子菜单 ;2:按钮权限)
|
||||||
|
if (DockingConstant.BPMC_RESOURCE_TYPE_MENU == resourceDto.getMenu_type()){
|
||||||
|
if (CharSequenceUtil.isEmpty(resourceDto.getParentId())){
|
||||||
|
sysPermission.setMenuType(0);
|
||||||
|
} else {
|
||||||
|
sysPermission.setMenuType(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sysPermission.setMenuType(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
sysPermission.setUpdateTime(resourceDto.getModifyTime());
|
||||||
|
sysPermission.setUpdateBy(DockingConstant.IAM_SYSTEM_NAME);
|
||||||
|
sysPermission.setDescription(resourceDto.getDescription());
|
||||||
|
|
||||||
|
if (resourceDto.getIs_route() != null){
|
||||||
|
sysPermission.setRoute(resourceDto.getIs_route() == 0 ? false : true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resourceDto.getKeep_alive() != null){
|
||||||
|
sysPermission.setKeepAlive(resourceDto.getKeep_alive() == 0 ? false : true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resourceDto.getHidden() != null){
|
||||||
|
sysPermission.setHidden(resourceDto.getKeep_alive() == 0 ? false : true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resourceDto.getInternal_or_external() != null){
|
||||||
|
sysPermission.setInternalOrExternal(resourceDto.getInternal_or_external() == 0 ? false : true);
|
||||||
|
}
|
||||||
|
|
||||||
|
sysPermissionService.editPermission(sysPermission);
|
||||||
return BpmcResponseDto.success();
|
return BpmcResponseDto.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,6 +841,14 @@ public class SyncIamService {
|
|||||||
sysUserRole.setUserId(userInfo.getId());
|
sysUserRole.setUserId(userInfo.getId());
|
||||||
sysUserRole.setRoleId(userRoleDto.getArId());
|
sysUserRole.setRoleId(userRoleDto.getArId());
|
||||||
|
|
||||||
|
// 角色重复性校验
|
||||||
|
int count = sysUserRoleService.count(new LambdaQueryWrapper<SysUserRole>()
|
||||||
|
.eq(SysUserRole::getUserId, sysUserRole.getUserId())
|
||||||
|
.eq(SysUserRole::getRoleId, sysUserRole.getRoleId()));
|
||||||
|
if (count > 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
userRoleList.add(sysUserRole);
|
userRoleList.add(sysUserRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -870,7 +892,13 @@ public class SyncIamService {
|
|||||||
SysRolePermission sysRolePermission = new SysRolePermission();
|
SysRolePermission sysRolePermission = new SysRolePermission();
|
||||||
sysRolePermission.setPermissionId(roleResourceDto.getAmId());
|
sysRolePermission.setPermissionId(roleResourceDto.getAmId());
|
||||||
sysRolePermission.setRoleId(roleResourceDto.getArId());
|
sysRolePermission.setRoleId(roleResourceDto.getArId());
|
||||||
|
// 重复性校验
|
||||||
|
int count = sysRolePermissionService.count(new LambdaQueryWrapper<SysRolePermission>()
|
||||||
|
.eq(SysRolePermission::getRoleId, sysRolePermission.getRoleId())
|
||||||
|
.eq(SysRolePermission::getPermissionId, sysRolePermission.getPermissionId()));
|
||||||
|
if (count > 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
sysRolePermissionList.add(sysRolePermission);
|
sysRolePermissionList.add(sysRolePermission);
|
||||||
}
|
}
|
||||||
this.sysRolePermissionService.saveBatch(sysRolePermissionList);
|
this.sysRolePermissionService.saveBatch(sysRolePermissionList);
|
||||||
@@ -888,7 +916,7 @@ public class SyncIamService {
|
|||||||
public BpmcResponseDto roleResourceDeleteService(List<RoleResourceDto> roleResourceDtoList){
|
public BpmcResponseDto roleResourceDeleteService(List<RoleResourceDto> roleResourceDtoList){
|
||||||
try {
|
try {
|
||||||
for (RoleResourceDto roleResourceDto : roleResourceDtoList){
|
for (RoleResourceDto roleResourceDto : roleResourceDtoList){
|
||||||
QueryWrapper<SysRolePermission> queryWrapper = new QueryWrapper<SysRolePermission>();
|
QueryWrapper<SysRolePermission> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("permission_id", roleResourceDto.getAmId());
|
queryWrapper.eq("permission_id", roleResourceDto.getAmId());
|
||||||
queryWrapper.eq("role_id", roleResourceDto.getArId());
|
queryWrapper.eq("role_id", roleResourceDto.getArId());
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -43,22 +43,22 @@ public class DockingConstant {
|
|||||||
/**
|
/**
|
||||||
* 竹云统一认证平台,接口类型:角色
|
* 竹云统一认证平台,接口类型:角色
|
||||||
*/
|
*/
|
||||||
public static String BPMC_TYPE_ROLE = "D_AR";
|
public static final String BPMC_TYPE_ROLE = "D_AR";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 竹云统一认证平台,接口类型:功能权限
|
* 竹云统一认证平台,接口类型:功能权限
|
||||||
*/
|
*/
|
||||||
public static String BPMC_TYPE_RESOURCE = "D_AM";
|
public static final String BPMC_TYPE_RESOURCE = "D_AM";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 竹云统一认证平台,接口类型:账号与应用角色关系
|
* 竹云统一认证平台,接口类型:账号与应用角色关系
|
||||||
*/
|
*/
|
||||||
public static String BPMC_TYPE_USER_ROLE = "R_USER_AR";
|
public static final String BPMC_TYPE_USER_ROLE = "R_USER_AR";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 竹云统一认证平台,接口类型:应用角色与应用功能权限关系
|
* 竹云统一认证平台,接口类型:应用角色与应用功能权限关系
|
||||||
*/
|
*/
|
||||||
public static String BPMC_TYPE_ROLE_RESOURCE = "R_AR_AM";
|
public static final String BPMC_TYPE_ROLE_RESOURCE = "R_AR_AM";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 竹云统一认证平台,操作类型:新增
|
* 竹云统一认证平台,操作类型:新增
|
||||||
|
|||||||
Reference in New Issue
Block a user