|
|
@ -27,28 +27,24 @@ public class AutoReceiptJob implements JobHandler { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String execute(String param) throws Exception { |
|
|
|
public String execute(String param) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer day = Integer.valueOf(param); |
|
|
|
|
|
|
|
|
|
|
|
List<TenantDO> tenants = tenantService.getTenantList(new TenantExportReqVO()); |
|
|
|
List<TenantDO> tenants = tenantService.getTenantList(new TenantExportReqVO()); |
|
|
|
|
|
|
|
|
|
|
|
AtomicReference<Integer> num = new AtomicReference<>(0); |
|
|
|
AtomicReference<Integer> num = new AtomicReference<>(0); |
|
|
|
tenants.forEach(tenantDO -> { |
|
|
|
tenants.forEach(tenantDO -> { |
|
|
|
|
|
|
|
|
|
|
|
TenantContextHolder.setTenantId(tenantDO.getId()); |
|
|
|
TenantContextHolder.setTenantId(tenantDO.getId()); |
|
|
|
|
|
|
|
// 10天未启动收货的订单
|
|
|
|
|
|
|
|
List<YxStoreOrder> orders = storeOrderService.listTimeoutOrders(day); |
|
|
|
|
|
|
|
|
|
|
|
// 每隔30分钟查询7天之前的订单 ,准备自动收获
|
|
|
|
|
|
|
|
// 测试环境3分钟 TIMESTAMPDIFF(minute,pay_time,{0}) > 3
|
|
|
|
|
|
|
|
// 线上环境7天 TIMESTAMPDIFF(dat,pay_time,{0}) > 7
|
|
|
|
|
|
|
|
List<YxStoreOrder> orders = storeOrderService.list(new LambdaQueryWrapper<YxStoreOrder>() |
|
|
|
|
|
|
|
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) |
|
|
|
|
|
|
|
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_1.getValue()) |
|
|
|
|
|
|
|
.apply("TIMESTAMPDIFF(day,pay_time,{0}) > 7 ",LocalDateTime.now()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
num.updateAndGet(v -> v + orders.size()); |
|
|
|
|
|
|
|
orders.forEach(yxStoreOrder -> { |
|
|
|
orders.forEach(yxStoreOrder -> { |
|
|
|
storeOrderService.takeOrder(yxStoreOrder.getOrderId(), null); |
|
|
|
storeOrderService.takeOrder(yxStoreOrder.getOrderId(), null); |
|
|
|
}); |
|
|
|
}); |
|
|
|
TenantContextHolder.setTenantId(null); |
|
|
|
TenantContextHolder.setTenantId(null); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return StrUtil.format("合计处理{}个租户,自动收货订单{}条", tenants.size(), num); |
|
|
|
return StrUtil.format("合计处理{}个租户,按照{}天自动收货订单{}条", tenants.size(), day, num); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|