Compare commits
303 Commits
release/te
...
release/3.
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c2b4ffc48 | |||
| b90df7468e | |||
| 370d9402f2 | |||
| 4d518d05b9 | |||
| 13514b277b | |||
| d6c5d0e95d | |||
| 301a62a563 | |||
| 22e5a97143 | |||
| 765d404845 | |||
| d5cf4e9d3f | |||
| 4b7fd649a3 | |||
| 6249d53b7b | |||
| b445f1f11e | |||
| 5c66ece467 | |||
| 3b6b0c7e2c | |||
| 9a81fb7ee4 | |||
| 31bb29f2fd | |||
| c7b46229b5 | |||
| 1482bb6ab2 | |||
| eae4087b3e | |||
| faf98607c4 | |||
| c19e9094d1 | |||
| db55c5597f | |||
| 0c79739867 | |||
| e484f22788 | |||
| 6a694cee18 | |||
| 1a077edf0c | |||
|
|
68926757dc | ||
|
|
eea57435e5 | ||
| 1f0e8f9cf2 | |||
|
|
63ee41e3b8 | ||
|
|
08072001a7 | ||
| 6b4d82a67d | |||
| 5612b5b1d4 | |||
| 1d46a3b6d4 | |||
| 0500557dca | |||
| 654a3829c6 | |||
| fccafba438 | |||
| 8cd4cfb36d | |||
|
|
7e55b1f85e | ||
|
|
a043db2de5 | ||
|
|
d3ee0e5f4f | ||
|
|
484a8d1d93 | ||
|
|
7839ac3322 | ||
|
|
e16f494cf4 | ||
|
|
6fc22784b8 | ||
| 52bafa95e3 | |||
| 377c86e390 | |||
| d809362ea7 | |||
| c08987a781 | |||
| e60c3d7aa3 | |||
| 614b8d0948 | |||
| 8834b906f4 | |||
| 828a022768 | |||
| 26c8d08d04 | |||
| 68a9b2281a | |||
| 63df493d33 | |||
| b7110c80b5 | |||
| c4dbd10a85 | |||
| 041a407978 | |||
| f73c997c38 | |||
| db2a955dea | |||
| a91643d2ec | |||
| 269cf7ea03 | |||
| e3aa964db8 | |||
| fa2fa66d4a | |||
| 6d2a189fef | |||
| 2033f61c7e | |||
| 4e2222966f | |||
| fbe9dc87e9 | |||
| d6f078ab60 | |||
| a940863799 | |||
| 11ffa66851 | |||
| fc3fa22bee | |||
| 37ff60fcfb | |||
| d2d5eebe12 | |||
| 9cfb5aa344 | |||
| 5e7f898840 | |||
|
|
6d3253aed3 | ||
|
|
52e5f246ce | ||
|
|
6222377bc5 | ||
|
|
2d10f57643 | ||
|
|
5f27a95498 | ||
|
|
7fdf832f44 | ||
| 43d2f83677 | |||
| e882a15aa0 | |||
| 1a3f16119b | |||
| 8e2e515af3 | |||
| f1a2495431 | |||
| c66b794daa | |||
| b9f7ea2722 | |||
| 455e17d4b1 | |||
| a1a6a78dac | |||
| 07f91aef74 | |||
|
|
079ab4d98f | ||
|
|
6e53bc3ca5 | ||
|
|
5e8eb716b1 | ||
|
|
34ee8fa11d | ||
|
|
b7dc95af26 | ||
|
|
297391d57e | ||
|
|
aff870fba7 | ||
| 7b1ac47228 | |||
| 7eb9abbdb5 | |||
| 521bd5071a | |||
| ab7e1705c4 | |||
|
|
a2390a6ab2 | ||
|
|
8dc5dcb1bd | ||
|
|
5d010d2f77 | ||
|
|
cec5544472 | ||
|
|
5f79c3276a | ||
| aadb717c9f | |||
| e2e9201fdd | |||
|
|
9053bdf10c | ||
|
|
b14297d1af | ||
|
|
e90979bbdc | ||
|
|
e02c278e7a | ||
|
|
e60d9483a3 | ||
|
|
ba49312fd5 | ||
| ba3c98771f | |||
| 4c738cc61d | |||
| d648a79ec4 | |||
| c325927418 | |||
| dba5625446 | |||
| 91189968e9 | |||
| 433d8a460e | |||
| ec9857fe73 | |||
| a9b01566e1 | |||
|
|
a384aba4df | ||
| e587ad3ca1 | |||
|
|
6a7c8b3d28 | ||
|
|
6f52c956ec | ||
|
|
9e5d2f47e2 | ||
|
|
627f264ef3 | ||
|
|
464de4ee5a | ||
|
|
cf76235123 | ||
| 8d9f51f50f | |||
| d840185ec7 | |||
| 9f4ab20b9d | |||
| 0877ff8f66 | |||
| 78046e8707 | |||
|
|
9fb8bc989d | ||
|
|
3c89670dae | ||
| 21b73d55f7 | |||
| 9199cdf7e2 | |||
|
|
8589216a77 | ||
|
|
87768c6b53 | ||
|
|
ca320f4334 | ||
|
|
7697ab59fa | ||
| e5e6f360dc | |||
| 68a9462714 | |||
| b185a94fcc | |||
| 708280ca14 | |||
| 0ab1e7eef7 | |||
| c7b1d46b18 | |||
| 9357a62f0c | |||
| c5b25e9a16 | |||
| a35d057146 | |||
| 7fc495eec9 | |||
| 46f37942d2 | |||
| e75196c904 | |||
| bdfa249c2e | |||
| d0e5f7da61 | |||
| d8320ba83d | |||
| 23460800d6 | |||
| 58c8b644bc | |||
| c4c04aecb6 | |||
| bb7c98c094 | |||
| dcdb0d06c4 | |||
| b6a66bed41 | |||
|
|
5f277ed815 | ||
|
|
845a553097 | ||
| 74f89c8b2d | |||
| cff8227228 | |||
| 51e2c9af02 | |||
| cd89a77189 | |||
| ab303cfeef | |||
|
|
07004a7415 | ||
|
|
d2069a3e7f | ||
|
|
501cee0057 | ||
| ac2454fd0e | |||
| 931a4cf807 | |||
| cb7099264e | |||
| e7aa951e89 | |||
| ef70598180 | |||
| 698fca8787 | |||
| 2f86090f21 | |||
| 2988a3b34e | |||
|
|
4fe5f65867 | ||
|
|
4bb1953d4a | ||
|
|
57a8260f03 | ||
| e4936a23bc | |||
| 9f37cb3f8d | |||
| b128b2436d | |||
| 66158e94dd | |||
| f6b489d950 | |||
| 30312caf82 | |||
| 1d0dd65f5e | |||
|
|
0b245f62af | ||
| 50d90af3a5 | |||
|
|
49b8585522 | ||
|
|
b49f098a5e | ||
| e9a15b950e | |||
| ee676614f8 | |||
| 710abf2323 | |||
| 1a9f06d259 | |||
|
|
eaaa99a946 | ||
|
|
c8e4d624b7 | ||
| f08e36d100 | |||
| de73536d1c | |||
| 6a861305d6 | |||
|
|
367fa130c0 | ||
|
|
d04987a3e2 | ||
| b0fa185d36 | |||
| 094718e67f | |||
| e4a8bf80e9 | |||
|
|
c04b102a81 | ||
|
|
da9b3a04b4 | ||
|
|
234a030801 | ||
|
|
5ea8e851d7 | ||
|
|
afeeef4af7 | ||
| ee1e2f8556 | |||
| 1157b41730 | |||
| ca4d75c63f | |||
| f45bd7acc4 | |||
| 7bdd62d4a9 | |||
| b01ee9129b | |||
|
|
214c93923c | ||
|
|
bfa1d67b5c | ||
| a0a1a1a06a | |||
| 468ad385d7 | |||
| fa94667c0f | |||
| c997fbf1cb | |||
| 7283ace072 | |||
|
|
69743d4ef0 | ||
|
|
e033671ffb | ||
|
|
15cde37af7 | ||
|
|
7fb74bc7d8 | ||
| 43968995ea | |||
| 0574180e4b | |||
| 5b653272ee | |||
| d28a6051f1 | |||
| f9063ad26e | |||
| 2f4d060ca3 | |||
| fcd0cf4836 | |||
| 26f50c2acb | |||
| c3eb1fc78c | |||
| b15cc542e1 | |||
|
|
ec094d7471 | ||
|
|
3dc432131c | ||
|
|
1a19604163 | ||
| fdebb2b215 | |||
| 7d8f047087 | |||
| bf8af41f3f | |||
|
|
cdf29d2b0d | ||
|
|
7194049127 | ||
|
|
e34cec812f | ||
|
|
11a5b53d2a | ||
| efe22de0a0 | |||
|
|
82f7571612 | ||
|
|
2ac54a50ec | ||
| 5dd1e10b61 | |||
| e9e8e87719 | |||
| 3c0fa205d1 | |||
| 47ca7bde41 | |||
|
|
9e28d579d1 | ||
|
|
1c96522447 | ||
|
|
1a568621ca | ||
| eecefee674 | |||
| ea0332851d | |||
| a25a7dc023 | |||
|
|
b4fe1ca199 | ||
|
|
b315ae5644 | ||
|
|
f7113601f3 | ||
|
|
8d6e3e9644 | ||
|
|
23b864d378 | ||
|
|
be1119be6f | ||
|
|
b836e7fd67 | ||
| a237b4041d | |||
| ea4cd29723 | |||
| 13397fa1f7 | |||
| 2fab472150 | |||
| 8c71b4845a | |||
| b70f909a32 | |||
| 1b15aed6a2 | |||
| 5019fbd3fc | |||
| 2ea19dcf03 | |||
| 4d756d5624 | |||
| f6f759110f | |||
| 8d27b5b51e | |||
|
|
9f064609e7 | ||
|
|
fd10d4dbc4 | ||
|
|
fadb5faf0d | ||
| e5e514b522 | |||
| 74e6d5a1da | |||
| 3cf0570912 | |||
|
|
8da51a0a82 | ||
|
|
37ff7fbb91 | ||
|
|
8c20b51e13 | ||
| 391a28d659 | |||
| 4535fb7dfb | |||
| 546d1b4c44 | |||
| 5fe605c130 | |||
| 4408c0ecc6 |
30
pom.xml
30
pom.xml
@@ -151,9 +151,15 @@
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<!-- /**发送邮件**/-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.tencentcloudapi</groupId>-->
|
||||
<!-- <artifactId>tencentcloud-sdk-java-ses</artifactId>-->
|
||||
<!-- <version>3.1.572</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-ses</artifactId>
|
||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
<version>3.1.572</version>
|
||||
</dependency>
|
||||
|
||||
@@ -288,6 +294,28 @@
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.auth</groupId>
|
||||
<artifactId>google-auth-library-oauth2-http</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.api-client</groupId>
|
||||
<artifactId>google-api-client</artifactId>
|
||||
<version>1.32.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.oauth-client</groupId>
|
||||
<artifactId>google-oauth-client</artifactId>
|
||||
<version>1.32.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.http-client</groupId>
|
||||
<artifactId>google-http-client-jackson2</artifactId>
|
||||
<version>1.41.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
||||
import com.ai.da.model.vo.GenerateResultVO;
|
||||
import com.ai.da.service.GenerateService;
|
||||
import com.ai.da.service.UserLikeGroupService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.rabbitmq.client.Channel;
|
||||
@@ -17,6 +18,7 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
@@ -31,6 +33,9 @@ public class GenerateConsumer {
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
@Autowired
|
||||
private RabbitMQProperties rabbitMQProperties;
|
||||
|
||||
@@ -167,6 +172,9 @@ public class GenerateConsumer {
|
||||
String taskId = generateResult.get("tasks_id");
|
||||
String category = generateResult.get("category");
|
||||
generateService.processToProductImageResult(taskId, url, category);
|
||||
} else if (generateResult.get("status").equals("NO_FACE")) {
|
||||
String taskId = generateResult.get("tasks_id");
|
||||
userLikeGroupService.toProduct(taskId);
|
||||
} else {
|
||||
// 修改redis中的数据状态为exception
|
||||
String key = toProductImageResultKey + ":" + generateResult.get("tasks_id");
|
||||
@@ -214,6 +222,9 @@ public class GenerateConsumer {
|
||||
String taskId = generateResult.get("tasks_id");
|
||||
String category = generateResult.get("category");
|
||||
generateService.processRelightResult(taskId, url, category);
|
||||
} else if (generateResult.get("status").equals("NO_FACE")) {
|
||||
String taskId = generateResult.get("tasks_id");
|
||||
userLikeGroupService.relight(taskId);
|
||||
} else {
|
||||
// 修改redis中的数据状态为exception
|
||||
String key = relightResultKey + ":" + generateResult.get("tasks_id");
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
|
||||
import com.ai.da.model.enums.StyleEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
@@ -41,6 +42,7 @@ public class MyTaskScheduler {
|
||||
public void test() {
|
||||
// clearMinio();
|
||||
// addSystemFileStyle();
|
||||
// sendTrialOrderExcelToManagements();
|
||||
}
|
||||
|
||||
@Resource
|
||||
@@ -89,6 +91,7 @@ public class MyTaskScheduler {
|
||||
public void sendTrialOrderExcelToManagements() {
|
||||
// 获取前一天日期
|
||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||
// LocalDate before = LocalDate.now().minusDays(4);
|
||||
|
||||
// 查询前一天的试用订单
|
||||
QueryWrapper<TrialOrder> qw = new QueryWrapper<>();
|
||||
@@ -128,7 +131,9 @@ public class MyTaskScheduler {
|
||||
row.createCell(6).setCellValue(trialOrder.getCountry());
|
||||
row.createCell(7).setCellValue(trialOrder.getOccupation());
|
||||
row.createCell(8).setCellValue(trialOrder.getCreateTime().format(formatter));
|
||||
row.createCell(9).setCellValue(trialOrder.getUpdateTime().format(formatter));
|
||||
if (!ObjectUtils.isEmpty(trialOrder.getUpdateTime())) {
|
||||
row.createCell(9).setCellValue(trialOrder.getUpdateTime().format(formatter));
|
||||
}
|
||||
row.createCell(10).setCellValue(trialOrder.getStatus());
|
||||
}
|
||||
|
||||
@@ -136,19 +141,27 @@ public class MyTaskScheduler {
|
||||
String fileName = "trialOrder-" + yesterday.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
||||
try (FileOutputStream fileOut = new FileOutputStream(fileName)) {
|
||||
workbook.write(fileOut);
|
||||
SendEmailUtil.sendExcelEmail("1023316923@qq.com", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
// SendEmailUtil.sendExcelEmail("1023316923@qq.com", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
SendEmailUtil.sendExcelEmail("calvinwong@aidlab.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
SendEmailUtil.sendExcelEmail("kaicpang.pang@connect.polyu.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
SendEmailUtil.sendExcelEmail("kimwong@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
// SendEmailUtil.sendExcelEmail("ningning@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
SendEmailUtil.sendExcelEmail("johnnyho@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
SendEmailUtil.sendExcelEmail("ringolau@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
SendEmailUtil.sendExcelEmail("chelseayu@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else {
|
||||
SendEmailUtil.sendNoExcelEmail("1023316923@qq.com", null);
|
||||
// SendEmailUtil.sendNoExcelEmail("1023316923@qq.com", null);
|
||||
SendEmailUtil.sendNoExcelEmail("calvinwong@aidlab.hk", null);
|
||||
SendEmailUtil.sendNoExcelEmail("kaicpang.pang@connect.polyu.hk", null);
|
||||
SendEmailUtil.sendNoExcelEmail("kimwong@code-create.com.hk", null);
|
||||
// SendEmailUtil.sendNoExcelEmail("ningning@code-create.com.hk", null);
|
||||
SendEmailUtil.sendNoExcelEmail("johnnyho@code-create.com.hk", null);
|
||||
SendEmailUtil.sendNoExcelEmail("ringolau@code-create.com.hk", null);
|
||||
SendEmailUtil.sendNoExcelEmail("chelseayu@code-create.com.hk", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ public class CommonConstant {
|
||||
public static final Integer MINIO_IMAGE_EXPIRE_TIME = 24 * 60;
|
||||
// 单位 秒 一天过期 in redis
|
||||
public static final Long GENERATE_RESULT_EXPIRE_TIME = 24 * 60 * 60L;
|
||||
// 单位 秒 7天过期
|
||||
public static final Long REDIS_SET_EXPIRE_TIME = 24 * 60 * 60 * 7L;
|
||||
|
||||
public static class Numbers{
|
||||
public static final Integer NUMBER_10 = 10;
|
||||
@@ -75,5 +77,11 @@ 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 TIME_FORMAT_yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
public static final String AFFILIATE_LINK = "https://www.aida.com.hk?ref=";
|
||||
}
|
||||
|
||||
@@ -27,7 +27,13 @@ public enum AuthenticationOperationTypeEnum {
|
||||
/**
|
||||
* 更改邮箱
|
||||
*/
|
||||
CHANGE_MAILBOX;
|
||||
CHANGE_MAILBOX,
|
||||
/**
|
||||
* 填写用户国家和职业
|
||||
*/
|
||||
UPDATE_USERINFO,
|
||||
|
||||
REGISTER;
|
||||
|
||||
public static AuthenticationOperationTypeEnum of(String name) {
|
||||
return Stream.of(AuthenticationOperationTypeEnum.values()).filter(v -> v.name().equals(name)).findFirst().orElse(null);
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -10,38 +10,34 @@ public enum OrderStatusEnum {
|
||||
* 未支付
|
||||
*/
|
||||
NOT_PAY("未支付"),
|
||||
|
||||
|
||||
/**
|
||||
* 支付成功
|
||||
*/
|
||||
SUCCESS("支付成功"),
|
||||
|
||||
/**
|
||||
* 支付失败
|
||||
*/
|
||||
FAILURE("支付失败"),
|
||||
/**
|
||||
* 已关闭
|
||||
*/
|
||||
TIMEOUT_CLOSED("超时已关闭"),
|
||||
|
||||
/**
|
||||
* 已取消
|
||||
*/
|
||||
CANCEL("用户已取消"),
|
||||
|
||||
/**
|
||||
* 退款中
|
||||
*/
|
||||
REFUND_PROCESSING("退款中"),
|
||||
|
||||
/**
|
||||
* 已退款
|
||||
*/
|
||||
REFUND_SUCCESS("已退款"),
|
||||
|
||||
/**
|
||||
* 退款异常
|
||||
*/
|
||||
REFUND_ABNORMAL("退款异常"),
|
||||
|
||||
/**
|
||||
* paypal订单状态为 APPROVED
|
||||
*/
|
||||
|
||||
25
src/main/java/com/ai/da/common/enums/ProductEnum.java
Normal file
25
src/main/java/com/ai/da/common/enums/ProductEnum.java
Normal 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", 10L),
|
||||
;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
private final Long price;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ai.da.common.response;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ApiModel("交易记录分页响应结果")
|
||||
public class TransactionPageResponse<T> extends PageBaseResponse<T> {
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
}
|
||||
@@ -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"
|
||||
"/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);
|
||||
|
||||
@@ -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,14 +16,18 @@ 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("每周日晚11:59:59刷新付费用户积分为 6000");
|
||||
log.info("每月1号0点 将年费用户积分重置为 6000");
|
||||
accountService.refreshCreditsWeekly();
|
||||
}
|
||||
|
||||
@@ -61,10 +66,18 @@ public class AccountTask {
|
||||
}
|
||||
|
||||
/**
|
||||
* !!关闭此定时器!!不再从Code-Create上默认创建AiDA游客
|
||||
* 将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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
123
src/main/java/com/ai/da/common/task/PaymentTask.java
Normal file
123
src/main/java/com/ai/da/common/task/PaymentTask.java
Normal file
@@ -0,0 +1,123 @@
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
// 如果有订阅已创建,但是没有发邮件通知的,需要主动获取回调信息并向用户发送邮件
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
||||
public void calcCouponsCommission(){
|
||||
// log.info("优惠券佣金计算定时器");
|
||||
affiliateService.calcCouponsCommission();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ComprehensivePunctuationConverter {
|
||||
private static final Map<Character, Character> FULL_TO_HALF_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
// 中文标点到英文标点的映射(扩展版)
|
||||
FULL_TO_HALF_MAP.put(',', ',');
|
||||
FULL_TO_HALF_MAP.put('。', '.');
|
||||
FULL_TO_HALF_MAP.put(';', ';');
|
||||
FULL_TO_HALF_MAP.put(':', ':');
|
||||
FULL_TO_HALF_MAP.put('?', '?');
|
||||
FULL_TO_HALF_MAP.put('!', '!');
|
||||
FULL_TO_HALF_MAP.put('(', '(');
|
||||
FULL_TO_HALF_MAP.put(')', ')');
|
||||
FULL_TO_HALF_MAP.put('【', '[');
|
||||
FULL_TO_HALF_MAP.put('】', ']');
|
||||
FULL_TO_HALF_MAP.put('「', '\'');
|
||||
FULL_TO_HALF_MAP.put('」', '\'');
|
||||
FULL_TO_HALF_MAP.put('『', '"');
|
||||
FULL_TO_HALF_MAP.put('』', '"');
|
||||
FULL_TO_HALF_MAP.put('、', '\\');
|
||||
FULL_TO_HALF_MAP.put('~', '~');
|
||||
FULL_TO_HALF_MAP.put('—', '-');
|
||||
FULL_TO_HALF_MAP.put('.', '.');
|
||||
FULL_TO_HALF_MAP.put('〈', '<');
|
||||
FULL_TO_HALF_MAP.put('〉', '>');
|
||||
FULL_TO_HALF_MAP.put('《', '«');
|
||||
FULL_TO_HALF_MAP.put('》', '»');
|
||||
FULL_TO_HALF_MAP.put('〝', '"');
|
||||
FULL_TO_HALF_MAP.put('〞', '"');
|
||||
FULL_TO_HALF_MAP.put('﹁', '"');
|
||||
FULL_TO_HALF_MAP.put('﹂', '"');
|
||||
FULL_TO_HALF_MAP.put('…', '.');
|
||||
FULL_TO_HALF_MAP.put('﹏', '_');
|
||||
|
||||
// 全角字母和数字
|
||||
for (char c = 'A'; c <= 'Z'; c++) {
|
||||
FULL_TO_HALF_MAP.put(c, (char)(c - 'A' + 'A'));
|
||||
}
|
||||
for (char c = 'a'; c <= 'z'; c++) {
|
||||
FULL_TO_HALF_MAP.put(c, (char)(c - 'a' + 'a'));
|
||||
}
|
||||
for (char c = '0'; c <= '9'; c++) {
|
||||
FULL_TO_HALF_MAP.put(c, (char)(c - '0' + '0'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串中的全角字符(包括标点、字母、数字)转换为半角字符
|
||||
*/
|
||||
public static String convertToHalfWidth(String input) {
|
||||
if (input == null || input.isEmpty()) {
|
||||
return input;
|
||||
}
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
char c = input.charAt(i);
|
||||
|
||||
// 检查映射表
|
||||
if (FULL_TO_HALF_MAP.containsKey(c)) {
|
||||
result.append(FULL_TO_HALF_MAP.get(c));
|
||||
}
|
||||
// 处理全角空格(Unicode 12288)
|
||||
else if (c == ' ') {
|
||||
result.append(' ');
|
||||
}
|
||||
// 其他字符保持不变
|
||||
else {
|
||||
result.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// String text = "这是一个全角示例,包含:中文标点、全角字母(ABC)、全角数字(123) 还有全角空格!";
|
||||
String text = "birds,yellow";
|
||||
String converted = convertToHalfWidth(text);
|
||||
System.out.println("原始文本: " + text);
|
||||
System.out.println("转换后: " + converted);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import com.ai.da.common.constant.CommonConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.text.ParseException;
|
||||
@@ -9,8 +10,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 +19,8 @@ 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 = "yyyyMMddHH";
|
||||
public static final String YYYY_MM_DD_hh_mm_ss = "yyyyMMddHHMMss";
|
||||
|
||||
/**
|
||||
* LocalDate -> Date
|
||||
@@ -81,4 +84,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(CommonConstant.TIME_FORMAT_MMM_dd_yyyy_EEEE, Locale.US));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public final class LocalCacheUtils {
|
||||
private static LoadingCache<String, String> loadTokenCache() {
|
||||
LoadingCache<String, String> tokenCache = CacheBuilder.newBuilder()
|
||||
.concurrencyLevel(10)
|
||||
.expireAfterWrite(24 * 100, TimeUnit.HOURS)
|
||||
.expireAfterWrite(24 * (7 - 1), TimeUnit.HOURS)
|
||||
.initialCapacity(100)
|
||||
.maximumSize(10000)
|
||||
.recordStats()
|
||||
|
||||
@@ -14,13 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -441,6 +440,16 @@ public class MinioUtil {
|
||||
return getPreSignedUrl(bucketName, String.valueOf(fileName), expiry);
|
||||
}
|
||||
|
||||
public boolean doesObjectExist(String path) {
|
||||
if (!path.contains("/")) {
|
||||
throw new BusinessException("the.path.is.error");
|
||||
}
|
||||
int index = path.indexOf("/");
|
||||
String bucketName = path.substring(0, index);
|
||||
String objectName = path.substring(index + 1);
|
||||
return doesObjectExist(bucketName, objectName);
|
||||
}
|
||||
|
||||
public boolean doesObjectExist(String bucketName, String objectName) {
|
||||
try {
|
||||
minioClient.statObject(
|
||||
@@ -484,6 +493,83 @@ public class MinioUtil {
|
||||
return null; // or throw an exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 MinIO 下载对象到本地路径
|
||||
*
|
||||
* @param bucketName 存储桶名称
|
||||
* @param objectName MinIO 上对象的名称
|
||||
* @param localFilePath 本地文件路径
|
||||
*/
|
||||
public void downloadMinioObjectToLocal(String bucketName, String objectName, String localFilePath) {
|
||||
File localFile = new File(localFilePath);
|
||||
File parentDir = localFile.getParentFile();
|
||||
if (parentDir != null) {
|
||||
parentDir.mkdirs(); // 创建文件夹,确保路径结构与 MinIO 一致
|
||||
}
|
||||
|
||||
try (InputStream stream = minioClient.getObject(
|
||||
GetObjectArgs.builder().bucket(bucketName).object(objectName).build());
|
||||
FileOutputStream out = new FileOutputStream(localFile)) {
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = stream.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
log.info("Downloaded object {} to {}", objectName, localFilePath);
|
||||
} catch (Exception e) {
|
||||
log.error("Error while downloading object {}: {}", objectName, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从路径中提取存储桶名称
|
||||
*
|
||||
* @param path MinIO 路径
|
||||
* @return 存储桶名称
|
||||
*/
|
||||
public String getBucketNameFromPath(String path) {
|
||||
int index = path.indexOf("/");
|
||||
return path.substring(0, index); // 获取第一级路径作为 bucket 名称
|
||||
}
|
||||
|
||||
/**
|
||||
* 从路径中提取对象名称
|
||||
*
|
||||
* @param path MinIO 路径
|
||||
* @return 对象名称
|
||||
*/
|
||||
public String getObjectNameFromPath(String path) {
|
||||
int index = path.indexOf("/");
|
||||
return path.substring(index + 1); // 获取路径的其余部分作为对象名称
|
||||
}
|
||||
|
||||
public List<Integer> getImagesWidthAndHeight(String path){
|
||||
int index = path.indexOf("/");
|
||||
String bucketName = path.substring(0, index);
|
||||
String objectName = path.substring(index + 1);
|
||||
try {
|
||||
// 从 MinIO 下载图片
|
||||
GetObjectResponse response = minioClient.getObject(
|
||||
GetObjectArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.object(objectName)
|
||||
.build()
|
||||
);
|
||||
|
||||
BufferedImage image = ImageIO.read(response);
|
||||
int width = image.getWidth();
|
||||
int height = image.getHeight();
|
||||
|
||||
log.info("Image path {}, Width: {}, Height: {}", path, width, height);
|
||||
response.close();
|
||||
return Arrays.asList(width, height);
|
||||
} catch (MinioException | IOException | NoSuchAlgorithmException | InvalidKeyException e) {
|
||||
log.error("图片:{}, 获取宽高异常", path);
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,4 +28,70 @@ public class PantoneUtils {
|
||||
return new int[]{Math.round(hsv[0]), Math.round(hsv[1] * 100), Math.round(hsv[2] * 100)};
|
||||
}
|
||||
|
||||
public static int[] hsvToRgb(int h, int s, int v) {
|
||||
// 确保 h 在 [0, 360) 范围内
|
||||
h = h % 360;
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
// 确保 s 和 v 在 [0, 100] 范围内
|
||||
s = Math.max(0, Math.min(100, s));
|
||||
v = Math.max(0, Math.min(100, v));
|
||||
|
||||
// 将 s 和 v 映射到 [0, 1] 范围
|
||||
float sNorm = s / 100.0f;
|
||||
float vNorm = v / 100.0f;
|
||||
|
||||
// 计算色相所在的区间
|
||||
int hi = (h / 60) % 6;
|
||||
float f = (h / 60.0f) - hi;
|
||||
float p = vNorm * (1 - sNorm);
|
||||
float q = vNorm * (1 - f * sNorm);
|
||||
float t = vNorm * (1 - (1 - f) * sNorm);
|
||||
|
||||
float r, g, b;
|
||||
switch (hi) {
|
||||
case 0:
|
||||
r = vNorm;
|
||||
g = t;
|
||||
b = p;
|
||||
break;
|
||||
case 1:
|
||||
r = q;
|
||||
g = vNorm;
|
||||
b = p;
|
||||
break;
|
||||
case 2:
|
||||
r = p;
|
||||
g = vNorm;
|
||||
b = t;
|
||||
break;
|
||||
case 3:
|
||||
r = p;
|
||||
g = q;
|
||||
b = vNorm;
|
||||
break;
|
||||
case 4:
|
||||
r = t;
|
||||
g = p;
|
||||
b = vNorm;
|
||||
break;
|
||||
case 5:
|
||||
r = vNorm;
|
||||
g = p;
|
||||
b = q;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Invalid HSV values");
|
||||
}
|
||||
|
||||
// 将 RGB 值从 [0, 1] 转换为 [0, 255]
|
||||
int red = Math.round(r * 255);
|
||||
int green = Math.round(g * 255);
|
||||
int blue = Math.round(b * 255);
|
||||
|
||||
return new int[]{red, green, blue};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,8 +84,10 @@ public class RedisUtil {
|
||||
/**
|
||||
* 将数据放入set缓存
|
||||
*/
|
||||
public void addToSet(String key, String value) {
|
||||
public void addToSet(String key, String value, Long expiresIn) {
|
||||
redisTemplate.opsForSet().add(key, value);
|
||||
// 设置过期时间
|
||||
redisTemplate.expire(key, expiresIn, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,4 +280,29 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
public final static String STRIPE_EXCEPTION_LOG = "StripeException:";
|
||||
public final static String SUBSCRIPTION_SENT_EMAIL_TYPE = "SubscriptionEmailSentType:";
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
// 实例化一个认证对象
|
||||
@@ -389,20 +396,20 @@ public class SendEmailUtil {
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject = "";
|
||||
Template template = new Template();
|
||||
if (type == 1) {
|
||||
subject = "Upcoming System Upgrade for AiDA 3.0";
|
||||
template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
||||
}else {
|
||||
subject = "即将到来的AiDA 3.0系统升级";
|
||||
template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
|
||||
}
|
||||
// if (type == 1) {
|
||||
// subject = "Successful System Upgrade and New Features in AiDA 3.1";
|
||||
// template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
|
||||
// subject = "Upcoming System Upgrade for AiDA 3.0";
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
||||
// }else {
|
||||
// subject = "系统升级成功和AiDA 3.1新功能";
|
||||
// template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
|
||||
// subject = "即将到来的AiDA 3.0系统升级";
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
|
||||
// }
|
||||
if (type == 1) {
|
||||
subject = "Successful System Upgrade and New Features in AiDA 3.0";
|
||||
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
|
||||
}else {
|
||||
subject = "系统升级成功和AiDA 3.0新功能";
|
||||
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
|
||||
}
|
||||
template.setTemplateData(buildAccountData(account));
|
||||
|
||||
req.setSubject(subject);
|
||||
@@ -410,15 +417,18 @@ public class SendEmailUtil {
|
||||
|
||||
// 发送邮件
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info(senderAddress);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info(senderAddress);
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
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 +467,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 +513,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 +536,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 +547,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 +608,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 进行获取
|
||||
@@ -626,16 +637,18 @@ public class SendEmailUtil {
|
||||
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");
|
||||
log.info("邮件发送至{} 发送失败###{}", receiverAddress, e.toString());
|
||||
log.error(e.getMessage());
|
||||
// 这里不再抛出异常 失败就不发,保证后续正常运行
|
||||
// throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
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 +666,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 +691,11 @@ 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 进行获取
|
||||
@@ -699,7 +711,7 @@ public class SendEmailUtil {
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
req.setFromEmailAddress(SEND_ADDRESS);
|
||||
req.setDestination(new String[]{shb, xp, wxd, pkc});
|
||||
req.setDestination(new String[]{xp, wxd, pkc});
|
||||
Template template = new Template();
|
||||
req.setSubject("上传图片超时提醒");
|
||||
template.setTemplateID(UPLOAD_TIMEOUT_REMINDER);
|
||||
@@ -721,6 +733,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 +763,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);
|
||||
}
|
||||
@@ -767,4 +780,300 @@ public class SendEmailUtil {
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
private final static Long SYSTEM_UPGRADE_CN_ID = 131743L;
|
||||
private final static Long SYSTEM_UPGRADE_EN_ID = 131744L;
|
||||
public static void temporaryUpgrade(Account account, String senderAddress, int type) {
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
if (StringUtils.isEmpty(senderAddress)) {
|
||||
senderAddress = CODE_CREATE_SEND_ADDRESS;
|
||||
}
|
||||
req.setFromEmailAddress(senderAddress);
|
||||
req.setDestination(new String[]{account.getUserEmail()});
|
||||
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject = "";
|
||||
Template template = new Template();
|
||||
if (type == 1) {
|
||||
subject = "AiDA system upgrade completed";
|
||||
template.setTemplateID(SYSTEM_UPGRADE_EN_ID);
|
||||
}else {
|
||||
subject = "AiDA系统升级完成";
|
||||
template.setTemplateID(SYSTEM_UPGRADE_CN_ID);
|
||||
}
|
||||
template.setTemplateData(buildAccountData(account));
|
||||
|
||||
req.setSubject(subject);
|
||||
req.setTemplate(template);
|
||||
|
||||
// 发送邮件
|
||||
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 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 NEW_MERCHANT_EN = 140335L;
|
||||
// private final static Long NEW_MERCHANT_EN = 135190L;
|
||||
// private final static Long NEW_USER_EN = 135189L;
|
||||
// private final static Long NEW_USER_CN = 135186L;
|
||||
private final static Long NEW_USER_EN = 140316L;
|
||||
private final static Long NEW_USER_CN = 140317L;
|
||||
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 boolean 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");
|
||||
return false;
|
||||
// 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));
|
||||
}
|
||||
return true;
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
return false;
|
||||
// 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");
|
||||
}
|
||||
}
|
||||
|
||||
private final static Long COMMON_EXCEPTION_REMINDER = 135279L;
|
||||
public static void commonExceptionReminder(String functionName, String[] destination) {
|
||||
try {
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
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(destination);
|
||||
Template template = new Template();
|
||||
req.setSubject("AiDA发生异常,请及时处理");
|
||||
template.setTemplateID(COMMON_EXCEPTION_REMINDER);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("function", functionName);
|
||||
|
||||
// 邮件内容 {{function}}处理异常,请及时查看
|
||||
template.setTemplateData(param.toJSONString());
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.ai.da.common.websocket;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
@@ -16,54 +19,55 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Slf4j
|
||||
public class NotificationConnection {
|
||||
|
||||
static Map<String,Session> sessionMap = new ConcurrentHashMap<>();
|
||||
//连接超时
|
||||
public static final long MAX_TIME_OUT = 3 * 60 * 1000;
|
||||
|
||||
private Session session;
|
||||
private Long userId;
|
||||
// 这里用ConcurrentHashMap 因为他是一个线程安全的Map
|
||||
private static ConcurrentHashMap<Long, NotificationConnection> websockets = new ConcurrentHashMap<>();
|
||||
//连接建立时执行的操作
|
||||
/*@OnOpen
|
||||
public void onOpen(Session session){
|
||||
sessionMap.put(session.getId(),session);
|
||||
log.info("websocket is open, sessionId: {}",session.getId());
|
||||
}*/
|
||||
|
||||
@OnOpen
|
||||
public void onOpen(Session session, @PathParam("id") String id) { // 接收到前端传来的用户ID
|
||||
this.session = session;
|
||||
this.userId = Long.valueOf(id);
|
||||
this.session.setMaxIdleTimeout(MAX_TIME_OUT);
|
||||
websockets.put(Long.parseLong(id), this); //将ID作为key,当前的对象作为Value
|
||||
log.info("【建立连接】 用户为:{}", this.session);
|
||||
log.info("【建立连接】 用户Id为:{}", id);
|
||||
log.info("【建立连接】 总数为:{}", websockets.size());
|
||||
log.info("【当前连接总数】 为:{}", websockets.size());
|
||||
}
|
||||
|
||||
@OnClose
|
||||
public void onClose() {
|
||||
websockets.remove(this); // 将当前的对象从集合中删除
|
||||
log.info("【连接断开】 用户为:{}", this.session);
|
||||
// log.info("【连接断开】 总数为:{}", websockets.size());
|
||||
public void onClose(CloseReason reason) {
|
||||
log.info("【连接断开】 用户为:{}, sessionId: {}, 原因为{}", this.userId, this.session.getId(), reason);
|
||||
log.info("【当前连接总数】 为:{}", websockets.size());
|
||||
websockets.remove(this.userId); // 将当前的对象从集合中删除
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误时调用
|
||||
* @param throwable 异常
|
||||
*/
|
||||
@OnError
|
||||
public void onError(Throwable throwable) {
|
||||
log.info("【连接异常】 用户为:{} , sessionId: {}", this.userId, this.session.getId(), throwable);
|
||||
websockets.remove(this.userId); // 将当前的对象从集合中删除
|
||||
log.info("【当前连接总数】 为:{}", websockets.size());
|
||||
}
|
||||
|
||||
//收到了客户端消息执行的操作
|
||||
@OnMessage
|
||||
public void onMessage(String text){
|
||||
log.info("收到了一条消息:"+text);
|
||||
public void onMessage(@RequestParam String text){
|
||||
Map<String, String> textMap = JSONObject.parseObject(text, Map.class);
|
||||
log.info("收到了一条来自 {} 的消息:{}, sessionId:{}", this.userId, textMap.get("text"), this.session.getId());
|
||||
// return "已收到你的消息";
|
||||
}
|
||||
/*//连接关闭的时候执行的操作
|
||||
@OnClose
|
||||
public void onClose(Session session){
|
||||
sessionMap.remove(session.getId());
|
||||
log.info("websocket is close, sessionId: {}",session.getId());
|
||||
}
|
||||
|
||||
public void sendMsg(String message) throws IOException {
|
||||
for(String key:sessionMap.keySet()){
|
||||
sessionMap.get(key).getBasicRemote().sendText(message);
|
||||
if (textMap.get("text").equals("PING")){
|
||||
sendMsg(JSON.toJSONString("PONG"), this.userId);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void sendMsg(String message, Long userId) throws IOException {
|
||||
public void sendMsg(String message, Long userId) {
|
||||
if (userId == null) { // 如果等于null则证明是群发
|
||||
// 获取当前Map的一个迭代器,遍历Map的方式有很多种,看着来
|
||||
// 这个就是遍历这个集合的过程....
|
||||
@@ -73,7 +77,11 @@ public class NotificationConnection {
|
||||
NotificationConnection webSocket = entry.getValue();
|
||||
// 接下来就是遍历群发
|
||||
log.info("广播消息 【给用户】 :{}发送消息【{}】", webSocket, message);
|
||||
webSocket.session.getBasicRemote().sendText(message); // 发送!!!!!!!!!
|
||||
try {
|
||||
webSocket.session.getBasicRemote().sendText(message); // 发送!!!!!!!!!
|
||||
} catch (IOException e) {
|
||||
log.error("Failed to send message to session {}: {}", webSocket.session.getId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
} else { // 如果不是群发,则判断ID,其余步骤一致
|
||||
// 获取当前Map的一个迭代器,遍历Map的方式有很多种,看着来
|
||||
|
||||
@@ -6,8 +6,6 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
/**
|
||||
* Configuration of WebSocket
|
||||
*
|
||||
* @author db1995
|
||||
*/
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
|
||||
@@ -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 = "十月半价活动")
|
||||
@@ -261,5 +264,88 @@ public class AccountController {
|
||||
return Response.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("temporaryUpgrade")
|
||||
@ApiOperation(value = "临时升级")
|
||||
public Response<Boolean> temporaryUpgrade() {
|
||||
accountService.temporaryUpgrade();
|
||||
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());
|
||||
}
|
||||
|
||||
@PostMapping("/updateUserInfo")
|
||||
@ApiOperation(value = "更新用户国家、职业信息")
|
||||
public Response<Boolean> updateUserInfo(@Valid @RequestBody UpdateUserInfoDTO updateUserInfoDTO) {
|
||||
return Response.success(accountService.updateUserInfo(updateUserInfoDTO));
|
||||
}
|
||||
}
|
||||
|
||||
94
src/main/java/com/ai/da/controller/AffiliateController.java
Normal file
94
src/main/java/com/ai/da/controller/AffiliateController.java
Normal file
@@ -0,0 +1,94 @@
|
||||
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,
|
||||
@RequestParam("commission") Float commission) {
|
||||
return Response.success(affiliateService.applicationApproval(id, isApproved, commission));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新佣金比例")
|
||||
@GetMapping("/updateCommission")
|
||||
public Response<String> updateCommissionPercentage(@RequestParam("id") Long id, @RequestParam("commission") Float commission) {
|
||||
affiliateService.updateCommissionPercentage(id, commission);
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
/*@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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,18 +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 io.netty.util.internal.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -23,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.*;
|
||||
@@ -36,13 +40,21 @@ public class ConvenientInquiryController {
|
||||
private DesignMapper designMapper;
|
||||
@Resource
|
||||
private ConvenientInquiryService convenientInquiryService;
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
|
||||
|
||||
@ApiOperation("获取当前所有试用用户")
|
||||
@PostMapping("/getTrial")
|
||||
public Response<IPage<TrialOrder>> getTrial(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
|
||||
String userEmail = accountService.getById(accountId).getUserEmail();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)
|
||||
|| accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)
|
||||
|| userEmail.equals("joho8228@hotmail.com")
|
||||
|| userEmail.equals("chelseayu@code-create.com.hk")
|
||||
|| userEmail.equals("cheungzt007@gmail.com")
|
||||
) {
|
||||
return Response.success(convenientInquiryService.getTrial(queryUserConditionsVO));
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
@@ -51,10 +63,16 @@ public class ConvenientInquiryController {
|
||||
|
||||
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
|
||||
@GetMapping("/getDesignStatistic")
|
||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime,
|
||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime,
|
||||
@RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
|
||||
String userEmail = accountService.getById(accountId).getUserEmail();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)
|
||||
|| accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)
|
||||
|| userEmail.equals("joho8228@hotmail.com")
|
||||
|| userEmail.equals("chelseayu@code-create.com.hk")
|
||||
|| userEmail.equals("cheungzt007@gmail.com")
|
||||
) {
|
||||
if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00";
|
||||
if (StringUtil.isNullOrEmpty(endTime)) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
@@ -137,7 +155,14 @@ public class ConvenientInquiryController {
|
||||
@ApiOperation("添加用户")
|
||||
@PostMapping("/addUser")
|
||||
public Response<Boolean> addUser(@Valid @RequestBody AccountAddDTO accountAddDTO) {
|
||||
return Response.success(convenientInquiryService.addUser(accountAddDTO));
|
||||
Long userAccountId = UserContext.getUserHolder().getId();
|
||||
if (userAccountId.equals(31L) || userAccountId.equals(87L) || userAccountId.equals(83L)
|
||||
|| userAccountId.equals(6L) || userAccountId.equals(4L) || userAccountId.equals(73L)
|
||||
) {
|
||||
return Response.success(convenientInquiryService.addUser(accountAddDTO));
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户信息")
|
||||
@@ -146,14 +171,27 @@ public class ConvenientInquiryController {
|
||||
@ApiParam(value = "有效期截止时间的毫秒级unix格式") @RequestParam @Nullable Long validEndTime,
|
||||
@ApiParam(value = "用户类型 1/2/3/0 -> yearly/monthly/trial/visitor") @RequestParam @Nullable Integer systemUser,
|
||||
@ApiParam("积分") @RequestParam @Nullable Long credits) {
|
||||
return Response.success(convenientInquiryService.modifyUser(accountId, validEndTime, systemUser, credits));
|
||||
Long userAccountId = UserContext.getUserHolder().getId();
|
||||
if (userAccountId.equals(31L) || userAccountId.equals(87L) || userAccountId.equals(83L)
|
||||
|| userAccountId.equals(6L) || userAccountId.equals(4L) || userAccountId.equals(73L)
|
||||
) {
|
||||
return Response.success(convenientInquiryService.modifyUser(accountId, validEndTime, systemUser, credits));
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户信息")
|
||||
@PostMapping("/getUserInfo")
|
||||
public Response<IPage<Account>> getUserInfo(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
|
||||
String userEmail = accountService.getById(accountId).getUserEmail();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)
|
||||
|| accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)
|
||||
|| userEmail.equals("joho8228@hotmail.com")
|
||||
|| userEmail.equals("chelseayu@code-create.com.hk")
|
||||
|| userEmail.equals("cheungzt007@gmail.com")
|
||||
) {
|
||||
return Response.success(convenientInquiryService.getUserInfo(queryUserConditionsVO));
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
@@ -166,5 +204,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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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模块")
|
||||
|
||||
@@ -66,6 +66,8 @@ public class ElementController {
|
||||
return Response.success();
|
||||
}
|
||||
|
||||
/** 该功能已删除 */
|
||||
@Deprecated
|
||||
@ApiOperation(value = "生成印花")
|
||||
@PostMapping("/generatePrint")
|
||||
public Response<GenerateCollectionItemVO> generatePrint(@Valid @RequestBody CollectionGeneratePrintDTO generatePrintDTO) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,4 +245,16 @@ public class SavedCollectionController {
|
||||
public Response<String> likeHistoryRelSketch() {
|
||||
return Response.success(userLikeGroupService.likeHistoryRelSketch());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "download")
|
||||
@PostMapping("/download")
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +1,84 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.common.utils.SendEmailUtil;
|
||||
import com.ai.da.mapper.primary.entity.ProductCoupons;
|
||||
import com.ai.da.model.dto.CreateCouponDTO;
|
||||
import com.ai.da.model.dto.ProductPurchaseDTO;
|
||||
import com.ai.da.model.dto.QueryCouponsPageDTO;
|
||||
import com.ai.da.model.vo.CheckCouponsVO;
|
||||
import com.ai.da.service.StripeService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.beans.factory.annotation.Value;
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "Stripe模块")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/stripe")
|
||||
@ApiIgnore
|
||||
public class StripeController {
|
||||
|
||||
@Resource
|
||||
private StripeService stripeService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
@Value("${stripe.webhook.fail.reminder}")
|
||||
private String webhookReminderFlag;
|
||||
|
||||
@ApiOperation("支付通知")
|
||||
@PostMapping("/trade/notify")
|
||||
public Response<String> callback(HttpServletRequest request) throws ServletException, IOException {
|
||||
Boolean result = stripeService.notify(request);
|
||||
if (result){
|
||||
return Response.success(200,"success");
|
||||
}else {
|
||||
return Response.fail(400,"failure");
|
||||
public void callback(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
try{
|
||||
Boolean result = stripeService.notify(request);
|
||||
if (result){
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
}else {
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Stripe Controller层异常捕捉, {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
String key_1 = RedisUtil.STRIPE_EXCEPTION_LOG + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH);
|
||||
String key_2 = key_1 + ":" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_hh_mm_ss);
|
||||
String stackTrace = stripeService.getStackTrace(e, 10);
|
||||
redisUtil.addToString(key_2, stackTrace);
|
||||
Long size = redisUtil.getSize(key_1);
|
||||
// 给我发送邮件
|
||||
if (webhookReminderFlag.equals("1") && size == 3){
|
||||
SendEmailUtil.commonExceptionReminder("Stripe Webhook 回调", new String[]{"xupei3360@163.com"});
|
||||
}
|
||||
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 +88,105 @@ 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("创建推广码")
|
||||
@PostMapping("/createCoupon")
|
||||
public Response<String> createCoupon(@Valid @RequestBody CreateCouponDTO createCouponDTO){
|
||||
return Response.success(stripeService.createCoupon(createCouponDTO));
|
||||
}
|
||||
|
||||
@ApiOperation("检查推广码")
|
||||
@GetMapping("/checkCoupon")
|
||||
public Response<CheckCouponsVO> checkCoupon(@RequestParam String promotionCode, @RequestParam Long price){
|
||||
return Response.success(stripeService.checkProductCoupon(promotionCode, price));
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有推广码")
|
||||
@PostMapping("/getAllCoupons")
|
||||
public Response<IPage<ProductCoupons>> getAllCoupons(@RequestBody QueryCouponsPageDTO queryCouponsPageDTO){
|
||||
return Response.success(stripeService.getAllCoupons(queryCouponsPageDTO));
|
||||
}
|
||||
|
||||
@ApiOperation("检索优惠券")
|
||||
@GetMapping("/retrieveCoupon")
|
||||
public Response<String> retrieveCoupon(@RequestParam String couponId){
|
||||
return Response.success(stripeService.retrieveCoupon(couponId));
|
||||
}
|
||||
|
||||
@ApiOperation("检索推广码")
|
||||
@GetMapping("/retrievePromotionCode")
|
||||
public Response<String> retrievePromotionCode(@RequestParam String retrievePromotionCode){
|
||||
return Response.success(stripeService.retrievePromotionCode(retrievePromotionCode));
|
||||
}
|
||||
|
||||
@ApiOperation("更新推广码信息")
|
||||
@GetMapping("/updatePromCodeInfo")
|
||||
public Response<ProductCoupons> updateCouponsInfo(@RequestParam Long id, @RequestParam(required = false) String paidCommission,
|
||||
@RequestParam(required = false) String cooperator,
|
||||
@RequestParam(required = false) String remark,
|
||||
@RequestParam(required = false) Long startTime){
|
||||
return Response.success(stripeService.updateCouponsInfo(id, paidCommission, cooperator, remark, startTime));
|
||||
}
|
||||
|
||||
@ApiOperation("删除推广码")
|
||||
@GetMapping("/deletePromCode")
|
||||
public Response<String> deleteCoupon(@RequestParam Long id){
|
||||
stripeService.deleteCoupon(id);
|
||||
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));
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -14,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.validation.Valid;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
@@ -27,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) {
|
||||
@@ -114,4 +122,28 @@ public class ThirdPartyController {
|
||||
public Response<String> updateNoLoginRequiredNew(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO, HttpServletRequest request) {
|
||||
return Response.success(accountService.updateNoLoginRequiredNew(noLoginRequiredDTO, request));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping("/auth/google_callback")
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author easy-generator
|
||||
* @since 2022-06-13
|
||||
*/
|
||||
public interface AccountExtendMapper extends CommonMapper<AccountExtend> {
|
||||
|
||||
|
||||
}
|
||||
@@ -30,6 +30,6 @@ public interface AccountMapper extends CommonMapper<Account> {
|
||||
*/
|
||||
// Account findById(String id);
|
||||
|
||||
void toVisitor(Long id, Date date);
|
||||
void toVisitor(Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
19
src/main/java/com/ai/da/mapper/primary/AffiliateMapper.java
Normal file
19
src/main/java/com/ai/da/mapper/primary/AffiliateMapper.java
Normal 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);
|
||||
|
||||
}
|
||||
@@ -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> {
|
||||
|
||||
|
||||
}
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -1,7 +1,39 @@
|
||||
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 org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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
|
||||
);
|
||||
|
||||
BigDecimal queryTotalPaymentAmount(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();
|
||||
|
||||
int insertIgnore(@Param("paymentInfo")PaymentInfo paymentInfo);
|
||||
|
||||
List<PaymentInfo> selectPaidPaymentsByAccountAndPromotion(Long accountId, String promotionCode);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.ProductCoupons;
|
||||
|
||||
public interface ProductCouponsMapper extends CommonMapper<ProductCoupons> {
|
||||
|
||||
}
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.SubscriptionInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface SubscriptionInfoMapper extends BaseMapper<SubscriptionInfo> {
|
||||
int insertIgnore(@Param("subscriptionInfo") SubscriptionInfo subscriptionInfo);
|
||||
}
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -57,6 +58,11 @@ public class Account implements Serializable {
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 职业
|
||||
*/
|
||||
private String occupation;
|
||||
|
||||
/**
|
||||
* 账户有效期开始时间
|
||||
*/
|
||||
@@ -97,6 +103,10 @@ public class Account implements Serializable {
|
||||
* 2 : 月付用户
|
||||
* 3 : 试用用户
|
||||
* 4 : 参加活动获取30天有效期和6000个积分的用户
|
||||
* 5 : 企业管理员账号
|
||||
* 6 : 企业子账号
|
||||
* 7 : 学校管理员
|
||||
* 8 : 学校子账号
|
||||
*/
|
||||
private Integer systemUser;
|
||||
|
||||
@@ -104,4 +114,25 @@ 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;
|
||||
|
||||
@ApiModelProperty("title")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("surname")
|
||||
private String surname;
|
||||
|
||||
@ApiModelProperty("givenName")
|
||||
private String givenName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("account_extend")
|
||||
public class AccountExtend implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long accountId;
|
||||
|
||||
private String authType;
|
||||
|
||||
private String headImgUrl;
|
||||
|
||||
private String name;
|
||||
|
||||
private String auth;
|
||||
}
|
||||
32
src/main/java/com/ai/da/mapper/primary/entity/Affiliate.java
Normal file
32
src/main/java/com/ai/da/mapper/primary/entity/Affiliate.java
Normal file
@@ -0,0 +1,32 @@
|
||||
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 commissionPercent;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class DesignItemDetailPrint {
|
||||
/**
|
||||
* 印花缩放比例
|
||||
*/
|
||||
private Double scale;
|
||||
private String scale;
|
||||
/**
|
||||
* 印花旋转角度
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GoogleUser {
|
||||
private String sub; // 用户唯一标识
|
||||
private String email;
|
||||
private String name;
|
||||
private String picture;
|
||||
private boolean emailVerified;
|
||||
private String givenName;
|
||||
private String familyName;
|
||||
}
|
||||
@@ -80,4 +80,18 @@ public class Library implements Serializable {
|
||||
private Date updateDate;
|
||||
|
||||
// private Integer isCopy;
|
||||
|
||||
|
||||
public Library() {
|
||||
}
|
||||
|
||||
public Library(Long accountId, String level1Type, String level2Type, String level3Type, String url, String md5, Date createDate) {
|
||||
this.accountId = accountId;
|
||||
this.level1Type = level1Type;
|
||||
this.level2Type = level2Type;
|
||||
this.level3Type = level3Type;
|
||||
this.url = url;
|
||||
this.md5 = md5;
|
||||
this.createDate = createDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -21,5 +21,20 @@ public class OrderInfo extends BaseEntity{
|
||||
|
||||
private String orderStatus;//订单状态
|
||||
|
||||
private String note;
|
||||
|
||||
private byte autoRenewal;
|
||||
|
||||
private String paymentType;//支付方式
|
||||
|
||||
// 可用于标记用户订单是否首次订阅
|
||||
private byte isFirstSubscription = 0;
|
||||
|
||||
private byte isCommissionCalculated = 0;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private String country;
|
||||
|
||||
private String city;
|
||||
}
|
||||
|
||||
@@ -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,38 @@ 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;
|
||||
|
||||
private String promotionCode;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("t_product_coupons")
|
||||
@NoArgsConstructor
|
||||
public class ProductCoupons extends BaseEntity{
|
||||
// 优惠券id
|
||||
private String couponId;
|
||||
// 优惠券有效期的截止日期
|
||||
private Long redeemBy;
|
||||
// 绑定的推广码id
|
||||
private String promotionCodeId;
|
||||
// 对应的推广码
|
||||
private String promotionCode;
|
||||
// 优惠券有效期开始时间
|
||||
private Long startTime;
|
||||
// 最大兑换次数
|
||||
private Long maxRedemptions;
|
||||
// 优惠券的折扣
|
||||
private float percentOff;
|
||||
// 佣金比例
|
||||
private float commissionRate;
|
||||
// 合作者
|
||||
private String cooperator;
|
||||
// 使用了该优惠券支付的总金额
|
||||
private BigDecimal totalEarnings = BigDecimal.ZERO;
|
||||
// 佣金
|
||||
private BigDecimal commission = BigDecimal.ZERO;
|
||||
// 已付佣金
|
||||
private BigDecimal paidCommission = BigDecimal.ZERO;
|
||||
// 未付佣金
|
||||
private BigDecimal unpaidCommission = BigDecimal.ZERO;
|
||||
// 备注
|
||||
private String remark;
|
||||
|
||||
@TableLogic
|
||||
private Integer isDeleted;
|
||||
|
||||
public ProductCoupons(String couponId, Long redeemBy, String promotionCodeId, String promotionCode, Long maxRedemptions, float percentOff, float commissionRate, String cooperator, String remark) {
|
||||
this.couponId = couponId;
|
||||
this.redeemBy = redeemBy;
|
||||
this.promotionCodeId = promotionCodeId;
|
||||
this.promotionCode = promotionCode;
|
||||
this.maxRedemptions = maxRedemptions;
|
||||
this.percentOff = percentOff;
|
||||
this.cooperator = cooperator;
|
||||
this.remark = remark;
|
||||
this.commissionRate = commissionRate;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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 || canceled
|
||||
private String status = "active";
|
||||
|
||||
private byte cancelNotified = (byte)0;
|
||||
|
||||
// 续订的下一个付款日
|
||||
private String nextPayDate;
|
||||
|
||||
// 当前订阅订单有效期开始时间
|
||||
private Long currentPeriodStart;
|
||||
|
||||
// 当前订阅订单有效期结束时间
|
||||
private Long currentPeriodEnd;
|
||||
|
||||
// 取消订阅原因
|
||||
private String cancelReason;
|
||||
|
||||
}
|
||||
@@ -10,4 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||
public class Tags extends BaseEntity{
|
||||
|
||||
private String tagName;
|
||||
|
||||
// 表示标签是否正在活动中 0->不在活动中 1->在活动中
|
||||
private byte active = (byte)0;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@@ -44,4 +45,8 @@ public class ToProductImageResult implements Serializable {
|
||||
private String resultType;
|
||||
|
||||
private Double brightenValue;
|
||||
|
||||
private BigDecimal imageStrength;
|
||||
|
||||
private String direction;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -19,6 +19,4 @@ public class AttributeRetrieval {
|
||||
private String subtype;
|
||||
|
||||
private String style;
|
||||
|
||||
private Integer deprecated;
|
||||
}
|
||||
|
||||
@@ -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("邮箱")
|
||||
@@ -22,4 +21,19 @@ public class AccountBindEmailDTO {
|
||||
@NotBlank(message = "emailVerifyCode.cannot.be.empty")
|
||||
@ApiModelProperty("邮箱验证码")
|
||||
private String emailVerifyCode;
|
||||
|
||||
// @ApiModelProperty("国家")
|
||||
// private String country;
|
||||
//
|
||||
// @ApiModelProperty("职业")
|
||||
// private String occupation;
|
||||
//
|
||||
// @ApiModelProperty("title")
|
||||
// private String title;
|
||||
//
|
||||
// @ApiModelProperty("surname")
|
||||
// private String surname;
|
||||
//
|
||||
// @ApiModelProperty("givenName")
|
||||
// private String givenName;
|
||||
}
|
||||
|
||||
@@ -6,4 +6,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AccountDesignWorksRegisterDTO extends Account {
|
||||
private String emailVerifyCode;
|
||||
|
||||
// private String invitationCode;
|
||||
}
|
||||
|
||||
@@ -32,4 +32,6 @@ public class AccountLoginDTO {
|
||||
@ApiModelProperty("邮箱验证码")
|
||||
private String emailVerifyCode;
|
||||
|
||||
private String organizationName;
|
||||
|
||||
}
|
||||
|
||||
12
src/main/java/com/ai/da/model/dto/AddSubAccountDTO.java
Normal file
12
src/main/java/com/ai/da/model/dto/AddSubAccountDTO.java
Normal 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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
31
src/main/java/com/ai/da/model/dto/AffiliateQueryDTO.java
Normal file
31
src/main/java/com/ai/da/model/dto/AffiliateQueryDTO.java
Normal 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() + '\'' + ' ' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
26
src/main/java/com/ai/da/model/dto/CreateCouponDTO.java
Normal file
26
src/main/java/com/ai/da/model/dto/CreateCouponDTO.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class CreateCouponDTO {
|
||||
@ApiModelProperty("折扣率")
|
||||
@NotNull(message = "Please set the percentOff")
|
||||
private Float percentOff;
|
||||
@ApiModelProperty("佣金比例")
|
||||
@NotNull(message = "Please set the commissionRate.")
|
||||
private Float commissionRate;
|
||||
@ApiModelProperty("推广码到期时间 秒级时间戳")
|
||||
private Long endTime;
|
||||
@ApiModelProperty("推广码开始时间 秒级时间戳")
|
||||
private Long startTime;
|
||||
@ApiModelProperty("推广码最大使用次数")
|
||||
private Long maxRedemptions;
|
||||
@ApiModelProperty("合作者/机构名")
|
||||
private String cooperator;
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -61,6 +61,10 @@ public class DesignCollectionDTO {
|
||||
@ApiModelProperty("python端design进程ID")
|
||||
private String processId;
|
||||
|
||||
private String moodboardPostion;
|
||||
private String moodboardPosition;
|
||||
|
||||
private List<String> requestIdList;
|
||||
|
||||
private Integer designNum;
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ public class DesignSingleItemDTO implements Serializable {
|
||||
@ApiModelProperty("对应的图片的minIO路径")
|
||||
private String path;
|
||||
|
||||
@NotBlank(message = "color.cannot.be.empty")
|
||||
@ApiModelProperty("颜色 存 RGB值 中间空格分隔 比如 \"58 58 169\"")
|
||||
private String color;
|
||||
|
||||
|
||||
@@ -15,10 +15,22 @@ 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 仅填写国家、职业(不发送邮件) REGISTER 注册")
|
||||
private String operationType;
|
||||
|
||||
@ApiModelProperty("异常ip")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty("国家")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty("职业")
|
||||
private String occupation;
|
||||
|
||||
private String title;
|
||||
private String surname;
|
||||
private String givenName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,9 +21,12 @@ public class GenerateModifyDTO {
|
||||
@ApiModelProperty(value = "sketch所属分类", required = true)
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "originalId的来源 Library || Generate(默认为空)", required = true)
|
||||
private String originalIdSource;
|
||||
|
||||
@NotNull(message = "id cannot be empty")
|
||||
@ApiModelProperty(value = "原图id", required = true)
|
||||
private String originalId;
|
||||
private Long originalId;
|
||||
|
||||
@ApiModelProperty("是否覆盖原图")
|
||||
private Boolean isOverride;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -29,12 +29,15 @@ public class GenerateToPythonDTO {
|
||||
|
||||
private String svg;
|
||||
|
||||
public GenerateToPythonDTO(String tasks_id, String prompt, String image_url, String mode, String category, String gender) {
|
||||
private String version;
|
||||
|
||||
public GenerateToPythonDTO(String tasks_id, String prompt, String image_url, String mode, String category, String gender, String version) {
|
||||
this.image_url = image_url;
|
||||
this.category = category;
|
||||
this.prompt = prompt;
|
||||
this.mode = mode;
|
||||
this.tasks_id = tasks_id;
|
||||
this.gender = gender;
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
36
src/main/java/com/ai/da/model/dto/ProductPurchaseDTO.java
Normal file
36
src/main/java/com/ai/da/model/dto/ProductPurchaseDTO.java
Normal file
@@ -0,0 +1,36 @@
|
||||
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;
|
||||
|
||||
@ApiModelProperty("优惠码")
|
||||
private String promotionCode;
|
||||
}
|
||||
22
src/main/java/com/ai/da/model/dto/QueryCouponsPageDTO.java
Normal file
22
src/main/java/com/ai/da/model/dto/QueryCouponsPageDTO.java
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
public class QueryCouponsPageDTO extends QueryPageByTimeDTO {
|
||||
@ApiModelProperty("DESC(按id降序) || ASC(按id升序)")
|
||||
private String orderById;
|
||||
@ApiModelProperty("推广码")
|
||||
private String promotionCode;
|
||||
@ApiModelProperty("查询过期 || 未过期的优惠券")
|
||||
private Boolean isExpired;
|
||||
@ApiModelProperty("按合作者名字查询")
|
||||
private String cooperator;
|
||||
|
||||
}
|
||||
@@ -16,4 +16,7 @@ public class QueryPageByTimeDTO extends PageQueryBaseVo {
|
||||
|
||||
@ApiModelProperty("结束时间 yyyy-mm-dd hh:mm:ss 可以不要时分秒")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty("指定id")
|
||||
private Long id;
|
||||
}
|
||||
|
||||
30
src/main/java/com/ai/da/model/dto/QueryPaymentInfoDTO.java
Normal file
30
src/main/java/com/ai/da/model/dto/QueryPaymentInfoDTO.java
Normal 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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
9
src/main/java/com/ai/da/model/dto/SubAccountPageDTO.java
Normal file
9
src/main/java/com/ai/da/model/dto/SubAccountPageDTO.java
Normal 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;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
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 renewalFee;
|
||||
|
||||
// 当前订阅开始时间
|
||||
private String lastOrderDate;
|
||||
|
||||
// 当前订阅结束时间
|
||||
private String endOfPrepaidTerm;
|
||||
|
||||
// 付款方式
|
||||
private String paymentMethod;
|
||||
|
||||
private String last4;
|
||||
|
||||
// 订阅Id
|
||||
private String subscriptionId;
|
||||
|
||||
// 订阅方式
|
||||
private String subscriptionType;
|
||||
|
||||
// 订阅开始时间
|
||||
private String startDate;
|
||||
|
||||
private String endDate;
|
||||
|
||||
// 下一个支付日期
|
||||
private String nextPayDate;
|
||||
|
||||
// 下次付款时间(reminder)
|
||||
private String renewalTime;
|
||||
|
||||
// 付款失败原因
|
||||
private String failMessage;
|
||||
|
||||
|
||||
}
|
||||
19
src/main/java/com/ai/da/model/dto/TimeQueryBaseDTO.java
Normal file
19
src/main/java/com/ai/da/model/dto/TimeQueryBaseDTO.java
Normal 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;
|
||||
}
|
||||
13
src/main/java/com/ai/da/model/dto/UpdateUserInfoDTO.java
Normal file
13
src/main/java/com/ai/da/model/dto/UpdateUserInfoDTO.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateUserInfoDTO {
|
||||
private String country;
|
||||
private String occupation;
|
||||
private String title;
|
||||
private String surname;
|
||||
private String givenName;
|
||||
}
|
||||
13
src/main/java/com/ai/da/model/dto/UserLikeSortDTO.java
Normal file
13
src/main/java/com/ai/da/model/dto/UserLikeSortDTO.java
Normal 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;
|
||||
}
|
||||
@@ -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,42 @@ 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;
|
||||
|
||||
private String title;
|
||||
|
||||
private String surname;
|
||||
|
||||
private String givenName;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
17
src/main/java/com/ai/da/model/vo/AffiliateVO.java
Normal file
17
src/main/java/com/ai/da/model/vo/AffiliateVO.java
Normal 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;
|
||||
|
||||
}
|
||||
9
src/main/java/com/ai/da/model/vo/BindEmailVO.java
Normal file
9
src/main/java/com/ai/da/model/vo/BindEmailVO.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BindEmailVO {
|
||||
|
||||
private String token;
|
||||
}
|
||||
18
src/main/java/com/ai/da/model/vo/CheckCouponsVO.java
Normal file
18
src/main/java/com/ai/da/model/vo/CheckCouponsVO.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CheckCouponsVO {
|
||||
|
||||
@ApiModelProperty("expired 过期 || invalid 无效 || valid 有效 || pending 尚未生效")
|
||||
private String status;
|
||||
|
||||
private String message;
|
||||
|
||||
private Float discountedPrice;
|
||||
}
|
||||
@@ -40,4 +40,6 @@ public class CollectionElementVO {
|
||||
|
||||
private String urlWithWhiteSide;
|
||||
|
||||
private String originalUrl;
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user