Commit 81165497 by lijingjing

修改报告问题;

parent 63785439
......@@ -62,7 +62,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
@Autowired
private IEntrustReportTemplateConfigService entrustReportTemplateConfigService;
@Autowired
private OssClient ossClient;
......@@ -363,62 +362,62 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
e.printStackTrace();
}
List<OriginalTemplateConfig> configList = originalTemplateConfigService.list(Condition.create().eq("template_id",templateId));
OriginalUtil.doReplace(xssfWorkbook,entrust);
XSSFSheet sheetOne = xssfWorkbook.getSheetAt(0);
String sheetName = sheetOne.getSheetName();
System.out.println(sheetName);
sheetOne.setForceFormulaRecalculation(true);
Integer beginRow = sysFileTemplate.getSampleBeginRow();
int sampleMergerNum = sysFileTemplate.getSampleMergerNum();
int templateSampleNum = sysFileTemplate.getTemplateSampleNum();
if (templateSampleNum>=sampleVOList.size()){
for (EntrustSampleVO vo:sampleVOList) {
List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId());
vo.setIndexList(indexList);
XSSFRow xssfRow = sheetOne.getRow(beginRow);
for (OriginalTemplateConfig 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;
}
String generated = entrust.getCode();
FileOutputStream os = null;
File file = null;
try {
file = File.createTempFile(generated, ".docx");
os = new FileOutputStream(file);
xssfWorkbook.write(os);
os.flush();
entrustReportService.uploadReportGenerateDocx(entrust,ids, account, StringHandleUtils.join(sampleNameSet),"报告生成", file);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
xssfWorkbook.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
io.close();
} catch (IOException e) {
e.printStackTrace();
}
FileUtils.deleteFiles(file);
}
List<EntrustReportTemplateConfig> configList = entrustReportTemplateConfigService.list(Condition.create().eq("template_id", templateId));
OriginalUtil.doReplace(xssfWorkbook, entrust);
XSSFSheet sheetOne = xssfWorkbook.getSheetAt(0);
String sheetName = sheetOne.getSheetName();
System.out.println(sheetName);
sheetOne.setForceFormulaRecalculation(true);
Integer beginRow = sysFileTemplate.getSampleBeginRow();
int sampleMergerNum = sysFileTemplate.getSampleMergerNum();
int templateSampleNum = sysFileTemplate.getTemplateSampleNum();
if (templateSampleNum >= sampleVOList.size()) {
for (EntrustSampleVO vo : sampleVOList) {
List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId());
vo.setIndexList(indexList);
XSSFRow xssfRow = sheetOne.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;
}
String generated = entrust.getCode();
FileOutputStream os = null;
File file = null;
try {
file = File.createTempFile(generated, ".xlsx");
os = new FileOutputStream(file);
xssfWorkbook.write(os);
os.flush();
entrustReportService.uploadReportGenerateDocx(entrust, ids, account, StringHandleUtils.join(sampleNameSet), "报告生成", file);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
xssfWorkbook.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
io.close();
} catch (IOException e) {
e.printStackTrace();
}
FileUtils.deleteFiles(file);
}
} else {
int insertRow = beginRow + sampleMergerNum * templateSampleNum;
......
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