@@ -0,0 +1,44 @@ | |||||
package com.ningdatech.pmapi.ding.controller; | |||||
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; | |||||
import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask; | |||||
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
/** | |||||
* <p> | |||||
* PullDingInfoController | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 2023/6/2 | |||||
**/ | |||||
@RestController | |||||
@RequestMapping("/api/v1/zwdd/pull") | |||||
@RequiredArgsConstructor | |||||
public class DingInfoPullController { | |||||
private final EmployeeBatchGetTask employeeBatchGetTask; | |||||
private final GovBusinessStripsTask businessStripsTask; | |||||
private final OrganizationBatchGetTask organizationBatchGetTask; | |||||
@GetMapping("/employee") | |||||
public void employeeBatchGet() { | |||||
employeeBatchGetTask.batchGetEmployeeTask(); | |||||
} | |||||
@GetMapping("/businessStrips") | |||||
public void businessStripsBatchGet() { | |||||
businessStripsTask.batchGetGovBusinessStripsTask(); | |||||
} | |||||
@GetMapping("/organization") | |||||
public void organizationBatchGet() { | |||||
organizationBatchGetTask.batchGetOrganizationTask(); | |||||
} | |||||
} |
@@ -21,6 +21,7 @@ import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; | |||||
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition; | import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.scheduling.annotation.Scheduled; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
@@ -56,6 +57,7 @@ public class EmployeeBatchGetTask { | |||||
private IUserInfoService iUserInfoService; | private IUserInfoService iUserInfoService; | ||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
@Scheduled(cron = "0 0 1 0/1 0 ?") | |||||
public void batchGetEmployeeTask() { | public void batchGetEmployeeTask() { | ||||
// 获取所有的组织列表用户获取组织下的 用户信息 | // 获取所有的组织列表用户获取组织下的 用户信息 | ||||
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(); | List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(); | ||||
@@ -9,6 +9,7 @@ import com.ningdatech.zwdd.model.Page; | |||||
import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; | import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; | ||||
import com.ningdatech.zwdd.model.query.PageSubGovBusinessStripsQuery; | import com.ningdatech.zwdd.model.query.PageSubGovBusinessStripsQuery; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.scheduling.annotation.Scheduled; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
@@ -34,6 +35,7 @@ public class GovBusinessStripsTask { | |||||
private IGovBusinessStripService iGovBusinessStripService; | private IGovBusinessStripService iGovBusinessStripService; | ||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
@Scheduled(cron = "0 0 1 0/1 0 ?") | |||||
public void batchGetGovBusinessStripsTask() { | public void batchGetGovBusinessStripsTask() { | ||||
PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); | PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); | ||||
pageSubGovBusinessStripsQuery.setPageNo(1); | pageSubGovBusinessStripsQuery.setPageNo(1); | ||||
@@ -16,6 +16,7 @@ import com.ningdatech.zwdd.model.dto.DingScopesV2DTO; | |||||
import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO; | import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.scheduling.annotation.Scheduled; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
@@ -45,6 +46,7 @@ public class OrganizationBatchGetTask { | |||||
* 获取浙政钉组织架构 | * 获取浙政钉组织架构 | ||||
*/ | */ | ||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
@Scheduled(cron = "0 0 1 0/1 0 ?") | |||||
public void batchGetOrganizationTask() { | public void batchGetOrganizationTask() { | ||||
// List<DingOrganization> allList = iDingOrganizationService.list(); | // List<DingOrganization> allList = iDingOrganizationService.list(); | ||||
// List<String> currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); | // List<String> currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); | ||||