排号增加天数查询限制

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