Stripe推广码 部分功能完善
This commit is contained in:
@@ -134,6 +134,13 @@ public class StripeController {
|
|||||||
public Response<String> retrievePromotionCode(@RequestParam String retrievePromotionCode){
|
public Response<String> retrievePromotionCode(@RequestParam String retrievePromotionCode){
|
||||||
return Response.success(stripeService.retrievePromotionCode(retrievePromotionCode));
|
return Response.success(stripeService.retrievePromotionCode(retrievePromotionCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("更新推广码信息")
|
||||||
|
@GetMapping("/updatePromCodeInfo")
|
||||||
|
public Response<ProductCoupons> updateCouponsInfo(@RequestParam Long id, @RequestParam(required = false) Long paidCommission,
|
||||||
|
@RequestParam(required = false) String cooperator, @RequestParam(required = false) String remark){
|
||||||
|
return Response.success(stripeService.updateCouponsInfo(id, paidCommission, cooperator, remark));
|
||||||
|
}
|
||||||
/*@ApiOperation("临时 取消订阅")
|
/*@ApiOperation("临时 取消订阅")
|
||||||
@GetMapping("/cancelSubscriptionTemp")
|
@GetMapping("/cancelSubscriptionTemp")
|
||||||
public Response<String> cancelSubscriptionTemp(@RequestParam String subscriptionId) {
|
public Response<String> cancelSubscriptionTemp(@RequestParam String subscriptionId) {
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ package com.ai.da.mapper.primary.entity;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@TableName("t_product_coupons")
|
@TableName("t_product_coupons")
|
||||||
|
@NoArgsConstructor
|
||||||
public class ProductCoupons extends BaseEntity{
|
public class ProductCoupons extends BaseEntity{
|
||||||
// 优惠券id
|
// 优惠券id
|
||||||
private String couponId;
|
private String couponId;
|
||||||
@@ -35,16 +37,15 @@ public class ProductCoupons extends BaseEntity{
|
|||||||
// 备注
|
// 备注
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
public ProductCoupons() {
|
public ProductCoupons(String couponId, Long redeemBy, String promotionCodeId, String promotionCode, Long maxRedemptions, float percentOff, float commissionRate, String cooperator, String remark) {
|
||||||
}
|
|
||||||
|
|
||||||
public ProductCoupons(String couponId, Long redeemBy, String promotionCodeId, String promotionCode, Long maxRedemptions, float percentOff, float commissionRate) {
|
|
||||||
this.couponId = couponId;
|
this.couponId = couponId;
|
||||||
this.redeemBy = redeemBy;
|
this.redeemBy = redeemBy;
|
||||||
this.promotionCodeId = promotionCodeId;
|
this.promotionCodeId = promotionCodeId;
|
||||||
this.promotionCode = promotionCode;
|
this.promotionCode = promotionCode;
|
||||||
this.maxRedemptions = maxRedemptions;
|
this.maxRedemptions = maxRedemptions;
|
||||||
this.percentOff = percentOff;
|
this.percentOff = percentOff;
|
||||||
|
this.cooperator = cooperator;
|
||||||
|
this.remark = remark;
|
||||||
this.commissionRate = commissionRate;
|
this.commissionRate = commissionRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,8 @@ public class CreateCouponDTO {
|
|||||||
private Long timestamp;
|
private Long timestamp;
|
||||||
@ApiModelProperty("推广码最大使用次数")
|
@ApiModelProperty("推广码最大使用次数")
|
||||||
private Long maxRedemptions;
|
private Long maxRedemptions;
|
||||||
|
@ApiModelProperty("合作者/机构名")
|
||||||
|
private String cooperator;
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remark;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public interface StripeService {
|
|||||||
|
|
||||||
CheckCouponsVO checkProductCoupon(String promotionCode, Long price);
|
CheckCouponsVO checkProductCoupon(String promotionCode, Long price);
|
||||||
|
|
||||||
|
ProductCoupons updateCouponsInfo(Long id, Long paidCommission, String cooperator, String remark);
|
||||||
|
|
||||||
ProductCoupons getProductCoupon(String promotionCode, String promotionCodeId);
|
ProductCoupons getProductCoupon(String promotionCode, String promotionCodeId);
|
||||||
|
|
||||||
String retrieveCoupon(String couponId);
|
String retrieveCoupon(String couponId);
|
||||||
|
|||||||
@@ -986,6 +986,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
} else if (Objects.nonNull(id)) {
|
} else if (Objects.nonNull(id)) {
|
||||||
library = libraryService.getById(id);
|
library = libraryService.getById(id);
|
||||||
// 判断从library中选择的图片是否有分割数据
|
// 判断从library中选择的图片是否有分割数据
|
||||||
|
if (Objects.isNull(library)) {
|
||||||
|
throw new BusinessException("library.not.found");
|
||||||
|
}
|
||||||
if (StringUtil.isNullOrEmpty(library.getSegmentedData())) {
|
if (StringUtil.isNullOrEmpty(library.getSegmentedData())) {
|
||||||
ImageSegmentation.ImageDate imageDate = new ImageSegmentation().new ImageDate();
|
ImageSegmentation.ImageDate imageDate = new ImageSegmentation().new ImageDate();
|
||||||
imageDate.setImage_url(library.getUrl());
|
imageDate.setImage_url(library.getUrl());
|
||||||
|
|||||||
@@ -1396,7 +1396,8 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
PromotionCode promotionCode = createPromotionCode(coupon.getId(), createCouponDTO.getMaxRedemptions());
|
PromotionCode promotionCode = createPromotionCode(coupon.getId(), createCouponDTO.getMaxRedemptions());
|
||||||
// 3、落库
|
// 3、落库
|
||||||
ProductCoupons productCoupons = new ProductCoupons(coupon.getId(), createCouponDTO.getTimestamp(), promotionCode.getId(),
|
ProductCoupons productCoupons = new ProductCoupons(coupon.getId(), createCouponDTO.getTimestamp(), promotionCode.getId(),
|
||||||
promotionCode.getCode(), createCouponDTO.getMaxRedemptions(), createCouponDTO.getPercentOff(), createCouponDTO.getCommissionRate());
|
promotionCode.getCode(), createCouponDTO.getMaxRedemptions(), createCouponDTO.getPercentOff(),
|
||||||
|
createCouponDTO.getCommissionRate(), createCouponDTO.getCooperator(), createCouponDTO.getRemark());
|
||||||
productCoupons.setCreateTime(LocalDateTime.now());
|
productCoupons.setCreateTime(LocalDateTime.now());
|
||||||
productCouponsMapper.insert(productCoupons);
|
productCouponsMapper.insert(productCoupons);
|
||||||
|
|
||||||
@@ -1422,6 +1423,31 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProductCoupons updateCouponsInfo(Long id, Long paidCommission, String cooperator, String remark){
|
||||||
|
ProductCoupons productCoupons = productCouponsMapper.selectById(id);
|
||||||
|
if (Objects.isNull(productCoupons)){
|
||||||
|
throw new BusinessException("Unknown Promotion Code");
|
||||||
|
}
|
||||||
|
boolean flag = false;
|
||||||
|
if (!StringUtil.isNullOrEmpty(cooperator)){
|
||||||
|
productCoupons.setCooperator(cooperator);
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (!StringUtil.isNullOrEmpty(remark)){
|
||||||
|
productCoupons.setRemark(remark);
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(paidCommission)){
|
||||||
|
productCoupons.setPaidCommission(paidCommission);
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (flag){
|
||||||
|
productCoupons.setUpdateTime(LocalDateTime.now());
|
||||||
|
productCouponsMapper.updateById(productCoupons);
|
||||||
|
}
|
||||||
|
return productCoupons;
|
||||||
|
}
|
||||||
|
|
||||||
public ProductCoupons checkProductCoupon(String promotionCode){
|
public ProductCoupons checkProductCoupon(String promotionCode){
|
||||||
Stripe.apiKey = privateKey;
|
Stripe.apiKey = privateKey;
|
||||||
Long accountId = UserContext.getUserHolder().getId();
|
Long accountId = UserContext.getUserHolder().getId();
|
||||||
|
|||||||
Reference in New Issue
Block a user