账户权限管理

master
Caps 6 years ago
parent 0dba0a246e
commit ecb062597f

@ -7,6 +7,8 @@ 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.OpVipDOMapper;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -29,33 +31,38 @@ public class CustomerService {
private final OpVipDOMapper opVipDOMapper;
private final PoiStoreStaffDOMapper poiStoreStaffDOMapper;
@Autowired
public CustomerService(OpCustomerDOMapper opCustomerDOMapper, OpSellerCustomerRelationDOMapper opSellerCustomerRelationDOMapper, OpVipDOMapper opVipDOMapper) {
public CustomerService(OpCustomerDOMapper opCustomerDOMapper, OpSellerCustomerRelationDOMapper opSellerCustomerRelationDOMapper, OpVipDOMapper opVipDOMapper, PoiStoreStaffDOMapper poiStoreStaffDOMapper) {
this.opCustomerDOMapper = opCustomerDOMapper;
this.opSellerCustomerRelationDOMapper = opSellerCustomerRelationDOMapper;
this.opVipDOMapper = opVipDOMapper;
this.poiStoreStaffDOMapper = poiStoreStaffDOMapper;
}
/**
*
* @param openId openId
* @param sellerId id
* @param shopId id
* @param uniId uniId
* @param staffCode Code
* @Description: id 1. 2.id 3.idvip
*/
@Transactional(rollbackFor = Exception.class)
@Deprecated
public void customerRelation(String openId,long sellerId,long shopId){
QueryWrapper<OpCustomer> wrapper = new QueryWrapper<>();
wrapper.eq("wechat_open_id",openId).last("limit 1");
OpCustomer opCustomer = opCustomerDOMapper.selectOne(wrapper);
public void customerRelation(String uniId,String staffCode){
QueryWrapper<OpCustomer> customerWrapper = new QueryWrapper<>();
customerWrapper.eq("wechat_uni_id",uniId).last("limit 1");
OpCustomer opCustomer = opCustomerDOMapper.selectOne(customerWrapper);
QueryWrapper<PoiStoreStaff> poiWrapper = new QueryWrapper<>();
poiWrapper.eq("staff_code",staffCode).last("limit 1");
PoiStoreStaff poiStoreStaff = poiStoreStaffDOMapper.selectOne(poiWrapper);
if(null != opCustomer){
//存在--1.处理客户导购关系。2.处理客户和vip关系(待定)
sellerCustomerRelation(opCustomer,sellerId,shopId);
sellerCustomerRelation(opCustomer,staffCode,poiStoreStaff.getStoreId(),poiStoreStaff.getUserId());
}else {
//不存在
OpCustomer insertCustomer = new OpCustomer();
insertCustomer.setWechatOpenId(openId);
insertCustomer.setWechatUniId(uniId);
opCustomerDOMapper.insert(insertCustomer);
}
}
@ -88,11 +95,11 @@ public class CustomerService {
/**
*
* @param opCustomer
* @param sellerId id
* @param staffCode Code
*/
private void sellerCustomerRelation(OpCustomer opCustomer,long sellerId,long shopId){
private void sellerCustomerRelation(OpCustomer opCustomer,String staffCode,long shopId,long sellerId){
QueryWrapper<OpSellerCustomerRelation> wrapper1 = new QueryWrapper<>();
wrapper1.eq("customer_id",opCustomer.getId()).eq("user_id",sellerId).eq("store_id",shopId).last("limit 1");
wrapper1.eq("customer_id",opCustomer.getId()).eq("staff_code",staffCode).eq("store_id",shopId).last("limit 1");
OpSellerCustomerRelation opSellerCustomerRelation = opSellerCustomerRelationDOMapper.selectOne(wrapper1);
if(null == opSellerCustomerRelation){
//不存在就添加

Loading…
Cancel
Save