新增Order、OrderGoods、Cart表
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Cart;
|
||||
import com.gxwebsoft.common.system.entity.OrderGoods;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.param.CartParam;
|
||||
import com.gxwebsoft.common.system.service.CartService;
|
||||
import com.gxwebsoft.common.system.service.OrderGoodsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 10:54:51
|
||||
*/
|
||||
@Api(tags = "购物车管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/cart")
|
||||
public class CartController extends BaseController {
|
||||
@Resource
|
||||
private CartService cartService;
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
|
||||
@ApiOperation("分页查询购物车")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Cart>> page(CartParam param) {
|
||||
// 使用关联查询
|
||||
return success(cartService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部购物车")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Cart>> list(CartParam param) {
|
||||
// 使用关联查询
|
||||
return success(cartService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询购物车")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Cart> get(@PathVariable("id") Long id) {
|
||||
// 使用关联查询
|
||||
return success(cartService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加购物车")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Cart cart) {
|
||||
System.out.println("cart = " + cart);
|
||||
final ArrayList<OrderGoods> orderGoods = new ArrayList<>();
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
cart.setUserId(loginUser.getUserId());
|
||||
cart.setTenantId(loginUser.getTenantId());
|
||||
if (cart.getType().equals(1)) {
|
||||
cart.getList().forEach(item -> {
|
||||
final OrderGoods og = new OrderGoods();
|
||||
og.setType(cart.getType());
|
||||
og.setItemId(item.getCompanyId());
|
||||
og.setPayPrice(item.getPrice());
|
||||
og.setMonth(cart.getMonth());
|
||||
og.setTotalNum(cart.getCartNum());
|
||||
og.setPayStatus(false);
|
||||
og.setOrderStatus(0);
|
||||
og.setTenantId(loginUser.getTenantId());
|
||||
og.setUserId(loginUser.getUserId());
|
||||
og.setComments("购买".concat(item.getTenantName()));
|
||||
orderGoods.add(og);
|
||||
});
|
||||
}
|
||||
if (cartService.save(cart)) {
|
||||
orderGoodsService.saveBatch(orderGoods);
|
||||
return success("添加成功");
|
||||
}
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改购物车")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Cart cart) {
|
||||
if (cartService.updateById(cart)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除购物车")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (cartService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加购物车")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Cart> list) {
|
||||
if (cartService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改购物车")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Cart> batchParam) {
|
||||
if (batchParam.update(cartService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除购物车")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (cartService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Cart;
|
||||
import com.gxwebsoft.common.system.entity.Order;
|
||||
import com.gxwebsoft.common.system.entity.OrderGoods;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.mapper.MenuMapper;
|
||||
import com.gxwebsoft.common.system.param.MenuParam;
|
||||
import com.gxwebsoft.common.system.param.OrderParam;
|
||||
import com.gxwebsoft.common.system.service.MenuService;
|
||||
import com.gxwebsoft.common.system.service.OrderGoodsService;
|
||||
import com.gxwebsoft.common.system.service.OrderService;
|
||||
import com.gxwebsoft.shop.entity.ShopMerchantApply;
|
||||
import com.gxwebsoft.shop.service.ShopMerchantApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-16 12:32:52
|
||||
*/
|
||||
@Api(tags = "订单管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/order")
|
||||
public class OrderController extends BaseController {
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Resource
|
||||
private ShopMerchantApplyService shopMerchantApplyService;
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
@Resource
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
@ApiOperation("分页查询订单")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Order>> page(OrderParam param) {
|
||||
// 使用关联查询
|
||||
final User loginUser = getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return fail("请先登陆",null);
|
||||
}
|
||||
// 非平台权限
|
||||
if (!loginUser.getTenantId().equals(5)) {
|
||||
param.setUserId(loginUser.getUserId());
|
||||
}
|
||||
return success(orderService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部订单")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Order>> list(OrderParam param) {
|
||||
final User loginUser = getLoginUser();
|
||||
// 非平台权限
|
||||
if (!loginUser.getTenantId().equals(5)) {
|
||||
param.setUserId(loginUser.getUserId());
|
||||
}
|
||||
// 使用关联查询
|
||||
return success(orderService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询订单")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Order> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(orderService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加订单")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Order order) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if(loginUser == null){
|
||||
return fail("请先登录");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(order.getType())) {
|
||||
return fail("订单类型不能为空");
|
||||
}
|
||||
// 封装订单信息
|
||||
order.setUserId(loginUser.getUserId());
|
||||
order.setTenantId(loginUser.getTenantId());
|
||||
order.setOrderNo(Long.toString(IdUtil.getSnowflakeNextId()));
|
||||
order.setPhone(loginUser.getPhone());
|
||||
order.setRealName(loginUser.getRealName());
|
||||
final ShopMerchantApply shopMerchantApply = shopMerchantApplyService.getOne(new LambdaQueryWrapper<ShopMerchantApply>().eq(ShopMerchantApply::getUserId, loginUser.getUserId()).eq(ShopMerchantApply::getStatus, 1));
|
||||
if (ObjectUtil.isNotEmpty(shopMerchantApply)) {
|
||||
order.setRealName(shopMerchantApply.getRealName());
|
||||
}
|
||||
// 购买商品
|
||||
if (order.getType().equals(0)) {
|
||||
order.setVersion(0);
|
||||
}
|
||||
// 购买插件
|
||||
if (order.getType().equals(1)) {
|
||||
order.setVersion(1);
|
||||
}
|
||||
|
||||
if (orderService.save(order)) {
|
||||
// 余额支付
|
||||
if(order.getPayType().equals(0)){
|
||||
if (loginUser.getBalance().compareTo(order.getPayPrice()) < 0) {
|
||||
return fail("余额不足"+loginUser.getBalance()+"==="+order.getPayPrice());
|
||||
}
|
||||
return success("支付成功");
|
||||
}
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改订单")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Order order) {
|
||||
if (orderService.updateById(order)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除订单")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (orderService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量添加订单")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Order> list) {
|
||||
if (orderService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改订单")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Order> batchParam) {
|
||||
if (batchParam.update(orderService, "order_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除订单")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (orderService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("统一下单")
|
||||
@PostMapping("/createOrder")
|
||||
public ApiResult<?> createOrder(@RequestBody Cart cart) {
|
||||
final MenuParam menuParam = new MenuParam();
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
// 封装订单数据
|
||||
final Order order = new Order();
|
||||
order.setType(cart.getType());
|
||||
order.setPayType(cart.getPayType());
|
||||
order.setPayPrice(cart.getPayPrice());
|
||||
order.setTotalPrice(cart.getTotalPrice());
|
||||
order.setMonth(cart.getMonth());
|
||||
order.setUserId(loginUser.getUserId());
|
||||
order.setOrderNo(Long.toString(IdUtil.getSnowflakeNextId()));
|
||||
order.setPhone(loginUser.getPhone());
|
||||
order.setComments(cart.getComments());
|
||||
order.setTenantId(loginUser.getTenantId());
|
||||
order.setRealName(loginUser.getRealName());
|
||||
order.setPayTime(DateUtil.date());
|
||||
|
||||
// 购买商品
|
||||
if (order.getType().equals(0)) {
|
||||
order.setVersion(0);
|
||||
}
|
||||
// 购买插件
|
||||
if (order.getType().equals(1)) {
|
||||
order.setVersion(1);
|
||||
}
|
||||
// 判断支付方式
|
||||
if(order.getPayType() == null){
|
||||
return fail("支付方式不能为空");
|
||||
}
|
||||
// 商品描述(必填)
|
||||
if (StrUtil.isBlank(order.getComments())) {
|
||||
return fail("商品描述(必填)");
|
||||
}
|
||||
// 微信支付
|
||||
if(order.getPayType().equals(1)){
|
||||
// 微信openid(必填)
|
||||
if (StrUtil.isBlank(loginUser.getOpenid())) {
|
||||
return fail("微信openid(必填)");
|
||||
}
|
||||
// 微信支付(商品金额不能为0)
|
||||
if (order.getTotalPrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||
return fail("商品金额不能为0");
|
||||
}
|
||||
}
|
||||
// 创建订单成功
|
||||
if (orderService.save(order)) {
|
||||
final ArrayList<OrderGoods> orderGoods = new ArrayList<>();
|
||||
if (order.getType().equals(1)) {
|
||||
cart.getList().forEach(item -> {
|
||||
final OrderGoods og = new OrderGoods();
|
||||
og.setOrderId(order.getOrderId());
|
||||
og.setType(order.getType());
|
||||
og.setItemId(item.getCompanyId());
|
||||
og.setMenuId(item.getMenuId());
|
||||
og.setPayPrice(item.getPrice());
|
||||
og.setMonth(order.getMonth());
|
||||
og.setTotalNum(order.getCartNum());
|
||||
og.setPayStatus(false);
|
||||
og.setOrderStatus(0);
|
||||
og.setTenantId(loginUser.getTenantId());
|
||||
og.setUserId(loginUser.getUserId());
|
||||
og.setComments(item.getTenantName());
|
||||
orderGoods.add(og);
|
||||
menuParam.setMenuId(item.getMenuId());
|
||||
menuParam.setTenantId(item.getTenantId());
|
||||
});
|
||||
}
|
||||
// 记录订单商品
|
||||
orderGoodsService.saveBatch(orderGoods);
|
||||
|
||||
// 余额支付
|
||||
if(order.getPayType().equals(0)){
|
||||
if (loginUser.getBalance().compareTo(order.getPayPrice()) < 0) {
|
||||
return fail("余额不足"+loginUser.getBalance()+"==="+order.getPayPrice());
|
||||
}
|
||||
// 附加插件参数
|
||||
order.setMenuParam(menuParam);
|
||||
// 执行支付成功后事务
|
||||
orderService.paySuccess(order);
|
||||
return success("余额支付成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
return fail("下单失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.OrderGoods;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.param.OrderGoodsParam;
|
||||
import com.gxwebsoft.common.system.service.OrderGoodsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单商品控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 12:18:05
|
||||
*/
|
||||
@Api(tags = "订单商品管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/order-goods")
|
||||
public class OrderGoodsController extends BaseController {
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
|
||||
@ApiOperation("分页查询订单商品")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<OrderGoods>> page(OrderGoodsParam param) {
|
||||
// 使用关联查询
|
||||
final User loginUser = getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return fail("请先登陆",null);
|
||||
}
|
||||
// 非平台权限
|
||||
if (!loginUser.getTenantId().equals(5)) {
|
||||
param.setUserId(loginUser.getUserId());
|
||||
}
|
||||
return success(orderGoodsService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:list')")
|
||||
@ApiOperation("查询全部订单商品")
|
||||
@GetMapping()
|
||||
public ApiResult<List<OrderGoods>> list(OrderGoodsParam param) {
|
||||
// 使用关联查询
|
||||
return success(orderGoodsService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:list')")
|
||||
@ApiOperation("根据id查询订单商品")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<OrderGoods> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(orderGoodsService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:save')")
|
||||
@ApiOperation("添加订单商品")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody OrderGoods orderGoods) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
orderGoods.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (orderGoodsService.save(orderGoods)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:update')")
|
||||
@ApiOperation("修改订单商品")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody OrderGoods orderGoods) {
|
||||
if (orderGoodsService.updateById(orderGoods)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:remove')")
|
||||
@ApiOperation("删除订单商品")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (orderGoodsService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:save')")
|
||||
@ApiOperation("批量添加订单商品")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<OrderGoods> list) {
|
||||
if (orderGoodsService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:update')")
|
||||
@ApiOperation("批量修改订单商品")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<OrderGoods> batchParam) {
|
||||
if (batchParam.update(orderGoodsService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:remove')")
|
||||
@ApiOperation("批量删除订单商品")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (orderGoodsService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
106
src/main/java/com/gxwebsoft/common/system/entity/Cart.java
Normal file
106
src/main/java/com/gxwebsoft/common/system/entity/Cart.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.gxwebsoft.common.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 10:54:51
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Cart对象", description = "购物车")
|
||||
@TableName("sys_cart")
|
||||
public class Cart implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "购物车表ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "类型 0商城 1应用插件")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "唯一标识")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "项目ID,0 goodId 1 companyId")
|
||||
private Long itemId;
|
||||
|
||||
@ApiModelProperty(value = "商品规格")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty(value = "商品价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "购买时长")
|
||||
private Integer month;
|
||||
|
||||
@ApiModelProperty(value = "商品数量")
|
||||
private Integer cartNum;
|
||||
|
||||
@ApiModelProperty(value = "单商品合计")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty(value = "0 = 未购买 1 = 已购买")
|
||||
private Boolean isPay;
|
||||
|
||||
@ApiModelProperty(value = "是否为立即购买")
|
||||
private Boolean isNew;
|
||||
|
||||
@ApiModelProperty(value = "拼团id")
|
||||
private Integer combinationId;
|
||||
|
||||
@ApiModelProperty(value = "秒杀产品ID")
|
||||
private Integer seckillId;
|
||||
|
||||
@ApiModelProperty(value = "砍价id")
|
||||
private Integer bargainId;
|
||||
|
||||
@ApiModelProperty(value = "是否选中")
|
||||
private Boolean selected;
|
||||
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
private Long merchantId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "商品描述")
|
||||
@TableField(exist = false)
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "支付方式")
|
||||
@TableField(exist = false)
|
||||
private Integer payType;
|
||||
|
||||
@ApiModelProperty(value = "支付金额")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ApiModelProperty(value = "应用列表")
|
||||
private List<Company> list;
|
||||
|
||||
}
|
||||
@@ -1,245 +1,171 @@
|
||||
package com.gxwebsoft.common.system.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.gxwebsoft.common.system.param.MenuParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-24 13:46:21
|
||||
* @since 2024-10-16 12:32:52
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Order对象", description = "订单")
|
||||
@TableName("sys_order")
|
||||
public class Order implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
@TableId(value = "order_id", type = IdType.AUTO)
|
||||
private Integer orderId;
|
||||
@ApiModelProperty(value = "订单号")
|
||||
@TableId(value = "order_id", type = IdType.AUTO)
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderNo;
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@ApiModelProperty(value = "微信支付订单号")
|
||||
private String wechatOrder;
|
||||
@ApiModelProperty(value = "订单类型,0产品 1插件")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "微信退款订单号")
|
||||
private String refundOrder;
|
||||
@ApiModelProperty(value = "下单渠道,0网站 1小程序 2其他")
|
||||
private Integer channel;
|
||||
|
||||
@ApiModelProperty(value = "场馆id用于权限判断")
|
||||
private Long merchantId;
|
||||
@ApiModelProperty(value = "微信支付订单号")
|
||||
private String transactionId;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
@ApiModelProperty(value = "微信退款订单号")
|
||||
private String refundOrder;
|
||||
|
||||
@ApiModelProperty(value = "使用的优惠券id")
|
||||
private Integer couponId;
|
||||
@ApiModelProperty(value = "使用的优惠券id")
|
||||
private Integer couponId;
|
||||
|
||||
@ApiModelProperty(value = "使用的会员卡id")
|
||||
private Integer cardId;
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "关联管理员id")
|
||||
private Integer aid;
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "核销管理员id")
|
||||
private Integer adminId;
|
||||
@ApiModelProperty(value = "订单总额")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty(value = "IC卡号")
|
||||
private String code;
|
||||
@ApiModelProperty(value = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格")
|
||||
private BigDecimal reducePrice;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "实际付款")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
@ApiModelProperty(value = "用于统计")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "订单总额")
|
||||
private BigDecimal totalPrice;
|
||||
@ApiModelProperty(value = "价钱,用于积分赠送")
|
||||
private BigDecimal money;
|
||||
|
||||
@ApiModelProperty(value = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格")
|
||||
private BigDecimal reducePrice;
|
||||
@ApiModelProperty(value = "退款金额")
|
||||
private BigDecimal refundMoney;
|
||||
|
||||
@ApiModelProperty(value = "实际付款")
|
||||
private BigDecimal payPrice;
|
||||
@ApiModelProperty(value = "购买数量")
|
||||
private Integer totalNum;
|
||||
|
||||
@ApiModelProperty(value = "用于统计")
|
||||
private BigDecimal price;
|
||||
@ApiModelProperty(value = "0余额支付, 1微信支付,102微信Native,2会员卡支付,3支付宝,4现金,5POS机")
|
||||
private Integer payType;
|
||||
|
||||
@ApiModelProperty(value = "价钱,用于积分赠送")
|
||||
private BigDecimal money;
|
||||
@ApiModelProperty(value = "0未付款,1已付款")
|
||||
private Boolean payStatus;
|
||||
|
||||
@ApiModelProperty(value = "退款金额")
|
||||
private BigDecimal refundMoney;
|
||||
@ApiModelProperty(value = "0未完成,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款")
|
||||
private Integer orderStatus;
|
||||
|
||||
@ApiModelProperty(value = "教练价格")
|
||||
private BigDecimal coachPrice;
|
||||
@ApiModelProperty(value = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡")
|
||||
private Integer couponType;
|
||||
|
||||
@ApiModelProperty(value = "教练id")
|
||||
private Integer coachId;
|
||||
@ApiModelProperty(value = "优惠说明")
|
||||
private String couponDesc;
|
||||
|
||||
@ApiModelProperty(value = "1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡")
|
||||
private Integer payType;
|
||||
@ApiModelProperty(value = "二维码地址,保存订单号,支付成功后才生成")
|
||||
private String qrcode;
|
||||
|
||||
@ApiModelProperty(value = "1已付款,2未付款")
|
||||
private Integer payStatus;
|
||||
@ApiModelProperty(value = "预约详情开始时间数组")
|
||||
private Long startTime;
|
||||
|
||||
@ApiModelProperty(value = "1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款")
|
||||
private Integer orderStatus;
|
||||
@ApiModelProperty(value = "是否已开具发票:0未开发票,1已开发票,2不能开具发票")
|
||||
private Boolean isInvoice;
|
||||
|
||||
@ApiModelProperty(value = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "发票流水号")
|
||||
private String invoiceNo;
|
||||
|
||||
@ApiModelProperty(value = "二维码地址,保存订单号,支付成功后才生成")
|
||||
private String qrcode;
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private Date payTime;
|
||||
|
||||
@ApiModelProperty(value = "优惠说明")
|
||||
private String desc;
|
||||
@ApiModelProperty(value = "退款时间")
|
||||
private Date refundTime;
|
||||
|
||||
@ApiModelProperty(value = "vip月卡年卡、ic月卡年卡回退次数")
|
||||
private Integer returnNum;
|
||||
@ApiModelProperty(value = "申请退款时间")
|
||||
private Date refundApplyTime;
|
||||
|
||||
@ApiModelProperty(value = "vip充值回退金额")
|
||||
private BigDecimal returnMoney;
|
||||
@ApiModelProperty(value = "过期时间")
|
||||
private Date expirationTime;
|
||||
|
||||
@ApiModelProperty(value = "预约详情开始时间数组")
|
||||
private Integer startTime;
|
||||
@ApiModelProperty(value = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单")
|
||||
private Integer checkBill;
|
||||
|
||||
@ApiModelProperty(value = "是否已开具发票:1已开发票,2未开发票,3不能开具发票")
|
||||
private Integer isInvoice;
|
||||
@ApiModelProperty(value = "订单是否已结算(0未结算 1已结算)")
|
||||
private Integer isSettled;
|
||||
|
||||
@ApiModelProperty(value = "付款时间")
|
||||
private Date payTime;
|
||||
@ApiModelProperty(value = "系统版本号 0当前版本 value=其他版本")
|
||||
private Integer version;
|
||||
|
||||
@ApiModelProperty(value = "退款时间")
|
||||
private Integer refundTime;
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "申请退款时间")
|
||||
private Integer refundApplyTime;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单")
|
||||
private Integer checkBill;
|
||||
@ApiModelProperty(value = "排序号")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "系统版本")
|
||||
private Integer version;
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
@ApiModelProperty(value = "购买时长")
|
||||
@TableField(exist = false)
|
||||
private Integer month;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
@ApiModelProperty(value = "购买数量")
|
||||
@TableField(exist = false)
|
||||
private Integer cartNum;
|
||||
|
||||
@ApiModelProperty(value = "商户名称")
|
||||
@TableField(exist = false)
|
||||
private String merchantName;
|
||||
@ApiModelProperty(value = "应用列表")
|
||||
private List<Company> list;
|
||||
|
||||
@ApiModelProperty(value = "商户图标")
|
||||
@TableField(exist = false)
|
||||
private String merchantAvatar;
|
||||
@ApiModelProperty(value = "插件安装参数")
|
||||
@TableField(exist = false)
|
||||
private MenuParam menuParam;
|
||||
|
||||
@ApiModelProperty(value = "微信OPENID,用于微信支付")
|
||||
@TableField(exist = false)
|
||||
private String openid;
|
||||
@ApiModelProperty(value = "应用名称")
|
||||
@TableField(exist = false)
|
||||
private String tenantName;
|
||||
|
||||
@ApiModelProperty(value = "订单详情")
|
||||
@TableField(exist = false)
|
||||
private List<OrderInfo> orderInfoList;
|
||||
@ApiModelProperty(value = "应用图标")
|
||||
@TableField(exist = false)
|
||||
private String logo;
|
||||
|
||||
@ApiModelProperty(value = "套餐ID")
|
||||
private Integer planId;
|
||||
|
||||
@ApiModelProperty(value = "卡ID")
|
||||
private Integer priceId;
|
||||
|
||||
@ApiModelProperty(value = "获得的会员等级")
|
||||
private Integer gradeId;
|
||||
|
||||
@ApiModelProperty(value = "卡名称")
|
||||
private String priceName;
|
||||
|
||||
@ApiModelProperty(value = "持有者ID")
|
||||
private Integer memberId;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "支付流水号")
|
||||
private String transactionId;
|
||||
|
||||
@ApiModelProperty(value = "支付方式(余额/微信/支付宝)")
|
||||
private String payMethod;
|
||||
|
||||
@ApiModelProperty(value = "到期时间")
|
||||
private Date expirationTime;
|
||||
|
||||
@ApiModelProperty(value = "所在省份")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "所在城市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "所在辖区")
|
||||
private String region;
|
||||
|
||||
@ApiModelProperty(value = "所在地区")
|
||||
private String area;
|
||||
|
||||
@ApiModelProperty(value = "街道地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "退款凭证")
|
||||
private String refundImage;
|
||||
|
||||
@ApiModelProperty(value = "退款理由")
|
||||
private String refundContent;
|
||||
|
||||
@ApiModelProperty(value = "订单是否已结算(0未结算 1已结算)")
|
||||
private Integer isSettled;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "租户名称")
|
||||
@TableField(exist = false)
|
||||
private String tenantName;
|
||||
|
||||
@ApiModelProperty(value = "企业ID")
|
||||
@TableField(exist = false)
|
||||
private Integer companyId;
|
||||
|
||||
@ApiModelProperty("手机号(脱敏)")
|
||||
@TableField(exist = false)
|
||||
private String mobile;
|
||||
|
||||
public String getMobile() {
|
||||
return DesensitizedUtil.mobilePhone(this.phone);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
101
src/main/java/com/gxwebsoft/common/system/entity/OrderGoods.java
Normal file
101
src/main/java/com/gxwebsoft/common/system/entity/OrderGoods.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package com.gxwebsoft.common.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 订单商品
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 12:18:05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "OrderGoods对象", description = "订单商品")
|
||||
@TableName("sys_order_goods")
|
||||
public class OrderGoods implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "订单类型,0商城 1应用插件")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "项目ID")
|
||||
private Integer itemId;
|
||||
|
||||
@ApiModelProperty(value = "插件ID")
|
||||
private Integer menuId;
|
||||
|
||||
@ApiModelProperty(value = "实际付款")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ApiModelProperty(value = "购买时长")
|
||||
private Integer month;
|
||||
|
||||
@ApiModelProperty(value = "购买数量")
|
||||
private Integer totalNum;
|
||||
|
||||
@ApiModelProperty(value = "0未付款,1已付款")
|
||||
private Boolean payStatus;
|
||||
|
||||
@ApiModelProperty(value = "0未完成,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款")
|
||||
private Integer orderStatus;
|
||||
|
||||
@ApiModelProperty(value = "预约详情开始时间数组")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "是否已开具发票:0未开发票,1已开发票,2不能开具发票")
|
||||
private Boolean isInvoice;
|
||||
|
||||
@ApiModelProperty(value = "发票流水号")
|
||||
private String invoiceNo;
|
||||
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private Date payTime;
|
||||
|
||||
@ApiModelProperty(value = "过期时间")
|
||||
private Date expirationTime;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "排序号")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "应用名称")
|
||||
@TableField(exist = false)
|
||||
private String tenantName;
|
||||
|
||||
@ApiModelProperty(value = "应用图标")
|
||||
@TableField(exist = false)
|
||||
private String logo;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.common.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.system.entity.Cart;
|
||||
import com.gxwebsoft.common.system.param.CartParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 10:54:51
|
||||
*/
|
||||
public interface CartMapper extends BaseMapper<Cart> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Cart>
|
||||
*/
|
||||
List<Cart> selectPageRel(@Param("page") IPage<Cart> page,
|
||||
@Param("param") CartParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Cart> selectListRel(@Param("param") CartParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.common.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.system.entity.OrderGoods;
|
||||
import com.gxwebsoft.common.system.param.OrderGoodsParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单商品Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 12:18:05
|
||||
*/
|
||||
public interface OrderGoodsMapper extends BaseMapper<OrderGoods> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<OrderGoods>
|
||||
*/
|
||||
List<OrderGoods> selectPageRel(@Param("page") IPage<OrderGoods> page,
|
||||
@Param("param") OrderGoodsParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<OrderGoods> selectListRel(@Param("param") OrderGoodsParam param);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gxwebsoft.common.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.system.entity.Order;
|
||||
@@ -13,7 +12,7 @@ import java.util.List;
|
||||
* 订单Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-24 13:46:21
|
||||
* @since 2024-10-16 12:32:52
|
||||
*/
|
||||
public interface OrderMapper extends BaseMapper<Order> {
|
||||
|
||||
@@ -35,10 +34,4 @@ public interface OrderMapper extends BaseMapper<Order> {
|
||||
*/
|
||||
List<Order> selectListRel(@Param("param") OrderParam param);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<Order> getByOutTradeNo(OrderParam param);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void updateByOutTradeNo(@Param("param") Order outTradeNo);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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="com.gxwebsoft.common.system.mapper.CartMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM sys_cart a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.code != null">
|
||||
AND a.code LIKE CONCAT('%', #{param.code}, '%')
|
||||
</if>
|
||||
<if test="param.itemId != null">
|
||||
AND a.item_id LIKE CONCAT('%', #{param.itemId}, '%')
|
||||
</if>
|
||||
<if test="param.spec != null">
|
||||
AND a.spec LIKE CONCAT('%', #{param.spec}, '%')
|
||||
</if>
|
||||
<if test="param.price != null">
|
||||
AND a.price = #{param.price}
|
||||
</if>
|
||||
<if test="param.cartNum != null">
|
||||
AND a.cart_num = #{param.cartNum}
|
||||
</if>
|
||||
<if test="param.totalPrice != null">
|
||||
AND a.total_price = #{param.totalPrice}
|
||||
</if>
|
||||
<if test="param.isPay != null">
|
||||
AND a.is_pay = #{param.isPay}
|
||||
</if>
|
||||
<if test="param.isNew != null">
|
||||
AND a.is_new = #{param.isNew}
|
||||
</if>
|
||||
<if test="param.combinationId != null">
|
||||
AND a.combination_id = #{param.combinationId}
|
||||
</if>
|
||||
<if test="param.seckillId != null">
|
||||
AND a.seckill_id = #{param.seckillId}
|
||||
</if>
|
||||
<if test="param.bargainId != null">
|
||||
AND a.bargain_id = #{param.bargainId}
|
||||
</if>
|
||||
<if test="param.selected != null">
|
||||
AND a.selected = #{param.selected}
|
||||
</if>
|
||||
<if test="param.merchantId != null">
|
||||
AND a.merchant_id LIKE CONCAT('%', #{param.merchantId}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id LIKE CONCAT('%', #{param.userId}, '%')
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.Cart">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.Cart">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?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="com.gxwebsoft.common.system.mapper.OrderGoodsMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*, b.short_name AS tenantName,b.company_logo as logo
|
||||
FROM sys_order_goods a
|
||||
LEFT JOIN sys_company b ON a.tenant_id = b.tenant_id
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.orderId != null">
|
||||
AND a.order_id = #{param.type}
|
||||
</if>
|
||||
<if test="param.itemId != null">
|
||||
AND a.item_id = #{param.itemId}
|
||||
</if>
|
||||
<if test="param.payPrice != null">
|
||||
AND a.pay_price = #{param.payPrice}
|
||||
</if>
|
||||
<if test="param.totalNum != null">
|
||||
AND a.total_num = #{param.totalNum}
|
||||
</if>
|
||||
<if test="param.payStatus != null">
|
||||
AND a.pay_status = #{param.payStatus}
|
||||
</if>
|
||||
<if test="param.orderStatus != null">
|
||||
AND a.order_status = #{param.orderStatus}
|
||||
</if>
|
||||
<if test="param.startTime != null">
|
||||
AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%')
|
||||
</if>
|
||||
<if test="param.isInvoice != null">
|
||||
AND a.is_invoice = #{param.isInvoice}
|
||||
</if>
|
||||
<if test="param.invoiceNo != null">
|
||||
AND a.invoice_no LIKE CONCAT('%', #{param.invoiceNo}, '%')
|
||||
</if>
|
||||
<if test="param.payTime != null">
|
||||
AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%')
|
||||
</if>
|
||||
<if test="param.expirationTime != null">
|
||||
AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.OrderGoods">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.OrderGoods">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
SELECT a.*, b.short_name AS tenantName,b.company_logo as logo
|
||||
FROM sys_order a
|
||||
LEFT JOIN sys_company b ON a.tenant_id = b.tenant_id
|
||||
<where>
|
||||
<if test="param.orderId != null">
|
||||
AND a.order_id = #{param.orderId}
|
||||
@@ -16,29 +17,17 @@
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.money != null">
|
||||
AND a.money = #{param.money}
|
||||
<if test="param.channel != null">
|
||||
AND a.channel = #{param.channel}
|
||||
</if>
|
||||
<if test="param.payPrice != null">
|
||||
AND a.pay_price = #{param.payPrice}
|
||||
<if test="param.transactionId != null">
|
||||
AND a.transaction_id LIKE CONCAT('%', #{param.transactionId}, '%')
|
||||
</if>
|
||||
<if test="param.planId != null">
|
||||
AND a.plan_id = #{param.planId}
|
||||
<if test="param.refundOrder != null">
|
||||
AND a.refund_order LIKE CONCAT('%', #{param.refundOrder}, '%')
|
||||
</if>
|
||||
<if test="param.priceId != null">
|
||||
AND a.price_id = #{param.priceId}
|
||||
</if>
|
||||
<if test="param.gradeId != null">
|
||||
AND a.grade_id = #{param.gradeId}
|
||||
</if>
|
||||
<if test="param.priceName != null">
|
||||
AND a.price_name LIKE CONCAT('%', #{param.priceName}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.memberId != null">
|
||||
AND a.member_id = #{param.memberId}
|
||||
<if test="param.couponId != null">
|
||||
AND a.coupon_id = #{param.couponId}
|
||||
</if>
|
||||
<if test="param.realName != null">
|
||||
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
|
||||
@@ -46,56 +35,83 @@
|
||||
<if test="param.phone != null">
|
||||
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
|
||||
</if>
|
||||
<if test="param.payTime != null">
|
||||
AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%')
|
||||
<if test="param.totalPrice != null">
|
||||
AND a.total_price = #{param.totalPrice}
|
||||
</if>
|
||||
<if test="param.transactionId != null">
|
||||
AND a.transaction_id LIKE CONCAT('%', #{param.transactionId}, '%')
|
||||
<if test="param.reducePrice != null">
|
||||
AND a.reduce_price = #{param.reducePrice}
|
||||
</if>
|
||||
<if test="param.payPrice != null">
|
||||
AND a.pay_price = #{param.payPrice}
|
||||
</if>
|
||||
<if test="param.price != null">
|
||||
AND a.price = #{param.price}
|
||||
</if>
|
||||
<if test="param.money != null">
|
||||
AND a.money = #{param.money}
|
||||
</if>
|
||||
<if test="param.refundMoney != null">
|
||||
AND a.refund_money = #{param.refundMoney}
|
||||
</if>
|
||||
<if test="param.totalNum != null">
|
||||
AND a.total_num = #{param.totalNum}
|
||||
</if>
|
||||
<if test="param.payType != null">
|
||||
AND a.pay_type = #{param.payType}
|
||||
</if>
|
||||
<if test="param.payStatus != null">
|
||||
AND a.pay_status = #{param.payStatus}
|
||||
</if>
|
||||
<if test="param.payMethod != null">
|
||||
AND a.pay_method LIKE CONCAT('%', #{param.payMethod}, '%')
|
||||
<if test="param.orderStatus != null">
|
||||
AND a.order_status = #{param.orderStatus}
|
||||
</if>
|
||||
<if test="param.couponType != null">
|
||||
AND a.coupon_type = #{param.couponType}
|
||||
</if>
|
||||
<if test="param.couponDesc != null">
|
||||
AND a.coupon_desc LIKE CONCAT('%', #{param.couponDesc}, '%')
|
||||
</if>
|
||||
<if test="param.qrcode != null">
|
||||
AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%')
|
||||
</if>
|
||||
<if test="param.startTime != null">
|
||||
AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%')
|
||||
</if>
|
||||
<if test="param.isInvoice != null">
|
||||
AND a.is_invoice = #{param.isInvoice}
|
||||
</if>
|
||||
<if test="param.invoiceNo != null">
|
||||
AND a.invoice_no LIKE CONCAT('%', #{param.invoiceNo}, '%')
|
||||
</if>
|
||||
<if test="param.payTime != null">
|
||||
AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%')
|
||||
</if>
|
||||
<if test="param.refundTime != null">
|
||||
AND a.refund_time LIKE CONCAT('%', #{param.refundTime}, '%')
|
||||
</if>
|
||||
<if test="param.refundApplyTime != null">
|
||||
AND a.refund_apply_time LIKE CONCAT('%', #{param.refundApplyTime}, '%')
|
||||
</if>
|
||||
<if test="param.expirationTime != null">
|
||||
AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%')
|
||||
</if>
|
||||
<if test="param.province != null">
|
||||
AND a.province LIKE CONCAT('%', #{param.province}, '%')
|
||||
</if>
|
||||
<if test="param.city != null">
|
||||
AND a.city LIKE CONCAT('%', #{param.city}, '%')
|
||||
</if>
|
||||
<if test="param.region != null">
|
||||
AND a.region LIKE CONCAT('%', #{param.region}, '%')
|
||||
</if>
|
||||
<if test="param.area != null">
|
||||
AND a.area LIKE CONCAT('%', #{param.area}, '%')
|
||||
</if>
|
||||
<if test="param.address != null">
|
||||
AND a.address LIKE CONCAT('%', #{param.address}, '%')
|
||||
</if>
|
||||
<if test="param.refundImage != null">
|
||||
AND a.refund_image LIKE CONCAT('%', #{param.refundImage}, '%')
|
||||
</if>
|
||||
<if test="param.refundContent != null">
|
||||
AND a.refund_content LIKE CONCAT('%', #{param.refundContent}, '%')
|
||||
<if test="param.checkBill != null">
|
||||
AND a.check_bill = #{param.checkBill}
|
||||
</if>
|
||||
<if test="param.isSettled != null">
|
||||
AND a.is_settled = #{param.isSettled}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
<if test="param.version != null">
|
||||
AND a.version = #{param.version}
|
||||
</if>
|
||||
<if test="param.merchantId != null">
|
||||
AND a.merchant_id = #{param.merchantId}
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
@@ -109,6 +125,14 @@
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.tenant_id = #{param.keywords}
|
||||
OR a.order_id = #{param.keywords}
|
||||
OR a.phone = #{param.keywords}
|
||||
OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
OR a.order_no LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
@@ -122,14 +146,4 @@
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 按OutTradeNo查询 -->
|
||||
<select id="getByOutTradeNo" resultType="com.gxwebsoft.common.system.entity.Order">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 更新订单状态 -->
|
||||
<select id="updateByOutTradeNo" resultType="com.gxwebsoft.common.system.entity.Order">
|
||||
UPDATE sys_order SET pay_status = #{param.payStatus},pay_time = #{param.payTime},pay_price = #{param.payPrice},transaction_id = #{param.transactionId} WHERE order_no = #{param.orderNo}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.gxwebsoft.common.system.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 购物车查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 10:54:51
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "CartParam对象", description = "购物车查询参数")
|
||||
public class CartParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "购物车表ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "类型 0商城 1应用插件")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "唯一标识")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "项目ID,0 goodId 1 companyId")
|
||||
private Long itemId;
|
||||
|
||||
@ApiModelProperty(value = "商品规格")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty(value = "商品价格")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "商品数量")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer cartNum;
|
||||
|
||||
@ApiModelProperty(value = "单商品合计")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty(value = "0 = 未购买 1 = 已购买")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean isPay;
|
||||
|
||||
@ApiModelProperty(value = "是否为立即购买")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean isNew;
|
||||
|
||||
@ApiModelProperty(value = "拼团id")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer combinationId;
|
||||
|
||||
@ApiModelProperty(value = "秒杀产品ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer seckillId;
|
||||
|
||||
@ApiModelProperty(value = "砍价id")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer bargainId;
|
||||
|
||||
@ApiModelProperty(value = "是否选中")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean selected;
|
||||
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
private Long merchantId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.gxwebsoft.common.system.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单商品查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 12:18:05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "OrderGoodsParam对象", description = "订单商品查询参数")
|
||||
public class OrderGoodsParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "订单类型,0商城 1应用插件")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "项目ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer itemId;
|
||||
|
||||
@ApiModelProperty(value = "实际付款")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ApiModelProperty(value = "购买数量")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer totalNum;
|
||||
|
||||
@ApiModelProperty(value = "0未付款,1已付款")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean payStatus;
|
||||
|
||||
@ApiModelProperty(value = "0未完成,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer orderStatus;
|
||||
|
||||
@ApiModelProperty(value = "预约详情开始时间数组")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "是否已开具发票:0未开发票,1已开发票,2不能开具发票")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean isInvoice;
|
||||
|
||||
@ApiModelProperty(value = "发票流水号")
|
||||
private String invoiceNo;
|
||||
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private String payTime;
|
||||
|
||||
@ApiModelProperty(value = "过期时间")
|
||||
private String expirationTime;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "排序号")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import java.math.BigDecimal;
|
||||
* 订单查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-24 13:46:21
|
||||
* @since 2024-10-16 12:32:52
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@@ -24,109 +24,131 @@ import java.math.BigDecimal;
|
||||
public class OrderParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@ApiModelProperty(value = "订单号")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
@ApiModelProperty(value = "订单类型,0产品 1插件")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
@ApiModelProperty(value = "下单渠道,0网站 1小程序 2其他")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal money;
|
||||
private Integer channel;
|
||||
|
||||
@ApiModelProperty(value = "实际付款金额(包含运费)")
|
||||
@ApiModelProperty(value = "微信支付订单号")
|
||||
private String transactionId;
|
||||
|
||||
@ApiModelProperty(value = "微信退款订单号")
|
||||
private String refundOrder;
|
||||
|
||||
@ApiModelProperty(value = "使用的优惠券id")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ApiModelProperty(value = "套餐ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer planId;
|
||||
|
||||
@ApiModelProperty(value = "卡ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer priceId;
|
||||
|
||||
@ApiModelProperty(value = "获得的会员等级")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer gradeId;
|
||||
|
||||
@ApiModelProperty(value = "卡名称")
|
||||
private String priceName;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "持有者ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer memberId;
|
||||
private Integer couponId;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "联系电话")
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "付款时间")
|
||||
@ApiModelProperty(value = "订单总额")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty(value = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal reducePrice;
|
||||
|
||||
@ApiModelProperty(value = "实际付款")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ApiModelProperty(value = "用于统计")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "价钱,用于积分赠送")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal money;
|
||||
|
||||
@ApiModelProperty(value = "退款金额")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal refundMoney;
|
||||
|
||||
@ApiModelProperty(value = "购买数量")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer totalNum;
|
||||
|
||||
@ApiModelProperty(value = "0余额支付, 1微信支付,102微信Native,2会员卡支付,3支付宝,4现金,5POS机")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer payType;
|
||||
|
||||
@ApiModelProperty(value = "0未付款,1已付款")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean payStatus;
|
||||
|
||||
@ApiModelProperty(value = "0未完成,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer orderStatus;
|
||||
|
||||
@ApiModelProperty(value = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer couponType;
|
||||
|
||||
@ApiModelProperty(value = "优惠说明")
|
||||
private String couponDesc;
|
||||
|
||||
@ApiModelProperty(value = "二维码地址,保存订单号,支付成功后才生成")
|
||||
private String qrcode;
|
||||
|
||||
@ApiModelProperty(value = "预约详情开始时间数组")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "是否已开具发票:0未开发票,1已开发票,2不能开具发票")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean isInvoice;
|
||||
|
||||
@ApiModelProperty(value = "发票流水号")
|
||||
private String invoiceNo;
|
||||
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private String payTime;
|
||||
|
||||
@ApiModelProperty(value = "支付流水号")
|
||||
private String transactionId;
|
||||
@ApiModelProperty(value = "退款时间")
|
||||
private String refundTime;
|
||||
|
||||
@ApiModelProperty(value = "付款状态(10未付款 20已付款)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer payStatus;
|
||||
@ApiModelProperty(value = "申请退款时间")
|
||||
private String refundApplyTime;
|
||||
|
||||
@ApiModelProperty(value = "支付方式(余额/微信/支付宝)")
|
||||
private String payMethod;
|
||||
|
||||
@ApiModelProperty(value = "到期时间")
|
||||
@ApiModelProperty(value = "过期时间")
|
||||
private String expirationTime;
|
||||
|
||||
@ApiModelProperty(value = "所在省份")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "所在城市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "所在辖区")
|
||||
private String region;
|
||||
|
||||
@ApiModelProperty(value = "所在地区")
|
||||
private String area;
|
||||
|
||||
@ApiModelProperty(value = "街道地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "退款凭证")
|
||||
private String refundImage;
|
||||
|
||||
@ApiModelProperty(value = "退款理由")
|
||||
private String refundContent;
|
||||
@ApiModelProperty(value = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer checkBill;
|
||||
|
||||
@ApiModelProperty(value = "订单是否已结算(0未结算 1已结算)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer isSettled;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@ApiModelProperty(value = "系统版本号 0当前版本 value=其他版本")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
private Integer version;
|
||||
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
@ApiModelProperty(value = "用户id")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Long merchantId;
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@ApiModelProperty(value = "排序号")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.common.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Cart;
|
||||
import com.gxwebsoft.common.system.param.CartParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 10:54:51
|
||||
*/
|
||||
public interface CartService extends IService<Cart> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<Cart>
|
||||
*/
|
||||
PageResult<Cart> pageRel(CartParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<Cart>
|
||||
*/
|
||||
List<Cart> listRel(CartParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 购物车表ID
|
||||
* @return Cart
|
||||
*/
|
||||
Cart getByIdRel(Long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.common.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.OrderGoods;
|
||||
import com.gxwebsoft.common.system.param.OrderGoodsParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单商品Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 12:18:05
|
||||
*/
|
||||
public interface OrderGoodsService extends IService<OrderGoods> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<OrderGoods>
|
||||
*/
|
||||
PageResult<OrderGoods> pageRel(OrderGoodsParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<OrderGoods>
|
||||
*/
|
||||
List<OrderGoods> listRel(OrderGoodsParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 订单号
|
||||
* @return OrderGoods
|
||||
*/
|
||||
OrderGoods getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -5,14 +5,13 @@ import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Order;
|
||||
import com.gxwebsoft.common.system.param.OrderParam;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-24 13:46:21
|
||||
* @since 2024-10-16 12:32:52
|
||||
*/
|
||||
public interface OrderService extends IService<Order> {
|
||||
|
||||
@@ -35,14 +34,10 @@ public interface OrderService extends IService<Order> {
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param orderId ID
|
||||
* @param orderId 订单号
|
||||
* @return Order
|
||||
*/
|
||||
Order getByIdRel(Integer orderId);
|
||||
|
||||
HashMap<String, String> createWxOrder(Order order);
|
||||
|
||||
Order getByOutTradeNo(String outTradeNo);
|
||||
|
||||
void updateByOutTradeNo(Order order);
|
||||
void paySuccess(Order order);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Cart;
|
||||
import com.gxwebsoft.common.system.mapper.CartMapper;
|
||||
import com.gxwebsoft.common.system.param.CartParam;
|
||||
import com.gxwebsoft.common.system.service.CartService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 10:54:51
|
||||
*/
|
||||
@Service
|
||||
public class CartServiceImpl extends ServiceImpl<CartMapper, Cart> implements CartService {
|
||||
|
||||
@Override
|
||||
public PageResult<Cart> pageRel(CartParam param) {
|
||||
PageParam<Cart, CartParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Cart> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cart> listRel(CartParam param) {
|
||||
List<Cart> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Cart, CartParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cart getByIdRel(Long id) {
|
||||
CartParam param = new CartParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.OrderGoods;
|
||||
import com.gxwebsoft.common.system.mapper.OrderGoodsMapper;
|
||||
import com.gxwebsoft.common.system.param.OrderGoodsParam;
|
||||
import com.gxwebsoft.common.system.service.OrderGoodsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单商品Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-26 12:18:05
|
||||
*/
|
||||
@Service
|
||||
public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGoods> implements OrderGoodsService {
|
||||
|
||||
@Override
|
||||
public PageResult<OrderGoods> pageRel(OrderGoodsParam param) {
|
||||
PageParam<OrderGoods, OrderGoodsParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<OrderGoods> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderGoods> listRel(OrderGoodsParam param) {
|
||||
List<OrderGoods> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<OrderGoods, OrderGoodsParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderGoods getByIdRel(Integer id) {
|
||||
OrderGoodsParam param = new OrderGoodsParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,171 +1,99 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Company;
|
||||
import com.gxwebsoft.common.system.entity.Order;
|
||||
import com.gxwebsoft.common.system.entity.Payment;
|
||||
import com.gxwebsoft.common.system.entity.OrderGoods;
|
||||
import com.gxwebsoft.common.system.mapper.OrderMapper;
|
||||
import com.gxwebsoft.common.system.param.OrderParam;
|
||||
import com.gxwebsoft.common.system.service.CompanyService;
|
||||
import com.gxwebsoft.common.system.service.MenuService;
|
||||
import com.gxwebsoft.common.system.service.OrderGoodsService;
|
||||
import com.gxwebsoft.common.system.service.OrderService;
|
||||
import com.gxwebsoft.common.system.service.PaymentService;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.RSAConfig;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-24 13:46:21
|
||||
* @since 2024-10-16 12:32:52
|
||||
*/
|
||||
@Service
|
||||
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||
@Value("${spring.profiles.active}")
|
||||
String active;
|
||||
@Resource
|
||||
private ConfigProperties config;
|
||||
@Resource
|
||||
private SettingService settingService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private PaymentService paymentService;
|
||||
public static String privateKeyPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/apiclient_key.pem";
|
||||
public static String privateCertPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/apiclient_cert.pem";
|
||||
public static String serialNumber = "48749613B40AA8F1D768583FC352358E13EB5AF0";
|
||||
public static String merchantId = "1246610101";
|
||||
public static String appId = "wx541db955e7a62709";
|
||||
public static String apiV3Key = "zGufUcqa7ovgxRL0kF5OlPr482EZwtn9";
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
|
||||
/**
|
||||
* 平台证书生成命令(勿删)
|
||||
* java -jar CertificateDownloader.jar -k zGufUcqa7ovgxRL0kF5OlPr482EZwtn9 -m 1246610101 -f /www/wwwroot/file.ws//file/20240511/280fb6cf7eec4c2d9661c2508123c6a8.pem -s 48749613B40AA8F1D768583FC352358E13EB5AF0 -o /www/cert/
|
||||
*/
|
||||
public static String wechatpayCertPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/wechatpay_4A3231584E93B6AE77820074D07EADEACCB7E223.pem"; // 平台证书
|
||||
|
||||
@Override
|
||||
public PageResult<Order> pageRel(OrderParam param) {
|
||||
PageParam<Order, OrderParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Order> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Order> listRel(OrderParam param) {
|
||||
List<Order> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Order, OrderParam> page = new PageParam<>();
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getByIdRel(Integer orderId) {
|
||||
OrderParam param = new OrderParam();
|
||||
param.setOrderId(orderId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getByOutTradeNo(String outTradeNo) {
|
||||
System.out.println("outTradeNo = " + outTradeNo);
|
||||
OrderParam param = new OrderParam();
|
||||
param.setOrderNo(outTradeNo);
|
||||
return param.getOne(baseMapper.getByOutTradeNo(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByOutTradeNo(Order order) {
|
||||
baseMapper.updateByOutTradeNo(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建微信支付
|
||||
*
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, String> createWxOrder(Order order) {
|
||||
// 服务器本地路径
|
||||
final String uploadPath = config.getUploadPath();
|
||||
final HashMap<String, String> orderInfo = new HashMap<>();
|
||||
// 微信小程序(微信支付)
|
||||
String key = "Payment:wxPay:".concat(order.getTenantId().toString());
|
||||
final Payment payment = redisUtil.get(key, Payment.class);
|
||||
|
||||
final JSONObject mpWx = settingService.getBySettingKey("mp-weixin");
|
||||
|
||||
// 计算金额
|
||||
BigDecimal decimal = order.getTotalPrice();
|
||||
final BigDecimal multiply = decimal.multiply(new BigDecimal(100));
|
||||
// 将 BigDecimal 转换为 Integer
|
||||
Integer money = multiply.intValue();
|
||||
String privateKey = uploadPath.concat("/file").concat(payment.getApiclientKey()); // 秘钥证书
|
||||
String apiclientCert = uploadPath.concat("/file").concat(payment.getApiclientCert());
|
||||
// 开发环境配置
|
||||
if(active.equals("dev")){
|
||||
privateKey = privateKeyPath;
|
||||
apiclientCert = wechatpayCertPath;
|
||||
@Override
|
||||
public PageResult<Order> pageRel(OrderParam param) {
|
||||
PageParam<Order, OrderParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Order> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
Config config =
|
||||
new RSAConfig.Builder()
|
||||
.merchantId(payment.getMchId())
|
||||
.privateKeyFromPath(privateKey)
|
||||
.merchantSerialNumber(payment.getMerchantSerialNumber())
|
||||
.wechatPayCertificatesFromPath(apiclientCert)
|
||||
.build();
|
||||
|
||||
// 构建service
|
||||
JsapiServiceExtension service = new JsapiServiceExtension.Builder().config(config).build();
|
||||
// 跟之前下单示例一样,填充预下单参数
|
||||
PrepayRequest request = new PrepayRequest();
|
||||
Amount amount = new Amount();
|
||||
amount.setTotal(money);
|
||||
amount.setCurrency("CNY");
|
||||
request.setAmount(amount);
|
||||
request.setAppid(mpWx.getString("appId"));
|
||||
request.setMchid(payment.getMchId());
|
||||
request.setDescription(order.getComments());
|
||||
request.setNotifyUrl("https://server.gxwebsoft.com/api/system/wx-pay/notify/" + order.getTenantId());
|
||||
request.setOutTradeNo(order.getOrderNo());
|
||||
request.setAttach(order.getTenantId().toString());
|
||||
final Payer payer = new Payer();
|
||||
payer.setOpenid(order.getOpenid());
|
||||
request.setPayer(payer);
|
||||
if (StrUtil.isNotBlank(payment.getNotifyUrl())) {
|
||||
request.setNotifyUrl(payment.getNotifyUrl().concat("/").concat(order.getTenantId().toString()));
|
||||
@Override
|
||||
public List<Order> listRel(OrderParam param) {
|
||||
List<Order> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Order, OrderParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
// 测试金额
|
||||
if(active.equals("dev")){
|
||||
amount.setTotal(1);
|
||||
request.setAmount(amount);
|
||||
|
||||
@Override
|
||||
public Order getByIdRel(Integer orderId) {
|
||||
OrderParam param = new OrderParam();
|
||||
param.setOrderId(orderId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paySuccess(Order order) {
|
||||
System.out.println("order = " + order);
|
||||
// 安装插件
|
||||
menuService.cloneMenu(order.getMenuParam());
|
||||
order.setPayStatus(true);
|
||||
// 实际支付金额
|
||||
if (order.getPayType().equals(0)) {
|
||||
order.setPayPrice(order.getPayPrice());
|
||||
}
|
||||
order.setPayTime(DateUtil.date());
|
||||
order.setStartTime(System.currentTimeMillis());
|
||||
order.setExpirationTime(DateUtil.offsetMonth(DateUtil.date(), order.getMonth()));
|
||||
updateById(order);
|
||||
// orderGoodsService.update(new LambdaUpdateWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId())
|
||||
// .set(OrderGoods::getPayStatus, 1)
|
||||
// .set(OrderGoods::getPayTime, DateUtil.date())
|
||||
// .set(OrderGoods::getExpirationTime, DateUtil.offsetMonth(DateUtil.date(), order.getMonth()))
|
||||
// );
|
||||
|
||||
final List<OrderGoods> list = orderGoodsService.list(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId()));
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(d -> {
|
||||
d.setPayStatus(true);
|
||||
d.setPayTime(DateUtil.date());
|
||||
d.setExpirationTime(DateUtil.offsetMonth(DateUtil.date(), order.getMonth()));
|
||||
});
|
||||
// 更新订单商品状态
|
||||
orderGoodsService.updateBatchById(list);
|
||||
// 累计销量
|
||||
Company company = companyService.getById(list.get(0).getItemId());
|
||||
company.setBuys(company.getBuys() + list.size());
|
||||
System.out.println("company = " + company);
|
||||
companyService.updateById(company);
|
||||
}
|
||||
System.out.println("request = " + request);
|
||||
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
|
||||
orderInfo.put("provider", "wxpay");
|
||||
orderInfo.put("timeStamp", response.getTimeStamp());
|
||||
orderInfo.put("nonceStr", response.getNonceStr());
|
||||
orderInfo.put("package", response.getPackageVal());
|
||||
orderInfo.put("signType", "RSA");
|
||||
orderInfo.put("paySign", response.getPaySign());
|
||||
return orderInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user