1.3.2
This commit is contained in:
@@ -658,6 +658,57 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
|||||||
}
|
}
|
||||||
// 添加支付成功redis队列
|
// 添加支付成功redis队列
|
||||||
redisUtil.lPush(Constants.ORDER_TASK_PAY_SUCCESS_AFTER, storeOrder.getOrderId());
|
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;
|
return Boolean.TRUE;
|
||||||
});
|
});
|
||||||
if (!execute) throw new CrmebException("余额支付订单失败");
|
if (!execute) throw new CrmebException("余额支付订单失败");
|
||||||
|
|||||||
@@ -389,12 +389,12 @@ public class OrderUtils {
|
|||||||
// 积分兑换金额小于实际支付金额
|
// 积分兑换金额小于实际支付金额
|
||||||
if(deductionPrice.compareTo(payPrice) < 0){
|
if(deductionPrice.compareTo(payPrice) < 0){
|
||||||
payPrice = payPrice.subtract(deductionPrice);
|
payPrice = payPrice.subtract(deductionPrice);
|
||||||
usedIntegral = currentUser.getIntegral().intValue();
|
usedIntegral = currentUser.getIntegral();
|
||||||
}else{
|
}else{
|
||||||
deductionPrice = payPrice;
|
deductionPrice = payPrice;
|
||||||
if(payPrice.compareTo(BigDecimal.ZERO) > 0){
|
if(payPrice.compareTo(BigDecimal.ZERO) > 0){
|
||||||
usedIntegral = payPrice.divide(BigDecimal.valueOf(Double.parseDouble(cor.getOther().get("integralRatio").toString()))).setScale(0, BigDecimal.ROUND_UP).intValue();
|
usedIntegral = payPrice.divide(BigDecimal.valueOf(Double.parseDouble(cor.getOther().get("integralRatio").toString())), 0, BigDecimal.ROUND_UP).intValue();
|
||||||
surPlusIntegral = currentUser.getIntegral().intValue() - usedIntegral;
|
surPlusIntegral = currentUser.getIntegral() - usedIntegral;
|
||||||
}
|
}
|
||||||
payPrice = BigDecimal.ZERO;
|
payPrice = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ spring:
|
|||||||
redis:
|
redis:
|
||||||
host: #地址
|
host: #地址
|
||||||
port: 6379 #端口
|
port: 6379 #端口
|
||||||
password:
|
password:
|
||||||
timeout: 30000 # 连接超时时间(毫秒)
|
timeout: 30000 # 连接超时时间(毫秒)
|
||||||
database: 0 #默认数据库
|
database: 0 #默认数据库
|
||||||
jedis:
|
jedis:
|
||||||
|
|||||||
Reference in New Issue
Block a user