Browse Source

Merge remote-tracking branch 'origin/dev_govorg' into dev_govorg

dev_shibei_match
sunyuchao 5 years ago
parent
commit
da805fc845
  1. 34
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java
  2. 68
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java
  3. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
  4. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  5. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  6. 23
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  7. 24
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
  8. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  9. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  10. 30
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  11. 22
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java
  12. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  13. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  14. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  15. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java
  16. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  17. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java
  18. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  19. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java
  20. 18
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
  21. 13
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

34
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java

@ -0,0 +1,34 @@
package com.epmet.dto;
import lombok.Data;
/**
* @Auther zxc
* @Create 2020-04-23 10:38
*/
@Data
public class StaffGridListDTO {
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
private String staffId;
/**
* 用户姓名
*/
private String staffName;
/**
* 用户头像
*/
private String staffHeadPhoto;
/**
* 角色名称
*/
private String roleName;
}

68
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java

@ -0,0 +1,68 @@
package com.epmet.dto.result;
import com.epmet.dto.StaffGridListDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Auther zxc
* @Create 2020-04-23 10:28
*/
@Data
public class GridDetailResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 网格id
*/
private String grid;
/**
* 网格名称
*/
private String gridName;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置维度
*/
private String latitude;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 管辖区域
*/
private String manageDistrict;
/**
* 当前网格总人数
*/
private Integer totalUser;
/**
* 所属组织机构IDcustomer_agencys.id
*/
private String agencyId;
/**
* 所有上级组织ID
*/
private String pIds;
/**
* 网格用户信息集合
*/
private List<StaffGridListDTO> staffGridList;
}

36
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java

@ -0,0 +1,36 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.result.GridDetailResultDTO;
import com.epmet.service.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Auther zxc
* @Create 2020-04-23 9:50
*/
@RestController
@RequestMapping("grid")
public class GridController {
@Autowired
private CustomerGridService customerGridService;
@PostMapping("griddetail")
public Result<GridDetailResultDTO> griddetail(@RequestBody CustomerGridFormDTO customerGridFormDTO){
Result<GridDetailResultDTO> griddetail = customerGridService.griddetail(customerGridFormDTO);
return griddetail;
}
/*@PostMapping("addgrid")
@PostMapping("editgrid")
@PostMapping("deletegrid")*/
}

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -19,10 +19,12 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.GridDetailResultDTO;
import com.epmet.entity.CustomerGridEntity; import com.epmet.entity.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -69,4 +71,19 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Author sun * @Author sun
*/ */
List<CustomerGridByUserIdResultDTO> getMyGrids(String userId); List<CustomerGridByUserIdResultDTO> getMyGrids(String userId);
/**
* 根据gridId获取网格详情
* @param customerGridFormDTO
* @return
*/
GridDetailResultDTO griddetail(CustomerGridFormDTO customerGridFormDTO);
/**
* 根据gridId查询uerId
* @param customerGridFormDTO
* @return
*/
List<CustomerStaffGridDTO> selectUserIdByGridId(CustomerGridFormDTO customerGridFormDTO);
} }

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -3,18 +3,21 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/** /**
* @author zhaoqifeng * @author zhaoqifeng
* @dscription * @dscription
* @date 2020/3/19 9:32 * @date 2020/3/19 9:32
*/ */
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class)
public interface EpmetUserFeignClient { public interface EpmetUserFeignClient {
/** /**
* 根据用户ID获取工作人员基本信息 * 根据用户ID获取工作人员基本信息
@ -27,4 +30,7 @@ public interface EpmetUserFeignClient {
@PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid") @PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid")
Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO);
@PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid")
Result<List<StaffGridListDTO>> getStaffGridList(@RequestBody List<CustomerStaffGridDTO> customerStaffGridDTOS);
} }

23
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -0,0 +1,23 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Auther zxc
* @Create 2020-04-23 14:10
*/
@Component
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
@Override
public Result<List<StaffGridListDTO>> getStaffGridList(List<CustomerStaffGridDTO> customerStaffGridDTOS) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS);
}
}

24
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java

@ -4,20 +4,26 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.OperUserDTO; import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
/** /**
* 用户模块 * @Auther zxc
* @author zhaoqifeng * @Create 2020-04-23 14:10
* @date 2020/3/19 9:34
*/ */
@Component @Component
public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
@Override
public Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO);
}
@Override @Override
public Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { public Result<List<StaffGridListDTO>> getStaffGridList(List<CustomerStaffGridDTO> customerStaffGridDTOS) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerStaffInfoByUserId", formDTO); return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS);
} }
} }

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -25,6 +25,7 @@ import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.GridDetailResultDTO;
import com.epmet.entity.CustomerGridEntity; import com.epmet.entity.CustomerGridEntity;
import java.util.List; import java.util.List;
@ -122,4 +123,11 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @Author sun * @Author sun
*/ */
Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(String userId); Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(String userId);
/**
* 根据gridId获取网格详情
* @param customerGridFormDTO
* @return
*/
Result<GridDetailResultDTO> griddetail(CustomerGridFormDTO customerGridFormDTO);
} }

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -26,11 +26,15 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerGridDao; import com.epmet.dao.CustomerGridDao;
import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.GridDetailResultDTO;
import com.epmet.entity.CustomerGridEntity; import com.epmet.entity.CustomerGridEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.CustomerGridRedis; import com.epmet.redis.CustomerGridRedis;
import com.epmet.service.CustomerGridService; import com.epmet.service.CustomerGridService;
import com.epmet.util.ModuleConstant; import com.epmet.util.ModuleConstant;
@ -55,6 +59,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Autowired @Autowired
private CustomerGridRedis customerGridRedis; private CustomerGridRedis customerGridRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override @Override
public PageData<CustomerGridDTO> page(Map<String, Object> params) { public PageData<CustomerGridDTO> page(Map<String, Object> params) {
@ -163,4 +169,13 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
return new Result<List<CustomerGridByUserIdResultDTO>>().ok(baseDao.getMyGrids(userId)); return new Result<List<CustomerGridByUserIdResultDTO>>().ok(baseDao.getMyGrids(userId));
} }
@Override
public Result<GridDetailResultDTO> griddetail(CustomerGridFormDTO customerGridFormDTO) {
GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO);
List<CustomerStaffGridDTO> customerStaffGridDTOS = baseDao.selectUserIdByGridId(customerGridFormDTO);
Result<List<StaffGridListDTO>> staffGridList = epmetUserFeignClient.getStaffGridList(customerStaffGridDTOS);
griddetail.setStaffGridList(staffGridList.getData());
return new Result<GridDetailResultDTO>().ok(griddetail);
}
} }

30
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -109,4 +109,34 @@
cg.created_time DESC cg.created_time DESC
</select> </select>
<!-- 根据gridId获取网格详情 -->
<select id="griddetail" resultType="com.epmet.dto.result.GridDetailResultDTO">
SELECT id AS grid,
grid_name AS gridName,
longitude AS longitude,
latitude AS latitude,
area_code AS areaCode,
manage_district AS manageDistrict,
total_user AS totalUser,
pid AS agencyId,
pids AS pids
FROM
customer_grid
WHERE
id = #{gridId}
AND del_flag = 0
ORDER BY created_by DESC
</select>
<!--根据gridId查询userId-->
<select id="selectUserIdByGridId" resultType="com.epmet.dto.CustomerStaffGridDTO">
SELECT
user_id
FROM
customer_staff_grid
WHERE
del_flag = 0
AND grid_id = #{gridId}
</select>
</mapper> </mapper>

22
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java

@ -7,12 +7,28 @@ import javax.validation.constraints.NotBlank;
@Data @Data
public class StaffRoleFormDTO { public class StaffRoleFormDTO {
@NotBlank(message = "工作人员ID不能为空") /**===========校验分组开始============*/
// 查询工作人员角色列表group
public interface GetRolesOfStaff {}
// 查询某角色下的人员列表group
public interface GetStaffsInRole {}
/**===========校验分组结束============*/
@NotBlank(message = "工作人员ID不能为空", groups = {GetRolesOfStaff.class})
private String staffId; private String staffId;
/** /**
* 机构id可以是agencyId,DeptId,GridId * 组织id可以是agencyId,DeptId,GridId
*/ */
@NotBlank(message = "工作人员所属组织ID不能为空") @NotBlank(message = "工作人员所属组织ID不能为空", groups = {GetRolesOfStaff.class, GetStaffsInRole.class})
private String orgId; private String orgId;
/**
* 角色key
*/
@NotBlank(message = "角色Key不能为空", groups = {GetStaffsInRole.class})
private String roleKey;
} }

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

@ -26,6 +26,9 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.excel.CustomerStaffExcel; import com.epmet.excel.CustomerStaffExcel;
import com.epmet.service.CustomerStaffService; import com.epmet.service.CustomerStaffService;
@ -117,6 +120,17 @@ public class CustomerStaffController {
return customerStaffService.getCustomerStaffInfo(formDTO); return customerStaffService.getCustomerStaffInfo(formDTO);
} }
/**
* 根据userId查询网格下用户信息
* @param customerStaffGridDTOS
* @return
*/
@PostMapping(value = "selectstaffgridlistbyuserid")
public Result<List<StaffGridListDTO>> selectStaffGridListByUserId(@RequestBody List<CustomerStaffGridDTO> customerStaffGridDTOS){
Result<List<StaffGridListDTO>> listResult = customerStaffService.selectStaffGridListByUserId(customerStaffGridDTOS);
return listResult;
}
/** /**
* 根据用户ID获取工作人员基本信息 * 根据用户ID获取工作人员基本信息
* *

19
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java

@ -3,7 +3,6 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.service.GovStaffRoleService; import com.epmet.service.GovStaffRoleService;
@ -32,12 +31,12 @@ public class StaffRoleController {
private GovStaffRoleService govStaffRoleService; private GovStaffRoleService govStaffRoleService;
/** /**
* 根据工作人员查询工作人员具有的角色列表 * 查询工作人员具有的角色列表
* @return * @return
*/ */
@PostMapping("staffroles") @PostMapping("staffroles")
public Result<List<GovStaffRoleDTO>> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { public Result<List<GovStaffRoleDTO>> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
ValidatorUtils.validateEntity(staffRoleFormDTO); ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetRolesOfStaff.class);
String staffId = staffRoleFormDTO.getStaffId(); String staffId = staffRoleFormDTO.getStaffId();
String orgId = staffRoleFormDTO.getOrgId(); String orgId = staffRoleFormDTO.getOrgId();
List<GovStaffRoleEntity> staffRoleEntities = govStaffRoleService.listRolesByStaffId(staffId, orgId); List<GovStaffRoleEntity> staffRoleEntities = govStaffRoleService.listRolesByStaffId(staffId, orgId);
@ -50,4 +49,18 @@ public class StaffRoleController {
return new Result<List<GovStaffRoleDTO>>().ok(staffRoleDTOS); return new Result<List<GovStaffRoleDTO>>().ok(staffRoleDTOS);
} }
/**
* 查询拥有指定角色的用户列表
* @param staffRoleFormDTO
* @return
*/
@PostMapping("staffsinrole")
public Result<List<GovStaffRoleDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class);
String roleKey = staffRoleFormDTO.getRoleKey();
String orgId = staffRoleFormDTO.getOrgId();
List<GovStaffRoleDTO> roleDTOS = govStaffRoleService.listStaffsInRole(roleKey, orgId);
return new Result<List<GovStaffRoleDTO>>().ok(roleDTOS);
}
} }

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

@ -19,6 +19,8 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -53,4 +55,11 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO); CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO);
CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO);
/**
* 根据userId查询查询网格下的用户信息
* @param customerStaffGridDTOS
* @return
*/
List<StaffGridListDTO> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS);
} }

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

@ -18,6 +18,7 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.GovStaffRoleEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -33,5 +34,19 @@ import java.util.List;
@Mapper @Mapper
public interface GovStaffRoleDao extends BaseDao<GovStaffRoleEntity> { public interface GovStaffRoleDao extends BaseDao<GovStaffRoleEntity> {
/**
* 根据staffId查询具有的角色列表
* @param staffId
* @param orgId
* @return
*/
List<GovStaffRoleEntity> listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); List<GovStaffRoleEntity> listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId);
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<GovStaffRoleDTO> listStaffsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId);
} }

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

@ -21,6 +21,9 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.CustomerStaffEntity;
@ -122,4 +125,11 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @date 2020/4/22 10:05 * @date 2020/4/22 10:05
**/ **/
Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO);
/**
* 根据guidId查询网格下的用户信息
* @param customerStaffGridDTOS
* @return
*/
Result<List<StaffGridListDTO>> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS);
} }

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

@ -99,4 +99,12 @@ public interface GovStaffRoleService extends BaseService<GovStaffRoleEntity> {
* @return * @return
*/ */
List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId); List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId);
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<GovStaffRoleDTO> listStaffsInRole(String roleKey, String orgId);
} }

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

@ -28,6 +28,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant; import com.epmet.constant.UserConstant;
import com.epmet.dao.CustomerStaffDao; import com.epmet.dao.CustomerStaffDao;
import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.CustomerStaffEntity;
import com.epmet.redis.CustomerStaffRedis; import com.epmet.redis.CustomerStaffRedis;
@ -140,4 +143,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return new Result<CustomerStaffDTO>().ok(customerStaffDTO); return new Result<CustomerStaffDTO>().ok(customerStaffDTO);
} }
@Override
public Result<List<StaffGridListDTO>> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS) {
List<StaffGridListDTO> staffGridListDTOS = baseDao.selectStaffGridListByUserId(customerStaffGridDTOS);
return new Result<List<StaffGridListDTO>>().ok(staffGridListDTOS);
}
} }

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

@ -111,4 +111,15 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
return baseDao.listRolesByStaffId(staffId, orgId); return baseDao.listRolesByStaffId(staffId, orgId);
} }
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
@Override
public List<GovStaffRoleDTO> listStaffsInRole(String roleKey, String orgId) {
return baseDao.listStaffsByRoleKeyAndOrgId(roleKey, orgId);
}
} }

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

@ -23,4 +23,22 @@
where cs.USER_ID=#{userId} where cs.USER_ID=#{userId}
and cs.DEL_FLAG='0' and cs.DEL_FLAG='0'
</select> </select>
<!-- 根据userId查询网格下的用户信息 -->
<select id="selectStaffGridListByUserId" parameterType="com.epmet.dto.CustomerStaffGridDTO" resultType="com.epmet.dto.StaffGridListDTO">
SELECT
cs.id AS staffId,
cs.real_name AS staffName,
cs.head_photo AS staffHeadPhoto,
gsr.role_name AS roleName
FROM
customer_staff cs
LEFT JOIN gov_staff_role gsr ON cs.user_id = gsr.id
WHERE
cs.user_id in
<foreach collection="list" item="staff" open="(" separator="," close=")">
#{staff.userId}
</foreach>
AND cs.del_flag = 0
</select>
</mapper> </mapper>

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

@ -17,6 +17,7 @@
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<!--根据staffId查询具有的角色列表-->
<select id="listRolesByStaffId" resultType="com.epmet.entity.GovStaffRoleEntity"> <select id="listRolesByStaffId" resultType="com.epmet.entity.GovStaffRoleEntity">
SELECT SELECT
r.* r.*
@ -28,5 +29,17 @@
AND sr.ORG_ID = #{orgId} AND sr.ORG_ID = #{orgId}
</select> </select>
<!--查询具有某角色的staff列表-->
<select id="listStaffsByRoleKeyAndOrgId" resultType="com.epmet.dto.GovStaffRoleDTO">
SELECT
r.*
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
WHERE
r.ROLE_KEY = #{roleKey}
AND sr.ORG_ID = #{orgId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save