客户扫码关联关系

master
Caps 6 years ago
parent 95b336ef50
commit 8935277b33

@ -3,8 +3,11 @@ package com.kiisoo.ic.customer;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kiisoo.ic.customer.entity.OpCustomer;
import com.kiisoo.ic.customer.entity.OpSellerCustomerRelation;
import com.kiisoo.ic.customer.entity.OpVip;
import com.kiisoo.ic.customer.mapper.OpCustomerDOMapper;
import com.kiisoo.ic.customer.mapper.OpSellerCustomerRelationDOMapper;
import com.kiisoo.ic.customer.mapper.OpVipAttrDOMapper;
import com.kiisoo.ic.customer.mapper.OpVipDOMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -25,24 +28,30 @@ public class CustomerService {
private final OpSellerCustomerRelationDOMapper opSellerCustomerRelationDOMapper;
private final OpVipDOMapper opVipDOMapper;
private final OpVipAttrDOMapper opVipAttrDOMapper;
@Autowired
public CustomerService(OpCustomerDOMapper opCustomerDOMapper, OpSellerCustomerRelationDOMapper opSellerCustomerRelationDOMapper) {
public CustomerService(OpCustomerDOMapper opCustomerDOMapper, OpSellerCustomerRelationDOMapper opSellerCustomerRelationDOMapper, OpVipDOMapper opVipDOMapper, OpVipAttrDOMapper opVipAttrDOMapper) {
this.opCustomerDOMapper = opCustomerDOMapper;
this.opSellerCustomerRelationDOMapper = opSellerCustomerRelationDOMapper;
this.opVipDOMapper = opVipDOMapper;
this.opVipAttrDOMapper = opVipAttrDOMapper;
}
/**
*
* @param phone
* @param openId openId
* @param sellerId id
* @param shopId id
* @Description: id 1. 2.id 3.idvip
*/
@Transactional(rollbackFor = Exception.class)
@Deprecated
public void customerRelation(String phone,long sellerId,long shopId){
public void customerRelation(String openId,long sellerId,long shopId){
QueryWrapper<OpCustomer> wrapper = new QueryWrapper<>();
wrapper.eq("phone",phone).last("limit 1");
wrapper.eq("wechat_open_id",openId).last("limit 1");
OpCustomer opCustomer = opCustomerDOMapper.selectOne(wrapper);
if(null != opCustomer){
//存在--1.处理客户导购关系。2.处理客户和vip关系(待定)
@ -50,11 +59,35 @@ public class CustomerService {
}else {
//不存在
OpCustomer insertCustomer = new OpCustomer();
insertCustomer.setPhone(phone);
insertCustomer.setWechatOpenId(openId);
opCustomerDOMapper.insert(insertCustomer);
}
}
/**
* /vipVIP
* @param openId
* @param name
* @param phone
* @param desc
* @param mail
* @param type
*/
@Transactional(rollbackFor = Exception.class)
public void customerVipRelation(String openId,String name,String phone,String desc,String mail,long type){
OpCustomer opCustomer = new OpCustomer(type,name,phone,desc,mail,new Date(),new Date());
QueryWrapper<OpVip> wrapper = new QueryWrapper<>();
wrapper.eq("phone",phone).last("limit 1");
OpVip opVip = opVipDOMapper.selectOne(wrapper);
if(null != opVip){
//有vip信息就绑定信息
opCustomer.setMemberId(opVip.getId());
}
QueryWrapper<OpCustomer> wrapper1 = new QueryWrapper<>();
wrapper1.eq("wechat_open_id",openId);
opCustomerDOMapper.update(opCustomer,wrapper1);
}
/**
*
* @param opCustomer

@ -15,6 +15,19 @@ import java.util.Date;
@TableName ("op_customer")
public class OpCustomer {
public OpCustomer() {
}
public OpCustomer(Long type, String name, String phone, String desc, String mail, Date createTime, Date updateTime) {
this.type = type;
this.name = name;
this.phone = phone;
this.desc = desc;
this.mail = mail;
this.createTime = createTime;
this.updateTime = updateTime;
}
/**
* ID
*/

@ -0,0 +1,13 @@
package com.kiisoo.ic.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.customer.entity.OpVipAttr;
import org.springframework.stereotype.Repository;
/**
* vip
*/
@Repository
public interface OpVipAttrDOMapper extends BaseMapper<OpVipAttr> {
}

@ -0,0 +1,14 @@
package com.kiisoo.ic.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.customer.entity.OpVip;
import com.kiisoo.ic.customer.entity.OpVipAttr;
import org.springframework.stereotype.Repository;
/**
* vip
*/
@Repository
public interface OpVipDOMapper extends BaseMapper<OpVip> {
}
Loading…
Cancel
Save