Merge branch 'dev/dev' into release/3.0

This commit is contained in:
shahaibo
2025-02-05 14:26:33 +08:00
127 changed files with 6024 additions and 663 deletions

View File

@@ -51,7 +51,7 @@ public class MyTaskScheduler {
// 定时任务,每十五天执行一次
// @Scheduled(cron = "0 0 0 ? * MON")
@Scheduled(cron = "0 0 0 */15 * ?")
// @Scheduled(cron = "0 0 0 */15 * ?")
public void checkExpiry() {
// 检测正式用户是否快要过期
QueryWrapper<Account> qw = new QueryWrapper<>();
@@ -85,7 +85,7 @@ public class MyTaskScheduler {
}
}
}
@Scheduled(cron = "0 0 9 * * ?")
// @Scheduled(cron = "0 0 9 * * ?")
public void sendTrialOrderExcelToManagements() {
// 获取前一天日期
LocalDate yesterday = LocalDate.now().minusDays(1);

View File

@@ -0,0 +1,12 @@
package com.ai.da.common.config.exception;
public class TokenMissingOrExpiredException extends RuntimeException {
public TokenMissingOrExpiredException(String message) {
super(message);
}
@Override
public Throwable fillInStackTrace() {
return this;
}
}

View File

@@ -75,5 +75,9 @@ public class CommonConstant {
public static final String PORTFOLIO_DELETED_CN = "作品已删除";
public static final String TIME_FORMAT_MMM_dd_yyyy_EEEE = "MMM. dd, yyyy, EEEE";
public static final String TIME_FORMAT_MMM_dd_yyyy = "MMM. dd, yyyy";
public static final String AFFILIATE_LINK = "https://www.aida.com.hk?ref=";
}

View File

@@ -27,7 +27,11 @@ public enum AuthenticationOperationTypeEnum {
/**
* 更改邮箱
*/
CHANGE_MAILBOX;
CHANGE_MAILBOX,
/**
* 填写用户国家和职业
*/
UPDATE_USERINFO;
public static AuthenticationOperationTypeEnum of(String name) {
return Stream.of(AuthenticationOperationTypeEnum.values()).filter(v -> v.name().equals(name)).findFirst().orElse(null);

View File

@@ -8,9 +8,11 @@ import lombok.Getter;
public enum CreditsEventsEnum {
PRICE("price","6"),
// PRICE("price","1"),// for test
// PRICE("price","0.1"),
BUY_CREDITS("Buy Credits","60"),
// BUY_CREDITS("Buy Credits","10"),// for test
REFUND("Refund","60"),
// BUY_CREDITS("Buy Credits","10"),
@@ -20,6 +22,7 @@ public enum CreditsEventsEnum {
INIT_MONTHLY("init_monthly", "5000"),
INIT_TRIAL("init_trial", "100"),
INIT_WEEKLY("init_weekly","6000"),
RESET_YEAR_CREDITS("reset_year_credits","6000"),
// SUPER_RESOLUTION("Super Resolution","30"),
SUPER_RESOLUTION("Super Resolution","10"),

View File

@@ -10,38 +10,34 @@ public enum OrderStatusEnum {
* 未支付
*/
NOT_PAY("未支付"),
/**
* 支付成功
*/
SUCCESS("支付成功"),
/**
* 支付失败
*/
FAILURE("支付失败"),
/**
* 已关闭
*/
TIMEOUT_CLOSED("超时已关闭"),
/**
* 已取消
*/
CANCEL("用户已取消"),
/**
* 退款中
*/
REFUND_PROCESSING("退款中"),
/**
* 已退款
*/
REFUND_SUCCESS("已退款"),
/**
* 退款异常
*/
REFUND_ABNORMAL("退款异常"),
/**
* paypal订单状态为 APPROVED
*/

View File

@@ -0,0 +1,25 @@
package com.ai.da.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ProductEnum {
// 积分购买
CreditsProduct("AiDA credits purchase", 6L),
// 年度订阅
AnnualSubscription("AiDA Annual Subscription", 5000L),
// 月度订阅
MonthlySubscription("AiDA Monthly Subscription", 500L),
// 测试
DailySubscription("AiDA Daily Subscription", 5L),
;
/**
* 类型
*/
private final String name;
private final Long price;
}

View File

@@ -1,6 +1,7 @@
package com.ai.da.common.security.filter;
import cn.hutool.core.util.StrUtil;
import com.ai.da.common.config.exception.TokenMissingOrExpiredException;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.security.config.SecurityProperties;
import com.ai.da.common.security.jwt.JWTTokenHelper;
@@ -51,7 +52,7 @@ public class AuthenticationFilter extends OncePerRequestFilter {
"/api/python/flush","/api/account/healthy","/api/ali-pay/trade/notify","/api/paypal/ipn/back","/api/alipay-hk/trade/notify",
"/api/portfolio/page", "/api/portfolio/detail", "/api/portfolio/commentPage", "/api/portfolio/viewsIncrease",
"/api/account/designWorksRegister","/api/account/questionnaire","/api/stripe/trade/notify",
"/notification","/api/account/activateNewEmail","/api/third/party/auth/google_callback"
"/notification","/api/account/activateNewEmail","/api/third/party/auth/google_callback","/api/third/party/parseGoogleCredential","/api/third/party/receiveDesignResults","/api/third/party/parseWeChatCode"
);
@Override
@@ -101,7 +102,8 @@ public class AuthenticationFilter extends OncePerRequestFilter {
if (StrUtil.isBlank(jwtToken)) {
String ipAddress = RequestInfoUtil.getIpAddress(request);
log.info("本次请求的ip为 " + ipAddress);
throw new RuntimeException("请传入token");
// throw new RuntimeException("请传入token");
throw new TokenMissingOrExpiredException("请传入token");
}
if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
//写死 暂时放行
@@ -112,7 +114,8 @@ public class AuthenticationFilter extends OncePerRequestFilter {
if (validate) {
AuthPrincipalVo principal = jwtTokenHelper.parserToUser(jwtToken);
if (principal == null) {
throw new RuntimeException("TOKEN已过期请重新登录");
// throw new RuntimeException("TOKEN已过期请重新登录");
throw new TokenMissingOrExpiredException("TOKEN已过期请重新登录(token without userInfo)");
}
//先清空当前线程变量,防止上一个线程遗留
UserContext.delete();
@@ -122,10 +125,12 @@ public class AuthenticationFilter extends OncePerRequestFilter {
String cacheToken = LocalCacheUtils.getTokenCache(String.valueOf(principal.getId()));
if(StringUtils.isEmpty(cacheToken)){
throw new RuntimeException("TOKEN已过期请重新登录");
// throw new RuntimeException("TOKEN已过期请重新登录");
throw new TokenMissingOrExpiredException("TOKEN已过期请重新登录(local cache empty)");
}
if(!cacheToken.equals(jwtToken) ){
throw new RuntimeException("TOKEN已过期请重新登录");
// throw new RuntimeException("TOKEN已过期请重新登录");
throw new TokenMissingOrExpiredException("TOKEN已过期请重新登录(token not match local cache)");
}
// UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null);
// SecurityContextHolder.getContext().setAuthentication(authentication);

View File

@@ -1,5 +1,6 @@
package com.ai.da.common.task;
import com.ai.da.common.utils.RedisUtil;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.service.AccountService;
import lombok.extern.slf4j.Slf4j;
@@ -15,25 +16,29 @@ public class AccountTask {
@Resource
private AccountService accountService;
@Resource
private RedisUtil redisUtil;
/**
* 每周日晚上刷新 年付用户、月付用户的积分
* 替换为
* 每个月月初只刷新年付用户的积分
*/
@Scheduled(cron = "59 59 23 ? * SUN")
// @Scheduled(cron = "59 59 23 * * ?")
@Scheduled(cron = "0 0 0 1 * ?")
public void refreshCreditsMonthly() {
log.info("周日晚115959刷新付费用户积分为 6000");
log.info("月1号0点 将年费用户积分重置为 6000");
accountService.refreshCreditsWeekly();
}
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void getPaidUser() {
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
accountService.extendValidityForCC();
}
// 每天凌晨0点执行一次
@Scheduled(cron = "0 0 0 * * ?")
// @Scheduled(cron = "0 0 0 * * ?")
public void cancelActivityBenefits() {
// 1、查询当前所有参与了活动且过期的用户
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
@@ -46,7 +51,7 @@ public class AccountTask {
}
// 每天检测正式用户到期情况每天凌晨0点执行
@Scheduled(cron = "0 0 0 * * ?")
// @Scheduled(cron = "0 0 0 * * ?")
public void paidUserToVisitor() {
// 1、查询当前已过期正式用户或试用用户
List<Account> accountList = accountService.getExpiredUserBySystemUser(1);
@@ -63,8 +68,15 @@ public class AccountTask {
/**
* 将Code-Create上注册的用户添加为AiDA的游客
*/
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void registerUserToVisitor() {
accountService.registerUserToVisitor();
}
@Scheduled(cron = "0 0 0 1 * ?")
// 每月初刷新所有用户用户名剩余修改次数
public void resetUsernameModifyTimes(){
log.info("重置所有用户的用户名修改次数");
redisUtil.batchDeleteKeysWithSamePrefix(RedisUtil.NICKNAME_MODIFY_TIMES);
}
}

View File

@@ -1,42 +0,0 @@
package com.ai.da.common.task;
import com.ai.da.mapper.primary.entity.OrderInfo;
import com.ai.da.common.enums.PayTypeEnum;
import com.ai.da.service.AliPayService;
import com.ai.da.service.OrderInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@Component
public class AliPayTask {
@Resource
private OrderInfoService orderInfoService;
@Resource
private AliPayService aliPayService;
/**
* 从第0秒开始每隔30秒执行1次查询创建超过5分钟并且未支付的订单
*/
// @Scheduled(cron = "0/30 * * * * ?")
public void orderConfirm(){
// log.info("Alipay orderConfirm 被执行......");
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(5, PayTypeEnum.ALIPAY.getType());
for (OrderInfo orderInfo : orderInfoList) {
String orderNo = orderInfo.getOrderNo();
log.warn("超时订单 ===> {}", orderNo);
//核实订单状态:调用支付宝查单接口
aliPayService.checkOrderStatus(orderNo);
}
}
}

View File

@@ -1,21 +0,0 @@
package com.ai.da.common.task;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class GenerateTask {
// @Scheduled(cron = "0 0 */1 * * ?")
public void generateScheduled(){
log.info("测试定时器generate");
try{
}catch(Exception e){
}
}
}

View File

@@ -0,0 +1,122 @@
package com.ai.da.common.task;
import com.ai.da.common.enums.PayTypeEnum;
import com.ai.da.mapper.primary.entity.OrderInfo;
import com.ai.da.service.*;
import com.paypal.http.exceptions.SerializeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
@Slf4j
@Component
public class PaymentTask {
@Resource
private OrderInfoService orderInfoService;
@Resource
private StripeService stripeService;
@Resource
private AffiliateService affiliateService;
// 考虑删除该定时任务(原因:之后的订单列允许用户查看发票,发票未过期时仍可以支付,所以不需要手动使订单过期)
// @Scheduled(cron = "0/30 * * * * ?")
public void orderConfirmForStripe() throws SerializeException {
// 查看超过30分钟以上仍未支付的订单 置为超时订单
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(30, PayTypeEnum.STRIPE.getType());
for (OrderInfo orderInfo : orderInfoList) {
String orderNo = orderInfo.getOrderNo();
log.warn("超时订单 ===> {}", orderNo);
//核实订单状态:调用支付宝查单接口
stripeService.checkOrderStatus(orderNo);
}
}
@Resource
private PayPalCheckoutService payPalCheckoutService;
// @Scheduled(cron = "0/30 * * * * ?")
public void orderConfirmForPaypal() throws SerializeException {
// log.info("PayPal orderConfirm 被执行......");
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(30, PayTypeEnum.PAYPAL.getType());
for (OrderInfo orderInfo : orderInfoList) {
String orderNo = orderInfo.getOrderNo();
log.warn("超时订单 ===> {}", orderNo);
//核实订单状态:调用支付宝查单接口
payPalCheckoutService.checkOrderStatus(orderNo);
}
}
@Resource
private AliPayService aliPayService;
/**
* 从第0秒开始每隔30秒执行1次查询创建超过5分钟并且未支付的订单
*/
// @Scheduled(cron = "0/30 * * * * ?")
public void orderConfirmForAlipay(){
/*
log.info("Alipay orderConfirm 被执行......");
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(5, PayTypeEnum.ALIPAY.getType());
for (OrderInfo orderInfo : orderInfoList) {
String orderNo = orderInfo.getOrderNo();
log.warn("超时订单 ===> {}", orderNo);
//核实订单状态:调用支付宝查单接口
aliPayService.checkOrderStatus(orderNo);
}*/
}
// 提前7天向用户发送提醒邮件,每天早上8点执行
@Scheduled(cron = "0 0 8 * * ?")
public void subscriptionReminder(){
stripeService.subscriptionReminder();
}
// 每天凌晨检查subscription中有哪些已过期更新状态
// @Scheduled(cron = "0 0 0 * * ?")
// public void checkSubscriptionExpiration(){
// stripeService.checkSubscriptionExpiration();
// }
// 如果有订阅已创建,但是没有发邮件通知的,需要主动获取回调信息并向用户发送邮件
public void checkSubscriptionPayment(){
//
}
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void updateAffiliateInfoWithPayment(){
// log.info("佣金计算定时器");
affiliateService.updateAffiliateInfoWithPayment();
}
@Scheduled(cron = "0 0 8 28-31 * ?")
public void commissionSummaryReminder(){
// 每个月末的最后一天的早上八点执行
LocalDate today = LocalDate.now();
// 判断是否为月底
if (today.plusDays(1).getDayOfMonth() == 1) {
log.info("今天是月底,执行佣金结算提醒任务!");
affiliateService.commissionCalculation(null, null);
}
}
}

View File

@@ -1,42 +0,0 @@
package com.ai.da.common.task;
import com.ai.da.common.enums.PayTypeEnum;
import com.ai.da.mapper.primary.entity.OrderInfo;
import com.ai.da.service.OrderInfoService;
import com.ai.da.service.PayPalCheckoutService;
import com.paypal.http.exceptions.SerializeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@Component
public class PaypalTask {
@Resource
private OrderInfoService orderInfoService;
@Resource
private PayPalCheckoutService payPalCheckoutService;
@Scheduled(cron = "0/30 * * * * ?")
public void orderConfirm() throws SerializeException {
// log.info("PayPal orderConfirm 被执行......");
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(30, PayTypeEnum.PAYPAL.getType());
for (OrderInfo orderInfo : orderInfoList) {
String orderNo = orderInfo.getOrderNo();
log.warn("超时订单 ===> {}", orderNo);
//核实订单状态:调用支付宝查单接口
payPalCheckoutService.checkOrderStatus(orderNo);
}
}
}

View File

@@ -1,40 +0,0 @@
package com.ai.da.common.task;
import com.ai.da.common.enums.PayTypeEnum;
import com.ai.da.mapper.primary.entity.OrderInfo;
import com.ai.da.service.OrderInfoService;
import com.ai.da.service.StripeService;
import com.paypal.http.exceptions.SerializeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@Component
public class StripeTask {
@Resource
private OrderInfoService orderInfoService;
@Resource
private StripeService stripeService;
@Scheduled(cron = "0/30 * * * * ?")
public void orderConfirm() throws SerializeException {
// 查看超过30分钟以上仍未支付的订单 置为超时订单
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(30, PayTypeEnum.STRIPE.getType());
for (OrderInfo orderInfo : orderInfoList) {
String orderNo = orderInfo.getOrderNo();
log.warn("超时订单 ===> {}", orderNo);
//核实订单状态:调用支付宝查单接口
stripeService.checkOrderStatus(orderNo);
}
}
}

View File

@@ -9,8 +9,8 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
@Slf4j
@@ -18,6 +18,7 @@ public class DateUtil {
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
public static final String YYYYMM = "yyyyMM";
public static final String YYYY_MM_DD = "yyyyMMdd";
public static final String YYYY_MM_DD_hh_mm_ss = "yyyyMMddHHMMss";
/**
* LocalDate -> Date
@@ -81,4 +82,21 @@ public class DateUtil {
return String.valueOf(epochSecond).substring(0, 10);
}
public static String changeTimeStampFormat(Long timeStamp, String type, String format){
// 将秒级时间戳转换为毫秒级
if (type.equals("seconds")){
timeStamp = timeStamp * 1000;
}
// 输出格式
SimpleDateFormat outputFormat = new SimpleDateFormat(format, Locale.ENGLISH);
// 创建Date对象
Date date = new Date(timeStamp);
// 格式化输出
return outputFormat.format(date);
}
public static String changeTimeStampFormat(LocalDateTime localDate){
return localDate.format(DateTimeFormatter.ofPattern("MMM. dd, yyyy, EEEE", Locale.US));
}
}

View File

@@ -278,4 +278,26 @@ public class RedisUtil {
// 设置过期时间为 5 分钟300 秒)
redisTemplate.expire(redisKey, 5, TimeUnit.MINUTES);
}
public final static String PAYMENT_INFO_LAST_SCAN_TIME = "PaymentInfoLastScanTime";
public final static String AFFILIATE_LINK_VIEW_KEY = "AffiliateLink:view:";
public void increaseAffiliateLinkViewCount(Long accountId) {
String key = AFFILIATE_LINK_VIEW_KEY + accountId;
redisTemplate.opsForValue().increment(key);
}
public Long getAffiliateLinkViewCount(Long accountId) {
String key = AFFILIATE_LINK_VIEW_KEY + accountId;
return redisTemplate.opsForValue().increment(key, 0);
}
public void batchDeleteKeysWithSamePrefix(String prefix){
Set<String> keys = redisTemplate.keys(prefix + "*");
assert keys != null;
if (!keys.isEmpty()){
redisTemplate.delete(keys);
}
}
}

View File

@@ -1,7 +1,16 @@
package com.ai.da.common.utils;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;
@Slf4j
public class RequestInfoUtil {
/**
@@ -45,4 +54,58 @@ public class RequestInfoUtil {
return ip;
}
/**
* 免费 API 服务可能有请求频率限制,如果你需要处理大量 IP 地址,可能需要考虑使用付费服务或购买 IP 地理位置数据库。此外,始终要遵守 API 提供商的使用条款和隐私政策
* @param ip https://ip-api.com/docs/api:json 使用的接口api
* @return
* {
* "query": "24.48.0.1",
* "status": "success",
* "country": "Canada",
* "countryCode": "CA",
* "region": "QC",
* "regionName": "Quebec",
* "city": "Montreal",
* "zip": "H1L",
* "lat": 45.6026,
* "lon": -73.5167,
* "timezone": "America/Toronto",
* "isp": "Le Groupe Videotron Ltee",
* "org": "Videotron Ltee",
* "as": "AS5769 Videotron Ltee"
* }
*/
public static Map getIPLocation(String ip) {
// String ip = "117.143.125.1"; // 替换为你想查询的 IP 地址
// String ip = "194.5.48.180"; // 替换为你想查询的 IP 地址
String apiURL = "http://ip-api.com/json/" + ip;
try {
URL url = new URL(apiURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
if (conn.getResponseCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String output;
StringBuilder outputBuilder = new StringBuilder();
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
outputBuilder.append(output);
System.out.println(output);
}
conn.disconnect();
Map map = JSONObject.parseObject(outputBuilder.toString(), Map.class);
log.info("map: {}", map);
return map;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@@ -2,8 +2,11 @@ package com.ai.da.common.utils;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.AffiliateEmailParamsDTO;
import com.ai.da.model.dto.SubscriptionEmailParamsDTO;
import com.alibaba.fastjson.JSONObject;
import com.ai.da.common.config.exception.BusinessException;
import com.alibaba.fastjson2.JSON;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
@@ -70,7 +73,8 @@ public class SendEmailUtil {
/**
* 绑定邮箱模板id
*/
public static Long BIND_MAILBOX_TEMPLATE_ID = 45619L;
// public static Long BIND_MAILBOX_TEMPLATE_ID = 45619L;
public static Long BIND_MAILBOX_TEMPLATE_ID = 132754L;
public static Long CHANGE_MAILBOX_TEMPLATE_ID = 128210L;
@@ -175,7 +179,7 @@ public class SendEmailUtil {
subject = "Approval Confirmation for AiDA System Trial Access";
if (country.equals("China")) {
template.setTemplateID(NOTIFICATION_CHINESE_TEMPLATE_ID);
}else {
} else {
template.setTemplateID(NOTIFICATION_TEMPLATE_ID);
}
template.setTemplateData(buildNotificationData(trialOrder, link));
@@ -225,7 +229,7 @@ public class SendEmailUtil {
attachment.setFileName(fileName); // 设置附件文件名
// 设置附件内容
attachment.setContent(Base64.getEncoder().encodeToString(fileContent));
req.setAttachments(new Attachment[] {attachment});
req.setAttachments(new Attachment[]{attachment});
// 发送邮件
SendEmailResponse resp = client.SendEmail(req);
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
@@ -268,7 +272,9 @@ public class SendEmailUtil {
throw new BusinessException("failed.to.send.mail");
}
}
private final static Long WILLBEEXPIRED_TEMPLATE_ID = 118178L;
public static void sendWillBeExpiredEmail(Account account, String senderAddress) {
try {
// 实例化一个认证对象
@@ -360,7 +366,7 @@ public class SendEmailUtil {
jsonObject.put("email", trialOrder.getEmail());
if (link) {
jsonObject.put("days", 14);
}else {
} else {
jsonObject.put("days", 5);
}
return jsonObject.toJSONString();
@@ -370,6 +376,7 @@ public class SendEmailUtil {
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID = 118856L;
private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 122898L;
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE = 122899L;
public static void sendUpgradeNotification(Account account, String senderAddress, Integer type) {
try {
// 实例化一个认证对象
@@ -418,7 +425,8 @@ public class SendEmailUtil {
}
private final static Long GENERATE_EXCEPTION_WARNING_ID = 122589L;
public static void sendGenerateExceptionWarning(String message){
public static void sendGenerateExceptionWarning(String message) {
try {
// 实例化一个认证对象
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
@@ -457,7 +465,8 @@ public class SendEmailUtil {
private final static Long QUESTIONNAIRE_FEEDBACK_EN_ID = 124151L;
private final static Long QUESTIONNAIRE_FEEDBACK_CN_ID = 124156L;
public static void questionnaireRelatedNotify(String userName, String email, String language){
public static void questionnaireRelatedNotify(String userName, String email, String language) {
try {
// 实例化一个认证对象
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
@@ -502,7 +511,7 @@ public class SendEmailUtil {
private final static Long RENEWAL_NOTIFICATION_FOR_OLD_USER_EN = 124892L;
private final static Long RENEWAL_NOTIFICATION_FOR_OLD_USER_CN = 124891L;
public static void notificationForPaidUser(String receiverAddress, int emailType, String country, String userName, String date){
public static void notificationForPaidUser(String receiverAddress, int emailType, String country, String userName, String date) {
try {
// 实例化一个认证对象
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
@@ -525,7 +534,7 @@ public class SendEmailUtil {
subject = "Welcome to AiDA!";
if (country.equals("China")) {
template.setTemplateID(NEW_USER_PAYMENT_NOTIFICATION_CN);
}else {
} else {
template.setTemplateID(NEW_USER_PAYMENT_NOTIFICATION_EN);
}
parameter.put("userName", userName);
@@ -536,7 +545,7 @@ public class SendEmailUtil {
subject = "Account renewal notification";
if (country.equals("China")) {
template.setTemplateID(RENEWAL_NOTIFICATION_FOR_OLD_USER_CN);
}else {
} else {
template.setTemplateID(RENEWAL_NOTIFICATION_FOR_OLD_USER_EN);
}
break;
@@ -597,8 +606,8 @@ public class SendEmailUtil {
private final static Long NEW_USER_REGISTER_NOTIFICATION_EN = 126919L;
public static void notificationForRegisterUser(String receiverAddress){
try{
public static void notificationForRegisterUser(String receiverAddress) {
try {
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey此处还需注意密钥对的保密
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露并威胁账号下所有资源的安全性。以下代码示例仅供参考建议采用更安全的方式来使用密钥请参见https://cloud.tencent.com/document/product/1278/85305
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
@@ -634,8 +643,8 @@ public class SendEmailUtil {
private final static Long CHANGE_MAILBOX_CONFIRM_CN = 128278L;
private final static Long CHANGE_MAILBOX_CONFIRM_EN = 128277L;
public static void changeMailboxConfirm(String receiverAddress, String language, String name, String link){
try{
public static void changeMailboxConfirm(String receiverAddress, String language, String name, String link) {
try {
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey此处还需注意密钥对的保密
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露并威胁账号下所有资源的安全性。以下代码示例仅供参考建议采用更安全的方式来使用密钥请参见https://cloud.tencent.com/document/product/1278/85305
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
@@ -653,10 +662,10 @@ public class SendEmailUtil {
req.setFromEmailAddress(SEND_ADDRESS);
req.setDestination(new String[]{receiverAddress});
Template template = new Template();
if (language.equals("ENGLISH")){
if (language.equals("ENGLISH")) {
req.setSubject("Change the email address bound to the AiDA account");
template.setTemplateID(CHANGE_MAILBOX_CONFIRM_EN);
}else {
} else {
req.setSubject("更换AiDA账号绑定的邮箱地址");
template.setTemplateID(CHANGE_MAILBOX_CONFIRM_CN);
}
@@ -678,12 +687,12 @@ public class SendEmailUtil {
private final static Long UPLOAD_TIMEOUT_REMINDER = 128324L;
public static void uploadTimeoutReminder(String userName, String time){
public static void uploadTimeoutReminder(String userName, String time) {
String xp = "xupei3360@163.com";
String shb = "shahaibodd99@gmail.com";
String wxd = "X1627315083@163.com";
String pkc = "kaicpang.pang@connect.polyu.hk";
try{
try {
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey此处还需注意密钥对的保密
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露并威胁账号下所有资源的安全性。以下代码示例仅供参考建议采用更安全的方式来使用密钥请参见https://cloud.tencent.com/document/product/1278/85305
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
@@ -721,6 +730,7 @@ public class SendEmailUtil {
private final static Long HALFPRICEPROMOTION_CN_ID = 128582L;
private final static Long HALFPRICEPROMOTION_EN_ID = 128583L;
public static void halfPricePromotion(Account account, String senderAddress, int type) {
try {
// 实例化一个认证对象
@@ -750,7 +760,7 @@ public class SendEmailUtil {
if (type == 1) {
subject = "AiDA workshop - Win a trip to Hong Kong";
template.setTemplateID(HALFPRICEPROMOTION_EN_ID);
}else {
} else {
subject = "AiDA workshop - 赢取香港之旅";
template.setTemplateID(HALFPRICEPROMOTION_CN_ID);
}
@@ -808,4 +818,212 @@ public class SendEmailUtil {
throw new BusinessException("failed.to.send.mail");
}
}
private final static Long CANCEL_MERCHANT_EN = 130720L;
private final static Long NEW_MERCHANT_EN = 130721L;
private final static Long NEW_USER_EN = 130722L;
private final static Long NEW_USER_CN = 130723L;
private final static Long RENEWAL_MERCHANT_EN = 130724L;
private final static Long RENEWAL_USER_EN = 130725L;
private final static Long RENEWAL_USER_CN = 130726L;
private final static Long RENEWAL_REMINDER_USER_EN = 130727L;
private final static Long RENEWAL_REMINDER_USER_CN = 130728L;
private final static Long PAYMENT_FAILED_NEW_MERCHANT_EN = 131230L;
private final static Long PAYMENT_FAILED_RENEWAL_MERCHANT_EN = 131225L;
private final static Long PAYMENT_FAILED_RENEWAL_USER_EN = 131563L;
private final static Long PAYMENT_FAILED_RENEWAL_USER_CN = 131564L;
public static void subscriptionEmailReminder(String type, SubscriptionEmailParamsDTO subscriptionEmailParamsDTO, String language, String receiverAddress) {
try {
// String merchantEmail = "kimwong@code-create.com.hk";
String developer = "xupei3360@163.com";
String[] receiverEmail = {/*merchantEmail, */developer};
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
// 实例化一个http选项可选的没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("ses.tencentcloudapi.com");
// 实例化一个client选项可选的没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
SendEmailRequest user = new SendEmailRequest();
user.setFromEmailAddress(SEND_ADDRESS);
user.setDestination(new String[]{receiverAddress});
SendEmailRequest merchant = new SendEmailRequest();
merchant.setFromEmailAddress(SEND_ADDRESS);
merchant.setDestination(receiverEmail);
Template templateUser = new Template();
Template templateMerchant = new Template();
switch (type) {
case "cancel":
merchant.setSubject("[Code-Create] Subscription Cancelled");
templateMerchant.setTemplateID(CANCEL_MERCHANT_EN);
break;
case "fail_new":
merchant.setSubject("[Code-Create] Payment Failed : New Order (" + subscriptionEmailParamsDTO.getOrderId() + ")");
templateMerchant.setTemplateID(PAYMENT_FAILED_NEW_MERCHANT_EN);
break;
case "fail_renewal":
merchant.setSubject("[Code-Create] Payment Failed : Renewal Order (" + subscriptionEmailParamsDTO.getOrderId() + ")");
templateMerchant.setTemplateID(PAYMENT_FAILED_RENEWAL_MERCHANT_EN);
// todo to user
if (language.equals("ENGLISH")) {
user.setSubject("[Code-Create] Payment Failed : Renewal Order (" + subscriptionEmailParamsDTO.getOrderId() + ")");
templateUser.setTemplateID(PAYMENT_FAILED_RENEWAL_USER_EN);
} else {
user.setSubject("[Code-Create] 自动续费失败 (" + subscriptionEmailParamsDTO.getOrderId() + ")");
templateUser.setTemplateID(PAYMENT_FAILED_RENEWAL_USER_CN);
}
break;
case "new":
merchant.setSubject("[Code-Create] New Order(" + subscriptionEmailParamsDTO.getOrderId() + ")");
templateMerchant.setTemplateID(NEW_MERCHANT_EN);
if (language.equals("ENGLISH")) {
user.setSubject("[Code-Create] You have successfully subscribed to AiDA");
templateUser.setTemplateID(NEW_USER_EN);
} else {
user.setSubject("[Code-Create] 您已成功订阅AiDA");
templateUser.setTemplateID(NEW_USER_CN);
}
break;
case "renewal":
merchant.setSubject("[Code-Create] New subscription renewal order (" + subscriptionEmailParamsDTO.getOrderId() + ")");
templateMerchant.setTemplateID(RENEWAL_MERCHANT_EN);
if (language.equals("ENGLISH")) {
user.setSubject("[Code-Create] AiDA Renewal Successful");
templateUser.setTemplateID(RENEWAL_USER_EN);
} else {
user.setSubject("[Code-Create] AiDA续订成功");
templateUser.setTemplateID(RENEWAL_USER_CN);
}
break;
case "reminder":
if (language.equals("ENGLISH")) {
user.setSubject("[Code-Create] AiDA Subscription Renewal Reminder");
templateUser.setTemplateID(RENEWAL_REMINDER_USER_EN);
} else {
user.setSubject("[Code-Create] AiDA续订提醒");
templateUser.setTemplateID(RENEWAL_REMINDER_USER_CN);
}
break;
default:
log.error("unknown subscription email type");
// throw new BusinessException("unknown subscription email type");
}
templateUser.setTemplateData(JSON.toJSONString(subscriptionEmailParamsDTO));
user.setTemplate(templateUser);
templateMerchant.setTemplateData(JSON.toJSONString(subscriptionEmailParamsDTO));
merchant.setTemplate(templateMerchant);
if (!type.equals("cancel") && !type.equals("fail_new")) {
// 返回的resp是一个SendEmailResponse的实例与请求对象对应
SendEmailResponse respUser = client.SendEmail(user);
log.info("邮件主题:{}发送结果toUser###{}", user.getSubject(), SendEmailResponse.toJsonString(respUser));
}
if (!type.equals("reminder")) {
SendEmailResponse respMerchant = client.SendEmail(merchant);
log.info("邮件主题:{}发送结果toMerchant###{}", merchant.getSubject(), SendEmailResponse.toJsonString(respMerchant));
}
} catch (TencentCloudSDKException e) {
log.info("邮件发送失败###{}", e.toString());
throw new BusinessException("failed.to.send.mail");
}
}
private final static Long NEW_REGISTRATION = 132123L;
private final static Long AFFILIATE_ACCEPTED = 132124L;
private final static Long AFFILIATE_REFUSED = 132125L;
private final static Long AFFILIATE_MONTHLY_SUMMARY = 132126L;
public static void affiliateEmailReminder(String[] receiverAddress, AffiliateEmailParamsDTO paramsDTO, String type) {
try {
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
// 实例化一个http选项可选的没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("ses.tencentcloudapi.com");
// 实例化一个client选项可选的没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
SendEmailRequest req = new SendEmailRequest();
req.setFromEmailAddress(SEND_ADDRESS);
req.setDestination(receiverAddress);
Template template = new Template();
switch (type) {
case "new":
req.setSubject("New Affiliate Registration");
template.setTemplateID(NEW_REGISTRATION);
break;
case "accepted":
req.setSubject("Affiliate Application Accepted");
template.setTemplateID(AFFILIATE_ACCEPTED);
break;
case "refused":
req.setSubject("Affiliate Application Refused");
template.setTemplateID(AFFILIATE_REFUSED);
break;
case "summary":
req.setSubject("Your Monthly AffiliateWP Summary for AiDA");
template.setTemplateID(AFFILIATE_MONTHLY_SUMMARY);
break;
}
template.setTemplateData(JSON.toJSONString(paramsDTO));
req.setTemplate(template);
// 返回的resp是一个SendEmailResponse的实例与请求对象对应
SendEmailResponse resp = client.SendEmail(req);
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
log.info("邮件发送失败###{}", e.toString());
throw new BusinessException("failed.to.send.mail");
}
}
private final static Long CREDITS_PURCHASE_MERCHANT = 133275L;
public static void creditsPurchaseReminder(String username, String quantity, String amount) {
try {
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
// 实例化一个http选项可选的没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("ses.tencentcloudapi.com");
// 实例化一个client选项可选的没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
SendEmailRequest req = new SendEmailRequest();
req.setFromEmailAddress(SEND_ADDRESS);
String merchantEmail = "kimwong@code-create.com.hk";
String developerEmail = "xupei@code-create.com.hk";
req.setDestination(new String[]{merchantEmail, developerEmail});
Template template = new Template();
req.setSubject("New Credit Purchase Order");
template.setTemplateID(CREDITS_PURCHASE_MERCHANT);
JSONObject jsonObject = new JSONObject();
// 设置试用订单相关数据
jsonObject.put("userName", username);
jsonObject.put("quantity", quantity);
jsonObject.put("totalFee", amount);
template.setTemplateData(JSON.toJSONString(jsonObject));
req.setTemplate(template);
// 返回的resp是一个SendEmailResponse的实例与请求对象对应
SendEmailResponse resp = client.SendEmail(req);
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
log.info("邮件发送失败###{}", e.toString());
throw new BusinessException("failed.to.send.mail");
}
}
}

View File

@@ -3,10 +3,13 @@ package com.ai.da.controller;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.AccountExtend;
import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.*;
import com.ai.da.model.vo.AccountLoginVO;
import com.ai.da.model.vo.AccountPreLoginVO;
import com.ai.da.model.vo.BindEmailVO;
import com.ai.da.model.vo.PersonalHomepageVO;
import com.ai.da.service.AccountService;
import io.swagger.annotations.Api;
@@ -48,8 +51,8 @@ public class AccountController {
@ApiOperation(value = "绑定邮箱")
@PostMapping("/bindEmail")
public Response<Boolean> bindEmail(@Valid @RequestBody AccountBindEmailDTO accountBindEmailDTO) {
return Response.success(accountService.bindEmail(accountBindEmailDTO));
public Response<BindEmailVO> bindEmail(@Valid @RequestBody AccountBindEmailDTO accountBindEmailDTO, HttpServletRequest request) {
return Response.success(accountService.bindEmail(accountBindEmailDTO, request));
}
@ApiOperation(value = "忘记密码")
@@ -222,7 +225,7 @@ public class AccountController {
@ApiOperation(value = "getUsernameModifyTimes")
@GetMapping("/getNicknameModifyTimes")
public Response<Map<String, Long>> getNicknameModifyTimes(){
public Response<Long> getNicknameModifyTimes(){
return Response.success(accountService.getNicknameModifyTimes());
}
@@ -233,7 +236,7 @@ public class AccountController {
return Response.success("success");
}
@ApiOperation(value = "verifyUserEmail")
/*@ApiOperation(value = "verifyUserEmail")
@GetMapping("/verifyUserEmail")
public Response<String> verifyUserEmail(@RequestParam("verifyCode") String verifyCode){
accountService.verifyUserEmail(verifyCode);
@@ -252,7 +255,7 @@ public class AccountController {
public Response<String> activateNewEmail(@RequestParam("token") String token){
accountService.activateNewEmail(token);
return Response.success("success");
}
}*/
@PostMapping("halfPricePromotion")
@ApiOperation(value = "十月半价活动")
@@ -268,5 +271,82 @@ public class AccountController {
return Response.success(true);
}
@PostMapping("enterpriseLogin")
@ApiOperation(value = "企业登录")
public Response<AccountLoginVO> enterpriseLogin(@Valid @RequestBody AccountLoginDTO accountDTO) {
return Response.success(accountService.enterpriseLogin(accountDTO));
}
@PostMapping("schoolLogin")
@ApiOperation(value = "学校登录")
public Response<AccountLoginVO> schoolLogin(@Valid @RequestBody AccountLoginDTO accountDTO) {
return Response.success(accountService.schoolLogin(accountDTO));
}
@PostMapping("addOrUpdateSubAccount")
@ApiOperation(value = "子账号新增")
public Response<Boolean> addSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
return Response.success(accountService.addSubAccount(addSubAccountDTO));
}
@PostMapping("deleteSubAccount")
@ApiOperation(value = "子账号删除")
public Response<Boolean> deleteSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
return Response.success(accountService.deleteSubAccount(addSubAccountDTO));
}
@PostMapping("subAccountList")
@ApiOperation(value = "子账号查询")
public Response<PageBaseResponse<Account>> subAccountList(@Valid @RequestBody SubAccountPageDTO subAccountPageDTO) {
return Response.success(accountService.subAccountList(subAccountPageDTO));
}
@GetMapping("accountDetail")
@ApiOperation(value = "账号详情")
public Response<Account> accountDetail(@RequestParam("id") Long id) {
return Response.success(accountService.accountDetail(id));
}
@PostMapping("getAccountDetail")
@ApiOperation(value = "获取账户信息")
public Response<AccountLoginVO> getAccountDetail() {
return Response.success(accountService.getAccountDetail());
}
@GetMapping("/bindGoogle")
@ApiOperation(value = "绑定谷歌")
public Response<AccountExtend> bindGoogle(@RequestParam("credential") String credential) {
return Response.success(accountService.bindGoogle(credential));
}
@GetMapping("/bindWeChat")
@ApiOperation(value = "绑定微信")
public Response<AccountExtend> bindWeChat(@RequestParam("code") String code) {
return Response.success(accountService.bindWeChat(code));
}
@GetMapping("/bindEmail")
@ApiOperation(value = "绑定邮箱")
public Response<BindEmailVO> bindEmail(@RequestParam("email") String email) {
return Response.success(accountService.bindEmail(email));
}
@GetMapping("/unbindWeChat")
@ApiOperation(value = "解除绑定微信")
public Response<Boolean> unbindWeChat() {
return Response.success(accountService.unbindWeChat());
}
@GetMapping("/unbindGoogle")
@ApiOperation(value = "解除绑定谷歌")
public Response<Boolean> unbindGoogle() {
return Response.success(accountService.unbindGoogle());
}
@GetMapping("/updateUserInfo")
@ApiOperation(value = "更新用户国家、职业信息")
public Response<String> updateUserInfo(@RequestParam(value = "country", required = false) String country, @RequestParam(value = "occupation", required = false) String occupation) {
accountService.updateUserInfo(country, occupation);
return Response.success();
}
}

View File

@@ -0,0 +1,85 @@
package com.ai.da.controller;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.AffiliateQueryDTO;
import com.ai.da.model.vo.AffiliateInvitationDetailsVO;
import com.ai.da.model.vo.AffiliateVO;
import com.ai.da.service.AffiliateService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
@Slf4j
@RestController
@RequestMapping("/api/affiliate")
@Api(tags = "Affiliate模块")
public class AffiliateController {
@Resource
private AffiliateService affiliateService;
@ApiOperation(value = "注册成为affiliate")
@GetMapping("/registration")
public Response<Boolean> completeGuidance(@RequestParam(value = "promotionMethod", required = false) String promotionMethod) {
return Response.success(affiliateService.registerAsAnAffiliate(promotionMethod));
}
@ApiOperation(value = "获取affiliate列表")
@PostMapping("/list")
public Response<PageBaseResponse<AffiliateVO>> getAffiliateList(@Valid @RequestBody AffiliateQueryDTO affiliateQueryDTO) {
return Response.success(affiliateService.getAffiliateList(affiliateQueryDTO));
}
@ApiOperation(value = "获取affiliate个人中心")
@GetMapping("/personalCenter")
public Response<AffiliateVO> personalAffiliateCenter() {
return Response.success(affiliateService.personalAffiliateCenter());
}
@ApiOperation(value = "获取个人佣金图表数据")
@GetMapping("/getPersonalMonthlyIncome")
public Response<double[]> 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) {
return Response.success(affiliateService.applicationApproval(id, isApproved));
}
/*@ApiOperation(value = "定时计算佣金")
@GetMapping("/testTask")
public Response<String> testTask() {
affiliateService.updateAffiliateInfoWithPayment();
return Response.success("success ");
}*/
/*@ApiOperation(value = "每月发送结算邮件")
@GetMapping("/commissionCalculation")
public Response<String> commissionCalculation(@RequestParam("year") Integer year, @RequestParam("month") Integer month) {
affiliateService.commissionCalculation(year, month);
return Response.success("success ");
}*/
@ApiOperation(value = "affiliate链接浏览量增加")
@GetMapping("/viewsIncrease")
public Response<Boolean> viewsGet(@RequestParam("id") Long id) {
return Response.success(affiliateService.affiliateLinkViewsIncrease(id));
}
@ApiOperation(value = "获取每个affiliate产生的收入")
@PostMapping("/getEachAffiliateGeneratedRevenue")
public Response<IPage<AffiliateInvitationDetailsVO>> getEachAffiliateGeneratedRevenue(@RequestBody AffiliateQueryDTO affiliateQueryDTO) {
return Response.success(affiliateService.getEachAffiliateGeneratedRevenue(affiliateQueryDTO));
}
}

View File

@@ -1,6 +1,7 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.ProductPurchaseDTO;
import com.ai.da.service.AliPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -8,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
@CrossOrigin
@@ -21,12 +24,12 @@ public class AliPayController {
private AliPayService aliPayService;
@ApiOperation("统一收单下单并支付页面接口的调用")
@PostMapping("/trade/page/pay/{amount}")
public Response<String> tradePagePay(@PathVariable Integer amount, @RequestParam String returnUrl){
@PostMapping("/trade/page/pay")
public Response<String> tradePagePay(@Valid @RequestBody ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request){
log.info("统一收单下单并支付页面接口的调用");
//支付宝开放平台接受 request 请求对象后
// 会为开发者生成一个html 形式的 form表单包含自动提交的脚本
String formStr = aliPayService.tradeCreate(amount, returnUrl);
String formStr = aliPayService.tradeCreate(productPurchaseDTO, request);
//我们将form表单字符串返回给前端程序之后前端将会调用自动提交脚本进行表单的提交
//此时表单会自动提交到action属性所指向的支付宝开放平台中从而为用户展示一个支付页面
return Response.success(formStr);

View File

@@ -1,6 +1,7 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.ProductPurchaseDTO;
import com.ai.da.service.AlipayHKService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -8,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
@CrossOrigin
@RestController
@@ -20,9 +23,9 @@ public class AlipayHKController {
private AlipayHKService alipayHKService;
@ApiOperation(value = "创建订单")
@PostMapping(value = "/createOrder/{wallet}/{amount}")
public Response<String> createOrder(@PathVariable Integer amount, @PathVariable String wallet) {
String order = alipayHKService.createOrder(amount, wallet);
@PostMapping(value = "/createOrder")
public Response<String> createOrder(@Valid @RequestBody ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request) {
String order = alipayHKService.createOrder(productPurchaseDTO, request);
return Response.success(order);
}

View File

@@ -2,20 +2,21 @@ package com.ai.da.controller;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.DesignMapper;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.AccountAddDTO;
import com.ai.da.model.dto.QueryPaymentInfoDTO;
import com.ai.da.model.dto.UserDesignStatisticDTO;
import com.ai.da.model.vo.PaymentInfoVO;
import com.ai.da.model.vo.QuestionnaireFeedbackVO;
import com.ai.da.model.vo.QuestionnaireVO;
import com.ai.da.model.vo.QueryUserConditionsVO;
import com.ai.da.service.AccountService;
import com.ai.da.service.ConvenientInquiryService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itextpdf.text.pdf.PRIndirectReference;
import io.netty.util.internal.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Nullable;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -196,5 +198,21 @@ public class ConvenientInquiryController {
return Response.success(convenientInquiryService.getAllUserIdList());
}
@ApiOperation("获取所有交易信息")
@PostMapping("/queryTransaction")
public Response<PageBaseResponse<PaymentInfoVO>> queryTransactionRecords(@Valid @RequestBody QueryPaymentInfoDTO queryPaymentInfoDTO){
return Response.success(convenientInquiryService.queryTransactionRecords(queryPaymentInfoDTO));
}
@ApiOperation("获取所有国家、城市")
@GetMapping("/getCities")
public Response<Map<String, List<String>>> getCities(){
return Response.success(convenientInquiryService.getCities());
}
@ApiOperation("下载交易记录")
@PostMapping("/queryTransaction/download")
public Response<String> exportTransactionRecords(@Valid @RequestBody QueryPaymentInfoDTO queryPaymentInfoDTO, HttpServletResponse response){
return Response.success(convenientInquiryService.exportTransactionRecords(queryPaymentInfoDTO, response));
}
}

View File

@@ -31,7 +31,7 @@ public class DesignController {
@ApiOperation(value = "设计 Conllection")
@PostMapping("/designCollection")
@CrossOrigin
public Response<DesignCollectionVO> designCollection(@Valid @RequestBody DesignCollectionDTO designDTO) {
public Response<String> designCollection(@Valid @RequestBody DesignCollectionDTO designDTO) {
return Response.success(designService.designCollection(designDTO));
}
@@ -43,7 +43,7 @@ public class DesignController {
@ApiOperation(value = "重新设计 Collection")
@PostMapping("/reDesignCollection")
public Response<DesignCollectionVO> reDesignCollection(@Valid @RequestBody ReDesignCollectionDTO reDesignDTO) {
public Response<String> reDesignCollection(@Valid @RequestBody ReDesignCollectionDTO reDesignDTO) {
return Response.success(designService.reDesignCollection(reDesignDTO));
}
@@ -71,6 +71,12 @@ public class DesignController {
return Response.success(designService.dislike(disDesignLikeDTO));
}
@ApiOperation(value = "Design sort")
@PostMapping("/sort")
public Response<Boolean> sort(@Valid @RequestBody UserLikeSortDTO userLikeSortDTO) {
return Response.success(designService.sort(userLikeSortDTO));
}
@ApiOperation(value = "sketchBoard upload generate design前裁剪")
@PostMapping("/sketchBoardsBoundingBox")
public Response<List<CollectionSketchVO>> sketchesBoundingBox(@Valid @RequestBody ReDesignCollectionDTO reDesignCollectionDTO) {
@@ -83,4 +89,16 @@ public class DesignController {
return Response.success(designService.getModel(designItemIdList));
}
@ApiOperation(value = "获取design结果")
@GetMapping("/getDesignResult")
public Response<DesignCollectionVO> getDesignResult(@RequestParam("requestId") String requestId, @RequestParam("objectSignList") List<String> objectSignList){
return Response.success(designService.getDesignResult(requestId, objectSignList));
}
@ApiOperation(value = "云生成")
@PostMapping("/designCloud")
@CrossOrigin
public Response<String> designCloud(@Valid @RequestBody DesignCollectionDTO designDTO) {
return Response.success(designService.designCloud(designDTO));
}
}

View File

@@ -5,7 +5,6 @@ import com.ai.da.model.dto.*;
import com.ai.da.model.vo.*;
import com.ai.da.service.DesignItemService;
import com.ai.da.service.DesignService;
import com.ai.da.service.UserLikeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -15,8 +14,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@Api(tags = "design Detail模块")

View File

@@ -66,6 +66,8 @@ public class ElementController {
return Response.success();
}
/** 该功能已删除 */
@Deprecated
@ApiOperation(value = "生成印花")
@PostMapping("/generatePrint")
public Response<GenerateCollectionItemVO> generatePrint(@Valid @RequestBody CollectionGeneratePrintDTO generatePrintDTO) {

View File

@@ -3,9 +3,10 @@ package com.ai.da.controller;
import com.ai.da.common.enums.OrderStatusEnum;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.OrderInfo;
import com.ai.da.model.dto.QueryPageByTimeDTO;
import com.ai.da.model.vo.OrderListVO;
import com.ai.da.service.OrderInfoService;
import com.ai.da.service.PaymentInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@@ -22,10 +23,13 @@ public class OrderInfoController {
@Resource
private OrderInfoService orderInfoService;
@Resource
private PaymentInfoService paymentInfoService;
@ApiOperation("订单列表")
@PostMapping("/list")
public Response<PageBaseResponse<OrderInfo>> list(@Valid @RequestBody QueryPageByTimeDTO queryPageByTimeDTO){
PageBaseResponse<OrderInfo> orderByAccountId = orderInfoService.getOrderByPage(queryPageByTimeDTO);
public Response<PageBaseResponse<OrderListVO>> list(@Valid @RequestBody QueryPageByTimeDTO queryPageByTimeDTO){
PageBaseResponse<OrderListVO> orderByAccountId = paymentInfoService.getPaymentInfo(queryPageByTimeDTO);
// List<OrderInfo> list = orderInfoService.listOrderByCreateTimeDesc();
return Response.success(orderByAccountId);
}

View File

@@ -1,6 +1,7 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.ProductPurchaseDTO;
import com.ai.da.service.PayPalCheckoutService;
import com.paypal.http.HttpResponse;
import com.paypal.http.exceptions.SerializeException;
@@ -14,6 +15,7 @@ import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
@@ -26,9 +28,9 @@ public class PayPalCheckoutController {
private PayPalCheckoutService payPalCheckoutService;
@ApiOperation(value = "创建订单")
@PostMapping(value = "/trade/{amount}")
public Response<HashMap<String, String>> createOrder(@PathVariable Integer amount, @RequestParam String returnUrl) throws SerializeException {
HashMap<String, String> approvalUrl = payPalCheckoutService.createOrder(amount,returnUrl);
@PostMapping(value = "/trade")
public Response<HashMap<String, String>> createOrder(@Valid @RequestBody ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request) throws SerializeException {
HashMap<String, String> approvalUrl = payPalCheckoutService.createOrder(productPurchaseDTO, request);
return Response.success(approvalUrl);
}

View File

@@ -251,4 +251,10 @@ public class SavedCollectionController {
public Response<String> download() {
return Response.success(userLikeGroupService.download());
}
@ApiOperation(value = "productImageInitialize")
@PostMapping("/productImageInitialize")
public Response<Boolean> productImageUpload(@Valid @RequestBody ProductImageInitializeDTO productImageInitializeDTO) {
return Response.success(userLikeGroupService.productImageInitialize(productImageInitializeDTO));
}
}

View File

@@ -1,47 +1,55 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.ProductPurchaseDTO;
import com.ai.da.service.StripeService;
import com.paypal.http.HttpResponse;
import com.paypal.payments.Refund;
import com.stripe.exception.StripeException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@Api(tags = "Stripe模块")
@Slf4j
@RestController
@RequestMapping("/api/stripe")
@ApiIgnore
public class StripeController {
@Resource
private StripeService stripeService;
@ApiOperation("创建支付链接")
@PostMapping("/createOrder/{amount}")
public Response<String> pay(@PathVariable Integer amount, @RequestParam String returnUrl) {
return Response.success(stripeService.pay(amount, returnUrl));
@PostMapping("/createOrder")
public Response<String> pay(@Valid @RequestBody ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request) {
return Response.success(stripeService.pay(productPurchaseDTO, request));
}
@ApiOperation("支付通知")
@PostMapping("/trade/notify")
public Response<String> callback(HttpServletRequest request) throws ServletException, IOException {
public void callback(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Boolean result = stripeService.notify(request);
if (result){
return Response.success(200,"success");
response.setStatus(HttpServletResponse.SC_OK);
}else {
return Response.fail(400,"failure");
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}
@ApiOperation("申请退款")
@PostMapping("/trade/refund/{orderNo}/{reason}")
@GetMapping("/trade/refund/{orderNo}/{reason}")
public Response<HttpResponse<Refund>> refund(@PathVariable String orderNo, @PathVariable String reason) throws IOException {
String response = stripeService.refund(null,orderNo,reason);
if (response.equals("退款成功")){
@@ -51,4 +59,58 @@ public class StripeController {
}
}
@ApiOperation("获取订阅")
@GetMapping("/getSubscription")
public Response<List<String>> getSubscription(@RequestParam String name, @RequestParam String email) {
try {
return Response.success(stripeService.getSubscriptionIds(name, email));
} catch (StripeException e) {
throw new RuntimeException(e);
}
}
@ApiOperation("取消订阅")
@GetMapping("/cancelSubscription")
public Response<String> cancelSubscription(@RequestParam String subscriptionId, @RequestParam(required = false) String reason) {
stripeService.cancelSubscription(subscriptionId, reason);
return Response.success("success");
}
/*@ApiOperation("临时 取消订阅")
@GetMapping("/cancelSubscriptionTemp")
public Response<String> cancelSubscriptionTemp(@RequestParam String subscriptionId) {
stripeService.cancelSubscriptionTemp(subscriptionId);
return Response.success("success");
}
@ApiOperation("创建订阅 临时")
@GetMapping("/createSubscriptionTemp")
public Response<String> createSubscriptionTemp(@RequestParam String name, @RequestParam String email) {
return Response.success(stripeService.createSubscriptionTemp(name, email));
}
@ApiOperation("修改用户默认支付方式 临时")
@GetMapping("/changeCustomerPayment")
public Response<String> changeCustomerPayment(@RequestParam String name, @RequestParam String email) {
return Response.success(stripeService.changeCustomerPayment(name, email));
}
@ApiOperation("临时 发送续订失败邮件")
@GetMapping("/sendRenewalFailEmail")
public Response<Boolean> sendRenewalFailEmail(@RequestParam String invoiceId, @RequestParam String subscriptionId, @RequestParam String orderNo) {
return Response.success(stripeService.sendRenewalFailEmail(invoiceId, subscriptionId,orderNo));
}
@ApiOperation("临时 查询指定用户绑定的付款方式")
@GetMapping("/getCustomerPaymentMethod")
public Response<List<Map<String,String>>> getCustomerPaymentMethod(@RequestParam String name, @RequestParam String email) {
return Response.success(stripeService.getCustomerPaymentMethod(name, email));
}
@ApiOperation("临时 解绑指定用户绑定的所有付款方式")
@GetMapping("/detachCustomerAllPaymentMethod")
public Response<String> detachCustomerAllPaymentMethod(@RequestParam String name, @RequestParam String email) {
return Response.success(stripeService.detachCustomerAllPaymentMethod(name, email));
}*/
}

View File

@@ -25,7 +25,7 @@ public class TagsController {
@ApiOperation("获取标签")
@GetMapping("/getTags")
public Response<List<Tags>> getTags(@RequestParam("userInput") String userInput) {
public Response<List<Tags>> getTags(@RequestParam(value = "userInput", required = false) String userInput) {
return Response.success(tagsService.getTags(userInput));
}
}

View File

@@ -1,9 +1,13 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.GoogleUser;
import com.ai.da.model.dto.*;
import com.ai.da.model.vo.AccountLoginVO;
import com.ai.da.model.vo.DesignCollectionVO;
import com.ai.da.service.AccountService;
import com.ai.da.service.DesignService;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -28,6 +32,9 @@ public class ThirdPartyController {
@Resource
private AccountService accountService;
@Resource
private DesignService designService;
/*@ApiOperation(value = "Add user information")
@PostMapping("/addUser")
public Response<Boolean> addUser(@Valid @RequestBody AccountAddDTO accountAddDTO) {
@@ -121,4 +128,22 @@ public class ThirdPartyController {
public Response<String> googleCallback(@RequestParam("code") String code, HttpSession session) {
return Response.success(accountService.googleCallback(code, session));
}
@CrossOrigin
@GetMapping("/parseGoogleCredential")
public Response<AccountLoginVO> parseGoogleCredential(@RequestParam("credential") String credential, @RequestParam("type") Integer type) {
return Response.success(accountService.parseGoogleCredential(credential, type));
}
@CrossOrigin
@GetMapping("/parseWeChatCode")
public Response<AccountLoginVO> parseWeChatCode(@RequestParam("code") String code, @RequestParam("type") Integer type) {
return Response.success(accountService.parseWeChatCode(code, type));
}
@ApiOperation(value = "接收Design结果")
@PostMapping("/receiveDesignResults")
@CrossOrigin
public Response<Boolean> receiveDesignResults(@Valid @RequestBody JSONObject responseObject) {
return Response.success(designService.receiveDesignResults(responseObject));
}
}

View File

@@ -1,6 +1,7 @@
package com.ai.da.mapper.primary.entity;
package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.AccountExtend;
import java.util.Date;
import java.util.List;

View File

@@ -30,6 +30,6 @@ public interface AccountMapper extends CommonMapper<Account> {
*/
// Account findById(String id);
void toVisitor(Long id, Date date);
void toVisitor(Long id);
}

View File

@@ -0,0 +1,14 @@
package com.ai.da.mapper.primary;
import com.ai.da.mapper.primary.entity.AffiliateIncome;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
public interface AffiliateIncomeMapper extends BaseMapper<AffiliateIncome> {
List<Map<String, Object>> getPersonalMonthlyIncome(Long affiliateAccountId, int year);
List<Map<String, Object>> getMonthlyAffiliateIncome(int year, int month);
}

View File

@@ -0,0 +1,19 @@
package com.ai.da.mapper.primary;
import com.ai.da.mapper.primary.entity.Affiliate;
import com.ai.da.model.vo.AffiliateVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
public interface AffiliateMapper extends BaseMapper<Affiliate> {
Map<String, Long> getMonthlyApprovedAffiliate(int year, int month);
List<AffiliateVO> getAffiliateList(String status, String startTime, String endTime,
String order, Long affiliateId, int size, int offset);
int queryAffiliateTotalCount(String status, String startTime, String endTime, Long affiliateId);
}

View File

@@ -0,0 +1,16 @@
package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.AccountExtend;
import com.ai.da.mapper.primary.entity.DesignBatch;
/**
* Mapper 接口
*
* @author easy-generator
* @since 2022-06-13
*/
public interface DesignBatchMapper extends CommonMapper<DesignBatch> {
}

View File

@@ -0,0 +1,7 @@
package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.MoodboardPosition;
public interface MoodboardPositionMapper extends CommonMapper<MoodboardPosition> {
}

View File

@@ -1,7 +1,29 @@
package com.ai.da.mapper.primary;
import com.ai.da.mapper.primary.entity.PaymentInfo;
import com.ai.da.model.vo.OrderListVO;
import com.ai.da.model.vo.PaymentInfoVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
public interface PaymentInfoMapper extends BaseMapper<PaymentInfo> {
List<OrderListVO> selectPageOrderList(Long accountId, String startTime, String endTime, int offset, int pageSize, Long id);
int queryOrderListTotalCount(Long accountId, String startTime, String endTime, Long id);
List<PaymentInfoVO> queryPaymentInfo(String paymentType,String payerTotal, String type, String status,
String country, String city, String startTime, String endTime,
int limit, int offset, String order, String payer
);
Long queryPaymentInfoCount(String paymentType,String payerTotal, String type, String status,
String country, String city, String startTime, String endTime, String payer
);
List<Map<String, String>> getCities();
List<Map<String, String>> getCountries();
}

View File

@@ -0,0 +1,7 @@
package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.ProductImageAttribute;
public interface ProductImageAttributeMapper extends CommonMapper<ProductImageAttribute> {
}

View File

@@ -0,0 +1,8 @@
package com.ai.da.mapper.primary;
import com.ai.da.mapper.primary.entity.SubscriptionInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface SubscriptionInfoMapper extends BaseMapper<SubscriptionInfo> {
}

View File

@@ -0,0 +1,7 @@
package com.ai.da.mapper.primary;
import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.UserLikeSort;
public interface UserLikeSortMapper extends CommonMapper<UserLikeSort> {
}

View File

@@ -57,6 +57,11 @@ public class Account implements Serializable {
*/
private String country;
/**
* 职业
*/
private String occupation;
/**
* 账户有效期开始时间
*/
@@ -97,6 +102,10 @@ public class Account implements Serializable {
* 2 月付用户
* 3 试用用户
* 4 参加活动获取30天有效期和6000个积分的用户
* 5 企业管理员账号
* 6 企业子账号
* 7 学校管理员
* 8 学校子账号
*/
private Integer systemUser;
@@ -104,4 +113,16 @@ public class Account implements Serializable {
* 头像
*/
private String avatar;
private String organizationName;
private Long parentId;
private Integer isAdmin;
private BigDecimal shareCredits;
private Integer subAccountNum;
private String invitationCode;
}

View File

@@ -1,5 +1,6 @@
package com.ai.da.mapper.primary.entity;
import com.ai.da.common.response.PageResponse;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -26,5 +27,9 @@ public class AccountExtend implements Serializable {
private String authType;
private String headImgUrl;
private String name;
private String auth;
}

View File

@@ -0,0 +1,30 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_affiliate")
public class Affiliate extends BaseEntity{
private Long accountId;
// Active活跃 || Inactive过期 || Pending待审批 || Refused(拒绝)
private String status;
private Float totalEarnings = 0.00F;
private Float monthlyEarnings = 0.00F;
private Float unpaidEarnings = 0.00F;
private Integer visits = 0;
private Boolean approved = false;
private String link;
private String promotionMethod;
}

View File

@@ -0,0 +1,28 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_affiliate_income")
public class AffiliateIncome extends BaseEntity {
private Long affiliateId;
private Long affiliateAccountId;
private Long inviteeAccountId;
private Float amount;
private Long paymentInfoId;
private LocalDateTime paymentTime;
private Float commission;
}

View File

@@ -0,0 +1,44 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("design_batch")
public class DesignBatch implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long accountId; // account_id
private Long designId; // design_id
private Long collectionId; // collection_id
private Integer status; // status
private LocalDateTime createTime; // create_time
private LocalDateTime updateTime; // update_time
private String taskId; // task_id
private Integer totalNum; // total_num
private Integer completedNum; // completed_num
}

View File

@@ -0,0 +1,29 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("moodboard_position")
public class MoodboardPosition implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long moodboardId;
private Long collectionId;
private String type;
private String styleData;
private Integer sequence;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@@ -21,5 +21,18 @@ public class OrderInfo extends BaseEntity{
private String orderStatus;//订单状态
private String note;
private String paymentType;//支付方式
// 可用于标记用户订单是否首次订阅
private byte isFirstSubscription = 0;
private byte isCommissionCalculated = 0;
private String ipAddress;
private String country;
private String city;
}

View File

@@ -2,7 +2,9 @@ package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_payment_info")
public class PaymentInfo extends BaseEntity{
@@ -13,11 +15,36 @@ public class PaymentInfo extends BaseEntity{
private String paymentType;//支付类型
private String tradeType;//交易类型
/**
* PayPal 订单状态CREATED/SAVED/APPROVED/VOIDED/COMPLETED/PAYER_ACTION_REQUIRED
* Stripe 订单状态: 原 session 状态open/completed/expired ; 现 invoice 状态draft/open/paid/uncollectible/void
* Alipay-HK 订单状态wait, paid, expired, liquidated
* paid and liquidated means the refund request has been executed.
* expired means the request has been rejected.
* wait means the request is still under processing.
*/
private String tradeState;//交易状态
private Float payerTotal;//支付金额(元)
private String content;//通知参数
// 支付类型 new || renewal || credits
private String type;
// 当前支付是否已邮件通知 0 || 1
private Integer notified;
private String paymentMethod;
private String last4;
// 发票托管页面
private String hostedInvoiceUrl;
private String ipAddress;
private String country;
private String city;
}

View File

@@ -0,0 +1,35 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("product_image_attribute")
public class ProductImageAttribute implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String imgName;
private String length;
private String sleeveLength;
private String sleeveShape;
private String sleeveShoulder;
private String neckline;
private String collar;
private String design;
private String silhouette;
private String type;
private String openingType;
private String subtype;
private String style;
}

View File

@@ -0,0 +1,39 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_subscription_info")
public class SubscriptionInfo extends BaseEntity{
private Long accountId;
private String orderNo;
// stripe || paypal 平台生成的id
private String subscriptionId;
// month || year
private String type;
// active || expired
private String status = "active";
private byte cancelNotified = (byte)0;
// 续订的下一个付款日
private String nextPayDate;
// 当前订阅订单有效期开始时间
private Long currentPeriodStart;
// 当前订阅订单有效期结束时间
private Long currentPeriodEnd;
// 取消订阅原因
private String cancelReason;
}

View File

@@ -10,4 +10,7 @@ import lombok.EqualsAndHashCode;
public class Tags extends BaseEntity{
private String tagName;
// 表示标签是否正在活动中 0->不在活动中 1->在活动中
private byte active = (byte)0;
}

View File

@@ -0,0 +1,24 @@
package com.ai.da.mapper.primary.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("user_like_sort")
public class UserLikeSort implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long userLikeGroupId;
private Long userLikeId;
private Integer sort;
}

View File

@@ -19,6 +19,4 @@ public class AttributeRetrieval {
private String subtype;
private String style;
private Integer deprecated;
}

View File

@@ -5,15 +5,14 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
@ApiModel("绑定邮箱")
public class AccountBindEmailDTO {
@NotNull(message = "userId.cannot.be.empty")
@ApiModelProperty("用户id")
private Long userId;
// @NotNull(message = "userId.cannot.be.empty")
// @ApiModelProperty("用户id")
// private Long userId;
@NotBlank(message = "email.cannot.be.empty")
@ApiModelProperty("邮箱")

View File

@@ -6,4 +6,6 @@ import lombok.Data;
@Data
public class AccountDesignWorksRegisterDTO extends Account {
private String emailVerifyCode;
// private String invitationCode;
}

View File

@@ -32,4 +32,6 @@ public class AccountLoginDTO {
@ApiModelProperty("邮箱验证码")
private String emailVerifyCode;
private String organizationName;
}

View File

@@ -0,0 +1,12 @@
package com.ai.da.model.dto;
import com.ai.da.mapper.primary.entity.Account;
import lombok.Data;
import java.util.List;
@Data
public class AddSubAccountDTO extends Account {
private List<Long> deleteIdList;
}

View File

@@ -0,0 +1,31 @@
package com.ai.da.model.dto;
import lombok.Data;
@Data
public class AffiliateEmailParamsDTO {
private String username;
private String promotionMethod;
private String totalProgramRevenue;
private String newApprovedAffiliates;
private String unpaidEarnings;
private String paidEarnings;
public AffiliateEmailParamsDTO() {
}
public AffiliateEmailParamsDTO(String username) {
this.username = username;
}
public AffiliateEmailParamsDTO(String username, String promotionMethod) {
this.username = username;
this.promotionMethod = promotionMethod;
}
}

View File

@@ -0,0 +1,31 @@
package com.ai.da.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("查询affiliate列表")
public class AffiliateQueryDTO extends TimeQueryBaseDTO{
@ApiModelProperty("Active活跃 || Inactive过期 || Pending待审批 || Refused(拒绝)")
private String status;
@ApiModelProperty("推广者id")
private Long affiliateId;
@ApiModelProperty("按时间 DESC 降序 || ASC 升序")
private String order = "ASC";
@Override
public String toString() {
return "AffiliateQueryDTO{" +
"status='" + status + '\'' + ' ' +
"startTime='" + super.getStartTime() + '\'' + ' ' +
"endTime='" + super.getEndTime() + '\'' + ' ' +
"page='" + super.getPage() + '\'' + ' ' +
"size='" + super.getSize() + '\'' + ' ' +
'}';
}
}

View File

@@ -63,4 +63,8 @@ public class DesignCollectionDTO {
private String moodboardPosition;
private List<String> requestIdList;
private Integer designNum;
}

View File

@@ -15,10 +15,17 @@ public class EmailSendDTO {
private String email;
@NotBlank(message = "operationType.cannot.be.empty")
@ApiModelProperty("操作类型 LOGIN 注册 FORGET_PWD 忘记密码 BIND_MAILBOX 绑定邮箱 CHANGE_MAILBOX 更改邮箱")
@ApiModelProperty("操作类型 LOGIN 注册 FORGET_PWD 忘记密码 BIND_MAILBOX 绑定邮箱 " +
"CHANGE_MAILBOX 更改邮箱 UPDATE_USERINFO 仅填写国家、职业(不发送邮件)")
private String operationType;
@ApiModelProperty("异常ip")
private String ip;
@ApiModelProperty("国家")
private String country;
@ApiModelProperty("职业")
private String occupation;
}

View File

@@ -12,49 +12,50 @@ import javax.validation.constraints.NotNull;
public class GenerateThroughImageTextDTO {
@NotNull(message = "userId cannot be empty")
@ApiModelProperty("用户id")
Long userId;
private Long userId;
@ApiModelProperty("caption | prompt")
String text;
private String text;
@ApiModelProperty("图片在t_collection_element表中的id")
Long collectionElementId;
private Long collectionElementId;
// todo 后续取消这个字段的传输,由后端自行判断相关参数是否有值
// @NotBlank(message = "you have to choose the generate type")
@ApiModelProperty("text image text-image")
String generateType;
private String generateType;
@ApiModelProperty("图片来源update从library中选择,从toProductImage结果中选择 collection || library || productImage")
String designType;
private String designType;
@NotBlank(message = "level1Type cannot be empty!")
@ApiModelProperty("Moodboard Printboard Sketchboard MarketingSketch")
String level1Type;
private String level1Type;
@ApiModelProperty("Outwear Dress Blouse Skirt Trousers || Logo Slogan Pattern")
String level2Type;
private String level2Type;
@ApiModelProperty("性别")
String gender;
private String gender;
@ApiModelProperty("选择的模型名")
String version;
@ApiModelProperty("选择的模型名 high || fast")
private String version;
@NotBlank(message = "timeZone cannot be empty!")
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
String timeZone;
private String timeZone;
@ApiModelProperty("唯一id用于保持消息唯一性")
String uniqueId;
private String uniqueId;
@NotNull(message = "Please check if the required fields are empty.(isTestUser)")
@ApiModelProperty("是否是测试用户")
Boolean isTestUser;
private Boolean isTestUser;
@ApiModelProperty("页面上用户设计的slogan所截的图片")
String sloganBase64;
private String sloganBase64;
@ApiModelProperty("种子 取值范围 0~500")
String seed;
private String seed;
}

View File

@@ -0,0 +1,10 @@
package com.ai.da.model.dto;
import lombok.Data;
import java.util.List;
@Data
public class ProductImageInitializeDTO {
private List<Long> libraryIds;
}

View File

@@ -0,0 +1,33 @@
package com.ai.da.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
@ApiModel("购买产品DTO")
public class ProductPurchaseDTO {
@ApiModelProperty("购买数量")
private int quantity;
// http://example.com
@NotBlank(message = "return url cannot be empty")
@ApiModelProperty("购买完成后返回页面地址")
private String returnUrl;
@NotBlank(message = "product name cannot be empty")
@ApiModelProperty("产品名 CreditsPurchase || Subscription")
private String productName;
@ApiModelProperty("Month || Year")
private String subscribeType;
@ApiModelProperty("是否自动续订 one_time || recurring")
private Boolean autoRenewal;
@ApiModelProperty("使用Alipay-HK时需要选择 ALIPAYHK || ALIPAYCN")
private String wallet;
}

View File

@@ -16,4 +16,7 @@ public class QueryPageByTimeDTO extends PageQueryBaseVo {
@ApiModelProperty("结束时间 yyyy-mm-dd hh:mm:ss 可以不要时分秒")
private String endTime;
@ApiModelProperty("指定id")
private Long id;
}

View File

@@ -0,0 +1,30 @@
package com.ai.da.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@Data
@ApiModel("交易记录详情")
public class QueryPaymentInfoDTO extends QueryPageByTimeDTO {
@ApiModelProperty("选择的支付平台 PayPal || Stripe || Alipay-HK")
private String platform;
@ApiModelProperty("支付的金额 单位:HKD")
private String payerTotal;
@ApiModelProperty("商品种类 new || renewal || credits")
private String type;
@ApiModelProperty("交易状态 Success || Fail || Pending")
private String status;
@ApiModelProperty("付款人所在国家")
private String country;
@ApiModelProperty("付款人所在城市")
private String city;
@ApiModelProperty("按id排序 DESC || ASC")
private String order = "DESC";
@ApiModelProperty("付款用户名")
private String payer;
}

View File

@@ -33,7 +33,7 @@ public class ReDesignCollectionDTO {
@ApiModelProperty("市场手稿板图片id 数组")
private List<DesignCollectionElementDTO> marketingSketchs;
@NotNull(message = "colorBoards.cannot.be.empty")
@NotNull(message = "systemScale.cannot.be.empty")
@ApiModelProperty("系统取图比列")
private BigDecimal systemScale;
@@ -67,4 +67,8 @@ public class ReDesignCollectionDTO {
private String moodboardPosition;
private String moodTemplateId;
private List<String> requestIdList;
private Integer designNum;
}

View File

@@ -0,0 +1,9 @@
package com.ai.da.model.dto;
import com.ai.da.model.vo.PageQueryBaseVo;
import lombok.Data;
@Data
public class SubAccountPageDTO extends PageQueryBaseVo {
private String userName;
}

View File

@@ -0,0 +1,55 @@
package com.ai.da.model.dto;
import lombok.Data;
@Data
public class SubscriptionEmailParamsDTO {
// 用户名
private String username;
// t_payment_info id每次支付对于用户来说是一笔新订单
private String orderId;
// 链接到订单列表的某个订单
private String orderRef;
// 订单支付创建日期
private String createDate;
// 购买数量
private String quantity;
// 费用
private String totalFee;
// 当前订阅开始时间
private String lastOrderDate;
// 当前订阅结束时间
private String endOfPrepaidTerm;
// 付款方式
private String paymentMethod;
private String last4;
// 订阅Id
private String subscriptionId;
// 订阅方式
private String subscriptionType;
// 订阅开始时间
private String startDate;
// 下一个支付日期
private String nextPayDate;
// 下次付款时间reminder
private String renewalTime;
// 付款失败原因
private String failMessage;
}

View File

@@ -0,0 +1,19 @@
package com.ai.da.model.dto;
import com.ai.da.model.vo.PageQueryBaseVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("按时间查询")
public class TimeQueryBaseDTO extends PageQueryBaseVo {
@ApiModelProperty("按时间区间查询 区间起点")
private String startTime;
@ApiModelProperty("按时间区间查询 区间终点")
private String endTime;
}

View File

@@ -0,0 +1,13 @@
package com.ai.da.model.dto;
import com.ai.da.mapper.primary.entity.UserLikeSort;
import lombok.Data;
import java.util.List;
@Data
public class UserLikeSortDTO{
private Long userLikeGroupId;
List<UserLikeSort> userLikeSortList;
}

View File

@@ -1,13 +1,14 @@
package com.ai.da.model.vo;
import com.ai.da.mapper.primary.entity.AccountExtend;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;
@AllArgsConstructor
@NoArgsConstructor
@@ -40,4 +41,36 @@ public class AccountLoginVO {
private Long followerCount;
private List<AccountExtend> accountExtendList;
private Long validStartTime;
private Long validEndTime;
private String Language;
// 订阅id(stripe提供)
private String subscriptionId;
// 订阅状态
private String status;
// 订阅过期时间
private String expireTime;
// 订阅类型 month || year
private String subscriptionType;
// 是否自动续订
private boolean isAutoRenewal;
// 是否是affiliate
private boolean isAffiliate = false;
private String country;
private String occupation;
private Long usernameModify;
}

View File

@@ -0,0 +1,25 @@
package com.ai.da.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AffiliateInvitationDetailsVO {
private Long accountId;
private String username;
private Float firstSubscriptionPaymentAmount;
private Float commission;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private LocalDateTime time;
}

View File

@@ -0,0 +1,17 @@
package com.ai.da.model.vo;
import com.ai.da.mapper.primary.entity.Affiliate;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AffiliateVO extends Affiliate {
private Long linkViewCount;
private String username;
}

View File

@@ -0,0 +1,9 @@
package com.ai.da.model.vo;
import lombok.Data;
@Data
public class BindEmailVO {
private String token;
}

View File

@@ -22,6 +22,8 @@ public class DesignCollectionItemVO {
@ApiModelProperty("t_design_python_outfit id")
private String designOutfitUrl;
private String objectSign;
public DesignCollectionItemVO() {
}

View File

@@ -23,6 +23,8 @@ public class DesignCollectionVO {
private String processId;
private List<String> UnfinishedList;
public DesignCollectionVO() {
}
}

View File

@@ -12,6 +12,8 @@ import java.util.List;
@ApiModel("design like-响应")
public class DesignLikeVO {
private Long userLikeSortId;
@ApiModelProperty("分组id")
private Long userGroupId;
@ApiModelProperty("分组详情id")
@@ -19,6 +21,10 @@ public class DesignLikeVO {
private String pictureName;
private Long userLikeId;
private Integer sort;
public DesignLikeVO() {
}
}

View File

@@ -0,0 +1,29 @@
package com.ai.da.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 用于订单列表展示(展示的是所有支付信息)
*/
@Data
public class OrderListVO {
private Long id;
private Float amount;
private String paymentMethod;
private String state;
private String orderType;
private String invoiceLink;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,34 @@
package com.ai.da.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@Data
@ApiModel("交易记录详情")
public class PaymentInfoVO {
private Long id;
@ApiModelProperty("付款用户名")
private String payer;
@ApiModelProperty("选择的支付平台 PayPal || Stripe || Alipay-HK")
private String platform;
@ApiModelProperty("支付的金额 单位:HKD")
private String payerTotal;
@ApiModelProperty("商品种类 new || renewal || credits")
private String type;
@ApiModelProperty("交易状态 Success || Fail || Pending")
private String status;
@ApiModelProperty("付款人所在国家")
private String country;
@ApiModelProperty("付款人所在城市")
private String city;
@ApiModelProperty("使用Stripe具体的支付方式")
private String paymentMethod;
@ApiModelProperty("信用卡支付的卡号后四位")
private String last4;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private String createTime;
}

View File

@@ -23,4 +23,7 @@ public class UserLikeVO {
@ApiModelProperty("图片路径")
private String designOutfitUrl;
private String pictureName;
private Integer sort;
private Long userLikeSortId;
}

View File

@@ -47,4 +47,8 @@ public class ValidateElementVO {
private String modelSex;
private String style;
private List<String> requestIdList;
private Integer designNum;
}

View File

@@ -41,6 +41,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -230,13 +231,17 @@ public class PythonService {
designPythonObjects.setProcess_id(processId);
long pinPrintNum = calculateDesignPinPrintNum(elementVO.getPrintBoardElements());
long noPinPrintNum = calculateDesignNoPinPrintNum(elementVO.getPrintBoardElements());
long noPrintNum = 8 - pinPrintNum - noPinPrintNum;
long noPinPrintNum = calculateDesignNoPinPrintNum(elementVO.getPrintBoardElements(), elementVO.getDesignNum());
long noPrintNum = elementVO.getDesignNum() - pinPrintNum - noPinPrintNum;
elementVO.setNoPinPrintNum(noPinPrintNum);
int[] sketchNumbers = new int[3];
for (int i = 0; i < 8; i++) {
int designNum = elementVO.getDesignNum();
Set<DesignPythonObject> assembledObjects = new HashSet<>(); // 用于存储已组装的 DesignPythonObject
DesignPythonObject lastAssembledObject = null; // 上一次组装的对象
for (int i = 0; i < designNum; i++) {
CurrentDesignPictureTypeEnum designPictureType = calculateCurrentDesignPictureTypeNew(elementVO, sketchNumbers, systemScale);
if (designPictureType == null) break;
@@ -255,19 +260,70 @@ public class PythonService {
noPrintNum--;
break;
}
// updatePrintNumbers(designPrintPictureType, pinPrintNum, noPinPrintNum, noPrintNum);
DesignPythonItemPrint designPythonItemPrint = getRandomPrint(elementVO, designPrintPictureType);
elementVO.setDesignPythonItemPrint(designPythonItemPrint);
elementVO.setDesignPrintPictureTypeLayoutList(calculateCurrentDesignPintPictureTypeLayout(elementVO.getModelSex()));
List<String> beforeAssemblyHasUseMd5List = new ArrayList<>(elementVO.getHasUseMd5List());
DesignPythonObject pythonObject = createDesignPythonObject(elementVO, designPictureType, systemScale, singleOverall, switchCategory, i);
// 如果当前对象与已组装的对象重复,则跳过当前组装
DesignPythonObject designPythonObjectCopy = getCopy(pythonObject);
boolean isDuplicate = assembledObjects.contains(designPythonObjectCopy);
if (isDuplicate) {
// if (lastAssembledObject != null && assembledObjects.contains(lastAssembledObject)) {
// // 如果当前组装与前一个组装的对象重复,且前一个组装也重复,结束组装
// System.out.println("当前组装的对象与前两个组装的对象重复,结束组装。");
// break;
// }
elementVO.setHasUseMd5List(beforeAssemblyHasUseMd5List);
i --;
switch (designPrintPictureType) {
case PIN:
pinPrintNum++;
break;
case NO_PIN:
noPinPrintNum++;
break;
case NO:
noPrintNum++;
break;
}
continue;
}
// 将当前对象添加到已组装的集合中,并记录
assembledObjects.add(designPythonObjectCopy);
// lastAssembledObject = designPythonObjectCopy; // 更新上一次组装的对象
DesignPythonObject pythonObject = createDesignPythonObject(elementVO, designPictureType, systemScale, singleOverall, switchCategory);
objects.add(pythonObject);
redisUtil.addProcessId(processId, i + 1);
}
return designPythonObjects;
}
private DesignPythonObject getCopy(DesignPythonObject pythonObject) {
DesignPythonObject designPythonObjectCopy = CopyUtil.copyObject(pythonObject, DesignPythonObject.class);
designPythonObjectCopy.setObjectSign(null);
DesignPythonBasic basic = designPythonObjectCopy.getBasic();
basic.setSave_name(null);
designPythonObjectCopy.setBasic(basic);
List<DesignPythonItem> items = designPythonObjectCopy.getItems();
List<DesignPythonItem> itemsCopy = new ArrayList<>();
for (DesignPythonItem item : items) {
item.setElementId(null);
item.setIcon(null);
item.setBusinessId(null);
item.setImage_id(null);
item.setImageId(null);
itemsCopy.add(item);
}
designPythonObjectCopy.setItems(itemsCopy);
return designPythonObjectCopy;
}
private void updateSketchNumbers(CurrentDesignPictureTypeEnum designPictureType, int[] sketchNumbers) {
switch (designPictureType) {
case PIN:
@@ -296,22 +352,26 @@ public class PythonService {
}
}
private DesignPythonObject createDesignPythonObject(ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType, BigDecimal systemScale, String singleOverall, String switchCategory) {
private DesignPythonObject createDesignPythonObject(ValidateElementVO elementVO, CurrentDesignPictureTypeEnum designPictureType, BigDecimal systemScale, String singleOverall, String switchCategory, int i) {
DesignPythonObject pythonObject = new DesignPythonObject();
pythonObject.setItems(coverToDesignPythonItemNew(elementVO, designPictureType, systemScale));
pythonObject.setBasic(coverToBasic(pythonObject.getItems().get(0), singleOverall, switchCategory, elementVO.getDesignLibraryModelPoint()));
if (CollectionUtil.isNotEmpty(elementVO.getRequestIdList())) {
pythonObject.setObjectSign(elementVO.getRequestIdList().get(i));
}
return pythonObject;
}
private CurrentDesignPictureTypeEnum calculateCurrentDesignPictureTypeNew(ValidateElementVO elementVO, int[] sketchNumbers, BigDecimal systemScale) {
List<CollectionElement> pinData = getPinData(elementVO);
Integer designNum = elementVO.getDesignNum();
if (CollectionUtil.isNotEmpty(pinData)) {
return CurrentDesignPictureTypeEnum.PIN;
} else {
if (sketchNumbers[1] == 0 && sketchNumbers[2] == 0) {
sketchNumbers[1] = systemScale.multiply(BigDecimal.valueOf(8 - sketchNumbers[0])).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
sketchNumbers[2] = 8 - sketchNumbers[0] - sketchNumbers[1];
sketchNumbers[1] = systemScale.multiply(BigDecimal.valueOf(designNum - sketchNumbers[0])).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
sketchNumbers[2] = designNum - sketchNumbers[0] - sketchNumbers[1];
}
if (sketchNumbers[2] > 0 && sketchNumbers[1] > 0) {
Long l = RandomsUtil.randomSysFile(0l, 2l);
@@ -491,7 +551,7 @@ public class PythonService {
}
//计算print 非Pin图片剩余张数
private long calculateDesignNoPinPrintNum(List<CollectionElement> printBoardElements) {
private long calculateDesignNoPinPrintNum(List<CollectionElement> printBoardElements, Integer designNum) {
if (CollectionUtils.isEmpty(printBoardElements)) {
return 0;
}
@@ -500,10 +560,10 @@ public class PythonService {
return 0;
} else {
long pinNum = printBoardElements.stream().filter(f -> f.getHasPin() == 1).count();
if (8 - pinNum < 4) {
return RandomsUtil.randomSysFile(0L, 8 - pinNum + 1);
if (designNum - pinNum < designNum/2) {
return RandomsUtil.randomSysFile(0L, designNum - pinNum + 1);
} else {
return RandomsUtil.randomSysFile(0L, 4L + 1);
return RandomsUtil.randomSysFile(0L, (long) (designNum/2 + 1));
}
}
}
@@ -553,7 +613,7 @@ public class PythonService {
if (elementVO.getSingleOverall().equals(SingleOverallEnum.OVERALL.getRealName())) {
List<String> otherSketchCategoryList = getOtherSketchCategoryList(elementVO.getModelSex(), designPythonItem);
if (!otherSketchCategoryList.isEmpty()) {
JSONObject attributeRecognition = getAttributeRecognition(designPythonItem, designPythonItem.getType(), elementVO.getModelSex());
JSONObject attributeRecognition = getAttributeRecognition(designPythonItem.getPath(), designPythonItem.getType(), elementVO.getModelSex());
for (String styleCategory : otherSketchCategoryList) {
DesignPythonItem otherSketch = processAttributeRecognition(attributeRecognition, elementVO, designPictureType, styleCategory, systemScale);
itemList.add(otherSketch);
@@ -790,7 +850,7 @@ public class PythonService {
return attributeRetrieval;
}
public JSONObject getAttributeRecognition(DesignPythonItem designPythonItem, String styleCategory, String modelSex) {
public JSONObject getAttributeRecognition(String sketchImgUrl, String styleCategory, String modelSex) {
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
@@ -801,7 +861,7 @@ public class PythonService {
JSONObject paramJSONObject = new JSONObject();
paramJSONObject.put("category", styleCategory);
paramJSONObject.put("colony", modelSex);
paramJSONObject.put("sketch_img_url", designPythonItem.getPath());
paramJSONObject.put("sketch_img_url", sketchImgUrl);
JSONArray paramArray = new JSONArray();
paramArray.add(paramJSONObject);
String param = JSON.toJSONString(paramArray, SerializerFeature.DisableCircularReferenceDetect);
@@ -3003,6 +3063,58 @@ public class PythonService {
throw new BusinessException("design.interface.exception");
}
public JSONObject designStream(DesignPythonObjects designPythonObjects) {
// todo 限流校验
// AccessLimitUtils.validate("design",5);
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
.readTimeout(60, TimeUnit.SECONDS)//读取超时(单位:秒)
.writeTimeout(60, TimeUnit.SECONDS)//写入超时(单位:秒)
.build();
MediaType mediaType = MediaType.parse("application/json");
//关闭FastJson的引用检测 防止出现$ref 现象
String param = JSON.toJSONString(designPythonObjects, SerializerFeature.DisableCircularReferenceDetect);
log.info("design请求python 参数:####{}", param);
RequestBody body = RequestBody.create(mediaType, param);
Request request = new Request.Builder()
.url(accessPythonIp + ":" + accessPythonPort + "/api/design_v2")
// .url(fastApiPythonAddress + "/api/design")
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
.addHeader("Content-Type", "application/json")
.build();
Response response;
String responseBody;
try {
response = client.newCall(request).execute();
} catch (IOException ioException) {
AccessLimitUtils.validateOut("design");
log.error("PythonService##design异常###{}", ExceptionUtil.getThrowableList(ioException));
throw new BusinessException("design.interface.exception");
}
//去除限流
// AccessLimitUtils.validateOut("design");
if (response.isSuccessful()) {
try {
if (Objects.nonNull(response.body())) {
responseBody = response.body().string();
JSONObject responseObject = JSON.parseObject(responseBody);
log.info("PythonService##responseObject###{}", responseObject);
return responseObject;
}
throw new BusinessException("design.interface.exception");
} catch (IOException | JSONException e) {
log.error("PythonService##design异常###{}", e.getMessage());
throw new BusinessException("design.interface.exception");
}
}
log.error("PythonService##design异常response###{}", response);
//生成失败
throw new BusinessException("design.interface.exception");
}
/**
* 暂时未用
*/
@@ -3566,4 +3678,121 @@ public class PythonService {
//生成失败
throw new BusinessException("bright.interface.exception");
}
public JSONObject attributeRecognition(List<String> pictureUrls,List<String> ids, List<String> category) {
//限流校验
AccessLimitUtils.validate("attributeRecognition", 20);
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
.readTimeout(300, TimeUnit.SECONDS)//读取超时(单位:秒)
.writeTimeout(300, TimeUnit.SECONDS)//写入超时(单位:秒)
.build();
MediaType mediaType = MediaType.parse("application/json");
Map<String, List<String>> content = Maps.newHashMap();
//识别图片路径数组
content.put("upload_img_path", pictureUrls);
//识别图片id数组
content.put("upload_img_id", ids);
content.put("upload_img_category", category);
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
Request request = new Request.Builder()
.url(accessPythonIp + ":9993/api/attribute")
.method("POST", body)
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
.addHeader("Content-Type", "application/json")
.build();
Response response = null;
String bodyStr = null;
try {
log.info("识别python对应的属性标签值请求入参content###{}", JSON.toJSONString(content));
response = client.newCall(request).execute();
bodyStr = response.body().string();
} catch (IOException ioException) {
log.error("PythonService###attributeRecognition异常##{}", ExceptionUtil.getThrowableList(ioException));
}
log.info("识别python对应的属性标签值结果###{}",bodyStr.trim());
//去除限流
AccessLimitUtils.validateOut("attributeRecognition");
if (Objects.isNull(response)) {
log.error("PythonService##attributeRecognition异常###{}", "response or body is empty!");
throw new BusinessException("attribute recognition exception!");
}
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(response));
Boolean result = jsonObject.getBoolean("successful");
if (result) {
JSONObject attributeJSONObject = JSON.parseObject(bodyStr.trim());
return attributeJSONObject;
}
log.info("识别python对应的属性标签值异常###{}", jsonObject);
//生成失败
throw new BusinessException("Atribute recognition exception!");
}
public String designBatch(DesignPythonObjects designPythonObjects, Long accountId, int designNum, String taskId) {
// todo 限流校验
// AccessLimitUtils.validate("design",5);
// 将 designPythonObjects 写入文件
File file = new File("design_batch_test.txt");
try (FileWriter writer = new FileWriter(file)) {
String param = JSON.toJSONString(designPythonObjects, SerializerFeature.DisableCircularReferenceDetect);
writer.write(param);
log.info("设计请求参数已写入文件:####{}", file.getAbsolutePath());
} catch (IOException e) {
log.error("写入文件异常:{}", e.getMessage());
throw new BusinessException("file.write.exception");
}
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
.pingInterval(5, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.build();
// 构建 multipart 表单
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file", "design_batch_test.txt",
RequestBody.create(MediaType.parse("text/plain"), file))
.addFormDataPart("tasks_id", taskId)
.addFormDataPart("user_id", String.valueOf(accountId))
.addFormDataPart("file_name", "design_batch_test" + taskId + ".json")
.addFormDataPart("total", String.valueOf(designNum))
.build();
Request request = new Request.Builder()
.url("http://18.167.251.121:9994/api/design_batch_generate")
.method("POST", body)
.addHeader("Content-Type", "multipart/form-data")
.build();
Response response;
String responseBody;
try {
response = client.newCall(request).execute();
} catch (IOException ioException) {
AccessLimitUtils.validateOut("design");
log.error("PythonService##design异常###{}", ExceptionUtil.getThrowableList(ioException));
throw new BusinessException("design.interface.exception");
}
if (response.isSuccessful()) {
try {
if (Objects.nonNull(response.body())) {
responseBody = response.body().string();
JSONObject responseObject = JSON.parseObject(responseBody);
log.info("PythonService##responseObject###{}", responseObject);
return taskId;
}
throw new BusinessException("design.interface.exception");
} catch (IOException | JSONException e) {
log.error("PythonService##design异常###{}", e.getMessage());
throw new BusinessException("design.interface.exception");
}
}
log.error("PythonService##design异常response###{}", response);
throw new BusinessException("design.interface.exception");
}
}

View File

@@ -15,4 +15,6 @@ public class DesignPythonObject {
* basic 选项
*/
DesignPythonBasic basic;
private String objectSign;
}

View File

@@ -16,4 +16,6 @@ public class DesignPythonObjects {
* design新增的library
*/
List<Library> addLibrary;
private String requestId;
}

View File

@@ -1,10 +1,13 @@
package com.ai.da.service;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.AccountExtend;
import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.*;
import com.ai.da.model.vo.AccountLoginVO;
import com.ai.da.model.vo.AccountPreLoginVO;
import com.ai.da.model.vo.BindEmailVO;
import com.ai.da.model.vo.PersonalHomepageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -45,7 +48,9 @@ public interface AccountService extends IService<Account> {
* @param accountBindEmailDTO
* @return
*/
Boolean bindEmail(AccountBindEmailDTO accountBindEmailDTO);
BindEmailVO bindEmail(AccountBindEmailDTO accountBindEmailDTO, HttpServletRequest request);
BindEmailVO bindEmail(String email);
/**
* 忘记密码
@@ -169,15 +174,15 @@ public interface AccountService extends IService<Account> {
void registerUserToVisitor();
Map<String, Long> getNicknameModifyTimes();
Long getNicknameModifyTimes();
void editUserName(String newUserName);
void verifyUserEmail(String verifyCode);
/*void verifyUserEmail(String verifyCode);
void changeUserEmail(String newMailbox);
void activateNewEmail(String token);
void activateNewEmail(String token);*/
String updateNoLoginRequiredNew(NoLoginRequiredDTO noLoginRequiredDTO, HttpServletRequest request);
@@ -188,4 +193,36 @@ public interface AccountService extends IService<Account> {
List<String> getPaidCustomerEmail();
void temporaryUpgrade();
AccountLoginVO enterpriseLogin(AccountLoginDTO accountDTO);
AccountLoginVO schoolLogin(AccountLoginDTO accountDTO);
Boolean addSubAccount(AddSubAccountDTO addSubAccountDTO);
Boolean deleteSubAccount(AddSubAccountDTO addSubAccountDTO);
PageBaseResponse<Account> subAccountList(SubAccountPageDTO subAccountPageDTO);
Account accountDetail(Long id);
AccountLoginVO parseGoogleCredential(String credential, Integer type);
AccountLoginVO parseWeChatCode(String code, Integer type);
AccountLoginVO getAccountDetail();
AccountExtend bindGoogle(String credential);
AccountExtend bindWeChat(String code);
Boolean unbindWeChat();
Boolean unbindGoogle();
void updateAccountValidity(Long accountId, Long currentPeriodEnd);
void updateUserRoleAndCredits(Long accountId, String type);
void updateUserInfo(String country, String occupation);
}

View File

@@ -0,0 +1,32 @@
package com.ai.da.service;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.mapper.primary.entity.Affiliate;
import com.ai.da.model.dto.AffiliateQueryDTO;
import com.ai.da.model.vo.AffiliateInvitationDetailsVO;
import com.ai.da.model.vo.AffiliateVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
public interface AffiliateService extends IService<Affiliate> {
Boolean registerAsAnAffiliate(String promotionMethod);
PageBaseResponse<AffiliateVO> getAffiliateList(AffiliateQueryDTO affiliateQueryDTO);
AffiliateVO personalAffiliateCenter();
double[] getPersonalMonthlyIncome(int year);
Boolean applicationApproval(Long id, Boolean isApproved);
void updateAffiliateInfoWithPayment();
Boolean affiliateLinkViewsIncrease(Long id);
IPage<AffiliateInvitationDetailsVO> getEachAffiliateGeneratedRevenue(AffiliateQueryDTO affiliateQueryDTO);
Affiliate getByAccountId(Long accountId);
void commissionCalculation(Integer year, Integer month);
}

View File

@@ -1,9 +1,12 @@
package com.ai.da.service;
import com.ai.da.model.dto.ProductPurchaseDTO;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
public interface AliPayService {
String tradeCreate(Integer amount,String returnUrl);
String tradeCreate(ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request);
String tradeNotify(Map<String, String> params);

View File

@@ -1,10 +1,13 @@
package com.ai.da.service;
import com.ai.da.model.dto.AlipayHKCallbackDTO;
import com.ai.da.model.dto.ProductPurchaseDTO;
import javax.servlet.http.HttpServletRequest;
public interface AlipayHKService {
String createOrder(Integer amount, String wallet);
String createOrder(ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request);
String callback(String paramString);

View File

@@ -1,15 +1,19 @@
package com.ai.da.service;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.Questionnaire;
import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.AccountAddDTO;
import com.ai.da.model.dto.QueryPaymentInfoDTO;
import com.ai.da.model.vo.PaymentInfoVO;
import com.ai.da.model.vo.QuestionnaireFeedbackVO;
import com.ai.da.model.vo.QuestionnaireVO;
import com.ai.da.model.vo.QueryUserConditionsVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@@ -43,4 +47,10 @@ public interface ConvenientInquiryService extends IService<Questionnaire> {
IPage<Account> getUserInfo(QueryUserConditionsVO queryUserConditionsVO);
List<Map<String, Object>> getAllUserIdList();
PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO);
Map<String, List<String>> getCities();
String exportTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO, HttpServletResponse response);
}

View File

@@ -17,9 +17,9 @@ public interface CreditsService extends IService<CreditsDetail> {
String getCredits(Long accountId);
void creditsRefund(Long accountId, Integer quantity);
void creditsRefund(Long accountId, Integer quantity, String orderNo);
void insertToCreditsDetail(Long accountId, String changeEvent, String credits, String changeType);
void insertToCreditsDetail(Long accountId, String changeEvent, String credits, String changeType, String orderNo);
PageBaseResponse<CreditsDetail> queryCreditsDetailsPage(QueryIncomeOrExpenditureDTO queryPageByTimeDTO);

View File

@@ -7,10 +7,13 @@ import com.ai.da.model.vo.DesignCollectionVO;
import com.ai.da.model.vo.DesignItemDetailVO;
import com.ai.da.model.vo.DesignLikeVO;
import com.ai.da.python.vo.DesignPythonObjects;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 服务类
@@ -25,7 +28,7 @@ public interface DesignService extends IService<Design> {
* @param designDTO
* @return
*/
DesignCollectionVO designCollection(DesignCollectionDTO designDTO);
String designCollection(DesignCollectionDTO designDTO);
/**
* redesign
@@ -33,7 +36,7 @@ public interface DesignService extends IService<Design> {
* @param reDesignDTO
* @return
*/
DesignCollectionVO reDesignCollection(ReDesignCollectionDTO reDesignDTO);
String reDesignCollection(ReDesignCollectionDTO reDesignDTO);
/**
* redesign
@@ -99,4 +102,14 @@ public interface DesignService extends IService<Design> {
List<String> getModel(List<Long> designItemIdList);
Long getCountByUserAndTime(String startTime, String endTime, List<Long> accountIds);
Boolean receiveDesignResults(JSONObject responseObject);
DesignCollectionVO getDesignResult(String requestId, List<String> objectSignList);
String designCloud(DesignCollectionDTO designDTO);
void processDesignBatch(Map<String, Object> designBatchResult);
Boolean sort(UserLikeSortDTO userLikeSortDTO);
}

View File

@@ -2,16 +2,20 @@ package com.ai.da.service;
import com.ai.da.common.enums.OrderStatusEnum;
import com.ai.da.common.enums.ProductEnum;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.mapper.primary.entity.OrderInfo;
import com.ai.da.model.dto.QueryPageByTimeDTO;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
public interface OrderInfoService extends IService<OrderInfo> {
OrderInfo createOrderByProductId(Integer productId, String paymentType);
OrderInfo createOrderByProductId(Integer productId, String paymentType, HttpServletRequest request);
OrderInfo createOrderByProductId(Integer amount, String paymentType, ProductEnum product, HttpServletRequest request);
void saveCodeUrl(String orderNo, String codeUrl);
@@ -28,4 +32,7 @@ public interface OrderInfoService extends IService<OrderInfo> {
PageBaseResponse<OrderInfo> getOrderByPage(QueryPageByTimeDTO queryPageByTimeDTO);
void updateOrderNoById(Long id, String orderNo);
void updateTotalFeeByOrderNo(String orderNo);
}

View File

@@ -1,5 +1,6 @@
package com.ai.da.service;
import com.ai.da.model.dto.ProductPurchaseDTO;
import com.paypal.http.exceptions.SerializeException;
import com.paypal.orders.Order;
@@ -8,11 +9,10 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public interface PayPalCheckoutService {
HashMap<String, String> createOrder(Integer amount,String returnUrl) throws SerializeException;
HashMap<String, String> createOrder(ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request) throws SerializeException;
// String callback(@SuppressWarnings("rawtypes") Map map);

View File

@@ -1,25 +1,35 @@
package com.ai.da.service;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.mapper.primary.entity.PaymentInfo;
import com.ai.da.model.dto.AlipayHKCallbackDTO;
import com.ai.da.model.dto.QueryPageByTimeDTO;
import com.ai.da.model.vo.OrderListVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.paypal.orders.Order;
import com.stripe.model.checkout.Session;
import com.stripe.model.Charge;
import com.stripe.model.Invoice;
import java.util.List;
import java.util.Map;
public interface PaymentInfoService {
public interface PaymentInfoService extends IService<PaymentInfo> {
void createPaymentInfo(String plainText);
void createPaymentInfoForAliPay(Map<String, String> params);
void createPaymentInfoForAliPay(Map<String, String> params, String type);
void createPaymentInfoForPayPal(Order order);
void createPaymentInfoForPayPal(Order order, String type);
void createPaymentInfoForAliPayHK(AlipayHKCallbackDTO alipayHKCallbackDTO);
void createPaymentInfoForAliPayHK(AlipayHKCallbackDTO alipayHKCallbackDTO, String type);
void createPaymentInfoForStripe(Session session);
PaymentInfo createOrUpdatePaymentInfoForStripe(Invoice invoice);
PaymentInfo getPaymentInfoByOrderId(String orderId);
PaymentInfo createOrUpdatePaymentInfoForStripe(Charge charge);
List<PaymentInfo> getPaymentInfoByOrderNo(String orderId, String order);
void updatePaymentStatusById(Long id, String status, String content);
PageBaseResponse<OrderListVO> getPaymentInfo(QueryPageByTimeDTO queryPageByTimeDTO);
}

View File

@@ -1,15 +1,52 @@
package com.ai.da.service;
import com.ai.da.mapper.primary.entity.SubscriptionInfo;
import com.ai.da.model.dto.ProductPurchaseDTO;
import com.stripe.exception.StripeException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
public interface StripeService {
String pay(Integer quantity, String returnUrl);
String pay(ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request);
Boolean notify(HttpServletRequest request);
SubscriptionInfo getLatestSubscriptionInfoByAccountId(Long accountId);
String refund(String amount, String orderId, String reason);
void checkOrderStatus(String orderNo);
List<String> getSubscriptionIds(String name, String userEmail) throws StripeException;
Map<String, String> getPaymentMethodByInvoiceId(String invoiceId);
void cancelSubscription(String orderNo, String cancelReason);
void cancelSubscriptionTemp(String subscriptionId);
Map<String, String> getPaymentMethod(String paymentMethodId);
/*void updateSubscription(String subscriptionId);
void resume(String subscriptionId);*/
void subscriptionReminder();
void checkSubscriptionExpiration();
String createSubscriptionTemp(String name, String email);
String changeCustomerPayment(String name, String email);
boolean sendRenewalFailEmail(String invoiceId, String subscriptionId, String orderNo);
List<Map<String,String>> getCustomerPaymentMethod(String name, String email);
String detachCustomerAllPaymentMethod(String name, String email);
// Map getIp(HttpServletRequest request);
}

View File

@@ -4,6 +4,7 @@ import com.ai.da.mapper.primary.entity.CanvasElementUpload;
import com.ai.da.mapper.primary.entity.ToProductImageResult;
import com.ai.da.mapper.primary.entity.UserLikeGroup;
import com.ai.da.model.dto.ExportSaveDTO;
import com.ai.da.model.dto.ProductImageInitializeDTO;
import com.ai.da.model.dto.ProductImageLikeDTO;
import com.ai.da.model.dto.ToProductImageDTO;
import com.ai.da.model.vo.*;
@@ -64,4 +65,6 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
String likeHistoryRelSketch();
String download();
Boolean productImageInitialize(ProductImageInitializeDTO productImageInitializeDTO);
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More