Problems encountered when importing easyPoi, when importing 5,000 pieces of data is stuck for 5 minutes with verification

1: Haha, at the beginning I also saw various recommendations that easypoi is so good. Then I believed it. Did not do any stress test. Just use it.

2: When easypoi is imported, you can add annotations for verification, and the verified fields must all be strings.

Then turn on the verification, the annotation can only control the verification of one move. If some data needs to be queried in the database, it is indeed possible to query through the corresponding interface of the easypoi framework. However, the key question is here. When our data volume is 5,000, a special card takes about 5 minutes. Because each piece of data I import needs to be verified and the database needs to be queried, the importExcelByIs method under the ExcelImportService class of the framework must be required.

return new ExcelImportService().importExcelByIs(inputstream, pojoClass, params, true);

One of the pitfalls of this method is that the needMore parameter must be set to true. Otherwise, the verification result cannot be obtained.

The corresponding logic is the main point of the pit mother. The loop inside this is a 5000*5000 loop. And cycled 2 times.

In fact, I just want a list of wrong data. I don't need other things, but the methods in this one can't do it. You can look at the source code first and then decide whether it is applicable. The logic inside is done by a single thread. Slow and stuck. Originally, I mentioned it all. no way. lag. I must do it all over again.

I have thought about adding easypoi's official QQ group to respond to this problem. Although joining the group 10 fast, I think it is acceptable. But because I didn't bind the qq wallet, I gave up.

3: Time is tight. I still wrote this blog with my heart. To prevent future generations from encountering the same problem as me. Maybe the understanding I described is wrong. Welcome everyone to correct me.

4: I uploaded the uploads and downloads that I reused in the project to my personal resource library. You can download it on demand.

 

Resource download address: https://download.csdn.net/download/lileronglilerong/12308637

No points are required. for reference only. The logic inside was written in 18 years. If something is not applicable, you can make modifications according to the actual situation.

If the amount of data is large, you use multiple threads for processing.

Guess you like

Origin blog.csdn.net/lileronglilerong/article/details/84636710