fuliqi
2023-11-30 e5bf0d08d05f5c58224fe28cdf743a1bae88e3f0
ycl-platform/src/main/java/com/ycl/timer/GetDingUserOrgTimer.java
@@ -52,11 +52,11 @@
    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
         if (contextRefreshedEvent.getApplicationContext().getParent() == null) {
             Thread thread = new Thread(this::run);
             thread.setUncaughtExceptionHandler(handler);
             thread.start();
         }
//         if (contextRefreshedEvent.getApplicationContext().getParent() == null) {
//             Thread thread = new Thread(this::run);
//             thread.setUncaughtExceptionHandler(handler);
//             thread.start();
//         }
    }
    @Autowired
@@ -72,14 +72,16 @@
    @Autowired
    private UmsAdminRoleRelationService umsAdminRoleRelationService;
    // @Scheduled(cron = "0 0 00 * * ?")
    //@Scheduled(cron = "0 50 15 * * ?")
    @Transactional(rollbackFor = Exception.class)
    public void run() {
        log.info("开始同步任务");
        //获取全部部门code
        JSONObject topObj = dingCommon.getBookAuthority();
        //顶级部门id
        JSONArray deptTopArr = topObj.getJSONArray("deptVisibleScopes");
        List<UmsDepart> dingOrgList = dingCommon.getOrgInfo(deptTopArr);
        //查询数据库中的部门
        List<UmsDepart> dataOrgList = umsDepartService.list();
        Iterator<UmsDepart> removeIterOrg = dingOrgList.iterator();
@@ -204,6 +206,6 @@
    @Override
    public void run(ApplicationArguments args) throws Exception {
         run();
//         run();
    }
}