每日00:25二级门禁车辆定时任务

koumen
lishiwei 2026-05-14 17:22:05 +08:00
parent 6a16b9484a
commit ded8ee64d7
2 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package com.zcloud.primeport.plan;
import com.jjb.saas.framework.job.Job;
import com.jjb.saas.framework.job.annotation.JobRegister;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zcloud.primeport.plan.mjDevice.TwoCarUtil;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class TwoLevelCarXxlJob implements Job {
@Resource
private TwoCarUtil twoCarUtil;
@Override
@JobRegister(cron = "0 25 0 * * ?", jobDesc = "闭区定时任务每日00:25进行当日二级门禁可进门车辆推送", triggerStatus = 1)
@XxlJob("com.zcloud.plan.TwoLevelCarDockXxlJob")
public ReturnT<String> execute(String param) {
try {
// 二级门禁车辆定时对接(含同步一级门禁)
twoCarUtil.scheduledCarCompany();
} catch (Exception e) {
e.printStackTrace();
return ReturnT.FAIL;
}
return ReturnT.SUCCESS;
}
}

View File

@ -48,6 +48,40 @@ public class TwoCarUtil {
private static Integer dockFlag = 0;
private static String prefix;
/*
*
*
* */
public void scheduledCarCompany() {
if (!dockFlag.equals(1)) return;
// 所有今日有效的分公司/相关方二级口门车car_belong_type IN 1,2,3,5
List<TwoLevelCar> fgsCarList = closedAreaCarApplyRepository.getFgsCarToDay(null);
for (TwoLevelCar twoLevelCar : fgsCarList) {
try {
HKDeviceUtil.saveOrUpdCar(twoLevelCar.getLicenceNo(), 0);
HKDeviceUtil.vehicleTopUp(twoLevelCar.getLicenceNo(), 0,
twoLevelCar.getHkIndexCode(), twoLevelCar.getKhParkSysCode(),
DateUtil.date2Str(new Date(), "yyyy-MM-dd"),
DateUtil.date2Str(new Date(), "yyyy-MM-dd"));
} catch (Exception e) {
System.err.println("二级门禁分公司车辆同步失败, licenceNo=" + twoLevelCar.getLicenceNo() + ", 原因: " + e.getMessage());
}
}
// 所有今日有效的临时二级口门车car_belong_type = 4
List<TwoLevelCar> tmpCarList = closedAreaCarApplyRepository.dockTmpCarLevelTwo(null);
for (TwoLevelCar twoLevelCar : tmpCarList) {
try {
HKDeviceUtil.saveOrUpdCar(twoLevelCar.getLicenceNo(), 0);
HKDeviceUtil.vehicleTopUp(twoLevelCar.getLicenceNo(), 0,
twoLevelCar.getHkIndexCode(), twoLevelCar.getKhParkSysCode(),
DateUtil.date2Str(new Date(), "yyyy-MM-dd"),
DateUtil.date2Str(new Date(), "yyyy-MM-dd"));
} catch (Exception e) {
System.err.println("二级门禁临时车辆同步失败, licenceNo=" + twoLevelCar.getLicenceNo() + ", 原因: " + e.getMessage());
}
}
}
public static void main(String[] args) throws Exception {
}