package com.zksy.data.schedule; import com.zksy.data.service.IBaseSaveDataInterface; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.HashMap; import java.util.List; @EnableScheduling @Component @Slf4j public class CollectDataSchedule { private HashMap serviceMap = new HashMap<>(); @Autowired private ApplicationContext applicationContext; @PostConstruct public void init() { serviceMap.put("xcrELicNcertificateServiceImpl", "gateway/api/1/getXzxkxxByUniscid"); serviceMap.put("xcrCompanyInvestmentServiceImpl", "gateway/api/1/getGdjczxgxxByUniscid"); serviceMap.put("xcrEquityChangeServiceImpl", "gateway/api/1/getGqczbgxxByUniscid"); serviceMap.put("xcrSupplementaryForeignInvestmentServiceImpl", "gateway/api/1/getWzbcxxByUniscid"); serviceMap.put("xcrAppointDelegatesServiceImpl", "gateway/api/1/getWpdbxxByUniscid"); serviceMap.put("xcrAgriculturalSupplementServiceImpl", "gateway/api/1/getNzbcxxByUniscid"); serviceMap.put("xcrDomesticCapitalSupplementServiceImpl", "gateway/api/1/getNzbcxxByUniscid1"); serviceMap.put("xcrInstallmentPaymentServiceImpl", "gateway/api/1/getFqsjxxByUniscid"); serviceMap.put("xcrInvestorSubscriptionDetailsServiceImpl", "gateway/api/1/getTzrrjxxByUniscid"); serviceMap.put("xcrNonNaturalPersonContributionServiceImpl", "gateway/api/1/getFzrrczxxByUniscid"); serviceMap.put("xcrNaturalPersonContributionsServiceImpl", "gateway/api/1/getZrrczxxByUniscid"); serviceMap.put("xcrHistoryNameServiceImpl", "gateway/api/1/getLsmcxxByUnscid"); serviceMap.put("xcrHistoricalLegalRepresentativeServiceImpl", "gateway/api/1/getLsfddbrxxByUniscid"); serviceMap.put("xcrAbnormalHouseholdTerminationServiceImpl", "gateway/api/1/getFzchjcxxByUniscid"); serviceMap.put("xcrTaxAdministrativePenaltyServiceImpl", "gateway/api/1/getSwxzcfxxByUniscid"); serviceMap.put("xcrAffiliatedEnterpriseServiceImpl", "gateway/api/1/getLsqyxxByUniscid"); serviceMap.put("xcrInstallmentSubscriptionServiceImpl", "gateway/api/1/getFqrjxxByUniscid"); serviceMap.put("xcrAdministrativeLicensingAgriculturalCollegesServiceImpl", "gateway/api/1/getNznbxzxkxxByUniscid"); serviceMap.put("xcrEnterpriseExceptionListServiceImpl", "gateway/api/1/getQyycmlxxByUniscid1"); serviceMap.put("xcrInvestorAbnormalRecordServiceImpl", "gateway/api/1/getQyjyycmlgdxxByUnsicd"); serviceMap.put("xcrEnterprisePublicityLicenseServiceImpl", "gateway/api/1/getQygsxkxxByUniscid"); serviceMap.put("xcrEnterprisePublicityEquityChangeServiceImpl", "gateway/api/1/getQygsgqbgxxByUniscid"); serviceMap.put("xcrSimplifiedCancellationAnnouncementServiceImpl", "gateway/api/1/getJyzxggxxByUniscid"); serviceMap.put("xcrCancelTaxRegistrationServiceImpl", "gateway/api/1/getZxswdjxxByUniscid"); serviceMap.put("xcrEnterprisePublicityInvestorInformationStatusServiceImpl", "gateway/api/1/getQygsczrxxqkByUniscid"); serviceMap.put("xcrEnterprisePublicityDetailsContributionsContributorsServiceImpl", "gateway/api/1/getCzrsjmxByUniscid"); serviceMap.put("xcrEnterprisePublicationSupplySubscribedDetailsInvestorsServiceImpl", "gateway/api/1/getQygsczrrjmxByUniscid"); serviceMap.put("xcrRevisionInformationAgriculturalCollegeAnnualReportServiceImpl", "gateway/api/1/getNznbxgxxByUniscid"); serviceMap.put("xcrBasicSupplementAgriculturalCollegeAnnualServiceImpl", "gateway/api/1/getNznbjbxxbcByUniscid"); serviceMap.put("xcrEnterpriseBasicInformationServiceImpl", "gateway/api/1/getQyjbxxByUniscid"); serviceMap.put("xcrEnterpriseNameApprovalServiceImpl", "gateway/api/1/getQymcxxByUniscid"); serviceMap.put("xcrSeriousIllegalDishonestEnterprisesServiceImpl", "gateway/api/1/getYzwfsxqymdBydm"); serviceMap.put("xcrSeriousIllegalDishonestEnterprisesDetailServiceImpl", "gateway/api/1/getYzwfxxxxByUniscid"); serviceMap.put("xcrEquityPledgeInfoServiceImpl", "gateway/api/1/getGqczdjxxBydm"); serviceMap.put("xcrEquityFreezeServiceImpl", "gateway/api/1/getGqdjxxByUniscid"); serviceMap.put("xcrEquityChangeInfoServiceImpl", "gateway/api/1/getGqbgxxByUniscid"); serviceMap.put("xcrEquityFreezeExecutionServiceImpl", "gateway/api/1/getGqdjbzxrxxByUniscid"); serviceMap.put("xcrAbnormalBusinessOperationsServiceImpl", "gateway/api/1/getQyycmlxxxxByUniscid"); serviceMap.put("xcrCheckWorkInfoServiceImpl", "gateway/api/1/getJcgzxxByUniscid"); serviceMap.put("xcrTaxRegistrationEstablishmentServiceImpl", "gateway/api/1/getSwdjslxxByUniscid"); serviceMap.put("xcrStopBusinessInformationServiceImpl", "gateway/api/1/getGtgshtxyxxByUniscid"); serviceMap.put("xcrAbnormalHouseholdIdentificationServiceImpl", "gateway/api/1/getFzchrdxxByUniscid"); serviceMap.put("xcrIncomeTaxReturnServiceImpl", "gateway/api/1/getQysdssbxxByUniscid1"); serviceMap.put("xcrMainFinancialStatementsServiceImpl", "gateway/api/1/getCwbbzbByUniscid"); serviceMap.put("xcrInvoiceIssuanceServiceImpl", "gateway/api/1/fpkpxxByUniscid"); serviceMap.put("xcrConfirmationTerminationServiceImpl", "gateway/api/1/getFzchrdjcxxbByUniscid"); serviceMap.put("xcrTaxpayerCreditRatingServiceImpl", "gateway/api/1/getNsrxydjByUniscid"); serviceMap.put("xcrInstitutionalClientsServiceImpl", "gateway/api/1/getJgkhxxByUnisicd"); serviceMap.put("xcrRecordDishonestyServiceImpl", "gateway/api/1/getSxjlmdByQymc"); serviceMap.put("xcrTechnologyPlanProjectServiceImpl", "gateway/api/1/getKjjhxmapbByQymc"); serviceMap.put("xcrTechnologyAwardSupplementServiceImpl", "gateway/api/1/getKjjbxmjzjqkByQymc"); serviceMap.put("xcrMinorEnterprisesServiceImpl", "gateway/api/1/getKjxzxqymdByQymc"); serviceMap.put("xcrInnovationPlatformServiceImpl", "gateway/api/1/getCxptmd"); serviceMap.put("xcrHighTechServiceImpl", "gateway/api/1/getGxjsqymdByUniscid"); serviceMap.put("xcrFoodProductionLicenseDetaliServiceImpl", "gateway/api/1/getSpscxkzpzmxByUniscid"); serviceMap.put("xcrLegalRepresentativeServiceImpl", "gateway/api/1/getSpscfddbrxxByUniscid"); serviceMap.put("xcrFoodProductionLicenseServiceImpl", "gateway/api/1/getSpscxkzjbxxByUniscid"); serviceMap.put("xcrFoodBusinessLicenseServiceImpl", "gateway/api/1/getSpjyxkzjbxxByUniscid"); serviceMap.put("xcrMsAdministrativeLicenseServiceImpl", "gateway/api/1/getXzxkxxByUniscid"); serviceMap.put("xcrContactInformationServiceImpl", "gateway/api/1/getLlyxxByUniscid"); serviceMap.put("xcrFinancialManagerServiceImpl", "gateway/api/1/getCwfzrByUniscid"); serviceMap.put("xcrPersonalRevokeRecordServiceImpl", "gateway/api/1/getGtdxxxByUniscid"); serviceMap.put("xcrNoticeRecordServiceImpl", "gateway/api/1/getGsggxxByUniscid"); serviceMap.put("xcrWebsiteInfoServiceImpl", "gateway/api/1/getGtnbwzhwdxxByUniscid"); serviceMap.put("xcrSmallAndMicroEnterprisesServiceImpl", "gateway/api/1/getXwqymljbxxByUniscid"); serviceMap.put("xcrRandomInspectionTaskServiceImpl", "gateway/api/1/getJcgzxxmlByUniscid"); serviceMap.put("xcrAnnualReportExternalInvestmentServiceImpl", "gateway/api/1/getQynbdwtzxxByUniscid"); serviceMap.put("xcrExternalGuaranteeServiceImpl", "gateway/api/1/getQynbdwtgbzxxByUniscid"); serviceMap.put("xcrRevokeInfoServiceImpl", "gateway/api/1/getDxxxByUniscid"); serviceMap.put("xcrBranchOfficesInfoServiceImpl", "gateway/api/1/getFzjgbaxxByUniscid1"); serviceMap.put("xcrLicenseInfoServiceImpl", "gateway/api/1/getXkxxByUniscid"); serviceMap.put("xcrChangeFilingServiceImpl", "gateway/api/1/getBgbaxxByUniscid"); serviceMap.put("xcrSocialInsuranceDataServiceImpl", "gateway/api/1/getQynbshbxxxByUniscid"); serviceMap.put("xcrAgriculturalCollegeAnnualReportServiceImpl", "gateway/api/1/getNznbjbxxByUniscid"); serviceMap.put("xcrEnterprisePollutionPermitInfoServiceImpl", "gateway/api/1/getQypwxkxxByUniscid"); serviceMap.put("xcrKeyPollutionSourcesServiceImpl", "gateway/api/1/getZdpwdwmlByShxyfwm"); serviceMap.put("xcrEnvironmentalPenaltyDecisionServiceImpl","gateway/api/1/getHbcfjdqkxxByUniscid"); } @Scheduled(cron = "0 0 1 1 * ?") public void getDataByMonth() { } @Scheduled(cron = "0 0 1 * * ?") public void getDataByDay1() { List serviceList = List.of( "xcrEnvironmentalPenaltyDecisionServiceImpl" ); serviceList.parallelStream().forEach((q)->{ try { Object bean = applicationContext.getBean(q); ((IBaseSaveDataInterface) bean).saveDataByUniCode(serviceMap.get(q)); } catch (BeansException e) { log.error("获取name为:{}的bean失败",q); throw new RuntimeException(e); } }); } @Scheduled(cron = "0 0 2 * * ?") public void getDataByDay2() { } @Scheduled(cron = "0 0 3 ? * SUN") public void getDataByDay0() { } @Scheduled(cron = "0 0 4 ? * SUN") public void getDataByWeek1() { List serviceList = List.of( "xcrEnterprisePollutionPermitInfoServiceImpl" ); serviceList.parallelStream().forEach((q)->{ try { Object bean = applicationContext.getBean(q); ((IBaseSaveDataInterface) bean).saveDataByUniCode(serviceMap.get(q)); } catch (BeansException e) { log.error("获取name为:{}的bean失败",q); throw new RuntimeException(e); } }); } @Scheduled(cron = "0 0 5 ? * SUN") public void getDataByWeek2() { } @Scheduled(cron = "0 0 6 ? * SUN") public void getDataByWeek3() { } }