排号增加天数查询限制

This commit is contained in:
SongZhang 2024-09-14 16:27:54 +08:00
parent 48f82895e7
commit d3d401d2f3
2 changed files with 11 additions and 0 deletions

View File

@ -73,4 +73,7 @@ public class TbCallQueue {
@Column(name = "call_num")
private String callNum;
@Column(name = "create_day")
private String createDay;
}

View File

@ -145,6 +145,7 @@ public class TbCallServiceImpl implements TbCallService {
.eq(TbCallQueue::getUserId, shopUser.getId())
.eq(TbCallQueue::getShopId, takeNumberDTO.getShopId())
.in(TbCallQueue::getState, 0, 1)
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.eq(TbCallQueue::getCallTableId, takeNumberDTO.getCallTableId()).one();
if (callQueue != null) {
throw new BadRequestException("当前用户已取号");
@ -163,6 +164,7 @@ public class TbCallServiceImpl implements TbCallService {
callQueue = callQueueService.lambdaQuery()
.eq(TbCallQueue::getPhone, takeNumberDTO.getPhone())
.eq(TbCallQueue::getShopId, takeNumberDTO.getShopId())
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.eq(TbCallQueue::getCallTableId, takeNumberDTO.getCallTableId()).one();
if (callQueue != null) {
throw new BadRequestException("当前用户已取号");
@ -174,6 +176,7 @@ public class TbCallServiceImpl implements TbCallService {
callQueue.setSubState(1);
}
callQueue.setCreateDay(DateUtil.today());
callQueue.setCallNum(getCallNumber(takeNumberDTO.getShopId(), callTable));
callQueue.setCreateTime(DateUtil.date().toInstant());
callQueue.setShopId(shopInfo.getId());
@ -186,6 +189,7 @@ public class TbCallServiceImpl implements TbCallService {
public Object call(CallQueueDTO callQueueDTO) {
TbCallQueue callQueue = callQueueService.lambdaQuery()
.notIn(TbCallQueue::getState, -1, 2)
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.eq(TbCallQueue::getShopId, callQueueDTO.getShopId())
.one();
@ -210,6 +214,7 @@ public class TbCallServiceImpl implements TbCallService {
List<TbCallQueue> current = callQueueService.lambdaQuery()
.eq(TbCallQueue::getCallTableId, callQueue.getCallTableId())
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.and(r -> {
r.eq(TbCallQueue::getState, 1)
.or()
@ -251,6 +256,7 @@ public class TbCallServiceImpl implements TbCallService {
public Object updateInfo(UpdateCallQueueDTO updateCallQueueDTO) {
TbCallQueue callQueue = callQueueService.lambdaQuery()
.eq(TbCallQueue::getShopId, updateCallQueueDTO.getShopId())
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.eq(TbCallQueue::getId, updateCallQueueDTO.getCallQueueId()).one();
if (callQueue == null) {
throw new BadRequestException("叫号用户不存在");
@ -303,6 +309,7 @@ public class TbCallServiceImpl implements TbCallService {
pageInfo.getRecords().forEach(item -> {
Long count = callQueueService.lambdaQuery()
.eq(TbCallQueue::getCallTableId, item.getId())
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.in(TbCallQueue::getState, 0, 1)
.count();
@ -353,6 +360,7 @@ public class TbCallServiceImpl implements TbCallService {
LambdaQueryChainWrapper<TbCallQueue> query = callQueueService.lambdaQuery()
.eq(TbCallQueue::getShopId, shopId)
.eq(TbCallQueue::getCreateDay, DateUtil.today())
.in(TbCallQueue::getCallTableId, tableIds);
if (state != null) {
query.eq(TbCallQueue::getState, state);