From 384370341c75c0a8ae371f307dffcc83b5258a43 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期五, 08 三月 2024 11:34:22 +0800
Subject: [PATCH] 整理
---
server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java | 79 ++++++++++++++++++++++++++++++++++-----
1 files changed, 68 insertions(+), 11 deletions(-)
diff --git a/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java b/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java
index 326d4c9..478d293 100644
--- a/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java
+++ b/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java
@@ -1,16 +1,24 @@
package com.doumee.task;
+import com.doumee.config.DataSyncConfig;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.utils.Constants;
import com.doumee.service.business.MemberService;
import com.doumee.service.business.impl.hksync.HkSyncEmpowerServiceImpl;
import com.doumee.service.business.impl.hksync.HkSyncImgServiceImpl;
-import com.doumee.service.business.impl.hksync.HkSyncOrgUserServiceImpl;
+import com.doumee.service.business.impl.hksync.HkSyncParkServiceImpl;
+import com.doumee.service.business.impl.hksync.ferp.HkSyncOrgUserToHKServiceImpl;
import com.doumee.service.business.impl.hksync.HkSyncVisitServiceImpl;
+import com.doumee.service.business.impl.hksync.fhk.HkSyncVehicleFromHKServiceImpl;
+import com.doumee.service.business.impl.hksync.fhk.HkSyncVisitFromHKServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+
+import java.util.Date;
/**
* 瀹氭椂浠诲姟
@@ -23,11 +31,17 @@
public class ScheduleTool {
@Autowired
+ private HkSyncParkServiceImpl hkSyncParkService;
+ @Autowired
private HkSyncImgServiceImpl hkSyncImgService;
@Autowired
private HkSyncEmpowerServiceImpl hkSyncEmpowerService;
@Autowired
- private HkSyncOrgUserServiceImpl hkSyncOrgUserService;
+ private HkSyncOrgUserToHKServiceImpl hkSyncOrgUserService;
+ @Autowired
+ private HkSyncVisitFromHKServiceImpl hkSyncVisitFromHKService;
+ @Autowired
+ private HkSyncVehicleFromHKServiceImpl hkSyncVehicleFromHKService;
@Autowired
private HkSyncVisitServiceImpl hkSyncVisitService;
@Autowired
@@ -35,17 +49,53 @@
/**
* 鏄惁寮�鍙戣��
*/
- @Value("${timing}")
- private Boolean timing;
-
+ @Autowired
+ private DataSyncConfig dataSyncConfig;
/**
- * 缂撳瓨鐪佸競鍖�
+ * 姣忓垎閽熸媺鍙栦竴娆′粖鏃ョ殑璁垮棰勭害鏁版嵁
+ * @throws Exception
+ */
+ @Scheduled(cron= "0 0 23 * * ?")
+ public void syncVehicleUpdateData() throws Exception {
+ hkSyncVehicleFromHKService.syncVehicleUpdateData(new Date(System.currentTimeMillis()-24*60*60*1000));
+ }
+ /**
+ * 姣忓垎閽熸媺鍙栦竴娆′粖鏃ョ殑璁垮棰勭害鏁版嵁
+ * @throws Exception
+ */
+ @Scheduled(fixedDelay= 30*1000)
+ public void syncVistAppointData() throws Exception {
+ if(Constants.DEALING_FROM_HK_VISIT){
+ return ;
+ }
+ try {
+ Constants.DEALING_FROM_HK_VISIT =true;
+ hkSyncVisitFromHKService.syncVistAppointData(new Date());
+ Constants.DEALING_FROM_HK_VISIT =false;
+ }catch (Exception e){
+// throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵逛笉璧凤紝娴峰悍鍚屾鏁版嵁澶辫触~");
+ }finally {
+ Constants.DEALING_FROM_HK_VISIT =false;
+ }
+ }
+ /**
+ * 姣�10鍒嗛挓鎷夊彇涓�娆℃渶鏂拌瀹㈢櫥璁扮姸鎬侊紙棰勭害鎴愬姛鍜屽凡鐧昏锛�
+ * @throws Exception
+ */
+ @Scheduled(fixedDelay= 10*60*1000)
+ public void syncVisitOuttimeStatus() throws Exception {
+ hkSyncVisitService.getOutTimeVisitRecord();
+ }
+ /**
+ * 涓嬭浇娴峰悍绯荤粺鍥剧墖鏁版嵁
* @throws Exception
*/
@Scheduled(fixedDelay= 60*1000)
public void downloadHkImg() throws Exception {
- hkSyncImgService.downHKImgs(0);
+ if(dataSyncConfig.getNeedDealImg()!=null && dataSyncConfig.getNeedDealImg()){
+ hkSyncImgService.downHKImgs(0);
+ }
}
/**
* 瀹氭椂鍚屾缁勭粐淇℃伅鍒版捣搴风郴缁�
@@ -53,7 +103,10 @@
*/
@Scheduled(fixedDelay= 60*1000)
public void syncOrgData() {
- hkSyncOrgUserService.syncOrgData();
+ if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.erp){
+ //濡傛灉鏄疎RP绯荤粺鍚屾涓嬪彂
+ hkSyncOrgUserService.syncOrgData();
+ }
}
/**
* 瀹氭椂鍚屾鐢ㄦ埛淇℃伅鍒版捣搴风郴缁�
@@ -61,7 +114,10 @@
*/
@Scheduled(fixedDelay= 60*1000)
public void syncUserData() {
- hkSyncOrgUserService.syncUserData();
+ if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.erp) {
+ //濡傛灉鏄疎RP绯荤粺鍚屾涓嬪彂
+ hkSyncOrgUserService.syncUserData();
+ }
}
/**
* 瀹氭椂鍚屾鐢宠閫氳繃鐨勮瀹㈡暟鎹埌娴峰悍绯荤粺
@@ -77,6 +133,7 @@
*/
@Scheduled(fixedDelay= 60*1000)
public void syncEmpowerData() {
+
hkSyncEmpowerService.syncEmpowerData();
}
/**
@@ -101,7 +158,7 @@
*/
@Scheduled(fixedDelay= 60*1000)
public void syncParkBookData() {
- hkSyncImgService.syncParkBookData();
+ hkSyncParkService.syncParkBookData();
}
--
Gitblit v1.9.3