|
@@ -200,7 +200,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
@Cacheable(value = RedisKeyConstant.CACHE_PAYMENT_CREAT_ORDER + "#24#h",
|
|
|
key = "T(String).valueOf(#createUserOrderDTO.userId)" +
|
|
|
".concat('-').concat(#createUserOrderDTO.productId)" +
|
|
|
- ".concat('-').concat(#createUserOrderDTO.paymentMethod)",
|
|
|
+ ".concat('-').concat(#createUserOrderDTO.paymentMethod)" +
|
|
|
+ ".concat('-').concat(#createUserOrderDTO.num)",
|
|
|
cacheManager = "myRedisCacheManager", unless = "#result == null")
|
|
|
public Map<String, String> createUserOrder(CreateUserOrderDTO createUserOrderDTO) {
|
|
|
UserVO userVO = userApi.getById(createUserOrderDTO.getUserId()).getResult();
|
|
@@ -337,7 +338,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
@Cacheable(value = RedisKeyConstant.CACHE_PAYMENT_CREAT_ORDER + "#24#h",
|
|
|
key = "T(String).valueOf(#createUserOrderDTO.userId)" +
|
|
|
".concat('-').concat(#createUserOrderDTO.productId)" +
|
|
|
- ".concat('-').concat(#createUserOrderDTO.paymentMethod)",
|
|
|
+ ".concat('-').concat(#createUserOrderDTO.paymentMethod)" +
|
|
|
+ ".concat('-').concat(#createUserOrderDTO.num)",
|
|
|
cacheManager = "myRedisCacheManager", unless = "#result == null")
|
|
|
public Map<String, String> createUserSubscription(CreateUserOrderDTO createUserOrderDTO) {
|
|
|
UserVO userVO = userApi.getById(createUserOrderDTO.getUserId()).getResult();
|
|
@@ -404,19 +406,25 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
RSAUtils rsaUtils = new RSAUtils();
|
|
|
String authorization = rsaUtils.encrypt(String.format("{\"configId\":\"%s\"}", configId));
|
|
|
|
|
|
- // 订阅优惠类型 0 默认,1 首期优惠,2 试用(首期免费)
|
|
|
- int subDiscountFlag = 0;
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("orderNum", readeNo);
|
|
|
jsonObject.put("currency", currency);
|
|
|
+ // 订阅优惠类型 0 默认,1 首期优惠,2 试用(首期免费)
|
|
|
+ int subDiscountFlag = 0;
|
|
|
// 订阅周期付费,以产品价格为准
|
|
|
- jsonObject.put("price", productVO.getPrice());
|
|
|
- // 设置订阅首期优惠
|
|
|
- if (order.getReducedPrice() != null) {
|
|
|
- subDiscountFlag = 1;
|
|
|
- jsonObject.put("discountPrice", order.getReducedPrice());
|
|
|
- if (order.getReducedPrice().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
- subDiscountFlag = 2;
|
|
|
+ if (createUserOrderDTO.getDiscountFlag() == 2) {
|
|
|
+ // 需求更新,升级购买首期优惠改为每期都用优惠价
|
|
|
+ jsonObject.put("price", order.getReducedPrice());
|
|
|
+ subDiscountFlag = 3;
|
|
|
+ } else {
|
|
|
+ jsonObject.put("price", productVO.getPrice());
|
|
|
+ // 设置订阅首期优惠
|
|
|
+ if (order.getReducedPrice() != null) {
|
|
|
+ subDiscountFlag = 1;
|
|
|
+ jsonObject.put("discountPrice", order.getReducedPrice());
|
|
|
+ if (order.getReducedPrice().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ subDiscountFlag = 2;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
jsonObject.put("discountFlag", subDiscountFlag);
|