1389 Commits

Author SHA1 Message Date
ba2d10afbc paymentMethodConfiguration切换 2026-01-28 15:41:52 +08:00
412550df27 BUGFIX:管理员查design频次与chart中获取到的数量有区别 2026-01-27 14:59:39 +08:00
497421e7fe TO DEV 2026-01-27 10:15:36 +08:00
891527426c Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/service/impl/DesignServiceImpl.java
2026-01-26 14:49:38 +08:00
litianxiang
8f0d0953b2 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2026-01-26 11:15:38 +08:00
f5c3621a5d bugfix: design like 2026-01-23 22:45:40 +08:00
litianxiang
9a1a0045e0 fix:like报错 2026-01-23 22:40:30 +08:00
6223c8e994 brandDNA 2026-01-23 22:25:01 +08:00
67bbee49fd Merge branch 'dev/3.1_release_merge' into release/3.1 2026-01-23 21:20:26 +08:00
ad62ceb32a Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-23 21:02:04 +08:00
082afe9e94 gradiant 置空 2026-01-23 20:57:48 +08:00
49288c3a31 TO Prod 2026-01-23 16:10:55 +08:00
81624e36db Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2026-01-23 15:12:15 +08:00
a526b122d1 Merge branch 'release/3.1' into dev/3.1_release_merge 2026-01-23 15:11:45 +08:00
litianxiang
d882b2e817 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-23 15:05:22 +08:00
litianxiang
ebf6427d42 fix:用户特征存入逻辑错误 2026-01-23 15:04:59 +08:00
77fe03d361 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-23 11:46:31 +08:00
7a44d67dbf BUGFIX: 系统消息发布 广播时消息数量错误 2026-01-23 11:46:08 +08:00
55ce2c6c7e Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-23 10:54:35 +08:00
a426caaca3 BUGFIX: 系统消息发布 2026-01-23 10:54:03 +08:00
7cb7ce2836 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-22 16:56:11 +08:00
8e075f1da4 BUGFIX: 通过hsv批量获取潘通信息,替换rgb 2026-01-22 16:55:00 +08:00
litianxiang
0f0fde2a3e Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-22 14:28:37 +08:00
litianxiang
8c6389a1f6 删除不用的字段 2026-01-22 14:28:10 +08:00
652f82b6a4 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-22 13:56:44 +08:00
7ca2528dcf BUGFIX: design后未存储undivided layers 2026-01-22 13:56:07 +08:00
litianxiang
a7800913d2 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-22 13:51:42 +08:00
litianxiang
1eaec64ff4 fix:GlobalAward读取配置错误 2026-01-22 13:51:13 +08:00
e603952332 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-22 11:37:25 +08:00
2bc8b8ef96 BUGFIX: single design的渐变色未存储 2026-01-22 11:36:43 +08:00
0ce968b919 BUGFIX: 用户登录时的有效期验证异常抛出导致事务回滚,用户信息修改失败 2026-01-22 10:37:23 +08:00
litianxiang
dfc9ae4db2 GlobalAward站内信url修改 2026-01-21 16:50:01 +08:00
litianxiang
a3505c6d95 GlobalAward站内信url修改 2026-01-21 15:09:45 +08:00
litianxiang
6db0afd515 GlobalAward保存成功发送站内信,根据url可跳转且召回已填写资料 2026-01-21 14:59:41 +08:00
litianxiang
b1e6183dd1 GlobalAward接口token验证,id更换为uuid 2026-01-21 14:34:43 +08:00
30d08356c0 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-21 14:14:17 +08:00
64cc29f456 TASK:Global Award邮箱验证 2026-01-21 14:13:33 +08:00
litianxiang
2b3e12a11c GlobalAward MINIO配置 2026-01-21 11:38:38 +08:00
litianxiang
d4a4724f61 GlobalAward拦截器配置 2026-01-21 10:35:22 +08:00
litianxiang
ba6e2bd24c GlobalAward拦截器配置 2026-01-21 10:21:17 +08:00
litianxiang
a38895b028 GlobalAward拦截器配置 2026-01-21 10:13:11 +08:00
litianxiang
69a95e66ca GlobalAward上传文件 2026-01-20 16:37:46 +08:00
litianxiang
40518cab37 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev-ltx
# Conflicts:
#	src/main/java/com/ai/da/controller/GlobalAwardController.java
#	src/main/java/com/ai/da/model/dto/ContestantDTO.java
#	src/main/resources/application-dev.properties
#	src/main/resources/application-prod.properties
2026-01-20 16:20:41 +08:00
litianxiang
46d61cb73f GlobalAward上传文件 2026-01-20 15:58:27 +08:00
08f20fd1fe Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-20 13:24:49 +08:00
d7edc166b3 TASK:Global Award邮箱验证 2026-01-20 13:14:50 +08:00
litianxiang
79ad02f66b fix:style为all时,like报错 2026-01-19 16:50:14 +08:00
litianxiang
5e261b55c7 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2026-01-19 16:41:02 +08:00
litianxiang
bc92fcbaf4 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-19 16:40:58 +08:00
litianxiang
c6aec917c2 fix:style为all时,like报错 2026-01-19 16:40:28 +08:00
6bc500e78f Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-16 17:17:25 +08:00
4c43b98c02 TASK:DB中PartialDesign为空时,取undivided_layer作为merge_image_path 2026-01-16 17:17:04 +08:00
litianxiang
5bae785a9f Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-16 16:37:49 +08:00
litianxiang
7b619aa4cb GlobalAward首次提交 2026-01-16 16:37:03 +08:00
c93ad6daa9 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-16 16:24:38 +08:00
0047be7a03 BUGFIX:PartialDesign传空时,先从数据库获取原数据 2026-01-16 16:23:56 +08:00
4ef209cfd4 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-16 14:28:27 +08:00
a19751b4b7 BUGFIX:designType参数校验;print数据验空 2026-01-16 14:28:04 +08:00
litianxiang
bb0e5a4263 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-16 11:04:52 +08:00
litianxiang
9e9df5367d fix:接口SegAnything返回值处理 2026-01-16 11:04:18 +08:00
ba8a2c52de Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2026-01-15 17:36:37 +08:00
39d8c7efcf TASK:取消存储/返回UndividedLayer和UndividedLayerWithSinglePrint字段 2026-01-15 17:35:55 +08:00
litianxiang
401910901a Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/python/PythonService.java
2026-01-15 17:21:30 +08:00
litianxiang
3f5ce6e0e7 接口SegAnything返回值处理 2026-01-15 17:17:08 +08:00
0787025151 TASK:merge 模式返回mask 2026-01-15 14:07:18 +08:00
08b26872ff Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2026-01-14 14:28:05 +08:00
5bbf1326bb TASK:design single部分cv操作前置,新增merge | default两种designType 2026-01-14 14:26:47 +08:00
litianxiang
c5e27cd220 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-14 13:55:01 +08:00
litianxiang
112e9c3bc9 对接前端和py接口SegAnything 2026-01-14 13:31:33 +08:00
litianxiang
ce95cb5080 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-12 14:42:02 +08:00
litianxiang
71211bfbc3 修改存入userPreference表的时间方式 2026-01-12 14:41:24 +08:00
72ad977dcb BUGFIX: 获取近期新用户图表数据允许userType为null 2026-01-12 11:55:43 +08:00
litianxiang
6400e79929 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2026-01-09 14:49:25 +08:00
litianxiang
dd8c72f7d7 切换用户sketch点赞记录存储方式;新增镜像和角度字段,存储前端需要的object 2026-01-09 10:14:46 +08:00
13151b65f5 TASK:限制同一个管理员不允许绑定不同组织的订阅计划 2026-01-07 15:24:38 +08:00
9f523d5953 TASK:分页获取所有用户id,添加按邮箱模糊查询 2026-01-07 11:26:39 +08:00
4879cfeb60 BUGFIX: 2026-01-07 09:53:58 +08:00
9e252b16ef BUGFIX: 2026-01-06 17:36:12 +08:00
e64add14af BUGFIX:更新订阅计划时根据业务需要对参数进行判断并在需要时更新管理员信息 2026-01-06 17:29:33 +08:00
3beb27e491 TASK:获取用户id信息做分页;订阅计划添加国家或地区字段 2026-01-06 09:56:21 +08:00
501032ef17 TASK:试用用户试用期延长至7天 2025-12-31 13:15:13 +08:00
litianxiang
cb25bdd2e0 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-12-29 14:57:41 +08:00
litianxiang
7a9fb0213b 适配新推荐接口 2025-12-29 13:49:31 +08:00
cd767dce6f BUGFIX:新用户不能获取历史系统通知 2025-12-24 11:47:11 +08:00
bf95b85841 to dev 2025-12-23 16:28:07 +08:00
9e58bd9e7d Merge branch 'release/3.1' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/common/utils/SendRequestUtil.java
2025-12-23 16:16:30 +08:00
d0ec5c5c26 BUGFIX:邮件发送失败 2025-12-23 16:03:48 +08:00
ab8aa5ea5c Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-12-23 14:07:53 +08:00
aefcd2fdb0 BUGFIX:邮件发送失败 2025-12-23 14:07:26 +08:00
e74eab1070 BUGFIX:邮件发送失败 2025-12-23 14:05:20 +08:00
litianxiang
34da437a26 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-12-22 11:36:23 +08:00
litianxiang
f84935d0bd 登录token存入redis 2025-12-22 11:35:38 +08:00
35edaa0f27 CONFIG: 拦截器配置 2025-12-19 21:43:02 +08:00
f43099e19e CONFIG: redis 配置修改 2025-12-19 21:21:21 +08:00
8079877734 CONFIG: TO DEV 2025-12-19 17:40:37 +08:00
ef686e38ac CONFIG: TO PROD 2025-12-19 17:33:51 +08:00
100019d2a4 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-12-19 16:00:55 +08:00
litianxiang
12af237d76 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-12-19 15:47:36 +08:00
litianxiang
44dbbb2a4b 更换Moodboard和Printboard提示词 2025-12-19 15:47:07 +08:00
9f42e153a4 Merge branch 'release/3.1' into dev/3.1_release_merge
# Conflicts:
#	.gitea/workflows/develop_build_manual.yaml
2025-12-19 15:01:32 +08:00
4fa70a1c90 BUGFIX:订阅计划创建不允许指定子账号为管理员 2025-12-18 18:03:03 +08:00
dfb34916e7 BUGFIX:订阅计划与子账号新增 2025-12-18 14:52:12 +08:00
9f7987306c BUGFIX:订阅计划 2025-12-18 13:38:38 +08:00
litianxiang
d3fc70fbf2 fix:edit产品图照成排序问题,恢复原逻辑 2025-12-17 16:08:49 +08:00
litianxiang
17645d17e5 关闭batch MQ监听 2025-12-17 16:02:49 +08:00
litianxiang
258eea5277 edit 产品图失败会导致sort不对试验5 2025-12-17 15:43:26 +08:00
litianxiang
bb1d3bd359 Revert "edit 产品图失败会导致sort不对试验5"
This reverts commit 6a8c87ed95.
2025-12-17 15:41:02 +08:00
litianxiang
6a8c87ed95 edit 产品图失败会导致sort不对试验5 2025-12-17 15:40:47 +08:00
litianxiang
eb3826927d edit 产品图失败会导致sort不对试验4 2025-12-17 15:33:14 +08:00
litianxiang
7720c8c771 edit 产品图失败会导致sort不对试验3 2025-12-17 14:12:20 +08:00
litianxiang
b459148d58 edit 产品图失败会导致sort不对试验2 2025-12-17 13:49:07 +08:00
litianxiang
eadda18d1e Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-12-17 13:28:12 +08:00
litianxiang
d403df51ec edit 产品图失败会导致sort不对试验 2025-12-17 13:28:04 +08:00
6903b98b60 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-12-17 13:20:34 +08:00
81bf65515c Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-12-17 13:19:54 +08:00
8e984eb283 BUGFIX:订阅计划 2025-12-17 13:18:24 +08:00
litianxiang
afc6041570 临时测试修改 2025-12-17 13:10:09 +08:00
bce368248c Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-12-16 16:26:27 +08:00
ca7121dcda BUGFIX:订阅计划 2025-12-16 16:24:52 +08:00
litianxiang
9a206f9979 生产环境配置callbackUrl 2025-12-16 14:10:22 +08:00
litianxiang
eb7a46c7e8 fix:callbackUrl 2025-12-16 13:45:21 +08:00
litianxiang
95ef68a784 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-12-16 13:20:31 +08:00
litianxiang
6429288fd9 dev环境加入design回调配置 2025-12-16 13:16:36 +08:00
c5af194876 BUGFIX 2025-12-16 10:42:31 +08:00
da84e1e4b4 注解修改 2025-12-15 18:39:16 +08:00
95a9c81a1b Merge branch 'dev/dev_xp' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/model/dto/SubscriptionPlanDTO.java
#	src/main/java/com/ai/da/model/vo/SubscriptionPlanVO.java
2025-12-15 18:34:30 +08:00
81c0d7eeac TASK:订阅计划相关 2025-12-15 18:30:28 +08:00
litianxiang
fbc473735c fix:对没有like的已发布作品进行二创,会不显示原作者名字 2025-12-15 15:41:58 +08:00
litianxiang
9f48a2ce09 fix:升级swagger注解 2025-12-15 13:38:44 +08:00
459c743ce4 CONFIG: 2025-12-11 16:58:24 +08:00
ce3516916d CONFIG: 2025-12-11 16:18:37 +08:00
0692b29065 Merge branch 'dev/dev_xp' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/controller/AccountController.java
2025-12-11 16:12:41 +08:00
94cafbd10c TASK:flux积分不足,邮件通知 2025-12-11 16:07:14 +08:00
5c2008ec4a TASK:订阅计划,测试修改 2025-12-11 15:26:20 +08:00
litianxiang
4e4b8bd4d2 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev-ltx 2025-12-11 15:12:22 +08:00
litianxiang
9c19d061be fix:升级swagger注解 2025-12-11 10:35:08 +08:00
7f094265da TASK:新增订阅计划概念 2025-12-11 09:44:25 +08:00
22bc8750c8 Merge branch 'dev-ltx' into dev/dev_xp 2025-12-03 16:53:17 +08:00
a940105fa4 DEV 数据库切换 2025-12-03 14:18:58 +08:00
4c0edf09bd Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-12-03 14:14:11 +08:00
bd69793a72 TASK:订阅到期通知或续订通知(暂时关闭邮件发送) 2025-12-03 13:55:52 +08:00
litianxiang
a643338916 fix:接口文档打不开问题pom更新 2025-12-02 15:43:16 +08:00
litianxiang
9344a946ad fix:接口文档打不开问题 2025-12-02 15:42:51 +08:00
fab0c7b372 更新 .gitea/workflows/develop_build_manual.yaml 2025-12-02 14:48:23 +08:00
fc0867d9b1 Merge branch 'dev/3.1_release_merge' into dev/dev_xp 2025-12-02 14:46:23 +08:00
c36ba6211a DEV 数据库切换 2025-12-02 14:34:12 +08:00
litianxiang
aa0a787e3f dev跨域问题初步验证 2025-12-02 14:27:31 +08:00
litianxiang
964ee1c5cc dev数据库切换 2025-12-02 14:18:18 +08:00
ac98cd01db DEV JDK版本升级,redis配置修改 2025-12-02 13:53:43 +08:00
70d498b90d 更新 .gitea/workflows/develop_build_manual.yaml 2025-12-02 13:14:26 +08:00
ae1a2eff2a 更新 .gitea/workflows/develop_build_manual.yaml 2025-12-02 13:12:38 +08:00
b54eaea7e3 更新 .gitea/workflows/develop_build_manual.yaml 2025-12-02 12:16:01 +08:00
aa2363b9a5 更新 .gitea/workflows/develop_build_manual.yaml 2025-12-02 12:11:04 +08:00
41ef9132e9 更新 .gitea/workflows/develop_build_manual.yaml 2025-12-02 11:05:42 +08:00
3b5b57ab08 更新 .gitea/workflows/develop_build_manual.yaml 2025-12-02 10:55:21 +08:00
2ec9ef3290 上传文件至「.gitea/workflows」 2025-12-02 10:49:14 +08:00
fe3fbbe135 DEV 切换数据库 2025-12-02 10:21:07 +08:00
01e82b4c23 Merge branch 'dev/3.1_release_merge' into dev/dev_xp 2025-12-01 17:11:03 +08:00
litianxiang
e085275aee Merge branch 'dev-ltx' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java
2025-12-01 17:10:35 +08:00
litianxiang
fa7271567e 解决循环依赖问题 2025-12-01 17:05:57 +08:00
05049ae7a2 [run build] 2025-12-01 16:39:26 +08:00
b023a68f83 Merge remote-tracking branch 'origin/dev/dev_xp' into dev/dev_xp 2025-12-01 16:02:20 +08:00
6cd42b799a 删除 .gitea/workflows/prod_build_schedule.yaml 2025-12-01 10:22:29 +08:00
6e1ed7f9b8 删除 .gitea/workflows/prod_build_manual.yaml 2025-12-01 10:22:25 +08:00
b7be16738b 删除 .gitea/workflows/develop_build_manual.yaml 2025-12-01 10:22:21 +08:00
6da5e91ec1 删除 .gitea/workflows/develop_build_commit.yaml 2025-12-01 10:22:17 +08:00
00c0a65547 删除 .gitea/workflows/prod_build_schedule.yaml 2025-12-01 10:22:09 +08:00
77aab576de 删除 .gitea/workflows/develop_build_manual.yaml 2025-12-01 10:22:06 +08:00
5b2c77f81b 删除 .gitea/workflows/develop_build_commit.yaml 2025-12-01 10:22:02 +08:00
96040f2349 删除 docker-compose.yml
All checks were successful
git commit 控制 AiDA back-java Develop 分支构建部署 / build_and_deploy (push) Has been skipped
2025-11-30 11:01:40 +08:00
a710fdd432 删除 docker-compose.yml 2025-11-30 11:01:12 +08:00
d598f53d3c Merge branch 'dev/3.1_release_merge' into release/3.1
# Conflicts:
#	.gitea/workflows/prod_build_schedule.yaml
2025-11-28 17:16:55 +08:00
62bf538d96 Merge branch 'dev/dev_xp' into dev/3.1_release_merge
All checks were successful
git commit 控制 AiDA back-java Develop 分支构建部署 / build_and_deploy (push) Has been skipped
2025-11-28 16:38:09 +08:00
456cb1ff19 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-11-28 16:37:56 +08:00
cbca666e7b BUGFIX: 账号重置为游客后,提示混乱 2025-11-28 16:36:34 +08:00
d622195f9d 更新 .gitea/workflows/develop_build_commit.yaml
All checks were successful
git commit 控制 AiDA back-java Develop 分支构建部署 / build_and_deploy (push) Has been skipped
2025-11-28 16:06:56 +08:00
1917fd518d 更新 docker-compose.yml
All checks were successful
手动 AiDA back-java Develop 分支构建部署 / build_and_deploy (push) Successful in 2m3s
[run build]
2025-11-28 15:35:50 +08:00
96170a9956 更新 .gitea/workflows/prod_build_manual.yaml 2025-11-28 15:25:50 +08:00
8205fb5290 上传文件至「.gitea/workflows」 2025-11-28 15:25:41 +08:00
8f72686809 添加 .gitea/workflows/prod_build_schedule.yaml
All checks were successful
手动 AiDA back-java Develop 分支构建部署 / build_and_deploy (push) Has been skipped
2025-11-28 15:18:20 +08:00
37ddf6f441 更新 .gitea/workflows/develop_build.yaml
All checks were successful
手动 AiDA back-java Develop 分支构建部署 / build_and_deploy (push) Has been skipped
2025-11-28 15:14:57 +08:00
dbf9b2d722 添加 .gitea/workflows/develop_build.yaml
Some checks failed
手动 AiDA back-java Develop 分支构建部署 / build_and_deploy (push) Has been cancelled
2025-11-28 15:13:48 +08:00
a91f9ccdd4 更新 .gitea/workflows/develop_build_manual.yaml 2025-11-28 15:09:33 +08:00
dac51afe73 添加 docker-compose.yml 2025-11-28 15:04:01 +08:00
3aa744895f 添加 .gitea/workflows/develop_build_manual.yaml 2025-11-28 14:55:50 +08:00
9535d8ce59 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-28 14:40:38 +08:00
6c8b316dfd BUGFIX: 添加已存在的账号为子账号,该账号有效期没有同步修改 2025-11-28 14:40:09 +08:00
e366d5a2c5 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-28 13:41:35 +08:00
b6add404b3 BUGFIX: 添加已存在的账号为子账号,该账号有效期没有同步修改 2025-11-28 13:36:46 +08:00
fcbe4762b3 TO prod 2025-11-27 17:38:24 +08:00
e750adcc94 TO prod 2025-11-27 17:35:47 +08:00
litianxiang
1c782f8fd7 dev fix:designSingle代码本地提交 sysfile加入style字段 2025-11-27 11:33:20 +08:00
litianxiang
b58b8df88f Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-11-26 16:14:09 +08:00
litianxiang
c09f734a30 fix:兼容老数据detail会创建新数据的问题 2025-11-26 16:13:39 +08:00
1464689657 TASK:视频生成完成站内信语言给中英双语 2025-11-26 10:09:59 +08:00
litianxiang
a2ff345da5 升级JDK到21 2025-11-25 16:46:05 +08:00
9ae1626309 Merge branch 'refs/heads/dev/3.1_release_merge' into dev/dev_xp 2025-11-25 14:25:59 +08:00
70a41bdfbc TASK:用户账号到期邮件通知 2025-11-25 14:24:30 +08:00
litianxiang
8757db4f3d Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-11-25 11:46:29 +08:00
litianxiang
a8e3304db2 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev-ltx 2025-11-25 11:45:49 +08:00
litianxiang
26f2299381 designSingle改为直接在源数据进行修改而不是逻辑删除再创建新数据 2025-11-25 11:45:09 +08:00
c1a5799da7 to dev 2025-11-25 10:15:32 +08:00
94c0e81335 BUGFIX: 打开佣金计算定时器 2025-11-25 10:10:14 +08:00
b9641474ba Merge branch 'release/3.1' into dev/3.1_release_merge 2025-11-22 00:42:20 +08:00
059d6edc12 BUGFIX: 查询affiliate时,不显示已删除的记录,删除affiliate时,状态也修改 2025-11-22 00:41:35 +08:00
97c5be7b22 CONFIG:修改第二数据源的库 2025-11-22 00:15:13 +08:00
c4da4ea111 CONFIG:to Prod 2025-11-21 17:09:53 +08:00
litianxiang
db1048d875 第二数据源修改库名 2025-11-21 16:49:07 +08:00
bbc8b025a9 CONFIG:to Prod 2025-11-20 16:57:48 +08:00
630f6b2737 Merge branch 'release/3.1' into dev/3.1_release_merge 2025-11-20 15:48:03 +08:00
d14fdfee79 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-20 11:11:21 +08:00
c14db62c0a BUGFIX:1.添加系统sketch到个人library 2.video生成结束后总是发送失败站内信 2025-11-20 11:09:20 +08:00
litianxiang
9166bf1a1a Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-11-20 10:50:17 +08:00
litianxiang
84c024eab8 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev-ltx 2025-11-20 10:48:57 +08:00
litianxiang
b86f3c9f7e 1.fix:高级工具转产品图不需要也没有ageGroup,会导致报错
2.上传sketch模板代码
2025-11-20 10:48:36 +08:00
e2009617db Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-19 17:00:29 +08:00
65b17fe109 TASK:调用第三方api,视频生成结束发送站内信 2025-11-19 16:59:54 +08:00
0917154283 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-19 15:58:11 +08:00
0f525c6c00 BUGFIX: 1.系统消息已读需判断接收人员 2.本地模型视频生成失败时,发送站内信 2025-11-19 15:57:47 +08:00
4beae1094b Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-18 17:45:53 +08:00
cefdac133e BUGFIX: 获取系统通知未读数 2025-11-18 17:45:11 +08:00
a466f269c2 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-18 16:04:37 +08:00
97f0c8f65f BUGFIX: 获取系统通知未读数 2025-11-18 16:02:26 +08:00
ad00ac08ca Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-18 14:10:24 +08:00
d236057f2a BUGFIX: 获取系统通知未读数 2025-11-18 14:09:58 +08:00
62e3e9c16f Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-18 13:32:16 +08:00
604c529b42 BUGFIX: 视频生成完成后,站内信通知 2025-11-18 13:31:18 +08:00
bc612481dc Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-18 10:28:44 +08:00
2f3fa695b2 BUGFIX: 解决部分循环注入问题 2025-11-18 10:27:29 +08:00
313fc19dac Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-17 16:56:50 +08:00
f36e0488ea TASK: video生成成功后添加站内信通知 2025-11-17 16:55:45 +08:00
f239c8c02b TASK: 订阅或试用用户账号到期邮件通知 2025-11-14 18:08:40 +08:00
litianxiang
1d4017bafd minio上传base64 log补充信息 2025-11-14 15:57:49 +08:00
litianxiang
8c98f91445 minio上传base64 log补充信息 2025-11-14 15:42:24 +08:00
18f5528d59 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-14 14:52:29 +08:00
88ce191950 TASK:1.订阅成功和续签成功,通知商家的邮件中添加邮件和国家 2.在getModuleContent的回参中添加motion相关数据 3.修改Affiliate账号状态与修改佣金比例接口合并 2025-11-14 14:51:30 +08:00
litianxiang
f3d6d7b000 fix:进行design后library中可能会生成同样的图片
fix:ageGroup在designSingle时不会被存入数据库导致收藏页面不能显示完整
2025-11-14 13:32:57 +08:00
ef84f32ca0 TASK:添加系统sketch到个人library 性别细节修改 2025-11-13 14:24:07 +08:00
3886aeaa46 Merge branch 'dev/dev_xp' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/python/PythonService.java
#	src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java
2025-11-13 13:41:31 +08:00
8750ea355a TASK:1.修改affiliate状态 2.添加系统sketch到个人library 3.视频生成新增生成模型 4.获取所有pose,从过去gif改为获取video 2025-11-13 11:40:37 +08:00
litianxiang
b107fa82df 修改第二数据源位置 2025-11-13 11:24:14 +08:00
litianxiang
e56a6176a9 fix:为BoundingBox返回值排序解决每次获取可能会排序错误的bug 2025-11-13 10:51:00 +08:00
litianxiang
e35ed2c768 转产品图提示词更换 2025-11-12 17:25:46 +08:00
litianxiang
52094d58e7 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-11-12 13:50:14 +08:00
litianxiang
e4e6cfbff7 sketch暂时修改为java端推荐,根据style进行推荐 2025-11-12 13:49:01 +08:00
litianxiang
15f2b78c94 配饰detail显示问题 2025-11-07 11:50:13 +08:00
litianxiang
1fd1f7dd47 配饰更换为其他 2025-11-06 17:20:05 +08:00
litianxiang
2a6d3c1b58 fix:初次从收藏和生成的线稿,再刷新前不会被用于design 2025-11-06 15:21:37 +08:00
59e33c22b7 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-11-05 17:25:21 +08:00
e5eecbfe8d BUGFIX: 路径修改 2025-11-05 17:24:46 +08:00
9759cf4740 BUGFIX: volcengine依赖包使用指定版本 2025-11-05 17:04:31 +08:00
e8766b9af3 Merge branch 'dev/dev_xp' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/common/config/MyTaskScheduler.java
#	src/main/java/com/ai/da/common/task/PaymentTask.java
2025-11-05 16:51:41 +08:00
4fed5f7439 BUGFIX: design single - sketch modify 2025-11-05 16:40:31 +08:00
litianxiang
c3e0a61ff7 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev-ltx 2025-11-04 16:41:08 +08:00
litianxiang
58212e92ec 增加配饰类别 2025-11-04 16:37:57 +08:00
5efaaf01b2 task:motion 本地模型接口调用地址修改 2025-11-03 13:10:37 +08:00
18c94ad1e0 BUGFIX:取消续订提前邮件通知 2025-10-30 16:44:45 +08:00
e825c9bd75 BUGFIX:用户订阅后,订阅者和商家无法收到通知邮件 2025-10-22 10:48:29 +08:00
1af705592a BUGFIX:1.design中dislike后排序混乱 2.续订成功通知会再次通知上一次的成功订阅 2025-10-17 17:59:43 +08:00
litianxiang
d426fb34a2 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-10-16 11:52:20 +08:00
litianxiang
8c3e1fdda5 fix:作品快照序列化问题导致报错 2025-10-16 11:51:29 +08:00
litianxiang
a76b9ba365 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-10-16 11:00:36 +08:00
cd74022d04 BUGFIX:generateLike添加年龄段 2025-10-16 10:03:57 +08:00
litianxiang
d5b972ab16 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev-ltx 2025-10-16 09:32:38 +08:00
a3e63c9877 BUGFIX:排序优化 2025-10-15 18:32:19 +08:00
0c227a1efa BUGFIX:排序优化 2025-10-15 18:03:48 +08:00
litianxiang
59602540a3 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-10-15 16:03:56 +08:00
4578cb5778 BUGFIX:排序优化 2025-10-15 16:03:08 +08:00
litianxiang
9959a03ccc fix:兼容二创设置旧数据没有性别问题 2025-10-15 15:58:08 +08:00
litianxiang
ff43ffaba6 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-10-15 15:17:22 +08:00
litianxiang
1c32aaa46c 防止因为二创导致的数据存在taskId相同导致报错问题 2025-10-15 14:47:04 +08:00
db5f435a4d BUGFIX:1.标签允许不同用户创建相同的标签2.删除指定人员试用名单通知邮箱 2025-10-15 10:46:27 +08:00
litianxiang
c9f9ef0ce2 谷歌模型错误提示词修改 2025-10-15 10:35:59 +08:00
litianxiang
3b6a9882d2 回滚 2025-10-14 18:10:59 +08:00
litianxiang
854847a6f4 去掉打印谷歌base64log 2025-10-14 17:46:06 +08:00
litianxiang
309d95ab3c fix:sort时有类型转换异常 2025-10-14 17:31:30 +08:00
litianxiang
422d547cfd Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/service/impl/CollectionSortServiceImpl.java
2025-10-14 17:30:30 +08:00
litianxiang
e6a0706d61 新增谷歌模型违规提示词或图片报错
模型扣除积分修改
压缩转产品图的输入
fix:sort时有类型转换异常
2025-10-14 17:20:23 +08:00
19c08f4237 BUGFIX:1. 排序优化,添加唯一约束和重试
2.like前先查询是否有被like
2025-10-13 17:35:27 +08:00
6ac9680c64 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-10-13 13:51:08 +08:00
4ce6fb4190 BUGFIX:为design的排序(collection_sort)添加唯一约束 2025-10-13 13:50:51 +08:00
litianxiang
6b7abafb68 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-10-13 13:45:31 +08:00
litianxiang
02f7031a67 修改配置增加模特功能修改
fix:模特有时会没有设置成功性别
豆包qwen模型增加违规提示词提醒
2025-10-13 13:42:38 +08:00
3d67ac71f3 BUGFIX:moodboard无法完全删除 2025-10-10 13:26:13 +08:00
litianxiang
67f0ce7c6c Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-10-09 15:28:08 +08:00
litianxiang
5fbcaf9077 去掉本地vpn设置 2025-10-09 15:23:12 +08:00
ebb19ea15e BUGFIX:漏传 2025-10-09 15:18:05 +08:00
litianxiang
5efa5cad33 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-10-09 15:06:34 +08:00
litianxiang
f9dfd61b89 fix:谷歌模型新加重试机制,修改nanobanana正式版ID 2025-10-09 15:05:09 +08:00
42aed5804b BUGFIX:1.生成的图案在design时未加入到library
2.获取组织名时出现空字符串
TASK:1. 允许超级管理员按组织名查询用户design频次
2025-10-08 21:04:19 +08:00
litianxiang
df5ee235f2 fix:fast模型匹配为normal 2025-10-08 16:09:39 +08:00
litianxiang
ad2bb7062e Merge remote-tracking branch 'origin/release/3.1' into dev-ltx 2025-10-08 13:09:39 +08:00
litianxiang
4fbacb37c1 google模型添加http重试 2025-10-08 13:08:14 +08:00
litianxiang
3150f5ae57 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-10-07 14:02:08 +08:00
litianxiang
20cf415635 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java
2025-10-06 22:16:26 +08:00
litianxiang
7bd32914a1 删掉aida.iml 2025-10-06 22:01:57 +08:00
litianxiang
24d54ea9ea 转产品图模型换为nanobanana 2025-10-06 22:00:34 +08:00
c00c2e738b BUGFIX:1.查询组织接口完善 2.设置默认的二级印花分类 3.教育管理员登录时过期处理 2025-10-06 18:09:11 +08:00
litianxiang
6772610129 fix:根据不同类型判断性别进行男女服装筛选,否则会造成design异常 2025-10-03 12:04:48 +08:00
litianxiang
a681a298f4 恢复修改设置会多一个模特fix判断模特是否存在的方式 2025-10-02 12:09:07 +08:00
litianxiang
e6d5d4f614 去掉vpn设定 2025-10-02 09:49:52 +08:00
litianxiang
187c38ad61 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-10-02 09:37:29 +08:00
litianxiang
95f6f02290 豆包api key 2025-10-02 09:37:21 +08:00
ab7ef19657 pantone中的rgb替换 2025-10-02 06:26:39 +08:00
litianxiang
d837f0dc78 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/service/WorkspaceService.java
#	src/main/java/com/ai/da/service/impl/DesignServiceImpl.java
#	src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java
2025-10-02 00:41:04 +08:00
litianxiang
ab6cc04483 为模特和线稿设置性别
修改设置模特会增多问题
模型更换
设置可以切换男女兼容
TODO:扣除积分价格
转产品图模型未完成
2025-09-30 17:22:23 +08:00
9110e0dd34 dev环境暂时不上生产的变更 2025-09-26 21:46:49 +08:00
0f084c27ea BUGFIX:1. singleDesign颜色返回不对 2. 单品design通过优先级获取图层有误 2025-09-26 18:25:40 +08:00
b1b465a05a BUGFIX:1. 单品设计返回的优先级不对 2. 修改项目参数会导致多一个模特 2025-09-26 16:47:03 +08:00
2e4b1516cc BUGFIX:新增的图层未转为预览地址 2025-09-26 11:40:17 +08:00
1e389bec86 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-09-25 16:52:50 +08:00
2d0936f0f3 BUGFIX:1. to product 不添加衣服类别提示词
2. 新增添加了单个印花的未分割图层返回
3. design中使用的元素,sketch没有被正确的添加年龄段,导致用户无法查询到
2025-09-25 16:51:58 +08:00
dab253c313 BUGFIX:检查所有异常提示的语言是否都做了多语言 2025-09-24 14:21:07 +08:00
ed86cd45ad BUGFIX:创建项目时,已输入的项目名被覆盖 2025-09-23 22:54:07 +08:00
814324430c dev切换到prod,部分功能不上传 2025-09-23 17:34:08 +08:00
1d006342fb BUGFIX:创建优惠券设置开始结束时间失败;开启stripe模块的接口文档 2025-09-23 16:24:00 +08:00
24fe265172 BUGFIX:1.微信注册后绑定邮箱失败;2.按类别查项目历史记录 2025-09-23 14:48:44 +08:00
79e19a029b BUGFIX:undividing layer未设置成功 2025-09-23 10:54:09 +08:00
227a20f6f2 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-09-22 17:50:06 +08:00
efa26d912d TASK:添加默认项目名,存储design结果的undivided_layer 2025-09-22 17:49:13 +08:00
litianxiang
ea19e915db fix:二创旧数据兼容 2025-09-22 15:03:20 +08:00
41759ca44b Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-09-22 14:17:05 +08:00
29e1d864ae BUGFIX: saveModuleContent时无法删除最后一个元素
TASK: 打开教育账号检查过期定时器
2025-09-22 14:16:34 +08:00
6cfd420e46 sketch advance 提示词增加修饰 2025-09-20 22:01:21 +08:00
51024508b9 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-09-19 17:31:55 +08:00
b7b07b8843 sketch 提示词未修饰 2025-09-19 17:31:31 +08:00
c1d26a87ce Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-09-19 14:09:29 +08:00
d59a69e6f4 切换dev环境的谷歌登录相关配置 2025-09-19 14:08:52 +08:00
litianxiang
042501f9b1 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-09-18 17:49:36 +08:00
litianxiang
9e6fcb4f73 fix:查询详细项目信息文件恢复 2025-09-18 17:48:40 +08:00
9386a2c6c4 隐藏检查管理员账号到期接口 2025-09-17 17:49:48 +08:00
c43a716104 BUGFIX: 所有通过邮件注册、登录等的查询,不再区分大小写 2025-09-17 17:46:42 +08:00
litianxiang
950707ab44 Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-09-17 16:45:56 +08:00
litianxiang
b0e5f39765 perf:减少/api/project/getModuleContent数据库交互次数以优化速度 2025-09-17 16:14:08 +08:00
5eebb878ca Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge 2025-09-17 15:34:36 +08:00
litianxiang
d568129843 fix:增加projectID匹配,避免因为二创导致查询到多条记录 2025-09-17 15:19:19 +08:00
d093aa9d1a Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-09-17 11:35:12 +08:00
3c1d180ed6 BUGFIX: 试用订单邮件发送,区分环境 2025-09-17 11:33:25 +08:00
b9c24386b9 BUGFIX: 未解析用户数据的接口使用了上一个使用这个线程的用户信息 2025-09-16 17:42:39 +08:00
litianxiang
8f53902d18 fix:点击我的喜欢会出现非喜欢的作品
fix:二创因为designID为-1导致报错的bug
2025-09-16 17:21:47 +08:00
c79535ac3f Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-09-16 17:02:20 +08:00
106528ce08 TASK: 教育管理员账号到期后降为游客并移除所有子账号 2025-09-16 17:01:18 +08:00
litianxiang
23eda80389 Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge 2025-09-16 11:49:43 +08:00
litianxiang
eccd2a35e9 fix:9.11代码覆盖恢复 2025-09-16 11:36:43 +08:00
9c69aeae53 Merge branch 'dev/dev_xp' into dev/3.1_release_merge 2025-09-16 11:26:12 +08:00
5bac740efd TASK: Affiliate审批通过后,邮件中添加邀请链接 2025-09-16 11:20:09 +08:00
litianxiang
fa74236035 fix:二创报错 2025-09-16 11:07:54 +08:00
litianxiang
630dfe98a4 /api/project/getModuleContent速度优化 2025-09-16 11:01:22 +08:00
c922563919 TASK: Affiliate审批通过后,邮件中添加邀请链接 2025-09-12 16:25:34 +08:00
ce68696934 TASK: 1. 登录不区分邮箱大小写
2. 将所有删除用户的操作更改为修改身份为游客
2025-09-12 15:46:35 +08:00
5d8bdf9ecc TASK: 子账号积分刷新沿用上月分配的积分
BUGFIX: 获取作品详情
2025-09-11 16:01:25 +08:00
e3b0d3bc0a BUGFIX:1. 新建的教育管理员无法登录、无法分配积分
2. 填写个人信息时会覆盖其他人的信息
TASK:教育用户不能通过个人版登录入口登录
2025-09-10 22:05:45 +08:00
5f5f2c83d7 管理员允许查看各功能使用数据表 2025-09-09 18:49:08 +08:00
aff51a2793 管理员允许查看各功能使用数据表 2025-09-09 18:48:42 +08:00
4c5d8d3c61 修改管理员页面权限校验 2025-09-09 17:32:12 +08:00
f667099f4f 修改管理员页面权限校验 2025-09-09 17:31:51 +08:00
d5a74c1ff3 新建子账号 默认密码修改 2025-09-09 12:04:37 +08:00
c187d25d74 新建子账号时已使用积分为空 2025-09-08 16:20:24 +08:00
f20a85a0e2 Google 回调地址修改 2025-09-07 20:52:49 +08:00
4f93ec144b BUGFIX:添加已存在的子账号时,不指定密码则不会修改原账号密码 2025-09-04 21:18:21 +08:00
de16437d08 BUGFIX:1. 所有作品中无法查看个人刚发布的作品
2. 100月付用户的邮件中续订金额不对,发送给商家的邮件中夹杂中文
3. 推广码没有截止有效期时使用该推广码报错
2025-09-04 18:29:52 +08:00
c67d197da0 BUGFIX:无法通过谷歌登录/教育管理员无法查看design使用频次 2025-09-03 18:15:23 +08:00
d8f0188596 BUGFIX:无法通过谷歌登录 2025-09-03 15:50:13 +08:00
ddc089faa4 BUGFIX:印花pin的数量为9时无法design 2025-09-03 15:48:45 +08:00
f5ecd34a9c BUGFIX:无法查看我喜欢的作品 2025-09-03 00:23:32 +08:00
3c071378ad BUGFIX:无法查看我的作品 2025-09-02 23:46:40 +08:00
8b2aab2e5e Merge branch 'dev/3.1_release_merge' into release/3.1 2025-09-02 22:28:58 +08:00
c4a42b03f6 BUGFIX:发布作品中没有like的衣服导致查看作品详细报错 2025-09-02 22:28:33 +08:00
0dad9ff618 切换端口9994->9990 2025-09-02 21:12:34 +08:00
136bcdf82b 切换正式支付环境 2025-09-02 20:13:37 +08:00
a59acb0903 BUGFIX: 2025-09-02 20:09:37 +08:00
feca192f53 BUGFIX: 无法二创 2025-09-01 23:13:54 +08:00
179b79812a release 3.1 dev与prod代码合并冲突处理 2025-08-31 22:02:28 +08:00
94cf82340a Merge branch 'release/3.1' into dev/3.1_release_merge
# Conflicts:
#	src/main/java/com/ai/da/common/config/MyTaskScheduler.java
#	src/main/java/com/ai/da/common/enums/ProductEnum.java
#	src/main/java/com/ai/da/common/task/PaymentTask.java
#	src/main/java/com/ai/da/common/utils/LocalCacheUtils.java
#	src/main/java/com/ai/da/common/utils/RedisUtil.java
#	src/main/java/com/ai/da/controller/AffiliateController.java
#	src/main/java/com/ai/da/controller/ConvenientInquiryController.java
#	src/main/java/com/ai/da/controller/StripeController.java
#	src/main/java/com/ai/da/mapper/primary/entity/Library.java
#	src/main/java/com/ai/da/mapper/primary/entity/ProductCoupons.java
#	src/main/java/com/ai/da/model/dto/CreateCouponDTO.java
#	src/main/java/com/ai/da/model/vo/CheckCouponsVO.java
#	src/main/java/com/ai/da/service/AffiliateService.java
#	src/main/java/com/ai/da/service/PaymentInfoService.java
#	src/main/java/com/ai/da/service/StripeService.java
#	src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
#	src/main/java/com/ai/da/service/impl/AffiliateServiceImpl.java
#	src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java
#	src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java
#	src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java
#	src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java
#	src/main/java/com/ai/da/service/impl/PaymentInfoServiceImpl.java
#	src/main/java/com/ai/da/service/impl/StripeServiceImpl.java
#	src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java
#	src/main/resources/messages_en.properties
#	src/main/resources/messages_zh.properties
2025-08-31 17:54:44 +08:00
c649907222 数据迁移代码 2025-08-31 14:16:08 +08:00
c93ae85b65 BUGFIX: 1、singleDesign使用generate的印花没有传minio导致出现错误
2、项目中没有保存生成和上传的印花的类型
2025-08-29 14:18:17 +08:00
6441bfbbba BUGFIX: 子账号信息无法正确导出为excel 2025-08-28 19:22:55 +08:00
933522482b TASK:审批affiliate 2025-08-28 14:01:48 +08:00
56b56981b1 TASK:便利查询,查询所有用户id时根据用户身份限定查询范围 2025-08-28 11:29:30 +08:00
9e2ea2de62 TASK:导出数据时添加校验 2025-08-27 17:40:05 +08:00
7005b75e11 TASK:导出数据时添加校验 2025-08-27 15:24:43 +08:00
5b09d2cbf5 BUGFIX:查询design使用情况数据不对 2025-08-27 14:57:15 +08:00
126ac209c6 BUGFIX:普通生成积分扣除有误 2025-08-27 14:15:58 +08:00
98eb29eeb5 BUGFIX:普通生成积分扣除有误 2025-08-27 13:44:32 +08:00
ee551a0be2 BUGFIX:编辑子账号邮箱时积分回流策略有漏洞 2025-08-27 11:41:07 +08:00
c3cbb61c16 BUGFIX:积分扣除失败 2025-08-27 11:22:08 +08:00
71f0293cd9 BUGFIX:修改用户邮箱异常时事务没回滚 2025-08-27 10:39:46 +08:00
35604e5130 BUGFIX:超管创建机构管理员 2025-08-27 10:15:59 +08:00
18c38b020e TASK:默认积分分配改为平均分配;超级管理员可新增教育、企业管理员账户;组织成员使用积分时需要记录creditsUsage;试用用户初始50积分 2025-08-26 23:53:40 +08:00
6e9213ec5a BUGFIX:获取brand dna计算时间为空 2025-08-26 16:24:52 +08:00
83ba69c950 BUGFIX:子账号批量导入、brand dna返回计算时间、按权限范围查询design频次 2025-08-26 15:49:02 +08:00
3cc329f983 param change 2025-08-26 14:49:43 +08:00
c42ee8a1bf Merge branch 'dev/dev_xp' into dev/dev 2025-08-26 14:27:50 +08:00
9a650afc7d TASK:优化查询子账号design试用频次,根据管理员身份限定查询范围 2025-08-26 14:10:28 +08:00
45a336ced3 TASK:brand dna获取进度 返回计算时间 2025-08-26 13:33:28 +08:00
e258166a16 Merge branch 'dev/dev_xp' into dev/dev 2025-08-26 11:54:24 +08:00
f9ec733f07 BUGFIX: 编辑referral状态 2025-08-26 11:53:53 +08:00
54b09b4940 TASK:万相补偿获取结果之后通知用户 2025-08-26 09:35:18 +08:00
6d0c29f5c3 TASK:motion生成完成后邮件通知 2025-08-25 18:16:57 +08:00
23523f73da TASK:教育版子账号积分刷新策略更新 2025-08-25 18:07:37 +08:00
e45d572078 TASK:Stripe订阅,添加月付(经济版)及相应费用、积分的更新 2025-08-25 15:02:34 +08:00
eebb790aeb BUGFIX:教育子账号新增-积分分配问题 2025-08-25 09:18:07 +08:00
9c6573f1a6 BUGFIX:删除library元素时没有将brand中关联的数据删除,导致出现空指针 2025-08-22 15:27:09 +08:00
6a5282e4d5 BUGFIX:将已存在的账号添加到子账号中,积分计算混乱 2025-08-21 16:03:24 +08:00
3c5a5ff225 Merge branch 'dev/dev' into dev/dev_xp 2025-08-21 13:22:48 +08:00
e4ce7e9e63 TASK:获取affiliate的用户名和id;BUGFIX:模特无法保存 2025-08-21 13:22:22 +08:00
1089a5a2a5 TASK:flux 生成pattern时输出图片比例设置为1:1 2025-08-20 18:15:46 +08:00
156fcfae6b Merge branch 'dev/dev_xp' into dev/dev 2025-08-20 18:02:18 +08:00
7436fa17c0 TASK:添加接口说明 2025-08-20 18:01:28 +08:00
d9f19f1728 Merge branch 'dev/dev_xp' into dev/dev 2025-08-20 16:41:14 +08:00
81c417ed76 BUGFIX:1、子账号查询,无法批量根据用户名或邮箱查
2、教育版子账号创建及修改涉及的积分问题
2025-08-20 16:40:44 +08:00
59a3015170 TASK:查affiliate列表接口添加参数校验;打开佣金计算定时器 2025-08-20 09:37:35 +08:00
b02009bf14 Merge branch 'dev/dev_xp' into dev/dev 2025-08-19 17:45:11 +08:00
caa9985d11 TASK: 1.affiliate 新增referral新增、查询、修改以及其他相关的自动结算佣金的功能;2.删除affiliate_income表及相关mapper 2025-08-19 17:44:34 +08:00
80957bfc00 Merge branch 'dev/dev_xp' into dev/dev 2025-08-19 09:33:16 +08:00
552ec828ab BUGFIX:1、删除模特后保存失败
2、获取个人库中的模特不准确
2025-08-18 16:18:51 +08:00
42273750f4 BUGFIX:从缓存获取模特 2025-08-15 18:00:41 +08:00
45d6af92e8 BUGFIX:1、教育通过上传文件批量创建子账号没有任何校验
2、下载子账号所有信息接口缺失(原下载模板接口保留)
3、保存个人模特到collection时类型设置为System
4、创建子账号时设置积分无效
2025-08-15 17:44:45 +08:00
c28db81893 BUGFIX:同一浏览器切换版本登录时,密码被置空 2025-08-13 16:45:30 +08:00
1e25ae36f1 TASK:1、教育版添加新用户、修改用户、移除用户需求更改;2、修改登入校验条件
BUGFIX:当用户积分为空时报错
2025-08-13 15:52:19 +08:00
9bf40d879f BUGFIX: 用户选择作品进行二创后,无法正确展示原作品中被like的design 2025-08-05 16:50:54 +08:00
878f556a0b BUGFIX:分页查询所有项目历史记录,根据更新时间排序,解决项目记录没有更新时间导致空指针问题 2025-08-04 13:29:12 +08:00
4ad2cd027c TASK:1. 通过定时任务,补偿获取第三方api的运行结果;
2. pose 生成,对使用万相模型的生成限流,最大支持5个并发
3. Slogan限流,一分钟内,最多接收3个请求
2025-08-01 17:21:41 +08:00
132f48eb60 CONFIG:dev添加死信队列信息 2025-08-01 11:29:47 +08:00
5b33e31504 BUGFIX:画布存在minioUrl为空的情况,此时不处理minio地址 2025-08-01 11:12:11 +08:00
e16268a013 TASK: 邮件模板 2025-07-31 18:20:43 +08:00
739e637267 TASK: 发送邮件功能及发送失败后的重试机制 2025-07-31 15:57:47 +08:00
7edc959432 TASK: 保存画布时返回画布id
BUGFIX: 用户输入的prompt没有传入flux
2025-07-31 14:57:20 +08:00
c444d5a69f TASK: to product、relight、pose未like的数据也需要返回parentId 2025-07-30 15:12:38 +08:00
830d06a900 BUGFIX: 更新flux生成结果失败 2025-07-29 15:59:57 +08:00
0fcd8e5444 BUGFIX: 1、修改画布时,不再上传新文件,改为覆盖原文件
2、删除toProduct relight结果时没删干净导致获取源文件失败
2025-07-29 15:00:13 +08:00
020cfe9016 TASK:design single中添加单件衣服画布保存 2025-07-29 13:12:20 +08:00
39903f3da6 BUGFIX:循环依赖导致项目无法启动 2025-07-28 17:27:00 +08:00
b1d682a909 TASK:1、to product修改任务状态字段为task 2、异步向api_generate表中添加记录 3、优化flux结果获取,避免重复获取结果时因图片过期覆盖原可用图片 2025-07-28 15:01:16 +08:00
07d60303db BUGFIX: to product 用户未输入prompt时,出现空指针 2025-07-28 12:10:39 +08:00
5287d83b82 BUGFIX:1、userLikeService中业务划分不清晰导致与generateService出现循环依赖问题。解决:将CollectionSort单独划分为一个Service
2、新建t_api_generate表用于补偿查询生成结果
2025-07-25 17:13:06 +08:00
e2085190d1 BUGFIX:单品设计存储时,不要涉及body相关数据 2025-07-25 13:17:23 +08:00
565b5c3de1 BUGFIX:单品设计偏移量为空问题 2025-07-24 17:18:40 +08:00
fd29452e0c BUGFIX:flux请求失败后的日志打印问题 2025-07-24 11:33:28 +08:00
0f93099d04 BUGFIX:修改获取flux结果的get方法名 2025-07-24 09:40:34 +08:00
e2d50a6dfa TASK: 优化generate请求方法,将长方法拆分为由多个小方法组成 2025-07-23 17:25:00 +08:00
c4d20cd522 TASK: 1、印花生成允许使用flux
2、修改sketch\print允许修改上传的元素
3、印花生成结果中添加level2Type
2025-07-23 16:59:41 +08:00
229e1353f4 BUGFIX: 获取万相的生成结果时没有返回status 2025-07-22 17:36:16 +08:00
07571aaad1 TASK: 画布数据 回参处理不为空时的minio地址 2025-07-22 13:42:07 +08:00
3c2b4ffc48 TASK: 画布数据 回参添加返回crossOrigin 2025-07-22 11:31:26 +08:00
bb0a3bd1cd BUGFIX: 1、允许存储没有潘通值的颜色
2、getModule时design子元素回参增加
2025-07-22 11:09:47 +08:00
3bd9ff82d7 BUGFIX: 获取我的作品时,无法查看设置为私有的作品 2025-07-21 17:54:12 +08:00
f0fccaaf51 TASK:pose transfer添加返回参数 2025-07-21 17:11:10 +08:00
2041809ea6 TASK:pose transfer添加返回参数 2025-07-20 19:19:07 +08:00
b90df7468e TASK:管理员权限变更 2025-07-18 17:32:03 +08:00
e2e0bd6b47 TASK:toProduct relight pose 返回的数据中需包含设置的参数信息 2025-07-18 16:37:37 +08:00
785ae33e86 BUGFIX: 旧作品中有的没有项目id 2025-07-17 17:34:03 +08:00
20f7dc0ef9 TASK:作品更新接口,将通过projectId替换userLikeGroupId 2025-07-17 17:21:14 +08:00
0155154664 BUGFIX: cloudTask数据插入的时间晚于python端向MQ中发消息的时间 2025-07-17 11:48:38 +08:00
d264c29557 TASK: 删除toProduct Relight Pose后重新排序 2025-07-17 10:51:43 +08:00
432149dce2 TASK: 拼贴 未进行生成时也显示上传的图片 2025-07-16 19:29:52 +08:00
5b3a52152a TASK: ToProduct Relight Pose新增删除接口 2025-07-16 19:14:41 +08:00
301f58bc62 TASK: 拼贴功能保存用户上传的图片并返回 2025-07-15 18:11:12 +08:00
64318de24a BUGFIX: 创建pose transfer任务error 2025-07-15 13:12:29 +08:00
fb01250142 BUGFIX: 通过projectId获取pose transfer结果路径出错 2025-07-15 13:02:59 +08:00
0beec5392e Merge branch 'dev/dev_xp' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java
2025-07-15 12:10:55 +08:00
f551ba452f BUGFIX: 通过projectId获取pose transfer结果路径出错 2025-07-15 11:58:13 +08:00
f4b22fe874 BUGFIX: 1、还未生成出结果但是没有失败的pose transfer需返回taskID 2025-07-14 19:17:21 +08:00
e95444266b BUGFIX: 1、getModuleContent没有返回taskId
2、万相生成的pose没有更新状态
2025-07-14 18:05:10 +08:00
e361960e51 TASK: 1、对于生成失败情况,在数据库添加状态记录,并在getModuleContent时不返回该条记录 2025-07-11 17:56:15 +08:00
d0a9c05d4b BUGFIX: 1、相同的relation_id,relation_type重复排序,针对脏数据做处理 2、传入数据库中没有的userLikeSortId 2025-07-11 14:22:38 +08:00
f852927116 BUGFIX: 1、积分重复扣除 2、pose transfer没有开始时间,没有项目id 2025-07-11 11:07:27 +08:00
daa88889d0 TASK:1、印花允许修改并保存
BUGFIX: 1、批量生成有的类型没有任务开始执行时间,任务结束时间有误
2025-07-10 17:50:31 +08:00
766e75f2ed BUGFIX: 批量生成积分扣除有误 2025-07-10 13:38:00 +08:00
eb7f2a1419 BUGFIX: 批量生成积分扣除有误 2025-07-10 11:24:25 +08:00
c7c69417ef TASK: 1、更换pose,重新生成templateId
2、brandDNA 开启分析attributes功能
2025-07-09 17:01:53 +08:00
9f548d299b TASK: 默认不like时,不要将元素添加到父元素子集但是要返回parentId 2025-07-09 12:10:10 +08:00
1dc6c6f8c4 TASK:生成获取结果接口返回parentId 2025-07-08 18:53:21 +08:00
5472e59a84 TASK: sketchboard library数据添加年龄组 2025-07-08 16:09:01 +08:00
d379f778dc TASK: 默认不like的元素,如有parentId,需要添加到CollectionSort表中 2025-07-08 14:29:54 +08:00
ec44c2a6b5 TASK: 1、默认不like的元素,如有parentId,需要回传
2、project查询 需要按id查
2025-07-08 13:54:27 +08:00
1f77500d61 TASK:product/relight/pose transfer的入参添加是否需要默认like 2025-07-08 11:39:05 +08:00
060db899cf TASK:product/pose transfer的回参添加sort和id 2025-07-08 10:21:28 +08:00
9fc8f52aca BUGFIX: 1、对话历史记录 有的回答没有深度思考标识 2、批量生成,积分扣除不足 2025-07-07 18:32:14 +08:00
9af1bc867a TASK:to product\relight的结果分like 没like返回 2025-07-07 16:34:22 +08:00
e92bb0c7cd TASK:获取模板内容 不再限制是否like 2025-07-07 14:49:36 +08:00
1d07d7d88a TASK:generate 普通生成改回按生成次数收费 2025-07-07 14:26:21 +08:00
ec7d84b354 BUGFIX:未生成完成的项目获取moduleContent报错 2025-07-07 14:14:45 +08:00
0a2c5e028f BUGFIX:对项目进行各种生成修改时没有更新项目更新时间 2025-07-07 11:53:50 +08:00
4379b9cff1 BUGFIX:design中的排序问题 倒序问题 再次修改 2025-07-04 19:08:59 +08:00
1b7c2041be BUGFIX:design中的排序问题 2025-07-04 17:20:35 +08:00
f3632f53e3 BUGFIX:生成没出结果之前获取结果报空指针 2025-07-04 12:43:14 +08:00
d76a9e6afd 1、design流程中使用to product、relight、pose transfer默认加到like
2、万象的pose transfer结果存到redis
2025-07-04 12:02:05 +08:00
e67acc4319 1、添加日志打印
2、batch获取结果报错
2025-07-03 19:03:45 +08:00
373a360e76 BUGFIX:FLUX童装prompt修改;获取video结果允许传入list 2025-07-03 14:20:33 +08:00
f541bee0e7 Merge branch 'dev/dev_xp' into dev/dev 2025-07-03 11:24:59 +08:00
75d086f680 pose transfer 万象入参添加日志打印 2025-07-03 11:21:10 +08:00
81ca723486 BUGFIX:Batch_Relight默认创建的项目类型是ToProduct 2025-07-03 09:48:21 +08:00
d51bbffb3e TASK:BrandDNA 2025-07-03 09:40:56 +08:00
07aad4afa0 Merge branch 'dev/dev_xp' into dev/dev 2025-07-02 19:04:52 +08:00
6495bb2be3 TASK:语言适配 2025-07-02 19:02:39 +08:00
3d8363c99b BUGFIX:批量生成创建姿势变更项目失败 2025-07-02 17:44:32 +08:00
333c11f81e 增加日志打印 2025-07-02 17:03:40 +08:00
77fc3e967a TASK: 批量生成 prompt微调获取接口,端口变更 2025-07-02 16:29:00 +08:00
a447cde05b TASK: 批量生成获取任务序号 2025-07-02 16:16:15 +08:00
e8ad241653 TASK: 生成项目参数 参数变更 2025-07-02 15:06:52 +08:00
1f824f3ae6 BUGFIX: 获取模块内容-pose transfer返回的图片无法显示 2025-07-02 13:35:15 +08:00
370d9402f2 TASK: 试用邮件通知权限变更 2025-07-02 10:08:54 +08:00
4d518d05b9 TASK: 管理员页面访问权限变动 2025-07-02 09:18:22 +08:00
8c87333fa2 Merge branch 'dev/dev_xp' into dev/dev 2025-06-30 19:34:34 +08:00
4273d0efc0 BUGFIX: 系列设计 修改模特后,原模特丢失问题 2025-06-30 19:32:16 +08:00
a37b64be91 BUGFIX: 使用万象生成失败时直接报错 2025-06-30 15:54:58 +08:00
905d296bdf TASK: 批量生成 存储任务序号 2025-06-30 15:17:07 +08:00
9a25e8ce4a TASK: 批量生成 获取任务序号 2025-06-30 15:11:31 +08:00
68311e1d8b TASK: 通过对话创建项目 请求地址变更 2025-06-30 13:13:58 +08:00
de5da5b299 TASK: 对话 扣除积分 2025-06-30 12:03:23 +08:00
dcd63668bd TASK: 添加注释 2025-06-27 13:09:36 +08:00
shahaibo
1a52399ec9 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-27 09:59:39 +08:00
shahaibo
b01f5f59d1 TASK: 数据迁移拆分; 2025-06-27 09:59:08 +08:00
c70231d5de Merge branch 'dev/dev_xp' into dev/dev 2025-06-26 14:15:35 +08:00
d3deec72eb TASK: 切换chat agent请求api地址 2025-06-26 14:11:42 +08:00
shahaibo
a7347c9dc0 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-26 11:53:53 +08:00
shahaibo
6ad5d373d5 bugfix: single design没结果,posetransfer没回显正在进行的结果; 2025-06-26 11:21:35 +08:00
e048b75ed7 BUGFIX: 去除base64控制台输出 2025-06-25 19:13:57 +08:00
469681b96c BUGFIX: 向flux发起生成请求时,功能指定错误 2025-06-25 19:04:29 +08:00
89457b0593 TASK: 使用Flux生成前,to Product Image,为输入透明图添加白色背景 2025-06-25 18:43:52 +08:00
7a6b257714 BUGFIX:批量生成,获取design的结果中缺失ResultType 2025-06-25 17:20:35 +08:00
443b557623 BUGFIX:1、design 渐变色没存 2、展示文本更新 3、取消拼贴图入参日志打印 2025-06-25 17:10:56 +08:00
shahaibo
84691f45b5 bugfix: parentId结果返回; 2025-06-25 15:52:11 +08:00
de65f78e89 BUGFIX:Batch generation 创建时允许projectId为空 2025-06-25 14:10:24 +08:00
252cd0a69c BUGFIX:design 没有存储渐变色 2025-06-25 11:30:36 +08:00
d77aabca92 TASK:修改relight默认prompt 2025-06-24 19:35:07 +08:00
13514b277b BUGFIX:用户注册后重发验证码,验证不通过 2025-06-24 19:30:20 +08:00
eaf90ab9e8 BUGFIX:注册用户登录没有邮件发送记录和登录记录 2025-06-24 17:53:52 +08:00
f828983969 BUGFIX:对话 控制台输出改为日志输出 2025-06-24 16:41:41 +08:00
be6eb64b35 Merge branch 'dev/dev_xp' into dev/dev 2025-06-24 16:30:28 +08:00
abc6c088fe BUGFIX:批量生成 relight和design创建的任务查不到 2025-06-24 16:27:15 +08:00
6f44489c6e BUGFIX:消息监听,消息解析失败,重复消费异常消息导致日志文件内容骤增 2025-06-24 16:11:53 +08:00
a809905c52 BUGFIX:batch generation like报错 2025-06-24 15:03:17 +08:00
7abab7121a BUGFIX:batch generate积分扣除报错 2025-06-24 14:22:41 +08:00
8e31968fd3 BUGFIX:1、积分消耗值不准确 2、flux获取结果报错 2025-06-23 18:16:23 +08:00
3d08e86049 BUGFIX:图片分割参数值变更 2025-06-23 13:44:56 +08:00
e0fdf1cc88 Merge branch 'dev/dev_xp' into dev/dev 2025-06-23 13:09:13 +08:00
4acdd8adb9 BUGFIX:1、积分扣除,金额不对 2、图片分割允许指定上传图片id 2025-06-23 12:02:16 +08:00
d6c5d0e95d TASK:查询交易记录 添加显示总金额和付款者邮箱 2025-06-23 10:53:30 +08:00
shahaibo
e8e6f8bc17 bugfix: posetransfer结果; 2025-06-20 17:28:34 +08:00
shahaibo
27983fe8ee bugfix: collectionSortParentId非必穿; 2025-06-20 17:01:47 +08:00
shahaibo
c3d92aacd5 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-20 16:29:06 +08:00
shahaibo
b287ec8529 bugfix: 对话中断排查日志添加; 2025-06-20 16:27:27 +08:00
07d3f6e224 Merge branch 'dev/dev_xp' into dev/dev 2025-06-20 16:23:38 +08:00
fc42f361fa BUGFIX:含小数的积分扣除失败 2025-06-20 16:14:56 +08:00
shahaibo
424f9a126d TASK: 结果返回parentId; 2025-06-20 15:20:35 +08:00
a042f05401 Merge branch 'dev/dev_xp' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/model/vo/MagicToolResultVO.java
2025-06-20 14:57:39 +08:00
f59adbe9bd TASK:更新各生成功能需要消耗的积分 2025-06-20 14:53:10 +08:00
a0ece486d8 TASK:更新各生成功能需要消耗的积分 2025-06-20 14:49:15 +08:00
shahaibo
4caa0a9b0d Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-20 13:51:21 +08:00
shahaibo
df5bbc3675 TASK: 结果返回parentId; 2025-06-20 13:50:29 +08:00
92278cf91b BUGFIX:获取all pose的预览地址报错 2025-06-20 12:01:17 +08:00
6b165fe5bc Merge branch 'dev/dev_xp' into dev/dev 2025-06-19 18:26:16 +08:00
64b32dc3a3 BUGFIX:sketch搜索出的图片去白边失败 2025-06-19 18:24:07 +08:00
301a62a563 TASK:添加管理员访问人员 2025-06-19 17:39:18 +08:00
1f84b4b3e6 BUGFIX: 2025-06-19 17:22:43 +08:00
a0979caba6 Merge branch 'dev/dev_xp' into dev/dev 2025-06-19 17:20:04 +08:00
18be52e806 BUGFIX: 1、llm使用sketch查询工具数据没有保存到历史记录中
2、flux运行失败状态下,获取结果报错
3、618福利邮件通知
2025-06-19 17:16:48 +08:00
shahaibo
627dad7aac Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-19 15:57:40 +08:00
shahaibo
7166db59bd Bugfix: 对话历史记录; 2025-06-19 15:44:26 +08:00
13759d806b Merge branch 'dev/dev_xp' into dev/dev 2025-06-19 14:58:56 +08:00
0fd1ddcde1 TASK: 1、LLM对话新增两个工具,查找sketch和修改项目参数 2、新增接口获取最新的minio图片预览地址 2025-06-19 14:56:18 +08:00
shahaibo
a5e743ce84 TASK: 数据迁移; 2025-06-19 14:29:44 +08:00
161bba896c BUGFIX: 获取当前任务结果报错(获取模型名出现空指针) 2025-06-19 14:08:25 +08:00
shahaibo
da8338be3f Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-19 11:52:03 +08:00
shahaibo
ea235b0d5c bugfix: delete collection; 2025-06-19 11:50:39 +08:00
98ea6004b4 TASK: 新增pose transfer模特姿势选项 2025-06-18 14:19:45 +08:00
62cbc612a7 Merge branch 'dev/dev_xp' into dev/dev 2025-06-17 16:56:45 +08:00
589fa8501e TASK: 优化童装prompt 2025-06-17 16:54:23 +08:00
shahaibo
d6285781f2 bugfix: delete collection; 2025-06-17 16:29:06 +08:00
shahaibo
137ef7045b TASK: cloud、posetransfer; 2025-06-17 16:25:57 +08:00
shahaibo
5e066995e8 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-17 14:53:52 +08:00
shahaibo
c1c50cb28b TASK: cloud、posetransfer; 2025-06-17 14:51:19 +08:00
3f13f64ab9 Merge branch 'dev/dev_xp' into dev/dev 2025-06-17 14:43:10 +08:00
5abe45ff34 TASK: 当选择童装时,sketch生成和to product的prompt需添加儿童限定词 2025-06-17 14:41:27 +08:00
shahaibo
0970127f68 TASK: collection sort; 2025-06-17 10:10:00 +08:00
shahaibo
93bb8d2f31 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-17 09:42:15 +08:00
shahaibo
88d8b75298 TASK: collection sort; 2025-06-17 09:41:19 +08:00
ea395e87ba Merge branch 'dev/dev_xp' into dev/dev 2025-06-16 18:52:41 +08:00
8d7b4adf48 BUGFIX: 1、sketch extract 没返回taskId
2、relight输入文本太长导致数据存储报错
2025-06-16 18:51:09 +08:00
e3ee724e6f BUGFIX:pose transfer 视频转GIF依赖操作系统环境切换 2025-06-16 18:25:32 +08:00
shahaibo
9d022ae13e Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-16 16:55:37 +08:00
shahaibo
8b0f9cfd11 TASK: cloud、posetransfer、sort; 2025-06-16 16:53:50 +08:00
f36b3818c5 Merge branch 'dev/dev_xp' into dev/dev 2025-06-16 16:17:56 +08:00
2ccbbf8893 BUGFIX:pose transfer 视频转GIF依赖缺失 2025-06-16 16:16:08 +08:00
76219aa4fe BUGFIX:pose transfer 记录重复存储问题 2025-06-16 15:32:32 +08:00
5ed3d8dfab Merge branch 'dev/dev_xp' into dev/dev 2025-06-16 15:08:50 +08:00
4dd3ddb1d0 BUGFIX:无法获取wx pose transfer的结果 2025-06-16 15:07:22 +08:00
fb16840a98 Merge branch 'dev/dev_xp' into dev/dev 2025-06-16 14:06:34 +08:00
9ad6acf28c BUGFIX:1、修改新增生成接口失败的状态 2、添加aliyun请求接口的密钥 2025-06-16 13:49:30 +08:00
shahaibo
774a20257d Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-16 13:45:25 +08:00
shahaibo
3db0a94981 TASK: cloud、posetransfer; 2025-06-16 13:44:22 +08:00
891b26d493 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-16 11:04:34 +08:00
86a991db81 BUGFIX:获取当前生成来自哪个模型 2025-06-16 11:03:40 +08:00
shahaibo
fd8e6fd2e8 BUGFIX: 切换性别 年龄段; 2025-06-13 17:03:07 +08:00
78239d3ead Merge branch 'dev/dev_xp' into dev/dev 2025-06-13 16:41:15 +08:00
174d1bf0d0 TASK:1、将imageToSketch接口调用转为异步 2、imageToSketch加入flux 2025-06-13 16:37:45 +08:00
da9f54982c Merge branch 'dev/dev_xp' into dev/dev 2025-06-13 15:58:37 +08:00
b6993b04c2 TASK:视频图像处理依赖包精简 2025-06-13 15:55:17 +08:00
shahaibo
4cca30ec75 BUGFIX: cloud; 2025-06-13 15:09:32 +08:00
shahaibo
b6c43e534b BUGFIX: 上传元素删除; 2025-06-13 14:07:38 +08:00
shahaibo
942b5eb19b BUGFIX: cloud; 2025-06-13 11:48:08 +08:00
22e5a97143 BUGFIX: 优惠券的佣金计算,统计时间边界问题优化 2025-06-13 11:18:55 +08:00
shahaibo
31b2bd97b4 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-13 10:56:44 +08:00
shahaibo
3eaa0d017c BUGFIX: cloud; 2025-06-13 10:55:55 +08:00
be42550d0a Merge branch 'dev/dev_xp' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/model/dto/ToProductImageDTO.java
2025-06-12 16:54:15 +08:00
6e32289b98 TASK:Flux接入,应用于to product image和relight 2025-06-12 16:50:27 +08:00
shahaibo
a750a91f7b BUGFIX: 创建项目; 2025-06-12 15:59:15 +08:00
shahaibo
2cf3b75e46 BUGFIX: 创建项目; 2025-06-12 15:47:46 +08:00
shahaibo
9586be40ce TASK:3d print; 2025-06-12 13:50:04 +08:00
shahaibo
4494ec7dbc TASK:cloud; 2025-06-12 13:41:13 +08:00
shahaibo
33af9d0b9d TASK:cloud; 2025-06-12 13:31:34 +08:00
shahaibo
7f30b2d05b Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-12 13:13:31 +08:00
shahaibo
3cd86042ff TASK:上传回显; 2025-06-12 13:12:44 +08:00
af1fab644a pose transform 打开输入图片的检测 2025-06-11 17:45:17 +08:00
ace53e81f2 pose transform 开放自定义输入图片 2025-06-11 17:35:00 +08:00
shahaibo
f179368668 BUGFIX:library ageGroup切换; 2025-06-11 15:58:06 +08:00
765d404845 TASK: 将generate,用户输入中的中文字符转换为英文字符 2025-06-11 15:34:00 +08:00
shahaibo
9134933a07 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-11 11:39:01 +08:00
shahaibo
290f6a9a35 BUGFIX:library ageGroup切换; 2025-06-11 11:37:29 +08:00
ac2d1e611b BUGFIX: prompt提取接口传参格式修改 2025-06-10 18:13:53 +08:00
1b75e2ab55 TASK: prompt提取接口地址切换 2025-06-10 18:08:16 +08:00
de9750b24a Merge branch 'dev/dev_xp' into dev/dev 2025-06-10 17:53:03 +08:00
595effa04c TASK: 接入第三方api freepik 新增sketch extract variation 2025-06-10 17:50:04 +08:00
shahaibo
09e24ab062 TASK:cloud; 2025-06-10 15:05:41 +08:00
shahaibo
391208f8bd TASK:cloud; 2025-06-10 15:02:44 +08:00
shahaibo
3cf47eb723 TASK:cloud; 2025-06-10 11:13:17 +08:00
shahaibo
c3ce25315c TASK:cloud; 2025-06-10 11:03:15 +08:00
shahaibo
ae71564b94 TASK:cloud; 2025-06-10 10:55:56 +08:00
shahaibo
d6bd24865e TASK:cloud; 2025-06-09 13:41:02 +08:00
shahaibo
c420300c11 TASK:cloud; 2025-06-09 11:30:23 +08:00
shahaibo
4c67fce8d1 TASK:cloud; 2025-06-09 10:15:40 +08:00
d5cf4e9d3f TASK: 添加“新增试用用户”通知对象chelseayu@code-create.com.hk 2025-06-08 09:19:36 +08:00
4b7fd649a3 TASK: 推广码 添加开始生效时间;优化数据计算类型,使用BigDecimal替换float;更新paidCommission后自动计算unpaidCommission 2025-06-06 19:37:38 +08:00
shahaibo
b8d3b0192d TASK:cloud; 2025-06-06 17:18:59 +08:00
shahaibo
1afd86d3ce Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-06 15:25:26 +08:00
shahaibo
daa133b993 TASK:cloud; 2025-06-06 15:22:07 +08:00
shahaibo
bf258ee4f9 TASK:cloud; 2025-06-06 15:19:00 +08:00
2bc17ec4d0 Merge branch 'dev/dev_xp' into dev/dev 2025-06-06 13:54:00 +08:00
090b9ab6ab TASK: 取消animate假数据,直接调用第三方接口 2025-06-06 13:53:43 +08:00
shahaibo
fb5b52bec2 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-06 11:58:01 +08:00
shahaibo
df678a12b9 TASK:cloud; 2025-06-06 11:57:10 +08:00
21f85a7322 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-06 11:51:34 +08:00
4e2590fd0f Merge branch 'dev/dev_xp' into dev/dev 2025-06-06 11:51:06 +08:00
31c5fef5c0 BUGFIX: 获取万象生成结果时,需指定api_key 2025-06-06 11:50:41 +08:00
shahaibo
94e26ac912 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-06-06 11:10:58 +08:00
shahaibo
711859ce89 TASK:cloud; 2025-06-06 11:08:53 +08:00
8502fffb68 Merge branch 'dev/dev_xp' into dev/dev 2025-06-06 11:03:45 +08:00
6f0cc3aaf8 TASK: 更换第三方access key获取方式,从系统变量中获取改为从配置文件中获取 2025-06-06 10:59:13 +08:00
shahaibo
ce13874431 TASK:cloud; 2025-06-06 10:51:25 +08:00
shahaibo
054c9fd604 TASK:cloud; 2025-06-06 10:46:57 +08:00
f5501db19e TASK: 接入第三方api 添加access key 2025-06-06 09:56:02 +08:00
4609af875e Merge branch 'dev/dev_xp' into dev/dev 2025-06-05 18:36:22 +08:00
1dad0a008a TASK: 接入第三方api 通过万象实现text2image和animate,完成数据传输与原接口的兼容 2025-06-05 18:03:19 +08:00
shahaibo
b757cdc5dd TASK:batch toProductImage;chatStream; 2025-06-05 17:09:03 +08:00
shahaibo
249351bf52 TASK:batch toProductImage;chatStream; 2025-06-05 17:06:11 +08:00
shahaibo
38ca810068 TASK:batch toProductImage;chatStream; 2025-06-05 15:44:23 +08:00
shahaibo
bab5c9a8e6 TASK:batch toProductImage;chatStream; 2025-06-05 15:33:08 +08:00
shahaibo
4e80493a26 TASK:batch toProductImage;chatStream; 2025-06-05 14:00:38 +08:00
shahaibo
12dbe90150 TASK:batch toProductImage;chatStream; 2025-06-05 13:35:13 +08:00
6249d53b7b BUGFIX: modifySketch 除library以外的地方修改,originalIdSource允许不传 2025-06-04 22:04:09 +08:00
b445f1f11e BUGFIX: modifySketch 在library中修改后需要保存到library 2025-06-04 15:49:55 +08:00
shahaibo
f2c268683c TASK:collection sort; 2025-06-03 15:05:40 +08:00
shahaibo
f69eaa4fe3 TASK:collection sort; 2025-06-03 14:39:56 +08:00
shahaibo
a9172dcd36 TASK:collection sort; 2025-06-03 14:31:51 +08:00
shahaibo
442e87267a TASK:collection sort; 2025-06-03 13:41:45 +08:00
shahaibo
32c8aaec9b TASK:collection sort; 2025-06-03 11:26:21 +08:00
shahaibo
112294bd7b TASK:collection sort; 2025-06-03 11:23:13 +08:00
shahaibo
3bfbd8abc1 TASK:collection sort; 2025-06-03 10:42:11 +08:00
shahaibo
78341850e1 TASK:collection sort; 2025-06-02 16:31:17 +08:00
shahaibo
becdbf1891 TASK:collection sort; 2025-06-02 16:19:41 +08:00
shahaibo
f0b1d3f9ce TASK:collection sort; 2025-05-30 15:02:39 +08:00
shahaibo
73bab2338e TASK:collection sort; 2025-05-30 14:04:18 +08:00
shahaibo
448e6d2c40 TASK:mannequin; 2025-05-30 13:08:19 +08:00
shahaibo
131d782b54 TASK:test; 2025-05-30 11:49:10 +08:00
shahaibo
d6cc8ab9a2 TASK:test; 2025-05-30 11:42:27 +08:00
shahaibo
d9e25fd0e4 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-05-29 16:17:49 +08:00
shahaibo
276994759e TASK:mannequin; 2025-05-29 16:17:39 +08:00
a569ee7736 Merge remote-tracking branch 'origin/dev/dev' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/mapper/primary/entity/DesignItem.java
2025-05-28 16:57:49 +08:00
d7762cbfed Merge branch 'dev/dev_xp' into dev/dev 2025-05-28 16:57:15 +08:00
8356326c7d TASK: DesignDetail中允许修改模特 2025-05-28 16:56:32 +08:00
shahaibo
8003a799c2 TASK:mannequin; 2025-05-28 16:42:54 +08:00
shahaibo
6de1ad150c TASK:mannequin; 2025-05-28 15:28:55 +08:00
shahaibo
b6a7354322 TASK:mannequin; 2025-05-28 13:59:52 +08:00
shahaibo
6e96f38c90 TASK:mannequin; 2025-05-28 13:59:00 +08:00
shahaibo
fc24e1fab8 TASK:mannequin; 2025-05-28 13:47:45 +08:00
shahaibo
718e1c93f6 TASK:mannequin; 2025-05-28 11:12:26 +08:00
shahaibo
74540610c6 TASK:mannequin; 2025-05-28 10:34:54 +08:00
shahaibo
1be4701f6d TASK:mannequin; 2025-05-28 09:37:27 +08:00
5c66ece467 1.关闭续订前七天邮件提醒
2.优化订阅邮件提醒,向redis存储已发送的邮件类型
2025-05-23 17:16:19 +08:00
shahaibo
d3b4d15df8 TASK:mannequin; 2025-05-23 16:33:43 +08:00
shahaibo
8fc79f6699 TASK:mannequin; 2025-05-23 15:13:46 +08:00
3b6b0c7e2c TASK: prom code 开启佣金计费定时器和商家邮件通知 2025-05-22 16:37:41 +08:00
shahaibo
91ee58db1b TASK:LLM; 2025-05-22 13:43:50 +08:00
shahaibo
af1c839495 TASK:LLM; 2025-05-22 13:24:28 +08:00
shahaibo
083416951a TASK:LLM; 2025-05-22 12:34:01 +08:00
shahaibo
cd20bdd88f TASK:LLM; 2025-05-22 12:27:00 +08:00
shahaibo
5a0fb6fd3f TASK:LLM; 2025-05-22 10:11:21 +08:00
shahaibo
93fe0781b2 TASK:LLM; 2025-05-21 21:04:28 +08:00
shahaibo
94e00459b6 TASK:LLM; 2025-05-21 21:03:15 +08:00
shahaibo
9614985690 TASK:LLM; 2025-05-20 16:59:07 +08:00
shahaibo
8c597db8a9 TASK:LLM; 2025-05-20 16:54:20 +08:00
9a81fb7ee4 TASK:将PromotionCode合并到生产-test 2025-05-20 16:53:48 +08:00
shahaibo
a0bd4cfa38 TASK:LLM; 2025-05-20 16:47:43 +08:00
shahaibo
82388b0c19 TASK:LLM; 2025-05-20 16:12:08 +08:00
shahaibo
588202311c TASK:LLM; 2025-05-20 16:02:38 +08:00
shahaibo
46820505ae TASK:LLM; 2025-05-20 14:37:34 +08:00
shahaibo
b030e9c09b TASK:LLM; 2025-05-20 14:31:05 +08:00
shahaibo
f1adbb4da7 TASK:LLM; 2025-05-20 14:24:16 +08:00
shahaibo
4dfee09abb TASK:LLM; 2025-05-20 13:56:42 +08:00
shahaibo
16e4f7c5b5 TASK:LLM; 2025-05-20 13:37:46 +08:00
shahaibo
e9e40e53bc TASK:LLM; 2025-05-20 13:16:57 +08:00
31bb29f2fd Affiliate 允许为不同的用户设置不同的affiliate
Stripe 添加优惠券删除接口;限制优惠券只能在订阅时使用

(cherry picked from commit 200c0adfba)
2025-05-20 11:30:42 +08:00
shahaibo
a2625fa73f TASK:LLM; 2025-05-20 11:24:02 +08:00
shahaibo
ab804d57c1 TASK:LLM; 2025-05-20 10:42:18 +08:00
shahaibo
cef2fca099 TASK:LLM; 2025-05-20 10:39:00 +08:00
shahaibo
3d783974fc Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-05-20 10:29:30 +08:00
shahaibo
7f5a1615b3 TASK:LLM; 2025-05-20 10:29:22 +08:00
c7b46229b5 删除优惠券
(cherry picked from commit 58af5c5570)
2025-05-19 17:29:06 +08:00
1482bb6ab2 Stripe推广码 部分功能完善
(cherry picked from commit 218d828e0d)
2025-05-19 17:28:52 +08:00
eae4087b3e Stripe支付--添加推广码功能及相应佣金计算
(cherry picked from commit 0ba28588da)
2025-05-19 17:13:28 +08:00
faf98607c4 优惠券查询DTO
(cherry picked from commit 1ce6c74f2c)
2025-05-19 17:04:51 +08:00
6c625de936 Merge branch 'dev/dev_xp' into dev/dev 2025-05-19 14:04:40 +08:00
aeb372bc17 TASK:企业、教育版library元素共享、作品广场作品发布到公共gallery 2025-05-19 14:02:42 +08:00
shahaibo
738144ad22 TASK:LLM; 2025-05-19 10:47:02 +08:00
shahaibo
a67b487dc0 TASK:LLM; 2025-05-19 10:23:53 +08:00
shahaibo
8613d4fc7a TASK:LLM; 2025-05-19 10:15:16 +08:00
shahaibo
6aa1a3d167 TASK:LLM; 2025-05-19 10:00:19 +08:00
shahaibo
59ffa38ff7 TASK:LLM; 2025-05-18 12:46:12 +08:00
c19e9094d1 BUGFIX: generate mode字段传递不准确导致生成结果与图片没有关联 2025-05-09 17:03:42 +08:00
bf92edb267 BUGFIX: 消息被双重转义时无法被正常解析,导致消息一直被重复消费 2025-05-09 07:51:37 +08:00
db55c5597f undividedLayers数据保存失败原因查找 2025-05-09 00:18:00 +08:00
0c79739867 BUGFIX: design之后,未分割图片的保存问题 2025-05-08 15:26:06 +08:00
e484f22788 BUGFIX : design 未分割图层保存问题 2025-05-08 14:54:12 +08:00
c72f382804 designSingle 取消颜色限制 2025-05-08 14:23:40 +08:00
6a694cee18 Merge remote-tracking branch 'origin/release/3.0' into release/3.0 2025-05-08 14:19:41 +08:00
1a077edf0c designSingle 取消颜色限制 2025-05-08 14:19:26 +08:00
shahaibo
68926757dc Merge remote-tracking branch 'origin/release/3.0' into release/3.0 2025-05-07 22:04:21 +08:00
shahaibo
eea57435e5 TASK:minio地址修改; 2025-05-07 22:04:10 +08:00
1f0e8f9cf2 BUGFIX: designSingle时,添加相同类型的服装导致未分割图层获取混乱 2025-05-07 14:10:42 +08:00
shahaibo
6d6768e6cb TASK:模块化; 2025-05-06 17:30:01 +08:00
shahaibo
a84fe12a28 TASK:模块化; 2025-05-02 14:33:53 +08:00
shahaibo
be019dcdd0 TASK:模块化; 2025-05-02 14:26:21 +08:00
shahaibo
82d65c3015 TASK:模块化; 2025-04-29 17:21:16 +08:00
shahaibo
815392fffa TASK:模块化; 2025-04-29 16:16:36 +08:00
shahaibo
35e95c835e Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-29 15:09:09 +08:00
shahaibo
1263409d7c TASK:模块化; 2025-04-29 15:08:59 +08:00
e5b184ea6d Merge branch 'dev/dev_xp' into dev/dev 2025-04-28 15:26:35 +08:00
aa0778958e BUGFIX: 用户被删除的情况下,获取该云过户原来的评论,点赞等记录 2025-04-28 15:26:07 +08:00
50b78e9898 Merge branch 'dev/dev_xp' into dev/dev 2025-04-28 14:56:48 +08:00
58af5c5570 删除优惠券 2025-04-28 14:56:13 +08:00
63cde1f6a0 Merge branch 'dev/dev_xp' into dev/dev 2025-04-28 14:53:04 +08:00
89e6ee9eff 用户账号不存在的情况下获取评论报错 2025-04-28 14:51:19 +08:00
200c0adfba Affiliate 允许为不同的用户设置不同的affiliate
Stripe 添加优惠券删除接口;限制优惠券只能在订阅时使用
2025-04-28 14:40:42 +08:00
shahaibo
306f4f3987 TASK:模块化; 2025-04-25 15:34:35 +08:00
shahaibo
1240a57405 TASK:模块化; 2025-04-25 11:01:06 +08:00
shahaibo
a9acc83bdf TASK:模块化; 2025-04-25 10:19:12 +08:00
a2d259aea1 从Stripe退款后,修改订单状态,添加退款记录 2025-04-25 10:06:07 +08:00
shahaibo
7ff8a9db22 TASK:模块化; 2025-04-23 15:36:56 +08:00
shahaibo
7b6904059f TASK:模块化; 2025-04-23 15:35:21 +08:00
shahaibo
eec9c6ebf2 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-23 14:52:39 +08:00
shahaibo
1e8884a7c3 TASK:模块化; 2025-04-23 14:52:32 +08:00
9d591bb070 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-23 14:23:46 +08:00
db4bad22f4 Merge branch 'dev/dev_xp' into dev/dev 2025-04-23 14:23:30 +08:00
58bd986090 图片分割,区分类型 2025-04-23 14:22:21 +08:00
shahaibo
9e5bafc75e TASK:模块化; 2025-04-23 14:05:14 +08:00
shahaibo
938ad7366f TASK:模块化; 2025-04-23 11:22:52 +08:00
shahaibo
56ec903807 TASK:模块化; 2025-04-23 10:56:32 +08:00
shahaibo
5913445257 TASK:模块化; 2025-04-23 10:25:02 +08:00
shahaibo
2d1d458929 TASK:模块化; 2025-04-23 10:14:15 +08:00
shahaibo
5a0c461961 TASK:模块化; 2025-04-22 16:24:05 +08:00
shahaibo
74ad20646d TASK:模块化; 2025-04-22 16:11:00 +08:00
shahaibo
604c57c208 TASK:模块化; 2025-04-22 15:59:08 +08:00
shahaibo
aca21b9d98 TASK:模块化; 2025-04-22 15:26:55 +08:00
shahaibo
b83a416dda TASK:模块化; 2025-04-22 14:20:57 +08:00
shahaibo
d1858ddf83 TASK:模块化; 2025-04-22 14:18:54 +08:00
shahaibo
aa1c48fcfe TASK:模块化; 2025-04-22 13:48:36 +08:00
shahaibo
b19bbf91f2 TASK:模块化; 2025-04-22 11:24:28 +08:00
shahaibo
d9e4fb3022 TASK:模块化; 2025-04-22 09:58:14 +08:00
shahaibo
cc8f2e0778 TASK:模块化; 2025-04-21 23:44:55 +08:00
shahaibo
9b1881349f TASK:模块化; 2025-04-21 23:40:30 +08:00
shahaibo
eacceb4b76 TASK:模块化; 2025-04-21 22:36:03 +08:00
shahaibo
c50c193a46 TASK:模块化; 2025-04-21 22:35:32 +08:00
shahaibo
dfe99ef080 TASK:模块化; 2025-04-21 22:13:53 +08:00
shahaibo
98e1f37c1d TASK:模块化; 2025-04-21 21:50:03 +08:00
shahaibo
05295b1a0d TASK:模块化; 2025-04-21 21:21:23 +08:00
shahaibo
6fb04a66df TASK:模块化; 2025-04-21 21:18:29 +08:00
shahaibo
ba14b67c24 TASK:模块化; 2025-04-21 19:40:41 +08:00
shahaibo
0a4d6ff13b TASK:模块化; 2025-04-21 18:51:43 +08:00
shahaibo
fc2795b83e TASK:模块化; 2025-04-17 16:30:06 +08:00
shahaibo
4c726ff747 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-17 16:08:17 +08:00
shahaibo
4ed93c7e48 TASK:模块化; 2025-04-17 16:08:10 +08:00
shahaibo
acb37bc255 TASK:模块化; 2025-04-17 16:07:50 +08:00
shahaibo
9b5040d449 TASK:模块化; 2025-04-16 16:35:51 +08:00
shahaibo
fe0d1f39b0 TASK:模块化; 2025-04-16 16:28:27 +08:00
79d2720733 Merge branch 'dev/dev_xp' into dev/dev 2025-04-15 15:58:51 +08:00
218d828e0d Stripe推广码 部分功能完善 2025-04-15 15:58:22 +08:00
2269662290 Stripe支付测试--切换支付方式配置 2025-04-15 11:20:03 +08:00
eaec1e4177 Stripe支付测试--切换支付环境 2025-04-15 10:38:10 +08:00
eaff87882e Merge branch 'dev/dev_xp' into dev/dev 2025-04-15 10:23:30 +08:00
0ba28588da Stripe支付--添加推广码功能及相应佣金计算 2025-04-15 10:22:45 +08:00
25f64831f3 Merge branch 'dev/dev_xp' into dev/dev 2025-04-14 15:20:32 +08:00
d6c869727a 应要求修改参数名 2025-04-14 15:18:54 +08:00
77a06e0edd bugfix:account mapper count 去重问题 2025-04-14 14:58:23 +08:00
21efcf3ea6 查询所有的生成功能名字 2025-04-14 14:14:45 +08:00
d77e1d74b0 Merge branch 'dev/dev_xp' into dev/dev 2025-04-14 13:37:25 +08:00
1ce6c74f2c 优惠券查询DTO 2025-04-14 13:37:01 +08:00
3c4b645772 Merge branch 'dev/dev_xp' into dev/dev 2025-04-14 13:34:56 +08:00
909978467c 查询积分DTO 2025-04-14 13:34:35 +08:00
912c449161 Merge branch 'dev/dev_xp' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/service/CollectionElementService.java
#	src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java
2025-04-14 13:30:02 +08:00
7f05bb2f7d 新增接口:图片分割 2025-04-14 13:26:56 +08:00
cbc760ebaf 便利查询--各版本管理员查看用户的design频次和各生成功能使用频次以及积分使用情况 2025-04-13 17:20:14 +08:00
shahaibo
48bb0cbff5 TASK:模块化; 2025-04-11 17:42:36 +08:00
shahaibo
1403b7851a TASK:模块化; 2025-04-11 15:11:44 +08:00
shahaibo
c36081996d TASK:模块化; 2025-04-11 14:33:25 +08:00
shahaibo
14dbc35eda TASK:模块化; 2025-04-11 14:16:54 +08:00
shahaibo
64c03768ff TASK:模块化; 2025-04-11 14:07:37 +08:00
shahaibo
b806bef0bf TASK:模块化; 2025-04-11 11:03:48 +08:00
shahaibo
811d22e229 TASK:模块化; 2025-04-11 10:49:22 +08:00
shahaibo
1ee612674e TASK:模块化; 2025-04-11 10:10:38 +08:00
shahaibo
cf9b621159 TASK:模块化; 2025-04-10 14:17:28 +08:00
shahaibo
03ae184541 TASK:模块化; 2025-04-10 14:00:33 +08:00
shahaibo
6b62d26544 TASK:模块化; 2025-04-10 11:01:24 +08:00
shahaibo
3883864558 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-09 10:30:56 +08:00
shahaibo
1089f37022 TASK:模块化; 2025-04-09 10:30:25 +08:00
c661767de3 Merge branch 'dev/dev_xp' into dev/dev 2025-04-09 09:48:51 +08:00
7b75e6ac69 获取所有姿势变换的pose 2025-04-09 09:48:00 +08:00
bd1f1deb53 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-08 18:07:00 +08:00
e142d50d18 Merge branch 'dev/dev_xp' into dev/dev 2025-04-08 18:06:40 +08:00
6250e763c3 获取所有姿势变换的pose 2025-04-08 18:05:49 +08:00
shahaibo
4cda43f3b5 TASK:模块化; 2025-04-08 17:29:10 +08:00
shahaibo
fd8d71e2a2 TASK:模块化; 2025-04-08 15:15:39 +08:00
shahaibo
87b702c24b TASK:模块化; 2025-04-08 11:09:28 +08:00
shahaibo
27cd98f0db TASK:模块化; 2025-04-07 17:12:33 +08:00
shahaibo
d1603fbc16 TASK:模块化; 2025-04-07 16:07:26 +08:00
shahaibo
96ba29a9a2 TASK:模块化; 2025-04-03 15:31:39 +08:00
shahaibo
5d9ca09272 TASK:模块化; 2025-04-03 14:27:03 +08:00
shahaibo
64676736b5 TASK:模块化; 2025-04-03 14:22:21 +08:00
shahaibo
7106482831 TASK:模块化; 2025-04-03 14:14:28 +08:00
shahaibo
b1c8606432 TASK:模块化; 2025-04-03 13:49:36 +08:00
shahaibo
0eb02c598e Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-02 17:14:32 +08:00
shahaibo
b6367d72ba TASK:模块化; 2025-04-02 17:13:58 +08:00
2e76bded8c Merge branch 'dev/dev_xp' into dev/dev 2025-04-02 15:57:18 +08:00
0e7c07b3b5 上传模特时保存点位信息接口修改 2025-04-02 15:56:05 +08:00
shahaibo
3e3b1eb868 TASK:模块化; 2025-04-02 15:32:48 +08:00
shahaibo
ec0309d6f2 TASK:模块化; 2025-04-02 15:27:16 +08:00
shahaibo
8ee7a030bd Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-02 15:18:27 +08:00
shahaibo
ca9778a416 TASK:模块化; 2025-04-02 15:18:20 +08:00
07504d8412 Merge branch 'dev/dev_xp' into dev/dev 2025-04-02 13:34:11 +08:00
88796f7f28 修改添加系统模特到个人lib接口和保存模特接口 2025-04-02 13:32:12 +08:00
shahaibo
8764e750ff Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-02 13:14:16 +08:00
shahaibo
9d2cb29255 TASK:模块化; 2025-04-02 13:09:48 +08:00
a1b8f9e000 修改添加系统模特到个人lib接口 2025-04-02 12:03:48 +08:00
6f2c670fce Merge branch 'dev/dev_xp' into dev/dev 2025-04-02 11:09:41 +08:00
d21cb4adfc 修改模特保存接口和添加系统模特到个人lib接口 2025-04-02 11:08:35 +08:00
shahaibo
97b922c1be TASK:模块化; 2025-04-01 17:52:55 +08:00
shahaibo
0af5b2121c TASK:模块化; 2025-04-01 17:44:16 +08:00
36be8b5420 修改模特比例接口不再与模特点位信息关联 2025-04-01 17:22:45 +08:00
a34d775f63 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-04-01 17:16:49 +08:00
1bee672592 Merge branch 'dev/dev_xp' into dev/dev 2025-04-01 17:16:27 +08:00
shahaibo
cf08f9126e TASK:模块化; 2025-04-01 17:16:27 +08:00
8e938e9f06 更新模特点位接口修改 2025-04-01 17:15:38 +08:00
shahaibo
a08744f71a TASK:模块化; 2025-04-01 15:42:15 +08:00
shahaibo
913c4c1ece TASK:模块化; 2025-04-01 15:20:59 +08:00
shahaibo
63ee41e3b8 Merge remote-tracking branch 'origin/release/3.0' into release/3.0 2025-03-31 17:47:33 +08:00
shahaibo
08072001a7 BUGFIX:dislike合并逻辑去除; 2025-03-31 17:47:25 +08:00
6b4d82a67d AiDA 8折优惠活动恢复 2025-03-31 17:45:16 +08:00
shahaibo
03f3162dc1 TASK:模块化; 2025-03-31 15:40:36 +08:00
shahaibo
0eb839e7c7 TASK:模块化; 2025-03-31 15:37:05 +08:00
shahaibo
807d3e1c46 TASK:模块化; 2025-03-31 15:27:17 +08:00
shahaibo
e6f990b766 TASK:模块化; 2025-03-31 15:02:44 +08:00
shahaibo
6dcc492127 TASK:模块化; 2025-03-31 11:53:43 +08:00
shahaibo
a2bd2fa6c6 TASK:模块化; 2025-03-31 11:21:45 +08:00
5612b5b1d4 AiDA 8折优惠活动 2025-03-31 09:48:09 +08:00
shahaibo
2edf7d211b TASK:模块化; 2025-03-30 23:31:00 +08:00
shahaibo
890265611a TASK:模块化; 2025-03-30 16:14:13 +08:00
shahaibo
48c7182f98 TASK:模块化; 2025-03-30 15:56:03 +08:00
shahaibo
2cfd342ef8 TASK:模块化; 2025-03-28 11:14:48 +08:00
shahaibo
63513df053 TASK:模块化; 2025-03-28 11:05:45 +08:00
shahaibo
bb00d9a714 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-03-28 09:37:51 +08:00
shahaibo
3398992bcd TASK:模块化; 2025-03-28 09:37:42 +08:00
2912463562 Merge branch 'dev/dev_xp' into dev/dev 2025-03-27 17:46:47 +08:00
3df4433381 BUGFIX: sketch拼贴 2025-03-27 17:46:09 +08:00
1d46a3b6d4 修改本地缓存的过期时间 2025-03-27 15:38:25 +08:00
shahaibo
a8f868e215 TASK:模块化; 2025-03-27 14:32:56 +08:00
shahaibo
78a5bebb4f TASK:模块化; 2025-03-27 13:55:16 +08:00
shahaibo
33582922be TASK:模块化; 2025-03-27 13:38:47 +08:00
shahaibo
e6234213f0 TASK:模块化; 2025-03-27 13:33:09 +08:00
shahaibo
1d9a89d7c7 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-03-26 15:13:06 +08:00
shahaibo
b0560b840f TASK:模块化; 2025-03-26 15:12:55 +08:00
20b15c0b78 sketch拼贴 添加返回服装分类 2025-03-26 13:39:39 +08:00
a4365abd4d 模特比例修改参数变换 2025-03-25 17:37:35 +08:00
1cb02a62e8 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-03-25 16:20:14 +08:00
67225c1a96 从统一接口获取pose transformation的生成记录 2025-03-25 16:20:00 +08:00
50ecc3a177 Merge branch 'dev/dev_xp' into dev/dev 2025-03-25 16:11:33 +08:00
63c9ff36a1 新增like\dislike pose transformation接口 2025-03-25 16:11:03 +08:00
shahaibo
dc62ca956c Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-03-25 16:10:19 +08:00
shahaibo
d45c555415 TASK:模块化; 2025-03-25 16:10:10 +08:00
a657464d22 sketch拼贴 获取模块信息走统一接口 2025-03-25 14:56:16 +08:00
b5b67e0c75 Merge branch 'dev/dev_xp' into dev/dev 2025-03-25 14:43:47 +08:00
619d0e817f sketch拼贴 获取画布走统一接口 2025-03-25 14:37:38 +08:00
shahaibo
5d7beca57d Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-03-25 13:16:40 +08:00
shahaibo
9a933e74ff TASK:模块化; 2025-03-25 13:16:31 +08:00
0b60dd799f Merge branch 'dev/dev_xp' into dev/dev 2025-03-25 11:45:37 +08:00
a38c15005e 开发环境 添加邮件相关配置信息 2025-03-25 11:45:10 +08:00
b5a8c635d6 Merge branch 'dev/dev_xp' into dev/dev 2025-03-25 11:38:31 +08:00
6b288a3b3c 邮件发送系统-初版 2025-03-25 11:37:53 +08:00
9a5718cc35 Merge remote-tracking branch 'origin/dev/dev' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/python/PythonService.java
2025-03-25 11:26:50 +08:00
cc804bac7d Merge branch 'dev/dev_xp' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/python/PythonService.java
2025-03-25 11:25:22 +08:00
b18a5a0050 模特比例修改、sketch拼贴 2025-03-25 11:22:17 +08:00
078a0c0dfb 模特比例修改、sketch拼贴 2025-03-25 11:19:55 +08:00
shahaibo
d080fc04bb TASK:模块化; 2025-03-25 10:51:16 +08:00
shahaibo
ae484c9e6c TASK:模块化; 2025-03-24 15:59:46 +08:00
shahaibo
39cb20618b TASK:代码覆盖修复; 2025-03-24 15:08:23 +08:00
shahaibo
5b95401204 TASK:AiDA模块化 2025-03-21 09:59:42 +08:00
6b62cf7299 PoseTransformation-初版 2025-03-20 17:42:16 +08:00
shahaibo
af352bbfe8 TASK:AiDA模块化 2025-03-20 16:47:34 +08:00
shahaibo
4d7673e8df TASK:AiDA模块化 2025-03-20 16:46:13 +08:00
shahaibo
55ec6da74b TASK:AiDA模块化 2025-03-19 14:13:16 +08:00
shahaibo
83d9a5befb TASK:AiDA模块化 2025-03-19 14:08:16 +08:00
shahaibo
ec836a6470 TASK:AiDA模块化 2025-03-19 12:17:29 +08:00
shahaibo
d6f9aa155e TASK:AiDA模块化 2025-03-19 11:55:38 +08:00
shahaibo
d3b507ed45 TASK:AiDA模块化 2025-03-19 11:35:13 +08:00
shahaibo
b027396567 TASK:AiDA模块化 2025-03-19 11:09:15 +08:00
shahaibo
7d0a6ae2bf TASK:AiDA模块化 2025-03-19 11:02:13 +08:00
shahaibo
d12bf41021 TASK:AiDA模块化 2025-03-19 10:51:15 +08:00
shahaibo
ca3a584100 TASK:AiDA模块化 2025-03-19 10:47:39 +08:00
shahaibo
47d0856296 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-03-19 10:39:52 +08:00
shahaibo
a828d75248 TASK:AiDA模块化 2025-03-19 10:39:42 +08:00
edc769ca79 to dev 2025-03-19 09:56:21 +08:00
0a22f01587 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-03-19 09:52:49 +08:00
45f0d571d6 Merge branch 'release/3.0' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/common/config/MyTaskScheduler.java
2025-03-19 09:51:36 +08:00
shahaibo
880adf7c69 TASK:AiDA模块化 2025-03-19 09:48:14 +08:00
shahaibo
591b4bf119 TASK:AiDA模块化 2025-03-19 09:27:10 +08:00
0500557dca BUGFIX: 获取pantone值为空时返回rgb和hsv 2025-03-18 18:47:05 +08:00
654a3829c6 BUGFIX: 获取RGB对应的PanTone数据失败,导致返回颜色为空 2025-03-18 17:39:39 +08:00
shahaibo
2db65776b1 TASK:AiDA模块化 2025-03-18 17:38:28 +08:00
shahaibo
7742bd56f8 TASK:AiDA模块化 2025-03-18 17:11:36 +08:00
shahaibo
3159208a0a TASK:AiDA模块化 2025-03-18 16:54:21 +08:00
fccafba438 Merge remote-tracking branch 'origin/release/3.0' into release/3.0 2025-03-18 15:33:38 +08:00
8cd4cfb36d getDetail 添加日志,打印入参回参 2025-03-18 15:33:24 +08:00
shahaibo
971b2034ee TASK:AiDA模块化 2025-03-18 13:43:59 +08:00
shahaibo
f17d171231 TASK:AiDA模块化 2025-03-17 11:42:02 +08:00
shahaibo
4be008382f TASK:AiDA模块化 2025-03-17 11:37:12 +08:00
shahaibo
1ae1703f53 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-03-17 11:30:48 +08:00
shahaibo
340227d9a6 TASK:AiDA模块化 2025-03-17 11:30:09 +08:00
shahaibo
fb99e83b2d TASK:AIDA模块化; 2025-03-16 13:48:54 +08:00
shahaibo
8fa76c6732 TASK:AiDA模块化 2025-03-16 13:09:50 +08:00
shahaibo
1637db2fe3 TASK:AiDA模块化 2025-03-13 17:57:27 +08:00
shahaibo
7e55b1f85e BUGFIX: 隐藏加载不出minio的相关数据; 2025-03-13 17:53:35 +08:00
shahaibo
575d1492ad BUGFIX: 隐藏加载不出minio的相关数据; 2025-03-12 23:22:41 +08:00
shahaibo
a043db2de5 BUGFIX: 隐藏加载不出minio的相关数据; 2025-03-12 22:48:18 +08:00
shahaibo
d3ee0e5f4f BUGFIX: 隐藏加载不出minio的相关数据; 2025-03-12 22:06:39 +08:00
shahaibo
484a8d1d93 BUGFIX: 隐藏加载不出minio的相关数据; 2025-03-12 22:00:07 +08:00
shahaibo
7839ac3322 BUGFIX: 隐藏加载不出minio的相关数据; 2025-03-12 21:54:23 +08:00
shahaibo
e16f494cf4 Merge remote-tracking branch 'origin/release/3.0' into release/3.0 2025-03-12 21:26:33 +08:00
shahaibo
6fc22784b8 BUGFIX: 隐藏加载不出minio的相关数据; 2025-03-12 21:26:24 +08:00
52bafa95e3 关闭默认从Code-Create创建游客账号的定时器 2025-03-03 21:17:14 +08:00
377c86e390 Stripe 回调判空并直接返回 2025-02-28 14:30:35 +08:00
79abe93744 Stripe 回调判空并直接返回 2025-02-28 14:27:36 +08:00
f580955c97 Stripe 回调判空 2025-02-28 14:18:32 +08:00
6a625ed4ea 设置未修改局部design图时的图片地址 2025-02-27 09:58:35 +08:00
8a47d9f3da 修改历史数据中的mask分割状态 2025-02-25 18:27:23 +08:00
148b6492ea 现在design后的mask 默认已分割 2025-02-25 18:14:43 +08:00
be3fa7a704 编辑前后片,添加日志打印 2025-02-25 18:03:52 +08:00
63af2daf28 打开前后片编辑 2025-02-25 15:44:21 +08:00
37be3a1759 1、局部design 未保存前,不覆盖原图
2、打开前后片编辑
2025-02-25 15:22:14 +08:00
df2547ff81 参数名统一 2025-02-25 14:24:15 +08:00
7693de93dc 参数名统一 2025-02-25 14:19:32 +08:00
c061045466 Merge branch 'dev/dev_xp' into dev/dev 2025-02-25 14:02:58 +08:00
abd68f2dc8 参数结构修改 2025-02-25 14:02:29 +08:00
285f956caa 配置修改 添加桶 2025-02-25 13:03:52 +08:00
019cf4adf4 Merge branch 'dev/dev_xp' into dev/dev 2025-02-25 11:48:39 +08:00
cf38e7253f 局部design 2025-02-25 11:48:08 +08:00
d809362ea7 Merge branch 'dev/dev' into release/3.0 2025-02-25 11:42:51 +08:00
c08987a781 Merge branch 'dev/dev_xp' into dev/dev 2025-02-24 10:37:14 +08:00
e60c3d7aa3 Stripe webhook charge回调处理 2025-02-24 10:36:42 +08:00
614b8d0948 to prod 2025-02-21 17:56:50 +08:00
8834b906f4 Merge branch 'dev/dev_xp' into dev/dev 2025-02-21 17:39:35 +08:00
828a022768 漏传 2025-02-21 17:39:12 +08:00
26c8d08d04 Merge branch 'dev/dev_xp' into dev/dev 2025-02-21 17:35:35 +08:00
68a9b2281a 管理员系统部分优化、stripe异常通知优化 2025-02-21 17:16:44 +08:00
63df493d33 切换dev支付环境为测试环境,回调端点为dev端点 2025-02-21 13:02:30 +08:00
b7110c80b5 切换dev支付回调端点 2025-02-21 12:51:11 +08:00
c4dbd10a85 to dev 2025-02-20 11:10:00 +08:00
041a407978 Merge branch 'release/3.0' into dev/dev 2025-02-20 11:00:41 +08:00
f73c997c38 Merge branch 'dev/dev_xp' into dev/dev 2025-02-20 10:59:58 +08:00
db2a955dea 生成结果均低于输出标准时的提示语句更换 2025-02-20 10:57:43 +08:00
a91643d2ec to prod 2025-02-19 17:44:14 +08:00
269cf7ea03 关闭merchant邮箱,test支付环境不通知商家 2025-02-19 16:40:12 +08:00
e3aa964db8 切换支付环境为test 2025-02-19 16:32:28 +08:00
fa2fa66d4a 打开商家邮箱 用于接收邮件通知 2025-02-19 14:54:24 +08:00
6d2a189fef 更换支付方式 2025-02-19 14:43:42 +08:00
2033f61c7e 切换支付环境为live 2025-02-19 14:28:07 +08:00
4e2222966f 修改邮件模板ID 2025-02-19 14:23:43 +08:00
fbe9dc87e9 Stripe 回调添加异常处理和异常情况下邮件通知 2025-02-19 14:14:20 +08:00
d6f078ab60 添加判断,确认邮件是否发送成功 2025-02-18 17:07:16 +08:00
a940863799 stripe 一次订阅 bug修复 2025-02-18 15:00:57 +08:00
11ffa66851 stripe 一次订阅 添加日志打印 2025-02-18 14:09:27 +08:00
fc3fa22bee 更换stripe-webhook回调密钥 2025-02-18 11:31:49 +08:00
37ff60fcfb Stripe 添加一次订阅服务(默认关闭自动续订功能) 2025-02-17 17:14:30 +08:00
d2d5eebe12 to dev 2025-02-17 10:52:11 +08:00
9cfb5aa344 Merge remote-tracking branch 'origin/release/3.0' into release/3.0 2025-02-17 10:19:17 +08:00
5e7f898840 BUGFIX: 用户支付后获取账号到期时间为空,无法更新账号信息 2025-02-17 10:18:57 +08:00
shahaibo
6d3253aed3 BUGFIX: bindEmail; 2025-02-14 11:49:37 +08:00
shahaibo
52e5f246ce Merge branch 'dev/dev' into release/3.0 2025-02-13 12:57:37 +08:00
shahaibo
6222377bc5 BUGFIX: dev恢复toProductImage、relight消费; 2025-02-13 11:57:00 +08:00
shahaibo
2d10f57643 BUGFIX: dev关闭toProductImage、relight消费; 2025-02-13 11:42:45 +08:00
shahaibo
5f27a95498 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-02-13 11:07:02 +08:00
shahaibo
7fdf832f44 BUGFIX: toProductImage、relight; 2025-02-13 11:06:19 +08:00
43d2f83677 BUGFIX:For input string: "[0.3400879, 0.3400879]" 2025-02-12 13:20:12 +08:00
e882a15aa0 Merge branch 'dev/dev' into release/3.0 2025-02-12 13:07:25 +08:00
1a3f16119b Merge branch 'dev/dev_xp' into dev/dev 2025-02-12 12:13:52 +08:00
8e2e515af3 BUGFIX:印花 不等比缩放适配历史数据 2025-02-12 12:13:25 +08:00
f1a2495431 Merge branch 'dev/dev' into release/3.0 2025-02-12 10:34:02 +08:00
c66b794daa Merge branch 'dev/dev_xp' into dev/dev 2025-02-12 10:33:39 +08:00
b9f7ea2722 BUGFIX: 多个印花 不等比缩放适配历史数据 2025-02-12 10:33:11 +08:00
455e17d4b1 Merge branch 'dev/dev' into release/3.0 2025-02-12 10:19:45 +08:00
a1a6a78dac Merge branch 'dev/dev_xp' into dev/dev 2025-02-12 10:14:17 +08:00
07f91aef74 BUGFIX: 印花不等比缩放适配历史数据 2025-02-12 10:13:54 +08:00
shahaibo
079ab4d98f BUGFIX: name 信息绑定邮箱录入; 2025-02-12 09:56:55 +08:00
shahaibo
6e53bc3ca5 TASK: 定时任务; 2025-02-12 09:28:04 +08:00
shahaibo
5e8eb716b1 TASK: name信息; 2025-02-11 20:50:22 +08:00
shahaibo
34ee8fa11d TASK: name信息; 2025-02-11 13:08:00 +08:00
shahaibo
b7dc95af26 TASK:name信息; 2025-02-11 11:35:57 +08:00
shahaibo
297391d57e BUGFIX:试用订单邮件 订单更新时间判断; 2025-02-11 11:27:08 +08:00
shahaibo
aff870fba7 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-02-11 10:25:08 +08:00
7b1ac47228 Merge branch 'dev/dev_xp' into dev/dev 2025-02-10 16:15:20 +08:00
7eb9abbdb5 优化接收Stripe回调时数据重复存储问题(添加唯一索引) 2025-02-10 16:11:59 +08:00
521bd5071a Merge branch 'dev/dev_xp' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/mapper/primary/entity/DesignItemDetailPrint.java
#	src/main/java/com/ai/da/model/vo/DesignSinglePrint.java
#	src/main/java/com/ai/da/python/PythonService.java
#	src/main/java/com/ai/da/python/vo/DesignPythonItemElement.java
#	src/main/java/com/ai/da/python/vo/DesignPythonItemPrint.java
#	src/main/java/com/ai/da/service/impl/DesignServiceImpl.java
2025-02-10 11:21:52 +08:00
ab7e1705c4 修改print scale的数据结构 2025-02-10 11:18:04 +08:00
shahaibo
a2390a6ab2 BUGFIX:试用订单邮件 订单更新时间判断; 2025-02-10 10:34:01 +08:00
shahaibo
8dc5dcb1bd BUGFIX:试用订单邮件 订单更新时间判断; 2025-02-10 10:11:59 +08:00
shahaibo
5d010d2f77 BUGFIX:试用订单邮件 订单更新时间判断; 2025-02-10 10:08:48 +08:00
shahaibo
cec5544472 BUGFIX:试用订单邮件 订单更新时间判断; 2025-02-10 10:05:57 +08:00
shahaibo
5f79c3276a BUGFIX:试用订单邮件 订单更新时间判断; 2025-02-10 10:03:28 +08:00
aadb717c9f to dev 2025-02-07 15:03:24 +08:00
e2e9201fdd 修改印花scale数据类型为数组 2025-02-07 14:57:28 +08:00
shahaibo
9053bdf10c BUGFIX:试用注册; 2025-02-07 12:48:37 +08:00
shahaibo
b14297d1af Merge branch 'dev/dev' into release/3.0 2025-02-07 11:58:36 +08:00
shahaibo
e90979bbdc BUGFIX:试用注册; 2025-02-07 11:58:12 +08:00
shahaibo
e02c278e7a Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-02-07 10:25:20 +08:00
shahaibo
e60d9483a3 BUGFIX:试用订单邮件信息; 2025-02-07 10:25:11 +08:00
shahaibo
ba49312fd5 BUGFIX:试用订单邮件信息; 2025-02-07 10:23:41 +08:00
ba3c98771f BUGFIX: 新建订阅时更新订阅不更新账号信息 2025-02-06 18:39:06 +08:00
4c738cc61d BUGFIX: 返回最新的订阅号 2025-02-06 17:35:35 +08:00
d648a79ec4 BUGFIX: 订阅付款失败时仍有新建订阅 2025-02-06 16:36:07 +08:00
c325927418 to prod 2025-02-06 14:46:50 +08:00
dba5625446 正式支付环境下区分生产分支与测试分支 2025-02-06 14:42:45 +08:00
91189968e9 在dev测试生产环境的Stripe支付功能 2025-02-06 14:37:06 +08:00
433d8a460e to dev 2025-02-06 14:22:27 +08:00
ec9857fe73 Merge branch 'dev/dev_xp' into dev/dev 2025-02-06 14:09:53 +08:00
a9b01566e1 优化积分购买 2025-02-06 14:09:15 +08:00
shahaibo
a384aba4df TASK:定时任务开启; 2025-02-06 10:04:30 +08:00
e587ad3ca1 1、支付环境切换为prod
2、邮件通知对象添加Kim
3、打开定时任务
2025-02-06 09:53:03 +08:00
shahaibo
6a7c8b3d28 Merge branch 'dev/dev' into release/3.0 2025-02-05 14:26:33 +08:00
shahaibo
6f52c956ec TASK:新的试用订单生成; 2025-02-05 14:20:22 +08:00
shahaibo
9e5d2f47e2 BUGFIX:绑定谷歌; 2025-02-05 13:38:10 +08:00
shahaibo
627f264ef3 BUGFIX:绑定谷歌; 2025-02-05 13:02:26 +08:00
shahaibo
464de4ee5a Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-02-05 12:05:07 +08:00
shahaibo
cf76235123 TASK:谷歌微信快捷区分登录注册; 2025-02-05 12:04:53 +08:00
8d9f51f50f 不再清空游客的到期时间 2025-02-05 11:22:45 +08:00
d840185ec7 测试 code-create DB最大连接时长 2025-02-05 10:56:17 +08:00
9f4ab20b9d 测试 code-create DB最大连接时长 2025-02-05 10:49:10 +08:00
0877ff8f66 支付 测试 2025-02-05 10:05:23 +08:00
78046e8707 支付 测试 2025-02-04 15:29:22 +08:00
shahaibo
9fb8bc989d Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-02-04 14:29:32 +08:00
shahaibo
3c89670dae BUGFIX:design重复回退; 2025-02-04 14:29:22 +08:00
21b73d55f7 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-02-04 14:04:17 +08:00
9199cdf7e2 支付 to prod 2025-02-04 14:04:01 +08:00
shahaibo
8589216a77 TASK:绑定邮箱; 2025-02-04 13:53:50 +08:00
shahaibo
87768c6b53 TASK:绑定邮箱、绑定微信; 2025-02-04 11:39:42 +08:00
shahaibo
ca320f4334 TASK:测试dev分支; 2025-02-04 11:00:31 +08:00
shahaibo
7697ab59fa BUGFIX:重复停止组装; 2025-02-04 10:58:35 +08:00
e5e6f360dc Merge branch 'dev/dev_xp' into dev/dev 2025-01-27 16:39:54 +08:00
68a9462714 交易记录下载 返回文件流改为返回文件下载地址 2025-01-27 16:39:19 +08:00
b185a94fcc Merge branch 'dev/dev_xp' into dev/dev 2025-01-27 11:00:10 +08:00
708280ca14 交易记录下载post请求改get请求 2025-01-27 10:58:35 +08:00
0ab1e7eef7 Merge branch 'dev/dev_xp' into dev/dev 2025-01-24 15:50:15 +08:00
c7b1d46b18 maven 依赖冲突解决 2025-01-24 15:49:34 +08:00
9357a62f0c Merge branch 'dev/dev_xp' into dev/dev 2025-01-24 14:28:54 +08:00
c5b25e9a16 优化 删除多余代码 2025-01-24 14:28:21 +08:00
a35d057146 优化 导出交易记录文件 2025-01-24 14:25:32 +08:00
7fc495eec9 Merge branch 'dev/dev_xp' into dev/dev 2025-01-24 13:27:50 +08:00
46f37942d2 将交易记录导出为excel文件 2025-01-24 13:26:53 +08:00
e75196c904 Merge branch 'dev/dev_xp' into dev/dev 2025-01-23 14:15:38 +08:00
bdfa249c2e token过期 日志打印优化 2025-01-23 14:15:12 +08:00
d0e5f7da61 Merge branch 'dev/dev_xp' into dev/dev 2025-01-23 13:57:26 +08:00
d8320ba83d 新增自定义异常 2025-01-23 13:56:48 +08:00
23460800d6 优化请求未携带token时的日志打印 2025-01-23 13:55:48 +08:00
58c8b644bc 佣金计算 打印日志 2025-01-22 16:41:40 +08:00
c4c04aecb6 affiliateIncome 添加字段paymentInfoId 2025-01-22 16:37:40 +08:00
bb7c98c094 affiliate 佣金计算统计 2025-01-22 15:32:09 +08:00
dcdb0d06c4 Merge branch 'dev/dev_xp' into dev/dev 2025-01-15 10:49:08 +08:00
b6a66bed41 查询交易记录 添加付款人字段 2025-01-15 10:45:51 +08:00
shahaibo
5f277ed815 BUGFIX:toproductimage 打光积分不足提示修改; 2025-01-13 15:12:54 +08:00
shahaibo
845a553097 BUGFIX:微信名解析、toproductimage 打光积分不足code码修改; 2025-01-13 14:11:03 +08:00
74f89c8b2d 只填写国家和职业(不发送验证码) 2025-01-13 11:15:31 +08:00
cff8227228 Merge branch 'dev/dev_xp' into dev/dev 2025-01-13 11:13:31 +08:00
51e2c9af02 只填写国家和职业(不发送验证码) 2025-01-13 11:11:01 +08:00
cd89a77189 漏传 2025-01-13 10:56:06 +08:00
ab303cfeef 绑定邮箱时添加国家、职业信息 2025-01-13 10:55:08 +08:00
shahaibo
07004a7415 TASK:去日志; 2025-01-13 10:20:14 +08:00
shahaibo
d2069a3e7f TASK:去日志; 2025-01-13 10:12:04 +08:00
shahaibo
501cee0057 TASK:去日志; 2025-01-13 10:05:38 +08:00
ac2454fd0e 绑定邮箱时添加国家、职业信息 2025-01-10 17:16:08 +08:00
931a4cf807 to dev 2025-01-10 17:01:59 +08:00
cb7099264e 绑定邮箱时需要填写国家和职业 2025-01-10 16:54:44 +08:00
e7aa951e89 漏传 2025-01-10 16:19:53 +08:00
ef70598180 修改查询交易记录接口
1、添加按id排序
2、添加查询所有国家
3、添加接口,更新用户国家、职业信息
2025-01-10 16:13:45 +08:00
698fca8787 查询各平台交易记录 2025-01-10 13:27:27 +08:00
2f86090f21 Merge branch 'dev/dev' into dev/dev_xp 2025-01-10 13:05:26 +08:00
2988a3b34e 修改code-create数据库 sql语句修改 2025-01-09 13:50:08 +08:00
shahaibo
4fe5f65867 TASK:AiDA design like sort 2025-01-08 16:56:02 +08:00
shahaibo
4bb1953d4a Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-01-08 15:39:32 +08:00
shahaibo
57a8260f03 TASK:AiDA design like sort 2025-01-08 15:38:29 +08:00
e4936a23bc 编辑用户名,改为当前月允许修改5次 2025-01-08 14:20:12 +08:00
9f37cb3f8d Merge branch 'release/3.0' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/controller/ConvenientInquiryController.java
#	src/main/java/com/ai/da/model/dto/DesignCollectionDTO.java
#	src/main/java/com/ai/da/service/impl/DesignServiceImpl.java
2025-01-08 10:33:49 +08:00
b128b2436d 限制人员添加用户 2025-01-08 10:24:51 +08:00
66158e94dd 限制人员添加用户 2025-01-08 10:12:43 +08:00
f6b489d950 添加管理员页面访问者 2025-01-08 09:50:13 +08:00
30312caf82 添加管理员访问者 2025-01-07 17:27:29 +08:00
1d0dd65f5e Merge branch 'dev/dev_xp' into dev/dev 2025-01-07 17:21:54 +08:00
shahaibo
0b245f62af TASK:AiDA design like sort、moodboardPosition 2025-01-07 17:16:45 +08:00
50d90af3a5 添加管理员访问者 2025-01-07 17:15:22 +08:00
shahaibo
49b8585522 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-01-07 15:30:33 +08:00
shahaibo
b49f098a5e TASK:AiDA design like sort、moodboardPosition 2025-01-07 15:29:46 +08:00
e9a15b950e Merge branch 'dev/dev_xp' into dev/dev 2025-01-07 14:37:28 +08:00
ee676614f8 统一多种支付方式创建订单的入参 2025-01-07 14:31:43 +08:00
710abf2323 修改积分价格,for test 2025-01-07 11:47:33 +08:00
1a9f06d259 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-01-07 11:26:16 +08:00
shahaibo
eaaa99a946 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-01-07 11:16:14 +08:00
shahaibo
c8e4d624b7 TASK:AiDA design like sort 2025-01-07 11:15:25 +08:00
f08e36d100 Merge branch 'dev/dev_xp' into dev/dev 2025-01-07 11:12:30 +08:00
de73536d1c 解析所有发起购买的客户端ip地址 2025-01-07 11:09:22 +08:00
6a861305d6 解析所有发起购买的客户端ip地址 2025-01-07 11:07:49 +08:00
shahaibo
367fa130c0 BUGFIX:moodboard edit; 2025-01-07 10:58:57 +08:00
shahaibo
d04987a3e2 BUGFIX:moodboard edit; 2025-01-07 09:58:36 +08:00
b0fa185d36 更改积分刷新task 2025-01-06 14:58:46 +08:00
094718e67f Merge branch 'dev/dev_xp' into dev/dev 2025-01-06 14:47:40 +08:00
e4a8bf80e9 1、用户详细信息添加国家、职业、用户名修改剩余次数
2、积分不够 返回异常提示类型更改
3、添加根据ip解析地理位置测试接口
4、更新积分刷新机制(每月1号0点刷新年费用户积分)
2025-01-06 14:42:08 +08:00
shahaibo
c04b102a81 TASK:AiDA design like sort 2025-01-06 11:49:47 +08:00
shahaibo
da9b3a04b4 TASK:AiDA design like sort 2025-01-06 11:35:54 +08:00
shahaibo
234a030801 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2025-01-06 10:49:39 +08:00
shahaibo
5ea8e851d7 TASK:AiDA design like sort 2025-01-06 10:46:51 +08:00
shahaibo
afeeef4af7 TASK:试用订单接收名单添加; 2025-01-04 21:35:21 +08:00
ee1e2f8556 获取所有标签 2025-01-02 17:32:49 +08:00
1157b41730 积分购买 添加邮件通知 2024-12-31 11:38:12 +08:00
ca4d75c63f BUGFIX:用户订阅后更新用户身份和积分 2024-12-27 14:29:07 +08:00
f45bd7acc4 develop 环境webhook_secret变更 2024-12-27 10:46:52 +08:00
7bdd62d4a9 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-12-27 10:32:09 +08:00
b01ee9129b develop 环境webhook_secret变更 2024-12-27 10:31:27 +08:00
shahaibo
214c93923c Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-12-24 14:01:34 +08:00
shahaibo
bfa1d67b5c BUGFIX:Collection not found 2024-12-24 14:00:44 +08:00
a0a1a1a06a Merge branch 'dev/dev_xp' into dev/dev 2024-12-23 17:31:53 +08:00
468ad385d7 用户登录时,不校验游客账号有效期 2024-12-23 17:29:48 +08:00
fa94667c0f 游客到期时间不置空 2024-12-23 16:07:05 +08:00
c997fbf1cb Merge branch 'dev/dev_xp' into dev/dev 2024-12-23 14:35:29 +08:00
7283ace072 getAffiliateList 添加返回用户名 2024-12-23 14:31:48 +08:00
shahaibo
69743d4ef0 BUGFIX:谷歌快捷登录 2024-12-23 10:27:01 +08:00
shahaibo
e033671ffb TASK:AiDA 2024-12-20 16:11:52 +08:00
shahaibo
15cde37af7 TASK:AiDA 2024-12-20 11:44:21 +08:00
shahaibo
7fb74bc7d8 TASK:AiDA 2024-12-19 17:52:14 +08:00
43968995ea generate去除额外prompt 2024-12-19 17:37:28 +08:00
0574180e4b generate去除额外prompt 2024-12-19 17:26:16 +08:00
5b653272ee 覆盖代码恢复-获取个人信息 2024-12-19 17:15:55 +08:00
d28a6051f1 Merge branch 'release/3.0' into dev/dev 2024-12-19 16:02:59 +08:00
f9063ad26e generate print翻译输入修改 2024-12-19 16:01:35 +08:00
2f4d060ca3 generate print翻译输入修改 2024-12-19 15:59:18 +08:00
fcd0cf4836 Merge branch 'release/3.0' into dev/dev 2024-12-19 15:32:10 +08:00
26f50c2acb generate print翻译输入修改 2024-12-19 15:26:27 +08:00
c3eb1fc78c Merge branch 'dev/dev_xp' into dev/dev 2024-12-19 14:04:28 +08:00
b15cc542e1 按id查询订单 2024-12-19 13:56:17 +08:00
shahaibo
ec094d7471 TASK:AiDA 2024-12-19 13:31:01 +08:00
shahaibo
3dc432131c TASK:AiDA 2024-12-19 11:13:30 +08:00
shahaibo
1a19604163 TASK:AiDA 2024-12-19 10:51:38 +08:00
fdebb2b215 Merge branch 'dev/dev_xp' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/model/vo/AccountLoginVO.java
#	src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
2024-12-18 14:02:06 +08:00
7d8f047087 Affiliate功能-数据库表设计更新 2024-12-18 11:53:41 +08:00
bf8af41f3f 添加Affiliate功能 2024-12-16 10:26:02 +08:00
shahaibo
cdf29d2b0d TASK:AiDA 2024-12-13 16:07:21 +08:00
shahaibo
7194049127 TASK:prompt修改; 2024-12-13 11:32:42 +08:00
shahaibo
e34cec812f Merge remote-tracking branch 'origin/release/3.0' into release/3.0 2024-12-13 10:35:17 +08:00
shahaibo
11a5b53d2a BUGFIX:prompt重复拼接; 2024-12-13 10:34:14 +08:00
efe22de0a0 Merge branch 'refs/heads/dev/dev' into dev/dev_xp
# Conflicts:
#	src/main/java/com/ai/da/common/utils/SendEmailUtil.java
#	src/main/java/com/ai/da/mapper/primary/entity/Account.java
2024-12-11 16:52:16 +08:00
shahaibo
82f7571612 TASK:AiDA 2024-12-11 16:21:18 +08:00
shahaibo
2ac54a50ec TASK:AiDA 2024-12-11 14:21:29 +08:00
5dd1e10b61 to dev 2024-12-10 10:09:21 +08:00
e9e8e87719 Merge branch 'release/3.0' into dev/dev 2024-12-10 10:04:27 +08:00
3c0fa205d1 BUGFIX:code-create注册的新用户自动添加为aida的游客,去重bug修改 2024-12-09 18:17:09 +08:00
47ca7bde41 Affiliate-新增、查询、佣金计算等 2024-12-09 16:53:29 +08:00
shahaibo
9e28d579d1 Merge branch 'dev/dev' into dev/dev_shb
# Conflicts:
#	src/main/java/com/ai/da/controller/AccountController.java
#	src/main/java/com/ai/da/controller/SavedCollectionController.java
#	src/main/java/com/ai/da/service/AccountService.java
#	src/main/java/com/ai/da/service/UserLikeGroupService.java
#	src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
2024-12-09 13:44:07 +08:00
shahaibo
1c96522447 TASK:AiDA 2024-12-09 13:31:30 +08:00
shahaibo
1a568621ca BUGFIX:重复申请试用; 2024-12-03 11:51:01 +08:00
eecefee674 Merge branch 'dev/dev' into release/3.0 2024-12-02 14:54:00 +08:00
ea0332851d Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-12-02 14:35:20 +08:00
a25a7dc023 high || fast 生成次数修改 2024-12-02 14:34:10 +08:00
shahaibo
b4fe1ca199 TASK:toproductimage prompt; 2024-12-02 13:51:46 +08:00
shahaibo
b315ae5644 TASK:toproductimage prompt; 2024-12-02 12:02:19 +08:00
徐佩
f7113601f3 Merge branch 'dev/dev' into release/3.0 2024-12-01 20:27:58 +08:00
徐佩
8d6e3e9644 sketchboard-prompt 修改 2024-12-01 19:48:12 +08:00
徐佩
23b864d378 to prod 2024-12-01 17:37:52 +08:00
徐佩
be1119be6f bugfix : fast || high 2024-12-01 16:51:38 +08:00
徐佩
b836e7fd67 bugfix : fast || high 2024-12-01 16:32:51 +08:00
a237b4041d 模型选择 添加high || fast 2024-11-29 15:09:34 +08:00
ea4cd29723 to dev 2024-11-28 17:26:53 +08:00
13397fa1f7 to dev 2024-11-28 17:22:57 +08:00
2fab472150 to dev 2024-11-28 17:21:58 +08:00
8c71b4845a Merge branch 'release/3.0' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
2024-11-28 17:19:40 +08:00
b70f909a32 优化-自动将Code-Create注册的新用户添加到AiDA 2024-11-28 17:14:11 +08:00
1b15aed6a2 支付优化-续订失败邮件通知 2024-11-28 10:43:06 +08:00
5019fbd3fc 支付优化 2024-11-25 10:53:09 +08:00
2ea19dcf03 Merge branch 'refs/heads/dev/dev' into dev/dev_xp 2024-11-19 17:09:36 +08:00
4d756d5624 支付优化 2024-11-19 17:08:16 +08:00
f6f759110f 支付优化--修改积分购买相应功能 2024-11-19 16:00:30 +08:00
8d27b5b51e 新增功能 -- 产品订阅 年度/月度 2024-11-18 16:20:25 +08:00
shahaibo
9f064609e7 TASK:谷歌登录 2024-11-13 15:45:40 +08:00
shahaibo
fd10d4dbc4 TASK:谷歌登录 2024-11-13 15:44:48 +08:00
shahaibo
fadb5faf0d TASK:谷歌登录 2024-11-12 15:34:43 +08:00
e5e514b522 ws优化 2024-11-11 17:31:55 +08:00
74e6d5a1da ws 联调修改 2024-11-11 17:24:49 +08:00
3cf0570912 ws 引入心跳 2024-11-11 16:34:55 +08:00
shahaibo
8da51a0a82 TASK:谷歌登录 2024-11-11 16:08:49 +08:00
shahaibo
37ff7fbb91 Merge remote-tracking branch 'origin/dev/dev' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/service/AccountService.java
2024-11-11 16:06:21 +08:00
shahaibo
8c20b51e13 TASK:谷歌登录 2024-11-11 16:04:26 +08:00
391a28d659 ws 2024-11-11 15:21:35 +08:00
4535fb7dfb ws 2024-11-11 15:07:02 +08:00
546d1b4c44 ws 设置session2分钟超时,以及心跳回复 2024-11-11 15:03:21 +08:00
5fe605c130 长连接 关闭日志打印 2024-11-11 10:45:57 +08:00
4408c0ecc6 to dev 2024-11-11 10:29:06 +08:00
49f08d1191 管理员系统优化-1 2024-11-06 17:51:51 +08:00
903bafb245 管理员系统优化 2024-11-06 17:27:16 +08:00
59b02b3f28 to prod 2024-11-04 10:49:29 +08:00
4a23e33080 BUGFIX:作品删除后,获取点赞详细报错 2024-11-04 10:42:35 +08:00
1e1b06fc48 chat-robot返回sketch图片地址变更 2024-10-29 16:53:17 +08:00
7c56d2bf4e to dev 2024-10-29 10:33:48 +08:00
4add0a806c 游客转试用用户,添加积分 2024-10-29 10:25:36 +08:00
c9bb7fe502 to prod 2024-10-29 10:03:21 +08:00
a8a7a129c9 Merge branch 'dev/dev' into release/3.0 2024-10-29 09:59:39 +08:00
c3c5532cb5 Merge branch 'dev/dev_xp' into dev/dev 2024-10-29 09:58:43 +08:00
78bfc16287 BUGFIX:imageToSketch 积分扣除校验 2024-10-29 09:57:34 +08:00
shahaibo
6c6162df74 BUGFIX:定时任务开启; 2024-10-23 08:54:00 +08:00
shahaibo
a837aff0fb BUGFIX:定时任务开启; 2024-10-22 10:06:12 +08:00
shahaibo
f673afc7fc TASK:配置 2024-10-21 10:59:50 +08:00
shahaibo
0ea96c728c BUGFIX:模特预览默认颜色添加; 2024-10-20 13:39:01 +08:00
shahaibo
77e71e3296 TASK:aida作品集查询; 2024-10-20 13:27:45 +08:00
shahaibo
ce870b9acf TASK:aida; 2024-10-20 11:50:52 +08:00
shahaibo
7f889b54e0 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-10-20 10:52:24 +08:00
shahaibo
ebd596d0d2 TASK:aida; 2024-10-20 10:52:14 +08:00
04ce95caa4 添加preview_submit字段to python 2024-10-15 10:44:26 +08:00
29bf172187 取消用户自定义mask的功能 2024-10-15 10:30:02 +08:00
shahaibo
41619febb9 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-10-14 11:18:30 +08:00
shahaibo
0f4b769d49 BUGFIX:moodboard合成图 裁剪; 2024-10-14 11:18:18 +08:00
66cd8217b9 更新undividedLayer临时访问地址缓存 2024-10-14 11:16:57 +08:00
e684c4e547 Merge branch 'release/3.0' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/common/constant/CommonConstant.java
#	src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
#	src/main/java/com/ai/da/controller/PortfolioController.java
#	src/main/java/com/ai/da/model/dto/QueryPortfolioPageDTO.java
#	src/main/java/com/ai/da/service/PortfolioService.java
#	src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java
#	src/main/resources/messages_en.properties
#	src/main/resources/messages_zh.properties
2024-10-10 23:26:20 +08:00
c439f41d69 bugfix:参与活动作品为0时查询出错 2024-10-09 16:42:45 +08:00
823e96b014 发布准备 2024-10-09 15:47:29 +08:00
0cca24ee30 修改环境及打开监听 2024-10-09 15:44:47 +08:00
66cccd0867 添加校验,二创作品不能参与活动 2024-10-09 15:40:29 +08:00
463ddf3cb2 1、为发布的作品添加标签
2、修改标签
3、不允许用户重复参与活动
4、查询所有参与活动的作品
2024-10-09 13:51:16 +08:00
shahaibo
f0e0987f31 BUGFIX:发布作品返回作品ID; 2024-10-09 13:10:48 +08:00
shahaibo
16bea58ab5 BUGFIX:更新作品集作品名重复判断; 2024-10-09 11:43:05 +08:00
shahaibo
f2bbbaaeb6 BUGFIX:history retrieval返回新增portfolio信息; 2024-10-09 11:34:04 +08:00
shahaibo
5098f6f4a1 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-10-08 17:07:43 +08:00
shahaibo
bc1815ae1b TASK:pantone提示词; 2024-10-08 17:07:30 +08:00
6256c90958 bugfix:修改提取的sketch,图片后缀问题 2024-10-08 16:36:48 +08:00
f0bfe249e0 bugfix:修改提取的sketch,图片后缀问题 2024-10-08 16:17:45 +08:00
7bbfd7c506 Merge branch 'dev/dev_xp' into dev/dev 2024-10-08 15:49:39 +08:00
3c7cbe28a1 design single preview_submit 2024-10-08 15:48:53 +08:00
c834aacf3a Merge branch 'dev/dev_xp' into dev/dev 2024-10-08 15:44:36 +08:00
90b0ef41e3 bugfix:修改提取出的sketch 2024-10-08 15:44:01 +08:00
shahaibo
2aeeec4468 TASK:裁剪; 2024-10-08 14:05:13 +08:00
a7c5723e10 保存修改 2024-10-08 13:34:10 +08:00
shahaibo
ba595b9d2c Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-10-08 13:18:12 +08:00
shahaibo
d9118aaf93 TASK:AiDA workshop活动; 2024-10-08 13:17:55 +08:00
1bdc71998b 按标签查询作品 2024-10-08 13:13:13 +08:00
a597f7a67a 为作品添加标签 2024-10-07 21:27:37 +08:00
195964ef5a 重新获取修改后的sketch的临时访问地址 2024-10-07 11:28:48 +08:00
shahaibo
c27ca77717 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-10-06 14:33:44 +08:00
shahaibo
7d0d460e5c bugfix:redesign bug; 2024-10-06 14:33:31 +08:00
5ac9df3056 Merge branch 'dev/dev_xp' into dev/dev 2024-10-06 14:28:18 +08:00
b8d64f1f28 获取指定用户的个人主页作品 2024-10-06 14:27:55 +08:00
c8dd9664be Merge branch 'dev/dev_xp' into dev/dev 2024-10-04 16:10:05 +08:00
8899a3a6bb SketchStyle 去除自定义风格 2024-10-04 11:45:00 +08:00
shahaibo
67f56f9b84 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-10-04 10:41:23 +08:00
shahaibo
fd12b9e571 TASK:male sketch style逻辑添加; 2024-10-04 10:40:32 +08:00
fb329c94aa Merge branch 'dev/dev_xp' into dev/dev 2024-10-03 16:49:03 +08:00
16d06582ee 重置designSingle返回的sketch在minio的临时访问凭证 2024-10-03 16:41:48 +08:00
shahaibo
6f98f111dd TASK:十月优惠邮件发送接口; 2024-10-03 12:15:55 +08:00
shahaibo
51a1c1d8e1 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-10-03 12:14:43 +08:00
shahaibo
8445c23984 TASK:十月优惠邮件发送接口; 2024-10-03 12:14:30 +08:00
961f8f874e 获取消息 按时间逆序 2024-10-01 16:08:40 +08:00
283b6244b1 消息推送连接关闭时避免报错 2024-10-01 10:29:06 +08:00
f19a15dbe8 Merge branch 'dev/dev_xp' into dev/dev 2024-09-30 17:16:11 +08:00
791d44df02 消息推送 bug修改 2024-09-30 17:15:11 +08:00
shahaibo
28e67db78d TASK:aida redesign不修改位置信息√接口修改; 2024-09-30 15:41:29 +08:00
shahaibo
63a120c652 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-09-30 14:49:05 +08:00
shahaibo
f60cabbbc0 TASK:aida design统计; 2024-09-30 14:48:44 +08:00
06db759749 my work bug修复 2024-09-30 11:28:53 +08:00
shahaibo
373608d989 TASK:aida design统计; 2024-09-29 18:32:06 +08:00
shahaibo
45e3dde03f Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-09-29 17:59:00 +08:00
shahaibo
3625180a6e Merge branch 'release/3.0' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
#	src/main/java/com/ai/da/controller/ThirdPartyController.java
#	src/main/java/com/ai/da/service/AccountService.java
#	src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
2024-09-29 17:56:49 +08:00
aae1442a6f websocket获取关注数与粉丝数 2024-09-29 15:55:12 +08:00
08dcd03468 修改默认头像 2024-09-28 20:14:19 +08:00
shahaibo
deda511e32 TASK:aida; 2024-09-27 16:43:02 +08:00
shahaibo
9bcf615b4b TASK:aida; 2024-09-27 16:30:58 +08:00
shahaibo
70912c4c43 Merge remote-tracking branch 'origin/dev/dev' into dev/dev 2024-09-27 16:24:56 +08:00
shahaibo
fa013c1974 TASK:aida; 2024-09-27 16:24:45 +08:00
11fbeb1ed0 Merge branch 'dev/dev_xp' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/common/utils/RedisUtil.java
#	src/main/java/com/ai/da/service/AccountService.java
2024-09-27 15:43:48 +08:00
f432b8cce6 修改提取的sketch 2024-09-27 15:40:30 +08:00
shahaibo
05ddd33bcd TASK:aida; 2024-09-27 15:33:20 +08:00
shahaibo
9f5c901502 TASK:aida; 2024-09-27 14:42:30 +08:00
33d5d3a2ea 上传图片超时,邮件提醒开发相关人员 2024-09-26 11:46:23 +08:00
2668dd3c47 redis 添加key 2024-09-25 16:17:55 +08:00
2bc5fef175 1、修改用户名
2、更改账号绑定邮箱地址
2024-09-25 16:15:18 +08:00
ea92e1f20d to dev 2024-09-25 11:38:11 +08:00
9f1cf1d90e Merge branch 'dev/dev_xp' into dev/dev 2024-09-25 11:31:40 +08:00
b43f9baead 修改 imageToSketch 2024-09-25 11:30:51 +08:00
shahaibo
41ffe335fc TASK:mq配置 2024-09-24 15:43:37 +08:00
shahaibo
56d0dcd25f TASK:数据迁移 2024-09-24 15:20:24 +08:00
shahaibo
4304acbe6f BUGFIX:作品广场 2024-09-24 14:37:22 +08:00
2f1b22d423 Merge branch 'refs/heads/release/3.0' into dev/dev_xp
# Conflicts:
#	src/main/java/com/ai/da/common/utils/RedisUtil.java
#	src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
#	src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java
2024-09-24 10:27:18 +08:00
3eb8626831 修改 imageToSketch 2024-09-24 10:20:08 +08:00
5a86f2e649 修改 imageToSketch 2024-09-23 11:13:44 +08:00
93e9c61943 1、新增 imageToSketch
2、删除无用代码
2024-09-20 11:32:09 +08:00
shahaibo
c5e9941adb BUGFIX:design colorboard元素混入sketchboard; 2024-09-20 11:31:48 +08:00
56679808e9 mask更新 从sketch分割 2024-09-19 09:50:56 +08:00
shahaibo
40f5705e7a TASK:凭证更新; 2024-09-13 11:24:14 +08:00
shahaibo
32975d9900 TASK:链接注册试用; 2024-09-13 11:16:17 +08:00
shahaibo
72db49e7f5 Merge remote-tracking branch 'origin/release/3.0' into release/3.0 2024-09-13 11:13:42 +08:00
shahaibo
472f5e65b4 TASK:凭证更新; 2024-09-13 11:13:23 +08:00
e2f8fb082c 广场用户注册修改 添加账户开始时间并设置积分为0 2024-09-13 10:43:28 +08:00
a47e53b19e mask 数据替换,代码暂存 2024-09-13 10:09:33 +08:00
c01acec9e6 Merge branch 'dev/dev_xp' into dev/dev 2024-09-09 10:50:14 +08:00
969d7586fc mask替换相关接口--未完善版,暂存 2024-09-06 12:34:36 +08:00
31a40ff7ca 关闭dev定时任务 2024-09-06 10:01:28 +08:00
afb9c99228 Merge branch 'dev/dev_xp' into dev/dev 2024-09-06 09:32:40 +08:00
8ee6a529a0 作品广场优化,将点赞前三和浏览量前三的作品放在第一页的最前面 2024-09-02 12:02:54 +08:00
cebc05d132 BUGFIX:管理员系统 添加新用户邮箱校验,相同的邮箱只能创建一个账号 2024-08-27 11:32:47 +08:00
d23ac82b1b TASK:code-create 注册用户添加为AiDA的游客
BUGFIX:0关注状态下获取动态
2024-08-27 11:27:05 +08:00
e86b576050 TASK:动态 2024-08-23 17:34:38 +08:00
8a774aa328 管理员系统 优化 按用户名或用户邮箱 查询用户design频率 2024-08-21 15:07:14 +08:00
c5da68dc47 1、获取关注、粉丝列表、消息详细 返回参数统一
2、管理员系统 按用户名或用户邮箱 查询用户design频率
2024-08-21 14:31:10 +08:00
28df672a7d 优化 获取关注、粉丝列表 2024-08-21 10:23:55 +08:00
203c88dd70 添加头像 2024-08-19 15:10:41 +08:00
fa86a2af45 添加关注、取消关注、获取关注列表、粉丝列表相关接口 2024-08-19 11:52:53 +08:00
ac28ba233c 消息通知系统-一键已读;反复点赞、关注及取消 数据存储处理, 2024-08-16 10:32:15 +08:00
shahaibo
47dc2bfc6e BUGFIX:二创变原创 2024-08-15 16:37:24 +08:00
085dac0630 消息通知系统 2024-08-15 16:25:44 +08:00
7b27b1362d Merge branch 'dev/dev_xp' into release/3.0
# Conflicts:
#	src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
2024-08-12 09:54:28 +08:00
704e3c25bf BUG修复:用户更改套餐,积分/用户角色不变更问题 2024-08-12 09:51:39 +08:00
7e5b10aab3 通过邮箱查询账户,忽略邮箱大小写 2024-08-08 10:54:22 +08:00
3ccbd8f905 账号置为游客日志添加 2024-08-08 10:13:47 +08:00
89a234e77d to prod 2024-08-06 11:43:20 +08:00
388dd54bfa to prod 2024-08-06 11:41:48 +08:00
035c4412f1 Merge branch 'dev/dev' into release/3.0 2024-08-06 11:35:55 +08:00
d4eb7c846b to dev 2024-08-06 11:35:11 +08:00
fef50d7a37 Merge branch 'dev/dev_xp' into dev/dev 2024-08-06 11:30:02 +08:00
e5a95972a5 modify : 管理员系统 2024-08-06 11:29:33 +08:00
shahaibo
36a796b38b BUGFIX:多个印花 2024-08-05 17:44:53 +08:00
94927ae0a4 modify 2024-08-05 15:48:50 +08:00
4d7153661c Merge branch 'release/3.0' into dev/dev 2024-08-05 15:39:01 +08:00
76062136d6 Merge branch 'dev/dev_xp' into dev/dev 2024-08-05 15:38:05 +08:00
ea4ba74989 管理员系统功能添加 2024-08-05 15:19:02 +08:00
shahaibo
5a09d7a195 BUGFIX:过滤已废弃 2024-08-02 12:28:58 +08:00
shahaibo
e0332b9ddf BUGFIX:过滤已废弃 2024-08-02 12:21:30 +08:00
shahaibo
685ba09f7d BUGFIX:过滤已废弃 2024-08-02 12:13:32 +08:00
shahaibo
7aa1fc0342 BUGFIX:过滤已废弃 2024-08-02 11:56:17 +08:00
shahaibo
653264151a BUGFIX:过滤已废弃 2024-08-02 11:53:50 +08:00
shahaibo
fada00c738 BUGFIX:过滤已废弃 2024-08-02 11:36:58 +08:00
a10d30337a 支付切换为live 2024-08-01 10:30:44 +08:00
85ffed114b 语言适配 2024-08-01 10:07:24 +08:00
1093ac68b6 查询指定用户各功能使用情况 2024-08-01 10:00:26 +08:00
71e6abd816 to prod 2024-07-29 17:52:06 +08:00
00c948116e to prod 2024-07-29 17:50:40 +08:00
b6efd598bd to prod 2024-07-29 17:50:09 +08:00
bfe7ad4aa6 to prod 2024-07-29 17:49:16 +08:00
018ccef46a to prod 2024-07-29 17:47:09 +08:00
feb836f849 调查问卷 2024-07-29 17:36:32 +08:00
0106f21b86 Merge branch 'dev/dev_xp' into dev/dev 2024-07-29 17:31:21 +08:00
1b5f64785d 调查问卷查看 2024-07-29 17:24:14 +08:00
77a4aee88e 取消英文字母的正则匹配 2024-07-24 09:44:32 +08:00
shahaibo
ce1e2f3eab TASK:取消定时任务 2024-07-22 11:18:43 +08:00
shahaibo
75fbd2844b TASK:mq配置 2024-07-22 11:15:25 +08:00
shahaibo
832f331603 TASK:配置文件dev分支改为dev 2024-07-22 11:14:19 +08:00
9a2d58d922 正则匹配输入的英文文本 2024-07-22 09:46:11 +08:00
徐佩
34c4cd47ef Merge remote-tracking branch 'origin/release/3.0' into dev/dev
# Conflicts:
#	src/main/java/com/ai/da/common/task/AccountTask.java
2024-07-21 09:54:42 +08:00
c46f65600f 添加 开展活动接口 2024-07-19 15:40:54 +08:00
aa1eb7411e stripe 设置支付链接语言 2024-07-17 17:12:25 +08:00
909 changed files with 57549 additions and 14660 deletions

View File

@@ -0,0 +1,174 @@
name: 手动 AiDA back-java 开发分支构建部署
on:
workflow_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
outputs:
build_status: ${{ job.status }}
build_url: ${{ gitea.server_url }}/${{ gitea.repository.owner.name }}/${{ gitea.repository.name }}/actions/runs/${{ gitea.run_id }}
permissions:
contents: read
packages: write
env:
REMOTE_DEPLOY_PATH: /workspace/workspace_aida/DevelopVersion/develop-version-aida-back
steps:
- name: 0.记录开始时间
id: build_start_time
run: echo "current_time=$(TZ='Asia/Hong_Kong' date '+%Y-%m-%d %H:%M:%S %Z')" >> $GITHUB_OUTPUT
- name: 1.检出代码
uses: actions/checkout@v4
with:
ref: dev/3.1_release_merge
- name: 2.Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
- name: 3.设置JAVA Maven 环境
run: |
# 适配root/普通用户
SUDO=""
[ "$(id -u)" != "0" ] && SUDO="sudo"
# 安装依赖
$SUDO apt update && $SUDO apt install -y wget tar --no-install-recommends
# 下载Maven
MAVEN_VERSION="3.9.11"
MAVEN_TAR="apache-maven-${MAVEN_VERSION}-bin.tar.gz"
MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/${MAVEN_TAR}"
wget --no-verbose -O /tmp/${MAVEN_TAR} ${MAVEN_URL}
# 解压+软链接
$SUDO tar -xzf /tmp/${MAVEN_TAR} -C /usr/local/
$SUDO ln -sf /usr/local/apache-maven-${MAVEN_VERSION} /usr/local/maven
# 配置PATH
echo "/usr/local/maven/bin" >> $GITHUB_PATH
export PATH="/usr/local/maven/bin:$PATH"
# 验证
mvn -v
- name: 4.构建jar包
run: |
echo "===== 开始构建JAR包 ====="
# 新增:打印当前构建分支(两种方式双重确认)
echo "当前工作目录分支:$(git branch --show-current)"
echo "Gitea检出分支:${{ github.ref_name }}"
echo "预期构建分支:dev/3.1_release_merge"
echo "========================"
mvn -B clean install -DskipTests -Pdev 2>&1
# 检查构建是否成功
if [ $? -ne 0 ]; then
echo "JAR包构建失败!"
exit 1
fi
- name: 5.生成Dockerfile
run: |
echo "===== 生成Dockerfile ====="
cat > Dockerfile << 'EOF'
FROM openjdk:21-ea-21-jdk-slim
VOLUME /tmp
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' > /etc/timezone
ADD ./aida-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
EOF
echo "Dockerfile内容:"
cat Dockerfile
- name: 6.生成docker-compose.yml
run: |
echo "===== 生成docker-compose.yml ====="
cat > docker-compose.yml << 'EOF'
version: '3'
services:
aida_back:
container_name: develop-version-aida-back
build: .
volumes:
# 数据挂载
- ./log:/log
ports:
- '10090:5567'
restart: always
EOF
# 验证docker-compose.yml生成
echo "docker-compose.yml内容:"
cat docker-compose.yml
- name: 7.安装SSH工具
run: |
$SUDO apt install -y sshpass openssh-client --no-install-recommends
# 配置SSH免密
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
- name: 8.同步文件到远程服务器
run: |
echo "===== 同步文件到远程服务器 ====="
# 使用scp同步文件
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
./target/*.jar ./Dockerfile ./docker-compose.yml \
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:${{ env.REMOTE_DEPLOY_PATH }} 2>&1
- name: 9.部署和运行服务
run: |
echo "===== 开始部署服务 ====="
# SSH执行部署命令
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF_SSH'
cd ${{ env.REMOTE_DEPLOY_PATH }}
echo "停止旧容器..."
docker compose down || true
echo "清理Docker资源..."
docker system prune -f
echo "构建镜像..."
docker compose build --no-cache
echo "启动服务..."
docker compose up -d
echo "验证容器状态..."
docker compose ps
echo "部署完成!"
EOF_SSH
- name: 10.发送构建结果邮件
if: always() # 无论上一步是否失败,都执行此步骤
uses: dawidd6/action-send-mail@v3
with:
from: ${{ secrets.MAIL_USERNAME }}
# --- 邮件配置 ---
server_address: smtp.gmail.com # 替换为你的SMTP服务器地址
server_port: 465 # 替换为你的SMTP端口 (通常是465或587)
username: ${{ secrets.MAIL_USERNAME }} # 存储在Secrets中的邮箱用户名
password: ${{ secrets.MAIL_PASSWORD }} # 存储在Secrets中的邮箱密码
subject: 'Gitea Actions 构建通知: ${{ job.status }} - AiDA back-java Develop'
# 收件人列表,可以根据需要更改
to: 'cgzhou@aidlab.hk,zchengrong@yeah.net' # 替换为实际收件人邮箱
# --- 邮件正文内容 ---
body: |
项目: AiDA back-java Develop
分支: dev/3.1_release_merge
🎉 构建结果: ${{ job.status }}
📅 构建时间: ${{ steps.build_start_time.outputs.current_time }}
🔗 构建链接: ${{ gitea.server_url }}/${{ gitea.repository.owner.name }}/${{ gitea.repository.name }}/actions/runs/${{ gitea.run_id }}
# 确保邮件内容为纯文本,或者你可以设置为 html: true 并调整 body
content_type: text/plain

1
.gitignore vendored
View File

@@ -48,3 +48,4 @@ log
temp/
docker-compose.yml
/src/main/resources/application-local.properties

View File

@@ -1,7 +0,0 @@
FROM openjdk:8
VOLUME /tmp
#时区设置
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' > /etc/timezone
ADD ./target/aida-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>

799
pom.xml
View File

@@ -1,324 +1,475 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.aida</groupId>
<artifactId>aida</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>aida</name>
<description>ai da</description>
<properties>
<java.version>8</java.version>
<mybatis.plus.version>3.5.2</mybatis.plus.version>
<hutool.version>5.8.2</hutool.version>
<wx.java.version>4.2.7.B</wx.java.version>
<fastjson.version>2.0.6.graal</fastjson.version>
<security.jwt.version>1.1.1.RELEASE</security.jwt.version>
<jjwt.version>0.9.1</jjwt.version>
<guava.version>31.1-jre</guava.version>
<jaxb-api>2.4.0-b180830.0359</jaxb-api>
<jaxb-impl>4.0.0</jaxb-impl>
<jaxb-core>4.0.0</jaxb-core>
<activation>1.1.1</activation>
<easy-captcha>1.6.2</easy-captcha>
<aws.java.sdk.version>2.20.43</aws.java.sdk.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>${aws.java.sdk.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>${security.jwt.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis.plus.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb-api}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb-impl}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb-core}</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>${activation}</version>
</dependency>
<dependency>
<groupId>com.github.whvcse</groupId>
<artifactId>easy-captcha</artifactId>
<version>${easy-captcha}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<!-- /**发送邮件**/-->
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java-ses</artifactId>
<version>3.1.572</version>
</dependency>
<!--minio-->
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.0.3</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.2.1.jre8</version>
</dependency>
<!-- RabbitMQ -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- redis 连接池 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<!--支付宝 SDK-->
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>4.22.57.ALL</version>
</dependency>
<!--PayPal SDK-->
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>checkout-sdk</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>rest-api-sdk</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230618</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>26.2.0</version>
</dependency>
<!-- aws s3 -->
<!-- S3 dependency -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3-transfer-manager</artifactId>
<version>2.17.103-PREVIEW</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>kms</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3control</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- 本地开发环境 -->
<id>dev</id>
<properties>
<profiles.active>dev</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<!-- 测试环境 -->
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
</properties>
</profile>
<profile>
<!-- 生产环境 -->
<id>prod</id>
<properties>
<profiles.active>prod</profiles.active>
</properties>
</profile>
</profiles>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.aida</groupId>
<artifactId>aida</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>aida</name>
<description>ai da</description>
<properties>
<java.version>21</java.version>
<mybatis.plus.version>3.5.5</mybatis.plus.version>
<hutool.version>5.8.23</hutool.version>
<wx.java.version>4.2.7.B</wx.java.version>
<fastjson.version>2.0.43</fastjson.version>
<jjwt.version>0.12.3</jjwt.version>
<guava.version>32.1.3-jre</guava.version>
<easy-captcha>1.6.2</easy-captcha>
<aws.java.sdk.version>2.20.43</aws.java.sdk.version>
<javacv.version>1.5.5</javacv.version>
<system.windowsx64>windows-x86_64</system.windowsx64>
<javacpp.platform.linux-x86_64>linux-x86_64</javacpp.platform.linux-x86_64>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>${aws.java.sdk.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis.plus.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>${jjwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>${jjwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.2</version>
</dependency>
<!-- JAXB is included in Java 11+ but needs explicit dependency for Java 9-10 -->
<!-- For Java 21, these are not needed as JAXB is part of JDK -->
<dependency>
<groupId>com.github.whvcse</groupId>
<artifactId>easy-captcha</artifactId>
<version>${easy-captcha}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Swagger 2 annotations for backward compatibility -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.14</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>
<version>3.1.572</version>
</dependency>
<!--minio-->
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.0.3</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.4.2.jre11</version>
</dependency>
<!-- RabbitMQ -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- redis 连接池 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<!--支付宝 SDK-->
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>4.22.57.ALL</version>
</dependency>
<!--PayPal SDK-->
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>checkout-sdk</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>rest-api-sdk</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230618</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.1</version>
</dependency>
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>26.2.0</version>
</dependency>
<!-- aws s3 -->
<!-- S3 dependency -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3-transfer-manager</artifactId>
<version>2.17.103-PREVIEW</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>kms</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3control</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<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>
<!-- 邮件发送 -->
<!-- thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.3.3</version>
</dependency>
<!-- JSON 转义恢复 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.10.0</version> <!-- 使用最新版本 -->
</dependency>
<!-- 最新版本号https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java -->
<!-- 万象SDK -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dashscope-sdk-java</artifactId>
<version>2.20.1</version>
</dependency>
<!-- FFmpeg封装JavaCV 视频转gif 全部依赖-->
<!--<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv-platform</artifactId>
<version>1.5.9</version>
</dependency>-->
<!-- javacv+javacpp核心库-->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>${javacv.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp-platform</artifactId>
<version>${javacv.version}</version>
</dependency>
<!-- 最小opencv依赖包 必须包含上面的javacv+javacpp -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv</artifactId>
<version>4.5.1-${javacv.version}</version>
<!--<classifier>${system.windowsx64}</classifier>-->
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>openblas</artifactId>
<version>0.3.13-${javacv.version}</version>
<!--<classifier>${system.windowsx64}</classifier>-->
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>flycapture</artifactId>
<version>2.13.3.31-${javacv.version}</version>
<!--<classifier>${system.windowsx64}</classifier>-->
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</dependency>
<!-- FFmpeg视频处理解决你的报错 -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg</artifactId>
<version>4.4-1.5.6</version>
<!--<classifier>${system.windowsx64}</classifier>-->
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</dependency>
<dependency>
<groupId>com.volcengine</groupId>
<artifactId>volcengine-java-sdk-ark-runtime</artifactId>
<version>0.2.43</version>
</dependency>
<!-- Google 认证库 -->
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>1.38.0</version>
</dependency>
<!-- GIFEncoder 视频转gif-->
<dependency>
<groupId>com.madgag</groupId>
<artifactId>animated-gif-lib</artifactId>
<version>1.4</version>
</dependency>
<!-- Jakarta WebSocket API -->
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-api</artifactId>
<version>2.1.1</version>
</dependency>
<!-- Spring MockMultipartFile 等测试工具,生产代码中也有引用 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<!-- BouncyCastle 加密库 -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- 本地开发环境 -->
<id>dev</id>
<properties>
<profiles.active>dev</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<!-- 测试环境 -->
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
</properties>
</profile>
<profile>
<!-- 生产环境 -->
<id>prod</id>
<properties>
<profiles.active>prod</profiles.active>
</properties>
</profile>
</profiles>
</project>

View File

@@ -3,11 +3,13 @@ package com.ai.da;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@Slf4j
@SpringBootApplication
@EnableScheduling
@EnableAsync
public class AiDaApplication {
public static void main(String[] args) {

View File

@@ -0,0 +1,95 @@
package com.ai.da.common.RabbitMQ;
import com.ai.da.common.utils.MailUtil;
import com.ai.da.model.dto.BasicEmailParamDTO;
import com.ai.da.service.EmailService;
import com.alibaba.fastjson.JSONObject;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.core.io.InputStreamSource;
import org.springframework.stereotype.Component;
import software.amazon.awssdk.core.exception.RetryableException;
import org.springframework.amqp.core.Message;
import jakarta.annotation.Resource;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
@Slf4j
@Component
public class EmailRetryConsumer {
@Resource
private MailUtil mailUtil;
@Resource
private MQPublisher mqPublisher;
@Resource
private EmailService emailService;
// @RabbitListener(queues = "#{rabbitMQProperties.deadLetter.queue}")
public void handleRetry(Map<String, String> mailParams, Message message, Channel channel) throws IOException {
long tag = message.getMessageProperties().getDeliveryTag();
try {
log.info("死信队列收到消息:{}", message);
// 处理邮件发送参数
BasicEmailParamDTO basicEmailParamDTO = JSONObject.parseObject(mailParams.get("dto"), BasicEmailParamDTO.class);
String fileName = mailParams.get("filename");
InputStreamSource inputStreamSource = Objects.isNull(mailParams.get("source")) ?
null : JSONObject.parseObject(mailParams.get("source"), InputStreamSource.class);
JSONObject templateParams = JSONObject.parseObject(mailParams.get("templateParams"), JSONObject.class);
String templateName = mailParams.get("templatePath");
long logId = Long.parseLong(mailParams.get("logId"));
basicEmailParamDTO.setContent(mailUtil.setContent(templateParams, templateName));
// 发邮件
int lastReturnCode = mailUtil.sendMail(basicEmailParamDTO, fileName, inputStreamSource);
if (lastReturnCode == 250) {
log.info("邮件发送成功Subject : {}", basicEmailParamDTO.getSubject());
emailService.updateStatus(logId, EmailService.DELIVERED);
} else if (lastReturnCode == 450) {
log.info("目标邮箱 {} 暂时不可用,请稍后重试", (Object) basicEmailParamDTO.getMailTo());
// 重试
retry(mailParams, message, channel, tag, logId);
} else if (lastReturnCode == 550) {
log.info("目标邮箱 {} 不可用,邮件发送失败", (Object) basicEmailParamDTO.getMailTo());
emailService.updateStatus(logId, EmailService.FAILED);
} else {
log.info("邮件发送失败Subject : {}, 状态码: {}", basicEmailParamDTO.getSubject(), lastReturnCode);
retry(mailParams, message, channel, tag, logId);
emailService.updateStatus(logId, EmailService.FAILED);
}
channel.basicAck(tag, false);
} catch (RetryableException e) {
log.info("邮件重试发生异常:RetryableException -> {}", e.getMessage());
channel.basicAck(tag, false); // 确认原消息
} catch (Exception e) {
log.info("邮件重试发生异常:Exception -> {}", e.getMessage());
channel.basicAck(tag, false); // 确认原消息
}
}
private int getRetryAttempt(Message message) {
Integer attempt = message.getMessageProperties()
.getHeader("x-retry-attempt");
return attempt != null ? attempt : 1;
}
private void retry(Map<String, String> mailParams, Message message, Channel channel, long tag, long logId) throws IOException{
int attempt = getRetryAttempt(message);
if (attempt >= 3) { // 最大重试次数
channel.basicReject(tag, false);
emailService.updateStatus(logId, EmailService.FAILED);
log.error("重试结束,邮件最终发送失败: {}", mailParams);
} else {
log.info("重新将邮件信息发送到重试队列");
mqPublisher.sendEmailMsg(mailParams, attempt);
channel.basicAck(tag, false); // 确认原消息
// 更新数据库
emailService.updateRetryCount(logId, attempt + 1);
}
}
}

View File

@@ -5,33 +5,50 @@ import com.ai.da.common.constant.CommonConstant;
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.model.vo.PoseTransformationVO;
import com.ai.da.service.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.rabbitmq.client.Channel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.jni.Time;
import org.apache.commons.text.StringEscapeUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
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;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@Slf4j
@Component
@RequiredArgsConstructor
public class GenerateConsumer {
@Resource
private GenerateService generateService;
private final GenerateService generateService;
@Resource
private RedisUtil redisUtil;
private final UserLikeGroupService userLikeGroupService;
private final DesignService designService;
private final CloudTaskService cloudTaskService;
private final RabbitMQProperties rabbitMQProperties;
private final RedisUtil redisUtil;
private final MessageCenterService messageCenterService;
@Value("${redis.key.orderForGenerate}")
private String consumptionOrderKey;
@@ -52,9 +69,9 @@ public class GenerateConsumer {
public void generate(Message msg, Channel channel, String consumerName) {
log.info("============start listening==========");
long start = System.currentTimeMillis();
GenerateThroughImageTextDTO generateThroughImageTextDTO = JSONObject.parseObject(msg.getBody(), GenerateThroughImageTextDTO.class);
String uniqueId = generateThroughImageTextDTO.getUniqueId();
Map<String, String> resp = jsonBytesToMap(msg, channel);
String uniqueId = resp.get("tasks_id");
// String uniqueId = generateThroughImageTextDTO.getUniqueId();
log.info("From " + consumerName + " : " + uniqueId);
try {
@@ -68,6 +85,7 @@ public class GenerateConsumer {
log.error("手动确认,不返回队列重新消费");
}
} else {
GenerateThroughImageTextDTO generateThroughImageTextDTO = JSONObject.parseObject(msg.getBody(), GenerateThroughImageTextDTO.class);
generateService.generateThroughImageText(generateThroughImageTextDTO);
// 将消息从redis排队队列中删除,需保证被消费的消息存储到db之后再从redis删除
redisUtil.removeFromZSet(consumptionOrderKey, uniqueId);
@@ -82,13 +100,13 @@ public class GenerateConsumer {
// 将消息从redis排队队列中删除,需保证被消费的消息存储到db之后再从redis删除
redisUtil.removeFromZSet(consumptionOrderKey, uniqueId);
String key = generateResultKey + ":" + uniqueId;
GenerateResultVO generateResultVO = new GenerateResultVO(generateThroughImageTextDTO.getUniqueId(), null, null, "Fail");
GenerateResultVO generateResultVO = new GenerateResultVO(uniqueId, null, null, "Fail");
redisUtil.addToString(key, new Gson().toJson(generateResultVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
} catch (IOException exception) {
log.error("手动确认,取消返回队列,不再重新消费");
}
// 将入参和错误信息存入数据库
String exceptionMessage = JSONObject.toJSONString(generateThroughImageTextDTO) +
String exceptionMessage = JSONObject.toJSONString(resp) +
" Exception message " + e.getMessage();
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(String.valueOf(uniqueId), exceptionMessage);
@@ -105,7 +123,7 @@ public class GenerateConsumer {
log.info("============ProcessGenerateResult listening==========");
long start = System.currentTimeMillis();
Map<String, String> generateResult = JSONObject.parseObject(msg.getBody(), Map.class);
Map<String, String> generateResult = jsonBytesToMap(msg, channel);
log.info("generate response : {}", generateResult);
try {
@@ -153,7 +171,7 @@ public class GenerateConsumer {
log.info("============processToProductImageResult listening==========");
long start = System.currentTimeMillis();
Map<String, String> generateResult = JSONObject.parseObject(msg.getBody(), Map.class);
Map<String, String> generateResult = jsonBytesToMap(msg, channel);
log.info("toProductImage response : {}", generateResult);
try {
@@ -163,9 +181,13 @@ 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");
generateService.updateToProductTaskStatus(generateResult.get("tasks_id"), "Fail");
redisUtil.addToString(key, new Gson().toJson(new GenerateResultVO(generateResult.get("tasks_id"), null, null, "Fail")), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
// 将异常信息存到exception中
HashMap<String, String> exceptionInfo = new HashMap<>();
@@ -200,7 +222,7 @@ public class GenerateConsumer {
log.info("============processRelightResult listening==========");
long start = System.currentTimeMillis();
Map<String, String> generateResult = JSONObject.parseObject(msg.getBody(), Map.class);
Map<String, String> generateResult = jsonBytesToMap(msg, channel);
log.info("toProductImage response : {}", generateResult);
try {
@@ -210,9 +232,13 @@ 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");
generateService.updateToProductTaskStatus(generateResult.get("tasks_id"), "Fail");
redisUtil.addToString(key, new Gson().toJson(new GenerateResultVO(generateResult.get("tasks_id"), null, null, "Fail")), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
// 将异常信息存到exception中
HashMap<String, String> exceptionInfo = new HashMap<>();
@@ -243,75 +269,393 @@ public class GenerateConsumer {
log.info("============ProcessRelightResult End listening==========");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
public void processPoseTransformResult(Message msg, Channel channel) {
log.info("============ProcessPoseTransformResult listening==========");
long start = System.currentTimeMillis();
Map<String, String> generateResult = jsonBytesToMap(msg, channel);
log.info("PoseTransformation response : {}", generateResult);
try {
log.info("tasks_id : {} start ", generateResult.get("tasks_id"));
if (generateResult.get("status").equals("SUCCESS")) {
String gifUrl = generateResult.get("gif_url");
String taskId = generateResult.get("tasks_id");
String videoUrl = generateResult.get("video_url");
String imageUrl = generateResult.get("image_url");
generateService.processPoseTransformResult(taskId, gifUrl, videoUrl, imageUrl);
} else {
// 修改redis中的数据状态为exception
String key = generateResultKey + ":" + generateResult.get("tasks_id");
generateService.updatePoseTransferStatus(generateResult.get("tasks_id"), "Fail", null);
redisUtil.addToString(key, new Gson().toJson(new PoseTransformationVO(null, generateResult.get("tasks_id"),null, null, null, (byte)0, "Fail")), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
// 将异常信息存到exception中
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(generateResult.get("tasks_id"), generateResult.get("message"));
// 存redis
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
// 记录失败状态并向用户发送提示消息
generateService.processPTFailSituation(generateResult.get("tasks_id"));
}
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage());
try {
channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
// 将消息从redis排队队列中删除,需保证被消费的消息存储到db之后再从redis删除
redisUtil.removeFromZSet(consumptionOrderKey, generateResult.get("tasks_id"));
} catch (IOException exception) {
log.error("手动确认,取消返回队列,不再重新消费");
}
// 将入参和错误信息存入数据库
String exceptionMessage = JSONObject.toJSONString(generateResult) +
" Exception message " + e.getMessage();
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(String.valueOf(generateResult.get("tasks_id")), exceptionMessage);
// 存redis
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
// 记录失败状态并向用户发送提示消息
generateService.processPTFailSituation(generateResult.get("tasks_id"));
}
long end = System.currentTimeMillis();
log.info("tasks_id : {}, end , message : {}, 执行时长: {} 毫秒", generateResult.get("tasks_id"), generateResult.get("message"), (end - start));
log.info("============ProcessPoseTransformResult End listening==========");
}
public static Map<String, String> jsonBytesToMap(Message msg, Channel channel) {
try {
// 1. byte[] -> String
String jsonString = new String(msg.getBody(), StandardCharsets.UTF_8).trim();
// 2. 处理可能的双重转义
if (jsonString.startsWith("\"") && jsonString.endsWith("\"")) {
jsonString = jsonString.substring(1, jsonString.length() - 1);
// 使用 Apache Commons Text 将 JSON 字符串中的转义字符还原为原始字符
jsonString = StringEscapeUtils.unescapeJson(jsonString);
}
// 3. 验证 JSON 格式
if (!isValidJson(jsonString)) {
throw new IllegalArgumentException("Invalid JSON format");
}
// 4. 解析为 Map
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(jsonString, new TypeReference<Map<String, String>>() {});
} catch (Exception e) {
log.error("消息解析失败: {}", e.getMessage(), e);
try {
// 仅对不可恢复错误(如非 JSON 数据)进行 ACK
if (e instanceof JsonParseException || e instanceof IllegalArgumentException) {
channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
log.warn("因消息格式错误,已确认并丢弃消息。原始消息为:{}", msg);
}
} catch (IOException ex) {
log.error("消息确认失败: {}", ex.getMessage(), ex);
}
throw new RuntimeException("Failed to parse JSON to Map", e);
}
}
// 辅助方法:验证字符串是否为合法 JSON
private static boolean isValidJson(String json) {
try {
new ObjectMapper().readTree(json);
return true;
} catch (Exception e) {
return false;
}
}
private void processDesignBatchResult(Message msg, Channel channel) {
log.info("============processDesignBatchResult listening==========");
long start = System.currentTimeMillis();
Map<String, Object> generateResult = JSONObject.parseObject(msg.getBody(), Map.class);
log.info("designBatch response : {}", generateResult);
designService.processDesignBatch(generateResult);
}
private void processToProductImageBatchResult(Message msg, Channel channel) {
log.info("============processToProductImageResultBatch listening==========");
long start = System.currentTimeMillis();
JSONObject generateResult = JSONObject.parseObject(msg.getBody(), JSONObject.class);
log.info("toProductImageBatch response : {}", generateResult);
try {
log.info("task_id : {} start ", generateResult.get("task_id"));
if (!StringUtils.isEmpty(generateResult.getString("progress"))) {
String progress = generateResult.getString("progress");
String url = null;
if (!progress.startsWith("0") && !progress.equals("OK")) {
JSONObject result = generateResult.getJSONObject("result");
if (Objects.nonNull(result)) {
url = result.getString("product_img");
String taskId = generateResult.getString("task_id");
userLikeGroupService.toProductBatch(taskId, url, progress);
}
} else if (progress.startsWith("0/")) {
String batchTaskId = generateResult.getString("task_id");
if (!StringUtils.isEmpty(batchTaskId)) {
cloudTaskService.startTask(batchTaskId);
}
} else if (progress.equals("OK")) {
String batchTaskId = generateResult.getString("task_id");
if (!StringUtils.isEmpty(batchTaskId)) {
cloudTaskService.completeTask(batchTaskId);
}
}
} else {
// 修改redis中的数据状态为exception
String key = toProductImageResultKey + ":" + generateResult.get("task_id");
generateService.updateToProductTaskStatus(generateResult.getString("task_id"), "Fail");
redisUtil.addToString(key, new Gson().toJson(new GenerateResultVO(generateResult.getString("tasks_id"), null, null, "Fail")), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
// 将异常信息存到exception中
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(generateResult.getString("task_id"), generateResult.getString("data"));
// 存redis
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
}
} catch (Exception e) {
log.error(e.getMessage());
try {
channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
// 将消息从redis排队队列中删除,需保证被消费的消息存储到db之后再从redis删除
redisUtil.removeFromZSet(consumptionOrderKey, generateResult.getString("task_id"));
} catch (IOException exception) {
log.error("手动确认,取消返回队列,不再重新消费");
}
// 将入参和错误信息存入数据库
String exceptionMessage = JSONObject.toJSONString(generateResult) +
" Exception message " + e.getMessage();
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(String.valueOf(generateResult.get("task_id")), exceptionMessage);
// 存redis
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
}
long end = System.currentTimeMillis();
log.info("task_id : {}, end , message : {}, 执行时长: {} 毫秒", generateResult.get("task_id"), generateResult.get("message"), (end - start));
log.info("============ProcessToProductImageBatchResult End listening==========");
}
private void processRelightBatchResult(Message msg, Channel channel) {
log.info("============processRelightResult listening==========");
long start = System.currentTimeMillis();
JSONObject generateResult = JSONObject.parseObject(msg.getBody(), JSONObject.class);
log.info("relightBatch response : {}", generateResult);
try {
log.info("task_id : {} start ", generateResult.get("task_id"));
if (!StringUtils.isEmpty(generateResult.getString("progress"))) {
String progress = generateResult.getString("progress");
String url = null;
if (!progress.startsWith("0") && !progress.equals("OK")) {
JSONObject result = generateResult.getJSONObject("result");
if (Objects.nonNull(result)) {
url = result.getString("relight_img");
String taskId = generateResult.getString("task_id");
userLikeGroupService.relightBatch(taskId, url, progress);
}
} else if (progress.startsWith("0/")) {
String batchTaskId = generateResult.getString("task_id");
if (!StringUtils.isEmpty(batchTaskId)) {
cloudTaskService.startTask(batchTaskId);
}
} else if (progress.equals("OK")) {
String batchTaskId = generateResult.getString("task_id");
if (!StringUtils.isEmpty(batchTaskId)) {
cloudTaskService.completeTask(batchTaskId);
}
}
} else {
// 修改redis中的数据状态为exception
String key = relightResultKey + ":" + generateResult.get("task_id");
generateService.updateToProductTaskStatus(generateResult.getString("task_id"), "Fail");
redisUtil.addToString(key, new Gson().toJson(new GenerateResultVO(generateResult.getString("tasks_id"), null, null, "Fail")), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
// 将异常信息存到exception中
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(generateResult.getString("task_id"), generateResult.getString("data"));
// 存redis
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
}
} catch (Exception e) {
log.error(e.getMessage());
try {
channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
// 将消息从redis排队队列中删除,需保证被消费的消息存储到db之后再从redis删除
redisUtil.removeFromZSet(consumptionOrderKey, generateResult.getString("task_id"));
} catch (IOException exception) {
log.error("手动确认,取消返回队列,不再重新消费");
}
// 将入参和错误信息存入数据库
String exceptionMessage = JSONObject.toJSONString(generateResult) +
" Exception message " + e.getMessage();
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(String.valueOf(generateResult.get("task_id")), exceptionMessage);
// 存redis
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
}
long end = System.currentTimeMillis();
log.info("task_id : {}, end , message : {}, 执行时长: {} 毫秒", generateResult.get("task_id"), generateResult.get("message"), (end - start));
log.info("============ProcessRelightBatchResult End listening==========");
}
private void processPoseTransformBatchResult(Message msg, Channel channel) {
log.info("============ProcessPoseTransformBatchResult listening==========");
long start = System.currentTimeMillis();
JSONObject generateResult = JSONObject.parseObject(msg.getBody(), JSONObject.class);
log.info("PoseTransformationBatch response : {}", generateResult);
try {
log.info("task_id : {} start ", generateResult.get("task_id"));
if (!StringUtils.isEmpty(generateResult.getString("progress"))) {
String progress = generateResult.getString("progress");
String taskId = generateResult.getString("task_id");
generateService.processPoseTransformResultBatch(progress, taskId);
JSONArray result = generateResult.getJSONArray("result");
if (!StringUtils.isEmpty(result)) {
JSONObject jsonObject = result.getJSONObject(0);
String gifUrl = jsonObject.getString("gif_url");
String videoUrl = jsonObject.getString("video_url");
String imageUrl = jsonObject.getString("first_image_url");
generateService.processPoseTransformResultBatch(taskId, gifUrl, videoUrl, imageUrl, progress);
}
} else {
// 修改redis中的数据状态为exception
String key = generateResultKey + ":" + generateResult.getString("task_id");
generateService.updatePoseTransferStatus(generateResult.getString("task_id"), "Fail", null);
redisUtil.addToString(key, new Gson().toJson(new PoseTransformationVO(null, generateResult.getString("task_id"),null, null, null, (byte)0, "Fail")), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
// 将异常信息存到exception中
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(generateResult.getString("task_id"), generateResult.getString("message"));
// 存redis
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
}
} catch (Exception e) {
log.error(e.getMessage());
try {
channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
// 将消息从redis排队队列中删除,需保证被消费的消息存储到db之后再从redis删除
redisUtil.removeFromZSet(consumptionOrderKey, generateResult.getString("task_id"));
} catch (IOException exception) {
log.error("手动确认,取消返回队列,不再重新消费");
}
// 将入参和错误信息存入数据库
String exceptionMessage = JSONObject.toJSONString(generateResult) +
" Exception message " + e.getMessage();
HashMap<String, String> exceptionInfo = new HashMap<>();
exceptionInfo.put(generateResult.getString("task_id"), exceptionMessage);
// 存redis
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
}
long end = System.currentTimeMillis();
log.info("tasks_id : {}, end , message : {}, 执行时长: {} 毫秒", generateResult.get("tasks_id"), generateResult.get("message"), (end - start));
log.info("============ProcessPoseTransformResult End listening==========");
}
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer1(Message msg, Channel channel) {
generate(msg, channel, "consumer 1");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer2(Message msg, Channel channel) {
generate(msg, channel, "consumer 2");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer3(Message msg, Channel channel) {
generate(msg, channel, "consumer 3");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer4(Message msg, Channel channel) {
generate(msg, channel, "consumer 4");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer5(Message msg, Channel channel) {
generate(msg, channel, "consumer 5");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer6(Message msg, Channel channel) {
generate(msg, channel, "consumer 6");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer7(Message msg, Channel channel) {
generate(msg, channel, "consumer 7");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer8(Message msg, Channel channel) {
generate(msg, channel, "consumer 8");
}
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
@RabbitHandler
public void generateConsumer9(Message msg, Channel channel) {
generate(msg, channel, "consumer 9");
}
@RabbitListener(queues = MQConfig.GENERATE_RESULT_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.generateResult}")
@RabbitHandler
public void getGenerateResult(Message msg, Channel channel) {
processGenerateResult(msg, channel);
}
@RabbitListener(queues = MQConfig.TO_PRODUCT_IMAGE_RESULT_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.toProductImageResult}")
@RabbitHandler
public void getToProductImageResult(Message msg, Channel channel) {
processToProductImageResult(msg, channel);
}
@RabbitListener(queues = MQConfig.RELIGHT_RESULT_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.relightResult}")
@RabbitHandler
public void getRelightResult(Message msg, Channel channel) {
processRelightResult(msg, channel);
}
@RabbitListener(queues = "#{rabbitMQProperties.queues.poseTransform}")
@RabbitHandler
public void getPoseTransformationResult(Message msg, Channel channel) {
processPoseTransformResult(msg, channel);
}
// @RabbitListener(queues = "#{rabbitMQProperties.queues.designBatch}")
// @RabbitHandler
// public void getDesignBatchResult(Message msg, Channel channel) {
// processDesignBatchResult(msg, channel);
// }
// @RabbitListener(queues = "#{rabbitMQProperties.queues.toProductImageBatch}")
// @RabbitHandler
// public void getToProductImageBatchResult(Message msg, Channel channel) {
// processToProductImageBatchResult(msg, channel);
// }
//
// @RabbitListener(queues = "#{rabbitMQProperties.queues.relightBatch}")
// @RabbitHandler
// public void getRelightBatchResult(Message msg, Channel channel) {
// processRelightBatchResult(msg, channel);
// }
//
// @RabbitListener(queues = "#{rabbitMQProperties.queues.poseTransformBatch}")
// @RabbitHandler
// public void getPoseTransformBatchResult(Message msg, Channel channel) {
// processPoseTransformBatchResult(msg, channel);
// }
}

View File

@@ -1,66 +1,82 @@
package com.ai.da.common.RabbitMQ;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MQConfig {
public static final String GENERATE_EXCHANGE_FANOUT = "generate-exchange";
// public static final String GENERATE_QUEUE = "generate-queue-prod";
// public static final String GENERATE_QUEUE = "generate-queue-test";
// ==================================================================
// public static final String GENERATE_QUEUE = "generate-queue-local";
// public static final String GENERATE_QUEUE = "generate-queue-dev";
public static final String GENERATE_QUEUE = "generate-queue-prod";
//
// public static final String SR_QUEUE = "SR-queue-local";
// public static final String SR_QUEUE = "SR-queue-dev";
public static final String SR_QUEUE = "SR-queue-prod";
//
// public static final String SR_RESULT_QUEUE = "SuperResolution-local";
// public static final String SR_RESULT_QUEUE = "SuperResolution-dev";
public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
//
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod";
public static final String RELIGHT_RESULT_QUEUE = "Relight-prod";
public MQConfig() {
}
// @Bean
// FanoutExchange fanoutRasaExchange() {
// return new FanoutExchange(GENERATE_EXCHANGE_FANOUT);
// }
/**
* 创建队列,使用工作模式,不用定义交换机
*/
@Bean
public Queue generateQueue() {
return new Queue(GENERATE_QUEUE);
}
@Bean
public Queue SRQueue() {
return new Queue(SR_QUEUE);
}
@Bean
public Queue SRResultQueue() {
return new Queue(SR_RESULT_QUEUE);
}
/**
* 将队列绑定到交换机上【队列订阅交换机】
*/
// @Bean
// Binding bindingExchangeRasa() {
// return BindingBuilder.bind(queueRasa()).to(fanoutRasaExchange());
// }
}
package com.ai.da.common.RabbitMQ;
import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MQConfig {
@Autowired
private RabbitMQProperties rabbitMQProperties;
@Bean
public Queue generateQueue() {
return new Queue(rabbitMQProperties.getQueues().getGenerate());
}
@Bean
public Queue SRQueue() {
return new Queue(rabbitMQProperties.getQueues().getSr());
}
@Bean
public Queue SRResultQueue() {
return new Queue(rabbitMQProperties.getQueues().getSrResult());
}
@Bean
public Queue generateResultQueue() {
return new Queue(rabbitMQProperties.getQueues().getGenerateResult());
}
@Bean
public Queue toProductImageResultQueue() {
return new Queue(rabbitMQProperties.getQueues().getToProductImageResult());
}
@Bean
public Queue relightResultQueue() {
return new Queue(rabbitMQProperties.getQueues().getRelightResult());
}
@Bean
public Queue poseTransformQueue() {
return new Queue(rabbitMQProperties.getQueues().getPoseTransform());
}
@Bean
public Queue mailRetryQueue() {
// 普通队列不绑定DLX首次失败后才进入MQ
// durable 持久化队列
return QueueBuilder.durable(rabbitMQProperties.getQueues().getEmailRetry())
// 关键参数:绑定死信交换机
.withArgument("x-dead-letter-exchange", rabbitMQProperties.getDeadLetter().getExchange())
// 可选:指定死信路由键(默认使用原消息的路由键)
.withArgument("x-dead-letter-routing-key", rabbitMQProperties.getDeadLetter().getRoutingKey())
.build();
}
// 新增死信交换机
@Bean
public DirectExchange deadLetterExchange() {
return new DirectExchange(rabbitMQProperties.getDeadLetter().getExchange());
}
// 新增死信队列
@Bean
public Queue deadLetterQueue() {
return QueueBuilder.durable(rabbitMQProperties.getDeadLetter().getQueue()).build();
}
// 绑定死信队列
@Bean
public Binding deadLetterBinding() {
return BindingBuilder.bind(deadLetterQueue())
.to(deadLetterExchange())
.with(rabbitMQProperties.getDeadLetter().getRoutingKey());
}
}

View File

@@ -1,28 +1,56 @@
package com.ai.da.common.RabbitMQ;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
public class MQPublisher {
// private final String url = "http://localhost:15672/api/queues/%2f/generate-queue";
@Resource
private AmqpTemplate amqpTemplate;
public void sendGenerateMessage(String mm) {
log.info("send message:" + mm);
amqpTemplate.convertAndSend(MQConfig.GENERATE_QUEUE, mm);
}
public void sendSRMessage(String mm) {
log.info("send message:" + mm);
amqpTemplate.convertAndSend(MQConfig.SR_QUEUE, mm);
}
}
package com.ai.da.common.RabbitMQ;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import jakarta.annotation.Resource;
import java.util.Map;
@Slf4j
@Component
public class MQPublisher {
@Autowired
private RabbitMQProperties rabbitMQProperties;
@Autowired
private AmqpTemplate amqpTemplate;
public void sendGenerateMessage(String mm) {
log.info("send generate message: {}", mm);
amqpTemplate.convertAndSend(rabbitMQProperties.getQueues().getGenerate(), mm);
}
public void sendSRMessage(String mm) {
log.info("send message: {}", mm);
amqpTemplate.convertAndSend(rabbitMQProperties.getQueues().getSr(), mm);
}
/**
*
* @param mailParams 含有的字段
* {"dto": basicEmailParamDTO, "filename": fileName, "source": inputStreamSource,
* "templateParams": jsonObject, "templatePath": path}
* 邮件发送参数,附件文件名,附件数据
* @param retryTimes 重试次数初始为0
*/
public void sendEmailMsg(Map<String, String> mailParams, int retryTimes){
log.info("send email MQ message: {} ", mailParams);
// // 重新入队(指数退避) 时间单位:毫秒
long newDelay = (long) (5000 * Math.pow(2, retryTimes + 1));
log.info("send email MQ delay: {} ms, retry attempt: {}", newDelay, retryTimes + 1);
amqpTemplate.convertAndSend(
rabbitMQProperties.getQueues().getEmailRetry(),
mailParams,
m -> {
m.getMessageProperties().setExpiration(String.valueOf(newDelay));
m.getMessageProperties().setHeader("x-retry-attempt", retryTimes + 1);
return m;
}
);
}
}

View File

@@ -0,0 +1,45 @@
package com.ai.da.common.RabbitMQ;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "rabbitmq")
@Data
public class RabbitMQProperties {
private Queues queues;
private Exchange exchange;
private DeadLetter deadLetter; // 新增死信配置
@Data
public static class Queues {
private String generate;
private String sr;
private String srResult;
private String generateResult;
private String toProductImageResult;
private String relightResult;
private String poseTransform;
private String emailRetry;
private String designBatch;
private String relightBatch;
private String toProductImageBatch;
private String poseTransformBatch;
}
@Data
public static class Exchange {
private String generate;
}
// 新增死信配置内部类
@Data
public static class DeadLetter {
private String exchange;
private String queue;
private String routingKey;
}
}

View File

@@ -15,10 +15,11 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
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 javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.HashMap;
@@ -27,6 +28,9 @@ import java.util.HashMap;
@Component
public class SRConsumer {
@Autowired
private RabbitMQProperties rabbitMQProperties;
@Resource
private RedisUtil redisUtil;
@@ -204,7 +208,7 @@ public class SRConsumer {
redisUtil.removeFromZSet(consumptionOrderKey, uniqueId);
} catch (Exception exception) {
log.error("手动确认,取消返回队列,不再重新消费");
throw new BusinessException("发生错误,手动确认消息");
throw new BusinessException("message.confirm.fail");
}
// 将入参和错误信息存入redis
String exceptionMessage = JSONObject.toJSONString(superResolutionDTO) +
@@ -218,14 +222,13 @@ public class SRConsumer {
taskListService.updateTaskStatusOrOutputRedis(uniqueId, "fail", null);
}
@RabbitListener(queues = MQConfig.SR_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.sr}")
@RabbitHandler
public void SRConsumer1(Message msg, Channel channel) {
superResolution(msg, channel, "consumer 1");
}
@RabbitListener(queues = MQConfig.SR_RESULT_QUEUE)
@RabbitListener(queues = "#{rabbitMQProperties.queues.srResult}")
@RabbitHandler
public void SRResultConsumer1(Message msg, Channel channel) {
getSRResult(msg, channel, "consumer 1");

View File

@@ -6,7 +6,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
@Configuration
//加载配置文件

View File

@@ -0,0 +1,21 @@
package com.ai.da.common.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
@Configuration
public class AsyncConfig {
@Bean("asyncTaskExecutor")
public Executor asyncTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(5);
executor.setMaxPoolSize(10);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("Async-ImageToSketch-");
executor.initialize();
return executor;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,260 @@
package com.ai.da.common.config;
import com.ai.da.common.utils.MinioUtil;
import com.ai.da.mapper.primary.ThreeDDetailMapper;
import com.ai.da.mapper.primary.ThreeDLayoutMapper;
import com.ai.da.mapper.primary.ThreeDPatternLayoutMapper;
import com.ai.da.mapper.primary.ThreeDSimpleMapper;
import com.ai.da.mapper.primary.entity.ThreeDDetail;
import com.ai.da.mapper.primary.entity.ThreeDLayout;
import com.ai.da.mapper.primary.entity.ThreeDPatternLayout;
import com.ai.da.mapper.primary.entity.ThreeDSimple;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Slf4j
@Component
public class ThreeDSave {
@Resource
private ThreeDDetailMapper threeDDetailMapper;
@Resource
private ThreeDSimpleMapper threeDSimpleMapper;
@Resource
private MinioUtil minioUtil;
@Resource
private ThreeDLayoutMapper threeDLayoutMapper;
@Resource
private ThreeDPatternLayoutMapper threeDPatternLayoutMapper;
@PostConstruct
public void test() {
// minioSave();
// frontBackDataCreate();
// patternDataCreate();
}
private void patternDataCreate() {
QueryWrapper<ThreeDSimple> qw = new QueryWrapper<>();
qw.lambda().eq(ThreeDSimple::getGender, "female");
qw.lambda().ne(ThreeDSimple::getId, 1);
List<ThreeDSimple> threeDSimpleList = threeDSimpleMapper.selectList(qw);
List<Integer> numbers = new ArrayList<>();
String patternPath = "C:\\workspace\\3D\\3D虚拟 1-7\\6.版文件、dxf文件\\女装系列(1)\\女装系列\\56款打版截图";
File directory = new File(patternPath);
if (directory.exists() && directory.isDirectory()) {
// 获取目录下的所有文件名,并建立编号 -> 文件名的映射
Map<Integer, String> fileMap = Arrays.stream(directory.listFiles())
.filter(File::isFile) // 只获取文件
.map(File::getName) // 获取文件名
.collect(Collectors.toMap(
name -> {
Matcher matcher = Pattern.compile("^\\d+").matcher(name);
return matcher.find() ? Integer.parseInt(matcher.group()) : -1;
},
name -> name,
(existing, replacement) -> existing // 处理重复情况,保留原有值
));
for (ThreeDSimple threeDSimple : threeDSimpleList) {
String name = threeDSimple.getName();
Pattern pattern = Pattern.compile("^\\d+"); // 匹配开头的数字
Matcher matcher = pattern.matcher(name);
if (matcher.find()) {
int number = Integer.parseInt(matcher.group());
numbers.add(number);
// 匹配对应文件夹,并获取文件
if (fileMap.containsKey(number)) {
String matchedFolder = fileMap.get(number);
File folder = new File(directory, matchedFolder);
ThreeDPatternLayout threeDPatternLayout = new ThreeDPatternLayout();
threeDPatternLayout.setThreeDSimpleId(threeDSimple.getId());
threeDPatternLayout.setName(matchedFolder);
String minioUrl = "aida-threed/female/pattern-layout/" + matchedFolder;
minioUtil.upload(minioUrl, folder);
threeDPatternLayout.setUrl(minioUrl);
// threeDPatternLayoutMapper.insert(threeDPatternLayout);
}
}
}
System.out.println("文件编号映射:" + fileMap);
}
}
private void frontBackDataCreate() {
QueryWrapper<ThreeDSimple> qw = new QueryWrapper<>();
qw.lambda().eq(ThreeDSimple::getGender, "female");
// qw.lambda().ne(ThreeDSimple::getId, 1);
List<ThreeDSimple> threeDSimpleList = threeDSimpleMapper.selectList(qw);
List<Integer> numbers = new ArrayList<>();
// 文件夹名列表
String path = "C:\\workspace\\3D\\3D虚拟 1-7\\3D服装真反面整理\\female"; // 目标路径
File directory = new File(path);
if (directory.exists() && directory.isDirectory()) {
// 获取文件夹名列表,并建立编号 -> 文件夹名的映射
Map<Integer, String> folderMap = Arrays.stream(directory.listFiles())
.filter(File::isDirectory)
.map(File::getName)
.collect(Collectors.toMap(
name -> {
Matcher matcher = Pattern.compile("^\\d+").matcher(name);
return matcher.find() ? Integer.parseInt(matcher.group()) : -1;
},
name -> name,
(existing, replacement) -> existing // 处理重复情况,保留原有值
));
System.out.println("文件夹编号映射:" + folderMap);
for (ThreeDSimple threeDSimple : threeDSimpleList) {
String name = threeDSimple.getName();
Pattern pattern = Pattern.compile("^\\d+"); // 匹配开头的数字
Matcher matcher = pattern.matcher(name);
if (matcher.find()) {
int number = Integer.parseInt(matcher.group());
numbers.add(number);
// 匹配对应文件夹,并获取文件
if (folderMap.containsKey(number)) {
String matchedFolder = folderMap.get(number);
File folder = new File(directory, matchedFolder);
if (folder.exists() && folder.isDirectory()) {
for (File file : folder.listFiles()) {
String fileName = file.getName(); // 去掉后缀
ThreeDLayout threeDLayout = new ThreeDLayout();
threeDLayout.setGender("female");
threeDLayout.setThreeDSimpleId(threeDSimple.getId());
threeDLayout.setName(file.getName());
if (fileName.startsWith("")) {
threeDLayout.setType("front");
}else if (fileName.startsWith("")) {
threeDLayout.setType("back");
}
String minioUrl = "aida-threed/female/layout/" + folderMap.get(number) + " " + file.getName();
minioUtil.upload(minioUrl, file);
threeDLayout.setUrl(minioUrl);
// threeDLayoutMapper.insert(threeDLayout);
}
}
}
}
}
System.out.println(numbers);
} else {
System.out.println("路径不存在或不是文件夹");
}
}
private void minioSave() {
// 指定目标文件夹路径
String folderPath = "C:\\workspace\\3D\\3D虚拟 1-7\\3D服装整理\\maleZip";
// 创建文件对象
File folder = new File(folderPath);
// 检查文件夹是否存在且是目录
if (folder.exists() && folder.isDirectory()) {
// 获取所有 .zip 文件
File[] zipFiles = folder.listFiles((dir, name) -> name.toLowerCase().endsWith(".zip"));
List<String> zipFileNameList = new ArrayList<>();
// 输出文件名
if (zipFiles != null) {
for (File file : zipFiles) {
String zipFileName = file.getName();
String[] split = zipFileName.split("_");
String zipName = split[0];
String sizeWithSuffix = split[1];
String[] sizeWithSuffixSplit = sizeWithSuffix.split("\\.");
String size = sizeWithSuffixSplit[0];
// 找到第一个字母的位置
int index = 0;
while (index < size.length() && Character.UnicodeBlock.of(size.charAt(index)) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS) {
index++;
}
if (index > 0 && index < size.length()) {
String prefix = size.substring(0, index); // "亚码"
String suffix = size.substring(index); // "L"
ThreeDDetail threeDDetail = new ThreeDDetail();
threeDDetail.setName(zipFileName);
String url = "aida-threed/male/zip/" + zipFileName;
threeDDetail.setGender("male");
threeDDetail.setSizeType(prefix);
threeDDetail.setSize(suffix);
threeDDetail.setUrl(url);
// threeDDetailMapper.insert(threeDDetail);
minioUtil.upload(url, file);
QueryWrapper<ThreeDSimple> qw = new QueryWrapper<>();
qw.lambda().eq(ThreeDSimple::getName, zipName);
qw.lambda().eq(ThreeDSimple::getGender, "male");
List<ThreeDSimple> threeDSimples = threeDSimpleMapper.selectList(qw);
if (CollectionUtils.isEmpty(threeDSimples)) {
ThreeDSimple threeDSimple = new ThreeDSimple();
threeDSimple.setName(zipName);
threeDSimple.setGender("male");
String glbPath = "C:\\workspace\\3D\\3D虚拟 1-7\\3D服装整理\\male\\" + zipName + "\\" +"亚码L";
File glbFolder = new File(glbPath);
// 查找 .glb 文件
if (glbFolder.exists() && glbFolder.isDirectory()) {
File[] glbFiles = glbFolder.listFiles((dir, name) -> name.toLowerCase().endsWith(".glb"));
if (glbFiles != null && glbFiles.length > 0) {
for (File glbFile : glbFiles) {
String name = glbFile.getName();
String glbUrl = "aida-threed/male/glb/" + name;
threeDSimple.setUrl(glbUrl);
minioUtil.upload(glbUrl, glbFile);
}
} else {
System.out.println("未找到 GLB 文件。" + glbFolder);
}
} else {
System.out.println("GLB 文件夹不存在: " + glbPath);
}
// threeDSimpleMapper.insert(threeDSimple);
threeDDetail.setThreeDSimpleId(threeDSimple.getId());
threeDDetailMapper.updateById(threeDDetail);
}else {
Long id = threeDSimples.get(0).getId();
threeDDetail.setThreeDSimpleId(id);
threeDDetailMapper.updateById(threeDDetail);
}
} else {
}
}
} else {
System.out.println("未找到 ZIP 文件。");
}
log.info("aaa");
} else {
System.out.println("文件夹不存在或不是一个目录。");
}
}
}

View File

@@ -1,42 +1,42 @@
package com.ai.da.common.config;
import org.hibernate.validator.HibernateValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
static final String ORIGINS[] = new String[]{"GET", "POST", "PUT", "DELETE"};
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOrigins("*").allowCredentials(true).allowedMethods(ORIGINS).maxAge(3600);
}
@Bean
public Validator validator() {
ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class)
.configure()
//failFast为true出现校验失败的情况立即结束校验不再进行后续的校验
.failFast(true)
.buildValidatorFactory();
return validatorFactory.getValidator();
}
@Bean
public MethodValidationPostProcessor methodValidationPostProcessor() {
MethodValidationPostProcessor methodValidationPostProcessor = new MethodValidationPostProcessor();
methodValidationPostProcessor.setValidator(validator());
return methodValidationPostProcessor;
}
}
package com.ai.da.common.config;
import org.hibernate.validator.HibernateValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;
@Configuration
public class WebConfig implements WebMvcConfigurer {
static final String ORIGINS[] = new String[]{"GET", "POST", "PUT", "DELETE"};
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOriginPatterns("*").allowCredentials(true).allowedMethods(ORIGINS).maxAge(3600);
}
@Bean
public Validator validator() {
ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class)
.configure()
//failFast为true出现校验失败的情况立即结束校验不再进行后续的校验
.failFast(true)
.buildValidatorFactory();
return validatorFactory.getValidator();
}
@Bean
public MethodValidationPostProcessor methodValidationPostProcessor() {
MethodValidationPostProcessor methodValidationPostProcessor = new MethodValidationPostProcessor();
methodValidationPostProcessor.setValidator(validator());
return methodValidationPostProcessor;
}
}

View File

@@ -5,6 +5,7 @@ import com.ai.da.common.response.ResultEnum;
import com.ai.da.model.enums.Language;
import com.ai.da.model.vo.AuthPrincipalVo;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -20,6 +21,7 @@ import java.util.ResourceBundle;
* @create: 2020-01-01 17:24
**/
@Data
@Slf4j
public class BusinessException extends RuntimeException {
private Integer code;

View File

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

View File

@@ -1,37 +0,0 @@
package com.ai.da.common.config.swagger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
@Configuration
@EnableSwagger2WebMvc
public class AidaConfiguration {
@Bean(value = "IntelligentCurtainApis")
public Docket gxyd5aThemeApis() {
Contact contact = new Contact("Mr.Y", "", "136");
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(new ApiInfoBuilder()
.description("aida接口文档")
.contact(contact)
.termsOfServiceUrl("暂无")
.version("1.0")
.build())
//分组名称
.groupName("1.0")
.select()
//这里指定Controller扫描包路径
.apis(RequestHandlerSelectors.basePackage("com.ai.da.controller"))
.paths(PathSelectors.any())
.build();
return docket;
}
}

View File

@@ -0,0 +1,9 @@
package com.ai.da.common.constant;
public class AffiliateConstants {
public static final String STATUS_ACTIVE = "Active";
public static final String STATUS_INACTIVE = "Inactive";
public static final String STATUS_DELETE = "Delete";
public static final Integer DELETED = 1;
public static final Integer NOT_DELETED = 0;
}

View File

@@ -1,5 +1,8 @@
package com.ai.da.common.constant;
import java.util.Arrays;
import java.util.List;
public class CommonConstant {
// 单位 秒 10分钟过期
// public static final Long TASK_EXPIRE_TIME = 24 * 60 * 60L;
@@ -10,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;
@@ -27,10 +32,66 @@ public class CommonConstant {
public static final String GENERATE_LOGO_SINGLE_CANCEL = "/api/generate_single_logo_cancel/";
// public static final String POSE_TRANSFORMATION_CANCEL = "/api/pose_transform_cancel/";
public static final String POSE_TRANSFORMATION_CANCEL = "/api/comfyui_i_2_video_cancel/";
public static final String PYTHON_PORT_9996 = "9996";
public static final String PYTHON_PORT_9997 = "9997";
public static final List<String> AGES_EN = Arrays.asList("Below 20", "20-30", "30-40", "40+");
public static final List<String> AGES_CN = Arrays.asList("20岁以下", "20-30岁", "30-40岁", "40+岁");
public static final List<String> IF_HELPFUL_EN = Arrays.asList("Easy to learn and use", "Easy to get trend information",
"Lots of creative design proposals","The AIGC functions for moodboard is helpful","The AIGC functions for design sketches is helpful",
"Easy to select the right color","The Chatbot function is helpful","The print position function is helpful",
"The drawing function is helpful","The export function is useful","Easy to edit the design","Others");
public static final List<String> IF_HELPFUL_CN = Arrays.asList("易于学习和使用", "容易获取趋势信息",
"提供大量创意设计方案","AIGC功能对灵感板有帮助","AIGC功能对设计草图有帮助",
"容易选择合适的颜色","聊天机器人功能有帮助","打印位置功能有帮助",
"绘图功能有帮助","导出功能有用","设计编辑简单","其他");
public static final List<String> IF_IMPROVE_EN = Arrays.asList("Proposed designs are boring, need more interesting designs",
"Difficult to make changes on design","Only 2D output, no 3D results","Difficult to apply keywords for AIGC generation",
"Clothing is not in the right proportion","Not compatible with pattern making solutions","Improved user interface for better navigation",
"Lack of responsive customer support","Insufficient tutorial or guidance for new users","Limited personalization options for designs","Others");
public static final List<String> IF_IMPROVE_CN = Arrays.asList("提供的设计很无聊,需要更多有趣的设计",
"设计修改困难","只有2D输出没有3D结果","难以选择合适的关键词应用于AIGC生成",
"服装比例不正确","与打版解决方案不兼容","改进用户界面以便更好导航",
"客户支持响应不及时","对新用户的教程或指导不足","设计个性化选项有限","其他");
public static final List<String> IS_SUBSCRIBE = Arrays.asList("yes", "no");
// public static final String DEFAULT_AVATAR = "aida-users/87/avatar/default.jpg";
public static final String DEFAULT_AVATAR = "aida-users/87/avatar/default.png";
/* 截止至2024/08/26在Code-Create DB中pmr_users表中最大的用户id */
public static final Long MAXIMUM_USER_ID = 704L;
// public static final Long MAXIMUM_USER_ID = 225L;
// 激活更改邮箱 链接有效期 毫秒 3天
public static final Long CHANGE_MAILBOX_LINK_VALIDITY = 259200000L;
public static final String RCA_WORKSHOP_TAG = "#RCAworkshop_2024";
public static final String PORTFOLIO_DELETED_EN = "Portfolio has been deleted";
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=";
public static final String PARTIAL_DESIGN_FILENAME = "PartialDesign";
public static final String PARTIAL_DESIGN_PREVIEW_FILENAME = "Preview";
public static final String senderEmail = "info@aida.com.hk";
}

View File

@@ -0,0 +1,42 @@
package com.ai.da.common.constant;
/**
* 模型相关常量类
* 用于存放 chooseModelAndPrompt 方法中的字符串常量
*/
public class ModelConstants {
// 类型常量
public static final String PRINTBOARD = "Printboard";
public static final String MOODBOARD = "Moodboard";
public static final String SKETCHBOARD = "Sketchboard";
// 模型级别常量
public static final String ADVANCED = "advanced";
public static final String HIGH = "high";
public static final String NORMAL = "normal";
// 模型名称常量
public static final String PRINTBOARD_ADVANCED_T2I = "qwen-image";
public static final String MOODBOARD_ADVANCED = "doubao-seedream-3-0-t2i-250415";
public static final String PRINTBOARD_HIGH_T2I = "doubao-seedream-3-0-t2i-250415";
public static final String PRINTBOARD_HIGH_I2I = "doubao-seededit-3-0-i2i-250628";
public static final String PRINTBOARD_ADVANCED_I2I = "doubao-seedream-4-0-250828";
public static final String IMAGEN_MODEL = "imagen-4.0-generate-001";
public static final String NANO_BANANA = "gemini-2.5-flash-image";
public static final String LOCAL_MODEL = "local";
// 风格常量
public static final String PAINTING_STYLE = "Painting Style";
public static final String ILLUSTRATION_STYLE = "Illustration Style";
public static final String REAL_STYLE = "Real Style";
// 映射键
public static final String PROMPT = "prompt";
public static final String USE_MODEL = "UseModel";
// 防止实例化
private ModelConstants() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
}

View File

@@ -23,7 +23,21 @@ public enum AuthenticationOperationTypeEnum {
/**
* 忘记密码
*/
FORGET_PWD;
FORGET_PWD,
/**
* 更改邮箱
*/
CHANGE_MAILBOX,
/**
* 填写用户国家和职业
*/
UPDATE_USERINFO,
REGISTER,
/**
* Global_Award 活动验证
*/
GLOBAL_AWARD;
public static AuthenticationOperationTypeEnum of(String name) {
return Stream.of(AuthenticationOperationTypeEnum.values()).filter(v -> v.name().equals(name)).findFirst().orElse(null);

View File

@@ -27,7 +27,9 @@ public enum CollectionLevel1TypeEnum {
/**
* 市场
*/
MARKETING_SKETCH("MarketingSketch");
MARKETING_SKETCH("MarketingSketch"),
MODEL("Models");
private String realName;

View File

@@ -68,4 +68,7 @@ public enum CollectionLevel2TypeEnum {
public static List<String> printType() {
return Arrays.asList(LOGO.getRealName(), SLOGAN.getRealName(), Pattern.getRealName());
}
public static CollectionLevel2TypeEnum ofWithLoweCase(String realName) {
return Stream.of(CollectionLevel2TypeEnum.values()).filter(v -> v.getRealName().toLowerCase().equals(realName)).findFirst().orElse(null);
}
}

View File

@@ -3,23 +3,35 @@ package com.ai.da.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum CreditsEventsEnum {
PRICE("price","6"),
PRICE("price","10"),
// PRICE("price","1"),// for test
// PRICE("price","0.1"),
BUY_CREDITS("Buy Credits","60"),
BUY_CREDITS("Buy Credits","50"),
// BUY_CREDITS("Buy Credits","10"),// for test
REFUND("Refund","60"),
REFUND("Refund","50"),
// BUY_CREDITS("Buy Credits","10"),
// 每月更新
INIT_YEARLY("init_yearly", "6000"),
INIT_MONTHLY("init_monthly", "5000"),
INIT_YEARLY("init_yearly", "50000"),
INIT_MONTHLY("init_monthly", "3500"),
INIT_MONTHLY_ECO("init_monthly_eco", "500"),
INIT_QUARTERLY("init_quarterly", "12000"),
INIT_MONTHLY_EDU("init_monthly_edu", "3500"),
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"),
@@ -29,15 +41,51 @@ public enum CreditsEventsEnum {
MOOD_BOARD("MoodBoard","5"),
SKETCH_BOARD("SketchBoard","5"),
TO_PRODUCT_IMAGE("ToProductImage","5"),
TO_PRODUCT_IMAGE_ADVANCED("ToProductImageAdvanced","15"),
RELIGHT("Relight","5"),
RELIGHT_FLUX("RelightFlux","10"),
QUESTIONNAIRE("Questionnaire","100"),
IMAGE_TO_SKETCH("ImageToSketch","5"),
IMAGE_TO_SKETCH_FLUX("ImageToSketchFlux","10"),
POSE_TRANSFORMATION("PoseTransformation","10"),
OTHER("Other","5"),
OTHER("Other","5");
SCETCH_TEXT2IMG("SketchText2Image","10"),
SCETCH_IMG2IMG("SketchImg2Image","15"),
WX_TEXT2IMG("WX_Text2Image", "5"),
QWEN_TEXT2IMG("QWEN_Text2Image", "10"),
DOUBAO_TEXT2IMG("Doubao_Text2Image", "10"),
DOUBAO_IMG2IMG_ADVANCED("Doubao_img2image_advanced", "10"),
DOUBAO_IMG2IMG_HIGH("Doubao_img2image_high", "15"),
WX_ANIMATION("WX_Animation", "30"),
FREEPIK_IMG2IMG("Freepik_img2img", "20"),
FLUX_IMG2IMG("Flux_img2img","10"),
private String name;
LOCAL_TEXT2IMG("Local_text2img","1.25"),
LOCAL_IMG2IMG("Local_img2img","1.25"),
LOCAL_TEXT2IMG_HIGH("Local_text2img_high","5"),
LOCAL_IMG2IMG_HIGH("Local_img2img_high","5"),
LOCAL_ANIMATION("Local_Animation","15"),
LLM_CONVERSATION("LLM_Conversation", "0")
;
private final String name;
/**
* 对应事件需要消耗or获得的积分
*/
private String value;
private final String value;
public static List<String> generateFunctionNames() {
return Arrays.asList(SLOGAN.name, LOGO.name, PATTERN.name, MOOD_BOARD.name, SKETCH_BOARD.name,
TO_PRODUCT_IMAGE.name, RELIGHT.name, IMAGE_TO_SKETCH.name, POSE_TRANSFORMATION.name);
}
private static final Map<String, CreditsEventsEnum> BY_TASK_NAME = Arrays.stream(values())
.collect(Collectors.toMap(CreditsEventsEnum::getName, Function.identity()));
public static CreditsEventsEnum getByTaskName(String taskName){
return BY_TASK_NAME.get(taskName);
}
}

View File

@@ -0,0 +1,34 @@
package com.ai.da.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum FluxTaskStatusEnum {
SUCCESS("Ready"),
TASK_NOT_FOUND("Task not found"),
REQUEST_MODERATED("Request Moderated"),
CONTENT_MODERATED("Content Moderated"),
ERROR("Error"),
PENDING_F("Pending");
private final String name;
public static FluxTaskStatusEnum fromName(String name) {
for (FluxTaskStatusEnum status : values()) {
if (status.name.equalsIgnoreCase(name)) {
return status;
}
}
// 或者返回默认值
return TASK_NOT_FOUND;
}
}

View File

@@ -28,7 +28,9 @@ public enum LibraryLevel1TypeEnum {
* 模特
*/
MODELS("Models"),
DESIGN_ELEMENTS("DesignElements");
DESIGN_ELEMENTS("DesignElements"),
BRAND_DNA("BrandDNA");
private String realName;

View File

@@ -0,0 +1,29 @@
package com.ai.da.common.enums;
import lombok.Getter;
import java.util.stream.Stream;
@Getter
public enum MotionModeEnum {
POSE_TO_VIDEO(1, "/api/comfyui_image_pose_2_video"),
PROMPT_TO_VIDEO(2, "/api/comfyui_image_2_video"),
FIRST_LAST_FRAME_TO_VIDEO(3, "/api/comfyui_flf_2_video")
;
private int code;
private String url;
MotionModeEnum(int code, String url) {
this.code = code;
this.url = url;
}
public static MotionModeEnum of(int code) {
return Stream.of(MotionModeEnum.values()).filter(v -> v.getCode()== code).findFirst().orElse(null);
}
}

View File

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

View File

@@ -0,0 +1,81 @@
package com.ai.da.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public enum PoseEnum {
// POSE_1(1, "aida-sys-image/pose/pose-1.mp4", "aida-sys-image/pose/pose-1.gif", "aida-sys-image/pose/pose-1-first_frame.jpeg", "AACT.8090e67b.-E3pujumEfCbDTI_rjSH-A.LwIlGT3j"),
POSE_1(1, "aida-sys-image/pose/pose-1-1.mp4", "aida-sys-image/pose/pose-1-1.gif", "aida-sys-image/pose/pose-1-first_frame.jpeg", "AACT.8090e67b.qNMWJlyKEfCuORaRJeW4dg.x3wUteVO"),
// POSE_2(2, "aida-sys-image/pose/pose-2.mp4", "aida-sys-image/pose/pose-2.gif", "aida-sys-image/pose/pose-2-first_frame.jpeg", "AACT.8090e67b.TwJLxEv3EfCbDTI_rjSH-A.IOQZCYhf"),
POSE_2(2, "aida-sys-image/pose/pose-2-1.mp4", "aida-sys-image/pose/pose-2-1.gif", "aida-sys-image/pose/pose-2-first_frame.jpeg", "AACT.8090e67b.QpaGOlyLEfCuuJo8eQGF2Q.62EiJj-6"),
// POSE_3(3, "aida-sys-image/pose/pose-3.mp4", "aida-sys-image/pose/pose-3.gif", "aida-sys-image/pose/pose-3-first_frame.jpeg", "AACT.8090e67b.gd3OCkv4EfCxyZo8eQGF2Q.qMm-a1XI"),
POSE_3(3, "aida-sys-image/pose/pose-3-1.mp4", "aida-sys-image/pose/pose-3-1.gif", "aida-sys-image/pose/pose-3-first_frame.jpeg", "AACT.8090e67b.2q5qjFyLEfCImjI_rjSH-A.5cFMwOvi"),
// POSE_4(4, "aida-sys-image/pose/pose-4.mp4", "aida-sys-image/pose/pose-4.gif", "aida-sys-image/pose/pose-4-first_frame.jpeg", "AACT.8090e67b.AUDnuEwDEfCEHBaRJeW4dg.rlx36xEY"),
POSE_4(4, "aida-sys-image/pose/pose-4-1.mp4", "aida-sys-image/pose/pose-4-1.gif", "aida-sys-image/pose/pose-4-first_frame.jpeg", "AACT.8090e67b.KoYMplyPEfCuORaRJeW4dg.MuuBTG78"),
// POSE_5(5, "aida-sys-image/pose/pose-5.mp4", "aida-sys-image/pose/pose-5.gif", "aida-sys-image/pose/pose-5-first_frame.jpeg", "AACT.8090e67b.G8BvkEwEEfCxyZo8eQGF2Q.fo4ryrgR"),
POSE_5(5, "aida-sys-image/pose/pose-5-1.mp4", "aida-sys-image/pose/pose-5-1.gif", "aida-sys-image/pose/pose-5-first_frame.jpeg", "AACT.8090e67b.x54FNFyPEfCuuJo8eQGF2Q.P1egmEZ_"),
// POSE_6(6, "aida-sys-image/pose/pose-6.mp4", "aida-sys-image/pose/pose-6.gif", "aida-sys-image/pose/pose-6-first_frame.jpeg", "AACT.8090e67b.yBIPnEwEEfCxyZo8eQGF2Q.boSFwTG9");
POSE_6(6, "aida-sys-image/pose/pose-6-1.mp4", "aida-sys-image/pose/pose-6-1.gif", "aida-sys-image/pose/pose-6-first_frame.jpeg", "AACT.8090e67b.QSCvBlyQEfCImjI_rjSH-A.G9-Z5ffW");
private final Integer id;
private final String videoPath;
private final String gifPath;
private final String firstFramePath;
private final String templateId;
private static final List<Map<String, String>> PROPERTY_LIST;
static {
PROPERTY_LIST = Arrays.stream(values())
.map(PoseEnum::toMap)
.collect(Collectors.toList());
}
private static final Map<Integer, PoseEnum> BY_ID = Arrays.stream(values())
.collect(Collectors.toMap(PoseEnum::getId, Function.identity()));
private static final Map<String, PoseEnum> BY_VIDEO_PATH = Arrays.stream(values())
.collect(Collectors.toMap(PoseEnum::getVideoPath, Function.identity()));
private static final List<String> VIDEO_PATH = Arrays.stream(values())
.map(PoseEnum::getVideoPath).collect(Collectors.toList());
public static PoseEnum getById(Integer id) {
return BY_ID.get(id);
}
public static PoseEnum getByVideoPath(String videoPath) {
return BY_VIDEO_PATH.get(videoPath);
}
private Map<String, String> toMap() {
Map<String, String> map = new HashMap<>();
map.put("id", String.valueOf(id));
map.put("gif", gifPath);
map.put("video", videoPath);
map.put("firstFrame", firstFramePath);
return map;
}
public static List<Map<String, String>> getPropertyList() {
return PROPERTY_LIST.stream()
.map(HashMap::new) // 深拷贝每个 Map
.collect(Collectors.toList());
}
public static List<String> getVideoList() {
return new ArrayList<>(VIDEO_PATH); // 返回副本以保证不可变性
}
}

View File

@@ -0,0 +1,33 @@
package com.ai.da.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ProductEnum {
// 积分购买
CreditsProduct("AiDA credits purchase", 10L, 50L),
// 年度订阅
AnnualSubscription("AiDA Annual Subscription", 5000L, 50000L),
// 月度订阅订阅费500每月3500 积分)
MonthlySubscription("AiDA Monthly Subscription", 500L, 3500L),
// 月度订阅 -- 经济实惠版 订阅费100每月500 积分)
Eco_MonthlySubscription("AiDA Eco Monthly Subscription", 100L, 500L),
// 季度订阅
QuarterlySubscription("AiDA Quarterly Subscription", 1500L, 12000L),
// 月度订阅 -- 教育版
EDUMonthlySubscription("AiDA Edu Monthly Subscription", 200L, 3500L),
// 测试
DailySubscription("AiDA Daily Subscription", 5L, 100L),
;
/**
* 类型
*/
private final String name;
private final Long price;
private final Long credits;
}

View File

@@ -0,0 +1,32 @@
package com.ai.da.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum WangXiangTaskStatusEnum {
SUCCEEDED("SUCCEEDED"),
UNKNOWN_W("UNKNOWN"),
FAILED("FAILED"),
RUNNING("RUNNING"),
PENDING_W("PENDING");
private final String name;
// 通过name查找枚举的静态方法
public static WangXiangTaskStatusEnum fromName(String name) {
for (WangXiangTaskStatusEnum status : values()) {
if (status.name.equalsIgnoreCase(name)) {
return status;
}
}
// 或者返回默认值
return UNKNOWN_W;
}
}

View File

@@ -1,8 +1,7 @@
package com.ai.da.common.response;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -16,17 +15,17 @@ import java.util.List;
*/
@Data
@NoArgsConstructor
@ApiModel("分页响应结果")
@Schema(description = "分页响应结果")
public class PageBaseResponse<T> {
@ApiModelProperty("页码")
@Schema(description = "页码")
private long page;
@ApiModelProperty("每页数量")
@Schema(description = "每页数量")
private long size;
@ApiModelProperty("总页数")
@Schema(description = "总页数")
private long pages;
@ApiModelProperty("总条数")
@Schema(description = "总条数")
private long total;
@ApiModelProperty("结果集")
@Schema(description = "结果集")
private List<T> content;

View File

@@ -1,8 +1,7 @@
package com.ai.da.common.response;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -16,18 +15,18 @@ import java.util.List;
*/
@Data
@NoArgsConstructor
@ApiModel("分页响应结果")
@Schema(description = "分页响应结果")
public class PageResponse<T> extends Response<List<T>> {
@ApiModelProperty("页码")
@Schema(description = "页码")
private long page;
@ApiModelProperty("每页数量")
@Schema(description = "每页数量")
private long size;
@ApiModelProperty("总页数")
@Schema(description = "总页数")
private long pages;
@ApiModelProperty("总条数")
@Schema(description = "总条数")
private long total;
@ApiModelProperty("结果集")
@Schema(description = "结果集")
private List<T> content;

View File

@@ -1,7 +1,6 @@
package com.ai.da.common.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -17,14 +16,14 @@ import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("响应结果")
@Schema(description = "响应结果")
public class Response<T> implements Serializable {
@ApiModelProperty("响应状态码 0成功 -1失败")
@Schema(description = "响应状态码 0成功 -1失败")
private int errCode;
@ApiModelProperty("提示消息")
@Schema(description = "提示消息")
private String errMsg;
@ApiModelProperty("数据结果")
@Schema(description = "数据结果")
private T data;
public static <T> Response<T> success() {

View File

@@ -0,0 +1,15 @@
package com.ai.da.common.response;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@NoArgsConstructor
@Schema(description = "交易记录分页响应结果")
public class TransactionPageResponse<T> extends PageBaseResponse<T> {
private BigDecimal totalAmount;
}

View File

@@ -7,8 +7,8 @@ import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
/**

View File

@@ -7,9 +7,9 @@ import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
/**

View File

@@ -5,7 +5,7 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
/**
* @author: dangweijian

View File

@@ -10,9 +10,9 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
/**

View File

@@ -8,10 +8,10 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.annotation.Resource;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
/**

View File

@@ -1,84 +1,107 @@
package com.ai.da.common.security.config;
import com.ai.da.common.security.*;
import com.ai.da.common.security.filter.AuthenticationFilter;
import com.ai.da.common.security.filter.UserAuthenticationProcessingFilter;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
import javax.annotation.Resource;
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableConfigurationProperties(SecurityProperties.class)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Resource
private SecurityProperties securityProperties;
@Resource
private UserLoginSuccessHandler userLoginSuccessHandler;
@Resource
private UserLoginFailureHandler userLoginFailureHandler;
@Resource
private UserAuthAccessDeniedHandler userAuthAccessDeniedHandler;
@Resource
private UserAuthenticationEntryPointHandler userAuthenticationEntryPointHandler;
@Resource
private UserAuthenticationManager userAuthenticationManager;
@Resource
private UserAuthenticationProcessingFilter userAuthenticationProcessingFilter;
/**
* 不通过注入spring管理 让Security来管理 这样自定义的Filter就不会走,.permitAll()才能起作用
*/
@Resource
private AuthenticationFilter authenticationFilter;
@Resource
private UserPermissionEvaluator userPermissionEvaluator;
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return this.userAuthenticationManager;
}
@Override
protected void configure(HttpSecurity httpSecurity/*, WebSecurity web*/) throws Exception {
// web.ignoring().antMatchers("/test/**");//禁止所有过滤器
httpSecurity.cors().disable()//禁用 CSRF
.authorizeRequests()//认证请求
.antMatchers(securityProperties.getIgnorePaths()).permitAll()//忽略的请求
.anyRequest().authenticated()//其余所有的请求都需要认证
.and().headers().frameOptions().disable()// 防止iframe 造成跨域
.and().exceptionHandling().authenticationEntryPoint(userAuthenticationEntryPointHandler)//未登录请求处理
.accessDeniedHandler(userAuthAccessDeniedHandler)//无权限访问处理类 (此配置可以忽略全局异常会先于Security框架处理异常全局异常已特殊处理)
.and().formLogin().loginProcessingUrl(securityProperties.getAuthApi())//指定认证接口
.successHandler(userLoginSuccessHandler)//登录成功处理器
.failureHandler(userLoginFailureHandler)//登录失败处理器
.and().cors().and().csrf().disable();//允许跨域
//自定义过滤器在登录时认证用户名、密码
httpSecurity.addFilterAt(userAuthenticationProcessingFilter, UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(authenticationFilter, BasicAuthenticationFilter.class);
//不创建session会话
httpSecurity.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
//取消头缓存控制
httpSecurity.headers().cacheControl();
}
@Bean
public DefaultWebSecurityExpressionHandler userSecurityExpressionHandler() {
DefaultWebSecurityExpressionHandler handler = new DefaultWebSecurityExpressionHandler();
handler.setPermissionEvaluator(userPermissionEvaluator);
return handler;
}
}
package com.ai.da.common.security.config;
import com.ai.da.common.security.*;
import com.ai.da.common.security.filter.AuthenticationFilter;
import com.ai.da.common.security.filter.UserAuthenticationProcessingFilter;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import jakarta.annotation.Resource;
@Configuration
@EnableWebSecurity
@EnableMethodSecurity(prePostEnabled = true)
@EnableConfigurationProperties(SecurityProperties.class)
public class SecurityConfig {
@Resource
private SecurityProperties securityProperties;
@Resource
private UserLoginSuccessHandler userLoginSuccessHandler;
@Resource
private UserLoginFailureHandler userLoginFailureHandler;
@Resource
private UserAuthAccessDeniedHandler userAuthAccessDeniedHandler;
@Resource
private UserAuthenticationEntryPointHandler userAuthenticationEntryPointHandler;
@Resource
private UserAuthenticationManager userAuthenticationManager;
@Resource
private UserAuthenticationProcessingFilter userAuthenticationProcessingFilter;
/**
* 不通过注入spring管理 让Security来管理 这样自定义的Filter就不会走,.permitAll()才能起作用
*/
@Resource
private AuthenticationFilter authenticationFilter;
@Resource
private UserPermissionEvaluator userPermissionEvaluator;
@Bean
public AuthenticationManager authenticationManager() throws Exception {
return this.userAuthenticationManager;
}
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.cors(Customizer.withDefaults())
.authorizeHttpRequests(auth -> auth
.requestMatchers(
new AntPathRequestMatcher("/doc.html"),
new AntPathRequestMatcher("/swagger-ui.html"),
new AntPathRequestMatcher("/swagger-ui/**"),
new AntPathRequestMatcher("/swagger-resources/**"),
new AntPathRequestMatcher("/v2/api-docs"),
new AntPathRequestMatcher("/v3/api-docs/**"),
new AntPathRequestMatcher("/webjars/**")
).permitAll()
.requestMatchers(securityProperties.getIgnorePaths()).permitAll()
.anyRequest().authenticated()
)
.headers(headers -> headers
.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable)
.cacheControl(cache -> cache.disable())
)
.exceptionHandling(exception -> exception
.authenticationEntryPoint(userAuthenticationEntryPointHandler)
.accessDeniedHandler(userAuthAccessDeniedHandler)
)
.formLogin(form -> form
.loginProcessingUrl(securityProperties.getAuthApi())
.successHandler(userLoginSuccessHandler)
.failureHandler(userLoginFailureHandler)
)
.csrf(AbstractHttpConfigurer::disable)
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
);
//自定义过滤器在登录时认证用户名、密码
httpSecurity.addFilterAt(userAuthenticationProcessingFilter, UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(authenticationFilter, BasicAuthenticationFilter.class);
return httpSecurity.build();
}
@Bean
public DefaultWebSecurityExpressionHandler userSecurityExpressionHandler() {
DefaultWebSecurityExpressionHandler handler = new DefaultWebSecurityExpressionHandler();
handler.setPermissionEvaluator(userPermissionEvaluator);
return handler;
}
}

View File

@@ -1,133 +1,164 @@
package com.ai.da.common.security.filter;
import cn.hutool.core.util.StrUtil;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.security.config.SecurityProperties;
import com.ai.da.common.security.jwt.JWTTokenHelper;
import com.ai.da.common.utils.LocalCacheUtils;
import com.ai.da.common.utils.MultiReadHttpServletRequest;
import com.ai.da.common.utils.MultiReadHttpServletResponse;
import com.ai.da.common.utils.RequestInfoUtil;
import com.ai.da.model.vo.AuthPrincipalVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.NonNull;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.StopWatch;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.annotation.Resource;
import javax.security.sasl.AuthenticationException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
/**
* @author: dangweijian
* @description: 认证拦截器
* @create: 2020-07-10 16:50
**/
@Slf4j
@Configuration
public class AuthenticationFilter extends OncePerRequestFilter {
@Resource
private JWTTokenHelper jwtTokenHelper;
@Resource
private SecurityProperties properties;
private static final List<String> FILTER_URL =
Arrays.asList("/favicon.ico", "/doc.html", "api/account/login", "api/account/preLogin", "api/account/sendEmail","api/account/noLoginRequired",
"/webjars/", "/swagger-resources", "/v2/api-docs", "api/account/resetPwd",
"/api/python/saveGeneratePicture", "/api/python/getLibraryByUserId",
"/api/third/party/addUser","/api/third/party/addTrialUser", "/api/third/party/editUser", "/api/element/initDefaultSysFile",
"/api/third/party/addNoLoginRequiredNew","/api/third/party/deleteNoLoginRequiredNew",
"/api/third/party/existNoLoginRequired","/api/third/party/getRedirectUrl",
"/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"
);
@Override
protected void doFilterInternal(HttpServletRequest httpServletRequest, @NonNull HttpServletResponse httpServletResponse, @NonNull FilterChain filterChain) throws ServletException, IOException {
String requestURI = httpServletRequest.getRequestURI();
if (calculateUrl(requestURI) || hasAuthorizationToken(httpServletRequest)) {
StopWatch stopWatch = new StopWatch();
HttpServletRequest wrappedRequest = httpServletRequest;
HttpServletResponse wrappedResponse = httpServletResponse;
try {
stopWatch.start();
if ((httpServletRequest.getContentType() == null && httpServletRequest.getContentLength() > 0) || (httpServletRequest.getContentType() != null && !httpServletRequest.getContentType().contains("application/json"))) {
extracted(wrappedRequest);
filterChain.doFilter(wrappedRequest, wrappedResponse);
} else {
wrappedRequest = new MultiReadHttpServletRequest(httpServletRequest);
wrappedResponse = new MultiReadHttpServletResponse(httpServletResponse);
extracted(wrappedRequest);
filterChain.doFilter(wrappedRequest, wrappedResponse);
}
} catch (Exception e) {
SecurityContextHolder.clearContext();
throw e;
} finally {
stopWatch.stop();
}
} else {
filterChain.doFilter(httpServletRequest, httpServletResponse);
}
}
private Boolean calculateUrl(String requestURI) {
String filterUrl = FILTER_URL.stream().filter(url -> requestURI.contains(url)).findFirst().orElse(null);
return null == filterUrl ? Boolean.TRUE : Boolean.FALSE;
}
private boolean hasAuthorizationToken(HttpServletRequest request) {
String authorizationHeader = request.getHeader("Authorization");
return authorizationHeader != null && authorizationHeader.startsWith("Bearer");
}
private void extracted(HttpServletRequest request) throws AuthenticationException {
String jwtToken = request.getHeader(properties.getJwtTokenHeader());
// log.debug("后台检查令牌:{}", jwtToken);
if (StrUtil.isBlank(jwtToken)) {
String ipAddress = RequestInfoUtil.getIpAddress(request);
log.info("本次请求的ip为 " + ipAddress);
throw new RuntimeException("请传入token");
}
if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
//写死 暂时放行
return;
}
// 检查token
boolean validate = jwtTokenHelper.validateToken(jwtToken);
if (validate) {
AuthPrincipalVo principal = jwtTokenHelper.parserToUser(jwtToken);
if (principal == null) {
throw new RuntimeException("TOKEN已过期请重新登录");
}
//先清空当前线程变量,防止上一个线程遗留
UserContext.delete();
//存取用户信息到缓存
UserContext.setUserHolder(principal);
//校验token
String cacheToken = LocalCacheUtils.getTokenCache(String.valueOf(principal.getId()));
if(StringUtils.isEmpty(cacheToken)){
throw new RuntimeException("TOKEN已过期请重新登录");
}
if(!cacheToken.equals(jwtToken) ){
throw new RuntimeException("TOKEN已过期请重新登录");
}
// UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null);
// SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
}
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;
import com.ai.da.common.utils.LocalCacheUtils;
import com.ai.da.common.utils.RedisUtil;
import com.ai.da.common.utils.MultiReadHttpServletRequest;
import com.ai.da.common.utils.MultiReadHttpServletResponse;
import com.ai.da.common.utils.RequestInfoUtil;
import com.ai.da.model.vo.AuthPrincipalVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.NonNull;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.StopWatch;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
import jakarta.annotation.Resource;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
/**
* @author: dangweijian
* @description: 认证拦截器
* @create: 2020-07-10 16:50
**/
@Slf4j
@Configuration
public class AuthenticationFilter extends OncePerRequestFilter {
@Resource
private JWTTokenHelper jwtTokenHelper;
@Resource
private SecurityProperties properties;
@Resource
private RedisUtil redisUtil;
private static final List<String> FILTER_URL =
Arrays.asList("/favicon.ico", "/doc.html", "/swagger-ui.html",
"/swagger-resources", "/swagger-resources/", "/swagger-resources/configuration/ui", "/swagger-resources/configuration/security",
"/webjars/", "/v2/api-docs", "/v3/api-docs", "/v3/api-docs/swagger-config",
"/api/account/login", "/api/account/preLogin", "api/account/sendEmail","api/account/noLoginRequired",
"/api/account/resetPwd",
"/api/python/saveGeneratePicture", "/api/python/getLibraryByUserId",
"/api/third/party/addUser","/api/third/party/addTrialUser", "/api/third/party/editUser", "/api/element/initDefaultSysFile",
"/api/third/party/addNoLoginRequiredNew","/api/third/party/deleteNoLoginRequiredNew","/api/third/party/updateNoLoginRequiredNew",
"/api/third/party/existNoLoginRequired","/api/third/party/getRedirectUrl",
"/api/python/flush","/api/account/healthy","/api/ali-pay/trade/notify","/api/paypal/ipn/back","/api/alipay-hk/trade/notify",
"/api/portfolio/page", "/api/portfolio/detail", "/api/portfolio/commentPage", "/api/portfolio/viewsIncrease",
"/api/account/designWorksRegister","/api/account/questionnaire","/api/stripe/trade/notify",
"/notification","/api/account/activateNewEmail","/api/third/party/auth/google_callback","/api/third/party/parseGoogleCredential","/api/third/party/receiveDesignResults","/api/third/party/parseWeChatCode","/api/third/party/receiveDesignParams"
, "/api/account/schoolLogin", "/api/account/enterpriseLogin", "/api/account/organizationNameSearch",
"/api/llm/stream",
//GlobalAwardController
"/api/global-award/uploads/pdf/init", "/api/global-award/uploads/pdf/chunk", "/api/global-award/uploads/pdf/complete", "/api/global-award/uploads/pdf/status",
"/api/global-award/uploads/video/init", "/api/global-award/uploads/video/chunk", "/api/global-award/uploads/video/complete", "/api/global-award/uploads/video/status",
"/api/global-award/contestants/save", "/api/global-award/contestants/by-email", "/api/global-award/checkEmail", "/api/global-award/checkCode"
);
@Override
protected void doFilterInternal(HttpServletRequest httpServletRequest, @NonNull HttpServletResponse httpServletResponse, @NonNull FilterChain filterChain) throws ServletException, IOException {
String requestURI = httpServletRequest.getRequestURI();
if (calculateUrl(requestURI)/* || hasAuthorizationToken(httpServletRequest)*/) {
StopWatch stopWatch = new StopWatch();
HttpServletRequest wrappedRequest = httpServletRequest;
HttpServletResponse wrappedResponse = httpServletResponse;
try {
stopWatch.start();
if ((httpServletRequest.getContentType() == null && httpServletRequest.getContentLength() > 0) || (httpServletRequest.getContentType() != null && !httpServletRequest.getContentType().contains("application/json"))) {
extracted(wrappedRequest);
filterChain.doFilter(wrappedRequest, wrappedResponse);
} else {
wrappedRequest = new MultiReadHttpServletRequest(httpServletRequest);
wrappedResponse = new MultiReadHttpServletResponse(httpServletResponse);
extracted(wrappedRequest);
// excel导出使用原始response,不对响应做包装
if (requestURI.equals("/api/account/exportAccountsToExcel")) {
filterChain.doFilter(httpServletRequest, httpServletResponse); // 不包装
} else {
filterChain.doFilter(wrappedRequest, wrappedResponse);
}
}
} catch (Exception e) {
SecurityContextHolder.clearContext();
throw e;
} finally {
stopWatch.stop();
}
} else {
//先清空当前线程变量,防止上一个线程遗留
UserContext.delete();
filterChain.doFilter(httpServletRequest, httpServletResponse);
}
}
private Boolean calculateUrl(String requestURI) {
String filterUrl = FILTER_URL.stream().filter(url -> requestURI.contains(url)).findFirst().orElse(null);
return null == filterUrl ? Boolean.TRUE : Boolean.FALSE;
}
private boolean hasAuthorizationToken(HttpServletRequest request) {
String authorizationHeader = request.getHeader("Authorization");
return authorizationHeader != null && authorizationHeader.startsWith("Bearer");
}
private void extracted(HttpServletRequest request) {
String jwtToken = request.getHeader(properties.getJwtTokenHeader());
// log.debug("后台检查令牌:{}", jwtToken);
if (StrUtil.isBlank(jwtToken)) {
String ipAddress = RequestInfoUtil.getIpAddress(request);
log.info("本次请求的ip为 " + ipAddress);
// throw new RuntimeException("请传入token");
throw new TokenMissingOrExpiredException("请传入token");
}
if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
//写死 暂时放行
return;
}
// 检查token
boolean validate = jwtTokenHelper.validateToken(jwtToken);
if (validate) {
AuthPrincipalVo principal = jwtTokenHelper.parserToUser(jwtToken);
if (principal == null) {
// throw new RuntimeException("TOKEN已过期请重新登录");
throw new TokenMissingOrExpiredException("TOKEN已过期请重新登录(token without userInfo)");
}
//先清空当前线程变量,防止上一个线程遗留
UserContext.delete();
//存取用户信息到缓存
UserContext.setUserHolder(principal);
// 校验 token先查本地缓存再查 Redis保证服务重启后仍然有效
String userIdStr = String.valueOf(principal.getId());
String cacheToken = LocalCacheUtils.getTokenCache(userIdStr);
if (StringUtils.isEmpty(cacheToken)) {
// 本地缓存为空时,尝试从 Redis 读取
cacheToken = redisUtil.getLoginToken(principal.getId());
if (StringUtils.isEmpty(cacheToken)) {
// throw new RuntimeException("TOKEN已过期请重新登录");
throw new TokenMissingOrExpiredException("TOKEN已过期请重新登录(cache & redis empty)");
}
// 将 Redis 中的 token 回填到本地缓存,减少后续 Redis 访问
LocalCacheUtils.setTokenCache(userIdStr, cacheToken);
}
if(!cacheToken.equals(jwtToken) ){
// throw new RuntimeException("TOKEN已过期请重新登录");
throw new TokenMissingOrExpiredException("TOKEN已过期请重新登录(token not match local cache)");
}
// UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null);
// SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
}

View File

@@ -1,69 +1,69 @@
package com.ai.da.common.security.filter;
import cn.hutool.core.util.StrUtil;
import com.ai.da.common.security.UserLoginSuccessHandler;
import com.ai.da.common.security.config.SecurityProperties;
import com.ai.da.common.utils.RedisCacheUtils;
import com.alibaba.fastjson.JSONObject;
import com.ai.da.common.security.UserAuthenticationManager;
import com.ai.da.common.security.UserLoginFailureHandler;
import com.ai.da.common.utils.MultiReadHttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author: dangweijian
* @description: 用户认证过滤器
* @create: 2020-07-10 15:58
**/
@Slf4j
@Component
public class UserAuthenticationProcessingFilter extends AbstractAuthenticationProcessingFilter {
/**
* @param securityProperties 配置从配置中读取登录url
* @param authenticationManager 认证管理器
* @param adminAuthenticationSuccessHandler 认证成功处理器
* @param adminAuthenticationFailureHandler 认证失败处理器
*/
public UserAuthenticationProcessingFilter(SecurityProperties securityProperties, UserAuthenticationManager authenticationManager, UserLoginSuccessHandler adminAuthenticationSuccessHandler, UserLoginFailureHandler adminAuthenticationFailureHandler) {
super(new AntPathRequestMatcher(securityProperties.getAuthApi(), HttpMethod.POST.name()));
this.setAuthenticationManager(authenticationManager);
this.setAuthenticationSuccessHandler(adminAuthenticationSuccessHandler);
this.setAuthenticationFailureHandler(adminAuthenticationFailureHandler);
}
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
if (request.getContentType() == null || !request.getContentType().contains("application/json")) {
throw new AuthenticationServiceException("请求头类型不支持: " + request.getContentType());
}
UsernamePasswordAuthenticationToken authRequest;
try {
MultiReadHttpServletRequest wrappedRequest = new MultiReadHttpServletRequest(request);
// 将前端传递的数据转换成jsonBean数据格式
JSONObject jsonObject = JSONObject.parseObject(wrappedRequest.getBodyJsonStrByJson(wrappedRequest));
String code = jsonObject.getString("code");
String uuid = jsonObject.getString("uuid");
if (StrUtil.isEmpty(code) || StrUtil.isEmpty(uuid) || !code.equals(RedisCacheUtils.get("code-key-" + uuid, String.class))) {
throw new AuthenticationServiceException("验证码错误");
}
RedisCacheUtils.delete("code-key-" + uuid);
authRequest = new UsernamePasswordAuthenticationToken(jsonObject.get("username"), jsonObject.get("password"), null);
authRequest.setDetails(authenticationDetailsSource.buildDetails(wrappedRequest));
} catch (Exception e) {
throw new AuthenticationServiceException(e.getMessage());
}
return this.getAuthenticationManager().authenticate(authRequest);
}
}
package com.ai.da.common.security.filter;
import cn.hutool.core.util.StrUtil;
import com.ai.da.common.security.UserLoginSuccessHandler;
import com.ai.da.common.security.config.SecurityProperties;
import com.ai.da.common.utils.RedisCacheUtils;
import com.alibaba.fastjson.JSONObject;
import com.ai.da.common.security.UserAuthenticationManager;
import com.ai.da.common.security.UserLoginFailureHandler;
import com.ai.da.common.utils.MultiReadHttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.stereotype.Component;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
/**
* @author: dangweijian
* @description: 用户认证过滤器
* @create: 2020-07-10 15:58
**/
@Slf4j
@Component
public class UserAuthenticationProcessingFilter extends AbstractAuthenticationProcessingFilter {
/**
* @param securityProperties 配置从配置中读取登录url
* @param authenticationManager 认证管理器
* @param adminAuthenticationSuccessHandler 认证成功处理器
* @param adminAuthenticationFailureHandler 认证失败处理器
*/
public UserAuthenticationProcessingFilter(SecurityProperties securityProperties, UserAuthenticationManager authenticationManager, UserLoginSuccessHandler adminAuthenticationSuccessHandler, UserLoginFailureHandler adminAuthenticationFailureHandler) {
super(new AntPathRequestMatcher(securityProperties.getAuthApi(), HttpMethod.POST.name()));
this.setAuthenticationManager(authenticationManager);
this.setAuthenticationSuccessHandler(adminAuthenticationSuccessHandler);
this.setAuthenticationFailureHandler(adminAuthenticationFailureHandler);
}
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
if (request.getContentType() == null || !request.getContentType().contains("application/json")) {
throw new AuthenticationServiceException("请求头类型不支持: " + request.getContentType());
}
UsernamePasswordAuthenticationToken authRequest;
try {
MultiReadHttpServletRequest wrappedRequest = new MultiReadHttpServletRequest(request);
// 将前端传递的数据转换成jsonBean数据格式
JSONObject jsonObject = JSONObject.parseObject(wrappedRequest.getBodyJsonStrByJson(wrappedRequest));
String code = jsonObject.getString("code");
String uuid = jsonObject.getString("uuid");
if (StrUtil.isEmpty(code) || StrUtil.isEmpty(uuid) || !code.equals(RedisCacheUtils.get("code-key-" + uuid, String.class))) {
throw new AuthenticationServiceException("验证码错误");
}
RedisCacheUtils.delete("code-key-" + uuid);
authRequest = new UsernamePasswordAuthenticationToken(jsonObject.get("username"), jsonObject.get("password"), null);
authRequest.setDetails(authenticationDetailsSource.buildDetails(wrappedRequest));
} catch (Exception e) {
throw new AuthenticationServiceException(e.getMessage());
}
return this.getAuthenticationManager().authenticate(authRequest);
}
}

View File

@@ -1,68 +1,108 @@
package com.ai.da.common.security.jwt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.ai.da.common.security.config.SecurityProperties;
import com.ai.da.model.vo.AuthPrincipalVo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
/**
* @author: dangweijian
* @description: JWT工具
* @create: 2020-07-09 09:27
**/
@Slf4j
@Component
public class JWTTokenHelper {
@Resource
private SecurityProperties securityProperties;
private static final String ISSUER = "DWJ";
private static final String AUTHORITIES = "authorities";
public String createToken(AuthPrincipalVo principal) {
String token = Jwts.builder()
.setId(String.valueOf(principal.getId()))
.setSubject(JSONObject.toJSONString(principal))
.setIssuedAt(new Date())
.setIssuer(ISSUER)
.claim(AUTHORITIES, JSON.toJSONString(new ArrayList<>()))//自定义属性 权限
.setExpiration(new Date(System.currentTimeMillis() + securityProperties.getJwtExpiration()))
.signWith(SignatureAlgorithm.HS512, securityProperties.getJwtSecret())
.compact();
token = securityProperties.getJwtTokenPrefix() + token;
return token;
}
public boolean validateToken(String token) {
Claims claims = parser(token);
if (MapUtil.isEmpty(claims)) {
return false;
}
return true;
}
public AuthPrincipalVo parserToUser(String token) {
String subject = parser(token).getSubject();
if (StrUtil.isNotEmpty(subject)) {
return JSONObject.parseObject(subject, AuthPrincipalVo.class);
}
return null;
}
public Claims parser(String token) {
token = token.replaceAll(securityProperties.getJwtTokenPrefix(), "");
return Jwts.parser().setSigningKey(securityProperties.getJwtSecret()).parseClaimsJws(token).getBody();
}
}
package com.ai.da.common.security.jwt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.DigestUtil;
import com.ai.da.common.constant.CommonConstant;
import com.ai.da.common.security.config.SecurityProperties;
import com.ai.da.model.vo.AuthPrincipalVo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import jakarta.annotation.Resource;
import javax.crypto.SecretKey;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
/**
* @author: dangweijian
* @description: JWT工具
* @create: 2020-07-09 09:27
**/
@Slf4j
@Component
public class JWTTokenHelper {
@Resource
private SecurityProperties securityProperties;
private static final String ISSUER = "DWJ";
private static final String AUTHORITIES = "authorities";
private static final String CHANGE_MAILBOX = "changeMailbox";
public String createToken(AuthPrincipalVo principal) {
SecretKey key = buildSigningKey();
String token = Jwts.builder()
.id(String.valueOf(principal.getId()))
.subject(JSONObject.toJSONString(principal))
.issuedAt(new Date())
.issuer(ISSUER)
.claim(AUTHORITIES, JSON.toJSONString(new ArrayList<>()))//自定义属性 权限
.expiration(new Date(System.currentTimeMillis() + securityProperties.getJwtExpiration()))
.signWith(key)
.compact();
token = securityProperties.getJwtTokenPrefix() + token;
return token;
}
public boolean validateToken(String token) {
Claims claims = parser(token);
if (MapUtil.isEmpty(claims)) {
return false;
}
return true;
}
public AuthPrincipalVo parserToUser(String token) {
String subject = parser(token).getSubject();
if (StrUtil.isNotEmpty(subject)) {
return JSONObject.parseObject(subject, AuthPrincipalVo.class);
}
return null;
}
public Claims parser(String token) {
token = token.replaceAll(securityProperties.getJwtTokenPrefix(), "");
SecretKey key = buildSigningKey();
return Jwts.parser()
.verifyWith(key)
.build()
.parseSignedClaims(token)
.getPayload();
}
public String createToken(Long userId, String userEmail){
SecretKey key = buildSigningKey();
String token = Jwts.builder()
.id(String.valueOf(userId))
.subject(userEmail + "_" + userId)
.issuedAt(new Date())
.issuer(ISSUER)
.claim(CHANGE_MAILBOX, JSON.toJSONString(new ArrayList<>()))//自定义属性 权限
.expiration(new Date(System.currentTimeMillis() + CommonConstant.CHANGE_MAILBOX_LINK_VALIDITY))
.signWith(key)
.compact();
return token;
}
public String parseToEmailAndId(String token) {
return parser(token).getSubject();
}
/**
* JWT 要求 HMAC-SHA 的密钥至少 256 bit这里统一扩展/哈希密钥长度避免 WeakKeyException。
*/
private SecretKey buildSigningKey() {
byte[] raw = securityProperties.getJwtSecret().getBytes(StandardCharsets.UTF_8);
if (raw.length < 32) {
raw = DigestUtil.sha256(raw);
}
return Keys.hmacShaKeyFor(raw);
}
}

View File

@@ -1,11 +1,15 @@
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 com.ai.da.service.SubscriptionPlanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.util.List;
@Component
@Slf4j
@@ -13,19 +17,86 @@ public class AccountTask {
@Resource
private AccountService accountService;
@Resource
private RedisUtil redisUtil;
@Resource
private SubscriptionPlanService subscriptionPlanService;
/** 每周日晚上刷新 年付用户、月付用户的积分 */
@Scheduled(cron = "59 59 23 ? * SUN")
// @Scheduled(cron = "59 59 23 * * ?")
public void refreshCreditsMonthly(){
log.info("每周日晚115959刷新付费用户积分为 6000");
accountService.refreshCreditsWeekly();
/**
* 每周日晚上刷新 年付用户、月付用户的积分
* 替换为
* 每个月月初只刷新教育子账号的积分
*/
// @Scheduled(cron = "0 25 14 * * ?")
@Scheduled(cron = "0 0 0 1 * ?")
public void refreshCreditsMonthly() {
log.info("每月1号0点 重置教育版子账号为默认积分");
accountService.refreshCreditsMonthly();
}
// todo 多久执行一次?
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void getPaidUser(){
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void getPaidUser() {
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
accountService.extendValidityForCC();
}
// 每天凌晨0点执行一次 目前已没有角色类型为4的用户
/*@Scheduled(cron = "0 0 0 * * ?")
public void cancelActivityBenefits() {
// 1、查询当前所有参与了活动且过期的用户
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
// 2、将到期用户置为游客
for (Account account : accountList) {
log.info("参与活动的用户{} : {} 于 {} 账号有效期到期,置为游客", account.getId(), account.getUserEmail(), account.getValidEndTime());
accountService.toVisitor(account);
}
}*/
// 每天检测正式用户到期情况每天凌晨0点执行
@Scheduled(cron = "0 0 0 * * ?")
public void paidUserToVisitor() {
// 1、查询当前已过期正式用户或试用用户
List<Account> accountList = accountService.getExpiredUserBySystemUser(1);
accountList.addAll(accountService.getExpiredUserBySystemUser(2));
accountList.addAll(accountService.getExpiredUserBySystemUser(3));
// 2、将到期用户置为游客
for (Account account : accountList) {
log.info("用户{} : {} 于 {}账号有效期到期,置为游客", account.getId(), account.getUserEmail(), account.getValidEndTime());
accountService.toVisitor(account);
}
}
/**
* 关闭此定时器不再从Code-Create上默认创建AiDA游客
* 将Code-Create上注册的用户添加为AiDA的游客
*/
// @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);
}
// @Scheduled(cron = "0 35 14 * * ?")
@Scheduled(cron = "0 5 0 * * ?")
public void checkEduAdminExpireStatus() {
accountService.checkEduAdminExpireStatus();
}
@Scheduled(cron = "0 5 0 * * ?")
public void activeSubscriptionPlan() {
subscriptionPlanService.activeSubscriptionPlan(null);
}
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void expireSubscription() {
subscriptionPlanService.expireSubscription();
}
}

View File

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

View File

@@ -1,21 +1,140 @@
package com.ai.da.common.task;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.utils.DateUtil;
import com.ai.da.mapper.primary.PoseTransformationMapper;
import com.ai.da.mapper.primary.ToProductImageResultMapper;
import com.ai.da.mapper.primary.entity.*;
import com.ai.da.model.vo.PoseTransformationVO;
import com.ai.da.service.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.netty.util.internal.StringUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import static com.ai.da.common.enums.CreditsEventsEnum.TO_PRODUCT_IMAGE;
@Slf4j
@Component
@RequiredArgsConstructor
public class GenerateTask {
private final APIGenerateService apiGenerateService;
private final CreditsService creditsService;
private final GenerateService generateService;
private final PoseTransformationMapper poseTransformationMapper;
private final ToProductImageResultMapper toProductImageResultMapper;
// @Scheduled(cron = "0 0 */1 * * ?")
public void generateScheduled(){
log.info("测试定时器generate");
try{
/*
* 对于使用了第三方api的允许异步获得结果的生成功能可能在第三方接口的结果Ready时没有及时存储结果导致第三方链接失效
* 万相 24h失效
* flux 10mins失效 使用了flux接口的功能 ToProductImage || Relight, Pattern这里不做补偿
* 故这里通过定时任务做补偿
* flux五分钟查询一次万相1小时查询一次
*/
@Scheduled(cron = "0 */4 * * * ?")
public void fluxCompensationMechanism(){
// 1、查所有 任务还没成功、还没失败正在等待或者执行中的任务id有哪些
// 由于获取结果的polling_url在redis中只存一天大部分结果超过一天之后就无法再找到任务小部分可以通过公共路径查到结果
List<APIGenerate> apiGenerates = apiGenerateService.getPendingTaskByStatus("flux");
if (apiGenerates != null && !apiGenerates.isEmpty()){
for (APIGenerate apiGenerate : apiGenerates){
String taskId = apiGenerate.getTaskId();
// 1. 根据taskId查toProductImageResult 判断当前任务状态与超时状态
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectOne(new QueryWrapper<ToProductImageResult>().eq("task_id", taskId));
if (Objects.nonNull(toProductImageResult) && "Pending".equals(toProductImageResult.getStatus())){
// 判断当前任务的超时状态
if (!DateUtil.isMoreThanOneDayApart(toProductImageResult.getCreateTime())){
// 1. 未超时,获取当前任务结果
String fileName = toProductImageResult.getResultType().equals(TO_PRODUCT_IMAGE.getName()) ? "product_image" : "relight_image";
String objectName = apiGenerate.getAccountId() + "/" + fileName +"/" + taskId + ".png";
String fluxResult = generateService.getFluxResult(taskId, objectName);
}catch(Exception e){
// 2. 成功获取结果下载图片上传至minio,更新toProductImageResult表
if (StringUtil.isNullOrEmpty(fluxResult) || fluxResult.equals("Fail")){
toProductImageResult.setStatus("Fail");
toProductImageResultMapper.updateById(toProductImageResult);
apiGenerate.setStatus("Fail");
apiGenerate.setUpdateTime(LocalDateTime.now());
apiGenerateService.updateById(apiGenerate);
} else if (!fluxResult.equals("Pending")){
if (StringUtil.isNullOrEmpty(toProductImageResult.getUrl())){
toProductImageResult.setStatus("Success");
toProductImageResult.setUrl(fluxResult);
toProductImageResultMapper.updateById(toProductImageResult);
apiGenerate.setStatus("Success");
apiGenerate.setUpdateTime(LocalDateTime.now());
apiGenerateService.updateById(apiGenerate);
}
// 扣积分
Boolean flag = creditsService.taskCreditsDeduction(apiGenerate.getAccountId(), taskId);
if (flag) creditsService.updateChangedCredits(String.valueOf(apiGenerate.getAccountId()), taskId);
}
} else {
// 超时,设置状态为失败
toProductImageResult.setStatus("Fail");
toProductImageResultMapper.updateById(toProductImageResult);
apiGenerate.setStatus("Fail");
apiGenerate.setUpdateTime(LocalDateTime.now());
apiGenerateService.updateById(apiGenerate);
}
// 将积分暂扣区的积分移除
if (toProductImageResult.getStatus().equals("Fail")){
creditsService.deleteCreditsDeduction(apiGenerate.getAccountId(), taskId);
}
}
}
}
}
// 万相 -> pose transformation 补偿 当前任务执行完后5分钟再执行一次不会出现任务重叠的情况
@Scheduled(fixedDelay = 5 * 60 * 1000)
public void wxCompensationMechanism(){
List<APIGenerate> apiGenerates = apiGenerateService.getPendingTaskByStatus("wx");
if (apiGenerates != null && !apiGenerates.isEmpty()){
log.info("=====万相补偿获取结果开始=====");
for (APIGenerate apiGenerate : apiGenerates){
String taskId = apiGenerate.getTaskId();
PoseTransformation poseTransformation = poseTransformationMapper.selectOne(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
if (Objects.nonNull(poseTransformation) && ("Pending".equals(poseTransformation.getTaskStatus()) || "Executing".equals(poseTransformation.getTaskStatus()))){
// 判断当前任务的超时状态
if (!DateUtil.isMoreThanOneDayApart(poseTransformation.getCreateTime())){
try {
// 方法中已经完成了pose_transformation和api_generate表的更新不用额外做处理
PoseTransformationVO animateResult = generateService.getAnimateResult(taskId);
if (animateResult.getStatus().equals("Success")){
log.info("补偿获取结果成功,发送系统消息");
}
} catch (BusinessException e){
log.warn("万相 animation 生成失败,原因:{}", e.getMessage());
}
}
} else {
poseTransformation.setTaskStatus("Fail");
poseTransformation.setUpdateTime(LocalDateTime.now());
poseTransformationMapper.updateById(poseTransformation);
apiGenerate.setStatus("Fail");
apiGenerate.setUpdateTime(LocalDateTime.now());
apiGenerateService.updateById(apiGenerate);
generateService.sendSysMsgForPT(poseTransformation);
}
}
}
}
}

View File

@@ -0,0 +1,216 @@
//package com.ai.da.common.task;
//
//import com.ai.da.common.utils.CopyUtil;
//import com.ai.da.common.utils.ExcelReader;
//import com.ai.da.common.utils.MinioUtil;
//import com.ai.da.common.utils.SendEmailUtil;
//import com.ai.da.mapper.primary.*;
//import com.ai.da.mapper.primary.entity.*;
//import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
//import com.ai.da.mapper.third.*;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.poi.ss.usermodel.Row;
//import org.apache.poi.ss.usermodel.Sheet;
//import org.apache.poi.ss.usermodel.Workbook;
//import org.apache.poi.xssf.usermodel.XSSFWorkbook;
//import org.springframework.stereotype.Component;
//import org.springframework.util.CollectionUtils;
//
//import jakarta.annotation.PostConstruct;
//import jakarta.annotation.Resource;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.nio.file.Files;
//import java.nio.file.Paths;
//import java.time.LocalDate;
//import java.time.format.DateTimeFormatter;
//import java.util.List;
//import java.util.concurrent.ExecutorService;
//import java.util.concurrent.Executors;
//import java.util.concurrent.TimeUnit;
//import java.util.stream.Collectors;
//
//@Component
//public class MoveDataScheduler {
//
// @PostConstruct
// public void test() {
// moveData();
// }
//
// @Resource
// private UserLikeGroupMapper userLikeGroupMapper;
// @Resource
// private UserLikeGroupZSMapper userLikeGroupZSMapper;
// @Resource
// private UserLikeMapper userLikeMapper;
// @Resource
// private UserLikeZSMapper userLikeZSMapper;
// @Resource
// private CollectionElementMapper collectionElementMapper;
// @Resource
// private CollectionElementZSMapper collectionElementZSMapper;
//
// @Resource
// private CollectionMapper collectionMapper;
//
// @Resource
// private CollectionZSMapper collectionZSMapper;
//
// @Resource
// private DesignMapper designMapper;
//
// @Resource
// private DesignZSMapper designZSMapper;
//
// @Resource
// private DesignItemMapper designItemMapper;
//
// @Resource
// private DesignItemZSMapper designItemZSMapper;
//
// @Resource
// private TDesignPythonOutfitMapper designPythonOutfitMapper;
//
// @Resource
// private TDesignPythonOutfitZSMapper designPythonOutfitZSMapper;
//
// @Resource
// private TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
//
// @Resource
// private TDesignPythonOutfitDetailZSMapper designPythonOutfitDetailZSMapper;
//
// @Resource
// private DesignItemDetailMapper designItemDetailMapper;
// @Resource
// private DesignItemZSDetailMapper designItemDetailZSMapper;
//
// @Resource
// private DesignItemDetailPrintMapper designItemDetailPrintMapper;
//
// @Resource
// private DesignItemDetailPrintZSMapper designItemDetailPrintZSMapper;
//
//
// private void moveData() {
// // 查询用户所有history记录
// QueryWrapper<UserLikeGroup> userLikeGroupQueryWrapper = new QueryWrapper<>();
// userLikeGroupQueryWrapper.lambda().eq(UserLikeGroup::getAccountId, 11411);
// List<UserLikeGroup> userLikeGroupList = userLikeGroupMapper.selectList(userLikeGroupQueryWrapper);
//
// for (UserLikeGroup userLikeGroup : userLikeGroupList) {
//
// com.ai.da.mapper.third.entity.UserLikeGroup userLikeGroupZS = CopyUtil.copyObject(userLikeGroup, com.ai.da.mapper.third.entity.UserLikeGroup.class);
// userLikeGroupZS.setAccountId(11420L);
// userLikeGroupZS.setId(null);
// Collection collection = collectionMapper.selectById(userLikeGroup.getCollectionId());
// com.ai.da.mapper.third.entity.Collection collectionZS = CopyUtil.copyObject(collection, com.ai.da.mapper.third.entity.Collection.class);
// collectionZS.setAccountId(11420L);
// collectionZS.setId(null);
//
// if (collection.getMoodTemplateId() != null) {
// CollectionElement element = collectionElementMapper.selectById(collection.getMoodTemplateId());
// com.ai.da.mapper.third.entity.CollectionElement collectionElementZS = CopyUtil.copyObject(element, com.ai.da.mapper.third.entity.CollectionElement.class);
// collectionElementZS.setAccountId(11420L);
// collectionElementZS.setId(null);
// collectionElementZSMapper.insert(collectionElementZS);
// collectionZS.setMoodTemplateId(String.valueOf(collectionElementZS.getId()));
// }
// collectionZSMapper.insert(collectionZS);
// userLikeGroupZS.setCollectionId(collectionZS.getId());
// userLikeGroupZSMapper.insert(userLikeGroupZS);
//
// // 生成元素
// QueryWrapper<CollectionElement> collectionElementQueryWrapper = new QueryWrapper<>();
// collectionElementQueryWrapper.lambda().eq(CollectionElement::getCollectionId, userLikeGroup.getCollectionId());
// List<CollectionElement> collectionElements = collectionElementMapper.selectList(collectionElementQueryWrapper);
//
// for (CollectionElement collectionElement : collectionElements) {
// com.ai.da.mapper.third.entity.CollectionElement collectionElementZS = CopyUtil.copyObject(collectionElement, com.ai.da.mapper.third.entity.CollectionElement.class);
// collectionElementZS.setId(null);
// collectionElementZS.setAccountId(11420L);
// collectionElementZS.setCollectionId(collectionZS.getId());
// collectionElementZSMapper.insert(collectionElementZS);
// }
//
// // 查询记录关联
// QueryWrapper<UserLike> userLikeQueryWrapper = new QueryWrapper<>();
// userLikeQueryWrapper.lambda().eq(UserLike::getUserLikeGroupId, userLikeGroup.getId());
// List<UserLike> userLikes = userLikeMapper.selectList(userLikeQueryWrapper);
// for (UserLike userLike : userLikes) {
// Design design = designMapper.selectById(userLike.getDesignId());
// com.ai.da.mapper.third.entity.Design designZS = CopyUtil.copyObject(design, com.ai.da.mapper.third.entity.Design.class);
// designZS.setId(null);
// designZS.setAccountId(11420L);
// designZS.setCollectionId(collectionZS.getId());
// designZSMapper.insert(designZS);
//
// com.ai.da.mapper.third.entity.UserLike userLikeZS = CopyUtil.copyObject(userLike, com.ai.da.mapper.third.entity.UserLike.class);
//// Design design = designMapper.selectById(userLike.getDesignId());
// userLikeZS.setId(null);
// DesignItem designItem = designItemMapper.selectById(userLike.getDesignItemId());
// com.ai.da.mapper.third.entity.DesignItem designItemZS = CopyUtil.copyObject(designItem, com.ai.da.mapper.third.entity.DesignItem.class);
// designItemZS.setId(null);
// designItemZS.setAccountId(11420L);
// designItemZS.setDesignId(designZS.getId());
// designItemZSMapper.insert(designItemZS);
//
// QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
// designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItem.getId());
// List<DesignItemDetail> designItemDetails = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
// for (DesignItemDetail designItemDetail : designItemDetails) {
// com.ai.da.mapper.third.entity.DesignItemDetail designItemDetailZS = CopyUtil.copyObject(designItemDetail, com.ai.da.mapper.third.entity.DesignItemDetail.class);
// designItemDetailZS.setId(null);
// designItemDetailZS.setDesignItemId(designItemZS.getId());
// designItemDetailZS.setAccountId(11420L);
// designItemDetailZS.setDesignId(designZS.getId());
// designItemDetailZSMapper.insert(designItemDetailZS);
//
// QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
// designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetail.getId());
// List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailPrintMapper.selectList(designItemDetailPrintQueryWrapper);
// if (!CollectionUtils.isEmpty(designItemDetailPrintList)) {
// for (DesignItemDetailPrint designItemDetailPrint : designItemDetailPrintList) {
// com.ai.da.mapper.third.entity.DesignItemDetailPrint designItemDetailPrintZS = CopyUtil.copyObject(designItemDetailPrint, com.ai.da.mapper.third.entity.DesignItemDetailPrint.class);
// designItemDetailPrintZS.setId(null);
// designItemDetailPrintZS.setDesignItemDetailId(designItemDetailZS.getId());
// designItemDetailPrintZSMapper.insert(designItemDetailPrintZS);
// }
// }
// }
//
// userLikeZS.setDesignItemId(designItemZS.getId());
// TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(userLike.getDesignOutfitId());
// com.ai.da.mapper.third.entity.TDesignPythonOutfit tDesignPythonOutfitZS = CopyUtil.copyObject(tDesignPythonOutfit, com.ai.da.mapper.third.entity.TDesignPythonOutfit.class);
// tDesignPythonOutfitZS.setId(null);
// tDesignPythonOutfitZS.setDesignItemId(designItemZS.getId());
// tDesignPythonOutfitZS.setCollectionId(collectionZS.getId());
// tDesignPythonOutfitZS.setUserId(11420L);
// tDesignPythonOutfitZS.setDesignId(designZS.getId());
// designPythonOutfitZSMapper.insert(tDesignPythonOutfitZS);
//
// userLikeZS.setUserLikeGroupId(userLikeGroupZS.getId());
// userLikeZS.setDesignId(designZS.getId());
// userLikeZS.setDesignOutfitId(tDesignPythonOutfitZS.getId());
// userLikeZSMapper.insert(userLikeZS);
//
// QueryWrapper<TDesignPythonOutfitDetail> designPythonOutfitDetailQueryWrapper = new QueryWrapper<>();
// designPythonOutfitDetailQueryWrapper.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, tDesignPythonOutfit.getId());
// List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(designPythonOutfitDetailQueryWrapper);
// for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
// com.ai.da.mapper.third.entity.TDesignPythonOutfitDetail tDesignPythonOutfitDetailZS = CopyUtil.copyObject(tDesignPythonOutfitDetail, com.ai.da.mapper.third.entity.TDesignPythonOutfitDetail.class);
// tDesignPythonOutfitDetailZS.setDesignPythonOutfitId(tDesignPythonOutfitZS.getId());
// tDesignPythonOutfitDetailZS.setId(null);
// tDesignPythonOutfitDetailZS.setDesignId(designZS.getId());
// designPythonOutfitDetailZSMapper.insert(tDesignPythonOutfitDetailZS);
// }
// }
// }
//
//
// }
//
//
//}

View File

@@ -0,0 +1,129 @@
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 jakarta.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(fixedRate = 60000)
public void syncLinkViewCountToDB(){
affiliateService.syncLinkViewCountToDB();
}
// @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();
}
}

View File

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

View File

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

View File

@@ -0,0 +1,144 @@
package com.ai.da.common.task;
import com.ai.da.common.utils.SendEmailUtil;
import com.ai.da.mapper.primary.AccountMapper;
import com.ai.da.mapper.primary.SubscriptionInfoMapper;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.SubscriptionInfo;
import com.ai.da.service.StripeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.netty.util.internal.StringUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Component
@RequiredArgsConstructor
public class SubscriptionReminderTask {
public final AccountMapper accountMapper;
public final SubscriptionInfoMapper subscriptionInfoMapper;
public final StripeService stripeService;
// 订阅类型与提前天数的映射配置
private static final Map<String, Integer> REMINDER_DAYS_CONFIG = new HashMap<>();
static {
REMINDER_DAYS_CONFIG.put("month", 7);
REMINDER_DAYS_CONFIG.put("year", 14);
}
// @Scheduled(cron = "0 0 9 * * ?")
public void subscriptionReminder() {
// 获取所有需要通知的订阅
List<SubscriptionInfo> subscriptionInfos = getDueSubscriptions();
for (SubscriptionInfo subscriptionInfo : subscriptionInfos) {
Integer daysBefore = REMINDER_DAYS_CONFIG.get(subscriptionInfo.getType());
if (daysBefore == null) {
log.warn("未知的订阅类型: {}", subscriptionInfo.getType());
continue;
}
String emailType = subscriptionInfo.getStatus().equals("active") ? "reminder_subscriber" : subscriptionInfo.getStatus().equals("canceled") ? "reminder_expire" : null;
if (StringUtil.isNullOrEmpty(emailType)) {
log.warn("未知订阅状态:{}", subscriptionInfo.getStatus());
continue;
}
boolean success = stripeService.sendEmail(subscriptionInfo.getSubscriptionId(), emailType, subscriptionInfo.getOrderNo());
if (success) {
log.info("提前{}天向用户 {} 发送续订通知邮件,订阅类型: {}",
daysBefore, subscriptionInfo.getAccountId(), subscriptionInfo.getType());
}
}
}
private List<SubscriptionInfo> getDueSubscriptions() {
List<SubscriptionInfo> results = new ArrayList<>();
for (Map.Entry<String, Integer> entry : REMINDER_DAYS_CONFIG.entrySet()) {
String subscriptionType = entry.getKey();
int daysBefore = entry.getValue();
results.addAll(getSubscriptionsDueInDays(subscriptionType, daysBefore));
}
return results;
}
private List<SubscriptionInfo> getSubscriptionsDueInDays(String subscriptionType, int daysBefore) {
LocalDateTime targetDate = LocalDateTime.now().plusDays(daysBefore);
LocalDateTime startOfDay = targetDate.toLocalDate().atStartOfDay();
LocalDateTime endOfDay = targetDate.toLocalDate().atTime(23, 59, 59);
// 使用系统默认时区
ZoneId zoneId = ZoneId.systemDefault();
long startTimestamp = startOfDay.atZone(zoneId).toEpochSecond();
long endTimestamp = endOfDay.atZone(zoneId).toEpochSecond();
QueryWrapper<SubscriptionInfo> qw = new QueryWrapper<>();
qw.lambda().ge(SubscriptionInfo::getCurrentPeriodEnd, startTimestamp);
qw.lambda().lt(SubscriptionInfo::getCurrentPeriodEnd, endTimestamp);
// qw.eq("status", "active");
qw.lambda().eq(SubscriptionInfo::getType, subscriptionType);
return subscriptionInfoMapper.selectList(qw);
}
// @Scheduled(cron = "0 0 9 * * ?")
public void trialReminder() {
// 今天的 00:00:00 和 23:59:59
LocalDateTime startOfDay = LocalDateTime.now().toLocalDate().atStartOfDay();
LocalDateTime endOfDay = LocalDateTime.now().toLocalDate().atTime(23, 59, 59);
// 使用系统默认时区
ZoneId zoneId = ZoneId.systemDefault();
long startTimestamp = startOfDay.atZone(zoneId).toEpochSecond() * 1000;
long endTimestamp = endOfDay.atZone(zoneId).toEpochSecond() * 1000;
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().gt(Account::getValidEndTime, startTimestamp)
.lt(Account::getValidEndTime, endTimestamp)
.eq(Account::getSystemUser, 3);
List<Account> accounts = accountMapper.selectList(queryWrapper);
for (Account account : accounts) {
String language = stripeService.getLanguage(account.getLanguage(), account.getCountry(), "reminder_trial");
SendEmailUtil.subscriptionEmailReminder("reminder_trial", null, language, account.getUserEmail());
}
}
/* public void subscriptionReminder(){
// 提前7天的 00:00:00 和 23:59:59
LocalDateTime startOfDay = LocalDateTime.now().plusDays(7).toLocalDate().atStartOfDay();
LocalDateTime endOfDay = LocalDateTime.now().plusDays(7).toLocalDate().atTime(23, 59, 59);
// 转为时间戳
long startTimestamp = startOfDay.toEpochSecond(ZoneOffset.UTC);
long endTimestamp = endOfDay.toEpochSecond(ZoneOffset.UTC);
QueryWrapper<SubscriptionInfo> qw = new QueryWrapper<>();
qw.ge("current_period_end", startTimestamp);
qw.lt("current_period_end", endTimestamp);
qw.eq("status", "active");
List<SubscriptionInfo> subscriptionInfos = subscriptionInfoMapper.selectList(qw);
for (SubscriptionInfo subscriptionInfo : subscriptionInfos) {
boolean b = sendEmail(subscriptionInfo.getSubscriptionId(), "reminder", null);
if (b) log.info("提前7天向用户 {} 发送续订通知邮件", subscriptionInfo.getAccountId());
}
}*/
}

View File

@@ -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 = ''; c <= ''; c++) {
FULL_TO_HALF_MAP.put(c, (char)(c - '' + 'A'));
}
for (char c = ''; c <= ''; c++) {
FULL_TO_HALF_MAP.put(c, (char)(c - '' + 'a'));
}
for (char c = ''; c <= ''; c++) {
FULL_TO_HALF_MAP.put(c, (char)(c - '' + '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 = "birdsyellow";
String converted = convertToHalfWidth(text);
System.out.println("原始文本: " + text);
System.out.println("转换后: " + converted);
}
}

View File

@@ -1,16 +1,14 @@
package com.ai.da.common.utils;
import com.ai.da.common.constant.CommonConstant;
import lombok.extern.slf4j.Slf4j;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
@Slf4j
@@ -18,6 +16,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 +81,27 @@ 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));
}
public static boolean isMoreThanOneDayApart(LocalDateTime givenDateTime) {
LocalDateTime now = LocalDateTime.now();
Duration duration = Duration.between(givenDateTime, now);
return duration.toHours() >= 24;
}
}

View File

@@ -1,6 +1,7 @@
package com.ai.da.common.utils;
import lombok.Data;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@@ -23,9 +24,28 @@ public class ExcelReader {
for (int i = 0; i < numberOfColumns; i++) {
List<String> columnData = new ArrayList<>();
for (Row row : sheet) {
columnData.add(row.getCell(i).getStringCellValue());
Cell cell = row.getCell(i);
if (cell != null) {
switch (cell.getCellType()) {
case STRING:
columnData.add(cell.getStringCellValue());
break;
case NUMERIC:
columnData.add(String.valueOf(cell.getNumericCellValue()));
break;
case BOOLEAN:
columnData.add(String.valueOf(cell.getBooleanCellValue()));
break;
default:
// 跳过空单元格或其他类型(比如错误类型)
break;
}
}
}
// 只有当这一列有数据时,才添加到结果列表中
if (!columnData.isEmpty()) {
data.add(columnData);
}
data.add(columnData);
}
}
return data;

View File

@@ -1,313 +1,325 @@
package com.ai.da.common.utils;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.model.vo.FileVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
public class FileUtil extends cn.hutool.core.io.FileUtil {
private static final Logger log = LoggerFactory.getLogger(com.ai.da.common.utils.FileUtil.class);
/**
* 系统临时目录
* <br>
* windows 包含路径分割符但Linux 不包含,
* 在windows \\==\ 前提下,
* 为安全起见 同意拼装 路径分割符,
* <pre>
* java.io.tmpdir
* windows : C:\Users/xxx\AppData\Local\Temp\
* linux: /temp
* </pre>
*/
public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator;
/**
* 定义GB的计算常量
*/
private static final int GB = 1024 * 1024 * 1024;
/**
* 定义MB的计算常量
*/
private static final int MB = 1024 * 1024;
/**
* 定义KB的计算常量
*/
private static final int KB = 1024;
/**
* 格式化小数
*/
private static final DecimalFormat DF = new DecimalFormat("0.00");
public static final String IMAGE = "图片";
public static final String TXT = "文档";
public static final String MUSIC = "音乐";
public static final String VIDEO = "视频";
public static final String OTHER = "其他";
/**
* MultipartFile转File
*/
public static File toFile(MultipartFile multipartFile) {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = "." + getExtensionName(fileName);
File file = null;
try {
// 用uuid作为文件名防止生成的临时文件重复
file = new File(SYS_TEM_DIR + IdUtil.simpleUUID() + prefix);
// MultipartFile to File
multipartFile.transferTo(file);
} catch (IOException e) {
log.error(e.getMessage(), e);
}
return file;
}
// public static void main(String[] args) {
// File file = new File(
// "http://18.162.111.141:5568/download/202211/userFile/collection/Printboard/1/a3c9838c-2171-44d7-af54-c94ee6affcd9print_2.jpg.png");
// FileUtil.getFileSize()
// }
/**
* 获取文件扩展名,不带 .
*/
public static String getExtensionName(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length() - 1))) {
return filename.substring(dot + 1);
}
}
return filename;
}
/**
* inputStream 转 File
*/
static File inputStreamToFile(InputStream ins, String name) {
File file = new File(SYS_TEM_DIR + name);
if (file.exists()) {
return file;
}
OutputStream os = null;
try {
os = new FileOutputStream(file);
int bytesRead;
int len = 8192;
byte[] buffer = new byte[len];
while ((bytesRead = ins.read(buffer, 0, len)) != -1) {
os.write(buffer, 0, bytesRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
CloseUtil.close(os);
CloseUtil.close(ins);
}
return file;
}
/**
* 获取文件尺寸
*/
public static FileVO getFileSize(MultipartFile file) {
int width = 0;
int height = 0;
try {
// 图片对象
BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
// 宽度
width = bufferedImage.getWidth();
// 高度
height = bufferedImage.getHeight();
} catch (IOException ioException) {
log.error("获取文件尺寸异常###{}", ExceptionUtil.stacktraceToString(ioException));
}
return new FileVO(height, width);
}
/**
* 获取文件尺寸
*/
public static FileVO getFileSize(InputStream inputStream) {
int width = 0;
int height = 0;
try {
// 图片对象
BufferedImage bufferedImage = ImageIO.read(inputStream);
// 宽度
width = bufferedImage.getWidth();
// 高度
height = bufferedImage.getHeight();
} catch (IOException ioException) {
log.error("获取文件尺寸异常###{}", ExceptionUtil.stacktraceToString(ioException));
}
return new FileVO(height, width);
}
/**
* 获取远程文件流
*/
public static InputStream getOriginFile(String path) {
try {
//远程
URL url = new URL(path);
return url.openStream();
} catch (IOException ioException) {
log.error("获取文件尺寸异常###{}###path##{}", ExceptionUtil.stacktraceToString(ioException), path);
throw new BusinessException("get.file.failed");
}
}
/**
* 将文件名解析成文件的上传路径
*/
public static File upload(MultipartFile file, String filePath) {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
String suffix = getExtensionName(file.getOriginalFilename());
String nowStr = format.format(date) + "-";
try {
String fileName = file.getOriginalFilename();
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
String path = filePath + fileSuffix;
// getCanonicalFile 可解析正确各种路径
File dest = new File(path).getCanonicalFile();
// 检测是否存在目录
if (!dest.getParentFile().exists()) {
if (!dest.getParentFile().mkdirs()) {
System.out.println("was not successful.");
}
}
// 文件写入
file.transferTo(dest);
return dest;
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null;
}
/**
* 将文件名解析成文件的上传路径
*/
public static File upload2(MultipartFile file, String filePath) {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
String suffix = getExtensionName(file.getOriginalFilename());
String nowStr = format.format(date) + "-";
try {
String fileName = file.getOriginalFilename();
String path = filePath + fileName;
// getCanonicalFile 可解析正确各种路径
File dest = new File(path).getCanonicalFile();
// 检测是否存在目录
if (!dest.getParentFile().exists()) {
if (!dest.getParentFile().mkdirs()) {
System.out.println("was not successful.");
}
}
// 文件写入
file.transferTo(dest);
return dest;
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null;
}
/**
* 删除文件
*/
public static boolean delete(String path) {
File file = new File(path);
if (file.exists()) {
return file.delete();
}
return false;
}
/**
* 获取指定文件夹下所有文件,不含文件夹里的文件
*
* @param dirFilePath 文件夹路径
* @return
*/
public static List<File> getAllFile(String dirFilePath) {
if (StrUtil.isBlank(dirFilePath)) {
return null;
}
return getAllFile(new File(dirFilePath));
}
/**
* 获取指定文件夹下所有文件,不含文件夹里的文件
*
* @param dirFile 文件夹
* @return
*/
public static List<File> getAllFile(File dirFile) {
// 如果文件夹不存在或着不是文件夹,则返回 null
if (Objects.isNull(dirFile) || !dirFile.exists() || dirFile.isFile()) {
return null;
}
File[] childrenFiles = dirFile.listFiles();
if (Objects.isNull(childrenFiles) || childrenFiles.length == 0) {
return null;
}
List<File> files = new ArrayList<>();
for (File childFile : childrenFiles) {
// 如果是文件,直接添加到结果集合
if (childFile.isFile()) {
files.add(childFile);
}
//以下几行代码取消注释后可以将所有子文件夹里的文件也获取到列表里
else {
// 如果是文件夹,则将其内部文件添加进结果集合
List<File> cFiles = getAllFile(childFile);
if (Objects.isNull(cFiles) || cFiles.isEmpty()) {
continue;
}
files.addAll(cFiles);
}
}
return files;
}
// 判断文件是否存在
public static boolean isFileExists(String filePath) {
File file = new File(filePath);
return file.exists() && file.isFile();
}
// 根据路径获取文件
public static File getFile(String filePath) {
File file = new File(filePath);
if (file.exists() && file.isFile()) {
return file;
} else {
return null;
}
}
}
package com.ai.da.common.utils;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.model.vo.FileVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
public class FileUtil extends cn.hutool.core.io.FileUtil {
private static final Logger log = LoggerFactory.getLogger(com.ai.da.common.utils.FileUtil.class);
/**
* 系统临时目录
* <br>
* windows 包含路径分割符但Linux 不包含,
* 在windows \\==\ 前提下,
* 为安全起见 同意拼装 路径分割符,
* <pre>
* java.io.tmpdir
* windows : C:\Users/xxx\AppData\Local\Temp\
* linux: /temp
* </pre>
*/
public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator;
/**
* 定义GB的计算常量
*/
private static final int GB = 1024 * 1024 * 1024;
/**
* 定义MB的计算常量
*/
private static final int MB = 1024 * 1024;
/**
* 定义KB的计算常量
*/
private static final int KB = 1024;
/**
* 格式化小数
*/
private static final DecimalFormat DF = new DecimalFormat("0.00");
public static final String IMAGE = "图片";
public static final String TXT = "文档";
public static final String MUSIC = "音乐";
public static final String VIDEO = "视频";
public static final String OTHER = "其他";
/**
* MultipartFile转File
*/
public static File toFile(MultipartFile multipartFile) {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = "." + getExtensionName(fileName);
File file = null;
try {
// 用uuid作为文件名防止生成的临时文件重复
file = new File(SYS_TEM_DIR + IdUtil.simpleUUID() + prefix);
// MultipartFile to File
multipartFile.transferTo(file);
} catch (IOException e) {
log.error(e.getMessage(), e);
}
return file;
}
// public static void main(String[] args) {
// File file = new File(
// "http://18.162.111.141:5568/download/202211/userFile/collection/Printboard/1/a3c9838c-2171-44d7-af54-c94ee6affcd9print_2.jpg.png");
// FileUtil.getFileSize()
// }
/**
* 获取文件扩展名,不带 .
*/
public static String getExtensionName(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length() - 1))) {
return filename.substring(dot + 1);
}
}
return filename;
}
/**
* inputStream 转 File
*/
static File inputStreamToFile(InputStream ins, String name) {
File file = new File(SYS_TEM_DIR + name);
if (file.exists()) {
return file;
}
OutputStream os = null;
try {
os = new FileOutputStream(file);
int bytesRead;
int len = 8192;
byte[] buffer = new byte[len];
while ((bytesRead = ins.read(buffer, 0, len)) != -1) {
os.write(buffer, 0, bytesRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
CloseUtil.close(os);
CloseUtil.close(ins);
}
return file;
}
/**
* 获取文件尺寸
*/
public static FileVO getFileSize(MultipartFile file) {
int width = 0;
int height = 0;
try {
// 图片对象
BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
// 宽度
width = bufferedImage.getWidth();
// 高度
height = bufferedImage.getHeight();
} catch (IOException ioException) {
log.error("获取文件尺寸异常###{}", ExceptionUtil.stacktraceToString(ioException));
}
return new FileVO(height, width);
}
/**
* 获取文件尺寸
*/
public static FileVO getFileSize(InputStream inputStream) {
int width = 0;
int height = 0;
try {
// 图片对象
BufferedImage bufferedImage = ImageIO.read(inputStream);
// 宽度
width = bufferedImage.getWidth();
// 高度
height = bufferedImage.getHeight();
} catch (IOException ioException) {
log.error("获取文件尺寸异常###{}", ExceptionUtil.stacktraceToString(ioException));
}
return new FileVO(height, width);
}
/**
* 获取远程文件流
*/
public static InputStream getOriginFile(String path) {
try {
//远程
URL url = new URL(path);
return url.openStream();
} catch (IOException ioException) {
log.error("获取文件异常###{}###path##{}", ExceptionUtil.stacktraceToString(ioException), path);
throw new BusinessException("get.file.failed");
}
}
/**
* 将文件名解析成文件的上传路径
*/
public static File upload(MultipartFile file, String filePath) {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
String suffix = getExtensionName(file.getOriginalFilename());
String nowStr = format.format(date) + "-";
try {
String fileName = file.getOriginalFilename();
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
String path = filePath + fileSuffix;
// getCanonicalFile 可解析正确各种路径
File dest = new File(path).getCanonicalFile();
// 检测是否存在目录
if (!dest.getParentFile().exists()) {
if (!dest.getParentFile().mkdirs()) {
System.out.println("was not successful.");
}
}
// 文件写入
file.transferTo(dest);
return dest;
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null;
}
/**
* 将文件名解析成文件的上传路径
*/
public static File upload2(MultipartFile file, String filePath) {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
String suffix = getExtensionName(file.getOriginalFilename());
String nowStr = format.format(date) + "-";
try {
String fileName = file.getOriginalFilename();
String path = filePath + fileName;
// getCanonicalFile 可解析正确各种路径
File dest = new File(path).getCanonicalFile();
// 检测是否存在目录
if (!dest.getParentFile().exists()) {
if (!dest.getParentFile().mkdirs()) {
System.out.println("was not successful.");
}
}
// 文件写入
file.transferTo(dest);
return dest;
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null;
}
/**
* 删除文件
*/
public static boolean delete(String path) {
File file = new File(path);
if (file.exists()) {
return file.delete();
}
return false;
}
/**
* 获取指定文件夹下所有文件,不含文件夹里的文件
*
* @param dirFilePath 文件夹路径
* @return
*/
public static List<File> getAllFile(String dirFilePath) {
if (StrUtil.isBlank(dirFilePath)) {
return null;
}
return getAllFile(new File(dirFilePath));
}
/**
* 获取指定文件夹下所有文件,不含文件夹里的文件
*
* @param dirFile 文件夹
* @return
*/
public static List<File> getAllFile(File dirFile) {
// 如果文件夹不存在或着不是文件夹,则返回 null
if (Objects.isNull(dirFile) || !dirFile.exists() || dirFile.isFile()) {
return null;
}
File[] childrenFiles = dirFile.listFiles();
if (Objects.isNull(childrenFiles) || childrenFiles.length == 0) {
return null;
}
List<File> files = new ArrayList<>();
for (File childFile : childrenFiles) {
// 如果是文件,直接添加到结果集合
if (childFile.isFile()) {
files.add(childFile);
}
//以下几行代码取消注释后可以将所有子文件夹里的文件也获取到列表里
else {
// 如果是文件夹,则将其内部文件添加进结果集合
List<File> cFiles = getAllFile(childFile);
if (Objects.isNull(cFiles) || cFiles.isEmpty()) {
continue;
}
files.addAll(cFiles);
}
}
return files;
}
// 判断文件是否存在
public static boolean isFileExists(String filePath) {
File file = new File(filePath);
return file.exists() && file.isFile();
}
// 根据路径获取文件
public static File getFile(String filePath) {
File file = new File(filePath);
if (file.exists() && file.isFile()) {
return file;
} else {
return null;
}
}
/**
* 将 FileItem 转换为 MultipartFile
* 用于 Spring Boot 3.x 兼容性CommonsMultipartFile 已移除)
*/
public static MultipartFile fileItemToMultipartFile(org.apache.commons.fileupload.FileItem fileItem) {
String fieldName = fileItem.getFieldName();
String fileName = fileItem.getName();
String contentType = fileItem.getContentType();
byte[] content = fileItem.get();
return new MockMultipartFile(fieldName, fileName, contentType, content);
}
}

View File

@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.ai.da.common.response.Response;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.ServletResponse;
import jakarta.servlet.ServletResponse;
import java.io.PrintWriter;

View File

@@ -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()

View File

@@ -0,0 +1,178 @@
package com.ai.da.common.utils;
import com.ai.da.common.constant.CommonConstant;
import com.ai.da.model.dto.BasicEmailParamDTO;
import com.alibaba.fastjson.JSONObject;
import com.sun.mail.smtp.SMTPTransport;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.InputStreamSource;
import org.springframework.mail.MailException;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;
import jakarta.annotation.Resource;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.*;
import java.util.List;
import java.util.Objects;
@Slf4j
@Component
public class MailUtil {
@Resource
private JavaMailSender javaMailSender;
@Resource
private TemplateEngine templateEngine;
/**
* 发送邮件 - 默认发件人
*
* @param basicEmailParamDTO 发送邮件所需参数
* @param inputStreamSource 附件(如果有)
*/
public int sendMail(BasicEmailParamDTO basicEmailParamDTO, String fileName, InputStreamSource inputStreamSource) throws MessagingException {
MimeMessage mimeMessage = createSimpleMail(basicEmailParamDTO, fileName, inputStreamSource);
// 提取配置
String host;
String username;
String password;
if (StringUtil.isNullOrEmpty(basicEmailParamDTO.getServiceAddress())) {
host = ((JavaMailSenderImpl) javaMailSender).getHost();
} else {
host = basicEmailParamDTO.getServiceAddress();
}
if (StringUtil.isNullOrEmpty(basicEmailParamDTO.getSenderUser())) {
username = ((JavaMailSenderImpl) javaMailSender).getUsername();
} else {
username = basicEmailParamDTO.getSenderUser();
}
if (StringUtil.isNullOrEmpty(basicEmailParamDTO.getServiceAddress())) {
password = ((JavaMailSenderImpl) javaMailSender).getPassword();
} else {
password = basicEmailParamDTO.getPassword();
}
return sendMail(mimeMessage, host, username, password);
}
private int sendMail(MimeMessage mimeMessage, String host, String username, String password) throws MessagingException {
SMTPTransport transport = null;
try {
// 获取 SMTPTransport
transport = (SMTPTransport) mimeMessage.getSession().getTransport("smtp");
// 连接到 SMTP 服务器
transport.connect(host, username, password);
// 发送邮件
transport.sendMessage(mimeMessage, mimeMessage.getAllRecipients());
// 获取 SMTP 服务器的响应
String lastServerResponse = transport.getLastServerResponse();
int lastReturnCode = transport.getLastReturnCode();
log.info("SMTP 状态码: {}, SMTP 服务器响应: {}", lastReturnCode, lastServerResponse);
return lastReturnCode;
} catch (MailException | MessagingException e) {
// 记录日志或执行其他补偿逻辑
log.info("邮件发送失败:{}", e.getMessage());
} finally {
// 关闭连接
assert transport != null;
transport.close();
}
return 0;
}
/**
* 创建一封邮件
*
* @param basicEmailParamDTO 创建邮件需要的参数
* @param inputStreamSource 附件(如果有)
* @return 一封邮件
*/
private MimeMessage createSimpleMail(BasicEmailParamDTO basicEmailParamDTO, String fileName, InputStreamSource inputStreamSource) throws MessagingException {
// 创建邮件对象
MimeMessage message = javaMailSender.createMimeMessage();
// 使用 MimeMessageHelper 简化邮件内容和附件的设置
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(message, true);
// 设置发件人
mimeMessageHelper.setFrom(new InternetAddress(basicEmailParamDTO.getSenderUserMail()));
// 设置收件人
mimeMessageHelper.setTo(basicEmailParamDTO.getMailTo());
// 设置抄送人
if (basicEmailParamDTO.getCc() != null && basicEmailParamDTO.getCc().length > 0) {
mimeMessageHelper.setCc(basicEmailParamDTO.getCc());
}
// 设置暗送人
if (basicEmailParamDTO.getBcc() != null && basicEmailParamDTO.getBcc().length > 0) {
mimeMessageHelper.setBcc(basicEmailParamDTO.getBcc());
}
// 设置邮件主题
mimeMessageHelper.setSubject(basicEmailParamDTO.getSubject());
// 设置邮件内容HTML 格式)
mimeMessageHelper.setText(basicEmailParamDTO.getContent(), true);
// 设置附件
if (inputStreamSource != null) {
mimeMessageHelper.addAttachment(fileName, inputStreamSource);
}
return message;
}
/**
* 设置实体参数
*
* @param mailTo 接收邮件的邮箱地址
* @param jsonObject 模板中变量的值
* @return 返回一个MailEntity
* @throws AddressException 邮箱地址值异常
*/
public BasicEmailParamDTO setBasicEmailParams(List<String> mailTo, JSONObject jsonObject, String templatePath, String title) throws AddressException {
BasicEmailParamDTO basicEmailParamDTO = new BasicEmailParamDTO();
// basicEmailParamDTO.setSenderUserMail("info@aida.com.hk");
basicEmailParamDTO.setSenderUserMail(CommonConstant.senderEmail);
basicEmailParamDTO.setMailTo(getInternetAddressList(mailTo));
basicEmailParamDTO.setSubject(title);
// todo 邮件模板不存在的报错与重试机制
basicEmailParamDTO.setContent(setContent(jsonObject, templatePath));
return basicEmailParamDTO;
}
public BasicEmailParamDTO setBasicEmailParams(List<String> mailTo, String title) throws AddressException {
BasicEmailParamDTO basicEmailParamDTO = new BasicEmailParamDTO();
basicEmailParamDTO.setSenderUserMail("info@aida.com.hk");
basicEmailParamDTO.setMailTo(getInternetAddressList(mailTo));
basicEmailParamDTO.setSubject(title);
return basicEmailParamDTO;
}
/**
* 将地址转换为InternetAddress类型
*
* @param addressList 普通的地址字符串列表
* @return InternetAddress类型的地址列表
* @throws AddressException 地址异常
*/
public InternetAddress[] getInternetAddressList(List<String> addressList) throws AddressException {
InternetAddress[] toAddress = new InternetAddress[addressList.size()];
for (String address : addressList) {
toAddress[addressList.indexOf(address)] = new InternetAddress(address);
}
return toAddress;
}
public String setContent(JSONObject jsonObject, String templatePath) {
Context context = new Context();
if (Objects.nonNull(jsonObject)) {
for (String key : jsonObject.keySet()) {
context.setVariable(key, jsonObject.get(key));
}
}
return templateEngine.process(templatePath, context);
}
}

View File

@@ -1,26 +1,33 @@
package com.ai.da.common.utils;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.constant.CommonConstant;
import com.ai.da.common.response.ResultEnum;
import com.ai.da.mapper.primary.entity.ObjectItem;
import io.minio.*;
import io.minio.errors.MinioException;
import io.minio.errors.*;
import io.minio.http.Method;
import io.minio.messages.DeleteError;
import io.minio.messages.DeleteObject;
import io.minio.messages.Item;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
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.*;
import java.awt.image.BufferedImage;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.io.*;
import java.net.URL;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.*;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -34,6 +41,13 @@ public class MinioUtil {
@Autowired
private MinioClient minioClient;
/**
* 获取MinIO客户端实例
*/
public MinioClient getMinioClient() {
return minioClient;
}
/**
* description: 判断bucket是否存在不存在则创建
*
@@ -357,7 +371,7 @@ public class MinioUtil {
public void deleteObject(String path) {
if (!path.contains("/")) {
throw new BusinessException("The path is error!");
throw new BusinessException("the.path.is.error");
}
int index = path.indexOf("/");
String bucketName = path.substring(0, index);
@@ -375,16 +389,38 @@ public class MinioUtil {
*/
public String getPreSignedUrl(String bucketName, String fileName, int expiry) {
try {
return minioClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.bucket(bucketName)
.object(fileName)
.expiry(expiry, TimeUnit.MINUTES)
.method(Method.GET)
.build()
);
} catch (MinioException | InvalidKeyException | IOException | NoSuchAlgorithmException e) {
String lowerName = fileName.toLowerCase();
boolean isImage = lowerName.endsWith(".jpg") || lowerName.endsWith(".jpeg")
|| lowerName.endsWith(".png") || lowerName.endsWith(".gif");
GetPresignedObjectUrlArgs.Builder builder = GetPresignedObjectUrlArgs.builder()
.bucket(bucketName)
.object(fileName)
.expiry(expiry, TimeUnit.MINUTES)
.method(Method.GET);
if (isImage) {
// 根据后缀名设置正确的 content-type
String contentType = "image/jpeg";
if (lowerName.endsWith(".png")) {
contentType = "image/png";
} else if (lowerName.endsWith(".gif")) { // 新增 GIF
contentType = "image/gif";
}
Map<String, String> queryParams = new HashMap<>();
queryParams.put("response-content-type", contentType);
queryParams.put("response-content-disposition", "inline");
builder.extraQueryParams(queryParams);
}
return minioClient.getPresignedObjectUrl(builder.build());
} catch (MinioException | InvalidKeyException
| IOException | NoSuchAlgorithmException | IllegalArgumentException e) {
e.printStackTrace();
log.error("bucket: {}, object:{}", bucketName, fileName);
throw new BusinessException(e.getMessage());
}
}
@@ -394,7 +430,7 @@ public class MinioUtil {
return LocalCacheUtils.getPresignedUrlCache(path);
} else {
if (!path.contains("/")) {
throw new BusinessException("The path is error!");
throw new BusinessException("the.path.is.error");
}
int index = path.indexOf("/");
String bucketName = path.substring(0, index);
@@ -408,7 +444,7 @@ public class MinioUtil {
public String getPreSignedUrl(String path, int expiry, boolean resetCache) {
if (resetCache || LocalCacheUtils.getPresignedUrlCache(path) == null) {
if (!path.contains("/")) {
throw new BusinessException("The path is error!");
throw new BusinessException("the.path.is.error");
}
int index = path.indexOf("/");
String bucketName = path.substring(0, index);
@@ -441,6 +477,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(
@@ -480,10 +526,438 @@ public class MinioUtil {
return bucketName + "/" + fileName;
} catch (Exception e) {
log.info("base64上传minio失败:{}",e.getMessage());
log.error(e.getMessage());
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());
}
}
public void upload(String url, File file) {
try {
// 分割桶名和对象路径
int firstSlashIndex = url.indexOf("/");
if (firstSlashIndex == -1) {
throw new IllegalArgumentException("URL 格式不正确,无法解析桶名和对象路径");
}
String bucketName = url.substring(0, firstSlashIndex);
String objectName = url.substring(firstSlashIndex + 1);
// 读取文件流
try (FileInputStream fileInputStream = new FileInputStream(file)) {
// 上传到 MinIO
minioClient.putObject(
PutObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.stream(fileInputStream, file.length(), -1)
.contentType("application/zip")
.build()
);
System.out.println("文件上传成功: " + url);
}
} catch (Exception e) {
e.printStackTrace();
System.err.println("文件上传失败: " + e.getMessage());
}
}
public String getImageAsBase64(String path) throws IOException {
int index = path.indexOf("/");
String bucketName = path.substring(0, index);
String fileName = path.substring(index + 1);
// 检查桶是否存在
boolean found = doesObjectExist(bucketName, fileName);
if (!found) {
throw new IOException("Bucket " + bucketName + " does not exist");
}
try (InputStream stream = minioClient.getObject(
GetObjectArgs.builder()
.bucket(bucketName)
.object(fileName)
.build())) {
byte[] bytes = IOUtils.toByteArray(stream);
return Base64.getEncoder().encodeToString(bytes);
} catch (ServerException e) {
throw new RuntimeException(e);
} catch (InsufficientDataException e) {
throw new RuntimeException(e);
} catch (ErrorResponseException e) {
throw new RuntimeException(e);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeyException e) {
throw new RuntimeException(e);
} catch (InvalidResponseException e) {
throw new RuntimeException(e);
} catch (XmlParserException e) {
throw new RuntimeException(e);
} catch (InternalException e) {
throw new RuntimeException(e);
}
}
/**
* 获取压缩后的图片Base64编码
* @param path 图片的minio路径
* @param targetWidth 目标宽度
* @param targetHeight 目标高度
* @return 压缩后的图片Base64编码
* @throws IOException
*/
public String getCompressedImageAsBase64(String path, int targetWidth, int targetHeight) throws IOException {
int index = path.indexOf("/");
String bucketName = path.substring(0, index);
String fileName = path.substring(index + 1);
// 检查桶是否存在
boolean found = doesObjectExist(bucketName, fileName);
if (!found) {
throw new IOException("Bucket " + bucketName + " does not exist");
}
try (InputStream stream = minioClient.getObject(
GetObjectArgs.builder()
.bucket(bucketName)
.object(fileName)
.build())) {
// 读取原始图片
BufferedImage originalImage = ImageIO.read(stream);
if (originalImage == null) {
throw new IOException("无法读取图片: " + path);
}
// 计算压缩比例,保持宽高比
int originalWidth = originalImage.getWidth();
int originalHeight = originalImage.getHeight();
double scaleX = (double) targetWidth / originalWidth;
double scaleY = (double) targetHeight / originalHeight;
double scale = Math.min(scaleX, scaleY); // 选择较小的缩放比例以保持宽高比
int newWidth = (int) (originalWidth * scale);
int newHeight = (int) (originalHeight * scale);
// 创建压缩后的图片
BufferedImage compressedImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = compressedImage.createGraphics();
// 设置高质量渲染
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// 绘制压缩后的图片
g2d.drawImage(originalImage, 0, 0, newWidth, newHeight, null);
g2d.dispose();
// 转换为Base64
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(compressedImage, "JPEG", baos); // 使用JPEG格式以减小文件大小
byte[] imageBytes = baos.toByteArray();
log.info("图片压缩完成: {} -> {}x{} (原始: {}x{})", path, newWidth, newHeight, originalWidth, originalHeight);
return Base64.getEncoder().encodeToString(imageBytes);
} catch (ServerException e) {
throw new RuntimeException(e);
} catch (InsufficientDataException e) {
throw new RuntimeException(e);
} catch (ErrorResponseException e) {
throw new RuntimeException(e);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeyException e) {
throw new RuntimeException(e);
} catch (InvalidResponseException e) {
throw new RuntimeException(e);
} catch (XmlParserException e) {
throw new RuntimeException(e);
} catch (InternalException e) {
throw new RuntimeException(e);
}
}
/**
* 压缩base64格式的图片
* @param base64Image 包含前缀的base64图片字符串 (如: "data:image/png;base64,...")
* @param targetWidth 目标宽度
* @param targetHeight 目标高度
* @return 压缩后的base64图片字符串保持原有前缀格式
*/
public String compressBase64Image(String base64Image, int targetWidth, int targetHeight) {
if (base64Image == null || base64Image.isEmpty()) {
return base64Image;
}
try {
// 解析base64字符串
String[] parts = base64Image.split(",");
if (parts.length != 2) {
log.warn("无效的base64图片格式: {}", base64Image.substring(0, Math.min(50, base64Image.length())));
return base64Image;
}
String prefix = parts[0] + ","; // 保留前缀,如 "data:image/png;base64,"
String base64Data = parts[1];
// 解码base64数据
byte[] imageBytes = Base64.getDecoder().decode(base64Data);
// 读取图片
BufferedImage originalImage = ImageIO.read(new ByteArrayInputStream(imageBytes));
if (originalImage == null) {
log.warn("无法读取base64图片数据");
return base64Image;
}
// 计算压缩比例,保持宽高比
int originalWidth = originalImage.getWidth();
int originalHeight = originalImage.getHeight();
double scaleX = (double) targetWidth / originalWidth;
double scaleY = (double) targetHeight / originalHeight;
double scale = Math.min(scaleX, scaleY); // 选择较小的缩放比例以保持宽高比
int newWidth = (int) (originalWidth * scale);
int newHeight = (int) (originalHeight * scale);
// 如果图片已经比目标尺寸小,则不进行压缩
if (scale >= 1.0) {
log.info("图片尺寸 {}x{} 已小于目标尺寸 {}x{},无需压缩", originalWidth, originalHeight, targetWidth, targetHeight);
return base64Image;
}
// 创建压缩后的图片
BufferedImage compressedImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = compressedImage.createGraphics();
// 设置高质量渲染
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// 绘制压缩后的图片
g2d.drawImage(originalImage, 0, 0, newWidth, newHeight, null);
g2d.dispose();
// 转换为Base64
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(compressedImage, "PNG", baos); // 保持PNG格式以支持透明度
byte[] compressedBytes = baos.toByteArray();
String compressedBase64 = Base64.getEncoder().encodeToString(compressedBytes);
log.info("Base64图片压缩完成: {}x{} -> {}x{} (压缩比: {:.2f})",
originalWidth, originalHeight, newWidth, newHeight, scale);
return prefix + compressedBase64;
} catch (Exception e) {
log.error("压缩base64图片失败", e);
return base64Image; // 出错时返回原图
}
}
public void uploadToMinio(byte[] data, String bucket, String objectName, String contentType) /*throws Exception*/ {
try {
minioClient.putObject(PutObjectArgs.builder()
.bucket(bucket)
.object(objectName)
.stream(new ByteArrayInputStream(data), data.length, -1)
.contentType(contentType)
.build());
} catch (MinioException | IOException | NoSuchAlgorithmException | InvalidKeyException e){
log.error("图片上传到minio出错{}", e.getMessage());
throw new BusinessException("file.upload.fail");
}
}
public String changeToWhiteBackground(String minioPath){
try {
// 1. 使用URL读取远程图片
BufferedImage originalImage = ImageIO.read(new URL(getPreSignedUrl(minioPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME)));
// 2. 透明图检查(新增核心逻辑)
if (!hasTransparency(originalImage)) {
log.info("图片 {} 无透明通道,无需添加白底", minioPath);
return null; // 返回空
}
// 3. 处理图片(例如:转换为白底)
BufferedImage newImage = new BufferedImage(
originalImage.getWidth(),
originalImage.getHeight(),
BufferedImage.TYPE_INT_RGB
);
// 4. 填充白色背景
java.awt.Graphics2D g = newImage.createGraphics();
g.setColor(java.awt.Color.WHITE);
g.fillRect(0, 0, newImage.getWidth(), newImage.getHeight());
g.drawImage(originalImage, 0, 0, null);
g.dispose();
// 5. 输出为Base64
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(newImage, "PNG", baos);
String base64Image = java.util.Base64.getEncoder().encodeToString(baos.toByteArray());
log.info("为图片 {} 添加白色背景", minioPath);
// System.out.println("data:image/png;base64," + base64Image);
return "data:image/png;base64," + base64Image;
// return base64Image;
} catch (Exception e) {
log.error(e.getMessage());
throw new BusinessException("white.bg.add.fail", ResultEnum.PROMPT.getCode());
}
}
/**
* 检测图片是否包含透明通道
*/
private boolean hasTransparency(BufferedImage image) {
// 情况1图像本身支持透明如TYPE_INT_ARGB
if (image.getTransparency() == Transparency.TRANSLUCENT) {
return true;
}
// 情况2检查像素级透明度适用于TYPE_INT_RGB等格式
if (image.getColorModel().hasAlpha()) {
// 抽样检查前100x100像素避免全图扫描的性能问题
int width = Math.min(image.getWidth(), 100);
int height = Math.min(image.getHeight(), 100);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if ((image.getRGB(x, y) >> 24) == 0x00) {
return true; // 发现透明像素
}
}
}
}
return false;
}
/**
* 将A桶中的对象复制到B桶中
* @return
*/
public void copyObject(String sourceBucket, String sourceObject, String targetBucket, String targetObject) {
// 检查目标桶是否存在
boolean found;
try {
found = minioClient.bucketExists(BucketExistsArgs.builder()
.bucket(targetBucket)
.build());
} catch (Exception e) {
log.error("目标桶{},不存在", targetBucket);
throw new BusinessException("Copy object failed");
}
if (found) {
// 复制对象
try {
minioClient.copyObject(
CopyObjectArgs.builder()
.bucket(targetBucket)
.object(targetObject)
.source(
CopySource.builder()
.bucket(sourceBucket)
.object(sourceObject)
.build()
)
.build()
);
} catch (Exception e) {
log.error("对象复制失败");
throw new BusinessException("Copy object failed");
}
log.info("对象复制成功");
} else {
log.error("目标桶{},不存在", targetBucket);
throw new BusinessException("Copy object failed");
}
}
}

View File

@@ -3,11 +3,11 @@ package com.ai.da.common.utils;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequestWrapper;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;

View File

@@ -3,10 +3,10 @@ package com.ai.da.common.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.WriteListener;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponseWrapper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

View File

@@ -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};
}
}

View File

@@ -1,219 +1,659 @@
package com.ai.da.common.utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Slf4j
@Component
public class RedisUtil {
@Resource
private RedisTemplate<String, String> redisTemplate;
public Boolean hasKey(String key){
return redisTemplate.hasKey(key);
}
//- - - - - - - - - - - - - - - - - - - - - ZSet类型 - - - - - - - - - - - - - - - - - - - -
/**
* 向ZSet中添加元素
*/
public void addToZSet(String key, String value, Double score) {
redisTemplate.opsForZSet().add(key, value, score);
}
/**
* 从ZSet中删除元素
*/
public void removeFromZSet(String key, String value) {
redisTemplate.opsForZSet().remove(key, value);
}
/**
* 获取指定元素的当前排列顺序
*/
public Long getRank(String key, String value) {
return redisTemplate.opsForZSet().rank(key, value);
}
/**
* 获取当前ZSet中的最大score
*/
public Double getMaxScore(String key) {
Set<ZSetOperations.TypedTuple<String>> set = redisTemplate.opsForZSet().reverseRangeWithScores(key, 0, 0);
if (!CollectionUtils.isEmpty(set)) {
Double score = set.iterator().next().getScore();
return score + 1.0;
} else {
return 1.0;
}
}
/**
* 判断元素是否存在
*/
public Boolean isElementExistsInZSet(String key, String value) {
return redisTemplate.opsForZSet().score(key, value) != null;
}
/**
* 获取当前ZSet中数据量的总和
*/
public Long getZSetTotalCount(String key) {
return redisTemplate.opsForZSet().zCard(key);
}
public Set<String> getZSetTotalData(String key){
return redisTemplate.opsForZSet().range(key, 0, -1);
}
//- - - - - - - - - - - - - - - - - - - - - set类型 - - - - - - - - - - - - - - - - - - - -
/**
* 将数据放入set缓存
*/
public void addToSet(String key, String value) {
redisTemplate.opsForSet().add(key, value);
}
/**
* 弹出变量中的元素
*/
public void removeFromSet(String key, String value) {
redisTemplate.opsForSet().remove(key, value);
}
/**
* 检查给定的元素是否在变量中。
*/
public Boolean isElementExistsInSet(String key, String obj) {
return redisTemplate.opsForSet().isMember(key, obj);
}
//- - - - - - - - - - - - - - - - - - - - - hash类型 - - - - - - - - - - - - - - - - - - - -
/**
* 加入缓存
*/
public void addToMap(String key, Map<String, String> map) {
redisTemplate.opsForHash().putAll(key, map);
}
/**
* 验证指定 key 下 有没有指定的 hashkey
*/
public Boolean isElementExistsInMap(String key, String hashKey) {
return redisTemplate.opsForHash().hasKey(key, hashKey);
}
/**
* 获取指定key的值string
*/
public String getMapValue(String key1, String key2) {
return String.valueOf(redisTemplate.opsForHash().get(key1, key2));
}
/**
* 删除指定 hash 的 HashKey
*
* @return 删除成功的 数量
*/
public Long removeFromMap(String key, String hashKeys) {
return redisTemplate.opsForHash().delete(key, hashKeys);
}
//- - - - - - - - - - - - - - - - - - - - - String类型 - - - - - - - - - - - - - - - - - - - -
public void addToString(String key, String value){
redisTemplate.opsForValue().set(key,value);
}
public void addToString(String key, String value, Long expiresIn){
redisTemplate.opsForValue().set(key,value,expiresIn, TimeUnit.SECONDS);
}
public String getFromString(String key){
return redisTemplate.opsForValue().get(key);
}
public Set<String> getKeysFromString(String key){
return redisTemplate.keys(key);
}
public List<String> getMultiValue(Set<String> keys){
return redisTemplate.opsForValue().multiGet(keys);
}
public Long getExpire(String key){
return redisTemplate.getExpire(key);
}
public void removeFromString(String key){
redisTemplate.delete(key);
}
public final static String PORTFOLIO_LIKE_KEY = "portfolio:like:";
public void likePost(Long portfolioId, Long userId) {
redisTemplate.opsForSet().add(PORTFOLIO_LIKE_KEY + portfolioId, String.valueOf(userId));
}
public Long getLikeCount(Long portfolioId) {
String key = PORTFOLIO_LIKE_KEY + portfolioId;
return redisTemplate.opsForSet().size(key);
}
public List<Long> getLikedPortfolios(Long userId) {
// 获取所有包含PORTFOLIO_LIKE_KEY的键
Set<String> likedPortfolios = redisTemplate.keys(PORTFOLIO_LIKE_KEY + "*");
// 如果没有喜欢的,返回空列表
if (likedPortfolios == null || likedPortfolios.isEmpty()) {
return new ArrayList<>();
}
// 过滤出包含指定用户ID的键并提取投资组合ID
return likedPortfolios.stream()
.filter(key -> redisTemplate.opsForSet().isMember(key, String.valueOf(userId)))
.map(key -> Long.valueOf(key.replace(PORTFOLIO_LIKE_KEY, "")))
.collect(Collectors.toList());
}
public void unLikePost(Long portfolioId, Long userId) {
redisTemplate.opsForSet().remove(PORTFOLIO_LIKE_KEY + portfolioId, userId.toString());
}
// 检查用户是否喜欢某个作品
public boolean isPostLikedByUser(Long portfolioId, Long userId) {
String key = PORTFOLIO_LIKE_KEY + portfolioId;
Boolean isMember = redisTemplate.opsForSet().isMember(key, userId.toString());
return isMember != null && isMember;
}
public final static String PORTFOLIO_VIEW_KEY = "portfolio:view:";
public void increaseViewCount(Long portfolioId) {
String key = PORTFOLIO_VIEW_KEY + portfolioId;
redisTemplate.opsForValue().increment(key);
}
public Long getViewCount(Long portfolioId) {
String key = PORTFOLIO_VIEW_KEY + portfolioId;
return redisTemplate.opsForValue().increment(key, 0);
}
}
package com.ai.da.common.utils;
import com.ai.da.model.dto.ProgressDTO;
import com.ai.da.python.vo.DesignPythonObject;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import jakarta.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Slf4j
@Component
public class RedisUtil {
@Resource
private RedisTemplate<String, String> redisTemplate;
public final static String FLUX_POLLING_URL = "Flux:";
/**
* 登录 token 在 Redis 中的前缀:
* 最终 key 结构为 login:token:{userId}
*/
public final static String LOGIN_TOKEN_KEY = "login:token:";
public Boolean hasKey(String key){
return redisTemplate.hasKey(key);
}
//- - - - - - - - - - - - - - - - - - - - - ZSet类型 - - - - - - - - - - - - - - - - - - - -
/**
* 向ZSet中添加元素
*/
public void addToZSet(String key, String value, Double score) {
redisTemplate.opsForZSet().add(key, value, score);
}
/**
* 从ZSet中删除元素
*/
public void removeFromZSet(String key, String value) {
redisTemplate.opsForZSet().remove(key, value);
}
/**
* 获取指定元素的当前排列顺序
*/
public Long getRank(String key, String value) {
return redisTemplate.opsForZSet().rank(key, value);
}
/**
* 获取当前ZSet中的最大score
*/
public Double getMaxScore(String key) {
Set<ZSetOperations.TypedTuple<String>> set = redisTemplate.opsForZSet().reverseRangeWithScores(key, 0, 0);
if (!CollectionUtils.isEmpty(set)) {
Double score = set.iterator().next().getScore();
return score + 1.0;
} else {
return 1.0;
}
}
/**
* 判断元素是否存在
*/
public Boolean isElementExistsInZSet(String key, String value) {
return redisTemplate.opsForZSet().score(key, value) != null;
}
/**
* 获取当前ZSet中数据量的总和
*/
public Long getZSetTotalCount(String key) {
return redisTemplate.opsForZSet().zCard(key);
}
public Set<String> getZSetTotalData(String key){
return redisTemplate.opsForZSet().range(key, 0, -1);
}
//- - - - - - - - - - - - - - - - - - - - - set类型 - - - - - - - - - - - - - - - - - - - -
public final static String VIDEO_FINISHED_TASKS = "VideoFinishedTasks";
/**
* 将数据放入set缓存
*/
public void addToSet(String key, String value, Long expiresIn) {
redisTemplate.opsForSet().add(key, value);
// 设置过期时间
redisTemplate.expire(key, expiresIn, TimeUnit.SECONDS);
}
/**
* 弹出变量中的元素
*/
public void removeFromSet(String key, String value) {
redisTemplate.opsForSet().remove(key, value);
}
/**
* 检查给定的元素是否在变量中。
*/
public Boolean isElementExistsInSet(String key, String obj) {
return redisTemplate.opsForSet().isMember(key, obj);
}
//- - - - - - - - - - - - - - - - - - - - - hash类型 - - - - - - - - - - - - - - - - - - - -
/**
* 加入缓存
*/
public void addToMap(String key, Map<String, String> map) {
redisTemplate.opsForHash().putAll(key, map);
}
/**
* 验证指定 key 下 有没有指定的 hashkey
*/
public Boolean isElementExistsInMap(String key, String hashKey) {
return redisTemplate.opsForHash().hasKey(key, hashKey);
}
/**
* 获取指定key的值string
*/
public String getMapValue(String key1, String key2) {
return String.valueOf(redisTemplate.opsForHash().get(key1, key2));
}
/**
* 删除指定 hash 的 HashKey
*
* @return 删除成功的 数量
*/
public Long removeFromMap(String key, String hashKeys) {
return redisTemplate.opsForHash().delete(key, hashKeys);
}
//- - - - - - - - - - - - - - - - - - - - - String类型 - - - - - - - - - - - - - - - - - - - -
public void addToString(String key, String value){
redisTemplate.opsForValue().set(key,value);
}
public void addToString(String key, String value, Long expiresIn){
redisTemplate.opsForValue().set(key,value,expiresIn, TimeUnit.SECONDS);
}
public String getFromString(String key){
return redisTemplate.opsForValue().get(key);
}
public Set<String> getKeysFromString(String key){
return redisTemplate.keys(key);
}
public Long getSize(String key){return redisTemplate.opsForSet().size(key);}
public List<String> getMultiValue(Set<String> keys){
return redisTemplate.opsForValue().multiGet(keys);
}
public Long getExpire(String key){
return redisTemplate.getExpire(key);
}
public void removeFromString(String key){
redisTemplate.delete(key);
}
/**
* 保存登录 token
*
* @param userId 用户 ID
* @param token token 字符串
* @param expireMillis 过期时间(毫秒,通常与 JWT 保持一致)
*/
public void setLoginToken(Long userId, String token, long expireMillis) {
if (expireMillis <= 0) {
// 不设置过期时间,直到手动删除(不推荐)
addToString(LOGIN_TOKEN_KEY + userId, token);
return;
}
long expireSeconds = expireMillis / 1000;
if (expireSeconds <= 0) {
expireSeconds = 1;
}
addToString(LOGIN_TOKEN_KEY + userId, token, expireSeconds);
}
/**
* 获取登录 token
*/
public String getLoginToken(Long userId) {
return getFromString(LOGIN_TOKEN_KEY + userId);
}
/**
* 删除登录 token
*/
public void deleteLoginToken(Long userId) {
removeFromString(LOGIN_TOKEN_KEY + userId);
}
public final static String PORTFOLIO_LIKE_KEY = "portfolio:like:";
public void likePost(Long portfolioId, Long userId) {
redisTemplate.opsForSet().add(PORTFOLIO_LIKE_KEY + portfolioId, String.valueOf(userId));
}
public Long getLikeCount(Long portfolioId) {
String key = PORTFOLIO_LIKE_KEY + portfolioId;
return redisTemplate.opsForSet().size(key);
}
public List<Long> getLikedPortfolios(Long userId) {
// 获取所有包含PORTFOLIO_LIKE_KEY的键
Set<String> likedPortfolios = redisTemplate.keys(PORTFOLIO_LIKE_KEY + "*");
// 如果没有喜欢的,返回空列表
if (likedPortfolios == null || likedPortfolios.isEmpty()) {
return new ArrayList<>();
}
// 过滤出包含指定用户ID的键并提取投资组合ID
return likedPortfolios.stream()
.filter(key -> redisTemplate.opsForSet().isMember(key, String.valueOf(userId)))
.map(key -> Long.valueOf(key.replace(PORTFOLIO_LIKE_KEY, "")))
.collect(Collectors.toList());
}
public void unLikePost(Long portfolioId, Long userId) {
redisTemplate.opsForSet().remove(PORTFOLIO_LIKE_KEY + portfolioId, userId.toString());
}
// 检查用户是否喜欢某个作品
public boolean isPostLikedByUser(Long portfolioId, Long userId) {
String key = PORTFOLIO_LIKE_KEY + portfolioId;
Boolean isMember = redisTemplate.opsForSet().isMember(key, userId.toString());
return isMember != null && isMember;
}
public final static String PORTFOLIO_VIEW_KEY = "portfolio:view:";
public void increaseViewCount(Long portfolioId) {
String key = PORTFOLIO_VIEW_KEY + portfolioId;
redisTemplate.opsForValue().increment(key);
}
public Long getViewCount(Long portfolioId) {
String key = PORTFOLIO_VIEW_KEY + portfolioId;
return redisTemplate.opsForValue().increment(key, 0);
}
public Long getViewCount(String key) {
Object value = redisTemplate.opsForValue().get(key);
if (value instanceof Integer) {
return Long.valueOf((Integer) value);
} else if (value instanceof Long) {
return (Long) value;
} else if (value instanceof String) {
return Long.valueOf((String) value);
} else {
throw new IllegalArgumentException("Unexpected value type");
}
}
public final static String PERSONAL_HOMEPAGE_VIEW_KEY = "PersonalHomepage:view:";
public void increasePersonalHomepageViewCount(Long accountId) {
String key = PERSONAL_HOMEPAGE_VIEW_KEY + accountId;
redisTemplate.opsForValue().increment(key);
}
public Long getPersonalHomepageViewCount(Long accountId) {
String key = PERSONAL_HOMEPAGE_VIEW_KEY + accountId;
return redisTemplate.opsForValue().increment(key, 0);
}
public final static String MOODBOARD_POSITION_KEY = "moodboard:position:";
public void saveMoodboardPosition(Long id, String moodboardPosition) {
addToString(MOODBOARD_POSITION_KEY + id, moodboardPosition);
}
public String getMoodboardPosition(Long id) {
return getFromString(MOODBOARD_POSITION_KEY + id);
}
public final static String NICKNAME_MODIFY_TIMES = "NicknameModifyTimes:";
public final static String UNNAMED_PROJECT_SEQ = "Project:UnnamedProjectSeq:";
public Long increaseCount(String key) {
return redisTemplate.opsForValue().increment(key);
}
public Long getIncrementCount(String key) {
return redisTemplate.opsForValue().increment(key, 0);
}
public void setKeyExpire(String key, Long expire) {
redisTemplate.expire(key, expire, TimeUnit.DAYS);
}
public final static String CHANGE_MAILBOX = "ChangeMailbox:";
// 每天允许通知3次
public final static String UPLOAD_TIMEOUT_REMINDER_COUNTER = "UploadTimeoutReminderCounter";
public void addProcessId(String processId, int progress) {
// Redis 中的键,可以通过 processId 来唯一标识
String redisKey = "process:progress:" + processId;
// 将当前进度存储到 Redis
redisTemplate.opsForValue().set(redisKey, String.valueOf(progress));
// 设置过期时间为 5 分钟300 秒)
redisTemplate.expire(redisKey, 5, TimeUnit.MINUTES);
}
public void addPathToCache(Long collectionId, Long userId, String path) {
// Redis 中的键,唯一标识由 collectionId 和 userId 组成
String redisKey = "path:cache:" + collectionId + ":" + userId;
// 增加路径的计数
redisTemplate.opsForHash().increment(redisKey, path, 1);
// 设置过期时间为 2 小时7200 秒)
redisTemplate.expire(redisKey, 8, TimeUnit.HOURS);
}
public int getPathUsageCount(Long collectionId, Long userId, String path) {
String redisKey = "path:cache:" + collectionId + ":" + userId;
// 获取路径的使用次数
Object count = redisTemplate.opsForHash().get(redisKey, path);
return count != null ? Integer.parseInt(count.toString()) : 0;
}
public void addAssembledObjects(Long collectionId, Set<DesignPythonObject> assembledObjects) {
// Redis 中的键,使用 collectionId 来唯一标识
String redisKey = "collection:assembledObjects:" + collectionId;
// 将 assembledObjects 转换为 JSON 格式存储,避免直接存储对象
String assembledObjectsJson = convertToJson(assembledObjects);
// 使用 Redis 的 set 操作更新集合
redisTemplate.opsForValue().set(redisKey, assembledObjectsJson);
// 设置过期时间为 5 分钟300 秒)
redisTemplate.expire(redisKey, 30, TimeUnit.MINUTES);
}
// 将 Set<DesignPythonObject> 转换为 JSON 格式
private String convertToJson(Set<DesignPythonObject> assembledObjects) {
try {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.writeValueAsString(assembledObjects);
} catch (JsonProcessingException e) {
e.printStackTrace();
return null;
}
}
public Set<DesignPythonObject> getAssembledObjects(Long collectionId) {
// Redis 中的键,使用 collectionId 来唯一标识
String redisKey = "collection:assembledObjects:" + collectionId;
// 从 Redis 获取存储的 JSON 字符串
String assembledObjectsJson = (String) redisTemplate.opsForValue().get(redisKey);
if (assembledObjectsJson == null) {
return new HashSet<>(); // 如果没有找到数据,返回一个空的 Set
}
// 将 JSON 字符串转换为 Set<DesignPythonObject>
return convertFromJson(assembledObjectsJson);
}
// 将 JSON 字符串转换为 Set<DesignPythonObject>
private Set<DesignPythonObject> convertFromJson(String json) {
try {
ObjectMapper objectMapper = new ObjectMapper();
// 使用 TypeReference 来指定目标类型是 Set<DesignPythonObject>
return objectMapper.readValue(json, new TypeReference<Set<DesignPythonObject>>() {});
} catch (JsonProcessingException e) {
e.printStackTrace();
return new HashSet<>(); // 如果转换失败,返回空的 Set
}
}
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);
}
/**
* 记录任务的耗时到Redis
* @param taskKey 任务标识,如 "taskA"
* @param elapsedTime 本次耗时,单位为毫秒
*/
public void recordTaskElapsedTime(String taskKey, long elapsedTime) {
String hashKey = "task:stats";
// 累加总耗时
redisTemplate.opsForHash().increment(hashKey, taskKey + ":totalTime", elapsedTime);
// 增加计数器
redisTemplate.opsForHash().increment(hashKey, taskKey + ":count", 1);
}
/**
* 获取任务的平均耗时
* @param taskKey 任务标识,如 "taskA"
* @return 平均耗时(毫秒)
*/
public double getTaskAverageTime(String taskKey) {
String hashKey = "task:stats";
// 获取总耗时和计数
Object totalTime = redisTemplate.opsForHash().get(hashKey, taskKey + ":totalTime");
Object count = redisTemplate.opsForHash().get(hashKey, taskKey + ":count");
// 计算平均值
if (totalTime == null || count == null) {
return 0;
}
return Double.parseDouble(totalTime.toString()) / Long.parseLong(count.toString());
}
/**
* 清除指定任务的统计数据
* @param taskKey 任务标识,如 "taskA"
*/
public void clearTaskStats(String taskKey) {
String hashKey = "task:stats";
// 删除总耗时和计数器
redisTemplate.opsForHash().delete(hashKey, taskKey + ":totalTime", taskKey + ":count");
}
public void recordTaskElapsedTime(String taskKey, double elapsedTimeInSeconds) {
// 将耗时转换为 BigDecimal并四舍五入保留四位小数
BigDecimal elapsedTime = new BigDecimal(elapsedTimeInSeconds).setScale(4, RoundingMode.HALF_UP);
// 累加总耗时(以毫秒为单位)
redisTemplate.opsForHash().increment("task:stats", taskKey + ":totalTime", elapsedTime.doubleValue());
// 增加计数器
redisTemplate.opsForHash().increment("task:stats", taskKey + ":count", 1);
}
// 获取第一部分Sketch耗时
public double getFirstSketchTime() {
// 获取 "firstSketchTime:totalTime" 对应的值,并返回(单位为秒)
Object time = redisTemplate.opsForHash().get("task:stats", "firstSketchTime:totalTime");
return time != null ? (double) time : 0.0;
}
// 获取第二部分(获取特征值)耗时
public double getGetAttributeRecognitionTime() {
// 获取 "getAttributeRecognitionTime:totalTime" 对应的值,并返回(单位为秒)
Object time = redisTemplate.opsForHash().get("task:stats", "getAttributeRecognitionTime:totalTime");
return time != null ? (double) time : 0.0;
}
// 获取第三部分(搭配 Sketch耗时
public double getOtherSketchTime() {
// 获取 "otherSketchTime:totalTime" 对应的值,并返回(单位为秒)
Object time = redisTemplate.opsForHash().get("task:stats", "otherSketchTime:totalTime");
return time != null ? (double) time : 0.0;
}
// 清理三部分的缓存
public void clearTaskElapsedTimeCache() {
// 删除第一部分的缓存
redisTemplate.opsForHash().delete("task:stats", "firstSketchTime:totalTime");
redisTemplate.opsForHash().delete("task:stats", "firstSketchTime:count");
// 删除第二部分的缓存
redisTemplate.opsForHash().delete("task:stats", "getAttributeRecognitionTime:totalTime");
redisTemplate.opsForHash().delete("task:stats", "getAttributeRecognitionTime:count");
// 删除第三部分的缓存
redisTemplate.opsForHash().delete("task:stats", "otherSketchTime:totalTime");
redisTemplate.opsForHash().delete("task:stats", "otherSketchTime:count");
}
public boolean incrementLikeCount(Long userId, String sketchPath) {
String redisKey = "user_like_count:" + userId;
try {
redisTemplate.opsForHash().increment(redisKey, sketchPath, 1);
return true;
} catch (Exception e) {
log.error("Error incrementing like count for userId {} and sketchPath {}: {}", userId, sketchPath, e.getMessage());
return false;
}
}
public int getLikeCount(Long userId, String sketchPath) {
String redisKey = "user_like_count:" + userId;
Object count = redisTemplate.opsForHash().get(redisKey, sketchPath);
return count != null ? Integer.parseInt(count.toString()) : 0;
}
public void storeMaxLikeCount(Long userId, int maxLikeCount) {
String redisKey = "user_max_like_count:" + userId;
redisTemplate.opsForValue().set(redisKey, String.valueOf(maxLikeCount));
}
public int getMaxLikeCount(Long userId) {
String redisKey = "user_max_like_count:" + userId;
String maxLikeCount = redisTemplate.opsForValue().get(redisKey);
return maxLikeCount != null ? Integer.parseInt(maxLikeCount) : 0;
}
public final static String IMAGE_SEGMENTATION = "ImageSegmentation:";
public final static String STRIPE_EXCEPTION_LOG = "StripeException:";
public final static String SUBSCRIPTION_SENT_EMAIL_TYPE = "SubscriptionEmailSentType:";
public void batchDeleteKeysWithSamePrefix(String prefix){
Set<String> keys = redisTemplate.keys(prefix + "*");
assert keys != null;
if (!keys.isEmpty()){
redisTemplate.delete(keys);
}
}
public void setTaskProgressDTO(String taskId, ProgressDTO dto) {
String key = "task:progress:" + taskId;
redisTemplate.opsForValue().set(key, JSON.toJSONString(dto), Duration.ofDays(1));
}
public ProgressDTO getTaskProgressDTO(String taskId) {
String key = "task:progress:" + taskId;
String json = redisTemplate.opsForValue().get(key);
if (StringUtils.isBlank(json)) {
// return new ProgressDTO(0, 0, false);
return null;
}
try {
return JSON.parseObject(json, ProgressDTO.class);
} catch (Exception e) {
log.warn("任务进度解析失败 key={}, json={}", key, json);
return new ProgressDTO(0, 0, false, null);
}
}
// Lua脚本原子化操作
/*private static final String RATE_LIMIT_SCRIPT =
"local current = redis.call('INCR', KEYS[1])\n" +
"if tonumber(current) == 1 then\n" +
" redis.call('EXPIRE', KEYS[1], ARGV[1])\n" +
"end\n" +
"return tonumber(current) <= tonumber(ARGV[2])";*/
private static final String RATE_LIMIT_SCRIPT =
"local current = redis.call('INCR', KEYS[1])\n" +
"local ttl = redis.call('TTL', KEYS[1])\n" +
"if tonumber(current) == 1 or tonumber(ttl) == -1 then\n" +
" redis.call('EXPIRE', KEYS[1], ARGV[1])\n" +
"end\n" +
"return tonumber(current) <= tonumber(ARGV[2])";
/**
* 检查是否允许发送
* @param userId 用户ID
* @return true-允许发送false-已超限
*/
public boolean allowSend(Long userId) {
String hourKey = getCurrentHourKey(userId);
// 执行Lua脚本
List<String> keys = Collections.singletonList(hourKey);
List<Long> args = Arrays.asList(
3600L, // 1小时过期
10L // 限制数量 一小时只能向普通用户发10封
);
Boolean result = redisTemplate.execute(
new DefaultRedisScript<>(RATE_LIMIT_SCRIPT, Boolean.class),
keys,
args.toArray()
);
return Boolean.TRUE.equals(result);
}
/**
* 获取当前小时的Key
* 格式email_limit:{userId}:{yyyyMMddHH}
*/
private String getCurrentHourKey(Long userId) {
String hour = LocalDateTime.now()
.format(DateTimeFormatter.ofPattern("yyyyMMddHH"));
return String.format("email_limit:%s:%s", userId, hour);
}
/**
* 获取当前已发送数量
*/
public int getCurrentCount(Long userId) {
String key = getCurrentHourKey(userId);
String val = redisTemplate.opsForValue().get(key);
int count;
if (StringUtils.isBlank(val)){
count = 0;
}else {
count = Integer.parseInt(val);
}
return count;
}
public boolean allowRequest(String apiKey) {
String key = "rate_limit:" + apiKey;
ValueOperations<String, String> ops = redisTemplate.opsForValue();
// 使用Redis的INCR命令
Long count = ops.increment(key, 1);
if (count == 1) {
// 第一次调用,设置过期时间
redisTemplate.expire(key, 1, TimeUnit.MINUTES);
}
return count <= 3;
}
}

View File

@@ -0,0 +1,743 @@
package com.ai.da.common.utils;
import com.ai.da.model.dto.ProgressDTO;
import com.ai.da.python.vo.DesignPythonObject;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Slf4j
@Component
public class RedisUtilEnhance {
@Resource
private RedisTemplate<String, Object> redisTemplate;
private ValueOperations<String, Object> valueOperations;
private SetOperations<String, Object> setOperations;
private HashOperations<String, Object, Object> hashOperations;
private ZSetOperations<String, Object> zSetOperations;
@PostConstruct
public void init() {
this.valueOperations = redisTemplate.opsForValue();
this.setOperations = redisTemplate.opsForSet();
this.hashOperations = redisTemplate.opsForHash();
this.zSetOperations = redisTemplate.opsForZSet();
}
public final static String FLUX_POLLING_URL = "Flux:";
public Boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
//- - - - - - - - - - - - - - - - - - - - - ZSet类型 - - - - - - - - - - - - - - - - - - - -
/**
* 向ZSet中添加元素
*/
public void addToZSet(String key, Object value, Double score) {
zSetOperations.add(key, value, score);
}
/**
* 从ZSet中删除元素
*/
public void removeFromZSet(String key, Object value) {
zSetOperations.remove(key, value);
}
/**
* 获取指定元素的当前排列顺序
*/
public Long getRank(String key, Object value) {
return zSetOperations.rank(key, value);
}
/**
* 获取当前ZSet中的最大score
*/
public Double getMaxScore(String key) {
Set<ZSetOperations.TypedTuple<Object>> set = zSetOperations.reverseRangeWithScores(key, 0, 0);
if (!CollectionUtils.isEmpty(set)) {
Iterator<ZSetOperations.TypedTuple<Object>> iterator = set.iterator();
if (iterator.hasNext()) {
Double score = iterator.next().getScore();
return score != null ? score + 1.0 : 1.0;
}
}
return 1.0;
}
/**
* 判断元素是否存在
*/
public Boolean isElementExistsInZSet(String key, Object value) {
return zSetOperations.score(key, value) != null;
}
/**
* 获取当前ZSet中数据量的总和
*/
public Long getZSetTotalCount(String key) {
return zSetOperations.zCard(key);
}
public Set<Object> getZSetTotalData(String key) {
return zSetOperations.range(key, 0, -1);
}
//- - - - - - - - - - - - - - - - - - - - - set类型 - - - - - - - - - - - - - - - - - - - -
/**
* 将数据放入set缓存
*/
public void addToSet(String key, Object value) {
setOperations.add(key, value);
}
/**
* 弹出变量中的元素
*/
public void removeFromSet(String key, Object value) {
setOperations.remove(key, value);
}
/**
* 检查给定的元素是否在变量中。
*/
public Boolean isElementExistsInSet(String key, Object obj) {
return setOperations.isMember(key, obj);
}
//- - - - - - - - - - - - - - - - - - - - - hash类型 - - - - - - - - - - - - - - - - - - - -
/**
* 加入缓存
*/
public void addToMap(String key, Map<String, String> map) {
hashOperations.putAll(key, map);
}
/**
* 验证指定 key 下 有没有指定的 hashkey
*/
public Boolean isElementExistsInMap(String key, Object hashKey) {
return hashOperations.hasKey(key, hashKey);
}
/**
* 获取指定key的值string
*/
public String getMapValue(String key1, Object key2) {
Object value = hashOperations.get(key1, key2);
return value != null ? value.toString() : null;
}
/**
* 删除指定 hash 的 HashKey
*
* @return 删除成功的 数量
*/
public Long removeFromMap(String key, Object hashKeys) {
return hashOperations.delete(key, hashKeys);
}
//- - - - - - - - - - - - - - - - - - - - - String/Long/Integer类型支持 - - - - - - - - - - - - - - - - - - - -
/**
* 设置字符串值
*/
public void setString(String key, String value) {
valueOperations.set(key, value);
}
/**
* 设置字符串值并设置过期时间
*/
public void setString(String key, String value, long timeout, TimeUnit unit) {
valueOperations.set(key, value, timeout, unit);
}
/**
* 设置Long值
*/
public void setLong(String key, Long value) {
valueOperations.set(key, value);
}
/**
* 设置Long值并设置过期时间
*/
public void setLong(String key, Long value, long timeout, TimeUnit unit) {
valueOperations.set(key, value, timeout, unit);
}
/**
* 设置Integer值
*/
public void setInteger(String key, Integer value) {
valueOperations.set(key, value);
}
/**
* 设置Integer值并设置过期时间
*/
public void setInteger(String key, Integer value, long timeout, TimeUnit unit) {
valueOperations.set(key, value, timeout, unit);
}
/**
* 设置对象值
*/
public void setObject(String key, Object value, long timeout, TimeUnit unit) {
valueOperations.set(key, value, timeout, unit);
}
/**
* 获取字符串值
*/
public String getString(String key) {
Object value = valueOperations.get(key);
return value != null ? value.toString() : null;
}
/**
* 获取Long值
*/
public Long getLong(String key) {
Object value = valueOperations.get(key);
if (value instanceof Long) {
return (Long) value;
} else if (value instanceof Integer) {
return ((Integer) value).longValue();
} else if (value instanceof String) {
try {
return Long.parseLong((String) value);
} catch (NumberFormatException e) {
log.warn("无法将字符串转换为Long: key={}, value={}", key, value);
return null;
}
} else if (value != null) {
log.warn("不支持的类型转换到Long: key={}, type={}", key, value.getClass().getName());
}
return null;
}
/**
* 获取Long值带默认值
*/
public Long getLong(String key, Long defaultValue) {
try {
Long value = getLong(key);
return value != null ? value : defaultValue;
} catch (Exception e) {
log.warn("获取Long值失败: key={}", key, e);
return defaultValue;
}
}
/**
* 获取Integer值
*/
public Integer getInteger(String key) {
Object value = valueOperations.get(key);
if (value instanceof Integer) {
return (Integer) value;
} else if (value instanceof Long) {
return ((Long) value).intValue();
} else if (value instanceof String) {
try {
return Integer.parseInt((String) value);
} catch (NumberFormatException e) {
log.warn("无法将字符串转换为Integer: key={}, value={}", key, value);
return null;
}
} else if (value != null) {
log.warn("不支持的类型转换到Integer: key={}, type={}", key, value.getClass().getName());
}
return null;
}
/**
* 获取Integer值带默认值
*/
public Integer getInteger(String key, Integer defaultValue) {
try {
Integer value = getInteger(key);
return value != null ? value : defaultValue;
} catch (Exception e) {
log.warn("获取Integer值失败: key={}", key, e);
return defaultValue;
}
}
/**
* 递增操作
*/
public Long increment(String key, long delta) {
return valueOperations.increment(key, delta);
}
/**
* 递增操作double
*/
public Double increment(String key, double delta) {
return valueOperations.increment(key, delta);
}
//- - - - - - - - - - - - - - - - - - - - - 原有方法适配 - - - - - - - - - - - - - - - - - - - -
public void addToString(String key, String value) {
setString(key, value);
}
public void addToString(String key, String value, Long expiresIn) {
setString(key, value, expiresIn, TimeUnit.SECONDS);
}
public String getFromString(String key) {
return getString(key);
}
public Set<String> getKeysFromString(String pattern) {
Set<String> keys = redisTemplate.keys(pattern);
return keys != null ? keys : Collections.emptySet();
}
public Long getSize(String key) {
return setOperations.size(key);
}
public List<Object> getMultiValue(Set<String> keys) {
return valueOperations.multiGet(keys);
}
public Long getExpire(String key) {
return redisTemplate.getExpire(key);
}
public void removeFromString(String key) {
redisTemplate.delete(key);
}
public final static String PORTFOLIO_LIKE_KEY = "portfolio:like:";
public void likePost(Long portfolioId, Long userId) {
setOperations.add(PORTFOLIO_LIKE_KEY + portfolioId, userId.toString());
}
public Long getLikeCount(Long portfolioId) {
String key = PORTFOLIO_LIKE_KEY + portfolioId;
return setOperations.size(key);
}
public List<Long> getLikedPortfolios(Long userId) {
// 获取所有包含PORTFOLIO_LIKE_KEY的键
Set<String> likedPortfolios = redisTemplate.keys(PORTFOLIO_LIKE_KEY + "*");
// 如果没有喜欢的,返回空列表
if (likedPortfolios == null || likedPortfolios.isEmpty()) {
return new ArrayList<>();
}
// 过滤出包含指定用户ID的键并提取投资组合ID
return likedPortfolios.stream()
.filter(key -> setOperations.isMember(key, userId.toString()))
.map(key -> Long.valueOf(key.replace(PORTFOLIO_LIKE_KEY, "")))
.collect(Collectors.toList());
}
public void unLikePost(Long portfolioId, Long userId) {
setOperations.remove(PORTFOLIO_LIKE_KEY + portfolioId, userId.toString());
}
// 检查用户是否喜欢某个作品
public boolean isPostLikedByUser(Long portfolioId, Long userId) {
String key = PORTFOLIO_LIKE_KEY + portfolioId;
Boolean isMember = setOperations.isMember(key, userId.toString());
return isMember != null && isMember;
}
public final static String PORTFOLIO_VIEW_KEY = "portfolio:view:";
public void increaseViewCount(Long portfolioId) {
String key = PORTFOLIO_VIEW_KEY + portfolioId;
increment(key, 1);
}
public Long getViewCount(Long portfolioId) {
String key = PORTFOLIO_VIEW_KEY + portfolioId;
return getLong(key, 0L);
}
public Long getViewCount(String key) {
return getLong(key, 0L);
}
public final static String PERSONAL_HOMEPAGE_VIEW_KEY = "PersonalHomepage:view:";
public void increasePersonalHomepageViewCount(Long accountId) {
String key = PERSONAL_HOMEPAGE_VIEW_KEY + accountId;
increment(key, 1);
}
public Long getPersonalHomepageViewCount(Long accountId) {
String key = PERSONAL_HOMEPAGE_VIEW_KEY + accountId;
return getLong(key, 0L);
}
public final static String MOODBOARD_POSITION_KEY = "moodboard:position:";
public void saveMoodboardPosition(Long id, String moodboardPosition) {
setString(MOODBOARD_POSITION_KEY + id, moodboardPosition);
}
public String getMoodboardPosition(Long id) {
return getString(MOODBOARD_POSITION_KEY + id);
}
public final static String NICKNAME_MODIFY_TIMES = "NicknameModifyTimes:";
public void increaseCount(String key) {
increment(key, 1);
}
public Long getIncrementCount(String key) {
return getLong(key, 0L);
}
public void setKeyExpire(String key, Long expire) {
redisTemplate.expire(key, expire, TimeUnit.DAYS);
}
public final static String CHANGE_MAILBOX = "ChangeMailbox:";
// 每天允许通知3次
public final static String UPLOAD_TIMEOUT_REMINDER_COUNTER = "UploadTimeoutReminderCounter";
public void addProcessId(String processId, int progress) {
// Redis 中的键,可以通过 processId 来唯一标识
String redisKey = "process:progress:" + processId;
setInteger(redisKey, progress);
redisTemplate.expire(redisKey, 5, TimeUnit.MINUTES);
}
public void addPathToCache(Long collectionId, Long userId, String path) {
// Redis 中的键,唯一标识由 collectionId 和 userId 组成
String redisKey = "path:cache:" + collectionId + ":" + userId;
// 增加路径的计数
hashOperations.increment(redisKey, path, 1);
// 设置过期时间为 2 小时7200 秒)
redisTemplate.expire(redisKey, 2, TimeUnit.HOURS);
}
public int getPathUsageCount(Long collectionId, Long userId, String path) {
String redisKey = "path:cache:" + collectionId + ":" + userId;
// 获取路径的使用次数
Object count = hashOperations.get(redisKey, path);
return count != null ? ((Number) count).intValue() : 0;
}
public void addAssembledObjects(Long collectionId, Set<DesignPythonObject> assembledObjects) {
// Redis 中的键,使用 collectionId 来唯一标识
String redisKey = "collection:assembledObjects:" + collectionId;
// 将 assembledObjects 转换为 JSON 格式存储,避免直接存储对象
String assembledObjectsJson = convertToJson(assembledObjects);
if (assembledObjectsJson != null) {
// 使用 Redis 的 set 操作更新集合
setString(redisKey, assembledObjectsJson);
// 设置过期时间为 5 分钟300 秒)
redisTemplate.expire(redisKey, 30, TimeUnit.MINUTES);
}
}
private String convertToJson(Set<DesignPythonObject> assembledObjects) {
try {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.writeValueAsString(assembledObjects);
} catch (JsonProcessingException e) {
log.error("JSON转换失败", e);
return null;
}
}
public Set<DesignPythonObject> getAssembledObjects(Long collectionId) {
String redisKey = "collection:assembledObjects:" + collectionId;
String assembledObjectsJson = getString(redisKey);
if (assembledObjectsJson == null) {
return new HashSet<>();
}
return convertFromJson(assembledObjectsJson);
}
private Set<DesignPythonObject> convertFromJson(String json) {
try {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(json, new TypeReference<Set<DesignPythonObject>>() {});
} catch (JsonProcessingException e) {
log.error("JSON解析失败", e);
return new HashSet<>();
}
}
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;
increment(key, 1);
}
public Long getAffiliateLinkViewCount(Long accountId) {
String key = AFFILIATE_LINK_VIEW_KEY + accountId;
return getLong(key, 0L);
}
public Long getAndSetKey(String key, Long count) {
Object oldValue = valueOperations.getAndSet(key, count);
if (oldValue instanceof Long) {
return (Long) oldValue;
} else if (oldValue instanceof Integer) {
return ((Integer) oldValue).longValue();
} else if (oldValue instanceof String) {
try {
return Long.parseLong((String) oldValue);
} catch (NumberFormatException e) {
log.warn("无法将字符串转换为Long: key={}, value={}", key, oldValue);
return 0L;
}
}
return 0L;
}
/**
* 记录任务的耗时到Redis
*/
public void recordTaskElapsedTime(String taskKey, long elapsedTime) {
String hashKey = "task:stats";
hashOperations.increment(hashKey, taskKey + ":totalTime", elapsedTime);
hashOperations.increment(hashKey, taskKey + ":count", 1);
}
/**
* 获取任务的平均耗时
*/
public double getTaskAverageTime(String taskKey) {
String hashKey = "task:stats";
Object totalTime = hashOperations.get(hashKey, taskKey + ":totalTime");
Object count = hashOperations.get(hashKey, taskKey + ":count");
if (totalTime == null || count == null) {
return 0;
}
try {
double total = ((Number) totalTime).doubleValue();
long cnt = ((Number) count).longValue();
return cnt > 0 ? total / cnt : 0;
} catch (Exception e) {
log.warn("计算平均耗时失败: taskKey={}", taskKey, e);
return 0;
}
}
/**
* 清除指定任务的统计数据
* @param taskKey 任务标识,如 "taskA"
*/
public void clearTaskStats(String taskKey) {
String hashKey = "task:stats";
// 删除总耗时和计数器
hashOperations.delete(hashKey, taskKey + ":totalTime", taskKey + ":count");
}
public void recordTaskElapsedTime(String taskKey, double elapsedTimeInSeconds) {
// 将耗时转换为 BigDecimal并四舍五入保留四位小数
BigDecimal elapsedTime = new BigDecimal(elapsedTimeInSeconds).setScale(4, RoundingMode.HALF_UP);
hashOperations.increment("task:stats", taskKey + ":totalTime", elapsedTime.doubleValue());
hashOperations.increment("task:stats", taskKey + ":count", 1);
}
// 获取第一部分Sketch耗时
public double getFirstSketchTime() {
Object time = hashOperations.get("task:stats", "firstSketchTime:totalTime");
return time != null ? ((Number) time).doubleValue() : 0.0;
}
// 获取第二部分(获取特征值)耗时
public double getGetAttributeRecognitionTime() {
Object time = hashOperations.get("task:stats", "getAttributeRecognitionTime:totalTime");
return time != null ? ((Number) time).doubleValue() : 0.0;
}
// 获取第三部分(搭配 Sketch耗时
public double getOtherSketchTime() {
Object time = hashOperations.get("task:stats", "otherSketchTime:totalTime");
return time != null ? ((Number) time).doubleValue() : 0.0;
}
// 清理三部分的缓存
public void clearTaskElapsedTimeCache() {
String hashKey = "task:stats";
Object[] keysToDelete = {
"firstSketchTime:totalTime", "firstSketchTime:count",
"getAttributeRecognitionTime:totalTime", "getAttributeRecognitionTime:count",
"otherSketchTime:totalTime", "otherSketchTime:count"
};
hashOperations.delete(hashKey, keysToDelete);
}
public boolean incrementLikeCount(Long userId, String sketchPath) {
String redisKey = "user_like_count:" + userId;
try {
hashOperations.increment(redisKey, sketchPath, 1);
return true;
} catch (Exception e) {
log.error("Error incrementing like count for userId {} and sketchPath {}: {}", userId, sketchPath, e.getMessage());
return false;
}
}
public int getLikeCount(Long userId, String sketchPath) {
String redisKey = "user_like_count:" + userId;
Object count = hashOperations.get(redisKey, sketchPath);
return count != null ? ((Number) count).intValue() : 0;
}
public void storeMaxLikeCount(Long userId, int maxLikeCount) {
String redisKey = "user_max_like_count:" + userId;
setInteger(redisKey, maxLikeCount);
}
public int getMaxLikeCount(Long userId) {
String redisKey = "user_max_like_count:" + userId;
return getInteger(redisKey, 0);
}
public final static String IMAGE_SEGMENTATION = "ImageSegmentation:";
public final static String STRIPE_EXCEPTION_LOG = "StripeException:";
public void batchDeleteKeysWithSamePrefix(String prefix) {
Set<String> keys = redisTemplate.keys(prefix + "*");
if (keys != null && !keys.isEmpty()) {
redisTemplate.delete(keys);
}
}
public void setTaskProgressDTO(String taskId, ProgressDTO dto) {
String key = "task:progress:" + taskId;
setString(key, JSON.toJSONString(dto));
redisTemplate.expire(key, 1, TimeUnit.DAYS);
}
public ProgressDTO getTaskProgressDTO(String taskId) {
String key = "task:progress:" + taskId;
String json = getString(key);
if (StringUtils.isBlank(json)) {
return null;
}
try {
return JSON.parseObject(json, ProgressDTO.class);
} catch (Exception e) {
log.warn("任务进度解析失败 key={}, json={}", key, json);
return new ProgressDTO(0, 0, false, null);
}
}
// Lua脚本
private static final String RATE_LIMIT_SCRIPT =
"local current = redis.call('INCR', KEYS[1])\n" +
"local ttl = redis.call('TTL', KEYS[1])\n" +
"if tonumber(current) == 1 or tonumber(ttl) == -1 then\n" +
" redis.call('EXPIRE', KEYS[1], ARGV[1])\n" +
"end\n" +
"return tonumber(current) <= tonumber(ARGV[2])";
/**
* 检查是否允许发送
* @param userId 用户ID
* @return true-允许发送false-已超限
*/
public boolean allowSend(Long userId) {
String hourKey = getCurrentHourKey(userId);
// 执行Lua脚本
List<String> keys = Collections.singletonList(hourKey);
// 1小时过期限制数量 一小时只能向普通用户发10封
String[] args = new String[]{"3600", "10"};
Boolean result = redisTemplate.execute(
new DefaultRedisScript<>(RATE_LIMIT_SCRIPT, Boolean.class),
keys,
args
);
return Boolean.TRUE.equals(result);
}
/**
* 获取当前小时的Key
*/
private String getCurrentHourKey(Long userId) {
String hour = LocalDateTime.now()
.format(DateTimeFormatter.ofPattern("yyyyMMddHH"));
return String.format("email_limit:%s:%s", userId, hour);
}
/**
* 获取当前已发送数量
*/
public int getCurrentCount(Long userId) {
String key = getCurrentHourKey(userId);
return getInteger(key, 0);
}
public boolean allowRequest(String apiKey) {
String key = "rate_limit:" + apiKey;
// 使用Redis的INCR命令
Long count = increment(key, 1);
if (count == 1) {
redisTemplate.expire(key, 1, TimeUnit.MINUTES);
}
return count <= 3;
}
// 新增方法安全删除key
public boolean safeDelete(String key) {
try {
return Boolean.TRUE.equals(redisTemplate.delete(key));
} catch (Exception e) {
log.error("删除Redis key失败: {}", key, e);
return false;
}
}
// 新增方法:批量设置过期时间
public void batchExpire(Set<String> keys, long timeout, TimeUnit unit) {
if (keys != null && !keys.isEmpty()) {
for (String key : keys) {
redisTemplate.expire(key, timeout, unit);
}
}
}
}

View File

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

View File

@@ -19,7 +19,7 @@ import software.amazon.awssdk.services.s3.presigner.S3Presigner;
import software.amazon.awssdk.services.s3.presigner.model.GetObjectPresignRequest;
import software.amazon.awssdk.services.s3.presigner.model.PresignedGetObjectRequest;
import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.io.*;
import java.time.Duration;
import java.util.*;
@@ -215,7 +215,7 @@ public class S3Util {
public void deleteObject(String path) {
if (!path.contains("/")) {
throw new BusinessException("The path is error!");
throw new BusinessException("the.path.is.error");
}
int index = path.indexOf("/");
String bucketName = path.substring(0, index);
@@ -244,7 +244,7 @@ public class S3Util {
return LocalCacheUtils.getPresignedUrlCache(path);
} else {
if (!path.contains("/")) {
throw new BusinessException("The path is error!");
throw new BusinessException("the.path.is.error");
}
int index = path.indexOf("/");
String bucketName = path.substring(0, index);
@@ -255,6 +255,22 @@ public class S3Util {
}
}
public String getPreSignedUrl(String path, int expiry, boolean resetCache) {
if (resetCache || LocalCacheUtils.getPresignedUrlCache(path) == null) {
if (!path.contains("/")) {
throw new BusinessException("the.path.is.error");
}
int index = path.indexOf("/");
String bucketName = path.substring(0, index);
String fileName = path.substring(index + 1);
String presignedUrl = getPreSignatureUrl(bucketName, fileName, expiry);
LocalCacheUtils.setPresignedUrlCache(path, presignedUrl);
return presignedUrl;
} else {
return LocalCacheUtils.getPresignedUrlCache(path);
}
}
/**
* @param keyName key名称: test/2022/06/123.pdf
* @param signatureDurationTime 有效期 单位:秒

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,207 @@
package com.ai.da.common.utils;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Map;
@Slf4j
@Component
public class SendRequestUtil {
@Value("${ALIYUN_API_KEY}")
private String ALIYUN_API_KEY;
@Value("${FREEPIK_API_KEY}")
private String FREEPIK_API_KEY;
public String sendAliYunPostAsync(String apiUrl, String requestBody){
// 发送POST请求 todo 异常处理
HttpResponse execute = HttpRequest.post(apiUrl)
.header(Header.AUTHORIZATION, "Bearer " + ALIYUN_API_KEY)
.header("X-DashScope-Async", "enable")
.header(Header.CONTENT_TYPE, "application/json")
.body(requestBody)
.timeout(20000) // 设置超时时间20秒
.execute();
int status = execute.getStatus();
if (status == 200){
String body = execute.body();
JSONObject bodyJson = JSONUtil.parseObj(body);
return body;
}
log.warn("请求失败,状态码为 {}", status);
return null;
}
public String sendAliYunPost(String apiUrl, String requestBody){
// 发送POST请求 todo 异常处理
HttpResponse execute = HttpRequest.post(apiUrl)
.header(Header.AUTHORIZATION, "Bearer " + ALIYUN_API_KEY)
.header(Header.CONTENT_TYPE, "application/json")
.body(requestBody)
.timeout(20000) // 设置超时时间20秒
.execute();
int status = execute.getStatus();
if (status == 200){
String body = execute.body();
JSONObject bodyJson = JSONUtil.parseObj(body);
return body;
}
log.warn("请求失败,状态码为 {}", status);
return null;
}
public static final String FREE_PIK = "https://api.freepik.com/v1/ai/beta/text-to-image/reimagine-flux";
public String sendFreepikPost( String requestBody){
// 发送POST请求 todo 异常处理
HttpResponse execute = HttpRequest.post(FREE_PIK)
.header(Header.CONTENT_TYPE, "application/json")
.header("x-freepik-api-key", FREEPIK_API_KEY)
.body(requestBody)
.timeout(20000) // 设置超时时间20秒
.execute();
int status = execute.getStatus();
if (status == 200){
return execute.body();
}
log.warn("请求失败,状态码为 {}", status);
return null;
}
public String sendAliYunGet(String fullUrl){
// 发送GET请求 todo 异常处理
HttpResponse httpResponse = HttpRequest.get(fullUrl)
.header(Header.AUTHORIZATION, "Bearer " + ALIYUN_API_KEY)
.timeout(20000) // 设置超时时间20秒
.execute();
int status = httpResponse.getStatus();
if (status == 200){
return httpResponse.body();
}else {
return null;
}
}
/*public String sendFluxPost(String url, String requestBodyStr){
int status;
String body;
try (HttpResponse execute = HttpRequest.post(url)
.header(Header.CONTENT_TYPE, "application/json")
.header("x-key", "d447a0ac-2291-4f1c-9a36-f7614c385989")
.body(requestBodyStr) // Hutool 会自动处理 JSON 序列化
.timeout(180000) // 设置超时(毫秒)
.execute()) {
status = execute.getStatus();
body = execute.body();
if (status == 200) {
return body;
}
if (status == 402 || status == 403) {
SendEmailUtil.commonExceptionReminder("Flux账户积分不足flux生成任务",
new String[]{"xupei3360@163.com, fangjianliao@aidlab.hk, investigation@aidlab.hk"});
}
}
log.warn("请求失败,状态码为 {}", status);
return null;
}*/
public String sendFluxPost(String url, String requestBodyStr) {
// 尝试两个API key
String[] apiKeys = {"84e8f5d5-b0b3-49aa-b244-ab7ba27e7ae7",
"d447a0ac-2291-4f1c-9a36-f7614c385989"};
boolean[] notified = {false, false}; // 记录是否已发送过不足提醒
for (int i = 0; i < apiKeys.length; i++) {
int status;
String body;
try (HttpResponse execute = HttpRequest.post(url)
.header(Header.CONTENT_TYPE, "application/json")
.header("x-key", apiKeys[i])
.body(requestBodyStr)
.timeout(180000)
.execute()) {
status = execute.getStatus();
body = execute.body();
if (status == 200) {
return body;
}
// 余额不足处理
if (status == 402 || status == 403) {
if (!notified[i]) {
SendEmailUtil.commonExceptionReminder(
"Flux账户积分不足flux生成任务失败。key:" + apiKeys[i],
new String[]{"xupei3360@163.com", "fangjianliao@aidlab.hk", "investigation@aidlab.hk"}
);
notified[i] = true;
}
continue; // 尝试下一个key
}
// 其他错误直接返回null
log.warn("请求失败,状态码为:{}使用key{}", status, apiKeys[i]);
return null;
} catch (Exception e) {
log.error("请求异常使用key{}", apiKeys[i], e);
if (i == apiKeys.length - 1) return null; // 最后一个key也失败则返回null
}
}
log.warn("所有API key均余额不足");
return null;
}
public String sendPost(String url, String requestBodyStr){
int status;
String body;
try (HttpResponse execute = HttpRequest.post(url)
.header("Content-Type", "application/json") // 必须设置 Content-Type
.body(requestBodyStr) // Hutool 会自动处理 JSON 序列化
.timeout(180000) // 设置超时(毫秒)
.execute()) {
status = execute.getStatus();
body = execute.body();
if (status == 200) {
return body;
}
}
log.warn("请求失败,状态码为 {}, body: {}", status, body);
return null;
}
public String sendGet(String url, Map<String, Object> params) {
int status;
String body;
try (HttpResponse execute = HttpRequest.get(url)
.form(params) // 直接传入MapHutool会正确处理
.timeout(180000)
.execute()) {
status = execute.getStatus();
body = execute.body();
if (status == 200) {
return body;
}
} catch (Exception e) {
log.error("请求发生异常: {}", e.getMessage(), e);
return null;
}
log.warn("请求失败,状态码为: {}, body: {}", status, body);
return body;
}
}

View File

@@ -0,0 +1,114 @@
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 jakarta.websocket.*;
import jakarta.websocket.server.PathParam;
import jakarta.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ServerEndpoint(value = "/notification/{id}")
@Component
@Slf4j
public class NotificationConnection {
//连接超时
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, @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());
}
@OnClose
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){
Map<String, String> textMap = JSONObject.parseObject(text, Map.class);
log.info("收到了一条来自 {} 的消息:{} sessionId{}", this.userId, textMap.get("text"), this.session.getId());
// return "已收到你的消息";
if (textMap.get("text").equals("PING")){
sendMsg(JSON.toJSONString("PONG"), this.userId);
}
}
public void sendMsg(String message, Long userId) {
if (userId == null) { // 如果等于null则证明是群发
// 获取当前Map的一个迭代器遍历Map的方式有很多种看着来
// 这个就是遍历这个集合的过程....
for (Map.Entry<Long, NotificationConnection> entry : websockets.entrySet()) {
// 获取每一个Entry实例
// 获取每一个Value而这个Value就是WebSocket的实例
NotificationConnection webSocket = entry.getValue();
// 接下来就是遍历群发
log.info("广播消息 【给用户】 {}发送消息【{}】", webSocket, 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的方式有很多种看着来
// 这个就是遍历这个集合的过程....
for (Map.Entry<Long, NotificationConnection> entry : websockets.entrySet()) {
// 获取每一个Entry实例
// 获取每一个Value而这个Value就是WebSocket的实例
NotificationConnection webSocket = entry.getValue();
// 获取每一个Key这个Key就是用户ID
Long key = entry.getKey();
// 判断用户ID与当前的Key相等
if (userId.equals(key)) {
log.info("私发消息 【给用户】 {}发送消息【{}】", key, message); // 打印
if (webSocket.session.isOpen()){
// 避免因为网络问题或其他原因导致连接突然关闭而报错
try {
webSocket.session.getBasicRemote().sendText(message); // 则发送给当前的用户即可
} catch (IOException e) {
log.error("Failed to send message to session {}: {}", webSocket.session.getId(), e.getMessage());
// 这里可以选择移除关闭的 session
websockets.remove(entry.getKey());
}
}else {
log.info("连接已关闭sessionId:{}, userId:{}", webSocket.session.getId(), key);
websockets.remove(entry.getKey());
}
}
}
}
}
}

View File

@@ -0,0 +1,20 @@
package com.ai.da.common.websocket.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* Configuration of WebSocket
*/
@Configuration
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@ConditionalOnProperty(name = "websocket.enabled", havingValue = "true", matchIfMissing = true)
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}

View File

@@ -1,27 +1,37 @@
package com.ai.da.controller;
import com.ai.da.common.config.exception.BusinessException;
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.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;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Api(tags = "Account模块")
@Tag(name = "Account模块")
@Slf4j
@RestController
@RequestMapping("/api/account")
@@ -30,151 +40,363 @@ public class AccountController {
@Resource
private AccountService accountService;
@ApiOperation(value = "预先登入")
@Operation(summary = "预先登入")
@PostMapping("/preLogin")
public Response<AccountPreLoginVO> preLogin(@Valid @RequestBody AccountPreLoginDTO accountDTO) {
return Response.success(accountService.preLogin(accountDTO));
}
@ApiOperation(value = "登入")
@Operation(summary = "登入")
@PostMapping("/login")
public Response<AccountLoginVO> login(@Valid @RequestBody AccountLoginDTO accountDTO, HttpServletRequest request) {
return Response.success(accountService.login(accountDTO, request));
}
@ApiOperation(value = "绑定邮箱")
@Operation(summary = "绑定邮箱")
@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 = "忘记密码")
@Operation(summary = "忘记密码")
@PostMapping("/resetPwd")
public Response<Boolean> resetPwd(@Valid @RequestBody AccountRegisterDTO accountRegisterDTO) {
return Response.success(accountService.forgetPwd(accountRegisterDTO));
}
@ApiOperation(value = "发送邮件")
@Operation(summary = "发送邮件")
@PostMapping("/sendEmail")
public Response<Boolean> sendEmail(@Valid @RequestBody EmailSendDTO emailSendDTO) {
return Response.success(accountService.sendEmail(emailSendDTO));
}
@ApiOperation(value = "登出")
@Operation(summary = "登出")
@PostMapping("/logout")
public Response<Boolean> logout(@Valid @RequestBody AccountLogoutDTO accountLogoutDTO) {
return Response.success(accountService.logout(accountLogoutDTO));
}
@ApiOperation(value = "是否登入")
@Operation(summary = "是否登入")
@PostMapping("/isLogin")
public Response<Boolean> isLogin(@Valid @RequestBody AccountLogoutDTO accountLogoutDTO) {
return Response.success(accountService.isLogin(accountLogoutDTO));
}
@ApiOperation(value = "获取当前用户语言")
@Operation(summary = "获取当前用户语言")
@PostMapping("/getUserLanguage")
public Response<String> getUserLanguage() {
return Response.success(accountService.getUserLanguage());
}
@ApiOperation(value = "切换当前用户语言")
@Operation(summary = "切换当前用户语言")
@GetMapping("/changeUserLanguage")
public Response<String> changeUserLanguage(String language) {
return Response.success(accountService.changeUserLanguage(language));
}
@ApiOperation(value = "试用用户退出登录")
@Operation(summary = "试用用户退出登录")
@GetMapping("/trialUserLogout")
public Response<Boolean> trialUserLogout() {
return Response.success(accountService.trialUserLogout());
}
@ApiOperation(value = "完成新手教程")
@Operation(summary = "完成新手教程")
@PostMapping("/completeGuidance")
public Response<Boolean> completeGuidance() {
return Response.success(accountService.completeGuidance());
}
@ApiOperation(value = "试用订单列表")
@Operation(summary = "试用订单列表")
@PostMapping("/trialOrderList")
public Response<PageBaseResponse<TrialOrder>> trialOrderList(@Valid @RequestBody TrialOrderDTO trialOrderDTO) {
return Response.success(PageBaseResponse.success(accountService.trialOrderList(trialOrderDTO)));
}
@ApiOperation(value = "通过试用订单审批")
@Operation(summary = "通过试用订单审批")
@PostMapping("/trialOrderApproval")
public Response<Boolean> trialOrderApproval(@RequestParam("ids") List<Long> ids) {
return Response.success(accountService.trialOrderApproval(ids));
}
@ApiOperation(value = "拒绝试用订单审批")
@Operation(summary = "拒绝试用订单审批")
@PostMapping("/trialOrderRefuse")
public Response<Boolean> trialOrderRefuse(@RequestParam("ids") List<Long> ids) {
return Response.success(accountService.trialOrderRefuse(ids));
}
@ApiOperation(value = "获取是否自动审评")
@Operation(summary = "获取是否自动审评")
@PostMapping("/getIsAutoApproval")
public Response<Boolean> getIsAutoApproval() {
return Response.success(accountService.getIsAutoApproval());
}
@ApiOperation(value = "切换是否自动审评")
@Operation(summary = "切换是否自动审评")
@PostMapping("/switchIsAutoApproval")
public Response<Boolean> switchIsAutoApproval() {
return Response.success(accountService.switchIsAutoApproval());
}
@ApiOperation(value = "aws状态检测")
@Operation(summary = "aws状态检测")
@GetMapping("/healthy")
@ResponseStatus(HttpStatus.OK)
public Response<Map<String,Integer>> checkStatus(){
Map<String,Integer> returnMap = new HashMap<>();
returnMap.put("code",200);
public Response<Map<String, Integer>> checkStatus() {
Map<String, Integer> returnMap = new HashMap<>();
returnMap.put("code", 200);
return Response.success(returnMap);
}
@ApiOperation(value = "查询账号到期时间")
@Operation(summary = "查询账号到期时间")
@PostMapping("/getExpiredTime")
public Response<Long> getExpiredTime(){
public Response<Long> getExpiredTime() {
return Response.success(accountService.getExpiredTime());
}
@ApiOperation(value = "免密登录")
@Operation(summary = "免密登录")
@PostMapping("/noLoginRequired")
public Response<AccountLoginVO> noLoginRequired(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO, HttpServletRequest request){
public Response<AccountLoginVO> noLoginRequired(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO, HttpServletRequest request) {
return Response.success(accountService.noLoginRequired(noLoginRequiredDTO, request));
}
@PostMapping("upgradeNotification")
@ApiOperation(value = "升级邮件通知")
@Operation(summary = "升级邮件通知")
public Response<Boolean> upgradeNotification() {
accountService.upgradeNotification();
return Response.success(true);
}
@CrossOrigin
@ApiOperation(value = "广场用户注册")
@Operation(summary = "广场用户注册")
@PostMapping("/designWorksRegister")
public Response<Boolean> designWorksRegister(@Valid @RequestBody AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
return Response.success(accountService.designWorksRegister(accountDesignWorksRegisterDTO));
}
@CrossOrigin
@ApiOperation(value = "广场用户注册")
@Operation(summary = "广场用户注册")
@PostMapping("/designWorksRegisterCode")
public Response<AccountLoginVO> designWorksRegisterCode(@Valid @RequestBody AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
return Response.success(accountService.designWorksRegisterCode(accountDesignWorksRegisterDTO));
public Response<AccountLoginVO> designWorksRegisterCode(@Valid @RequestBody AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO,
HttpServletRequest request) {
return Response.success(accountService.designWorksRegisterCode(accountDesignWorksRegisterDTO, request));
}
/**
* 填写调查问卷
* @return
*/
@ApiOperation(value = "填写调查问卷")
/* @Operation(summary = "填写调查问卷")
@PostMapping("/questionnaire")
public Response<Boolean> questionnaire(@Valid @RequestBody String questionnaireInfo){
return Response.success(accountService.collectQuestionnaires(questionnaireInfo));
}*/
/**
* 参与活动 获取福利
*
* @return
*/
/* @Operation(summary = "参与活动 获取福利")
@GetMapping("/activity")
public Response<String> getActivityBenefits(){
return Response.success(accountService.getActivityBenefits());
}*/
@Operation(summary = "将用户账号过期时间设置为过期当天的235959")
@GetMapping("/setUserValidToDayEnd")
public Response<List<Long>> setUserValidToDayEnd() {
return Response.success(accountService.setUserValidToDayEnd());
}
// 用户上传头像
@Operation(summary = "上传头像")
@PostMapping(path = "/uploadAvatar")
public Response<String> uploadAvatar(@RequestParam("file") MultipartFile file) {
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
throw new BusinessException("file.cannot.be.empty");
}
return Response.success(accountService.uploadAvatar(file));
}
@Operation(summary = "个人主页浏览量增加")
@GetMapping("/viewsIncrease")
public Response<Boolean> viewsGet(@RequestParam("id") Long id) {
return Response.success(accountService.viewsIncrease(id));
}
@Operation(summary = "获取个人主页信息")
@GetMapping("/personalHomepage")
public Response<PersonalHomepageVO> getPersonalHomepage(@RequestParam("id") Long id) {
return Response.success(accountService.getPersonalHomepage(id));
}
@Operation(summary = "getUsernameModifyTimes")
@GetMapping("/getNicknameModifyTimes")
public Response<Long> getNicknameModifyTimes() {
return Response.success(accountService.getNicknameModifyTimes());
}
@Operation(summary = "editUserName")
@GetMapping("/editUserName")
public Response<String> editUserName(@RequestParam("newUserName") String newUserName) {
accountService.editUserName(newUserName);
return Response.success("success");
}
/*@ApiOperation(value = "verifyUserEmail")
@GetMapping("/verifyUserEmail")
public Response<String> verifyUserEmail(@RequestParam("verifyCode") String verifyCode){
accountService.verifyUserEmail(verifyCode);
return Response.success("success");
}
@Operation(summary = "changeUserEmail")
@GetMapping("/changeUserEmail")
public Response<String> changeUserEmail(@RequestParam("newMailbox") String newMailbox){
accountService.changeUserEmail(newMailbox);
return Response.success("success");
}
@Operation(summary = "activateNewEmail")
@GetMapping("/activateNewEmail")
public Response<String> activateNewEmail(@RequestParam("token") String token){
accountService.activateNewEmail(token);
return Response.success("success");
}*/
@PostMapping("halfPricePromotion")
@Operation(summary = "十月半价活动")
public Response<Boolean> halfPricePromotion() {
accountService.halfPricePromotion();
return Response.success(true);
}
@PostMapping("temporaryUpgrade")
@Operation(summary = "临时升级")
public Response<Boolean> temporaryUpgrade() {
accountService.temporaryUpgrade();
return Response.success(true);
}
@PostMapping("enterpriseLogin")
@Operation(summary = "企业登录")
public Response<AccountPreLoginVO> enterpriseLogin(@Valid @RequestBody AccountLoginDTO accountDTO) {
return Response.success(accountService.enterpriseLogin(accountDTO));
}
@PostMapping("schoolLogin")
@Operation(summary = "学校登录")
public Response<AccountPreLoginVO> schoolLogin(@Valid @RequestBody AccountLoginDTO accountDTO) {
return Response.success(accountService.schoolLogin(accountDTO));
}
@PostMapping("organizationNameSearch")
@Operation(summary = "组织名模糊查询")
public Response<Set<String>> organizationNameSearch(@RequestParam("type") String type, @RequestParam(value = "name", required = false) String name) {
return Response.success(accountService.organizationNameSearch(type, name));
}
@PostMapping("addOrUpdateSubAccount")
@Operation(summary = "子账号新增")
public Response<Boolean> addSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
return Response.success(accountService.addSubAccount(addSubAccountDTO));
}
@PostMapping("deleteSubAccount")
@Operation(summary = "子账号删除")
public Response<Boolean> deleteSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
// return Response.success(accountService.deleteSubAccount(addSubAccountDTO));
accountService.removeSubAccount(addSubAccountDTO, UserContext.getUserHolder().getId());
return Response.success();
}
@PostMapping("subAccountList")
@Operation(summary = "子账号查询")
public Response<PageBaseResponse<Account>> subAccountList(@Valid @RequestBody SubAccountPageDTO subAccountPageDTO) {
return Response.success(accountService.subAccountList(subAccountPageDTO));
}
@GetMapping("accountDetail")
@Operation(summary = "账号详情")
public Response<Account> accountDetail(@RequestParam("id") Long id) {
return Response.success(accountService.accountDetail(id));
}
@PostMapping("getAccountDetail")
@Operation(summary = "获取账户信息")
public Response<AccountLoginVO> getAccountDetail() {
return Response.success(accountService.getAccountDetail());
}
@GetMapping("/bindGoogle")
@Operation(summary = "绑定谷歌")
public Response<AccountExtend> bindGoogle(@RequestParam("credential") String credential) {
return Response.success(accountService.bindGoogle(credential));
}
@GetMapping("/bindWeChat")
@Operation(summary = "绑定微信")
public Response<AccountExtend> bindWeChat(@RequestParam("code") String code) {
return Response.success(accountService.bindWeChat(code));
}
@GetMapping("/bindEmail")
@Operation(summary = "绑定邮箱")
public Response<BindEmailVO> bindEmail(@RequestParam("email") String email) {
return Response.success(accountService.bindEmail(email));
}
@GetMapping("/unbindWeChat")
@Operation(summary = "解除绑定微信")
public Response<Boolean> unbindWeChat() {
return Response.success(accountService.unbindWeChat());
}
@GetMapping("/unbindGoogle")
@Operation(summary = "解除绑定谷歌")
public Response<Boolean> unbindGoogle() {
return Response.success(accountService.unbindGoogle());
}
@PostMapping("/updateUserInfo")
@Operation(summary = "更新用户国家、职业信息")
public Response<Boolean> updateUserInfo(@Valid @RequestBody UpdateUserInfoDTO updateUserInfoDTO) {
return Response.success(accountService.updateUserInfo(updateUserInfoDTO));
}
@GetMapping("/subAccountImportExcelDownload")
@Operation(summary = "模板下载")
public void subAccountImportExcelDownload(HttpServletResponse response) {
accountService.subAccountImportExcelDownload(response);
}
@GetMapping("/exportAccountsToExcel")
@Operation(summary = "下载子账号信息")
public void exportAccountsToExcel(HttpServletResponse response) {
accountService.exportAccountsToExcel(response);
}
@PostMapping("/subAccountImport")
@Operation(summary = "模板导入")
public Response<Boolean> subAccountImport(@RequestParam("file") MultipartFile file) {
return Response.success(accountService.subAccountImport(file));
}
/*@GetMapping("/send618Email")
@Operation(summary = "618邮件发送")
public Response<String> send618PromotionEmailTemp() {
accountService.send618PromotionEmailTemp();
return Response.success("success");
}*/
/*@GetMapping("/refreshCreditsMonthly")
@Operation(summary = "刷新子账号积分")
public void refreshCreditsMonthly() {
accountService.refreshCreditsMonthly();
}*/
/*@GetMapping("/checkEduAdminExpireStatus")
@Operation(summary = "检查教育管理员账号到期情况")
public void checkEduAdminExpireStatus() {
accountService.checkEduAdminExpireStatus();
}*/
}

View File

@@ -0,0 +1,136 @@
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.dto.EditReferralDTO;
import com.ai.da.model.dto.ReferralPageQueryDTO;
import com.ai.da.model.vo.AffiliateInvitationDetailsVO;
import com.ai.da.model.vo.AffiliateVO;
import com.ai.da.model.vo.ReferralPageQueryVO;
import com.ai.da.service.AffiliateService;
import com.ai.da.service.ReferralService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/api/affiliate")
@Tag(name = "Affiliate模块")
public class AffiliateController {
@Resource
private AffiliateService affiliateService;
@Resource
private ReferralService referralService;
@Operation(summary = "注册成为affiliate")
@GetMapping("/registration")
public Response<Boolean> completeGuidance(@RequestParam(value = "promotionMethod", required = false) String promotionMethod) {
return Response.success(affiliateService.registerAsAnAffiliate(promotionMethod));
}
@Operation(summary = "获取affiliate列表")
@PostMapping("/list")
public Response<PageBaseResponse<AffiliateVO>> getAffiliateList(@Validated @RequestBody AffiliateQueryDTO affiliateQueryDTO) {
return Response.success(affiliateService.getAffiliateList(affiliateQueryDTO));
}
@Operation(summary = "获取affiliate个人中心")
@GetMapping("/personalCenter")
public Response<AffiliateVO> personalAffiliateCenter() {
return Response.success(affiliateService.personalAffiliateCenter());
}
@Operation(summary = "获取个人佣金图表数据")
@GetMapping("/getPersonalMonthlyIncome")
public Response<BigDecimal[]> getPersonalMonthlyIncome(@RequestParam("year") int year) {
return Response.success(affiliateService.getPersonalMonthlyIncome(year));
}
@Operation(summary = "审批affiliate申请")
@GetMapping("/approval")
public Response<Boolean> applicationApproval(@RequestParam("id") Long id,
@RequestParam("isApproved") Boolean isApproved,
@RequestParam(value = "commission", required = false) Float commission) {
return Response.success(affiliateService.applicationApproval(id, isApproved, commission));
}
@Operation(summary = "编辑affiliate")
@GetMapping("/editAffiliate")
public Response<String> editAffiliate(@RequestParam("id") Long id,
@Parameter(description = "佣金比例", example = "25")
@RequestParam(value = "commission", required = false) Float commission,
@Parameter(description = "操作类型", example = "Active",
schema = @Schema(allowableValues = {"Active", "Inactive", "Delete"}))
@RequestParam(value = "operationType", required = false) String operationType) {
affiliateService.editAffiliate(id, commission, operationType);
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 ");
}*/
@Operation(summary = "affiliate链接浏览量增加")
@GetMapping("/viewsIncrease")
public Response<Boolean> viewsGet(@RequestParam("id") Long id) {
return Response.success(affiliateService.affiliateLinkViewsIncrease(id));
}
@Operation(summary = "获取每个affiliate产生的收入")
@PostMapping("/getEachAffiliateGeneratedRevenue")
public Response<IPage<AffiliateInvitationDetailsVO>> getEachAffiliateGeneratedRevenue(@Validated @RequestBody AffiliateQueryDTO affiliateQueryDTO) {
return Response.success(affiliateService.getEachAffiliateGeneratedRevenue(affiliateQueryDTO));
}
@Operation(summary = "分页获取所有的referral")
@PostMapping("/getReferrals")
public Response<IPage<ReferralPageQueryVO>> getReferrals(@RequestBody ReferralPageQueryDTO referralPageQueryDTO) {
return Response.success(referralService.queryByPage(referralPageQueryDTO));
}
@Operation(summary = "编辑单个referral")
@PostMapping("/editReferral")
public Response<String> editReferral(@Validated @RequestBody EditReferralDTO editReferralDTO) {
referralService.editReferral(editReferralDTO);
return Response.success();
}
@Operation(summary = "批量删除referral")
@PostMapping("/batchDeleteReferral")
public Response<String> batchDeleteReferral(@RequestBody List<Long> idList) {
referralService.deleteReferral(idList);
return Response.success();
}
@Operation(summary = "获取所有affiliate用户名")
@GetMapping("/getAllAffiliateUsername")
public Response<List<Map<String, Object>>> getAllAffiliateUsername() {
return Response.success(affiliateService.getAllAffiliateUsername());
}
}

View File

@@ -1,38 +1,41 @@
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;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import java.util.Map;
@CrossOrigin
@RestController
@RequestMapping("/api/ali-pay")
@Api(tags = "网站支付宝支付")
@Tag(name = "网站支付宝支付")
@Slf4j
public class AliPayController {
@Resource
private AliPayService aliPayService;
@ApiOperation("统一收单下单并支付页面接口的调用")
@PostMapping("/trade/page/pay/{amount}")
public Response<String> tradePagePay(@PathVariable Integer amount, @RequestParam String returnUrl){
@Operation(summary = "统一收单下单并支付页面接口的调用")
@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);
}
@ApiOperation("支付通知")
@Operation(summary = "支付通知")
@PostMapping("/trade/notify")
public String tradeNotify(@RequestParam Map<String, String> params){
return aliPayService.tradeNotify(params);
@@ -43,7 +46,7 @@ public class AliPayController {
* @param orderNo
* @return
*/
@ApiOperation("用户取消订单")
@Operation(summary = "用户取消订单")
@PostMapping("/trade/close/{orderNo}")
public Response<String> cancel(@PathVariable String orderNo){
log.info("取消订单");
@@ -56,7 +59,7 @@ public class AliPayController {
* @param orderNo
* @return
*/
@ApiOperation("查询订单:测试订单状态用")
@Operation(summary = "查询订单:测试订单状态用")
@GetMapping("/trade/query/{orderNo}")
public Response<String> queryOrder(@PathVariable String orderNo) {
log.info("查询订单");
@@ -71,7 +74,7 @@ public class AliPayController {
* @param reason
* @return
*/
@ApiOperation("申请退款")
@Operation(summary = "申请退款")
@PostMapping("/trade/refund/{orderNo}/{reason}")
public Response<String> refunds(@PathVariable String orderNo, @PathVariable String reason){
log.info("申请退款");
@@ -85,7 +88,7 @@ public class AliPayController {
* @return
* @throws Exception
*/
@ApiOperation("查询退款:测试用")
@Operation(summary = "查询退款:测试用")
@GetMapping("/trade/fastpay/refund/{orderNo}")
public Response<String> queryRefund(@PathVariable String orderNo) {
log.info("查询退款");
@@ -100,7 +103,7 @@ public class AliPayController {
* @param type
* @return
*/
@ApiOperation("获取账单url")
@Operation(summary = "获取账单url")
@GetMapping("/bill/downloadurl/query/{billDate}/{type}")
public Response<String> queryTradeBill(
@PathVariable String billDate,

View File

@@ -1,39 +1,42 @@
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;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
@CrossOrigin
@RestController
@RequestMapping("/api/alipay-hk")
@Api(tags = "网站支付 香港支付宝")
@Tag(name = "网站支付 香港支付宝")
@Slf4j
public class AlipayHKController {
@Resource
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);
@Operation(summary = "创建订单")
@PostMapping(value = "/createOrder")
public Response<String> createOrder(@Valid @RequestBody ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request) {
String order = alipayHKService.createOrder(productPurchaseDTO, request);
return Response.success(order);
}
@ApiOperation("支付通知")
@Operation(summary = "支付通知")
@PostMapping("/trade/notify")
public String callback(@RequestBody String paramString){
log.info("alipay-hk callback parameter : {}", paramString);
return alipayHKService.callback(paramString);
}
@ApiOperation("订单查询")
@Operation(summary = "订单查询")
@PostMapping("/trade/query/{orderRef}")
public Response<String> queryOrder(@PathVariable String orderRef){
String s = alipayHKService.queryDetail(orderRef);

View File

@@ -5,15 +5,14 @@ import com.ai.da.model.dto.ClassificationDTO;
import com.ai.da.model.vo.ClassificationVO;
import com.ai.da.service.ClassificationService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
/**
@@ -26,7 +25,7 @@ import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@RequestMapping("/api/classification")
@Api(value = "", tags = "分类")
@Tag(name = "分类")
public class ClassificationController {
@Resource
@@ -37,7 +36,7 @@ public class ClassificationController {
*/
@PostMapping("/saveOrUpdate")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增修改", notes = "传入ClassificationDTO")
@Operation(summary = "新增修改", description = "传入ClassificationDTO")
public Response<Boolean> saveOrUpdate(@Valid @RequestBody ClassificationDTO classificationDTO) {
return Response.success(classificationService.saveOrUpdate(classificationDTO));
}
@@ -47,28 +46,28 @@ public class ClassificationController {
*/
@PostMapping("/delete")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "删除", notes = "传入ClassificationDTO")
@Operation(summary = "删除", description = "传入ClassificationDTO")
public Response<Boolean> delete(@Valid @RequestBody ClassificationDTO classificationDTO) {
return Response.success(classificationService.delete(classificationDTO));
}
@PostMapping("/queryClassification")
@ApiOperationSupport(order = 3)
@ApiModelProperty(value = "查询", notes = "传入ClassificationDTO")
@Operation(summary = "查询", description = "传入ClassificationDTO")
public Response<List<ClassificationVO>> queryClassification(@Valid @RequestBody ClassificationDTO classificationDTO) {
return Response.success(classificationService.queryClassification(classificationDTO));
}
@PostMapping("/relationLibrary")
@ApiOperationSupport(order = 4)
@ApiModelProperty(value = "关联", notes = "传入ClassificationDTO")
@Operation(summary = "关联", description = "传入ClassificationDTO")
public Response<Boolean> relationLibrary(@Valid @RequestBody ClassificationDTO classificationDTO) {
return Response.success(classificationService.relationLibrary(classificationDTO));
}
@PostMapping("/getRelClassificationIdList")
@ApiOperationSupport(order = 5)
@ApiModelProperty(value = "获取关联分类IDList", notes = "传入ClassificationDTO")
@Operation(summary = "获取关联分类IDList", description = "传入ClassificationDTO")
public Response<List<Long>> getRelClassificationIdList(@Valid @RequestBody ClassificationDTO classificationDTO) {
return Response.success(classificationService.getRelClassificationIdList(classificationDTO));
}
@@ -80,7 +79,7 @@ public class ClassificationController {
*/
@PostMapping("/getRelPublicClassificationIdList")
@ApiOperationSupport(order = 5)
@ApiModelProperty(value = "获取关联公共分类IDList", notes = "传入ClassificationDTO")
@Operation(summary = "获取关联公共分类IDList", description = "传入ClassificationDTO")
public Response<List<Long>> getRelPublicClassificationIdList(@Valid @RequestBody ClassificationDTO classificationDTO) {
return Response.success(classificationService.getRelPublicClassificationIdList(classificationDTO));
}
@@ -92,7 +91,7 @@ public class ClassificationController {
*/
@PostMapping("/editRelPublicClassificationIdList")
@ApiOperationSupport(order = 5)
@ApiModelProperty(value = "编辑关联公共分类IDList", notes = "传入ClassificationDTO")
@Operation(summary = "编辑关联公共分类IDList", description = "传入ClassificationDTO")
public Response<Boolean> editRelPublicClassificationIdList(@Valid @RequestBody ClassificationDTO classificationDTO) {
return Response.success(classificationService.editRelPublicClassificationIdList(classificationDTO));
}

View File

@@ -2,62 +2,230 @@ 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.TrialOrderMapper;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.Organization;
import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.UserDesignStatisticDTO;
import com.ai.da.model.dto.*;
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 io.netty.util.internal.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import jakarta.annotation.Nullable;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.*;
@Api(tags = "便利查询")
@Tag(name = "便利查询")
@Slf4j
@RestController
@RequestMapping("/api/inquiry")
public class ConvenientInquiryController {
@Resource
private TrialOrderMapper trialOrderMapper;
@Resource
private DesignMapper designMapper;
@Resource
private ConvenientInquiryService convenientInquiryService;
@Resource
private AccountService accountService;
@ApiOperation("获取当前所有试用用户")
@GetMapping("/getTrial")
public Response<List<TrialOrder>> getTrial(){
Long accountId = UserContext.getUserHolder().getId();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)){
List<TrialOrder> trialOrders = trialOrderMapper.selectList(null);
return Response.success(trialOrders);
}else {
return Response.fail("Sorry, you don't have permission");
}
@Operation(summary = "获取当前所有试用用户")
@PostMapping("/getTrial")
public Response<IPage<TrialOrder>> getTrial(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
return Response.success(convenientInquiryService.getTrial(queryUserConditionsVO));
}
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
@Operation(summary = "获取指定时间区间内所有用户design的使用情况")
@GetMapping("/getDesignStatistic")
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime,@RequestParam String endTime){
Long accountId = UserContext.getUserHolder().getId();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)){
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,
@RequestParam(required = false) String organizationName) {
/*Long accountId = UserContext.getUserHolder().getId();
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)){
if (StringUtil.isNullOrEmpty(endTime)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date date = new Date();
endTime = simpleDateFormat.format(date);
}
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime);
if (!StringUtil.isNullOrEmpty(email)){
email = email.trim();
}
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime, ids, email,"prsn", null);
return Response.success(designStatistic);
}else {
} else {
return Response.fail("Sorry, you don't have permission");
}*/
return Response.success(convenientInquiryService.getDesignStatistic(startTime, endTime, ids, email, organizationName));
}
//调查问卷
@Operation(summary = "获取调查问卷统计详情")
@GetMapping("/getQuestionnaireStatistic")
public Response<QuestionnaireFeedbackVO> getQuestionnaire() {
return Response.success(convenientInquiryService.getQuestionnaireInfo());
}
@Operation(summary = "获取所有调查问卷")
@GetMapping("/getAllQuestionnaire")
public Response<List<QuestionnaireVO>> getAllQuestionnaire() {
return Response.success(convenientInquiryService.getAllQuestionnaire());
}
@Operation(summary = "获取近期新用户")
@PostMapping("/recentNewUser")
public Response<IPage<Account>> recentNewUser(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
return Response.success(convenientInquiryService.recentNewUser(queryUserConditionsVO));
}
@Operation(summary = "获取近期新用户图表数据")
@GetMapping("/recentNewUserChart")
public Response<Map<String, Object>> recentNewUserChart(@Parameter(description = "startTime") @RequestParam @Nullable String startTime,
@Parameter(description = "endTime") @RequestParam @Nullable String endTime,
@Parameter(description = "userType") @RequestParam @Nullable Integer userType) {
return Response.success(convenientInquiryService.recentNewUserChart(startTime, endTime, userType));
}
@Operation(summary = "获取近期活跃用户")
@PostMapping("/recentActiveUser")
public Response<IPage<Account>> recentActiveUser(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
return Response.success(convenientInquiryService.recentActiveUser(queryUserConditionsVO));
}
@Operation(summary = "获取近期活跃用户图表数据")
@GetMapping("/recentActiveUserChart")
public Response<Integer> recentActiveUserChart(@Parameter(description = "startTime") @RequestParam @Nullable String startTime,
@Parameter(description = "endTime") @RequestParam @Nullable String endTime) {
return Response.success(convenientInquiryService.recentActiveUserChart(startTime, endTime));
}
@Operation(summary = "获取用户的各模块功能使用详情")
@GetMapping("/getActiveUserFunc")
public Response<Map<String, List<Object>>> getActiveUserFunc(@Parameter(description = "startTime") @RequestParam @Nullable String startTime,
@Parameter(description = "endTime") @RequestParam @Nullable String endTime,
@Parameter(description = "userIdList") @RequestParam(required = false) @Nullable List<Long> userIdList) {
return Response.success(convenientInquiryService.getActiveUserFunc(startTime, endTime, userIdList));
}
@Operation(summary = "试用用户到正式用户的转化率")
@GetMapping("/conversionRate")
public Response<Map<String, Object>> conversionRate(@Parameter(description = "startTime") @RequestParam(required = false) @Nullable String startTime,
@Parameter(description = "endTime") @RequestParam(required = false) @Nullable String endTime) {
return Response.success(convenientInquiryService.conversionRate(startTime, endTime));
}
@Operation(summary = "试用用户国家/城市分布")
@GetMapping("/trialUserCountry")
public Response<Map<String, List<Object>>> trialUserCountry(@Parameter(description = "startTime") @RequestParam(required = false) @Nullable String startTime,
@Parameter(description = "endTime") @RequestParam(required = false) @Nullable String endTime) {
return Response.success(convenientInquiryService.trialUserCountry(startTime, endTime));
}
@Operation(summary = "添加用户")
@PostMapping("/addUser")
public Response<Boolean> addUser(@Valid @RequestBody AccountAddDTO 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");
}
}
@Operation(summary = "修改用户信息")
@PostMapping("/modifyUser")
public Response<Boolean> modifyUser(@Parameter(description = "用户id") @RequestParam @Nullable Long accountId,
@Parameter(description = "有效期截止时间的毫秒级unix格式") @RequestParam @Nullable Long validEndTime,
@Parameter(description = "用户类型 1/2/3/0 -> yearly/monthly/trial/visitor") @RequestParam @Nullable Integer systemUser,
@Parameter(description = "积分") @RequestParam @Nullable Long 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");
}
}
@Operation(summary = "获取用户信息")
@PostMapping("/getUserInfo")
public Response<IPage<Account>> getUserInfo(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
return Response.success(convenientInquiryService.getUserInfo(queryUserConditionsVO));
}
@Operation(summary = "获取所有用户id")
@GetMapping("/getAllUserId")
public Response<IPage<Map<String, Object>>> getAllUserIdList(@Parameter(description = "page") @RequestParam Integer page,
@Parameter(description = "size") @RequestParam Integer size,
@Parameter(description = "email 模糊查询") @RequestParam(required = false) String email) {
return Response.success(convenientInquiryService.getAllUserIdList(page, size, email));
}
@Operation(summary = "获取所有交易信息")
@PostMapping("/queryTransaction")
public Response<PageBaseResponse<PaymentInfoVO>> queryTransactionRecords(@Valid @RequestBody QueryPaymentInfoDTO queryPaymentInfoDTO){
return Response.success(convenientInquiryService.queryTransactionRecords(queryPaymentInfoDTO));
}
@Operation(summary = "获取所有国家、城市")
@GetMapping("/getCities")
public Response<Map<String, List<String>>> getCities(){
return Response.success(convenientInquiryService.getCities());
}
@Operation(summary = "下载交易记录")
@PostMapping("/queryTransaction/download")
public Response<String> exportTransactionRecords(@Valid @RequestBody QueryPaymentInfoDTO queryPaymentInfoDTO, HttpServletResponse response){
return Response.success(convenientInquiryService.exportTransactionRecords(queryPaymentInfoDTO, response));
}
@Operation(summary = "获取生成功能使用频次")
@PostMapping("/getGenerateFrequency")
public Response<PageBaseResponse<AccountCreditsUsageDTO>> getGenerateFrequency(@Valid @RequestBody AccountCreditsUsageQueryDTO queryDTO){
return Response.success(convenientInquiryService.getGenerateFrequency(queryDTO));
}
@Operation(summary = "获取所有生成功能的名字")
@GetMapping("/getAllGenerateFuncName")
public Response<List<String>> getAllGenerateFuncName(){
return Response.success(convenientInquiryService.getAllGenerateFuncName());
}
@Operation(summary = "添加组织机构")
@GetMapping("/addOrganization")
public Response<String> addOrganization(@Parameter(description = "机构名") @RequestParam String name, @Parameter(description = "Enterprise || Education") @RequestParam String type){
convenientInquiryService.addOrganization(name, type);
return Response.success();
}
@Operation(summary = "查询所有企业或教育机构")
@PostMapping("/queryOrganization")
public Response<IPage<Organization>> queryOrganization(@RequestBody QueryOrganizationPageDTO queryOrganizationPageDTO){
return Response.success(convenientInquiryService.queryOrganization(queryOrganizationPageDTO));
}
}

View File

@@ -6,32 +6,32 @@ import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.CreditsDetail;
import com.ai.da.model.dto.QueryIncomeOrExpenditureDTO;
import com.ai.da.service.CreditsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
@CrossOrigin
@RestController
@RequestMapping("/api/credits")
@Api(tags = "积分")
@Tag(name = "积分")
@Slf4j
public class CreditsController {
@Resource
private CreditsService creditsService;
@ApiOperation("获取当前积分")
@Operation(summary = "获取当前积分")
@GetMapping("/getCredits")
public Response<String> getCredits() {
String credits = creditsService.getCredits(UserContext.getUserHolder().getId());
return Response.success(credits);
}
@ApiOperation("获取积分详细")
@Operation(summary = "获取积分详细")
@PostMapping("/getCreditsDetail")
public Response<PageBaseResponse<CreditsDetail>> getCreditsDetail(@Valid @RequestBody QueryIncomeOrExpenditureDTO queryPageByTimeDTO) {
PageBaseResponse<CreditsDetail> credits = creditsService.queryCreditsDetailsPage(queryPageByTimeDTO);

View File

@@ -1,86 +1,130 @@
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.CloudTask;
import com.ai.da.mapper.primary.entity.CollectionSort;
import com.ai.da.model.dto.*;
import com.ai.da.model.vo.CollectionSketchVO;
import com.ai.da.model.vo.DesignCollectionVO;
import com.ai.da.model.vo.DesignLikeVO;
import com.ai.da.model.vo.*;
import com.ai.da.service.DesignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.ai.da.service.UserLikeGroupService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.math.BigDecimal;
import java.util.List;
@Api(tags = "design模块")
@Tag(name = "design模块")
@Slf4j
@RestController
@RequestMapping("/api/design")
public class DesignController {
@Resource
private DesignService designService;
@Resource
private UserLikeGroupService userLikeGroupService;
@ApiOperation(value = "设计 Conllection")
@Operation(summary = "设计 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));
}
@ApiOperation(value = "design进度条")
@Operation(summary = "design进度条")
@GetMapping("/designProcess")
public Response<Integer> designProcess(@RequestParam("processId") String processId) {
return Response.success(designService.designProcess(processId));
}
@ApiOperation(value = "重新设计 Collection")
@Operation(summary = "重新设计 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));
}
@ApiOperation(value = "designItem list,刷新用")
@Operation(summary = "designItem list,刷新用")
@GetMapping("/designItemList")
public Response<DesignCollectionVO> designItemList(@ApiParam("designId") @RequestParam("designId") Long designId) {
public Response<DesignCollectionVO> designItemList(@Parameter(description = "designId") @RequestParam("designId") Long designId) {
return Response.success(designService.designItemList(designId));
}
@ApiOperation(value = "统计design进度")
@Operation(summary = "统计design进度")
@PostMapping("/countDesignProcess")
public Response<BigDecimal> countDesignProcess() {
return Response.success(designService.countDesignProcess());
}
@ApiOperation(value = "Design Like")
@Operation(summary = "Design Like")
@PostMapping("/like")
public Response<DesignLikeVO> like(@Valid @RequestBody DesignLikeDTO designLikeDTO) {
return Response.success(designService.like(designLikeDTO));
}
@ApiOperation(value = "Design Dislike")
@Operation(summary = "Design Dislike")
@PostMapping("/dislike")
public Response<Boolean> dislike(@Valid @RequestBody DisDesignLikeDTO disDesignLikeDTO) {
return Response.success(designService.dislike(disDesignLikeDTO));
}
@ApiOperation(value = "sketchBoard upload generate design前裁剪")
@PostMapping("/sketchBoardsBoundingBox")
public Response<List<CollectionSketchVO>> sketchesBoundingBox(@Valid @RequestBody SketchesBoundingBoxDTO sketchesBoundingBoxDTO) {
return Response.success(designService.sketchesBoundingBox(sketchesBoundingBoxDTO));
@Operation(summary = "Design sort")
@PostMapping("/sort")
public Response<Boolean> sort(@Valid @RequestBody CollectionSortDTO userLikeSortDTO) {
return Response.success(designService.sort(userLikeSortDTO));
}
@ApiOperation(value = "通过designItemId获取模特图")
@Operation(summary = "sketchBoard upload generate design前裁剪")
@PostMapping("/sketchBoardsBoundingBox")
public Response<List<CollectionSketchVO>> sketchesBoundingBox(@Valid @RequestBody ReDesignCollectionDTO reDesignCollectionDTO) {
return Response.success(designService.sketchesBoundingBox(reDesignCollectionDTO));
}
@Operation(summary = "通过designItemId获取模特图")
@PostMapping("/getModel")
public Response<List<String>> getModel(@RequestBody List<Long> designItemIdList){
return Response.success(designService.getModel(designItemIdList));
}
@Operation(summary = "获取design结果")
@GetMapping("/getDesignResult")
public Response<DesignCollectionVO> getDesignResult(@RequestParam("requestId") String requestId, @RequestParam("objectSignList") List<String> objectSignList){
return Response.success(designService.getDesignResult(requestId, objectSignList));
}
@Operation(summary = "云生成")
@PostMapping("/designCloud")
public Response<String> designCloud(@Valid @RequestBody CloudTaskDTO cloudTaskDTO) {
return Response.success(designService.designCloud(cloudTaskDTO));
}
@Operation(summary = "云生成修改任务名")
@PostMapping("/cloudTaskNameUpdate")
public Response<Boolean> cloudTaskNameUpdate(@Valid @RequestBody CloudTaskDTO cloudTaskDTO) {
return Response.success(designService.cloudTaskNameUpdate(cloudTaskDTO));
}
@Operation(summary = "云生成删除任务")
@PostMapping("/cloudTaskDelete")
public Response<Boolean> cloudTaskDelete(@Valid @RequestBody CloudTaskDTO cloudTaskDTO) {
return Response.success(designService.cloudTaskDelete(cloudTaskDTO));
}
@Operation(summary = "云生成page")
@PostMapping("/cloudPage")
public Response<PageBaseResponse<CloudTaskVO>> cloudPage(@Valid @RequestBody CloudPageDTO cloudPageDTO) {
return Response.success(PageBaseResponse.success(designService.cloudPage(cloudPageDTO)));
}
@Operation(summary = "获取design云生成结果")
@PostMapping("/getDesignCloudResult")
public Response<CloudTaskResultVO> getDesignCloudResult(@Valid @RequestBody DesignCloudResultQuery designCloudResultQuery) {
return Response.success(designService.getDesignCloudResult(designCloudResultQuery));
}
}

View File

@@ -5,18 +5,18 @@ 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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.io.IOException;
@Api(tags = "design Detail模块")
@Tag(name = "design Detail模块")
@Slf4j
@RestController
@RequestMapping("/api/design/detail")
@@ -26,7 +26,7 @@ public class DesignDetailController {
@Resource
private DesignItemService designItemService;
@ApiOperation(value = "生成高级design图片")
@Operation(summary = "生成高级design图片")
@PostMapping("/generateHighDesign")
public Response<String> generateHighDesign(@Valid @RequestBody GenerateHighDesignDTO generateHighDesignDTO) {
Response response = new Response();
@@ -34,7 +34,7 @@ public class DesignDetailController {
return response;
}
@ApiOperation(value = "删除高级design图片")
@Operation(summary = "删除高级design图片")
@PostMapping("/deleteHighDesign")
public Response<Boolean> deleteHighDesign(@Valid @RequestBody GenerateHighDesignDTO generateHighDesignDTO) {
Response response = new Response();
@@ -42,28 +42,28 @@ public class DesignDetailController {
return response;
}
@ApiOperation(value = "查询design详情")
@Operation(summary = "查询design详情")
@GetMapping("/getDetail")
public Response<DesignItemDetailVO> getDetail(@ApiParam("designItemId") @RequestParam("designItemId") Long designItemId,
@ApiParam("designPythonOutfitId") @RequestParam(value = "designPythonOutfitId", required = false) Long designPythonOutfitId) {
public Response<DesignItemDetailVO> getDetail(@Parameter(description = "designItemId") @RequestParam("designItemId") Long designItemId,
@Parameter(description = "designPythonOutfitId") @RequestParam(value = "designPythonOutfitId", required = false) Long designPythonOutfitId) {
return Response.success(designService.detail(designPythonOutfitId, designItemId));
}
@ApiOperation(value = "切换系统的element")
@Operation(summary = "切换系统的element")
@GetMapping("/getNextSysElement")
public Response<GetNextSysElementVO> getNextSysElement(@ApiParam("要切换的系统element 类型") @RequestParam("type") String type,
@ApiParam("要切换的系统element id") @RequestParam("id") Long id,
@ApiParam("操作类型 PREV 上一步 NEXT 下一步") @RequestParam("operateType") String operateType) {
public Response<GetNextSysElementVO> getNextSysElement(@Parameter(description = "要切换的系统element 类型") @RequestParam("type") String type,
@Parameter(description = "要切换的系统element id") @RequestParam("id") Long id,
@Parameter(description = "操作类型 PREV 上一步 NEXT 下一步") @RequestParam("operateType") String operateType) {
return Response.success(designItemService.getNextSysElement(id, type, operateType));
}
@ApiOperation(value = "单个design")
@Operation(summary = "单个design")
@PostMapping("/designSingle")
public Response<DesignSingleVO> designSingle(@Valid @RequestBody DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO) {
return Response.success(designItemService.designSingleIncludeLayers(designSingleIncludeLayersDTO));
}
@ApiOperation(value = "print打点")
@Operation(summary = "print打点")
@PostMapping("/printDot")
public Response<String> printDot(@Valid @RequestBody DesignSingleDTO designSingleDTO) {
Response<String> response = new Response();
@@ -72,9 +72,23 @@ public class DesignDetailController {
return response;
}
@ApiOperation(value = "编辑图层大小和位置 废弃")
@Operation(summary = "编辑图层大小和位置 废弃")
@PostMapping("/editLayers")
public Response<ComposeLayersVO> editPositionAndScale(@Valid @RequestBody EditLayersPositionAndScaleVO positionAndScaleVO) throws IOException {
return Response.success(designItemService.editLayersPositionAndScale(positionAndScaleVO));
}
@Operation(summary = "mask数据兼容")
@GetMapping("/convertWithoutGradient")
public Response<String> convertHistoryMaskWithoutGradient(){
designItemService.convertHistoryMaskWithoutGradient();
return Response.success("success");
}
@Operation(summary = "mask数据库路径更新")
@GetMapping("/updateMaskUrl")
public Response<String> updateMaskUrl(){
designItemService.updateMaskUrl();
return Response.success("success");
}
}

View File

@@ -8,20 +8,23 @@ import com.ai.da.model.vo.*;
import com.ai.da.service.CollectionElementService;
import com.ai.da.service.PanToneService;
import com.ai.da.service.SysFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Pattern;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Api(tags = "collection模块")
@Tag(name = "collection模块")
@Slf4j
@RestController
@RequestMapping("/api/element")
@@ -34,7 +37,7 @@ public class ElementController {
@Resource
private SysFileService sysFileService;
@ApiOperation(value = "初始化系统文件")
@Operation(summary = "初始化系统文件")
@PostMapping("/initDefaultSysFile")
public Response<Boolean> initDefaultSysFile(@RequestParam("validate") String validateUse) {
if (validateUse.equals("da_fl_mm_dad88888")) {
@@ -44,64 +47,97 @@ public class ElementController {
return Response.success();
}
@ApiOperation(value = "element文件上传")
@Operation(summary = "element文件上传")
@PostMapping("/upload")
public Response<CollectionElementVO> upload(@RequestParam("file") MultipartFile file,
@ApiParam("一级类型 Moodboard Printboard Sketchboard MarketingSketch Colorboard")
@Parameter(description = "一级类型 Moodboard Printboard Sketchboard MarketingSketch Colorboard")
@RequestParam(value = "level1Type") String level1Type,
@RequestParam(name = "gender", required = false) String gender,
@ApiParam("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
@RequestParam(name = "level2Type", required = false) String level2Type,
@RequestParam(name = "projectId", required = false) Long projectId,
@Parameter(description = "本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
@RequestParam(value = "timeZone") String timeZone) {
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
throw new BusinessException("file.cannot.be.empty");
}
return Response.success(collectionElementService.upload(
new CollectionElementUploadDTO(file, level1Type, gender, timeZone, MD5Utils.encryptFile(file))));
new CollectionElementUploadDTO(file, projectId, level1Type, level2Type, gender, timeZone, MD5Utils.encryptFile(file))));
}
@ApiOperation(value = "element文件删除")
@Operation(summary = "element文件删除")
@PostMapping("/delete")
public Response<Boolean> delete(@Valid @RequestBody CollectionDeleteFileDTO deleteFileDTO) {
collectionElementService.delete(deleteFileDTO.getId());
return Response.success();
}
@ApiOperation(value = "生成印花")
/** 该功能已删除 */
@Deprecated
@Operation(summary = "生成印花")
@PostMapping("/generatePrint")
public Response<GenerateCollectionItemVO> generatePrint(@Valid @RequestBody CollectionGeneratePrintDTO generatePrintDTO) {
return Response.success(collectionElementService.generatePrint(generatePrintDTO));
}
@ApiOperation(value = "保存印花")
@Operation(summary = "保存印花")
@PostMapping("/savePrint")
public Response<Boolean> savePrint(@Valid @RequestBody CollectionSavePrintDTO savePrintDTO) {
return Response.success(collectionElementService.savePrint(savePrintDTO));
}
@ApiOperation(value = "通过tcx值获取潘通信息")
@Operation(summary = "通过tcx值获取潘通信息")
@GetMapping("/getRgbByTcx")
public Response<PantoneVO> getRgbByHsv(@ApiParam("tcx") @RequestParam("tcx") String tcx) {
public Response<PantoneVO> getRgbByHsv(@Parameter(description = "tcx") @RequestParam("tcx") String tcx) {
return Response.success(panToneService.getByTCX(tcx));
}
@ApiOperation(value = "通过hsv值获取潘通信息")
@Operation(summary = "通过hsv值获取潘通信息")
@GetMapping("/getRgbByHsv")
public Response<PantoneVO> getRgbByHsv(@RequestParam("h") Integer h,
@RequestParam("s") Integer s, @RequestParam("v") Integer v) {
return Response.success(panToneService.getByHSV(h, s, v));
}
@ApiOperation(value = "通过hsv值数组批量获取潘通信息")
@Operation(summary = "通过hsv值数组批量获取潘通信息")
@PostMapping("/getRgbByHsvBatch")
public Response<List<PantoneVO>> getRgbByHsvBatch(@RequestBody @Valid List<GetRgbByHsvBatchDTO> rgbByHsvBatch) {
return Response.success(panToneService.getRgbByHsvBatch(rgbByHsvBatch));
}
@ApiOperation(value = "刷新历史数据")
@Operation(summary = "刷新历史数据")
@PostMapping("/refreshHistoryData")
public Response<Boolean> refreshHistoryData() {
collectionElementService.refreshHistoryData();
return Response.success();
}
@Operation(summary = "图片分割")
@PostMapping("/imageSegmentation")
public Response<List<CollectionElementVO>> selectedImageSeg(
@RequestPart(value = "file", required = false) MultipartFile[] file,
@RequestParam(value = "type", required = false) @Pattern(regexp = "sketch|product", message = "Please choose the image type") String type,
@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "sourceType", required = false) @Pattern(regexp = "Library|Upload", message = "Select an image from the library or upload one.") String sourceType) {
// 过滤空文件
List<MultipartFile> nonEmptyFiles = Arrays.stream(file)
.filter(item -> !item.isEmpty())
.collect(Collectors.toList());
// 参数校验
if ((nonEmptyFiles.isEmpty()) && id == null) {
throw new BusinessException("必须提供文件上传或ID");
}
if (!nonEmptyFiles.isEmpty() && id != null) {
throw new BusinessException("不能同时提供文件上传和ID");
}
return Response.success(collectionElementService.selectedImageSeg(nonEmptyFiles, id, type, sourceType));
}
@Operation(summary = "更新element level2type")
@GetMapping("/updateElementLevel2Type")
public Response<String> updateLibraryLevel2Type(@RequestParam(value = "elementId") Long elementId, @RequestParam(value = "level2Type") String level2Type) {
collectionElementService.updateElementLevel2Type(elementId, level2Type);
return Response.success("success");
}
}

View File

@@ -0,0 +1,42 @@
package com.ai.da.controller;
import com.ai.da.service.EmailService;
import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.thymeleaf.context.Context;
import jakarta.annotation.Resource;
import java.util.Collections;
@Tag(name = "邮件模块")
@Slf4j
@RestController
@RequestMapping("/api/email")
public class EmailController {
@Resource
private EmailService emailService;
@GetMapping("/loadSingleTemplate")
public void loadSingleEmailTemplate(){
emailService.loadSingleEmailTemplate("templates\\upgrade\\122899_AiDA发版完成通知中文版.html");
}
@GetMapping("/loadTemplate")
public void loadTemplatesFromResources(){
emailService.loadTemplatesFromResources("templates");
}
@GetMapping("/sendEmailTest")
public void sendEmailTest(){
Context context = new Context();
context.setVariable("username", "小白");
JSONObject jsonObject = new JSONObject();
jsonObject.put("username", "小白");
emailService.sendEmail(Collections.singletonList("xupei3360@163.com"), jsonObject, "132124_affiliate_accepted_en.html", "测试邮件", null, null );
}
}

View File

@@ -1,87 +1,240 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.GenerateLikeDTO;
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
import com.ai.da.model.vo.*;
import com.ai.da.service.GenerateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
* @author XP
*/
@Api(tags = "Generate模块")
@Slf4j
@RestController
@RequestMapping("/api/generate")
public class GenerateController {
@Resource
private GenerateService generateService;
/*@ApiOperation("自动识别sketch的caption 暂时未上")
@PostMapping("/caption")
public Response<GenerateCaptionVO> generateCaption(@RequestParam Long sketchElementId) {
return Response.success(generateService.generateCaption(sketchElementId));
}*/
/*@ApiOperation("通过文字、图片生成图片")
@PostMapping("/sketchAndPrint")
public void generateThroughImageText(@Valid @RequestBody GenerateThroughImageTextDTO generateThroughImageTextDTO) {
// return Response.success(generateService.generateThroughImageText(generateThroughImageTextDTO));
generateService.generateThroughImageText(generateThroughImageTextDTO);
}*/
@ApiOperation("喜欢生成的图片")
@PostMapping("/like")
public Response<GenerateLikeVO> like(@Valid @RequestBody GenerateLikeDTO generateLikeDTO) {
return Response.success(generateService.generateLike(generateLikeDTO));
}
@ApiOperation(value = "取消喜欢")
@GetMapping("/dislike")
public Response<Boolean> dislike(@ApiParam("generateDetailId") @RequestParam Long generateDetailId,
@ApiParam("timeZone") @RequestParam String timeZone) {
return Response.success(generateService.generateDislike(generateDetailId, timeZone));
}
@ApiOperation(value = "发起生成请求,异步获取结果")
@PostMapping("/prepare")
public Response<PrepareForGenerateVO> prepareForGenerate(@Valid @RequestBody GenerateThroughImageTextDTO generateThroughImageTextDTO) {
return Response.success(generateService.prepareForGenerate(generateThroughImageTextDTO));
}
@ApiOperation(value = "取消继续生成")
@GetMapping("/stopWaiting")
public Response<String> stopWaiting(@RequestParam("userId") Long userId,
@RequestParam("uniqueId") List<String> uniqueId,
@RequestParam("timeZone") String timeZone,
@RequestParam("type") String type) {
generateService.cancelGenerate(userId, uniqueId, timeZone, type);
return Response.success("stop waiting successfully");
}
/*@ApiOperation(value = "获取生成结果")
@GetMapping("/result")
public Response<GenerateCollectionVO> getGenerateResult(@RequestParam("uniqueId") String uniqueId) {
GenerateCollectionVO generateResult = generateService.getGenerateResult(uniqueId);
return Response.success(generateResult);
}*/
@ApiOperation(value = "获取生成结果")
@PostMapping("/result")
public Response<List<GenerateResultVO>> getGenerateResults(@Valid @RequestBody List<String> taskIdList) {
List<GenerateResultVO> generateResult = generateService.getGenerateResultList(taskIdList);
return Response.success(generateResult);
}
}
package com.ai.da.controller;
import com.ai.da.common.enums.CreditsEventsEnum;
import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.CollectionSort;
import com.ai.da.model.dto.*;
import com.ai.da.model.vo.*;
import com.ai.da.service.GenerateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
* @author XP
*/
@Tag(name = "Generate模块")
@Slf4j
@RestController
@RequestMapping("/api/generate")
public class GenerateController {
@Resource
private GenerateService generateService;
/*@ApiOperation("自动识别sketch的caption 暂时未上")
@PostMapping("/caption")
public Response<GenerateCaptionVO> generateCaption(@RequestParam Long sketchElementId) {
return Response.success(generateService.generateCaption(sketchElementId));
}*/
/*@ApiOperation("通过文字、图片生成图片")
@PostMapping("/sketchAndPrint")
public void generateThroughImageText(@Valid @RequestBody GenerateThroughImageTextDTO generateThroughImageTextDTO) {
// return Response.success(generateService.generateThroughImageText(generateThroughImageTextDTO));
generateService.generateThroughImageText(generateThroughImageTextDTO);
}*/
@Operation(summary = "喜欢生成的图片")
@PostMapping("/like")
public Response<GenerateLikeVO> like(@Valid @RequestBody GenerateLikeDTO generateLikeDTO) {
return Response.success(generateService.generateLike(generateLikeDTO));
}
@Operation(summary = "取消喜欢")
@GetMapping("/dislike")
public Response<Boolean> dislike(@Parameter(description = "generateDetailId") @RequestParam Long generateDetailId,
@Parameter(description = "timeZone") @RequestParam String timeZone) {
return Response.success(generateService.generateDislike(generateDetailId, timeZone));
}
@Operation(summary = "发起生成请求,异步获取结果")
@PostMapping("/prepare")
public ResponseEntity<Response<PrepareForGenerateVO>> prepareForGenerate(@Valid @RequestBody GenerateThroughImageTextDTO generateThroughImageTextDTO) {
PrepareForGenerateVO prepareForGenerateVO = generateService.prepareForGenerate(generateThroughImageTextDTO);
if (prepareForGenerateVO.getStatus().equals(200)){
prepareForGenerateVO.setStatus(0);
return ResponseEntity.ok(Response.success(prepareForGenerateVO));
} else {
return ResponseEntity.status(prepareForGenerateVO.getStatus()).body(Response.fail("The rate limit has been exceeded. Please wait 1 minute before retrying."));
}
}
@Operation(summary = "取消继续生成")
@GetMapping("/stopWaiting")
public Response<String> stopWaiting(@RequestParam("userId") Long userId,
@RequestParam("uniqueId") List<String> uniqueId,
@RequestParam("timeZone") String timeZone,
@RequestParam("type") String type) {
generateService.cancelGenerate(userId, uniqueId, timeZone, type);
return Response.success("stop waiting successfully");
}
/*@ApiOperation(value = "获取生成结果")
@GetMapping("/result")
public Response<GenerateCollectionVO> getGenerateResult(@RequestParam("uniqueId") String uniqueId) {
GenerateCollectionVO generateResult = generateService.getGenerateResult(uniqueId);
return Response.success(generateResult);
}*/
@Operation(summary = "获取生成结果")
@PostMapping("/result")
public Response<List<GenerateResultVO>> getGenerateResults(@Valid @RequestBody List<String> taskIdList) {
List<GenerateResultVO> generateResult = generateService.getGenerateResultList(taskIdList);
return Response.success(generateResult);
}
@Operation(summary = "imageToSketch")
@PostMapping("/imageToSketch")
public Response<String> imageToSketch(@Valid @RequestBody ImageToSketchDTO imageToSketchDTO) {
return Response.success(generateService.imageToSketchAsync(imageToSketchDTO, null, null));
// return Response.success(generateService.imageToSketch(imageToSketchDTO, null, null));
}
// modifySketch
@Operation(summary = "modifySketch")
@PostMapping("/modifySketch")
public Response<GenerateResultVO> modifySketch(@Valid @RequestBody GenerateModifyDTO generateModifyDTO) {
return Response.success(generateService.modifySketch(generateModifyDTO));
}
@Operation(summary = "请求进行姿势变换")
@PostMapping("/poseTransform")
public Response<ToProductImageResultVO> poseTransform(@Valid @RequestBody PoseTransformDTO poseTransformDTO) {
return Response.success(generateService.poseTransform(poseTransformDTO));
}
@Operation(summary = "获取姿势变换生成结果")
@PostMapping("/poseTransformResult")
public Response<List<PoseTransformationVO>> getPoseTransformationResults(@Valid @RequestBody List<String> taskIdList) {
List<PoseTransformationVO> generateResult = generateService.getPoseTransformationResult(taskIdList, null, null);
return Response.success(generateResult);
}
@Operation(summary = "喜欢或取消喜欢姿势变换生成的图片")
@PostMapping("/likeOrDislike")
public Response<CollectionSort> likeOrDislike(@Parameter(description = "id") @RequestParam Long transformedId, @Parameter(description = "like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId, @RequestParam(value = "collectionSortParentId", required = false) Long collectionSortParentId) {
return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike, projectId, collectionSortParentId));
}
@Operation(summary = "修改模特比例")
@PostMapping("/modifyProportion")
public Response<String> modifyModelProportion(@Valid @RequestBody ModifyModelProportionDTO proportionDTO){
String path = generateService.modifyModelProportion(proportionDTO);
return Response.success(path);
}
@Operation(summary = "拼贴图生成线稿")
@PostMapping("/genSketchRecon")
public Response<GenerateResultVO> sketchReconstructionGenerate(@Valid @RequestBody SketchReconstructionDTO sketchReconstructionDTO){
GenerateResultVO generateResultVO = generateService.sketchReconstructionGenerate(sketchReconstructionDTO);
return Response.success(generateResultVO);
}
@Operation(summary = "获取拼贴图最后一次生成结果")
@GetMapping("/getReconLastResult")
public Response<SketchReconstructionVO> getSketchReconstruction(@RequestParam("projectId") Long projectId){
SketchReconstructionVO sketchReconstruction = generateService.getSketchReconstruction(projectId);
return Response.success(sketchReconstruction);
}
@Operation(summary = "获取pose transfer的所有pose")
@GetMapping("/getAllPose")
public Response<List<Map<String, String>>> getAllPose(){
return Response.success(generateService.getAllPose());
}
@Operation(summary = "删除pose transfer的结果")
@GetMapping("/deleteResult")
public Response<String> deleteToProductRelightResult(@RequestParam("projectId") @NotNull Long projectId,
@RequestParam("id") @NotNull Long id){
try{
generateService.deleteGeneratedPose(projectId, id);
return Response.success();
}catch (Exception e){
return Response.fail(e.getMessage());
}
}
/*@ApiOperation(value = "万象 t2i 创建异步任务")
@GetMapping("/createAsyncTask")
public Response<String> createAsyncTask(@RequestParam("prompt") String prompt){
return Response.success(generateService.createAsyncTask(87L, prompt, ""));
}
@Operation(summary = "万象 t2i 获取异步任务结果")
@GetMapping("/waitAsyncTask")
public Response<GenerateResultVO> waitAsyncTask(@RequestParam("taskId") String taskId){
return Response.success(generateService.getAsyncTaskResult(taskId));
}
@Operation(summary = "万象 图生动图")
@GetMapping("/animateAnyone")
public Response<String> animateAnyone(@Valid @RequestBody PoseTransformDTO poseTransformDTO){
return Response.success(generateService.animateAnyone(poseTransformDTO, null));
}
@Operation(summary = "万象 获取动图模板id")
@GetMapping("/getVideoTemplateId")
public Response<String> getVideoTemplateId(@RequestParam("videoPath") String videoPath){
return Response.success(generateService.getVideoTemplateId(videoPath));
}
@Operation(summary = "万象 获取动图结果")
@GetMapping("/getAnimateResult")
public Response<PoseTransformationVO> getAnimateResult(@RequestParam("taskId") String taskId){
return Response.success(generateService.getAnimateResult(taskId));
}
@Operation(summary = "freepik toProductImage")
@GetMapping("/reimagineFreePik")
public Response<String> reimagineFreePik(@RequestParam("path") String path,
@RequestParam("prompt") String prompt,
@RequestParam("style") String style) throws IOException {
return Response.success(generateService.reimagineFreePik(path, prompt, style));
}
@Operation(summary = "获取图片描述")
@GetMapping("/getImageDescription")
public Response<String> getImageDescription(@RequestParam("path") String path) {
return Response.success(generateService.getImageDescription(path));
}*/
// @Operation(summary = "试用flux")
// @GetMapping("/flux")
public Response<String> flux(@RequestParam(value = "path", required = false) String path,
@RequestParam("type") int type,
@RequestParam(value = "prompt", required = false) String prompt){
CreditsEventsEnum typeEnum = CreditsEventsEnum.RELIGHT;
switch (type){
case 1:
typeEnum = CreditsEventsEnum.TO_PRODUCT_IMAGE;
break;
case 2:
typeEnum = CreditsEventsEnum.IMAGE_TO_SKETCH;
break;
case 3:
typeEnum = CreditsEventsEnum.PATTERN;
break;
}
return Response.success(generateService.flux(typeEnum, prompt, path, false));
}
// @Operation(summary = "获取flux结果")
// @GetMapping("/fluxResult")
public Response<String> fluxResult(@RequestParam("taskId") String taskId){
return Response.success(generateService.getFluxResult(taskId, "87/" + taskId + ".png"));
}
}

View File

@@ -0,0 +1,168 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.*;
import com.ai.da.model.dto.ContestantDTO;
import com.ai.da.model.vo.CheckOTPVO;
import com.ai.da.service.GlobalAwardService;
import com.ai.da.service.upload.UploadService;
import com.ai.da.service.upload.UploadTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
@RestController
@RequestMapping("/api/global-award")
@Api(tags = "全球奖项API", description = "全球奖项大赛管理和文件上传")
public class GlobalAwardController {
@Resource
private GlobalAwardService globalAwardService;
@Resource
private UploadService uploadService;
// @PostMapping("/uploads/pdf")
// public Response<String> uploadPdf(@RequestParam("file") MultipartFile file,
// @RequestParam(value = "email", required = false) String email) throws Exception {
// return Response.success(globalAwardService.uploadPdf(file, email));
// }
//
// @PostMapping("/uploads/video")
// public Response<String> uploadVideo(@RequestParam("file") MultipartFile file,
// @RequestParam(value = "email", required = false) String email) throws Exception {
// return Response.success(globalAwardService.uploadVideo(file, email));
// }
// ===== 新增分片上传接口 =====
// ===== PDF分片上传接口 =====
/** 初始化PDF上传任务 */
@PostMapping("/uploads/pdf/init")
@ApiOperation(value = "初始化PDF上传", notes = "创建新的PDF上传任务并返回上传参数")
public Response<UploadInitResponse> initPdfUpload(@ApiParam(value = "PDF上传初始化请求", required = true) @RequestBody UploadInitRequest request) {
UploadTask uploadTask = uploadService.initPdfUpload(request);
return Response.success(UploadInitResponse.builder()
.uploadId(uploadTask.getUploadId())
.chunkSize(uploadTask.getChunkSize())
.totalChunks(uploadTask.getTotalChunks())
.expiresAt(uploadTask.getExpiresAt())
.build());
}
/** 上传PDF分片 */
@PostMapping("/uploads/pdf/chunk")
@ApiOperation(value = "上传PDF分片", notes = "上传PDF文件的单个分片")
public Response<UploadChunkResponse> uploadPdfChunk(
@ApiParam(value = "PDF文件分片", required = true) @RequestParam("chunk") MultipartFile chunk,
@ApiParam(value = "上传任务ID", required = true) @RequestParam("uploadId") String uploadId,
@ApiParam(value = "分片索引(从0开始)", required = true) @RequestParam("chunkIndex") int chunkIndex,
@ApiParam(value = "分片总数", required = true) @RequestParam("totalChunks") int totalChunks) {
UploadChunkResponse uploadChunkResponse = uploadService.uploadPdfChunk(uploadId, chunk, chunkIndex, totalChunks);
return Response.success(uploadChunkResponse);
}
/** 完成PDF上传 */
@PostMapping("/uploads/pdf/complete")
@ApiOperation(value = "完成PDF上传", notes = "完成PDF上传并合并所有分片")
public Response<UploadCompleteResponse> completePdfUpload(@ApiParam(value = "PDF上传完成请求", required = true) @RequestBody UploadCompleteRequest request) {
UploadCompleteResponse uploadCompleteResponse = uploadService.completePdfUpload(
request.getUploadId(),
request.getFileName(),
request.getTotalSize(),
request.getEmail(),
request.getSecureToken());
return Response.success(uploadCompleteResponse);
}
/** 查询PDF上传状态 */
@GetMapping("/uploads/pdf/status/{uploadId}")
@ApiOperation(value = "查询PDF上传状态", notes = "获取PDF上传任务的当前状态")
public Response<UploadStatusResponse> getPdfUploadStatus(@ApiParam(value = "上传任务ID", required = true) @PathVariable String uploadId) {
UploadStatusResponse pdfUploadStatus = uploadService.getPdfUploadStatus(uploadId);
return Response.success(pdfUploadStatus);
}
// ===== 视频分片上传接口 =====
/** 初始化视频上传任务 */
@PostMapping("/uploads/video/init")
@ApiOperation(value = "初始化视频上传", notes = "创建新的视频上传任务并返回上传参数")
public Response<UploadInitResponse> initVideoUpload(@ApiParam(value = "视频上传初始化请求", required = true) @RequestBody UploadInitRequest request) {
UploadTask uploadTask = uploadService.initVideoUpload(request);
return Response.success(UploadInitResponse.builder()
.uploadId(uploadTask.getUploadId())
.chunkSize(uploadTask.getChunkSize())
.totalChunks(uploadTask.getTotalChunks())
.expiresAt(uploadTask.getExpiresAt())
.build());
}
/** 上传视频分片 */
@PostMapping("/uploads/video/chunk")
@ApiOperation(value = "上传视频分片", notes = "上传视频文件的单个分片")
public Response<UploadChunkResponse> uploadVideoChunk(
@ApiParam(value = "视频文件分片", required = true) @RequestParam("chunk") MultipartFile chunk,
@ApiParam(value = "上传任务ID", required = true) @RequestParam("uploadId") String uploadId,
@ApiParam(value = "分片索引(从0开始)", required = true) @RequestParam("chunkIndex") int chunkIndex,
@ApiParam(value = "分片总数", required = true) @RequestParam("totalChunks") int totalChunks) {
UploadChunkResponse uploadChunkResponse = uploadService.uploadVideoChunk(uploadId, chunk, chunkIndex, totalChunks);
return Response.success(uploadChunkResponse);
}
/** 完成视频上传 */
@PostMapping("/uploads/video/complete")
@ApiOperation(value = "完成视频上传", notes = "完成视频上传并合并所有分片")
public Response<UploadCompleteResponse> completeVideoUpload(@ApiParam(value = "视频上传完成请求", required = true) @RequestBody UploadCompleteRequest request) {
UploadCompleteResponse uploadCompleteResponse = uploadService.completeVideoUpload(
request.getUploadId(),
request.getFileName(),
request.getTotalSize(),
request.getEmail(),
request.getSecureToken());
return Response.success(uploadCompleteResponse);
}
/** 查询视频上传状态 */
@GetMapping("/uploads/video/status/{uploadId}")
@ApiOperation(value = "查询视频上传状态", notes = "获取视频上传任务的当前状态")
public Response<UploadStatusResponse> getVideoUploadStatus(@ApiParam(value = "上传任务ID", required = true) @PathVariable String uploadId) {
UploadStatusResponse videoUploadStatus = uploadService.getVideoUploadStatus(uploadId);
return Response.success(videoUploadStatus);
}
@PostMapping("/contestants/save")
@ApiOperation(value = "保存参赛者信息", notes = "保存或更新参赛者信息及已上传的文件")
public Response<Map<String,Object>> submit(@ApiParam(value = "参赛者信息", required = true) @RequestBody ContestantDTO request) {
return Response.success(globalAwardService.saveContestant(request));
}
@GetMapping("/contestants/{id}")
@ApiOperation(value = "根据id查询参赛者", notes = "根据id获取参赛者信息")
public Response<ContestantDTO> getContestantByID(@ApiParam(value = "参赛者id", required = true) @PathVariable("id") String id) {
ContestantDTO dto = globalAwardService.getContestantByID(id);
return Response.success(dto);
}
@GetMapping("/checkEmail")
public Response<String> checkEmail(@RequestParam("email") String email) {
globalAwardService.checkEmail(email);
return Response.success();
}
@GetMapping("/checkCode")
public Response<CheckOTPVO> checkCode(@RequestParam("email") String email, @RequestParam("code") String code) {
return Response.success(globalAwardService.checkCode(email, code));
}
}

View File

@@ -0,0 +1,74 @@
package com.ai.da.controller;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.ChatMessage;
import com.ai.da.model.dto.*;
import com.ai.da.service.LLMService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import jakarta.annotation.Resource;
import java.util.*;
@Tag(name = "llm模块")
@Slf4j
@RestController
@RequestMapping("/api/llm")
public class LLMController {
@Resource
private LLMService llmService;
@Operation(summary = "对话")
@CrossOrigin
@GetMapping(value = "/stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public SseEmitter streamPrompt(@RequestParam String prompt,
@RequestParam(required = false) Long projectId,
@RequestParam(required = false) String fileUrl,
@RequestParam(required = false) List<String> imageUrlList,
@RequestParam(required = false) String process,
@RequestParam String token,
@RequestParam Boolean enableThinking) {
return llmService.stream(prompt, projectId, fileUrl, imageUrlList, token, enableThinking, process);
}
@Operation(summary = "对话")
@CrossOrigin
@GetMapping(value = "/streamNew", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public SseEmitter streamNew(@RequestParam String prompt,
@RequestParam(required = false) Long projectId,
@RequestParam(required = false) String fileUrl,
@RequestParam(required = false) List<String> imageUrlList,
@RequestParam(required = false) String process,
@RequestParam String token,
@RequestParam Boolean enableThinking) {
return llmService.streamNew(prompt, projectId, fileUrl, imageUrlList, token, enableThinking, process);
}
@Operation(summary = "对话创建项目")
@GetMapping(value = "/chatCreateProject")
public Response<Long> chatCreateProject(@RequestParam String prompt, @RequestParam String process,
@RequestParam(required = false) String fileUrl,
@RequestParam(required = false) List<String> imageUrlList) {
return Response.success(llmService.chatCreateProject(prompt, process, fileUrl, imageUrlList));
}
@Operation(summary = "上传文件")
@PostMapping(value = "/uploadFile")
public Response<List<String>> uploadFile(@RequestParam("file") MultipartFile file) {
return Response.success(llmService.uploadFile(file));
}
@Operation(summary = "获取历史聊天记录")
@PostMapping(value = "/getChatHistory")
public Response<PageBaseResponse<ChatMessage>> getChatHistory(@RequestBody ChatHistoryDTO chatHistoryDTO) {
return Response.success(llmService.getChatHistory(chatHistoryDTO));
}
}

View File

@@ -14,25 +14,24 @@ import com.ai.da.model.vo.*;
import com.ai.da.service.LibraryModelPointService;
import com.ai.da.service.LibraryService;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.io.File;
import java.text.ParseException;
import java.util.Date;
import java.util.Objects;
import java.util.UUID;
import java.util.*;
@Api(tags = "library模块")
@Tag(name = "library模块")
@Slf4j
@RestController
@RequestMapping("/api/library")
@@ -50,29 +49,30 @@ public class LibraryController {
@Value("${minio.bucketName.sysImage}")
private String sysImage;
@ApiOperation(value = "Library分页列表")
@Operation(summary = "Library分页列表")
@PostMapping("/queryLibraryPage")
public Response<PageBaseResponse<QueryLibraryPageVO>> queryLibraryPage(@Valid @RequestBody QueryLibraryPageDTO query) {
return Response.success(libraryService.queryLibraryPage(CopyUtil.copyObject(query, QueryLibraryPageServiceDTO.class)));
}
@ApiOperation(value = "Library分页列表(查询top和bottom)")
@Operation(summary = "Library分页列表(查询top和bottom)")
@PostMapping("/queryLibraryTopAndBottomPage")
public Response<PageBaseResponse<QueryLibraryPageVO>> queryLibraryTopAndBottomPage(@Valid @RequestBody QueryLibraryTopPageDTO query) {
return Response.success(libraryService.queryLibraryPage(CopyUtil.copyObject(query, QueryLibraryPageServiceDTO.class)));
}
@ApiOperation(value = "Library文件上传")
@Operation(summary = "Library文件上传")
@PostMapping("/upload")
public Response<LibraryUpdateVo> upload(@RequestParam("file") MultipartFile file,
@ApiParam("一级类型 Moodboard Printboard Sketchboard MarketingSketch Models")
@Parameter(description = "一级类型 Moodboard Printboard Sketchboard MarketingSketch Models")
@RequestParam(value = "level1Type") String level1Type,
@ApiParam("二级类型 争对 Sketchboard; 有 Outwear Dress Blouse Skirt Trousers")
@Parameter(description = "二级类型 争对 Sketchboard; 有 Outwear Dress Blouse Skirt Trousers")
@RequestParam(value = "level2Type", required = false) String level2Type,
@ApiParam("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
@Parameter(description = "本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
@RequestParam(value = "timeZone") String timeZone,
@RequestParam(value = "modelType") String modelType,
@RequestParam(value = "sex") String sex,
@RequestParam(value = "ageGroup") String ageGroup,
@RequestParam(value = "checkMd5") Integer checkMd5) {
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
throw new BusinessException("file.cannot.be.empty");
@@ -99,23 +99,23 @@ public class LibraryController {
}
}
return Response.success(libraryService.upload(new LibraryUploadDTO(file, level1Type, level2Type,
timeZone, md5, high, width, modelType, sex)));
timeZone, md5, high, width, modelType, sex, ageGroup)));
}
@ApiOperation(value = "保存或者编辑template打点")
@Operation(summary = "保存或者编辑template打点")
@PostMapping("/saveOrEditTemplatePoint")
public Response<LibraryModelPointVO> saveOrEditTemplatePoint(@Valid @RequestBody LibraryModelPointDTO libraryModelPoint) {
return Response.success(libraryModelPointService.saveOrEditTemplatePoint(libraryModelPoint));
}
@ApiOperation(value = "批量Library修改用户文件名")
@Operation(summary = "批量Library修改用户文件名")
@PostMapping("/batchUpdateLibraryName")
public Response<Boolean> batchUpdateLibraryName(@Valid @RequestBody LibraryUpdateDTO libraryUpdateDTO) {
libraryService.updateLibraryName(libraryUpdateDTO);
return Response.success(Boolean.TRUE);
}
@ApiOperation(value = "批量删除library")
@Operation(summary = "批量删除library")
@PostMapping("/batchDeleteLibrary")
public Response<Boolean> batchDeleteLibrary(@Valid @RequestBody LibraryDeleteDTO deleteDTO) {
libraryService.batchDeleteLibrary(deleteDTO);
@@ -123,10 +123,10 @@ public class LibraryController {
}
@ApiOperation(value = "Models打点预览")
@Operation(summary = "Models打点预览")
@PostMapping("/modelsDot")
public Response<String> modelsDot(@ApiParam("file") @RequestPart(value = "file", required = false) MultipartFile file,
@ApiParam("models对象") @RequestPart("models") ModelsDotDTO modelsDotDTO) {
public Response<String> modelsDot(@Parameter(description = "file") @RequestPart(value = "file", required = false) MultipartFile file,
@Parameter(description = "models对象") @RequestPart("models") ModelsDotDTO modelsDotDTO) {
if (Objects.nonNull(file)) {
if (StringUtils.isEmpty(file.getOriginalFilename())) {
throw new BusinessException("file.cannot.be.empty");
@@ -167,9 +167,9 @@ public class LibraryController {
return response;
}
@ApiOperation(value = "更新sketchboard level2type")
@Operation(summary = "更新sketchboard level2type")
@PostMapping("/updateLibraryLevel2Type")
public Response<Boolean> updateLibraryLevel2Type(@RequestBody LibraryLevel2TypeUpdateDTO libraryLevel2TypeUpdateDTO) {
public Response<Boolean> updateLibraryLevel2Type(@Validated @RequestBody LibraryLevel2TypeUpdateDTO libraryLevel2TypeUpdateDTO) {
return Response.success(libraryService.updateLibraryLevel2Type(libraryLevel2TypeUpdateDTO));
}
@@ -196,10 +196,57 @@ public class LibraryController {
}
@PostMapping("moveLibraryData")
@ApiOperation(value = "用户library数据迁移")
@Operation(summary = "用户library数据迁移")
public Response<Boolean> moveLibraryDate() throws ParseException {
libraryService.moveLibraryDate();
return Response.success(true);
}
@Operation(summary = "将系统模特添加到个人library")
@GetMapping("addSysModelToLib")
public Response<Map<String, String>> addSysModelToLib(@Parameter(description = "系统模特id") @RequestParam("sysModelId")long sysModelId){
return Response.success(libraryService.addSysModelToLib(sysModelId));
}
@Operation(summary = "将个人library元素添加到公共库")
@GetMapping("addToPublicLibrary")
public Response<String> addToPublicLibrary(@Parameter(description = "元素的libraryId") @RequestParam("libraryId") Long libraryId){
boolean b = libraryService.saveToOrganizationLibrary(libraryId);
if (b){
return Response.success("success");
}else {
return Response.success("fail");
}
}
@Operation(summary = "将个人library元素从公共库中删除")
@GetMapping("deleteFromPublicLib")
public Response<String> deleteFromPublicLib(@Parameter(description = "元素的libraryId") @RequestParam("libraryId") Long libraryId){
libraryService.deleteFromPublicLib(libraryId);
return Response.success("success");
}
@Operation(summary = "获取公共库")
@GetMapping("getPublicLib")
public Response<PageBaseResponse<Library>> getPublicLib(@Parameter(description = "排序" ) @RequestParam(value = "order", defaultValue = "DESC", required = false) String order,
@Parameter(description = "page") @RequestParam(value = "page", defaultValue = "1", required = false) Long page,
@Parameter(description = "size") @RequestParam(value = "size", defaultValue = "20", required = false) Long size){
return Response.success(libraryService.getPublicLib(order, page, size));
}
@Operation(summary = "管理员获取所有子账号lib元素")
@GetMapping("getAllSubAccLib")
public Response<PageBaseResponse<Library>> getAllSubAccLib(@Parameter(description = "排序") @RequestParam(value = "order", defaultValue = "DESC", required = false) String order,
@Parameter(description = "page") @RequestParam(value = "page", defaultValue = "1", required = false) Long page,
@Parameter(description = "size") @RequestParam(value = "size", defaultValue = "20", required = false) Long size){
return Response.success(libraryService.getAllSubAccLib(order, page, size));
}
@Operation(summary = "将系统sketch添加到library")
@GetMapping("addSysSketchToLibrary")
public Response<String> addSysSketchToLibrary(Long clothId, String path) {
return Response.success(libraryService.addSysSketchToLibrary(clothId, path));
}
}

View File

@@ -0,0 +1,63 @@
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.GetNotificationDTO;
import com.ai.da.model.vo.NotificationVO;
import com.ai.da.model.dto.PublishSysNotificationDTO;
import com.ai.da.service.MessageCenterService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
@Tag(name = "消息中心模块")
@Slf4j
@RestController
@RequestMapping("/api/message")
public class MessageCenterController {
@Resource
private MessageCenterService messageCenterService;
// 获取未读消息总数
@Operation(summary = "获取未读消息数")
@GetMapping("/getUnreadCount")
public Response<Map<String, Long>> getUnreadMessage(){
return Response.success(messageCenterService.getAllTypeMessageUnreadCount());
}
// 获取历史消息
@Operation(summary = "获取历史消息")
@PostMapping("/getHistoryNotification")
public Response<PageBaseResponse<NotificationVO>> getHistoryNotification(@Valid @RequestBody GetNotificationDTO getNotificationDTO) {
return Response.success(messageCenterService.getHistoryNotification(getNotificationDTO));
}
// 已读消息
@Operation(summary = "设置消息状态为已读")
@PostMapping("/setReadStatus")
public Response<Boolean> setReadStatus(@RequestParam("notificationIdList") List<Long> notificationIdList, @RequestParam("type") String type) {
return Response.success(messageCenterService.setReadStatus(notificationIdList, type));
}
// 发布系统消息
@Operation(summary = "发布系统消息")
@PostMapping("/publishSysMessage")
public Response<String> publishSysMessage(@Valid @RequestBody PublishSysNotificationDTO message) {
messageCenterService.publishSystemNotification(message);
return Response.success("success");
}
@Operation(summary = "一键已读")
@PostMapping("/oneClickRead")
public Response<String> setReadAll(@RequestParam("type") String type) {
messageCenterService.setReadAll(type);
return Response.success("success");
}
}

View File

@@ -3,18 +3,19 @@ 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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ai.da.service.PaymentInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
@CrossOrigin //开放前端的跨域访问
@Api(tags = "商品订单管理")
@Tag(name = "商品订单管理")
@RestController
@RequestMapping("/api/order-info")
public class OrderInfoController {
@@ -22,10 +23,13 @@ public class OrderInfoController {
@Resource
private OrderInfoService orderInfoService;
@ApiOperation("订单列表")
@Resource
private PaymentInfoService paymentInfoService;
@Operation(summary = "订单列表")
@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);
}
@@ -35,7 +39,7 @@ public class OrderInfoController {
* @param orderNo
* @return
*/
@ApiOperation("查询本地订单状态")
@Operation(summary = "查询本地订单状态")
@GetMapping("/query-order-status/{orderNo}")
public Response<String> queryOrderStatus(@PathVariable String orderNo){
String orderStatus = orderInfoService.getOrderStatus(orderNo);

View File

@@ -1,38 +1,40 @@
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;
import com.paypal.orders.Order;
import com.paypal.payments.Refund;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.annotation.Resource;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
@RestController
@Api(tags = "PayPalCheckout接口")
@Tag(name = "PayPalCheckout接口")
@RequestMapping("/api/paypal")
public class PayPalCheckoutController {
@Resource
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);
@Operation(summary = "创建订单")
@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);
}
@ApiOperation(value = "ipn异步回调")
@Operation(summary = "ipn异步回调")
@PostMapping(value = "/ipn/back")
public Response<String> callback(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Boolean result = payPalCheckoutService.doPost(request, response);
@@ -43,7 +45,7 @@ public class PayPalCheckoutController {
}
}
@ApiOperation(value = "查询指定订单")
@Operation(summary = "查询指定订单")
@PostMapping(value = "/trade/query/{orderNo}")
public Response<Order> queryOrder(@PathVariable String orderNo) throws SerializeException {
Order s = payPalCheckoutService.queryOrder(orderNo);
@@ -51,7 +53,7 @@ public class PayPalCheckoutController {
}
/** 不提供退款接口 */
@ApiOperation("申请退款")
@Operation(summary = "申请退款")
@PostMapping("/trade/refund/{orderNo}/{reason}")
public Response<HttpResponse<Refund>> refund(@PathVariable String orderNo, @PathVariable String reason) throws IOException {
Boolean response = payPalCheckoutService.refundOrder(orderNo,reason);
@@ -62,7 +64,7 @@ public class PayPalCheckoutController {
}
}
@ApiOperation("执行扣款")
@Operation(summary = "执行扣款")
@PostMapping("/trade/capture/{orderNo}")
public Response<com.paypal.orders.Order> captureOrder(@PathVariable String orderNo) throws IOException {
Order response = payPalCheckoutService.captureOrder(orderNo);

View File

@@ -1,23 +1,25 @@
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.model.dto.*;
import com.ai.da.model.vo.*;
import com.ai.da.model.vo.CommentVO;
import com.ai.da.model.vo.PortfolioVO;
import com.ai.da.model.vo.UserLikeChooseVO;
import com.ai.da.model.vo.UserLikeGroupVO;
import com.ai.da.service.PortfolioService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ai.da.service.UserFollowService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
@Api(tags = "Portfolio模块")
@Tag(name = "Portfolio模块")
@Slf4j
@RestController
@RequestMapping("/api/portfolio")
@@ -26,95 +28,139 @@ public class PortfolioController {
@Resource
private PortfolioService portfolioService;
@ApiOperation(value = "发布作品集")
@Resource
private UserFollowService userFollowService;
@Operation(summary = "发布作品集")
@PostMapping("/publish")
public Response<Boolean> preLogin(@RequestParam("file") MultipartFile canvas, @RequestParam("data") String data) {
public Response<Long> publish(@RequestParam("file") MultipartFile canvas, @RequestParam("data") String data) {
return Response.success(portfolioService.publish(canvas, data));
}
@ApiOperation(value = "删除作品集")
@Operation(summary = "删除作品集")
@GetMapping("/delete")
public Response<Boolean> delete(@RequestParam("id") Long id) {
return Response.success(portfolioService.delete(id));
}
@CrossOrigin
@ApiOperation(value = "作品集page")
@Operation(summary = "作品集page")
@PostMapping("/page")
public Response<PageBaseResponse<PortfolioVO>> page(@Valid @RequestBody QueryPortfolioPageDTO query) {
return Response.success(portfolioService.page(query));
}
@CrossOrigin
@ApiOperation(value = "作品详情")
@Operation(summary = "作品详情")
@PostMapping("/detail")
public Response<PortfolioVO> detail(@Valid @RequestBody PortfolioDTO portfolioDTO) {
return Response.success(portfolioService.detail(portfolioDTO));
}
@ApiOperation(value = "选择作品")
@Operation(summary = "选择作品")
@PostMapping("/choose")
public Response<UserLikeChooseVO> choose(@Valid @RequestBody PortfolioDTO portfolioDTO) {
public Response<ProjectChooseVO> choose(@Valid @RequestBody PortfolioDTO portfolioDTO) {
return Response.success(portfolioService.choose(portfolioDTO));
}
@ApiOperation(value = "更新作品")
@Operation(summary = "更新作品")
@PostMapping("/update")
public Response<PortfolioVO> update(@Valid @RequestBody PortfolioDTO portfolioDTO) {
return Response.success(portfolioService.update(portfolioDTO));
}
@ApiOperation(value = "广场用户注册")
@Operation(summary = "广场用户注册")
@PostMapping("/designWorksRegister")
public Response<Boolean> designWorksRegister(@Valid @RequestBody DesignWorksRegisterDTO designWorksRegisterDTO) {
return Response.success(portfolioService.designWorksRegister(designWorksRegisterDTO));
}
@ApiOperation(value = "喜欢")
@Operation(summary = "喜欢")
@GetMapping("/like")
public Response<Boolean> like(@RequestParam("id") Long id) {
return Response.success(portfolioService.like(id));
}
@ApiOperation(value = "不喜欢")
@Operation(summary = "不喜欢")
@GetMapping("/unlike")
public Response<Boolean> unlike(@RequestParam("id") Long id) {
return Response.success(portfolioService.unlike(id));
}
@ApiOperation(value = "获取点赞数")
@Operation(summary = "获取点赞数")
@GetMapping("/getLikeCount")
public Response<Long> getLikeCount(@RequestParam("id") Long id) {
return Response.success(portfolioService.getLikeCount(id));
}
@ApiOperation(value = "评论")
@Operation(summary = "评论")
@PostMapping("/comment")
public Response<Boolean> comment(@Valid @RequestBody CommentDTO commentDTO) {
return Response.success(portfolioService.comment(commentDTO));
}
@ApiOperation(value = "评论列表")
@Operation(summary = "评论列表")
@PostMapping("/commentPage")
public Response<PageBaseResponse<CommentVO>> commentPage(@Valid @RequestBody CommentPageDTO commentPageDTO) {
return Response.success(portfolioService.commentPage(commentPageDTO));
}
@ApiOperation(value = "增加浏览量")
@Operation(summary = "增加浏览量")
@GetMapping("/viewsIncrease")
public Response<Boolean> viewsIncrease(@RequestParam("id") Long id) {
return Response.success(portfolioService.viewsIncrease(id));
}
@ApiOperation(value = "浏览量获取")
@Operation(summary = "浏览量获取")
@GetMapping("/viewsGet")
public Response<Long> viewsGet(@RequestParam("id") Long id) {
return Response.success(portfolioService.viewsGet(id));
}
@ApiOperation(value = "删除评论")
@Operation(summary = "删除评论")
@PostMapping("/commentDelete")
public Response<Boolean> commentDelete(@Valid @RequestBody CommentDTO commentDTO) {
return Response.success(portfolioService.commentDelete(commentDTO));
}
@Operation(summary = "关注")
@GetMapping("/follow")
public Response<String> follow(@RequestParam("followeeId") Long followeeId) {
portfolioService.follow(followeeId);
return Response.success(BusinessException.getMessageFromResource("subscription.success"));
}
@Operation(summary = "取消关注")
@GetMapping("/cancelFollow")
public Response<String> cancelFollow(@RequestParam("followeeId") Long followeeId) {
portfolioService.cancelFollow(followeeId);
return Response.success(BusinessException.getMessageFromResource("unsubscribe.success"));
}
@Operation(summary = "获取关注列表")
@PostMapping("/getFolloweeList")
public Response<List<AccountFollowVO>> getFolloweeList(@Valid @RequestBody GetFollowListDTO getFollowListDTO) {
return Response.success(userFollowService.getFolloweeList(getFollowListDTO));
}
@Operation(summary = "获取粉丝列表")
@PostMapping("/getFollowerList")
public Response<List<AccountFollowVO>> getFollowerList(@Valid @RequestBody GetFollowListDTO getFollowListDTO) {
return Response.success(userFollowService.getFollowerList(getFollowListDTO));
}
/* @Operation(summary = "按标签名查询作品")
@GetMapping("/queryPortfolioByTag")
public Response<List<PortfolioVO>> queryPortfolioByTag(@RequestParam(value = "tagName", required = false) String tagName,
@RequestParam(value = "tagId", required = false) Long tagId) {
return Response.success(portfolioService.queryPortfolioByTag(tagName, tagId));
}*/
@Operation(summary = "将企业或教育版中的作品发布到公共gallery")
@GetMapping("/toPublic")
public Response<String> setPortfolioToPublic(@RequestParam("portfolioId") Long portfolioId) {
portfolioService.setPortfolioToPublic(portfolioId);
return Response.success("success");
}
}

View File

@@ -4,19 +4,19 @@ package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.Product;
import com.ai.da.service.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.util.Date;
import java.util.List;
@CrossOrigin //开放前端的跨域访问
@Api(tags = "商品管理")
@Tag(name = "商品管理")
@RestController
@RequestMapping("/api/product")
public class ProductController {
@@ -24,14 +24,14 @@ public class ProductController {
@Resource
private ProductService productService;
@ApiOperation("测试接口")
@Operation(summary = "测试接口")
@GetMapping("/test")
public Response<String> test(){
return Response.success("now" + new Date());
}
@ApiOperation("商品列表")
@Operation(summary = "商品列表")
@GetMapping("/list")
public Response<List<Product>> list(){

View File

@@ -0,0 +1,152 @@
package com.ai.da.controller;
import com.ai.da.common.config.MyTaskScheduler;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
import com.ai.da.model.dto.*;
import com.ai.da.model.vo.*;
import com.ai.da.service.ProjectService;
import com.ai.da.service.UserLikeGroupService;
import com.ai.da.service.WorkspaceService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.minio.errors.MinioException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import java.io.IOException;
@Tag(name = "Project模块")
@Slf4j
@RestController
@RequestMapping("/api/project")
public class ProjectController {
@Resource
private WorkspaceService workspaceService;
@Resource
private UserLikeGroupService userLikeGroupService;
@Resource
private ProjectService projectService;
@PostMapping("/saveOrUpdate")
@ApiOperationSupport(order = 1)
@Operation(summary = "新增或编辑", description = "传入project")
public Response<SaveOrUpdateProjectVO> saveOrUpdateProject(@Valid @RequestBody ProjectDTO projectDTO) {
return Response.success(workspaceService.saveOrUpdateProject(projectDTO));
}
@PostMapping("/page")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页查询", description = "传入project")
public Response<PageBaseResponse<ProjectVO>> page(@Valid @RequestBody ProjectQueryDTO projectQueryDTO) {
return Response.success(PageBaseResponse.success(userLikeGroupService.getPage(projectQueryDTO)));
}
// @PostMapping("/detail")
// @ApiOperationSupport(order = 3)
// @ApiOperation(value = "详情", notes = "传入project")
// public Response saveOrUpdateProject(@Valid @RequestBody ProjectDTO projectDTO) {
// return Response.success(workspaceService.saveOrUpdateProject(projectDTO));
// }
//
@PostMapping("/choose")
@ApiOperationSupport(order = 4)
@Operation(summary = "选择", description = "传入project")
public Response<ProjectChooseVO> choose(@Valid @RequestBody ProjectDTO projectDTO) {
return Response.success(userLikeGroupService.choose(projectDTO));
}
@PostMapping("/getModuleContent")
@ApiOperationSupport(order = 5)
@Operation(summary = "获取模块内容", description = "传入project")
public Response<ModuleChooseVO> getModuleContent(@Valid @RequestBody ProjectDTO projectDTO) {
return Response.success(userLikeGroupService.getModuleContent(projectDTO));
}
@PostMapping("/saveModuleContent")
@ApiOperationSupport(order = 6)
@Operation(summary = "存储模块内容", description = "传入project")
public Response<ModuleChooseVO> saveModuleContent(@Valid @RequestBody ModuleSaveDTO moduleSaveDTO) {
return Response.success(userLikeGroupService.saveModuleContent(moduleSaveDTO));
}
//
// @PostMapping("/delete")
// @ApiOperationSupport(order = 5)
// @ApiOperation(value = "删除", notes = "传入project")
// public Response saveOrUpdateProject(@Valid @RequestBody ProjectDTO projectDTO) {
// return Response.success(workspaceService.saveOrUpdateProject(projectDTO));
// }
@PostMapping("/getMannequinDetail")
@ApiOperationSupport(order = 7)
@Operation(summary = "获取模特详情", description = "传入mannequinId")
public Response<QueryLibraryPageVO> getMannequinDetail(@Valid @RequestBody MannequinDTO mannequinDTO) {
return Response.success(userLikeGroupService.getMannequinDetail(mannequinDTO));
}
@PostMapping("/threeDPage")
@ApiOperationSupport(order = 8)
@Operation(summary = "获取3Dpage", description = "传入ThreeDLayoutQueryDTO")
public Response<PageBaseResponse<ThreeDLayoutVO>> threeDPage(@Valid @RequestBody ThreeDLayoutQueryDTO threeDLayoutQueryDTO) {
return Response.success(PageBaseResponse.success(userLikeGroupService.getThreeDLayoutPage(threeDLayoutQueryDTO)));
}
@PostMapping("/getLayoutDetail")
@ApiOperationSupport(order = 9)
@Operation(summary = "获取3D详情", description = "传入project")
public Response<ThreeDVO> getLayoutDetail(@RequestParam(value = "threeDSimpleId") Long threeDSimpleId) {
return Response.success(userLikeGroupService.getLayoutDetail(threeDSimpleId));
}
@PostMapping("/getThreeDSize")
@ApiOperationSupport(order = 10)
@Operation(summary = "获取尺码", description = "传入project")
public Response<ThreeDSizeVO> getThreeDSize(@RequestParam(value = "threeDSimpleId") Long threeDSimpleId) {
return Response.success(userLikeGroupService.getThreeDSize(threeDSimpleId));
}
@GetMapping("/getThreeDGlb")
@ApiOperationSupport(order = 11)
@Operation(summary = "获取GLB", description = "传入project")
public void getThreeDGlb(@RequestParam(value = "threeDSimpleId") Long threeDSimpleId, HttpServletResponse response) throws MinioException, IOException {
userLikeGroupService.getThreeDGlb(threeDSimpleId, response);
}
@GetMapping("/downloadZip")
@ApiOperationSupport(order = 11)
@Operation(summary = "下载", description = "传入project")
public Response<String> downloadZip(@RequestParam(value = "threeDSimpleId") Long threeDSimpleId, @RequestParam(value = "sizeType") String sizeType, @RequestParam(value = "size") String size, HttpServletResponse response) throws MinioException, IOException {
return Response.success(userLikeGroupService.downloadZip(threeDSimpleId, sizeType, size, response));
}
@PostMapping("/delete")
@ApiOperationSupport(order = 12)
@Operation(summary = "删除", description = "传入project")
public Response<Boolean> delete(@RequestParam("projectId") Long projectId) {
return Response.success(userLikeGroupService.delete(projectId));
}
@Resource
private MyTaskScheduler myTaskScheduler;
/*@GetMapping("/dataMigration")
public String dataMigration(){
myTaskScheduler.projectDataCreate();
return "success";
}*/
@GetMapping("/getNextSequence")
public Response<Integer> getNextSequence(){
return Response.success(projectService.getOrCreateSequence());
}
}

View File

@@ -16,14 +16,17 @@ import com.ai.da.service.ChatRobotService;
import com.ai.da.service.LibraryService;
import com.ai.da.service.SuperResolutionService;
import com.ai.da.service.SysFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import jakarta.annotation.Resource;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
@@ -31,7 +34,7 @@ import java.util.Map;
import java.util.stream.Collectors;
@Api(tags = "python对接模块")
@Tag(name = "python对接模块")
@Slf4j
@RestController
@RequestMapping("/api/python")
@@ -49,17 +52,17 @@ public class PythonController {
@Resource
private SuperResolutionService superResolutionService;
@ApiOperation(value = "python服务保存图片到java服务")
@Operation(summary = "python服务保存图片到java服务")
@PostMapping("/saveGeneratePicture")
public Response<String> upload(@RequestParam("file") MultipartFile file,
@ApiParam("操作类型 generatePrint ->生成印花 " +
@Parameter(description = "操作类型 generatePrint ->生成印花 " +
"designCollection ->设计collection generateAdvancedDesign ->生成高级design" +
"generateSketch -> 生成草图")
@RequestParam(value = "operateType") String operateType) {
return Response.success(pythonService.upload(file, operateType));
}
// @ApiOperation(value = "python服务保存多张图片到java服务")
// @Operation(summary = "python服务保存多张图片到java服务")
// @PostMapping("/saveMultiGeneratePicture")
// public Response<List<String>> uploadMultiple(@RequestParam("files") MultipartFile[] files,
// @ApiParam("操作类型 generatePrint ->生成印花 " +
@@ -69,13 +72,13 @@ public class PythonController {
// return Response.success(pythonService.upload(files, operateType));
// }
@ApiOperation(value = "通过文件类型获取系统文件")
@Operation(summary = "通过文件类型获取系统文件")
@GetMapping("/getSysFileByLevel2Type")
public Response<List<SysFileVO>> getSysFileByLevel2Type(/*@RequestParam(value = "level2Type",required = false) String level2Type*/) {
return Response.success(sysFileService.getByLevel2Type("All"));
}
@ApiOperation(value = "通过用户id获取library")
@Operation(summary = "通过用户id获取library")
@GetMapping("/getLibraryByUserId")
public Response<Map<String, List<String>>> getLibraryByUserId(@RequestParam(value = "userId") Long userId) {
List<PythonLibraryVo> response = CopyUtil.copyList(libraryService.selectByAccountIdAnd1TypeList(userId,
@@ -86,37 +89,47 @@ public class PythonController {
}
@CrossOrigin
@ApiOperation(value = "发送用户输入消息")
@Operation(summary = "发送用户输入消息")
@PostMapping("/chatStream")
public Response<ChatRobotVO> MessageToPythonChatStream(@RequestBody ChatSendDTO chatSendDTO) {
log.info(chatSendDTO.toString());
return Response.success(chatRobotService.sendMessageToChatRobot(chatSendDTO));
}
@ApiOperation(value = "血条")
@Operation(summary = "血条")
@GetMapping("/getBloodBars")
public Response<BigDecimal> getBloodBars(@RequestParam(value = "userId") Long userId) {
return Response.success(chatRobotService.getBloodBars(userId));
}
@CrossOrigin
@ApiOperation(value = "likeOrUnlike")
@Operation(summary = "likeOrUnlike")
@PostMapping("/pictureLikeOrUnLike")
public Response<Library> pictureLikeOrUnLike(@RequestBody ChatRobotLibraryDTO chatRobotLibraryDTO) {
return Response.success(chatRobotService.pictureLikeOrUnLike(chatRobotLibraryDTO));
}
@CrossOrigin
@ApiOperation(value = "刷新会话缓存")
@Operation(summary = "刷新会话缓存")
@PostMapping("/flush")
public Response<String> ChatBufferFlush(@RequestBody ChatFlushDTO chatFlushDTO) {
return Response.success(chatRobotService.chatBufferFlush(chatFlushDTO));
}
@ApiOperation(value = "超分辨率")
@Operation(summary = "超分辨率")
@PostMapping("/prepareForSR")
public Response<List<String>> superResolution(@RequestBody List<SuperResolutionDTO> superResolutionDTO) {
return Response.success(superResolutionService.prepareForSR(superResolutionDTO));
}
@CrossOrigin
@Operation(summary = "Seg Anything 转发接口")
@PostMapping("/segAnything")
public Response<String> segAnything(@RequestBody Map<String, Object> payload) {
// 将前端传来的 Map 转为 fastjson JSONObject 并转发给 python 服务
JSONObject requestJson = (JSONObject) JSON.toJSON(payload);
String url = pythonService.segAnything(requestJson);
return Response.success(url);
}
}

View File

@@ -17,24 +17,29 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Function;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Valid;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Pattern;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@Api(tags = "History模块(saved Collection)")
@Tag(name = "History模块(saved Collection)")
@Slf4j
@RestController
@Validated
@RequestMapping("/api/history")
public class SavedCollectionController {
@Resource
@@ -52,7 +57,7 @@ public class SavedCollectionController {
@Resource
private PortfolioService portfolioService;
@ApiOperation(value = "History用户分页分组列表")
@Operation(summary = "History用户分页分组列表")
@PostMapping("/queryUserGroup")
public Response<PageBaseResponse<UserLikeGroupVO>> queryUserGroup(@Valid @RequestBody QueryHistoryPageDTO query) {
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
@@ -104,9 +109,9 @@ public class SavedCollectionController {
}
List<Long> groupIds = page.getRecords().stream().map(UserLikeGroup::getId).collect(Collectors.toList());
List<UserLikeVO> groupDetails = userLikeService.getGroupDetails(groupIds);
if (CollectionUtils.isEmpty(groupDetails)) {
throw new BusinessException("groupDetails.not.found");
}
// if (CollectionUtils.isEmpty(groupDetails)) {
// throw new BusinessException("groupDetails.not.found");
// }
Map<Long, List<UserLikeVO>> groupDetailMap = groupDetails.stream()
.collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId));
@@ -117,13 +122,17 @@ public class SavedCollectionController {
userLikeGroupVO.setUpdateDate(group.getUpdateDate().getTime());
userLikeGroupVO.setAuthor(account.getUserName());
//count 和detail
List<UserLikeVO> details = groupDetailMap.get(group.getId());
for (UserLikeVO detail : details) {
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId());
detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
if (groupDetailMap.keySet().contains(group.getId())) {
List<UserLikeVO> details = groupDetailMap.get(group.getId());
for (UserLikeVO detail : details) {
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId());
detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
}
userLikeGroupVO.setGroupDetails(details);
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
}else {
userLikeGroupVO.setSketchCount(0);
}
userLikeGroupVO.setGroupDetails(details);
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
if (userLikeGroupVO.getOriginal() == 0) {
userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName());
Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());
@@ -139,21 +148,21 @@ public class SavedCollectionController {
return Response.success(PageBaseResponse.success(convert));
}
@ApiOperation(value = "History用户分组详情,目前弃用 ")
@Operation(summary = "History用户分组详情,目前弃用 ")
@GetMapping("/getUserGroupDetail")
public Response<List<UserLikeVO>> getUserGroupDetail(
@ApiParam("用户分组id") @RequestParam("userGroupId") Long userGroupId) {
@Parameter(description = "用户分组id") @RequestParam("userGroupId") Long userGroupId) {
return Response.success(userLikeService.getGroupDetail(userGroupId));
}
@ApiOperation(value = "History修改用户分组名")
@Operation(summary = "History修改用户分组名")
@PostMapping("/updateUserGroupName")
public Response<HistoryUpdateVO> updateUserGroupName(@Valid @RequestBody HistoryUpdateDTO historyUpdateDTO) {
return Response.success(userLikeGroupService.updateUserGroupName(historyUpdateDTO.getUserGroupId()
, historyUpdateDTO.getUserGroupName(), historyUpdateDTO.getTimeZone()));
}
@ApiOperation(value = "History删除用户分组")
@Operation(summary = "History删除用户分组")
@PostMapping("/deleteUserGroup")
public Response<Boolean> deleteUserGroup(@Valid @RequestBody HistoryDeleteDTO deleteDTO) {
userLikeGroupService.deleteUserGroup(deleteDTO.getUserGroupId());
@@ -161,78 +170,175 @@ public class SavedCollectionController {
return Response.success(Boolean.TRUE);
}
@ApiOperation(value = "History choose")
@Operation(summary = "History choose")
@GetMapping("/choose")
public Response<UserLikeChooseVO> choose(
@ApiParam("用户分组id") @RequestParam("userGroupId") Long userGroupId) {
@Parameter(description = "用户分组id") @RequestParam("userGroupId") Long userGroupId) {
return Response.success(userLikeGroupService.choose(userGroupId));
}
@ApiOperation(value = "exportSave")
@Operation(summary = "exportSave")
@PostMapping("/exportSave")
public Response<Boolean> exportSave(@RequestParam("file") MultipartFile file, @RequestParam("userLikeGroupId") Long userLikeGroupId) {
return Response.success(userLikeGroupService.exportSave(file, userLikeGroupId));
public Response<Long> exportSave(@RequestParam("file") MultipartFile file, @RequestParam(value = "projectId", required = false) Long projectId,
@RequestParam("module") String module, @RequestParam(value = "designItemDetailId", required = false) Long designItemDetailId) {
return Response.success(userLikeGroupService.exportSave(file, projectId, module, designItemDetailId));
}
@ApiOperation(value = "exportSearch")
@Operation(summary = "exportSearch")
@PostMapping("/exportSearch")
public Response<JSONObject> exportSearch(@Valid @RequestBody ExportSearchDTO exportSearchDTO) {
return Response.success(userLikeGroupService.exportSearch(exportSearchDTO.getUserLikeGroupId()));
return Response.success(userLikeGroupService.exportSearch(exportSearchDTO));
}
@ApiOperation(value = "toProduct")
@Operation(summary = "toProduct")
@PostMapping("/toProduct")
public Response<List<ToProductImageResult>> toProduct(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
public Response<List<ToProductImageResultVO>> toProduct(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
return Response.success(userLikeGroupService.toProduct(toProductImageDTO));
}
@ApiOperation(value = "toProductImageElementUpload")
@Operation(summary = "toProductImageElementUpload")
@PostMapping("/toProductImageElementUpload")
public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file, @RequestParam(value = "userlikeGroupId") Long userLikeGroupId) {
return Response.success(userLikeGroupService.toProductImageElementUpload(file, userLikeGroupId));
public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file,
@RequestParam(value = "projectId", required = false) Long projectId,
@Parameter(description = "首尾帧", example = "first",
schema = @Schema(allowableValues = {"first", "last"}))
@RequestParam(value = "type", required = false) String type) {
return Response.success(userLikeGroupService.toProductImageElementUpload(file, projectId, type));
}
@ApiOperation(value = "productImageLike")
@Operation(summary = "toProductImageElementDelete")
@PostMapping("/toProductImageElementDelete")
public Response<Boolean> toProductImageElementDelete(@RequestParam(value = "id") Long id) {
return Response.success(userLikeGroupService.toProductImageElementDelete(id));
}
@Operation(summary = "productImageLike")
@PostMapping("/productImageLike")
public Response<Boolean> productImageLike(@Valid @RequestBody ProductImageLikeDTO productImageLikeDTO) {
return Response.success(userLikeGroupService.productImageLike(productImageLikeDTO));
public Response<CollectionSort> productImageLike(@Valid @RequestBody ProductImageLikeDTO productImageLikeDTO) {
CollectionSort collectionSort = userLikeGroupService.productImageLike(productImageLikeDTO);
return Response.success(collectionSort);
}
@ApiOperation(value = "productImageUnLike")
@Operation(summary = "collectionLikeUpdate")
@PostMapping("/collectionLikeUpdate")
public Response<Boolean> collectionLikeUpdate(@Valid @RequestBody CollectionLikeUpdateDTO collectionLikeUpdateDTO) {
return Response.success(userLikeGroupService.collectionLikeUpdate(collectionLikeUpdateDTO));
}
@Operation(summary = "productImageUnLike")
@PostMapping("/productImageUnLike")
public Response<Boolean> productImageUnLike(@Valid @RequestBody ProductImageLikeDTO productImageLikeDTO) {
return Response.success(userLikeGroupService.productImageUnLike(productImageLikeDTO));
}
@ApiOperation(value = "获取生成结果")
@Operation(summary = "获取生成结果")
@PostMapping("/toProductImageResult")
public Response<List<MagicToolResultVO>> getToProductImageResult(@Valid @RequestBody List<String> taskIdList) {
List<MagicToolResultVO> magicToolResultVOList = userLikeGroupService.getToProductImageResultList(taskIdList);
return Response.success(magicToolResultVOList);
}
@ApiOperation(value = "画布用户上传元素")
@Operation(summary = "画布用户上传元素")
@PostMapping("/canvasElementUpload")
public Response<CanvasElementUpload> canvasElementUpload(@RequestParam("file") MultipartFile file) {
return Response.success(userLikeGroupService.canvasElementUpload(file));
}
@ApiOperation("productImageLikeList")
@Operation(summary = "productImageLikeList")
@PostMapping("/productImageLikeList")
public Response<List<ToProductImageResultVO>> productImageLikeList(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
return Response.success(userLikeGroupService.productImageLikeList(toProductImageDTO));
}
@ApiOperation(value = "relight")
@Operation(summary = "relight")
@PostMapping("/relight")
public Response<List<ToProductImageResult>> relight(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
public Response<List<ToProductImageResultVO>> relight(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
return Response.success(userLikeGroupService.relight(toProductImageDTO));
}
@ApiOperation(value = "获取relight结果")
@Operation(summary = "relight元素")
@PostMapping("/convertRelightElement")
public Response<ToProductElementVO> convertRelightElement(@RequestParam("id") Long id) {
return Response.success(userLikeGroupService.convertRelightElement(id));
}
@Operation(summary = "获取relight结果")
@PostMapping("/relightResult")
public Response<List<MagicToolResultVO>> getRelightResult(@Valid @RequestBody List<String> taskIdList) {
List<MagicToolResultVO> magicToolResultVOList = userLikeGroupService.getRelightResult(taskIdList);
return Response.success(magicToolResultVOList);
}
@Operation(summary = "删除toProduct Relight的结果")
@GetMapping("/deleteResult")
public Response<String> deleteResult(@RequestParam("id") Long id,
@RequestParam("projectId") Long projectId,
@RequestParam("type") @Pattern(regexp = "^(Relight|ToProductImage)$", message = "Please choose type from 'Relight|ToProductImage'") String type){
try{
userLikeGroupService.deleteToProductRelightResult(id, projectId, type);
return Response.success();
}catch (Exception e){
return Response.fail(e.getMessage());
}
}
@Operation(summary = "likeHistoryRelSketch")
@PostMapping("/likeHistoryRelSketch")
public Response<String> likeHistoryRelSketch() {
return Response.success(userLikeGroupService.likeHistoryRelSketch());
}
@Operation(summary = "download")
@PostMapping("/download")
public Response<String> download() {
return Response.success(userLikeGroupService.download());
}
@Operation(summary = "productImageInitialize")
@PostMapping("/productImageInitialize")
public Response<Boolean> productImageUpload(@Valid @RequestBody ProductImageInitializeDTO productImageInitializeDTO) {
return Response.success(userLikeGroupService.productImageInitialize(productImageInitializeDTO));
}
@Operation(summary = "getInitializeProgress")
@PostMapping("/getInitializeProgress")
public Response<InitializeProgressVO> getInitializeProgress(@Valid @RequestBody ProductImageInitializeDTO productImageInitializeDTO) {
return Response.success(userLikeGroupService.getInitializeProgress(productImageInitializeDTO));
}
@Operation(summary = "brandDNASaveOrUpdate")
@PostMapping("/brandDNASaveOrUpdate")
public Response<Boolean> brandDNASaveOrUpdate(@Valid @RequestBody BrandDNADTO brandDNADTO) {
return Response.success(userLikeGroupService.brandDNASaveOrUpdate(brandDNADTO));
}
@Operation(summary = "brandDNADelete")
@PostMapping("/brandDNADelete")
public Response<Boolean> brandDNADelete(@Valid @RequestBody BrandDNADTO brandDNADTO) {
return Response.success(userLikeGroupService.brandDNADelete(brandDNADTO));
}
@Operation(summary = "brandDNAPage")
@PostMapping("/brandDNAPage")
public Response<PageBaseResponse<BrandDNAVO>> brandDNAPage(@Valid @RequestBody BrandDNAQueryDTO brandDNAQueryDTO) {
return Response.success(userLikeGroupService.brandDNAPage(brandDNAQueryDTO));
}
@Operation(summary = "brandLogoUpload")
@PostMapping("/brandLogoUpload")
public Response<BrandLogoUploadVO> brandDNASaveOrUpdate(@RequestParam("file") MultipartFile file) {
return Response.success(userLikeGroupService.brandLogoUpload(file));
}
@Operation(summary = "brandDNAUpload")
@PostMapping("/brandDNAUpload")
public Response<LibraryUpdateVo> brandDNAUpload(@RequestParam("file") MultipartFile file, @RequestParam("brandId") Long brandId) throws IOException {
return Response.success(userLikeGroupService.brandDNAUpload(file, brandId));
}
@Operation(summary = "brandDNAGenerate")
@PostMapping("/brandDNAGenerate")
public Response<BrandDNAGenerateVO> brandDNAGenerate(@RequestParam("prompt") String prompt) {
return Response.success(userLikeGroupService.brandDNAGenerate(prompt));
}
}

View File

@@ -1,47 +1,83 @@
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.stripe.exception.StripeException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import jakarta.annotation.Resource;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import java.io.IOException;
import java.util.Date;
import java.util.List;
@Api(tags = "Stripe模块")
@Tag(name = "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));
@Operation(summary = "创建支付链接")
@PostMapping("/createOrder")
public Response<String> pay(@Valid @RequestBody ProductPurchaseDTO productPurchaseDTO, HttpServletRequest request) {
return Response.success(stripeService.pay(productPurchaseDTO, request));
}
@ApiOperation("支付通知")
@Value("${stripe.webhook.fail.reminder}")
private String webhookReminderFlag;
@Operation(summary = "支付通知")
@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}")
@Operation(summary = "申请退款")
@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 +87,105 @@ public class StripeController {
}
}
@Operation(summary = "获取订阅")
@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);
}
}
@Operation(summary = "取消订阅")
@GetMapping("/cancelSubscription")
public Response<String> cancelSubscription(@RequestParam String subscriptionId, @RequestParam(required = false) String reason) {
stripeService.cancelSubscription(subscriptionId, reason);
return Response.success("success");
}
@Operation(summary = "创建推广码")
@PostMapping("/createCoupon")
public Response<String> createCoupon(@Valid @RequestBody CreateCouponDTO createCouponDTO){
return Response.success(stripeService.createCoupon(createCouponDTO));
}
@Operation(summary = "检查推广码")
@GetMapping("/checkCoupon")
public Response<CheckCouponsVO> checkCoupon(@RequestParam String promotionCode, @RequestParam Long price){
return Response.success(stripeService.checkProductCoupon(promotionCode, price));
}
@Operation(summary = "获取所有推广码")
@PostMapping("/getAllCoupons")
public Response<IPage<ProductCoupons>> getAllCoupons(@RequestBody QueryCouponsPageDTO queryCouponsPageDTO){
return Response.success(stripeService.getAllCoupons(queryCouponsPageDTO));
}
@Operation(summary = "检索优惠券")
@GetMapping("/retrieveCoupon")
public Response<String> retrieveCoupon(@RequestParam String couponId){
return Response.success(stripeService.retrieveCoupon(couponId));
}
@Operation(summary = "检索推广码")
@GetMapping("/retrievePromotionCode")
public Response<String> retrievePromotionCode(@RequestParam String retrievePromotionCode){
return Response.success(stripeService.retrievePromotionCode(retrievePromotionCode));
}
@Operation(summary = "更新推广码信息")
@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));
}
@Operation(summary = "删除推广码")
@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");
}
@Operation(summary = "创建订阅 临时")
@GetMapping("/createSubscriptionTemp")
public Response<String> createSubscriptionTemp(@RequestParam String name, @RequestParam String email) {
return Response.success(stripeService.createSubscriptionTemp(name, email));
}
@Operation(summary = "修改用户默认支付方式 临时")
@GetMapping("/changeCustomerPayment")
public Response<String> changeCustomerPayment(@RequestParam String name, @RequestParam String email) {
return Response.success(stripeService.changeCustomerPayment(name, email));
}
@Operation(summary = "临时 发送续订失败邮件")
@GetMapping("/sendRenewalFailEmail")
public Response<Boolean> sendRenewalFailEmail(@RequestParam String invoiceId, @RequestParam String subscriptionId, @RequestParam String orderNo) {
return Response.success(stripeService.sendRenewalFailEmail(invoiceId, subscriptionId,orderNo));
}
@Operation(summary = "临时 查询指定用户绑定的付款方式")
@GetMapping("/getCustomerPaymentMethod")
public Response<List<Map<String,String>>> getCustomerPaymentMethod(@RequestParam String name, @RequestParam String email) {
return Response.success(stripeService.getCustomerPaymentMethod(name, email));
}
@Operation(summary = "临时 解绑指定用户绑定的所有付款方式")
@GetMapping("/detachCustomerAllPaymentMethod")
public Response<String> detachCustomerAllPaymentMethod(@RequestParam String name, @RequestParam String email) {
return Response.success(stripeService.detachCustomerAllPaymentMethod(name, email));
}*/
}

View File

@@ -0,0 +1,112 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.common.task.SubscriptionReminderTask;
import com.ai.da.mapper.primary.entity.SubscriptionPlan;
import com.ai.da.model.dto.SubscriptionPlanDTO;
import com.ai.da.model.dto.SubscriptionPlanPageQuery;
import com.ai.da.model.dto.UpdateSubscriptionPlanDTO;
import com.ai.da.model.vo.SubscriptionPlanVO;
import com.ai.da.service.SubscriptionPlanService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Tag(name = "订阅计划模块")
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/subscription_plan")
public class SubscriptionPlanController {
private final SubscriptionPlanService subscriptionPlanService;
private final SubscriptionReminderTask subscriptionReminderTask;
@Operation(summary = "创建订阅计划")
@PostMapping("/createPlan")
public Response<String> createPlan(@Valid @RequestBody SubscriptionPlanDTO subscriptionPlanDTO) {
subscriptionPlanService.createPlan(subscriptionPlanDTO);
return Response.success();
}
@Operation(summary = "更新订阅计划")
@PostMapping("/updatePlan")
public Response<String> updatePlan(@Valid @RequestBody UpdateSubscriptionPlanDTO updateDTO) {
subscriptionPlanService.updatePlan(updateDTO);
return Response.success();
}
@Operation(summary = "搜索订阅计划")
@PostMapping("/searchByOrganizationIdAndStatus")
public Response<List<SubscriptionPlan>> searchByOrganizationIdAndStatus(@Valid @RequestBody SubscriptionPlanPageQuery subscriptionPlanPageQuery) {
return Response.success(subscriptionPlanService.searchByOrganizationIdAndStatus(subscriptionPlanPageQuery));
}
@Operation(summary = "分页搜索订阅计划")
@PostMapping("/searchByPage")
public Response<IPage<SubscriptionPlanVO>> searchByPage(@Valid @RequestBody SubscriptionPlanPageQuery subscriptionPlanPageQuery) {
IPage<SubscriptionPlanVO> subscriptionPlanVOIPage = subscriptionPlanService.searchByPage(subscriptionPlanPageQuery);
return Response.success(subscriptionPlanVOIPage);
}
@Operation(summary = "删除订阅计划")
@GetMapping("/deletePlan")
public Response<String> deletePlan(@RequestParam Long id) {
subscriptionPlanService.deletePlan(id);
return Response.success();
}
@Operation(summary = "管理员切换订阅计划")
@GetMapping("/switchSubscriptionPlan")
public Response<String> switchSubscriptionPlan(@RequestParam Long targetSubscriptionPlanId, @RequestParam(required = false) Long adminAccId) {
subscriptionPlanService.switchSubscriptionPlan(targetSubscriptionPlanId, adminAccId);
return Response.success();
}
@Operation(summary = "子账号切换订阅计划")
@GetMapping("/switchSubAccSubscriptionPlan")
public Response<String> switchSubAccSubscriptionPlan(@RequestParam Long targetSubscriptionPlanId, @RequestParam Long subAccId) {
subscriptionPlanService.switchSubAccSubscriptionPlan(targetSubscriptionPlanId, subAccId);
return Response.success();
}
// @Hidden
@Operation(summary = "activeSubscriptionPlan")
@GetMapping("/activeSubscriptionPlan")
public Response<String> activeSubscriptionPlan() {
subscriptionPlanService.activeSubscriptionPlan(null);
return Response.success();
}
// @Hidden
@Operation(summary = "expireSubscription")
@GetMapping("/expireSubscription")
public Response<String> expireSubscription() {
subscriptionPlanService.expireSubscription();
return Response.success();
}
@Operation(summary = "subscriptionReminder")
@GetMapping("/subscriptionReminder")
public Response<String> subscriptionReminder() {
subscriptionReminderTask.subscriptionReminder();
return Response.success();
}
@Operation(summary = "trialReminder")
@GetMapping("/trialReminder")
public Response<String> trialReminder() {
subscriptionReminderTask.trialReminder();
return Response.success();
}
}

View File

@@ -0,0 +1,31 @@
package com.ai.da.controller;
import com.ai.da.common.response.Response;
import com.ai.da.mapper.primary.entity.Product;
import com.ai.da.mapper.primary.entity.Tags;
import com.ai.da.service.ProductService;
import com.ai.da.service.TagsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.Date;
import java.util.List;
@CrossOrigin //开放前端的跨域访问
@Tag(name = "标签管理")
@RestController
@RequestMapping("/api/tags")
public class TagsController {
@Resource
private TagsService tagsService;
@Operation(summary = "获取标签")
@GetMapping("/getTags")
public Response<List<Tags>> getTags(@RequestParam(value = "userInput", required = false) String userInput) {
return Response.success(tagsService.getTags(userInput));
}
}

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