소스 검색

fix 奈飞天卡检测

zoujiajian 9 달 전
부모
커밋
3e597f0d00
1개의 변경된 파일15개의 추가작업 그리고 4개의 파일을 삭제
  1. 15 4
      netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

+ 15 - 4
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -1333,7 +1333,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				state = 3;
 			}
 			//如果账号下架了 直接失败
-			if (StrUtil.equals(GroupsTrips.Status.down.name(), renewalView.getGroupsStatus()) && renewalView.getSkuNum() > 1) {
+			if (renewalView.getDays() == null && StrUtil.equals(GroupsTrips.Status.down.name(), renewalView.getGroupsStatus()) && renewalView.getSkuNum() > 1) {
 				state = 3;
 			}
 		}
@@ -1392,7 +1392,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			//车队是否已下架
 			GroupsRelation relation = groupsRelationMapper.selectById(relationId);
 			GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
-			if (groupsTrips != null && groupsTrips.getStatus() == GroupsTrips.Status.down) {
+			GoodsDonSku sku = goodsDonSkuMapper.selectById(groupsTrips.getSkuId());
+			if (groupsTrips != null && sku.getDays() == null && groupsTrips.getStatus() == GroupsTrips.Status.down) {
 				state = 3;
 				//下架 异常
 				if (netflixUseAccountStatusRecord != null) {
@@ -1895,7 +1896,12 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			refundInfoResp.setIsRefund(false);
 		}
 		//每天单价
-		BigDecimal dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getMonths() * 30), RoundingMode.DOWN);
+		BigDecimal dayPrice;
+		if (sku.getDays() != null) {
+			dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getDays()), RoundingMode.DOWN);
+		} else {
+			dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getMonths() * 30), RoundingMode.DOWN);
+		}
 		//需要退款金额
 		BigDecimal refundMoney = dayPrice.multiply(BigDecimal.valueOf(betweenDay));
 		refundInfoResp.setPrice(refundMoney);
@@ -1940,7 +1946,12 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			throw BusinessRuntimeException.getInstance("不符合退款条件");
 		}
 		//每天单价
-		BigDecimal dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getMonths() * 30), RoundingMode.DOWN);
+		BigDecimal dayPrice;
+		if (sku.getDays() != null) {
+			dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getDays()), RoundingMode.DOWN);
+		} else {
+			dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getMonths() * 30), RoundingMode.DOWN);
+		}
 		//需要退款金额
 		BigDecimal refundMoney = dayPrice.multiply(BigDecimal.valueOf(betweenDay));
 		if (refundMoney.compareTo(orderMoney) > 0) {