|
@@ -4,14 +4,23 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
|
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
|
|
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
|
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
|
|
import kd.bos.context.RequestContext;
|
|
import kd.bos.context.RequestContext;
|
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
+import kd.bos.dataentity.resource.ResManager;
|
|
|
import kd.bos.entity.param.CustomParam;
|
|
import kd.bos.entity.param.CustomParam;
|
|
|
import kd.bos.exception.KDException;
|
|
import kd.bos.exception.KDException;
|
|
|
|
|
+import kd.bos.logging.Log;
|
|
|
|
|
+import kd.bos.logging.LogFactory;
|
|
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
|
|
+import kd.bos.schedule.api.JobInfo;
|
|
|
import kd.bos.schedule.executor.AbstractTask;
|
|
import kd.bos.schedule.executor.AbstractTask;
|
|
|
|
|
+import kd.bos.schedule.executor.JobClient;
|
|
|
|
|
+import kd.bos.schedule.server.ScheduleService;
|
|
|
import kd.bos.servicehelper.parameter.SystemParamServiceHelper;
|
|
import kd.bos.servicehelper.parameter.SystemParamServiceHelper;
|
|
|
import kd.sdk.plugin.Plugin;
|
|
import kd.sdk.plugin.Plugin;
|
|
|
import nckd.jxccl.wtc.utils.SyncPunchCardHelper;
|
|
import nckd.jxccl.wtc.utils.SyncPunchCardHelper;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import nckd.jxccl.wtc.wtabm.web.common.constant.WtcConstant;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
@@ -29,7 +38,7 @@ public class SyncPunchCardTask extends AbstractTask implements Plugin {
|
|
|
put("https://", getCamsApi);
|
|
put("https://", getCamsApi);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+ private static final Log LOGGER = LogFactory.getLog(SyncPunchCardTask.class);
|
|
|
public void initConfig() {
|
|
public void initConfig() {
|
|
|
CustomParam customParam = new CustomParam();
|
|
CustomParam customParam = new CustomParam();
|
|
|
customParam.getSearchKeySet().add("PUNCH_CARD_HOST");
|
|
customParam.getSearchKeySet().add("PUNCH_CARD_HOST");
|
|
@@ -56,6 +65,28 @@ public class SyncPunchCardTask extends AbstractTask implements Plugin {
|
|
|
getAllCards(startTime, endTime);
|
|
getAllCards(startTime, endTime);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ doSyncJob();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void doSyncJob() {
|
|
|
|
|
+ DynamicObject dynamicJob = WtcConstant.JOB_HELPER.loadOne("id", new QFilter("number", "=", "wtis_syncPunchCardData_SKDJ_S"));
|
|
|
|
|
+ if (dynamicJob != null) {
|
|
|
|
|
+ JobInfo jobInfo = ScheduleService.getInstance().getObjectFactory().getJobDao().get(String.valueOf(dynamicJob.getPkValue()));
|
|
|
|
|
+ if (jobInfo.isEnable()) {
|
|
|
|
|
+ DynamicObject task = WtcConstant.TASK_HELPER.queryOriginalOne("id", new QFilter[]{new QFilter("job.id", "=", dynamicJob.getPkValue()), new QFilter("status", "=", "SCHEDULED")});
|
|
|
|
|
+ if (task == null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ JobClient.dispatch(jobInfo);
|
|
|
|
|
+ if (LOGGER.isDebugEnabled()) {
|
|
|
|
|
+ LOGGER.debug("原始卡同步任务启动成功!");
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception var6) {
|
|
|
|
|
+ LOGGER.warn("原始卡同步任务启动失败!", var6);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|