Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
聂康
local-rnr-user
Commits
02be8110
Commit
02be8110
authored
Jun 17, 2025
by
kang.nie@inzymeits.com
Browse files
初始化代码
parent
e9f88257
Pipeline
#3111
failed with stages
in 0 seconds
Changes
259
Pipelines
1
Show whitespace changes
Inline
Side-by-side
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/constants/PasswordCheckCode.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.constants
;
public
enum
PasswordCheckCode
{
PASSWORD_LENGTH
(
1601
,
"密码长度限制为8-20个字符"
),
CONTAINS_USER_NAME
(
1602
,
"密码不能包含用户名"
),
CONTINUOUS_CHARACTER
(
1603
,
"密码不能包含3个连续的字符"
),
KEYBOARD_CONTINUOUS_CHARACTERS
(
1604
,
"密码不能包含3个及以上键盘连续字符"
),
CONTAINS_SYSTEM_PASSWORD
(
1605
,
"密码不能使用操作系统、数据库等相关词组"
),
TOO_LOW_COMPLEXITY
(
1606
,
"数字、小写字母、大写字母、特殊字符,至少包含三种"
)
;
private
Integer
code
;
private
String
msg
;
PasswordCheckCode
(
Integer
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/constants/RedisConstant.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.constants
;
/**
* Description: redis相关常量类
* <br />
* CreateDate 2021-11-03 20:36
*
* @author yuyi
**/
public
class
RedisConstant
{
//url的白名单集合
public
static
final
String
URL_WHITE_LIST
=
"CT:USER:AUTH:URL:WHITE:LIST"
;
//用户id对应的url集合 CT:USER:AUTH:URL:USER:租户编号:用户id_应用id
public
static
final
String
USER_URL_LIST
=
"CT:USER:AUTH:URL:USER:"
;
//应用配置信息
public
static
final
String
APP_CODE_CONFIG
=
"CT:USER:AUTH:APP:CONFIG:"
;
//应用配置信息失效时间 秒
public
static
final
int
APP_CODE_CONFIG_TIME
=
1800
;
//短信发送-重置密码-天限制
public
static
final
String
SMS_SEND_RESET_PASSWORD_DAY_LIMIT
=
"CT:USER:SMS:DAY:RESETPASSWORD:"
;
//短信发送-重置密码-间隔限制
public
static
final
String
SMS_SEND_RESET_PASSWORD_INTERVAL_LIMIT
=
"CT:USER:SMS:INTERVAL:RESETPASSWORD:"
;
//token相关
//access_token对应的用户id、refresh_token、scope
public
static
final
String
TOKEN_ACCESS_TOKEN_INFO
=
"CT:USER:AUTH:TOKEN:ACCESS_TOKEN:"
;
//refresh_token对应的token和用户id
public
static
final
String
TOKEN_REFRESH_TOKEN_INFO
=
"CT:USER:AUTH:TOKEN:REFRESH_TOKEN:"
;
//用户id对应的access_token、refresh_token集合
public
static
final
String
TOKEN_USER_TOKEN_INFO
=
"CT:USER:AUTH:TOKEN:USER:"
;
//短信验证码key前缀
public
static
final
String
SMS_CAPTCHA_KEY
=
"CT:USER:AUTH:SMS:CAPTCHA:"
;
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/constants/ResponseCode.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.constants
;
public
enum
ResponseCode
{
INVALID_DATA
(
1001
,
"数据校验不通过"
),
SYS_BUSY
(
1002
,
"服务调用失败"
),
SERVICE_NOT_FOUND
(
1003
,
"服务不存在"
),
TP_SYS_BUSY
(
1004
,
"第三方服务调用失败"
),
JSON_FORMAT_ERROR
(
1005
,
"参数格式错误"
),
REQ_TOO_MANY_TIMES
(
1007
,
"请求过于频繁,请联系管理员!"
),
NO_DATA_AUTH
(
1008
,
"请求过于频繁,请联系管理员!"
),
REDIS_OPT_FAIL
(
1009
,
"redis操作失败,请联系管理员!"
),
PARAMETER_NULL
(
1010
,
"请求参数不能为空!"
),
SMS_GET_CAPTCHA_FAIL
(
1113
,
"获取短信验证码失败"
),
SMS_CAPTCHA_INVALID
(
1114
,
"短信验证码无效!"
),
TENANT_NO_GENERATE_FAIL
(
1501
,
"租户编码生成失败"
),
COMPANY_REPEAT
(
1502
,
"公司名称重复"
),
USER_NAME_REPEAT
(
1503
,
"登录名重复"
),
USER_PHONE_REPEAT
(
1504
,
"手机号重复"
),
USER_EMAIL_REPEAT
(
1505
,
"邮箱重复"
),
USER_PASSWORD_NOT_NULL
(
1506
,
"用户密码不能为空"
),
ROLE_NAME_REPEAT
(
1507
,
"该角色名称已存在!"
),
ROLE_UUID_NOT_NULL
(
1508
,
"角色uuid不能为空"
),
ROLE_NAME_NOT_NULL
(
1509
,
"角色名称不能为空"
),
TENANT_NO_NOT_NULL
(
1510
,
"租户编码不能为空"
),
COMPANY_UUID_NOT_NULL
(
1511
,
"公司uuid不能为空"
),
USER_PHONE_NOT_NULL
(
1512
,
"用户手机号不能为空"
),
USER_UUID_NOT_NULL
(
1513
,
"用户uuid不能为空"
),
USER_ID_NOT_NULL
(
1514
,
"用户id不能为空"
),
ROLE_INVALID
(
1515
,
"无效的角色信息"
),
USER_INVALID
(
1516
,
"无效的用户信息"
),
TENANT_ADMIN_INVALID
(
1517
,
"租户的管理员账号不存在,请联系系统管理员!"
),
APP_CODE_NOT_NULL
(
1518
,
"应用编码不能为空"
),
APP_CONFIG_INVALID
(
1519
,
"应用配置信息无效"
),
USER_OLD_PASSWORD_ERROR
(
1520
,
"用户原密码不正确"
),
SMS_CONFIG_NOT_NULL
(
1521
,
"短信配置不能为空"
),
RESET_PASSWORDPHONE_NOT_NULL
(
1522
,
"重置密码失败,手机号不能空"
),
SMS_SEND_ERROR
(
1523
,
"短信发送失败,内部错误"
),
SMS_TOTAL_LIMIT_OVERRUN
(
1524
,
"发送短信超过当天发送的最大限制"
),
SMS_INTERVAL_LIMIT_OVERRUN
(
1525
,
"短信发送失败,发送间隔限制时间内重复发送"
),
APPLICATION_TENANT_REQUIRED
(
1526
,
"应用id和租户编号不能为空"
),
KICK_OUT_FAIL
(
1527
,
"踢出失败,系统异常!"
),
USER_NAME_NOT_NULL
(
1528
,
"用户名不能为空"
),
USER_EMAIL_NOT_NULL
(
1529
,
"邮箱不能为空"
),
RESOURCE_INVALID
(
1530
,
"无效的资源信息"
),
TENANT_NAME_REPEART
(
1531
,
"租户名称重复"
),
ORGAN_PARENT_INVALID
(
1532
,
"组织父节点无效"
),
SYSTEM_ERROR
(-
1
,
"系统错误"
);
;
private
Integer
code
;
private
String
msg
;
ResponseCode
(
Integer
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/DataOperationLogController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.PageResult
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.dto.DataOperationLogDTO
;
import
com.cusc.nirvana.user.eiam.service.IDataOperationLogService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* eiam数据操作历史(DataOperationLog)表控制层
*
* @author yuy336
* @since 2022-01-12 15:02:10
*/
@RestController
@RequestMapping
(
"/dataOperationLog"
)
public
class
DataOperationLogController
{
/**
* 服务对象
*/
@Autowired
private
IDataOperationLogService
dataOperationLogService
;
/**
* 分页查询
*
* @param dataOperationLog 筛选条件
* @return 查询结果
*/
@PostMapping
(
"/queryByPage"
)
@ApiOperation
(
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
Response
<
PageResult
<
DataOperationLogDTO
>>
queryByPage
(
@RequestBody
DataOperationLogDTO
dataOperationLog
)
{
return
Response
.
createSuccess
(
dataOperationLogService
.
queryByPage
(
dataOperationLog
));
}
/**
* 通过主键查询单条数据
*
* @param dataOperationLog 实体
* @return 单条数据
*/
@PostMapping
(
"/getByUuid"
)
public
Response
<
DataOperationLogDTO
>
getByUuid
(
@RequestBody
DataOperationLogDTO
dataOperationLog
)
{
return
Response
.
createSuccess
(
this
.
dataOperationLogService
.
getByUuid
(
dataOperationLog
));
}
/**
* 通过主键查询单条数据
*
* @param dataOperationLog 实体
* @return 单条数据
*/
@PostMapping
(
"/queryByList"
)
public
Response
<
List
<
DataOperationLogDTO
>>
queryByList
(
@RequestBody
DataOperationLogDTO
dataOperationLog
)
{
return
Response
.
createSuccess
(
this
.
dataOperationLogService
.
queryByList
(
dataOperationLog
));
}
/**
* 新增数据
*
* @param dataOperationLog 实体
* @return 新增结果
*/
@PostMapping
(
"/add"
)
public
Response
add
(
@RequestBody
DataOperationLogDTO
dataOperationLog
)
{
this
.
dataOperationLogService
.
insert
(
dataOperationLog
);
return
Response
.
createSuccess
();
}
/**
* 编辑数据
*
* @param dataOperationLog 实体
* @return 编辑结果
*/
@PostMapping
(
"/update"
)
public
Response
update
(
@RequestBody
DataOperationLogDTO
dataOperationLog
)
{
this
.
dataOperationLogService
.
update
(
dataOperationLog
);
return
Response
.
createSuccess
();
}
/**
* 删除数据
*
* @param dataOperationLog 实体
* @return 删除是否成功
*/
@PostMapping
(
"/deleteById"
)
public
Response
<
Boolean
>
deleteById
(
@RequestBody
DataOperationLogDTO
dataOperationLog
)
{
return
Response
.
createSuccess
(
dataOperationLogService
.
deleteById
(
dataOperationLog
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/OrganizationController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.PageResult
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.dto.OrganizationDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserOrganDTO
;
import
com.cusc.nirvana.user.eiam.service.IOrganizationService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* 组织机构(Organization)表控制层
*
* @author yuy336
* @since 2022-01-12 14:59:29
*/
@RestController
@RequestMapping
(
"/organization"
)
public
class
OrganizationController
{
/**
* 服务对象
*/
@Autowired
private
IOrganizationService
organizationService
;
/**
* 分页查询
*
* @param organization 筛选条件
* @return 查询结果
*/
@PostMapping
(
"/queryByPage"
)
@ApiOperation
(
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
Response
<
PageResult
<
OrganizationDTO
>>
queryByPage
(
@RequestBody
OrganizationDTO
organization
)
{
return
Response
.
createSuccess
(
organizationService
.
queryByPage
(
organization
));
}
/**
* 通过主键查询单条数据
*
* @param organization 实体
* @return 单条数据
*/
@PostMapping
(
"/getByUuid"
)
public
Response
<
OrganizationDTO
>
getByUuid
(
@RequestBody
OrganizationDTO
organization
)
{
return
Response
.
createSuccess
(
this
.
organizationService
.
getByUuid
(
organization
));
}
/**
* 通过主键查询单条数据
*
* @param organization 实体
* @return 单条数据
*/
@PostMapping
(
"/queryByList"
)
public
Response
<
List
<
OrganizationDTO
>>
queryByList
(
@RequestBody
OrganizationDTO
organization
)
{
return
Response
.
createSuccess
(
this
.
organizationService
.
queryByList
(
organization
));
}
/**
* 新增数据
*
* @param organization 实体
* @return 新增结果
*/
@PostMapping
(
"/add"
)
public
Response
<
OrganizationDTO
>
add
(
@RequestBody
OrganizationDTO
organization
)
{
return
Response
.
createSuccess
(
this
.
organizationService
.
insert
(
organization
));
}
/**
* 编辑数据
*
* @param organization 实体
* @return 编辑结果
*/
@PostMapping
(
"/update"
)
public
Response
update
(
@RequestBody
OrganizationDTO
organization
)
{
this
.
organizationService
.
update
(
organization
);
return
Response
.
createSuccess
();
}
/**
* 删除数据
*
* @param organization 实体
* @return 删除是否成功
*/
@PostMapping
(
"/deleteById"
)
public
Response
<
Boolean
>
deleteById
(
@RequestBody
OrganizationDTO
organization
)
{
return
Response
.
createSuccess
(
organizationService
.
deleteById
(
organization
));
}
/**
* 冻结数据
*
* @param bean 实体
* @return 删除是否成功
*/
@PostMapping
(
"/frozen"
)
@ApiOperation
(
value
=
"冻结"
,
notes
=
"冻结"
)
public
Response
frozen
(
@RequestBody
OrganizationDTO
bean
)
{
return
Response
.
createSuccess
(
organizationService
.
frozen
(
bean
));
}
/**
* 解冻数据
*
* @param bean 实体
* @return 删除是否成功
*/
@PostMapping
(
"/unfreeze"
)
@ApiOperation
(
value
=
"解冻"
,
notes
=
"解冻"
)
public
Response
unfreeze
(
@RequestBody
OrganizationDTO
bean
)
{
return
Response
.
createSuccess
(
organizationService
.
unfreeze
(
bean
));
}
/**
* 通过用户id查询组织集合信息
*
* @param bean 实体
* @return 单条数据
*/
@PostMapping
(
"/getOrganListByUserId"
)
public
Response
<
List
<
OrganizationDTO
>>
getOrganListByUserId
(
@RequestBody
UserOrganDTO
bean
)
{
return
Response
.
createSuccess
(
organizationService
.
getOrganListByUserId
(
bean
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/ResourceController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.PageResult
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.constants.ResponseCode
;
import
com.cusc.nirvana.user.eiam.dto.*
;
import
com.cusc.nirvana.user.eiam.service.IResourceService
;
import
com.cusc.nirvana.user.eiam.service.IRoleService
;
import
com.cusc.nirvana.user.util.CuscStringUtils
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 资源控制器
* </p>
*
* @author auto-generator
* @since 2021-10-20
*/
@Slf4j
@RestController
@RequestMapping
(
"/resource"
)
public
class
ResourceController
{
@Autowired
IResourceService
resourceService
;
@Autowired
IRoleService
roleService
;
@PostMapping
(
"/addList"
)
@ApiOperation
(
value
=
"批量新增"
,
notes
=
"批量新增"
)
public
Response
addList
(
@RequestBody
ResourceBatchDTO
resourceBatch
)
{
Response
ret
=
resourceService
.
addList
(
resourceBatch
);
return
ret
;
}
@PostMapping
(
"/compareResource"
)
@ApiOperation
(
value
=
"比对输入和数据库中的资源"
,
notes
=
"比对输入和数据库中的资源"
)
public
Response
compareResource
(
@RequestBody
List
<
ResourceTreeDTO
>
resourceList
)
{
resourceService
.
compareResource
(
resourceList
);
return
Response
.
createSuccess
();
}
@PostMapping
(
"/query"
)
@ApiOperation
(
value
=
"查询资源集合"
,
notes
=
"查询资源集合"
)
public
Response
<
List
<
ResourceSimpleDTO
>>
query
(
@RequestBody
ResourceDTO
entity
)
{
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
resourceService
.
query
(
entity
);
}
@PostMapping
(
"/queryResourceByRoleId"
)
@ApiOperation
(
value
=
"通过角色id查询资源信息"
,
notes
=
"通过角色id查询资源信息"
)
public
Response
<
List
<
ResourceDTO
>>
queryResourceByRoleId
(
@RequestBody
RoleResourceDTO
entity
)
{
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getTenantNo
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getRoleId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceService
.
queryResourceByRoleId
(
entity
));
}
@PostMapping
(
"/queryResourceByUserId"
)
@ApiOperation
(
value
=
"通过用户id查询资源信息"
,
notes
=
"通过用户id查询资源信息"
)
public
Response
<
List
<
ResourceSimpleDTO
>>
queryResourceByUserId
(
@RequestBody
UserRoleDTO
entity
)
{
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getUserId
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceService
.
queryResourceByUserId
(
entity
));
}
/**
* 分页查询ResourceClient.queryResourceByUserId
*
* @param bean 筛选条件
* @return 查询结果
*/
@PostMapping
(
"/queryByPage"
)
@ApiOperation
(
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
Response
<
PageResult
<
ResourceDTO
>>
queryByPage
(
@RequestBody
ResourceDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceService
.
queryByPage
(
bean
));
}
/**
* 通过主键查询单条数据
*
* @param bean 实体
* @return 单条数据
*/
@PostMapping
(
"/getByUuid"
)
@ApiOperation
(
value
=
"通过主键查询单条数据"
,
notes
=
"通过主键查询单条数据"
)
public
Response
<
ResourceDTO
>
getByUuid
(
@RequestBody
ResourceDTO
bean
)
{
return
Response
.
createSuccess
(
resourceService
.
getByUuid
(
bean
));
}
/**
* 新增数据
*
* @param bean 实体
* @return 新增结果
*/
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"新增数据"
,
notes
=
"新增数据"
)
public
Response
add
(
@RequestBody
ResourceDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getResourceCode
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getResourceName
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceService
.
add
(
bean
));
}
/**
* 编辑数据
*
* @param bean 实体
* @return 编辑结果
*/
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"新增数据"
,
notes
=
"新增数据"
)
public
Response
update
(
@RequestBody
ResourceDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getUuid
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceService
.
update
(
bean
));
}
/**
* 删除数据
*
* @param resource 实体
* @return 删除是否成功
*/
@PostMapping
(
"/deleteById"
)
@ApiOperation
(
value
=
"删除数据"
,
notes
=
"删除数据"
)
public
Response
<
Boolean
>
deleteById
(
@RequestBody
ResourceDTO
resource
)
{
if
(
CuscStringUtils
.
isEmpty
(
resource
.
getUuid
())
||
CuscStringUtils
.
isEmpty
(
resource
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceService
.
deleteById
(
resource
));
}
/**
* 冻结数据
*
* @param resource 实体
* @return 删除是否成功
*/
@PostMapping
(
"/frozen"
)
@ApiOperation
(
value
=
"冻结"
,
notes
=
"冻结"
)
public
Response
frozen
(
@RequestBody
ResourceDTO
resource
)
{
if
(
CuscStringUtils
.
isEmpty
(
resource
.
getUuid
())
||
CuscStringUtils
.
isEmpty
(
resource
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceService
.
frozen
(
resource
));
}
/**
* 解冻数据
*
* @param resource 实体
* @return 删除是否成功
*/
@PostMapping
(
"/unfreeze"
)
@ApiOperation
(
value
=
"解冻"
,
notes
=
"解冻"
)
public
Response
unfreeze
(
@RequestBody
ResourceDTO
resource
)
{
if
(
CuscStringUtils
.
isEmpty
(
resource
.
getUuid
())
||
CuscStringUtils
.
isEmpty
(
resource
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceService
.
unfreeze
(
resource
));
}
/**
* 生成资源sql
*
* @param bean 实体
* @return 删除是否成功
*/
@PostMapping
(
"/generateResSql"
)
@ApiOperation
(
value
=
"生成资源sql"
,
notes
=
"生成资源sql"
)
public
Response
<
List
<
String
>>
generateResSql
(
@RequestBody
ResourceDTO
bean
)
{
return
Response
.
createSuccess
(
resourceService
.
generateResSql
(
bean
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/ResourceTempalteController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.PageResult
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.constants.ResponseCode
;
import
com.cusc.nirvana.user.eiam.dto.ResourceTempalteDTO
;
import
com.cusc.nirvana.user.eiam.service.IResourceTempalteService
;
import
com.cusc.nirvana.user.util.CuscStringUtils
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* (ResourceTempalte)表控制层
*
* @author yuy336
* @since 2022-01-11 17:34:39
*/
@RestController
@RequestMapping
(
"/resourceTempalte"
)
public
class
ResourceTempalteController
{
/**
* 服务对象
*/
@Autowired
private
IResourceTempalteService
resourceTempalteService
;
/**
* 分页查询
*
* @param resourceTempalte 筛选条件
* @return 查询结果
*/
@PostMapping
(
"/queryByPage"
)
@ApiOperation
(
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
Response
<
PageResult
<
ResourceTempalteDTO
>>
queryByPage
(
@RequestBody
ResourceTempalteDTO
resourceTempalte
)
{
return
Response
.
createSuccess
(
resourceTempalteService
.
queryByPage
(
resourceTempalte
));
}
/**
* 通过主键查询单条数据
*
* @param resourceTempalte 实体
* @return 单条数据
*/
@PostMapping
(
"/getByUuid"
)
public
Response
<
ResourceTempalteDTO
>
getByUuid
(
@RequestBody
ResourceTempalteDTO
resourceTempalte
)
{
return
Response
.
createSuccess
(
this
.
resourceTempalteService
.
getByUuid
(
resourceTempalte
));
}
/**
* 通过主键查询单条数据
*
* @param resourceTempalte 实体
* @return 单条数据
*/
@PostMapping
(
"/queryByList"
)
public
Response
<
List
<
ResourceTempalteDTO
>>
queryByList
(
@RequestBody
ResourceTempalteDTO
resourceTempalte
)
{
return
Response
.
createSuccess
(
this
.
resourceTempalteService
.
queryByList
(
resourceTempalte
));
}
/**
* 新增数据
*
* @param resourceTempalte 实体
* @return 新增结果
*/
@PostMapping
(
"/add"
)
public
Response
add
(
@RequestBody
ResourceTempalteDTO
resourceTempalte
)
{
this
.
resourceTempalteService
.
insert
(
resourceTempalte
);
return
Response
.
createSuccess
();
}
/**
* 编辑数据
*
* @param resourceTempalte 实体
* @return 编辑结果
*/
@PostMapping
(
"/update"
)
public
Response
update
(
@RequestBody
ResourceTempalteDTO
resourceTempalte
)
{
this
.
resourceTempalteService
.
update
(
resourceTempalte
);
return
Response
.
createSuccess
();
}
/**
* 删除数据
*
* @param resourceTempalte 实体
* @return 删除是否成功
*/
@PostMapping
(
"/deleteById"
)
public
Response
<
Boolean
>
deleteById
(
@RequestBody
ResourceTempalteDTO
resourceTempalte
)
{
return
Response
.
createSuccess
(
resourceTempalteService
.
deleteById
(
resourceTempalte
));
}
/**
* 通过租户编号和应用id查询资源id集合
* @param resourceTempalte
* @return
*/
@PostMapping
(
"/queryResourceIdList"
)
public
Response
<
List
<
String
>>
queryResourceIdList
(
@RequestBody
ResourceTempalteDTO
resourceTempalte
)
{
if
(
CuscStringUtils
.
isEmpty
(
resourceTempalte
.
getApplicationId
())
||
CuscStringUtils
.
isEmpty
(
resourceTempalte
.
getRoleCode
())){
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
resourceTempalteService
.
queryResourceIdList
(
resourceTempalte
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/RoleController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.PageResult
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.constants.ResponseCode
;
import
com.cusc.nirvana.user.eiam.dto.RoleDTO
;
import
com.cusc.nirvana.user.eiam.dto.RoleSimpleDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserRoleDTO
;
import
com.cusc.nirvana.user.eiam.service.IRoleService
;
import
com.cusc.nirvana.user.eiam.service.IUrlService
;
import
com.cusc.nirvana.user.eiam.util.CommonParamterCheck
;
import
com.cusc.nirvana.user.util.CuscStringUtils
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 角色管理
* </p>
*
* @author auto-generator
* @since 2021-10-20
*/
@Slf4j
@RestController
@RequestMapping
(
"/role"
)
public
class
RoleController
{
@Autowired
private
IRoleService
roleService
;
@Autowired
private
IUrlService
urlService
;
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"新增角色"
,
notes
=
"新增角色"
)
public
Response
add
(
@RequestBody
RoleDTO
entity
)
{
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getRoleCode
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getRoleName
())
||
entity
.
getRoleType
()
==
null
)
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
RoleDTO
ret
=
roleService
.
add
(
entity
);
urlService
.
roleRelUrlToRedis
(
ret
.
getUuid
(),
ret
.
getRoleScene
(),
ret
.
getTenantNo
(),
ret
.
getApplicationId
());
return
Response
.
createSuccess
(
ret
);
}
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新角色"
,
notes
=
"更新角色"
)
public
Response
update
(
@RequestBody
RoleDTO
entity
)
{
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
RoleDTO
ret
=
roleService
.
update
(
entity
);
urlService
.
roleRelUrlToRedis
(
ret
.
getUuid
(),
ret
.
getRoleScene
(),
ret
.
getTenantNo
(),
ret
.
getApplicationId
());
return
Response
.
createSuccess
(
ret
);
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除角色"
,
notes
=
"删除角色"
)
public
Response
delete
(
@RequestBody
RoleDTO
entity
)
{
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
RoleDTO
ret
=
roleService
.
delete
(
entity
);
urlService
.
roleRelUrlToRedis
(
ret
.
getUuid
(),
ret
.
getRoleScene
(),
ret
.
getTenantNo
(),
ret
.
getApplicationId
());
return
Response
.
createSuccess
(
true
);
}
@PostMapping
(
"/query"
)
@ApiOperation
(
value
=
"查询角色"
,
notes
=
"查询角色"
)
public
Response
<
List
<
RoleSimpleDTO
>>
query
(
@RequestBody
RoleDTO
entity
)
{
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
roleService
.
query
(
entity
));
}
@PostMapping
(
"/get"
)
@ApiOperation
(
value
=
"查询单个角色"
,
notes
=
"查询单个角色"
)
public
Response
<
RoleDTO
>
get
(
@RequestBody
RoleDTO
entity
)
{
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
roleService
.
get
(
entity
));
}
@PostMapping
(
"/page"
)
@ApiOperation
(
value
=
"分页查询(page)"
,
notes
=
"分页查询"
)
public
Response
<
PageResult
<
RoleDTO
>>
page
(
@RequestBody
RoleDTO
entity
)
{
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
roleService
.
page
(
entity
));
}
@PostMapping
(
"/getByUuid"
)
@ApiOperation
(
value
=
"通过id查询角色详情"
,
notes
=
"通过id查询角色详情"
)
public
Response
<
RoleDTO
>
getByUuid
(
@RequestBody
RoleDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
roleService
.
getByUuid
(
entity
));
}
@PostMapping
(
"/getByUuids"
)
@ApiOperation
(
value
=
"通过id集合查询角色详情"
,
notes
=
"通过id集合查询角色详情"
)
public
Response
<
List
<
RoleSimpleDTO
>>
getByUuids
(
@RequestBody
RoleDTO
entity
)
{
if
(
CollectionUtils
.
isEmpty
(
entity
.
getUuidList
()))
{
return
Response
.
createError
(
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
roleService
.
getByUuids
(
entity
));
}
@PostMapping
(
"/queryRoleByUserId"
)
@ApiOperation
(
value
=
"通过用户id查询角色信息"
,
notes
=
"通过用户id查询角色信息"
)
public
Response
<
List
<
RoleDTO
>>
queryRoleByUserId
(
@RequestBody
UserRoleDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUserId
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
roleService
.
queryRoleByUserId
(
entity
));
}
@PostMapping
(
"/queryRoleByName"
)
@ApiOperation
(
value
=
"通过角色名称查询角色信息"
,
notes
=
"通过角色名称查询角色信息"
)
public
Response
<
List
<
RoleSimpleDTO
>>
queryRoleByName
(
@RequestBody
RoleDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getRoleName
()))
{
return
Response
.
createError
(
ResponseCode
.
ROLE_NAME_NOT_NULL
.
getMsg
(),
ResponseCode
.
ROLE_NAME_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
roleService
.
queryRoleByName
(
entity
));
}
/**
* 冻结数据
*
* @param bean 实体
* @return 删除是否成功
*/
@PostMapping
(
"/frozen"
)
@ApiOperation
(
value
=
"冻结"
,
notes
=
"冻结"
)
public
Response
frozen
(
@RequestBody
RoleDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
bean
.
getApplicationId
(),
bean
.
getTenantNo
());
RoleDTO
ret
=
roleService
.
frozen
(
bean
);
urlService
.
roleRelUrlToRedis
(
ret
.
getUuid
(),
ret
.
getRoleScene
(),
ret
.
getTenantNo
(),
ret
.
getApplicationId
());
return
Response
.
createSuccess
(
true
);
}
/**
* 解冻数据
*
* @param bean 实体
* @return 删除是否成功
*/
@PostMapping
(
"/unfreeze"
)
@ApiOperation
(
value
=
"解冻"
,
notes
=
"解冻"
)
public
Response
unfreeze
(
@RequestBody
RoleDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
ROLE_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
bean
.
getApplicationId
(),
bean
.
getTenantNo
());
RoleDTO
ret
=
roleService
.
unfreeze
(
bean
);
urlService
.
roleRelUrlToRedis
(
ret
.
getUuid
(),
ret
.
getRoleScene
(),
ret
.
getTenantNo
(),
ret
.
getApplicationId
());
return
Response
.
createSuccess
(
true
);
}
@PostMapping
(
"/queryHideSensitiveByUserId"
)
@ApiOperation
(
value
=
"通过用户id查询是否脱敏"
,
notes
=
"通过用户id查询是否脱敏 false 脱敏, true 不脱敏"
)
public
Response
<
Boolean
>
queryHideSensitiveByUserId
(
@RequestBody
UserRoleDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUserId
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
roleService
.
queryHideSensitiveByUserId
(
entity
);
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/RoleResourceController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.constants.ResponseCode
;
import
com.cusc.nirvana.user.eiam.constants.RoleSceneEnum
;
import
com.cusc.nirvana.user.eiam.dto.RoleResourceDTO
;
import
com.cusc.nirvana.user.eiam.service.IRoleResourceService
;
import
com.cusc.nirvana.user.eiam.service.IUrlService
;
import
com.cusc.nirvana.user.util.CuscStringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* (RoleResource)表控制层
*
* @author yuy336
* @since 2022-01-18 17:35:23
*/
@RestController
@RequestMapping
(
"/roleResource"
)
public
class
RoleResourceController
{
/**
* 服务对象
*/
@Autowired
private
IRoleResourceService
roleResourceService
;
@Autowired
private
IUrlService
urlService
;
/**
* 新增数据
*
* @param bean 实体
* @return 新增结果
*/
@PostMapping
(
"/add"
)
public
Response
add
(
@RequestBody
RoleResourceDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getRoleId
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getTenantNo
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getApplicationId
())){
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
roleResourceService
.
add
(
bean
));
}
/**
* 通过角色批量删除角色与资源的关系
*
* @param bean 实体
* @return 删除结果
*/
@PostMapping
(
"/deleteBatchRole"
)
public
Response
deleteBatchRole
(
@RequestBody
RoleResourceDTO
bean
)
{
if
(
CollectionUtils
.
isEmpty
(
bean
.
getRoleIdList
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getTenantNo
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
for
(
String
roleId
:
bean
.
getRoleIdList
())
{
bean
.
setRoleId
(
roleId
);
roleResourceService
.
addBatchResource
(
bean
);
urlService
.
roleRelUrlToRedis
(
roleId
,
RoleSceneEnum
.
USER
.
getCode
(),
bean
.
getTenantNo
(),
bean
.
getApplicationId
());
}
return
Response
.
createSuccess
(
bean
.
getRoleIdList
().
size
());
}
/**
* 通过主键查询单条数据
*
* @param userRole 实体
* @return 单条数据
*/
@PostMapping
(
"/queryByList"
)
public
Response
<
List
<
RoleResourceDTO
>>
queryByList
(
@RequestBody
RoleResourceDTO
userRole
)
{
return
Response
.
createSuccess
(
roleResourceService
.
queryByList
(
userRole
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/UrlController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.constants.ResponseCode
;
import
com.cusc.nirvana.user.eiam.dto.EiamUrlDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserSimpleDTO
;
import
com.cusc.nirvana.user.eiam.service.IUrlService
;
import
com.cusc.nirvana.user.eiam.service.IUserService
;
import
com.cusc.nirvana.user.eiam.util.CommonParamterCheck
;
import
com.cusc.nirvana.user.util.CuscStringUtils
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 资源url控制器
* </p>
*
* @author auto-generator
* @since 2021-10-20
*/
@Slf4j
@RestController
@RequestMapping
(
"/resource/url"
)
public
class
UrlController
{
@Autowired
IUrlService
urlService
;
@Autowired
private
IUserService
userService
;
@PostMapping
(
"/queryByUrl"
)
@ApiOperation
(
value
=
"通过url 和 应用id 查询url对应的id"
,
notes
=
"通过url 和 应用id 查询url对应的id"
)
public
Response
<
Long
>
queryByUrl
(
@RequestBody
EiamUrlDTO
bean
)
{
return
Response
.
createSuccess
(
urlService
.
queryByUrl
(
bean
));
}
@PostMapping
(
"/whiteListToRedis"
)
@ApiOperation
(
value
=
"初始化白名单"
,
notes
=
"初始化白名单"
)
public
Response
<
Integer
>
whiteListToRedis
()
{
return
Response
.
createSuccess
(
urlService
.
whiteListToRedis
());
}
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"添加url"
,
notes
=
"添加url"
)
public
Response
<
Long
>
add
(
@RequestBody
EiamUrlDTO
bean
)
{
return
Response
.
createSuccess
(
urlService
.
add
(
bean
));
}
@PostMapping
(
"/userRoleResUrlToRedis"
)
@ApiOperation
(
value
=
"将用户授权的url写入redis"
,
notes
=
"将用户授权的url写入redis"
)
public
Response
userRoleResUrlToRedis
(
@RequestBody
EiamUrlDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getUserId
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getApplicationId
())
||
CuscStringUtils
.
isEmpty
(
bean
.
getTenantNo
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
urlService
.
userRoleResUrlToRedis
(
bean
.
getUserId
(),
bean
.
getTenantNo
(),
bean
.
getApplicationId
());
return
Response
.
createSuccess
();
}
@PostMapping
(
"/allUserRoleResToRedis"
)
@ApiOperation
(
value
=
"刷新所有用户的URL至缓存"
,
notes
=
"刷新所有用户的URL至缓存"
)
public
Response
allUserRoleResToRedis
(
@RequestBody
EiamUrlDTO
bean
)
{
CommonParamterCheck
.
appIdAndTenantNoRequired
(
bean
.
getApplicationId
(),
bean
.
getTenantNo
());
//查询所有用户信息
UserDTO
user
=
new
UserDTO
();
user
.
setTenantNo
(
bean
.
getTenantNo
());
List
<
UserSimpleDTO
>
userList
=
userService
.
queryListUser
(
user
);
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
for
(
UserSimpleDTO
userSimpleDTO
:
userList
)
{
urlService
.
userRoleResUrlToRedis
(
userSimpleDTO
.
getUuid
(),
bean
.
getTenantNo
(),
bean
.
getApplicationId
());
}
}
return
Response
.
createSuccess
();
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/UserController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.PageResult
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.constants.CommonDeleteEnum
;
import
com.cusc.nirvana.user.eiam.constants.ResponseCode
;
import
com.cusc.nirvana.user.eiam.dto.UserDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserPasswordDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserRoleDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserSimpleDTO
;
import
com.cusc.nirvana.user.eiam.service.IUserService
;
import
com.cusc.nirvana.user.eiam.util.CommonParamterCheck
;
import
com.cusc.nirvana.user.util.CuscStringUtils
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 针对内部员工、生态合作伙伴、分级线下店铺等企业内部用户 前端控制器
* </p>
*
* @author yuy336
* @since 2021-10-20
*/
@Slf4j
@RestController
@RequestMapping
(
"/user"
)
public
class
UserController
{
@Autowired
IUserService
userService
;
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"新增用户"
,
notes
=
"新增用户"
)
public
Response
add
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getPhone
())){
return
Response
.
createError
(
ResponseCode
.
USER_PHONE_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_PHONE_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
addUser
(
entity
));
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除用户"
,
notes
=
"删除用户"
)
public
Response
delete
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
deleteUser
(
entity
));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新用户信息"
,
notes
=
"更新用户信息"
)
public
Response
update
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
updateUser
(
entity
));
}
@PostMapping
(
"/query"
)
@ApiOperation
(
value
=
"查询用户集合信息"
,
notes
=
"查询用户集合信息"
)
public
Response
<
List
<
UserSimpleDTO
>>
query
(
@RequestBody
UserDTO
entity
)
{
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
queryListUser
(
entity
));
}
@PostMapping
(
"/get"
)
@ApiOperation
(
value
=
"查询单个用户信息"
,
notes
=
"查询单个用户信息"
)
public
Response
<
UserDTO
>
get
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
getUser
(
entity
));
}
@PostMapping
(
"/page"
)
@ApiOperation
(
value
=
"分页查询用户信息(page)"
,
notes
=
"分页查询用户信息"
)
public
Response
<
PageResult
<
UserDTO
>>
page
(
@RequestBody
UserDTO
entity
)
{
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
pageListUser
(
entity
));
}
@PostMapping
(
"/frozen"
)
@ApiOperation
(
value
=
"冻结用户"
,
notes
=
"冻结用户"
)
public
Response
frozen
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
frozen
(
entity
));
}
@PostMapping
(
"/unfreeze"
)
@ApiOperation
(
value
=
"解冻用户"
,
notes
=
"解冻用户"
)
public
Response
unfreeze
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
unfreeze
(
entity
));
}
@PostMapping
(
"/getByUuid"
)
@ApiOperation
(
value
=
"通过id查询用户详情"
,
notes
=
"通过id查询用户详情"
)
public
Response
<
UserDTO
>
getByUuid
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
getByUuid
(
entity
));
}
@PostMapping
(
"/getByUuids"
)
@ApiOperation
(
value
=
"通过id集合查询用户详情"
,
notes
=
"通过id集合查询用户详情"
)
public
Response
<
List
<
UserSimpleDTO
>>
getByUuids
(
@RequestBody
UserDTO
entity
)
{
if
(
CollectionUtils
.
isEmpty
(
entity
.
getUuidList
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
getByUuids
(
entity
));
}
@PostMapping
(
"/queryUserByRoleId"
)
@ApiOperation
(
value
=
"通过角色id查询用户信息"
,
notes
=
"通过角色查询用户信息"
)
public
Response
<
List
<
UserDTO
>>
queryUserByRoleId
(
@RequestBody
UserRoleDTO
entity
)
{
if
(
entity
.
getIsDelete
()
==
null
)
{
entity
.
setIsDelete
(
CommonDeleteEnum
.
NORMAL
.
getCode
());
}
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getTenantNo
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getApplicationId
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getRoleId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
userService
.
queryUserByRoleId
(
entity
));
}
@PostMapping
(
"/getByPhone"
)
@ApiOperation
(
value
=
"通过手机号查询用户详情"
,
notes
=
"通过手机号查询用户详情"
)
public
Response
<
UserDTO
>
getByPhone
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getPhone
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_PHONE_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_PHONE_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
getUser
(
entity
));
}
@PostMapping
(
"/getByUserName"
)
@ApiOperation
(
value
=
"通过登录名查询用户详情"
,
notes
=
"通过登录名查询用户详情"
)
public
Response
<
UserDTO
>
getByUserName
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUserName
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_NAME_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_NAME_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
getUser
(
entity
));
}
@PostMapping
(
"/getByEmail"
)
@ApiOperation
(
value
=
"通过邮箱查询用户详情"
,
notes
=
"通过邮箱查询用户详情"
)
public
Response
<
UserDTO
>
getByEmail
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getEmail
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_EMAIL_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_EMAIL_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
getUser
(
entity
));
}
@PostMapping
(
"/changeTenantAdmin"
)
@ApiOperation
(
value
=
"更换租户管理员账号"
,
notes
=
"更换租户管理员账号"
)
public
Response
changeTenantAdmin
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getTenantNo
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
userService
.
changeTenantAdmin
(
entity
));
}
@PostMapping
(
"/allUserRelUrlToRedis"
)
@ApiOperation
(
value
=
"将租户下的所有用户对应的url写入redis"
,
notes
=
"将租户下的所有用户对应的url写入redis"
)
public
Response
allUserRelUrlToRedis
(
@RequestBody
UserDTO
entity
)
{
userService
.
allUserRelUrlToRedis
(
entity
);
return
Response
.
createSuccess
();
}
@PostMapping
(
"/changePassword"
)
@ApiOperation
(
value
=
"修改密码"
,
notes
=
"修改密码"
)
public
Response
changePassword
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getPassword
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getNewPassword
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
changePassword
(
entity
));
}
@PostMapping
(
"/resetPassword"
)
@ApiOperation
(
value
=
"重置密码"
,
notes
=
"重置密码"
)
public
Response
<
Boolean
>
resetPassword
(
@RequestBody
UserPasswordDTO
bean
)
{
if
(
bean
==
null
||
CuscStringUtils
.
isEmpty
(
bean
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
bean
.
getApplicationId
(),
bean
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
resetPassword
(
bean
));
}
@PostMapping
(
"/getUserOnline"
)
@ApiOperation
(
value
=
"查询用户是否在线"
,
notes
=
"查询用户是否在线"
)
public
Response
getUserOnline
(
@RequestBody
UserDTO
entity
)
{
if
(
entity
==
null
||
CuscStringUtils
.
isEmpty
(
entity
.
getUuid
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
entity
.
getApplicationId
(),
entity
.
getTenantNo
());
return
Response
.
createSuccess
(
userService
.
getUserOnline
(
entity
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/UserOrganController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.PageResult
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.dto.UserOrganDTO
;
import
com.cusc.nirvana.user.eiam.service.IUserOrganService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* 用户组织信息(UserOrgan)表控制层
*
* @author yuy336
* @since 2022-01-12 15:00:02
*/
@RestController
@RequestMapping
(
"/userOrgan"
)
public
class
UserOrganController
{
/**
* 服务对象
*/
@Autowired
private
IUserOrganService
userOrganService
;
/**
* 分页查询
*
* @param userOrgan 筛选条件
* @return 查询结果
*/
@PostMapping
(
"/queryByPage"
)
@ApiOperation
(
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
Response
<
PageResult
<
UserOrganDTO
>>
queryByPage
(
@RequestBody
UserOrganDTO
userOrgan
)
{
return
Response
.
createSuccess
(
userOrganService
.
queryByPage
(
userOrgan
));
}
/**
* 通过主键查询单条数据
*
* @param userOrgan 实体
* @return 单条数据
*/
@PostMapping
(
"/getByUuid"
)
public
Response
<
UserOrganDTO
>
getByUuid
(
@RequestBody
UserOrganDTO
userOrgan
)
{
return
Response
.
createSuccess
(
this
.
userOrganService
.
getByUuid
(
userOrgan
));
}
/**
* 通过主键查询单条数据
*
* @param userOrgan 实体
* @return 单条数据
*/
@PostMapping
(
"/queryByList"
)
public
Response
<
List
<
UserOrganDTO
>>
queryByList
(
@RequestBody
UserOrganDTO
userOrgan
)
{
return
Response
.
createSuccess
(
this
.
userOrganService
.
queryByList
(
userOrgan
));
}
/**
* 新增数据
*
* @param userOrgan 实体
* @return 新增结果
*/
@PostMapping
(
"/add"
)
public
Response
add
(
@RequestBody
UserOrganDTO
userOrgan
)
{
this
.
userOrganService
.
insert
(
userOrgan
);
return
Response
.
createSuccess
();
}
/**
* 编辑数据
*
* @param userOrgan 实体
* @return 编辑结果
*/
@PostMapping
(
"/update"
)
public
Response
update
(
@RequestBody
UserOrganDTO
userOrgan
)
{
this
.
userOrganService
.
update
(
userOrgan
);
return
Response
.
createSuccess
();
}
/**
* 删除数据
*
* @param userOrgan 实体
* @return 删除是否成功
*/
@PostMapping
(
"/deleteById"
)
public
Response
<
Boolean
>
deleteById
(
@RequestBody
UserOrganDTO
userOrgan
)
{
return
Response
.
createSuccess
(
userOrganService
.
deleteById
(
userOrgan
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/UserResourceController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.constants.ResponseCode
;
import
com.cusc.nirvana.user.eiam.dto.UserDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserResourceDTO
;
import
com.cusc.nirvana.user.eiam.dto.UserSimpleDTO
;
import
com.cusc.nirvana.user.eiam.service.IUrlService
;
import
com.cusc.nirvana.user.eiam.service.IUserResourceService
;
import
com.cusc.nirvana.user.eiam.service.IUserService
;
import
com.cusc.nirvana.user.eiam.util.CommonParamterCheck
;
import
com.cusc.nirvana.user.util.CuscStringUtils
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* 用户资源关系(UserResource)表控制层
*
* @author yuy336
* @since 2022-01-19 13:41:03
*/
@RestController
@RequestMapping
(
"/userResource"
)
public
class
UserResourceController
{
/**
* 服务对象
*/
@Autowired
private
IUserResourceService
userResourceService
;
@Autowired
private
IUserService
userService
;
@Autowired
private
IUrlService
urlService
;
/**
* 查询数据
*
* @param bean 实体
* @return 单条数据
*/
@PostMapping
(
"/queryByList"
)
public
Response
<
List
<
UserResourceDTO
>>
queryByList
(
@RequestBody
UserResourceDTO
bean
)
{
return
Response
.
createSuccess
(
userResourceService
.
queryByList
(
bean
));
}
/**
* 新增数据
*
* @param bean 实体
* @return 新增结果
*/
@PostMapping
(
"/add"
)
public
Response
add
(
@RequestBody
UserResourceDTO
bean
)
{
return
Response
.
createSuccess
(
userResourceService
.
insert
(
bean
));
}
@PostMapping
(
"/allUserRelUrlToRedis"
)
@ApiOperation
(
value
=
"刷新所有用户的URL至缓存"
,
notes
=
"刷新所有用户的URL至缓存"
)
public
Response
allUserRelUrlToRedis
(
@RequestBody
UserResourceDTO
userResDTO
)
{
CommonParamterCheck
.
appIdAndTenantNoRequired
(
userResDTO
.
getApplicationId
(),
userResDTO
.
getTenantNo
());
//查询所有用户信息
UserDTO
user
=
new
UserDTO
();
user
.
setTenantNo
(
userResDTO
.
getTenantNo
());
List
<
UserSimpleDTO
>
userList
=
userService
.
queryListUser
(
user
);
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
for
(
UserSimpleDTO
userSimpleDTO
:
userList
)
{
urlService
.
userRelRolUrlToRedis
(
userSimpleDTO
.
getUuid
(),
userResDTO
.
getTenantNo
(),
userResDTO
.
getApplicationId
());
}
}
return
Response
.
createSuccess
();
}
/**
* 通过用户id批量新增用户资源数据
*
* @param bean 实体
* @return 新增结果
*/
@PostMapping
(
"/insertBatchResource"
)
public
Response
insertBatchResource
(
@RequestBody
UserResourceDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getUserId
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
bean
.
getApplicationId
(),
bean
.
getTenantNo
());
int
ret
=
userResourceService
.
insertBatchResource
(
bean
);
//刷新用户对应的url
urlService
.
userRelUrlToRedis
(
bean
.
getUserId
(),
bean
.
getTenantNo
(),
bean
.
getApplicationId
());
return
Response
.
createSuccess
(
ret
);
}
/**
* 根据用户id删除用户资源信息
*
* @param bean 实体
* @return 新增结果
*/
@PostMapping
(
"/deleteByUserId"
)
public
Response
deleteByUserId
(
@RequestBody
UserResourceDTO
bean
)
{
if
(
CuscStringUtils
.
isEmpty
(
bean
.
getUserId
()))
{
return
Response
.
createError
(
ResponseCode
.
USER_UUID_NOT_NULL
.
getMsg
(),
ResponseCode
.
USER_UUID_NOT_NULL
.
getCode
());
}
CommonParamterCheck
.
appIdAndTenantNoRequired
(
bean
.
getApplicationId
(),
bean
.
getTenantNo
());
return
Response
.
createSuccess
(
userResourceService
.
deleteByUserId
(
bean
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/controller/UserRoleController.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.controller
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.eiam.constants.ResponseCode
;
import
com.cusc.nirvana.user.eiam.dto.UserRoleDTO
;
import
com.cusc.nirvana.user.eiam.service.IUserRoleService
;
import
com.cusc.nirvana.user.eiam.service.IUserService
;
import
com.cusc.nirvana.user.util.CuscStringUtils
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 用户角色控制器
* </p>
*
* @author auto-generator
* @since 2021-10-20
*/
@Slf4j
@RestController
@RequestMapping
(
"/userRole"
)
public
class
UserRoleController
{
@Autowired
IUserRoleService
userRoleService
;
@Autowired
IUserService
userService
;
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"用户角色信息"
,
notes
=
"用户角色信息"
)
public
Response
add
(
@RequestBody
UserRoleDTO
entity
)
{
return
Response
.
createSuccess
(
userRoleService
.
add
(
entity
));
}
@PostMapping
(
"/addBatchUserList"
)
@ApiOperation
(
value
=
"批量新增用户角色信息"
,
notes
=
"批量新增用户角色信息"
)
public
Response
addBatchUserList
(
@RequestBody
UserRoleDTO
entity
)
{
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getUserId
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getTenantNo
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
userRoleService
.
addBatchRole
(
entity
));
}
@PostMapping
(
"/delBatchUser"
)
@ApiOperation
(
value
=
"通过用户id删除用户角色关系"
,
notes
=
"通过用户id删除用户角色关系"
)
public
Response
delBatchUser
(
@RequestBody
UserRoleDTO
entity
)
{
if
(
CuscStringUtils
.
isEmpty
(
entity
.
getUserId
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getTenantNo
())
||
CuscStringUtils
.
isEmpty
(
entity
.
getApplicationId
()))
{
return
Response
.
createError
(
ResponseCode
.
PARAMETER_NULL
.
getMsg
(),
ResponseCode
.
PARAMETER_NULL
.
getCode
());
}
return
Response
.
createSuccess
(
userRoleService
.
delBatchUser
(
entity
));
}
@PostMapping
(
"/updateByUserId"
)
public
Response
updateByUserId
(
@RequestBody
UserRoleDTO
dto
){
userRoleService
.
updateByUserId
(
dto
);
return
Response
.
createSuccess
();
}
@PostMapping
(
"/queryListByUserIdList"
)
public
Response
<
List
<
UserRoleDTO
>>
queryListByUserIdList
(
@RequestBody
UserRoleDTO
dto
){
return
Response
.
createSuccess
(
userRoleService
.
queryListByUserIdList
(
dto
));
}
/**
* 通过主键查询单条数据
*
* @param userRole 实体
* @return 单条数据
*/
@PostMapping
(
"/queryByList"
)
public
Response
<
List
<
UserRoleDTO
>>
queryByList
(
@RequestBody
UserRoleDTO
userRole
)
{
return
Response
.
createSuccess
(
this
.
userRoleService
.
queryByList
(
userRole
));
}
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/converter/ApplicationConverter.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.converter
;
import
com.cusc.nirvana.user.eiam.dao.entity.ApplicationPO
;
import
com.cusc.nirvana.user.eiam.dto.ApplicationDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
/**
* (Application)表服务接口
*
* @author yuy336
* @since 2022-01-11 17:09:08
*/
@Mapper
public
interface
ApplicationConverter
{
ApplicationConverter
INSTANCE
=
Mappers
.
getMapper
(
ApplicationConverter
.
class
);
/**
* Description: do 转 dto
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
ApplicationDTO
poToDto
(
ApplicationPO
bean
);
/**
* Description: dto 转 do
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
ApplicationPO
dtoToPo
(
ApplicationDTO
bean
);
/**
* Description: do list 转 dto list
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
List
<
ApplicationDTO
>
poListToDtoList
(
List
<
ApplicationPO
>
list
);
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/converter/DataOperationLogConverter.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.converter
;
import
com.cusc.nirvana.user.eiam.dao.entity.DataOperationLogPO
;
import
com.cusc.nirvana.user.eiam.dto.DataOperationLogDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
/**
* eiam数据操作历史(DataOperationLog)表服务接口
*
* @author yuy336
* @since 2022-01-12 15:02:10
*/
@Mapper
public
interface
DataOperationLogConverter
{
DataOperationLogConverter
INSTANCE
=
Mappers
.
getMapper
(
DataOperationLogConverter
.
class
);
/**
* Description: do 转 dto
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
DataOperationLogDTO
poToDto
(
DataOperationLogPO
bean
);
/**
* Description: dto 转 do
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
DataOperationLogPO
dtoToPo
(
DataOperationLogDTO
bean
);
/**
* Description: do list 转 dto list
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
List
<
DataOperationLogDTO
>
poListToDtoList
(
List
<
DataOperationLogPO
>
list
);
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/converter/OrganizationConverter.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.converter
;
import
com.cusc.nirvana.user.eiam.dao.entity.OrganizationPO
;
import
com.cusc.nirvana.user.eiam.dto.OrganizationDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
/**
* 组织机构(Organization)表服务接口
*
* @author yuy336
* @since 2022-01-12 14:59:30
*/
@Mapper
public
interface
OrganizationConverter
{
OrganizationConverter
INSTANCE
=
Mappers
.
getMapper
(
OrganizationConverter
.
class
);
/**
* Description: do 转 dto
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
OrganizationDTO
poToDto
(
OrganizationPO
bean
);
/**
* Description: dto 转 do
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
OrganizationPO
dtoToPo
(
OrganizationDTO
bean
);
/**
* Description: do list 转 dto list
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
List
<
OrganizationDTO
>
poListToDtoList
(
List
<
OrganizationPO
>
list
);
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/converter/ResourceConverter.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.converter
;
import
com.cusc.nirvana.user.eiam.dao.entity.ResourcePO
;
import
com.cusc.nirvana.user.eiam.dto.ResourceDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
/**
* (resource)表服务接口
*
* @author yuy336
* @since 2022-01-11 17:09:08
*/
@Mapper
public
interface
ResourceConverter
{
ResourceConverter
INSTANCE
=
Mappers
.
getMapper
(
ResourceConverter
.
class
);
/**
* Description: do 转 dto
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
ResourceDTO
poToDto
(
ResourcePO
bean
);
/**
* Description: dto 转 do
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
ResourcePO
dtoToPo
(
ResourceDTO
bean
);
/**
* Description: do list 转 dto list
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
List
<
ResourceDTO
>
poListToDtoList
(
List
<
ResourcePO
>
list
);
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/converter/ResourceTempalteConverter.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.converter
;
import
com.cusc.nirvana.user.eiam.dao.entity.ResourceTempaltePO
;
import
com.cusc.nirvana.user.eiam.dto.ResourceTempalteDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
/**
* (ResourceTempalte)表服务接口
*
* @author yuy336
* @since 2022-01-11 17:34:46
*/
@Mapper
public
interface
ResourceTempalteConverter
{
ResourceTempalteConverter
INSTANCE
=
Mappers
.
getMapper
(
ResourceTempalteConverter
.
class
);
/**
* Description: do 转 dto
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
ResourceTempalteDTO
poToDto
(
ResourceTempaltePO
bean
);
/**
* Description: dto 转 do
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
ResourceTempaltePO
dtoToPo
(
ResourceTempalteDTO
bean
);
/**
* Description: do list 转 dto list
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
List
<
ResourceTempalteDTO
>
poListToDtoList
(
List
<
ResourceTempaltePO
>
list
);
}
local-rnr-user-server/src/main/java/com/cusc/nirvana/user/eiam/converter/RoleConverter.java
0 → 100644
View file @
02be8110
package
com.cusc.nirvana.user.eiam.converter
;
import
com.cusc.nirvana.user.eiam.dao.entity.RolePO
;
import
com.cusc.nirvana.user.eiam.dto.RoleDTO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
/**
* (Role)表服务接口
*
* @author yuy336
* @since 2022-01-17 15:50:27
*/
@Mapper
public
interface
RoleConverter
{
RoleConverter
INSTANCE
=
Mappers
.
getMapper
(
RoleConverter
.
class
);
/**
* Description: do 转 dto
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
RoleDTO
poToDto
(
RolePO
bean
);
/**
* Description: dto 转 do
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
RolePO
dtoToPo
(
RoleDTO
bean
);
/**
* Description: do list 转 dto list
* <br />
* CreateDate 2021-11-18 15:21:27
*
* @author yuyi
**/
List
<
RoleDTO
>
poListToDtoList
(
List
<
RolePO
>
list
);
}
Prev
1
…
5
6
7
8
9
10
11
12
13
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment