Commit a31a2a95 by 吕明尚

修改订单计算

parent 4b8bb9a7
......@@ -976,6 +976,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
});
}
}
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Map<String, String> map = new HashMap<>();
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getEndDate().toString());
......@@ -1879,12 +1884,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
creatExtracted(consumerWallet, sOrder, consumerMember);
baseMapper.updateSOrder(sOrder);
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Map<String, String> map = new HashMap<>();
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getEndDate().toString());
JSONObject jsonObject = new JSONObject(map);
redisUtil.set(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo(), jsonObject.toString());
} else if (sOrder.getOrderType().equals(OrderTypeEnum.RESERVER.getCode())) {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Map<String, String> map = new HashMap<>();
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getPreStartDate().toString());
......@@ -2355,8 +2370,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper.eq(Activity::getPackId, roomLabel.getPackId());
activity = activityService.getOne(queryWrapper);
totalFee = getBigDecimal(request, activity, payPrice, user, consumerMember);
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
// priceResponse.setTotalFeeNow(totalFee);
// priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request);
}
......@@ -2387,8 +2402,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper.eq(Activity::getPackId, request.getPackId());
activity = activityService.getOne(queryWrapper);
totalFee = getBigDecimal(request, activity, payPrice, user, consumerMember);
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
// priceResponse.setTotalFeeNow(totalFee);
// priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request);
}
......@@ -2564,10 +2579,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
boolean match1 = executionTime.isMatch(ZonedDateTime.ofInstant(request.getPreEndDate().toInstant(), ZoneId.systemDefault()));
if (match && match1) {
if (consumerWallet.getBalance().compareTo(totalFee) >= 0) {
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(totalFee);
priceResponse.setBalance(totalFee);
priceResponse.setRemainingBalance(consumerWallet.getBalance().subtract(totalFee));
totalFee = new BigDecimal(0);
} else if (consumerWallet.getBalance().compareTo(totalFee) < 0) {
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(totalFee);
priceResponse.setBalance(consumerWallet.getBalance());
priceResponse.setRemainingBalance(new BigDecimal(0));
totalFee = totalFee.subtract(consumerWallet.getBalance());
......@@ -2578,6 +2597,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(timeLong));
totalFee = new BigDecimal(0);
} else if (consumerWallet.getRemainingDuration().compareTo(timeLong) < 0) {
priceResponse.setMemberDiscount(priceResponse.getTotalFeeNow().subtract(totalFee));
priceResponse.setTotalFeeNow(totalFee);
if (consumerWallet.getBalance().compareTo(priceResponse.getTotalFeeNow()) >= 0) {
priceResponse.setBalance(priceResponse.getTotalFeeNow());
priceResponse.setRemainingBalance(consumerWallet.getBalance().subtract(priceResponse.getTotalFeeNow()));
......@@ -2595,6 +2616,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(timeLong));
totalFee = new BigDecimal(0);
} else if (consumerWallet.getRemainingDuration().compareTo(timeLong) < 0) {
priceResponse.setMemberDiscount(priceResponse.getTotalFeeNow().subtract(totalFee));
priceResponse.setTotalFeeNow(totalFee);
if (consumerWallet.getBalance().compareTo(priceResponse.getTotalFeeNow()) >= 0) {
priceResponse.setBalance(priceResponse.getTotalFeeNow());
priceResponse.setRemainingBalance(consumerWallet.getBalance().subtract(priceResponse.getTotalFeeNow()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment