TASK:1.订阅成功和续签成功,通知商家的邮件中添加邮件和国家 2.在getModuleContent的回参中添加motion相关数据 3.修改Affiliate账号状态与修改佣金比例接口合并

This commit is contained in:
2025-11-14 14:51:30 +08:00
parent ef84f32ca0
commit 88ce191950
12 changed files with 64 additions and 46 deletions

View File

@@ -14,6 +14,7 @@ import com.ai.da.service.ReferralService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -67,10 +68,15 @@ public class AffiliateController {
return Response.success(affiliateService.applicationApproval(id, isApproved, commission)); return Response.success(affiliateService.applicationApproval(id, isApproved, commission));
} }
@ApiOperation(value = "更新佣金比例") @ApiOperation(value = "编辑affiliate")
@GetMapping("/updateCommission") @GetMapping("/editAffiliate")
public Response<String> updateCommissionPercentage(@RequestParam("id") Long id, @RequestParam("commission") Float commission) { public Response<String> editAffiliate(@RequestParam("id") Long id,
affiliateService.updateCommissionPercentage(id, commission); @ApiParam(value = "佣金比例", example = "25")
@RequestParam(value = "commission", required = false) Float commission,
@ApiParam(value = "操作类型", example = "Active",
allowableValues = "Active,Inactive,Delete")
@RequestParam(value = "operationType", required = false) String operationType) {
affiliateService.editAffiliate(id, commission, operationType);
return Response.success("success"); return Response.success("success");
} }
@@ -126,11 +132,4 @@ public class AffiliateController {
return Response.success(affiliateService.getAllAffiliateUsername()); return Response.success(affiliateService.getAllAffiliateUsername());
} }
@ApiOperation(value = "修改affiliate状态Active | Inactive | Delete")
@GetMapping("/modifyAffiliateStatus")
public Response<String> modifyAffiliateStatus(@RequestParam Long affiliateId, @RequestParam String operationType) {
affiliateService.modifyAffiliateStatus(affiliateId, operationType);
return Response.success();
}
} }

View File

@@ -197,8 +197,12 @@ public class SavedCollectionController {
@ApiOperation(value = "toProductImageElementUpload") @ApiOperation(value = "toProductImageElementUpload")
@PostMapping("/toProductImageElementUpload") @PostMapping("/toProductImageElementUpload")
public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file, @RequestParam(value = "projectId", required = false) Long projectId) { public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file,
return Response.success(userLikeGroupService.toProductImageElementUpload(file, projectId)); @RequestParam(value = "projectId", required = false) Long projectId,
@ApiParam(value = "首尾帧", example = "first",
allowableValues = "first,last")
@RequestParam(value = "type", required = false) String type) {
return Response.success(userLikeGroupService.toProductImageElementUpload(file, projectId, type));
} }
@ApiOperation(value = "toProductImageElementDelete") @ApiOperation(value = "toProductImageElementDelete")

View File

@@ -19,12 +19,15 @@ public class ToProductElement implements Serializable {
@ApiModelProperty(value = "userLikeGroupId") @ApiModelProperty(value = "userLikeGroupId")
private Long userLikeGroupId; private Long userLikeGroupId;
@ApiModelProperty(value = "项目id")
private Long projectId; private Long projectId;
@ApiModelProperty(value = "url") @ApiModelProperty(value = "url")
private String url; private String url;
// private String type; @ApiModelProperty(value = "首尾帧 first | last")
private String frameType;
@ApiModelProperty(value = "createTime") @ApiModelProperty(value = "createTime")
private LocalDateTime createTime; private LocalDateTime createTime;
} }

View File

@@ -7,6 +7,12 @@ public class SubscriptionEmailParamsDTO {
// 用户名 // 用户名
private String username; private String username;
// 用户邮箱
private String email;
// 国家
private String country;
// t_payment_info id每次支付对于用户来说是一笔新订单 // t_payment_info id每次支付对于用户来说是一笔新订单
private String orderId; private String orderId;

View File

@@ -15,6 +15,8 @@ public class PoseTransformationVO implements AllCollectionVO{
private String productImage; private String productImage;
private String lastFrameProductImage;
private String gifUrl; private String gifUrl;
private String videoUrl; private String videoUrl;
@@ -38,6 +40,8 @@ public class PoseTransformationVO implements AllCollectionVO{
private int poseId; private int poseId;
private String prompt;
public PoseTransformationVO(Long id, String taskId, String gifUrl, String videoUrl, String firstFrameUrl, byte isLiked, String status) { public PoseTransformationVO(Long id, String taskId, String gifUrl, String videoUrl, String firstFrameUrl, byte isLiked, String status) {
this.id = id; this.id = id;
this.taskId = taskId; this.taskId = taskId;

View File

@@ -24,7 +24,7 @@ public interface AffiliateService extends IService<Affiliate> {
Boolean applicationApproval(Long id, Boolean isApproved, Float commission); Boolean applicationApproval(Long id, Boolean isApproved, Float commission);
void updateCommissionPercentage(Long id, Float commission); void editAffiliate(Long id, Float commission, String operationType);
void updateAffiliateInfoWithPayment(); void updateAffiliateInfoWithPayment();
@@ -41,6 +41,4 @@ public interface AffiliateService extends IService<Affiliate> {
void calcCouponsCommission(); void calcCouponsCommission();
List<Map<String, Object>> getAllAffiliateUsername(); List<Map<String, Object>> getAllAffiliateUsername();
void modifyAffiliateStatus(Long affiliateId, String operationType);
} }

View File

@@ -35,6 +35,8 @@ public interface StripeService {
Map<String, String> getPaymentMethod(String paymentMethodId); Map<String, String> getPaymentMethod(String paymentMethodId);
boolean sendEmail(String subscriptionId, String type, String orderNo);
/*void updateSubscription(String subscriptionId); /*void updateSubscription(String subscriptionId);
void resume(String subscriptionId);*/ void resume(String subscriptionId);*/

View File

@@ -50,7 +50,7 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
void toProduct(String taskId); void toProduct(String taskId);
ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId); ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId, String type);
CollectionSort productImageLike(ProductImageLikeDTO productImageLikeDTO); CollectionSort productImageLike(ProductImageLikeDTO productImageLikeDTO);

View File

@@ -200,7 +200,7 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
return true; return true;
} }
public void updateCommissionPercentage(Long id, Float commission){ public void editAffiliate(Long id, Float commission, String operationType){
Affiliate affiliate = baseMapper.selectById(id); Affiliate affiliate = baseMapper.selectById(id);
if (Objects.isNull(affiliate)){ if (Objects.isNull(affiliate)){
log.info("未知affiliate id :{}", id); log.info("未知affiliate id :{}", id);
@@ -208,10 +208,22 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
} }
if (!Objects.equals(affiliate.getCommissionPercent(), commission)){ if (!Objects.equals(affiliate.getCommissionPercent(), commission)){
affiliate.setCommissionPercent(commission); affiliate.setCommissionPercent(commission);
}
// operationType Active -> 激活 | Inactive -> 关闭 | Delete -> 删除
if (!StringUtil.isNullOrEmpty(operationType)) {
if (operationType.equals("Delete")) {
baseMapper.deleteById(id);
return;
} else if (operationType.equals("Active") || operationType.equals("Inactive")) {
affiliate.setStatus(operationType);
} else {
throw new BusinessException("unknown.operationType");
}
}
affiliate.setUpdateTime(LocalDateTime.now()); affiliate.setUpdateTime(LocalDateTime.now());
baseMapper.updateById(affiliate); baseMapper.updateById(affiliate);
} }
}
// 定时计算佣金 // 定时计算佣金
public void updateAffiliateInfoWithPayment(){ public void updateAffiliateInfoWithPayment(){
@@ -554,23 +566,4 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
coupon.setUnpaidCommission(unpaidCommission); coupon.setUnpaidCommission(unpaidCommission);
} }
// operationType Active -> 激活 | Inactive -> 关闭 | Delete -> 删除
@Override
public void modifyAffiliateStatus(Long affiliateId, String operationType) {
Affiliate affiliate = baseMapper.selectById(affiliateId);
if (Objects.isNull(affiliate)) {
throw new BusinessException("unknow.affiliate");
}
if (operationType.equals("Delete")) {
affiliate.setIsDeleted(1);
} else if (operationType.equals("Active") || operationType.equals("Inactive")) {
affiliate.setStatus(operationType);
} else {
throw new BusinessException("unknown.operationType");
}
updateById(affiliate);
}
} }

View File

@@ -2673,11 +2673,16 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
vo = CopyUtil.copyObject(dbItem, PoseTransformationVO.class); vo = CopyUtil.copyObject(dbItem, PoseTransformationVO.class);
vo.setTaskId(taskId); vo.setTaskId(taskId);
// 设置产品图片URL // 设置产品图片URL(首帧)
if (dbItem.getProductImage() != null) { if (dbItem.getProductImage() != null) {
vo.setProductImage(minioUtil.getPreSignedUrl( vo.setProductImage(minioUtil.getPreSignedUrl(
dbItem.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME)); dbItem.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
} }
// 设置产品图片URL(尾帧)
if (dbItem.getLastFrameProductImage() != null) {
vo.setLastFrameProductImage(minioUtil.getPreSignedUrl(
dbItem.getLastFrameProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
}
// 如果视频URL为空直接返回 // 如果视频URL为空直接返回
if (StringUtil.isNullOrEmpty(dbItem.getVideoUrl())) { if (StringUtil.isNullOrEmpty(dbItem.getVideoUrl())) {

View File

@@ -1085,6 +1085,8 @@ public class StripeServiceImpl implements StripeService {
SubscriptionEmailParamsDTO emailParamsDTO = new SubscriptionEmailParamsDTO(); SubscriptionEmailParamsDTO emailParamsDTO = new SubscriptionEmailParamsDTO();
emailParamsDTO.setUsername(userName); emailParamsDTO.setUsername(userName);
emailParamsDTO.setEmail(account.getUserEmail());
emailParamsDTO.setCountry(paymentInfo.getCountry());
emailParamsDTO.setOrderId(paymentInfo.getId().toString()); emailParamsDTO.setOrderId(paymentInfo.getId().toString());
emailParamsDTO.setOrderRef("\"" + orderListLink + paymentInfo.getId().toString() + "\""); emailParamsDTO.setOrderRef("\"" + orderListLink + paymentInfo.getId().toString() + "\"");
emailParamsDTO.setCreateDate(String.valueOf(paymentInfo.getCreateTime()).replace("T", " ")); emailParamsDTO.setCreateDate(String.valueOf(paymentInfo.getCreateTime()).replace("T", " "));

View File

@@ -739,7 +739,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId) { public ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId, String type) {
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) { if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
throw new BusinessException("file.cannot.be.empty"); throw new BusinessException("file.cannot.be.empty");
} }
@@ -754,7 +754,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
// toProductElement.setUserLikeGroupId(userLikeGroupId); // toProductElement.setUserLikeGroupId(userLikeGroupId);
toProductElement.setProjectId(projectId); toProductElement.setProjectId(projectId);
toProductElement.setCreateTime(LocalDateTime.now()); toProductElement.setCreateTime(LocalDateTime.now());
// toProductElement.setType(type); toProductElement.setFrameType(type);
toProductElementMapper.insert(toProductElement); toProductElementMapper.insert(toProductElement);
ToProductElementVO toProductElementVO = CopyUtil.copyObject(toProductElement, ToProductElementVO.class); ToProductElementVO toProductElementVO = CopyUtil.copyObject(toProductElement, ToProductElementVO.class);
toProductElementVO.setMinioUrl(toProductElementVO.getUrl()); toProductElementVO.setMinioUrl(toProductElementVO.getUrl());
@@ -2286,6 +2286,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
poseTransformationVO.setId(item.getId()); poseTransformationVO.setId(item.getId());
poseTransformationVO.setTaskId(item.getUniqueId()); poseTransformationVO.setTaskId(item.getUniqueId());
poseTransformationVO.setProductImage(getMinioUrl(item.getProductImage())); poseTransformationVO.setProductImage(getMinioUrl(item.getProductImage()));
poseTransformationVO.setLastFrameProductImage(getMinioUrl(item.getLastFrameProductImage()));
poseTransformationVO.setPrompt(item.getPrompt());
poseTransformationVO.setGifUrl(getMinioUrl(item.getGifUrl())); poseTransformationVO.setGifUrl(getMinioUrl(item.getGifUrl()));
poseTransformationVO.setVideoUrl(getMinioUrl(item.getVideoUrl())); poseTransformationVO.setVideoUrl(getMinioUrl(item.getVideoUrl()));
poseTransformationVO.setFirstFrameUrl(getMinioUrl(item.getFirstFrameUrl())); poseTransformationVO.setFirstFrameUrl(getMinioUrl(item.getFirstFrameUrl()));