Browse Source

Merge branch 'dev_govorg' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_govorg

master
sunyuchao 5 years ago
parent
commit
3a896a19e7
  1. 2
      epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java
  2. 11
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  3. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java
  4. 39
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java
  5. 43
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java
  6. 12
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java
  7. 40
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
  8. 3
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java
  9. 3
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java
  10. 9
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java
  11. 28
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java
  12. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java
  13. 38
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java
  14. 13
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java
  15. 27
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java
  16. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java
  17. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java
  18. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java
  19. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  20. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java
  21. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  22. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java
  23. 40
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  24. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java
  25. 22
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java
  26. 146
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  27. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java
  28. 54
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
  29. 6
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  30. 10
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml
  31. 20
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java
  32. 12
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  33. 11
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java
  34. 10
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
  35. 7
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  36. 14
      epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml
  37. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java
  38. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  39. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  40. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  41. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  42. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java
  43. 27
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

2
epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java

@ -34,6 +34,6 @@ public class GovWxmpEnteOrgFormDTO implements Serializable {
* 选择的要进入的组织(根组织id)
*/
@NotBlank(message = "组织id不能为空")
private String agencyId;
private String rootAgencyId;
}

11
epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java

@ -127,6 +127,9 @@ public class GovLoginServiceImpl implements GovLoginService {
public Result<UserTokenResultDTO> loginByWxCode(GovWxmpFormDTO formDTO) {
//1、解析微信用户
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode());
if(null!=wxMaJscode2SessionResult){
logger.info(String.format("app=%s,wxCode=%s,openId=%s",formDTO.getApp(),formDTO.getWxCode(),wxMaJscode2SessionResult.getOpenid()));
}
Result<StaffLatestAgencyResultDTO> latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid());
if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) {
logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg()));
@ -200,7 +203,7 @@ public class GovLoginServiceImpl implements GovLoginService {
//5.1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId());
//5.2、保存到redis
this.saveGovTokenDto(formDTO.getAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
this.saveGovTokenDto(formDTO.getRootAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
@ -223,7 +226,7 @@ public class GovLoginServiceImpl implements GovLoginService {
staffLoginAgencyRecordFormDTO.setStaffId(staffId);
staffLoginAgencyRecordFormDTO.setWxOpenId(openId);
staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile());
staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getAgencyId());
staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getRootAgencyId());
Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO);
return staffLoginRecordResult;
}
@ -252,9 +255,9 @@ public class GovLoginServiceImpl implements GovLoginService {
Map<String, Object> map = new HashMap<>();
map.put("app", LoginConstant.APP_GOV);
map.put("client", LoginConstant.CLIENT_WXMP);
map.put("staffId", staffId);
map.put("userId", staffId);
String token = jwtTokenUtils.createToken(map);
logger.info("app:" + LoginConstant.APP_GOV + ";client:" + LoginConstant.CLIENT_WXMP + ";staffId:" + staffId + ";生成token[" + token + "]");
logger.info("app:" + LoginConstant.APP_GOV + ";client:" + LoginConstant.CLIENT_WXMP + ";userId:" + staffId + ";生成token[" + token + "]");
return token;
}

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java

@ -4,6 +4,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Set;
/**
* @Description 政府端登录信息
@ -62,5 +63,10 @@ public class GovTokenDto extends BaseTokenDto implements Serializable {
* 最后一次更新时间
*/
private long updateTime;
/**
* 功能权限列表实际上是gov_staff => staff_role => role_operation查询到的operationKey
*/
private List<String> permissions;
}

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);
}
}

3
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java

@ -34,7 +34,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
import java.util.Set;
/**
* 机关单位信息表
@ -78,7 +77,7 @@ public class StaffAgencyController {
* @Date 2020/4/23 10:34
**/
@PostMapping("switchgrid")
public Result<Set<String>> switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) {
public Result switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) {
switchGridFormDTO.setStaffId(tokenDto.getUserId());
return staffAgencyService.switchGrid(switchGridFormDTO);
}

3
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java

@ -25,7 +25,6 @@ import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import java.util.List;
import java.util.Set;
/**
* 机关单位信息表
@ -57,7 +56,7 @@ public interface StaffAgencyService {
* @Description 切换网格
* @Date 2020/4/23 10:49
**/
Result<Set<String>> switchGrid(SwitchGridFormDTO switchGridFormDTO);
Result switchGrid(SwitchGridFormDTO switchGridFormDTO);
/**
* @Description 得到工作人员最后一次登录的网格

9
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java

@ -37,7 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
/**
* 机关单位信息表
@ -94,17 +93,17 @@ public class StaffAgencyServiceImpl implements StaffAgencyService {
@Override
public Result<Set<String>> switchGrid(SwitchGridFormDTO switchGridFormDTO) {
public Result switchGrid(SwitchGridFormDTO switchGridFormDTO) {
//记录网格访问记录
StaffGridVisitedFormDTO staffGridVisitedFormDTO = ConvertUtils.sourceToTarget(switchGridFormDTO, StaffGridVisitedFormDTO.class);
Result saveStaffGridVisitedRecord = epmetUserFeignClient.saveStaffGridVisitedRecord(staffGridVisitedFormDTO);
if (!saveStaffGridVisitedRecord.success()) {
logger.error("保存网格访问记录失败");
return new Result<Set<String>>().error();
}
//查询网格的权限
/* //查询网格的权限
Set<String> opeKeys = accessService.listOpeKeysByStaffId(switchGridFormDTO.getStaffId(), null, switchGridFormDTO.getGridId());
return new Result<Set<String>>().ok(opeKeys);
return new Result<Set<String>>().ok(opeKeys);*/
return new Result();
}

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;
}

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java

@ -21,7 +21,7 @@ public class LatestCustomerResultDTO implements Serializable {
*/
private String customerName;
/**
* 客户顶级名称
* 用户所属组织id任意一条
*/
private String agencyId;
/**
@ -29,7 +29,7 @@ public class LatestCustomerResultDTO implements Serializable {
*/
private String staffHeadPhoto;
/**
* 性别
* 性别0未知1男2女
*/
private Integer gender;
}

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;
}

13
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java

@ -14,9 +14,14 @@ public class StaffOrgsResultDTO implements Serializable {
private static final long serialVersionUID = -9148184731135509803L;
/**
* 组织id
* 根级根级组织id
*/
private String orgId;
private String rootAgencyId;
/**
* 根级组织名称
*/
private String rootAgencyName;
/**
* 客户id
@ -24,8 +29,8 @@ public class StaffOrgsResultDTO implements Serializable {
private String customerId;
/**
* 组织名称
* 客户名称
*/
private String orgName;
private String customerName;
}

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;
}

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/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);
}

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);
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java

@ -3,11 +3,14 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.CustomerFormDTO;
import com.epmet.feign.fallback.OperCrmFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
@ -22,4 +25,14 @@ public interface OperCrmFeignClient {
*/
@PostMapping("/oper/crm/customer/getcostomerInfo")
Result<CustomerDTO> getCustomerInfo(@RequestBody CustomerDTO dto);
/**
* @param customerFormDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.CustomerDTO>>
* @Author yinzuomei
* @Description 根据客户id查询客户信息
* @Date 2020/4/24 9:07
**/
@PostMapping("/oper/crm/customer/queryCustomerList")
Result<List<CustomerDTO>> queryCustomerList(CustomerFormDTO customerFormDTO);
}

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);
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java

@ -4,9 +4,12 @@ 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.CustomerDTO;
import com.epmet.dto.form.CustomerFormDTO;
import com.epmet.feign.OperCrmFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
@ -18,4 +21,9 @@ public class OperCrmFeignClientFallBack implements OperCrmFeignClient {
public Result<CustomerDTO> getCustomerInfo(CustomerDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto);
}
@Override
public Result<List<CustomerDTO>> queryCustomerList(CustomerFormDTO customerFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "queryCustomerList", customerFormDTO);
}
}

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

@ -107,4 +107,44 @@ 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);
}

146
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -30,9 +30,11 @@ 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.CustomerDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.CustomerAgencyService;
import org.apache.commons.lang3.StringUtils;
@ -55,9 +57,11 @@ import java.util.Map;
@Service
public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao, CustomerAgencyEntity> implements CustomerAgencyService {
private static final Logger logger = LoggerFactory.getLogger(CustomerAgencyServiceImpl.class);
@Autowired
private CustomerAgencyRedis customerAgencyRedis;
@Autowired
private OperCrmFeignClient operCrmFeignClient;
@Override
public PageData<CustomerAgencyDTO> page(Map<String, Object> params) {
IPage<CustomerAgencyEntity> page = baseDao.selectPage(
@ -116,6 +120,146 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return new Result<>();
}
List<StaffOrgsResultDTO> list = baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList());
CustomerFormDTO customerFormDTO = new CustomerFormDTO();
customerFormDTO.setCustomerIdList(staffOrgsFormDTO.getCustomerIdList());
Result<List<CustomerDTO>> customerDTOResult = operCrmFeignClient.queryCustomerList(customerFormDTO);
List<CustomerDTO> customerDTOList = customerDTOResult.getData();
if (customerDTOResult.success() && customerDTOList.size() > 0) {
for (CustomerDTO customer : customerDTOList) {
for (StaffOrgsResultDTO staffOrgsResultDTO : list) {
if (customer.getId().equals(staffOrgsResultDTO.getCustomerId())) {
staffOrgsResultDTO.setCustomerName(customer.getCustomerName());
break;
}
}
}
} else {
logger.error("获取客户名称失败");
}
return new Result<List<StaffOrgsResultDTO>>().ok(list);
}
/**
* @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 = baseDao.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 (baseDao.insert(entity) < NumConstant.ONE) {
logger.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 (baseDao.updateById(entity) < NumConstant.ONE) {
logger.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 = baseDao.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 (baseDao.deleteById(formDTO.getAgencyId()) < NumConstant.ONE) {
logger.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 = baseDao.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 = baseDao.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 = baseDao.selectSubAgencyById(formDTO.getAgencyId());
subAgencyResultDTO.setAgencyList(agencyList);
//2:统计下一级机关数
subAgencyResultDTO.setSubAgencyCount(agencyList.size());
return new Result<SubAgencyResultDTO>().ok(subAgencyResultDTO);
}
}

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);
}
}

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

@ -24,9 +24,9 @@
<!-- 查询客户对应的根级组织 -->
<select id="selectStaffOrgList" parameterType="map" resultType="com.epmet.dto.result.StaffOrgsResultDTO">
SELECT
ca.pid AS orgId,
ca.CUSTOMER_ID AS customerId,
ca.ORGANIZATION_NAME AS orgName
ca.pid AS agencyId,
ca.ORGANIZATION_NAME AS agencyName,
ca.CUSTOMER_ID AS customerId
FROM
customer_agency ca
WHERE

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>

20
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 根据客户id查询客户信息
* @Author yinzuomei
* @Date 2020/4/24 9:09
*/
@Data
public class CustomerFormDTO implements Serializable {
/**
* 客户id集合
* */
private List<String> customerIdList;
}

12
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java

@ -26,6 +26,7 @@ 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.CustomerDTO;
import com.epmet.dto.form.CustomerFormDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.excel.CustomerExcel;
import com.epmet.service.CustomerService;
@ -144,4 +145,15 @@ public class CustomerController {
return customerService.getCustomerInfo(dto);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerDTO>
* @Author yinzuomei
* @Description 根据客户id查询客户信息
* @Date 2020/4/24 9:13
**/
@PostMapping("queryCustomerList")
public Result<List<CustomerDTO>> queryCustomerList(@RequestBody CustomerFormDTO formDTO) {
return customerService.queryCustomerList(formDTO);
}
}

11
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java

@ -18,9 +18,11 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.entity.CustomerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -40,4 +42,13 @@ public interface CustomerDao extends BaseDao<CustomerEntity> {
* @date 2020-03-11
*/
List<ValidCustomerResultDTO> selectListValidCustomerResultDTO();
/**
* @return java.util.List<com.epmet.dto.CustomerDTO>
* @param customerIdList
* @Author yinzuomei
* @Description 根据客户id查询客户信息
* @Date 2020/4/24 9:21
**/
List<CustomerDTO> selectListByIds(@Param("customerIdList") List<String> customerIdList);
}

10
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.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.CustomerDTO;
import com.epmet.dto.form.CustomerFormDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.entity.CustomerEntity;
@ -120,4 +121,13 @@ public interface CustomerService extends BaseService<CustomerEntity> {
* @return
*/
Result<CustomerDTO> getCustomerInfo(CustomerDTO dto);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerDTO>
* @Author yinzuomei
* @Description 根据客户id查询客户信息
* @Date 2020/4/24 9:13
**/
Result<List<CustomerDTO>> queryCustomerList(CustomerFormDTO formDTO);
}

7
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java

@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerDao;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.CustomerFormDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.entity.CustomerEntity;
import com.epmet.redis.CustomerRedis;
@ -135,4 +136,10 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
return new Result<CustomerDTO>().ok(ConvertUtils.sourceToTarget(entity, CustomerDTO.class));
}
@Override
public Result<List<CustomerDTO>> queryCustomerList(CustomerFormDTO formDTO) {
List<CustomerDTO> customerDTOList = baseDao.selectListByIds(formDTO.getCustomerIdList());
return new Result<List<CustomerDTO>>().ok(customerDTOList);
}
}

14
epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml

@ -34,4 +34,18 @@
ORDER BY
CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC
</select>
<!-- 根据客户id查询客户信息 -->
<select id="selectListByIds" parameterType="map" resultType="com.epmet.dto.CustomerDTO">
SELECT
*
FROM
customer c
WHERE
c.DEL_FLAG = '0'
AND c.id IN
<foreach item="customerId" collection="customerIdList" open="(" separator="," close=")">
#{customerId}
</foreach>
</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);
}
}

25
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,14 +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);
/**
* 根据userId查询查询网格下的用户信息
*
* @param customerStaffGridDTOS
* @return
*/
List<StaffGridListDTO> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS);
/**
* 根据用户ID列表获取用户信息
*
* @param fromDTO
* @return
*/
List<StaffInfoResultDTO> selectCustomerStaffList(StaffsInAgencyFromDTO fromDTO);
/**
* @return com.epmet.entity.CustomerStaffEntity

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);
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java

@ -112,7 +112,7 @@ public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl<StaffAgencyVi
@Override
public Result<StaffLatestAgencyResultDTO> getLatestStaffWechatLoginRecord(String openId) {
if (StringUtils.isNotBlank(openId)) {
if (StringUtils.isBlank(openId)) {
logger.error("openId 不能为空");
return new Result();
}

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