/*
 * @Author: Kane
 * 
 * @Date: 2025-03-11 09:27:40
 * 
 * @LastEditors: Kane
 * 
 * @FilePath: /cpicxim-XMNHSA-repeater/src/main/java/com/cpic/xim/huixiabao/AppMain.java
 * 
 * @Description:
 * 
 * Copyright (c) ${2023} by Kane, All Rights Reserved.
 */
package com.cpic.xim.huixiabao;

import java.util.Vector;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.cpic.xim.huixiabao.data.config.HuixiabaoConfig;
import com.cpic.xim.huixiabao.data.pojo.HmbXyxInfo;
import com.cpic.xim.huixiabao.nhs.CpicximToXMNHS;

public class AppMain
{
    private static Logger logger = LoggerFactory.getLogger( AppMain.class );

    public static void main( String[] args )
    {
        doPostXyxInfo();

        System.out.println( "Hello World!" );
    }

    private static void doPostXyxInfo()
    {
        while ( true )
        {
            Vector<HmbXyxInfo> xyxInfo = CpicximToXMNHS.getNeverTransHmbList();

            // 发送
            if ( xyxInfo.isEmpty() == false )
            {
                logger.info( "查询到" + String.valueOf( xyxInfo.size() ) + "条数据，开始发送！" );
                
                CpicximToXMNHS.postHmbXyxInfo( xyxInfo );
            }

            try
            {
                logger.info( "等待" + String.valueOf( HuixiabaoConfig.getSleepSeconds() ) + "秒。" );
                Thread.sleep( HuixiabaoConfig.getSleepSeconds() * 1000 );
            }
            catch ( InterruptedException error )
            {
                logger.error( "sleep时出错：" + error.getMessage() );
            }
        }
    }
}
