TASK:1.订阅成功和续签成功,通知商家的邮件中添加邮件和国家 2.在getModuleContent的回参中添加motion相关数据 3.修改Affiliate账号状态与修改佣金比例接口合并
This commit is contained in:
@@ -14,6 +14,7 @@ import com.ai.da.service.ReferralService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -55,22 +56,27 @@ public class AffiliateController {
|
||||
|
||||
@ApiOperation(value = "获取个人佣金图表数据")
|
||||
@GetMapping("/getPersonalMonthlyIncome")
|
||||
public Response<BigDecimal[]> getPersonalMonthlyIncome(@RequestParam("year")int year) {
|
||||
public Response<BigDecimal[]> getPersonalMonthlyIncome(@RequestParam("year") int year) {
|
||||
return Response.success(affiliateService.getPersonalMonthlyIncome(year));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "审批affiliate申请")
|
||||
@GetMapping("/approval")
|
||||
public Response<Boolean> applicationApproval(@RequestParam("id") Long id,
|
||||
@RequestParam("isApproved")Boolean isApproved,
|
||||
@RequestParam("isApproved") Boolean isApproved,
|
||||
@RequestParam(value = "commission", required = false) Float commission) {
|
||||
return Response.success(affiliateService.applicationApproval(id, isApproved, commission));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新佣金比例")
|
||||
@GetMapping("/updateCommission")
|
||||
public Response<String> updateCommissionPercentage(@RequestParam("id") Long id, @RequestParam("commission") Float commission) {
|
||||
affiliateService.updateCommissionPercentage(id, commission);
|
||||
@ApiOperation(value = "编辑affiliate")
|
||||
@GetMapping("/editAffiliate")
|
||||
public Response<String> editAffiliate(@RequestParam("id") Long id,
|
||||
@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");
|
||||
}
|
||||
|
||||
@@ -122,15 +128,8 @@ public class AffiliateController {
|
||||
|
||||
@ApiOperation(value = "获取所有affiliate用户名")
|
||||
@GetMapping("/getAllAffiliateUsername")
|
||||
public Response<List<Map<String, Object>>> getAllAffiliateUsername() {
|
||||
public Response<List<Map<String, Object>>> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -197,8 +197,12 @@ public class SavedCollectionController {
|
||||
|
||||
@ApiOperation(value = "toProductImageElementUpload")
|
||||
@PostMapping("/toProductImageElementUpload")
|
||||
public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file, @RequestParam(value = "projectId", required = false) Long projectId) {
|
||||
return Response.success(userLikeGroupService.toProductImageElementUpload(file, projectId));
|
||||
public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file,
|
||||
@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")
|
||||
|
||||
@@ -19,12 +19,15 @@ public class ToProductElement implements Serializable {
|
||||
@ApiModelProperty(value = "userLikeGroupId")
|
||||
private Long userLikeGroupId;
|
||||
|
||||
@ApiModelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
@ApiModelProperty(value = "url")
|
||||
private String url;
|
||||
|
||||
// private String type;
|
||||
@ApiModelProperty(value = "首尾帧 first | last")
|
||||
private String frameType;
|
||||
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@ public class SubscriptionEmailParamsDTO {
|
||||
// 用户名
|
||||
private String username;
|
||||
|
||||
// 用户邮箱
|
||||
private String email;
|
||||
|
||||
// 国家
|
||||
private String country;
|
||||
|
||||
// t_payment_info id(每次支付对于用户来说是一笔新订单)
|
||||
private String orderId;
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ public class PoseTransformationVO implements AllCollectionVO{
|
||||
|
||||
private String productImage;
|
||||
|
||||
private String lastFrameProductImage;
|
||||
|
||||
private String gifUrl;
|
||||
|
||||
private String videoUrl;
|
||||
@@ -38,6 +40,8 @@ public class PoseTransformationVO implements AllCollectionVO{
|
||||
|
||||
private int poseId;
|
||||
|
||||
private String prompt;
|
||||
|
||||
public PoseTransformationVO(Long id, String taskId, String gifUrl, String videoUrl, String firstFrameUrl, byte isLiked, String status) {
|
||||
this.id = id;
|
||||
this.taskId = taskId;
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface AffiliateService extends IService<Affiliate> {
|
||||
|
||||
Boolean applicationApproval(Long id, Boolean isApproved, Float commission);
|
||||
|
||||
void updateCommissionPercentage(Long id, Float commission);
|
||||
void editAffiliate(Long id, Float commission, String operationType);
|
||||
|
||||
void updateAffiliateInfoWithPayment();
|
||||
|
||||
@@ -41,6 +41,4 @@ public interface AffiliateService extends IService<Affiliate> {
|
||||
void calcCouponsCommission();
|
||||
|
||||
List<Map<String, Object>> getAllAffiliateUsername();
|
||||
|
||||
void modifyAffiliateStatus(Long affiliateId, String operationType);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public interface StripeService {
|
||||
|
||||
Map<String, String> getPaymentMethod(String paymentMethodId);
|
||||
|
||||
boolean sendEmail(String subscriptionId, String type, String orderNo);
|
||||
|
||||
/*void updateSubscription(String subscriptionId);
|
||||
|
||||
void resume(String subscriptionId);*/
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
||||
|
||||
void toProduct(String taskId);
|
||||
|
||||
ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId);
|
||||
ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId, String type);
|
||||
|
||||
CollectionSort productImageLike(ProductImageLikeDTO productImageLikeDTO);
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateCommissionPercentage(Long id, Float commission){
|
||||
public void editAffiliate(Long id, Float commission, String operationType){
|
||||
Affiliate affiliate = baseMapper.selectById(id);
|
||||
if (Objects.isNull(affiliate)){
|
||||
log.info("未知affiliate id :{}", id);
|
||||
@@ -208,9 +208,21 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
||||
}
|
||||
if (!Objects.equals(affiliate.getCommissionPercent(), commission)){
|
||||
affiliate.setCommissionPercent(commission);
|
||||
affiliate.setUpdateTime(LocalDateTime.now());
|
||||
baseMapper.updateById(affiliate);
|
||||
}
|
||||
|
||||
// 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());
|
||||
baseMapper.updateById(affiliate);
|
||||
}
|
||||
|
||||
// 定时计算佣金
|
||||
@@ -554,23 +566,4 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2673,11 +2673,16 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
vo = CopyUtil.copyObject(dbItem, PoseTransformationVO.class);
|
||||
vo.setTaskId(taskId);
|
||||
|
||||
// 设置产品图片URL
|
||||
// 设置产品图片URL(首帧)
|
||||
if (dbItem.getProductImage() != null) {
|
||||
vo.setProductImage(minioUtil.getPreSignedUrl(
|
||||
dbItem.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
// 设置产品图片URL(尾帧)
|
||||
if (dbItem.getLastFrameProductImage() != null) {
|
||||
vo.setLastFrameProductImage(minioUtil.getPreSignedUrl(
|
||||
dbItem.getLastFrameProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
|
||||
// 如果视频URL为空,直接返回
|
||||
if (StringUtil.isNullOrEmpty(dbItem.getVideoUrl())) {
|
||||
|
||||
@@ -1085,6 +1085,8 @@ public class StripeServiceImpl implements StripeService {
|
||||
|
||||
SubscriptionEmailParamsDTO emailParamsDTO = new SubscriptionEmailParamsDTO();
|
||||
emailParamsDTO.setUsername(userName);
|
||||
emailParamsDTO.setEmail(account.getUserEmail());
|
||||
emailParamsDTO.setCountry(paymentInfo.getCountry());
|
||||
emailParamsDTO.setOrderId(paymentInfo.getId().toString());
|
||||
emailParamsDTO.setOrderRef("\"" + orderListLink + paymentInfo.getId().toString() + "\"");
|
||||
emailParamsDTO.setCreateDate(String.valueOf(paymentInfo.getCreateTime()).replace("T", " "));
|
||||
|
||||
@@ -739,7 +739,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
|
||||
@Override
|
||||
@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())) {
|
||||
throw new BusinessException("file.cannot.be.empty");
|
||||
}
|
||||
@@ -754,7 +754,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
// toProductElement.setUserLikeGroupId(userLikeGroupId);
|
||||
toProductElement.setProjectId(projectId);
|
||||
toProductElement.setCreateTime(LocalDateTime.now());
|
||||
// toProductElement.setType(type);
|
||||
toProductElement.setFrameType(type);
|
||||
toProductElementMapper.insert(toProductElement);
|
||||
ToProductElementVO toProductElementVO = CopyUtil.copyObject(toProductElement, ToProductElementVO.class);
|
||||
toProductElementVO.setMinioUrl(toProductElementVO.getUrl());
|
||||
@@ -2286,6 +2286,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
poseTransformationVO.setId(item.getId());
|
||||
poseTransformationVO.setTaskId(item.getUniqueId());
|
||||
poseTransformationVO.setProductImage(getMinioUrl(item.getProductImage()));
|
||||
poseTransformationVO.setLastFrameProductImage(getMinioUrl(item.getLastFrameProductImage()));
|
||||
poseTransformationVO.setPrompt(item.getPrompt());
|
||||
poseTransformationVO.setGifUrl(getMinioUrl(item.getGifUrl()));
|
||||
poseTransformationVO.setVideoUrl(getMinioUrl(item.getVideoUrl()));
|
||||
poseTransformationVO.setFirstFrameUrl(getMinioUrl(item.getFirstFrameUrl()));
|
||||
|
||||
Reference in New Issue
Block a user