|
@@ -5,7 +5,9 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|
|
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
|
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|
|
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectPlanDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.inspect.IotInspectPlanMapper;
|
|
|
import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderService;
|
|
@@ -32,23 +34,26 @@ public class InspectCreateOrderJob implements JobHandler {
|
|
|
@TenantJob
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@DataPermission(enable = false)
|
|
|
+ @TenantIgnore
|
|
|
public String execute(String param) throws Exception {
|
|
|
try {
|
|
|
- List<IotInspectPlanDO> plans = iotInspectPlanMapper.selectList();
|
|
|
- plans.stream().filter(e -> e.getStatus()==0).forEach(plan -> {
|
|
|
- if (plan.getLastCreateTime()==null) {
|
|
|
- Date date = Date.from(
|
|
|
- plan.getCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
|
|
- .toInstant() // 转为 Instant(时间戳)
|
|
|
- );
|
|
|
+ TenantUtils.execute(1L, () -> {
|
|
|
+ List<IotInspectPlanDO> plans = iotInspectPlanMapper.selectList();
|
|
|
+ plans.stream().filter(e -> e.getStatus()==0).forEach(plan -> {
|
|
|
+ if (plan.getLastCreateTime()==null) {
|
|
|
+ Date date = Date.from(
|
|
|
+ plan.getCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
|
|
+ .toInstant() // 转为 Instant(时间戳)
|
|
|
+ );
|
|
|
deal(plan, date);
|
|
|
- } else {
|
|
|
- Date lastdate = Date.from(
|
|
|
- plan.getLastCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
|
|
- .toInstant() // 转为 Instant(时间戳)
|
|
|
- );
|
|
|
+ } else {
|
|
|
+ Date lastdate = Date.from(
|
|
|
+ plan.getLastCreateTime().atZone(ZoneId.systemDefault()) // 使用系统默认时区
|
|
|
+ .toInstant() // 转为 Instant(时间戳)
|
|
|
+ );
|
|
|
deal(plan, lastdate);
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e.getMessage());
|