排队叫号添加微信模板消息提醒
This commit is contained in:
@@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import cn.ysk.cashier.cons.RedisConstant;
|
||||
import cn.ysk.cashier.dto.CallNumPrintDTO;
|
||||
import cn.ysk.cashier.dto.calltable.*;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.entity.TbCallConfig;
|
||||
@@ -27,7 +26,6 @@ import cn.ysk.cashier.utils.WxMiniUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -254,14 +252,31 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
.orderByAsc(TbCallQueue::getCreateTime)
|
||||
.page(new Page<>(1, 1)).getRecords();
|
||||
|
||||
if (current.isEmpty()) {
|
||||
throw new BadRequestException("当前用户未排号");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(callQueue.getOpenId())) {
|
||||
throw new BadRequestException("此用户未订阅微信小程序消息");
|
||||
}
|
||||
|
||||
wxMiniUtils.sendNearCallMsg(shopInfo.getShopName(), getStrByState(Integer.valueOf(callQueue.getState())),
|
||||
callQueue.getCallNum(), current.isEmpty() ? "" : current.get(0).getCallNum(), "排号信息", callQueue.getOpenId());
|
||||
wxMiniUtils.sendCurrentOrNearCallMsg(shopInfo.getShopName(), getStrByState(Integer.valueOf(callQueue.getState())),
|
||||
callQueue.getCallNum(), current.isEmpty() ? "" : current.get(0).getCallNum(), "排号信息", callQueue.getOpenId(), false);
|
||||
boolean flag = callQueueService.updateById(callQueue);
|
||||
|
||||
return callQueueService.updateById(callQueue);
|
||||
TbCallConfig config = getConfig(callQueueDTO.getShopId());
|
||||
// 临近用户提醒
|
||||
List<TbCallQueue> nearList = callQueueService.lambdaQuery()
|
||||
.eq(TbCallQueue::getCallTableId, callQueue.getCallTableId())
|
||||
.eq(TbCallQueue::getCreateDay, DateUtil.today())
|
||||
.gt(TbCallQueue::getId, current.get(0).getId())
|
||||
.page(new Page<>(config.getNearNum(), 1)).getRecords();
|
||||
if (!nearList.isEmpty()) {
|
||||
TbCallQueue nearQueue = nearList.get(0);
|
||||
wxMiniUtils.sendCurrentOrNearCallMsg(shopInfo.getShopName(), getStrByState(Integer.valueOf(nearQueue.getState())),
|
||||
nearQueue.getCallNum(), current.isEmpty() ? "" : current.get(0).getCallNum(), "排号信息", nearQueue.getOpenId(), true);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private String getStrByState(Integer state) {
|
||||
@@ -445,7 +460,7 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getConfig(Integer shopId) {
|
||||
public TbCallConfig getConfig(Integer shopId) {
|
||||
TbCallConfig config = tbCallConfigService.lambdaQuery().eq(TbCallConfig::getShopId, shopId).one();
|
||||
if (config == null) {
|
||||
config = new TbCallConfig();
|
||||
|
||||
Reference in New Issue
Block a user