添加活动回调代码。

dev_0531
kevin jiang 5 years ago
parent 561ae5f9b2
commit 8b6a17077f

@ -147,4 +147,15 @@ public class Constants {
public static final String CODE_STORE_STAFF_HAS = "3007"; public static final String CODE_STORE_STAFF_HAS = "3007";
/**
*
*/
public static final String ACTIVITY_QR_CODE_PREFIX = "pmn";
/**
* 线
*/
public static final String LINE = "_";
} }

@ -43,6 +43,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -174,6 +175,36 @@ public class CustomerService {
* @return * @return
*/ */
public void turnBack(TurnBackDTO turnBackDTOS) throws Exception { public void turnBack(TurnBackDTO turnBackDTOS) throws Exception {
String eaCode = turnBackDTOS.getEaCode();
// 判断是否是活动扫码
if(eaCode.contains(Constants.ACTIVITY_QR_CODE_PREFIX)){
// 活动码处理
handleActivity(turnBackDTOS, eaCode);
}else{
// 导购码处理
handleCustomer(turnBackDTOS);
}
}
/**
*
* @param turnBackDTOS
* @param eaCode state
*/
private void handleActivity(TurnBackDTO turnBackDTOS, String eaCode){
String[] strArr = eaCode.split(Constants.LINE);
Long instanceId = Long.parseLong(strArr[1]);
int type = Integer.parseInt(strArr[2]);
Long promoterId = Long.parseLong(strArr[3]);
// 处理逻辑
}
/**
*
* @param turnBackDTOS
*/
private void handleCustomer(TurnBackDTO turnBackDTOS) throws Exception {
OpCustomer opCustomer = null; OpCustomer opCustomer = null;
if (turnBackDTOS.getWxData().getUnionId() == null && turnBackDTOS.getWxData().getUserId() != null) { if (turnBackDTOS.getWxData().getUnionId() == null && turnBackDTOS.getWxData().getUserId() != null) {
//此时说明是企业微信扫码添加 //此时说明是企业微信扫码添加
@ -186,6 +217,7 @@ public class CustomerService {
customerWrapper.eq("wechat_uni_id", turnBackDTOS.getWxData().getUnionId()).last("limit 1"); customerWrapper.eq("wechat_uni_id", turnBackDTOS.getWxData().getUnionId()).last("limit 1");
opCustomer = opCustomerDOMapper.selectOne(customerWrapper); opCustomer = opCustomerDOMapper.selectOne(customerWrapper);
}else{ }else{
log.error("turn back error: " + turnBackDTOS.toString());
return; return;
} }
@ -283,8 +315,6 @@ public class CustomerService {
//有vip数据就不需要重新请求bsd的vip接口 //有vip数据就不需要重新请求bsd的vip接口
vipCheck(turnBackDTOS); vipCheck(turnBackDTOS);
} }
//todo 发送websocket放开
// WebSocketController.sendInfo(new Gson().toJson(insertCustomer));
} }
/** /**

@ -85,6 +85,11 @@ public class Constants {
*/ */
public static final String BSD_REQ_QRCODE_TYPE_SELLER = "1"; public static final String BSD_REQ_QRCODE_TYPE_SELLER = "1";
/**
*
*/
public static final String BSD_REQ_QRCODE_TYPE_ACTIVITY = "2";
/** /**
* 0 * 0
*/ */

@ -1361,4 +1361,21 @@ public class StoreEmployeeService {
return (b + b2 + b3 + b4) == 4; return (b + b2 + b3 + b4) == 4;
} }
/**
*
* @param cpUserId
* @param storeCode
* @param type 广: 1 2 3广
* @param instanceId id
* @param promoterId 广ID id, id, 广广id
* @return
* @throws Exception
* @author dexiang.jiang
* @date 2020/05/21 15:01
*/
public String createActivityQrCode(String cpUserId, String storeCode,int type ,Long instanceId, Long promoterId) throws Exception {
String state = Constants.ACTIVITY_QR_CODE_PREFIX + Constants.LINE + instanceId + Constants.LINE + type + Constants.LINE + promoterId;
return getQrCodeFromBSD(cpUserId, BSD_REQ_QRCODE_TYPE_ACTIVITY, state, storeCode);
}
} }

Loading…
Cancel
Save