Compare commits
207 Commits
temp0516
...
test/stabl
| Author | SHA1 | Date | |
|---|---|---|---|
| 56ebcfbce2 | |||
| 4626ea3c55 | |||
| 5858f7dcf1 | |||
| 440dfdcceb | |||
| 36e41ecd89 | |||
| e1b08a9979 | |||
| b9041d9c09 | |||
| 037a0d12ff | |||
| 956b72729f | |||
| 9b185e6919 | |||
|
|
f77de3a1f4 | ||
| f03d32030d | |||
|
|
6a098ffa13 | ||
|
|
12c10167f1 | ||
|
|
679b213b6f | ||
|
|
6fa6c38398 | ||
| 925da9fa03 | |||
| 8f0d45adf9 | |||
| 505288fdb7 | |||
| 44e045ece3 | |||
| 429fdad2b7 | |||
| 46fbbd747e | |||
| 803bdfd291 | |||
|
|
6cbc4882fa | ||
|
|
54f8d4b5e0 | ||
|
|
314ad7a4f8 | ||
|
|
a56510c35a | ||
|
|
c2e2140ce6 | ||
| 83915d332f | |||
| 751aeb785d | |||
| 7cadab9345 | |||
|
|
8a7b64dd65 | ||
|
|
4c598200e5 | ||
|
|
d052918725 | ||
|
|
8fd6a3462e | ||
|
|
11eb6595dd | ||
|
|
0adfcb745d | ||
|
|
779e1e8be3 | ||
|
|
5297880c3b | ||
|
|
6028ef8cdd | ||
|
|
c7de1779bd | ||
|
|
95bfb00a9d | ||
|
|
5fc50f2d96 | ||
|
|
22d7395e11 | ||
|
|
3d4ea89516 | ||
|
|
2ed63cafd0 | ||
|
|
701652c6b2 | ||
|
|
df66b51e5c | ||
|
|
0c6187a759 | ||
|
|
2d6867b729 | ||
|
|
0b8d0a1843 | ||
| 64c7b8c1fd | |||
|
|
42f1d47f82 | ||
|
|
9ca0cd7c43 | ||
|
|
4c187d1fbd | ||
|
|
733de89883 | ||
|
|
0e1a5a70df | ||
| 5ecebd5117 | |||
| c6626b230a | |||
|
|
1cab7332f9 | ||
|
|
c1d88943a9 | ||
| bc85e561d2 | |||
|
|
be8968605b | ||
| 569c2e719f | |||
|
|
5fa7e36dc2 | ||
|
|
4a533b3cf0 | ||
| d2129459fe | |||
|
|
9784d07680 | ||
|
|
a71fa4df51 | ||
|
|
ce384dbba9 | ||
|
|
dd8f5696a2 | ||
|
|
4211bce256 | ||
|
|
bc240cd2ee | ||
|
|
f869f8eb10 | ||
|
|
9b438c78a3 | ||
| a5b435b80f | |||
| a64d4e30de | |||
| 0759452381 | |||
|
|
58a78a5366 | ||
|
|
9bd695a24d | ||
| e614e3a07a | |||
|
|
8c65592394 | ||
|
|
e093d694fd | ||
|
|
a5bfc4e41d | ||
| be001477ce | |||
| 3e150b2067 | |||
| 8ea06c05e9 | |||
|
|
9b589eece6 | ||
|
|
ba4388b87d | ||
|
|
5b3a668ce7 | ||
| aacbe92cdc | |||
| 57ab6c64ef | |||
| ffaef2ff6c | |||
| 5113cb0606 | |||
| 30d5466805 | |||
| 8457a61ded | |||
| e7f9b77fe5 | |||
|
|
6c0f65b801 | ||
|
|
ad1fa0e4c2 | ||
| 227c742f0d | |||
| c317942447 | |||
|
|
a6f02bf22f | ||
| 4f12aa92b6 | |||
| e6a2ce2b69 | |||
|
|
1f0439c7f9 | ||
|
|
676ef74bdc | ||
|
|
b2bc47da99 | ||
|
|
02787db0a1 | ||
| 19524520f4 | |||
| 2a2c4b1d39 | |||
| 257c99698e | |||
| 8ff8a7480f | |||
| 5e1ff16052 | |||
| dbd89798d5 | |||
| b5b6f737aa | |||
| 1d60a6a129 | |||
| 0017568cc7 | |||
|
|
375f717721 | ||
|
|
18914bea7e | ||
| fc48d8931f | |||
| 619d33b412 | |||
| 1a48527c70 | |||
|
|
ee68a5d782 | ||
|
|
3a29d25060 | ||
| 77f514a03b | |||
| 954f6207ec | |||
| 891f6fb15f | |||
| 49b086ad10 | |||
| 86e7119cfb | |||
|
|
775ae3266c | ||
| 1aea8e93f2 | |||
| 804dc9b1b4 | |||
| bd543e56d5 | |||
|
|
3dc7866fba | ||
|
|
ffd371e5b4 | ||
|
|
40aad9d1a3 | ||
| 709393a9a6 | |||
| fb8de15eca | |||
| f4e9a3474a | |||
|
|
890389843f | ||
| db04267591 | |||
| 5ff2bf11d7 | |||
| 76618de386 | |||
| eda92b3f0b | |||
|
|
b1b4b4147c | ||
|
|
4ba5f63a62 | ||
|
|
8b274b2822 | ||
| 54cbaf4b80 | |||
| c688af01f2 | |||
|
|
37de7d9276 | ||
|
|
02b3a407a9 | ||
| 5ebf0669f5 | |||
|
|
031d71bf99 | ||
|
|
205f0d54c5 | ||
|
|
50e46fed02 | ||
|
|
1303b1805a | ||
|
|
2845c2c8b9 | ||
|
|
cd817dbf57 | ||
| f9ce559915 | |||
| e40401f61f | |||
|
|
6e64eb741a | ||
|
|
c4a37f5d73 | ||
|
|
8f5a86db0b | ||
|
|
14c99f6c6b | ||
|
|
bf072e35f5 | ||
|
|
b8048704ba | ||
|
|
b6704c3caf | ||
|
|
6b07c84c80 | ||
|
|
980e1547cd | ||
|
|
ae2191f369 | ||
|
|
4b1a58c036 | ||
|
|
4dbd5a1fad | ||
|
|
b063cad764 | ||
|
|
f1eb48ae74 | ||
|
|
7233540ab4 | ||
|
|
e634481113 | ||
|
|
b3591f879d | ||
|
|
12c447d6b0 | ||
|
|
c73876e8b0 | ||
|
|
a726ceca59 | ||
|
|
51db8b4ec2 | ||
|
|
9f4dbda152 | ||
|
|
8e1766eed0 | ||
|
|
f1d67f2f7d | ||
|
|
ebb6577e98 | ||
| 5318e5d32a | |||
| 2aabb2347b | |||
| 3790b8ee72 | |||
| f4766d4ab4 | |||
| d1fab003d2 | |||
| 718198bcfe | |||
|
|
7b83f42ed8 | ||
| f23f4133d0 | |||
|
|
fb29310ba1 | ||
|
|
b86f168fe8 | ||
|
|
a54f7e7c30 | ||
|
|
de865b918f | ||
|
|
d2e917e3ce | ||
|
|
e70580c388 | ||
|
|
7454e16076 | ||
|
|
c3ae729466 | ||
|
|
faeb59bae5 | ||
|
|
5a69a770ac | ||
|
|
d1772be737 | ||
|
|
95aee1daae | ||
|
|
9bae02406c | ||
|
|
fda2a3120b |
9
files/COD-public-key.txt
Normal file
9
files/COD-public-key.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAymkBAWixxUi9IAeMWgsq
|
||||
K92AzFbe0qzzYPdkoh15ymL2A5MkYH7asnhFwclgdiFmd9a0TbZP+t/SzWW8UUzN
|
||||
1pXoEp48R+eguGTt5xkJwb10+H6quVXF/Ezzid5yzVW3dcYRp8qUlFr0XBpvkK9l
|
||||
FpPzh2+mwVEAsgBMXq/K50ZiX2dlkPZ7ffkVPWaK2ESIo3YgfM6dmiiza0hPWJ35
|
||||
UgTH5rwJ7vN3IdOJTlkQOvrIrj2ocPcrudeEwqybIbCGhgRBwQSBsXQOO4U//rE4
|
||||
VU+0LF/3uQgXkvVY1+a1JLiTncZYKGEQ/NtxM+dGtYWV2gPhQRyJ7Z77OX0XCbcn
|
||||
zwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
@@ -1,28 +0,0 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC1XpZ0+EIoJvQk
|
||||
GHAdpcpr35S+UnxNdOE+1sZsIDWuyzXG0d6vOudITmYFTqVzJRaAArhwp+NQ/R9y
|
||||
onsuUsEc0x2qTntySYMedHfI2TSl6qTsqpHykSLr6u0E4TuYUiGs/nf3t0A/rEvm
|
||||
KK6OP4vNgUlANhOKDwiCAdmJkiOBEHJwLsN1xlcnBkUR0Wr+uauVo+A0opkM7HrB
|
||||
aXXTcy+gpold+uCgCbRzFCiDr0uKsLJgb3Ce1aXTwa8k2dDg6mzhE0U65yhsNzjC
|
||||
Cqg+g8tfEVha9Nrsmd6hG2iFHnk4rCqRXhjuI1V10GiZUppMWJtGD2tj7ZK0XXKh
|
||||
5sAclu9RAgMBAAECggEBAKSQy8IclKKsHbA2wFwWV6Ijv2olnAYH/G0xId9wJmWQ
|
||||
mx3oxb6Hmt3fzPAZ2UOuLkk+rq4Bl9+fnQ494bk5e2G1KWCjT512mFNk6F9EvmGh
|
||||
k73uUvkeueoIQsG/wHxIYaf/SUlqbBCaPE/9L82AWVDBc36g0n/dfiHAnesWv8JV
|
||||
agiTF/SIWDPtzRaVh8VObFOusHdqnRuLqV7n0FSVJePSNBFSSOz5XTttOtM4whg8
|
||||
kw3jlCHbVMVKtPYcebxGf0vkDapyGJiZ6wc1rD4MXJTciG+WQNfNE+Af2UB606VC
|
||||
Nlq/CRkXr2Ix9ASSMeE4TcH+0EoxeITpP2NV+3hAzgECgYEA7mWSd6HgPXMdwO33
|
||||
efmx0qky+I/4bhicG9Go6021fRY+jUhRcj6VtDWBzuZwblgTSiDH4t2TbfB+hvQD
|
||||
GVTJNc21+hXEVNu0ajqLuMiCgqaZCeNeJYYYowbLSbYd4t/nQh1vCZ/44aRWqG8G
|
||||
eWEGruMaqSlGyFG7kyaoQaY1X6ECgYEAwsMGiupkNZ/JU3PZd2X2X+37b8BXcIt7
|
||||
itL413GDiLwCNII5pArD7GHYFQzN4GaUCt/VjrRXbTY1xYCk2RA0FyBMsxAGa+eH
|
||||
9iTSLQvDJpxV/44UY3L9ZFcz4t0WjRcsdqPt30yUBNWiAIGcjtae2tMvtfxKICLQ
|
||||
sYXAS+ciMbECgYEA4tnerV5pfq/7QSpw0y4Ky5ZcPXDqiwF6E3LH1dlleTlgnpqR
|
||||
fjAVzp0X/+UCWc4P1PsqmjQU5YnzLMIn7MPkkAFHSEnMQJ+sp2U8rcKHhoG3oVQt
|
||||
s3FOIlwFuAfHmqtLaXuOvM7wSu9R0weLVpdAf8z2AsCXbWlxH86qT4Y0xeECgYBM
|
||||
NJkbw8i//qx8vciqYjf7oxeNy1mrTLhjQldhnSXVW5MVTpsVJ60vkb1Fx0PK+PgW
|
||||
JSzfcIsAzYROqh5WXHO1VMsOCUgp8mcNlayzOXX7ZpJzsvkhTH3/Q+umadGIFTgt
|
||||
l8jcZY9JMPn5br1+WlW/04BImdW7K0QzId1zFZYYkQKBgQDqswTLEpbBDOE/3uk4
|
||||
laZ9kTLJMP/hVmDJ0/jbETMdCkzIORnr3xFxmZIHG17E2In9PVumD0ESCh7qbCDE
|
||||
isbfLSgfJR6ItdOM6W2R0GAsXQ3e0byBpR7qm0j9J3zYRhQwfVbZtkX0uywB9a/4
|
||||
q2bz4491ESrbryx16FZKUJeX8g==
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -1,9 +0,0 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtV6WdPhCKCb0JBhwHaXK
|
||||
a9+UvlJ8TXThPtbGbCA1rss1xtHerzrnSE5mBU6lcyUWgAK4cKfjUP0fcqJ7LlLB
|
||||
HNMdqk57ckmDHnR3yNk0peqk7KqR8pEi6+rtBOE7mFIhrP5397dAP6xL5iiujj+L
|
||||
zYFJQDYTig8IggHZiZIjgRBycC7DdcZXJwZFEdFq/rmrlaPgNKKZDOx6wWl103Mv
|
||||
oKaJXfrgoAm0cxQog69LirCyYG9wntWl08GvJNnQ4Ops4RNFOucobDc4wgqoPoPL
|
||||
XxFYWvTa7JneoRtohR55OKwqkV4Y7iNVddBomVKaTFibRg9rY+2StF1yoebAHJbv
|
||||
UQIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDD+NUduhLJcb2Z
|
||||
ryLwtIHdmjfh6Wn73E9umHmdPf6yF7IbDoTDBmIAfaPU/oiLgrka3fKGCkn/yHvW
|
||||
QcL+Ry96/Uu+iIN9SbG5vPVvLtLfx+5++IE8p3RxcSDQggqFuJ+osebXeVIrOcTZ
|
||||
s7nXCqGenTcagv2eJESiq712fcBvY1wVgilT6ERVQy+zdvwAOiS6wXF/51AueP+E
|
||||
rNDHuPLkGH6JhLtO4LffeYgM/Th7eCl/WWLkiVMSoeJt7vWFe4bYV/IYW1qI2aQX
|
||||
H1DYmvwgDfDv8jRORD9D191YBqq1l3Tw7VSjFrpydFvSK46dbXKBj3oA5ZiJ+Ttj
|
||||
ZCtBRiOdAgMBAAECggEAUKl4Fs9C8lV1o+85Y3f4yBy1CbCIZhltPGlYDUe6MNWe
|
||||
ApL8REW5Sthr+bx2uW2qAQv/yfosMTL0/eB9gSoNugLODXOlI4mUtI25O/U66M8j
|
||||
NHHWx/9o51SYHBqaeCXg2Y+4I1KVZqNVigH26TNACMhPKQNnnpLxCT/FMSNbdLzo
|
||||
wfFMyjN7R3Hc8ZB1C2zx+fLJm1DNZeOJOHAkW1LprlotRv6eq3lOwZaDDUTB5xhT
|
||||
0Erev3djC/R08Fne1y09ukar8z0tX3Fm9SzHJDFVoh1HOYPWayCiAxOhip+JnFct
|
||||
rtK5jjuB8DAP4Q1k12yOWUFwb6NOG9Hf/G6XExRPBQKBgQD1P2SnKD1IlNSrvVJn
|
||||
2HzKnBVllVo50fbv7SpnP8H1B5vt2Qo/mgOGtzbeXyK4mcLFaWg9++BrsjTXwZFi
|
||||
wmKeJgNI822DPhF5qQhK7Cc+WMwesufGrTnmRUOEFYehz9ffZBvMa1s/ObIEyLcr
|
||||
tYitT74+nFdRPtr+8PN06QMEcwKBgQDMkGFWhSO7p7VMuV0H0uC1fj3GGtVvM+Ps
|
||||
a9ASs0HBhQaOpberkKY9vgry6HoJ8CGvbrxlmc3JoYPRwKN3oQRYLvGSF96HAg9i
|
||||
643FmVAWiVzHpjYX9fMJyCzXiOw6Qet8Zp3Ewaw9BBG0200Fj6/zGc8XEqNjIv5Q
|
||||
DQ9MosRDrwKBgQCU5i5IRugeXy5YLxQPNKNfqDBdgrZLEK2qsgXithUencYQPIw6
|
||||
XVnyut43WO+NwN0+WmcN6xUwjfwDWuTYX0jc2Bt6eUFuQ4r8oKIGSybwdZ1IrjqG
|
||||
p7nVkwwQ77lvhu98FB3EmRHHa1IoEW0Uvp0DDL1m6ikhjNYNn2FRA//u/QKBgGbY
|
||||
a+eo1ldBMPha9Te6wLjeuEYCNa5L41p4tcrBDt0xeSN8k4QRHFNMWYrYcIrQjM77
|
||||
mIJoOjsWFgT9mfHKJToEl/VAROORmJS+Iq/mrYo3E0tY+DdBsygG2Oyf7Uw42iDY
|
||||
IpfKW0Lt6c0IuIeEPwy0vBY4i6aK8Frkxf1ck9oHAoGBAKFQg/c36J6tjnttpmes
|
||||
R/zijp1ROE+z+dMmm3icDhCDvvR6MnHa2Y9ittNWdEUosZk9FsFn62YNtJJV2SIN
|
||||
DDn0ASLtBkeCd8yad5uzUb7Umci9V7TP5c0NE3DK95FmciLGOuRbFyq1Z8edHnaS
|
||||
zgLnf4yb25eCMLEG0Z2ugN3C
|
||||
-----END PRIVATE KEY-----
|
||||
9
files/Code-Create Limited.merchant.aqs.public.key.pem
Normal file
9
files/Code-Create Limited.merchant.aqs.public.key.pem
Normal file
@@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw/jVHboSyXG9ma8i8LSB
|
||||
3Zo34elp+9xPbph5nT3+sheyGw6EwwZiAH2j1P6Ii4K5Gt3yhgpJ/8h71kHC/kcv
|
||||
ev1LvoiDfUmxubz1by7S38fufviBPKd0cXEg0IIKhbifqLHm13lSKznE2bO51wqh
|
||||
np03GoL9niREoqu9dn3Ab2NcFYIpU+hEVUMvs3b8ADokusFxf+dQLnj/hKzQx7jy
|
||||
5Bh+iYS7TuC333mIDP04e3gpf1li5IlTEqHibe71hXuG2FfyGFtaiNmkFx9Q2Jr8
|
||||
IA3w7/I0TkQ/Q9fdWAaqtZd08O1Uoxa6cnRb0iuOnW1ygY96AOWYifk7Y2QrQUYj
|
||||
nQIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
49
pom.xml
49
pom.xml
@@ -28,7 +28,19 @@
|
||||
<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>
|
||||
@@ -202,6 +214,13 @@
|
||||
<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>
|
||||
@@ -226,7 +245,37 @@
|
||||
<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>
|
||||
|
||||
@@ -44,6 +44,10 @@ public class GenerateConsumer {
|
||||
|
||||
@Value("${redis.key.generateResult}")
|
||||
private String generateResultKey;
|
||||
@Value("${redis.key.toProductImageResultKey}")
|
||||
private String toProductImageResultKey;
|
||||
@Value("${redis.key.relightResultKey}")
|
||||
private String relightResultKey;
|
||||
|
||||
public void generate(Message msg, Channel channel, String consumerName) {
|
||||
log.info("============start listening==========");
|
||||
@@ -63,23 +67,14 @@ public class GenerateConsumer {
|
||||
} catch (IOException ex) {
|
||||
log.error("手动确认,不返回队列重新消费");
|
||||
}
|
||||
// 2.2 将该消息从取消列表中删除
|
||||
// redisUtil.removeFromSet(cancelSetKey, uniqueId);
|
||||
} else {
|
||||
// GenerateCollectionVO generateCollectionVO = generateService.generateThroughImageText(generateThroughImageTextDTO);
|
||||
generateService.generateThroughImageText(generateThroughImageTextDTO);
|
||||
// 将消息从redis排队队列中删除,需保证被消费的消息存储到db之后再从redis删除
|
||||
redisUtil.removeFromZSet(consumptionOrderKey, uniqueId);
|
||||
/*if (!Objects.isNull(generateCollectionVO)) {
|
||||
HashMap<String, String> generateResult = new HashMap<>();
|
||||
generateResult.put(uniqueId, JSONObject.toJSONString(generateCollectionVO));
|
||||
// 将结果存在redis中 ,为空时不要存
|
||||
redisUtil.addToMap(resultMapKey, generateResult);
|
||||
}*/
|
||||
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
log.error(e.getMsg());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
// channel.basicNack() 为不确认deliveryTag对应的消息,第二个参数是否应用于多消息,第三个参数是否requeue
|
||||
try {
|
||||
// 第二个参数,是否批量确认消息,当传false时,只确认当前 deliveryTag对应的消息;当传true时,会确认当前及之前所有未确认的消息。
|
||||
@@ -94,7 +89,7 @@ public class GenerateConsumer {
|
||||
}
|
||||
// 将入参和错误信息存入数据库
|
||||
String exceptionMessage = JSONObject.toJSONString(generateThroughImageTextDTO) +
|
||||
" Exception message : " + e.getMsg();
|
||||
" Exception message : " + e.getMessage();
|
||||
HashMap<String, String> exceptionInfo = new HashMap<>();
|
||||
exceptionInfo.put(String.valueOf(uniqueId), exceptionMessage);
|
||||
// 存redis
|
||||
@@ -154,6 +149,100 @@ public class GenerateConsumer {
|
||||
|
||||
}
|
||||
|
||||
public void processToProductImageResult(Message msg, Channel channel) {
|
||||
log.info("============processToProductImageResult listening==========");
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
Map<String, String> generateResult = JSONObject.parseObject(msg.getBody(), Map.class);
|
||||
log.info("toProductImage response : {}", generateResult);
|
||||
|
||||
try {
|
||||
log.info("tasks_id : {} start ", generateResult.get("tasks_id"));
|
||||
if (generateResult.get("status").equals("SUCCESS")) {
|
||||
String url = generateResult.get("image_url");
|
||||
String taskId = generateResult.get("tasks_id");
|
||||
String category = generateResult.get("category");
|
||||
generateService.processToProductImageResult(taskId, url, category);
|
||||
} else {
|
||||
// 修改redis中的数据状态为exception
|
||||
String key = toProductImageResultKey + ":" + generateResult.get("tasks_id");
|
||||
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<>();
|
||||
exceptionInfo.put(generateResult.get("tasks_id"), generateResult.get("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.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);
|
||||
}
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
log.info("tasks_id : {}, end , message : {}, 执行时长: {} 毫秒", generateResult.get("tasks_id"), generateResult.get("message"), (end - start));
|
||||
log.info("============ProcessToProductImageResult End listening==========");
|
||||
}
|
||||
|
||||
private void processRelightResult(Message msg, Channel channel) {
|
||||
log.info("============processRelightResult listening==========");
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
Map<String, String> generateResult = JSONObject.parseObject(msg.getBody(), Map.class);
|
||||
log.info("toProductImage response : {}", generateResult);
|
||||
|
||||
try {
|
||||
log.info("tasks_id : {} start ", generateResult.get("tasks_id"));
|
||||
if (generateResult.get("status").equals("SUCCESS")) {
|
||||
String url = generateResult.get("image_url");
|
||||
String taskId = generateResult.get("tasks_id");
|
||||
String category = generateResult.get("category");
|
||||
generateService.processRelightResult(taskId, url, category);
|
||||
} else {
|
||||
// 修改redis中的数据状态为exception
|
||||
String key = relightResultKey + ":" + generateResult.get("tasks_id");
|
||||
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<>();
|
||||
exceptionInfo.put(generateResult.get("tasks_id"), generateResult.get("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.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);
|
||||
}
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
log.info("tasks_id : {}, end , message : {}, 执行时长: {} 毫秒", generateResult.get("tasks_id"), generateResult.get("message"), (end - start));
|
||||
log.info("============ProcessRelightResult End listening==========");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer1(Message msg, Channel channel) {
|
||||
@@ -213,4 +302,16 @@ public class GenerateConsumer {
|
||||
public void getGenerateResult(Message msg, Channel channel) {
|
||||
processGenerateResult(msg, channel);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.TO_PRODUCT_IMAGE_RESULT_QUEUE)
|
||||
@RabbitHandler
|
||||
public void getToProductImageResult(Message msg, Channel channel) {
|
||||
processToProductImageResult(msg, channel);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.RELIGHT_RESULT_QUEUE)
|
||||
@RabbitHandler
|
||||
public void getRelightResult(Message msg, Channel channel) {
|
||||
processRelightResult(msg, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,17 +12,23 @@ public class MQConfig {
|
||||
// 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-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-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-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-dev";
|
||||
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() {
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.ai.da.common.config;
|
||||
|
||||
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.AccountMapper;
|
||||
import com.ai.da.mapper.primary.TrialOrderMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
|
||||
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;
|
||||
@@ -17,15 +19,28 @@ import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
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 MyTaskScheduler {
|
||||
|
||||
@PostConstruct
|
||||
public void test() {
|
||||
// clearMinio();
|
||||
// addSystemFileStyle();
|
||||
}
|
||||
|
||||
@Resource
|
||||
private AccountMapper accountMapper;
|
||||
|
||||
@@ -127,6 +142,181 @@ public class MyTaskScheduler {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else {
|
||||
SendEmailUtil.sendNoExcelEmail("1023316923@qq.com", null);
|
||||
SendEmailUtil.sendNoExcelEmail("calvinwong@aidlab.hk", null);
|
||||
SendEmailUtil.sendNoExcelEmail("kaicpang.pang@connect.polyu.hk", null);
|
||||
SendEmailUtil.sendNoExcelEmail("kimwong@code-create.com.hk", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupMapper userLikeGroupMapper;
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
@Resource
|
||||
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
@Resource
|
||||
private TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
|
||||
@Resource
|
||||
private DesignItemMapper designItemMapper;
|
||||
@Resource
|
||||
private DesignItemDetailMapper designItemDetailMapper;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
public void clearMinio() {
|
||||
// 获取当前所有history
|
||||
QueryWrapper<UserLikeGroup> userLikeGroupQueryWrapper = new QueryWrapper<>();
|
||||
List<UserLikeGroup> userLikeGroupList = userLikeGroupMapper.selectList(userLikeGroupQueryWrapper);
|
||||
List<Long> userLikeGroupIdList = userLikeGroupList.stream().map(UserLikeGroup::getId).collect(Collectors.toList());
|
||||
QueryWrapper<UserLike> userLikeQueryWrapper = new QueryWrapper<>();
|
||||
userLikeQueryWrapper.lambda().in(UserLike::getUserLikeGroupId, userLikeGroupIdList);
|
||||
// 所有喜欢的图片
|
||||
List<UserLike> userLikes = userLikeMapper.selectList(userLikeQueryWrapper);
|
||||
List<Long> designOutfitIdList = userLikes.stream().map(UserLike::getDesignOutfitId).collect(Collectors.toList());
|
||||
QueryWrapper<TDesignPythonOutfit> designPythonOutfitQueryWrapper = new QueryWrapper<>();
|
||||
designPythonOutfitQueryWrapper.lambda().notIn(TDesignPythonOutfit::getId, designOutfitIdList);
|
||||
List<TDesignPythonOutfit> tDesignPythonOutfits = designPythonOutfitMapper.selectList(designPythonOutfitQueryWrapper);
|
||||
// int i = 0;
|
||||
// for (TDesignPythonOutfit tDesignPythonOutfit : tDesignPythonOutfits) {
|
||||
// String designUrl = tDesignPythonOutfit.getDesignUrl();
|
||||
// if (StringUtils.isNotBlank(designUrl)) {
|
||||
// minioUtil.deleteObject(designUrl);
|
||||
// i ++;
|
||||
// }
|
||||
// QueryWrapper<TDesignPythonOutfitDetail> designPythonOutfitDetailQueryWrapper = new QueryWrapper<>();
|
||||
// designPythonOutfitDetailQueryWrapper.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, tDesignPythonOutfit.getId());
|
||||
// List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(designPythonOutfitDetailQueryWrapper);
|
||||
// for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||
// if (!tDesignPythonOutfitDetail.getImageCategory().equals("body")) {
|
||||
// if (StringUtils.isNotBlank(tDesignPythonOutfitDetail.getImageUrl())) {
|
||||
// minioUtil.deleteObject(tDesignPythonOutfitDetail.getImageUrl());
|
||||
// i ++;
|
||||
// }
|
||||
// if (StringUtils.isNotBlank(tDesignPythonOutfitDetail.getMaskUrl())) {
|
||||
// minioUtil.deleteObject(tDesignPythonOutfitDetail.getMaskUrl());
|
||||
// i ++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
System.out.println("i");
|
||||
// List<Long> designItemIdList = userLikes.stream().map(UserLike::getDesignItemId).collect(Collectors.toList());
|
||||
// QueryWrapper<DesignItem> designItemQueryWrapper = new QueryWrapper<>();
|
||||
// designItemQueryWrapper.lambda().in(DesignItem::getId,designItemIdList);
|
||||
// List<DesignItem> designItems = designItemMapper.selectList(designItemQueryWrapper);
|
||||
// for (DesignItem designItem : designItems) {
|
||||
// QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||
// designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItem.getId());
|
||||
// List<DesignItemDetail> designItemDetails = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||
// for (DesignItemDetail designItemDetail : designItemDetails) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Resource
|
||||
private AttributeRetrievalMapper attributeRetrievalMapper;
|
||||
|
||||
public void addSystemFileStyle() {
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||
|
||||
try {
|
||||
String[] filePaths = {
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Blouse style output updated25.6.2024.xlsx",
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Dress style output updated25.6.2024.xlsx",
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Outerwear style output.xlsx",
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Skirt style output .xlsx",
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Trousers style output.xlsx"
|
||||
};
|
||||
|
||||
for (String filePath : filePaths) {
|
||||
executorService.submit(() -> processExcelFile(filePath));
|
||||
}
|
||||
} finally {
|
||||
executorService.shutdown();
|
||||
try {
|
||||
if (!executorService.awaitTermination(60, TimeUnit.MINUTES)) {
|
||||
executorService.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
executorService.shutdownNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processExcelFile(String filePath) {
|
||||
System.out.println("线程开始");
|
||||
try {
|
||||
List<List<String>> excelData = ExcelReader.readExcel(filePath);
|
||||
String tableName = getTableNameFromFilePath(filePath);
|
||||
String prefix = getPrefixFromFilePath(filePath);
|
||||
|
||||
for (List<String> columnData : excelData) {
|
||||
String style = columnData.get(0);
|
||||
for (int i = 1; i < columnData.size(); i++) {
|
||||
String fileName = columnData.get(i);
|
||||
if (StringUtils.isBlank(fileName)) {
|
||||
continue;
|
||||
}
|
||||
if ("X".equals(style)) {
|
||||
attributeRetrievalMapper.updateStyleByFileName("X", prefix + fileName, tableName);
|
||||
System.out.println(fileName);
|
||||
} else {
|
||||
attributeRetrievalMapper.updateStyleByFileName(style, prefix + fileName, tableName);
|
||||
System.out.println(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private String getTableNameFromFilePath(String filePath) {
|
||||
if (filePath.contains("Blouse")) {
|
||||
return "female_top";
|
||||
} else if (filePath.contains("Dress")) {
|
||||
return "female_dress";
|
||||
} else if (filePath.contains("Outerwear")) {
|
||||
return "female_outwear";
|
||||
} else if (filePath.contains("Skirt")) {
|
||||
return "female_skirt";
|
||||
} else if (filePath.contains("Trousers")) {
|
||||
return "female_pants";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getPrefixFromFilePath(String filePath) {
|
||||
if (filePath.contains("Blouse")) {
|
||||
return "blouse/";
|
||||
} else if (filePath.contains("Dress")) {
|
||||
return "dress/";
|
||||
} else if (filePath.contains("Outerwear")) {
|
||||
return "outwear/";
|
||||
} else if (filePath.contains("Skirt")) {
|
||||
return "skirt/";
|
||||
} else if (filePath.contains("Trousers")) {
|
||||
return "trousers/";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// public static List<String> getFileNames(String directoryPath) {
|
||||
// List<String> fileNames = new ArrayList<>();
|
||||
// Path path = Paths.get(directoryPath);
|
||||
//
|
||||
// try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {
|
||||
// for (Path entry : stream) {
|
||||
// if (Files.isRegularFile(entry)) {
|
||||
// fileNames.add(entry.getFileName().toString());
|
||||
// }
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// System.err.println("Error reading directory: " + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// return fileNames;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -3,17 +3,12 @@ package com.ai.da.common.config;
|
||||
import com.paypal.core.PayPalEnvironment;
|
||||
import com.paypal.core.PayPalHttpClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
@PropertySource("classpath:paypal-sandbox.properties")
|
||||
@PropertySource("classpath:payment.properties")
|
||||
public class PayPalClient {
|
||||
|
||||
public PayPalHttpClient client(String mode, String clientId, String clientSecret) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ai.da.common.constant;
|
||||
|
||||
public class AlipayHKConstant {
|
||||
|
||||
// 服务名
|
||||
public static final String CREATE_ORDER = "create_order";
|
||||
public static final String ORDER_DETAILS = "order_details";
|
||||
public static final String TRANSACTION_DETAILS = "transaction_details";
|
||||
public static final String GET_FILE = "get_file";
|
||||
public static final String CREATE_AUTO_DEBIT = "create_auto_debit";
|
||||
public static final String REFRESH_TRANSACTION_STATUS = "refresh_transaction_status";
|
||||
public static final String REFUND_TRANSACTION = "refund_transaction";
|
||||
|
||||
// 订单状态
|
||||
public static final String STATUS_NEW = "new";
|
||||
public static final String STATUS_WAIT = "wait";
|
||||
public static final String STATUS_PAID = "paid";
|
||||
public static final String STATUS_EXPIRED = "expired";
|
||||
public static final String STATUS_LIQUIDATED = "liquidated";
|
||||
}
|
||||
@@ -11,4 +11,26 @@ public class CommonConstant {
|
||||
// 单位 秒 一天过期 in redis
|
||||
public static final Long GENERATE_RESULT_EXPIRE_TIME = 24 * 60 * 60L;
|
||||
|
||||
public static class Numbers{
|
||||
public static final Integer NUMBER_10 = 10;
|
||||
public static final Integer NUMBER_1000 = 1000;
|
||||
public static final Integer NUMBER_10080 = 10080;
|
||||
}
|
||||
|
||||
public static final String GENERATE_PATH = "/api/generate_image";
|
||||
|
||||
public static final String GENERATE_SINGLE_LOGO = "/api/generate_single_logo";
|
||||
|
||||
public static final String GENERATE_SLOGAN = "/api/slogan";
|
||||
|
||||
public static final String GENERATE_CANCEL = "/api/generate_cancel/";
|
||||
|
||||
public static final String GENERATE_LOGO_SINGLE_CANCEL = "/api/generate_single_logo_cancel/";
|
||||
|
||||
public static final String PYTHON_PORT_9996 = "9996";
|
||||
|
||||
public static final String PYTHON_PORT_9997 = "9997";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ai.da.common.enums;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
@@ -36,7 +38,18 @@ public enum CollectionLevel2TypeEnum {
|
||||
* 男装下装
|
||||
*/
|
||||
BOTTOMS("Bottoms"),
|
||||
;
|
||||
/**
|
||||
* 印花-logo
|
||||
*/
|
||||
LOGO("Logo"),
|
||||
/**
|
||||
* 印花-slogan
|
||||
*/
|
||||
SLOGAN("Slogan"),
|
||||
/**
|
||||
* 印花-图案
|
||||
*/
|
||||
Pattern("Pattern");
|
||||
|
||||
private String realName;
|
||||
|
||||
@@ -51,4 +64,8 @@ public enum CollectionLevel2TypeEnum {
|
||||
public static CollectionLevel2TypeEnum of(String realName) {
|
||||
return Stream.of(CollectionLevel2TypeEnum.values()).filter(v -> v.getRealName().equals(realName)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static List<String> printType() {
|
||||
return Arrays.asList(LOGO.getRealName(), SLOGAN.getRealName(), Pattern.getRealName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,19 +8,31 @@ import lombok.Getter;
|
||||
public enum CreditsEventsEnum {
|
||||
|
||||
PRICE("price","6"),
|
||||
// PRICE("price","0.1"),
|
||||
|
||||
BUY_CREDITS("Buy Credits","600"),
|
||||
BUY_CREDITS("Buy Credits","60"),
|
||||
|
||||
INIT("init", "500"),
|
||||
REFUND("Refund","60"),
|
||||
// BUY_CREDITS("Buy Credits","10"),
|
||||
|
||||
DAILY_CHECKIN("Daily Check-In", "20"),
|
||||
// 每月更新
|
||||
INIT_YEARLY("init_yearly", "6000"),
|
||||
INIT_MONTHLY("init_monthly", "5000"),
|
||||
INIT_TRIAL("init_trial", "100"),
|
||||
INIT_WEEKLY("init_weekly","6000"),
|
||||
|
||||
SOCIAL_MEDIA_SHARING("Social Media Sharing","20"),
|
||||
// SUPER_RESOLUTION("Super Resolution","30"),
|
||||
SUPER_RESOLUTION("Super Resolution","10"),
|
||||
SLOGAN("Slogan","10"),
|
||||
LOGO("Logo","5"),
|
||||
PATTERN("Pattern","5"),
|
||||
MOOD_BOARD("MoodBoard","5"),
|
||||
SKETCH_BOARD("SketchBoard","5"),
|
||||
TO_PRODUCT_IMAGE("ToProductImage","5"),
|
||||
RELIGHT("Relight","5"),
|
||||
QUESTIONNAIRE("Questionnaire","100"),
|
||||
|
||||
// SUPER_RESOLUTION("Super Resolution","300"),
|
||||
SUPER_RESOLUTION("Super Resolution","5"),
|
||||
|
||||
OTHER("Other","10");
|
||||
OTHER("Other","5");
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ public enum LibraryLevel1TypeEnum {
|
||||
/**
|
||||
* 模特
|
||||
*/
|
||||
MODELS("Models");
|
||||
MODELS("Models"),
|
||||
DESIGN_ELEMENTS("DesignElements");
|
||||
|
||||
private String realName;
|
||||
|
||||
|
||||
@@ -19,7 +19,17 @@ public enum PayTypeEnum {
|
||||
/**
|
||||
* PayPal
|
||||
*/
|
||||
PAYPAL("PayPal");
|
||||
PAYPAL("PayPal"),
|
||||
|
||||
/**
|
||||
* 香港支付宝
|
||||
*/
|
||||
ALIPAY_HK("Alipay-HK"),
|
||||
|
||||
/**
|
||||
* Stripe
|
||||
*/
|
||||
STRIPE("Stripe");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
|
||||
@@ -48,15 +48,16 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
"/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/chatStream",
|
||||
"/api/python/flush","/api/account/healthy","/api/ali-pay/trade/notify","/api/paypal/ipn/back"
|
||||
"/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)) {
|
||||
if (calculateUrl(requestURI) || hasAuthorizationToken(httpServletRequest)) {
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
HttpServletRequest wrappedRequest = httpServletRequest;
|
||||
HttpServletResponse wrappedResponse = httpServletResponse;
|
||||
@@ -87,9 +88,14 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
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);
|
||||
// log.debug("后台检查令牌:{}", jwtToken);
|
||||
|
||||
if (StrUtil.isBlank(jwtToken)) {
|
||||
String ipAddress = RequestInfoUtil.getIpAddress(request);
|
||||
|
||||
31
src/main/java/com/ai/da/common/task/AccountTask.java
Normal file
31
src/main/java/com/ai/da/common/task/AccountTask.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.ai.da.common.task;
|
||||
|
||||
import com.ai.da.service.AccountService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AccountTask {
|
||||
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
|
||||
/** 每周日晚上刷新 年付用户、月付用户的积分 */
|
||||
@Scheduled(cron = "59 59 23 ? * SUN")
|
||||
// @Scheduled(cron = "59 59 23 * * ?")
|
||||
public void refreshCreditsMonthly(){
|
||||
log.info("每周日晚11:59:59刷新付费用户积分为 6000");
|
||||
accountService.refreshCreditsWeekly();
|
||||
}
|
||||
|
||||
// todo 多久执行一次?
|
||||
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
||||
public void getPaidUser(){
|
||||
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
|
||||
accountService.extendValidityForCC();
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class AliPayTask {
|
||||
// @Scheduled(cron = "0/30 * * * * ?")
|
||||
public void orderConfirm(){
|
||||
|
||||
log.info("Alipay orderConfirm 被执行......");
|
||||
// log.info("Alipay orderConfirm 被执行......");
|
||||
|
||||
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(5, PayTypeEnum.ALIPAY.getType());
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
|
||||
@Slf4j
|
||||
public class GenerateTask {
|
||||
|
||||
@Scheduled(cron = "0 0 */1 * * ?")
|
||||
// @Scheduled(cron = "0 0 */1 * * ?")
|
||||
public void generateScheduled(){
|
||||
log.info("测试定时器:generate");
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ public class PaypalTask {
|
||||
@Scheduled(cron = "0/30 * * * * ?")
|
||||
public void orderConfirm() throws SerializeException {
|
||||
|
||||
log.info("PayPal orderConfirm 被执行......");
|
||||
// log.info("PayPal orderConfirm 被执行......");
|
||||
|
||||
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(5, PayTypeEnum.PAYPAL.getType());
|
||||
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(30, PayTypeEnum.PAYPAL.getType());
|
||||
|
||||
for (OrderInfo orderInfo : orderInfoList) {
|
||||
String orderNo = orderInfo.getOrderNo();
|
||||
|
||||
40
src/main/java/com/ai/da/common/task/StripeTask.java
Normal file
40
src/main/java/com/ai/da/common/task/StripeTask.java
Normal file
@@ -0,0 +1,40 @@
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,23 @@
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import cn.hutool.core.io.resource.ClassPathResource;
|
||||
import com.ai.da.model.dto.AlipayHKParametersDTO;
|
||||
import com.ai.da.model.dto.AlipayHKRequestDTO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
|
||||
import org.bouncycastle.crypto.digests.SHA256Digest;
|
||||
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
|
||||
import org.bouncycastle.crypto.signers.RSADigestSigner;
|
||||
import org.bouncycastle.crypto.util.PublicKeyFactory;
|
||||
import org.bouncycastle.openssl.PEMParser;
|
||||
import org.bouncycastle.util.io.pem.PemObject;
|
||||
import org.bouncycastle.util.io.pem.PemReader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
@@ -25,22 +34,27 @@ import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AlipayHKEncryptionUtil {
|
||||
|
||||
@Value("${alipay.hk.merchant-id}")
|
||||
private static String merchantId;
|
||||
@Value("${alipayHK.merchantId}")
|
||||
private String merchantId;
|
||||
|
||||
@Value("${alipay.hk.segment-id}")
|
||||
private static String segmentId;
|
||||
@Value("${alipayHK.segmentId}")
|
||||
private String segmentId;
|
||||
|
||||
@Value("${alipay.hk.AESKey}")
|
||||
private static String aesKey;
|
||||
@Value("${alipayHK.AESKey}")
|
||||
private String aesKey;
|
||||
|
||||
@Value("${alipay.hk.rsaPrivateKey}")
|
||||
private static String privateKeyPath;
|
||||
@Value("${alipayHK.rsaPrivateKey}")
|
||||
private String privateKeyPath;
|
||||
|
||||
@Value("${alipayHK.rsaPublicKey}")
|
||||
private String publicKeyPath;
|
||||
|
||||
@Value("${alipayHK.CODPublicKey}")
|
||||
private String CODPublicKeyPath;
|
||||
|
||||
@Value("${alipay.hk.rsaPublicKey}")
|
||||
private static String publicKeyPath;
|
||||
|
||||
/**
|
||||
* 加密
|
||||
@@ -55,13 +69,14 @@ public class AlipayHKEncryptionUtil {
|
||||
* @throws BadPaddingException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static AlipayHKRequestDTO AESCBCWithRSA(HashMap<String, Object> param, String serviceName) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, IOException {
|
||||
public AlipayHKRequestDTO AESCBCWithRSA(HashMap<String, Object> param, String serviceName) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, IOException {
|
||||
// Pre-shared secret key, DO NOT hardcode this key
|
||||
String key = aesKey;
|
||||
// The path to the rsa private key file, DO NOT save this key to a publicly accessible location
|
||||
// 使用私钥创建数字签名
|
||||
// Mode, aes-128-cbc for 128bit key
|
||||
String mode = "aes-128-cbc";
|
||||
// String mode = "aes-128-cbc";
|
||||
String mode = "aes-256-cbc";
|
||||
// Padding mode
|
||||
String padding = "pkcs7";
|
||||
// signature alogrithm
|
||||
@@ -75,18 +90,11 @@ public class AlipayHKEncryptionUtil {
|
||||
requestMessage.setRequest_uuid(UUID.randomUUID().toString());
|
||||
// HashMap<String, Object> param = new HashMap<>();
|
||||
requestMessage.setParameters(param);
|
||||
/*String orderRef = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
param.put("order_ref", orderRef);
|
||||
param.put("amount", 208.12);
|
||||
param.put("subject", "四月帳單 April Bill");
|
||||
param.put("wallet", "ALIPAYHK");
|
||||
param.put("segment_id", segmentId);
|
||||
param.put("payment_solution", "WAP");*/
|
||||
|
||||
|
||||
// Serialize message body
|
||||
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
||||
String content = gson.toJson(requestMessage);
|
||||
log.info("alipay-hk request 加密前:{}", content);
|
||||
|
||||
// Secure random iv 获取随机种子
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
@@ -144,7 +152,7 @@ public class AlipayHKEncryptionUtil {
|
||||
|
||||
// Encode to json
|
||||
String jsonEncoded = JSONObject.toJSONString(alipayHKRequestDTO);
|
||||
log.info(jsonEncoded);
|
||||
log.info("alipay-hk request 加密加签后:{}",jsonEncoded);
|
||||
|
||||
// String info = AlipayHKRequestUtil.createOrder(alipayHKRequestDTO);
|
||||
// log.info(info);
|
||||
@@ -159,7 +167,23 @@ public class AlipayHKEncryptionUtil {
|
||||
* @throws Exception
|
||||
*/
|
||||
private static PrivateKey readPrivateKeyFromFile(String filePath) throws Exception {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(filePath));
|
||||
ClassPathResource classPathResource = new ClassPathResource(filePath);
|
||||
InputStream inputstream = classPathResource.getStream();
|
||||
String privateKeyContent = getString(inputstream);
|
||||
|
||||
// 进行 Base64 解码
|
||||
byte[] privateKeyBytes = Base64.getDecoder().decode(privateKeyContent);
|
||||
|
||||
// 根据 PKCS8 格式的私钥字节数组构造私钥对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
|
||||
return keyFactory.generatePrivate(keySpec);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getString(InputStream inputstream) throws IOException {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream));
|
||||
// BufferedReader reader = new BufferedReader(new FileReader(filePath));
|
||||
StringBuilder keyBuffer = new StringBuilder();
|
||||
String line;
|
||||
|
||||
@@ -174,20 +198,13 @@ public class AlipayHKEncryptionUtil {
|
||||
.replace("-----BEGIN PRIVATE KEY-----", "")
|
||||
.replace("-----END PRIVATE KEY-----", "")
|
||||
.replaceAll("\\s+", ""); // 去除空格、换行等字符
|
||||
|
||||
// 进行 Base64 解码
|
||||
byte[] privateKeyBytes = Base64.getDecoder().decode(privateKeyContent);
|
||||
|
||||
// 根据 PKCS8 格式的私钥字节数组构造私钥对象
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
|
||||
return keyFactory.generatePrivate(keySpec);
|
||||
return privateKeyContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用 AES 密钥和随机向量进行解密
|
||||
*/
|
||||
public static String decryptAES(String encryptedText, String iv) throws Exception {
|
||||
public String decryptAES(String encryptedText, String iv) throws Exception {
|
||||
byte[] encryptedBytes = Base64.getDecoder().decode(encryptedText);
|
||||
byte[] ivBytes = Base64.getDecoder().decode(iv);
|
||||
|
||||
@@ -201,7 +218,7 @@ public class AlipayHKEncryptionUtil {
|
||||
return new String(decryptedBytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static void test() throws Exception {
|
||||
public void test() throws Exception {
|
||||
// 加密数据
|
||||
AlipayHKParametersDTO requestMessage = new AlipayHKParametersDTO();
|
||||
requestMessage.setService("create_order");
|
||||
@@ -227,7 +244,7 @@ public class AlipayHKEncryptionUtil {
|
||||
|
||||
// 使用 RSA 公钥加密 AES 密钥
|
||||
String rsaPublicKeyPath = publicKeyPath;
|
||||
PublicKey publicKey = readPublicKey(new File(rsaPublicKeyPath));
|
||||
PublicKey publicKey = readPublicKey(rsaPublicKeyPath);
|
||||
|
||||
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
|
||||
// Cipher rsaCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
@@ -307,11 +324,14 @@ public class AlipayHKEncryptionUtil {
|
||||
System.out.println("数字签名验证结果:" + signatureValid);
|
||||
}
|
||||
|
||||
public static PublicKey readPublicKey(File file) throws Exception {
|
||||
// public static PublicKey readPublicKey(File file) throws Exception {
|
||||
public static PublicKey readPublicKey(String fileName) throws Exception {
|
||||
KeyFactory factory = KeyFactory.getInstance("RSA");
|
||||
|
||||
try (FileReader keyReader = new FileReader(file);
|
||||
PemReader pemReader = new PemReader(keyReader)) {
|
||||
ClassPathResource classPathResource = new ClassPathResource(fileName);
|
||||
InputStream inputStream = classPathResource.getStream();
|
||||
BufferedReader fileReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
try (PemReader pemReader = new PemReader(fileReader)) {
|
||||
|
||||
PemObject pemObject = pemReader.readPemObject();
|
||||
byte[] content = pemObject.getContent();
|
||||
@@ -326,4 +346,38 @@ public class AlipayHKEncryptionUtil {
|
||||
random.nextBytes(iv);
|
||||
return iv;
|
||||
}
|
||||
|
||||
public Boolean signatureVerification(String data, String signatureBase64){
|
||||
|
||||
Base64.Decoder decoder = Base64.getDecoder();
|
||||
// Verify key
|
||||
try {
|
||||
ClassPathResource classPathResource = new ClassPathResource(CODPublicKeyPath);
|
||||
InputStream inputstream = classPathResource.getStream();
|
||||
// 从指定的路径读取公钥文件
|
||||
InputStreamReader isrPub = new InputStreamReader(inputstream);
|
||||
PEMParser pemParserPub = new PEMParser(isrPub);
|
||||
// 使用 PEMParser 解析公钥文件
|
||||
SubjectPublicKeyInfo pubInfo = (SubjectPublicKeyInfo) pemParserPub.readObject();
|
||||
// 从 SubjectPublicKeyInfo 创建 AsymmetricKeyParameter 对象
|
||||
AsymmetricKeyParameter pubKey = PublicKeyFactory.createKey(pubInfo);
|
||||
// Verifying; 创建 RSADigestSigner 对象并使用 SHA-256 作为摘要算法
|
||||
RSADigestSigner verifier = new RSADigestSigner(new SHA256Digest());
|
||||
// 初始化 RSADigestSigner,设置为验证模式并提供公钥参数
|
||||
verifier.init(false, pubKey);
|
||||
// 将要验证的数据转换为字节数组
|
||||
byte[] signMessageForVerifying = data.getBytes();
|
||||
// 将 Base64 编码的签名转换为字节数组
|
||||
byte[] signatureBase64ForVerifying = decoder.decode(signatureBase64);
|
||||
// 使用签名器更新要验证的数据
|
||||
verifier.update(signMessageForVerifying, 0, signMessageForVerifying.length);
|
||||
// 验证签名并返回结果
|
||||
Boolean verifyResult = verifier.verifySignature(signatureBase64ForVerifying);
|
||||
return verifyResult;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,11 +11,13 @@ import java.time.Instant;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AlipayHKRequestUtil {
|
||||
|
||||
public static String createOrder(AlipayHKRequestDTO alipayHKRequestDTO) throws IOException {
|
||||
public String requestAlipayHK(AlipayHKRequestDTO alipayHKRequestDTO) {
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
|
||||
@@ -27,27 +29,34 @@ public class AlipayHKRequestUtil {
|
||||
log.info("Alipay-HK send request unix timestamp: {}", epochMilli);
|
||||
|
||||
String jsonString = JSONObject.toJSONString(alipayHKRequestDTO, SerializerFeature.WriteMapNullValue);
|
||||
log.info(jsonString);
|
||||
// log.info(jsonString);
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType, jsonString);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
// .url("https://aqs-api.sandbox-codpayment.com")
|
||||
.url("https://aqs-api.sandbox-codpayment.com/v1/service")
|
||||
// .url("https://aqs-api.sandbox-codpayment.com/v1/service")
|
||||
.url("https://aqs-api.codpayment.com/v1/service")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json;charset=utf-8")
|
||||
.build();
|
||||
Response response = null;
|
||||
Response response;
|
||||
String bodyString;
|
||||
try {
|
||||
// log.info("generateSketchOrPrint请求入参content###{}", JSON.toJSONString(alipayHKRequestDTO, SerializerFeature.WriteMapNullValue));
|
||||
response = client.newCall(request).execute();
|
||||
assert response.body() != null;
|
||||
bodyString = response.body().string();
|
||||
} catch (Exception e) {
|
||||
// log.error("PythonService##generateSketchOrPrint异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||
// throw new BusinessException("generate.interface.error");
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
return response.body().string();
|
||||
JSONObject jsonObject = JSONObject.parseObject(bodyString);
|
||||
boolean success = (boolean) jsonObject.get("success");
|
||||
if (success){
|
||||
return bodyString;
|
||||
} else {
|
||||
String message = jsonObject.get("error_code").toString() + ":" + jsonObject.get("error");
|
||||
log.error("Alipay return message : {}", message);
|
||||
throw new BusinessException("Alipay return message : " + message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
33
src/main/java/com/ai/da/common/utils/ExcelReader.java
Normal file
33
src/main/java/com/ai/da/common/utils/ExcelReader.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import lombok.Data;
|
||||
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 java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ExcelReader {
|
||||
public static List<List<String>> readExcel(String filePath) throws IOException {
|
||||
List<List<String>> data = new ArrayList<>();
|
||||
try (FileInputStream fis = new FileInputStream(filePath);
|
||||
Workbook workbook = new XSSFWorkbook(fis)) {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
int numberOfColumns = sheet.getRow(0).getLastCellNum();
|
||||
|
||||
for (int i = 0; i < numberOfColumns; i++) {
|
||||
List<String> columnData = new ArrayList<>();
|
||||
for (Row row : sheet) {
|
||||
columnData.add(row.getCell(i).getStringCellValue());
|
||||
}
|
||||
data.add(columnData);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ 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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -16,6 +18,7 @@ import java.io.*;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -25,6 +28,7 @@ import java.util.stream.Collectors;
|
||||
* @description: minio工具类
|
||||
* @version:3.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MinioUtil {
|
||||
@Autowired
|
||||
@@ -126,6 +130,26 @@ public class MinioUtil {
|
||||
return names;
|
||||
}
|
||||
|
||||
public String uploadImageFromBase64(String bucketName, String base64Image, String imageType) {
|
||||
byte[] imageBytes = Base64.getDecoder().decode(base64Image);
|
||||
String fileName = UUID.randomUUID().toString() + "." + imageType; // or any other image format
|
||||
|
||||
try (InputStream in = new ByteArrayInputStream(imageBytes)) {
|
||||
minioClient.putObject(PutObjectArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.object(fileName)
|
||||
.stream(in, in.available(), -1)
|
||||
.contentType("image/png") // Set the content type according to your image format
|
||||
.build()
|
||||
);
|
||||
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null; // or throw an exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* description: 上传文件
|
||||
*
|
||||
@@ -349,7 +373,7 @@ public class MinioUtil {
|
||||
* @param expiry 过期时间(单位:分)
|
||||
* @return 文件的临时URL,如果出现异常则返回null
|
||||
*/
|
||||
public String getPresignedUrl(String bucketName, String fileName, int expiry) {
|
||||
public String getPreSignedUrl(String bucketName, String fileName, int expiry) {
|
||||
try {
|
||||
return minioClient.getPresignedObjectUrl(
|
||||
GetPresignedObjectUrlArgs.builder()
|
||||
@@ -365,7 +389,7 @@ public class MinioUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public String getPresignedUrl(String path, int expiry) {
|
||||
public String getPreSignedUrl(String path, int expiry) {
|
||||
if (LocalCacheUtils.getPresignedUrlCache(path) != null) {
|
||||
return LocalCacheUtils.getPresignedUrlCache(path);
|
||||
} else {
|
||||
@@ -375,12 +399,28 @@ public class MinioUtil {
|
||||
int index = path.indexOf("/");
|
||||
String bucketName = path.substring(0, index);
|
||||
String fileName = path.substring(index + 1);
|
||||
String presignedUrl = getPresignedUrl(bucketName, fileName, expiry);
|
||||
String presignedUrl = getPreSignedUrl(bucketName, fileName, expiry);
|
||||
LocalCacheUtils.setPresignedUrlCache(path, presignedUrl);
|
||||
return presignedUrl;
|
||||
}
|
||||
}
|
||||
|
||||
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 = getPreSignedUrl(bucketName, fileName, expiry);
|
||||
LocalCacheUtils.setPresignedUrlCache(path, presignedUrl);
|
||||
return presignedUrl;
|
||||
} else {
|
||||
return LocalCacheUtils.getPresignedUrlCache(path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将桶名、文件名从url中分离出来
|
||||
*
|
||||
@@ -398,7 +438,7 @@ public class MinioUtil {
|
||||
fileName.append("/");
|
||||
}
|
||||
}
|
||||
return getPresignedUrl(bucketName, String.valueOf(fileName), expiry);
|
||||
return getPreSignedUrl(bucketName, String.valueOf(fileName), expiry);
|
||||
}
|
||||
|
||||
public boolean doesObjectExist(String bucketName, String objectName) {
|
||||
@@ -415,6 +455,35 @@ public class MinioUtil {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String base64UploadToPath(String base64, String bucketName, String path){
|
||||
String[] parts = base64.split(",");
|
||||
String imageType = parts[0].split("/")[1].split(";")[0];
|
||||
String base64Data = parts[1];
|
||||
|
||||
byte[] imageBytes = Base64.getDecoder().decode(base64Data);
|
||||
String fileName;
|
||||
if (!StringUtil.isNullOrEmpty(path)){
|
||||
fileName = path + "." + imageType; // or any other image format
|
||||
}else {
|
||||
fileName = UUID.randomUUID() + "." + imageType;
|
||||
}
|
||||
|
||||
try (InputStream in = new ByteArrayInputStream(imageBytes)) {
|
||||
minioClient.putObject(PutObjectArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.object(fileName)
|
||||
.stream(in, in.available(), -1)
|
||||
.contentType("image/" + imageType) // Set the content type according to your image format
|
||||
.build()
|
||||
);
|
||||
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return null; // or throw an exception
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@ 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
|
||||
@@ -164,4 +166,54 @@ public class RedisUtil {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
364
src/main/java/com/ai/da/common/utils/S3Util.java
Normal file
364
src/main/java/com/ai/da/common/utils/S3Util.java
Normal file
@@ -0,0 +1,364 @@
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.constant.CommonConstant;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
||||
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
|
||||
import software.amazon.awssdk.core.ResponseBytes;
|
||||
import software.amazon.awssdk.core.sync.RequestBody;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.s3.S3Client;
|
||||
import software.amazon.awssdk.services.s3.S3Configuration;
|
||||
import software.amazon.awssdk.services.s3.model.*;
|
||||
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 java.io.*;
|
||||
import java.time.Duration;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class S3Util {
|
||||
|
||||
@Value("${aws.s3.accessKeyId}")
|
||||
private String accessKeyId;
|
||||
|
||||
@Value("${aws.s3.secretKey}")
|
||||
private String secretKey;
|
||||
|
||||
@Value("${aws.s3.regionName}")
|
||||
private String region;
|
||||
|
||||
public static String S3_ACCESS_KEY_ID = null;
|
||||
|
||||
public static String S3_SECRET_KEY = null;
|
||||
|
||||
public static String S3_REGION = null;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
S3_ACCESS_KEY_ID = accessKeyId;
|
||||
S3_SECRET_KEY = secretKey;
|
||||
S3_REGION = region;
|
||||
}
|
||||
|
||||
private static S3Client s3Client;
|
||||
|
||||
private static S3Presigner s3Presigner;
|
||||
|
||||
/**
|
||||
* @return software.amazon.awssdk.services.s3.S3Client
|
||||
* @description: 获取S3客户端对象
|
||||
*/
|
||||
public synchronized S3Client getS3Client() {
|
||||
if (null == s3Client) {
|
||||
s3Client = S3Client.builder()
|
||||
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(S3_ACCESS_KEY_ID, S3_SECRET_KEY)))
|
||||
// .endpointOverride(URI.create(S3_URI))
|
||||
.serviceConfiguration(item -> item.pathStyleAccessEnabled(true).checksumValidationEnabled(false))
|
||||
.region(Region.of(S3_REGION))
|
||||
.build();
|
||||
}
|
||||
|
||||
return s3Client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return software.amazon.awssdk.services.s3.presigner.S3Presigner
|
||||
* @description: 获取预签名对象
|
||||
*/
|
||||
public synchronized S3Presigner getS3PreSigner() {
|
||||
if (null == s3Presigner) {
|
||||
s3Presigner = S3Presigner.builder()
|
||||
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(S3_ACCESS_KEY_ID, S3_SECRET_KEY)))
|
||||
// .endpointOverride(URI.create(S3_URI))
|
||||
.serviceConfiguration(S3Configuration.builder()
|
||||
.checksumValidationEnabled(false)
|
||||
.pathStyleAccessEnabled(true)
|
||||
.build())
|
||||
.region(Region.of(S3_REGION))
|
||||
.build();
|
||||
}
|
||||
return s3Presigner;
|
||||
}
|
||||
|
||||
public String uploadImageFromBase64(String bucketName, String base64Image, String imageType) {
|
||||
S3Client s3Client = getS3Client();
|
||||
byte[] imageBytes = Base64.getDecoder().decode(base64Image);
|
||||
String fileName = UUID.randomUUID() + "." + imageType; // or any other image format
|
||||
|
||||
try (InputStream in = new ByteArrayInputStream(imageBytes)) {
|
||||
PutObjectRequest putObjectRequest = PutObjectRequest.builder()
|
||||
.bucket(bucketName)
|
||||
.contentType("image/png")
|
||||
.contentLength((long) in.available())
|
||||
.key(fileName)
|
||||
.acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.build();
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(in, in.available()));
|
||||
|
||||
log.info("uploadImageFromBase64 上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null; // or throw an exception
|
||||
}
|
||||
}
|
||||
|
||||
public String upload(String bucketName, String path, MultipartFile file) {
|
||||
S3Client s3Client = getS3Client();
|
||||
try {
|
||||
String fileName = file.getOriginalFilename();
|
||||
assert fileName != null;
|
||||
String[] split = fileName.split("\\.");
|
||||
if (split.length > 1) {
|
||||
fileName = path + "/" + UUID.randomUUID() + "." + split[split.length - 1];
|
||||
} else {
|
||||
fileName = path + "/" + UUID.randomUUID();
|
||||
}
|
||||
PutObjectRequest putObjectRequest = PutObjectRequest.builder()
|
||||
.bucket(bucketName)
|
||||
.contentType(file.getContentType())
|
||||
.contentLength(file.getSize())
|
||||
.key(fileName)
|
||||
.acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.build();
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(file.getInputStream(), file.getSize()));
|
||||
|
||||
log.info("upload 上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件到S3失败 异常:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// todo
|
||||
public String upload(String bucketName, String path, MultipartFile file, String copy) {
|
||||
S3Client s3Client = getS3Client();
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = file.getInputStream();
|
||||
|
||||
PutObjectRequest putObjectRequest = PutObjectRequest.builder()
|
||||
.bucket(bucketName)
|
||||
.contentType(file.getContentType())
|
||||
.contentLength(file.getSize())
|
||||
.key(path)
|
||||
.acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.build();
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(file.getInputStream(), file.getSize()));
|
||||
log.info("upload-copy 上传的位置:桶 - {},路径 - {}", bucketName, path);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return bucketName + "/" + path;
|
||||
}
|
||||
|
||||
public InputStream download(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 download(bucketName, objectName);
|
||||
}
|
||||
|
||||
public InputStream download(String bucketName, String objectName) {
|
||||
try {
|
||||
S3Client s3Client = getS3Client();
|
||||
GetObjectRequest objectRequest = GetObjectRequest
|
||||
.builder()
|
||||
.key(objectName)
|
||||
.bucket(bucketName)
|
||||
.build();
|
||||
|
||||
// ResponseBytes<GetObjectResponse> objectBytes = s3.getObjectAsBytes(objectRequest);
|
||||
ResponseBytes<GetObjectResponse> objectAsBytes = s3Client.getObjectAsBytes(objectRequest);
|
||||
byte[] data = objectAsBytes.asByteArray();
|
||||
log.info("download 下载图片位置:桶 - {},路径 - {}", bucketName, objectName);
|
||||
return new ByteArrayInputStream(data);
|
||||
|
||||
/*// Write the data to a local file.
|
||||
File myFile = new File("files/images.png");
|
||||
OutputStream os = new FileOutputStream(myFile);
|
||||
os.write(data);
|
||||
System.out.println("Successfully obtained bytes from an S3 object");
|
||||
os.close();
|
||||
return null;*/
|
||||
// return minioClient.getObject(GetObjectArgs.builder().bucket(bucketName).object(objectName).build());
|
||||
} catch (Exception e) {
|
||||
log.error("");
|
||||
throw new BusinessException("");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteObject(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);
|
||||
deleteObject(bucketName, objectName);
|
||||
}
|
||||
|
||||
public void deleteObject(String bucketName, String objectName) {
|
||||
try {
|
||||
S3Client s3Client = getS3Client();
|
||||
DeleteObjectRequest deleteObjectRequest = DeleteObjectRequest
|
||||
.builder()
|
||||
.key(objectName)
|
||||
.bucket(bucketName)
|
||||
.build();
|
||||
s3Client.deleteObject(deleteObjectRequest);
|
||||
log.info("Object " + objectName + " successfully removed from bucket " + bucketName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info("Error while removing object " + objectName + " from bucket " + bucketName + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String getPreSignedUrl(String path, int expiry) {
|
||||
if (LocalCacheUtils.getPresignedUrlCache(path) != null) {
|
||||
return LocalCacheUtils.getPresignedUrlCache(path);
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keyName key名称: test/2022/06/123.pdf
|
||||
* @param signatureDurationTime 有效期 单位:秒
|
||||
* @return java.lang.String
|
||||
* @description: 生成预签名URL
|
||||
*/
|
||||
public String getPreSignatureUrl(String bucket, String keyName, Integer signatureDurationTime) {
|
||||
String preSignatureUrl = "";
|
||||
try {
|
||||
S3Presigner s3PreSigner = getS3PreSigner();
|
||||
S3Client s3Client = getS3Client();
|
||||
setObjectAcl(s3Client, bucket, keyName, ObjectCannedACL.PUBLIC_READ);
|
||||
|
||||
GetObjectRequest getObjectRequest = GetObjectRequest.builder()
|
||||
.bucket(bucket)
|
||||
.key(keyName)
|
||||
.build();
|
||||
|
||||
//设置预签名URL可访问时间
|
||||
signatureDurationTime = Optional.ofNullable(signatureDurationTime)
|
||||
.map(item -> {
|
||||
if (item.intValue() > CommonConstant.Numbers.NUMBER_10080) {
|
||||
item = CommonConstant.Numbers.NUMBER_10080;
|
||||
}
|
||||
return item;
|
||||
})
|
||||
.orElse(CommonConstant.Numbers.NUMBER_10);
|
||||
GetObjectPresignRequest getObjectPresignRequest = GetObjectPresignRequest.builder()
|
||||
.signatureDuration(Duration.ofMinutes(signatureDurationTime))
|
||||
.getObjectRequest(getObjectRequest)
|
||||
.build();
|
||||
|
||||
PresignedGetObjectRequest presignedGetObjectRequest =
|
||||
s3PreSigner.presignGetObject(getObjectPresignRequest);
|
||||
|
||||
preSignatureUrl = String.valueOf(presignedGetObjectRequest.url());
|
||||
} catch (Exception e) {
|
||||
log.error("生成预签名URL失败,异常:{}", e.getMessage());
|
||||
}
|
||||
return preSignatureUrl;
|
||||
}
|
||||
|
||||
public static void setObjectAcl(S3Client s3, String bucketName, String keyName, ObjectCannedACL acl) {
|
||||
PutObjectAclRequest aclRequest = PutObjectAclRequest.builder()
|
||||
.bucket(bucketName)
|
||||
.key(keyName)
|
||||
.acl(acl)
|
||||
.build();
|
||||
s3.putObjectAcl(aclRequest);
|
||||
}
|
||||
public boolean doesObjectExist(String bucketName, String objectName) {
|
||||
try {
|
||||
S3Client s3Client = getS3Client();
|
||||
HeadObjectRequest headObjectRequest = HeadObjectRequest.builder()
|
||||
.bucket(bucketName)
|
||||
.key(objectName)
|
||||
.build();
|
||||
HeadObjectResponse headObjectResponse = s3Client.headObject(headObjectRequest);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.info("指定文件 {}/{} 不存在", bucketName, objectName);
|
||||
// 如果发生异常,说明文件不存在或者出现了其他错误
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String base64UploadToPath(String base64, String bucketName, String path) {
|
||||
S3Client s3Client = getS3Client();
|
||||
String[] parts = base64.split(",");
|
||||
String imageType = parts[0].split("/")[1].split(";")[0];
|
||||
String base64Data = parts[1];
|
||||
|
||||
byte[] imageBytes = Base64.getDecoder().decode(base64Data);
|
||||
String fileName;
|
||||
if (!StringUtil.isNullOrEmpty(path)) {
|
||||
fileName = path + "." + imageType; // or any other image format
|
||||
} else {
|
||||
fileName = UUID.randomUUID() + "." + imageType;
|
||||
}
|
||||
|
||||
try (InputStream in = new ByteArrayInputStream(imageBytes)) {
|
||||
PutObjectRequest putObjectRequest = PutObjectRequest.builder()
|
||||
.bucket(bucketName)
|
||||
.contentType("image/" + imageType)
|
||||
.contentLength((long) in.available())
|
||||
.key(fileName)
|
||||
.acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.build();
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(in, in.available()));
|
||||
|
||||
log.info("base64UploadToPath 上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null; // or throw an exception
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<String> listAllBucket() {
|
||||
S3Client s3Client = getS3Client();
|
||||
ListBucketsResponse listBucketsResponse = s3Client.listBuckets();
|
||||
List<Bucket> buckets = listBucketsResponse.buckets();
|
||||
return buckets.stream().map(Bucket::name).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,6 +57,7 @@ public class SendEmailUtil {
|
||||
* 登入模板id
|
||||
*/
|
||||
public static Long LOGIN_TEMPLATE_ID = 58020L;
|
||||
public static Long PORTFOLIO_REGISTER_ID = 124847L;
|
||||
/**
|
||||
* 修改密码模板id
|
||||
*/
|
||||
@@ -134,7 +135,9 @@ public class SendEmailUtil {
|
||||
private final static Long NOTIFICATION_TEMPLATE_ID = 117216L;
|
||||
private final static Long NOTIFICATION_CHINESE_TEMPLATE_ID = 122229L;
|
||||
private final static Long TRIAL_ORDER_LIST_ID = 122273L;
|
||||
public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType, String country) {
|
||||
private final static Long NO_TRIAL_ORDER_LIST_ID = 122591L;
|
||||
|
||||
public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType, String country, boolean link) {
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
@@ -171,7 +174,7 @@ public class SendEmailUtil {
|
||||
}else {
|
||||
template.setTemplateID(NOTIFICATION_TEMPLATE_ID);
|
||||
}
|
||||
template.setTemplateData(buildNotificationData(trialOrder));
|
||||
template.setTemplateData(buildNotificationData(trialOrder, link));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -227,6 +230,40 @@ public class SendEmailUtil {
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void sendNoExcelEmail(String receiverAddress, String senderAddress) {
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
if (StringUtils.isEmpty(senderAddress)) {
|
||||
senderAddress = SEND_ADDRESS;
|
||||
}
|
||||
req.setFromEmailAddress(senderAddress);
|
||||
req.setDestination(new String[]{receiverAddress});
|
||||
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject = "";
|
||||
Template template = new Template();
|
||||
subject = "昨日试用订单数据";
|
||||
template.setTemplateID(NO_TRIAL_ORDER_LIST_ID);
|
||||
|
||||
req.setSubject(subject);
|
||||
req.setTemplate(template);
|
||||
// 发送邮件
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
private final static Long WILLBEEXPIRED_TEMPLATE_ID = 118178L;
|
||||
public static void sendWillBeExpiredEmail(Account account, String senderAddress) {
|
||||
try {
|
||||
@@ -309,7 +346,7 @@ public class SendEmailUtil {
|
||||
}
|
||||
|
||||
// 构建试用订单通过通知数据
|
||||
private static String buildNotificationData(TrialOrder trialOrder) {
|
||||
private static String buildNotificationData(TrialOrder trialOrder, boolean link) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// 设置试用订单通过通知相关数据
|
||||
jsonObject.put("title", trialOrder.getTitle());
|
||||
@@ -317,11 +354,19 @@ public class SendEmailUtil {
|
||||
jsonObject.put("givenName", trialOrder.getGivenName());
|
||||
jsonObject.put("userName", trialOrder.getUserName());
|
||||
jsonObject.put("email", trialOrder.getEmail());
|
||||
if (link) {
|
||||
jsonObject.put("days", 14);
|
||||
}else {
|
||||
jsonObject.put("days", 5);
|
||||
}
|
||||
return jsonObject.toJSONString();
|
||||
}
|
||||
|
||||
private final static Long UPGRADE_NOTIFICATION_ID = 118855L;
|
||||
public static void sendUpgradeNotification(Account account, String senderAddress) {
|
||||
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID = 118856L;
|
||||
private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 122898L;
|
||||
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE = 122899L;
|
||||
public static void sendUpgradeNotification(Account account, String senderAddress, Integer type) {
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
@@ -340,8 +385,20 @@ public class SendEmailUtil {
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject = "";
|
||||
Template template = new Template();
|
||||
subject = "Upcoming AiDA 3.0 Launch and Scheduled Maintenance";
|
||||
template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
||||
// if (type == 1) {
|
||||
// subject = "Upcoming System Upgrade for AiDA 3.0";
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
||||
// }else {
|
||||
// subject = "即将到来的AiDA 3.0系统升级";
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
|
||||
// }
|
||||
if (type == 1) {
|
||||
subject = "Successful System Upgrade and New Features in AiDA 3.0";
|
||||
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
|
||||
}else {
|
||||
subject = "系统升级成功和AiDA 3.0新功能";
|
||||
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
|
||||
}
|
||||
template.setTemplateData(buildAccountData(account));
|
||||
|
||||
req.setSubject(subject);
|
||||
@@ -394,7 +451,143 @@ public class SendEmailUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private final static Long QUESTIONNAIRE_FEEDBACK_EN_ID = 124151L;
|
||||
private final static Long QUESTIONNAIRE_FEEDBACK_CN_ID = 124156L;
|
||||
public static void questionnaireRelatedNotify(String userName, String email, String language){
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
req.setFromEmailAddress(CODE_CREATE_SEND_ADDRESS);
|
||||
req.setDestination(new String[]{email});
|
||||
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
Template template = new Template();
|
||||
String subject = "Thank You for Completing the AiDA System Survey";
|
||||
template.setTemplateID(QUESTIONNAIRE_FEEDBACK_EN_ID);
|
||||
if (language.equals("CN")) {
|
||||
subject = "感谢您完成AiDA系统问卷调查";
|
||||
template.setTemplateID(QUESTIONNAIRE_FEEDBACK_CN_ID);
|
||||
}
|
||||
|
||||
JSONObject parameter = new JSONObject();
|
||||
parameter.put("userName", userName);
|
||||
|
||||
template.setTemplateData(parameter.toJSONString());
|
||||
|
||||
req.setSubject(subject);
|
||||
req.setTemplate(template);
|
||||
|
||||
// 发送邮件
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final static Long NEW_USER_PAYMENT_NOTIFICATION_EN = 124889L;
|
||||
private final static Long NEW_USER_PAYMENT_NOTIFICATION_CN = 124888L;
|
||||
private final static Long RENEWAL_NOTIFICATION_FOR_OLD_USER_EN = 124892L;
|
||||
private final static Long RENEWAL_NOTIFICATION_FOR_OLD_USER_CN = 124891L;
|
||||
|
||||
public static void notificationForPaidUser(String receiverAddress, int emailType, String country, String userName, String date){
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
req.setFromEmailAddress(SEND_ADDRESS);
|
||||
req.setDestination(new String[]{receiverAddress});
|
||||
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject = "";
|
||||
Template template = new Template();
|
||||
JSONObject parameter = new JSONObject();
|
||||
switch (emailType) {
|
||||
// 新用户
|
||||
case 1:
|
||||
subject = "Welcome to AiDA!";
|
||||
if (country.equals("China")) {
|
||||
template.setTemplateID(NEW_USER_PAYMENT_NOTIFICATION_CN);
|
||||
}else {
|
||||
template.setTemplateID(NEW_USER_PAYMENT_NOTIFICATION_EN);
|
||||
}
|
||||
parameter.put("userName", userName);
|
||||
parameter.put("email", receiverAddress);
|
||||
break;
|
||||
// 续费用户
|
||||
case 2:
|
||||
subject = "Account renewal notification";
|
||||
if (country.equals("China")) {
|
||||
template.setTemplateID(RENEWAL_NOTIFICATION_FOR_OLD_USER_CN);
|
||||
}else {
|
||||
template.setTemplateID(RENEWAL_NOTIFICATION_FOR_OLD_USER_EN);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
parameter.put("userName", userName);
|
||||
parameter.put("date", date);
|
||||
template.setTemplateData(parameter.toJSONString());
|
||||
|
||||
req.setSubject(subject);
|
||||
req.setTemplate(template);
|
||||
|
||||
// 发送邮件
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Boolean designWorksRegister(String userEmail, String randomVerifyCode) {
|
||||
try {
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
|
||||
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
|
||||
req.setFromEmailAddress(SEND_ADDRESS);
|
||||
req.setDestination(new String[]{userEmail});
|
||||
String subject = "Tourist registration";
|
||||
req.setSubject(subject);
|
||||
|
||||
req.setTemplate(contractTemplate(PORTFOLIO_REGISTER_ID, randomVerifyCode, null));
|
||||
|
||||
// 返回的resp是一个SendEmailResponse的实例,与请求对象对应
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
// 输出json格式的字符串回包
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
return Boolean.TRUE;
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,4 +153,28 @@ public class AccountController {
|
||||
accountService.upgradeNotification();
|
||||
return Response.success(true);
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "广场用户注册")
|
||||
@PostMapping("/designWorksRegister")
|
||||
public Response<Boolean> designWorksRegister(@Valid @RequestBody AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
|
||||
return Response.success(accountService.designWorksRegister(accountDesignWorksRegisterDTO));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "广场用户注册")
|
||||
@PostMapping("/designWorksRegisterCode")
|
||||
public Response<AccountLoginVO> designWorksRegisterCode(@Valid @RequestBody AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
|
||||
return Response.success(accountService.designWorksRegisterCode(accountDesignWorksRegisterDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 填写调查问卷
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "填写调查问卷")
|
||||
@PostMapping("/questionnaire")
|
||||
public Response<Boolean> questionnaire(@Valid @RequestBody String questionnaireInfo){
|
||||
return Response.success(accountService.collectQuestionnaires(questionnaireInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,45 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.service.AlipayHKService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/ali-pay-hk")
|
||||
@RequestMapping("/api/alipay-hk")
|
||||
@Api(tags = "网站支付 香港支付宝")
|
||||
@Slf4j
|
||||
public class AlipayHKController {
|
||||
|
||||
public Response<String> createOrder(){
|
||||
return Response.success();
|
||||
@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);
|
||||
return Response.success(order);
|
||||
}
|
||||
|
||||
@ApiOperation("支付通知")
|
||||
@PostMapping("/trade/notify")
|
||||
public String callback(@RequestBody String paramString){
|
||||
log.info("alipay-hk callback parameter : {}", paramString);
|
||||
return alipayHKService.callback(paramString);
|
||||
}
|
||||
|
||||
@ApiOperation("订单查询")
|
||||
@PostMapping("/trade/query/{orderRef}")
|
||||
public Response<String> queryOrder(@PathVariable String orderRef){
|
||||
String s = alipayHKService.queryDetail(orderRef);
|
||||
return Response.success(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ public class GenerateController {
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
|
||||
@ApiOperation("自动识别sketch的caption 暂时未上")
|
||||
/*@ApiOperation("自动识别sketch的caption 暂时未上")
|
||||
@PostMapping("/caption")
|
||||
public Response<GenerateCaptionVO> generateCaption(@RequestParam Long sketchElementId) {
|
||||
return Response.success(generateService.generateCaption(sketchElementId));
|
||||
}
|
||||
}*/
|
||||
|
||||
/*@ApiOperation("通过文字、图片生成图片")
|
||||
@PostMapping("/sketchAndPrint")
|
||||
@@ -63,8 +63,9 @@ public class GenerateController {
|
||||
@GetMapping("/stopWaiting")
|
||||
public Response<String> stopWaiting(@RequestParam("userId") Long userId,
|
||||
@RequestParam("uniqueId") List<String> uniqueId,
|
||||
@RequestParam("timeZone") String timeZone) {
|
||||
generateService.cancelGenerate(userId, uniqueId, timeZone);
|
||||
@RequestParam("timeZone") String timeZone,
|
||||
@RequestParam("type") String type) {
|
||||
generateService.cancelGenerate(userId, uniqueId, timeZone, type);
|
||||
return Response.success("stop waiting successfully");
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ public class LibraryController {
|
||||
Response<String> response = new Response();
|
||||
log.info("Models打点预览入参####{}", JSON.toJSONString(modelsDotDTO));
|
||||
String url = libraryModelPointService.modelsDot(modelsDotDTO);
|
||||
response.setData(minioUtil.getPresignedUrl(url, 24 * 60));
|
||||
response.setData(minioUtil.getPreSignedUrl(url, 24 * 60));
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
120
src/main/java/com/ai/da/controller/PortfolioController.java
Normal file
120
src/main/java/com/ai/da/controller/PortfolioController.java
Normal file
@@ -0,0 +1,120 @@
|
||||
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.*;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Api(tags = "Portfolio模块")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/portfolio")
|
||||
public class PortfolioController {
|
||||
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@ApiOperation(value = "发布作品集")
|
||||
@PostMapping("/publish")
|
||||
public Response<Boolean> preLogin(@RequestParam("file") MultipartFile canvas, @RequestParam("data") String data) {
|
||||
return Response.success(portfolioService.publish(canvas, data));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除作品集")
|
||||
@GetMapping("/delete")
|
||||
public Response<Boolean> delete(@RequestParam("id") Long id) {
|
||||
return Response.success(portfolioService.delete(id));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "作品集page")
|
||||
@PostMapping("/page")
|
||||
public Response<PageBaseResponse<PortfolioVO>> page(@Valid @RequestBody QueryPortfolioPageDTO query) {
|
||||
return Response.success(portfolioService.page(query));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "作品详情")
|
||||
@PostMapping("/detail")
|
||||
public Response<PortfolioVO> detail(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||
return Response.success(portfolioService.detail(portfolioDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "选择作品")
|
||||
@PostMapping("/choose")
|
||||
public Response<UserLikeChooseVO> choose(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||
return Response.success(portfolioService.choose(portfolioDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新作品")
|
||||
@PostMapping("/update")
|
||||
public Response<PortfolioVO> update(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||
return Response.success(portfolioService.update(portfolioDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "广场用户注册")
|
||||
@PostMapping("/designWorksRegister")
|
||||
public Response<Boolean> designWorksRegister(@Valid @RequestBody DesignWorksRegisterDTO designWorksRegisterDTO) {
|
||||
return Response.success(portfolioService.designWorksRegister(designWorksRegisterDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "喜欢")
|
||||
@GetMapping("/like")
|
||||
public Response<Boolean> like(@RequestParam("id") Long id) {
|
||||
return Response.success(portfolioService.like(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "不喜欢")
|
||||
@GetMapping("/unlike")
|
||||
public Response<Boolean> unlike(@RequestParam("id") Long id) {
|
||||
return Response.success(portfolioService.unlike(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取点赞数")
|
||||
@GetMapping("/getLikeCount")
|
||||
public Response<Long> getLikeCount(@RequestParam("id") Long id) {
|
||||
return Response.success(portfolioService.getLikeCount(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "评论")
|
||||
@PostMapping("/comment")
|
||||
public Response<Boolean> comment(@Valid @RequestBody CommentDTO commentDTO) {
|
||||
return Response.success(portfolioService.comment(commentDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "评论列表")
|
||||
@PostMapping("/commentPage")
|
||||
public Response<PageBaseResponse<CommentVO>> commentPage(@Valid @RequestBody CommentPageDTO commentPageDTO) {
|
||||
return Response.success(portfolioService.commentPage(commentPageDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "增加浏览量")
|
||||
@GetMapping("/viewsIncrease")
|
||||
public Response<Boolean> viewsIncrease(@RequestParam("id") Long id) {
|
||||
return Response.success(portfolioService.viewsIncrease(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "浏览量获取")
|
||||
@GetMapping("/viewsGet")
|
||||
public Response<Long> viewsGet(@RequestParam("id") Long id) {
|
||||
return Response.success(portfolioService.viewsGet(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除评论")
|
||||
@PostMapping("/commentDelete")
|
||||
public Response<Boolean> commentDelete(@Valid @RequestBody CommentDTO commentDTO) {
|
||||
return Response.success(portfolioService.commentDelete(commentDTO));
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,11 @@ import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.mapper.primary.TDesignPythonOutfitMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.Library;
|
||||
import com.ai.da.mapper.primary.entity.TDesignPythonOutfit;
|
||||
import com.ai.da.mapper.primary.entity.UserLikeGroup;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.*;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -26,6 +24,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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;
|
||||
@@ -50,6 +49,8 @@ public class SavedCollectionController {
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private ClassificationService classificationService;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@ApiOperation(value = "History用户分页分组列表")
|
||||
@PostMapping("/queryUserGroup")
|
||||
@@ -119,10 +120,18 @@ public class SavedCollectionController {
|
||||
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));
|
||||
detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
}
|
||||
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());
|
||||
if (Objects.nonNull(byId)) {
|
||||
String portfolioName = byId.getPortfolioName();
|
||||
userLikeGroupVO.setOriginalPortfolioName(portfolioName);
|
||||
}
|
||||
}
|
||||
return userLikeGroupVO;
|
||||
}
|
||||
return null;
|
||||
@@ -159,4 +168,71 @@ public class SavedCollectionController {
|
||||
return Response.success(userLikeGroupService.choose(userGroupId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "exportSave")
|
||||
@PostMapping("/exportSave")
|
||||
public Response<Boolean> exportSave(@RequestParam("file") MultipartFile file, @RequestParam("userLikeGroupId") Long userLikeGroupId) {
|
||||
return Response.success(userLikeGroupService.exportSave(file, userLikeGroupId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "exportSearch")
|
||||
@PostMapping("/exportSearch")
|
||||
public Response<JSONObject> exportSearch(@Valid @RequestBody ExportSearchDTO exportSearchDTO) {
|
||||
return Response.success(userLikeGroupService.exportSearch(exportSearchDTO.getUserLikeGroupId()));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "toProduct")
|
||||
@PostMapping("/toProduct")
|
||||
public Response<List<ToProductImageResult>> toProduct(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
|
||||
return Response.success(userLikeGroupService.toProduct(toProductImageDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "toProductImageElementUpload")
|
||||
@PostMapping("/toProductImageElementUpload")
|
||||
public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file, @RequestParam(value = "userlikeGroupId") Long userLikeGroupId) {
|
||||
return Response.success(userLikeGroupService.toProductImageElementUpload(file, userLikeGroupId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "productImageLike")
|
||||
@PostMapping("/productImageLike")
|
||||
public Response<Boolean> productImageLike(@Valid @RequestBody ProductImageLikeDTO productImageLikeDTO) {
|
||||
return Response.success(userLikeGroupService.productImageLike(productImageLikeDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "productImageUnLike")
|
||||
@PostMapping("/productImageUnLike")
|
||||
public Response<Boolean> productImageUnLike(@Valid @RequestBody ProductImageLikeDTO productImageLikeDTO) {
|
||||
return Response.success(userLikeGroupService.productImageUnLike(productImageLikeDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取生成结果")
|
||||
@PostMapping("/toProductImageResult")
|
||||
public Response<List<MagicToolResultVO>> getToProductImageResult(@Valid @RequestBody List<String> taskIdList) {
|
||||
List<MagicToolResultVO> magicToolResultVOList = userLikeGroupService.getToProductImageResultList(taskIdList);
|
||||
return Response.success(magicToolResultVOList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "画布用户上传元素")
|
||||
@PostMapping("/canvasElementUpload")
|
||||
public Response<CanvasElementUpload> canvasElementUpload(@RequestParam("file") MultipartFile file) {
|
||||
return Response.success(userLikeGroupService.canvasElementUpload(file));
|
||||
}
|
||||
|
||||
@ApiOperation("productImageLikeList")
|
||||
@PostMapping("/productImageLikeList")
|
||||
public Response<List<ToProductImageResultVO>> productImageLikeList(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
|
||||
return Response.success(userLikeGroupService.productImageLikeList(toProductImageDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "relight")
|
||||
@PostMapping("/relight")
|
||||
public Response<List<ToProductImageResult>> relight(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
|
||||
return Response.success(userLikeGroupService.relight(toProductImageDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取relight结果")
|
||||
@PostMapping("/relightResult")
|
||||
public Response<List<MagicToolResultVO>> getRelightResult(@Valid @RequestBody List<String> taskIdList) {
|
||||
List<MagicToolResultVO> magicToolResultVOList = userLikeGroupService.getRelightResult(taskIdList);
|
||||
return Response.success(magicToolResultVOList);
|
||||
}
|
||||
}
|
||||
|
||||
54
src/main/java/com/ai/da/controller/StripeController.java
Normal file
54
src/main/java/com/ai/da/controller/StripeController.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.service.StripeService;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.payments.Refund;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
@Api(tags = "Stripe模块")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/stripe")
|
||||
public class StripeController {
|
||||
|
||||
@Resource
|
||||
private StripeService stripeService;
|
||||
|
||||
@ApiOperation("创建支付链接")
|
||||
@PostMapping("/createOrder/{amount}")
|
||||
public Response<String> pay(@PathVariable Integer amount, @RequestParam String returnUrl) {
|
||||
return Response.success(stripeService.pay(amount, returnUrl));
|
||||
}
|
||||
|
||||
@ApiOperation("支付通知")
|
||||
@PostMapping("/trade/notify")
|
||||
public Response<String> callback(HttpServletRequest request) throws ServletException, IOException {
|
||||
Boolean result = stripeService.notify(request);
|
||||
if (result){
|
||||
return Response.success(200,"success");
|
||||
}else {
|
||||
return Response.fail(400,"failure");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("申请退款")
|
||||
@PostMapping("/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("退款成功")){
|
||||
return Response.success();
|
||||
}else {
|
||||
return Response.fail("Request for refund failed.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,11 +27,11 @@ public class ThirdPartyController {
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
|
||||
@ApiOperation(value = "Add user information")
|
||||
/*@ApiOperation(value = "Add user information")
|
||||
@PostMapping("/addUser")
|
||||
public Response<Boolean> addUser(@Valid @RequestBody AccountAddDTO accountAddDTO) {
|
||||
return Response.success(accountService.addUser(accountAddDTO));
|
||||
}
|
||||
}*/
|
||||
|
||||
@ApiOperation(value = "Edit user information")
|
||||
@PostMapping("/editUser")
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.Style;
|
||||
import com.ai.da.mapper.primary.entity.Workspace;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.dto.WorkspaceSaveDTO;
|
||||
import com.ai.da.model.enums.BizJson;
|
||||
import com.ai.da.model.vo.ModelsVO;
|
||||
import com.ai.da.model.vo.StyleVO;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.ai.da.service.WorkspaceService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -44,8 +47,8 @@ public class WorkspaceController {
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ApiOperation(value = "详情", notes = "传入workspace")
|
||||
public Response<Workspace> detail(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
|
||||
Workspace detail = workspaceService.getByIdNew(id);
|
||||
public Response<WorkspaceVO> detail(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
|
||||
WorkspaceVO detail = workspaceService.getByIdNew(id);
|
||||
return Response.success(detail);
|
||||
}
|
||||
|
||||
@@ -66,8 +69,8 @@ public class WorkspaceController {
|
||||
@PostMapping("/saveOrUpdate")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@ApiOperation(value = "新增或编辑", notes = "传入workspace")
|
||||
public Response saveOrUpdate(@Valid @RequestBody Workspace workspace) {
|
||||
return Response.success(workspaceService.saveOrUpdate(workspace));
|
||||
public Response saveOrUpdate(@Valid @RequestBody WorkspaceSaveDTO workspaceDTO) {
|
||||
return Response.success(workspaceService.saveOrUpdate(workspaceDTO));
|
||||
}
|
||||
|
||||
|
||||
@@ -92,8 +95,8 @@ public class WorkspaceController {
|
||||
@GetMapping("/getMannequins")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@ApiOperation(value = "获取模特")
|
||||
public Response<List<ModelsVO>> getMannequins(@RequestParam("sex") String sex) {
|
||||
List<ModelsVO> modelsVO = workspaceService.getMannequins(sex);
|
||||
public Response<List<ModelsVO>> getMannequins(@RequestParam("sex") String sex, @RequestParam("style") String style) {
|
||||
List<ModelsVO> modelsVO = workspaceService.getMannequins(sex, style);
|
||||
return Response.success(modelsVO);
|
||||
}
|
||||
|
||||
@@ -115,10 +118,17 @@ public class WorkspaceController {
|
||||
}
|
||||
|
||||
@PostMapping("maleDataInsert")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@ApiOperationSupport(order = 8)
|
||||
@ApiOperation(value = "男装数据入库入minio")
|
||||
public Response<Boolean> maleDataInsert() throws FileNotFoundException {
|
||||
workspaceService.maleDataInsert();
|
||||
return Response.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("styleList")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@ApiOperation(value = "获取style列表")
|
||||
public Response<List<StyleVO>> styleList() {
|
||||
return Response.success(workspaceService.styleList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ public interface AccountMapper extends CommonMapper<Account> {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Account findById(String id);
|
||||
// Account findById(String id);
|
||||
|
||||
}
|
||||
|
||||
7
src/main/java/com/ai/da/mapper/primary/CanvasMapper.java
Normal file
7
src/main/java/com/ai/da/mapper/primary/CanvasMapper.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Canvas;
|
||||
|
||||
public interface CanvasMapper extends CommonMapper<Canvas> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Comment;
|
||||
|
||||
public interface CommentMapper extends CommonMapper<Comment> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.ExportFile;
|
||||
|
||||
public interface ExportFileMapper extends CommonMapper<ExportFile> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
|
||||
public interface PortfolioMapper extends CommonMapper<Portfolio> {
|
||||
Portfolio getByIdAll(Long originalPortfolioId);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Questionnaire;
|
||||
|
||||
public interface QuestionnaireMapper extends CommonMapper<Questionnaire> {
|
||||
}
|
||||
17
src/main/java/com/ai/da/mapper/primary/StyleMapper.java
Normal file
17
src/main/java/com/ai/da/mapper/primary/StyleMapper.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Style;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author easy-generator
|
||||
* @since 2022-06-13
|
||||
*/
|
||||
public interface StyleMapper extends CommonMapper<Style> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.ToProductElement;
|
||||
|
||||
public interface ToProductElementMapper extends CommonMapper<ToProductElement> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.ToProductImageRecord;
|
||||
|
||||
public interface ToProductImageRecordMapper extends CommonMapper<ToProductImageRecord> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.ToProductImageResult;
|
||||
|
||||
public interface ToProductImageResultMapper extends CommonMapper<ToProductImageResult> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.WorkspaceRelStyle;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author easy-generator
|
||||
* @since 2022-06-13
|
||||
*/
|
||||
public interface WorkspaceRelStyleMapper extends CommonMapper<WorkspaceRelStyle> {
|
||||
|
||||
|
||||
}
|
||||
@@ -86,4 +86,13 @@ public class Account implements Serializable {
|
||||
* 积分
|
||||
*/
|
||||
private BigDecimal credits;
|
||||
|
||||
/**
|
||||
* 用于区分游客与系统用户
|
||||
* 0 : 游客
|
||||
* 1 : 年付用户
|
||||
* 2 : 月付用户
|
||||
* 3 : 试用用户
|
||||
*/
|
||||
private Integer systemUser;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -24,11 +25,13 @@ public class BaseEntity implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
|
||||
42
src/main/java/com/ai/da/mapper/primary/entity/Canvas.java
Normal file
42
src/main/java/com/ai/da/mapper/primary/entity/Canvas.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Attendance
|
||||
*
|
||||
* @author easy-generator
|
||||
* @since 2022-06-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("canvas")
|
||||
public class Canvas implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("url")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty("accountId")
|
||||
private Long accountId;
|
||||
|
||||
@ApiModelProperty("createTime")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CanvasElementUpload {
|
||||
private String url;
|
||||
private String minioUrl;
|
||||
}
|
||||
@@ -75,6 +75,8 @@ public class CollectionElement implements Serializable {
|
||||
*/
|
||||
private String md5;
|
||||
|
||||
private String gradientString;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
38
src/main/java/com/ai/da/mapper/primary/entity/Comment.java
Normal file
38
src/main/java/com/ai/da/mapper/primary/entity/Comment.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("comment")
|
||||
public class Comment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long portfolioId;
|
||||
|
||||
private Long accountId;
|
||||
|
||||
private String comment;
|
||||
|
||||
// 一级父节点ID
|
||||
private Long parentLevel1Id;
|
||||
|
||||
// 二级父节点ID
|
||||
private Long parentLevel2Id;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private Integer isDeleted;
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import java.math.BigDecimal;
|
||||
public class CreditsDetail extends BaseEntity {
|
||||
/** 用户id */
|
||||
private Long accountId;
|
||||
/** 任务id或uuid */
|
||||
private String taskId;
|
||||
/** 积分变更事件 */
|
||||
private String changeEvent;
|
||||
/** 变更积分 ( + 表示加,- 表示减) */
|
||||
|
||||
@@ -64,6 +64,8 @@ public class DesignItemDetail implements Serializable {
|
||||
*/
|
||||
private String color;
|
||||
|
||||
private String gradientString;
|
||||
|
||||
/**
|
||||
* 对应的print图片的绝对路径
|
||||
*/
|
||||
@@ -88,6 +90,10 @@ public class DesignItemDetail implements Serializable {
|
||||
* item的优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
/**
|
||||
* 未分割的只上了颜色或只有overall印花的图层
|
||||
*/
|
||||
private String undividedLayer;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
||||
@@ -20,6 +20,16 @@ public class DesignItemDetailPrint {
|
||||
* 关联t_design_item_detail表ID
|
||||
*/
|
||||
private Long designItemDetailId;
|
||||
|
||||
/**
|
||||
* 印花的类型 print || trims
|
||||
*/
|
||||
private String printType;
|
||||
|
||||
/**
|
||||
* 印花二级分类 Slogan || Logo || Pattern
|
||||
*/
|
||||
private String level2Type;
|
||||
/**
|
||||
* 印花路径
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("export_file")
|
||||
public class ExportFile implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String url;
|
||||
private Long userLikeGroupId;
|
||||
}
|
||||
@@ -33,10 +33,15 @@ public class Generate {
|
||||
private String uniqueId;
|
||||
|
||||
/**
|
||||
* Sketchboard Printboard
|
||||
* Sketchboard Printboard Moodboard
|
||||
*/
|
||||
private String level1Type;
|
||||
|
||||
/**
|
||||
* Slogan Logo Pattern
|
||||
*/
|
||||
private String level2Type;
|
||||
|
||||
/**
|
||||
* 图片来源 collection | library
|
||||
*/
|
||||
@@ -62,6 +67,11 @@ public class Generate {
|
||||
*/
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* Logo 种子 相同种子 相同prompt 输出一定相同
|
||||
*/
|
||||
private String seed;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
15
src/main/java/com/ai/da/mapper/primary/entity/Gradient.java
Normal file
15
src/main/java/com/ai/da/mapper/primary/entity/Gradient.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Gradient implements Serializable {
|
||||
private List<GradientItem> gradientList;
|
||||
private int angle;
|
||||
private int selectIndex;
|
||||
private boolean gradientShow;
|
||||
private String colorImg;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class GradientItem implements Serializable {
|
||||
private RGBA rgba;
|
||||
private String left;
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class OrderInfo extends BaseEntity{
|
||||
|
||||
private Long productId;//支付产品id
|
||||
|
||||
private Integer totalFee;//订单金额(元)
|
||||
private Float totalFee;//订单金额(元)
|
||||
|
||||
private String codeUrl;//订单二维码连接
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public class PaymentInfo extends BaseEntity{
|
||||
|
||||
private String tradeState;//交易状态
|
||||
|
||||
private Integer payerTotal;//支付金额(分)
|
||||
private Float payerTotal;//支付金额(元)
|
||||
|
||||
private String content;//通知参数
|
||||
}
|
||||
|
||||
67
src/main/java/com/ai/da/mapper/primary/entity/Portfolio.java
Normal file
67
src/main/java/com/ai/da/mapper/primary/entity/Portfolio.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
@ApiModel(value = "Portfolio对象", description = "作品集")
|
||||
@TableName("portfolio")
|
||||
public class Portfolio implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "collection ID")
|
||||
private Long collectionId;
|
||||
|
||||
@ApiModelProperty(value = "userLikeGroup源")
|
||||
private Long userLikeGroupSourceId;
|
||||
|
||||
@ApiModelProperty(value = "作品名称")
|
||||
private String portfolioName;
|
||||
|
||||
@ApiModelProperty(value = "作品描述")
|
||||
private String portfolioDes;
|
||||
|
||||
@ApiModelProperty(value = "作品类型")
|
||||
private String portfolioType;
|
||||
|
||||
@ApiModelProperty(value = "画布ID")
|
||||
private Long canvasId;
|
||||
|
||||
@ApiModelProperty(value = "封面ID")
|
||||
private Long coverId;
|
||||
|
||||
@ApiModelProperty(value = "作品状态1公开0隐藏")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否允许二次创作1允许0不允许")
|
||||
private Integer openSource;
|
||||
|
||||
private Integer original;
|
||||
|
||||
private Long originalAccountId;
|
||||
|
||||
private Long originalPortfolioId;
|
||||
|
||||
@ApiModelProperty(value = "作品集作者ID")
|
||||
private Long accountId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createDate;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer isDeleted;
|
||||
}
|
||||
@@ -9,7 +9,8 @@ public class Product extends BaseEntity{
|
||||
|
||||
private String title; //商品名称
|
||||
|
||||
private Integer price; //价格(分)
|
||||
// private Integer price; //价格(分)
|
||||
private Float price; //价格(元)
|
||||
|
||||
private Integer credits; // 积分
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("t_questionnaire")
|
||||
public class Questionnaire extends BaseEntity{
|
||||
|
||||
/**
|
||||
* 用户所填调查问卷结果
|
||||
*/
|
||||
private String questionnaireInfo;
|
||||
/**
|
||||
* 调查问卷标题
|
||||
*/
|
||||
private String title;
|
||||
}
|
||||
13
src/main/java/com/ai/da/mapper/primary/entity/RGBA.java
Normal file
13
src/main/java/com/ai/da/mapper/primary/entity/RGBA.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class RGBA implements Serializable {
|
||||
private int r;
|
||||
private int g;
|
||||
private int b;
|
||||
private double a;
|
||||
}
|
||||
@@ -13,9 +13,11 @@ public class RefundInfo extends BaseEntity{
|
||||
|
||||
private String refundId;//支付系统退款单号(微信)
|
||||
|
||||
private Integer totalFee;//原订单金额(分)
|
||||
// private Integer totalFee;//原订单金额(分)
|
||||
private Float totalFee;//原订单金额(分)
|
||||
|
||||
private Integer refund;//退款金额(分)
|
||||
// private Integer refund;//退款金额(分)
|
||||
private Float refund;//退款金额(分)
|
||||
|
||||
private String reason;//退款原因
|
||||
|
||||
|
||||
17
src/main/java/com/ai/da/mapper/primary/entity/Style.java
Normal file
17
src/main/java/com/ai/da/mapper/primary/entity/Style.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("style")
|
||||
public class Style implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class ToProductElement implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "userLikeGroupId")
|
||||
private Long userLikeGroupId;
|
||||
|
||||
@ApiModelProperty(value = "url")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class ToProductImageRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "userLikeGroupId")
|
||||
private Long userLikeGroupId;
|
||||
|
||||
@ApiModelProperty(value = "prompt")
|
||||
private String prompt;
|
||||
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class ToProductImageResult implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "elementId")
|
||||
private Long elementId;
|
||||
|
||||
@ApiModelProperty(value = "elementType")
|
||||
private String elementType;
|
||||
|
||||
@ApiModelProperty(value = "url")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "isLike 1是0否")
|
||||
private Integer isLike;
|
||||
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "toProductImageRecordId")
|
||||
private Long toProductImageRecordId;
|
||||
|
||||
@ApiModelProperty(value = "taskId")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty(value = "userLikeGroupId")
|
||||
private Long userLikeGroupId;
|
||||
|
||||
@ApiModelProperty(value = "generate 结果类型")
|
||||
private String resultType;
|
||||
}
|
||||
@@ -43,6 +43,12 @@ public class UserLikeGroup implements Serializable {
|
||||
*/
|
||||
private String name;
|
||||
|
||||
private Integer original;
|
||||
|
||||
private Long originalAccountId;
|
||||
|
||||
private Long originalPortfolioId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("workspace_rel_style")
|
||||
public class WorkspaceRelStyle implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long workspaceId;
|
||||
private Long styleId;
|
||||
}
|
||||
@@ -17,9 +17,15 @@ import java.util.List;
|
||||
public interface AttributeRetrievalMapper {
|
||||
|
||||
|
||||
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum);
|
||||
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style);
|
||||
|
||||
AttributeRetrieval getSystemRandom(String tableName);
|
||||
AttributeRetrieval getSystemRandom(String tableName, String style);
|
||||
|
||||
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName);
|
||||
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style);
|
||||
|
||||
Long getIdByFileName(String fileName, String tableName);
|
||||
|
||||
void updateStyleById(Long idByFileName, String style, String tableName);
|
||||
|
||||
void updateStyleByFileName(String style, String fileName, String tableName);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class AttributeRetrieval {
|
||||
private String openingType;
|
||||
private String subtype;
|
||||
|
||||
private String sleeve;
|
||||
private String sleeve1;
|
||||
private String sleeve2;
|
||||
private String style;
|
||||
|
||||
private Integer deprecated;
|
||||
}
|
||||
|
||||
@@ -2,23 +2,27 @@ package com.ai.da.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("AccountAdd")
|
||||
@AllArgsConstructor
|
||||
public class AccountAddDTO {
|
||||
|
||||
@NotBlank(message = "email.cannot.be.empty")
|
||||
@ApiModelProperty("email")
|
||||
private String email;
|
||||
@ApiModelProperty("userEmail")
|
||||
private String userEmail;
|
||||
|
||||
@NotBlank(message = "userName.cannot.be.empty")
|
||||
@ApiModelProperty("userName")
|
||||
private String userName;
|
||||
|
||||
private String country;
|
||||
|
||||
@NotBlank(message = "validStartTime.cannot.be.empty")
|
||||
@ApiModelProperty("Start time of account validity ")
|
||||
private String validStartTime;
|
||||
@@ -29,4 +33,8 @@ public class AccountAddDTO {
|
||||
|
||||
private Integer isTrial;
|
||||
|
||||
private BigDecimal credits;
|
||||
|
||||
private Integer systemUser;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AccountDesignWorksRegisterDTO extends Account {
|
||||
private String emailVerifyCode;
|
||||
}
|
||||
@@ -9,5 +9,5 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@ApiModel("AccountTrial")
|
||||
public class AccountTrialDTO extends TrialOrder {
|
||||
|
||||
private String ref;
|
||||
}
|
||||
|
||||
30
src/main/java/com/ai/da/model/dto/AlipayHKCallbackDTO.java
Normal file
30
src/main/java/com/ai/da/model/dto/AlipayHKCallbackDTO.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlipayHKCallbackDTO {
|
||||
|
||||
private String transaction_id;
|
||||
|
||||
private Float amount;
|
||||
|
||||
private String currency;
|
||||
|
||||
private String payment_time;
|
||||
|
||||
private String merchant_id;
|
||||
|
||||
private String segment_id;
|
||||
|
||||
private String out_trade_no;
|
||||
|
||||
private String type;
|
||||
|
||||
private String status;
|
||||
|
||||
private String pid;
|
||||
|
||||
private String subject;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Gradient;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -25,4 +26,10 @@ public class CollectionColorDTO {
|
||||
@ApiModelProperty("潘通RGB值")
|
||||
private String rgbValue;
|
||||
|
||||
private Gradient gradient;
|
||||
|
||||
private String gradientString;
|
||||
|
||||
private String gradientMinioUrl;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Gradient;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
8
src/main/java/com/ai/da/model/dto/CommentDTO.java
Normal file
8
src/main/java/com/ai/da/model/dto/CommentDTO.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Comment;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommentDTO extends Comment {
|
||||
}
|
||||
9
src/main/java/com/ai/da/model/dto/CommentPageDTO.java
Normal file
9
src/main/java/com/ai/da/model/dto/CommentPageDTO.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommentPageDTO extends PageQueryBaseVo {
|
||||
private Long portfolioId;
|
||||
}
|
||||
@@ -14,6 +14,8 @@ public class DesignCollectionPrintElementDTO {
|
||||
@ApiModelProperty("design类型 用户design生成时候区别library和collection")
|
||||
private String designType;
|
||||
|
||||
private String level2Type;
|
||||
|
||||
@ApiModelProperty("是否pin 1 pin 0 不pin")
|
||||
private Byte isPin;
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@ import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DesignSingleIncludeLayersDTO {
|
||||
public class DesignSingleIncludeLayersDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty("designItemId")
|
||||
@NotNull(message = "designItemId.cannot.be.empty")
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Gradient;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DesignSingleItemDTO {
|
||||
public class DesignSingleItemDTO implements Serializable {
|
||||
|
||||
@NotNull(message = "id.cannot.be.empty")
|
||||
@ApiModelProperty("切换图片对应的id")
|
||||
@@ -24,7 +26,7 @@ public class DesignSingleItemDTO {
|
||||
private String designType;
|
||||
|
||||
@NotBlank(message = "type.cannot.be.empty")
|
||||
@ApiModelProperty("生成item实际对应的类型 有:outwear,dress,blouse,skirt,trousers Shoes Hairstyle Earring")
|
||||
@ApiModelProperty("生成item实际对应的类型 有:Outwear,Dress,Blouse,Skirt,Trousers Shoes Hairstyle Earring")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("对应的图片的minIO路径")
|
||||
@@ -42,15 +44,19 @@ public class DesignSingleItemDTO {
|
||||
private List<Long> offset;
|
||||
|
||||
@ApiModelProperty("图层缩放比例")
|
||||
private Float scale;
|
||||
private Float[] scale;
|
||||
|
||||
@NotNull(message = "priority.cannot.be.empty")
|
||||
@ApiModelProperty("图层优先级")
|
||||
private Integer priority;
|
||||
|
||||
// @ApiModelProperty("渐变 起始/目标 颜色")
|
||||
// private List<List<Integer>> gradient;
|
||||
//
|
||||
// @ApiModelProperty("渐变角度")
|
||||
// private Float gradient_angle;
|
||||
@ApiModelProperty("渐变 颜色")
|
||||
private Gradient gradient;
|
||||
|
||||
@ApiModelProperty("画笔修改过的sketch图片的base64格式的数据")
|
||||
private String sketchString;
|
||||
|
||||
@ApiModelProperty("衣服上的装饰")
|
||||
private DesignSinglePrintDTO trims;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,21 +5,27 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("design single 印花请求信息")
|
||||
public class DesignSinglePrintDTO {
|
||||
public class DesignSinglePrintDTO implements Serializable {
|
||||
|
||||
// @ApiModelProperty("印花url")
|
||||
// private String path;
|
||||
|
||||
@ApiModelProperty("single -> true,overall -> false")
|
||||
private Boolean ifSingle;
|
||||
/*@ApiModelProperty("single -> true,overall -> false")
|
||||
private Boolean ifSingle;*/
|
||||
|
||||
@ApiModelProperty("印花详细")
|
||||
private List<DesignSinglePrint> prints;
|
||||
|
||||
public DesignSinglePrintDTO() {
|
||||
}
|
||||
/*
|
||||
public DesignSinglePrintDTO(Boolean ifSingle, List<DesignSinglePrint> prints) {
|
||||
this.ifSingle = ifSingle;
|
||||
this.prints = prints;
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DesignWorksRegisterDTO {
|
||||
private String userName;
|
||||
private String email;
|
||||
private String password;
|
||||
}
|
||||
8
src/main/java/com/ai/da/model/dto/ExportSaveDTO.java
Normal file
8
src/main/java/com/ai/da/model/dto/ExportSaveDTO.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExportSaveDTO {
|
||||
private String data;
|
||||
}
|
||||
8
src/main/java/com/ai/da/model/dto/ExportSearchDTO.java
Normal file
8
src/main/java/com/ai/da/model/dto/ExportSearchDTO.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExportSearchDTO {
|
||||
private Long userLikeGroupId;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class GenerateLikeDTO {
|
||||
@ApiModelProperty("一级类型 Sketchboard Printboard")
|
||||
private String level1Type;
|
||||
|
||||
@ApiModelProperty("当一级类型为Sketchboard时,二级类型 Outwear Dress Blouse Skirt Trousers")
|
||||
@ApiModelProperty("当一级类型为Sketchboard时,二级类型 Outwear Dress Blouse Skirt Trousers;当一级类型为Printboard时,二级类型 Slogan Logo Pattern")
|
||||
private String level2Type;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
|
||||
@@ -14,24 +14,25 @@ public class GenerateThroughImageTextDTO {
|
||||
@ApiModelProperty("用户id")
|
||||
Long userId;
|
||||
|
||||
@ApiModelProperty("caption")
|
||||
@ApiModelProperty("caption | prompt")
|
||||
String text;
|
||||
|
||||
@ApiModelProperty("图片在t_collection_element表中的id")
|
||||
Long collectionElementId;
|
||||
|
||||
@NotBlank(message = "you have to choose the generate type")
|
||||
// todo 后续取消这个字段的传输,由后端自行判断相关参数是否有值
|
||||
// @NotBlank(message = "you have to choose the generate type")
|
||||
@ApiModelProperty("text image text-image")
|
||||
String generateType;
|
||||
|
||||
@ApiModelProperty("图片是update,还是从library中选择")
|
||||
@ApiModelProperty("图片是update,还是从library中选择 collection || library")
|
||||
String designType;
|
||||
|
||||
@NotBlank(message = "level1Type cannot be empty!")
|
||||
@ApiModelProperty("Moodboard Printboard Sketchboard MarketingSketch")
|
||||
String level1Type;
|
||||
|
||||
@ApiModelProperty("Outwear Dress Blouse Skirt Trousers")
|
||||
@ApiModelProperty("Outwear Dress Blouse Skirt Trousers || Logo Slogan Pattern")
|
||||
String level2Type;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
@@ -50,4 +51,10 @@ public class GenerateThroughImageTextDTO {
|
||||
@NotNull(message = "Please check if the required fields are empty.(isTestUser)")
|
||||
@ApiModelProperty("是否是测试用户")
|
||||
Boolean isTestUser;
|
||||
|
||||
@ApiModelProperty("页面上用户设计的slogan所截的图片")
|
||||
String sloganBase64;
|
||||
|
||||
@ApiModelProperty("种子 取值范围 0~500")
|
||||
String seed;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -26,6 +25,10 @@ public class GenerateToPythonDTO {
|
||||
// taskId的最后拼接用户id
|
||||
private String tasks_id;
|
||||
|
||||
private String seed;
|
||||
|
||||
private String svg;
|
||||
|
||||
public GenerateToPythonDTO(String tasks_id, String prompt, String image_url, String mode, String category, String gender) {
|
||||
this.image_url = image_url;
|
||||
this.category = category;
|
||||
|
||||
@@ -71,4 +71,6 @@ public class ModelsDotDTO implements Serializable {
|
||||
*/
|
||||
private String templateUrl;
|
||||
|
||||
private String sex;
|
||||
|
||||
}
|
||||
|
||||
12
src/main/java/com/ai/da/model/dto/PortfolioDTO.java
Normal file
12
src/main/java/com/ai/da/model/dto/PortfolioDTO.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Data
|
||||
public class PortfolioDTO extends Portfolio {
|
||||
private Long userLikeGroupId;
|
||||
}
|
||||
10
src/main/java/com/ai/da/model/dto/ProductImageLikeDTO.java
Normal file
10
src/main/java/com/ai/da/model/dto/ProductImageLikeDTO.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ProductImageLikeDTO {
|
||||
private List<Long> toProductImageResultId;
|
||||
}
|
||||
17
src/main/java/com/ai/da/model/dto/QueryPortfolioPageDTO.java
Normal file
17
src/main/java/com/ai/da/model/dto/QueryPortfolioPageDTO.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("作品集分页查询")
|
||||
public class QueryPortfolioPageDTO extends PageQueryBaseVo {
|
||||
|
||||
private Integer getMyPortfolio;
|
||||
|
||||
private Integer getLikePortfolio;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user