Parcourir la source

更新安全注解

Woody il y a 1 mois
Parent
commit
e5725b8cdf

+ 11 - 10
src/main/java/com/chelvc/cloud/maintain/controller/AssetController.java

@@ -1,20 +1,22 @@
 package com.chelvc.cloud.maintain.controller;
 
+import javax.servlet.http.HttpServletRequest;
+
 import com.chelvc.cloud.vehicle.client.AssetClient;
 import com.chelvc.cloud.vehicle.client.dto.MerchantAssetDTO;
 import com.chelvc.cloud.vehicle.client.param.SxyNotifyParam;
-import com.chelvc.cloud.vehicle.client.param.TransferNotifyParam;
-import com.chelvc.cloud.vehicle.client.param.WithdrawNotifyParam;
 import com.chelvc.cloud.vehicle.client.param.WithdrawParam;
 import com.chelvc.framework.base.annotation.ResponseWrapping;
-import com.chelvc.framework.security.annotation.Authorize;
+import com.chelvc.framework.security.annotation.Security;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 资产管理
@@ -30,6 +32,7 @@ import javax.servlet.http.HttpServletRequest;
 public class AssetController {
 
     private final AssetClient assetClient;
+
     /**
      * 获取商家端钱包信息
      *
@@ -52,10 +55,9 @@ public class AssetController {
 
     /**
      * 提现回调接口
-     *
      */
+    @Security(enabled = false)
     @PostMapping("/asset/withdraw/notify")
-    @Authorize(enabled = false)
     public void withdrawNotify(HttpServletRequest request, @RequestBody SxyNotifyParam param) {
         String merchantId = request.getHeader("merchantId");
         String encryptKey = request.getHeader("encryptKey");
@@ -66,10 +68,9 @@ public class AssetController {
 
     /**
      * 转账回调接口
-     *
      */
+    @Security(enabled = false)
     @PostMapping("/asset/transfer/notify")
-    @Authorize(enabled = false)
     public void transferNotify(HttpServletRequest request, @RequestBody SxyNotifyParam param) {
         String merchantId = request.getHeader("merchantId");
         String encryptKey = request.getHeader("encryptKey");

+ 4 - 4
src/main/java/com/chelvc/cloud/maintain/controller/AuthorizeController.java

@@ -8,7 +8,7 @@ import com.chelvc.cloud.user.client.UserClient;
 import com.chelvc.cloud.user.client.model.Authorization;
 import com.chelvc.cloud.user.client.param.AuthorizeParam;
 import com.chelvc.framework.base.annotation.ResponseWrapping;
-import com.chelvc.framework.security.annotation.Authorize;
+import com.chelvc.framework.security.annotation.Security;
 import com.chelvc.framework.sms.CaptchaSmsHandler;
 import com.chelvc.framework.sms.SmsSession;
 import lombok.RequiredArgsConstructor;
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @ResponseWrapping
-@Authorize(enabled = false)
+@Security(authorize = false)
 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
 public class AuthorizeController {
     private final UserClient userClient;
@@ -82,7 +82,7 @@ public class AuthorizeController {
      *
      * @param param 认证参数
      */
-    @Authorize
+    @Security
     @PostMapping("/logoff")
     public void logoff(@RequestBody @Valid AuthorizeParam param) {
         this.authorizeClient.logout(param);
@@ -91,7 +91,7 @@ public class AuthorizeController {
     /**
      * 用户注销
      */
-    @Authorize
+    @Security
     @DeleteMapping("/unregister")
     public void unregister() {
         this.userClient.unregister();

+ 2 - 2
src/main/java/com/chelvc/cloud/maintain/controller/CarouselImagesController.java

@@ -5,7 +5,7 @@ import java.util.List;
 import com.chelvc.cloud.vehicle.client.CarouselImagesClient;
 import com.chelvc.cloud.vehicle.client.dto.CarouselImagesDTO;
 import com.chelvc.framework.base.annotation.ResponseWrapping;
-import com.chelvc.framework.security.annotation.Authorize;
+import com.chelvc.framework.security.annotation.Security;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 @Validated
 @RestController
 @ResponseWrapping
-@Authorize(enabled = false)
+@Security(authorize = false)
 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
 public class CarouselImagesController {
     private final CarouselImagesClient carouselImagesClient;

+ 7 - 9
src/main/java/com/chelvc/cloud/maintain/controller/IndexController.java

@@ -18,15 +18,13 @@ import com.chelvc.framework.base.context.SessionContextHolder;
 import com.chelvc.framework.common.model.Pagination;
 import com.chelvc.framework.location.Address;
 import com.chelvc.framework.location.LocationHandler;
-import com.chelvc.framework.security.annotation.Authorize;
+import com.chelvc.framework.security.annotation.Security;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.openfeign.SpringQueryMap;
 import org.springframework.util.StringUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -40,7 +38,7 @@ import org.springframework.web.bind.annotation.RestController;
 @Validated
 @RestController
 @ResponseWrapping
-@Authorize(enabled = false)
+@Security(authorize = false)
 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
 public class IndexController {
     private final CategoryClient categoryClient;
@@ -79,8 +77,8 @@ public class IndexController {
      */
     @GetMapping("/customer/index")
     public CustomerIndexVO getCustomerIndex(@Valid LocationQueryParam param) {
-        param.setCode((param.getRegion()/100)*100);
-        param.setBoundary((param.getRegion()/100)*100+99);
+        param.setCode((param.getRegion() / 100) * 100);
+        param.setBoundary((param.getRegion() / 100) * 100 + 99);
         CustomerIndexVO index = CustomerIndexVO.builder().build();
 
         // 加载推荐分类列表
@@ -118,11 +116,11 @@ public class IndexController {
      * @param param 查询参数
      * @return 商家信息列表
      */
-    @Authorize
+    @Security
     @GetMapping("/merchant/indexMerchantPaging")
     public Pagination<MerchantDTO> indexMerchantPaging(@Valid LocationQueryPagingParam param) {
-        param.setCode((param.getRegion()/100)*100);
-        param.setBoundary((param.getRegion()/100)*100+99);
+        param.setCode((param.getRegion() / 100) * 100);
+        param.setBoundary((param.getRegion() / 100) * 100 + 99);
         return merchantClient.indexMerchantPaging(param);
     }
 }

+ 22 - 12
src/main/java/com/chelvc/cloud/maintain/controller/MerchantController.java

@@ -17,15 +17,26 @@ import com.chelvc.cloud.vehicle.client.dto.BalanceDetailDTO;
 import com.chelvc.cloud.vehicle.client.dto.MerchantDTO;
 import com.chelvc.cloud.vehicle.client.dto.MerchantDetailDTO;
 import com.chelvc.cloud.vehicle.client.dto.MerchantRankDTO;
-import com.chelvc.cloud.vehicle.client.param.*;
+import com.chelvc.cloud.vehicle.client.param.LocationQueryParam;
+import com.chelvc.cloud.vehicle.client.param.MerchantQueryParam;
+import com.chelvc.cloud.vehicle.client.param.MerchantQueryParamPaging;
+import com.chelvc.cloud.vehicle.client.param.MerchantRankParam;
+import com.chelvc.cloud.vehicle.client.param.OmsCartItemPagingParam;
+import com.chelvc.cloud.vehicle.client.param.QueryMerchantBalanceParam;
+import com.chelvc.cloud.vehicle.client.param.SxyNotifyParam;
 import com.chelvc.framework.base.annotation.ResponseWrapping;
 import com.chelvc.framework.base.context.SessionContextHolder;
 import com.chelvc.framework.common.model.Pagination;
-import com.chelvc.framework.security.annotation.Authorize;
+import com.chelvc.framework.security.annotation.Security;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 商家接口
@@ -51,8 +62,8 @@ public class MerchantController {
      */
     @GetMapping("/merchantSort")
     public List<SimpleMerchantVO> listSimpleMerchants(@Valid MerchantQueryParam param) {
-        param.setCode((param.getRegion()/100)*100);
-        param.setBoundary((param.getRegion()/100)*100+99);
+        param.setCode((param.getRegion() / 100) * 100);
+        param.setBoundary((param.getRegion() / 100) * 100 + 99);
         return MerchantCopier.INSTANCE.copying(this.merchantClient.listSimpleMerchants(param));
     }
 
@@ -64,8 +75,8 @@ public class MerchantController {
      */
     @GetMapping("/merchantPagingList")
     public Pagination<MerchantDTO> merchantPagingList(@Valid MerchantQueryParamPaging param) {
-        param.setCode((param.getRegion()/100)*100);
-        param.setBoundary((param.getRegion()/100)*100+99);
+        param.setCode((param.getRegion() / 100) * 100);
+        param.setBoundary((param.getRegion() / 100) * 100 + 99);
         return this.merchantClient.merchantPagingList(param);
     }
 
@@ -90,8 +101,8 @@ public class MerchantController {
     @GetMapping("/merchant/{id}")
     public MerchantDetailDTO getMerchantDetail(@PathVariable("id") @Min(value = 1, message = "商家ID不能小于1") Long id,
                                                @Valid LocationQueryParam param) {
-        param.setCode((param.getRegion()/100)*100);
-        param.setBoundary((param.getRegion()/100)*100+99);
+        param.setCode((param.getRegion() / 100) * 100);
+        param.setBoundary((param.getRegion() / 100) * 100 + 99);
         return this.merchantClient.queryMerchantDetail(id, param);
     }
 
@@ -171,12 +182,11 @@ public class MerchantController {
 
     /**
      * 子商户入网回调接口
-     *
      */
+    @Security(enabled = false)
     @PostMapping("/merchant/apply/notify")
-    @Authorize(enabled = false)
     public void merchantApplyNotify(HttpServletRequest request,
-           @RequestBody SxyNotifyParam param) {
+                                    @RequestBody SxyNotifyParam param) {
         String merchantId = request.getHeader("merchantId");
         String encryptKey = request.getHeader("encryptKey");
         param.setMerchantId(merchantId);

+ 23 - 18
src/main/java/com/chelvc/cloud/maintain/controller/OmsOrderController.java

@@ -1,5 +1,13 @@
 package com.chelvc.cloud.maintain.controller;
 
+import java.io.IOException;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
 import com.chelvc.cloud.vehicle.client.OmsOrderClient;
 import com.chelvc.cloud.vehicle.client.OmsOrderReturnApplyClient;
 import com.chelvc.cloud.vehicle.client.dto.ConfirmOrderResultDTO;
@@ -12,23 +20,17 @@ import com.chelvc.cloud.vehicle.client.param.OrderRefundParam;
 import com.chelvc.cloud.vehicle.client.param.SxyNotifyParam;
 import com.chelvc.framework.base.annotation.ResponseWrapping;
 import com.chelvc.framework.common.model.Pagination;
-import com.chelvc.framework.security.annotation.Authorize;
+import com.chelvc.framework.security.annotation.Security;
 import com.chelvc.framework.wechat.WechatUnifiedOrder;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Map;
-import java.util.Objects;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 订单接口
@@ -186,6 +188,7 @@ public class OmsOrderController {
 
     /**
      * 查询订单详情
+     *
      * @param id 查询参数
      * @return
      */
@@ -200,16 +203,16 @@ public class OmsOrderController {
      */
     @GetMapping("/omsOrder/{orderSn}/{merchantId}")
     public OmsOrderDetailDTO getOrderDetailBySn(@PathVariable("orderSn") @Min(value = 1, message = "核销码不能小于1") Long orderSn,
-                                            @PathVariable("merchantId") @Min(value = 1, message = "商家ID不能小于1") Long merchantId) {
-        return this.omsOrderClient.getOrderDetail(orderSn,merchantId);
+                                                @PathVariable("merchantId") @Min(value = 1, message = "商家ID不能小于1") Long merchantId) {
+        return this.omsOrderClient.getOrderDetail(orderSn, merchantId);
     }
 
     /**
      * 订单支付回调
      */
-    @Authorize(enabled = false)
+    @Security(enabled = false)
     @PostMapping("/order/notify")
-    public void orderNotify(HttpServletRequest request, @RequestBody SxyNotifyParam param){
+    public void orderNotify(HttpServletRequest request, @RequestBody SxyNotifyParam param) {
         String merchantId = request.getHeader("merchantId");
         String encryptKey = request.getHeader("encryptKey");
         param.setMerchantId(merchantId);
@@ -219,20 +222,22 @@ public class OmsOrderController {
 
     /**
      * 退款申请
+     *
      * @param param 参数
      * @return
      */
     @PostMapping("/order/refund")
     public void orderRefund(@RequestBody OrderRefundParam param) {
-         this.omsOrderClient.orderRefund(param);
+        this.omsOrderClient.orderRefund(param);
     }
 
     /**
      * 退款申请回调
+     *
      * @return
      */
+    @Security(enabled = false)
     @PostMapping("/order/refund/notify")
-    @Authorize(enabled = false)
     public void orderRefundNotify(HttpServletRequest request, @RequestBody SxyNotifyParam param) {
         String merchantId = request.getHeader("merchantId");
         String encryptKey = request.getHeader("encryptKey");