feat:基础数据同步JOB开发
parent
b62db8c7d2
commit
cf3b7d9ee1
@ -1 +1 @@
|
|||||||
{"startDate": "2024-01-01", "pageNumber": 1, "pageSize": 100}
|
{"startDate": "2024-01-01"}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.docus.server.archive.job;
|
||||||
|
|
||||||
|
import com.docus.server.archive.config.DocusProperties;
|
||||||
|
import com.docus.server.archive.constans.SyncConstant;
|
||||||
|
import com.docus.server.archive.service.DeptInfoSyncService;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科室数据同步job
|
||||||
|
*
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2024/5/27 9:16
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class DeptInfoSyncJob {
|
||||||
|
@Resource
|
||||||
|
private DocusProperties docusProperties;
|
||||||
|
@Autowired
|
||||||
|
private Map<String, DeptInfoSyncService> deptInfoSyncServiceMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@XxlJob("DeptInfoSyncJob")
|
||||||
|
public void deptInfoSync() {
|
||||||
|
String syncServicePrefix = docusProperties.getSyncServicePrefix();
|
||||||
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> {} 科室基础数据同步开始了!", syncServicePrefix);
|
||||||
|
String serviceName = syncServicePrefix + SyncConstant.DEPT_INFO_SYNC_SERVICE_SUFFIX;
|
||||||
|
DeptInfoSyncService deptInfoSyncService = deptInfoSyncServiceMap.get(serviceName);
|
||||||
|
if (deptInfoSyncService == null) {
|
||||||
|
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 科室基础数据同步服务 {} 未找到!", serviceName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
deptInfoSyncService.fullSync();
|
||||||
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> {} 科室基础数据同步结束了!", syncServicePrefix);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " + syncServicePrefix + " 科室基础数据同步出现异常!" + ex.getMessage(), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.docus.server.archive.job;
|
||||||
|
|
||||||
|
import com.docus.server.archive.config.DocusProperties;
|
||||||
|
import com.docus.server.archive.constans.SyncConstant;
|
||||||
|
import com.docus.server.archive.service.UserInfoSyncService;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工用户数据同步job
|
||||||
|
*
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2024/5/27 9:16
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class UserInfoSyncJob {
|
||||||
|
@Resource
|
||||||
|
private DocusProperties docusProperties;
|
||||||
|
@Autowired
|
||||||
|
private Map<String, UserInfoSyncService> userInfoSyncServiceMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
@XxlJob("UserInfoSyncJob")
|
||||||
|
public void userInfoSync() {
|
||||||
|
String syncServicePrefix = docusProperties.getSyncServicePrefix();
|
||||||
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> {} 用户基础数据同步开始了!", syncServicePrefix);
|
||||||
|
String serviceName = syncServicePrefix + SyncConstant.USER_INFO_SYNC_SERVICE_SUFFIX;
|
||||||
|
UserInfoSyncService userInfoSyncService = userInfoSyncServiceMap.get(serviceName);
|
||||||
|
if (userInfoSyncService == null) {
|
||||||
|
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 用户基础数据同步服务 {} 未找到!", serviceName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
userInfoSyncService.fullSync();
|
||||||
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> {} 用户基础数据同步结束了!", syncServicePrefix);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " + syncServicePrefix + " 用户基础数据同步出现异常!" + ex.getMessage(), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue