java program considering import data in table

A front end

    1. Select the imported file to do the most basic file format judgment as to meet the requirements.

    2. Click Import, to request before the back-end, give the page a friendly prompt "the data being imported, wait ..." etc.

Second, the back-end

    1. Although the leading end of the file format determination has been done, but the safety concerns (request interface by preventing direct URL), so the code is repeated once again determine the format of the file.

    2. The size of the file is determined, if it is an empty file or exceeds the maximum limit (limit herein comprises two [① file size itself, such as 3M ② content can not exceed the length of the file, such as not more than 10,000 data ]), an error message is returned directly to the front end.

    3. parse files (java commonly used XSSFWorkbook), resolution includes parsing the file [file into the field whether the format template requirements, for example, required field is missing, the content meets the requirements, the ranks of some of the others whether the content is empty, lost, the existence of duplicate data file, what data resolution failed, and so on].

    4. If successful parse is complete, the file is a batch (for the case of large data files, in order to improve efficiency and stability into the database), the general file data 500 is divided into 1000 pieces, the time database insert about 500, not a one-time all the data into the database.

    5. Finally the insertion process, the insertion fails, and data analysis of failure data is returned to the front end of the display.

Guess you like

Origin www.cnblogs.com/woniufei/p/11532842.html