|
|
@ -146,6 +146,9 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WechatPayUtil wechatPayUtil; |
|
|
private WechatPayUtil wechatPayUtil; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private MallOrderDeliveryFeeRefundHelper mallOrderDeliveryFeeRefundHelper; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
WorkerOrderCacheUtil workerOrderCacheUtil; |
|
|
WorkerOrderCacheUtil workerOrderCacheUtil; |
|
|
|
|
|
|
|
|
@ -723,7 +726,11 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
} |
|
|
} |
|
|
}else if(orderId != null && orderId.startsWith("ORDERDE_")){ |
|
|
}else if(orderId != null && orderId.startsWith("ORDERDE_")){ |
|
|
//增加配送佣金
|
|
|
//增加配送佣金
|
|
|
orderId = orderId.substring(8); |
|
|
String wxOrderId = orderId; |
|
|
|
|
|
if (mallOrderDeliveryFeeRefundHelper.existsAddedDeliveryFee(wxOrderId)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
orderId = orderId.substring(10); |
|
|
MallOrder order = this.getById(orderId); |
|
|
MallOrder order = this.getById(orderId); |
|
|
if(order.getOrderType() == ORDER_TYPE_FACETOFACE){ |
|
|
if(order.getOrderType() == ORDER_TYPE_FACETOFACE){ |
|
|
MallDeliveryOrder delivery = mallDeliveryOrderMapper.selectByGroupId(orderId); |
|
|
MallDeliveryOrder delivery = mallDeliveryOrderMapper.selectByGroupId(orderId); |
|
|
@ -734,6 +741,7 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
MallDeliveryOrder delivery = mallDeliveryOrderMapper.selectOne(qw); |
|
|
MallDeliveryOrder delivery = mallDeliveryOrderMapper.selectOne(qw); |
|
|
mallDeliveryOrderService.addDeliveryFee(order,delivery, totalFee,order.getDeliveryFee()); |
|
|
mallDeliveryOrderService.addDeliveryFee(order,delivery, totalFee,order.getDeliveryFee()); |
|
|
} |
|
|
} |
|
|
|
|
|
mallOrderDeliveryFeeRefundHelper.recordAddedDeliveryFee(orderId, wxOrderId, totalFee); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1021,7 +1029,7 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
if (group.getSuccessTime() != null) { |
|
|
if (group.getSuccessTime() != null) { |
|
|
long diffMs = System.currentTimeMillis() - group.getSuccessTime().getTime(); |
|
|
long diffMs = System.currentTimeMillis() - group.getSuccessTime().getTime(); |
|
|
if (diffMs < 10 * 60 * 1000L) { |
|
|
if (diffMs < 10 * 60 * 1000L) { |
|
|
throw new RuntimeException("拼团订单10分钟内无法退款"); |
|
|
throw new RuntimeException("拼团配送订单成团后10分钟内无法退款"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (delivery != null && delivery.getStatus() != null && delivery.getStatus() >= 1) { |
|
|
if (delivery != null && delivery.getStatus() != null && delivery.getStatus() >= 1) { |
|
|
@ -1215,7 +1223,7 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
} |
|
|
} |
|
|
//优惠券变成已使用
|
|
|
//优惠券变成已使用
|
|
|
mallUserCouponService.useCoupon(orderId); |
|
|
mallUserCouponService.useCoupon(orderId); |
|
|
updateOrderStatus(orderId, STATUS_DONE); |
|
|
updateOrderStatusForDaoDian(orderId, STATUS_DONE); |
|
|
rewardIeMatchQuota(order.getUserId()); |
|
|
rewardIeMatchQuota(order.getUserId()); |
|
|
//白嫖星球-订单完成发放星球券(不影响主流程)
|
|
|
//白嫖星球-订单完成发放星球券(不影响主流程)
|
|
|
planetRewardHook.onOrderFinish(order.getUserId(), order.getRegionId(), order.getId()); |
|
|
planetRewardHook.onOrderFinish(order.getUserId(), order.getRegionId(), order.getId()); |
|
|
@ -1252,6 +1260,7 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
@Override |
|
|
@Override |
|
|
public Map<String, Object> countByShop(String shopId) { |
|
|
public Map<String, Object> countByShop(String shopId) { |
|
|
Map<String, Object> result = new HashMap<String,Object>(); |
|
|
Map<String, Object> result = new HashMap<String,Object>(); |
|
|
|
|
|
//统计不同业务类型的订单数量
|
|
|
List<HashMap<Integer, String>> orderStatusCount = this.baseMapper.selectOrderStatusCount(shopId); |
|
|
List<HashMap<Integer, String>> orderStatusCount = this.baseMapper.selectOrderStatusCount(shopId); |
|
|
result.put("orderStatusCount", orderStatusCount); |
|
|
result.put("orderStatusCount", orderStatusCount); |
|
|
// 1. 获取指定日期(例如:今天)
|
|
|
// 1. 获取指定日期(例如:今天)
|
|
|
@ -1262,15 +1271,19 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
|
|
|
|
|
|
// 3. 生成结束时间:当天的 23:59:59
|
|
|
// 3. 生成结束时间:当天的 23:59:59
|
|
|
LocalDateTime endTime = date.atTime(LocalTime.MAX); |
|
|
LocalDateTime endTime = date.atTime(LocalTime.MAX); |
|
|
|
|
|
//统计营业额和订单量
|
|
|
HashMap<String, Object> orderRevenueAndCount = this.baseMapper.selectOrderRevenueAndCount(shopId,startTime,endTime); |
|
|
HashMap<String, Object> orderRevenueAndCount = this.baseMapper.selectOrderRevenueAndCount(shopId,startTime,endTime); |
|
|
result.put("orderRevenueAndCount", orderRevenueAndCount); |
|
|
result.put("orderRevenueAndCount", orderRevenueAndCount); |
|
|
|
|
|
//待处理差评订单数
|
|
|
Integer pendingBadReviewCount = this.baseMapper.selectPendingBadReviewCount(shopId); |
|
|
Integer pendingBadReviewCount = this.baseMapper.selectPendingBadReviewCount(shopId); |
|
|
result.put("pendingBadReviewCount", pendingBadReviewCount); |
|
|
result.put("pendingBadReviewCount", pendingBadReviewCount); |
|
|
|
|
|
//待处理退款/售后数
|
|
|
Integer refundCount = this.baseMapper.selectRefundCount(shopId); |
|
|
Integer refundCount = this.baseMapper.selectRefundCount(shopId); |
|
|
result.put("refundCount", refundCount); |
|
|
result.put("refundCount", refundCount); |
|
|
|
|
|
//待处理商家自配送订单数
|
|
|
Integer shopDeliveryPendingCount = this.baseMapper.selectShopDeliveryPendingCount(shopId); |
|
|
Integer shopDeliveryPendingCount = this.baseMapper.selectShopDeliveryPendingCount(shopId); |
|
|
result.put("shopDeliveryPendingCount", shopDeliveryPendingCount == null ? 0 : shopDeliveryPendingCount); |
|
|
result.put("shopDeliveryPendingCount", shopDeliveryPendingCount == null ? 0 : shopDeliveryPendingCount); |
|
|
|
|
|
//待处理中转配送订单数
|
|
|
Integer transferDeliveryPendingCount = this.baseMapper.selectTransferDeliveryPendingCount(shopId); |
|
|
Integer transferDeliveryPendingCount = this.baseMapper.selectTransferDeliveryPendingCount(shopId); |
|
|
result.put("transferDeliveryPendingCount", transferDeliveryPendingCount == null ? 0 : transferDeliveryPendingCount); |
|
|
result.put("transferDeliveryPendingCount", transferDeliveryPendingCount == null ? 0 : transferDeliveryPendingCount); |
|
|
return result; |
|
|
return result; |
|
|
@ -1847,6 +1860,13 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
this.update(uw); |
|
|
this.update(uw); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateOrderStatusForDaoDian(String orderId, int status) { |
|
|
|
|
|
LambdaUpdateWrapper<MallOrder> uw = new LambdaUpdateWrapper<>(); |
|
|
|
|
|
uw.eq(MallOrder::getId, orderId).set(MallOrder::getStatus, status) |
|
|
|
|
|
.set(MallOrder::getShopMakeTime,new Date()); |
|
|
|
|
|
this.update(uw); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 更新订单状态为商家拒绝退款 |
|
|
* 更新订单状态为商家拒绝退款 |
|
|
*/ |
|
|
*/ |
|
|
@ -2144,7 +2164,7 @@ public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrder |
|
|
mallRefundRecordMapper.insert(record); |
|
|
mallRefundRecordMapper.insert(record); |
|
|
//回退优惠券
|
|
|
//回退优惠券
|
|
|
mallUserCouponService.refundCoupon(order.getId()); |
|
|
mallUserCouponService.refundCoupon(order.getId()); |
|
|
wechatPayUtil.refund(order.getId(), order.getTotalAmount().multiply(new BigDecimal(100)).longValue(), order.getTotalAmount().multiply(new BigDecimal(100)).longValue()); |
|
|
mallOrderDeliveryFeeRefundHelper.refundOrderWithAddedDeliveryFee(order, order.getTotalAmount()); |
|
|
List<MallOrderGoods> goodsList = mallOrderGoodsMapper.selectByOrderId(order.getId()); |
|
|
List<MallOrderGoods> goodsList = mallOrderGoodsMapper.selectByOrderId(order.getId()); |
|
|
if (goodsList == null || goodsList.isEmpty()) return; |
|
|
if (goodsList == null || goodsList.isEmpty()) return; |
|
|
List<MallReturnOrderGoods> returnList = goodsList.stream() |
|
|
List<MallReturnOrderGoods> returnList = goodsList.stream() |
|
|
|