店铺营业时间可到次日
This commit is contained in:
parent
9f7aadd2c3
commit
085050cbdc
|
@ -83,7 +83,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<where>
|
<where>
|
||||||
<include refid="searchCondition"/>
|
<include refid="searchCondition"/>
|
||||||
</where>
|
</where>
|
||||||
order by ss.group_sort asc, ss.create_time asc
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSmStoreById" parameterType="Long" resultMap="SmStoreResult">
|
<select id="selectSmStoreById" parameterType="Long" resultMap="SmStoreResult">
|
||||||
|
|
|
@ -301,12 +301,31 @@ public class StoreValidatorImpl extends BaseValidator implements StoreValidator
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否营业时间
|
||||||
|
* @param store
|
||||||
|
* @param time
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isBusinessTime(StoreVo store, LocalTime time) {
|
public boolean isBusinessTime(StoreVo store, LocalTime time) {
|
||||||
if (store.getUseOutTime() == null || store.getUseOutTime()) {
|
if (store.getUseOutTime() == null || store.getUseOutTime()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return time.isAfter(store.getBusinessTimeStart()) && time.isBefore(store.getBusinessTimeEnd());
|
// 验证时间不为null
|
||||||
|
LocalTime start = store.getBusinessTimeStart();
|
||||||
|
LocalTime end = store.getBusinessTimeEnd();
|
||||||
|
if (start == null || end == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 正常时间
|
||||||
|
if (end.isAfter(start)) {
|
||||||
|
return time.isAfter(start) && time.isBefore(end);
|
||||||
|
}
|
||||||
|
// 隔天
|
||||||
|
else {
|
||||||
|
return time.isAfter(start) || time.isBefore(end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -320,9 +339,9 @@ public class StoreValidatorImpl extends BaseValidator implements StoreValidator
|
||||||
return error("不允许单独设置营业时间的起始或结束");
|
return error("不允许单独设置营业时间的起始或结束");
|
||||||
}
|
}
|
||||||
// 判断起始时间是否在结束时间前
|
// 判断起始时间是否在结束时间前
|
||||||
if (start.isAfter(end)) {
|
// if (start.isAfter(end)) {
|
||||||
return error("营业时间(起始)不允许晚于营业时间(结束)");
|
// return error("营业时间(起始)不允许晚于营业时间(结束)");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,10 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans
|
||||||
if (store != null) {
|
if (store != null) {
|
||||||
LocalTime now = LocalTime.now();
|
LocalTime now = LocalTime.now();
|
||||||
if (!storeValidator.isBusinessTime(store, now)) {
|
if (!storeValidator.isBusinessTime(store, now)) {
|
||||||
return error(String.format("请在营业时间内使用该设备!营业时间:%s - %s", store.getBusinessTimeStart(), store.getBusinessTimeEnd()));
|
return error(String.format("请在营业时间内使用该设备!%s - %s%s",
|
||||||
|
store.getBusinessTimeStart(),
|
||||||
|
store.getBusinessTimeEnd().isAfter(store.getBusinessTimeStart()) ? "" : "次日",
|
||||||
|
store.getBusinessTimeEnd()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.web.controller.app;
|
package com.ruoyi.web.controller.app;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonView;
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
@ -49,6 +50,7 @@ public class AppStoreController extends BaseController {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(@Validated(ValidGroup.Query.class) StoreQuery store) {
|
public TableDataInfo list(@Validated(ValidGroup.Query.class) StoreQuery store) {
|
||||||
startPage();
|
startPage();
|
||||||
|
PageHelper.orderBy("ss.group_sort asc, ss.create_time asc");
|
||||||
store.setUserId(getUserId());
|
store.setUserId(getUserId());
|
||||||
List<StoreVo> list = storeService.selectSmStoreList(store);
|
List<StoreVo> list = storeService.selectSmStoreList(store);
|
||||||
// 拼接设备数量
|
// 拼接设备数量
|
||||||
|
|
Loading…
Reference in New Issue
Block a user