|
|
@ -123,7 +123,7 @@ public class ActRedPackServiceImpl implements ActRedPackService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ruleOrderTotal != null) {
|
|
|
|
if (ruleOrderTotal != null) {
|
|
|
|
if (!(currencyAmount.compareTo(ruleOrderTotal) >= 0)) {
|
|
|
|
if (!(currencyAmount.compareTo(ruleOrderTotal) >= 0)) {
|
|
|
|
logger.info("订单金额不满足活动要求金额");
|
|
|
|
logger.info("订单金额不满足 [{}] 红包活动要求金额",actName);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -133,29 +133,29 @@ public class ActRedPackServiceImpl implements ActRedPackService {
|
|
|
|
int getTotalCounts = getRedPacketsByOpenid(customerId, new Date(), actId);
|
|
|
|
int getTotalCounts = getRedPacketsByOpenid(customerId, new Date(), actId);
|
|
|
|
int ruleMaxNum = redpackCustomerActivity.getIntValue("rule_max_num");
|
|
|
|
int ruleMaxNum = redpackCustomerActivity.getIntValue("rule_max_num");
|
|
|
|
if (getTotalCounts >= ruleMaxNum) {
|
|
|
|
if (getTotalCounts >= ruleMaxNum) {
|
|
|
|
logger.debug("customerId:" + customerId + "已达到本次活动发送最大次数" + ruleMaxNum + "!跳过");
|
|
|
|
logger.debug("customerId:" + customerId + "已达到本次 [{}] 红包活动发送最大次数" + ruleMaxNum + "!跳过",actName);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int getDailyTotalCounts = getRedPacketsByOpenid(customerId, new Date(), actId);
|
|
|
|
int getDailyTotalCounts = getRedPacketsByOpenid(customerId, new Date(), actId);
|
|
|
|
int ruleMaxNumLimit = redpackCustomerActivity.getIntValue("rule_max_num_limit");
|
|
|
|
int ruleMaxNumLimit = redpackCustomerActivity.getIntValue("rule_max_num_limit");
|
|
|
|
if (getDailyTotalCounts >= ruleMaxNumLimit) {
|
|
|
|
if (getDailyTotalCounts >= ruleMaxNumLimit) {
|
|
|
|
logger.debug("customerId:" + customerId + "已达当日发送最大次数" + ruleMaxNumLimit + "!跳过");
|
|
|
|
logger.debug("customerId:" + customerId + "已达 [{}] 红包活动当日发送最大次数" + ruleMaxNumLimit + "!跳过",actName);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
takeRedpack(actId, orderId, clientId, clientApply, currencyAmount, customerId, 0);
|
|
|
|
takeRedpack(actId, orderId, clientId, clientApply, currencyAmount, customerId,actName, 0);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void takeRedpack(String actId, String orderId, int clientId, JSONObject clientApply, BigDecimal currencyAmount, String customerId, int tryTimes)
|
|
|
|
private void takeRedpack(String actId, String orderId, int clientId, JSONObject clientApply, BigDecimal currencyAmount, String customerId, String actName, int tryTimes)
|
|
|
|
throws RedPackException {
|
|
|
|
throws RedPackException {
|
|
|
|
if (tryTimes > 5) {
|
|
|
|
if (tryTimes > 5) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int random = (int) (Math.random() * 100);
|
|
|
|
int random = (int) (Math.random() * 100);
|
|
|
|
if (random > 80) {
|
|
|
|
if (random > 80) {
|
|
|
|
logger.info("未达到触发概率当前概率为:" + random);
|
|
|
|
logger.info("未达到 [{}] 红包活动触发概率,当前概率为:" + random, actName);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -177,7 +177,7 @@ public class ActRedPackServiceImpl implements ActRedPackService {
|
|
|
|
doSendWechatActLuckyMoney(customerId, lock, clientApply.getString("act_name"), clientApply.getString("send_name"), clientApply.getString("wishing"));
|
|
|
|
doSendWechatActLuckyMoney(customerId, lock, clientApply.getString("act_name"), clientApply.getString("send_name"), clientApply.getString("wishing"));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
takeRedpack(actId, orderId, clientId, clientApply, currencyAmount, customerId, tryTimes + 1);
|
|
|
|
takeRedpack(actId, orderId, clientId, clientApply, currencyAmount, customerId, actName, tryTimes + 1);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -186,6 +186,7 @@ public class ActRedPackServiceImpl implements ActRedPackService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void doSendWechatActLuckyMoney(String paymentOpenId, String lock, String actName, String sendName, String wishing) throws RedPackException {
|
|
|
|
public void doSendWechatActLuckyMoney(String paymentOpenId, String lock, String actName, String sendName, String wishing) throws RedPackException {
|
|
|
|
|
|
|
|
logger.info("开始给支付用户 [{}] 发送 [{}--{}]红包", paymentOpenId, actName, lock);
|
|
|
|
JSONObject prizeDetail = actRedPacketsCustomerOrdersMapper.findLockedPrize(lock, paymentOpenId);
|
|
|
|
JSONObject prizeDetail = actRedPacketsCustomerOrdersMapper.findLockedPrize(lock, paymentOpenId);
|
|
|
|
BigDecimal luckyMoeny = prizeDetail.getBigDecimal("red_packet_amount");
|
|
|
|
BigDecimal luckyMoeny = prizeDetail.getBigDecimal("red_packet_amount");
|
|
|
|
String redPackOrderId = prizeDetail.getString("red_packet_order_id");
|
|
|
|
String redPackOrderId = prizeDetail.getString("red_packet_order_id");
|
|
|
@ -216,6 +217,7 @@ public class ActRedPackServiceImpl implements ActRedPackService {
|
|
|
|
prizeDetail.put("red_packet_id", redPacketId);
|
|
|
|
prizeDetail.put("red_packet_id", redPacketId);
|
|
|
|
prizeDetail.put("status", 1);
|
|
|
|
prizeDetail.put("status", 1);
|
|
|
|
actRedPacketsCustomerOrdersMapper.update(prizeDetail);
|
|
|
|
actRedPacketsCustomerOrdersMapper.update(prizeDetail);
|
|
|
|
|
|
|
|
logger.info("支付用户 [{}] 发送 [{}--{}] 红包结束", paymentOpenId, actName, lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|