Browse Source

文件下载

licailing 4 years ago
parent
commit
787fd3e892

+ 2 - 1
src/main/java/com/izouma/wenlvju/domain/TrainingInstitution.java

@@ -32,6 +32,7 @@ public class TrainingInstitution extends BaseEntity {
     private String uscc;
     private String uscc;
 
 
     @ApiModelProperty(value = "是否从事文化艺术类校外培训")
     @ApiModelProperty(value = "是否从事文化艺术类校外培训")
+    @ExcelProperty(value = "是否从事文化艺术类校外培训", converter = BooleanConverter.class)
     private boolean engagedInTraining;
     private boolean engagedInTraining;
 
 
     @ExcelProperty(value = "经营范围")
     @ExcelProperty(value = "经营范围")
@@ -52,7 +53,7 @@ public class TrainingInstitution extends BaseEntity {
     private String privacyPolicy;
     private String privacyPolicy;
 
 
     @ExcelIgnore
     @ExcelIgnore
-    @ApiModelProperty(value = "短信号码")
+    @ApiModelProperty(value = "短信发送号码")
     private String phone;
     private String phone;
 
 
     @ExcelProperty(value = "企业联系方式")
     @ExcelProperty(value = "企业联系方式")

+ 8 - 0
src/main/java/com/izouma/wenlvju/dto/TrainingInstitutionDTO.java

@@ -23,6 +23,14 @@ public class TrainingInstitutionDTO {
     @ApiModelProperty("企业名称")
     @ApiModelProperty("企业名称")
     private String name;
     private String name;
 
 
+    @ExcelProperty(value = "注册号")
+    @ApiModelProperty("注册号")
+    private String uscc;
+
+    @ExcelProperty(value = "法人姓名")
+    @ApiModelProperty(value = "法人姓名")
+    private String privacyPolicy;
+
     @ExcelProperty(value = "固定电话")
     @ExcelProperty(value = "固定电话")
     @ApiModelProperty(value = "固定电话")
     @ApiModelProperty(value = "固定电话")
     private String contactPhone;
     private String contactPhone;

+ 23 - 3
src/main/java/com/izouma/wenlvju/service/RateService.java

@@ -377,15 +377,35 @@ public class RateService {
         urls.forEach(privacy -> {
         urls.forEach(privacy -> {
             num.getAndIncrement();
             num.getAndIncrement();
             if ("doc".equals(getSuffix(privacy)) || "docx".equals(getSuffix(privacy))) {
             if ("doc".equals(getSuffix(privacy)) || "docx".equals(getSuffix(privacy))) {
-                InputStream is1 = HttpRequest.get(privacy)
-                        .stream();
+                InputStream is1;
+                if (privacy.contains("http")) {
+                    is1 = HttpRequest.get(privacy)
+                            .stream();
+                } else {
+                    try {
+                        is1 = new FileInputStream(privacy);
+                    } catch (FileNotFoundException e) {
+                        throw new BusinessException("找不到文件");
+                    }
+                }
                 InputStream stream = HttpRequest.post("http://convert.izouma.com/word2pdf")
                 InputStream stream = HttpRequest.post("http://convert.izouma.com/word2pdf")
                         .accept("*/*")
                         .accept("*/*")
                         .part("file", "审核材料.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", is1)
                         .part("file", "审核材料.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", is1)
                         .stream();
                         .stream();
                 files.add(stream);
                 files.add(stream);
             } else if ("pdf".equals(getSuffix(privacy))) {
             } else if ("pdf".equals(getSuffix(privacy))) {
-                InputStream stream = HttpRequest.get(privacy).stream();
+                InputStream stream;
+                if (privacy.contains("http")) {
+                    stream = HttpRequest.get(privacy)
+                            .stream();
+                } else {
+                    try {
+                        stream = new FileInputStream(privacy);
+                    } catch (FileNotFoundException e) {
+                        throw new BusinessException("找不到文件");
+                    }
+                }
+//                InputStream stream = HttpRequest.get(privacy).stream();
                 files.add(stream);
                 files.add(stream);
             }
             }
         });
         });

+ 1 - 1
src/main/java/com/izouma/wenlvju/service/TrainingInstitutionService.java

@@ -37,7 +37,7 @@ public class TrainingInstitutionService {
     public void batchSend(List<String> phones) throws InterruptedException {
     public void batchSend(List<String> phones) throws InterruptedException {
 
 
         int count = phones.size() / 950;
         int count = phones.size() / 950;
-        String body = "";
+        String body = "http://wljtest.izouma.com/h5/trainingInstitution";
         for (int i = 0; i < count; i++) {
         for (int i = 0; i < count; i++) {
             int start = i * 950;
             int start = i * 950;
             int end = start + 950;
             int end = start + 950;