From 36e41ecd897dbd04e6c30be7a3065b6e78cd8bae Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 17 Jul 2024 15:28:55 +0800 Subject: [PATCH 1/5] =?UTF-8?q?push=20to=20prod=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/common/RabbitMQ/MQConfig.java | 20 +++++++++---------- src/main/resources/application.properties | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java b/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java index 4eebfa78..337f12dd 100644 --- a/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java +++ b/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java @@ -11,24 +11,24 @@ public class MQConfig { // public static final String GENERATE_QUEUE = "generate-queue-prod"; // public static final String GENERATE_QUEUE = "generate-queue-test"; // ================================================================== - public static final String GENERATE_QUEUE = "generate-queue-local"; +// public static final String GENERATE_QUEUE = "generate-queue-local"; // public static final String GENERATE_QUEUE = "generate-queue-dev"; -// public static final String GENERATE_QUEUE = "generate-queue-prod"; + 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-local"; // public static final String SR_QUEUE = "SR-queue-dev"; -// public static final String SR_QUEUE = "SR-queue-prod"; + 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-local"; // public static final String SR_RESULT_QUEUE = "SuperResolution-dev"; -// public static final String SR_RESULT_QUEUE = "SuperResolution-prod"; + public static final String SR_RESULT_QUEUE = "SuperResolution-prod"; // - public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local"; -// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod"; +// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local"; + public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod"; - public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-local"; + public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod"; - public static final String RELIGHT_RESULT_QUEUE = "Relight-local"; + public static final String RELIGHT_RESULT_QUEUE = "Relight-prod"; public MQConfig() { } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 974fee23..8550475d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,7 +2,7 @@ #spring.profiles.active=test #����application-prod�ļ�(��������) -#spring.profiles.active=prod +spring.profiles.active=prod #����application-dev�ļ�(��������) -spring.profiles.active=dev +#spring.profiles.active=dev From 440dfdccebf8490658de658ac6fe4ceb46c49c49 Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 17 Jul 2024 15:32:58 +0800 Subject: [PATCH 2/5] =?UTF-8?q?push=20to=20prod=20=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ai/da/common/task/AccountTask.java | 4 ++-- src/main/java/com/ai/da/common/task/PaypalTask.java | 4 ++-- src/main/java/com/ai/da/common/task/StripeTask.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/ai/da/common/task/AccountTask.java b/src/main/java/com/ai/da/common/task/AccountTask.java index 32b0eb70..902d74f9 100644 --- a/src/main/java/com/ai/da/common/task/AccountTask.java +++ b/src/main/java/com/ai/da/common/task/AccountTask.java @@ -15,7 +15,7 @@ public class AccountTask { private AccountService accountService; /** 每周日晚上刷新 年付用户、月付用户的积分 */ -// @Scheduled(cron = "59 59 23 ? * SUN") + @Scheduled(cron = "59 59 23 ? * SUN") // @Scheduled(cron = "59 59 23 * * ?") public void refreshCreditsMonthly(){ log.info("每周日晚11:59:59刷新付费用户积分为 6000"); @@ -23,7 +23,7 @@ public class AccountTask { } // todo 多久执行一次? -// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes + @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes public void getPaidUser(){ // 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单 accountService.extendValidityForCC(); 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 b36c377a..865eaaa4 100644 --- a/src/main/java/com/ai/da/common/task/PaypalTask.java +++ b/src/main/java/com/ai/da/common/task/PaypalTask.java @@ -23,12 +23,12 @@ public class PaypalTask { @Resource private PayPalCheckoutService payPalCheckoutService; -// @Scheduled(cron = "0/30 * * * * ?") + @Scheduled(cron = "0/30 * * * * ?") public void orderConfirm() throws SerializeException { // log.info("PayPal orderConfirm 被执行......"); - List orderInfoList = orderInfoService.getNoPayOrderByDuration(5, PayTypeEnum.PAYPAL.getType()); + List orderInfoList = orderInfoService.getNoPayOrderByDuration(30, PayTypeEnum.PAYPAL.getType()); for (OrderInfo orderInfo : orderInfoList) { String orderNo = orderInfo.getOrderNo(); diff --git a/src/main/java/com/ai/da/common/task/StripeTask.java b/src/main/java/com/ai/da/common/task/StripeTask.java index d4a6fbaf..45d98997 100644 --- a/src/main/java/com/ai/da/common/task/StripeTask.java +++ b/src/main/java/com/ai/da/common/task/StripeTask.java @@ -22,7 +22,7 @@ public class StripeTask { @Resource private StripeService stripeService; -// @Scheduled(cron = "0/30 * * * * ?") + @Scheduled(cron = "0/30 * * * * ?") public void orderConfirm() throws SerializeException { // 查看超过30分钟以上仍未支付的订单 置为超时订单 From 5858f7dcf1e18d7c04f71ed9d276a3638008e98d Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 17 Jul 2024 16:05:33 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0stripe=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=88=B0=E8=BF=87=E6=BB=A4=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-dev.properties | 2 +- src/main/resources/application-prod.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 18d03e9c..5beb50fd 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -19,7 +19,7 @@ spring.security.jwtExpiration=8640000000 #spring security权限设置 认证了token还要认证权限 不然报错Full authentication is required to access this resource spring.security.ignorePaths=/,/favicon.ico,/doc.html,/webjars/**,/swagger-resources,/v2/api-docs,\ /api/account/**,/api/element/**,/api/python/**,/api/design/**,/api/history/**,/api/library/**,/api/third/party/**,/api/generate/**,/api/workspace/**,/api/classification/**,\ - /api/product/**,/api/ali-pay/**,/api/order-info/**,/api/paypal/**,/api/credits/**,/api/inquiry/**,/api/tasks/**,/api/python/prepareForSR,/api/alipay-hk/**,/api/portfolio/** + /api/product/**,/api/ali-pay/**,/api/order-info/**,/api/paypal/**,/api/credits/**,/api/inquiry/**,/api/tasks/**,/api/python/prepareForSR,/api/alipay-hk/**,/api/portfolio/**,/api/stripe/** spring.security.authApi=/auth/login diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 99fd8f26..4cdf0386 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -20,7 +20,7 @@ spring.security.jwtExpiration=8640000000 #spring security权限设置 认证了token还要认证权限 不然报错Full authentication is required to access this resource spring.security.ignorePaths=/,/favicon.ico,/doc.html,/webjars/**,/swagger-resources,/v2/api-docs,\ /api/account/**,/api/element/**,/api/python/**,/api/design/**,/api/history/**,/api/library/**,/api/third/party/**,/api/generate/**,/api/workspace/**,/api/classification/**,\ - /api/product/**,/api/ali-pay/**,/api/order-info/**,/api/paypal/**,/api/credits/**,/api/inquiry/**,/api/tasks/**,/api/python/prepareForSR,/api/alipay-hk/**,/api/portfolio/** + /api/product/**,/api/ali-pay/**,/api/order-info/**,/api/paypal/**,/api/credits/**,/api/inquiry/**,/api/tasks/**,/api/python/prepareForSR,/api/alipay-hk/**,/api/portfolio/**,/api/stripe/** spring.security.authApi=/auth/login From 4626ea3c55807496b3061e4da072cb5c8e5e3b41 Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 17 Jul 2024 16:21:05 +0800 Subject: [PATCH 4/5] prod stripe->live --- src/main/resources/payment.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/payment.properties b/src/main/resources/payment.properties index 0f1d2b4e..b42ffac7 100644 --- a/src/main/resources/payment.properties +++ b/src/main/resources/payment.properties @@ -32,9 +32,9 @@ paypal.webhook_id=31797347YC028794L #stripe.webhook-sign-secret=whsec_e0dBiJngx6qqgJj6yPyJ2A9ouh1Cjv5w # kim - test -stripe.private-key=sk_test_51LwPrxH7nPZ8bkrNj67TFD7sxucaTANs1lf0KGSu1QSJfxYXcnigq2wTaZyZzST7y0fMbhhvaJZ4LjjFhr95M83a00eXrmOTL0 -stripe.webhook-sign-secret=whsec_GoyVEAaBtuGD5Rt55z83JnPnLDAZTN3u +#stripe.private-key=sk_test_51LwPrxH7nPZ8bkrNj67TFD7sxucaTANs1lf0KGSu1QSJfxYXcnigq2wTaZyZzST7y0fMbhhvaJZ4LjjFhr95M83a00eXrmOTL0 +#stripe.webhook-sign-secret=whsec_GoyVEAaBtuGD5Rt55z83JnPnLDAZTN3u # kim - live -#stripe.private-key=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 -#stripe.webhook-sign-secret=whsec_hhGDgdelQRHSg4LmChtQe41crj41eb11 \ No newline at end of file +stripe.private-key=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 +stripe.webhook-sign-secret=whsec_hhGDgdelQRHSg4LmChtQe41crj41eb11 \ No newline at end of file From 56ebcfbce2cc9b2ee4a92a5d2397a1cf4bd16d04 Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 17 Jul 2024 17:17:04 +0800 Subject: [PATCH 5/5] =?UTF-8?q?stripe=20=E8=AE=BE=E7=BD=AE=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=93=BE=E6=8E=A5=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/service/impl/StripeServiceImpl.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/StripeServiceImpl.java b/src/main/java/com/ai/da/service/impl/StripeServiceImpl.java index 1f9933d5..2946f872 100644 --- a/src/main/java/com/ai/da/service/impl/StripeServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/StripeServiceImpl.java @@ -1,10 +1,12 @@ package com.ai.da.service.impl; +import com.ai.da.common.context.UserContext; import com.ai.da.common.enums.AliPayTradeStateEnum; import com.ai.da.common.enums.CreditsEventsEnum; import com.ai.da.common.enums.OrderStatusEnum; import com.ai.da.common.enums.PayTypeEnum; import com.ai.da.common.utils.OrderNoUtils; +import com.ai.da.mapper.primary.AccountMapper; import com.ai.da.mapper.primary.entity.OrderInfo; import com.ai.da.mapper.primary.entity.PaymentInfo; import com.ai.da.mapper.primary.entity.RefundInfo; @@ -48,6 +50,9 @@ public class StripeServiceImpl implements StripeService { @Resource private RefundInfoService refundInfoService; + @Resource + private AccountMapper accountMapper; + @Value("${stripe.private-key}") private String privateKey; @@ -61,6 +66,9 @@ public class StripeServiceImpl implements StripeService { log.info("生成订单"); OrderInfo orderInfo = orderInfoService.createOrderByProductId(quantity, PayTypeEnum.STRIPE.getType()); + Long id = UserContext.getUserHolder().getId(); + com.ai.da.mapper.primary.entity.Account account = accountMapper.selectById(id); + try { //创建产品 Map params = new HashMap<>(); @@ -83,8 +91,9 @@ public class StripeServiceImpl implements StripeService { //创建支付信息得到url SessionCreateParams params3 = SessionCreateParams.builder() .setMode(SessionCreateParams.Mode.PAYMENT) - .setSuccessUrl(returnUrl) - .setPaymentIntentData(SessionCreateParams.PaymentIntentData.builder().setDescription("AiDA - " + orderId).build())//可自定义成功页面 + .setSuccessUrl(returnUrl)//可自定义成功页面 + .setPaymentIntentData(SessionCreateParams.PaymentIntentData.builder().setDescription("AiDA - " + orderId).build()) + .setLocale(account.getLanguage().equals("CHINESE_SIMPLIFIED") ? SessionCreateParams.Locale.ZH : SessionCreateParams.Locale.EN) .addLineItem( SessionCreateParams.LineItem.builder() .setQuantity(Long.valueOf(quantity))