|
|
@ -165,7 +165,6 @@ public class CustomerService {
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public void turnBack(TurnBackDTO turnBackDTOS) throws Exception {
|
|
|
|
public void turnBack(TurnBackDTO turnBackDTOS) throws Exception {
|
|
|
|
if (turnBackDTOS.getWxData().getUnionId() == null || turnBackDTOS.getUserId() == null) {
|
|
|
|
if (turnBackDTOS.getWxData().getUnionId() == null || turnBackDTOS.getUserId() == null) {
|
|
|
|
log.info("unionId 是空不操作");
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//客户信息
|
|
|
|
//客户信息
|
|
|
@ -175,12 +174,10 @@ public class CustomerService {
|
|
|
|
//店铺信息
|
|
|
|
//店铺信息
|
|
|
|
PrivilageCpUserStoreDO poiStore = privilageCpUserStoreDOMapper.selectOneCpUser(turnBackDTOS.getUserId());
|
|
|
|
PrivilageCpUserStoreDO poiStore = privilageCpUserStoreDOMapper.selectOneCpUser(turnBackDTOS.getUserId());
|
|
|
|
if (poiStore == null) {
|
|
|
|
if (poiStore == null) {
|
|
|
|
log.info("店铺信息是空的不操作");
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PoiStoreStaff poiStoreStaff = null;
|
|
|
|
PoiStoreStaff poiStoreStaff = null;
|
|
|
|
if (!turnBackDTOS.getEaCode().equals("") && !turnBackDTOS.getEaCode().equals("0")) {
|
|
|
|
if (!turnBackDTOS.getEaCode().equals("") && !turnBackDTOS.getEaCode().equals("0")) {
|
|
|
|
log.info("导购code如果是0或者是空,不处理导购信息");
|
|
|
|
|
|
|
|
//导购信息
|
|
|
|
//导购信息
|
|
|
|
QueryWrapper<PoiStoreStaff> wrapper = new QueryWrapper<>();
|
|
|
|
QueryWrapper<PoiStoreStaff> wrapper = new QueryWrapper<>();
|
|
|
|
wrapper.eq("staff_code", turnBackDTOS.getEaCode()).eq("store_id", poiStore.getStoreId()).last("limit 1");
|
|
|
|
wrapper.eq("staff_code", turnBackDTOS.getEaCode()).eq("store_id", poiStore.getStoreId()).last("limit 1");
|
|
|
@ -194,7 +191,6 @@ public class CustomerService {
|
|
|
|
insertCustomer.setAvatarUrl(turnBackDTOS.getWxData().getAvatarUrl());
|
|
|
|
insertCustomer.setAvatarUrl(turnBackDTOS.getWxData().getAvatarUrl());
|
|
|
|
insertCustomer.setPhone(turnBackDTOS.getPhone());
|
|
|
|
insertCustomer.setPhone(turnBackDTOS.getPhone());
|
|
|
|
if (null != opCustomer) {
|
|
|
|
if (null != opCustomer) {
|
|
|
|
log.info("客户信息存在就修改");
|
|
|
|
|
|
|
|
//更新一下
|
|
|
|
//更新一下
|
|
|
|
insertCustomer.setId(opCustomer.getId());
|
|
|
|
insertCustomer.setId(opCustomer.getId());
|
|
|
|
opCustomerDOMapper.updateById(insertCustomer);
|
|
|
|
opCustomerDOMapper.updateById(insertCustomer);
|
|
|
@ -205,12 +201,10 @@ public class CustomerService {
|
|
|
|
storeCustomerRelation(opCustomer, poiStore.getStoreId());
|
|
|
|
storeCustomerRelation(opCustomer, poiStore.getStoreId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.info("客户信息不存在在就新增");
|
|
|
|
|
|
|
|
insertCustomer.setCreateBy(Constants.SYS_OPERATION);
|
|
|
|
insertCustomer.setCreateBy(Constants.SYS_OPERATION);
|
|
|
|
//不存在
|
|
|
|
//不存在
|
|
|
|
opCustomerDOMapper.insert(insertCustomer);
|
|
|
|
opCustomerDOMapper.insert(insertCustomer);
|
|
|
|
if (poiStoreStaff != null) {
|
|
|
|
if (poiStoreStaff != null) {
|
|
|
|
log.info("导购的信息没有就不添加导购客户的关系");
|
|
|
|
|
|
|
|
//添加关系
|
|
|
|
//添加关系
|
|
|
|
sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getUserId());
|
|
|
|
sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getUserId());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -220,7 +214,6 @@ public class CustomerService {
|
|
|
|
|
|
|
|
|
|
|
|
//处理客户vip的关系
|
|
|
|
//处理客户vip的关系
|
|
|
|
if (turnBackDTOS.getVipData() != null) {
|
|
|
|
if (turnBackDTOS.getVipData() != null) {
|
|
|
|
log.info("如果有vip数据就认为是vip客户然后绑定客户vip关系");
|
|
|
|
|
|
|
|
//有vip数据就不需要重新请求bsd的vip接口
|
|
|
|
//有vip数据就不需要重新请求bsd的vip接口
|
|
|
|
vipCheck(turnBackDTOS);
|
|
|
|
vipCheck(turnBackDTOS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|