Commit b55b3015 by 吕明尚

Merge branch 'refs/heads/dev' into test

parents 32e0b52a 5582a7e9
......@@ -980,7 +980,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getEndDate().toString());
JSONObject jsonObject = new JSONObject(map);
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo(), jsonObject.toString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
unLockOrder(request.getRoomId());
}
if (response.getStatus().equals(YesNoEnum.yes.getFlag())) {
......@@ -998,7 +1005,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
map.put("expirationTime", sOrder.getPreStartDate().toString());
JSONObject jsonObject = new JSONObject(map);
if (sOrder.getOrderType().equals(OrderTypeEnum.RESERVER.getCode())) {
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo(), jsonObject.toString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
unLockOrder(request.getRoomId());
}
// 订单预定成功, 发送短信通知运维客服
......@@ -1883,13 +1897,27 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getEndDate().toString());
JSONObject jsonObject = new JSONObject(map);
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo(), jsonObject.toString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
} else if (sOrder.getOrderType().equals(OrderTypeEnum.RESERVER.getCode())) {
Map<String, String> map = new HashMap<>();
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getPreStartDate().toString());
JSONObject jsonObject = new JSONObject(map);
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo(), jsonObject.toString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
Long couponId = sOrder.getCouponId();
SStore sStore = storeService.getById(sOrder.getStoreId());
......@@ -2231,13 +2259,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sOrder.setEndDate(sOrder.getPreEndDate());
}
}
sOrder.setArrivalTime(new Date());
baseMapper.updateById(sOrder);
Map<String, String> map = new HashMap<>();
map.put("orderNo", sOrder.getOrderNo());
map.put("expirationTime", sOrder.getEndDate().toString());
JSONObject jsonObject = new JSONObject(map);
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo(), jsonObject.toString());
sOrder.setArrivalTime(new Date());
baseMapper.updateById(sOrder);
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
//更改房间状态
SRoom sRoom = new SRoom();
sRoom.setId(sOrder.getRoomId());
......@@ -2341,6 +2376,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper.eq(Activity::getLabelId, roomLabel.getLabelId());
activity = activityService.getOne(queryWrapper);
totalFee = getBigDecimal(request, activity, payPrice, user, consumerMember);
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(payPrice.subtract(totalFee));
// priceResponse.setTotalFeeNow(totalFee);
priceResponse.setDiscount(totalFee.divide(payPrice, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember);
......@@ -2370,7 +2407,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper.eq(Activity::getLabelId, roomLabel.getLabelId());
activity = activityService.getOne(queryWrapper);
totalFee = getBigDecimal(request, activity, payPrice, user, consumerMember);
// priceResponse.setTotalFeeNow(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, room, request, consumerMember);
}
......@@ -2564,10 +2602,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 +2620,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 +2639,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