feat:部分日期相关字段替换类型

This commit is contained in:
amos
2026-03-04 16:36:24 +08:00
parent 4e8d409284
commit aeb64dfec2
5 changed files with 19 additions and 38 deletions

View File

@@ -49,7 +49,7 @@ public class FixedScheduleDO implements Serializable {
private String departureTime;
/**
* 到达时间
* 预计到达时间
*/
private String arrivalTime;

View File

@@ -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;
/**
* 创建时间
*/

View File

@@ -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;
/**
* 更新时间
*/

View File

@@ -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;

View File

@@ -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;