xiatian hace 17 horas
padre
commit
36ec5dcf6b

+ 12 - 8
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/config/service/impl/SystemCache.java

@@ -4,7 +4,8 @@ import java.util.List;
 
 import javax.annotation.PostConstruct;
 
-import cn.com.qmth.stmms.common.enums.TrialMode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -20,12 +21,15 @@ import cn.com.qmth.stmms.biz.utils.AppLicenseUtil;
 import cn.com.qmth.stmms.biz.utils.SolarHttpUtil;
 import cn.com.qmth.stmms.common.enums.ConfigType;
 import cn.com.qmth.stmms.common.enums.SystemAuthType;
+import cn.com.qmth.stmms.common.enums.TrialMode;
 import cn.com.qmth.stmms.common.utils.AesUtils;
 import net.sf.json.JSONObject;
 
 @Component
 public class SystemCache {
 
+    protected static final Logger log = LoggerFactory.getLogger(SystemCache.class);
+
     @Autowired
     private SystemAuthService authService;
 
@@ -171,7 +175,7 @@ public class SystemCache {
                 try {
                     expireTime = json.getJSONObject("control").getLong("expireTime");
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    log.warn("expireTime err:" + e.getMessage());
                 }
                 this.expireTime = expireTime;
             }
@@ -182,7 +186,7 @@ public class SystemCache {
                     this.doubleTrack = json.getJSONObject("control").getJSONObject("custom")
                             .getBoolean("enable_double_track");
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    log.warn("doubleTrack err:" + e.getMessage());
                 }
             }
             this.groupDeleteWarn = false;
@@ -192,7 +196,7 @@ public class SystemCache {
                     this.groupDeleteWarn = json.getJSONObject("control").getJSONObject("custom")
                             .getBoolean("enable_group_delete_warn");
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    log.warn("groupDeleteWarn err:" + e.getMessage());
                 }
             }
 
@@ -200,10 +204,10 @@ public class SystemCache {
             if (json.has("control") && json.getJSONObject("control").has("custom")
                     && json.getJSONObject("control").getJSONObject("custom").has("trial_mode")) {
                 try {
-                    this.trialMode = TrialMode.findByName(json.getJSONObject("control").getJSONObject("custom")
-                            .getString("trial_mode"));
+                    this.trialMode = TrialMode
+                            .findByName(json.getJSONObject("control").getJSONObject("custom").getString("trial_mode"));
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    log.warn("trialMode err:" + e.getMessage());
                 }
             }
 
@@ -214,7 +218,7 @@ public class SystemCache {
                     this.yjsObjectiveEnable = json.getJSONObject("control").getJSONObject("custom")
                             .getBoolean("yjs_objective_enable");
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    log.warn("yjsObjectiveEnable err:" + e.getMessage());
                 }
             }
         } else {

+ 1 - 4
stmms-web/src/main/java/cn/com/qmth/stmms/common/support/CustomExceptionHandler.java

@@ -44,6 +44,7 @@ public class CustomExceptionHandler {
             body = new StatusResponse(teme.getCode(), teme.getMessage());
             return asResultApiEx(e, body, request);
         } else {
+            log.error(e.getMessage(), e);
             body = new StatusResponse(500, "系统异常");
         }
 
@@ -55,8 +56,6 @@ public class CustomExceptionHandler {
         ApiException teme = (ApiException) err;
         HttpStatus httpStatus = HttpStatus.valueOf(teme.getCode());
 
-        log.error(err.getMessage(), err);
-
         HttpHeaders headers = new HttpHeaders();
         headers.add("Content-Type", "application/json;charset=utf-8");
         return new ResponseEntity<>(body, headers, httpStatus);
@@ -66,8 +65,6 @@ public class CustomExceptionHandler {
 
         HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
 
-        log.error(err.getMessage(), err);
-
         HttpHeaders headers = new HttpHeaders();
         headers.add("Content-Type", "application/json;charset=utf-8");
         return new ResponseEntity<>(body, headers, httpStatus);