|
|
|
@ -9,6 +9,7 @@ import com.xujie.sys.modules.reader.entity.EquipmentFolderLocation; |
|
|
|
import com.xujie.sys.modules.reader.service.EquipmentFolderLocationService; |
|
|
|
import com.xujie.sys.modules.reader.service.GetInformationForExcelService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
@ -35,6 +36,9 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
|
public void saveByExcel() { |
|
|
|
//获取每一个文件夹路径 |
|
|
|
List<EquipmentFolderLocation> locationList = equipmentFolderLocationService.list(); |
|
|
|
if(CollectionUtils.isEmpty(locationList)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
//创建线程池 |
|
|
|
ExecutorService executorService = Executors.newFixedThreadPool(locationList.size());//线程池的最大数量为文件夹的个数 |
|
|
|
for (EquipmentFolderLocation excel : locationList) { |
|
|
|
@ -58,6 +62,9 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
|
List<EquipmentDataDetail> equipmentDataDetails =new ArrayList<>(); |
|
|
|
//获取文件夹下所有文件 |
|
|
|
List<File> files=getExcelFiles(folderFiler); |
|
|
|
if(CollectionUtils.isEmpty(files)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
//创建一个list用来存储所有的的excel文件路径 |
|
|
|
List<String> fileName = new ArrayList<>(); |
|
|
|
for (File file : files) { |
|
|
|
|