|
|
|
@ -38,7 +38,6 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
@ -162,6 +161,7 @@ public class CustomerService {
|
|
|
|
|
* @param turnBackDTOS 数据实体
|
|
|
|
|
* @return 是否成功
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void turnBack(TurnBackDTO turnBackDTOS) throws Exception {
|
|
|
|
|
if (turnBackDTOS.getWxData().getUnionId() == null || turnBackDTOS.getUserId() == null) {
|
|
|
|
|
return;
|
|
|
|
@ -189,13 +189,6 @@ public class CustomerService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//做插入使用 --如果没有客户信息就先创建客户信息如果有就判断是否有客户导购得关系,如果没有就添加有就不管
|
|
|
|
|
vipDataUpdate(turnBackDTOS, shop, opCustomer, poiStoreStaff, poiStore);
|
|
|
|
|
//todo 发送websocket放开
|
|
|
|
|
// WebSocketController.sendInfo(new Gson().toJson(insertCustomer));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void vipDataUpdate(TurnBackDTO turnBackDTOS, PoiStore shop, OpCustomer opCustomer, PoiStoreStaff poiStoreStaff, PrivilageCpUserStoreDO poiStore) throws Exception {
|
|
|
|
|
OpCustomer insertCustomer = new OpCustomer();
|
|
|
|
|
insertCustomer.setWechatUniId(turnBackDTOS.getWxData().getUnionId());
|
|
|
|
|
insertCustomer.setName(turnBackDTOS.getName());
|
|
|
|
@ -212,23 +205,22 @@ public class CustomerService {
|
|
|
|
|
try {
|
|
|
|
|
opCustomerDOMapper.updateById(insertCustomer);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
System.out.println(insertCustomer.toString());
|
|
|
|
|
log.error(insertCustomer.toString(),e);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (poiStoreStaff != null) {
|
|
|
|
|
//存在--1.处理客户导购关系。
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
sellerCustomerRelation(opCustomer, turnBackDTOS.getEaCode(),sdf.parse(turnBackDTOS.getJoinTime()), poiStore.getStoreId(), poiStoreStaff.getId());
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
System.out.println(opCustomer.toString());
|
|
|
|
|
log.error(opCustomer.toString(),e);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
storeCustomerRelation(opCustomer,sdf.parse(turnBackDTOS.getJoinTime()), poiStore.getStoreId());
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
System.out.println(opCustomer.toString());
|
|
|
|
|
log.error(opCustomer.toString(),e);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -238,7 +230,7 @@ public class CustomerService {
|
|
|
|
|
try {
|
|
|
|
|
opCustomerDOMapper.insert(insertCustomer);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
System.out.println(insertCustomer.toString());
|
|
|
|
|
log.error(insertCustomer.toString(),e);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -247,14 +239,14 @@ public class CustomerService {
|
|
|
|
|
try {
|
|
|
|
|
sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(),sdf.parse(turnBackDTOS.getJoinTime()), poiStore.getStoreId(), poiStoreStaff.getId());
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
System.out.println(insertCustomer.toString());
|
|
|
|
|
log.error(insertCustomer.toString(),e);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
storeCustomerRelation(insertCustomer, sdf.parse(turnBackDTOS.getJoinTime()),poiStore.getStoreId());
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
System.out.println(insertCustomer.toString());
|
|
|
|
|
log.error(insertCustomer.toString(),e);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -265,6 +257,8 @@ public class CustomerService {
|
|
|
|
|
//有vip数据就不需要重新请求bsd的vip接口
|
|
|
|
|
vipCheck(turnBackDTOS);
|
|
|
|
|
}
|
|
|
|
|
//todo 发送websocket放开
|
|
|
|
|
// WebSocketController.sendInfo(new Gson().toJson(insertCustomer));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|