每日00:25二级门禁车辆定时任务
parent
6a16b9484a
commit
ded8ee64d7
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -48,6 +48,40 @@ public class TwoCarUtil {
|
||||||
private static Integer dockFlag = 0;
|
private static Integer dockFlag = 0;
|
||||||
private static String prefix;
|
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 {
|
public static void main(String[] args) throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue