Przeglądaj źródła

优化自定义异常类;新增钉钉机器人工具类

tsurumure 10 miesięcy temu
rodzic
commit
eba12ca09a
40 zmienionych plików z 547 dodań i 400 usunięć
  1. 1 1
      README.md
  2. 3 4
      src/main/java/com/backendsys/aspect/RateLimitingAspect.java
  3. 2 2
      src/main/java/com/backendsys/controller/Ai/AiznController.java
  4. 3 3
      src/main/java/com/backendsys/controller/Ai/AiznModelController.java
  5. 3 3
      src/main/java/com/backendsys/controller/KeyPair/KeyPairController.java
  6. 2 2
      src/main/java/com/backendsys/controller/Systems/SysUserPointController.java
  7. 2 2
      src/main/java/com/backendsys/controller/TestController.java
  8. 4 4
      src/main/java/com/backendsys/exception/CustException.java
  9. 7 0
      src/main/java/com/backendsys/exception/CustExceptionSimple.java
  10. 0 7
      src/main/java/com/backendsys/exception/CustomExceptionSimple.java
  11. 53 11
      src/main/java/com/backendsys/exception/GlobalExceptionHandler.java
  12. 3 3
      src/main/java/com/backendsys/modules/common/config/security/utils/PermissionUtil.java
  13. 3 5
      src/main/java/com/backendsys/modules/common/config/security/utils/SecurityUtil.java
  14. 6 0
      src/main/java/com/backendsys/modules/dingtalk/config/DingTalkConfig.java
  15. 325 0
      src/main/java/com/backendsys/modules/dingtalk/utils/DingTalkUtil.java
  16. 11 23
      src/main/java/com/backendsys/modules/log/controller/LogStreamController.java
  17. 0 199
      src/main/java/com/backendsys/modules/log/utils/DingTalkPushUtil.java
  18. 2 5
      src/main/java/com/backendsys/modules/system/controller/SysUserV2Controller.java
  19. 2 2
      src/main/java/com/backendsys/service/Ai/AiGenerateVideoServiceImpl.java
  20. 4 4
      src/main/java/com/backendsys/service/Ai/Aiivh/AiivhMakeBroadcastAudioTaskServiceImpl.java
  21. 12 12
      src/main/java/com/backendsys/service/Ai/Aiivh/AiivhMakeBroadcastTaskServiceImpl.java
  22. 2 2
      src/main/java/com/backendsys/service/Ai/Aiivh/AiivhMakeVirtualmanTaskServiceImpl.java
  23. 7 7
      src/main/java/com/backendsys/service/Ai/Aiivh/AiivhQuotaServiceImpl.java
  24. 3 3
      src/main/java/com/backendsys/service/Ai/Aizn/AiznGoodServiceImpl.java
  25. 5 5
      src/main/java/com/backendsys/service/Ai/Aizn/AiznImageTaskServiceImpl.java
  26. 6 6
      src/main/java/com/backendsys/service/Ai/Aizn/AiznModelServiceImpl.java
  27. 3 3
      src/main/java/com/backendsys/service/Ai/Aizn/AiznServiceImpl.java
  28. 6 6
      src/main/java/com/backendsys/service/KeyPair/KeyPairServiceImpl.java
  29. 3 3
      src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentAiServiceImpl.java
  30. 4 4
      src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentAiVirtualmanServiceImpl.java
  31. 22 22
      src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentCOSServiceImpl.java
  32. 6 6
      src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentSMSServiceImpl.java
  33. 15 15
      src/main/java/com/backendsys/service/System/SysAuthServiceImpl.java
  34. 2 2
      src/main/java/com/backendsys/service/System/SysResourceServiceImpl.java
  35. 5 5
      src/main/java/com/backendsys/service/System/SysUserPointHistoryServiceImpl.java
  36. 2 2
      src/main/java/com/backendsys/utils/CommonUtil.java
  37. 3 3
      src/main/java/com/backendsys/utils/CountUtil.java
  38. 2 2
      src/main/java/com/backendsys/utils/IDUtil.java
  39. 3 8
      src/main/resources/application-local.yml
  40. 0 4
      src/main/resources/application-prod.yml

+ 1 - 1
README.md

@@ -126,4 +126,4 @@ Long user_count = Convert.toLong(sysUserRole.get("user_count"));
 - 接口1:查询接口,首次调用Service时,将该值保存到Redis长效缓存
 - 接口2:手动更新缓存的接口
 
-2.日志log加.gz压缩
+2.Nginx均衡负载,双应用,无感知重启

+ 3 - 4
src/main/java/com/backendsys/aspect/RateLimitingAspect.java

@@ -1,7 +1,6 @@
 package com.backendsys.aspect;
 
-import com.backendsys.exception.CustomException;
-import com.backendsys.exception.CustomExceptionSimple;
+import com.backendsys.exception.CustException;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -39,8 +38,8 @@ public class RateLimitingAspect {
         long value = redisTemplate.opsForValue().increment(key, 1);
         if (value > limit) {
             log.error("接口限流,key:{},count:{},currentCount:{}", key, limit, value);
-//            throw new CustomExceptionSimple("访问过于频繁,请稍后再试!");
-            throw new CustomException("访问过于频繁,请稍后再试!");
+//            throw new CustExceptionSimple("访问过于频繁,请稍后再试!");
+            throw new CustException("访问过于频繁,请稍后再试!");
         }
         // 第一次请求设置过期时间
         if(value == 1){

+ 2 - 2
src/main/java/com/backendsys/controller/Ai/AiznController.java

@@ -1,6 +1,6 @@
 package com.backendsys.controller.Ai;
 
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.fzzixun.openapi.sdk.client.OpenClient;
 import com.fzzixun.openapi.sdk.request.AppTokenRequest;
 import com.fzzixun.openapi.sdk.response.AppTokenResponse;
@@ -37,7 +37,7 @@ public class AiznController {
             AppTokenResponse appTokenResponse = response.getDataObj(AppTokenResponse.class);
             return appTokenResponse.getAppAuthToken();
         } else {
-            throw new CustomException(response.getErrorMsg());
+            throw new CustException(response.getErrorMsg());
         }
     }
 

+ 3 - 3
src/main/java/com/backendsys/controller/Ai/AiznModelController.java

@@ -5,7 +5,7 @@ import com.backendsys.entity.Ai.Aizn.AiznIntelligentClipTaskDTO;
 import com.backendsys.entity.Ai.Aizn.AiznInteractClipTask.AiznInteractClipTaskDTO;
 import com.backendsys.entity.Ai.Aizn.AiznModel.AiznModelTaskDTO;
 import com.backendsys.entity.System.SysResourcePointsDTO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.System.SysResourcePointsMapper;
 import com.backendsys.service.Ai.Aizn.AiznImageTaskService;
 import com.backendsys.service.Ai.Aizn.AiznModelService;
@@ -104,10 +104,10 @@ public class AiznModelController {
             @RequestParam(value = "ids", required = false) String ids
     ) throws IOException {
         if (ids != null) {
-            if (id != null) throw new CustomException("id 与 ids 不能同时存在");
+            if (id != null) throw new CustException("id 与 ids 不能同时存在");
             return Result.success(aiznImageTaskService.getProgressOfTaskArray(ids, 9));
         } else {
-            if (id == null) throw new CustomException("id 与 ids 至少一项不能为空");
+            if (id == null) throw new CustException("id 与 ids 至少一项不能为空");
             return Result.success(aiznImageTaskService.getProgressOfTask(id, 9));
         }
     }

+ 3 - 3
src/main/java/com/backendsys/controller/KeyPair/KeyPairController.java

@@ -2,7 +2,7 @@ package com.backendsys.controller.KeyPair;
 
 import com.backendsys.entity.KeyPair.DecryptedContentDTO;
 import com.backendsys.entity.KeyPair.EncryptedContentDTO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.service.KeyPair.KeyPairService;
 import com.backendsys.utils.response.Result;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,7 +43,7 @@ public class KeyPairController {
             String content_encrypted = keyPairService.encryptedRSA(public_key, content);
             return Result.success(Map.of("content_encrypted", content_encrypted));
         } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
     }
 
@@ -60,7 +60,7 @@ public class KeyPairController {
             // 使用私钥来加密数据
             return Result.success(Map.of("content", keyPairService.decryptedRSA(private_key, content_encrypted)));
         } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
     }
 

+ 2 - 2
src/main/java/com/backendsys/controller/Systems/SysUserPointController.java

@@ -1,12 +1,12 @@
 package com.backendsys.controller.Systems;
 
 import com.backendsys.aspect.HttpRequestAspect;
+import com.backendsys.exception.CustException;
 import com.backendsys.modules.common.config.security.utils.PermissionUtil;
 import com.backendsys.entity.PageDTO;
 import com.backendsys.entity.System.SysUserPointsDTO;
 import com.backendsys.enums.UserPointActivityType;
 import com.backendsys.enums.UserPointOperatorType;
-import com.backendsys.exception.CustomException;
 import com.backendsys.mapper.System.SysUserPointsHistoryMapper;
 import com.backendsys.service.System.SysUserPointHistoryService;
 import com.backendsys.service.System.SysUserService;
@@ -56,7 +56,7 @@ public class SysUserPointController {
         boolean isSuper = permissionUtil.isSuper();
         // 如果非超级管理员且目标用户ID与当前用户ID不匹配,则抛出权限异常
         if (!isSuper && !sysUserPointsDTO.getTarget_user_id().equals(user_id)) {
-            throw new CustomException("当前用户没有权限查看或操作其他用户积分");
+            throw new CustException("当前用户没有权限查看或操作其他用户积分");
         }
     }
 

+ 2 - 2
src/main/java/com/backendsys/controller/TestController.java

@@ -533,7 +533,7 @@ public class TestController {
 //            if (!semaphore.tryAcquire(maxConcurrentRequests, 3, TimeUnit.SECONDS)) {
 //                // 如果无法获取信号量,说明并发数已满,抛出异常
 //                long waitingPosition = getWaitingPosition();
-//                throw new CustomException("正在排队中,第" + waitingPosition + "位 / 共" + maxConcurrentRequests + "位");
+//                throw new CustException("正在排队中,第" + waitingPosition + "位 / 共" + maxConcurrentRequests + "位");
 //            }
 //            // 执行业务逻辑
 //            System.out.println("开始休眠..");
@@ -542,7 +542,7 @@ public class TestController {
 //
 //        } catch (InterruptedException e) {
 //            // 处理中断异常
-//            throw new CustomException("处理中断异常");
+//            throw new CustException("处理中断异常");
 //
 //        } finally {
 //            // 释放信号量

+ 4 - 4
src/main/java/com/backendsys/exception/CustomException.java → src/main/java/com/backendsys/exception/CustException.java

@@ -1,20 +1,20 @@
 package com.backendsys.exception;
 
-public class CustomException extends RuntimeException {
+public class CustException extends RuntimeException {
     private Integer errorCode;
 
     private Object errorObject;
 
-    public CustomException(String message) {
+    public CustException(String message) {
         super(message);
     }
-    public CustomException(String message, Integer errorCode) {
+    public CustException(String message, Integer errorCode) {
         super(message);
         this.errorCode = errorCode;
     }
 
     // 可以添加更多的构造函数,以支持不同的参数,例如错误详情等
-    public CustomException(String message, Integer errorCode, Object errorObject) {
+    public CustException(String message, Integer errorCode, Object errorObject) {
         super(message);
         this.errorCode = errorCode;
         this.errorObject = errorObject;

+ 7 - 0
src/main/java/com/backendsys/exception/CustExceptionSimple.java

@@ -0,0 +1,7 @@
+package com.backendsys.exception;
+
+public class CustExceptionSimple extends RuntimeException {
+    public CustExceptionSimple(String message) {
+        super(message);
+    }
+}

+ 0 - 7
src/main/java/com/backendsys/exception/CustomExceptionSimple.java

@@ -1,7 +0,0 @@
-package com.backendsys.exception;
-
-public class CustomExceptionSimple extends RuntimeException {
-    public CustomExceptionSimple(String message) {
-        super(message);
-    }
-}

+ 53 - 11
src/main/java/com/backendsys/exception/GlobalExceptionHandler.java

@@ -1,9 +1,12 @@
 package com.backendsys.exception;
 
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import com.backendsys.modules.dingtalk.utils.DingTalkUtil;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.backendsys.utils.response.Result;
 import com.backendsys.utils.response.ResultEnum;
+import com.google.common.collect.Lists;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.validation.ConstraintViolation;
 import jakarta.validation.ConstraintViolationException;
@@ -34,14 +37,13 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
 
 import javax.security.auth.login.LoginException;
 import java.util.*;
-import java.util.stream.Collectors;
+import java.util.concurrent.CompletableFuture;
 
 /**
  * https://juejin.cn/post/6844903902811275278
  * https://juejin.cn/post/7132747726965440520
  * 待看
  */
-
 @Slf4j
 @RestControllerAdvice
 public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
@@ -88,6 +90,7 @@ public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
                 String method = request.getMethod();
                 String url = request.getRequestURL().toString();
                 String ip = request.getRemoteAddr();
+
                 // 记录URL和IP地址
                 log.warn("[" + method + "] " + url + ", (" + ip + ")");
             }
@@ -95,7 +98,6 @@ public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
     }
 
     // -- 自定义异常输出结构 (警告) ----------------------------------------------------
-    // https://oapi.dingtalk.com/robot/send?access_token=6c677738c71a91ad096499784aa6bd0bb19ed99c2be99d31552ae3bb8fa7d5d5
     private static void printWarnException(Exception e) {
         printRequestInfo();
         log.warn(e.getClass().getName() + ": " + e.getMessage());
@@ -104,9 +106,49 @@ public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
     // -- 自定义异常输出结构 (错误) ----------------------------------------------------
     private static void printErrorException(Exception e, Boolean isPrintStack) {
         log.error("========================================================================");
-        printRequestInfo();
+        // printRequestInfo();
+
+        // 获取请求的URL
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        if (attributes != null) {
+            HttpServletRequest request = attributes.getRequest();
+            if (request != null) {
+                String url = request.getRequestURL().toString();
+                String ip = request.getRemoteAddr();
+                String method = request.getMethod();
+                String createTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
+                String serverName = request.getServerName();
+
+                System.out.println("serverName = " + serverName);
+
+                // --- 向钉钉发送消息 -----------------------------------
+                // (本地环境不触发)
+                if (!"localhost".equals(serverName)) {
+                    // 创建一个CompletableFuture来执行异步任务
+                    CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
+                        try {
+                            String message = "【系统异常】:" + e.getMessage() + "\n" +
+                                    "【异常接口】:" + url + "\n" +
+                                    "【异常堆栈】:" + Convert.toStr(e.getStackTrace()).substring(0, 400) + "\n" +
+                                    "【异常时间】:" + createTime + "\n" +
+                                    "【异常来源】:" + ip;
+                            DingTalkUtil.sendTextMsg(message, Lists.newArrayList(), Lists.newLinkedList(), false);
+                        } catch (Exception ex) {
+                            System.out.println("钉钉群消息发送异常,异常原因:" + ex.getMessage());
+                            log.error(ex.getMessage());
+                        }
+                    });
+                }
+                // ---------------------------------------------------
+
+                // 记录URL和IP地址
+                log.error("[" + method + "] " + url + ", (" + ip + ")");
+            }
+        }
+
         // 记录 当前异常类的class名称、异常消息
         log.error(e.getMessage() + " (" + e.getClass().getName() + ")");
+
         // 记录异常的详细信息
         if (isPrintStack) {
             log.error(Convert.toStr(e.getStackTrace()));
@@ -182,20 +224,20 @@ public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
 
     /**
      * 自定义异常类
-     * throw new CustomException("错误提示")
+     * throw new CustException("错误提示")
      */
-    @ExceptionHandler(CustomException.class)
-    public Result handleCustomException(CustomException e) {
-        System.out.println("****** CustomException.class: ******");
+    @ExceptionHandler(CustException.class)
+    public Result handleCustException(CustException e) {
+        System.out.println("****** CustException.class: ******");
         printWarnException(e);
         return Result.error(e.getErrorCode() != null ? e.getErrorCode() : ResultEnum.PARAMETER_EXCEPTION.getCode(), e.getMessage(), e.getErrorObject());
     }
     /**
      * 自定义异常类 (仅返回文本)
      */
-    @ExceptionHandler(CustomExceptionSimple.class)
-    public String handleCustomExceptionSimple(CustomExceptionSimple e) {
-        System.out.println("****** CustomExceptionSimple.class: ******");
+    @ExceptionHandler(CustExceptionSimple.class)
+    public String handleCustExceptionSimple(CustExceptionSimple e) {
+        System.out.println("****** CustExceptionSimple.class: ******");
         printErrorException(e);
         return e.getMessage();
     }

+ 3 - 3
src/main/java/com/backendsys/modules/common/config/security/utils/PermissionUtil.java

@@ -1,7 +1,7 @@
 package com.backendsys.modules.common.config.security.utils;
 
+import com.backendsys.exception.CustException;
 import com.backendsys.modules.common.config.security.entity.SecurityUserInfo;
-import com.backendsys.exception.CustomException;
 import com.backendsys.utils.response.ResultEnum;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -85,7 +85,7 @@ public class PermissionUtil {
         SecurityUserInfo securityUserInfo = SecurityUtil.getUserInfo();
         if (securityUserInfo.getUser_id() != user_id) {
             if (!hasPermi(permission)) {
-                throw new CustomException(ResultEnum.AUTH_ROLE_ERROR.getMessage(), ResultEnum.AUTH_ROLE_ERROR.getCode());
+                throw new CustException(ResultEnum.AUTH_ROLE_ERROR.getMessage(), ResultEnum.AUTH_ROLE_ERROR.getCode());
             }
         }
     }
@@ -97,7 +97,7 @@ public class PermissionUtil {
         if (user_id == 1) {
             SecurityUserInfo securityUserInfo = SecurityUtil.getUserInfo();
             if (securityUserInfo.getUser_id() != 1) {
-                throw new CustomException(ResultEnum.AUTH_USER_ERROR.getMessage(), ResultEnum.AUTH_USER_ERROR.getCode());
+                throw new CustException(ResultEnum.AUTH_USER_ERROR.getMessage(), ResultEnum.AUTH_USER_ERROR.getCode());
             }
         }
     }

+ 3 - 5
src/main/java/com/backendsys/modules/common/config/security/utils/SecurityUtil.java

@@ -4,20 +4,18 @@ import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.modules.common.config.security.entity.SecurityUserInfo;
 import com.backendsys.modules.common.enums.MatchType;
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.Jwts;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.web.authentication.WebAuthenticationDetails;
 import org.springframework.stereotype.Service;
 
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
 import java.util.Base64;
 import java.util.List;
 
@@ -66,8 +64,8 @@ public class SecurityUtil {
      */
     public static SecurityUserInfo getUserInfo(){
         String token = getToken();
-        if (StrUtil.isEmpty(token)) throw new CustomException("getUserInfo() token is empty.");
-        if (token.contains("SessionId") || token.contains("RemoteIpAddress")) throw new CustomException("getUserInfo() need token.");
+        if (StrUtil.isEmpty(token)) throw new CustException("getUserInfo() token is empty.");
+        if (token.contains("SessionId") || token.contains("RemoteIpAddress")) throw new CustException("getUserInfo() need token.");
 
         Claims tokenInfo = Jwts.parser().verifyWith(getSignInKey()).build().parseSignedClaims(token).getPayload();
         JSONObject userInfo = JSONUtil.parseObj(tokenInfo.get("userInfo"));

+ 6 - 0
src/main/java/com/backendsys/modules/dingtalk/config/DingTalkConfig.java

@@ -0,0 +1,6 @@
+package com.backendsys.modules.dingtalk.config;
+
+public class DingTalkConfig {
+    public static String secret = "SECf936313d718270626986fea3f1a6bfe2640f3cb653f45aa12ad68e7ddfd8c945";
+    public static String webhook = "https://oapi.dingtalk.com/robot/send?access_token=6c677738c71a91ad096499784aa6bd0bb19ed99c2be99d31552ae3bb8fa7d5d5";
+}

+ 325 - 0
src/main/java/com/backendsys/modules/dingtalk/utils/DingTalkUtil.java

@@ -0,0 +1,325 @@
+package com.backendsys.modules.dingtalk.utils;
+
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.backendsys.modules.dingtalk.config.DingTalkConfig;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 钉钉群机器人
+ * https://open.dingtalk.com/document/orgapp/robot-application-overview
+ * https://blog.csdn.net/weixin_44996457/article/details/128565224
+ *
+ * 使用示例:
+ * 单条消息:DingTalkUtil.testSendTextMsg();
+ * 带链接的消息:DingTalkUtil.testSendLinkMsg();
+ * 卡片式的消息 (单按钮:阅读全文):DingTalkUtil.testWholeSendActionCardMsg();
+ * 卡片式的消息 (多按钮:内容不错/不感兴趣):DingTalkUtil.testIndependentSendActionCardMsg();
+ */
+@Slf4j
+public class DingTalkUtil {
+
+    /**
+     * 文本消息
+     */
+    public static void testSendTextMsg() {
+        try {
+            String message = "【系统环境】:正式服\n" +
+                "【异常接口】:/app/demo/demo\n" +
+                "【异常代码】:500\n" +
+                "【异常描述】:内部服务器错误\n" +
+                "【异常时间】:2024-10-31 13:45:00";
+            sendTextMsg(message, Lists.newArrayList(), Lists.newLinkedList(), false);
+        } catch (Exception e) {
+            System.out.println("钉钉群消息发送异常,异常原因:");
+            System.out.println(e.getMessage());
+        }
+    }
+
+    /**
+     * link类型
+     */
+    public static void testSendLinkMsg() {
+        try {
+            sendLinkMsg("时代的火车向前开",
+            "这个即将发布的新版本,创始人xx称它为红树林。而在此之前,每当面临重大升级,产品经理们都会取一个应景的代号,这一次,为什么是红树林",
+            "https://www.dingtalk.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI",
+            "");
+        } catch (Exception e) {
+            System.out.println("钉钉群消息发送异常,异常原因:");
+            System.out.println(e.getMessage());
+        }
+    }
+
+    /**
+     * 整体跳转ActionCard类型
+     */
+    public static void testWholeSendActionCardMsg() {
+        try {
+            sendActionCardMsg("打造一间咖啡厅", "![screenshot](https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png) 乔布斯 20 年前想打造的苹果咖啡厅,Apple Store 的设计正从原来满满的科技感走向生活化,而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划",
+                    "0", "阅读全文", "https://www.dingtalk.com/");
+        } catch (Exception e) {
+            System.out.println("钉钉群消息发送异常,异常原因:");
+            System.out.println(e.getMessage());
+        }
+    }
+
+    /**
+     * 独立跳转ActionCard类型
+     */
+    public static void testIndependentSendActionCardMsg() {
+        try {
+            List<Map<String, String>> btnsList = new ArrayList<>();
+            Map<String, String> map1 = new HashMap<>();
+            Map<String, String> map2 = new HashMap<>();
+            map1.put("title", "内容不错");
+            map1.put("messageURL", "https://www.dingtalk.com/");
+            map2.put("title", "不感兴趣");
+            map2.put("actionURL", "https://www.dingtalk.com/");
+            btnsList.add(map1);
+            btnsList.add(map2);
+            sendActionCardMsg("打造一间咖啡厅", "![screenshot](https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png) 乔布斯 20 年前想打造的苹果咖啡厅,Apple Store 的设计正从原来满满的科技感走向生活化,而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划",
+                    "0", btnsList);
+        } catch (Exception e) {
+            System.out.println("钉钉群消息发送异常,异常原因:{}");
+            System.out.println(e.getMessage());
+        }
+    }
+
+
+
+
+    /**
+     * 群里面发送消息
+     *
+     * @param content    消息内容
+     * @param isAtAll    是否@所有人
+     * @param mobileList 被@人的手机号
+     * @param userIdList 被@人的用户userid
+     * @throws Exception
+     */
+    public static void sendTextMsg(String content, List<String> mobileList, List<String> userIdList, boolean isAtAll) throws Exception {
+        String dingUrl = getDingUrl();
+        // 组装请求内容
+
+//        // 被@人的手机号
+//        mobileList.add("13537082474");
+
+        String reqStr = buildReqTextStr(content, isAtAll, mobileList, userIdList);
+        // 推送消息(http请求)
+        String result = HttpUtil.post(dingUrl, reqStr);
+        handleErrorCode(result);
+        System.out.println();
+        System.out.println("钉钉请求发送成功,返回结果:" + result);
+    }
+
+    /**
+     * 群里面发送消息
+     *
+     * @param title      消息标题
+     * @param messageUrl 点击消息跳转的URL
+     * @param picUrl     图片URL
+     * @param text       消息内容
+     * @throws Exception
+     */
+    public static void sendLinkMsg(String title, String text, String messageUrl, String picUrl) throws Exception {
+        String dingUrl = getDingUrl();
+        // 组装请求内容
+        String reqStr = buildReqLinkStr(title, text, messageUrl, picUrl);
+        // 推送消息(http请求)
+        String result = HttpUtil.post(dingUrl, reqStr);
+        handleErrorCode(result);
+        System.out.println("钉钉请求发送成功,返回结果:" + result);
+    }
+    /**
+     * 群里面发送消息
+     *
+     * @param title          首屏会话透出的展示内容
+     * @param text           markdown格式的消息
+     * @param btnOrientation 0:按钮竖直排列 1:按钮横向排列
+     * @param singleTitle    单个按钮的标题
+     * @param singleURL      点击消息跳转的URL
+     * @throws Exception
+     */
+    public static void sendActionCardMsg(String title, String text, String btnOrientation, String singleTitle, String singleURL) throws Exception {
+        String dingUrl = getDingUrl();
+        // 组装请求内容
+        String reqStr = buildReqActionCard(title, text, btnOrientation, singleTitle, singleURL);
+        // 推送消息(http请求)
+        String result = HttpUtil.post(dingUrl, reqStr);
+        handleErrorCode(result);
+        System.out.println("钉钉请求发送成功,返回结果:" + result);
+    }
+    /**
+     * 群里面发送消息
+     *
+     * @param title          首屏会话透出的展示内容
+     * @param text           markdown格式的消息
+     * @param btnOrientation 0:按钮竖直排列 1:按钮横向排列
+     * @param btnsList       按钮
+     * @throws Exception
+     */
+    public static void sendActionCardMsg(String title, String text, String btnOrientation, List<Map<String, String>> btnsList) throws Exception {
+        String dingUrl = getDingUrl();
+        // 组装请求内容
+        String reqStr = buildReqActionCard(title, text, btnOrientation, btnsList);
+        // 推送消息(http请求)
+        String result = HttpUtil.post(dingUrl, reqStr);
+        handleErrorCode(result);
+        System.out.println("钉钉请求发送成功,返回结果:" + result);
+    }
+
+
+    /**
+     * 组装请求报文-整体跳转ActionCard类型
+     *
+     * @param title          首屏会话透出的展示内容
+     * @param text           markdown格式的消息
+     * @param btnOrientation 0:按钮竖直排列 1:按钮横向排列
+     * @param singleTitle    单个按钮的标题
+     * @param singleURL      点击消息跳转的URL
+     * @return
+     */
+    private static String buildReqActionCard(String title, String text, String btnOrientation, String singleTitle, String singleURL) {
+        Map<String, String> actionCardMap = Maps.newHashMap();
+        actionCardMap.put("title", title);
+        actionCardMap.put("text", text);
+        actionCardMap.put("btnOrientation", btnOrientation);
+        actionCardMap.put("singleTitle", singleTitle);
+        actionCardMap.put("singleURL", singleURL);
+
+        Map<String, Object> reqMap = Maps.newHashMap();
+        reqMap.put("msgtype", "actionCard");
+        reqMap.put("actionCard", actionCardMap);
+
+        return JSONObject.toJSONString(reqMap);
+    }
+    /**
+     * 组装请求报文-独立跳转ActionCard类型
+     *
+     * @param title          首屏会话透出的展示内容
+     * @param text           markdown格式的消息
+     * @param btnOrientation 0:按钮竖直排列 1:按钮横向排列
+     * @param btnsList       按钮
+     * @return
+     */
+    private static String buildReqActionCard(String title, String text, String btnOrientation, List<Map<String, String>> btnsList) {
+        Map<String, Object> actionCardMap = Maps.newHashMap();
+        actionCardMap.put("title", title);
+        actionCardMap.put("text", text);
+        actionCardMap.put("btnOrientation", btnOrientation);
+        actionCardMap.put("btns", btnsList);
+
+        Map<String, Object> reqMap = Maps.newHashMap();
+        reqMap.put("msgtype", "actionCard");
+        reqMap.put("actionCard", actionCardMap);
+
+        return JSONObject.toJSONString(reqMap);
+    }
+
+
+
+
+
+
+
+
+    /**
+     * 组装请求报文-link类型
+     *
+     * @param title      消息标题
+     * @param text       消息内容
+     * @param messageUrl 点击消息跳转的URL
+     * @param picUrl     图片URL
+     * @return
+     */
+    private static String buildReqLinkStr(String title, String text, String messageUrl, String picUrl) {
+        Map<String, String> linkMap = Maps.newHashMap();
+
+        linkMap.put("text", text);
+        linkMap.put("title", title);
+        linkMap.put("picUrl", picUrl);
+        linkMap.put("messageUrl", messageUrl);
+
+        Map<String, Object> reqMap = Maps.newHashMap();
+        reqMap.put("msgtype", "link");
+        reqMap.put("link", linkMap);
+
+        return JSONObject.toJSONString(reqMap);
+    }
+
+    /**
+     * 获取请求url
+     * @return
+     */
+    private static String getDingUrl() throws Exception {
+        // 获取系统时间戳
+        Long timestamp = System.currentTimeMillis();
+        // 拼接
+        String stringToSign = timestamp + "\n" + DingTalkConfig.secret;
+        // 使用HmacSHA256算法计算签名
+        Mac mac = Mac.getInstance("HmacSHA256");
+        mac.init(new SecretKeySpec(DingTalkConfig.secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
+        byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8));
+        // 进行Base64 encode 得到最后的sign,可以拼接进url里
+        String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8");//Base64.encodeBase64(signData)
+        // 钉钉机器人地址(配置机器人的webhook),为了让每次请求不同,避免钉钉拦截,加上时间戳
+        String dingUrl = DingTalkConfig.webhook + "&timestamp=" + timestamp + "&sign=" + sign;
+        return dingUrl;
+    }
+
+    /**
+     * 组装请求报文-text类型
+     *
+     * @param content    消息内容
+     * @param isAtAll    是否@所有人
+     * @param mobileList 被@人的手机号
+     * @param atUserIds  被@人的用户userid
+     * @return
+     */
+    private static String buildReqTextStr(String content, boolean isAtAll, List<String> mobileList, List<String> atUserIds) {
+        Map<String, String> contentMap = Maps.newHashMap();
+        contentMap.put("content", content);
+
+        Map<String, Object> atMap = Maps.newHashMap();
+        atMap.put("isAtAll", isAtAll);
+        atMap.put("atMobiles", mobileList);
+        atMap.put("atUserIds", atUserIds);
+
+        Map<String, Object> reqMap = Maps.newHashMap();
+        reqMap.put("msgtype", "text");
+        reqMap.put("text", contentMap);
+        reqMap.put("at", atMap);
+
+        return JSONObject.toJSONString(reqMap);
+    }
+
+    /**
+     * errcode处理
+     * @param resultStr
+     */
+    private static void handleErrorCode(String resultStr) {
+        if (StringUtils.isEmpty(resultStr)) {
+            throw new RuntimeException("返回结果为空");
+        }
+        JSONObject jsonObject = JSONObject.parseObject(resultStr);
+        if (310000 == jsonObject.getLong("errcode")) {
+            throw new RuntimeException("keywords not in content");
+        }
+    }
+
+}

+ 11 - 23
src/main/java/com/backendsys/modules/log/controller/LogStreamController.java

@@ -2,33 +2,22 @@ package com.backendsys.modules.log.controller;
 
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
-import com.backendsys.exception.CustomException;
 import com.backendsys.modules.common.config.security.annotations.Anonymous;
 import com.backendsys.modules.common.utils.Result;
-import com.backendsys.modules.log.utils.DingTalkPushUtil;
+import com.backendsys.modules.dingtalk.utils.DingTalkUtil;
 import com.backendsys.modules.sse.emitter.SseEmitterManager;
 import com.backendsys.modules.sse.utils.SseEmitterUTF8;
 import com.backendsys.modules.sse.utils.SseUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.MediaType;
-import org.springframework.http.codec.ServerSentEvent;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
-import reactor.core.publisher.Flux;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.time.Duration;
-import java.time.LocalTime;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
 
 @Slf4j
 @RestController
@@ -46,17 +35,16 @@ public class LogStreamController {
     @Value("${log-stream.sign}")
     private String signValue;
 
-    @Autowired
-    private DingTalkPushUtil dingTalkPushUtil;
-
-    @Anonymous
-    @GetMapping("/api/test/sendDingMsg")
-    public Result sendDingMsg() {
-//        DingTalkPushUtil.testSendTextMsg();
-//        DingTalkPushUtil.testSendLinkMsg();
-        dingTalkPushUtil.testSendLinkMsg();
-        return Result.success();
-    }
+//    @Anonymous
+//    @GetMapping("/api/test/sendDingMsg")
+//    public Result sendDingMsg() {
+//        DingTalkUtil.testSendTextMsg();
+////        DingTalkUtil.testSendLinkMsg();
+////        DingTalkUtil.testWholeSendActionCardMsg();
+////        DingTalkUtil.testIndependentSendActionCardMsg();
+//
+//        return Result.success();
+//    }
 
 
     /**

+ 0 - 199
src/main/java/com/backendsys/modules/log/utils/DingTalkPushUtil.java

@@ -1,199 +0,0 @@
-package com.backendsys.modules.log.utils;
-
-import cn.hutool.http.HttpUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.env.Environment;
-import org.springframework.core.env.StandardEnvironment;
-import org.springframework.stereotype.Component;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 钉钉群机器人
- * https://open.dingtalk.com/document/orgapp/robot-application-overview
- * https://blog.csdn.net/weixin_44996457/article/details/128565224
- */
-@Slf4j
-@Component
-public class DingTalkPushUtil {
-
-    @Value("${ding-talk.enable}")
-    private Boolean isEnable;
-    @Value("${ding-talk.secret}")
-    private String secret;
-    @Value("${ding-talk.webhook}")
-    private String webhook;
-
-//    private static final String secret = "SECf936313d718270626986fea3f1a6bfe2640f3cb653f45aa12ad68e7ddfd8c945";
-//    private static final String webhook = "https://oapi.dingtalk.com/robot/send?access_token=6c677738c71a91ad096499784aa6bd0bb19ed99c2be99d31552ae3bb8fa7d5d5";
-
-    /**
-     * 文本消息
-     */
-    public void testSendTextMsg() {
-        try {
-            sendTextMsg("我就是我, 是不一样的烟火", Lists.newArrayList(), Lists.newLinkedList(), false);
-        } catch (Exception e) {
-            System.out.println("钉钉群消息发送异常,异常原因:");
-            System.out.println(e.getMessage());
-        }
-    }
-
-    /**
-     * link类型
-     */
-    public void testSendLinkMsg() {
-        try {
-            sendLinkMsg("时代的火车向前开",
-            "这个即将发布的新版本,创始人xx称它为红树林。而在此之前,每当面临重大升级,产品经理们都会取一个应景的代号,这一次,为什么是红树林",
-            "https://www.dingtalk.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI",
-            "");
-        } catch (Exception e) {
-            System.out.println("钉钉群消息发送异常,异常原因:");
-            System.out.println(e.getMessage());
-        }
-    }
-
-
-
-
-    /**
-     * 群里面发送消息
-     *
-     * @param content    消息内容
-     * @param isAtAll    是否@所有人
-     * @param mobileList 被@人的手机号
-     * @param userIdList 被@人的用户userid
-     * @throws Exception
-     */
-    public void sendTextMsg(String content, List<String> mobileList, List<String> userIdList, boolean isAtAll) throws Exception {
-        if (!isEnable) return;
-        String dingUrl = getDingUrl();
-        // 组装请求内容
-        String reqStr = buildReqTextStr(content, isAtAll, mobileList, userIdList);
-        // 推送消息(http请求)
-        String result = HttpUtil.post(dingUrl, reqStr);
-        handleErrorCode(result);
-        System.out.println();
-        System.out.println("钉钉请求发送成功,返回结果:");
-        System.out.println(result);
-    }
-
-    /**
-     * 群里面发送消息
-     *
-     * @param title      消息标题
-     * @param messageUrl 点击消息跳转的URL
-     * @param picUrl     图片URL
-     * @param text       消息内容
-     * @throws Exception
-     */
-    public void sendLinkMsg(String title, String text, String messageUrl, String picUrl) throws Exception {
-        if (!isEnable) return;
-        String dingUrl = getDingUrl();
-        // 组装请求内容
-        String reqStr = buildReqLinkStr(title, text, messageUrl, picUrl);
-        // 推送消息(http请求)
-        String result = HttpUtil.post(dingUrl, reqStr);
-        handleErrorCode(result);
-        System.out.println("钉钉请求发送成功,返回结果:");
-        System.out.println(result);
-    }
-
-    /**
-     * 组装请求报文-link类型
-     *
-     * @param title      消息标题
-     * @param text       消息内容
-     * @param messageUrl 点击消息跳转的URL
-     * @param picUrl     图片URL
-     * @return
-     */
-    private String buildReqLinkStr(String title, String text, String messageUrl, String picUrl) {
-        Map<String, String> linkMap = Maps.newHashMap();
-
-        linkMap.put("text", text);
-        linkMap.put("title", title);
-        linkMap.put("picUrl", picUrl);
-        linkMap.put("messageUrl", messageUrl);
-
-        Map<String, Object> reqMap = Maps.newHashMap();
-        reqMap.put("msgtype", "link");
-        reqMap.put("link", linkMap);
-
-        return JSONObject.toJSONString(reqMap);
-    }
-
-    /**
-     * 获取请求url
-     * @return
-     */
-    private String getDingUrl() throws Exception {
-        // 获取系统时间戳
-        Long timestamp = System.currentTimeMillis();
-        // 拼接
-        String stringToSign = timestamp + "\n" + secret;
-        // 使用HmacSHA256算法计算签名
-        Mac mac = Mac.getInstance("HmacSHA256");
-        mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
-        byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8));
-        // 进行Base64 encode 得到最后的sign,可以拼接进url里
-        String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8");//Base64.encodeBase64(signData)
-        // 钉钉机器人地址(配置机器人的webhook),为了让每次请求不同,避免钉钉拦截,加上时间戳
-        String dingUrl = webhook + "&timestamp=" + timestamp + "&sign=" + sign;
-        return dingUrl;
-    }
-
-    /**
-     * 组装请求报文-text类型
-     *
-     * @param content    消息内容
-     * @param isAtAll    是否@所有人
-     * @param mobileList 被@人的手机号
-     * @param atUserIds  被@人的用户userid
-     * @return
-     */
-    private String buildReqTextStr(String content, boolean isAtAll, List<String> mobileList, List<String> atUserIds) {
-        Map<String, String> contentMap = Maps.newHashMap();
-        contentMap.put("content", content);
-
-        Map<String, Object> atMap = Maps.newHashMap();
-        atMap.put("isAtAll", isAtAll);
-        atMap.put("atMobiles", mobileList);
-        atMap.put("atUserIds", atUserIds);
-
-        Map<String, Object> reqMap = Maps.newHashMap();
-        reqMap.put("msgtype", "text");
-        reqMap.put("text", contentMap);
-        reqMap.put("at", atMap);
-
-        return JSONObject.toJSONString(reqMap);
-    }
-
-    /**
-     * errcode处理
-     * @param resultStr
-     */
-    private void handleErrorCode(String resultStr) {
-        if (StringUtils.isEmpty(resultStr)) {
-            throw new RuntimeException("返回结果为空");
-        }
-        JSONObject jsonObject = JSONObject.parseObject(resultStr);
-        if (310000 == jsonObject.getLong("errcode")) {
-            throw new RuntimeException("keywords not in content");
-        }
-    }
-
-}

+ 2 - 5
src/main/java/com/backendsys/modules/system/controller/SysUserV2Controller.java

@@ -1,17 +1,14 @@
 package com.backendsys.modules.system.controller;
 
-import com.backendsys.exception.CustomException;
-import com.backendsys.modules.common.config.security.annotations.Anonymous;
+import com.backendsys.exception.CustException;
 import com.backendsys.modules.common.config.security.enums.SecurityEnum;
 import com.backendsys.modules.common.config.security.utils.SecurityUtil;
-import com.backendsys.modules.common.enums.MatchType;
 import com.backendsys.modules.common.utils.Result;
 import com.backendsys.modules.system.entity.SysUser.SysUserInfo;
 import com.backendsys.modules.system.service.SysUserV2Service;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -41,7 +38,7 @@ public class SysUserV2Controller {
 
         // 查询他人的用户信息,需要具备权限 (非管理员,非当前用户,不具备权限)
         if (!SecurityUtil.isSuper() && user_id != SecurityUtil.getUserId() && !SecurityUtil.hasPermission("3.2.1.2")) {
-            throw new CustomException(SecurityEnum.NOAUTH);
+            throw new CustException(SecurityEnum.NOAUTH);
         }
 
         return Result.success().put("data", sysUserV2Service.selectUserInfo(user_id));

+ 2 - 2
src/main/java/com/backendsys/service/Ai/AiGenerateVideoServiceImpl.java

@@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.backendsys.entity.Ai.AiGenerateVideoDTO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.Ai.AiGenerateVideoMapper;
 import com.backendsys.mapper.Ai.AiGenerateVideoTimbreMapper;
 import com.backendsys.service.SDKService.SDKBaidu.SDKBaiduAiGenerateVideoService;
@@ -105,7 +105,7 @@ public class AiGenerateVideoServiceImpl implements AiGenerateVideoService {
             aiGenerateVideoMapper.insertAiGenerateVideo(aiGenerateVideoDTO);
         } else {
             String error_message = Convert.toStr(MapUtil.get(resp, "error_msg"));
-            throw new CustomException("(" + error_code + ") " + error_message);
+            throw new CustException("(" + error_code + ") " + error_message);
         }
 
         return resp;

+ 4 - 4
src/main/java/com/backendsys/service/Ai/Aiivh/AiivhMakeBroadcastAudioTaskServiceImpl.java

@@ -2,7 +2,7 @@ package com.backendsys.service.Ai.Aiivh;
 
 import com.backendsys.aspect.HttpRequestAspect;
 import com.backendsys.entity.Ai.Aiivh.AiivhMakeBroadcastAudioTask.*;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.Ai.Aiivh.AiivhAnchorMapper;
 import com.backendsys.mapper.Ai.Aiivh.AiivhMakeBroadcastAudioTaskMapper;
 import com.backendsys.service.SDKService.SDKTencent.SDKTencentAiVideoService;
@@ -56,10 +56,10 @@ public class AiivhMakeBroadcastAudioTaskServiceImpl implements AiivhMakeBroadcas
 
         Map<String, Object> detail = aiivhMakeBroadcastAudioTaskMapper.queryAiivhMakeBroadcastAudioTaskDetail(aiivhMakeBroadcastAudioTaskDTO);
         if (detail == null) {
-            throw new CustomException("(task_id) 找不到任务");
+            throw new CustException("(task_id) 找不到任务");
         }
         if (!aiivhMakeBroadcastAudioTaskDTO.getUser_id().equals((Long) detail.get("user_id"))) {
-            throw new CustomException("(task_id) 任务没有访问权限");
+            throw new CustException("(task_id) 任务没有访问权限");
         }
 
         System.out.println("detail:");
@@ -128,7 +128,7 @@ public class AiivhMakeBroadcastAudioTaskServiceImpl implements AiivhMakeBroadcas
         Integer respHeaderCode = (Integer) MapUtil.get(resp, "Header.Code");
         if (respHeaderCode != null && respHeaderCode != 0) {
             String respHeaderMessage = (String) MapUtil.get(resp, "Header.Message");
-            throw new CustomException("(" + respHeaderCode + ") " + respHeaderMessage);
+            throw new CustException("(" + respHeaderCode + ") " + respHeaderMessage);
         }
         String task_id = (String) MapUtil.get(resp, "Payload.TaskId");
         String request_id = (String) MapUtil.get(resp, "Payload.RequestID");

+ 12 - 12
src/main/java/com/backendsys/service/Ai/Aiivh/AiivhMakeBroadcastTaskServiceImpl.java

@@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil;
 
 import com.backendsys.aspect.HttpRequestAspect;
 import com.backendsys.entity.Ai.Aiivh.AiivhMakeBroadcastTask.*;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.Ai.Aiivh.AiivhAnchorMapper;
 import com.backendsys.mapper.Ai.Aiivh.AiivhMakeBroadcastTaskMapper;
 import com.backendsys.service.SDKService.SDKTencent.SDKTencentAiVideoService;
@@ -60,10 +60,10 @@ public class AiivhMakeBroadcastTaskServiceImpl implements AiivhMakeBroadcastTask
 
         Map<String, Object> detail = aiivhMakeBroadcastTaskMapper.queryAiivhMakeBroadcastTaskDetail(aiivhMakeBroadcastTaskDTO);
         if (detail == null) {
-            throw new CustomException("(task_id) 找不到任务");
+            throw new CustException("(task_id) 找不到任务");
         }
         if (!aiivhMakeBroadcastTaskDTO.getUser_id().equals((Long) detail.get("user_id"))) {
-            throw new CustomException("(task_id) 任务没有访问权限");
+            throw new CustException("(task_id) 任务没有访问权限");
         }
 
         // -- 如果是任务 CONFIRM 状态,则刷新状态
@@ -263,13 +263,13 @@ public class AiivhMakeBroadcastTaskServiceImpl implements AiivhMakeBroadcastTask
             // -- 当 DriverType 为空 或 Text 时,{ input_ssml } 字段必填 ------------------------------
             String input_ssml = aiivhMakeBroadcastTaskDTO.getInput_ssml();
             if (StrUtil.isBlank(input_ssml)) {
-                throw new CustomException("当 {driver_type} 为空 或 {driver_type} 为 Text 时,{input_ssml} 必填");
+                throw new CustException("当 {driver_type} 为空 或 {driver_type} 为 Text 时,{input_ssml} 必填");
             }
         } else if (driver_type.equals("OriginalVoice") || driver_type.equals("ModulatedVoice")) {
             // -- 当 DriverType 为 OriginalVoice、ModulatedVoice 时,{ input_audio_url } 字段必填 -----
             String input_audio_url = aiivhMakeBroadcastTaskDTO.getInput_audio_url();
             if (StrUtil.isBlank(input_audio_url)) {
-                throw new CustomException("当 {driver_type} 为 OriginalVoice 或 ModulatedVoice 时,{input_audio_url} 必填");
+                throw new CustException("当 {driver_type} 为 OriginalVoice 或 ModulatedVoice 时,{input_audio_url} 必填");
             }
         }
         // ---------------------------------------------------------------------------
@@ -282,7 +282,7 @@ public class AiivhMakeBroadcastTaskServiceImpl implements AiivhMakeBroadcastTask
             String videoparam_background_file_url = video_param.getBackground_file_url();
             String[] videoparam_background_file_url_suffix = new String[]{"jpg", "png", "mp4"};
             if (!StrUtil.isBlank(videoparam_background_file_url) && !ResourceUtil.checkUrlSuffix(videoparam_background_file_url, videoparam_background_file_url_suffix)) {
-                throw new CustomException("字段 {video_param.background_file_url} 格式必须是 " + Arrays.toString(videoparam_background_file_url_suffix));
+                throw new CustException("字段 {video_param.background_file_url} 格式必须是 " + Arrays.toString(videoparam_background_file_url_suffix));
             }
             // ---------------------------------------------------------------------------
             // [判断] video_param.head_file_url、video_param.tail_file_url 文件类型
@@ -290,10 +290,10 @@ public class AiivhMakeBroadcastTaskServiceImpl implements AiivhMakeBroadcastTask
             String videoparam_tail_file_url = video_param.getTail_file_url();
             String[] videoparam_file_url_suffix = new String[]{"mp4"};
             if (!StrUtil.isBlank(videoparam_head_file_url) && !ResourceUtil.checkUrlSuffix(videoparam_head_file_url, videoparam_file_url_suffix)) {
-                throw new CustomException("字段 {video_param.head_file_url} 格式必须是 " + Arrays.toString(videoparam_file_url_suffix));
+                throw new CustException("字段 {video_param.head_file_url} 格式必须是 " + Arrays.toString(videoparam_file_url_suffix));
             }
             if (!StrUtil.isBlank(videoparam_tail_file_url) && !ResourceUtil.checkUrlSuffix(videoparam_tail_file_url, videoparam_file_url_suffix)) {
-                throw new CustomException("字段 {video_param.tail_file_url} 格式必须是 " + Arrays.toString(videoparam_file_url_suffix));
+                throw new CustException("字段 {video_param.tail_file_url} 格式必须是 " + Arrays.toString(videoparam_file_url_suffix));
             }
             // ---------------------------------------------------------------------------
 
@@ -304,7 +304,7 @@ public class AiivhMakeBroadcastTaskServiceImpl implements AiivhMakeBroadcastTask
                 String logo_param_file_url = logo_params.get(0).getLogo_file_url();
                 String[] logoparam_file_url_suffix = new String[]{"jpg", "png"};
                 if (!StrUtil.isBlank(logo_param_file_url) && !ResourceUtil.checkUrlSuffix(logo_param_file_url, logoparam_file_url_suffix)) {
-                    throw new CustomException("字段 {video_param.logo_params.file_url} 格式必须是 " + Arrays.toString(logoparam_file_url_suffix));
+                    throw new CustException("字段 {video_param.logo_params.file_url} 格式必须是 " + Arrays.toString(logoparam_file_url_suffix));
                 }
             }
 
@@ -340,7 +340,7 @@ public class AiivhMakeBroadcastTaskServiceImpl implements AiivhMakeBroadcastTask
         Integer respHeaderCode = (Integer) MapUtil.get(resp, "Header.Code");
         if (respHeaderCode != null && respHeaderCode != 0) {
             String respHeaderMessage = (String) MapUtil.get(resp, "Header.Message");
-            throw new CustomException("(" + respHeaderCode + ") " + respHeaderMessage);
+            throw new CustException("(" + respHeaderCode + ") " + respHeaderMessage);
         }
         String task_id = (String) MapUtil.get(resp, "Payload.TaskId");
         vo.put("task_id", task_id);
@@ -376,11 +376,11 @@ public class AiivhMakeBroadcastTaskServiceImpl implements AiivhMakeBroadcastTask
         Map<String, Object> detail = aiivhMakeBroadcastTaskMapper.queryAiivhMakeBroadcastTaskDetail(aiivhMakeBroadcastTaskDTO);
 
         if (detail == null) {
-            throw new CustomException("(task_id) 找不到任务");
+            throw new CustException("(task_id) 找不到任务");
         } else {
             String task_status = (String) detail.get("task_status");
             if (!task_status.equals("CONFIRM")) {
-                throw new CustomException("(task_id) 任务结果不可重复更新");
+                throw new CustException("(task_id) 任务结果不可重复更新");
             }
         }
 

+ 2 - 2
src/main/java/com/backendsys/service/Ai/Aiivh/AiivhMakeVirtualmanTaskServiceImpl.java

@@ -3,7 +3,7 @@ package com.backendsys.service.Ai.Aiivh;
 import com.backendsys.entity.Ai.Aiivh.AiPersonDTO;
 import com.backendsys.entity.Ai.Aiivh.AiPersonTimbreCustomDTO;
 import com.backendsys.entity.Ai.Aiivh.AiivhAnchorDTO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.Ai.Aiivh.AiivhMakeVirtualmanTaskMapper;
 import com.backendsys.utils.response.PageInfoResult;
 import com.github.pagehelper.PageHelper;
@@ -37,7 +37,7 @@ public class AiivhMakeVirtualmanTaskServiceImpl implements AiivhMakeVirtualmanTa
     public Map<String, Object> queryAiivhMakeVirtualmanTaskDetail(AiPersonDTO aiPersonDTO) {
 
         Map<String, Object> response = aiivhMakeVirtualmanTaskMapper.queryAiivhMakeVirtualmanTaskDetail(aiPersonDTO);
-        if (response == null) throw new CustomException("找不到任务");
+        if (response == null) throw new CustException("找不到任务");
 
         String anchor_name_timestamp = (String) response.get("anchor_name");
         String[] parts = anchor_name_timestamp.split("__");

+ 7 - 7
src/main/java/com/backendsys/service/Ai/Aiivh/AiivhQuotaServiceImpl.java

@@ -10,7 +10,7 @@ import com.backendsys.entity.System.SysUserPointsDTO;
 import com.backendsys.enums.IvhQuotaActiveEvent;
 import com.backendsys.enums.UserPointActivityType;
 import com.backendsys.enums.UserPointOperatorType;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.Ai.Aiivh.AiivhQuotaHistoryMapper;
 import com.backendsys.mapper.Ai.Aiivh.AiivhQuotaMapper;
 import com.backendsys.mapper.Ai.Aiivh.AiivhQuotaOrderMapper;
@@ -101,7 +101,7 @@ public class AiivhQuotaServiceImpl implements AiivhQuotaService{
                 timbre_subtotal_point = timbrePoint * quantity;
                 break;
             default:
-                throw new CustomException("orderType 不匹配");
+                throw new CustException("orderType 不匹配");
         }
         // 总计积分
         Float total_point = anchor_subtotal_point + timbre_subtotal_point;
@@ -131,7 +131,7 @@ public class AiivhQuotaServiceImpl implements AiivhQuotaService{
                 dto.setQuota_type("Timbre");
                 break;
             default:
-                throw new CustomException("increaseQuota is no match");
+                throw new CustException("increaseQuota is no match");
         }
         return dto;
     }
@@ -153,7 +153,7 @@ public class AiivhQuotaServiceImpl implements AiivhQuotaService{
                 aiivhQuotaHistoryDTOList.add(increaseQuotaHistory("Timbre", aiivhQuotaOrderDTO.getQuantity(), aiivhQuotaOrderDTO.getUser_id()));
                 break;
             default:
-                throw new CustomException("orderType 不匹配");
+                throw new CustException("orderType 不匹配");
         }
         return aiivhQuotaHistoryDTOList;
     }
@@ -177,7 +177,7 @@ public class AiivhQuotaServiceImpl implements AiivhQuotaService{
                 dto.setQuota_type("Timbre");
                 break;
             default:
-                throw new CustomException("increaseQuota is no match");
+                throw new CustException("increaseQuota is no match");
         }
 
         dto.setExpire_date(DateUtil.getAfterYear(1));
@@ -205,7 +205,7 @@ public class AiivhQuotaServiceImpl implements AiivhQuotaService{
                         aiivhQuotaDTOList.add(increaseQuota("Timbre", aiivhQuotaOrderDTO.getUser_id(), aiivhQuotaOrderDTO.getOrder_code()));
                         break;
                     default:
-                        throw new CustomException("orderType 不匹配");
+                        throw new CustException("orderType 不匹配");
                 }
             } catch (RuntimeException | ParseException e) {
                 throw new RuntimeException(e);
@@ -267,7 +267,7 @@ public class AiivhQuotaServiceImpl implements AiivhQuotaService{
 
             // 判断用户积分是否足够扣除
             if (origin_point_balance < aiivhQuotaOrderDTO.getTotal_point()) {
-                throw new CustomException("用户积分不足,当前积分: " + origin_point_balance + ", 需要积分: " + aiivhQuotaOrderDTO.getTotal_point());
+                throw new CustException("用户积分不足,当前积分: " + origin_point_balance + ", 需要积分: " + aiivhQuotaOrderDTO.getTotal_point());
             }
 
             // 4.[扣除] 用户信息中的积分字段 (sys_user_info 用户信息)

+ 3 - 3
src/main/java/com/backendsys/service/Ai/Aizn/AiznGoodServiceImpl.java

@@ -7,7 +7,7 @@ import com.backendsys.aspect.HttpRequestAspect;
 import com.backendsys.entity.Ai.Aizn.AiznGood.AiznGoodCompoundTask.AiznGoodCompoundTaskDTO;
 import com.backendsys.entity.Ai.Aizn.AiznGood.AiznGoodReplaceTask.AiznGoodReplaceTaskDTO;
 import com.backendsys.entity.Ai.Aizn.AiznImageTaskVO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.Ai.Aizn.AiznImageTaskMapper;
 import com.backendsys.service.System.SysResourceService;
 import com.backendsys.utils.MapUtil;
@@ -103,7 +103,7 @@ public class AiznGoodServiceImpl implements AiznGoodService {
 
             } else {
                 System.out.println(resp);
-                throw new CustomException((String) resp.get("msg"));
+                throw new CustException((String) resp.get("msg"));
             }
 
         } catch (InterruptedException e) { throw new RuntimeException(e);
@@ -165,7 +165,7 @@ public class AiznGoodServiceImpl implements AiznGoodService {
 
             } else {
                 System.out.println(resp);
-                throw new CustomException((String) resp.get("msg"));
+                throw new CustException((String) resp.get("msg"));
             }
 
         } catch (InterruptedException e) { throw new RuntimeException(e);

+ 5 - 5
src/main/java/com/backendsys/service/Ai/Aizn/AiznImageTaskServiceImpl.java

@@ -7,7 +7,7 @@ import cn.hutool.json.JSONUtil;
 import com.backendsys.entity.Ai.Aizn.AiznImageTaskVO;
 import com.backendsys.entity.Tencent.TencentCos.UploadOriginDTO;
 import com.backendsys.entity.Tencent.TencentCos.UploadOriginResp;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.Ai.Aizn.AiznImageTaskMapper;
 import com.backendsys.service.SDKService.SDKTencent.SDKTencentCOSService;
 import com.backendsys.utils.MapUtil;
@@ -50,7 +50,7 @@ public class AiznImageTaskServiceImpl implements AiznImageTaskService {
         AiznImageTaskVO aiznImageTaskVO = new AiznImageTaskVO();
         aiznImageTaskVO.setTask_id(id);
         Map<String, Object> detail = aiznImageTaskMapper.queryAiznImageTaskDetail(aiznImageTaskVO);
-        if (detail == null) throw new CustomException("任务ID不存在");
+        if (detail == null) throw new CustException("任务ID不存在");
 
         // -- 如果已有结果 (status = 3),则不必再查询/上传储存桶,仅返回原始数据 {task_result_json} --
         if ((Integer) detail.get("status") != 3) {
@@ -124,7 +124,7 @@ public class AiznImageTaskServiceImpl implements AiznImageTaskService {
 
             } else {
                 System.out.println(resp);
-                throw new CustomException((String) resp.get("msg"));
+                throw new CustException((String) resp.get("msg"));
             }
 
         } else {
@@ -138,7 +138,7 @@ public class AiznImageTaskServiceImpl implements AiznImageTaskService {
         List<String> idsArray = StrUtil.split(ids, ',');
 
         if (idsArray.size() == 0 || idsArray.size() > 10) {
-            throw new CustomException("批量查询范围是: 1~10 条");
+            throw new CustException("批量查询范围是: 1~10 条");
         }
 
         String[] integerIdsArray = Convert.toStrArray(idsArray);
@@ -182,7 +182,7 @@ public class AiznImageTaskServiceImpl implements AiznImageTaskService {
     @Override
     public Map<String, Object> getImageTaskDetail(AiznImageTaskVO aiznImageTaskVO) {
         Map<String, Object> resp = aiznImageTaskMapper.queryAiznImageTaskDetail(aiznImageTaskVO);
-        if (resp == null) throw new CustomException("任务ID不存在");
+        if (resp == null) throw new CustException("任务ID不存在");
 
         // result_image_url 转 数组类型
         String imgUrls = (String) resp.get("result_image_url");

+ 6 - 6
src/main/java/com/backendsys/service/Ai/Aizn/AiznModelServiceImpl.java

@@ -4,13 +4,13 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.backendsys.aspect.HttpRequestAspect;
+import com.backendsys.exception.CustException;
 import com.backendsys.modules.common.config.redis.utils.RedisUtil;
 import com.backendsys.entity.Ai.Aizn.AiznImageStyleDTO;
 import com.backendsys.entity.Ai.Aizn.AiznIntelligentClipTaskDTO;
 import com.backendsys.entity.Ai.Aizn.AiznImageTaskVO;
 import com.backendsys.entity.Ai.Aizn.AiznInteractClipTask.AiznInteractClipTaskDTO;
 import com.backendsys.entity.Ai.Aizn.AiznModel.AiznModelTaskDTO;
-import com.backendsys.exception.CustomException;
 import com.backendsys.mapper.Ai.Aizn.AiznImageTaskMapper;
 import com.backendsys.service.SDKService.SDKTencent.SDKTencentCOSService;
 import com.backendsys.service.System.SysResourceService;
@@ -123,7 +123,7 @@ public class AiznModelServiceImpl implements AiznModelService {
             } else {
                 System.out.println(resp);
                 Integer code = resp.get("code") != null ? (Integer) resp.get("code") : 6001;
-                throw new CustomException("功能暂不可用,请联系管理员", code, resp);
+                throw new CustException("功能暂不可用,请联系管理员", code, resp);
             }
 
         }
@@ -180,7 +180,7 @@ public class AiznModelServiceImpl implements AiznModelService {
             } else {
                 System.out.println(resp);
                 Integer code = resp.get("code") != null ? (Integer) resp.get("code") : 6001;
-                throw new CustomException("功能暂不可用,请联系管理员", code, resp);
+                throw new CustException("功能暂不可用,请联系管理员", code, resp);
             }
 
         } catch (InterruptedException e) { throw new RuntimeException(e);
@@ -235,7 +235,7 @@ public class AiznModelServiceImpl implements AiznModelService {
             } else {
                 System.out.println(resp);
                 Integer code = resp.get("code") != null ? (Integer) resp.get("code") : 6001;
-                throw new CustomException("功能暂不可用,请联系管理员", code, resp);
+                throw new CustException("功能暂不可用,请联系管理员", code, resp);
             }
 
         } catch (InterruptedException e) { throw new RuntimeException(e);
@@ -255,7 +255,7 @@ public class AiznModelServiceImpl implements AiznModelService {
 
 //            // 自定义描述时 scene 字段不能跟 style 字段共存,
 //            if (aiznModelTaskDTO.getStyle() != null && aiznModelTaskDTO.getExtend_fields().getScene() != null) {
-//                throw new CustomException("自定义描述时,style 与 extend_fields.scene 不能共存");
+//                throw new CustException("自定义描述时,style 与 extend_fields.scene 不能共存");
 //            }
 
             // -- 业务参数 -------------------------------------------------------------------
@@ -316,7 +316,7 @@ public class AiznModelServiceImpl implements AiznModelService {
             } else {
                 System.out.println(resp);
                 Integer code = resp.get("code") != null ? (Integer) resp.get("code") : 6001;
-                throw new CustomException("功能暂不可用,请联系管理员", code, resp);
+                throw new CustException("功能暂不可用,请联系管理员", code, resp);
             }
 
         } catch (InterruptedException e) { throw new RuntimeException(e);

+ 3 - 3
src/main/java/com/backendsys/service/Ai/Aizn/AiznServiceImpl.java

@@ -2,7 +2,7 @@ package com.backendsys.service.Ai.Aizn;
 
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.fzzixun.openapi.sdk.client.OpenClient;
 import com.fzzixun.openapi.sdk.request.AppTokenRequest;
 import com.fzzixun.openapi.sdk.response.AppTokenResponse;
@@ -39,7 +39,7 @@ public class AiznServiceImpl implements AiznService{
             AppTokenResponse appTokenResponse = response.getDataObj(AppTokenResponse.class);
             return appTokenResponse.getAppAuthToken();
         } else {
-            throw new CustomException(response.getErrorMsg());
+            throw new CustException(response.getErrorMsg());
         }
     }
 
@@ -60,7 +60,7 @@ public class AiznServiceImpl implements AiznService{
         } else {
             System.out.println(response.getBody());
             System.out.println(response.getErrorMsg());
-            throw new CustomException(response.getErrorMsg());
+            throw new CustException(response.getErrorMsg());
         }
     }
 

+ 6 - 6
src/main/java/com/backendsys/service/KeyPair/KeyPairServiceImpl.java

@@ -1,7 +1,7 @@
 package com.backendsys.service.KeyPair;
 
 import com.backendsys.entity.KeyPair.KeyPairDTO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import org.springframework.stereotype.Service;
 
 import javax.crypto.BadPaddingException;
@@ -36,7 +36,7 @@ public class KeyPairServiceImpl implements KeyPairService{
             keyPairDTO.setPublic_key(publicKeyString);
             keyPairDTO.setPrivate_key(privateKeyString);
         } catch (NoSuchAlgorithmException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
         return keyPairDTO;
     }
@@ -52,7 +52,7 @@ public class KeyPairServiceImpl implements KeyPairService{
             PublicKey publicKeyRecovered = keyFactory.generatePublic(keySpec);
             return publicKeyRecovered;
         } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
     }
     /**
@@ -66,7 +66,7 @@ public class KeyPairServiceImpl implements KeyPairService{
             PrivateKey privateKeyRecovered = keyFactory.generatePrivate(keySpec);
             return privateKeyRecovered;
         } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
     }
 
@@ -82,7 +82,7 @@ public class KeyPairServiceImpl implements KeyPairService{
             String encryptedString = new String(encryptedData);
             return encryptedString;
         } catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
     }
 
@@ -99,7 +99,7 @@ public class KeyPairServiceImpl implements KeyPairService{
             String decryptedString = new String(decryptedData);
             return decryptedString;
         } catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
     }
 

+ 3 - 3
src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentAiServiceImpl.java

@@ -2,7 +2,7 @@ package com.backendsys.service.SDKService.SDKTencent;
 
 import cn.hutool.core.convert.Convert;
 import com.backendsys.entity.SDKEntity.TencentCOSCredentialsDTO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.utils.MapUtil;
 import com.qcloud.cos.COSClient;
 import com.qcloud.cos.ClientConfig;
@@ -59,14 +59,14 @@ public class SDKTencentAiServiceImpl implements SDKTencentAiService {
             if (respHeaderCode != 0) {
                 String respHeaderMessage = (String) MapUtil.get(resp, "Header.Message");
                 System.out.println(resp);
-                throw new CustomException("(" + respHeaderCode + ") " + respHeaderMessage);
+                throw new CustException("(" + respHeaderCode + ") " + respHeaderMessage);
             }
 //            Map<String, Object> respPayload = (Map<String, Object>) resp.get("Payload");
             Map<String, Object> respPayload = Convert.toMap(String.class, Object.class, resp.get("Payload"));
 
             return respPayload;
         }
-        throw new CustomException("resp is null");
+        throw new CustException("resp is null");
     }
 
 

+ 4 - 4
src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentAiVirtualmanServiceImpl.java

@@ -12,7 +12,7 @@ import com.backendsys.entity.Ai.Aiivh.AiivhMakeBroadcastTask.VideoParamDTO;
 import com.backendsys.entity.Ai.Aiivh.AiivhMakeBroadcastTask.VideoParamLogoParamDTO;
 import com.backendsys.entity.Tencent.*;
 import com.backendsys.enums.IvhQuotaActiveEvent;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.Ai.Aiivh.AiivhQuotaHistoryMapper;
 import com.backendsys.mapper.Ai.Aiivh.AiivhQuotaMapper;
 import com.backendsys.service.Ai.Aiivh.AiivhAssetService;
@@ -429,7 +429,7 @@ public class SDKTencentAiVirtualmanServiceImpl implements SDKTencentAiVirtualman
         })).collect(Collectors.toList());
 
         if (myQuota.size() == 0) {
-            throw new CustomException("(" + makeType + ") 配额不足");
+            throw new CustException("(" + makeType + ") 配额不足");
         } else {
             // 获得最近临期的那一条配额
             Map<String, Object> targetQuota = myQuota.get(0);
@@ -470,7 +470,7 @@ public class SDKTencentAiVirtualmanServiceImpl implements SDKTencentAiVirtualman
             }
 
             if (quota_balance <= 0) {
-                throw new CustomException("(" + makeType + ") 配额不足");
+                throw new CustException("(" + makeType + ") 配额不足");
             } else {
 
                 // -- 1.查询我的配额,并获得有效(类型匹配,状态可用,未过期),最近临期的那一条配额 -----------------------------
@@ -540,7 +540,7 @@ public class SDKTencentAiVirtualmanServiceImpl implements SDKTencentAiVirtualman
         if (respHeaderCode != 0) {
             // {Header={RequestID=gz6c6d3da317138514464456410, SessionID=gz6c6d3da317138514464456411, DialogID=, Code=100008, Message=LimitExceeded:超过配额限制: AssetInsufficientError:无可用配额}}
             String message = (String) MapUtil.get(resp, "Header.Message");
-            throw new CustomException(message);
+            throw new CustException(message);
         } else {
             // 2.更新 任务ID、腾讯订单号、备注
             String task_id = (String) MapUtil.get(resp, "Payload.TaskId");

+ 22 - 22
src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentCOSServiceImpl.java

@@ -13,7 +13,7 @@ import com.backendsys.entity.Tencent.TencentCos.MultipartUploadDTO;
 import com.backendsys.entity.Tencent.TencentCos.TempCredentialsDTO;
 import com.backendsys.entity.Tencent.TencentCos.UploadOriginDTO;
 import com.backendsys.entity.Tencent.TencentCos.UploadOriginResp;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.System.SysFileCategoryMapper;
 import com.backendsys.mapper.System.SysFileMapper;
 import com.backendsys.service.System.SysFileService;
@@ -188,7 +188,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
 
         } catch (Exception e) {
             e.printStackTrace();
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
 
     }
@@ -481,7 +481,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
      */
     public UploadOriginResp uploadOrigin(UploadOriginDTO uploadOriginDTO) throws IOException {
 
-        if (uploadOriginDTO.getUrl() == null) throw new CustomException("图片不能为空");
+        if (uploadOriginDTO.getUrl() == null) throw new CustException("图片不能为空");
 
         // 获得自身 user_id
         Long user_id = httpRequestAspect.getUserId();
@@ -493,7 +493,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
         HttpURLConnection connection = (HttpURLConnection) url.openConnection();
         connection.connect();
         int responseCode = connection.getResponseCode();
-        if (responseCode != HttpURLConnection.HTTP_OK) throw new CustomException("文件失效或已过期");
+        if (responseCode != HttpURLConnection.HTTP_OK) throw new CustException("文件失效或已过期");
 
         // 获取系统默认的临时目录
         Path tempDirPath = Paths.get(System.getProperty("java.io.tmpdir"));
@@ -639,11 +639,11 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
     public MultipartUploadRespDTO simpleUpload(MultipartFile file) {
 
         // 检查上传的文件是否为空
-        if (file == null || file.isEmpty()) throw new CustomException("file 上传文件不能为空");
+        if (file == null || file.isEmpty()) throw new CustException("file 上传文件不能为空");
 
         // 判断文件大小是否超过
         if (file.getSize() > maxSize) {
-            throw new CustomException("上传文件不能大于 " + maxSize/1024/1024 + " MB,如有需要请使用大文件上传功能");
+            throw new CustException("上传文件不能大于 " + maxSize/1024/1024 + " MB,如有需要请使用大文件上传功能");
         }
 
         // 生成cos客户端
@@ -754,7 +754,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
             resp.setPath(remotePath);
 
         } catch (IOException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         } finally {
             if (cosClient != null) {
                 cosClient.shutdown();
@@ -797,7 +797,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
             return resp;
 
         } catch (CosServiceException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
     }
     // -- 上传分块 ------------------------------------------------------------------------------------
@@ -832,9 +832,9 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
 
         } catch (CosServiceException e) {
             if ("NoSuchUpload".equals(e.getErrorCode())) {
-                throw new CustomException("找不到相关的 upload_id 或 key 信息,任务已终止或已完成");
+                throw new CustException("找不到相关的 upload_id 或 key 信息,任务已终止或已完成");
             }
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
@@ -888,7 +888,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
             System.out.println("getErrorCode:");
             System.out.println(e.getErrorCode());
             System.out.println(e.getMessage());
-            throw new CustomException("合并失败,无效的分块,请重新上传", 6001, "(" + e.getErrorCode() + ") " + e.getMessage());
+            throw new CustException("合并失败,无效的分块,请重新上传", 6001, "(" + e.getErrorCode() + ") " + e.getMessage());
         }
     }
     // -- 获得分类 CategoryID (通过文件后缀名) -----------------------------------------------------------
@@ -911,15 +911,15 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
     public MultipartUploadRespDTO multipartUpload(MultipartUploadDTO multipartUploadDTO) {
 
         // -- 参数校验 ------------------------------------------------------
-        if (multipartUploadDTO.getFile() == null || multipartUploadDTO.getFile().isEmpty()) throw new CustomException("file 上传文件不能为空");
+        if (multipartUploadDTO.getFile() == null || multipartUploadDTO.getFile().isEmpty()) throw new CustException("file 上传文件不能为空");
 
         // 当存在 uploadId 时,即是分块上传阶段
         if (multipartUploadDTO.getUpload_id() != null) {
-            if (multipartUploadDTO.getKey() == null) throw new CustomException("key 不能为空");
-            if (multipartUploadDTO.getIndex() == null) throw new CustomException("index 不能为空");
-            if (multipartUploadDTO.getCount() == null) throw new CustomException("count 不能为空");
+            if (multipartUploadDTO.getKey() == null) throw new CustException("key 不能为空");
+            if (multipartUploadDTO.getIndex() == null) throw new CustException("index 不能为空");
+            if (multipartUploadDTO.getCount() == null) throw new CustException("count 不能为空");
             if (multipartUploadDTO.getIndex() > multipartUploadDTO.getCount()) {
-                throw new CustomException("index 不能大于 count");
+                throw new CustException("index 不能大于 count");
             }
         }
         // -----------------------------------------------------------------
@@ -987,7 +987,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
 
 //                        // 上传要求每个分块大小必须大于 1MB,所以整个文件也不能小于 1MB
 //                        if (multipartUploadDTO.getFile().getSize() < 1 * 1024 * 1024) {
-//                            throw new CustomException("上传文件不能小于1MB");
+//                            throw new CustException("上传文件不能小于1MB");
 //                        }
 
                         // -- [初始化] 第一次上传,无 uploadId ---------------------
@@ -1012,7 +1012,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
                     // 分块上传要求每个分块大小必须大于 1MB (最后一个例外)
                     if (resp.getIndex() != resp.getCount()) {
                         if (multipartUploadDTO.getFile().getSize() < 1 * 1024 * 1024) {
-                            throw new CustomException("分块文件不能小于1MB");
+                            throw new CustException("分块文件不能小于1MB");
                         }
                     }
 
@@ -1074,7 +1074,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
             }
 
         } catch (IOException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         } finally {
             if (cosClient != null) {
                 cosClient.shutdown();
@@ -1102,9 +1102,9 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
             System.out.println(e.getErrorCode());
             System.out.println(e.getMessage());
             if ("NoSuchUpload".equals(e.getErrorCode())) {
-                throw new CustomException("找不到相关的 upload_id 或 key 信息,任务已终止或已完成");
+                throw new CustException("找不到相关的 upload_id 或 key 信息,任务已终止或已完成");
             }
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         }
 
         // 确保不再使用 cosClient 之后,关闭即可
@@ -1143,7 +1143,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
 
         // -- [DB] 判断记录是否存在 --------------------------------
         SysFileDTO fileDetail = sysFileMapper.queryFileByKey(key);
-        if (fileDetail == null) throw new CustomException("文件记录不存在");
+        if (fileDetail == null) throw new CustException("文件记录不存在");
 
         // -- [DB] 删除存储桶中的文件 -------------------------------
         // -- 创建异步上传任务 ---------------------------------------------------------------------

+ 6 - 6
src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentSMSServiceImpl.java

@@ -7,7 +7,7 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.backendsys.modules.common.config.redis.utils.RedisUtil;
 import com.backendsys.entity.System.SysSMSDTO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.System.SysMobileSMSHistoryMapper;
 import com.backendsys.utils.MapUtil;
 import com.tencentcloudapi.common.Credential;
@@ -60,7 +60,7 @@ public class SDKTencentSMSServiceImpl implements SDKTencentSMSService {
     private Map<String, Object> getCurrentAndBeforeDate(String beginTime, String endTime, Integer n) {
 
         if (beginTime != null && endTime != null && Long.valueOf(beginTime) > Long.valueOf(endTime)) {
-            throw new CustomException("开始时间不能大于结束时间");
+            throw new CustException("开始时间不能大于结束时间");
         }
         // 获取当前时间
         Date now = new Date();
@@ -101,7 +101,7 @@ public class SDKTencentSMSServiceImpl implements SDKTencentSMSService {
 //                String code = (String) phoneInfo.get("code");
 //                if (!"Ok".equals(code)) {
 //                    String message = (String) phoneInfo.get("message");
-//                    throw new CustomException("发送失败,请检查手机号码格式", 6001, phoneInfo);
+//                    throw new CustException("发送失败,请检查手机号码格式", 6001, phoneInfo);
 //                }
 //            }
 
@@ -160,7 +160,7 @@ public class SDKTencentSMSServiceImpl implements SDKTencentSMSService {
                 // 发送成功后,留下记录
                 sysMobileSMSHistoryMapper.insertMobileSMSHistory(sysSMSDTO);
             } else {
-                throw new CustomException(message);
+                throw new CustException(message);
             }
 
         } catch (TencentCloudSDKException e) {
@@ -182,7 +182,7 @@ public class SDKTencentSMSServiceImpl implements SDKTencentSMSService {
             if (limitCount == null) {
                 limitCount = 100L;
             } else if (limitCount <= 0 || limitCount > 100) {
-                throw new CustomException("limit 范围在 1~100");
+                throw new CustException("limit 范围在 1~100");
             }
 
             // ----------------------------------------------------------------------
@@ -361,7 +361,7 @@ public class SDKTencentSMSServiceImpl implements SDKTencentSMSService {
 //        try {
 //
 //            if (phones == null) {
-//                throw new CustomException("手机号码不能为空");
+//                throw new CustException("手机号码不能为空");
 //            }
 //            String[] phoneNumberSet = phones.split(",");
 //

+ 15 - 15
src/main/java/com/backendsys/service/System/SysAuthServiceImpl.java

@@ -2,12 +2,12 @@ package com.backendsys.service.System;
 
 import cn.hutool.json.JSONUtil;
 import com.backendsys.config.Kaptcha.KaptchaUtil;
+import com.backendsys.exception.CustException;
 import com.backendsys.modules.common.config.redis.utils.RedisUtil;
 import com.backendsys.modules.common.config.security.entity.SecurityUserInfo;
 import com.backendsys.modules.common.config.security.utils.TokenUtil;
 import com.backendsys.modules.system.dao.SysUserInfoDao;
 import com.backendsys.entity.System.SysUserDTO;
-import com.backendsys.exception.CustomException;
 import com.backendsys.service.SDKService.SDKTencent.SDKTencentSMSService;
 import com.backendsys.utils.CountUtil;
 import com.backendsys.utils.UserUtils;
@@ -148,8 +148,8 @@ public class SysAuthServiceImpl implements SysAuthService {
 
         // 判断用户是否已审核
         Integer auditStatus = (Integer) sysUserDetail.get("audit_status");
-        if (auditStatus == 1) throw new CustomException("请等待管理员审核");
-        if (auditStatus == -1) throw new CustomException("审核未通过,请联系客服获取详细信息");
+        if (auditStatus == 1) throw new CustException("请等待管理员审核");
+        if (auditStatus == -1) throw new CustException("审核未通过,请联系客服获取详细信息");
 
         // [Redis] 删除旧 Redis Key
         String old_uuid = (String) sysUserDetail.get("last_login_uuid");
@@ -157,7 +157,7 @@ public class SysAuthServiceImpl implements SysAuthService {
 
         // 3.判断用户 status 是否启用
         Object status = sysUserDetail.get("status");
-        if (status != null && (Integer) status == -1) throw new CustomException("该用户已被禁用");
+        if (status != null && (Integer) status == -1) throw new CustException("该用户已被禁用");
 
         // 4.格式化 modules: [{ id: 1, module_code: "xxx" }] 转为 ["1.x.x", "2.x.x"] (减少 Token 长度)
         List<Map<String, Object>> roles = (List<Map<String, Object>>) sysUserDetail.get("roles");
@@ -235,7 +235,7 @@ public class SysAuthServiceImpl implements SysAuthService {
         // [Method] 判断验证码是否正确
         if (!isCaptchaValid(captcha, captchaRedisKey)) {
             stringRedisTemplate.delete(captchaRedisKey);
-            throw new CustomException("验证码错误", ResultEnum.INVALID_CREDENTIALS.getCode());
+            throw new CustException("验证码错误", ResultEnum.INVALID_CREDENTIALS.getCode());
         }
 
         // [Method] 判断 用户 是否存在 && 密码是否正确
@@ -248,7 +248,7 @@ public class SysAuthServiceImpl implements SysAuthService {
             // 添加错误标记 (2分钟内错误5次,则出现提示)
             countUtil.setErrorCount("login-error", username);
             //
-            throw new CustomException("用户名或密码错误", ResultEnum.INVALID_CREDENTIALS.getCode());
+            throw new CustException("用户名或密码错误", ResultEnum.INVALID_CREDENTIALS.getCode());
         }
 
         // 1.作废验证码密钥
@@ -284,13 +284,13 @@ public class SysAuthServiceImpl implements SysAuthService {
         if ("false".equals(SMS_DEBUG) && (smsCode == null || !smsCode.equals(phoneValidCode))) {
             // 添加错误标记 (2分钟内错误5次,则出现提示)
             countUtil.setErrorCount("login-error", phone);
-            throw new CustomException("短信验证码错误", ResultEnum.INVALID_CREDENTIALS.getCode());
+            throw new CustException("短信验证码错误", ResultEnum.INVALID_CREDENTIALS.getCode());
         }
 
         // 判断手机号是否存在
         Map<String, Object> sysUserSimple = sysUserMapper.queryUserByIdOrName(null, null, phone, phoneAreaCode);
          if (sysUserSimple == null) {
-            throw new CustomException("手机号码不存在", ResultEnum.INVALID_CREDENTIALS.getCode());
+            throw new CustException("手机号码不存在", ResultEnum.INVALID_CREDENTIALS.getCode());
         } else {
             // 登录成功,销毁 smsCode
             redisUtil.deleteObject(redisKey);
@@ -323,7 +323,7 @@ public class SysAuthServiceImpl implements SysAuthService {
             String captchaRedisKey = KaptchaUtil.getKaptchaKey(request);
             if (!isCaptchaValid(captcha, captchaRedisKey)) {
                 stringRedisTemplate.delete(captchaRedisKey);
-                throw new CustomException("图形验证码错误");
+                throw new CustException("图形验证码错误");
             }
             // 如果是用手机号注册,则还需判断短信验证码是否正确
             if (sysUserDTO.getPhone() != null) {
@@ -336,18 +336,18 @@ public class SysAuthServiceImpl implements SysAuthService {
 
 
                 if ("false".equals(SMS_DEBUG) && (smsCode == null || !smsCode.equals(phoneValidCode))) {
-                    throw new CustomException("短信验证码错误");
+                    throw new CustException("短信验证码错误");
                 }
 
                 // 判断手机号是否已注册
                 Map<String, Object> sysUserSimple1 = sysUserMapper.queryUserByIdOrName(null, null, sysUserDTO.getPhone(), sysUserDTO.getPhone_area_code());
                 if (sysUserSimple1 != null) {
-                    throw new CustomException("手机号码已被注册");
+                    throw new CustException("手机号码已被注册");
                 }
                 // 判断用户名是否已注册
                 Map<String, Object> sysUserSimple2 = sysUserMapper.queryUserByIdOrName(null, sysUserDTO.getUsername(), null, null);
                 if (sysUserSimple2 != null) {
-                    throw new CustomException("用户名已被注册");
+                    throw new CustException("用户名已被注册");
                 }
 
                 // 判断密钥是否有效
@@ -406,13 +406,13 @@ public class SysAuthServiceImpl implements SysAuthService {
 //            System.out.println("smsCode: " + smsCode);
 
             if ("false".equals(SMS_DEBUG) && (smsCode == null || !smsCode.equals(phoneValidCode))) {
-                throw new CustomException("短信验证码错误");
+                throw new CustException("短信验证码错误");
             }
 
             // 2.判断手机号是否存在
             Map<String, Object> sysUserSimple = sysUserMapper.queryUserByIdOrName(null, null, sysUserDTO.getPhone(), sysUserDTO.getPhone_area_code());
             if (sysUserSimple == null) {
-                throw new CustomException("手机号码不存在");
+                throw new CustException("手机号码不存在");
             }
 
             // 3.更改密码
@@ -446,7 +446,7 @@ public class SysAuthServiceImpl implements SysAuthService {
             tokenUtil.deleteRedisToken();
             return Map.of("message", "退出成功");
         }
-        throw new CustomException(ResultEnum.TOKEN_EMPTY_ERROR.getMessage(), ResultEnum.TOKEN_EMPTY_ERROR.getCode());
+        throw new CustException(ResultEnum.TOKEN_EMPTY_ERROR.getMessage(), ResultEnum.TOKEN_EMPTY_ERROR.getCode());
     }
 
 }

+ 2 - 2
src/main/java/com/backendsys/service/System/SysResourceServiceImpl.java

@@ -6,7 +6,7 @@ import com.backendsys.entity.System.SysUserDTO;
 import com.backendsys.entity.System.SysUserPointsDTO;
 import com.backendsys.enums.UserPointActivityType;
 import com.backendsys.enums.UserPointOperatorType;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.System.SysResourcePointsMapper;
 import com.backendsys.mapper.System.SysUserMapper;
 import com.backendsys.mapper.System.SysUserPointsHistoryMapper;
@@ -57,7 +57,7 @@ public class SysResourceServiceImpl implements SysResourceService {
             Float my_point = (Float) myPointDetail.get("point_balance");
 
             if (consumption_point > my_point) {
-                throw new CustomException("用户积分不足,当前积分: " + my_point + ", 需要积分: " + consumption_point);
+                throw new CustException("用户积分不足,当前积分: " + my_point + ", 需要积分: " + consumption_point);
             }
 
             // 3.更新我的积分

+ 5 - 5
src/main/java/com/backendsys/service/System/SysUserPointHistoryServiceImpl.java

@@ -1,7 +1,7 @@
 package com.backendsys.service.System;
 
 import com.backendsys.entity.System.SysUserPointsDTO;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.mapper.System.SysUserMapper;
 import com.backendsys.mapper.System.SysUserPointsHistoryMapper;
 import com.backendsys.utils.response.PageInfoResult;
@@ -44,13 +44,13 @@ public class SysUserPointHistoryServiceImpl implements SysUserPointHistoryServic
             // [查询] 用户当前信息
             Map<String, Object> userDetail = sysUserMapper.queryUserDetail(sysUserPointsDTO.getTarget_user_id());
             if (userDetail == null) {
-                throw new CustomException("用户不存在");
+                throw new CustException("用户不存在");
             }
             if (!userDetail.get("audit_status").equals(2)) {
-                throw new CustomException("用户未通过审核");
+                throw new CustException("用户未通过审核");
             }
             if (!userDetail.get("status").equals(1)) {
-                throw new CustomException("用户未激活");
+                throw new CustException("用户未激活");
             }
 
             // -- 积分计算 (增加/减少) -------------------------------------------------
@@ -67,7 +67,7 @@ public class SysUserPointHistoryServiceImpl implements SysUserPointHistoryServic
                 // point_blance_total = (float) 0;
 
                 // 判断:如果操作后积分小于0,则抛出异常
-                throw new CustomException("积分不足");
+                throw new CustException("积分不足");
             }
 
             // 入参格式化

+ 2 - 2
src/main/java/com/backendsys/utils/CommonUtil.java

@@ -11,7 +11,7 @@ import java.util.Random;
 import java.util.UUID;
 
 import cn.hutool.core.date.DateUtil;
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import jakarta.servlet.http.HttpServletRequest;
 import org.springframework.stereotype.Component;
 
@@ -144,7 +144,7 @@ public class CommonUtil {
             int contentLength = connection.getContentLength();
             return (long) contentLength;
         } catch (MalformedURLException e) {
-            throw new CustomException(e.getMessage());
+            throw new CustException(e.getMessage());
         } catch (ProtocolException e) {
             throw new RuntimeException(e);
         } catch (IOException e) {

+ 3 - 3
src/main/java/com/backendsys/utils/CountUtil.java

@@ -1,6 +1,6 @@
 package com.backendsys.utils;
 
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 import com.backendsys.utils.response.ResultEnum;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
@@ -24,7 +24,7 @@ public class CountUtil {
         if (errValue == null) {
             errValue = "1";
         } else if (Integer.valueOf(errValue) >= 5) {
-            throw new CustomException("错误次数过多,为账号安全,请等待" + timeout + "分钟后重新尝试", ResultEnum.LOCK_CREDENTIALS.getCode());
+            throw new CustException("错误次数过多,为账号安全,请等待" + timeout + "分钟后重新尝试", ResultEnum.LOCK_CREDENTIALS.getCode());
         } else {
             errValue = String.valueOf((Integer.valueOf(errValue) + 1));
         }
@@ -38,7 +38,7 @@ public class CountUtil {
         String errKey = key + "-" + tag;
         String errValue = stringRedisTemplate.opsForValue().get(errKey);
         if (errValue != null && Integer.valueOf(errValue) >= 5) {
-            throw new CustomException("错误次数过多,为账号安全,请等待" + timeout + "分钟后重新尝试", ResultEnum.LOCK_CREDENTIALS.getCode());
+            throw new CustException("错误次数过多,为账号安全,请等待" + timeout + "分钟后重新尝试", ResultEnum.LOCK_CREDENTIALS.getCode());
         }
     }
 

+ 2 - 2
src/main/java/com/backendsys/utils/IDUtil.java

@@ -1,6 +1,6 @@
 package com.backendsys.utils;
 
-import com.backendsys.exception.CustomException;
+import com.backendsys.exception.CustException;
 
 import java.util.Calendar;
 import java.util.Random;
@@ -24,7 +24,7 @@ public class IDUtil {
         long baseNumber = year * 10000 + month * 100 + day * ID;
 
         // 预留4位给日期+ID的计算 (10的4次方)
-        if (digits < 6) throw new CustomException("(IDUtil.generateUniqueID) digits 不能小于 6");
+        if (digits < 6) throw new CustException("(IDUtil.generateUniqueID) digits 不能小于 6");
         Integer length = (int) Math.pow(10, (digits - 6));
 
         // 生成4位随机数作为序列号,确保在同一天同一用户不会产生重复

+ 3 - 8
src/main/resources/application-local.yml

@@ -2,9 +2,9 @@ server:
   port: 48080
 
 # 注意:
-
-
-
+# 1. 修改服务器内网IP:ip addr show dev eth0 (一般是 eth0: 172.19.0.7)
+# 2. 修改内置数据库:mysql库 -> user表 -> root用户的 Host 改为 % (默认有不用改)
+# 3. 修改内置Redis conf:bind 172.19.0.7 (重启)
 
 # 远程抓取的链接
 HTTP_BASE_URI: http://127.0.0.1:48080
@@ -17,11 +17,6 @@ log-stream:
   charset: UTF-8 # GBK #
   exec: 'powershell -Command "Get-Content -Path D:\CodeJava\QuickLaunchSpring\BackendSys\logs\backendsys.log -Wait"'
 
-ding-talk:
-  enable: true
-  secret: SECf936313d718270626986fea3f1a6bfe2640f3cb653f45aa12ad68e7ddfd8c945
-  webhook: 'https://oapi.dingtalk.com/robot/send?access_token=6c677738c71a91ad096499784aa6bd0bb19ed99c2be99d31552ae3bb8fa7d5d5'
-
 spring:
   config:
     name: application-local

+ 0 - 4
src/main/resources/application-prod.yml

@@ -17,10 +17,6 @@ log-stream:
   charset: UTF-8
   exec: 'tail -f /logs/backendsys.log'
 
-ding-talk:
-  secret: SECf936313d718270626986fea3f1a6bfe2640f3cb653f45aa12ad68e7ddfd8c945
-  webhook: 'https://oapi.dingtalk.com/robot/send?access_token=6c677738c71a91ad096499784aa6bd0bb19ed99c2be99d31552ae3bb8fa7d5d5'
-
 spring:
   config:
     name: application-prod