Commit b2380b31 by 吕明尚

Merge branch 'refs/heads/dev' into test

parents 89cf7903 97abafa3
...@@ -1636,20 +1636,46 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1636,20 +1636,46 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SOrder order = getOne(queryWrapper); SOrder order = getOne(queryWrapper);
if (ObjectUtil.isNotEmpty(order)) { if (ObjectUtil.isNotEmpty(order)) {
baseMapper.updateSOrder(sOrder); baseMapper.updateSOrder(sOrder);
//延迟5秒
try {
// 延迟 5 秒
Thread.sleep(5000);
} catch (InterruptedException e) {
// 如果线程被中断,这里可以处理异常
e.printStackTrace();
}
logger.debug("订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉"); logger.debug("订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉");
//退款 //退款
AdminRefundRequest refundRequest = new AdminRefundRequest(); // AdminRefundRequest refundRequest = new AdminRefundRequest();
refundRequest.setOrderNo(sOrder.getOrderNo()); // refundRequest.setOrderNo(sOrder.getOrderNo());
refundRequest.setAmount(sOrder.getPayPrice()); // refundRequest.setAmount(sOrder.getPayPrice());
refundRequest.setIsClean(YesNoEnum.no.getIndex()); // refundRequest.setIsClean(YesNoEnum.no.getIndex());
refundRequest.setRefundCoupon(YesNoEnum.yes.getIndex()); // refundRequest.setRefundCoupon(YesNoEnum.yes.getIndex());
refundRequest.setRefundReason("当前订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉"); // refundRequest.setRefundReason("当前订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉");
int i = sOrderService.refundOp(refundRequest); // int i = sOrderService.refundOp(refundRequest);
if (i == 1) { OrderRefundRequest request = new OrderRefundRequest();
sOrderService.removeById(sOrder); request.setOrderNo(sOrder.getOrderNo());
request.setAmount(sOrder.getPayPrice());
request.setApprovalStatus(YesNoEnum.yes.getIndex());
request.setRefundReason("当前订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉");
boolean isRefund = orderRefundService.refund(request, sOrder);
if (isRefund) {
// 删除redis 缓存信息,防止退款订单自动开始及给用户发送提示短信
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo());
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo());
//查询是否有使用中的订单
LambdaQueryWrapper<SOrder> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SOrder::getRoomId, sOrder.getRoomId());
wrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode());
List<SOrder> list = baseMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
//房间断电
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} }
return; refundExtracted(consumerWallet, sOrder, consumerMember);
} }
} else {
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) { if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
SRoom room = roomService.getById(sOrder.getRoomId()); SRoom room = roomService.getById(sOrder.getRoomId());
...@@ -1735,7 +1761,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1735,7 +1761,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
.eq(SStoreConsumer::getStoreId, sOrder.getStoreId()) .eq(SStoreConsumer::getStoreId, sOrder.getStoreId())
).stream().collect(Collectors.toMap(SStoreConsumer::getConsumerId, Function.identity())); ).stream().collect(Collectors.toMap(SStoreConsumer::getConsumerId, Function.identity()));
logger.debug("订单预订成功通知发送开始"); logger.debug("订单预订成功通知发送开始");
consumers.forEach(o->{ consumers.forEach(o -> {
SStoreConsumer sStoreConsumer = consumerMap.get(o.getId()); SStoreConsumer sStoreConsumer = consumerMap.get(o.getId());
if (ObjectUtil.isNotEmpty(sStoreConsumer)) { if (ObjectUtil.isNotEmpty(sStoreConsumer)) {
if (sStoreConsumer.getGating().equals(YesNoEnum.yes.getIndex())) { if (sStoreConsumer.getGating().equals(YesNoEnum.yes.getIndex())) {
...@@ -1751,6 +1777,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1751,6 +1777,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
logger.debug("订单预订成功通知发送结束"); logger.debug("订单预订成功通知发送结束");
} }
} }
}
@Override @Override
public void refundSuccessful(SOrder sOrder) { public void refundSuccessful(SOrder sOrder) {
......
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