feat:基本模型以及dal层
This commit is contained in:
31
api/pom.xml
Normal file
31
api/pom.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>pers.amos</groupId>
|
||||
<artifactId>tech-mall</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>api</artifactId>
|
||||
<name>api</name>
|
||||
<description>Dubbo API定义模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Dubbo -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Common模块 -->
|
||||
<dependency>
|
||||
<groupId>pers.amos</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package pers.amos.mall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 库存检查DTO
|
||||
*/
|
||||
@Data
|
||||
public class InventoryCheckDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 订单类型:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 固定班次编号
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 需要的座位数
|
||||
*/
|
||||
private Integer quantity;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package pers.amos.mall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 库存操作DTO(锁定/扣减/释放)
|
||||
*/
|
||||
@Data
|
||||
public class InventoryOperationDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 订单类型:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 固定班次编号
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 需要的座位数
|
||||
*/
|
||||
private Integer quantity;
|
||||
}
|
||||
|
||||
50
api/src/main/java/pers/amos/mall/api/dto/OrderCreateDTO.java
Normal file
50
api/src/main/java/pers/amos/mall/api/dto/OrderCreateDTO.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package pers.amos.mall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建订单DTO
|
||||
*/
|
||||
@Data
|
||||
public class OrderCreateDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 线路编码
|
||||
*/
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 订单类型:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 固定班次编号(orderType=FIXED时必填)
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次日期(orderType=ROLLING时必填,格式:yyyy-MM-dd)
|
||||
*/
|
||||
private String scheduleDate;
|
||||
|
||||
/**
|
||||
* 票种:ADULT-成人票,STUDENT-学生票,CHILD-儿童票
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
/**
|
||||
* 购票数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
}
|
||||
|
||||
88
api/src/main/java/pers/amos/mall/api/dto/OrderResultDTO.java
Normal file
88
api/src/main/java/pers/amos/mall/api/dto/OrderResultDTO.java
Normal file
@@ -0,0 +1,88 @@
|
||||
package pers.amos.mall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单返回DTO
|
||||
*/
|
||||
@Data
|
||||
public class OrderResultDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 线路编码
|
||||
*/
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 订单类型:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 固定班次编号
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 票种
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
/**
|
||||
* 购票数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 支付超时时间
|
||||
*/
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
/**
|
||||
* 车票列表
|
||||
*/
|
||||
private List<TicketDTO> tickets;
|
||||
}
|
||||
|
||||
76
api/src/main/java/pers/amos/mall/api/dto/TicketDTO.java
Normal file
76
api/src/main/java/pers/amos/mall/api/dto/TicketDTO.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package pers.amos.mall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 车票DTO
|
||||
*/
|
||||
@Data
|
||||
public class TicketDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 车票号
|
||||
*/
|
||||
private String ticketNo;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 线路编码
|
||||
*/
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 订单类型
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 固定班次编号
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 票种
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
/**
|
||||
* 二维码内容
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 出票时间
|
||||
*/
|
||||
private LocalDateTime issueTime;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private LocalDateTime expireTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package pers.amos.mall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 生成车票DTO
|
||||
*/
|
||||
@Data
|
||||
public class TicketGenerateDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 线路编码
|
||||
*/
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 订单类型:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 固定班次编号
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 票种:ADULT-成人票,STUDENT-学生票,CHILD-儿童票
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package pers.amos.mall.api.service;
|
||||
|
||||
import pers.amos.mall.api.dto.InventoryCheckDTO;
|
||||
import pers.amos.mall.api.dto.InventoryOperationDTO;
|
||||
import pers.amos.mall.common.response.Result;
|
||||
|
||||
/**
|
||||
* 线路服务Dubbo接口
|
||||
*/
|
||||
public interface RouteService {
|
||||
|
||||
/**
|
||||
* 检查库存是否充足
|
||||
*
|
||||
* @param dto 库存检查DTO
|
||||
* @return 检查结果
|
||||
*/
|
||||
Result<Boolean> checkInventory(InventoryCheckDTO dto);
|
||||
|
||||
/**
|
||||
* 锁定库存
|
||||
*
|
||||
* @param dto 库存操作DTO
|
||||
* @return 锁定结果
|
||||
*/
|
||||
Result<Boolean> lockInventory(InventoryOperationDTO dto);
|
||||
|
||||
/**
|
||||
* 扣减库存(支付成功后调用)
|
||||
*
|
||||
* @param dto 库存操作DTO
|
||||
* @return 扣减结果
|
||||
*/
|
||||
Result<Boolean> deductInventory(InventoryOperationDTO dto);
|
||||
|
||||
/**
|
||||
* 释放库存(订单取消或超时)
|
||||
*
|
||||
* @param dto 库存操作DTO
|
||||
* @return 释放结果
|
||||
*/
|
||||
Result<Boolean> releaseInventory(InventoryOperationDTO dto);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package pers.amos.mall.api.service;
|
||||
|
||||
import pers.amos.mall.api.dto.TicketDTO;
|
||||
import pers.amos.mall.api.dto.TicketGenerateDTO;
|
||||
import pers.amos.mall.common.response.Result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车票服务Dubbo接口
|
||||
*/
|
||||
public interface TicketService {
|
||||
|
||||
/**
|
||||
* 生成车票
|
||||
*
|
||||
* @param dto 生成车票DTO
|
||||
* @return 车票列表
|
||||
*/
|
||||
Result<List<TicketDTO>> generateTickets(TicketGenerateDTO dto);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
<artifactId>common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>pers.amos</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 电子车票实体
|
||||
* 电子车票实体(订单1:N车票)
|
||||
*/
|
||||
@Data
|
||||
@TableName("ticket")
|
||||
@@ -29,27 +29,42 @@ public class Ticket implements Serializable {
|
||||
private String ticketNo;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
* 订单号
|
||||
*/
|
||||
private Long orderId;
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 持票人用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 线路ID
|
||||
* 线路编码
|
||||
*/
|
||||
private Long routeId;
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 班次ID
|
||||
* 订单类型:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private Long scheduleId;
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 票种
|
||||
* 固定班次编号(orderType=FIXED时使用)
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号(orderType=ROLLING时使用)
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 票种规则编码
|
||||
*/
|
||||
private String ruleCode;
|
||||
|
||||
/**
|
||||
* 票种:ADULT-成人票,STUDENT-学生票,CHILD-儿童票
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
@@ -58,11 +73,6 @@ public class Ticket implements Serializable {
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 二维码图片URL
|
||||
*/
|
||||
private String qrCodeUrl;
|
||||
|
||||
/**
|
||||
* 状态:VALID-有效,USED-已使用,EXPIRED-已过期,REFUNDED-已退款
|
||||
*/
|
||||
@@ -79,7 +89,7 @@ public class Ticket implements Serializable {
|
||||
private LocalDateTime usedTime;
|
||||
|
||||
/**
|
||||
* 过期时间(班次发车时间)
|
||||
* 过期时间
|
||||
*/
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package pers.amos.mall.perform.dal.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 车票规则实体
|
||||
*/
|
||||
@Data
|
||||
@TableName("ticket_rule")
|
||||
public class TicketRule implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 规则编码(唯一)
|
||||
*/
|
||||
private String ruleCode;
|
||||
|
||||
/**
|
||||
* 票种:ADULT-成人票,STUDENT-学生票,CHILD-儿童票
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
private String ruleName;
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
*/
|
||||
private String ruleDescription;
|
||||
|
||||
/**
|
||||
* 折扣率(基于基础票价)
|
||||
*/
|
||||
private BigDecimal discountRate;
|
||||
|
||||
/**
|
||||
* 是否需要身份验证
|
||||
*/
|
||||
private Boolean needVerify;
|
||||
|
||||
/**
|
||||
* 最小年龄限制
|
||||
*/
|
||||
private Integer minAge;
|
||||
|
||||
/**
|
||||
* 最大年龄限制
|
||||
*/
|
||||
private Integer maxAge;
|
||||
|
||||
/**
|
||||
* 状态:1-启用,0-停用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 车票核销记录实体
|
||||
* 车票核销记录实体(车票1:N核销记录)
|
||||
*/
|
||||
@Data
|
||||
@TableName("ticket_verification")
|
||||
@@ -24,17 +24,32 @@ public class TicketVerification implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 车票ID
|
||||
* 核销流水号(唯一)
|
||||
*/
|
||||
private Long ticketId;
|
||||
private String verificationNo;
|
||||
|
||||
/**
|
||||
* 实际核销的班次ID
|
||||
* 车票号
|
||||
*/
|
||||
private Long scheduleId;
|
||||
private String ticketNo;
|
||||
|
||||
/**
|
||||
* 二维码
|
||||
* 订单类型:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 实际核销的固定班次编号(orderType=FIXED时使用)
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 实际核销的滚动班次编号(orderType=ROLLING时使用)
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 二维码内容
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package pers.amos.mall.perform.dal.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import pers.amos.mall.perform.dal.dataobject.TicketRule;
|
||||
|
||||
/**
|
||||
* 车票规则Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface TicketRuleMapper extends BaseMapper<TicketRule> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package pers.amos.mall.perform.dal.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import pers.amos.mall.perform.dal.dataobject.TicketRule;
|
||||
|
||||
/**
|
||||
* 车票规则Repository
|
||||
*/
|
||||
public interface TicketRuleRepository extends IService<TicketRule> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package pers.amos.mall.perform.dal.repository.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import pers.amos.mall.perform.dal.dataobject.TicketRule;
|
||||
import pers.amos.mall.perform.dal.mapper.TicketRuleMapper;
|
||||
import pers.amos.mall.perform.dal.repository.TicketRuleRepository;
|
||||
|
||||
/**
|
||||
* 车票规则Repository实现
|
||||
*/
|
||||
@Repository
|
||||
public class TicketRuleRepositoryImpl extends ServiceImpl<TicketRuleMapper, TicketRule> implements TicketRuleRepository {
|
||||
}
|
||||
|
||||
15
pom.xml
15
pom.xml
@@ -10,6 +10,7 @@
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>common</module>
|
||||
<module>api</module>
|
||||
<module>route</module>
|
||||
<module>trade</module>
|
||||
<module>perform</module>
|
||||
@@ -32,6 +33,7 @@
|
||||
<hutool.version>5.8.41</hutool.version>
|
||||
<lombok.version>1.18.38</lombok.version>
|
||||
<fastjson2.version>2.0.43</fastjson2.version>
|
||||
<liteflow.version>2.12.0</liteflow.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -123,12 +125,25 @@
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- LiteFlow -->
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>${liteflow.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 内部模块 -->
|
||||
<dependency>
|
||||
<groupId>pers.amos</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>pers.amos</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
<artifactId>common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>pers.amos</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -13,11 +13,11 @@ import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 班次实体(包含库存管理)
|
||||
* 固定班次实体(独立库存管理)
|
||||
*/
|
||||
@Data
|
||||
@TableName("schedule")
|
||||
public class Schedule implements Serializable {
|
||||
@TableName("fixed_schedule")
|
||||
public class FixedSchedule implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -28,12 +28,12 @@ public class Schedule implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所属线路ID
|
||||
* 线路编码
|
||||
*/
|
||||
private Long routeId;
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 班次编号
|
||||
* 班次编号(唯一)
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
@@ -9,11 +9,11 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 班次库存变动日志
|
||||
* 库存变动日志(固定班次和滚动发车通用)
|
||||
*/
|
||||
@Data
|
||||
@TableName("schedule_inventory_log")
|
||||
public class ScheduleInventoryLog implements Serializable {
|
||||
@TableName("inventory_log")
|
||||
public class InventoryLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -24,9 +24,19 @@ public class ScheduleInventoryLog implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 班次ID
|
||||
* 库存类型:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private Long scheduleId;
|
||||
private String inventoryType;
|
||||
|
||||
/**
|
||||
* 固定班次编号(inventoryType=FIXED时使用)
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号(inventoryType=ROLLING时使用)
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 操作类型:LOCK-锁定,UNLOCK-解锁,DEDUCT-扣减,RELEASE-释放
|
||||
@@ -49,9 +59,9 @@ public class ScheduleInventoryLog implements Serializable {
|
||||
private Integer afterQty;
|
||||
|
||||
/**
|
||||
* 关联订单ID
|
||||
* 关联订单号
|
||||
*/
|
||||
private Long orderId;
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 操作描述
|
||||
@@ -0,0 +1,79 @@
|
||||
package pers.amos.mall.route.dal.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 滚动发车班次实体(共享库存池)
|
||||
*/
|
||||
@Data
|
||||
@TableName("rolling_schedule")
|
||||
public class RollingSchedule implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 线路编码
|
||||
*/
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号(唯一)
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 班次日期
|
||||
*/
|
||||
private LocalDate scheduleDate;
|
||||
|
||||
/**
|
||||
* 总座位数(共享库存池)
|
||||
*/
|
||||
private Integer totalCapacity;
|
||||
|
||||
/**
|
||||
* 可售座位数
|
||||
*/
|
||||
private Integer availableSeats;
|
||||
|
||||
/**
|
||||
* 已售座位数
|
||||
*/
|
||||
private Integer soldSeats;
|
||||
|
||||
/**
|
||||
* 状态:1-运营中,0-已停运
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 乐观锁版本号(防止超卖)
|
||||
*/
|
||||
@Version
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 线路实体
|
||||
@@ -25,7 +26,7 @@ public class Route implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 线路编码
|
||||
* 线路编码(唯一)
|
||||
*/
|
||||
private String routeCode;
|
||||
|
||||
@@ -70,14 +71,29 @@ public class Route implements Serializable {
|
||||
private BigDecimal childPrice;
|
||||
|
||||
/**
|
||||
* 班次类型:INTERVAL-间隔发车,FIXED-固定时刻
|
||||
* 运营模式:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private String scheduleType;
|
||||
private String operationMode;
|
||||
|
||||
/**
|
||||
* 班次间隔(分钟)- 仅当scheduleType=INTERVAL时有效
|
||||
* 滚动发车运营开始时间(仅ROLLING模式有效)
|
||||
*/
|
||||
private Integer scheduleInterval;
|
||||
private LocalTime operationStart;
|
||||
|
||||
/**
|
||||
* 滚动发车运营结束时间(仅ROLLING模式有效)
|
||||
*/
|
||||
private LocalTime operationEnd;
|
||||
|
||||
/**
|
||||
* 滚动发车间隔(分钟,仅ROLLING模式有效)
|
||||
*/
|
||||
private Integer departureInterval;
|
||||
|
||||
/**
|
||||
* 滚动发车每日总座位数(仅ROLLING模式有效)
|
||||
*/
|
||||
private Integer dailyCapacity;
|
||||
|
||||
/**
|
||||
* 状态:1-运营中,0-停运
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package pers.amos.mall.route.dal.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import pers.amos.mall.route.dal.dataobject.FixedSchedule;
|
||||
|
||||
/**
|
||||
* 固定班次Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface FixedScheduleMapper extends BaseMapper<FixedSchedule> {
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package pers.amos.mall.route.dal.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import pers.amos.mall.route.dal.dataobject.Schedule;
|
||||
import pers.amos.mall.route.dal.dataobject.InventoryLog;
|
||||
|
||||
/**
|
||||
* 班次Mapper
|
||||
* 库存日志Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleMapper extends BaseMapper<Schedule> {
|
||||
public interface InventoryLogMapper extends BaseMapper<InventoryLog> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package pers.amos.mall.route.dal.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import pers.amos.mall.route.dal.dataobject.RollingSchedule;
|
||||
|
||||
/**
|
||||
* 滚动发车班次Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface RollingScheduleMapper extends BaseMapper<RollingSchedule> {
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package pers.amos.mall.route.dal.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import pers.amos.mall.route.dal.dataobject.ScheduleInventoryLog;
|
||||
|
||||
/**
|
||||
* 班次库存变动日志Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleInventoryLogMapper extends BaseMapper<ScheduleInventoryLog> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package pers.amos.mall.route.dal.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import pers.amos.mall.route.dal.dataobject.FixedSchedule;
|
||||
|
||||
/**
|
||||
* 固定班次Repository
|
||||
*/
|
||||
public interface FixedScheduleRepository extends IService<FixedSchedule> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package pers.amos.mall.route.dal.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import pers.amos.mall.route.dal.dataobject.InventoryLog;
|
||||
|
||||
/**
|
||||
* 库存日志Repository
|
||||
*/
|
||||
public interface InventoryLogRepository extends IService<InventoryLog> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package pers.amos.mall.route.dal.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import pers.amos.mall.route.dal.dataobject.RollingSchedule;
|
||||
|
||||
/**
|
||||
* 滚动发车班次Repository
|
||||
*/
|
||||
public interface RollingScheduleRepository extends IService<RollingSchedule> {
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package pers.amos.mall.route.dal.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import pers.amos.mall.route.dal.dataobject.ScheduleInventoryLog;
|
||||
|
||||
/**
|
||||
* 班次库存变动日志Repository
|
||||
*/
|
||||
public interface ScheduleInventoryLogRepository extends IService<ScheduleInventoryLog> {
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package pers.amos.mall.route.dal.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import pers.amos.mall.route.dal.dataobject.Schedule;
|
||||
|
||||
/**
|
||||
* 班次Repository
|
||||
*/
|
||||
public interface ScheduleRepository extends IService<Schedule> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package pers.amos.mall.route.dal.repository.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import pers.amos.mall.route.dal.dataobject.FixedSchedule;
|
||||
import pers.amos.mall.route.dal.mapper.FixedScheduleMapper;
|
||||
import pers.amos.mall.route.dal.repository.FixedScheduleRepository;
|
||||
|
||||
/**
|
||||
* 固定班次Repository实现
|
||||
*/
|
||||
@Repository
|
||||
public class FixedScheduleRepositoryImpl extends ServiceImpl<FixedScheduleMapper, FixedSchedule> implements FixedScheduleRepository {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package pers.amos.mall.route.dal.repository.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import pers.amos.mall.route.dal.dataobject.InventoryLog;
|
||||
import pers.amos.mall.route.dal.mapper.InventoryLogMapper;
|
||||
import pers.amos.mall.route.dal.repository.InventoryLogRepository;
|
||||
|
||||
/**
|
||||
* 库存日志Repository实现
|
||||
*/
|
||||
@Repository
|
||||
public class InventoryLogRepositoryImpl extends ServiceImpl<InventoryLogMapper, InventoryLog> implements InventoryLogRepository {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package pers.amos.mall.route.dal.repository.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import pers.amos.mall.route.dal.dataobject.RollingSchedule;
|
||||
import pers.amos.mall.route.dal.mapper.RollingScheduleMapper;
|
||||
import pers.amos.mall.route.dal.repository.RollingScheduleRepository;
|
||||
|
||||
/**
|
||||
* 滚动发车班次Repository实现
|
||||
*/
|
||||
@Repository
|
||||
public class RollingScheduleRepositoryImpl extends ServiceImpl<RollingScheduleMapper, RollingSchedule> implements RollingScheduleRepository {
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package pers.amos.mall.route.dal.repository.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import pers.amos.mall.route.dal.dataobject.ScheduleInventoryLog;
|
||||
import pers.amos.mall.route.dal.mapper.ScheduleInventoryLogMapper;
|
||||
import pers.amos.mall.route.dal.repository.ScheduleInventoryLogRepository;
|
||||
|
||||
/**
|
||||
* 班次库存变动日志Repository实现
|
||||
*/
|
||||
@Service
|
||||
public class ScheduleInventoryLogRepositoryImpl extends ServiceImpl<ScheduleInventoryLogMapper, ScheduleInventoryLog> implements ScheduleInventoryLogRepository {
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package pers.amos.mall.route.dal.repository.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import pers.amos.mall.route.dal.dataobject.Schedule;
|
||||
import pers.amos.mall.route.dal.mapper.ScheduleMapper;
|
||||
import pers.amos.mall.route.dal.repository.ScheduleRepository;
|
||||
|
||||
/**
|
||||
* 班次Repository实现
|
||||
*/
|
||||
@Service
|
||||
public class ScheduleRepositoryImpl extends ServiceImpl<ScheduleMapper, Schedule> implements ScheduleRepository {
|
||||
}
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
<artifactId>common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>pers.amos</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -65,6 +70,12 @@
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- LiteFlow -->
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -25,24 +25,34 @@ public class Order implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
* 订单号(唯一)
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 线路ID
|
||||
* 线路编码(冗余字段,方便查询统计)
|
||||
*/
|
||||
private Long routeId;
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 班次ID
|
||||
* 订单类型:FIXED-固定班次订单,ROLLING-滚动发车订单
|
||||
*/
|
||||
private Long scheduleId;
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 固定班次编号(orderType=FIXED时使用)
|
||||
*/
|
||||
private String scheduleCode;
|
||||
|
||||
/**
|
||||
* 滚动班次编号(orderType=ROLLING时使用)
|
||||
*/
|
||||
private String rollingScheduleCode;
|
||||
|
||||
/**
|
||||
* 票种:ADULT-成人票,STUDENT-学生票,CHILD-儿童票
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付记录实体
|
||||
* 支付记录实体(订单1:N支付单,支持重复支付和多次支付记录)
|
||||
*/
|
||||
@Data
|
||||
@TableName("payment")
|
||||
@@ -25,12 +25,12 @@ public class Payment implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
* 订单号
|
||||
*/
|
||||
private Long orderId;
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 支付流水号
|
||||
* 支付流水号(唯一)
|
||||
*/
|
||||
private String paymentNo;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 退款记录实体
|
||||
* 退款记录实体(订单1:N退款单,支持部分退款)
|
||||
*/
|
||||
@Data
|
||||
@TableName("refund")
|
||||
@@ -25,15 +25,25 @@ public class Refund implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
* 订单号
|
||||
*/
|
||||
private Long orderId;
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
* 退款单号(唯一)
|
||||
*/
|
||||
private String refundNo;
|
||||
|
||||
/**
|
||||
* 退款车票号(部分退款时指定具体车票)
|
||||
*/
|
||||
private String ticketNo;
|
||||
|
||||
/**
|
||||
* 退款数量
|
||||
*/
|
||||
private Integer refundQuantity;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user