|
|
@@ -2223,38 +2223,48 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
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)) {
|
|
|
+ if (!Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_1) && !appOrder.getOrderType().equals(CommonConstant.ORDER_PRO_INFO_TYPE_2) && !appOrder.getOrderType().equals(CommonConstant.ORDER_PRO_INFO_TYPE_5)) {
|
|
|
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(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_5)) {
|
|
|
+ AppCourses appCourses = appCoursesMapper.selectById(appOrder.getProductIds());
|
|
|
+ Date startTime = appCourses.getStartTime();
|
|
|
+ Date now = new Date();
|
|
|
+ if(startTime.before(now)){
|
|
|
+ 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);
|
|
|
- if(ObjectUtil.isNotEmpty(sitePriceRules)){
|
|
|
- if(Objects.equals(sitePriceRules.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_1)){
|
|
|
- String timeStr = appOrderProInfo.getProductName().split("-")[0] + "-" + appOrderProInfo.getProductName().split("-")[1];
|
|
|
- int year = LocalDate.now().getYear();
|
|
|
- Instant originalInstant = DateUtils.parseDate(year+"-"+timeStr, "yyyy-MM-dd HH:mm").toInstant();
|
|
|
- Instant time = originalInstant.minusSeconds(appSitePlace.getEarlyRefundTime() * 60);
|
|
|
- Instant now = Instant.now();
|
|
|
- if (!now.isBefore(time)) {
|
|
|
- throw new JeecgBootException("商品:" + appOrderProInfo.getProductName() + " 已超过可退时间,无法进行退款!");
|
|
|
+ if (Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_1) || appOrder.getOrderType().equals(CommonConstant.ORDER_PRO_INFO_TYPE_2)){
|
|
|
+ //通过订单查询门店退款规则,判断是否可以进行退款
|
|
|
+ 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);
|
|
|
+ if(ObjectUtil.isNotEmpty(sitePriceRules)){
|
|
|
+ if(Objects.equals(sitePriceRules.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_1)){
|
|
|
+ String timeStr = appOrderProInfo.getProductName().split("-")[0] + "-" + appOrderProInfo.getProductName().split("-")[1];
|
|
|
+ int year = LocalDate.now().getYear();
|
|
|
+ Instant originalInstant = DateUtils.parseDate(year+"-"+timeStr, "yyyy-MM-dd HH:mm").toInstant();
|
|
|
+ Instant time = originalInstant.minusSeconds(appSitePlace.getEarlyRefundTime() * 60);
|
|
|
+ Instant now = Instant.now();
|
|
|
+ if (!now.isBefore(time)) {
|
|
|
+ throw new JeecgBootException("商品:" + appOrderProInfo.getProductName() + " 已超过可退时间,无法进行退款!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|