Browse Source

【通讯录】姓名检索工作人员

dev_shibei_match
sunyuchao 4 years ago
parent
commit
7fa8bbfd1b
  1. 6
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ListStaffFormDTO.java
  2. 19
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java
  3. 45
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgNameResultDTO.java
  4. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  5. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  6. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java
  7. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
  8. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  9. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  10. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  11. 19
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  12. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml
  13. 85
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

6
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ListStaffFormDTO.java

@ -15,10 +15,14 @@ public class ListStaffFormDTO implements Serializable {
private static final long serialVersionUID = -3381286960911634231L; private static final long serialVersionUID = -3381286960911634231L;
/** /**
* 客户Id * 待检索姓名
*/ */
@NotBlank(message = "姓名不能为空", groups = ListStaffFormDTO.Staff.class) @NotBlank(message = "姓名不能为空", groups = ListStaffFormDTO.Staff.class)
private String realName; private String realName;
/**
* token中客户Id
*/
private String customerId;
public interface Staff extends CustomerClientShowGroup {} public interface Staff extends CustomerClientShowGroup {}
} }

19
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java

@ -3,9 +3,10 @@ package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* @Description 对外接口--通讯录姓名检索工作人员-接口返参 * @Description 通讯录姓名检索工作人员-接口返参
* @Auth sun * @Auth sun
*/ */
@Data @Data
@ -15,14 +16,16 @@ public class ListStaffResultDTO implements Serializable {
//工作人员用户id //工作人员用户id
private String staffId = ""; private String staffId = "";
//工作人员姓名 //工作人员姓名
private String staffName = ""; private String name = "";
//性别
private String gender = "";
//头像
private String headPhoto = "";
//手机号 //手机号
private String mobile = ""; private String mobile = "";
//用户所属组织id //人员新增所属组织名【组织-组织,组织-部门,组织-网格】
private String agencyId = ""; private String orgName = "";
//用户所属组织全路径名称 //职责名称列表
private String agencyAllName = ""; private List<String> roles;
//客户Id
private String customerId = "";
} }

45
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgNameResultDTO.java

@ -0,0 +1,45 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.dto.govorg.result;
import lombok.Data;
import java.io.Serializable;
/**
* 查询工作人员注册组织信息
* @author sun
*/
@Data
public class StaffOrgNameResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
//工作人员所属组织Id
private String agencyId = "";
//人员Id
private String staffId = "";
//人员注册时所属组织名【组织-组织,组织-部门,组织-网格】
private String orgName = "";
//工作人员添加入口Id(agencyId;deptId;gridId)
private String orgId = "";
//工作人员添加入口类型(组织:agency;部门:dept;网格:gridId)
private String orgname = "";
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -211,7 +211,7 @@ public class EpmetUserController {
@PostMapping("stafflistbyrealname") @PostMapping("stafflistbyrealname")
public Result<List<ListStaffResultDTO>> staffListByRealName(@LoginUser TokenDto tokenDto, @RequestBody ListStaffFormDTO formDTO) { public Result<List<ListStaffResultDTO>> staffListByRealName(@LoginUser TokenDto tokenDto, @RequestBody ListStaffFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ListStaffFormDTO.Staff.class); ValidatorUtils.validateEntity(formDTO, ListStaffFormDTO.Staff.class);
//formDTO.setCustomerId(formDTO.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<List<ListStaffResultDTO>>().ok(epmetUserService.listStaff(formDTO)); return new Result<List<ListStaffResultDTO>>().ok(epmetUserService.listStaff(formDTO));
} }

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java

@ -19,6 +19,7 @@ package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO;
import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO;
import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -44,4 +45,10 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @author sun * @author sun
*/ */
List<CustomerStaffDTO> selectByStaffIds(@Param("staffIds") List<String> staffIds, @Param("realName") String realName); List<CustomerStaffDTO> selectByStaffIds(@Param("staffIds") List<String> staffIds, @Param("realName") String realName);
/**
* @Description 模糊查询用户角色信息
* @author sun
*/
List<ListStaffResultDTO> selectByRealName(@Param("customerId") String customerId, @Param("realName") String realName);
} }

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java

@ -48,4 +48,10 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
**/ **/
List<StaffRoleListResultDTO> selectStaffRoleList(@Param("customerId") String customerId, @Param("staffId") String staffId); List<StaffRoleListResultDTO> selectStaffRoleList(@Param("customerId") String customerId, @Param("staffId") String staffId);
/**
* @Description 查询工作人员拥有的角色名称列表
* @Author sun
**/
List<String> selectByStaffId(@Param("staffId") String staffId);
} }

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java

@ -20,6 +20,7 @@ package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO; import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO; import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -59,4 +60,10 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Description 递归查询当前组织的直属下级组织列表 * @Description 递归查询当前组织的直属下级组织列表
**/ **/
List<StaffAgencyGridListResultDTO> selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids); List<StaffAgencyGridListResultDTO> selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids);
/**
* @Description 批量查询工作人员注册组织信息
* @author sun
*/
List<StaffOrgNameResultDTO> selelctStaffOrg(@Param("staffIdList") List<String> staffIdList);
} }

18
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -16,6 +16,7 @@ import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO;
import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity;
import com.epmet.dataaggre.entity.epmetuser.ResiUserBadgeEntity; import com.epmet.dataaggre.entity.epmetuser.ResiUserBadgeEntity;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
@ -426,15 +427,28 @@ public class EpmetUserServiceImpl implements EpmetUserService {
/** /**
* @Param formDTO * @Param formDTO
* @Description 通讯录姓名检索工作人员 * @Description 通讯录姓名检索工作人员
* @author sun * @author sun
*/ */
@Override @Override
public List<ListStaffResultDTO> listStaff(ListStaffFormDTO formDTO) { public List<ListStaffResultDTO> listStaff(ListStaffFormDTO formDTO) {
//1.模糊查询用户、角色信息
List<ListStaffResultDTO> resultList = customerStaffDao.selectByRealName(formDTO.getCustomerId(), formDTO.getRealName());
if (null == resultList || resultList.size() < NumConstant.ONE) {
return new ArrayList<>();
}
return null; //2.查询用户注册组织信息
List<String> staffIdList = resultList.stream().map(ListStaffResultDTO::getStaffId).collect(Collectors.toList());
List<StaffOrgNameResultDTO> orgList = govOrgService.getStaffOrgName(staffIdList);
//3.封装数据并返回
resultList.forEach(re -> orgList.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> re.setOrgName(s.getOrgName())));
return resultList;
} }
/** /**
* 根据角色查询人员列表 * 根据角色查询人员列表
* *

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -103,4 +103,11 @@ public interface GovOrgService {
* @Date 2021/8/19 15:12 * @Date 2021/8/19 15:12
*/ */
SubOrgResultDTO getSubOrg(SubOrgFormDTO formDTO); SubOrgResultDTO getSubOrg(SubOrgFormDTO formDTO);
/**
* @Description 批量查询工作人员注册组织信息
* @author sun
*/
List<StaffOrgNameResultDTO> getStaffOrgName(List<String> staffIdList);
} }

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -405,4 +405,14 @@ public class GovOrgServiceImpl implements GovOrgService {
return null; return null;
} }
/**
* @Description 批量查询工作人员注册组织信息
* @author sun
*/
@Override
public List<StaffOrgNameResultDTO> getStaffOrgName(List<String> staffIdList) {
List<StaffOrgNameResultDTO> resultList = customerAgencyDao.selelctStaffOrg(staffIdList);
return resultList;
}
} }

19
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml

@ -31,4 +31,23 @@
</if> </if>
</select> </select>
<resultMap id="staffList" type="com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO">
<result property="staffId" column="user_id"/>
<result property="name" column="real_name"/>
<result property="gender" column="gender"/>
<result property="headPhoto" column="head_photo"/>
<result property="mobile" column="mobile"/>
<association property="roles" column="user_id" select="com.epmet.dataaggre.dao.epmetuser.StaffRoleDao.selectByStaffId"/>
</resultMap>
<select id="selectByRealName" resultMap="staffList">
SELECT
*
FROM
customer_staff
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND real_name LIKE CONCAT('%', #{realName}, '%')
</select>
</mapper> </mapper>

12
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml

@ -46,4 +46,16 @@
</if> </if>
</select> </select>
<select id="selectByStaffId" resultType="java.lang.String">
SELECT
gsr.role_name
FROM
staff_role sr
INNER JOIN gov_staff_role gsr ON sr.role_id = gsr.id
WHERE
sr.staff_id = #{staffId}
ORDER BY
gsr.sort ASC
</select>
</mapper> </mapper>

85
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

@ -62,4 +62,89 @@
created_time DESC created_time DESC
</select> </select>
<select id="selelctStaffOrg" resultType="com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO">
SELECT
ca.id agencyId,
sor.staff_id staffId,
IF(
ca.pid = '0',
ca.organization_name,
CONCAT(
(select organization_name from customer_agency where id = ca.pid),
'-',
ca.organization_name
)
)orgName,
sor.org_id orgId,
'agency' orgname
FROM
staff_org_relation sor
INNER JOIN customer_agency ca ON sor.org_id = ca.id
WHERE
sor.org_type = 'agency'
<if test="staffIdList != null and staffIdList.size() > 0">
sor.staff_id IN (
<foreach collection="staffIdList" item="staffId" separator=",">
#{staffId}
</foreach>
)
</if>
UNION
SELECT
ca.ID agencyId,
sor.staff_id staffId,
IF(
ca.pid = '0',
cd.department_name,
CONCAT(
ca.organization_name,
'-',
cd.department_name
)
)orgName,
sor.org_id orgId,
'dept' orgname
FROM
staff_org_relation sor
INNER JOIN customer_department cd ON sor.org_id = cd.id
INNER JOIN customer_agency ca ON cd.agency_id = ca.id
WHERE
sor.org_type = 'dept'
<if test="staffIdList != null and staffIdList.size() > 0">
sor.staff_id IN (
<foreach collection="staffIdList" item="staffId" separator=",">
#{staffId}
</foreach>
)
</if>
UNION
SELECT
ca.ID agencyId,
sor.staff_id staffId,
IF(
ca.pid = '0',
cg.grid_name,
CONCAT(
ca.organization_name,
'-',
cg.grid_name
)
)orgName,
sor.org_id orgId,
'grid' orgname
FROM
staff_org_relation sor
INNER JOIN customer_grid cg ON sor.org_id = cg.id
INNER JOIN customer_agency ca ON cg.pid = ca.id
WHERE
sor.org_type = 'grid'
<if test="staffIdList != null and staffIdList.size() > 0">
sor.staff_id IN (
<foreach collection="staffIdList" item="staffId" separator=",">
#{staffId}
</foreach>
)
</if>
</select>
</mapper> </mapper>
Loading…
Cancel
Save