feat:
1. add mall product
This commit is contained in:
10
doc/sql/update/order.menu.sql
Normal file
10
doc/sql/update/order.menu.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||||
|
VALUES ('2019446499472781314', '1123598815738675201', 'order', '用户订单', 'menu', '/common/order', NULL, 1, 1, 0, 1, NULL, 0);
|
||||||
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||||
|
VALUES ('2019446499472781315', '2019446499472781314', 'order_add', '新增', 'add', '/common/order/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||||
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||||
|
VALUES ('2019446499472781316', '2019446499472781314', 'order_edit', '修改', 'edit', '/common/order/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||||
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||||
|
VALUES ('2019446499472781317', '2019446499472781314', 'order_delete', '删除', 'delete', '/api/user-order/order/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||||
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||||
|
VALUES ('2019446499472781318', '2019446499472781314', 'order_view', '查看', 'view', '/common/order/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||||
@@ -21,16 +21,14 @@ public class APPMallController {
|
|||||||
|
|
||||||
private final IMallProductService mallProductService;
|
private final IMallProductService mallProductService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品列表
|
* 商品列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 1)
|
||||||
@Operation(summary = "列表")
|
@Operation(summary = "列表")
|
||||||
public R<List<MallProductApiVO>> list() {
|
public R<List<MallProductApiVO>> list() {
|
||||||
return R.data(mallProductService.apiVoList());
|
return R.data(mallProductService.apiVoList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,27 @@
|
|||||||
package org.springblade.modules.api.app;
|
package org.springblade.modules.api.app;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import lombok.AllArgsConstructor;
|
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.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.springblade.modules.system.service.IUserService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Hidden
|
@Hidden
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -18,6 +31,8 @@ public class APPUserController {
|
|||||||
|
|
||||||
private final IUserService userService;
|
private final IUserService userService;
|
||||||
|
|
||||||
|
private final ICommonUserOrderService orderService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否修改过密码
|
* 是否修改过密码
|
||||||
@@ -35,7 +50,7 @@ public class APPUserController {
|
|||||||
@PostMapping("/change-password")
|
@PostMapping("/change-password")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
@Operation(summary = "修改登录密码", description = "传入String")
|
@Operation(summary = "修改登录密码", description = "传入String")
|
||||||
public R submit(@RequestBody String password) {
|
public R changePassword(@RequestBody String password) {
|
||||||
return R.status(userService.changePassword(password));
|
return R.status(userService.changePassword(password));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,4 +64,35 @@ public class APPUserController {
|
|||||||
return R.data(userService.inviteCode());
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import org.springblade.core.secure.BladeUser;
|
||||||
|
import org.springblade.core.secure.annotation.IsAdmin;
|
||||||
|
import org.springblade.core.mp.support.Condition;
|
||||||
|
import org.springblade.core.mp.support.Query;
|
||||||
|
import org.springblade.core.tool.api.R;
|
||||||
|
import org.springblade.core.tool.utils.Func;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||||
|
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||||
|
import org.springblade.modules.common.excel.CommonUserOrderExcel;
|
||||||
|
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||||
|
import org.springblade.core.boot.ctrl.BladeController;
|
||||||
|
import org.springblade.core.tool.utils.DateUtil;
|
||||||
|
import org.springblade.core.excel.util.ExcelUtil;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 控制器
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequestMapping("user-order/order")
|
||||||
|
@Tag(name = "用户订单", description = "用户订单接口")
|
||||||
|
public class CommonUserOrderController extends BladeController {
|
||||||
|
|
||||||
|
private final ICommonUserOrderService orderService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@Operation(summary = "详情", description = "传入order")
|
||||||
|
public R<CommonUserOrderEntity> detail(CommonUserOrderEntity order) {
|
||||||
|
CommonUserOrderEntity detail = orderService.getOne(Condition.getQueryWrapper(order));
|
||||||
|
return R.data(detail);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 用户订单 分页
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@Operation(summary = "分页", description = "传入order")
|
||||||
|
public R<IPage<CommonUserOrderEntity>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> order, Query query) {
|
||||||
|
IPage<CommonUserOrderEntity> pages = orderService.page(Condition.getPage(query), Condition.getQueryWrapper(order, CommonUserOrderEntity.class));
|
||||||
|
return R.data(pages);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 自定义分页
|
||||||
|
*/
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
|
@Operation(summary = "分页", description = "传入order")
|
||||||
|
public R<IPage<CommonUserOrderVO>> page(CommonUserOrderVO order, Query query) {
|
||||||
|
IPage<CommonUserOrderVO> pages = orderService.selectOrderPage(Condition.getPage(query), order);
|
||||||
|
return R.data(pages);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/save")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@Operation(summary = "新增", description = "传入order")
|
||||||
|
public R save(@Valid @RequestBody CommonUserOrderEntity order) {
|
||||||
|
return R.status(orderService.save(order));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ApiOperationSupport(order = 5)
|
||||||
|
@Operation(summary = "修改", description = "传入order")
|
||||||
|
public R update(@Valid @RequestBody CommonUserOrderEntity order) {
|
||||||
|
return R.status(orderService.updateById(order));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 新增或修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/submit")
|
||||||
|
@ApiOperationSupport(order = 6)
|
||||||
|
@Operation(summary = "新增或修改", description = "传入order")
|
||||||
|
public R submit(@Valid @RequestBody CommonUserOrderEntity order) {
|
||||||
|
return R.status(orderService.saveOrUpdate(order));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ApiOperationSupport(order = 7)
|
||||||
|
@Operation(summary = "删除", description = "传入ids")
|
||||||
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||||
|
return R.status(orderService.removeByIds(Func.toLongList(ids)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
*/
|
||||||
|
@IsAdmin
|
||||||
|
@GetMapping("/export-order")
|
||||||
|
@ApiOperationSupport(order = 9)
|
||||||
|
@Operation(summary = "导出数据", description = "传入order")
|
||||||
|
public void exportOrder(@Parameter(hidden = true) @RequestParam Map<String, Object> order, BladeUser bladeUser, HttpServletResponse response) {
|
||||||
|
QueryWrapper<CommonUserOrderEntity> queryWrapper = Condition.getQueryWrapper(order, CommonUserOrderEntity.class);
|
||||||
|
//if (!AuthUtil.isAdministrator()) {
|
||||||
|
// queryWrapper.lambda().eq(Order::getTenantId, bladeUser.getTenantId());
|
||||||
|
//}
|
||||||
|
//queryWrapper.lambda().eq(OrderEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
||||||
|
List<CommonUserOrderExcel> list = orderService.exportOrder(queryWrapper);
|
||||||
|
ExcelUtil.export(response, "用户订单数据" + DateUtil.time(), "用户订单数据表", list, CommonUserOrderExcel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
package org.springblade.modules.common.convert;
|
package org.springblade.modules.common.convert;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import org.springblade.modules.api.request.CreateOrderRequest;
|
||||||
|
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
|
import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
|
||||||
|
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||||
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
|
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
|
||||||
|
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||||
|
import org.springblade.modules.mall.pojo.entity.MallProductEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -17,4 +23,22 @@ public interface AppCommonConvert {
|
|||||||
|
|
||||||
List<AppCommonRegionsInfoVO> convertRegionsInfoListVO(List<CommonRegionsInfoEntity> list);
|
List<AppCommonRegionsInfoVO> convertRegionsInfoListVO(List<CommonRegionsInfoEntity> list);
|
||||||
|
|
||||||
|
@Mapping(target = "id", ignore = true)
|
||||||
|
@Mapping(target = "consigneePhone", source = "request.consigneePhone")
|
||||||
|
@Mapping(target = "consignee", source = "request.consignee")
|
||||||
|
@Mapping(target = "itemCode", source = "request.itemCode")
|
||||||
|
@Mapping(target = "quantity", source = "request.quantity")
|
||||||
|
@Mapping(target = "deliveryAddress", source = "request.address")
|
||||||
|
@Mapping(target = "itemName", source = "product.productName")
|
||||||
|
@Mapping(target = "imageUrl", source = "product.thumbImageUrl")
|
||||||
|
CommonUserOrderEntity convertMallProductToOrder(CreateOrderRequest request, MallProductEntity product);
|
||||||
|
|
||||||
|
CommonUserOrderVO convertUserOrderEntityToVO(CommonUserOrderEntity entity);
|
||||||
|
|
||||||
|
List<CommonUserOrderVO> convertUserOrderEntityListTOVOList(List<CommonUserOrderEntity> entityList);
|
||||||
|
|
||||||
|
CommonUserOrderApiVO convertOrderApiVO(CommonUserOrderVO vo);
|
||||||
|
|
||||||
|
List<CommonUserOrderApiVO> convertOrderApiListVO(List<CommonUserOrderVO> voList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.excel;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||||
|
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 Excel实体类
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ColumnWidth(25)
|
||||||
|
@HeadRowHeight(20)
|
||||||
|
@ContentRowHeight(18)
|
||||||
|
public class CommonUserOrderExcel implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("用户id")
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 收件人手机号
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("收件人手机号")
|
||||||
|
private String consigneePhone;
|
||||||
|
/**
|
||||||
|
* 收件人
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("收件人")
|
||||||
|
private String consignee;
|
||||||
|
/**
|
||||||
|
* 订单类型
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("订单类型")
|
||||||
|
private String orderType;
|
||||||
|
/**
|
||||||
|
* 商品编号
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("商品编号")
|
||||||
|
private String itemCode;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("商品名称")
|
||||||
|
private String itemName;
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("图片")
|
||||||
|
private String imageUrl;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("数量")
|
||||||
|
private Integer quantity;
|
||||||
|
/**
|
||||||
|
* 收货地址(实物商品必填,虚拟商品可为空)
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("收货地址(实物商品必填,虚拟商品可为空)")
|
||||||
|
private String deliveryAddress;
|
||||||
|
/**
|
||||||
|
* 快递公司名称
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("快递公司名称")
|
||||||
|
private String expressCompany;
|
||||||
|
/**
|
||||||
|
* 快递单号(物流单号)
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("快递单号(物流单号)")
|
||||||
|
private String expressNo;
|
||||||
|
/**
|
||||||
|
* 订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款")
|
||||||
|
private Integer orderStatus;
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("订单金额")
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
/**
|
||||||
|
* 实际支付金额
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("实际支付金额")
|
||||||
|
private BigDecimal actualAmount;
|
||||||
|
/**
|
||||||
|
* 支付方式
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("支付方式")
|
||||||
|
private Integer paymentType;
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("支付时间")
|
||||||
|
private Date paymentTime;
|
||||||
|
/**
|
||||||
|
* 支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)")
|
||||||
|
private Integer paymentStatus;
|
||||||
|
/**
|
||||||
|
* 支付凭证编号
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("支付凭证编号")
|
||||||
|
private String paymentTrack;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty("")
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.mapper;
|
||||||
|
|
||||||
|
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||||
|
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||||
|
import org.springblade.modules.common.excel.CommonUserOrderExcel;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 Mapper 接口
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-06
|
||||||
|
*/
|
||||||
|
public interface CommonUserOrderMapper extends BaseMapper<CommonUserOrderEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义分页
|
||||||
|
*
|
||||||
|
* @param page 分页参数
|
||||||
|
* @param order 查询参数
|
||||||
|
* @return List<OrderVO>
|
||||||
|
*/
|
||||||
|
List<CommonUserOrderVO> selectOrderPage(IPage page, CommonUserOrderVO order);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取导出数据
|
||||||
|
*
|
||||||
|
* @param queryWrapper 查询条件
|
||||||
|
* @return List<OrderExcel>
|
||||||
|
*/
|
||||||
|
List<CommonUserOrderExcel> exportOrder(@Param("ew") Wrapper<CommonUserOrderEntity> queryWrapper);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.springblade.modules.common.mapper.CommonUserOrderMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="orderResultMap" type="org.springblade.modules.common.pojo.entity.CommonUserOrderEntity">
|
||||||
|
<result column="id" property="id"/>
|
||||||
|
<result column="user_id" property="userId"/>
|
||||||
|
<result column="consignee_phone" property="consigneePhone"/>
|
||||||
|
<result column="consignee" property="consignee"/>
|
||||||
|
<result column="order_type" property="orderType"/>
|
||||||
|
<result column="item_code" property="itemCode"/>
|
||||||
|
<result column="item_name" property="itemName"/>
|
||||||
|
<result column="image_url" property="imageUrl"/>
|
||||||
|
<result column="quantity" property="quantity"/>
|
||||||
|
<result column="delivery_address" property="deliveryAddress"/>
|
||||||
|
<result column="express_company" property="expressCompany"/>
|
||||||
|
<result column="express_no" property="expressNo"/>
|
||||||
|
<result column="order_status" property="orderStatus"/>
|
||||||
|
<result column="total_amount" property="totalAmount"/>
|
||||||
|
<result column="actual_amount" property="actualAmount"/>
|
||||||
|
<result column="payment_type" property="paymentType"/>
|
||||||
|
<result column="payment_time" property="paymentTime"/>
|
||||||
|
<result column="payment_status" property="paymentStatus"/>
|
||||||
|
<result column="payment_track" property="paymentTrack"/>
|
||||||
|
<result column="create_user" property="createUser"/>
|
||||||
|
<result column="create_dept" property="createDept"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_user" property="updateUser"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
<result column="status" property="status"/>
|
||||||
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectOrderPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserOrderVO">
|
||||||
|
select * from user_order where is_deleted = 0 and user_id = #{order.userId}
|
||||||
|
<if test="order.orderStatus !=null and order.orderStatus > 0 ">
|
||||||
|
and order_status = #{order.orderStatus}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="exportOrder" resultType="org.springblade.modules.common.excel.CommonUserOrderExcel">
|
||||||
|
SELECT * FROM user_order ${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.pojo.dto;
|
||||||
|
|
||||||
|
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 数据传输对象实体类
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class CommonUserOrderDTO extends CommonUserOrderEntity {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.pojo.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 实体类
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("user_order")
|
||||||
|
@Schema(description = "Order对象")
|
||||||
|
public class CommonUserOrderEntity implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
@Schema(description = "主键")
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 收件人手机号
|
||||||
|
*/
|
||||||
|
@Schema(description = "收件人手机号")
|
||||||
|
private String consigneePhone;
|
||||||
|
/**
|
||||||
|
* 收件人
|
||||||
|
*/
|
||||||
|
@Schema(description = "收件人")
|
||||||
|
private String consignee;
|
||||||
|
/**
|
||||||
|
* 订单类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单类型")
|
||||||
|
private String orderType;
|
||||||
|
/**
|
||||||
|
* 商品编号
|
||||||
|
*/
|
||||||
|
@Schema(description = "商品编号")
|
||||||
|
private String itemCode;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "商品名称")
|
||||||
|
private String itemName;
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
@Schema(description = "图片")
|
||||||
|
private String imageUrl;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
@Schema(description = "数量")
|
||||||
|
private Integer quantity;
|
||||||
|
/**
|
||||||
|
* 收货地址(实物商品必填,虚拟商品可为空)
|
||||||
|
*/
|
||||||
|
@Schema(description = "收货地址(实物商品必填,虚拟商品可为空)")
|
||||||
|
private String deliveryAddress;
|
||||||
|
/**
|
||||||
|
* 快递公司名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "快递公司名称")
|
||||||
|
private String expressCompany;
|
||||||
|
/**
|
||||||
|
* 快递单号(物流单号)
|
||||||
|
*/
|
||||||
|
@Schema(description = "快递单号(物流单号)")
|
||||||
|
private String expressNo;
|
||||||
|
/**
|
||||||
|
* 订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款")
|
||||||
|
private Integer orderStatus;
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单金额")
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
/**
|
||||||
|
* 实际支付金额
|
||||||
|
*/
|
||||||
|
@Schema(description = "实际支付金额")
|
||||||
|
private BigDecimal actualAmount;
|
||||||
|
/**
|
||||||
|
* 支付方式
|
||||||
|
*/
|
||||||
|
@Schema(description = "支付方式")
|
||||||
|
private Integer paymentType;
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "支付时间")
|
||||||
|
private Date paymentTime;
|
||||||
|
/**
|
||||||
|
* 支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)
|
||||||
|
*/
|
||||||
|
@Schema(description = "支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)")
|
||||||
|
private Integer paymentStatus;
|
||||||
|
/**
|
||||||
|
* 支付凭证编号
|
||||||
|
*/
|
||||||
|
@Schema(description = "支付凭证编号")
|
||||||
|
private String paymentTrack;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@Schema(description = "创建人")
|
||||||
|
private Long createUser;
|
||||||
|
/**
|
||||||
|
* 创建部门
|
||||||
|
*/
|
||||||
|
@Schema(description = "创建部门")
|
||||||
|
private Long createDept;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
@Schema(description = "修改人")
|
||||||
|
private Long updateUser;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "修改时间")
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Schema(description = "状态")
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Schema(description = "")
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.pojo.vo;
|
||||||
|
|
||||||
|
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 视图实体类
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class CommonUserOrderVO extends CommonUserOrderEntity {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
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.entity.CommonUserOrderEntity;
|
||||||
|
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||||
|
import org.springblade.modules.common.excel.CommonUserOrderExcel;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 服务类
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-06
|
||||||
|
*/
|
||||||
|
public interface ICommonUserOrderService extends IService<CommonUserOrderEntity> {
|
||||||
|
/**
|
||||||
|
* 自定义分页
|
||||||
|
*
|
||||||
|
* @param page 分页参数
|
||||||
|
* @param order 查询参数
|
||||||
|
* @return IPage<OrderVO>
|
||||||
|
*/
|
||||||
|
IPage<CommonUserOrderVO> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
*
|
||||||
|
* @param queryWrapper 查询条件
|
||||||
|
* @return List<OrderExcel>
|
||||||
|
*/
|
||||||
|
List<CommonUserOrderExcel> exportOrder(Wrapper<CommonUserOrderEntity> queryWrapper);
|
||||||
|
|
||||||
|
CreateOrderResponse createOrder(CreateOrderRequest request);
|
||||||
|
|
||||||
|
PaymentResponse pay(PaymentRequest request);
|
||||||
|
|
||||||
|
IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import io.jsonwebtoken.lang.Assert;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.RandomUtils;
|
||||||
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
|
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.convert.AppCommonConvert;
|
||||||
|
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||||
|
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||||
|
import org.springblade.modules.common.excel.CommonUserOrderExcel;
|
||||||
|
import org.springblade.modules.common.mapper.CommonUserOrderMapper;
|
||||||
|
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||||
|
import org.springblade.modules.mall.pojo.entity.MallProductEntity;
|
||||||
|
import org.springblade.modules.mall.service.IMallProductService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 服务实现类
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-06
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMapper, CommonUserOrderEntity> implements ICommonUserOrderService {
|
||||||
|
|
||||||
|
private final IMallProductService productService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<CommonUserOrderVO> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order) {
|
||||||
|
return page.setRecords(baseMapper.selectOrderPage(page, order));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CommonUserOrderExcel> exportOrder(Wrapper<CommonUserOrderEntity> queryWrapper) {
|
||||||
|
List<CommonUserOrderExcel> orderList = baseMapper.exportOrder(queryWrapper);
|
||||||
|
//orderList.forEach(order -> {
|
||||||
|
// order.setTypeName(DictCache.getValue(DictEnum.YES_NO, Order.getType()));
|
||||||
|
//});
|
||||||
|
return orderList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CreateOrderResponse createOrder(CreateOrderRequest request) {
|
||||||
|
BigDecimal discount = BigDecimal.ZERO;
|
||||||
|
String orderType = request.getOrderType().toUpperCase();
|
||||||
|
if (!request.getIsOfflinePayment()) {
|
||||||
|
discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2);
|
||||||
|
}
|
||||||
|
return switch (orderType) {
|
||||||
|
case "MALL" -> {
|
||||||
|
MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode()));
|
||||||
|
Assert.notNull(product, "无效商品");
|
||||||
|
CommonUserOrderEntity order = AppCommonConvert.INSTANCE.convertMallProductToOrder(request, product);
|
||||||
|
BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN);
|
||||||
|
BigDecimal actualAmount = totalAmount.subtract(discount);
|
||||||
|
order.setUserId(AuthUtil.getUserId());
|
||||||
|
order.setTotalAmount(totalAmount);
|
||||||
|
order.setActualAmount(actualAmount);
|
||||||
|
order.setOrderType(orderType);
|
||||||
|
order.setPaymentType(request.getIsOfflinePayment() ? request.getPaymentType() : null);
|
||||||
|
save(order);
|
||||||
|
yield new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
|
||||||
|
}
|
||||||
|
case "FILTER" -> {
|
||||||
|
yield new CreateOrderResponse("", BigDecimal.ZERO, BigDecimal.ZERO, discount);
|
||||||
|
}
|
||||||
|
default -> throw new IllegalArgumentException("不支持的订单类型: " + request.getOrderType());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PaymentResponse pay(PaymentRequest request) {
|
||||||
|
//todo先判断是否为线下支付,如果是线下支付则立即返回
|
||||||
|
CommonUserOrderEntity order = getById(Long.valueOf(request.getOrderId()));
|
||||||
|
Assert.notNull(order, "无效订单");
|
||||||
|
Assert.isTrue(order.getPaymentType()!=99, "线下订单不能重复支付");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder) {
|
||||||
|
CommonUserOrderVO vo = new CommonUserOrderVO();
|
||||||
|
vo.setOrderStatus(userOrder.getOrderStatus());
|
||||||
|
vo.setUserId(AuthUtil.getUserId());
|
||||||
|
List<CommonUserOrderVO> commonUserOrderVOS = baseMapper.selectOrderPage(page, vo);
|
||||||
|
return page.setRecords(AppCommonConvert.INSTANCE.convertOrderApiListVO(commonUserOrderVOS));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
|
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||||
import org.springblade.modules.auth.provider.UserType;
|
import org.springblade.modules.auth.provider.UserType;
|
||||||
import org.springblade.modules.system.pojo.entity.User;
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
import org.springblade.modules.system.pojo.entity.UserInfo;
|
import org.springblade.modules.system.pojo.entity.UserInfo;
|
||||||
@@ -307,4 +308,5 @@ public interface IUserService extends BaseService<User> {
|
|||||||
String inviteCode();
|
String inviteCode();
|
||||||
|
|
||||||
User getByPhone(String phoneNumber);
|
User getByPhone(String phoneNumber);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -619,4 +619,5 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|||||||
public User getByPhone(String phoneNumber) {
|
public User getByPhone(String phoneNumber) {
|
||||||
return getOne(Wrappers.<User>lambdaQuery().eq(User::getAccount, phoneNumber).eq(User::getIsDeleted, 0).eq(User::getStatus, 1));
|
return getOne(Wrappers.<User>lambdaQuery().eq(User::getAccount, phoneNumber).eq(User::getIsDeleted, 0).eq(User::getStatus, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user