Class FaqExcelReader

java.lang.Object
com.bytedesk.kbase.faq.batch.FaqExcelReader
All Implemented Interfaces:
org.springframework.batch.item.ItemReader<FaqExcel>

@Component public class FaqExcelReader extends Object implements org.springframework.batch.item.ItemReader<FaqExcel>
实现Spring Batch的ItemReader接口,用于读取Excel文件中的FAQ数据
  • Field Details

    • resource

      private org.springframework.core.io.Resource resource
    • items

      private Queue<FaqExcel> items
    • initialized

      private Boolean initialized
  • Constructor Details

    • FaqExcelReader

      public FaqExcelReader()
  • Method Details

    • setResource

      public void setResource(org.springframework.core.io.Resource resource)
    • read

      public FaqExcel read() throws Exception, org.springframework.batch.item.UnexpectedInputException, org.springframework.batch.item.ParseException, org.springframework.batch.item.NonTransientResourceException
      读取下一个FAQ记录
      Specified by:
      read in interface org.springframework.batch.item.ItemReader<FaqExcel>
      Throws:
      Exception
      org.springframework.batch.item.UnexpectedInputException
      org.springframework.batch.item.ParseException
      org.springframework.batch.item.NonTransientResourceException
    • initialize

      private void initialize() throws IOException
      初始化并预加载所有Excel数据
      Throws:
      IOException