Kaynağa Gözat

数据库优化

xiongzhu 3 yıl önce
ebeveyn
işleme
8a6ceff2a0

+ 5 - 11
pom.xml

@@ -52,14 +52,6 @@
                     </excludes>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>9</source>
-                    <target>9</target>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 
@@ -135,6 +127,7 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
         </dependency>
 
         <dependency>
@@ -376,7 +369,7 @@
         <dependency>
             <groupId>net.coobird</groupId>
             <artifactId>thumbnailator</artifactId>
-            <version>0.4.14</version>
+            <version>0.4.17</version>
         </dependency>
 
         <dependency>
@@ -400,7 +393,7 @@
         <dependency>
             <groupId>org.apache.rocketmq</groupId>
             <artifactId>rocketmq-spring-boot-starter</artifactId>
-            <version>2.2.0</version>
+            <version>2.2.1</version>
         </dependency>
 
         <dependency>
@@ -424,8 +417,9 @@
         <dependency>
             <groupId>com.github.marschall</groupId>
             <artifactId>hibernate-batch-sequence-generator</artifactId>
-            <version>1.2.0</version>
+            <version>2.0.1</version>
         </dependency>
+
     </dependencies>
 
 </project>

+ 6 - 7
src/main/java/com/izouma/nineth/service/sms/AliSmsService.java

@@ -1,10 +1,11 @@
 package com.izouma.nineth.service.sms;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.CommonRequest;
 import com.aliyuncs.CommonResponse;
 import com.aliyuncs.DefaultAcsClient;
 import com.aliyuncs.IAcsClient;
-import com.aliyuncs.exceptions.ClientException;
 import com.aliyuncs.http.MethodType;
 import com.aliyuncs.profile.DefaultProfile;
 import com.izouma.nineth.config.Constants;
@@ -17,8 +18,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.configurationprocessor.json.JSONException;
-import org.springframework.boot.configurationprocessor.json.JSONObject;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
@@ -85,7 +84,7 @@ public class AliSmsService implements SmsService {
                 throw new BusinessException("发送失败,请稍后再试", response.getHttpStatus() + "," + response.getData());
             }
             log.info("send sms response {}", response.getData());
-            JSONObject jsonObject = new JSONObject(response.getData());
+            JSONObject jsonObject = JSON.parseObject(response.getData());
             if (!"ok".equalsIgnoreCase(jsonObject.getString("Code"))) {
                 throw new BusinessException("发送失败,请稍后再试", jsonObject.getString("Message"));
             }
@@ -99,7 +98,7 @@ public class AliSmsService implements SmsService {
                     .expired(false)
                     .build());
             return sessionId;
-        } catch (ClientException | JSONException e) {
+        } catch (Exception e) {
             e.printStackTrace();
             throw new BusinessException("发送失败,请稍后再试", e.getMessage());
         }
@@ -149,12 +148,12 @@ public class AliSmsService implements SmsService {
                 log.error("发送失败," + response.getHttpStatus() + "," + response.getData());
             }
             log.info("send sms response {}", response.getData());
-            JSONObject jsonObject = new JSONObject(response.getData());
+            JSONObject jsonObject = JSON.parseObject(response.getData());
             if (!"ok".equalsIgnoreCase(jsonObject.getString("Code"))) {
                 log.error("发送失败," + jsonObject.getString("Message"));
             }
 
-        } catch (ClientException | JSONException e) {
+        } catch (Exception e) {
             e.printStackTrace();
             log.error("发送失败," + e.getMessage());
         }