砍价字段修改
This commit is contained in:
parent
507b65838c
commit
d2289f2d12
@ -132,7 +132,7 @@ public class ShopStoreActivityBase implements Serializable {
|
|||||||
@ApiModelProperty(value = "在活动时间范围内,用户砍价允许的天数")
|
@ApiModelProperty(value = "在活动时间范围内,用户砍价允许的天数")
|
||||||
private Integer cut_days;
|
private Integer cut_days;
|
||||||
|
|
||||||
@ApiModelProperty(value = "活动商品的总数量")
|
@ApiModelProperty(value = "参与活动商品的总数量")
|
||||||
private Integer product_cont;
|
private Integer product_count;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -852,84 +852,6 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
|||||||
return this.count(queryWrapper);
|
return this.count(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查订单预约参数是否合法
|
|
||||||
*
|
|
||||||
* @param storeId 店铺ID
|
|
||||||
* @param bookingState 预约配送状态
|
|
||||||
* @param bookingBeginTimeStr 预约开始时间
|
|
||||||
* @param bookingEndTimeStr 预约截止时间
|
|
||||||
* @return 验证结果Pair,第一个元素表示是否通过验证,第二个元素为提示信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Pair<Boolean, String> checkBookingOrderArgs(Integer storeId, Integer bookingState, String bookingBeginTimeStr, String bookingEndTimeStr) {
|
|
||||||
// 1. 必填参数检查
|
|
||||||
if (CheckUtil.isEmpty(storeId) || CheckUtil.isEmpty(bookingState)) {
|
|
||||||
return Pair.of(false, "[预约单校验] 缺少必要参数");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 预约状态检查
|
|
||||||
if (!CommonConstant.Order_Booking_State_YY.equals(bookingState)) {
|
|
||||||
return Pair.of(true, "[预约单校验] 非预订单,跳过验证");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 时间格式检查
|
|
||||||
if (StrUtil.isBlank(bookingBeginTimeStr)) {
|
|
||||||
return Pair.of(false, "[预约单校验] 预约时间不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
Date bookingBeginTime = DateTimeUtils.tryParseDateTimeToDate(bookingBeginTimeStr);
|
|
||||||
Date bookingEndTime = DateTimeUtils.tryParseDateTimeToDate(bookingEndTimeStr);
|
|
||||||
if (bookingBeginTime == null) {
|
|
||||||
return Pair.of(false, "[预约单校验] 预约时间格式有误");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. 时间逻辑检查 - 开始时间不能晚于结束时间
|
|
||||||
if (bookingEndTime != null && bookingBeginTime.after(bookingEndTime)) {
|
|
||||||
return Pair.of(false, "[预约单校验] 开始时间不能晚于截止时间");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 5. 店铺信息检查
|
|
||||||
ShopStoreInfo shopStoreInfo = shopStoreInfoService.getShopStoreInfoByStoreId(storeId);
|
|
||||||
if (shopStoreInfo == null) {
|
|
||||||
return Pair.of(false, "[预约单校验] 店铺信息有误");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isBlank(shopStoreInfo.getStore_opening_hours()) || StrUtil.isBlank(shopStoreInfo.getStore_close_hours())) {
|
|
||||||
shopStoreInfo.setStore_opening_hours("09:00");
|
|
||||||
shopStoreInfo.setStore_close_hours("06:00");
|
|
||||||
logger.warn("[预约单校验] 店铺营业时间未设置,请联系商家,默认指定 {}-{}", shopStoreInfo.getStore_opening_hours(), shopStoreInfo.getStore_close_hours());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 6. 店铺营业时间检查
|
|
||||||
if (DateTimeUtils.isTimeInRange(shopStoreInfo.getStore_opening_hours(), shopStoreInfo.getStore_close_hours(), bookingBeginTime) != 0) {
|
|
||||||
String message = StrUtil.format("[预约单校验] 请在 {}-{} 店铺营业时间内预约下单", shopStoreInfo.getStore_opening_hours(), shopStoreInfo.getStore_close_hours());
|
|
||||||
return Pair.of(false, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 7. 预约时间范围检查 - 仅能预约50分钟后的订单(防止用户在下单页面停留太长,45分钟也是可以通过的)
|
|
||||||
Date fortyFiveMinutesLater = DateUtil.offsetMinute(new Date(), CommonConstant.MIN_DELAY_MINUTES_FOR_BOOKING_ORDER - 5);
|
|
||||||
if (bookingBeginTime.before(fortyFiveMinutesLater)) {
|
|
||||||
return Pair.of(false, String.format("[预约单校验] 请预约%d分后的订单", CommonConstant.MIN_DELAY_MINUTES_FOR_BOOKING_ORDER));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Pair.of(true, "[预约单校验] 成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断订单是否为预约订单
|
|
||||||
*
|
|
||||||
* @param orderInfo 订单信息
|
|
||||||
* @return 是否为预约订单
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean isBookingOrder(ShopOrderInfo orderInfo) {
|
|
||||||
return orderInfo != null
|
|
||||||
&& CommonConstant.Order_Booking_State_YY.equals(orderInfo.getBooking_state())
|
|
||||||
&& !CheckUtil.isEmpty(orderInfo.getBooking_at())
|
|
||||||
&& orderInfo.getBooking_at().longValue() >= System.currentTimeMillis() / 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行预约订单到点后向顺丰同城订单任务
|
* 执行预约订单到点后向顺丰同城订单任务
|
||||||
*
|
*
|
||||||
@ -1008,6 +930,86 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查订单预约参数是否合法
|
||||||
|
*
|
||||||
|
* @param storeId 店铺ID
|
||||||
|
* @param bookingState 预约配送状态
|
||||||
|
* @param bookingBeginTimeStr 预约开始时间
|
||||||
|
* @param bookingEndTimeStr 预约截止时间
|
||||||
|
* @return 验证结果Pair,第一个元素表示是否通过验证,第二个元素为提示信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Pair<Boolean, String> checkBookingOrderArgs(Integer storeId, Integer bookingState, String bookingBeginTimeStr, String bookingEndTimeStr) {
|
||||||
|
// 1. 必填参数检查
|
||||||
|
if (CheckUtil.isEmpty(storeId) || CheckUtil.isEmpty(bookingState)) {
|
||||||
|
return Pair.of(false, "[预约单校验] 缺少必要参数");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 预约状态检查
|
||||||
|
if (!CommonConstant.Order_Booking_State_YY.equals(bookingState)) {
|
||||||
|
return Pair.of(true, "[预约单校验] 非预订单,跳过验证");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 时间格式检查
|
||||||
|
if (StrUtil.isBlank(bookingBeginTimeStr)) {
|
||||||
|
return Pair.of(false, "[预约单校验] 预约时间不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
Date bookingBeginTime = DateTimeUtils.tryParseDateTimeToDate(bookingBeginTimeStr);
|
||||||
|
Date bookingEndTime = DateTimeUtils.tryParseDateTimeToDate(bookingEndTimeStr);
|
||||||
|
if (bookingBeginTime == null) {
|
||||||
|
return Pair.of(false, "[预约单校验] 预约时间格式有误");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 时间逻辑检查 - 开始时间不能晚于结束时间
|
||||||
|
if (bookingEndTime != null && bookingBeginTime.after(bookingEndTime)) {
|
||||||
|
return Pair.of(false, "[预约单校验] 开始时间不能晚于截止时间");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 店铺信息检查
|
||||||
|
ShopStoreInfo shopStoreInfo = shopStoreInfoService.getShopStoreInfoByStoreId(storeId);
|
||||||
|
if (shopStoreInfo == null) {
|
||||||
|
return Pair.of(false, "[预约单校验] 店铺信息有误");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isBlank(shopStoreInfo.getStore_opening_hours()) || StrUtil.isBlank(shopStoreInfo.getStore_close_hours())) {
|
||||||
|
shopStoreInfo.setStore_opening_hours("00:00");
|
||||||
|
shopStoreInfo.setStore_close_hours("23:59");
|
||||||
|
logger.warn("[预约单校验] 店铺营业时间未设置,请联系商家,默认指定 {}-{}", shopStoreInfo.getStore_opening_hours(), shopStoreInfo.getStore_close_hours());
|
||||||
|
return Pair.of(false, "[预约单校验] 店铺营业时间未设置,请联系商家");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 店铺营业时间检查
|
||||||
|
if (DateTimeUtils.isTimeInRange(shopStoreInfo.getStore_opening_hours(), shopStoreInfo.getStore_close_hours(), bookingBeginTime) != 0) {
|
||||||
|
String message = StrUtil.format("[预约单校验] 请在 {}-{} 营业时间内预约下单", shopStoreInfo.getStore_opening_hours(), shopStoreInfo.getStore_close_hours());
|
||||||
|
return Pair.of(false, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7. 预约时间范围检查 - 仅能预约50分钟后的订单(防止用户在下单页面停留太长,45分钟也是可以通过的)
|
||||||
|
Date fortyFiveMinutesLater = DateUtil.offsetMinute(new Date(), CommonConstant.MIN_DELAY_MINUTES_FOR_BOOKING_ORDER - 5);
|
||||||
|
if (bookingBeginTime.before(fortyFiveMinutesLater)) {
|
||||||
|
return Pair.of(false, String.format("[预约单校验] 请预约%d分钟后下单", CommonConstant.MIN_DELAY_MINUTES_FOR_BOOKING_ORDER));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Pair.of(true, "[预约单校验] 成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断订单是否为预约订单
|
||||||
|
*
|
||||||
|
* @param orderInfo 订单信息
|
||||||
|
* @return 是否为预约订单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean isBookingOrder(ShopOrderInfo orderInfo) {
|
||||||
|
return orderInfo != null
|
||||||
|
&& CommonConstant.Order_Booking_State_YY.equals(orderInfo.getBooking_state())
|
||||||
|
&& !CheckUtil.isEmpty(orderInfo.getBooking_at())
|
||||||
|
&& orderInfo.getBooking_at().longValue() >= System.currentTimeMillis() / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据店铺的营业时间范围生成可预约下单的参数
|
* 根据店铺的营业时间范围生成可预约下单的参数
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2370,9 +2370,15 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
base.setSubsite_id(subsite_id);
|
base.setSubsite_id(subsite_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 店铺营业状态:1-营业中;2-已打烊;3-开业(活动)筹备中;
|
||||||
Integer storeBizState = Convert.toInt(getParameter("store_biz_state"));
|
Integer storeBizState = Convert.toInt(getParameter("store_biz_state"));
|
||||||
if (storeBizState != null && storeBizState <= 2 && storeBizState >= 1) {
|
if (storeBizState != null && storeBizState <= 3 && storeBizState >= 1) {
|
||||||
base.setStore_biz_state(storeBizState);
|
base.setStore_biz_state(storeBizState);
|
||||||
|
|
||||||
|
Date storeBizOpeningDate = Convert.toDate(getParameter("store_biz_opening_date"));
|
||||||
|
if (storeBizState == 3 && storeBizOpeningDate == null) {
|
||||||
|
return CommonResult.failed("店铺如果开业(活动)筹备中,请输入开业日期:yyyy-MM-dd");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打包费
|
// 打包费
|
||||||
@ -2535,9 +2541,15 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 店铺营业状态:1-营业中;2-已打烊;3-开业(活动)筹备中;
|
||||||
Integer storeBizState = Convert.toInt(getParameter("store_biz_state"));
|
Integer storeBizState = Convert.toInt(getParameter("store_biz_state"));
|
||||||
if (storeBizState != null && storeBizState <= 2 && storeBizState >= 1) {
|
if (storeBizState != null && storeBizState <= 3 && storeBizState >= 1) {
|
||||||
base.setStore_biz_state(storeBizState);
|
base.setStore_biz_state(storeBizState);
|
||||||
|
|
||||||
|
Date storeBizOpeningDate = Convert.toDate(getParameter("store_biz_opening_date"));
|
||||||
|
if (storeBizState == 3 && storeBizOpeningDate == null) {
|
||||||
|
return CommonResult.failed("店铺如果开业(活动)筹备中,请输入开业日期:yyyy-MM-dd");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShopStoreCompany company = null;
|
ShopStoreCompany company = null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user