diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml
index a6077f5fa3..aac182bf35 100644
--- a/epmet-module/gov-mine/gov-mine-server/pom.xml
+++ b/epmet-module/gov-mine/gov-mine-server/pom.xml
@@ -73,6 +73,12 @@
2.0.0
compile
+
+ com.epmet
+ epmet-user-client
+ 2.0.0
+ compile
+
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java
index 4ba21fb7be..a4718c4482 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java
+++ b/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> getMyGrids(@LoginUser TokenDto tokenDTO) {
- return staffAgencyService.getMyGrids(tokenDTO);
- }
+ @Autowired
+ private StaffAgencyService staffAgencyService;
+
+ /**
+ * @param tokenDTO
+ * @return
+ * @Description 根据userId查询该用户涉及的所有网格列表
+ * @Author sun
+ */
+ @PostMapping("getmygrids")
+ public Result> getMyGrids(@LoginUser TokenDto tokenDTO) {
+ return staffAgencyService.getMyGrids(tokenDTO);
+ }
+
+ /**
+ * 获取最近一次登录的客户信息
+ *
+ * @param tokenDTO
+ * @return
+ */
+ @PostMapping("getlatestcustomer")
+ public Result getLatestCustomer(@LoginUser TokenDto tokenDTO) {
+ return staffAgencyService.getLatestCustomer(tokenDTO);
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
index 07d46c559d..78f955955d 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
+++ b/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 getLatestCustomer(@PathVariable("userId") String userId);
}
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
index 9c5a63a4fd..dfd80859f3 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
+++ b/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 getLatestCustomer(String userId) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId);
+ }
}
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java
index ae1329232c..589a0ed64e 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java
+++ b/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> getMyGrids(TokenDto tokenDTO);
+
+ /**
+ * 获取最近一次登录的客户信息
+ * @param tokenDTO
+ * @return
+ */
+ Result getLatestCustomer(TokenDto tokenDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java
index c65f231671..5ead6f7e81 100644
--- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java
+++ b/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 getLatestCustomer(TokenDto tokenDTO) {
+ return epmetUserFeignClient.getLatestCustomer(tokenDTO.getUserId());
+ }
+
+
}
\ No newline at end of file
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
index 4beebeae8d..4e683e3ffc 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
@@ -133,4 +133,15 @@ public class CustomerController {
public Result> getValidCustomerList() {
return customerService.getValidCustomerList();
}
+
+ /**
+ * 获取客户信息
+ * @param dto
+ * @return
+ */
+ @PostMapping("getcostomerInfo")
+ public Result getCustomerInfo(@RequestBody CustomerDTO dto) {
+ return customerService.getCustomerInfo(dto);
+ }
+
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
index 1ef60f3762..b36bd6f5b2 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
+++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
@@ -113,4 +113,11 @@ public interface CustomerService extends BaseService {
* @Date 2020/3/18 9:44
**/
Result saveCustomerInfo(CustomerDTO dto);
+
+ /**
+ * 获取客户信息
+ * @param dto
+ * @return
+ */
+ Result getCustomerInfo(CustomerDTO dto);
}
diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
index 512eb55d40..5384193128 100644
--- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
+++ b/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().ok(entity.getId());
}
+ @Override
+ public Result getCustomerInfo(CustomerDTO dto) {
+ CustomerEntity entity = baseDao.selectById(dto.getId());
+ return new Result().ok(ConvertUtils.sourceToTarget(entity, CustomerDTO.class));
+ }
+
}
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java
new file mode 100644
index 0000000000..5bdf00228b
--- /dev/null
+++ b/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;
+}
diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml
index adc3bba016..761a0299a9 100644
--- a/epmet-user/epmet-user-server/pom.xml
+++ b/epmet-user/epmet-user-server/pom.xml
@@ -70,6 +70,12 @@
2.0.0
compile
+
+ com.epmet
+ oper-crm-client
+ 2.0.0
+ compile
+
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java
index 5111dc2a25..73d2ea4d27 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java
+++ b/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;
@@ -34,31 +35,43 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("staffagencyvisited")
public class StaffAgencyVisitedController {
-
- @Autowired
- private StaffAgencyVisitedService staffAgencyVisitedService;
- /**
- * @param openId
- * @return com.epmet.commons.tools.utils.Result
- * @Author yinzuomei
- * @Description 获取当前微信上次登录的账号信息
- * @Date 2020/4/20 12:42
- **/
- @GetMapping(value = "getlatest/{openId}")
- public Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) {
- return staffAgencyVisitedService.getLatestStaffWechatLoginRecord(openId);
- }
+ @Autowired
+ private StaffAgencyVisitedService staffAgencyVisitedService;
- /**
- * @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 openId
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 获取当前微信上次登录的账号信息
+ * @Date 2020/4/20 12:42
+ **/
+ @GetMapping(value = "getlatest/{openId}")
+ public Result 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 userId 参数
+ * @return Result
+ * @author zhaoqifeng
+ */
+ @GetMapping("getlatestcustomer/{userId}")
+ public Result getLatestCustomer(@PathVariable("userId") String userId) {
+ return staffAgencyVisitedService.getLatestCustomer(userId);
+ }
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
index a676eb8a2c..689af6a49b 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
@@ -51,4 +51,6 @@ public interface CustomerStaffDao extends BaseDao {
* @Date 2020/4/20 14:08
**/
CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO);
+
+ CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java
index 189b179f0c..4e55a5e731 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java
@@ -38,4 +38,7 @@ public interface StaffAgencyVisitedDao extends BaseDao
* @Date 2020/4/20 12:45
**/
StaffLatestAgencyResultDTO selectLatestStaffWechatLoginRecord(String openId);
+
+
+ StaffLatestAgencyResultDTO selectLatestCustomer(String userId);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java
new file mode 100644
index 0000000000..9cd6369f4f
--- /dev/null
+++ b/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 getCustomerInfo(@RequestBody CustomerDTO dto);
+}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java
new file mode 100644
index 0000000000..473a1fe64f
--- /dev/null
+++ b/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 getCustomerInfo(CustomerDTO dto) {
+ return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto);
+ }
+}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
index b459bdb83c..12c2c04c52 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
+++ b/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 {
- /**
- * 默认分页
- *
- * @param params
- * @return PageData
- * @author generator
- * @date 2020-04-18
- */
- PageData page(Map params);
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-04-18
+ */
+ PageData page(Map params);
- /**
- * 默认查询
- *
- * @param params
- * @return java.util.List
- * @author generator
- * @date 2020-04-18
- */
- List list(Map params);
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-04-18
+ */
+ List list(Map 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> getCustsomerStaffByPhone(String mobile);
+ /**
+ * @param mobile 手机号
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据手机号查询政府端工作人员基本信息,校验用户是否存在
+ * @Date 2020/4/18 14:07
+ **/
+ Result> getCustsomerStaffByPhone(String mobile);
- /**
- * @param formDTO
- * @return com.epmet.commons.tools.utils.Result
- * @Author yinzuomei
- * @Description 根据手机号+客户id获取工作人员基本信息
- * @Date 2020/4/20 14:05
- **/
- Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO);
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据手机号+客户id获取工作人员基本信息
+ * @Date 2020/4/20 14:05
+ **/
+ Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO);
+
+ /**
+ * 根据用户ID获取工作人员基本信息
+ *
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author zhaoqifeng
+ * @date 2020/4/22 10:05
+ **/
+ Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java
index 4b67657992..d8a3dc064e 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java
+++ b/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 {
- /**
- * 默认分页
- *
- * @param params
- * @return PageData
- * @author generator
- * @date 2020-04-21
- */
- PageData page(Map params);
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-04-21
+ */
+ PageData page(Map params);
- /**
- * 默认查询
- *
- * @param params
- * @return java.util.List
- * @author generator
- * @date 2020-04-21
- */
- List list(Map params);
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-04-21
+ */
+ List list(Map 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
- * @Author yinzuomei
- * @Description 获取当前微信上次登录的账号信息
- * @Date 2020/4/20 12:43
- **/
- Result getLatestStaffWechatLoginRecord(String openId);
+ /**
+ * @param openId
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 获取当前微信上次登录的账号信息
+ * @Date 2020/4/20 12:43
+ **/
+ Result 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 getLatestCustomer(String userId);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
index 9d9e11a64c..e0d2c3ac8f 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
@@ -134,4 +134,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(customerStaffDTO);
}
+ @Override
+ public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) {
+ CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfoByUserId(formDTO);
+ return new Result().ok(customerStaffDTO);
+ }
+
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java
index 399b4c6bf0..5108b1d8a5 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java
+++ b/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 implements StaffAgencyVisitedService {
- private static final Logger logger = LoggerFactory.getLogger(StaffAgencyVisitedServiceImpl.class);
-
- @Override
- public PageData page(Map params) {
- IPage page = baseDao.selectPage(
- getPage(params, FieldConstant.CREATED_TIME, false),
- getWrapper(params)
- );
- return getPageData(page, StaffAgencyVisitedDTO.class);
- }
-
- @Override
- public List list(Map params) {
- List entityList = baseDao.selectList(getWrapper(params));
-
- return ConvertUtils.sourceToTarget(entityList, StaffAgencyVisitedDTO.class);
- }
-
- private QueryWrapper getWrapper(Map params){
- String id = (String)params.get(FieldConstant.ID_HUMP);
-
- QueryWrapper 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 getLatestStaffWechatLoginRecord(String openId) {
- if (StringUtils.isNotBlank(openId)) {
- logger.error("openId 不能为空");
- return new Result();
- }
- StaffLatestAgencyResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId);
- return new Result().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 page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, StaffAgencyVisitedDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, StaffAgencyVisitedDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params) {
+ String id = (String) params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper 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 getLatestStaffWechatLoginRecord(String openId) {
+ if (StringUtils.isNotBlank(openId)) {
+ logger.error("openId 不能为空");
+ return new Result();
+ }
+ StaffLatestAgencyResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId);
+ return new Result().ok(latestStaffWechatLoginDTO);
+ }
+
+ @Override
+ public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO) {
+ StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffAgencyVisitedEntity.class);
+ insert(entity);
+ return new Result();
+ }
+
+ @Override
+ public Result 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 staffInfo =
+ customerStaffService.getCustomerStaffInfoByUserId(customerStaffParam);
+ resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto());
+ //获取客户名称
+ CustomerDTO customerDTO = new CustomerDTO();
+ customerDTO.setId(latestCustomer.getCustomerId());
+ Result customerResult = operCrmFeignClient.getCustomerInfo(customerDTO);
+ resultDTO.setCustomerName(customerResult.getData().getCustomerName());
+ return new Result().ok(resultDTO);
+ }
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
index 3478b0fbba..08b3afb984 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
+++ b/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'
+
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml
index d211f53ac4..82bc2cace3 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml
@@ -35,4 +35,19 @@
sav.CREATED_TIME DESC
LIMIT 1
+
\ No newline at end of file