瀏覽代碼

新增后台意向管理

赵冬冬 4 年之前
父節點
當前提交
359d9d94a1

+ 1 - 1
forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/service/impl/PmsBrandServiceImpl.java

@@ -98,7 +98,7 @@ public class PmsBrandServiceImpl implements PmsBrandService {
 
     @Override
     public List<PmsBrand> listBrand(String keyword, int pageNum, int pageSize) {
-        long compId = CurrUserUtil.getCompIdInfo();
+        Long compId = CurrUserUtil.getCompIdInfo();
 
         PageHelper.startPage(pageNum, pageSize);
         PmsBrandExample pmsBrandExample = new PmsBrandExample();

+ 8 - 0
forest-common/pom.xml

@@ -71,6 +71,14 @@
             <groupId>org.apache.tomcat.embed</groupId>
             <artifactId>tomcat-embed-core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-core</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 19 - 0
forest-common/src/main/java/com/hwrj/cloud/common/exception/GlobalExceptionHandler.java

@@ -4,9 +4,11 @@ package com.hwrj.cloud.common.exception;
 import com.hwrj.cloud.common.api.CommonResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.validation.BindException;
 import org.springframework.web.bind.MethodArgumentNotValidException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 
 /**
@@ -53,4 +55,21 @@ public class GlobalExceptionHandler {
     public CommonResult businessException(GlobalException e){
          return CommonResult.failed(e.getMessage());
     }
+    /**
+     * 处理自定义异常
+     * @param ex
+     * @return
+     */
+    @ExceptionHandler(RuntimeException.class)
+    @ResponseBody
+    public CommonResult handleOrderException(RuntimeException ex) {
+        return CommonResult.failed(500 ,ex.getMessage());
+    }
+
+    @ExceptionHandler(UsernameNotFoundException.class)
+    @ResponseBody
+    public CommonResult usernameNotFoundException(UsernameNotFoundException ex) {
+        return CommonResult.failed(400 ,ex.getMessage());
+    }
+
 }