fix(QywxMessageJob): 修复逾期商品提醒任务中未处理购买订单的问题
在发送逾期商品提醒时,增加对购买订单的检查。如果订单模式为购买且货柜模式也为购买,则跳过发送提醒。同时添加了对货柜和货柜单元格的校验,避免因数据不存在导致的错误。
This commit is contained in:
parent
3ee313b1a3
commit
a0e9e224ac
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue