Procházet zdrojové kódy

fix(order):优化退款时间判断逻辑

- 增加对sitePriceRules对象非空校验
- 仅针对特定类型商品执行退款时间限制检查- 避免因空指针导致的系统异常- 提高退款流程的稳定性和安全性
wzq před 1 týdnem
rodič
revize
6cd1f44f35

+ 9 - 5
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/OrderServiceImpl.java

@@ -2174,11 +2174,15 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
                     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(ObjectUtil.isNotEmpty(sitePriceRules)){
+                        if(Objects.equals(sitePriceRules.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_1)){
+                            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() + " 已超过可退时间,无法进行退款!");
+                            }
+                        }
                     }
                 }
             }