Commit 5a340148 authored by lcl's avatar lcl

u

parent 447397f4
......@@ -190,33 +190,34 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
List<String> result = new LinkedList();//导入结果汇总
List<BusinessExcelDto> businessInfoList = null;
try {
businessInfoList = new ExcelUtils<>(BusinessExcelDto.class).importExcel(file.getInputStream(), 2);
businessInfoList = new ExcelUtils<>(BusinessExcelDto.class).importExcel(file.getInputStream(), 2);
if (CollectionUtil.isEmpty(businessInfoList)) return AjaxResult.error("文档中无项目信息,请按照模板文档格式上传");
} catch (Exception e) {
e.printStackTrace();
throw new ServiceException("数据导入失败,请检查文档格式是否有误!");
}
// List<BusinessExcelDto> businessInfoList = readBusinessInfoExcel.getExcelInfo(file);
if (CollectionUtil.isEmpty(businessInfoList)) return AjaxResult.error("文档中无项目信息,请按照模板文档格式上传");
for (BusinessExcelDto businessInfo : businessInfoList) {
//查询已有的项目名称
Integer count = businessInfoMapper.isRepetitionProjectName(businessInfo.getProjectName(), userId, businessInfo.getOwnerCompany());
row++;
if (count > 0) {
//如果存在,跳过该项目,不保存
// result.add("第" + row + "行的" + businessInfo.getProjectName() + "的项目已存在,跳过该项目,保存下一条");
log.info("第" + row + "行的" + businessInfo.getProjectName() + "的项目已存在,跳过该项目,保存下一条");
errorCount++;
} else {
// //查询已有的项目名称
// Integer count = businessInfoMapper.isRepetitionProjectName(businessInfo.getProjectName(), userId, businessInfo.getOwnerCompany());
// row++;
// if (count > 0) {
// //如果存在,跳过该项目,不保存
//// result.add("第" + row + "行的" + businessInfo.getProjectName() + "的项目已存在,跳过该项目,保存下一条");
// log.info("第" + row + "行的" + businessInfo.getProjectName() + "的项目已存在,跳过该项目,保存下一条");
// errorCount++;
// } else {
//保存到数据库
BusinessAddDto businessAddDto = new BusinessAddDto();
BeanUtil.copyProperties(businessInfo, businessAddDto);
businessAddDto.setUserId(userId);
try {
new BusinessInfoServiceImpl().insertBusinessInfo(businessAddDto);
// new BusinessInfoServiceImpl().insertBusinessInfo(businessAddDto);
this.insertBusinessInfo(businessAddDto);
rowSuccess++;
}catch (Exception e){
errorCount++;
}
}
// }
}
result.add("导入项目成功条数" + rowSuccess);
result.add("导入项目去重条数" + errorCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment