Browse Source

更新回显待会租户角色名称

tags/v2.4.1
xiaoying 1 year ago
parent
commit
e0142666fe
9 changed files with 34 additions and 25 deletions
  1. +1
    -1
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/entity/TenantEmploy.java
  2. +4
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/ClientRoleDto.java
  3. +0
    -1
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/CreateClientTenantDto.java
  4. +2
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/po/ClientUserRolePo.java
  5. +19
    -15
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java
  6. +4
    -4
      tuoheng_oidc_admin/src/main/resources/mapper/ClientUserRoleMapper.xml
  7. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/model/param/ClientRoleDto.class
  8. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/model/param/CreateClientTenantDto.class
  9. +4
    -4
      tuoheng_oidc_admin/target/classes/mapper/ClientUserRoleMapper.xml

+ 1
- 1
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/entity/TenantEmploy.java View File

/** /**
* *
*/ */
@TableId(type = IdType.AUTO)
@TableId(type = IdType.ASSIGN_ID)
private Long id; private Long id;


/** /**

+ 4
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/ClientRoleDto.java View File

* 识别详情 * 识别详情
*/ */
private String description; private String description;
/**
* 角色名
*/
private String roleName;
} }

+ 0
- 1
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/CreateClientTenantDto.java View File

@NotEmpty(message = "username can not be empty!") @NotEmpty(message = "username can not be empty!")
private String username; private String username;


@NotEmpty(message = "password can not be empty!")
private String password; private String password;


private String remark; private String remark;

+ 2
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/po/ClientUserRolePo.java View File



private Integer status; private Integer status;


private String roleName;

} }

+ 19
- 15
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java View File

if (clientUserMapper.judgeCreateByUserName(createClientTenantDto.getUsername()) > 0) { if (clientUserMapper.judgeCreateByUserName(createClientTenantDto.getUsername()) > 0) {
return JsonResult.error("该用户名称已存在!"); return JsonResult.error("该用户名称已存在!");
} }
createClientTenantDto.setPassword(passward);
//创建租户创建成功后的返回实体类 //创建租户创建成功后的返回实体类
CreateTenantVo vo = new CreateTenantVo(); CreateTenantVo vo = new CreateTenantVo();
vo.setPassword(passward);
vo.setPassword(createClientTenantDto.getPassword());
vo.setTenantName(createClientTenantDto.getTenantName()); vo.setTenantName(createClientTenantDto.getTenantName());
vo.setUsername(createClientTenantDto.getUsername()); vo.setUsername(createClientTenantDto.getUsername());
//code复用username //code复用username
createClientTenantDto.setTenantCode(createClientTenantDto.getTenantName());
createClientTenantDto.setTenantCode(createClientTenantDto.getUsername());
//用户表 //用户表
UserPo userPo = new UserPo() UserPo userPo = new UserPo()
.setIsTenant(1) .setIsTenant(1)
ClientUserRolePo clientUserRolePo = new ClientUserRolePo() ClientUserRolePo clientUserRolePo = new ClientUserRolePo()
.setUserId(userPo.getId()) .setUserId(userPo.getId())
.setClientId(clientRoleDto.getClientId()) .setClientId(clientRoleDto.getClientId())
.setRoleId(clientRoleDto.getRoleId());
.setRoleId(clientRoleDto.getRoleId())
.setRoleName(clientRoleDto.getRoleName());
clientUserRolePo.setCreateUser(loginUser.getUserId()); clientUserRolePo.setCreateUser(loginUser.getUserId());
clientUserRolePoArrayList.add(clientUserRolePo); clientUserRolePoArrayList.add(clientUserRolePo);
} }
switch (dto.getClientId()) { switch (dto.getClientId()) {
//暂时河湖长,动态匹配其他平台 //暂时河湖长,动态匹配其他平台
case HhzUrlConstant.HHZ_CLIENT: case HhzUrlConstant.HHZ_CLIENT:
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_MP, dto.getRoleId(), clientRoleDtoList);
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_ADMIN, dto.getRoleId(), clientRoleDtoList);
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_MP, dto, clientRoleDtoList);
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_ADMIN,dto, clientRoleDtoList);
break; break;
case PilotConstant.PILOT_CLIENT: case PilotConstant.PILOT_CLIENT:
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_ADMIN, dto.getRoleId(), clientRoleDtoList);
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_MP, dto.getRoleId(), clientRoleDtoList);
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_ADMIN, dto, clientRoleDtoList);
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_MP, dto, clientRoleDtoList);
break; break;
////暂时河湖长,动态匹配其他平台 ////暂时河湖长,动态匹配其他平台
//case HhzUrlConstant.HHZ_CLIENT: //case HhzUrlConstant.HHZ_CLIENT:
* 封装数据到 clientRoleDtoList * 封装数据到 clientRoleDtoList
* *
* @param clientId * @param clientId
* @param roleId
* @param dto
* @param clientRoleDtoList * @param clientRoleDtoList
*/ */
private void addClientRoleDtoList(String clientId, Integer roleId, List<ClientRoleDto> clientRoleDtoList) {
private void addClientRoleDtoList(String clientId, ClientRoleDto dto, List<ClientRoleDto> clientRoleDtoList) {
ClientRoleDto clientRoleDto = new ClientRoleDto(); ClientRoleDto clientRoleDto = new ClientRoleDto();
clientRoleDto.setClientId(clientId); clientRoleDto.setClientId(clientId);
clientRoleDto.setRoleId(roleId);
clientRoleDto.setRoleId(dto.getRoleId());
clientRoleDto.setRoleName(dto.getRoleName());
clientRoleDtoList.add(clientRoleDto); clientRoleDtoList.add(clientRoleDto);
} }


List<BusinessSystemVo> businessSystemVoList = new ArrayList<>(); List<BusinessSystemVo> businessSystemVoList = new ArrayList<>();
for (AuthoritiesPo authoritiesPo : list) { for (AuthoritiesPo authoritiesPo : list) {
//TODO 后期维护各个业务平台 //TODO 后期维护各个业务平台
if (authoritiesPo.getAuthority().contains("hhz")) {
if (authoritiesPo.getAuthority().contains(HhzUrlConstant.HHZ_CLIENT)) {
businessSystemVoList.add(getbusinessSystemVo(HhzUrlConstant.HHZ_CLIENT, HhzUrlConstant.HHZ_NAME)); businessSystemVoList.add(getbusinessSystemVo(HhzUrlConstant.HHZ_CLIENT, HhzUrlConstant.HHZ_NAME));
} else if (authoritiesPo.getAuthority().contains("airport")) {
} else if (authoritiesPo.getAuthority().contains(AirportConstant.AIRPORT_CLIENT)) {
businessSystemVoList.add(getbusinessSystemVo(AirportConstant.AIRPORT_CLIENT, AirportConstant.AIRPORT_NAME)); businessSystemVoList.add(getbusinessSystemVo(AirportConstant.AIRPORT_CLIENT, AirportConstant.AIRPORT_NAME));
} else if (authoritiesPo.getAuthority().contains("waterway")) {
} else if (authoritiesPo.getAuthority().contains(WaterWayConstant.WATERWAY_CLIENT)) {
businessSystemVoList.add(getbusinessSystemVo(WaterWayConstant.WATERWAY_CLIENT, WaterWayConstant.WATERWAY_NAME)); businessSystemVoList.add(getbusinessSystemVo(WaterWayConstant.WATERWAY_CLIENT, WaterWayConstant.WATERWAY_NAME));
} else if (authoritiesPo.getAuthority().contains("freeway")) {
} else if (authoritiesPo.getAuthority().contains(FreeWayConstant.FREEWAY_CLIENT)) {
businessSystemVoList.add(getbusinessSystemVo(FreeWayConstant.FREEWAY_CLIENT, FreeWayConstant.FREEWAY_NAME)); businessSystemVoList.add(getbusinessSystemVo(FreeWayConstant.FREEWAY_CLIENT, FreeWayConstant.FREEWAY_NAME));
} else if (authoritiesPo.getAuthority().contains("pilot")) {
} else if (authoritiesPo.getAuthority().contains(PilotConstant.PILOT_CLIENT)) {
businessSystemVoList.add(getbusinessSystemVo(PilotConstant.PILOT_CLIENT, PilotConstant.PILOT_NAME)); businessSystemVoList.add(getbusinessSystemVo(PilotConstant.PILOT_CLIENT, PilotConstant.PILOT_NAME));
} }
} }
clientRoleDto = new ClientRoleDto(); clientRoleDto = new ClientRoleDto();
//此处 暂时格式都为 tuoheng-hhz-web 等格式 如后续维护需要变更形式则此处代码需要更改 //此处 暂时格式都为 tuoheng-hhz-web 等格式 如后续维护需要变更形式则此处代码需要更改
clientRoleDto.setRoleId(clientUserRolePo.getRoleId()); clientRoleDto.setRoleId(clientUserRolePo.getRoleId());
clientRoleDto.setRoleName(clientUserRolePo.getRoleName());
clientRoleDto.setClientId(clientUserRolePo.getClientId().substring(CommonConstant.ZERO, clientUserRolePo.getClientId().lastIndexOf(CommonConstant.BARS))); clientRoleDto.setClientId(clientUserRolePo.getClientId().substring(CommonConstant.ZERO, clientUserRolePo.getClientId().lastIndexOf(CommonConstant.BARS)));
TenantEmploy tenantEmploy = tenantEmployMapper.selectOne(Wrappers.<TenantEmploy>lambdaQuery() TenantEmploy tenantEmploy = tenantEmployMapper.selectOne(Wrappers.<TenantEmploy>lambdaQuery()
.eq(TenantEmploy::getTenantId, tenantId) .eq(TenantEmploy::getTenantId, tenantId)

+ 4
- 4
tuoheng_oidc_admin/src/main/resources/mapper/ClientUserRoleMapper.xml View File

<mapper namespace="com.tuoheng.mapper.ClientUserRoleMapper"> <mapper namespace="com.tuoheng.mapper.ClientUserRoleMapper">


<insert id="batchInsert" parameterType="java.util.List"> <insert id="batchInsert" parameterType="java.util.List">
insert into t_client_user_role (user_id, client_id, role_id, create_user)
insert into t_client_user_role (user_id, client_id, role_id, create_user,role_name)
VALUES VALUES
<foreach collection="list" item="it" separator=","> <foreach collection="list" item="it" separator=",">
(#{it.userId}, #{it.clientId}, #{it.roleId}, #{it.createUser})
(#{it.userId}, #{it.clientId}, #{it.roleId}, #{it.createUser},#{it.roleName})
</foreach> </foreach>
</insert> </insert>


<insert id="insert" parameterType="com.tuoheng.model.po.ClientUserRolePo"> <insert id="insert" parameterType="com.tuoheng.model.po.ClientUserRolePo">
insert into t_client_user_role (user_id, client_id, role_id, create_user)
VALUES (#{userId}, #{clientId}, #{roleId}, #{createUser})
insert into t_client_user_role (user_id, client_id, role_id, create_user, role_name)
VALUES (#{userId}, #{clientId}, #{roleId}, #{createUser}, #{it.roleName})
</insert> </insert>


<update id="updateUserClientRole" parameterType="com.tuoheng.model.po.ClientUserRolePo"> <update id="updateUserClientRole" parameterType="com.tuoheng.model.po.ClientUserRolePo">

BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/model/param/ClientRoleDto.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/model/param/CreateClientTenantDto.class View File


+ 4
- 4
tuoheng_oidc_admin/target/classes/mapper/ClientUserRoleMapper.xml View File

<mapper namespace="com.tuoheng.mapper.ClientUserRoleMapper"> <mapper namespace="com.tuoheng.mapper.ClientUserRoleMapper">


<insert id="batchInsert" parameterType="java.util.List"> <insert id="batchInsert" parameterType="java.util.List">
insert into t_client_user_role (user_id, client_id, role_id, create_user)
insert into t_client_user_role (user_id, client_id, role_id, create_user,role_name)
VALUES VALUES
<foreach collection="list" item="it" separator=","> <foreach collection="list" item="it" separator=",">
(#{it.userId}, #{it.clientId}, #{it.roleId}, #{it.createUser})
(#{it.userId}, #{it.clientId}, #{it.roleId}, #{it.createUser},#{it.roleName})
</foreach> </foreach>
</insert> </insert>


<insert id="insert" parameterType="com.tuoheng.model.po.ClientUserRolePo"> <insert id="insert" parameterType="com.tuoheng.model.po.ClientUserRolePo">
insert into t_client_user_role (user_id, client_id, role_id, create_user)
VALUES (#{userId}, #{clientId}, #{roleId}, #{createUser})
insert into t_client_user_role (user_id, client_id, role_id, create_user, role_name)
VALUES (#{userId}, #{clientId}, #{roleId}, #{createUser}, #{it.roleName})
</insert> </insert>


<update id="updateUserClientRole" parameterType="com.tuoheng.model.po.ClientUserRolePo"> <update id="updateUserClientRole" parameterType="com.tuoheng.model.po.ClientUserRolePo">

Loading…
Cancel
Save