Commit 8752777f by wangweidong

hmhj优化报告生成

parent ed434bba
...@@ -418,10 +418,11 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe ...@@ -418,10 +418,11 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
String sheetName = sheetOne.getSheetName(); String sheetName = sheetOne.getSheetName();
System.out.println(sheetName); System.out.println(sheetName);
sheetOne.setForceFormulaRecalculation(true); sheetOne.setForceFormulaRecalculation(true);
Integer beginRow = sysFileTemplate.getSampleBeginRow();
int sampleMergerNum = sysFileTemplate.getSampleMergerNum(); int sampleMergerNum = sysFileTemplate.getSampleMergerNum();
int templateSampleNum = sysFileTemplate.getTemplateSampleNum(); int templateSampleNum = sysFileTemplate.getTemplateSampleNum();
if (templateSampleNum >= sampleVOList.size()) { if (templateSampleNum >= sampleVOList.size()) {
Integer beginRow = sysFileTemplate.getSampleBeginRow();
for (EntrustSampleVO vo : sampleVOList) { for (EntrustSampleVO vo : sampleVOList) {
List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId()); List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId());
vo.setIndexList(indexList); vo.setIndexList(indexList);
...@@ -470,6 +471,43 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe ...@@ -470,6 +471,43 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
} }
} else { } else {
if (null!=sysFileTemplate.getMoreSheet()&&sysFileTemplate.getMoreSheet()==1){
int total= sampleVOList.size();
int totalSheetSize = (total+templateSampleNum-1)/templateSampleNum;
List<List<EntrustSampleVO>> listList = Lists.partition(sampleVOList,templateSampleNum);
for (int i = 1; i < totalSheetSize; i++) {
xssfWorkbook.cloneSheet(0,sheetOne.getSheetName()+(i+1));
}
for (int k = 0; k < listList.size(); k++) {
Integer beginRow = sysFileTemplate.getSampleBeginRow();
List<EntrustSampleVO> sampleVOListIndex = listList.get(k);
for (EntrustSampleVO vo : sampleVOListIndex) {
List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId());
vo.setIndexList(indexList);
XSSFSheet sheetOneIndex= xssfWorkbook.getSheetAt(k);
XSSFRow xssfRow = sheetOneIndex.getRow(beginRow);
for (EntrustReportTemplateConfig config : configList) {
XSSFCell cell = xssfRow.getCell(config.getColumnPlace());
if ("sn".equals(config.getDataAttribute())) {
continue;
}
if (StringUtils.isBlank(config.getDataAttribute())) {
continue;
}
String value = StringHandleUtils.getFieldValue(config.getDataAttribute(), vo);
cell.setCellValue(value);
}
beginRow += sampleMergerNum;
}
}
}else {
Integer beginRow = sysFileTemplate.getSampleBeginRow();
int insertRow = beginRow + sampleMergerNum * templateSampleNum; int insertRow = beginRow + sampleMergerNum * templateSampleNum;
XSSFRow zeroRow = sheetOne.getRow(beginRow); XSSFRow zeroRow = sheetOne.getRow(beginRow);
XSSFCellStyle cellStyle = zeroRow.getCell(0).getCellStyle(); XSSFCellStyle cellStyle = zeroRow.getCell(0).getCellStyle();
...@@ -489,8 +527,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe ...@@ -489,8 +527,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
} }
} }
int sn = 1; int sn = 1;
for (EntrustSampleVO vo : sampleVOList) { for (EntrustSampleVO vo : sampleVOList) {
XSSFRow xssfRow = sheetOne.getRow(beginRow); XSSFRow xssfRow = sheetOne.getRow(beginRow);
List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId()); List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId());
...@@ -534,6 +570,9 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe ...@@ -534,6 +570,9 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
} }
} }
} }
}
String generated = entrust.getCode(); String generated = entrust.getCode();
FileOutputStream os = null; FileOutputStream os = null;
File file = null; File file = null;
......
ALTER TABLE "public"."entrust_report_template"
ALTER TABLE "public"."entrust_report_template"
ADD COLUMN "more_sheet" int2 DEFAULT 0;
COMMENT ON COLUMN "public"."entrust_report_template"."more_sheet" IS '多Sheet模板(0否1是)';
\ No newline at end of file
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