diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/files/CODE-CREATE LIMITED-3015240422190522-merchant.private.key.txt b/files/CODE-CREATE LIMITED-3015240422190522-merchant.private.key.txt deleted file mode 100644 index b8487446..00000000 --- a/files/CODE-CREATE LIMITED-3015240422190522-merchant.private.key.txt +++ /dev/null @@ -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----- diff --git a/files/CODE-CREATE LIMITED.merchant.aqs.public.key.pem b/files/CODE-CREATE LIMITED.merchant.aqs.public.key.pem deleted file mode 100644 index 39a68d27..00000000 --- a/files/CODE-CREATE LIMITED.merchant.aqs.public.key.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtV6WdPhCKCb0JBhwHaXK -a9+UvlJ8TXThPtbGbCA1rss1xtHerzrnSE5mBU6lcyUWgAK4cKfjUP0fcqJ7LlLB -HNMdqk57ckmDHnR3yNk0peqk7KqR8pEi6+rtBOE7mFIhrP5397dAP6xL5iiujj+L -zYFJQDYTig8IggHZiZIjgRBycC7DdcZXJwZFEdFq/rmrlaPgNKKZDOx6wWl103Mv -oKaJXfrgoAm0cxQog69LirCyYG9wntWl08GvJNnQ4Ops4RNFOucobDc4wgqoPoPL -XxFYWvTa7JneoRtohR55OKwqkV4Y7iNVddBomVKaTFibRg9rY+2StF1yoebAHJbv -UQIDAQAB ------END PUBLIC KEY----- diff --git a/files/Code-Create Limited-2088841167357411-merchant.private.key.txt b/files/Code-Create Limited-2088841167357411-merchant.private.key.txt new file mode 100644 index 00000000..24cbf57d --- /dev/null +++ b/files/Code-Create Limited-2088841167357411-merchant.private.key.txt @@ -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----- diff --git a/files/Code-Create Limited.merchant.aqs.public.key.pem b/files/Code-Create Limited.merchant.aqs.public.key.pem new file mode 100644 index 00000000..d6a27eee --- /dev/null +++ b/files/Code-Create Limited.merchant.aqs.public.key.pem @@ -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----- diff --git a/pom.xml b/pom.xml index 70da458b..e2a8d0f6 100644 --- a/pom.xml +++ b/pom.xml @@ -233,6 +233,12 @@ 2.17.1 + + com.stripe + stripe-java + 25.0.0 + + diff --git a/src/main/java/com/ai/da/common/RabbitMQ/GenerateConsumer.java b/src/main/java/com/ai/da/common/RabbitMQ/GenerateConsumer.java index 3e8e6a6e..876dfd2c 100644 --- a/src/main/java/com/ai/da/common/RabbitMQ/GenerateConsumer.java +++ b/src/main/java/com/ai/da/common/RabbitMQ/GenerateConsumer.java @@ -154,63 +154,63 @@ public class GenerateConsumer { } - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer1(Message msg, Channel channel) { - generate(msg, channel, "consumer 1"); - } - - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer2(Message msg, Channel channel) { - generate(msg, channel, "consumer 2"); - } - - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer3(Message msg, Channel channel) { - generate(msg, channel, "consumer 3"); - } - - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer4(Message msg, Channel channel) { - generate(msg, channel, "consumer 4"); - } - - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer5(Message msg, Channel channel) { - generate(msg, channel, "consumer 5"); - } - - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer6(Message msg, Channel channel) { - generate(msg, channel, "consumer 6"); - } - - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer7(Message msg, Channel channel) { - generate(msg, channel, "consumer 7"); - } - - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer8(Message msg, Channel channel) { - generate(msg, channel, "consumer 8"); - } - - @RabbitListener(queues = MQConfig.GENERATE_QUEUE) - @RabbitHandler - public void generateConsumer9(Message msg, Channel channel) { - generate(msg, channel, "consumer 9"); - } - - @RabbitListener(queues = MQConfig.GENERATE_RESULT_QUEUE) - @RabbitHandler - public void getGenerateResult(Message msg, Channel channel) { - processGenerateResult(msg, channel); - } +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer1(Message msg, Channel channel) { +// generate(msg, channel, "consumer 1"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer2(Message msg, Channel channel) { +// generate(msg, channel, "consumer 2"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer3(Message msg, Channel channel) { +// generate(msg, channel, "consumer 3"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer4(Message msg, Channel channel) { +// generate(msg, channel, "consumer 4"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer5(Message msg, Channel channel) { +// generate(msg, channel, "consumer 5"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer6(Message msg, Channel channel) { +// generate(msg, channel, "consumer 6"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer7(Message msg, Channel channel) { +// generate(msg, channel, "consumer 7"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer8(Message msg, Channel channel) { +// generate(msg, channel, "consumer 8"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_QUEUE) +// @RabbitHandler +// public void generateConsumer9(Message msg, Channel channel) { +// generate(msg, channel, "consumer 9"); +// } +// +// @RabbitListener(queues = MQConfig.GENERATE_RESULT_QUEUE) +// @RabbitHandler +// public void getGenerateResult(Message msg, Channel channel) { +// processGenerateResult(msg, channel); +// } } diff --git a/src/main/java/com/ai/da/common/RabbitMQ/SRConsumer.java b/src/main/java/com/ai/da/common/RabbitMQ/SRConsumer.java index 6ad261bd..b8ba32f2 100644 --- a/src/main/java/com/ai/da/common/RabbitMQ/SRConsumer.java +++ b/src/main/java/com/ai/da/common/RabbitMQ/SRConsumer.java @@ -218,17 +218,17 @@ public class SRConsumer { taskListService.updateTaskStatusOrOutputRedis(uniqueId, "fail", null); } - @RabbitListener(queues = MQConfig.SR_QUEUE) - @RabbitHandler - public void SRConsumer1(Message msg, Channel channel) { - superResolution(msg, channel, "consumer 1"); - } - - - @RabbitListener(queues = MQConfig.SR_RESULT_QUEUE) - @RabbitHandler - public void SRResultConsumer1(Message msg, Channel channel) { - getSRResult(msg, channel, "consumer 1"); - } +// @RabbitListener(queues = MQConfig.SR_QUEUE) +// @RabbitHandler +// public void SRConsumer1(Message msg, Channel channel) { +// superResolution(msg, channel, "consumer 1"); +// } +// +// +// @RabbitListener(queues = MQConfig.SR_RESULT_QUEUE) +// @RabbitHandler +// public void SRResultConsumer1(Message msg, Channel channel) { +// getSRResult(msg, channel, "consumer 1"); +// } } diff --git a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java index 647c0f38..bd8f2687 100644 --- a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java +++ b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java @@ -34,7 +34,7 @@ public class MyTaskScheduler { // 定时任务,每十五天执行一次 // @Scheduled(cron = "0 0 0 ? * MON") - @Scheduled(cron = "0 0 0 */15 * ?") +// @Scheduled(cron = "0 0 0 */15 * ?") public void checkExpiry() { // 检测正式用户是否快要过期 QueryWrapper qw = new QueryWrapper<>(); diff --git a/src/main/java/com/ai/da/common/constant/AlipayHKConstant.java b/src/main/java/com/ai/da/common/constant/AlipayHKConstant.java new file mode 100644 index 00000000..aa290cc1 --- /dev/null +++ b/src/main/java/com/ai/da/common/constant/AlipayHKConstant.java @@ -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"; +} diff --git a/src/main/java/com/ai/da/common/enums/LibraryLevel1TypeEnum.java b/src/main/java/com/ai/da/common/enums/LibraryLevel1TypeEnum.java index bed5a60c..d3441eb7 100644 --- a/src/main/java/com/ai/da/common/enums/LibraryLevel1TypeEnum.java +++ b/src/main/java/com/ai/da/common/enums/LibraryLevel1TypeEnum.java @@ -27,7 +27,8 @@ public enum LibraryLevel1TypeEnum { /** * 模特 */ - MODELS("Models"); + MODELS("Models"), + DESIGN_ELEMENTS("DesignElements"); private String realName; diff --git a/src/main/java/com/ai/da/common/enums/PayTypeEnum.java b/src/main/java/com/ai/da/common/enums/PayTypeEnum.java index 70067578..5bc14b21 100644 --- a/src/main/java/com/ai/da/common/enums/PayTypeEnum.java +++ b/src/main/java/com/ai/da/common/enums/PayTypeEnum.java @@ -19,7 +19,12 @@ public enum PayTypeEnum { /** * PayPal */ - PAYPAL("PayPal"); + PAYPAL("PayPal"), + + /** + * 香港支付宝 + */ + ALIPAY_HK("Alipay-HK"); /** * 类型 diff --git a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java index 9e404107..24f96520 100644 --- a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java +++ b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java @@ -49,7 +49,7 @@ public class AuthenticationFilter extends OncePerRequestFilter { "/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" ); @Override @@ -89,7 +89,7 @@ public class AuthenticationFilter extends OncePerRequestFilter { 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); diff --git a/src/main/java/com/ai/da/common/task/GenerateTask.java b/src/main/java/com/ai/da/common/task/GenerateTask.java index 6d13d68f..038976d0 100644 --- a/src/main/java/com/ai/da/common/task/GenerateTask.java +++ b/src/main/java/com/ai/da/common/task/GenerateTask.java @@ -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"); diff --git a/src/main/java/com/ai/da/common/task/PaypalTask.java b/src/main/java/com/ai/da/common/task/PaypalTask.java index bc0e24dd..65d5b8a3 100644 --- a/src/main/java/com/ai/da/common/task/PaypalTask.java +++ b/src/main/java/com/ai/da/common/task/PaypalTask.java @@ -23,7 +23,7 @@ public class PaypalTask { @Resource private PayPalCheckoutService payPalCheckoutService; - @Scheduled(cron = "0/30 * * * * ?") +// @Scheduled(cron = "0/30 * * * * ?") public void orderConfirm() throws SerializeException { log.info("PayPal orderConfirm 被执行......"); diff --git a/src/main/java/com/ai/da/common/utils/AlipayHKEncryptionUtil.java b/src/main/java/com/ai/da/common/utils/AlipayHKEncryptionUtil.java index 205c7f94..5e8662a3 100644 --- a/src/main/java/com/ai/da/common/utils/AlipayHKEncryptionUtil.java +++ b/src/main/java/com/ai/da/common/utils/AlipayHKEncryptionUtil.java @@ -6,9 +6,16 @@ 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.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; import javax.crypto.*; import javax.crypto.spec.IvParameterSpec; @@ -25,22 +32,24 @@ 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("${alipay.hk.rsaPublicKey}") - private static String publicKeyPath; /** * 加密 @@ -55,7 +64,7 @@ public class AlipayHKEncryptionUtil { * @throws BadPaddingException * @throws IOException */ - public static AlipayHKRequestDTO AESCBCWithRSA(HashMap param, String serviceName) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, IOException { + public AlipayHKRequestDTO AESCBCWithRSA(HashMap 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 @@ -187,7 +196,7 @@ public class AlipayHKEncryptionUtil { /** * 使用 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 +210,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"); @@ -326,4 +335,29 @@ public class AlipayHKEncryptionUtil { random.nextBytes(iv); return iv; } + + public Boolean signatureVerification(String data, String signatureBase64){ + + Base64.Decoder decoder = Base64.getDecoder(); + // Verify key + try { +// PublicKey publicKey = readPublicKey(new File(publicKeyPath)); + InputStreamReader isrPub = new InputStreamReader(new FileInputStream(publicKeyPath)); + PEMParser pemParserPub = new PEMParser(isrPub); + SubjectPublicKeyInfo pubInfo = (SubjectPublicKeyInfo) pemParserPub.readObject(); + AsymmetricKeyParameter pubKey = PublicKeyFactory.createKey(pubInfo); + // Verifying + RSADigestSigner verifier = new RSADigestSigner(new SHA256Digest()); + verifier.init(false, pubKey); + byte[] signMessageForVerifing = data.getBytes(); + byte[] signatureBase64ForVerifing = decoder.decode(signatureBase64); + verifier.update(signMessageForVerifing, 0, signMessageForVerifing.length); + Boolean verifyResult = verifier.verifySignature(signatureBase64ForVerifing); + return verifyResult; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + } diff --git a/src/main/java/com/ai/da/common/utils/AlipayHKRequestUtil.java b/src/main/java/com/ai/da/common/utils/AlipayHKRequestUtil.java index 331c01ed..a980e477 100644 --- a/src/main/java/com/ai/da/common/utils/AlipayHKRequestUtil.java +++ b/src/main/java/com/ai/da/common/utils/AlipayHKRequestUtil.java @@ -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 createOrder(AlipayHKRequestDTO alipayHKRequestDTO) throws IOException { OkHttpClient client = new OkHttpClient().newBuilder() .connectTimeout(30, TimeUnit.SECONDS) .pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒) @@ -32,22 +34,29 @@ public class AlipayHKRequestUtil { 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); + } } } diff --git a/src/main/java/com/ai/da/common/utils/MinioUtil.java b/src/main/java/com/ai/da/common/utils/MinioUtil.java index 352b4d79..9341e3ea 100644 --- a/src/main/java/com/ai/da/common/utils/MinioUtil.java +++ b/src/main/java/com/ai/da/common/utils/MinioUtil.java @@ -16,6 +16,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; @@ -126,6 +127,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: 上传文件 * @@ -415,6 +436,13 @@ public class MinioUtil { return false; } } + + public String base64Upload(String base64, String bucketName){ + String[] parts = base64.split(","); + String imageType = parts[0].split("/")[1].split(";")[0]; + String base64Data = parts[1]; + return uploadImageFromBase64(bucketName, base64Data, imageType); + } } diff --git a/src/main/java/com/ai/da/common/utils/SendEmailUtil.java b/src/main/java/com/ai/da/common/utils/SendEmailUtil.java index 73c4eb17..d72e41c6 100644 --- a/src/main/java/com/ai/da/common/utils/SendEmailUtil.java +++ b/src/main/java/com/ai/da/common/utils/SendEmailUtil.java @@ -357,7 +357,10 @@ public class SendEmailUtil { } 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); @@ -376,8 +379,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); diff --git a/src/main/java/com/ai/da/controller/AlipayHKController.java b/src/main/java/com/ai/da/controller/AlipayHKController.java index 9b2fca11..38f2da9b 100644 --- a/src/main/java/com/ai/da/controller/AlipayHKController.java +++ b/src/main/java/com/ai/da/controller/AlipayHKController.java @@ -1,22 +1,40 @@ 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; +import java.util.Map; @CrossOrigin @RestController -@RequestMapping("/api/ali-pay-hk") +@RequestMapping("/api/alipay-hk") @Api(tags = "网站支付 香港支付宝") @Slf4j public class AlipayHKController { - public Response createOrder(){ - return Response.success(); + @Resource + private AlipayHKService alipayHKService; + + @ApiOperation(value = "创建订单") + @PostMapping(value = "/createOrder") + public Response createOrder(@RequestParam Integer amount, @RequestParam String wallet) { + String order = alipayHKService.createOrder(amount, wallet); + return Response.success(order); + } + + @ApiOperation("支付通知") + @PostMapping("/trade/notify") + public String callback(@RequestParam Map params){ + return alipayHKService.callback(params); } + + + } diff --git a/src/main/java/com/ai/da/controller/PortfolioController.java b/src/main/java/com/ai/da/controller/PortfolioController.java new file mode 100644 index 00000000..32337e46 --- /dev/null +++ b/src/main/java/com/ai/da/controller/PortfolioController.java @@ -0,0 +1,59 @@ +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.PortfolioDTO; +import com.ai.da.model.dto.QueryPortfolioPageDTO; +import com.ai.da.model.vo.PortfolioVO; +import com.ai.da.model.vo.UserLikeChooseVO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +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 preLogin(@Valid @RequestBody PortfolioDTO portfolioDTO) { + return Response.success(portfolioService.publish(portfolioDTO)); + } + + @ApiOperation(value = "作品集page") + @PostMapping("/page") + public Response> page(@Valid @RequestBody QueryPortfolioPageDTO query) { + return Response.success(portfolioService.page(query)); + } + + @ApiOperation(value = "作品详情") + @PostMapping("/detail") + public Response detail(@Valid @RequestBody PortfolioDTO portfolioDTO) { + return Response.success(portfolioService.detail(portfolioDTO)); + } + + @ApiOperation(value = "选择作品") + @PostMapping("/choose") + public Response choose(@Valid @RequestBody PortfolioDTO portfolioDTO) { + return Response.success(portfolioService.choose(portfolioDTO)); + } + + @ApiOperation(value = "更新作品") + @PostMapping("/update") + public Response update(@Valid @RequestBody PortfolioDTO portfolioDTO) { + return Response.success(portfolioService.update(portfolioDTO)); + } +} diff --git a/src/main/java/com/ai/da/controller/WorkspaceController.java b/src/main/java/com/ai/da/controller/WorkspaceController.java index b0c089f0..883239a2 100644 --- a/src/main/java/com/ai/da/controller/WorkspaceController.java +++ b/src/main/java/com/ai/da/controller/WorkspaceController.java @@ -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 detail(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) { - Workspace detail = workspaceService.getByIdNew(id); + public Response 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)); } @@ -115,10 +118,17 @@ public class WorkspaceController { } @PostMapping("maleDataInsert") - @ApiOperationSupport(order = 7) + @ApiOperationSupport(order = 8) @ApiOperation(value = "男装数据入库入minio") public Response maleDataInsert() throws FileNotFoundException { workspaceService.maleDataInsert(); return Response.success(true); } + + @PostMapping("styleList") + @ApiOperationSupport(order = 9) + @ApiOperation(value = "获取style列表") + public Response> styleList() { + return Response.success(workspaceService.styleList()); + } } diff --git a/src/main/java/com/ai/da/mapper/primary/PortfolioMapper.java b/src/main/java/com/ai/da/mapper/primary/PortfolioMapper.java new file mode 100644 index 00000000..54ef023b --- /dev/null +++ b/src/main/java/com/ai/da/mapper/primary/PortfolioMapper.java @@ -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.Portfolio; + +public interface PortfolioMapper extends CommonMapper { +} diff --git a/src/main/java/com/ai/da/mapper/primary/StyleMapper.java b/src/main/java/com/ai/da/mapper/primary/StyleMapper.java new file mode 100644 index 00000000..be697be8 --- /dev/null +++ b/src/main/java/com/ai/da/mapper/primary/StyleMapper.java @@ -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