|
|
@@ -87,9 +87,6 @@ public class RateService {
|
|
|
//承办过
|
|
|
dataMap.put("undertake", rate.isUndertakeExamination() ? "是" : "否");
|
|
|
//考级机构名称
|
|
|
-// if (rate.isUndertakeExamination()) {
|
|
|
-// dataMap.put("examination", String.join(",", rate.getExamination()));
|
|
|
-// }
|
|
|
Set<Long> ids = collaborateRepo.findAllByRateId(rate.getId())
|
|
|
.stream()
|
|
|
.map(Collaborate::getGradingOrganizationId)
|
|
|
@@ -112,8 +109,6 @@ public class RateService {
|
|
|
StringWriter writer = new StringWriter();
|
|
|
Template template = configuration.getTemplate("RateTemplate.ftl", "utf-8");//以utf-8的编码读取ftl文件
|
|
|
template.process(dataMap, writer);
|
|
|
- System.out.println(writer.toString());
|
|
|
-
|
|
|
return writer.toString();
|
|
|
} catch (Exception e) {
|
|
|
log.error("生成word错误", e);
|
|
|
@@ -121,30 +116,86 @@ public class RateService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void upLoad(Rate rate) {
|
|
|
+ public List<File> upLoad(Rate rate) {
|
|
|
+ List<File> files = new ArrayList<>();
|
|
|
String uri = "http://192.168.50.238:8080/word2pdf";
|
|
|
// 表格
|
|
|
String export = this.export(rate);
|
|
|
InputStream is = new ByteArrayInputStream(export.getBytes());
|
|
|
- String filename = "审核材料";
|
|
|
- AtomicInteger num = new AtomicInteger(1);
|
|
|
+ File file = new File("/Users/qiufangchao/Desktop/" + "申请表" + ".pdf");
|
|
|
HttpRequest.post(uri)
|
|
|
.accept("*/*")
|
|
|
.part("file", "审核材料.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", is)
|
|
|
- .receive(new File("/Users/qiufangchao/Desktop/" + filename + num + ".pdf"));
|
|
|
+ .receive(file);
|
|
|
+ files.add(file);
|
|
|
+ this.downloadFile(files, rate.getPrivacyPolicy(), "法人资格");
|
|
|
+// this.downloadFile(files, rate.getBusiness(), "业务内容");
|
|
|
+// this.downloadFile(files, rate.getCredits(), "社会信誉");
|
|
|
+// this.downloadFile(files, rate.getFire(), "消防安全");
|
|
|
+// this.downloadFile(files, rate.getHygiene(), "卫生防疫");
|
|
|
+// this.downloadFile(files, rate.getFinance(), "财务报表");
|
|
|
+// this.downloadFile(files, rate.getProperty(), "房产证明");
|
|
|
+ return files;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<InputStream> upLoad1(Rate rate) {
|
|
|
+ List<InputStream> files = new ArrayList<>();
|
|
|
+ String uri = "http://192.168.50.238:8080/word2pdf";
|
|
|
+ // 表格
|
|
|
+ String export = this.export(rate);
|
|
|
+ InputStream is = new ByteArrayInputStream(export.getBytes());
|
|
|
+ InputStream stream = HttpRequest.post(uri)
|
|
|
+ .accept("*/*")
|
|
|
+ .part("file", "审核材料.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", is)
|
|
|
+ .stream();
|
|
|
+ files.add(stream);
|
|
|
+ this.downloadFile1(files, rate.getPrivacyPolicy());
|
|
|
+// this.downloadFile(files, rate.getBusiness(), "业务内容");
|
|
|
+// this.downloadFile(files, rate.getCredits(), "社会信誉");
|
|
|
+// this.downloadFile(files, rate.getFire(), "消防安全");
|
|
|
+// this.downloadFile(files, rate.getHygiene(), "卫生防疫");
|
|
|
+// this.downloadFile(files, rate.getFinance(), "财务报表");
|
|
|
+// this.downloadFile(files, rate.getProperty(), "房产证明");
|
|
|
+ return files;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void downloadFile1(List<InputStream> files, List<String> urls) {
|
|
|
+ AtomicInteger num = new AtomicInteger(1);
|
|
|
+ urls.forEach(privacy -> {
|
|
|
+ num.getAndIncrement();
|
|
|
+ if (getSuffix(privacy).equals("doc") || getSuffix(privacy).equals("docx")) {
|
|
|
+ InputStream is1 = HttpRequest.get(privacy)
|
|
|
+ .stream();
|
|
|
+ InputStream stream = HttpRequest.post("http://192.168.50.238:8080/word2pdf")
|
|
|
+ .accept("*/*")
|
|
|
+ .part("file", "审核材料.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", is1)
|
|
|
+ .stream();
|
|
|
+ files.add(stream);
|
|
|
+ } else if (getSuffix(privacy).equals("pdf")) {
|
|
|
+ InputStream stream = HttpRequest.get(privacy)
|
|
|
+ .stream();
|
|
|
+ files.add(stream);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- rate.getPrivacyPolicy().forEach(privacy -> {
|
|
|
+ public void downloadFile(List<File> files, List<String> urls, String filename) {
|
|
|
+ AtomicInteger num = new AtomicInteger(1);
|
|
|
+ urls.forEach(privacy -> {
|
|
|
num.getAndIncrement();
|
|
|
+ File file1 = new File("/Users/qiufangchao/Desktop/" + filename + num + ".pdf");
|
|
|
if (getSuffix(privacy).equals("doc") || getSuffix(privacy).equals("docx")) {
|
|
|
InputStream is1 = HttpRequest.get(privacy)
|
|
|
.stream();
|
|
|
- HttpRequest.post(uri)
|
|
|
+ HttpRequest.post("http://192.168.50.238:8080/word2pdf")
|
|
|
.accept("*/*")
|
|
|
.part("file", "审核材料.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", is1)
|
|
|
- .receive(new File("/Users/qiufangchao/Desktop/" + filename + num + ".pdf"));
|
|
|
+ .receive(file1);
|
|
|
+ files.add(file1);
|
|
|
} else if (getSuffix(privacy).equals("pdf")) {
|
|
|
HttpRequest.get(privacy)
|
|
|
- .receive(new File("/Users/qiufangchao/Desktop/" + filename + num + ".pdf"));
|
|
|
+ .receive(file1);
|
|
|
+ files.add(file1);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -154,6 +205,6 @@ public class RateService {
|
|
|
if (index < 0) {
|
|
|
return "";
|
|
|
}
|
|
|
- return url.substring(index);
|
|
|
+ return url.substring(index + 1);
|
|
|
}
|
|
|
}
|