|
|
|
@ -199,7 +199,9 @@ public class CustomerService {
|
|
|
|
|
opCustomerDOMapper.updateById(insertCustomer);
|
|
|
|
|
if(poiStoreStaff != null){
|
|
|
|
|
//存在--1.处理客户导购关系。
|
|
|
|
|
sellerCustomerRelation(opCustomer,turnBackDTOS.getEaCode(),poiStore.getId(),poiStoreStaff.getUserId());
|
|
|
|
|
sellerCustomerRelation(opCustomer,turnBackDTOS.getEaCode(),poiStore.getStoreId(),poiStoreStaff.getUserId());
|
|
|
|
|
}else {
|
|
|
|
|
storeCustomerRelation(opCustomer,poiStore.getStoreId());
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
log.info("客户信息不存在在就新增");
|
|
|
|
@ -209,7 +211,9 @@ public class CustomerService {
|
|
|
|
|
if(poiStoreStaff != null) {
|
|
|
|
|
log.info("导购的信息没有就不添加导购客户的关系");
|
|
|
|
|
//添加关系
|
|
|
|
|
sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(), poiStore.getId(), poiStoreStaff.getUserId());
|
|
|
|
|
sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getUserId());
|
|
|
|
|
}else {
|
|
|
|
|
storeCustomerRelation(opCustomer,poiStore.getStoreId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -301,6 +305,35 @@ public class CustomerService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void storeCustomerRelation(OpCustomer opCustomer,long shopId){
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper1 = new QueryWrapper<>();
|
|
|
|
|
wrapper1.eq("customer_id",opCustomer.getId()).eq("store_id",shopId).last("limit 1");
|
|
|
|
|
OpSellerCustomerRelation opSellerCustomerRelation = opSellerCustomerRelationDOMapper.selectOne(wrapper1);
|
|
|
|
|
if(null == opSellerCustomerRelation){
|
|
|
|
|
//不存在就添加
|
|
|
|
|
OpSellerCustomerRelation insertRelation = new OpSellerCustomerRelation();
|
|
|
|
|
insertRelation.setCreateTime(new Date());
|
|
|
|
|
insertRelation.setUpdateTime(new Date());
|
|
|
|
|
insertRelation.setCustomerId(opCustomer.getId());
|
|
|
|
|
insertRelation.setStoreId(shopId);
|
|
|
|
|
insertRelation.setCreateBy(Constants.SYS_OPERATION);
|
|
|
|
|
insertRelation.setUpdateBy(Constants.SYS_OPERATION);
|
|
|
|
|
|
|
|
|
|
//判断是否有效
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.eq("customer_id",opCustomer.getId()).last("limit 1");
|
|
|
|
|
OpSellerCustomerRelation op = opSellerCustomerRelationDOMapper.selectOne(wrapper);
|
|
|
|
|
if(op == null){
|
|
|
|
|
//有效
|
|
|
|
|
insertRelation.setType(1);
|
|
|
|
|
}else {
|
|
|
|
|
//无效
|
|
|
|
|
insertRelation.setType(2);
|
|
|
|
|
}
|
|
|
|
|
opSellerCustomerRelationDOMapper.insert(insertRelation);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据店铺id找到顾客信息
|
|
|
|
|
* @param shopIds
|
|
|
|
|