添加 order 临时提交,写完 api dataObject 和一些定义,为实现

pull/1/head
sin 2019-03-16 15:22:24 +08:00
parent c8488fc278
commit d70d1dcc7a
18 changed files with 640 additions and 0 deletions

View File

@ -0,0 +1,57 @@
package cn.iocoder.mall.order.api;
import cn.iocoder.mall.order.api.bo.OrderBO;
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderUpdateDTO;
/**
* service
*
* @author Sin
* @time 2019-03-16 13:15
*/
public interface OrderService {
/**
*
*
* @param orderCreateDTO
* @return
*/
OrderBO createOrder(OrderCreateDTO orderCreateDTO);
/**
*
*
* @param orderUpdateDTO
*/
void updateOrder(OrderUpdateDTO orderUpdateDTO);
/**
*
*
* @param orderId
*/
void deleteOrder(String orderId);
/**
*
*
* mq payStatus
*/
void listenerPayment();
/**
*
*
* mq status
*/
void listenerConfirmGoods();
/**
*
*
* mq status
*/
void listenerExchangeGoods();
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.mall.order.api.bo;
import java.io.Serializable;
/**
* BO
*
* @author Sin
* @time 2019-03-16 14:38
*/
public class OrderBO implements Serializable {
}

View File

@ -0,0 +1,15 @@
package cn.iocoder.mall.order.api.constants;
/**
* MQ
*
* @author Sin
* @time 2019-03-16 15:04
*/
public class MQConstants {
/**
* -
*/
public static final String ORDER_CREATE_SUCCESS = "order.orderCreateSuccess";
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.mall.order.api.constants;
/**
* status
*
* @author Sin
* @time 2019-03-16 14:32
*/
public enum OrderPayStatusEnum {
WAITING_PAYMENT(0, "等待支付"),
SUCCESSFUL_PAYMENT(1, "支付成功"),
REFUND_PAYMENT(2, "退款成功"),
;
private final int value;
private final String text;
OrderPayStatusEnum(int value, String text) {
this.value = value;
this.text = text;
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.mall.order.api.constants;
/**
* - status
*
* @author Sin
* @time 2019-03-16 14:06
*/
public enum OrderStatusEnum {
// 基本状态
WAIT_SHIPMENT(0, "等待发货"),
ALREADY_SHIPMENT(1, "已发货"),
RECEIVED_GOODS(2, "已收货"),
CONFIRM_RECEIPT_GOODS(3, "确认收货"), // 确认收货,也就是交易成功!
// 换货
APPLY_EXCHANGE_GOODS(20, "申请换货"),
EXCHANGE_GOODS(21, "换货中"),
EXCHANGE_GOODS_SUCCESSFUL(22, "换货成功"),
// 退货
APPLY_RETURN_GOODS(40, "申请退货"),
RETURN_GOODS(41, "退货中"),
RETURN_GOODS_SUCCESSFUL(42, "退货成功"),
;
private final int value;
private final String text;
OrderStatusEnum(int value, String text) {
this.value = value;
this.text = text;
}}

View File

@ -0,0 +1,12 @@
package cn.iocoder.mall.order.api.dto;
import java.io.Serializable;
/**
*
*
* @author Sin
* @time 2019-03-16 14:42
*/
public class OrderCreateDTO implements Serializable {
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.mall.order.api.dto;
import java.io.Serializable;
/**
*
*
* @author Sin
* @time 2019-03-16 14:46
*/
public class OrderUpdateDTO implements Serializable {
}

View File

@ -0,0 +1,7 @@
/**
* api
*
* @author Sin
* @time 2019-03-16 13:15
*/
package cn.iocoder.mall.order.api;

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>order</artifactId>
<groupId>cn.iocoder.mall</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>order-service-impl</artifactId>
<dependencies>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>order-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,21 @@
package cn.iocoder.mall.order.dao;
import cn.iocoder.mall.order.dataobject.OrderDO;
import org.springframework.stereotype.Repository;
/**
* mapper
*
* @author Sin
* @time 2019-03-16 15:09
*/
@Repository
public interface OrderMapper {
/**
*
*
* @param orderDO
*/
void insert(OrderDO orderDO);
}

View File

@ -0,0 +1,201 @@
package cn.iocoder.mall.order.dataobject;
import java.io.Serializable;
import java.util.Date;
/**
*
*
* @author Sin
* @time 2019-03-16 13:49
*/
public class OrderDO implements Serializable {
/**
*
*/
private String id;
/**
*
*/
private String orderNo;
/**
*
*/
private Integer price;
/**
*
*/
private String receiverAreaNo;
/**
*
*/
private String receiverMobile;
/**
*
*/
private String receiverAddress;
/**
* ()
*
* - 0
* - 1
* - 2
* - 20
* - 21
* - 40退
* - 41退
*/
private Integer status;
/**
*
*
* - 0
* - 1
* - 2退
*/
private Integer payStatus;
/**
*
*/
private Date createTime;
/**
*
*/
private Date paymentTime;
/**
*
*/
private Date deliveryTime;
/**
*
*/
private Date closingTime;
/**
*
*/
private String remark;
@Override
public String toString() {
return "Order{" +
"id='" + id + '\'' +
", orderNo='" + orderNo + '\'' +
", price=" + price +
", receiverAreaNo='" + receiverAreaNo + '\'' +
", receiverMobile='" + receiverMobile + '\'' +
", receiverAddress='" + receiverAddress + '\'' +
", status=" + status +
", payStatus=" + payStatus +
", createTime=" + createTime +
", paymentTime=" + paymentTime +
", deliveryTime=" + deliveryTime +
", closingTime=" + closingTime +
", remark='" + remark + '\'' +
'}';
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getReceiverAreaNo() {
return receiverAreaNo;
}
public void setReceiverAreaNo(String receiverAreaNo) {
this.receiverAreaNo = receiverAreaNo;
}
public String getReceiverMobile() {
return receiverMobile;
}
public void setReceiverMobile(String receiverMobile) {
this.receiverMobile = receiverMobile;
}
public String getReceiverAddress() {
return receiverAddress;
}
public void setReceiverAddress(String receiverAddress) {
this.receiverAddress = receiverAddress;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getPayStatus() {
return payStatus;
}
public void setPayStatus(Integer payStatus) {
this.payStatus = payStatus;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getPaymentTime() {
return paymentTime;
}
public void setPaymentTime(Date paymentTime) {
this.paymentTime = paymentTime;
}
public Date getDeliveryTime() {
return deliveryTime;
}
public void setDeliveryTime(Date deliveryTime) {
this.deliveryTime = deliveryTime;
}
public Date getClosingTime() {
return closingTime;
}
public void setClosingTime(Date closingTime) {
this.closingTime = closingTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@ -0,0 +1,105 @@
package cn.iocoder.mall.order.dataobject;
import java.io.Serializable;
/**
* item
*
* @author Sin
* @time 2019-03-16 14:03
*/
public class OrderItemDO implements Serializable {
/**
*
*/
private String id;
/**
*
*/
private String orderId;
/**
*
*/
private String commodityId;
/**
*
*/
private Integer quantity;
/**
* ()
*/
private Integer price;
/**
*
*
* - 0
* - 1
* - 2
* - 20
* - 21
* - 40退
* - 41退
*/
private Integer status;
@Override
public String toString() {
return "OrderItem{" +
"id='" + id + '\'' +
", orderId='" + orderId + '\'' +
", commodityId='" + commodityId + '\'' +
", quantity=" + quantity +
", price=" + price +
", status=" + status +
'}';
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getCommodityId() {
return commodityId;
}
public void setCommodityId(String commodityId) {
this.commodityId = commodityId;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}

View File

@ -0,0 +1,5 @@
/**
* @author Sin
* @time 2019-03-16 13:49
*/
package cn.iocoder.mall.order;

View File

@ -0,0 +1,16 @@
package cn.iocoder.mall.order.service;
import org.springframework.stereotype.Service;
/**
* service impl
*
* @author Sin
* @time 2019-03-16 15:08
*/
@Service
@com.alibaba.dubbo.config.annotation.Service(validation = "true")
public class ServiceImpl {
}

View File

@ -0,0 +1,25 @@
spring:
# datasource
datasource:
url: jdbc:mysql://180.167.213.26:13306/mall_order?useSSL=false&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver
username: root
password: ${MALL_MYSQL_PASSWORD}
# mybatis
mybatis:
config-location: classpath:mybatis-config.xml
mapper-locations: classpath:mapper/*.xml
type-aliases-package: cn.iocoder.mall.order.dataobject
# dubbo
dubbo:
application:
name: order-service
registry:
address: zookeeper://127.0.0.1:2181
protocol:
port: -1
name: dubbo
scan:
base-packages: cn.iocoder.mall.order.service

View File

@ -0,0 +1,23 @@
<?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="cn.iocoder.mall.order.dao.OrderMapper">
<sql id="FIELDS">
id, order_no, price, receiver_area_no, receiver_mobile,
receiver_address, status, pay_status, create_time,
payment_time, delivery_time, closing_time, remark
</sql>
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO order (
id, order_no, price, receiver_area_no, receiver_mobile,
receiver_address, status, pay_status, create_time,
payment_time, delivery_time, closing_time, remark
) VALUES (
${orderNo}, ${price}, ${receiverAreaNo}, ${receiverMobile},
${receiverAddress}, ${status}, ${payStatus}, ${createTime},
${paymentTime}, ${deliveryTime}, ${closingTime}, ${remark}
)
</insert>
</mapper>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 使用驼峰命名法转换字段。 -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
<typeAliases>
<typeAlias alias="Integer" type="java.lang.Integer"/>
<typeAlias alias="Long" type="java.lang.Long"/>
<typeAlias alias="HashMap" type="java.util.HashMap"/>
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap"/>
<typeAlias alias="ArrayList" type="java.util.ArrayList"/>
<typeAlias alias="LinkedList" type="java.util.LinkedList"/>
</typeAliases>
</configuration>

View File

@ -14,6 +14,7 @@
<modules> <modules>
<module>order-application</module> <module>order-application</module>
<module>order-service-api</module> <module>order-service-api</module>
<module>order-service-impl</module>
</modules> </modules>