feat:部分日期相关字段替换类型
This commit is contained in:
@@ -49,7 +49,7 @@ public class FixedScheduleDO implements Serializable {
|
||||
private String departureTime;
|
||||
|
||||
/**
|
||||
* 到达时间
|
||||
* 预计到达时间
|
||||
*/
|
||||
private String arrivalTime;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ 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;
|
||||
@@ -54,12 +53,6 @@ public class InventoryDO implements Serializable {
|
||||
*/
|
||||
private Integer remainingStock;
|
||||
|
||||
/**
|
||||
* 乐观锁版本号
|
||||
*/
|
||||
@Version
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 线路实体
|
||||
@@ -22,77 +20,77 @@ public class RouteDO implements Serializable {
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 线路编码(唯一)
|
||||
*/
|
||||
private String routeCode;
|
||||
|
||||
|
||||
/**
|
||||
* 线路名称
|
||||
*/
|
||||
private String routeName;
|
||||
|
||||
|
||||
/**
|
||||
* 起点站
|
||||
*/
|
||||
private String startStation;
|
||||
|
||||
|
||||
/**
|
||||
* 终点站
|
||||
*/
|
||||
private String endStation;
|
||||
|
||||
|
||||
/**
|
||||
* 里程(公里)
|
||||
*/
|
||||
private Double distance;
|
||||
|
||||
|
||||
/**
|
||||
* 预计时长(分钟)
|
||||
*/
|
||||
private Integer estimatedDuration;
|
||||
|
||||
|
||||
/**
|
||||
* 基础票价(成人票)
|
||||
*/
|
||||
private String basePrice;
|
||||
|
||||
|
||||
/**
|
||||
* 运营模式:FIXED-固定班次,ROLLING-滚动发车
|
||||
*/
|
||||
private String operationMode;
|
||||
|
||||
|
||||
/**
|
||||
* 滚动发车运营开始时间(仅ROLLING模式有效)
|
||||
*/
|
||||
private String operationStart;
|
||||
private LocalDateTime operationStart;
|
||||
|
||||
/**
|
||||
* 滚动发车运营结束时间(仅ROLLING模式有效)
|
||||
*/
|
||||
private String operationEnd;
|
||||
|
||||
private LocalDateTime operationEnd;
|
||||
|
||||
/**
|
||||
* 滚动发车间隔(分钟,仅ROLLING模式有效)
|
||||
*/
|
||||
private Integer departureInterval;
|
||||
|
||||
|
||||
/**
|
||||
* 滚动发车每日总座位数(仅ROLLING模式有效)
|
||||
*/
|
||||
private Integer dailyCapacity;
|
||||
|
||||
|
||||
/**
|
||||
* 状态:1-运营中,0-停运
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
|
||||
@@ -25,13 +25,6 @@ public class InventoryRepositoryImpl extends ServiceImpl<InventoryMapper, Invent
|
||||
|
||||
@Override
|
||||
public boolean updateWithVersion(InventoryDO inventoryDO) {
|
||||
// MyBatis-Plus 的 @Version 注解会自动处理乐观锁
|
||||
// 更新时会自动:
|
||||
// 1. WHERE 条件加上 version = 当前版本
|
||||
// 2. SET version = version + 1
|
||||
// 3. 如果 affected rows = 0,说明版本冲突或库存不足
|
||||
|
||||
// 额外检查:确保剩余库存不为负数
|
||||
if (inventoryDO.getRemainingStock() < 0) {
|
||||
LogUtil.warn("库存更新失败(剩余库存为负), inventoryCode={}, remainingStock={}",
|
||||
inventoryDO.getInventoryCode(), inventoryDO.getRemainingStock());
|
||||
@@ -41,8 +34,8 @@ public class InventoryRepositoryImpl extends ServiceImpl<InventoryMapper, Invent
|
||||
boolean success = this.updateById(inventoryDO);
|
||||
|
||||
if (!success) {
|
||||
LogUtil.warn("库存更新失败(乐观锁冲突), inventoryCode={}, version={}",
|
||||
inventoryDO.getInventoryCode(), inventoryDO.getVersion());
|
||||
LogUtil.warn("库存更新失败(乐观锁冲突), inventoryCode={}",
|
||||
inventoryDO.getInventoryCode());
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package pers.amos.mall.route.domain;
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user