Explorar el Código

fix 特定未发车的平台可允许续费

zoujiajian hace 3 años
padre
commit
b1cd133f31

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mange/group/CmsGroupServiceImpl.java

@@ -89,7 +89,7 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
                    //如果续费增加时间,如果首次则设置当前时间为初始时间
                    Date expiryTime = Optional.ofNullable(relation.getExpiryTime()).orElse(new Date());
                    log.info("设置账号,该用户 {} 初始时间:{} ",orderDon.getUserId(),DateUtil.format(expiryTime,"yyyy-MM-dd HH:mm:ss"));
-                   GoodsDonSku donSku = skuMapper.selectById(getById(groupsTrips.getId()).getSkuId());
+                   GoodsDonSku donSku = skuMapper.selectById(orderDon.getSkuId());
 
                    Date newDate = DateUtil.offset(expiryTime, DateField.MONTH, donSku.getMonths() * orderDon.getNum());
                    relation.setExpiryTime(newDate);

+ 9 - 4
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -166,6 +166,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 
 	private final TemplateCommonService templateCommonService;
 
+	private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
+
 	@Transactional(rollbackFor = Throwable.class)
 	@Override
 	public OrderDon submit(OrderPayRequest payRequest) throws Exception {
@@ -587,11 +589,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
         }
         GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
 
-        if (GroupsTrips.Status.waiting.equals(groupsTrips.getStatus())) {
-            throw new BusinessRuntimeException("亲,该车次还未发车,需等待客服发车才能续费哦.");
-        }
-
 		GoodsDon goodsDon = goodsDonMapper.selectById(sku.getGoodsId());
+
 		if (goodsDon == null || !goodsDon.getStatus()) {
 			throw new BusinessRuntimeException("商品已下架");
 		}
@@ -600,6 +599,12 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			throw new BusinessRuntimeException("实物不支持续费");
 		}
 
+		if (GroupsTrips.Status.waiting.equals(groupsTrips.getStatus())) {
+			if (!noChekGoodsTemp.contains(goodsDon.getTitle())) {
+				throw new BusinessRuntimeException("亲,该车次还未发车,需等待客服发车才能续费哦.");
+			}
+		}
+
 		String payOpenId = user.getOpenId();
 
 		/* 生成订单 */