Browse Source

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

# Conflicts:
#	epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
master
yinzuomei 5 years ago
parent
commit
fb0d1d90d0
  1. 39
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java
  2. 43
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java
  3. 12
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java
  4. 40
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
  5. 43
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyListFormDTO.java
  6. 28
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java
  7. 51
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java
  8. 38
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java
  9. 27
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java
  10. 113
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
  11. 61
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  12. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java
  13. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java
  14. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  15. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java
  16. 0
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/.gitkeep
  17. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  18. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  19. 85
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
  20. 40
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  21. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java
  22. 22
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java
  23. 197
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  24. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java
  25. 54
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
  26. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  27. 10
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml
  28. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java
  29. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  30. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  31. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  32. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  33. 27
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

39
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java

@ -0,0 +1,39 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.List;
@Data
public class StaffPermCacheFormDTO {
/**
* 更新权限缓存分组
*/
public interface UpdatePermissionCache {}
/**
* 工作人员 id
*/
@NotBlank(message = "工作人员ID不能为空", groups = {UpdatePermissionCache.class})
private String staffId;
/**
* 登录头信息app
*/
@NotBlank(message = "登录头信息app不能为空", groups = {UpdatePermissionCache.class})
private String app;
/**
* 登录头信息client
*/
@NotBlank(message = "登录头信息client不能为空", groups = {UpdatePermissionCache.class})
private String client;
/**
* 权限列表
*/
private List<String> permissions;
}

43
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java

@ -0,0 +1,43 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.StaffPermCacheFormDTO;
import com.epmet.service.AccessService;
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;
import java.util.List;
/**
* 权限相关Api
* @Author wxz
* @Description
* @Date 2020/4/23 17:54
**/
@RestController
@RequestMapping("access")
public class AccessController {
@Autowired
private AccessService accessService;
/**
* 更新工作人员权限缓存
* @param staffPermCacheFormDTO
* @return
*/
@PostMapping("updatepermissioncache")
public Result updatePermissionCache(@RequestBody StaffPermCacheFormDTO staffPermCacheFormDTO) {
ValidatorUtils.validateEntity(staffPermCacheFormDTO, StaffPermCacheFormDTO.UpdatePermissionCache.class);
String staffId = staffPermCacheFormDTO.getStaffId();
String app = staffPermCacheFormDTO.getApp();
String client = staffPermCacheFormDTO.getClient();
List<String> permissions = staffPermCacheFormDTO.getPermissions();
accessService.updatePermissionCache(staffId, app, client, permissions);
return new Result();
}
}

12
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java

@ -0,0 +1,12 @@
package com.epmet.service;
import java.util.List;
public interface AccessService {
/**
* 更新权限缓存
* @param staffId
* @param permissions
*/
void updatePermissionCache(String staffId, String app, String client, List<String> permissions);
}

40
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

@ -0,0 +1,40 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.service.AccessService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AccessServiceImpl implements AccessService {
private static Logger logger = LoggerFactory.getLogger(AccessServiceImpl.class);
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
/**
* 更新权限缓存
* @param staffId
* @param permissions
*/
@Override
public void updatePermissionCache(String staffId, String app, String client, List<String> permissions) {
GovTokenDto govTokenDto = cpUserDetailRedis.get(app, client, staffId, GovTokenDto.class);
if (govTokenDto == null) {
logger.warn("更新[{}]用户缓存:Redis中不存在该用户TokenDto缓存信息", staffId);
return ;
}
govTokenDto.setPermissions(permissions);
// 将新的TokenDto更新到redis中
long expire = cpUserDetailRedis.getExpire(app, client, staffId);
cpUserDetailRedis.set(govTokenDto, expire);
logger.warn("更新[{}]用户缓存成功。", staffId);
}
}

43
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyListFormDTO.java

@ -0,0 +1,43 @@
/**
* 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.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 获取组织列表-接口入参
*
* @author sun
*/
@Data
public class AgencyListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
@NotBlank(message = "组织机构ID不能为空")
private String agencyId;
}

28
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/23 15:45
*/
@Data
public class StaffsInAgencyFromDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 机关ID
*/
private String agencyId;
/**
* 用户ID
*/
private List<String> staffList;
}

51
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java

@ -0,0 +1,51 @@
/**
* 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.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 获取组织列表-接口返参
*
* @author sun
*/
@Data
public class AgencyListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
private String agencyId;
/**
* 机关组织名称
*/
private String agencyName;
/**
* 总人数
*/
private Integer totalUser;
}

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

@ -0,0 +1,38 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/23 16:08
*/
@Data
public class StaffInfoResultDTO implements Serializable {
/**
* 用户ID
*/
private String staffId;
/**
* 用户姓名
*/
private String staffName;
/**
* 头像
*/
private String staffHeadPhoto;
/**
* 性别
*/
private Integer gender;
/**
* 是否禁用未禁用enable,已禁用disabled
*/
private String enableFlag;
/**
* 权限名
*/
private String roleName;
}

27
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/23 15:58
*/
@NoArgsConstructor
@Data
public class StaffsInAgencyResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 人员总数
*/
private Integer staffCount;
/**
* 人员列表
*/
private List<StaffInfoResultDTO> staffList;
}

113
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java

@ -0,0 +1,113 @@
/**
* 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.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.dto.result.AgencyListResultDTO;
import com.epmet.dto.result.AgencydetailResultDTO;
import com.epmet.dto.result.SubAgencyResultDTO;
import com.epmet.service.AgencyService;
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;
import java.util.List;
/**
* 组织机构
*
* @author generator generator@elink-cn.com
*/
@RestController
@RequestMapping("agency")
public class AgencyController {
@Autowired
private AgencyService agencyService;
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加组织
*/
@PostMapping("addagency")
public Result<AddAgencyResultDTO> addAgency(@RequestBody AddAgencyFormDTO formDTO) {
return agencyService.addAgency(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织名称编辑
*/
@PostMapping("editagency")
public Result editAgency(@RequestBody EditAgencyFormDTO formDTO) {
return agencyService.editAgency(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除组织机关
*/
@PostMapping("removeagency")
public Result removeAgency(@RequestBody RemoveAgencyFormDTO formDTO) {
return agencyService.removeAgency(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取组织机构信息
*/
@PostMapping("agencydetail")
public Result<AgencydetailResultDTO> agencyDetail(@RequestBody AgencydetailFormDTO formDTO) {
return agencyService.agencyDetail(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-下级机关列表
*/
@PostMapping("subagencylist")
public Result<SubAgencyResultDTO> subAgencyList(@RequestBody SubAgencyFormDTO formDTO) {
return agencyService.subAgencyList(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取组织列表
*/
@PostMapping("agencylist")
public Result<List<AgencyListResultDTO>> agencyList(@RequestBody AgencyListFormDTO formDTO) {
return agencyService.agencyList(formDTO);
}
}

61
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -26,11 +26,8 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.dto.result.AgencydetailResultDTO;
import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.SubAgencyResultDTO;
import com.epmet.excel.CustomerAgencyExcel;
import com.epmet.service.CustomerAgencyService;
import org.springframework.beans.factory.annotation.Autowired;
@ -107,60 +104,4 @@ public class CustomerAgencyController {
public Result<List<StaffOrgsResultDTO>> getStaffOrgList(@RequestBody StaffOrgFormDTO staffOrgsFormDTO) {
return customerAgencyService.getStaffOrgList(staffOrgsFormDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加组织
*/
@PostMapping("addagency")
public Result<AddAgencyResultDTO> addAgency(@RequestBody AddAgencyFormDTO formDTO) {
return customerAgencyService.addAgency(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织名称编辑
*/
@PostMapping("editagency")
public Result editAgency(@RequestBody EditAgencyFormDTO formDTO) {
return customerAgencyService.editAgency(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除组织机关
*/
@PostMapping("removeagency")
public Result removeAgency(@RequestBody RemoveAgencyFormDTO formDTO) {
return customerAgencyService.removeAgency(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取组织机构信息
*/
@PostMapping("agencydetail")
public Result<AgencydetailResultDTO> agencyDetail(@RequestBody AgencydetailFormDTO formDTO) {
return customerAgencyService.agencyDetail(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-下级机关列表
*/
@PostMapping("subagencylist")
public Result<SubAgencyResultDTO> subAgencyList(@RequestBody SubAgencyFormDTO formDTO) {
return customerAgencyService.subAgencyList(formDTO);
}
}

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java

@ -26,7 +26,9 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.excel.CustomerStaffAgencyExcel;
import com.epmet.service.CustomerStaffAgencyService;
import org.springframework.beans.factory.annotation.Autowired;
@ -104,4 +106,7 @@ public class CustomerStaffAgencyController {
return customerStaffAgencyService.getLatestCustomer(userId);
}
}

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

@ -0,0 +1,36 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.dto.result.StaffsInAgencyResultDTO;
import com.epmet.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 组织结构-工作人员
* @author zhaoqifeng
* @date 2020/4/23 17:59
*/
@RestController
@RequestMapping("staff")
public class StaffController {
@Autowired
private StaffService staffService;
/**
* 组织首页-工作人员列表
* @param fromDTO
* @return
*/
@PostMapping("staffsinagency")
public Result<StaffsInAgencyResultDTO> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
return staffService.getStaffInfoForHome(fromDTO);
}
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.AgencyListResultDTO;
import com.epmet.dto.result.ParentListResultDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.SubListResultDTO;
@ -59,4 +60,12 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Description 组织首页-下级机关列表
**/
List<SubListResultDTO> selectSubAgencyById(@Param("pId") String pId);
/**
* @param pId
* @return
* @Author sun
* @Description 获取组织列表
**/
List<AgencyListResultDTO> selectAgencyList(@Param("pId") String pId);
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java

@ -22,6 +22,8 @@ import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.entity.CustomerStaffAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 人员-机关单位关系表
*
@ -37,5 +39,12 @@ public interface CustomerStaffAgencyDao extends BaseDao<CustomerStaffAgencyEntit
* @return
*/
CustomerStaffAgencyDTO selectLatestCustomerByStaff(String userId);
/**
* 获取机关下的工作人员
* @param agencyId
* @return
*/
List<CustomerStaffAgencyDTO> selectCustomerStaffAgencyList(String agencyId);
}

0
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/.gitkeep

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

@ -5,6 +5,8 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
@ -33,4 +35,12 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid")
Result<List<StaffGridListDTO>> getStaffGridList(@RequestBody List<CustomerStaffGridDTO> customerStaffGridDTOS);
/**
* 组织首页-工作人员列表
* @param fromDTO
* @return
*/
@PostMapping("/epmetuser/customerstaff/staffsinagency")
Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO);
}

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

@ -6,6 +6,8 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
@ -25,4 +27,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
public Result<List<StaffGridListDTO>> getStaffGridList(List<CustomerStaffGridDTO> customerStaffGridDTOS) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS);
}
@Override
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoForHome", fromDTO);
}
}

85
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java

@ -0,0 +1,85 @@
/**
* 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.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import java.util.List;
import java.util.Map;
/**
* 机关单位信息
*
* @author generator generator@elink-cn.com
*/
public interface AgencyService {
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加组织
*/
Result<AddAgencyResultDTO> addAgency(AddAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织名称编辑
*/
Result editAgency(EditAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除组织机关
*/
Result removeAgency(RemoveAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取组织机构信息
*/
Result<AgencydetailResultDTO> agencyDetail(AgencydetailFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-下级机关列表
*/
Result<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取组织列表
*/
Result<List<AgencyListResultDTO>> agencyList(AgencyListFormDTO formDTO);
}

40
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -107,44 +107,4 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Date 2020/4/20 21:45
**/
Result<List<StaffOrgsResultDTO>> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加组织
*/
Result<AddAgencyResultDTO> addAgency(AddAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织名称编辑
*/
Result editAgency(EditAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除组织机关
*/
Result removeAgency(RemoveAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取组织机构信息
*/
Result<AgencydetailResultDTO> agencyDetail(AgencydetailFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-下级机关列表
*/
Result<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO);
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.entity.CustomerStaffAgencyEntity;
@ -102,4 +103,13 @@ public interface CustomerStaffAgencyService extends BaseService<CustomerStaffAge
* @return
*/
Result<LatestCustomerResultDTO> getLatestCustomer(String userId);
/**
* 获取组织下关联人员
* @param fromDTO
* @return
*/
Result<List<CustomerStaffAgencyDTO>> getCustomerStaffAgencyList(StaffsInAgencyFromDTO fromDTO);
}

22
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java

@ -0,0 +1,22 @@
package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffsInAgencyResultDTO;
/**
* 组织结构-工作人员
*
* @author zhaoqifeng
* @date 2020/4/23 18:00
*/
public interface StaffService {
/**
* 组织首页-工作人员列表
*
* @param fromDTO 参数
* @return Result<StaffsInAgencyResultDTO>
* @author zhaoqifeng
*/
Result<StaffsInAgencyResultDTO> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO);
}

197
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -0,0 +1,197 @@
/**
* 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.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.AgencyService;
import com.epmet.service.CustomerAgencyService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 机关单位信息
*
* @author generator generator@elink-cn.com
*/
@Service
public class AgencyServiceImpl implements AgencyService {
private static final Logger log = LoggerFactory.getLogger(AgencyServiceImpl.class);
@Autowired
private CustomerAgencyDao customerAgencyDao;
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加组织
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<AddAgencyResultDTO> addAgency(AddAgencyFormDTO formDTO) {
Result<AddAgencyResultDTO> result = new Result<AddAgencyResultDTO>();
AddAgencyResultDTO addAgencyResultDTO = new AddAgencyResultDTO();
//0:属性映射赋值
CustomerAgencyEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class);
entity.setOrganizationName(formDTO.getAgencyName());
entity.setTotalUser(NumConstant.ZERO);
//1:查询上级机关信息
CustomerAgencyEntity parentEntity = customerAgencyDao.selectById(formDTO.getPid());
entity.setCustomerId(parentEntity.getCustomerId());
if (null == parentEntity.getPid()) {
entity.setPids(parentEntity.getId());
entity.setAllParentName(parentEntity.getOrganizationName());
} else {
entity.setPids(":" + parentEntity.getId());
entity.setAllParentName("-" + parentEntity.getOrganizationName());
}
//2:保存组织信息
if (customerAgencyDao.insert(entity) < NumConstant.ONE) {
log.error(CustomerAgencyConstant.SAVE_EXCEPTION);
throw new RenException(CustomerAgencyConstant.SAVE_EXCEPTION);
}
//3:返回新组织Id
addAgencyResultDTO.setAgencyId(entity.getId());
return result.ok(addAgencyResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织名称编辑
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result editAgency(EditAgencyFormDTO formDTO) {
Result result = new Result();
CustomerAgencyEntity entity = new CustomerAgencyEntity();
entity.setId(formDTO.getAgencyId());
entity.setOrganizationName(formDTO.getAgencyName());
if (customerAgencyDao.updateById(entity) < NumConstant.ONE) {
log.error(CustomerAgencyConstant.UPDATE_EXCEPTION);
throw new RenException(CustomerAgencyConstant.UPDATE_EXCEPTION);
}
return result;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除组织机关
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result removeAgency(RemoveAgencyFormDTO formDTO) {
Result result = new Result();
//1:查询当前机关是否存在所属下级机关,存在下级的不能删除
List<SubListResultDTO> agencyList = customerAgencyDao.selectSubAgencyById(formDTO.getAgencyId());
if (null != agencyList && agencyList.size() > NumConstant.ZERO) {
result.setCode(EpmetErrorCode.NOT_DEL_AGENCY.getCode());
result.setMsg(EpmetErrorCode.NOT_DEL_AGENCY.getMsg());
return result;
}
//2:删除当前机关组织(逻辑删)
if (customerAgencyDao.deleteById(formDTO.getAgencyId()) < NumConstant.ONE) {
log.error(CustomerAgencyConstant.DEL_EXCEPTION);
throw new RenException(CustomerAgencyConstant.DEL_EXCEPTION);
}
return result;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取组织机构信息
*/
@Override
public Result<AgencydetailResultDTO> agencyDetail(AgencydetailFormDTO formDTO) {
AgencydetailResultDTO agencydetailResultDTO = new AgencydetailResultDTO();
//1:查询本机关详细信息
CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getAgencyId());
if (null == entity) {
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO);
}
agencydetailResultDTO = ConvertUtils.sourceToTarget(entity, AgencydetailResultDTO.class);
agencydetailResultDTO.setAgencyId(entity.getId());
agencydetailResultDTO.setAgencyName(entity.getOrganizationName());
//2:查询本机关的所有上级机关,按自上而下层级顺序
if (null == entity.getPids()) {
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO);
}
List<String> listStr = Arrays.asList(entity.getPids().split(":"));
List<ParentListResultDTO> parentList = customerAgencyDao.selectPAgencyById(listStr);
agencydetailResultDTO.setParentList(parentList);
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-下级机关列表
*/
@Override
public Result<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO) {
SubAgencyResultDTO subAgencyResultDTO = new SubAgencyResultDTO();
//1:根据当前机关Id查询直属下一级机关列表
List<SubListResultDTO> agencyList = customerAgencyDao.selectSubAgencyById(formDTO.getAgencyId());
subAgencyResultDTO.setAgencyList(agencyList);
//2:统计下一级机关数
subAgencyResultDTO.setSubAgencyCount(agencyList.size());
return new Result<SubAgencyResultDTO>().ok(subAgencyResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取组织列表
*/
@Override
public Result<List<AgencyListResultDTO>> agencyList(AgencyListFormDTO formDTO) {
List<AgencyListResultDTO> agencyList = customerAgencyDao.selectAgencyList(formDTO.getAgencyId());
return new Result<List<AgencyListResultDTO>>().ok(agencyList);
}
}

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java

@ -28,11 +28,16 @@ import com.epmet.dao.CustomerStaffAgencyDao;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.dto.result.StaffsInAgencyResultDTO;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerStaffAgencyEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.CustomerStaffAgencyRedis;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerStaffAgencyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -42,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 人员-机关单位关系表
@ -58,6 +64,8 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl<CustomerStaf
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private OperCrmFeignClient operCrmFeignClient;
@Autowired
private CustomerAgencyService customerAgencyService;
@Override
public PageData<CustomerStaffAgencyDTO> page(Map<String, Object> params) {
@ -121,8 +129,7 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl<CustomerStaf
//获取工作人员头像
CustomerStaffDTO customerStaffParam = new CustomerStaffDTO();
customerStaffParam.setUserId(userId);
Result<CustomerStaffDTO> staffInfo =
epmetUserFeignClient.getCustomerStaffInfoByUserId(customerStaffParam);
Result<CustomerStaffDTO> staffInfo = epmetUserFeignClient.getCustomerStaffInfoByUserId(customerStaffParam);
resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto());
resultDTO.setGender(staffInfo.getData().getGender());
//获取客户名称
@ -133,4 +140,12 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl<CustomerStaf
return new Result<LatestCustomerResultDTO>().ok(resultDTO);
}
@Override
public Result<List<CustomerStaffAgencyDTO>> getCustomerStaffAgencyList(StaffsInAgencyFromDTO fromDTO) {
List<CustomerStaffAgencyDTO> customerStaffAgencyList = baseDao.selectCustomerStaffAgencyList(fromDTO.getAgencyId());
return new Result<List<CustomerStaffAgencyDTO>>().ok(customerStaffAgencyList);
}
}

54
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java

@ -0,0 +1,54 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.dto.result.StaffsInAgencyResultDTO;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.OperCrmFeignClient;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerStaffAgencyService;
import com.epmet.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/23 18:05
*/
@Service
public class StaffServiceImpl implements StaffService {
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private OperCrmFeignClient operCrmFeignClient;
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired
private CustomerStaffAgencyService customerStaffAgencyService;
@Override
public Result<StaffsInAgencyResultDTO> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
StaffsInAgencyResultDTO resultDTO = new StaffsInAgencyResultDTO();
//获取机关所在客户ID和人员总数
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
resultDTO.setStaffCount(customerAgencyEntity.getTotalUser());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
List<CustomerStaffAgencyDTO> customerStaffAgencyList = customerStaffAgencyService.getCustomerStaffAgencyList(fromDTO).getData();
if (null == customerStaffAgencyList || customerStaffAgencyList.size() == 0) {
return new Result<StaffsInAgencyResultDTO>().ok(null);
}
//提取所有userID
List<String> staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList());
fromDTO.setStaffList(staffIds);
//获取用户信息
Result<List<StaffInfoResultDTO>> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO);
resultDTO.setStaffList(staffInfoListResult.getData());
return new Result<StaffsInAgencyResultDTO>().ok(resultDTO);
}
}

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -59,4 +59,15 @@
AND pid = #{pId}
ORDER BY CREATED_TIME DESC
</select>
<select id="selectAgencyList" resultType="com.epmet.dto.result.AgencyListResultDTO">
SELECT
id AS 'agencyId',
organization_name AS 'agencyName',
total_user AS 'totalUser'
FROM customer_agency
WHERE del_flag = '0'
AND pid = #{pId}
ORDER BY CREATED_TIME DESC
</select>
</mapper>

10
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml

@ -28,5 +28,15 @@
CREATED_TIME DESC
LIMIT 1
</select>
<select id="selectCustomerStaffAgencyList" parameterType="java.lang.String"
resultType="com.epmet.dto.CustomerStaffAgencyDTO">
SELECT
*
FROM
customer_staff_agency
WHERE
DEL_FLAG = '0'
AND AGENCY_ID =#{agencyId}
</select>
</mapper>

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java

@ -128,4 +128,9 @@ public class CustomerStaffDTO implements Serializable {
* 客户id
*/
private String customerId;
/**
* 角色名称
*/
private String roleName;
}

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

@ -30,6 +30,8 @@ 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.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.excel.CustomerStaffExcel;
import com.epmet.service.CustomerStaffService;
import org.springframework.beans.factory.annotation.Autowired;
@ -143,4 +145,14 @@ public class CustomerStaffController {
public Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) {
return customerStaffService.getCustomerStaffInfoByUserId(formDTO);
}
/**
* 组织首页-工作人员列表
* @param fromDTO
* @return
*/
@PostMapping("staffsinagency")
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffInfoForHome(fromDTO);
}
}

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

@ -22,6 +22,8 @@ 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.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper;
@ -54,8 +56,23 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
**/
CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO);
CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO);
CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO);
/**
* 根据userId查询查询网格下的用户信息
*
* @param customerStaffGridDTOS
* @return
*/
List<StaffGridListDTO> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS);
/**
* 根据用户ID列表获取用户信息
*
* @param fromDTO
* @return
*/
List<StaffInfoResultDTO> selectCustomerStaffList(StaffsInAgencyFromDTO fromDTO);
/**
* 根据userId查询查询网格下的用户信息
* @param customerStaffGridDTOS

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

@ -23,8 +23,9 @@ import com.epmet.commons.tools.utils.Result;
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.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.CustomerStaffEntity;
import java.util.List;
@ -132,4 +133,11 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @return
*/
Result<List<StaffGridListDTO>> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS);
/**
* 组织首页-工作人员列表
* @param fromDTO
* @return
*/
Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO);
}

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

@ -30,8 +30,9 @@ import com.epmet.dao.CustomerStaffDao;
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.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.CustomerStaffEntity;
import com.epmet.redis.CustomerStaffRedis;
import com.epmet.service.CustomerStaffService;
@ -149,4 +150,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return new Result<List<StaffGridListDTO>>().ok(staffGridListDTOS);
}
@Override
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
List<StaffInfoResultDTO> list = baseDao.selectCustomerStaffList(fromDTO);
return new Result<List<StaffInfoResultDTO>>().ok(list);
}
}

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

@ -41,6 +41,33 @@
</foreach>
AND cs.del_flag = 0
</select>
<select id="selectCustomerStaffList" resultType="com.epmet.dto.result.StaffInfoResultDTO" parameterType="com.epmet.dto.form.StaffsInAgencyFromDTO">
SELECT
cs.USER_ID AS "staffId",
cs.REAL_NAME AS "staffName",
cs.GENDER AS "gender",
cs.HEAD_PHOTO AS "staffHeadPhoto",
cs.ENABLE_FLAG AS "enableFlag",
gsr.ROLE_NAME AS "roleName"
FROM
customer_staff cs
LEFT JOIN staff_role sr ON cs.USER_ID = sr.STAFF_ID
AND sr.DEL_FLAG = '0'
AND sr.ORG_ID = #{agencyId}
LEFT JOIN gov_staff_role gsr ON sr.ROLE_ID = gsr.ID
AND gsr.DEL_FLAG = '0'
AND gsr.CUSTOMER_ID = #{customerId}
AND gsr.ROLE_KEY = 'agency_leader'
WHERE
cs.DEL_FLAG = '0'
AND
cs.USER_ID in
<foreach item="userId" collection="staffList" separator="," open="(" close=")" index="">
#{userId}
</foreach>
ORDER BY gsr.ROLE_NAME DESC, cs.CREATED_TIME DESC
LIMIT 12
</select>
<!-- 根据staffid查询用户基本信息 -->
<select id="selectByUserId" parameterType="java.lang.String" resultType="com.epmet.entity.CustomerStaffEntity">

Loading…
Cancel
Save