叫号配置接口

This commit is contained in:
2024-09-19 10:16:50 +08:00
parent 66dc7c8581
commit 079bf18d4c
11 changed files with 210 additions and 0 deletions

View File

@@ -22,4 +22,8 @@ public interface TbCallService {
Object getQueue(Integer shopId, Integer callTableId, Integer state, Integer page, Integer size);
Object getCallRecord(Integer shopId, Integer callTableId, Integer page, Integer size);
Object getConfig(Integer shopId);
Object updateConfig(UpdateConfigDTO configDTO);
}

View File

@@ -8,10 +8,12 @@ import cn.hutool.extra.qrcode.QrConfig;
import cn.ysk.cashier.cons.RedisConstant;
import cn.ysk.cashier.dto.calltable.*;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.mybatis.entity.TbCallConfig;
import cn.ysk.cashier.mybatis.entity.TbCallQueue;
import cn.ysk.cashier.mybatis.entity.TbCallTable;
import cn.ysk.cashier.mybatis.mapper.TbCallQueueMapper;
import cn.ysk.cashier.mybatis.mapper.TbShopUserMapper;
import cn.ysk.cashier.mybatis.service.TbCallConfigService;
import cn.ysk.cashier.mybatis.service.TbCallQueueService;
import cn.ysk.cashier.mybatis.service.TbCallTableService;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
@@ -43,6 +45,7 @@ public class TbCallServiceImpl implements TbCallService {
private final StringRedisTemplate redisTemplate;
private final TbCallQueueMapper tbCallQueueMapper;
private final WxMiniUtils wxMiniUtils;
private final TbCallConfigService tbCallConfigService;
@Override
public Object add(CallTableDTO addCallTableDTO) {
@@ -418,4 +421,30 @@ public class TbCallServiceImpl implements TbCallService {
public Object getCallRecord(Integer shopId, Integer callTableId, Integer page, Integer size) {
return tbCallQueueMapper.selectCallRecord(shopId, callTableId, new Page<>(page, size));
}
@Override
public Object getConfig(Integer shopId) {
TbCallConfig config = tbCallConfigService.lambdaQuery().eq(TbCallConfig::getShopId, shopId).one();
if (config == null) {
config = new TbCallConfig();
config.setShopId(shopId);
config.setCreateTime(DateUtil.date().toInstant());
tbCallConfigService.save(config);
config = tbCallConfigService.lambdaQuery().eq(TbCallConfig::getShopId, shopId).one();
}
return config;
}
@Override
public Object updateConfig(UpdateConfigDTO configDTO) {
TbCallConfig config = tbCallConfigService.lambdaQuery().eq(TbCallConfig::getShopId, configDTO.getShopId()).one();
if (config == null) {
throw new BadRequestException("未查询到配置信息");
}
TbCallConfig tbCallConfig = BeanUtil.copyProperties(configDTO, TbCallConfig.class);
tbCallConfig.setId(config.getId());
tbCallConfig.setUpdateTime(DateUtil.date().toInstant());
return tbCallConfigService.updateById(tbCallConfig);
}
}