Browse Source

Merge branch 'dev_oper_role' into develop

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
d8cffc1be0
  1. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java
  2. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java
  3. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java
  4. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java
  5. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java
  6. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  7. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java
  8. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java

@ -31,4 +31,6 @@ public class RoleInfoResultDTO implements Serializable{
private Boolean fullTimeOnly = false;
private String roleKey;
private String description;
}

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
@ -37,4 +38,6 @@ public class StaffInfoResultDTO implements Serializable {
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String roleName;
List<String> roles;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java

@ -30,4 +30,6 @@ public class StaffRoleResultDTO implements Serializable {
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Boolean selected;
private String description;
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java

@ -47,6 +47,14 @@ public interface GovStaffRoleDao extends BaseDao<GovStaffRoleEntity> {
*/
List<GovStaffRoleEntity> listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId);
/**
* 根据staffId查询具有的角色列表
* @param staffId
* @param orgId
* @return
*/
List<GovStaffRoleEntity> getStaffRoles(@Param("staffIds") List<String> staffId, @Param("orgId") String orgId);
/**
* 获取客户机关角色列表
* @param params

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

@ -105,6 +105,16 @@ public interface GovStaffRoleService extends BaseService<GovStaffRoleEntity> {
*/
List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId);
/**
* 查询用户角色
* @author zhaoqifeng
* @date 2021/7/1 15:30
* @param staffIds
* @param orgId
* @return java.util.Map<java.lang.String,java.util.List<java.lang.String>>
*/
Map<String, List<String>> getStaffRoles(List<String> staffIds, String orgId);
/**
* 获取当前机关下的角色列表
* @param dto

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

@ -226,6 +226,12 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
if (null == list) {
list = new ArrayList<>();
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
Map<String, List<String>> map = govStaffRoleService.getStaffRoles(fromDTO.getStaffList(), fromDTO.getAgencyId());
list.forEach(item -> {
item.setRoles(map.get(item.getStaffId()));
});
}
return new Result<List<StaffInfoResultDTO>>().ok(list);
}
@ -245,6 +251,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
staffRoleResultDTO.setRoleId(p.getId());
staffRoleResultDTO.setRoleName(p.getRoleName());
staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly());
staffRoleResultDTO.setDescription(p.getDescription());
return staffRoleResultDTO;
}).collect(Collectors.toList());
return new Result<List<RoleInfoResultDTO>>().ok(staffRoleList);
@ -277,6 +284,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
staffRoleResultDTO.setRoleId(p.getId());
staffRoleResultDTO.setRoleName(p.getRoleName());
staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly());
staffRoleResultDTO.setDescription(p.getDescription());
staffRoleResultDTO.setSelected(false);
return staffRoleResultDTO;
}).collect(Collectors.toList());

19
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java

@ -45,6 +45,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 政府端角色表
@ -134,6 +137,22 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
return baseDao.listRolesByStaffId(staffId, orgId);
}
/**
* 查询用户角色
*
* @param staffIds
* @param orgId
* @return java.util.Map<java.lang.String, java.util.List < java.lang.String>>
* @author zhaoqifeng
* @date 2021/7/1 15:30
*/
@Override
public Map<String, List<String>> getStaffRoles(List<String> staffIds, String orgId) {
List<GovStaffRoleEntity> staffRoleList = baseDao.getStaffRoles(staffIds, orgId);
return staffRoleList.stream().collect(Collectors.groupingBy(GovStaffRoleEntity::getCustomerId,
Collectors.mapping(GovStaffRoleEntity :: getId, Collectors.toList())));
}
@Override
public List<GovStaffRoleDTO> getGovStaffRoleList(GovStaffRoleDTO dto) {
return baseDao.selectGovStaffRoleList(dto);

17
epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

@ -138,6 +138,23 @@
</foreach>
)
</select>
<select id="getStaffRoles" resultType="com.epmet.entity.GovStaffRoleEntity">
SELECT
sr.STAFF_ID AS customerId,
r.ID,
r.ROLE_KEY,
r.ROLE_NAME
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID ) AND r.DEL_FLAG = '0'
WHERE
sr.DEL_FLAG = '0'
AND sr.ORG_ID = #{orgId}
<foreach collection="staffIds" item="staffId" open="AND ( " separator=" OR " close=" ) ">
sr.STAFF_ID = #{staffId}
</foreach>
ORDER BY r.SORT asc
</select>
<update id="upNameOrDescription">
UPDATE gov_staff_role

Loading…
Cancel
Save