1.排队取号 取号打印小票,增加订阅接口
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CallSubMsgDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CancelCallQueueDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.TakeNumberDTO;
|
||||
|
||||
public interface TbCallService {
|
||||
Object takeNumber(TakeNumberDTO takeNumberDTO);
|
||||
|
||||
Object getList(Integer shopId, String openId);
|
||||
Object getList(Integer shopId, String openId, Integer queueId);
|
||||
|
||||
Object getAllInfo(Integer shopId);
|
||||
|
||||
Object cancel(CancelCallQueueDTO cancelCallQueueDTO);
|
||||
|
||||
Object getState(String openId, Integer shopId);
|
||||
Object getState(String openId, Integer shopId, Integer queueId);
|
||||
|
||||
Object subMsg(CallSubMsgDTO subMsgDTO);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.CallSubMsgDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CancelCallQueueDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.TakeNumberDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CallQueueInfoVO;
|
||||
@@ -16,6 +18,7 @@ import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbCallQueueService;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbCallService;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbCallTableService;
|
||||
import com.chaozhanggui.system.cashierservice.util.MQUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.Utils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
@@ -35,6 +38,7 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
private final TbShopInfoMapper shopInfoMapper;
|
||||
private final TbCallQueueMapper callQueueMapper;
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
private final MQUtils mQUtils;
|
||||
|
||||
private String getCallNumber(Integer shopId, TbCallTable callTable) {
|
||||
return Utils.runFunAndCheckKey(() -> {
|
||||
@@ -96,12 +100,17 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
callQueue.setShopName(shopInfo.getShopName());
|
||||
callQueue.setCallNum(getCallNumber(takeNumberDTO.getShopId(), callTable));
|
||||
callQueue.setCreateDay(DateUtil.today());
|
||||
return callQueueService.save(callQueue);
|
||||
boolean save = callQueueService.save(callQueue);
|
||||
// 打印排号票信息
|
||||
if (save) {
|
||||
mQUtils.printCallNumTicket(callQueue.getId(), callQueue.getShopId());
|
||||
}
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getList(Integer shopId, String openId) {
|
||||
return callQueueMapper.selectInfoByOpenId(shopId, openId, DateUtil.today());
|
||||
public Object getList(Integer shopId, String openId, Integer queueId) {
|
||||
return callQueueMapper.selectInfoByOpenId(shopId, openId, DateUtil.today(), queueId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,12 +129,26 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
|
||||
|
||||
@Override
|
||||
public Object getState(String openId, Integer shopId) {
|
||||
List<CallQueueInfoVO> callQueueInfoVOS = callQueueMapper.selectInfoByOpenId(shopId, openId, DateUtil.today());
|
||||
public Object getState(String openId, Integer shopId, Integer queueId) {
|
||||
List<CallQueueInfoVO> callQueueInfoVOS = callQueueMapper.selectInfoByOpenId(shopId, openId, DateUtil.today(), queueId);
|
||||
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(shopId);
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("shopInfo", shopInfo);
|
||||
data.put("queueInfo", callQueueInfoVOS.isEmpty() ? null : callQueueInfoVOS.get(0));
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object subMsg(CallSubMsgDTO subMsgDTO) {
|
||||
TbCallQueue queue = callQueueMapper.selectOne(new LambdaQueryWrapper<TbCallQueue>()
|
||||
.eq(TbCallQueue::getShopId, subMsgDTO.getShopId())
|
||||
.eq(TbCallQueue::getId, subMsgDTO.getQueueId()));
|
||||
if (queue == null) {
|
||||
throw new MsgException("您未排号请先排号");
|
||||
}
|
||||
|
||||
queue.setSubState(1);
|
||||
queue.setOpenId(subMsgDTO.getOpenId());
|
||||
return callQueueMapper.updateById(queue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user