From bee78cc9a2ac3b71197a7b5709b57b93f2eeb756 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 30 Jan 2024 13:34:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?generate=20=E6=B7=BB=E5=8A=A0=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E7=94=A8=E6=88=B7=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 4 ++-- src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8325f62d..5b64e5f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ version: "3" services: aida_back: - container_name: stable-version-aida-back + container_name: prod-version-aida-back build: . volumes: # 日志目录映射 - ./log:/log ports: - - "10086:5567" + - "10010:5567" 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 208075fd..7f7428ad 100644 --- a/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java +++ b/src/main/java/com/ai/da/common/RabbitMQ/MQConfig.java @@ -16,8 +16,8 @@ import org.springframework.beans.factory.annotation.Value; public class MQConfig { public static final String GENERATE_EXCHANGE_FANOUT = "generate-exchange"; -// public static final String GENERATE_QUEUE = "generate-queue-prod"; - public static final String GENERATE_QUEUE = "generate-queue-test"; + public static final String GENERATE_QUEUE = "generate-queue-prod"; +// public static final String GENERATE_QUEUE = "generate-queue-test"; public MQConfig() { } From 821a3420ae57724822b6db0808575386431ba7b7 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 30 Jan 2024 13:39:59 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 47a99eb3..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=test +spring.profiles.active=prod #����application-dev�ļ�(��������) #spring.profiles.active=dev From 81c5d7ee65108a850b5b5f80d5ae2bd296a7199b Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Tue, 30 Jan 2024 14:20:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?TASK:=E8=AF=95=E7=94=A8=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E4=BD=99=E9=A2=9D;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../da/service/impl/ChatRobotServiceImpl.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java b/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java index 5f06a194..1300292f 100644 --- a/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java @@ -9,7 +9,9 @@ import com.ai.da.common.enums.LibraryLevel1TypeEnum; import com.ai.da.common.utils.CopyUtil; import com.ai.da.common.utils.MD5Utils; import com.ai.da.common.utils.MinioUtil; +import com.ai.da.mapper.AccountMapper; import com.ai.da.mapper.LibraryMapper; +import com.ai.da.mapper.entity.Account; import com.ai.da.mapper.entity.ChatRobot; import com.ai.da.mapper.ChatRobotMapper; import com.ai.da.mapper.entity.Library; @@ -74,6 +76,8 @@ public class ChatRobotServiceImpl implements ChatRobotService { @Value("${minio.bucketName.sysImage}") private String sysImage; + @Resource + private AccountMapper accountMapper; Gson gson = new GsonBuilder().create(); private final ExecutorService executorService = Executors.newSingleThreadExecutor(); @@ -257,8 +261,15 @@ public class ChatRobotServiceImpl implements ChatRobotService { List chatRobots = chatRobotMapper.selectList(queryWrapper); if (!CollectionUtils.isEmpty(chatRobots)) { BigDecimal totalCostUsed = chatRobots.get(0).getTotalCost(); - if (totalCostUsed.add(totalCost).compareTo(BigDecimal.valueOf(5)) > 0) { - throw new BusinessException("Your balance is insufficient"); + Account account = accountMapper.selectById(userId); + if (account.getIsTrial() == 1) { + if (totalCostUsed.add(totalCost).compareTo(BigDecimal.valueOf(0.1)) > 0) { + throw new BusinessException("Your balance is insufficient"); + } + }else { + if (totalCostUsed.add(totalCost).compareTo(BigDecimal.valueOf(5)) > 0) { + throw new BusinessException("Your balance is insufficient"); + } } } } @@ -323,9 +334,13 @@ public class ChatRobotServiceImpl implements ChatRobotService { if (CollectionUtils.isEmpty(chatRobots)) { return BigDecimal.ONE; } else { + Account account = accountMapper.selectById(userId); BigDecimal totalCost = BigDecimal.valueOf(5).subtract(chatRobots.get(0).getTotalCost()); - BigDecimal result = totalCost.divide(BigDecimal.valueOf(5), 4, RoundingMode.HALF_UP); - return result; + if (account.getIsTrial() == 1) { + return totalCost.divide(BigDecimal.valueOf(0.1), 4, RoundingMode.HALF_UP); + }else { + return totalCost.divide(BigDecimal.valueOf(5), 4, RoundingMode.HALF_UP); + } } } From f1176dfefb0d99476fcbeb8be7494b76a517e669 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Tue, 30 Jan 2024 15:03:38 +0800 Subject: [PATCH 4/4] =?UTF-8?q?TASK:=E8=AF=95=E7=94=A8=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E4=BD=99=E9=A2=9D;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java b/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java index 1300292f..650deb4c 100644 --- a/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java @@ -337,6 +337,7 @@ public class ChatRobotServiceImpl implements ChatRobotService { Account account = accountMapper.selectById(userId); BigDecimal totalCost = BigDecimal.valueOf(5).subtract(chatRobots.get(0).getTotalCost()); if (account.getIsTrial() == 1) { + totalCost = BigDecimal.valueOf(0.1).subtract(chatRobots.get(0).getTotalCost()); return totalCost.divide(BigDecimal.valueOf(0.1), 4, RoundingMode.HALF_UP); }else { return totalCost.divide(BigDecimal.valueOf(5), 4, RoundingMode.HALF_UP);