From 32c51c1f6207920a5de64a9152aaefa609dc0e79 Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Sat, 15 Jan 2022 16:51:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=8F=91=E7=A5=A8?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=A4=AA=E9=95=BF=E5=AF=BC=E8=87=B4redis?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=9B=9E=E6=BB=9A=E6=9C=AA=E8=AF=BB=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../invoice/service/impl/XhpcInvoiceServiceImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java index 2528d3e7..b27b1735 100644 --- a/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java +++ b/xhpc-modules/xhpc-invoice/src/main/java/com/xhpc/invoice/service/impl/XhpcInvoiceServiceImpl.java @@ -391,9 +391,15 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { if (xhpcInvoice.getIsRead().equals(IsReadStatusConst.READED)) { return specificInvoicedResponse; } - //一旦调了详情接口,就去掉该已开发票的未读状态,同时redis中的未读数量数据-1 + //一旦调了详情接口,就去掉该已开发票的未读状态,同时再次查询用户未读的数量,并将其设置到redis当中 xhpcInvoiceMapper.updateByInvoiceId(invoiceId); - reduceNoReadInvoiceCount(xhpcInvoice); + Long notReadCount = xhpcInvoiceMapper.findNotReadCount(xhpcInvoice.getCreatorId(), xhpcInvoice.getCreatorType()); + String redisKey = generateRedisKey(xhpcInvoice); + if (notReadCount == 0) { + redisService.deleteObject(redisKey); + } else { + redisService.setCacheObject(redisKey, notReadCount); + } return specificInvoicedResponse; }