提交 3779562b 编写于 作者: huawei_code1994's avatar huawei_code1994

feat:订单模块初始化

上级 7d575da6
package com.youlai.mall.oms.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.core.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单物流记录表
*
* @author huawei
* @email huawei_code@163.com
* @date 2020-12-30 22:31:10
*/
@Data
@TableName("oms_order_delivery")
public class OrderDeliveryEntity extends BaseEntity {
/**
* id
*/
@TableId
private Long id;
/**
* 订单id
*/
private Long orderId;
/**
* 物流公司(配送方式)
*/
private String deliveryCompany;
/**
* 物流单号
*/
private String deliverySn;
/**
* 收货人姓名
*/
private String receiverName;
/**
* 收货人电话
*/
private String receiverPhone;
/**
* 收货人邮编
*/
private String receiverPostCode;
/**
* 省份/直辖市
*/
private String receiverProvince;
/**
* 城市
*/
private String receiverCity;
/**
* 区
*/
private String receiverRegion;
/**
* 详细地址
*/
private String receiverDetailAddress;
/**
* 备注
*/
private String remark;
/**
* 物流状态【0->运输中;1->已收货】
*/
private Integer deliveryStatus;
/**
* 发货时间
*/
private Date deliveryTime;
/**
* 确认收货时间
*/
private Date receiveTime;
/**
* 逻辑删除【0->正常;1->已删除】
*/
private Integer deleted;
}
package com.youlai.mall.oms.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.core.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单详情表
*
* @author huawei
* @email huawei_code@163.com
* @date 2020-12-30 22:31:10
*/
@Data
@TableName("oms_order")
public class OrderEntity extends BaseEntity {
/**
* id
*/
@TableId
private Long id;
/**
* 订单号
*/
private String orderSn;
/**
* 订单总额(分)
*/
private Long totalAmount;
/**
* 商品总数
*/
private Integer totalQuantity;
/**
* 订单来源[0->PC订单;1->app订单]
*/
private Integer sourceType;
/**
* 订单状态【101->待付款;102->用户取消;103->系统取消;201->已付款;202->申请退款;203->已退款;301->待发货;401->已发货;501->用户收货;502->系统收货;901->已完成】
*/
private Integer status;
/**
* 订单备注
*/
private String remark;
/**
* 会员id
*/
private Long memberId;
/**
* 使用的优惠券
*/
private Long couponId;
/**
* 优惠券抵扣金额(分)
*/
private Long couponAmount;
/**
* 运费金额(分)
*/
private Long freightAmount;
/**
* 应付总额(分)
*/
private Long payAmount;
/**
* 支付时间
*/
private Date payTime;
/**
* 支付方式【1->支付宝;2->微信;3->银联; 4->货到付款;】
*/
private Integer payType;
/**
* 发货时间
*/
private Date deliveryTime;
/**
* 确认收货时间
*/
private Date receiveTime;
/**
* 评价时间
*/
private Date commentTime;
/**
* 逻辑删除【0->正常;1->已删除】
*/
private Integer deleted;
}
package com.youlai.mall.oms.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.core.base.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 订单商品信息表
*
* @author huawei
* @email huawei_code@163.com
* @date 2020-12-30 22:31:10
*/
@Data
@TableName("oms_order_goods")
public class OrderGoodsEntity extends BaseEntity {
/**
* id
*/
@TableId
private Long id;
/**
* order_id
*/
private Long orderId;
/**
* 商品sku id
*/
private Long skuId;
/**
* 商品sku编号
*/
private String skuCode;
/**
* 商品sku名字
*/
private String skuName;
/**
* 商品sku图片
*/
private String skuPic;
/**
* 商品sku价格(分)
*/
private Long skuPrice;
/**
* 商品购买的数量
*/
private Integer skuQuantity;
/**
* 商品sku总价格(分)
*/
private Long skuTotalPrice;
/**
* spu_id
*/
private Long spuId;
/**
* spu_name
*/
private String spuName;
/**
* spu_pic
*/
private String spuPic;
/**
* 品牌id
*/
private Long brandId;
/**
* 品牌名称
*/
private String brandName;
/**
* 商品分类id
*/
private Long categoryId;
/**
* 商品分类名称
*/
private String categoryName;
/**
* 逻辑删除【0->正常;1->已删除】
*/
private Integer deleted;
}
package com.youlai.mall.oms.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.core.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单操作历史记录
*
* @author huawei
* @email huawei_code@163.com
* @date 2020-12-30 22:31:10
*/
@Data
@TableName("oms_order_logs")
public class OrderLogsEntity extends BaseEntity {
/**
* id
*/
@TableId
private Long id;
/**
* 订单id
*/
private Long orderId;
/**
* 操作人[用户;系统;后台管理员]
*/
private String user;
/**
* 操作详情
*/
private String detail;
/**
* 操作时订单状态
*/
private Integer orderStatus;
/**
* 备注
*/
private String remark;
/**
* 逻辑删除【0->正常;1->已删除】
*/
private Integer deleted;
}
package com.youlai.mall.oms.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.core.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 支付信息表
*
* @author huawei
* @email huawei_code@163.com
* @date 2020-12-30 22:31:10
*/
@Data
@TableName("oms_order_pay")
public class OrderPayEntity extends BaseEntity {
/**
* id
*/
@TableId
private Long id;
/**
* 订单id
*/
private Long orderId;
/**
* 支付流水号
*/
private String paySn;
/**
* 应付总额(分)
*/
private Long payAmount;
/**
* 支付时间
*/
private Date payTime;
/**
* 支付方式【1->支付宝;2->微信;3->银联; 4->货到付款;】
*/
private Integer payType;
/**
* 支付状态
*/
private Integer payStatus;
/**
* 确认时间
*/
private Date confirmTime;
/**
* 回调内容
*/
private String callbackContent;
/**
* 回调时间
*/
private Date callbackTime;
/**
* 交易内容
*/
private String paySubject;
/**
* 逻辑删除【0->正常;1->已删除】
*/
private Integer deleted;
}
package com.youlai.mall.oms.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.youlai.common.core.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单配置信息
*
* @author huawei
* @email huawei_code@163.com
* @date 2020-12-30 22:31:10
*/
@Data
@TableName("oms_order_setting")
public class OrderSettingEntity extends BaseEntity {
/**
* id
*/
@TableId
private Long id;
/**
* 秒杀订单超时关闭时间(分)
*/
private Integer flashOrderOvertime;
/**
* 正常订单超时时间(分)
*/
private Integer normalOrderOvertime;
/**
* 发货后自动确认收货时间(天)
*/
private Integer confirmOvertime;
/**
* 自动完成交易时间,不能申请退货(天)
*/
private Integer finishOvertime;
/**
* 订单完成后自动好评时间(天)
*/
private Integer commentOvertime;
/**
* 会员等级【0-不限会员等级,全部通用;其他-对应的其他会员等级】
*/
private Integer memberLevel;
/**
* 逻辑删除【0->正常;1->已删除】
*/
private Integer deleted;
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.youlai.common.core.base;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.common.core.constant.RenrenConstant;
import com.youlai.common.core.xss.SQLFilter;
import java.util.Map;
/**
* 查询参数
*
* @author Mark sunlightcs@gmail.com
*/
public class Query<T> {
public IPage<T> getPage(Map<String, Object> params) {
return this.getPage(params, null, false);
}
public IPage<T> getPage(Map<String, Object> params, String defaultOrderField, boolean isAsc) {
//分页参数
long curPage = 1;
long limit = 10;
if(params.get(RenrenConstant.PAGE) != null){
curPage = Long.parseLong((String)params.get(RenrenConstant.PAGE));
}
if(params.get(RenrenConstant.LIMIT) != null){
limit = Long.parseLong((String)params.get(RenrenConstant.LIMIT));
}
//分页对象
Page<T> page = new Page<>(curPage, limit);
//分页参数
params.put(RenrenConstant.PAGE, page);
//排序字段
//防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险)
String orderField = SQLFilter.sqlInject((String)params.get(RenrenConstant.ORDER_FIELD));
String order = (String)params.get(RenrenConstant.ORDER);
//前端字段排序
if(StrUtil.isNotEmpty(orderField) && StrUtil.isNotEmpty(order)){
if(RenrenConstant.ASC.equalsIgnoreCase(order)) {
return page.addOrder(OrderItem.asc(orderField));
}else {
return page.addOrder(OrderItem.desc(orderField));
}
}
//没有排序字段,则不排序
if(StrUtil.isBlank(defaultOrderField)){
return page;
}
//默认排序
if(isAsc) {
page.addOrder(OrderItem.asc(defaultOrderField));
}else {
page.addOrder(OrderItem.desc(defaultOrderField));
}
return page;
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.youlai.common.core.constant;
/**
* 常量
*
* @author Mark sunlightcs@gmail.com
*/
public class RenrenConstant {
/** 超级管理员ID */
public static final int SUPER_ADMIN = 1;
/**
* 当前页码
*/
public static final String PAGE = "page";
/**
* 每页显示记录数
*/
public static final String LIMIT = "limit";
/**
* 排序字段
*/
public static final String ORDER_FIELD = "sidx";
/**
* 排序方式
*/
public static final String ORDER = "order";
/**
* 升序
*/
public static final String ASC = "asc";
/**
* 菜单类型
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2016年11月15日 下午1:24:29
*/
public enum MenuType {
/**
* 目录
*/
CATALOG(0),
/**
* 菜单
*/
MENU(1),
/**
* 按钮
*/
BUTTON(2);
private int value;
MenuType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
/**
* 定时任务状态
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2016年12月3日 上午12:07:22
*/
public enum ScheduleStatus {
/**
* 正常
*/
NORMAL(0),
/**
* 暂停
*/
PAUSE(1);
private int value;
ScheduleStatus(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
/**
* 云服务商
*/
public enum CloudService {
/**
* 七牛云
*/
QINIU(1),
/**
* 阿里云
*/
ALIYUN(2),
/**
* 腾讯云
*/
QCLOUD(3);
private int value;
CloudService(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.youlai.common.core.xss;
import cn.hutool.core.util.StrUtil;
/**
* SQL过滤
*
* @author Mark sunlightcs@gmail.com
*/
public class SQLFilter {
/**
* SQL注入过滤
* @param str 待验证的字符串
*/
public static String sqlInject(String str){
if(StrUtil.isBlank(str)){
return null;
}
//去掉'|"|;|\字符
str = StrUtil.replace(str, "'", "");
str = StrUtil.replace(str, "\"", "");
str = StrUtil.replace(str, ";", "");
str = StrUtil.replace(str, "\\", "");
//转换成小写
str = str.toLowerCase();
//非法字符
String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"};
//判断是否包含非法字符
for(String keyword : keywords){
if(str.indexOf(keyword) != -1){
//throw new cust("包含非法字符");
}
}
return str;
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.youlai.common.mybatis.utils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.io.Serializable;
import java.util.List;
/**
* 分页工具类
*
* @author Mark sunlightcs@gmail.com
*/
public class PageUtils implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 总记录数
*/
private int totalCount;
/**
* 每页记录数
*/
private int pageSize;
/**
* 总页数
*/
private int totalPage;
/**
* 当前页数
*/
private int currPage;
/**
* 列表数据
*/
private List<?> list;
/**
* 分页
* @param list 列表数据
* @param totalCount 总记录数
* @param pageSize 每页记录数
* @param currPage 当前页数
*/
public PageUtils(List<?> list, int totalCount, int pageSize, int currPage) {
this.list = list;
this.totalCount = totalCount;
this.pageSize = pageSize;
this.currPage = currPage;
this.totalPage = (int)Math.ceil((double)totalCount/pageSize);
}
/**
* 分页
*/
public PageUtils(IPage<?> page) {
this.list = page.getRecords();
this.totalCount = (int)page.getTotal();
this.pageSize = (int)page.getSize();
this.currPage = (int)page.getCurrent();
this.totalPage = (int)page.getPages();
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getCurrPage() {
return currPage;
}
public void setCurrPage(int currPage) {
this.currPage = currPage;
}
public List<?> getList() {
return list;
}
public void setList(List<?> list) {
this.list = list;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册