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; }