zoujiajian 1 vuosi sitten
vanhempi
sitoutus
13b879710e

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsCategorySkuView.java

@@ -5,6 +5,8 @@ import com.ejlchina.searcher.bean.SearchBean;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 /**
  * 项目名: yhlxj
  * 文件名: GoodsCategorySkuView
@@ -29,6 +31,9 @@ public class GoodsCategorySkuView {
 	@DbField("sku.id")
 	private Long skuId;
 
+	@DbField("sku.price")
+	private BigDecimal price;
+
 	@DbField("sku.spec_val")
 	private String specVal;
 }

+ 24 - 30
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -1585,37 +1585,31 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		if (betweenDay > 15) {
 			refundInfoResp.setIsRefund(false);
 		}
-		if (refundInfoResp.getIsRefund()) {
-			List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
-			OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
-					.eq(OrderDon::getRelationId, relationId)
-					.in(OrderDon::getUserId, userIdList)
-					.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
-					.orderByDesc(OrderDon::getId)
-					.last("limit 1"));
-			if (orderDon == null) {
-				throw BusinessRuntimeException.getInstance("对应车票订单不存在,请联系客服");
-			}
-			Long skuId = netflixRelationView.getSkuId();
-			GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
-			BigDecimal orderMoney = orderDon.getMoney();
-			if (orderMoney.compareTo(BigDecimal.ZERO) == 0) {
-				refundInfoResp.setIsRefund(false);
-			}
-			if (refundInfoResp.getIsRefund()) {
-				//每天单价
-				BigDecimal dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getMonths() * 30), RoundingMode.DOWN);
-				//需要退款金额
-				BigDecimal refundMoney = dayPrice.multiply(BigDecimal.valueOf(betweenDay));
-				if (refundMoney.compareTo(orderMoney) > 0) {
-					refundInfoResp.setIsRefund(false);
-				}
-				if (refundInfoResp.getIsRefund()) {
-					refundInfoResp.setPrice(refundMoney);
-					refundInfoResp.setRemainDays(betweenDay);
-				}
-			}
+		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+		OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
+				.eq(OrderDon::getRelationId, relationId)
+				.in(OrderDon::getUserId, userIdList)
+				.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
+				.orderByDesc(OrderDon::getId)
+				.last("limit 1"));
+		if (orderDon == null) {
+			refundInfoResp.setIsRefund(false);
+		}
+		Long skuId = netflixRelationView.getSkuId();
+		GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
+		BigDecimal orderMoney = orderDon == null ? BigDecimal.ZERO : orderDon.getMoney();
+		if (orderMoney.compareTo(BigDecimal.ZERO) == 0) {
+			refundInfoResp.setIsRefund(false);
+		}
+		//每天单价
+		BigDecimal dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getMonths() * 30), RoundingMode.DOWN);
+		//需要退款金额
+		BigDecimal refundMoney = dayPrice.multiply(BigDecimal.valueOf(betweenDay));
+		if (refundMoney.compareTo(orderMoney) > 0) {
+			refundInfoResp.setIsRefund(false);
 		}
+		refundInfoResp.setPrice(refundMoney);
+		refundInfoResp.setRemainDays(betweenDay);
 		return refundInfoResp;
 	}