Explorar el Código

修改文件生成路径按照日期生成

qxm hace 4 años
padre
commit
537dc979a6

+ 0 - 2
suishenbang-admin/src/test/java/com/qxp/myTest.java

@@ -20,9 +20,7 @@ public class myTest {
 
     @Test
     public void test(){
-        customersMapper.selectCustomerMapByChainsCode();
 
-        System.out.println("11111");
     }
 
 }

+ 22 - 30
suishenbang-api/src/test/java/test/MyTest.java

@@ -3,6 +3,7 @@ package test;
 
 import com.dgtly.ApiApplication;
 import com.dgtly.system.domain.SysUser;
+import com.dgtly.system.service.ISysUserService;
 import com.dgtly.wxportal.config.ESignConfig;
 import com.dgtly.wxportal.service.ESignService;
 import com.dgtly.wxportal.service.IEsignOrganRealVerifyService;
@@ -34,31 +35,34 @@ public class MyTest {
     private ESignConfig eSignConfig;
     @Autowired
     private IEsignSignService signService;
+    @Autowired
+    private ISysUserService userService;
     @Test
     public void test() throws Exception {
 
 
         //创建文件
-       /* SysUser user = new SysUser();
-        user.setUserName("乔小明");
-        user.setLoginName("qiaoxiaoming4");
-        int result = eSignService.createPersonalAccount(user);*/
+        /*SysUser user = new SysUser();
+//        user.setUserName("乔小明");
+        user.setLoginName("qiaoxiaoming6");
+        SysUser account = eSignService.createPersonalAccount(user);*/
 
 
-//        CustomersExt customersExt = new CustomersExt();
-//        customersExt.setChainsCode("qiaoxiaomingqiye");
-//        customersExt.setCreator("7303abf8d1e54308a889ee61db2639da");
+        /*CustomersExt customersExt = new CustomersExt();
+        customersExt.setChainsCode("qiaoxiaominggongsi");
+        customersExt.setCreator("7303abf8d1e54308a889ee61db2639da");
 //        customersExt.setCustomersName("乔小明企业");
 //
-//        CustomersExt result = eSignService.createThirdParty(customersExt);
+        CustomersExt s = eSignService.createThirdParty(customersExt);*/
 
 
         //创建文件
 //        String s = eSignService.upload("D:/SZSM/工作交接表.docx");
         /*个人认证*/
-//        String s = personRealnVerifyService.personRealnVerify("7303abf8d1e54308a889ee61db2639da");
+//        String s = personRealnVerifyService.personRealnVerify("f39ab04d93174953a6fd22849512d4c9","http://baidu.com");
         /*企业认证*/
-//        String s = organRealVerifyService.organRealVerify("60b47892094143be9288bcfa6d5ab697","7303abf8d1e54308a889ee61db2639da");
+//        String s = organRealVerifyService.organRealVerify("60b47892094143be9288bcfa6d5ab697","7303abf8d1e54308a889ee61db2639da","http://baidu.com");
+//        String s = organRealVerifyService.organRealVerify("ca0d13a520bb415eaee16491776fe965","7303abf8d1e54308a889ee61db2639da","http://baidu.com");
 
         /** 一步发起签署
          *
@@ -76,18 +80,22 @@ public class MyTest {
         /*开启签署流程*/
 //        String s = signService.processStart("456e7367066f406b8d62fcd25f65e793");
 //        /*获取签署地址*/
-//        String s = signService.processExecuteUrl("456e7367066f406b8d62fcd25f65e793","7303abf8d1e54308a889ee61db2639da","6cad4e8a08c34711853ba96973ecf24d");
+//        String s = signService.processExecuteUrl("905cf2b712314666bab0c699dd6d17b7","7303abf8d1e54308a889ee61db2639da","81630c7a5c794f9ab1329d17b7004dcd");
+        /*设置静默签署*/
+//        String s = signService.signAuth("3fe60580bd2f4501bf1a41efabc3c3aa");
         /*查询流程签署列表人*/
 //        String s = signService.processExecuteSigners("7ea59df3f2384bf882b0f37d9cb8c0b1");
 //        /*流程归档*/
 //        String s = signService.processArchiv("0cee5f3db6f8411b9cdefb1c7175cfaf");
         /*签署文件下载*/
-//        String s = signService.processDocumentDownload("c35e714481bb4a0288a81cf94bc3508e");
-
+//        String s = signService.processDocumentDownload("801f7fb2831040b28a92a3d57f33ae05");
+       /* SysUser user = userService.selectUserById((long) 8036);
+        user.setUserName("屈星鹏");
+        eSignService.updatePersonalAccount(user);*/
 //        getURLResource("E:\\测试.pdf","https://esignoss.esign.cn/1111563786/19a14aab-b5d7-405c-a58d-55c337310803/%E5%90%88%E5%90%8C.pdf?Expires=1603179315&OSSAccessKeyId=LTAIdvHfiVrzDKbE&Signature=dl3hGcJ3HQ5%2FDTTN5%2F0UPajobyw%3D");
 
 //        System.out.println(s);
-        System.out.println("111111");
+//        System.out.println("111111");
 
     }
 
@@ -116,22 +124,6 @@ public class MyTest {
         fw.close();
     }
 
-    @Test
-    public void test2() throws Exception {
-        System.out.println(eSignConfig.getAccessToken());
-        SysUser user = new SysUser();
-        user.setUserId(7971L);
-        user.setUserName("屈星鹏");
-        user.setIdNumber("410304199209191012");
-        user.setAccountId("cf6824d029054529a0c8ec32de7a388a");
-
-        eSignService.updatePersonalAccount(user);
-
-        System.out.println(eSignConfig.getAccessToken());
-
-
-        System.out.println(1111111111);
-    }
 
 
 }

+ 0 - 6
suishenbang-wxportal/suishenbang-wxportal-common/pom.xml

@@ -33,11 +33,5 @@
             <artifactId>itext-asian</artifactId>
             <version>5.2.0</version>
         </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-test</artifactId>
-            <version>5.2.4.RELEASE</version>
-            <scope>compile</scope>
-        </dependency>
     </dependencies>
 </project>

+ 15 - 20
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/EsignSignServiceImpl.java

@@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.dgtly.common.config.Global;
 import com.dgtly.common.constant.Constants;
-import com.dgtly.common.utils.file.FileUploadUtils;
-import com.dgtly.common.utils.http.HttpUtils;
+import com.dgtly.common.utils.DateUtils;
 import com.dgtly.system.domain.*;
 import com.dgtly.wxportal.config.ESignConfig;
 import com.dgtly.wxportal.domain.OrderFile;
@@ -13,17 +12,14 @@ import com.dgtly.wxportal.service.IEsignSignService;
 import com.dgtly.wxportal.service.IOrderFileService;
 import com.dgtly.wxportal.utils.ESign.ESignHttpUtil;
 import com.dgtly.wxportal.utils.ESign.ESignUrl;
-import org.apache.poi.util.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestClientException;
 import org.springframework.web.client.RestTemplate;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.io.*;
 import java.net.HttpURLConnection;
@@ -203,11 +199,11 @@ public class EsignSignServiceImpl implements IEsignSignService {
 //        System.out.println("executeAysncTask1 method: 执行异步保存{} -------"+ i);
         String fileUrl = processDocumentDownload(flowId);
         /*下载保存签署后的文件,返回文件存储地址*/
-        String refile = downloadFile(Global.getPdfPath(), orderFlag.getOrderId() + "_签收订单.pdf", fileUrl);
+        downloadFile(Global.getPdfPath(), orderFlag.getOrderId() + "_签收订单.pdf", fileUrl);
         OrderFile orderFile = new OrderFile();
         orderFile.setFlowId(flowId);
-//        orderFile.setFileUrl(Constants.RESOURCE_PREFIX+"/"+"pdf/"+orderFlag.getOrderId() + "_签收订单.pdf");
-        orderFile.setFileUrl(refile);
+        orderFile.setFileUrl(Constants.RESOURCE_PREFIX+"/pdf/"+DateUtils.datePath()+"/"+orderFlag.getOrderId() + "_签收订单.pdf");
+//        orderFile.setFileUrl(refile);
         orderFileService.updateOrderFileByFlowId(orderFile);
     }
 
@@ -300,7 +296,7 @@ public class EsignSignServiceImpl implements IEsignSignService {
      * @author: qxm      
      * @date: 2020/10/27 9:58
      */ 
-    public String downloadFile(String filePath,String fileName,String httpUrl){
+    public static void downloadFile(String filePath,String fileName,String httpUrl){
         BufferedInputStream bis=null;
         BufferedOutputStream bos=null;
         FileInputStream inputStream=null;
@@ -312,7 +308,7 @@ public class EsignSignServiceImpl implements IEsignSignService {
             InputStream is = connection.getInputStream();
 
             bis = new BufferedInputStream(is);
-            File file = new File(filePath+"/"+fileName);//E:\test.pdf
+            File file = new File(filePath+"/"+ DateUtils.datePath()+"/"+fileName);//E:\test.pdf
             if (!file.getParentFile().exists())
             {
                 file.getParentFile().mkdirs();
@@ -325,15 +321,14 @@ public class EsignSignServiceImpl implements IEsignSignService {
                 bos.write(byArr, 0, b);
             }
 
-            inputStream = new FileInputStream(file);
-            MultipartFile multipartFile = new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(inputStream));
-            FileUploadUtils.extractFilename(multipartFile);
-            String uploadPath = FileUploadUtils.upload(Global.getPdfPath(), multipartFile);
-            return uploadPath;
+//            inputStream = new FileInputStream(file);
+//            MultipartFile multipartFile = new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(inputStream));
+//            FileUploadUtils.extractFilename(multipartFile);
+//            String uploadPath = FileUploadUtils.upload(Global.getPdfPath(), multipartFile);
+//            return uploadPath;
 
         } catch (Exception e) {
             e.printStackTrace();
-            return null;
         }finally{
             try {
                 if(bis!=null){
@@ -345,10 +340,10 @@ public class EsignSignServiceImpl implements IEsignSignService {
                 if(inputStream!=null){
                     inputStream.close();
                 }
-                File file1 = new File(filePath+"/"+fileName);
-                if (!file1.isDirectory()) {
-                    file1.delete();
-                }
+//                File file1 = new File(filePath+"/"+fileName);
+//                if (!file1.isDirectory()) {
+//                    file1.delete();
+//                }
             } catch (IOException e) {
                 e.printStackTrace();
             }