Commit d057309f authored by chase's avatar chase

fix bug

parent 4a272701
......@@ -479,12 +479,14 @@ public class ReportServiceImpl extends BaseService {
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) {
Cell cell = row.getCell(c);
if (cell == null) {
continue;//todo cell == null 如何处理
}
if (r <= addRowIndex + 1) {
if(r == addRowIndex + 1 && c>TaxesCalculateReportEnum.Column.Column_14.getIndex()){
assembleOriginalTemplateData(template,projectId,period,r,c,addRowIndex,cellTemplateList,cellTemplateConfigList);
}else{
String cellId = projectId + template.getId() + period + r + c;
if ((r - 1) >= 0 && (r - 1) < configIds.size()) {
cellId += configIds.get(configIds.size() - r);
......@@ -546,7 +548,26 @@ public class ReportServiceImpl extends BaseService {
if (r > 0 && r <= addRowIndex && hasHandDatas.contains(c)) {
addManualConfig(cellTemplate, cell, now, cellTemplateConfigList);
}
}
} else {
assembleOriginalTemplateData(template,projectId,period,r,c,addRowIndex,cellTemplateList,cellTemplateConfigList);
}
}
}
List<List<PeriodCellTemplate>> tmpList = CommonUtils.subListWithLen(cellTemplateList, CommonUtils.BATCH_NUM);
// tmpList.forEach(list -> cellTemplateMapper.batchInsert2(list));
tmpList.forEach(list -> periodCellTemplateMapper.batchInsert(list));//todo 批量插入优化
List<List<PeriodCellTemplateConfig>> tmpConfigList = CommonUtils.subListWithLen(cellTemplateConfigList, CommonUtils.BATCH_NUM);
tmpConfigList.forEach(list -> periodCellTemplateConfigMapper.batchInsert(list));
} catch (Exception e) {
logger.error("importTemplateExcelFile error.", e);
throw new ServiceException(ErrorMessage.SystemError);
}
}
public void assembleOriginalTemplateData(Template template, String projectId, Integer period,
Integer r, Integer c, Integer addRowIndex,
List<PeriodCellTemplate> cellTemplateList, List<PeriodCellTemplateConfig> cellTemplateConfigList) {
//查询原来行cell是否有CellTemplate
CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdEqualTo(template.getId()).andRowIndexEqualTo(r - addRowIndex).andColumnIndexEqualTo(c);
......@@ -614,19 +635,6 @@ public class ReportServiceImpl extends BaseService {
}
}
}
}
}
List<List<PeriodCellTemplate>> tmpList = CommonUtils.subListWithLen(cellTemplateList, CommonUtils.BATCH_NUM);
// tmpList.forEach(list -> cellTemplateMapper.batchInsert2(list));
tmpList.forEach(list -> periodCellTemplateMapper.batchInsert(list));//todo 批量插入优化
List<List<PeriodCellTemplateConfig>> tmpConfigList = CommonUtils.subListWithLen(cellTemplateConfigList, CommonUtils.BATCH_NUM);
tmpConfigList.forEach(list -> periodCellTemplateConfigMapper.batchInsert(list));
} catch (Exception e) {
logger.error("importTemplateExcelFile error.", e);
throw new ServiceException(ErrorMessage.SystemError);
}
}
private void addManualConfig(PeriodCellTemplate cellTemplate, Cell cell, Date now, List<PeriodCellTemplateConfig> list) {
PeriodCellTemplateConfig configManual = new PeriodCellTemplateConfig();
configManual.setId(distributedIdService.nextId());
......
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