feat:
1. add mall product
This commit is contained in:
@@ -21,16 +21,14 @@ public class APPMallController {
|
||||
|
||||
private final IMallProductService mallProductService;
|
||||
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "列表")
|
||||
public R<List<MallProductApiVO>> list() {
|
||||
return R.data(mallProductService.apiVoList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,27 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.CreateOrderRequest;
|
||||
import org.springblade.modules.api.request.PaymentRequest;
|
||||
import org.springblade.modules.api.response.CreateOrderResponse;
|
||||
import org.springblade.modules.api.response.PaymentResponse;
|
||||
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserAddressVO;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@@ -18,6 +31,8 @@ public class APPUserController {
|
||||
|
||||
private final IUserService userService;
|
||||
|
||||
private final ICommonUserOrderService orderService;
|
||||
|
||||
|
||||
/**
|
||||
* 是否修改过密码
|
||||
@@ -35,7 +50,7 @@ public class APPUserController {
|
||||
@PostMapping("/change-password")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "修改登录密码", description = "传入String")
|
||||
public R submit(@RequestBody String password) {
|
||||
public R changePassword(@RequestBody String password) {
|
||||
return R.status(userService.changePassword(password));
|
||||
}
|
||||
|
||||
@@ -49,4 +64,35 @@ public class APPUserController {
|
||||
return R.data(userService.inviteCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 下单
|
||||
*/
|
||||
@PostMapping("/create-order")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "下单", description = "传入CreateOrderRequest")
|
||||
public R<CreateOrderResponse> createOrder(@Valid @RequestBody CreateOrderRequest request) {
|
||||
return R.data(orderService.createOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付
|
||||
*/
|
||||
@PostMapping("/pay")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "支付", description = "传入PaymentRequest")
|
||||
public R<PaymentResponse> pay(@Valid @RequestBody PaymentRequest request) {
|
||||
return R.data(orderService.pay(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户订单列表
|
||||
*/
|
||||
@GetMapping("/order-page")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户订单分页列表", description = "传入userAddress")
|
||||
public R<IPage<CommonUserOrderApiVO>> orderList(CommonUserOrderApiVO userOrder, Query query) {
|
||||
IPage<CommonUserOrderApiVO> pages = orderService.selectOrderApiPage(Condition.getPage(query), userOrder);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CreateOrderRequest implements Serializable {
|
||||
|
||||
@NotEmpty(message = "请填写联系人")
|
||||
private String consignee;
|
||||
|
||||
@NotEmpty(message = "请填写联系电话")
|
||||
private String consigneePhone;
|
||||
|
||||
@NotEmpty(message = "订单类型为空")
|
||||
private String orderType;
|
||||
|
||||
@NotEmpty(message = "商品编号为空")
|
||||
private String itemCode;
|
||||
|
||||
@NotNull(message = "商品数量不能为空")
|
||||
@Min(value = 1, message = "无效商品数量")
|
||||
private Integer quantity;
|
||||
|
||||
@NotEmpty(message = "请填写收货地址")
|
||||
private String address;
|
||||
|
||||
@NotNull(message = "无效支付方式")
|
||||
private Integer paymentType;
|
||||
|
||||
@NotNull(message = "无效标识")
|
||||
private Boolean isOfflinePayment;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PaymentRequest implements Serializable {
|
||||
|
||||
private String orderId;
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.springblade.modules.api.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class CreateOrderResponse implements Serializable {
|
||||
|
||||
private String orderId;
|
||||
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal discount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.springblade.modules.api.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PaymentResponse implements Serializable {
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
private String payChannel;
|
||||
|
||||
private String params;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CommonUserOrderApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String consigneePhone;
|
||||
|
||||
private String consignee;
|
||||
|
||||
private String orderType;
|
||||
|
||||
private String itemCode;
|
||||
|
||||
private String itemName;
|
||||
|
||||
private String imageUrl;
|
||||
|
||||
private Integer quantity;
|
||||
|
||||
private String deliveryAddress;
|
||||
|
||||
private String expressCompany;
|
||||
|
||||
private String expressNo;
|
||||
|
||||
private Integer orderStatus;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
private Date paymentTime;
|
||||
|
||||
private Integer paymentStatus;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user