From a0e9e224acc77f9740d64a1f86b7a8f00f26b8d4 Mon Sep 17 00:00:00 2001 From: dzq Date: Sat, 2 Aug 2025 16:11:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(QywxMessageJob):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=80=BE=E6=9C=9F=E5=95=86=E5=93=81=E6=8F=90=E9=86=92=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E4=B8=AD=E6=9C=AA=E5=A4=84=E7=90=86=E8=B4=AD=E4=B9=B0?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在发送逾期商品提醒时,增加对购买订单的检查。如果订单模式为购买且货柜模式也为购买,则跳过发送提醒。同时添加了对货柜和货柜单元格的校验,避免因数据不存在导致的错误。 --- .../customize/service/job/QywxMessageJob.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/agileboot-admin/src/main/java/com/agileboot/admin/customize/service/job/QywxMessageJob.java b/agileboot-admin/src/main/java/com/agileboot/admin/customize/service/job/QywxMessageJob.java index a552364..230dc3e 100644 --- a/agileboot-admin/src/main/java/com/agileboot/admin/customize/service/job/QywxMessageJob.java +++ b/agileboot-admin/src/main/java/com/agileboot/admin/customize/service/job/QywxMessageJob.java @@ -2,6 +2,10 @@ package com.agileboot.admin.customize.service.job; import cn.hutool.core.date.DateUtil; import com.agileboot.domain.ab98.user.db.Ab98UserService; +import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity; +import com.agileboot.domain.cabinet.cell.db.CabinetCellService; +import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetEntity; +import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetService; import com.agileboot.domain.qywx.accessToken.AccessTokenApplicationService; import com.agileboot.domain.qywx.accessToken.db.QyAccessTokenEntity; import com.agileboot.domain.qywx.api.QywxApiUtil; @@ -51,6 +55,8 @@ public class QywxMessageJob { private final ShopOrderService orderService; private final Ab98UserService ab98UserService; private final QyUserService qyUserService; + private final CabinetCellService cabinetCellService; + private final SmartCabinetService smartCabinetService; // private static final String appid = "QYTONG_YS_WXSHOP"; /** @@ -61,7 +67,7 @@ public class QywxMessageJob { /** * 每天向逾期未归还商品的用户发送提醒消息 - * 执行时间:每天凌晨2点 + * 执行时间:每天10点 */ @Scheduled(cron = "0 0 10 * * *") public void sendOverdueGoodsReminderTask() { @@ -114,6 +120,25 @@ public class QywxMessageJob { // 6. 遍历逾期记录发送消息 for (ShopOrderGoodsEntity record : overdueRecords) { + if (record.getCellId() != null) { + CabinetCellEntity cell = cabinetCellService.getById(record.getCellId()); + if (cell == null) { + log.error("cell[{}]不存在", record.getCellId()); + continue; + } + + SmartCabinetEntity cabinet = smartCabinetService.getById(cell.getCabinetId()); + if (cabinet == null) { + log.error("cabinet[{}]不存在", cell.getCabinetId()); + continue; + } + + if (record.getMode().equals(0) && cabinet.getMode().equals(0) + && cabinet.getReturnDeadline() != null && cabinet.getReturnDeadline() > 0) { + log.info("订单[{}]为购买订单,无需发送逾期提醒", record.getOrderId()); + continue; + } + } sendSingleReminder(accessToken.getAccessToken(), authCorpInfo, record); } } catch (Exception e) {