|
|
@@ -1858,40 +1858,40 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
List<String> refundOrderProInfoIds = new ArrayList<>(Arrays.asList(refundOrderForm.getOrderProInfoIds().split(",")));
|
|
|
List<AppOrderProInfo> appOrderProInfoList = new ArrayList<>();
|
|
|
if (ObjectUtil.isNotEmpty(appOrder)) {
|
|
|
-// if (appOrder.getProfitSharingStatus() > CommonConstant.NUMBER_0) {
|
|
|
-// throw new JeecgBootException("当前订单无法进行退款,请联系客服处理!");
|
|
|
-// }
|
|
|
-// if(!Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_1) && !appOrder.getOrderType().equals(CommonConstant.ORDER_PRO_INFO_TYPE_2)){
|
|
|
-// throw new JeecgBootException("当前订单类型不支持退款!");
|
|
|
-// }
|
|
|
-// if (Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_2)) {
|
|
|
-// throw new JeecgBootException("订单商品已使用,无法进行退款!");
|
|
|
-// }
|
|
|
-// //通过订单查询门店退款规则,判断是否可以进行退款
|
|
|
-// String s = appOrder.getProductIds().split(",")[0];
|
|
|
-// String priceRuleId = s.split("\\|")[0];
|
|
|
-// AppSitePriceRules appSitePriceRules =
|
|
|
-// appSitePriceRulesMapper.selectOne(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getId, priceRuleId).last("limit 1"));
|
|
|
-// String sitePlaceId = appSitePriceRules.getSitePlaceId();
|
|
|
-// AppSitePlace appSitePlace = appSitePlaceMapper.selectById(sitePlaceId);
|
|
|
-// if (Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_2) && Objects.equals(appSitePlace.getRefundType(),
|
|
|
-// CommonConstant.NUMBER_2)) {
|
|
|
-// throw new JeecgBootException("当前门店不支持退款!");
|
|
|
-// }
|
|
|
-// if (Objects.equals(appSitePlace.getRefundType(), CommonConstant.NUMBER_1)) {
|
|
|
-//
|
|
|
-// for (String refundOrderProInfoId : refundOrderProInfoIds) {
|
|
|
-// AppOrderProInfo appOrderProInfo = appOrderProInfoMapper.selectById(refundOrderProInfoId);
|
|
|
-// String productId = appOrderProInfo.getProductId();
|
|
|
-// AppSitePriceRules sitePriceRules = appSitePriceRulesMapper.selectById(productId);
|
|
|
-// Instant originalInstant = sitePriceRules.getStartTime().toInstant();
|
|
|
-// Instant time = originalInstant.minusSeconds(appSitePlace.getEarlyRefundTime() * 60);
|
|
|
-// Instant now = Instant.now();
|
|
|
-// if (!now.isBefore(time)) {
|
|
|
-// throw new JeecgBootException("商品:"+ appOrderProInfo.getProductName() +" 已超过可退时间,无法进行退款!");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if (appOrder.getProfitSharingStatus() > CommonConstant.NUMBER_0) {
|
|
|
+ throw new JeecgBootException("当前订单无法进行退款,请联系客服处理!");
|
|
|
+ }
|
|
|
+ if(!Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_1) && !appOrder.getOrderType().equals(CommonConstant.ORDER_PRO_INFO_TYPE_2)){
|
|
|
+ throw new JeecgBootException("当前订单类型不支持退款!");
|
|
|
+ }
|
|
|
+ if (Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_2)) {
|
|
|
+ throw new JeecgBootException("订单商品已使用,无法进行退款!");
|
|
|
+ }
|
|
|
+ //通过订单查询门店退款规则,判断是否可以进行退款
|
|
|
+ String s = appOrder.getProductIds().split(",")[0];
|
|
|
+ String priceRuleId = s.split("\\|")[0];
|
|
|
+ AppSitePriceRules appSitePriceRules =
|
|
|
+ appSitePriceRulesMapper.selectOne(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getId, priceRuleId).last("limit 1"));
|
|
|
+ String sitePlaceId = appSitePriceRules.getSitePlaceId();
|
|
|
+ AppSitePlace appSitePlace = appSitePlaceMapper.selectById(sitePlaceId);
|
|
|
+ if (Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_2) && Objects.equals(appSitePlace.getRefundType(),
|
|
|
+ CommonConstant.NUMBER_2)) {
|
|
|
+ throw new JeecgBootException("当前门店不支持退款!");
|
|
|
+ }
|
|
|
+ if (Objects.equals(appSitePlace.getRefundType(), CommonConstant.NUMBER_1)) {
|
|
|
+
|
|
|
+ for (String refundOrderProInfoId : refundOrderProInfoIds) {
|
|
|
+ AppOrderProInfo appOrderProInfo = appOrderProInfoMapper.selectById(refundOrderProInfoId);
|
|
|
+ String productId = appOrderProInfo.getProductId();
|
|
|
+ AppSitePriceRules sitePriceRules = appSitePriceRulesMapper.selectById(productId);
|
|
|
+ Instant originalInstant = sitePriceRules.getStartTime().toInstant();
|
|
|
+ Instant time = originalInstant.minusSeconds(appSitePlace.getEarlyRefundTime() * 60);
|
|
|
+ Instant now = Instant.now();
|
|
|
+ if (!now.isBefore(time)) {
|
|
|
+ throw new JeecgBootException("商品:"+ appOrderProInfo.getProductName() +" 已超过可退时间,无法进行退款!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//退款金额统计(不为保险的子订单)
|
|
|
for (String refundOrderProInfoId : refundOrderProInfoIds) {
|
|
|
@@ -1901,7 +1901,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
}
|
|
|
}
|
|
|
//调用退款逻辑
|
|
|
- weChatPayService.refundOrder(appOrder,appOrderProInfoList,refundAmount, refundOrderForm.getReason());
|
|
|
+ weChatPayService.refundOrder(appOrder,appOrderProInfoList,refundAmount, refundOrderForm.getReason(),refundOrderForm.getType());
|
|
|
|
|
|
return "申请成功,预计在3个工作日内处理!";
|
|
|
}
|