From 10bc593d0f0e11265150414a28f932b77be21ca1 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Fri, 18 Oct 2024 13:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E9=98=9F=E5=8F=96=E5=8F=B7=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TbCallServiceImpl.java | 13 ++++++++++--- src/main/resources/mapper/TbCallQueueMapper.xml | 12 ++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbCallServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbCallServiceImpl.java index 8a9c422..fedb495 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbCallServiceImpl.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbCallServiceImpl.java @@ -4,6 +4,7 @@ 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.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper; import com.chaozhanggui.system.cashierservice.entity.TbCallQueue; import com.chaozhanggui.system.cashierservice.entity.TbCallTable; @@ -54,15 +55,15 @@ public class TbCallServiceImpl implements TbCallService { if (setFlag) { return callTable.getPrefix() + callTable.getStart(); - }else if (StrUtil.isNotBlank(newVal.get())){ + } else if (StrUtil.isNotBlank(newVal.get())) { value = String.valueOf((Integer.parseInt(newVal.get()) + 1)); redisTemplate.opsForValue().set(callNumKey, value); return callTable.getPrefix() + value; - }else { + } else { throw new MsgException("生成排队号码失败"); } - }else { + } else { value = String.valueOf((Integer.parseInt(value) + 1)); redisTemplate.opsForValue().set(callNumKey, value); return callTable.getPrefix() + value; @@ -148,6 +149,12 @@ public class TbCallServiceImpl implements TbCallService { if (callQueueInfoVOS.isEmpty()) { callQueueInfoVOS = callQueueMapper.selectInfoByOpenId(shopId, openId, DateUtil.date().toString("yyyy-MM-dd"), null); } + if (!callQueueInfoVOS.isEmpty()) { + CallQueueInfoVO callQueueInfoVO = callQueueInfoVOS.get(0); + callQueueMapper.update(null, new LambdaUpdateWrapper() + .eq(TbCallQueue::getId, callQueueInfoVO.getId()) + .set(TbCallQueue::getOpenId, openId)); + } TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(shopId); HashMap data = new HashMap<>(); data.put("shopInfo", shopInfo); diff --git a/src/main/resources/mapper/TbCallQueueMapper.xml b/src/main/resources/mapper/TbCallQueueMapper.xml index 12c6a3c..bd8c208 100644 --- a/src/main/resources/mapper/TbCallQueueMapper.xml +++ b/src/main/resources/mapper/TbCallQueueMapper.xml @@ -71,12 +71,16 @@ WHERE a.shop_id = #{shopId} AND a.create_day = #{today} -- 替换为目标日期 - - and (a.open_id = #{openId} or a.open_id is null) -- 替换为目标用户的 open_id - + - and a.id = #{queueId} -- 替换为目标用户的 open_id + and a.id = #{queueId} and (a.open_id = #{openId} or a.open_id is null) + + + and a.open_id = #{openId} -- 替换为目标用户的 open_id + + + and a.state != 3 GROUP BY a.id, a.user_id, b.name, b.note, b.wait_time ORDER BY