Browse Source

【事件】网格员服务电话

master
sunyuchao 4 years ago
parent
commit
15369acced
  1. 24
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridMobileListFormDTO.java
  2. 61
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridMobileListResultDTO.java
  3. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  4. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  5. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  6. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  7. 44
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  8. 1
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
  9. 19
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

24
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridMobileListFormDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
/**
* @description: 事件网格员服务电话
* @author: sun
*/
@NoArgsConstructor
@Data
public class GridMobileListFormDTO {
/**
* 网格Id
*/
@NotBlank(message = "网格Id不能为空", groups = Gridobile.class)
private String gridId;
public interface Gridobile{}
}

61
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridMobileListResultDTO.java

@ -0,0 +1,61 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.util.List;
/**
* @description: 事件网格员服务电话
* @author: sun
*/
@Data
public class GridMobileListResultDTO {
/**
* 网格Id
*/
private String gridId;
/**
* 工作人员Id
*/
private String staffId;
/**
* 人员名称
*/
private String staffName;
/**
* 性别
*/
private String gender;
/**
* 工作人员头像
*/
private String staffHeadPhoto;
/**
* 人员角色列表
*/
private List<Role> roleList;
@Data
public static class Role {
/**
* 工作人员Id
*/
@JsonIgnore
private String staffId;
/**
* 角色Id
*/
private String roleId;
/**
* 角色名称
*/
private String roleName;
}
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -479,5 +479,15 @@ public class CustomerStaffController {
return new Result<List<CustomerStaffDTO>>().ok(customerStaffService.getByRealNames(formDTO)); return new Result<List<CustomerStaffDTO>>().ok(customerStaffService.getByRealNames(formDTO));
} }
/**
* @Author sun
* @Description 事件网格员服务电话
**/
@PostMapping(value = "gridmobilelist")
public Result<List<GridMobileListResultDTO>> gridMobileList(@RequestBody GridMobileListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GridMobileListFormDTO.Gridobile.class);
return new Result<List<GridMobileListResultDTO>>().ok(customerStaffService.gridMobileList(formDTO.getGridId()));
}
} }

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -221,4 +221,10 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Description 根据工作人员姓名批量查询基础信息数据 * @Description 根据工作人员姓名批量查询基础信息数据
**/ **/
List<CustomerStaffDTO> getByRealNames(GetByRealNamesFormDTO formDTO); List<CustomerStaffDTO> getByRealNames(GetByRealNamesFormDTO formDTO);
/**
* @Author sun
* @Description 工作人员基本信息
**/
List<GridMobileListResultDTO> gridStaffMobileList(List<String> staffIdList);
} }

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

@ -163,4 +163,10 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
* @date 2021/8/19 11:16 上午 * @date 2021/8/19 11:16 上午
*/ */
Set<String> selectRoleStaffIds(@Param("customerId") String customerId,@Param("roleIds") Set<String> roleIds); Set<String> selectRoleStaffIds(@Param("customerId") String customerId,@Param("roleIds") Set<String> roleIds);
/**
* @Author sun
* @Description 事件网格员服务电话
**/
List<GridMobileListResultDTO.Role> staffRoleList(@Param("staffIds") List<String> staffIds);
} }

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -341,4 +341,10 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @Description 根据工作人员姓名批量查询基础信息数据 * @Description 根据工作人员姓名批量查询基础信息数据
**/ **/
List<CustomerStaffDTO> getByRealNames(GetByRealNamesFormDTO formDTO); List<CustomerStaffDTO> getByRealNames(GetByRealNamesFormDTO formDTO);
/**
* @Author sun
* @Description 事件网格员服务电话
**/
List<GridMobileListResultDTO> gridMobileList(String gridId);
} }

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

@ -799,4 +799,48 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return baseDao.getByRealNames(formDTO); return baseDao.getByRealNames(formDTO);
} }
/**
* @Author sun
* @Description 事件网格员服务电话
**/
@Override
public List<GridMobileListResultDTO> gridMobileList(String gridId) {
List<GridMobileListResultDTO> resultList = new ArrayList<>();
//1.查询网格下工作人员列表
CommonGridIdFormDTO dto = new CommonGridIdFormDTO();
dto.setGridId(gridId);
Result<List<String>> gridStaffs = govOrgOpenFeignClient.getGridStaffs(dto);
if (!gridStaffs.success()) {
throw new RenException("获取网格下工作人员列表失败!");
}
if (gridStaffs.getData().size() < NumConstant.ONE) {
return resultList;
}
//2.查询工作人员中拥有网格长网格员角色的人员列表
List<GridMobileListResultDTO.Role> staffRoleList = staffRoleDao.staffRoleList(gridStaffs.getData());
//3.查询工作人员基础信息
List<String> staffIdList = staffRoleList.stream().map(GridMobileListResultDTO.Role::getStaffId).collect(Collectors.toList());
staffIdList = staffIdList.stream().distinct().collect(Collectors.toList());
List<StaffListResultDTO> list = baseDao.selectStaffByIds(staffIdList);
//4.封装数据并返回
resultList = ConvertUtils.sourceToTarget(list, GridMobileListResultDTO.class);
List<GridMobileListResultDTO.Role> roleList = null;
for (GridMobileListResultDTO re : resultList) {
roleList = new ArrayList<>();
for (GridMobileListResultDTO.Role r : staffRoleList) {
if (re.getStaffId().equals(r.getStaffId())) {
GridMobileListResultDTO.Role role = ConvertUtils.sourceToTarget(r, GridMobileListResultDTO.Role.class);
roleList.add(role);
}
}
re.setGridId(gridId);
re.setRoleList(roleList);
}
return resultList;
}
} }

1
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -451,5 +451,6 @@
#{name} #{name}
</foreach> </foreach>
</select> </select>
<select id="gridStaffMobileList" resultType="com.epmet.dto.result.GridMobileListResultDTO"></select>
</mapper> </mapper>

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

@ -253,4 +253,23 @@
</foreach> </foreach>
</if> </if>
</select> </select>
<select id="staffRoleList" resultType="com.epmet.dto.result.GridMobileListResultDTO$Role">
SELECT
sr.staff_id staffId,
sr.role_id roleId,
gsr.role_name roleName
FROM
staff_role sr
INNER JOIN gov_staff_role gsr ON sr.role_id = gsr.id
WHERE
sr.del_flag = '0'
AND gsr.del_flag = '0'
AND gsr.role_key IN('grid_manager','grid_member')
<foreach collection="staffIds" item="staffId" open="AND sr.staff_id IN (" separator="," close=")">
#{staffId}
</foreach>
ORDER BY sr.staff_id, gsr.role_key
</select>
</mapper> </mapper>

Loading…
Cancel
Save