Browse Source

获取最近一次登录的客户信息

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
74af1354c6
  1. 6
      epmet-module/gov-mine/gov-mine-server/pom.xml
  2. 38
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java
  3. 13
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  4. 8
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
  5. 8
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java
  6. 7
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java
  7. 11
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  8. 7
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
  9. 6
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  10. 31
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java
  11. 6
      epmet-user/epmet-user-server/pom.xml
  12. 61
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java
  13. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  14. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java
  15. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java
  16. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java
  17. 150
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  18. 151
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java
  19. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  20. 172
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java
  21. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
  22. 15
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml

6
epmet-module/gov-mine/gov-mine-server/pom.xml

@ -73,6 +73,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

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

@ -21,6 +21,7 @@ import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.service.StaffAgencyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -38,18 +39,29 @@ import java.util.List;
@RequestMapping("agency")
public class StaffAgencyController {
@Autowired
private StaffAgencyService staffAgencyService;
/**
* @param tokenDTO
* @return
* @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun
*/
@PostMapping("getmygrids")
public Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(@LoginUser TokenDto tokenDTO) {
return staffAgencyService.getMyGrids(tokenDTO);
}
@Autowired
private StaffAgencyService staffAgencyService;
/**
* @param tokenDTO
* @return
* @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun
*/
@PostMapping("getmygrids")
public Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(@LoginUser TokenDto tokenDTO) {
return staffAgencyService.getMyGrids(tokenDTO);
}
/**
* 获取最近一次登录的客户信息
*
* @param tokenDTO
* @return
*/
@PostMapping("getlatestcustomer")
public Result<LatestCustomerResultDTO> getLatestCustomer(@LoginUser TokenDto tokenDTO) {
return staffAgencyService.getLatestCustomer(tokenDTO);
}
}

13
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -1,8 +1,13 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @Description
@ -10,4 +15,12 @@ import org.springframework.cloud.openfeign.FeignClient;
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class)
public interface EpmetUserFeignClient {
/**
* 获取最近一次登录的客户信息
*
* @param userId
* @return
*/
@GetMapping("/epmetuser/staffagencyvisited/getlatestcustomer/{userId}")
Result<LatestCustomerResultDTO> getLatestCustomer(@PathVariable("userId") String userId);
}

8
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java

@ -1,5 +1,9 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
@ -10,4 +14,8 @@ import org.springframework.stereotype.Component;
@Component
public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
@Override
public Result<LatestCustomerResultDTO> getLatestCustomer(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId);
}
}

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

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import java.util.List;
@ -37,4 +38,11 @@ public interface StaffAgencyService {
* @Author sun
*/
Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(TokenDto tokenDTO);
/**
* 获取最近一次登录的客户信息
* @param tokenDTO
* @return
*/
Result<LatestCustomerResultDTO> getLatestCustomer(TokenDto tokenDTO);
}

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

@ -20,6 +20,7 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.StaffAgencyService;
@ -52,4 +53,10 @@ public class StaffAgencyServiceImpl implements StaffAgencyService {
return govOrgFeignClient.getMyGrids(tokenDTO.getUserId());
}
@Override
public Result<LatestCustomerResultDTO> getLatestCustomer(TokenDto tokenDTO) {
return epmetUserFeignClient.getLatestCustomer(tokenDTO.getUserId());
}
}

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

@ -133,4 +133,15 @@ public class CustomerController {
public Result<List<ValidCustomerResultDTO>> getValidCustomerList() {
return customerService.getValidCustomerList();
}
/**
* 获取客户信息
* @param dto
* @return
*/
@PostMapping("getcostomerInfo")
public Result<CustomerDTO> getCustomerInfo(@RequestBody CustomerDTO dto) {
return customerService.getCustomerInfo(dto);
}
}

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

@ -113,4 +113,11 @@ public interface CustomerService extends BaseService<CustomerEntity> {
* @Date 2020/3/18 9:44
**/
Result<String> saveCustomerInfo(CustomerDTO dto);
/**
* 获取客户信息
* @param dto
* @return
*/
Result<CustomerDTO> getCustomerInfo(CustomerDTO dto);
}

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

@ -129,4 +129,10 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
return new Result<String>().ok(entity.getId());
}
@Override
public Result<CustomerDTO> getCustomerInfo(CustomerDTO dto) {
CustomerEntity entity = baseDao.selectById(dto.getId());
return new Result<CustomerDTO>().ok(ConvertUtils.sourceToTarget(entity, CustomerDTO.class));
}
}

31
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/22 9:59
*/
@Data
public class LatestCustomerResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户名称
*/
private String customerName;
/**
* 客户顶级名称
*/
private String agencyId;
/**
* 工作人员头像
*/
private String staffHeadPhoto;
}

6
epmet-user/epmet-user-server/pom.xml

@ -70,6 +70,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-crm-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

61
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java

@ -19,6 +19,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.dto.result.StaffLatestAgencyResultDTO;
import com.epmet.service.StaffAgencyVisitedService;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,30 +36,42 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("staffagencyvisited")
public class StaffAgencyVisitedController {
@Autowired
private StaffAgencyVisitedService staffAgencyVisitedService;
@Autowired
private StaffAgencyVisitedService staffAgencyVisitedService;
/**
* @param openId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.LatestStaffWechatLoginDTO>
* @Author yinzuomei
* @Description 获取当前微信上次登录的账号信息
* @Date 2020/4/20 12:42
**/
@GetMapping(value = "getlatest/{openId}")
public Result<StaffLatestAgencyResultDTO> getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) {
return staffAgencyVisitedService.getLatestStaffWechatLoginRecord(openId);
}
/**
* @param openId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.LatestStaffWechatLoginDTO>
* @Author yinzuomei
* @Description 获取当前微信上次登录的账号信息
* @Date 2020/4/20 12:42
**/
@GetMapping(value = "getlatest/{openId}")
public Result<StaffLatestAgencyResultDTO> getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) {
return staffAgencyVisitedService.getLatestStaffWechatLoginRecord(openId);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 保存登录日志
* @Date 2020/4/20 14:29
**/
@PostMapping(value = "saveStaffLoginRecord")
public Result saveStaffLoginRecord(@RequestBody StaffLoginAgencyRecordFormDTO formDTO) {
return staffAgencyVisitedService.saveStaffLoginRecord(formDTO);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 保存登录日志
* @Date 2020/4/20 14:29
**/
@PostMapping(value = "saveStaffLoginRecord")
public Result saveStaffLoginRecord(@RequestBody StaffLoginAgencyRecordFormDTO formDTO) {
return staffAgencyVisitedService.saveStaffLoginRecord(formDTO);
}
/**
* 获取最近一次登录的客户信息
*
* @param userId 参数
* @return Result
* @author zhaoqifeng
*/
@GetMapping("getlatestcustomer/{userId}")
public Result<LatestCustomerResultDTO> getLatestCustomer(@PathVariable("userId") String userId) {
return staffAgencyVisitedService.getLatestCustomer(userId);
}
}

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

@ -51,4 +51,6 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Date 2020/4/20 14:08
**/
CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO);
CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java

@ -38,4 +38,7 @@ public interface StaffAgencyVisitedDao extends BaseDao<StaffAgencyVisitedEntity>
* @Date 2020/4/20 12:45
**/
StaffLatestAgencyResultDTO selectLatestStaffWechatLoginRecord(String openId);
StaffLatestAgencyResultDTO selectLatestCustomer(String userId);
}

25
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java

@ -0,0 +1,25 @@
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.feign.fallback.OperCrmFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/22 10:41
*/
@FeignClient(name = ServiceConstant.OPER_CRM_SERVER, fallback = OperCrmFeignClientFallBack.class)
public interface OperCrmFeignClient {
/**
* 获取客户信息
* @param dto
* @return
*/
@PostMapping("/oper/crm/customer/getcostomerInfo")
Result<CustomerDTO> getCustomerInfo(@RequestBody CustomerDTO dto);
}

19
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java

@ -0,0 +1,19 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDTO;
import com.epmet.feign.OperCrmFeignClient;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/4/22 10:43
*/
public class OperCrmFeignClientFallBack implements OperCrmFeignClient {
@Override
public Result<CustomerDTO> getCustomerInfo(CustomerDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto);
}
}

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

@ -35,81 +35,91 @@ import java.util.Map;
*/
public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<CustomerStaffDTO>
* @author generator
* @date 2020-04-18
*/
PageData<CustomerStaffDTO> page(Map<String, Object> params);
/**
* 默认分页
*
* @param params
* @return PageData<CustomerStaffDTO>
* @author generator
* @date 2020-04-18
*/
PageData<CustomerStaffDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CustomerStaffDTO>
* @author generator
* @date 2020-04-18
*/
List<CustomerStaffDTO> list(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CustomerStaffDTO>
* @author generator
* @date 2020-04-18
*/
List<CustomerStaffDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return CustomerStaffDTO
* @author generator
* @date 2020-04-18
*/
CustomerStaffDTO get(String id);
/**
* 单条查询
*
* @param id
* @return CustomerStaffDTO
* @author generator
* @date 2020-04-18
*/
CustomerStaffDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-04-18
*/
void save(CustomerStaffDTO dto);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-04-18
*/
void save(CustomerStaffDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-04-18
*/
void update(CustomerStaffDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-04-18
*/
void update(CustomerStaffDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-04-18
*/
void delete(String[] ids);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-04-18
*/
void delete(String[] ids);
/**
* @param mobile 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据手机号查询政府端工作人员基本信息校验用户是否存在
* @Date 2020/4/18 14:07
**/
Result<List<CustomerStaffDTO>> getCustsomerStaffByPhone(String mobile);
/**
* @param mobile 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据手机号查询政府端工作人员基本信息校验用户是否存在
* @Date 2020/4/18 14:07
**/
Result<List<CustomerStaffDTO>> getCustsomerStaffByPhone(String mobile);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerStaffDTO>
* @Author yinzuomei
* @Description 根据手机号+客户id获取工作人员基本信息
* @Date 2020/4/20 14:05
**/
Result<CustomerStaffDTO> getCustomerStaffInfo(CustomerStaffFormDTO formDTO);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerStaffDTO>
* @Author yinzuomei
* @Description 根据手机号+客户id获取工作人员基本信息
* @Date 2020/4/20 14:05
**/
Result<CustomerStaffDTO> getCustomerStaffInfo(CustomerStaffFormDTO formDTO);
/**
* 根据用户ID获取工作人员基本信息
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerStaffDTO>
* @author zhaoqifeng
* @date 2020/4/22 10:05
**/
Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO);
}

151
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java

@ -19,9 +19,11 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StaffAgencyVisitedDTO;
import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.dto.result.StaffLatestAgencyResultDTO;
import com.epmet.entity.StaffAgencyVisitedEntity;
@ -36,81 +38,90 @@ import java.util.Map;
*/
public interface StaffAgencyVisitedService extends BaseService<StaffAgencyVisitedEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<StaffAgencyVisitedDTO>
* @author generator
* @date 2020-04-21
*/
PageData<StaffAgencyVisitedDTO> page(Map<String, Object> params);
/**
* 默认分页
*
* @param params
* @return PageData<StaffAgencyVisitedDTO>
* @author generator
* @date 2020-04-21
*/
PageData<StaffAgencyVisitedDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<StaffAgencyVisitedDTO>
* @author generator
* @date 2020-04-21
*/
List<StaffAgencyVisitedDTO> list(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<StaffAgencyVisitedDTO>
* @author generator
* @date 2020-04-21
*/
List<StaffAgencyVisitedDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return StaffAgencyVisitedDTO
* @author generator
* @date 2020-04-21
*/
StaffAgencyVisitedDTO get(String id);
/**
* 单条查询
*
* @param id
* @return StaffAgencyVisitedDTO
* @author generator
* @date 2020-04-21
*/
StaffAgencyVisitedDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-04-21
*/
void save(StaffAgencyVisitedDTO dto);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-04-21
*/
void save(StaffAgencyVisitedDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-04-21
*/
void update(StaffAgencyVisitedDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-04-21
*/
void update(StaffAgencyVisitedDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-04-21
*/
void delete(String[] ids);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-04-21
*/
void delete(String[] ids);
/**
* @param openId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.LatestStaffWechatLoginDTO>
* @Author yinzuomei
* @Description 获取当前微信上次登录的账号信息
* @Date 2020/4/20 12:43
**/
Result<StaffLatestAgencyResultDTO> getLatestStaffWechatLoginRecord(String openId);
/**
* @param openId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.LatestStaffWechatLoginDTO>
* @Author yinzuomei
* @Description 获取当前微信上次登录的账号信息
* @Date 2020/4/20 12:43
**/
Result<StaffLatestAgencyResultDTO> getLatestStaffWechatLoginRecord(String openId);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 保存登录日志
* @Date 2020/4/20 14:33
**/
Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 保存登录日志
* @Date 2020/4/20 14:33
**/
Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO);
/**
* 获取最近一次登录的客户信息
*
* @param userId 参数
* @return Result
* @author zhaoqifeng
*/
Result<LatestCustomerResultDTO> getLatestCustomer(String userId);
}

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

@ -134,4 +134,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return new Result<CustomerStaffDTO>().ok(customerStaffDTO);
}
@Override
public Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) {
CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfoByUserId(formDTO);
return new Result<CustomerStaffDTO>().ok(customerStaffDTO);
}
}

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

@ -22,17 +22,24 @@ 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.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.StaffAgencyVisitedDao;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.StaffAgencyVisitedDTO;
import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.dto.result.StaffLatestAgencyResultDTO;
import com.epmet.entity.StaffAgencyVisitedEntity;
import com.epmet.feign.OperCrmFeignClient;
import com.epmet.service.CustomerStaffService;
import com.epmet.service.StaffAgencyVisitedService;
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;
@ -48,74 +55,99 @@ import java.util.Map;
*/
@Service
public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl<StaffAgencyVisitedDao, StaffAgencyVisitedEntity> implements StaffAgencyVisitedService {
private static final Logger logger = LoggerFactory.getLogger(StaffAgencyVisitedServiceImpl.class);
@Override
public PageData<StaffAgencyVisitedDTO> page(Map<String, Object> params) {
IPage<StaffAgencyVisitedEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, StaffAgencyVisitedDTO.class);
}
@Override
public List<StaffAgencyVisitedDTO> list(Map<String, Object> params) {
List<StaffAgencyVisitedEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, StaffAgencyVisitedDTO.class);
}
private QueryWrapper<StaffAgencyVisitedEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<StaffAgencyVisitedEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public StaffAgencyVisitedDTO get(String id) {
StaffAgencyVisitedEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, StaffAgencyVisitedDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(StaffAgencyVisitedDTO dto) {
StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(StaffAgencyVisitedDTO dto) {
StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public Result<StaffLatestAgencyResultDTO> getLatestStaffWechatLoginRecord(String openId) {
if (StringUtils.isNotBlank(openId)) {
logger.error("openId 不能为空");
return new Result();
}
StaffLatestAgencyResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId);
return new Result<StaffLatestAgencyResultDTO>().ok(latestStaffWechatLoginDTO);
}
@Override
public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO) {
StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffAgencyVisitedEntity.class);
insert(entity);
return new Result();
}
private static final Logger logger = LoggerFactory.getLogger(StaffAgencyVisitedServiceImpl.class);
@Autowired
private CustomerStaffService customerStaffService;
@Autowired
private OperCrmFeignClient operCrmFeignClient;
@Override
public PageData<StaffAgencyVisitedDTO> page(Map<String, Object> params) {
IPage<StaffAgencyVisitedEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, StaffAgencyVisitedDTO.class);
}
@Override
public List<StaffAgencyVisitedDTO> list(Map<String, Object> params) {
List<StaffAgencyVisitedEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, StaffAgencyVisitedDTO.class);
}
private QueryWrapper<StaffAgencyVisitedEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<StaffAgencyVisitedEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public StaffAgencyVisitedDTO get(String id) {
StaffAgencyVisitedEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, StaffAgencyVisitedDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(StaffAgencyVisitedDTO dto) {
StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(StaffAgencyVisitedDTO dto) {
StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public Result<StaffLatestAgencyResultDTO> getLatestStaffWechatLoginRecord(String openId) {
if (StringUtils.isNotBlank(openId)) {
logger.error("openId 不能为空");
return new Result();
}
StaffLatestAgencyResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId);
return new Result<StaffLatestAgencyResultDTO>().ok(latestStaffWechatLoginDTO);
}
@Override
public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO) {
StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffAgencyVisitedEntity.class);
insert(entity);
return new Result();
}
@Override
public Result<LatestCustomerResultDTO> getLatestCustomer(String userId) {
LatestCustomerResultDTO resultDTO = new LatestCustomerResultDTO();
StaffLatestAgencyResultDTO latestCustomer = baseDao.selectLatestCustomer(userId);
resultDTO.setAgencyId(latestCustomer.getAgencyId());
resultDTO.setCustomerId(latestCustomer.getCustomerId());
//获取工作人员头像
CustomerStaffDTO customerStaffParam = new CustomerStaffDTO();
customerStaffParam.setUserId(userId);
Result<CustomerStaffDTO> staffInfo =
customerStaffService.getCustomerStaffInfoByUserId(customerStaffParam);
resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto());
//获取客户名称
CustomerDTO customerDTO = new CustomerDTO();
customerDTO.setId(latestCustomer.getCustomerId());
Result<CustomerDTO> customerResult = operCrmFeignClient.getCustomerInfo(customerDTO);
resultDTO.setCustomerName(customerResult.getData().getCustomerName());
return new Result<LatestCustomerResultDTO>().ok(resultDTO);
}
}

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

@ -18,4 +18,9 @@
and cs.CUSTOMER_ID=#{customerId}
and cs.DEL_FLAG='1'
</select>
<select id="selectStaffInfoByUserId" parameterType="com.epmet.dto.CustomerStaffDTO" resultType="com.epmet.dto.CustomerStaffDTO">
select * from customer_staff cs
where cs.USER_ID=#{userId}
and cs.DEL_FLAG='0'
</select>
</mapper>

15
epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml

@ -35,4 +35,19 @@
sav.CREATED_TIME DESC
LIMIT 1
</select>
<select id="selectLatestCustomer" parameterType="java.lang.String"
resultType="com.epmet.dto.result.StaffLatestAgencyResultDTO">
SELECT
sav.CUSTOMER_ID,
sav.STAFF_ID,
sav.AGENCY_ID
FROM
staff_agency_visited sav
WHERE
sav.DEL_FLAG = '0'
AND sav.STAFF_ID =#{userId}
ORDER BY
sav.CREATED_TIME DESC
LIMIT 1
</select>
</mapper>
Loading…
Cancel
Save