This commit is contained in:
hzw
2021-02-07 11:02:16 +08:00
committed by ָ·ìdeÑô¹â
parent 4048634de3
commit a4c69db2d7
3 changed files with 55 additions and 4 deletions

View File

@@ -658,6 +658,57 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
}
// 添加支付成功redis队列
redisUtil.lPush(Constants.ORDER_TASK_PAY_SUCCESS_AFTER, storeOrder.getOrderId());
// 处理拼团
if (storeOrder.getCombinationId() > 0) {
// 判断拼团团长是否存在
StorePink headPink = new StorePink();
Integer pinkId = storeOrder.getPinkId();
if (pinkId > 0) {
headPink = storePinkService.getById(pinkId);
if (ObjectUtil.isNull(headPink) || headPink.getIsRefund().equals(true) || headPink.getStatus() == 3) {
pinkId = 0;
}
}
StoreCombination storeCombination = storeCombinationService.getById(storeOrder.getCombinationId());
// 生成拼团表数据
StorePink storePink = new StorePink();
storePink.setUid(user.getUid());
storePink.setAvatar(user.getAvatar());
storePink.setNickname(user.getNickname());
storePink.setOrderId(storeOrder.getOrderId());
storePink.setOrderIdKey(storeOrder.getId());
storePink.setTotalNum(storeOrder.getTotalNum());
storePink.setTotalPrice(storeOrder.getTotalPrice());
storePink.setCid(storeCombination.getId());
storePink.setPid(storeCombination.getProductId());
storePink.setPeople(storeCombination.getPeople());
storePink.setPrice(storeCombination.getPrice());
Integer effectiveTime = storeCombination.getEffectiveTime();// 有效小时数
DateTime dateTime = cn.hutool.core.date.DateUtil.date();
storePink.setAddTime(dateTime.getTime());
if (pinkId > 0) {
storePink.setStopTime(headPink.getStopTime());
} else {
DateTime hourTime = cn.hutool.core.date.DateUtil.offsetHour(dateTime, effectiveTime);
long stopTime = hourTime.getTime();
if (stopTime > storeCombination.getStopTime()) {
stopTime = storeCombination.getStopTime();
}
storePink.setStopTime(stopTime);
}
storePink.setKId(pinkId);
storePink.setIsTpl(false);
storePink.setIsRefund(false);
storePink.setStatus(1);
storePinkService.save(storePink);
// 如果是开团,需要更新订单数据
if (storePink.getKId() == 0) {
storeOrder.setPinkId(storePink.getId());
storeOrderService.updateById(storeOrder);
}
}
return Boolean.TRUE;
});
if (!execute) throw new CrmebException("余额支付订单失败");

View File

@@ -389,12 +389,12 @@ public class OrderUtils {
// 积分兑换金额小于实际支付金额
if(deductionPrice.compareTo(payPrice) < 0){
payPrice = payPrice.subtract(deductionPrice);
usedIntegral = currentUser.getIntegral().intValue();
usedIntegral = currentUser.getIntegral();
}else{
deductionPrice = payPrice;
if(payPrice.compareTo(BigDecimal.ZERO) > 0){
usedIntegral = payPrice.divide(BigDecimal.valueOf(Double.parseDouble(cor.getOther().get("integralRatio").toString()))).setScale(0, BigDecimal.ROUND_UP).intValue();
surPlusIntegral = currentUser.getIntegral().intValue() - usedIntegral;
usedIntegral = payPrice.divide(BigDecimal.valueOf(Double.parseDouble(cor.getOther().get("integralRatio").toString())), 0, BigDecimal.ROUND_UP).intValue();
surPlusIntegral = currentUser.getIntegral() - usedIntegral;
}
payPrice = BigDecimal.ZERO;
}

View File

@@ -37,7 +37,7 @@ spring:
redis:
host: #地址
port: 6379 #端口
password:
password:
timeout: 30000 # 连接超时时间(毫秒)
database: 0 #默认数据库
jedis: