Commit 2f3b78c7 by 王祖波

实时获取当前未建联数

parent ba88fada
......@@ -236,6 +236,7 @@
<dubbo:reference interface="com.gic.store.goods.service.GoodsInfoOutApiService" id="goodsInfoOutApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.store.goods.service.GoodsCenterApiService" id="goodsCenterApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.store.goods.service.StoreGoodsService" id="storeGoodsService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.store.goods.service.potential.PlatformPotentialCustomerApiService" id="platformPotentialCustomerApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.business.order.service.ordermanage.OrderInfoOutApiService" id="orderInfoOutApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.orderecommerce.api.service.EcommerceOrderOutputApiService" id="ecommerceOrderOutputApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.order.api.service.sharding.OrderApiService" id="orderApiService" timeout="10000" retries="0" check="false"/>
......
......@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller.potential;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Pair;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
......@@ -9,6 +10,11 @@ import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.haoban.app.customer.dto.CustomerDTO;
import com.gic.haoban.app.customer.dto.MemberInfoListParamsDTO;
import com.gic.haoban.app.customer.dto.contact.ContactParamDTO;
import com.gic.haoban.app.customer.dto.contact.ContactSumDTO;
import com.gic.haoban.app.customer.service.api.service.CustomerApiService;
import com.gic.haoban.manage.api.dto.contact.ContactOrderDetailDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactOrderSearchQDTO;
import com.gic.haoban.manage.api.service.contact.ContactOrderApiService;
......@@ -19,6 +25,8 @@ import com.gic.haoban.manage.web.qo.potential.*;
import com.gic.haoban.manage.web.utils.EsMemberInfoUtils;
import com.gic.haoban.manage.web.utils.storestatusfilter.StoreStatusFilterUtils;
import com.gic.haoban.manage.web.vo.potential.*;
import com.gic.store.goods.dto.potential.PlatformPotentialCustomerOutDTO;
import com.gic.store.goods.service.potential.PlatformPotentialCustomerApiService;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
......@@ -48,6 +56,10 @@ public class PotentialDataController {
private PotentialDataAdaptor potentialDataAdaptor;
@Autowired
private EsMemberInfoUtils esMemberInfoUtils;
@Autowired
private PlatformPotentialCustomerApiService platformPotentialCustomerApiService;
@Autowired
private CustomerApiService customerService;
/**
* 分页查询转化记录
......@@ -165,6 +177,12 @@ public class PotentialDataController {
*/
@RequestMapping(path = "/potential/contact-detail")
public RestResponse<Page<PotentialContactDetailOverviewVO>> queryPotentialContactReport(@RequestBody PotentialContactOverviewQO potentialOverviewQO) {
String enterpriseId = potentialOverviewQO.getEnterpriseId();
String wxEnterpriseId = potentialOverviewQO.getWxEnterpriseId();
ServiceResponse<PlatformPotentialCustomerOutDTO> potentialResponse = platformPotentialCustomerApiService.getPotentialCustomerOutRule(enterpriseId);
if (!potentialResponse.isSuccess() || potentialResponse.getResult() == null) {
return RestResponse.successResult(new Page<>());
}
List<String> storeIds = getStoreIds(potentialOverviewQO).getValue();
Page<PotentialContactOverviewVO> page = potentialDataAdaptor.pagePotentialContactOverview(potentialOverviewQO, storeIds);
List<PotentialContactOverviewVO> result = page.getResult();
......@@ -174,8 +192,13 @@ public class PotentialDataController {
Map<String, ClerkDTO> clerkMap = pair.getKey();
Map<String, StoreDTO> storeMap = pair.getValue();
list = result.stream().map(x -> {
ClerkDTO clerkDTO = clerkMap.getOrDefault(x.getClerkId(), new ClerkDTO());
StoreDTO storeDTO = storeMap.getOrDefault(x.getStoreId(), new StoreDTO());
ClerkDTO clerkDTO = clerkMap.get(x.getClerkId());
StoreDTO storeDTO = storeMap.get(x.getStoreId());
// 实时获取当前未建联数 todo
Integer potCusNum = getPotCusNum(potentialResponse, enterpriseId, wxEnterpriseId, storeDTO.getStoreId(), clerkDTO);
x.setPotCusNum(potCusNum);
PotentialContactDetailOverviewVO overviewVO = new PotentialContactDetailOverviewVO();
overviewVO.setContact(x);
overviewVO.setStore(storeDTO);
......@@ -192,6 +215,31 @@ public class PotentialDataController {
return RestResponse.successResult(res);
}
private Integer getPotCusNum(ServiceResponse<PlatformPotentialCustomerOutDTO> potentialResponse, String enterpriseId,String wxEnterpriseId,String storeId,ClerkDTO clerkDTO) {
if (StringUtils.isBlank(storeId) && clerkDTO == null) {
return 0;
}
CustomerDTO params = new CustomerDTO();
String clerkId = null;
if (clerkDTO != null) {
clerkId = clerkDTO.getClerkId();
Integer clerkType = clerkDTO.getClerkType();
if (clerkType == 0 || clerkType == 1) {
storeId = clerkDTO.getStoreId();
}
}
ContactParamDTO contact = new ContactParamDTO();
contact.setRuleJSON(JSON.toJSONString(potentialResponse.getResult()));
contact.setContactType(0);
params.setStoreId(storeId);
params.setClerkId(clerkId);
params.setEnterpriseId(enterpriseId);
params.setWxEnterpriseId(wxEnterpriseId);
params.setContactParamDTO(contact);
ServiceResponse<ContactSumDTO> noContactResponse = customerService.contactMemberSum(new com.gic.haoban.base.api.common.BasePageInfo(), params, new MemberInfoListParamsDTO());
return noContactResponse.getResult() != null ? noContactResponse.getResult().getTotalCount() : 0;
}
/**
* 转化明细概览 周/月报
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment