Browse Source

修改用户信息修改接口,刷新redis权限,修复丢失root_manager的问题

版本升级
dev_shibei_match
wxz 5 years ago
parent
commit
47164c985c
  1. 2
      epmet-user/epmet-user-server/deploy/docker-compose-dev.yml
  2. 2
      epmet-user/epmet-user-server/pom.xml
  3. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  4. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  5. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  6. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  7. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

2
epmet-user/epmet-user-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-user-server:
container_name: epmet-user-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.78
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.79
ports:
- "8087:8087"
network_mode: host # 不会创建新的网络

2
epmet-user/epmet-user-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.78</version>
<version>0.3.79</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-user</artifactId>

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java

@ -98,4 +98,6 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
* @return java.util.List<com.epmet.dto.result.CustomerStaffRoleResultDTO>
*/
List<CustomerStaffRoleResultDTO> selectStaffRoles(@Param("staffId") String staffId);
List<StaffRoleEntity> listStaffRoleEntytiesByStaffIdAndOrgId(@Param("agencyId") String agencyId, @Param("staffId") String staffId);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java

@ -148,4 +148,6 @@ public interface StaffRoleService extends BaseService<StaffRoleEntity> {
* @return java.util.List<com.epmet.dto.result.CustomerStaffRoleResultDTO>
*/
List<CustomerStaffRoleResultDTO> getStaffRoles(String staffId);
List<StaffRoleEntity> getStaffRoleEntytiesByStaffIdAndOrgId(String agencyId, String staffId);
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -56,6 +56,7 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
@ -341,11 +342,18 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
staffRoleService.insert(staffRoleEntity);
});
// 重新查询用户的角色列表(可以取到前端没有传过来的角色,例如根管理员)
List<StaffRoleEntity> staffRoleEntytiesByStaffIdAndOrgId = staffRoleService.getStaffRoleEntytiesByStaffIdAndOrgId(fromDTO.getAgencyId(), fromDTO.getStaffId());
List<String> roleIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(staffRoleEntytiesByStaffIdAndOrgId)) {
roleIds = staffRoleEntytiesByStaffIdAndOrgId.stream().map(sr -> sr.getRoleId()).collect(Collectors.toList());
}
// redis缓存角色修改
UpdateCachedRolesFormDTO updateRolesForm = new UpdateCachedRolesFormDTO();
updateRolesForm.setOrgId(fromDTO.getAgencyId());
updateRolesForm.setStaffId(fromDTO.getStaffId());
updateRolesForm.setRoleIds(fromDTO.getRoles());
updateRolesForm.setRoleIds(roleIds);
try {
Result result = authFeignClient.updateCachedRoles(updateRolesForm);
if (!result.success()) {

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java

@ -19,7 +19,6 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.annotation.DataFilter;
import com.epmet.commons.mybatis.entity.DataScope;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
@ -36,9 +35,7 @@ import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.entity.StaffRoleEntity;
import com.epmet.redis.StaffRoleRedis;
import com.epmet.service.StaffRoleService;
@ -180,4 +177,9 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
return baseDao.selectStaffRoles(staffId);
}
@Override
public List<StaffRoleEntity> getStaffRoleEntytiesByStaffIdAndOrgId(String agencyId, String staffId) {
return baseDao.listStaffRoleEntytiesByStaffIdAndOrgId(agencyId, staffId);
}
}

8
epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

@ -156,4 +156,12 @@
AND gsr.del_flag = '0'
AND sr.staff_id = #{staffId}
</select>
<select id="listStaffRoleEntytiesByStaffIdAndOrgId" resultType="com.epmet.entity.StaffRoleEntity">
select *
from staff_role sr
where sr.STAFF_ID = #{staffId}
and sr.ORG_ID = #{agencyId}
and sr.DEL_FLAG='0'
</select>
</mapper>
Loading…
Cancel
Save