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

This commit is contained in:
YunaiV 2024-09-01 09:38:45 +08:00
parent 2578ca7311
commit 87adf15a93
6 changed files with 20 additions and 32 deletions

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.controller.app.aftersale;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.AfterSaleLogRespVO;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleRespVO;
@ -12,14 +12,11 @@ import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@ -35,6 +32,7 @@ public class AppAfterSaleController {
@GetMapping(value = "/page")
@Operation(summary = "获得售后分页")
@PreAuthenticated
public CommonResult<PageResult<AppAfterSaleRespVO>> getAfterSalePage(PageParam pageParam) {
return success(AfterSaleConvert.INSTANCE.convertPage02(
afterSaleService.getAfterSalePage(getLoginUserId(), pageParam)));
@ -43,18 +41,21 @@ public class AppAfterSaleController {
@GetMapping(value = "/get")
@Operation(summary = "获得售后订单")
@Parameter(name = "id", description = "售后编号", required = true, example = "1")
@PreAuthenticated
public CommonResult<AppAfterSaleRespVO> getAfterSale(@RequestParam("id") Long id) {
return success(AfterSaleConvert.INSTANCE.convert(afterSaleService.getAfterSale(getLoginUserId(), id)));
}
@PostMapping(value = "/create")
@Operation(summary = "申请售后")
@PreAuthenticated
public CommonResult<Long> createAfterSale(@RequestBody AppAfterSaleCreateReqVO createReqVO) {
return success(afterSaleService.createAfterSale(getLoginUserId(), createReqVO));
}
@PutMapping(value = "/delivery")
@Operation(summary = "退回货物")
@PreAuthenticated
public CommonResult<Boolean> deliveryAfterSale(@RequestBody AppAfterSaleDeliveryReqVO deliveryReqVO) {
afterSaleService.deliveryAfterSale(getLoginUserId(), deliveryReqVO);
return success(true);
@ -63,6 +64,7 @@ public class AppAfterSaleController {
@DeleteMapping(value = "/cancel")
@Operation(summary = "取消售后")
@Parameter(name = "id", description = "售后编号", required = true, example = "1")
@PreAuthenticated
public CommonResult<Boolean> cancelAfterSale(@RequestParam("id") Long id) {
afterSaleService.cancelAfterSale(getLoginUserId(), id);
return success(true);

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.controller.app.aftersale;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.log.AppAfterSaleLogRespVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleLogDO;
import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleLogService;
@ -33,6 +34,7 @@ public class AppAfterSaleLogController {
@GetMapping("/list")
@Operation(summary = "获得售后日志列表")
@Parameter(name = "afterSaleId", description = "售后编号", required = true, example = "1")
@PreAuthenticated
public CommonResult<List<AppAfterSaleLogRespVO>> getAfterSaleLogList(
@RequestParam("afterSaleId") Long afterSaleId) {
List<AfterSaleLogDO> logs = afterSaleLogService.getAfterSaleLogList(afterSaleId);

View File

@ -45,6 +45,7 @@ public class AppBrokerageRecordController {
@GetMapping("/get-product-brokerage-price")
@Operation(summary = "获得商品的分销金额")
@PreAuthenticated
public CommonResult<AppBrokerageProductPriceRespVO> getProductBrokeragePrice(@RequestParam("spuId") Long spuId) {
return success(brokerageRecordService.calculateProductBrokeragePrice(getLoginUserId(), spuId));
}

View File

@ -133,6 +133,7 @@ public class AppBrokerageUserController {
@GetMapping("/get-rank-by-price")
@Operation(summary = "获得分销用户排行(基于佣金)")
@Parameter(name = "times", description = "时间段", required = true)
@PreAuthenticated
public CommonResult<Integer> getRankByPrice(
@RequestParam("times") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime[] times) {
return success(brokerageRecordService.getUserRankByPrice(getLoginUserId(), times));

View File

@ -1,27 +0,0 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.config.AppDeliveryConfigRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 App - 配送配置")
@RestController
@RequestMapping("/trade/delivery/config")
@Validated
public class AppDeliverConfigController {
// TODO @芋艿这里后面干掉合并到 AppTradeConfigController
@GetMapping("/get")
@Operation(summary = "获得配送配置")
public CommonResult<AppDeliveryConfigRespVO> getDeliveryConfig() {
return success(new AppDeliveryConfigRespVO().setPickUpEnable(true).setTencentLbsKey("123456"));
}
}

View File

@ -80,6 +80,7 @@ public class AppTradeOrderController {
@GetMapping("/get-detail")
@Operation(summary = "获得交易订单")
@Parameter(name = "id", description = "交易订单编号")
@PreAuthenticated
public CommonResult<AppTradeOrderDetailRespVO> getOrder(@RequestParam("id") Long id) {
// 查询订单
TradeOrderDO order = tradeOrderQueryService.getOrder(getLoginUserId(), id);
@ -99,6 +100,7 @@ public class AppTradeOrderController {
@GetMapping("/get-express-track-list")
@Operation(summary = "获得交易订单的物流轨迹")
@Parameter(name = "id", description = "交易订单编号")
@PreAuthenticated
public CommonResult<List<AppOrderExpressTrackRespDTO>> getOrderExpressTrackList(@RequestParam("id") Long id) {
return success(TradeOrderConvert.INSTANCE.convertList02(
tradeOrderQueryService.getExpressTrackList(id, getLoginUserId())));
@ -106,6 +108,7 @@ public class AppTradeOrderController {
@GetMapping("/page")
@Operation(summary = "获得交易订单分页")
@PreAuthenticated
public CommonResult<PageResult<AppTradeOrderPageItemRespVO>> getOrderPage(AppTradeOrderPageReqVO reqVO) {
// 查询订单
PageResult<TradeOrderDO> pageResult = tradeOrderQueryService.getOrderPage(getLoginUserId(), reqVO);
@ -118,6 +121,7 @@ public class AppTradeOrderController {
@GetMapping("/get-count")
@Operation(summary = "获得交易订单数量")
@PreAuthenticated
public CommonResult<Map<String, Long>> getOrderCount() {
Map<String, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(5);
// 全部
@ -142,6 +146,7 @@ public class AppTradeOrderController {
@PutMapping("/receive")
@Operation(summary = "确认交易订单收货")
@Parameter(name = "id", description = "交易订单编号")
@PreAuthenticated
public CommonResult<Boolean> receiveOrder(@RequestParam("id") Long id) {
tradeOrderUpdateService.receiveOrderByMember(getLoginUserId(), id);
return success(true);
@ -150,6 +155,7 @@ public class AppTradeOrderController {
@DeleteMapping("/cancel")
@Operation(summary = "取消交易订单")
@Parameter(name = "id", description = "交易订单编号")
@PreAuthenticated
public CommonResult<Boolean> cancelOrder(@RequestParam("id") Long id) {
tradeOrderUpdateService.cancelOrderByMember(getLoginUserId(), id);
return success(true);
@ -158,6 +164,7 @@ public class AppTradeOrderController {
@DeleteMapping("/delete")
@Operation(summary = "删除交易订单")
@Parameter(name = "id", description = "交易订单编号")
@PreAuthenticated
public CommonResult<Boolean> deleteOrder(@RequestParam("id") Long id) {
tradeOrderUpdateService.deleteOrder(getLoginUserId(), id);
return success(true);
@ -168,6 +175,7 @@ public class AppTradeOrderController {
@GetMapping("/item/get")
@Operation(summary = "获得交易订单项")
@Parameter(name = "id", description = "交易订单项编号")
@PreAuthenticated
public CommonResult<AppTradeOrderItemRespVO> getOrderItem(@RequestParam("id") Long id) {
TradeOrderItemDO item = tradeOrderQueryService.getOrderItem(getLoginUserId(), id);
return success(TradeOrderConvert.INSTANCE.convert03(item));
@ -175,6 +183,7 @@ public class AppTradeOrderController {
@PostMapping("/item/create-comment")
@Operation(summary = "创建交易订单项的评价")
@PreAuthenticated
public CommonResult<Long> createOrderItemComment(@RequestBody AppTradeOrderItemCommentCreateReqVO createReqVO) {
return success(tradeOrderUpdateService.createOrderItemCommentByMember(getLoginUserId(), createReqVO));
}