Commit 87adf15a934b7c9560c3f20dd7a80849510a19cd

Authored by YunaiV
1 parent 2578ca73

【功能修复】商城:App 接口增加部分需要登录的校验

yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppAfterSaleController.java
... ... @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.controller.app.aftersale;
3 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 4 import cn.iocoder.yudao.framework.common.pojo.PageParam;
5 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.AfterSaleLogRespVO;
  6 +import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
7 7 import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleCreateReqVO;
8 8 import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
9 9 import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleRespVO;
... ... @@ -12,14 +12,11 @@ import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService;
12 12 import io.swagger.v3.oas.annotations.Operation;
13 13 import io.swagger.v3.oas.annotations.Parameter;
14 14 import io.swagger.v3.oas.annotations.tags.Tag;
  15 +import jakarta.annotation.Resource;
15 16 import lombok.extern.slf4j.Slf4j;
16 17 import org.springframework.validation.annotation.Validated;
17 18 import org.springframework.web.bind.annotation.*;
18 19  
19   -import jakarta.annotation.Resource;
20   -
21   -import java.util.List;
22   -
23 20 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
24 21 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
25 22  
... ... @@ -35,6 +32,7 @@ public class AppAfterSaleController {
35 32  
36 33 @GetMapping(value = "/page")
37 34 @Operation(summary = "获得售后分页")
  35 + @PreAuthenticated
38 36 public CommonResult<PageResult<AppAfterSaleRespVO>> getAfterSalePage(PageParam pageParam) {
39 37 return success(AfterSaleConvert.INSTANCE.convertPage02(
40 38 afterSaleService.getAfterSalePage(getLoginUserId(), pageParam)));
... ... @@ -43,18 +41,21 @@ public class AppAfterSaleController {
43 41 @GetMapping(value = "/get")
44 42 @Operation(summary = "获得售后订单")
45 43 @Parameter(name = "id", description = "售后编号", required = true, example = "1")
  44 + @PreAuthenticated
46 45 public CommonResult<AppAfterSaleRespVO> getAfterSale(@RequestParam("id") Long id) {
47 46 return success(AfterSaleConvert.INSTANCE.convert(afterSaleService.getAfterSale(getLoginUserId(), id)));
48 47 }
49 48  
50 49 @PostMapping(value = "/create")
51 50 @Operation(summary = "申请售后")
  51 + @PreAuthenticated
52 52 public CommonResult<Long> createAfterSale(@RequestBody AppAfterSaleCreateReqVO createReqVO) {
53 53 return success(afterSaleService.createAfterSale(getLoginUserId(), createReqVO));
54 54 }
55 55  
56 56 @PutMapping(value = "/delivery")
57 57 @Operation(summary = "退回货物")
  58 + @PreAuthenticated
58 59 public CommonResult<Boolean> deliveryAfterSale(@RequestBody AppAfterSaleDeliveryReqVO deliveryReqVO) {
59 60 afterSaleService.deliveryAfterSale(getLoginUserId(), deliveryReqVO);
60 61 return success(true);
... ... @@ -63,6 +64,7 @@ public class AppAfterSaleController {
63 64 @DeleteMapping(value = "/cancel")
64 65 @Operation(summary = "取消售后")
65 66 @Parameter(name = "id", description = "售后编号", required = true, example = "1")
  67 + @PreAuthenticated
66 68 public CommonResult<Boolean> cancelAfterSale(@RequestParam("id") Long id) {
67 69 afterSaleService.cancelAfterSale(getLoginUserId(), id);
68 70 return success(true);
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppAfterSaleLogController.java
... ... @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.controller.app.aftersale;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 4 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  5 +import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
5 6 import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.log.AppAfterSaleLogRespVO;
6 7 import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleLogDO;
7 8 import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleLogService;
... ... @@ -33,6 +34,7 @@ public class AppAfterSaleLogController {
33 34 @GetMapping("/list")
34 35 @Operation(summary = "获得售后日志列表")
35 36 @Parameter(name = "afterSaleId", description = "售后编号", required = true, example = "1")
  37 + @PreAuthenticated
36 38 public CommonResult<List<AppAfterSaleLogRespVO>> getAfterSaleLogList(
37 39 @RequestParam("afterSaleId") Long afterSaleId) {
38 40 List<AfterSaleLogDO> logs = afterSaleLogService.getAfterSaleLogList(afterSaleId);
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageRecordController.java
... ... @@ -45,6 +45,7 @@ public class AppBrokerageRecordController {
45 45  
46 46 @GetMapping("/get-product-brokerage-price")
47 47 @Operation(summary = "获得商品的分销金额")
  48 + @PreAuthenticated
48 49 public CommonResult<AppBrokerageProductPriceRespVO> getProductBrokeragePrice(@RequestParam("spuId") Long spuId) {
49 50 return success(brokerageRecordService.calculateProductBrokeragePrice(getLoginUserId(), spuId));
50 51 }
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageUserController.java
... ... @@ -133,6 +133,7 @@ public class AppBrokerageUserController {
133 133 @GetMapping("/get-rank-by-price")
134 134 @Operation(summary = "获得分销用户排行(基于佣金)")
135 135 @Parameter(name = "times", description = "时间段", required = true)
  136 + @PreAuthenticated
136 137 public CommonResult<Integer> getRankByPrice(
137 138 @RequestParam("times") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime[] times) {
138 139 return success(brokerageRecordService.getUserRankByPrice(getLoginUserId(), times));
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverConfigController.java deleted
1   -package cn.iocoder.yudao.module.trade.controller.app.delivery;
2   -
3   -import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4   -import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.config.AppDeliveryConfigRespVO;
5   -import io.swagger.v3.oas.annotations.Operation;
6   -import io.swagger.v3.oas.annotations.tags.Tag;
7   -import org.springframework.validation.annotation.Validated;
8   -import org.springframework.web.bind.annotation.GetMapping;
9   -import org.springframework.web.bind.annotation.RequestMapping;
10   -import org.springframework.web.bind.annotation.RestController;
11   -
12   -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
13   -
14   -@Tag(name = "用户 App - 配送配置")
15   -@RestController
16   -@RequestMapping("/trade/delivery/config")
17   -@Validated
18   -public class AppDeliverConfigController {
19   -
20   - // TODO @芋艿:这里后面干掉,合并到 AppTradeConfigController 中
21   - @GetMapping("/get")
22   - @Operation(summary = "获得配送配置")
23   - public CommonResult<AppDeliveryConfigRespVO> getDeliveryConfig() {
24   - return success(new AppDeliveryConfigRespVO().setPickUpEnable(true).setTencentLbsKey("123456"));
25   - }
26   -
27   -}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
... ... @@ -80,6 +80,7 @@ public class AppTradeOrderController {
80 80 @GetMapping("/get-detail")
81 81 @Operation(summary = "获得交易订单")
82 82 @Parameter(name = "id", description = "交易订单编号")
  83 + @PreAuthenticated
83 84 public CommonResult<AppTradeOrderDetailRespVO> getOrder(@RequestParam("id") Long id) {
84 85 // 查询订单
85 86 TradeOrderDO order = tradeOrderQueryService.getOrder(getLoginUserId(), id);
... ... @@ -99,6 +100,7 @@ public class AppTradeOrderController {
99 100 @GetMapping("/get-express-track-list")
100 101 @Operation(summary = "获得交易订单的物流轨迹")
101 102 @Parameter(name = "id", description = "交易订单编号")
  103 + @PreAuthenticated
102 104 public CommonResult<List<AppOrderExpressTrackRespDTO>> getOrderExpressTrackList(@RequestParam("id") Long id) {
103 105 return success(TradeOrderConvert.INSTANCE.convertList02(
104 106 tradeOrderQueryService.getExpressTrackList(id, getLoginUserId())));
... ... @@ -106,6 +108,7 @@ public class AppTradeOrderController {
106 108  
107 109 @GetMapping("/page")
108 110 @Operation(summary = "获得交易订单分页")
  111 + @PreAuthenticated
109 112 public CommonResult<PageResult<AppTradeOrderPageItemRespVO>> getOrderPage(AppTradeOrderPageReqVO reqVO) {
110 113 // 查询订单
111 114 PageResult<TradeOrderDO> pageResult = tradeOrderQueryService.getOrderPage(getLoginUserId(), reqVO);
... ... @@ -118,6 +121,7 @@ public class AppTradeOrderController {
118 121  
119 122 @GetMapping("/get-count")
120 123 @Operation(summary = "获得交易订单数量")
  124 + @PreAuthenticated
121 125 public CommonResult<Map<String, Long>> getOrderCount() {
122 126 Map<String, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(5);
123 127 // 全部
... ... @@ -142,6 +146,7 @@ public class AppTradeOrderController {
142 146 @PutMapping("/receive")
143 147 @Operation(summary = "确认交易订单收货")
144 148 @Parameter(name = "id", description = "交易订单编号")
  149 + @PreAuthenticated
145 150 public CommonResult<Boolean> receiveOrder(@RequestParam("id") Long id) {
146 151 tradeOrderUpdateService.receiveOrderByMember(getLoginUserId(), id);
147 152 return success(true);
... ... @@ -150,6 +155,7 @@ public class AppTradeOrderController {
150 155 @DeleteMapping("/cancel")
151 156 @Operation(summary = "取消交易订单")
152 157 @Parameter(name = "id", description = "交易订单编号")
  158 + @PreAuthenticated
153 159 public CommonResult<Boolean> cancelOrder(@RequestParam("id") Long id) {
154 160 tradeOrderUpdateService.cancelOrderByMember(getLoginUserId(), id);
155 161 return success(true);
... ... @@ -158,6 +164,7 @@ public class AppTradeOrderController {
158 164 @DeleteMapping("/delete")
159 165 @Operation(summary = "删除交易订单")
160 166 @Parameter(name = "id", description = "交易订单编号")
  167 + @PreAuthenticated
161 168 public CommonResult<Boolean> deleteOrder(@RequestParam("id") Long id) {
162 169 tradeOrderUpdateService.deleteOrder(getLoginUserId(), id);
163 170 return success(true);
... ... @@ -168,6 +175,7 @@ public class AppTradeOrderController {
168 175 @GetMapping("/item/get")
169 176 @Operation(summary = "获得交易订单项")
170 177 @Parameter(name = "id", description = "交易订单项编号")
  178 + @PreAuthenticated
171 179 public CommonResult<AppTradeOrderItemRespVO> getOrderItem(@RequestParam("id") Long id) {
172 180 TradeOrderItemDO item = tradeOrderQueryService.getOrderItem(getLoginUserId(), id);
173 181 return success(TradeOrderConvert.INSTANCE.convert03(item));
... ... @@ -175,6 +183,7 @@ public class AppTradeOrderController {
175 183  
176 184 @PostMapping("/item/create-comment")
177 185 @Operation(summary = "创建交易订单项的评价")
  186 + @PreAuthenticated
178 187 public CommonResult<Long> createOrderItemComment(@RequestBody AppTradeOrderItemCommentCreateReqVO createReqVO) {
179 188 return success(tradeOrderUpdateService.createOrderItemCommentByMember(getLoginUserId(), createReqVO));
180 189 }
... ...