|
|
|
@ -20,6 +20,7 @@ import com.dreamchaser.depository_manage.security.pool.ExcelFileInfoPool; |
|
|
|
import com.dreamchaser.depository_manage.service.*; |
|
|
|
import com.dreamchaser.depository_manage.utils.*; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.apache.poi.ss.usermodel.Sheet; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
@ -117,7 +118,7 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
int maxThreadSize = Runtime.getRuntime().availableProcessors(); |
|
|
|
if (threadSize > maxThreadSize) { |
|
|
|
double temp = threadSize - maxThreadSize; |
|
|
|
maxThreadSize =(int)(Math.ceil(temp / maxThreadSize) * maxThreadSize); |
|
|
|
maxThreadSize = (int) (Math.ceil(temp / maxThreadSize) * maxThreadSize); |
|
|
|
} |
|
|
|
|
|
|
|
// 定义开启线程数目
|
|
|
|
@ -788,8 +789,23 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
param.put("typeId", typeId); |
|
|
|
} else { |
|
|
|
String typeName = excelVo.getTypeName(); |
|
|
|
MaterialType materialTypeByName = materialTypeService.findMaterialTypeByName(typeName); |
|
|
|
param.put("typeId", materialTypeByName.getOldId()); |
|
|
|
List<MaterialType> materialTypeByNames = materialTypeService.findMaterialTypeByName(typeName); |
|
|
|
|
|
|
|
Long oldId = null; |
|
|
|
if (materialTypeByNames.size() > 1) { |
|
|
|
List<Long> parentOldIdList = new ArrayList<>(); |
|
|
|
List<Long> OldIdList = new ArrayList<>(); |
|
|
|
for (MaterialType materialType : materialTypeByNames) { |
|
|
|
parentOldIdList.add(materialType.getParentId()); |
|
|
|
OldIdList.add(materialType.getOldId()); |
|
|
|
} |
|
|
|
OldIdList = (List<Long>) CollectionUtils.subtract(OldIdList, parentOldIdList); |
|
|
|
oldId = OldIdList.get(0); |
|
|
|
}else{ |
|
|
|
oldId = materialTypeByNames.get(0).getOldId(); |
|
|
|
} |
|
|
|
|
|
|
|
param.put("typeId", oldId); |
|
|
|
} |
|
|
|
param.put("id", excelVo.getId()); |
|
|
|
param.put("brand", excelVo.getBrand()); |
|
|
|
@ -1058,8 +1074,8 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
errMsg.add(msg); |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
MaterialType materialTypeByName = materialTypeService.findMaterialTypeByName(excelInfoForMaterial.getTypeName()); |
|
|
|
if (materialTypeByName == null) { |
|
|
|
List<MaterialType> materialTypeByName = materialTypeService.findMaterialTypeByName(excelInfoForMaterial.getTypeName()); |
|
|
|
if (materialTypeByName == null || materialTypeByName.size() == 0) { |
|
|
|
String s = dataIndex.get(i); |
|
|
|
String msg = s + "出现异常" + excelInfoForMaterial.getTypeName() + "的物料类型不存在"; |
|
|
|
errMsg.add(msg); |
|
|
|
|