Просмотр файла Excel с Java Apoi - PullRequest
0 голосов
/ 09 апреля 2020

Здравствуйте, я пытаюсь просмотреть файл Excel с весенней загрузкой, но я получаю первую строку в базе данных, поэтому, что мне нужно сделать, чтобы добавить другую строку в моей базе данных с этим кодом, я просто получаю первую строку, мне нужно импортировать все строки в моей базе данных, пожалуйста, что мне нужно сделать, чтобы файл стал передний конец реагировать js загрузить файл

код:

@PostMapping("/upload")
public ResponseEntity<?> addRfp  (@RequestParam("file") MultipartFile file) throws IOException, InvalidFormatException  {
    ZipSecureFile.setMinInflateRatio(0);



    FileInputStream fis =  (FileInputStream) file.getInputStream();
    XSSFWorkbook myWorkBook = new XSSFWorkbook (fis);
    XSSFSheet mySheet = myWorkBook.getSheetAt(0);
    Iterator<Row> rowIterator = mySheet.iterator();
    while (rowIterator.hasNext()) {
        Row row = rowIterator.next();
        Iterator<Cell> cellIterator = row.cellIterator();
        while (cellIterator.hasNext()) {       
            Cell cell = cellIterator.next();
            final DataFormatter df = new DataFormatter();
            Rfp rfp = new Rfp();
            //String line = cell.getStringCellValue();


           rfp.setIde(df.formatCellValue(row.getCell(0)));
           rfp.setUnit(df.formatCellValue(row.getCell(1)));
            rfp.setRFPID(df.formatCellValue(row.getCell(2)));
            rfp.setREQUESTID(df.formatCellValue(row.getCell(3)));
            rfp.setINCOMING(df.formatCellValue(row.getCell(4)));
            rfp.setPROJECTTITLE(df.formatCellValue(row.getCell(5)));
            rfp.setSERVICELINE(df.formatCellValue(row.getCell(6)));
            rfp.setBUSINESSUNIT(df.formatCellValue(row.getCell(7)));
            rfp.setREQUSITIONBUSINESSUNIT(df.formatCellValue(row.getCell(8)));
            rfp.setCOUNTRY(df.formatCellValue(row.getCell(9)));
            rfp.setTARGETPROPOSE(df.formatCellValue(row.getCell(10)));
            rfp.setRFX(df.formatCellValue(row.getCell(11)));
            rfp.setWORKFLOWTRACKING(df.formatCellValue(row.getCell(12)));
            rfp.setPROTOCOL(df.formatCellValue(row.getCell(13)));
            rfp.setJOURFIXKUNDE(df.formatCellValue(row.getCell(14)));
            rfp.setREJECTEDSTATUS(df.formatCellValue(row.getCell(15)));
            rfp.setCLOSEDREASON(df.formatCellValue(row.getCell(16)));
            rfp.setPRACTICE(df.formatCellValue(row.getCell(17)));
            rfp.setSTARTDATE(df.formatCellValue(row.getCell(18)));
            rfp.setENDDATE(df.formatCellValue(row.getCell(19)));
            rfp.setVERTRAGSART(df.formatCellValue(row.getCell(20)));
            rfp.setRFPCOMMENT(df.formatCellValue(row.getCell(21)));
            rfp.setPERSONDAYS(df.formatCellValue(row.getCell(22)));
            rfp.setACCOUNTEXECUTIVE(df.formatCellValue(row.getCell(23)));
            rfp.setACCOUNTSALESMANAGER(df.formatCellValue(row.getCell(24)));
            rfp.setEXPERTSALES(df.formatCellValue(row.getCell(25)));
            rfp.setDELIVERYUNIT(df.formatCellValue(row.getCell(26)));
            rfp.setDELIVERYRESPONSIBLE(df.formatCellValue(row.getCell(27)));
            rfp.setREQUISITIONER(df.formatCellValue(row.getCell(28)));
            rfp.setPROCUREMENT(df.formatCellValue(row.getCell(29)));
            rfp.setREFERENCENUMBER(df.formatCellValue(row.getCell(30)));
            rfp.setATOSCONTRACTNO(df.formatCellValue(row.getCell(31)));
            rfp.setCANDIDATES(df.formatCellValue(row.getCell(32)));
            rfp.setITEC(df.formatCellValue(row.getCell(33)));
            rfp.setTCV(df.formatCellValue(row.getCell(34)));
            rfp.setUPDATED(df.formatCellValue(row.getCell(35)));
            rfp.setUPDATEDBY(df.formatCellValue(row.getCell(36)));
            rfp.setPORTFOLIO(df.formatCellValue(row.getCell(37)));
            rfp.setPATH(df.formatCellValue(row.getCell(38)));
            rfp.setRMPROTOCOL(df.formatCellValue(row.getCell(39)));
            rfp.setRM(df.formatCellValue(row.getCell(40)));
            rfp.setWFM_ID(df.formatCellValue(row.getCell(41)));
            rfp.setNEEDCONFOPART(df.formatCellValue(row.getCell(42)));
            rfp.setCONFIRMATIONOFPARTICIPATION(df.formatCellValue(row.getCell(43)));
            rfp.setPROPOSE(df.formatCellValue(row.getCell(44)));
            rfp.setLASTCALL(df.formatCellValue(row.getCell(45)));
            rfp.setLASTCALLDATE(df.formatCellValue(row.getCell(46)));
            rfp.setSKILLS(df.formatCellValue(row.getCell(47)));
            rfp.setLEISTUNGSERBRINGUNG(df.formatCellValue(row.getCell(48)));
            rfp.setROLLEFUNKTION(df.formatCellValue(row.getCell(49)));
            rfp.setINHALTSCOPE(df.formatCellValue(row.getCell(50)));
            rfp.setLAUFZEITPERSPEKTIVE(df.formatCellValue(row.getCell(51)));
            rfp.setLAUFZEITANGEFRAGT(df.formatCellValue(row.getCell(52)));
            rfp.setPHASE(df.formatCellValue(row.getCell(53)));
            rfp.setFRISTVERLAENGERUNG(df.formatCellValue(row.getCell(54)));
            rfp.setCLOSEDSTATUS(df.formatCellValue(row.getCell(55)));
            rfp.setDEFERRED_TILL(df.formatCellValue(row.getCell(56)));
            rfp.setSIPA_YN(df.formatCellValue(row.getCell(57)));
            rfp.setPO_NO(df.formatCellValue(row.getCell(58)));
            rfp.setNESSIE_NO(df.formatCellValue(row.getCell(59)));
            rfp.setNUMBER_OF_PERSONS(df.formatCellValue(row.getCell(60)));
            rfp.setATT_JOB_SITE(df.formatCellValue(row.getCell(61)));
            rfp.setATT_LANGUAGE(df.formatCellValue(row.getCell(62)));
            rfp.setATT_MAIN_TOPICS(df.formatCellValue(row.getCell(63)));
            rfp.setREF_RFPID(df.formatCellValue(row.getCell(64)));
            rfp.setREF_HISTORY(df.formatCellValue(row.getCell(65)));
            rfp.setREF_REJECTIONS(df.formatCellValue(row.getCell(66)));
            rfp.setRV_REJ_STATUS_DETAILS(df.formatCellValue(row.getCell(67)));
            rfp.setRV_ALLIANCE_MANAGER(df.formatCellValue(row.getCell(68)));
            rfp.setRV_FINAL_STATUS(df.formatCellValue(row.getCell(69)));
            rfp.setRV_CUST_LIST_DATE(df.formatCellValue(row.getCell(70)));
            rfp.setRV_FINAL_NOTE(df.formatCellValue(row.getCell(71)));
            rfp.setRV_ATOS_ROOT_CAUSES(df.formatCellValue(row.getCell(72)));
            rfp.setCURRENCY(df.formatCellValue(row.getCell(73)));
            rfp.setEXTERNALID(df.formatCellValue(row.getCell(74)));
            rfp.setRESULTSTATUS(df.formatCellValue(row.getCell(75)));
            rfp.setREASONCODE(df.formatCellValue(row.getCell(76)));
            rfp.setSYSID(df.formatCellValue(row.getCell(77)));
            rfp.setNCRM_COMMENT(df.formatCellValue(row.getCell(78)));
            rfp.setIDEMAND_COMMENT(df.formatCellValue(row.getCell(79)));
            rfp.setOFFSHORE_COMMENT(df.formatCellValue(row.getCell(80)));
            rfp.setRV_RC_UPDBY(df.formatCellValue(row.getCell(81)));
            rfp.setRV_RC_DATE(df.formatCellValue(row.getCell(82)));
            rfp.setRV_FINALCOMMENT(df.formatCellValue(row.getCell(83)));
            rfp.setRV_FINALDATE(df.formatCellValue(row.getCell(84)));
            rfp.setTCV_EURO(df.formatCellValue(row.getCell(85)));
            rfp.setREM_ACTIVE(df.formatCellValue(row.getCell(86)));
            rfp.setREM_SEND(df.formatCellValue(row.getCell(87)));
            rfp.setREMCOP_ACTIVE(df.formatCellValue(row.getCell(88)));
            rfp.setREMCOP_SEND(df.formatCellValue(row.getCell(89)));
            rfp.setIDEMAND(df.formatCellValue(row.getCell(90)));
            rfp.setIDEMAND_URL(df.formatCellValue(row.getCell(91)));
            rfp.setLABOUR_LEASING_YN(df.formatCellValue(row.getCell(92)));
            rfp.setCAS_NO(df.formatCellValue(row.getCell(93)));
            rfp.setPROLONGATION(df.formatCellValue(row.getCell(94)));
            rfp.setRV_SKILLS_MISS_1(df.formatCellValue(row.getCell(95)));
            rfp.setRV_SKILLS_MISS_2(df.formatCellValue(row.getCell(96)));
            rfp.setRV_SKILLS_MISS_3(df.formatCellValue(row.getCell(97)));
            rfp.setREF_RENEWAL_DATE(df.formatCellValue(row.getCell(98)));
            rfprepository.save(rfp);


    return null;}
    }
    return null;    
}}
...