Commit ebe46889 by wangweidong

土工平台修改

parent e2233e1f
...@@ -13,15 +13,69 @@ import java.util.List; ...@@ -13,15 +13,69 @@ import java.util.List;
public class CollectUtil { public class CollectUtil {
public static void main(String[] args) { public static void main(String[] args) {
File file = new File("D://界限含水率(联合测定)S-1.txt"); File file = new File("D://颗粒分析试验 GB SieveS-99.txt");
try { try {
FileInputStream io = new FileInputStream(file); FileInputStream io = new FileInputStream(file);
txt2StringWuxing(io); txt2StringKeliFenxi(io);
}catch (Exception e){ }catch (Exception e){
} }
} }
public static List<SoilExperimentCollectDataVO> txt2StringKeliFenxi(InputStream io){
StringBuilder result = new StringBuilder();
List<SoilExperimentCollectDataVO> dataList = new ArrayList<>();
try {
InputStreamReader inputReader = new InputStreamReader(io,"GBK");
BufferedReader brCheck = new BufferedReader(inputReader);//构造一个BufferedReader类来读取文件
BufferedReader br = new BufferedReader(inputReader);//构造一个BufferedReader类来读取文件
String s = null;
StringBuffer sbAll = new StringBuffer();
List<String> allStringList = new ArrayList<>();
String gcbh = "";
String sampleCode = "";
while((s = brCheck.readLine())!=null){
// s = s.replace("─","").replace("┌","").
// replace("┬","").replace("┐","").
// replace("├","").replace("┼","").
// replace("┴","").replace("└","").
// replace("┘","").replace("┤","").
// replace("─","").replace("─","");
System.out.println(s);
allStringList.add(s);
String content = s.replace(" ","");
sbAll.append(content);
}
System.out.println();
System.out.println(sampleCode);
}catch (Exception e){
}
return dataList;
}
public static List<SoilExperimentCollectDataVO> txt2StringWuxing(InputStream io){ public static List<SoilExperimentCollectDataVO> txt2StringWuxing(InputStream io){
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
List<SoilExperimentCollectDataVO> dataList = new ArrayList<>(); List<SoilExperimentCollectDataVO> dataList = new ArrayList<>();
......
...@@ -148,6 +148,8 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe ...@@ -148,6 +148,8 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public SoilReport generateReport(Long entrustId,Long templateId, Long[] expReportIds) { public SoilReport generateReport(Long entrustId,Long templateId, Long[] expReportIds) {
try {
RestAssert.fail(null == templateId,"请选择报告模板"); RestAssert.fail(null == templateId,"请选择报告模板");
RestAssert.fail(ArrayUtils.isEmpty(expReportIds),"请选择试验项目报告"); RestAssert.fail(ArrayUtils.isEmpty(expReportIds),"请选择试验项目报告");
SoilExpReportTemplate template = soilExpReportTemplateService.getById(templateId); SoilExpReportTemplate template = soilExpReportTemplateService.getById(templateId);
...@@ -341,7 +343,7 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe ...@@ -341,7 +343,7 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe
try { try {
workbook = new Workbook(exportToExcelInputStream(xssfWorkbook)); workbook = new Workbook(exportToExcelInputStream(xssfWorkbook));
}catch (Exception e){ }catch (Exception e){
logger.error(" workbook = new Workbook(exportToExcelInputStream(xssfWorkbook));"+e.getMessage());
} }
} }
for (SoilExpReport report:reportList) { for (SoilExpReport report:reportList) {
...@@ -351,7 +353,7 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe ...@@ -351,7 +353,7 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe
bookList.add(book); bookList.add(book);
} }
}catch (Exception e){ }catch (Exception e){
logger.error(" Workbook book = new Workbook(ossClient.download(report.getObjectKey()));"+e.getMessage());
} }
} }
for (SoilAppendix appendix:appendixList) { for (SoilAppendix appendix:appendixList) {
...@@ -362,7 +364,7 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe ...@@ -362,7 +364,7 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe
bookList.add(book); bookList.add(book);
} }
}catch (Exception e){ }catch (Exception e){
logger.error(" Workbook book = new Workbook(ossClient.download(appendix.getObjectKey()));;"+e.getMessage());
} }
} }
...@@ -397,6 +399,13 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe ...@@ -397,6 +399,13 @@ public class SoilExpReportServiceImpl extends BaseServiceImpl<SoilExpReportMappe
}else{ }else{
return null; return null;
} }
}catch (Exception e){
logger.error("生成汇总报告失败------"+e.getMessage());
RestAssert.fail("生成失败,请联系管理员!");
}
return null; return null;
} }
......
...@@ -3168,6 +3168,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap ...@@ -3168,6 +3168,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
replaceMap.put("#{title}","附录"+(count)+" "+type.getExperiment()+"试验成果图\n" + replaceMap.put("#{title}","附录"+(count)+" "+type.getExperiment()+"试验成果图\n" +
"APPENDIX "+count+" "+testEnglish); "APPENDIX "+count+" "+testEnglish);
replaceMap.put("#{reportCode}",StringHandleUtils.getString(type.getEntrustCode()));
try { try {
HSSFWorkbookUtil.replaceModel(replaceMap,xssfWorkbook); HSSFWorkbookUtil.replaceModel(replaceMap,xssfWorkbook);
HSSFWorkbookUtil.insertImage(xssfWorkbook,fileMap,true); HSSFWorkbookUtil.insertImage(xssfWorkbook,fileMap,true);
......
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