1.排队取号 取消排号接口
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.BaseCallTableDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CancelCallQueueDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.TakeNumberDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbCallService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
@@ -46,4 +48,11 @@ public class TbCallTableController {
|
||||
return Result.successWithData(tbCallService.getAllInfo(shopId));
|
||||
}
|
||||
|
||||
@PutMapping("/cancel")
|
||||
public Result cancel(
|
||||
@Validated @RequestParam CancelCallQueueDTO cancelCallQueueDTO
|
||||
) {
|
||||
return Result.successWithData(tbCallService.cancel(cancelCallQueueDTO));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class CancelCallQueueDTO {
|
||||
@NotNull
|
||||
private Integer queueId;
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CancelCallQueueDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.TakeNumberDTO;
|
||||
|
||||
public interface TbCallService {
|
||||
@@ -8,4 +9,6 @@ public interface TbCallService {
|
||||
Object getList(Integer shopId, String openId);
|
||||
|
||||
Object getAllInfo(Integer shopId);
|
||||
|
||||
Object cancel(CancelCallQueueDTO cancelCallQueueDTO);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCallQueue;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCallTable;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CancelCallQueueDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.TakeNumberDTO;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.TbCallQueueMapper;
|
||||
@@ -77,6 +78,7 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
TbCallQueue callQueue = callQueueService.lambdaQuery()
|
||||
.eq(TbCallQueue::getPhone, takeNumberDTO.getPhone())
|
||||
.eq(TbCallQueue::getShopId, takeNumberDTO.getShopId())
|
||||
.in(TbCallQueue::getState, 0, 1)
|
||||
.eq(TbCallQueue::getCallTableId, takeNumberDTO.getCallTableId()).one();
|
||||
if (callQueue != null) {
|
||||
throw new MsgException("您已取号,请勿重复取号");
|
||||
@@ -100,4 +102,13 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
public Object getAllInfo(Integer shopId) {
|
||||
return callTableService.lambdaQuery().eq(TbCallTable::getShopId, shopId).eq(TbCallTable::getState, 1).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object cancel(CancelCallQueueDTO cancelCallQueueDTO) {
|
||||
return callQueueService.lambdaUpdate()
|
||||
.eq(TbCallQueue::getShopId, cancelCallQueueDTO.getShopId())
|
||||
.eq(TbCallQueue::getId, cancelCallQueueDTO.getQueueId())
|
||||
.set(TbCallQueue::getCallTime, DateUtil.date())
|
||||
.set(TbCallQueue::getState, -1).update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user