Merge branch 'master' of http://120.27.238.55:7000/r/xc-mall
Conflicts:
src/main/java/cc/mrbird/febs/mall/mapper/MallOrderInfoMapper.java
src/main/resources/mapper/modules/MallOrderInfoMapper.xml
9 files added
8 files modified
| | |
| | | member_id bigint null comment '用户ID', |
| | | PRIMARY KEY (ID) |
| | | ) COMMENT = '用户钱包'; |
| | | alter table mall_order_item add sku_image varchar(1000) null comment 'sku图片' after sku_name; |
| | | |
| | | DROP TABLE IF EXISTS mall_express_info; |
| | | CREATE TABLE mall_express_info( |
| | | REVISION INT COMMENT '乐观锁' , |
| | | CREATED_BY VARCHAR(32) COMMENT '创建人' , |
| | | CREATED_TIME DATETIME COMMENT '创建时间' , |
| | | UPDATED_BY VARCHAR(32) COMMENT '更新人' , |
| | | UPDATED_TIME DATETIME COMMENT '更新时间' , |
| | | ID BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键' , |
| | | order_id BIGINT COMMENT '订单ID' , |
| | | member_id BIGINT COMMENT '用户ID' , |
| | | express_no VARCHAR(255) COMMENT '物流单号' , |
| | | express_com VARCHAR(255) COMMENT '物流公司' , |
| | | PRIMARY KEY (ID) |
| | | ) COMMENT = '物流信息表'; |
| | | |
| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.mall.dto.AddOrderDto; |
| | | import cc.mrbird.febs.mall.dto.OrderListDto; |
| | | import cc.mrbird.febs.mall.dto.PayOrderDto; |
| | | import cc.mrbird.febs.mall.service.IApiMallOrderInfoService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | return new FebsResponse().success().data(map).message("支付成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "订单列表", notes = "订单列表") |
| | | @PostMapping(value = "/orderList") |
| | | public FebsResponse orderList(@RequestBody OrderListDto orderListDto) { |
| | | return new FebsResponse().success().data(mallOrderInfoService.findOrderList(orderListDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "订单详情", notes = "订单详情") |
| | | @GetMapping(value = "/orderDetails/{id}") |
| | | public FebsResponse orderDetails(@PathVariable("id") Long id) { |
| | | return new FebsResponse().success().data(mallOrderInfoService.findOrderDetailsById(id)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.conversion; |
| | | |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.mall.vo.OrderDetailVo; |
| | | import cc.mrbird.febs.mall.vo.OrderListVo; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-22 |
| | | **/ |
| | | @Mapper |
| | | public abstract class MallOrderInfoConversion { |
| | | public static final MallOrderInfoConversion INSTANCE = Mappers.getMapper(MallOrderInfoConversion.class); |
| | | |
| | | |
| | | public abstract OrderListVo entityToVo(MallOrderInfo mallOrderInfo); |
| | | public abstract List<OrderListVo> entitysToVos(List<MallOrderInfo> mallOrderInfos); |
| | | |
| | | |
| | | public abstract OrderDetailVo entityToDetailVo(MallOrderInfo mallOrderInfo); |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.conversion; |
| | | |
| | | import cc.mrbird.febs.mall.entity.MallOrderItem; |
| | | import cc.mrbird.febs.mall.vo.OrderItemVo; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-22 |
| | | **/ |
| | | @Mapper |
| | | public abstract class MallOrderItemConversion { |
| | | public static final MallOrderItemConversion INSTANCE = Mappers.getMapper(MallOrderItemConversion.class); |
| | | |
| | | public abstract OrderItemVo entityToVo(MallOrderItem item); |
| | | public abstract List<OrderItemVo> entityToVo(List<MallOrderItem> items); |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-22 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "OrderListDto", description = "订单列表参数接收类") |
| | | public class OrderListDto { |
| | | |
| | | @ApiModelProperty(value = "一页数量", example = "10") |
| | | private Integer pageSize; |
| | | |
| | | @ApiModelProperty(value = "第几页", example = "1") |
| | | private Integer pageNum; |
| | | |
| | | @ApiModelProperty(value = "搜索参数", example = "1") |
| | | private String query; |
| | | |
| | | @ApiModelProperty(value = "订单状态", example = "0-全部 1-待付款 2-待发货 3-待收货 4-退款或退款中") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-22 |
| | | **/ |
| | | @Data |
| | | @TableName("mall_express_info") |
| | | public class MallExpressInfo extends BaseEntity { |
| | | |
| | | private Long orderId; |
| | | |
| | | private Long memberId; |
| | | |
| | | private String expressNo; |
| | | |
| | | private String expressCom; |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | |
| | | private String remark; |
| | | |
| | | /** |
| | | * 是否删除 1-是 2-否 |
| | | */ |
| | | private Integer delFlag; |
| | | |
| | | @TableField(exist = false) |
| | | private List<MallOrderItem> items; |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | |
| | | **/ |
| | | @Data |
| | | @TableName("mall_order_item") |
| | | public class MallOrderItem { |
| | | public class MallOrderItem extends BaseEntity { |
| | | |
| | | private Long orderId; |
| | | |
| | |
| | | |
| | | private String skuName; |
| | | |
| | | private String skuImage; |
| | | |
| | | private Integer cnt; |
| | | |
| | | private BigDecimal price; |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.MallExpressInfo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface MallExpressInfoMapper extends BaseMapper<MallExpressInfo> { |
| | | |
| | | MallExpressInfo selectByOrderId(@Param("orderId") Long orderId); |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.dto.MallOrderInfoDto; |
| | | import cc.mrbird.febs.mall.dto.OrderListDto; |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallOrderInfoVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallOrderVo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | IPage<AdminMallOrderInfoVo> selectOrderListInPage(Page<AdminMallOrderInfoVo> page, @Param("record") MallOrderInfoDto mallOrderInfo); |
| | | |
| | | AdminMallOrderVo getMallOrderInfoById(@Param("id")long id); |
| | | |
| | | IPage<MallOrderInfo> selectOrderListInPage(IPage<MallOrderInfo> page,@Param("record") OrderListDto orderListDto); |
| | | |
| | | MallOrderInfo selectOrderDetailsById(@Param("id") Long id); |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.service; |
| | | |
| | | import cc.mrbird.febs.mall.dto.AddOrderDto; |
| | | import cc.mrbird.febs.mall.dto.OrderListDto; |
| | | import cc.mrbird.febs.mall.dto.PayOrderDto; |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.mall.vo.OrderDetailVo; |
| | | import cc.mrbird.febs.mall.vo.OrderListVo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IApiMallOrderInfoService extends IService<MallOrderInfo> { |
| | | |
| | |
| | | void cancelOrder(Long id); |
| | | |
| | | String payOrder(PayOrderDto payOrderDto); |
| | | |
| | | List<OrderListVo> findOrderList(OrderListDto orderListDto); |
| | | |
| | | OrderDetailVo findOrderDetailsById(Long id); |
| | | } |
| | |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.mall.conversion.MallOrderInfoConversion; |
| | | import cc.mrbird.febs.mall.dto.AddOrderDto; |
| | | import cc.mrbird.febs.mall.dto.AddOrderItemDto; |
| | | import cc.mrbird.febs.mall.dto.OrderListDto; |
| | | import cc.mrbird.febs.mall.dto.PayOrderDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.IApiMallOrderInfoService; |
| | | import cc.mrbird.febs.mall.vo.OrderDetailVo; |
| | | import cc.mrbird.febs.mall.vo.OrderListVo; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | |
| | | private final MallOrderItemMapper mallOrderItemMapper; |
| | | private final MallMemberMapper memberMapper; |
| | | private final IApiMallMemberWalletService memberWalletService; |
| | | private final MallExpressInfoMapper expressInfoMapper; |
| | | |
| | | @Override |
| | | public Long createOrder(AddOrderDto addOrderDto) { |
| | |
| | | memberWalletService.reduceBalance(orderInfo.getAmount(), mallMember.getId()); |
| | | return orderInfo.getOrderNo(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<OrderListVo> findOrderList(OrderListDto orderListDto) { |
| | | IPage<MallOrderInfo> page = new Page<>(orderListDto.getPageNum(), orderListDto.getPageSize()); |
| | | |
| | | IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectOrderListInPage(page, orderListDto); |
| | | return MallOrderInfoConversion.INSTANCE.entitysToVos(mallOrderInfos.getRecords()); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetailVo findOrderDetailsById(Long id) { |
| | | MallOrderInfo orderInfo = this.baseMapper.selectOrderDetailsById(id); |
| | | if (orderInfo == null) { |
| | | throw new FebsException("订单不存在"); |
| | | } |
| | | |
| | | OrderDetailVo orderDetailVo = MallOrderInfoConversion.INSTANCE.entityToDetailVo(orderInfo); |
| | | |
| | | if (orderInfo.getStatus() == OrderStatusEnum.WAIT_FINISH.getValue()) { |
| | | MallExpressInfo expressInfo = expressInfoMapper.selectByOrderId(orderInfo.getId()); |
| | | orderDetailVo.setExpressNo(expressInfo.getExpressNo()); |
| | | orderDetailVo.setExpressCom(expressInfo.getExpressCom()); |
| | | } |
| | | return orderDetailVo; |
| | | } |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-22 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "OrderDetailVo", description = "订单明细返回参数类") |
| | | public class OrderDetailVo { |
| | | |
| | | @ApiModelProperty(value = "订单ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty(value = "下单时间") |
| | | private Date orderTime; |
| | | |
| | | @ApiModelProperty(value = "支付方式") |
| | | private String payMethod; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "订单金额") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty(value = "收货人姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "收货人电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "收货人地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "物流单号") |
| | | private String expressNo; |
| | | |
| | | @ApiModelProperty(value = "物流公司") |
| | | private String expressCom; |
| | | |
| | | @ApiModelProperty(value = "订单明细") |
| | | private List<OrderItemVo> items; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import sun.nio.cs.ext.Big5; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-22 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "OrderListItemVo", description = "订单列表明细返回参数类") |
| | | public class OrderItemVo { |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "样式名称") |
| | | private String styleName; |
| | | |
| | | @ApiModelProperty(value = "sku名称") |
| | | private String skuName; |
| | | |
| | | @ApiModelProperty(value = "sku图片") |
| | | private String skuImage; |
| | | |
| | | @ApiModelProperty(value = "数量") |
| | | private Integer cnt; |
| | | |
| | | @ApiModelProperty(value = "单价") |
| | | private BigDecimal price; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-22 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "OrderListVo", description = "订单列表返回参数类") |
| | | public class OrderListVo { |
| | | |
| | | @ApiModelProperty(value = "订单ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty(value = "下单时间") |
| | | private Date orderTime; |
| | | |
| | | @ApiModelProperty(value = "状态 1-待支付2-待发货3-待收货4-已完成5-退款中6-已退款7-已取消") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "订单金额") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty(value = "订单明细") |
| | | private List<OrderItemVo> items; |
| | | } |
New file |
| | |
| | | <?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="cc.mrbird.febs.mall.mapper.MallExpressInfoMapper"> |
| | | |
| | | <select id="selectByOrderId" resultType="cc.mrbird.febs.mall.entity.MallExpressInfo"> |
| | | select * from mall_express_info where order_id=#{orderId} |
| | | </select> |
| | | </mapper> |
| | |
| | | select * from mall_order_info where id = #{id} |
| | | </select> |
| | | |
| | | |
| | | <resultMap id="OrderInfoMap" type="cc.mrbird.febs.mall.entity.MallOrderInfo"> |
| | | <id column="id" property="id" /> |
| | | <result column="order_no" property="orderNo" /> |
| | | <result column="member_id" property="memberId" /> |
| | | <result column="order_time" property="orderTime" /> |
| | | <result column="pay_time" property="payTime" /> |
| | | <result column="amount" property="amount" /> |
| | | <result column="pay_method" property="payMethod" /> |
| | | <result column="pay_order_no" property="payOrderNo" /> |
| | | <result column="pay_result" property="payResult" /> |
| | | <result column="status" property="status" /> |
| | | <result column="cancel_type" property="cancelType" /> |
| | | <result column="name" property="name" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="address" property="address" /> |
| | | <result column="longitude" property="longitude" /> |
| | | <result column="latitude" property="latitude" /> |
| | | <result column="remark" property="remark" /> |
| | | <collection property="items" ofType="cc.mrbird.febs.mall.entity.MallOrderItem"> |
| | | <id property="id" column="item_id" /> |
| | | <result property="orderId" column="order_id" /> |
| | | <result property="goodsId" column="goods_id" /> |
| | | <result property="skuId" column="sku_id" /> |
| | | <result property="goodsName" column="goods_name" /> |
| | | <result property="styleName" column="style_name" /> |
| | | <result property="skuName" column="sku_name" /> |
| | | <result property="skuImage" column="sku_image" /> |
| | | <result property="cnt" column="cnt" /> |
| | | <result property="price" column="price" /> |
| | | <result property="amount" column="amount" /> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <select id="selectOrderListInPage" resultMap="OrderInfoMap"> |
| | | select |
| | | a.*, |
| | | b.id item_id, |
| | | b.order_id, |
| | | b.goods_id, |
| | | b.sku_id, |
| | | b.goods_name, |
| | | b.style_name, |
| | | b.sku_name, |
| | | b.sku_image, |
| | | b.cnt, |
| | | b.price, |
| | | b.amount |
| | | from mall_order_info a |
| | | inner join mall_order_item b on a.id=b.order_id |
| | | <where> |
| | | <if test="record.query != null and record.query != ''"> |
| | | and (b.goods_name like CONCAT('%', CONCAT(#{record.query}, '%')) or b.style_name like CONCAT('%', CONCAT(#{record.query}, '%')) or b.sku_name like CONCAT('%', CONCAT(#{record.query}, '%'))) |
| | | </if> |
| | | <if test="record.status == 4"> |
| | | and a.status in (5,6) |
| | | </if> |
| | | <if test="record.status != 4"> |
| | | and a.status = #{record.status} |
| | | </if> |
| | | </where> |
| | | order by a.created_time desc |
| | | </select> |
| | | |
| | | <select id="selectOrderDetailsById" resultMap="OrderInfoMap"> |
| | | select |
| | | a.*, |
| | | b.id item_id, |
| | | b.order_id, |
| | | b.goods_id, |
| | | b.sku_id, |
| | | b.goods_name, |
| | | b.style_name, |
| | | b.sku_name, |
| | | b.sku_image, |
| | | b.cnt, |
| | | b.price, |
| | | b.amount |
| | | from mall_order_info a |
| | | inner join mall_order_item b on a.id=b.order_id |
| | | where id=#{id} |
| | | </select> |
| | | </mapper> |