package com.zksy.data.controller;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.zksy.api.client.TableDataClient;
import com.zksy.api.dto.tableData.EBaseinfo;
import com.zksy.common.domain.Result;
import com.zksy.data.domain.po.XcrEBaseinfo;
import com.zksy.data.service.*;
import com.zksy.data.utils.RedisService;
import com.zksy.data.utils.XhRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {
    @Autowired
    private XhRequestUtil xhRequestUtil;
    @Autowired
    private XcrCompanyInvestmentService xcrCompanyInvestmentService;
    @Autowired
    private XcrEquityChangeService xcrEquityChangeService;
    @Autowired
    private XcrAppointDelegatesService xcrAppointDelegatesService;
    @Autowired
    private XcrSupplementaryForeignInvestmentService xcrSupplementaryForeignInvestmentService;
    @Autowired
    private XcrAgriculturalSupplementService xcrAgriculturalSupplementService;
    @Autowired
    private XcrDomesticCapitalSupplementService xcrDomesticCapitalSupplementService;
    @Autowired
    private XcrInstallmentPaymentService xcrInstallmentPaymentService;
    @Autowired
    private XcrInvestorSubscriptionDetailsService xcrInvestorSubscriptionDetailsService;
    @Autowired
    private XcrNonNaturalPersonContributionService xcrNonNaturalPersonContributionService;
    @Autowired
    private XcrNaturalPersonContributionsService xcrNaturalPersonContributionsService;
    @Autowired
    private XcrHistoryNameService xcrHistoryNameService;
    @Autowired
    private XcrHistoricalLegalRepresentativeService xcrHistoricalLegalRepresentativeService;
    @Autowired
    private XcrAbnormalHouseholdTerminationService xcrAbnormalHouseholdTerminationService;
    @Autowired
    private XcrTaxAdministrativePenaltyService xcrTaxAdministrativePenaltyService;
    @Autowired
    private XcrCancelTaxRegistrationService xcrCancelTaxRegistrationService;
    @Autowired
    private XcrAffiliatedEnterpriseService xcrAffiliatedEnterpriseService;
    @Autowired
    private XcrInstallmentSubscriptionService xcrInstallmentSubscriptionService;
    @Autowired
    private XcrAdministrativeLicensingAgriculturalCollegesService xcrAdministrativeLicensingAgriculturalCollegesService;
    @Autowired
    private XcrEnterpriseExceptionListService xcrEnterpriseExceptionListService;
    @Autowired
    private XcrInvestorAbnormalRecordService xcrInvestorAbnormalRecordService;
    @Autowired
    private XcrEnterprisePublicityLicenseService xcrEnterprisePublicityLicenseService;
    @Autowired
    private XcrEnterprisePublicityEquityChangeService xcrEnterprisePublicityEquityChangeService;
    @Autowired
    private XcrSimplifiedCancellationAnnouncementService xcrSimplifiedCancellationAnnouncementService;
    @Autowired
    private XcrTaxRegistrationEstablishmentService xcrTaxRegistrationEstablishmentService;
    @Autowired
    private XcrEnterprisePublicityInvestorInformationStatusService xcrEnterprisePublicityInvestorInformationStatusService;
    @Autowired
    private XcrEnterprisePublicityDetailsContributionsContributorsService xcrEnterprisePublicityDetailsContributionsContributorsService;
    @Autowired
    private XcrEnterprisePublicationSupplySubscribedDetailsInvestorsService xcrEnterprisePublicationSupplySubscribedDetailsInvestorsService;
    @Autowired
    private XcrRevisionInformationAgriculturalCollegeAnnualReportService xcrRevisionInformationAgriculturalCollegeAnnualReportService;
    @Autowired
    private XcrStopBusinessInformationService xcrStopBusinessInformationService;
    @Autowired
    private XcrAbnormalHouseholdIdentificationService xcrAbnormalHouseholdIdentificationService;
    @Autowired
    private XcrIncomeTaxReturnService xcrIncomeTaxReturnService;
    @Autowired
    private XcrMainFinancialStatementsService xcrMainFinancialStatementsService;
    @Autowired
    private XcrInvoiceIssuanceService xcrInvoiceIssuanceService;
    @Autowired
    private XcrConfirmationTerminationService xcrConfirmationTerminationService;
    @Autowired
    private XcrTaxpayerCreditRatingService xcrTaxpayerCreditRatingService;
    @Autowired
    private XcrInstitutionalClientsService xcrInstitutionalClientsService;
    @Autowired
    private XcrRecordDishonestyService xcrRecordDishonestyService;
    @Autowired
    private XcrTechnologyPlanProjectService xcrTechnologyPlanProjectService;
    @Autowired
    private XcrTechnologyAwardSupplementService xcrTechnologyAwardSupplementService;
    @Autowired
    private XcrMinorEnterprisesService xcrMinorEnterprisesService;
    @Autowired
    private XcrInnovationPlatformService xcrInnovationPlatformService;
    @Autowired
    private XcrHighTechService xcrHighTechService;
    @Autowired
    private XcrFoodProductionLicenseDetaliService xcrFoodProductionLicenseDetaliService;
    @Autowired
    private XcrLegalRepresentativeService xcrLegalRepresentativeService;
    @Autowired
    private XcrFoodProductionLicenseService xcrFoodProductionLicenseService;
    @Autowired
    private XcrBasicSupplementAgriculturalCollegeAnnualService xcrBasicSupplementAgriculturalCollegeAnnualService;
    @Autowired
    private XcrEnterpriseBasicInformationService xcrEnterpriseBasicInformationService;
    @Autowired
    private XcrEnterpriseNameApprovalService xcrEnterpriseNameApprovalService;
    @Autowired
    private XcrSeriousIllegalDishonestEnterprisesService xcrSeriousIllegalDishonestEnterprisesService;
    @Autowired
    private XcrSeriousIllegalDishonestEnterprisesDetailService xcrSeriousIllegalDishonestEnterprisesDetailService;
    @Autowired
    private XcrEquityPledgeInfoService xcrEquityPledgeInfoService;
    @Autowired
    private XcrEquityFreezeService xcrEquityFreezeService;
    @Autowired
    private XcrEquityChangeInfoService xcrEquityChangeInfoService;
    @Autowired
    private XcrEquityFreezeExecutionService xcrEquityFreezeExecutionService;
    @Autowired
    private XcrAbnormalBusinessOperationsService xcrAbnormalBusinessOperationsService;
    @Autowired
    private XcrCheckWorkInfoService xcrCheckWorkInfoService;
    @Autowired
    private XcrPersonalRevokeRecordService xcrPersonalRevokeRecordService;
    @Autowired
    private XcrNoticeRecordService xcrNoticeRecordService;
    @Autowired
    private XcrWebsiteInfoService xcrWebsiteInfoService;
    @Autowired
    private XcrSmallAndMicroEnterprisesService xcrSmallAndMicroEnterprisesService;
    @Autowired
    private XcrAnnualReportUpdateService xcrAnnualReportUpdateService;
    @Autowired
    private XcrRandomInspectionTaskService xcrRandomInspectionTaskService;
    @Autowired
    private XcrAnnualReportExternalInvestmentService xcrAnnualReportExternalInvestmentService;
    @Autowired
    private XcrExternalGuaranteeService xcrExternalGuaranteeService;
    @Autowired
    private XcrRevokeInfoService xcrRevokeInfoService;
    @Autowired
    private XcrBranchOfficesInfoService xcrBranchOfficesInfoService;
    @Autowired
    private XcrLicenseInfoService xcrLicenseInfoService;
    @Autowired
    private XcrFoodBusinessLicenseService xcrFoodBusinessLicenseService;
    @Autowired
    private XcrMsAdministrativeLicenseService xcrMsAdministrativeLicenseService;
    @Autowired
    private XcrContactInformationService xcrContactInformationService;
    @Autowired
    private XcrFinancialManagerService xcrFinancialManagerService;
    @Autowired
    private XcrChangeFilingService xcrChangeFilingService;
    @Autowired
    private XcrSocialInsuranceDataService xcrSocialInsuranceDataService;
    @Autowired
    private XcrAgriculturalCollegeAnnualReportService xcrAgriculturalCollegeAnnualReportService;
    @Autowired
    private XcrInspectionResultsService xcrInspectionResultsService;
    @Autowired
    private XcrIndividualBusinessInformationService xcrIndividualBusinessInformationService;
    @Autowired
    private XcrIndustryCommerceService xcrIndustryCommerceService;
    @Autowired
    private XcrIndividualChangeInformationService xcrIndividualChangeInformationService;
    @Autowired
    private XcrIndividualCancellationService xcrIndividualCancellationService;
    @Autowired
    private XcrIndividualBusinessAbnormalityService xcrIndividualBusinessAbnormalityService;
    @Autowired
    private XcrMoveOutService xcrMoveOutService;
    @Autowired
    private XcrMoveInService xcrMoveInService;
    @Autowired
    private XcrDeregistrationService xcrDeregistrationService;
    @Autowired
    private XcrIndividualLicenseService xcrIndividualLicenseService;
    @Autowired
    private XcrCancellationService xcrCancellationService;
    @Autowired
    private XcrLiquidationBasicInfoService xcrLiquidationBasicInfoService;
    @Autowired
    private XcrLiquidationMemberInfoService xcrLiquidationMemberInfoService;
    @Autowired
    private XcrAbnormalOperationAnnouncementService xcrAbnormalOperationAnnouncementService;
    @Autowired
    private XcrFarmSpecialAbnormalDetailService xcrFarmSpecialAbnormalDetailService;
    @Autowired
    private XcrEnterpriseAnnualReportWebsiteService xcrEnterpriseAnnualReportWebsiteService;
    @Autowired
    private XcrEnterpriseAnnualReportShareholderService xcrEnterpriseAnnualReportShareholderService;
    @Autowired
    private XcrEnterpriseAnnualReportEquityChangeService xcrEnterpriseAnnualReportEquityChangeService;
    @Autowired
    private XcrRevokeRegistrationService xcrRevokeRegistrationService;
    @Autowired
    private XcrIndividualCancellationObjectionService xcrIndividualCancellationObjectionService;
    @Autowired
    private XcrAnnualReportBaseInfoService xcrAnnualReportBaseInfoService;
    @Autowired
    private XcrEnvironmentalPenaltyDecisionService xcrEnvironmentalPenaltyDecisionService;
    @Autowired
    private XcrEnterprisePollutionPermitInfoService xcrEnterprisePollutionPermitInfoService;
    @Autowired
    private XcrKeyPollutionSourcesService xcrKeyPollutionSourcesService;
    @Autowired
    private XcrAgriculturalSpecializedWebsiteService xcrAgriculturalSpecializedWebsiteService;
    @Autowired
    private XcrMajorMembersService xcrMajorMembersService;
    @Autowired
    private XcrAnSfcBranchinfoService xcrAnSfcBranchinfoService;
    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping("/a")
    public String hello(){
        executeServiceCall(() -> xcrCompanyInvestmentService.saveDataByUniCode("gateway/api/1/getGdjczxgxxByUniscid"), "gateway/api/1/getGdjczxgxxByUniscid");
        executeServiceCall(() -> xcrEquityChangeService.saveDataByUniCode("gateway/api/1/getGqczbgxxByUniscid"), "gateway/api/1/getGqczbgxxByUniscid");
        executeServiceCall(() -> xcrSupplementaryForeignInvestmentService.saveDataByUniCode("gateway/api/1/getWzbcxxByUniscid"), "gateway/api/1/getWzbcxxByUniscid");
        executeServiceCall(() -> xcrAppointDelegatesService.saveDataByUniCode("gateway/api/1/getWpdbxxByUniscid"), "gateway/api/1/getWpdbxxByUniscid");
        executeServiceCall(() -> xcrAgriculturalSupplementService.saveDataByUniCode("gateway/api/1/getNzbcxxByUniscid"), "gateway/api/1/getNzbcxxByUniscid");
        executeServiceCall(() -> xcrDomesticCapitalSupplementService.saveDataByUniCode("gateway/api/1/getNzbcxxByUniscid1"), "gateway/api/1/getNzbcxxByUniscid1");
        executeServiceCall(() -> xcrInstallmentPaymentService.saveDataByUniCode("gateway/api/1/getFqsjxxByUniscid"), "gateway/api/1/getFqsjxxByUniscid");
        executeServiceCall(() -> xcrInvestorSubscriptionDetailsService.saveDataByUniCode("gateway/api/1/getTzrrjxxByUniscid"), "gateway/api/1/getTzrrjxxByUniscid");
        executeServiceCall(() -> xcrNonNaturalPersonContributionService.saveDataByUniCode("gateway/api/1/getFzrrczxxByUniscid"), "gateway/api/1/getFzrrczxxByUniscid");
        executeServiceCall(() -> xcrNaturalPersonContributionsService.saveDataByUniCode("gateway/api/1/getZrrczxxByUniscid"), "gateway/api/1/getZrrczxxByUniscid");
        executeServiceCall(() -> xcrHistoryNameService.saveDataByUniCode("gateway/api/1/getLsmcxxByUnscid"), "gateway/api/1/getLsmcxxByUnscid");
        executeServiceCall(() -> xcrHistoricalLegalRepresentativeService.saveDataByUniCode("gateway/api/1/getLsfddbrxxByUniscid"), "gateway/api/1/getLsfddbrxxByUniscid");
        //非正常户接触信息
        executeServiceCall(() -> xcrAbnormalHouseholdTerminationService.saveDataByUniCode("gateway/api/1/getFzchjcxxByUniscid"), "gateway/api/1/getFzchjcxxByUniscid");
        executeServiceCall(() -> xcrTaxAdministrativePenaltyService.saveDataByUniCode("gateway/api/1/getSwxzcfxxByUniscid"), "gateway/api/1/getSwxzcfxxByUniscid");
        executeServiceCall(() -> xcrAffiliatedEnterpriseService.saveDataByUniCode("gateway/api/1/getLsqyxxByUniscid"), "gateway/api/1/getLsqyxxByUniscid");
        executeServiceCall(() -> xcrInstallmentSubscriptionService.saveDataByUniCode("gateway/api/1/getFqrjxxByUniscid"), "gateway/api/1/getFqrjxxByUniscid");
        executeServiceCall(() -> xcrAdministrativeLicensingAgriculturalCollegesService.saveDataByUniCode("gateway/api/1/getNznbxzxkxxByUniscid"), "gateway/api/1/getNznbxzxkxxByUniscid");
        executeServiceCall(() -> xcrEnterpriseExceptionListService.saveDataByUniCode("gateway/api/1/getQyycmlxxByUniscid1"), "gateway/api/1/getQyycmlxxByUniscid1");
        executeServiceCall(() -> xcrInvestorAbnormalRecordService.saveDataByUniCode("gateway/api/1/getQyjyycmlgdxxByUnsicd"), "gateway/api/1/getQyjyycmlgdxxByUnsicd");
        executeServiceCall(() -> xcrEnterprisePublicityLicenseService.saveDataByUniCode("gateway/api/1/getQygsxkxxByUniscid"), "gateway/api/1/getQygsxkxxByUniscid");
        executeServiceCall(() -> xcrEnterprisePublicityEquityChangeService.saveDataByUniCode("gateway/api/1/getQygsgqbgxxByUniscid"), "gateway/api/1/getQygsgqbgxxByUniscid");
        executeServiceCall(() -> xcrSimplifiedCancellationAnnouncementService.saveDataByUniCode("gateway/api/1/getJyzxggxxByUniscid"), "gateway/api/1/getJyzxggxxByUniscid");
        executeServiceCall(() -> xcrEnterprisePublicityInvestorInformationStatusService.saveDataByUniCode("gateway/api/1/getQygsczrxxqkByUniscid"), "gateway/api/1/getQygsczrxxqkByUniscid");
        executeServiceCall(() -> xcrEnterprisePublicityDetailsContributionsContributorsService.saveDataByUniCode("gateway/api/1/getCzrsjmxByUniscid"), "gateway/api/1/getCzrsjmxByUniscid");
        executeServiceCall(() -> xcrEnterprisePublicationSupplySubscribedDetailsInvestorsService.saveDataByUniCode("gateway/api/1/getQygsczrrjmxByUniscid"), "gateway/api/1/getQygsczrrjmxByUniscid");
        executeServiceCall(() -> xcrRevisionInformationAgriculturalCollegeAnnualReportService.saveDataByUniCode("gateway/api/1/getNznbxgxxByUniscid"), "gateway/api/1/getNznbxgxxByUniscid");
        executeServiceCall(() -> xcrBasicSupplementAgriculturalCollegeAnnualService.saveDataByUniCode("gateway/api/1/getNznbjbxxbcByUniscid"), "gateway/api/1/getNznbjbxxbcByUniscid");
        executeServiceCall(() -> xcrEnterpriseBasicInformationService.saveDataByUniCode("gateway/api/1/getQyjbxxByUniscid"), "gateway/api/1/getQyjbxxByUniscid");
        executeServiceCall(() -> xcrEnterpriseNameApprovalService.saveDataByUniCode("gateway/api/1/getQymcxxByUniscid"), "gateway/api/1/getQymcxxByUniscid");
        executeServiceCall(() -> xcrSeriousIllegalDishonestEnterprisesService.saveDataByUniCode("gateway/api/1/getYzwfsxqymdBydm"), "gateway/api/1/getYzwfsxqymdBydm");
        executeServiceCall(() -> xcrSeriousIllegalDishonestEnterprisesDetailService.saveDataByUniCode("gateway/api/1/getYzwfxxxxByUniscid"), "gateway/api/1/getYzwfxxxxByUniscid");
        executeServiceCall(() -> xcrEquityPledgeInfoService.saveDataByUniCode("gateway/api/1/getGqczdjxxBydm"), "gateway/api/1/getGqczdjxxBydm");
        executeServiceCall(() -> xcrEquityFreezeService.saveDataByUniCode("gateway/api/1/getGqdjxxByUniscid"), "gateway/api/1/getGqdjxxByUniscid");
        executeServiceCall(() -> xcrEquityChangeInfoService.saveDataByUniCode("gateway/api/1/getGqbgxxByUniscid"), "gateway/api/1/getGqbgxxByUniscid");
        executeServiceCall(() -> xcrEquityFreezeExecutionService.saveDataByUniCode("gateway/api/1/getGqdjbzxrxxByUniscid"), "gateway/api/1/getGqdjbzxrxxByUniscid");
        executeServiceCall(() -> xcrAbnormalBusinessOperationsService.saveDataByUniCode("gateway/api/1/getQyycmlxxxxByUniscid"), "gateway/api/1/getQyycmlxxxxByUniscid");
        executeServiceCall(() -> xcrCheckWorkInfoService.saveDataByUniCode("gateway/api/1/getJcgzxxByUniscid"), "gateway/api/1/getJcgzxxByUniscid");
        //注销税务登记信息(接口慢导致连接超时)
        //executeServiceCall(() -> xcrCancelTaxRegistrationService.saveDataByUniCode("gateway/api/1/getZxswdjxxByUniscid"), "gateway/api/1/getJcgzxxByUniscid");
        //税务登记设立信息
        //xcrTaxRegistrationEstablishmentService.saveDataByUniCode("gateway/api/1/getSwdjslxxByUniscid");
        //个体工商户停歇业信息
        executeServiceCall(() -> xcrStopBusinessInformationService.saveDataByUniCode("gateway/api/1/getGtgshtxyxxByUniscid"),"gateway/api/1/getGtgshtxyxxByUniscid");;
        //非正常户认定信息
        //xcrAbnormalHouseholdIdentificationService.saveDataByUniCode("gateway/api/1/getFzchrdxxByUniscid");
        //企业所得税申报信息
        //xcrIncomeTaxReturnService.saveDataByUniCode("gateway/api/1/getQysdssbxxByUniscid1");
        //财务报表主表
        executeServiceCall(() -> xcrMainFinancialStatementsService.saveDataByUniCode("gateway/api/1/getCwbbzbByUniscid"),"gateway/api/1/getCwbbzbByUniscid");
        //发票开票信息
        //xcrInvoiceIssuanceService.saveDataByUniCode("gateway/api/1/fpkpxxByUniscid");
        //非正常户认定解除信息表
        //xcrConfirmationTerminationService.saveDataByUniCode("gateway/api/1/getFzchrdjcxxbByUniscid");
        //纳税人信用等级
        executeServiceCall(() -> xcrTaxpayerCreditRatingService.saveDataByUniCode("gateway/api/1/getNsrxydjByUniscid"), "gateway/api/1/getNsrxydjByUniscid");
        // 机构客户信息
        executeServiceCall(() -> xcrInstitutionalClientsService.saveDataByUniCode("gateway/api/1/getJgkhxxByUnisicd"), "gateway/api/1/getJgkhxxByUnisicd");
        // 失信记录名单
        executeServiceCall(() -> xcrRecordDishonestyService.saveDataByUniCode("gateway/api/1/getSxjlmdByQymc"), "gateway/api/1/getSxjlmdByQymc");
        // 科技计划项目安排表
        executeServiceCall(() -> xcrTechnologyPlanProjectService.saveDataByUniCode("gateway/api/1/getKjjhxmapbByQymc"), "gateway/api/1/getKjjhxmapbByQymc");
        // 科技奖补项目及资金情况
        executeServiceCall(() -> xcrTechnologyAwardSupplementService.saveDataByUniCode("gateway/api/1/getKjjbxmjzjqkByQymc"), "gateway/api/1/getKjjbxmjzjqkByQymc");
        // 科技型中小企业名单
        executeServiceCall(() -> xcrMinorEnterprisesService.saveDataByUniCode("gateway/api/1/getKjxzxqymdByQymc"), "gateway/api/1/getKjxzxqymdByQymc");
        // 国家、省、市创新平台名单
        executeServiceCall(() -> xcrInnovationPlatformService.saveDataByUniCode("gateway/api/1/getCxptmd"), "gateway/api/1/getCxptmd");
        // 高新技术企业名单
        executeServiceCall(() -> xcrHighTechService.saveDataByUniCode("gateway/api/1/getGxjsqymdByUniscid"), "gateway/api/1/getGxjsqymdByUniscid");
        // 食品生产许可证品种明细
        executeServiceCall(() -> xcrFoodProductionLicenseDetaliService.saveDataByUniCode("gateway/api/1/getSpscxkzpzmxByUniscid"), "gateway/api/1/getSpscxkzpzmxByUniscid");
        // 食品生产法定代表人信息
        executeServiceCall(() -> xcrLegalRepresentativeService.saveDataByUniCode("gateway/api/1/getSpscfddbrxxByUniscid"), "gateway/api/1/getSpscfddbrxxByUniscid");
        // 食品生产许可证基本信息
        executeServiceCall(() -> xcrFoodProductionLicenseService.saveDataByUniCode("gateway/api/1/getSpscxkzjbxxByUniscid"), "gateway/api/1/getSpscxkzjbxxByUniscid");
        // 食品经营许可证基本信息
        executeServiceCall(() -> xcrFoodBusinessLicenseService.saveDataByUniCode("gateway/api/1/getSpjyxkzjbxxByUniscid"), "gateway/api/1/getSpjyxkzjbxxByUniscid");
        // 市场监管_行政许可信息
        executeServiceCall(() -> xcrMsAdministrativeLicenseService.saveDataByUniCode("gateway/api/1/getXzxkxxByUniscid"), "gateway/api/1/getXzxkxxByUniscid");
        // 联络员信息
        executeServiceCall(() -> xcrContactInformationService.saveDataByUniCode("gateway/api/1/getLlyxxByUniscid"), "gateway/api/1/getLlyxxByUniscid");
        // 财务负责人
        executeServiceCall(() -> xcrFinancialManagerService.saveDataByUniCode("gateway/api/1/getCwfzrByUniscid"), "gateway/api/1/getCwfzrByUniscid");
        executeServiceCall(() -> xcrPersonalRevokeRecordService.saveDataByUniCode("gateway/api/1/getGtdxxxByUniscid"), "gateway/api/1/getGtdxxxByUniscid");
        executeServiceCall(() -> xcrNoticeRecordService.saveDataByUniCode("gateway/api/1/getGsggxxByUniscid"), "gateway/api/1/getGsggxxByUniscid");
        executeServiceCall(() -> xcrWebsiteInfoService.saveDataByUniCode("gateway/api/1/getGtnbwzhwdxxByUniscid"), "gateway/api/1/getGtnbwzhwdxxByUniscid");
        executeServiceCall(() -> xcrSmallAndMicroEnterprisesService.saveDataByUniCode("gateway/api/1/getXwqymljbxxByUniscid"), "gateway/api/1/getXwqymljbxxByUniscid");
        executeServiceCall(() -> xcrAnnualReportUpdateService.saveDataByUniCode("gateway/api/1/getGtnbxgxxByUniscid"), "gateway/api/1/getGtnbxgxxByUniscid");
        executeServiceCall(() -> xcrRandomInspectionTaskService.saveDataByUniCode("gateway/api/1/getJcgzxxmlByUniscid"), "gateway/api/1/getJcgzxxmlByUniscid");
        executeServiceCall(() -> xcrAnnualReportExternalInvestmentService.saveDataByUniCode("gateway/api/1/getQynbdwtzxxByUniscid"), "gateway/api/1/getQynbdwtzxxByUniscid");
        executeServiceCall(() -> xcrExternalGuaranteeService.saveDataByUniCode("gateway/api/1/getQynbdwtgbzxxByUniscid"), "gateway/api/1/getQynbdwtgbzxxByUniscid");
        executeServiceCall(() -> xcrRevokeInfoService.saveDataByUniCode("gateway/api/1/getDxxxByUniscid"), "gateway/api/1/getDxxxByUniscid");
        executeServiceCall(() -> xcrBranchOfficesInfoService.saveDataByUniCode("gateway/api/1/getFzjgbaxxByUniscid1"), "gateway/api/1/getFzjgbaxxByUniscid1");
        executeServiceCall(() -> xcrLicenseInfoService.saveDataByUniCode("gateway/api/1/getXkxxByUniscid"), "gateway/api/1/getXkxxByUniscid");
        executeServiceCall(() -> xcrChangeFilingService.saveDataByUniCode("gateway/api/1/getBgbaxxByUniscid"), "gateway/api/1/getBgbaxxByUniscid");
        //executeServiceCall(() -> xcrSocialInsuranceDataService.saveDataByUniCode("gateway/api/1/getQynbshbxxxByUniscid"), "gateway/api/1/getQynbshbxxxByUniscid");
        executeServiceCall(() -> xcrAgriculturalCollegeAnnualReportService.saveDataByUniCode("gateway/api/1/getNznbjbxxByUniscid"), "gateway/api/1/getNznbjbxxByUniscid");
        //executeServiceCall(() -> xcrInspectionResultsService.saveDataByUniCode("gateway/api/1/getJcjgxxByUniscid"), "gateway/api/1/getJcjgxxByUniscid");
        // 个体经营者基本信息
        executeServiceCall(() -> xcrIndividualBusinessInformationService.saveDataByUniCode("gateway/api/1/getGtjyzjbxxByUniscid"), "gateway/api/1/getGtjyzjbxxByUniscid");
        // 个体工商户基本信息
        executeServiceCall(() -> xcrIndustryCommerceService.saveDataByUniCode("gateway/api/1/getGtgshjbxxByUniscid"), "gateway/api/1/getGtgshjbxxByUniscid");
        // 个体变更信息
        executeServiceCall(() -> xcrIndividualChangeInformationService.saveDataByUniCode("gateway/api/1/getGtbgxxByUniscid"), "gateway/api/1/getGtbgxxByUniscid");
        // 个体注销信息
        executeServiceCall(() -> xcrIndividualCancellationService.saveDataByUniCode("gateway/api/1/getGtzxxxByUniscid"), "gateway/api/1/getGtzxxxByUniscid");
        // 个体经营异常标记信息
        executeServiceCall(() -> xcrIndividualBusinessAbnormalityService.saveDataByUniCode("gateway/api/1/getGtjyycbjxxByUniscid"), "gateway/api/1/getGtjyycbjxxByUniscid");
        // 迁出信息
        executeServiceCall(() -> xcrMoveOutService.saveDataByUniCode("gateway/api/1/getQcxxByUniscid"), "gateway/api/1/getQcxxByUniscid");
        // 迁入信息
        executeServiceCall(() -> xcrMoveInService.saveDataByUniCode("gateway/api/1/getQrxxByUniscid"), "gateway/api/1/getQrxxByUniscid");
        // 撤销登记信息
        executeServiceCall(() -> xcrDeregistrationService.saveDataByUniCode("gateway/api/1/getCxdjxxByUniscid"), "gateway/api/1/getCxdjxxByUniscid");
        // 个体许可信息
        // executeServiceCall(() -> xcrIndividualLicenseService.saveDataByUniCode("gateway/api/1/getGtxkxxByUniscid"), "gateway/api/1/getGtxkxxByUniscid");
        // 注销信息
        executeServiceCall(() -> xcrCancellationService.saveDataByUniCode("gateway/api/1/getZxxxByUniscid"), "gateway/api/1/getZxxxByUniscid");
        // 清算基本信息
        executeServiceCall(() -> xcrLiquidationBasicInfoService.saveDataByUniCode("gateway/api/1/getQsjbxxByUniscid1"), "gateway/api/1/getQsjbxxByUniscid1");
        // 清算成员信息
        executeServiceCall(() -> xcrLiquidationMemberInfoService.saveDataByUniCode("gateway/api/1/getQscyxxByUniscid"), "gateway/api/1/getQscyxxByUniscid");
        // 经营异常公告批量名单信息
        executeServiceCall(() -> xcrAbnormalOperationAnnouncementService.saveDataByUniCode("gateway/api/1/getJyycggplmdxxByUniscid"), "gateway/api/1/getJyycggplmdxxByUniscid");
        // 农专异常名录详细信息
        executeServiceCall(() -> xcrFarmSpecialAbnormalDetailService.saveDataByUniCode("gateway/api/1/getNzycmlxxxxByUniscid"), "gateway/api/1/getNzycmlxxxxByUniscid");
        // 企业年报网站或网店信息
        executeServiceCall(() -> xcrEnterpriseAnnualReportWebsiteService.saveDataByUniCode("gateway/api/1/getQynbwzhwdxxByUniscid"), "gateway/api/1/getQynbwzhwdxxByUniscid");
        // 企业年报股东及出资信息
        // executeServiceCall(() -> xcrEnterpriseAnnualReportShareholderService.saveDataByUniCode("gateway/api/1/getQynbgdjczxxByUniscid"), "gateway/api/1/getQynbgdjczxxByUniscid");
        // 企业年报股权变更信息
        executeServiceCall(() -> xcrEnterpriseAnnualReportEquityChangeService.saveDataByUniCode("gateway/api/1/getQynbgqbgxxByUniscid"), "gateway/api/1/getQynbgqbgxxByUniscid");
        // 个体撤销登记信息
        executeServiceCall(() -> xcrRevokeRegistrationService.saveDataByUniCode("gateway/api/1/getGtcxdjxxByUniscid"), "gateway/api/1/getGtcxdjxxByUniscid");
        // 简易注销异议信息
        executeServiceCall(() -> xcrIndividualCancellationObjectionService.saveDataByUniCode("gateway/api/1/getJyzxyyxxByUniscid"), "gateway/api/1/getJyzxyyxxByUniscid");
        // 环保处罚决定情况信息
        executeServiceCall(() -> xcrEnvironmentalPenaltyDecisionService.saveDataByUniCode("gateway/api/1/getHbcfjdqkxxByUniscid"), "gateway/api/1/getHbcfjdqkxxByUniscid");
        // 企业排污许可信息
        executeServiceCall(() -> xcrEnterprisePollutionPermitInfoService.saveDataByUniCode("gateway/api/1/getQypwxkxxByUniscid"), "gateway/api/1/getQypwxkxxByUniscid");
        // 重点排污单位名录
        executeServiceCall(() -> xcrKeyPollutionSourcesService.saveDataByUniCode("gateway/api/1/getZdpwdwmlByShxyfwm"), "gateway/api/1/getZdpwdwmlByShxyfwm");
        // 农专年报网站或网店信息
        executeServiceCall(() -> xcrAgriculturalSpecializedWebsiteService.saveDataByUniCode("gateway/api/1/nznbwzhwdxxByUniscid"), "gateway/api/1/nznbwzhwdxxByUniscid");
        // 主要成员信息
        executeServiceCall(() -> xcrMajorMembersService.saveDataByUniCode("gateway/api/1/zyryxxByUniscid"), "gateway/api/1/zyryxxByUniscid");
        executeServiceCall(() -> xcrAnSfcBranchinfoService.saveDataByUniCode("gateway/api/1/getNznbfzjgxxByUniscid"), "gateway/api/1/getNznbfzjgxxByUniscid");
        return "成功";
    }
    /**
     * 执行服务调用，并处理可能出现的异常。
     * @param runnable 服务的具体方法
     * @param apiEndpoint API端点
     */
    private void executeServiceCall(Runnable runnable, String apiEndpoint) {
        try {
            runnable.run();
        } catch (Exception e) {
            // 可以在这里记录错误日志
            log.error(e.toString(),apiEndpoint+"接口同步失败");
        }
    }
    @GetMapping("/b")
    public String test(String address,String paramsValue){
        List<String> creditCodes = (List<String>) redisService.getList("creditCodes").get(0);
        for (String creditCode : creditCodes) {
            String s;
            try {
                s = xhRequestUtil.testHttpRequest(creditCode, address,paramsValue);
            } catch (Exception e) {
                break;
            }
            ss = s;
        }
        System.out.println("找到了,去浏览器拿结构建实体类");
        System.out.println(ss);
        return ss;
    }
    private String ss;
    @Autowired
    private RedisService redisService;
    @Autowired
    private TableDataClient tableDataClient;
    @GetMapping("/c")
    public String test2(){
        Result<List<EBaseinfo>> baseinfoAll = tableDataClient.getEBaseinfoAll();
        if(baseinfoAll.getCode() != 200){
            throw new RuntimeException(baseinfoAll.getMsg());
        }
        List<XcrEBaseinfo> xcrEBaseinfos = BeanUtil.copyToList(baseinfoAll.getData(), XcrEBaseinfo.class);
        List<String> list = xcrEBaseinfos.stream().map(XcrEBaseinfo::getUniscid).filter(StrUtil::isNotBlank).collect(Collectors.toList());
        redisTemplate.delete("creditCodes");
        redisService.saveList("creditCodes",list);
        List<String> list2 = xcrEBaseinfos.stream().map(XcrEBaseinfo::getEntname).filter(StrUtil::isNotBlank).collect(Collectors.toList());
        redisTemplate.delete("creditNames");
        redisService.saveList("creditNames",list2);
        return "成功";
    }
    @Autowired
    private XcrAdministrativeLicensingService xcrAdministrativeLicensingService;
    @Autowired
    private XcrAdministrativePenaltyService xcrAdministrativePenaltyService;
    @Autowired
    private XcrXinyonghuaihuaBaseInfoService xcrXinyonghuaihuaBaseInfoService;
    @Autowired
    private XcrOtherInfo36Service xcrOtherInfo36Service;
    @Autowired
    private XcrOtherInfo37Service xcrOtherInfo37Service;
    @Autowired
    private XcrOtherInfo38Service xcrOtherInfo38Service;
    @Autowired
    private XcrOtherInfo39Service xcrOtherInfo39Service;
    @Autowired
    private XcrTrustworthyIncentive42Service xcrTrustworthyIncentive42Service;
    @Autowired
    private  XcrDishonestyPunishment19Service xcrDishonestyPunishment19Service;
    @GetMapping("/d")
    public String test3(){
        //xhRequestUtil.requestXinyonghuanhuai();
        xcrAdministrativeLicensingService.saveDataByUniCode("interface/v1/doublePublic/findLicensingList");
        xcrAdministrativePenaltyService.saveDataByUniCode("interface/v1/doublePublic/findSanctionList");
        xcrXinyonghuaihuaBaseInfoService.saveDataByUniCode("interface/v1/datawarehouse/list");
        xcrOtherInfo36Service.saveDataByUniCode("interface/v1/datawarehouse/list");
        xcrOtherInfo37Service.saveDataByUniCode("interface/v1/datawarehouse/list");
        xcrOtherInfo38Service.saveDataByUniCode("interface/v1/datawarehouse/list");
        xcrOtherInfo39Service.saveDataByUniCode("interface/v1/datawarehouse/list");
        xcrTrustworthyIncentive42Service.saveDataByUniCode("interface/v1/datawarehouse/list");
        xcrDishonestyPunishment19Service.saveDataByUniCode("interface/v1/datawarehouse/list");
        return "成功";
    }
    @GetMapping("/e")
    public String test4(String address,@RequestParam(value = "inventoryId",defaultValue = "") Long inventoryId){
        List<String> creditCodes = (List<String>) redisService.getList("creditCodes").get(0);
        String s = "";
        for (String creditCode : creditCodes) {
            try {
                HashMap<String, Object> requestbodyMap = new HashMap<>();
                requestbodyMap.put("entityCode", creditCode);
                if(!Objects.equals(inventoryId, "")){
                    requestbodyMap.put("inventoryId",inventoryId);
                }
                s = xhRequestUtil.testHttpRequest(requestbodyMap, address);
            } catch (Exception e) {
                break;
            }
        }
        ss = s;
        System.out.println("找到了,去浏览器拿结构建实体类");
        System.out.println(ss);
        return ss;
    }

    @Autowired
    private XcrEBaseinfoService xcrEBaseinfoService;
    @GetMapping("/testClient")
    public Result testClient(){
        //xcrEBaseinfoService.saveDataByUniCode("123");
        //xcrAnnualReportBaseInfoService.saveDataByUniCode("123");
        //xcrEnterpriseAnnualReportShareholderService.saveDataByUniCode("123");
        xcrInspectionResultsService.saveDataByUniCode("");
        return Result.ok();
    }
}
