From 85ffed114b76a02c24b69b5ed0c7a9e52fa85ae5 Mon Sep 17 00:00:00 2001 From: xupei Date: Thu, 1 Aug 2024 10:07:24 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E8=AF=AD=E8=A8=80=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/messages_zh.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/messages_zh.properties b/src/main/resources/messages_zh.properties index e4bbeb87..f10a5235 100644 --- a/src/main/resources/messages_zh.properties +++ b/src/main/resources/messages_zh.properties @@ -177,8 +177,8 @@ OVERALL=整体 TOPS=上装 BOTTOMS=下装 OUTWEAR=外套 -BLOUSE=衬衫 -DRESS=长裙 +BLOUSE=上衣 +DRESS=连衣裙 TROUSERS=裤子 SKIRT=短裙 FEMALE=女装 From a10d30337ab3b1430b317d3693253a03d2628f05 Mon Sep 17 00:00:00 2001 From: xupei Date: Thu, 1 Aug 2024 10:30:44 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E4=B8=BAlive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/payment.properties | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/resources/payment.properties b/src/main/resources/payment.properties index b42ffac7..56e5a315 100644 --- a/src/main/resources/payment.properties +++ b/src/main/resources/payment.properties @@ -1,12 +1,12 @@ ##### PayPal # developer-sandbox-xp -paypal.client-id=ATbaebYi7-GXWRWJqwRLYMzKEbwjh4BFRqD4Y13i4lZq0rplWIM_IpPrtPKpdkAt_KrPXd6IJTwsDqa5 -paypal.client-secret=EHWWJqGmmbfjLXqCUpGrvxRYBPPtWvA3hR5ZaAyHlGSVJiHoQPS8skbNaJ9h39VObnchUbgiY2pPu__s -paypal.receiver.email=sb-ukxfk29608925@business.example.com -paypal.mode=sandbox +#paypal.client-id=ATbaebYi7-GXWRWJqwRLYMzKEbwjh4BFRqD4Y13i4lZq0rplWIM_IpPrtPKpdkAt_KrPXd6IJTwsDqa5 +#paypal.client-secret=EHWWJqGmmbfjLXqCUpGrvxRYBPPtWvA3hR5ZaAyHlGSVJiHoQPS8skbNaJ9h39VObnchUbgiY2pPu__s +#paypal.receiver.email=sb-ukxfk29608925@business.example.com +#paypal.mode=sandbox # local -paypal.webhook_id=31797347YC028794L +#paypal.webhook_id=31797347YC028794L # dev #paypal.webhook_id=51V87014T6406322F @@ -18,12 +18,11 @@ paypal.webhook_id=31797347YC028794L #paypal.webhook_id=1WH327112B602422N # aida-live-kim -#paypal.client-id=ASWSIZ3MXJU5w5VOeOHeigWcSw6iinl30ZCipruziKpHclxP0ryf8-7VKG1Ba2VwZwa2DMvGEzTfCTgz -#paypal.client-secret=EHQg_K5PSqmp4FJlzEcOEH_kFkmq4aBzaI7jridw53L6cOQRULBAnfv2KakRfrsqaU1PDSkO4Co9Vyxc -#paypal.receiver.email=kimwong@code-create.com.hk -#paypal.mode=live -#paypal.webhook_id=41L14847MC833625B -#paypal.webhook_id=1D107312EX592781K +paypal.client-id=ASWSIZ3MXJU5w5VOeOHeigWcSw6iinl30ZCipruziKpHclxP0ryf8-7VKG1Ba2VwZwa2DMvGEzTfCTgz +paypal.client-secret=EHQg_K5PSqmp4FJlzEcOEH_kFkmq4aBzaI7jridw53L6cOQRULBAnfv2KakRfrsqaU1PDSkO4Co9Vyxc +paypal.receiver.email=kimwong@code-create.com.hk +paypal.mode=live +paypal.webhook_id=1D107312EX592781K ##### Stripe From fada00c7388d1400f458c2699ba7a7351a527bcd Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 2 Aug 2024 11:36:58 +0800 Subject: [PATCH 03/18] =?UTF-8?q?BUGFIX:=E8=BF=87=E6=BB=A4=E5=B7=B2?= =?UTF-8?q?=E5=BA=9F=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../secondary/AttributeRetrievalMapper.java | 6 ++-- .../java/com/ai/da/python/PythonService.java | 33 ++++++++++++++----- .../secondary/AttributeRetrievalMapper.xml | 12 +++++-- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/ai/da/mapper/secondary/AttributeRetrievalMapper.java b/src/main/java/com/ai/da/mapper/secondary/AttributeRetrievalMapper.java index 1c3be31b..772d63df 100644 --- a/src/main/java/com/ai/da/mapper/secondary/AttributeRetrievalMapper.java +++ b/src/main/java/com/ai/da/mapper/secondary/AttributeRetrievalMapper.java @@ -17,11 +17,11 @@ import java.util.List; public interface AttributeRetrievalMapper { - List getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style); + List getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style, @Param("isFemaleTable") boolean isFemaleTable); - AttributeRetrieval getSystemRandom(String tableName, String style); + AttributeRetrieval getSystemRandom(String tableName, String style, boolean isFemaleTable); - List getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style); + List getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style, boolean isFemaleTable); Long getIdByFileName(String fileName, String tableName); diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index 3dd32bb3..0dd6163c 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -644,14 +644,18 @@ public class PythonService { AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON); String tableName; tableName = getTableName(modelSex, styleCategory); - List attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style); + boolean isFemaleTable = false; + if (tableName.contains("female")) { + isFemaleTable = true; + } + List attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable); if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) { attributeRetrievalAttrDict.setDesign(null); - attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style); + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable); } if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) { attributeRetrievalAttrDict.setSilhouette(null); - attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style); + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable); } return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex); } @@ -670,7 +674,10 @@ public class PythonService { AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON); String tableName; tableName = getTableName(modelSex, styleCategory); - + boolean isFemaleTable = false; + if (tableName.contains("female")) { + isFemaleTable = true; + } // 存储非空字段的列表 List nonNullFields = new ArrayList<>(); if (attributeRetrievalAttrDict.getType() != null) { @@ -712,7 +719,7 @@ public class PythonService { } } - List attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); + List attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable); if (CollectionUtil.isEmpty(attributeRetrievalList)) { System.out.println(attributeRetrievalAttrDict); System.out.println(tableName); @@ -720,12 +727,12 @@ public class PythonService { attributeRetrievalAttrDict.setType(null); attributeRetrievalAttrDict.setOpeningType(null); attributeRetrievalAttrDict.setSubtype(null); - attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable); }else { attributeRetrievalAttrDict.setType(null); attributeRetrievalAttrDict.setOpeningType(null); attributeRetrievalAttrDict.setSubtype(null); - attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable); } } return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex); @@ -946,7 +953,11 @@ public class PythonService { Integer randomNum = RandomsUtil.randomSysFile(dressings.size()); String category = dressings.get(randomNum).getStyleCategory(); String tableName = getTableName(validateElementVO.getModelSex(), category); - AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle()); + boolean isFemaleTable = false; + if (tableName.contains("female")) { + isFemaleTable = true; + } + AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle(), isFemaleTable); CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex()); return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO); } @@ -986,7 +997,11 @@ public class PythonService { Integer randomNum = RandomsUtil.randomSysFile(dressings.size()); String category = dressings.get(randomNum).getStyleCategory(); String tableName = getTableName(validateElementVO.getModelSex(), category); - AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle()); + boolean isFemaleTable = false; + if (tableName.contains("female")) { + isFemaleTable = true; + } + AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle(), isFemaleTable); CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex()); return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO); } diff --git a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml index bcdfa819..ed6bc6a6 100644 --- a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml +++ b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml @@ -32,7 +32,9 @@ AND style = #{style} - + + AND deprecated = 0 + ORDER BY RAND() @@ -48,7 +50,9 @@ AND style = #{style} - + + AND deprecated = 0 + ORDER BY RAND() @@ -73,7 +77,9 @@ AND style = #{style} - + + AND deprecated = 0 + ORDER BY RAND() From 653264151ad785572b7883a768e7cfd11c003e10 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 2 Aug 2024 11:53:50 +0800 Subject: [PATCH 04/18] =?UTF-8?q?BUGFIX:=E8=BF=87=E6=BB=A4=E5=B7=B2?= =?UTF-8?q?=E5=BA=9F=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ai/da/python/PythonService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index 0dd6163c..4285aea5 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -728,11 +728,12 @@ public class PythonService { attributeRetrievalAttrDict.setOpeningType(null); attributeRetrievalAttrDict.setSubtype(null); attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable); - }else { - attributeRetrievalAttrDict.setType(null); - attributeRetrievalAttrDict.setOpeningType(null); - attributeRetrievalAttrDict.setSubtype(null); + } + + if (CollectionUtil.isEmpty(attributeRetrievalList)) { + style = null; attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable); + } } return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex); From 7aa1fc0342424c5622c8b8486ff63c967aa2082e Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 2 Aug 2024 11:56:17 +0800 Subject: [PATCH 05/18] =?UTF-8?q?BUGFIX:=E8=BF=87=E6=BB=A4=E5=B7=B2?= =?UTF-8?q?=E5=BA=9F=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ai/da/python/PythonService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index 4285aea5..789866e5 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -657,6 +657,10 @@ public class PythonService { attributeRetrievalAttrDict.setSilhouette(null); attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable); } + if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) { + style = null; + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable); + } return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex); } From 685ba09f7d319da9aa8620e5304e97c67c7ef561 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 2 Aug 2024 12:13:32 +0800 Subject: [PATCH 06/18] =?UTF-8?q?BUGFIX:=E8=BF=87=E6=BB=A4=E5=B7=B2?= =?UTF-8?q?=E5=BA=9F=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/secondary/AttributeRetrievalMapper.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml index ed6bc6a6..c8ac3ccf 100644 --- a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml +++ b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml @@ -33,7 +33,7 @@ AND style = #{style} - AND deprecated = 0 + AND deprecated != 1 ORDER BY @@ -51,7 +51,7 @@ AND style = #{style} - AND deprecated = 0 + AND deprecated != 1 ORDER BY @@ -78,7 +78,7 @@ AND style = #{style} - AND deprecated = 0 + AND deprecated != 1 ORDER BY From e0332b9ddfb5bc31c1478391070b8ba4a577e9ae Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 2 Aug 2024 12:21:30 +0800 Subject: [PATCH 07/18] =?UTF-8?q?BUGFIX:=E8=BF=87=E6=BB=A4=E5=B7=B2?= =?UTF-8?q?=E5=BA=9F=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/secondary/AttributeRetrievalMapper.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml index c8ac3ccf..b3ae0138 100644 --- a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml +++ b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml @@ -33,7 +33,7 @@ AND style = #{style} - AND deprecated != 1 + AND deprecated is null ORDER BY @@ -51,7 +51,7 @@ AND style = #{style} - AND deprecated != 1 + AND deprecated is null ORDER BY @@ -78,7 +78,7 @@ AND style = #{style} - AND deprecated != 1 + AND deprecated is null ORDER BY From 5a09d7a195b4722c42dedc31b9092eab2471d1b9 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 2 Aug 2024 12:28:58 +0800 Subject: [PATCH 08/18] =?UTF-8?q?BUGFIX:=E8=BF=87=E6=BB=A4=E5=B7=B2?= =?UTF-8?q?=E5=BA=9F=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/secondary/AttributeRetrievalMapper.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml index b3ae0138..ed6bc6a6 100644 --- a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml +++ b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml @@ -33,7 +33,7 @@ AND style = #{style} - AND deprecated is null + AND deprecated = 0 ORDER BY @@ -51,7 +51,7 @@ AND style = #{style} - AND deprecated is null + AND deprecated = 0 ORDER BY @@ -78,7 +78,7 @@ AND style = #{style} - AND deprecated is null + AND deprecated = 0 ORDER BY From 94927ae0a4856632f9a608d78d7aba39dbfd81c6 Mon Sep 17 00:00:00 2001 From: xupei Date: Mon, 5 Aug 2024 15:48:50 +0800 Subject: [PATCH 09/18] modify --- .../com/ai/da/common/RabbitMQ/MQConfig.java | 21 +++++++++++-------- .../com/ai/da/common/task/AccountTask.java | 4 ++-- .../com/ai/da/common/task/AliPayTask.java | 2 +- src/main/resources/application.properties | 4 ++-- 4 files changed, 17 insertions(+), 14 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 337f12dd..b6565c86 100644 --- a/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java +++ b/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java @@ -12,23 +12,26 @@ 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-prod"; + public static final String GENERATE_QUEUE = "generate-queue-dev"; +// public static final String GENERATE_QUEUE = "generate-queue-prod"; // // public static final String SR_QUEUE = "SR-queue-local"; -// public static final String SR_QUEUE = "SR-queue-dev"; - public static final String SR_QUEUE = "SR-queue-prod"; + public static final String SR_QUEUE = "SR-queue-dev"; +// public static final String SR_QUEUE = "SR-queue-prod"; // // public static final String SR_RESULT_QUEUE = "SuperResolution-local"; -// public static final String SR_RESULT_QUEUE = "SuperResolution-dev"; - public static final String SR_RESULT_QUEUE = "SuperResolution-prod"; + public static final String SR_RESULT_QUEUE = "SuperResolution-dev"; +// public static final String SR_RESULT_QUEUE = "SuperResolution-prod"; // // public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local"; - public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod"; + public static final String 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 TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-dev"; +// public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod"; - public static final String RELIGHT_RESULT_QUEUE = "Relight-prod"; + public static final String RELIGHT_RESULT_QUEUE = "Relight-dev"; +// public static final String RELIGHT_RESULT_QUEUE = "Relight-prod"; public MQConfig() { } 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 0151665d..96f6e962 100644 --- a/src/main/java/com/ai/da/common/task/AccountTask.java +++ b/src/main/java/com/ai/da/common/task/AccountTask.java @@ -31,7 +31,7 @@ public class AccountTask { } // 每天凌晨0点执行一次 -// @Scheduled(cron = "0 0 0 * * ?") + @Scheduled(cron = "0 0 0 * * ?") public void cancelActivityBenefits(){ // 1、查询当前所有参与了活动且过期的用户 List accountList = accountService.getExpiredUserBySystemUser(4); @@ -44,7 +44,7 @@ public class AccountTask { } // 每天检测正式用户到期情况,每天凌晨0点执行 -// @Scheduled(cron = "0 0 0 * * ?") + @Scheduled(cron = "0 0 0 * * ?") public void paidUserToVisitor(){ // 1、查询当前已过期正式用户或试用用户 List accountList = accountService.getExpiredUserBySystemUser(1); diff --git a/src/main/java/com/ai/da/common/task/AliPayTask.java b/src/main/java/com/ai/da/common/task/AliPayTask.java index 670a417c..f099752e 100644 --- a/src/main/java/com/ai/da/common/task/AliPayTask.java +++ b/src/main/java/com/ai/da/common/task/AliPayTask.java @@ -24,7 +24,7 @@ public class AliPayTask { /** * 从第0秒开始每隔30秒执行1次,查询创建超过5分钟,并且未支付的订单 */ -// @Scheduled(cron = "0/30 * * * * ?") + @Scheduled(cron = "0/30 * * * * ?") public void orderConfirm(){ // log.info("Alipay orderConfirm 被执行......"); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8550475d..974fee23 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 36a796b38b9f5a193e53d1d2326fea6daa6c9bf0 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Mon, 5 Aug 2024 17:44:53 +0800 Subject: [PATCH 10/18] =?UTF-8?q?BUGFIX:=E5=A4=9A=E4=B8=AA=E5=8D=B0?= =?UTF-8?q?=E8=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ai/da/service/impl/PortfolioServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java index a002c37d..295ac54b 100644 --- a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java @@ -657,8 +657,8 @@ public class PortfolioServiceImpl extends ServiceImpl designItemDetailPrintQueryWrapper = new QueryWrapper<>(); designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld); - DesignItemDetailPrint designItemDetailPrint = designItemDetailPrintMapper.selectOne(designItemDetailPrintQueryWrapper); - if (Objects.nonNull(designItemDetailPrint)) { + List designItemDetailPrintList = designItemDetailPrintMapper.selectList(designItemDetailPrintQueryWrapper); + for (DesignItemDetailPrint designItemDetailPrint : designItemDetailPrintList) { designItemDetailPrint.setId(null); designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew); designItemDetailPrintMapper.insert(designItemDetailPrint); From d4eb7c846bc86c87e7da8a86074a4fb5d0a5c102 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 6 Aug 2024 11:35:11 +0800 Subject: [PATCH 11/18] to dev --- src/main/java/com/ai/da/common/config/MyTaskScheduler.java | 4 ++-- src/main/java/com/ai/da/common/task/AccountTask.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 69f2ffd9..df7d8677 100644 --- a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java +++ b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java @@ -49,7 +49,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<>(); @@ -83,7 +83,7 @@ public class MyTaskScheduler { } } } - @Scheduled(cron = "0 0 8 * * ?") +// @Scheduled(cron = "0 0 8 * * ?") public void sendTrialOrderExcelToManagements() { // 获取前一天日期 LocalDate yesterday = LocalDate.now().minusDays(1); 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 96f6e962..9e232d83 100644 --- a/src/main/java/com/ai/da/common/task/AccountTask.java +++ b/src/main/java/com/ai/da/common/task/AccountTask.java @@ -24,7 +24,7 @@ public class AccountTask { accountService.refreshCreditsWeekly(); } - @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(); From 388dd54bfa3f0529ab5c9b902ab98e9530b3977c Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 6 Aug 2024 11:41:48 +0800 Subject: [PATCH 12/18] to prod --- .../com/ai/da/common/RabbitMQ/MQConfig.java | 24 +++++++++---------- .../ai/da/common/config/MyTaskScheduler.java | 4 ++-- .../com/ai/da/common/task/AccountTask.java | 2 +- src/main/resources/application.properties | 4 ++-- 4 files changed, 17 insertions(+), 17 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 b6565c86..5442ae06 100644 --- a/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java +++ b/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java @@ -12,26 +12,26 @@ 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-prod"; +// public static final String GENERATE_QUEUE = "generate-queue-dev"; + public static final String GENERATE_QUEUE = "generate-queue-prod"; // // public static final String SR_QUEUE = "SR-queue-local"; - public static final String SR_QUEUE = "SR-queue-dev"; -// public static final String SR_QUEUE = "SR-queue-prod"; +// public static final String SR_QUEUE = "SR-queue-dev"; + public static final String SR_QUEUE = "SR-queue-prod"; // // public static final String SR_RESULT_QUEUE = "SuperResolution-local"; - public static final String SR_RESULT_QUEUE = "SuperResolution-dev"; -// public static final String SR_RESULT_QUEUE = "SuperResolution-prod"; +// public static final String 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 GENERATE_RESULT_QUEUE = "GenerateImage-dev"; + public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod"; - public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-dev"; -// public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod"; +// public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-dev"; + public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod"; - public static final String RELIGHT_RESULT_QUEUE = "Relight-dev"; -// public static final String RELIGHT_RESULT_QUEUE = "Relight-prod"; +// public static final String RELIGHT_RESULT_QUEUE = "Relight-dev"; + public static final String RELIGHT_RESULT_QUEUE = "Relight-prod"; public MQConfig() { } 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 df7d8677..69f2ffd9 100644 --- a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java +++ b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java @@ -49,7 +49,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<>(); @@ -83,7 +83,7 @@ public class MyTaskScheduler { } } } -// @Scheduled(cron = "0 0 8 * * ?") + @Scheduled(cron = "0 0 8 * * ?") public void sendTrialOrderExcelToManagements() { // 获取前一天日期 LocalDate yesterday = LocalDate.now().minusDays(1); 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 9e232d83..96f6e962 100644 --- a/src/main/java/com/ai/da/common/task/AccountTask.java +++ b/src/main/java/com/ai/da/common/task/AccountTask.java @@ -24,7 +24,7 @@ public class AccountTask { accountService.refreshCreditsWeekly(); } -// @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/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 89a234e77d108686e09b67766116a1aa46c99b58 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 6 Aug 2024 11:43:20 +0800 Subject: [PATCH 13/18] to prod --- src/main/java/com/ai/da/common/task/AliPayTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/ai/da/common/task/AliPayTask.java b/src/main/java/com/ai/da/common/task/AliPayTask.java index f099752e..670a417c 100644 --- a/src/main/java/com/ai/da/common/task/AliPayTask.java +++ b/src/main/java/com/ai/da/common/task/AliPayTask.java @@ -24,7 +24,7 @@ public class AliPayTask { /** * 从第0秒开始每隔30秒执行1次,查询创建超过5分钟,并且未支付的订单 */ - @Scheduled(cron = "0/30 * * * * ?") +// @Scheduled(cron = "0/30 * * * * ?") public void orderConfirm(){ // log.info("Alipay orderConfirm 被执行......"); From 3ccbd8f905a013e2912705b7e127eda585b0b948 Mon Sep 17 00:00:00 2001 From: xupei Date: Thu, 8 Aug 2024 10:13:47 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E7=BD=AE=E4=B8=BA?= =?UTF-8?q?=E6=B8=B8=E5=AE=A2=E6=97=A5=E5=BF=97=E6=B7=BB=E5=8A=A0?= 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 ++-- 1 file changed, 2 insertions(+), 2 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 96f6e962..53d43f67 100644 --- a/src/main/java/com/ai/da/common/task/AccountTask.java +++ b/src/main/java/com/ai/da/common/task/AccountTask.java @@ -38,7 +38,7 @@ public class AccountTask { // 2、将到期用户置为游客 for(Account account : accountList){ - log.info("参与活动的用户到期,置为游客"); + log.info("参与活动的用户{} : {} 于 {} 账号有效期到期,置为游客",account.getId(),account.getUserEmail(),account.getValidEndTime()); accountService.toVisitor(account); } } @@ -53,7 +53,7 @@ public class AccountTask { // 2、将到期用户置为游客 for(Account account : accountList){ - log.info("用户有效期到期,置为游客"); + log.info("用户{} : {} 于 {}账号有效期到期,置为游客", account.getId(), account.getUserEmail(),account.getValidEndTime()); accountService.toVisitor(account); } } From 7e5b10aab3e6732c338b8445ad4e60105a79ae56 Mon Sep 17 00:00:00 2001 From: xupei Date: Thu, 8 Aug 2024 10:54:22 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E9=80=9A=E8=BF=87=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=B4=A6=E6=88=B7=EF=BC=8C=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E9=82=AE=E7=AE=B1=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/service/impl/AccountServiceImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java index eec39d47..d57bb6b3 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -306,6 +306,16 @@ public class AccountServiceImpl extends ServiceImpl impl return accountList.get(0); } + private Account getByEmailIgnoreCase(String email) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("user_email", email); + List accountList = accountMapper.selectList(queryWrapper); + if (CollectionUtil.isEmpty(accountList)) { + throw new BusinessException("email.does.not.exist", ResultEnum.PROMPT.getCode()); + } + return accountList.get(0); + } + private Account getOneByUserName(String userName) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(Account::getUserName, userName); @@ -1094,7 +1104,7 @@ public class AccountServiceImpl extends ServiceImpl impl Boolean flag = Boolean.FALSE; try { // 不是新用户 直接延长使用期限 - userInfo = getOneByEmail(email); + userInfo = getByEmailIgnoreCase(email); } catch (BusinessException e) { // 通过邮箱找不到用户 说明是新用户 => 创建用户 flag = Boolean.TRUE; From 47dc2bfc6e63ec2d662eb4939e79d781c8f2bbe7 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Thu, 15 Aug 2024 16:37:24 +0800 Subject: [PATCH 16/18] =?UTF-8?q?BUGFIX:=E4=BA=8C=E5=88=9B=E5=8F=98?= =?UTF-8?q?=E5=8E=9F=E5=88=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SavedCollectionController.java | 22 +++++++++++-------- .../ai/da/service/impl/DesignServiceImpl.java | 13 ++++++----- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/ai/da/controller/SavedCollectionController.java b/src/main/java/com/ai/da/controller/SavedCollectionController.java index 228646dc..76addf89 100644 --- a/src/main/java/com/ai/da/controller/SavedCollectionController.java +++ b/src/main/java/com/ai/da/controller/SavedCollectionController.java @@ -104,9 +104,9 @@ public class SavedCollectionController { } List groupIds = page.getRecords().stream().map(UserLikeGroup::getId).collect(Collectors.toList()); List groupDetails = userLikeService.getGroupDetails(groupIds); - if (CollectionUtils.isEmpty(groupDetails)) { - throw new BusinessException("groupDetails.not.found"); - } +// if (CollectionUtils.isEmpty(groupDetails)) { +// throw new BusinessException("groupDetails.not.found"); +// } Map> groupDetailMap = groupDetails.stream() .collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId)); @@ -117,13 +117,17 @@ public class SavedCollectionController { userLikeGroupVO.setUpdateDate(group.getUpdateDate().getTime()); userLikeGroupVO.setAuthor(account.getUserName()); //count 和detail - List details = groupDetailMap.get(group.getId()); - for (UserLikeVO detail : details) { - TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId()); - detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60)); + if (groupDetailMap.keySet().contains(group.getId())) { + List details = groupDetailMap.get(group.getId()); + for (UserLikeVO detail : details) { + TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId()); + detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60)); + } + userLikeGroupVO.setGroupDetails(details); + userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size()); + }else { + userLikeGroupVO.setSketchCount(0); } - userLikeGroupVO.setGroupDetails(details); - userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size()); if (userLikeGroupVO.getOriginal() == 0) { userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName()); Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId()); diff --git a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java index 7f779570..35e0220b 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -813,9 +813,9 @@ public class DesignServiceImpl extends ServiceImpl impleme // return new DesignLikeVO(); // } List oldElements = collectionElementService.getByCollectionId(userLikeGroup.getCollectionId()); - if (CollectionUtil.isEmpty(oldElements)) { - throw new BusinessException("old.elements.not.found"); - } +// if (CollectionUtil.isEmpty(oldElements)) { +// throw new BusinessException("old.elements.not.found"); +// } List designItemDetails = designItemDetailService.selectByDesignItemId(designLikeDTO.getDesignItemId()); if (CollectionUtil.isEmpty(designItemDetails)) { throw new BusinessException("new.designItemDetails.not.found"); @@ -867,8 +867,11 @@ public class DesignServiceImpl extends ServiceImpl impleme if (CollectionUtils.isEmpty(hasCollections)) { return null; } - List oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList()); List elementIds = hasCollections.stream().map(DesignItemDetail::getCollectionElementId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(oldElements)) { + return elementIds; + } + List oldIds = oldElements.stream().map(CollectionElement::getId).collect(Collectors.toList()); //本次新增collection个数 List adds = elementIds.stream().filter(id -> !oldIds.contains(id)).collect(Collectors.toList()); if (CollectionUtils.isEmpty(adds)) { @@ -934,7 +937,7 @@ public class DesignServiceImpl extends ServiceImpl impleme List userLikeVOS = userLikeService.getGroupDetail(userLike.getUserLikeGroupId()); if (CollectionUtils.isEmpty(userLikeVOS)) { //group 下面没有元素时候 直接删除 - userLikeGroupService.removeById(userLike.getUserLikeGroupId()); +// userLikeGroupService.removeById(userLike.getUserLikeGroupId()); } return Boolean.TRUE; } From cebc05d132cb623e5c7ed51eaf624870f98a94be Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 27 Aug 2024 11:32:47 +0800 Subject: [PATCH 17/18] =?UTF-8?q?BUGFIX=EF=BC=9A=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=B3=BB=E7=BB=9F=20=E6=B7=BB=E5=8A=A0=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=82=AE=E7=AE=B1=E6=A0=A1=E9=AA=8C=EF=BC=8C?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E7=9A=84=E9=82=AE=E7=AE=B1=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=B8=80=E4=B8=AA=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/da/service/impl/ConvenientInquiryServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java b/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java index b664ed21..43c99f5a 100644 --- a/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java @@ -437,8 +437,16 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("user_email", account.getUserEmail()); + + Account existsAccount = accountMapper.selectOne(queryWrapper); + if (!Objects.isNull(existsAccount)){ + throw new BusinessException("The email address already exists. One email address can only register one AiDA account"); + } // 添加正式用户 + assert accountAddDTO != null; if (Objects.isNull(accountAddDTO.getSystemUser())) { throw new BusinessException("you have to choose user type"); } else { From 8ee6a529a0469e68258914d496a34378f6e37952 Mon Sep 17 00:00:00 2001 From: xupei Date: Mon, 2 Sep 2024 12:02:54 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=B9=BF=E5=9C=BA?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E5=B0=86=E7=82=B9=E8=B5=9E=E5=89=8D?= =?UTF-8?q?=E4=B8=89=E5=92=8C=E6=B5=8F=E8=A7=88=E9=87=8F=E5=89=8D=E4=B8=89?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E5=93=81=E6=94=BE=E5=9C=A8=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E6=9C=80=E5=89=8D=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/common/utils/RedisUtil.java | 20 ++- .../da/service/impl/PortfolioServiceImpl.java | 140 ++++++++++++++---- 2 files changed, 128 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/ai/da/common/utils/RedisUtil.java b/src/main/java/com/ai/da/common/utils/RedisUtil.java index 0d5c6153..902e50e0 100644 --- a/src/main/java/com/ai/da/common/utils/RedisUtil.java +++ b/src/main/java/com/ai/da/common/utils/RedisUtil.java @@ -7,10 +7,7 @@ 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.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -154,6 +151,8 @@ public class RedisUtil { return redisTemplate.keys(key); } + public Long getSize(String key){return redisTemplate.opsForSet().size(key);} + public List getMultiValue(Set keys){ return redisTemplate.opsForValue().multiGet(keys); } @@ -216,4 +215,17 @@ public class RedisUtil { return redisTemplate.opsForValue().increment(key, 0); } + public Long getViewCount(String key) { + Object value = redisTemplate.opsForValue().get(key); + if (value instanceof Integer) { + return Long.valueOf((Integer) value); + } else if (value instanceof Long) { + return (Long) value; + } else if (value instanceof String) { + return Long.valueOf((String) value); + } else { + throw new IllegalArgumentException("Unexpected value type"); + } + } + } diff --git a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java index 295ac54b..0fba4ddb 100644 --- a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java @@ -8,6 +8,7 @@ import com.ai.da.common.utils.MinioUtil; import com.ai.da.common.utils.RedisUtil; import com.ai.da.mapper.primary.*; import com.ai.da.mapper.primary.entity.*; +import com.ai.da.mapper.primary.entity.Collection; import com.ai.da.model.dto.*; import com.ai.da.model.enums.Position; import com.ai.da.model.enums.Sex; @@ -20,21 +21,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.base.Function; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.web.multipart.MultipartFile; -import sun.security.krb5.internal.crypto.Des; import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Objects; +import java.util.*; +import java.util.stream.Collectors; +@Slf4j @Service public class PortfolioServiceImpl extends ServiceImpl implements PortfolioService { @@ -60,8 +60,8 @@ public class PortfolioServiceImpl extends ServiceImpl likedPortfolioIdList = redisUtil.getLikedPortfolios(userHolder.getId()); if (!CollectionUtils.isEmpty(likedPortfolioIdList)) { qw.lambda().in(Portfolio::getId, likedPortfolioIdList); - }else { + } else { return PageBaseResponse.success(new Page<>()); } } + List topThree = new ArrayList<>(); + + if (query.getPage() == 1 && + (query.getGetMyPortfolio() != 1 || query.getGetLikePortfolio() != 1)) { + List topThreeLike = getTopThreeLikeFromRedis(RedisUtil.PORTFOLIO_LIKE_KEY); + log.info("top three like 的作品集的id : {}", topThreeLike); + List topThreeView = getTopThreeViewFromRedis(RedisUtil.PORTFOLIO_VIEW_KEY); + log.info("top three view 的作品集的id : {}", topThreeView); + QueryWrapper queryLike = new QueryWrapper<>(); + queryLike.in("id", topThreeLike); + QueryWrapper queryView = new QueryWrapper<>(); + queryView.in("id", topThreeView); + List topThreeLikePortfolio = baseMapper.selectList(queryLike); + List topThreeViewPortfolio = baseMapper.selectList(queryView); + topThree.addAll(topThreeLikePortfolio); + topThree.addAll(topThreeViewPortfolio); + } + qw.lambda().orderByDesc(Portfolio::getUpdateDate); - IPage page = portfolioMapper.selectPage(new Page<>(query.getPage(), query.getSize()),qw); + IPage page = portfolioMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw); + if (!topThree.isEmpty()) { + List records = page.getRecords(); + records.addAll(0, topThree); + page.setRecords(records); + } IPage convert = page.convert((Function) portfolio -> { if (portfolio != null) { PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class); @@ -481,11 +504,11 @@ public class PortfolioServiceImpl extends ServiceImpl getSelectedQw = new QueryWrapper<>(); getSelectedQw.lambda().eq(UserLikeGroup::getAccountId, userHolder.getId()); @@ -520,7 +543,7 @@ public class PortfolioServiceImpl extends ServiceImpl userLikeGroups = userLikeGroupMapper.selectList(getSelectedQw); if (CollectionUtils.isEmpty(userLikeGroups)) { vo.setSelected(0); - }else { + } else { vo.setSelected(1); } } @@ -547,12 +570,12 @@ public class PortfolioServiceImpl extends ServiceImpl getTopThreeLikeFromRedis(String prefix) { + // 获取所有与 PORTFOLIO_LIKE_KEY 相关的 keys + Set keys = redisUtil.getKeysFromString(prefix + "*"); + + List> portfolioSizes = new ArrayList<>(); + + if (keys != null) { + for (String key : keys) { + // 获取 Set 的 size + Long size = redisUtil.getSize(key); + // 保存 key 和 size + portfolioSizes.add(new AbstractMap.SimpleEntry<>(key, size)); + } + // 按 size 倒序排序 + portfolioSizes.sort((e1, e2) -> e2.getValue().compareTo(e1.getValue())); + // 获取 size 最大的前三个 + List top3PortfolioIds = portfolioSizes.stream() + .limit(3) + .map(Map.Entry::getKey) + .map(key -> key.replace(prefix, "")) // 去掉前缀,获取 portfolioId + .map(Long::valueOf) + .collect(Collectors.toList()); + // 输出 top3PortfolioIds + top3PortfolioIds.forEach(System.out::println); + return top3PortfolioIds; + } + return null; + } + + private List getTopThreeViewFromRedis(String prefix) { + // Step 1: Get all keys with the specific prefix + Set keys = redisUtil.getKeysFromString(prefix + "*"); +// Step 2: Create a map to store portfolioId and its corresponding value + Map portfolioViews = new HashMap<>(); + if (keys != null) { + for (String key : keys) { + // Get the value associated with the key + Long value = redisUtil.getViewCount(key); + if (!Objects.isNull(value)) { + // Extract the portfolioId from the key (assuming the key structure is consistent) + Long portfolioId = Long.valueOf(key.replace(prefix, "")); + portfolioViews.put(portfolioId, value); + } + } + } +// Step 3: Find the top 3 portfolio IDs with the largest values + if (!portfolioViews.isEmpty()){ + List top3PortfolioIds = portfolioViews.entrySet().stream() + .sorted(Map.Entry.comparingByValue().reversed()) + .limit(3) + .map(Map.Entry::getKey) + .collect(Collectors.toList()); + + System.out.println("Top 3 Portfolio IDs: " + top3PortfolioIds); + return top3PortfolioIds; + } + return null; + } }