瀏覽代碼

文件下载

peixh 3 年之前
父節點
當前提交
7b0931881b

+ 4 - 1
sc-service/src/main/java/com/huyi/service/common/flowable/controller/FlowableController.java

@@ -315,10 +315,11 @@ public class  FlowableController extends BaseController
             String [] arr = id.split("\\|");
             //融信id
             String zfiId = arr[0];
+            System.out.println("融信id====================>" + zfiId);
             wrapper.eq(ZcFinanceInf::getZfiId,zfiId);
             ZcFinanceInf zcFinanceInf = new ZcFinanceInf();
+            //融资方审批状态(00:审批中, 01:审批通过, 02:审批拒绝, 03:暂存)
             zcFinanceInf.setZfiSupplierStatus("01");
-
             //融信id查询融资产品
             ZcFinanceInf inf = zcFinanceInfService.getById(zfiId);
             //融资产品
@@ -376,7 +377,9 @@ public class  FlowableController extends BaseController
                 /**融信操作日志*/
                 financeLog.addFinanceLog(zfiId, "平台资料审核【通过】,融信资料提交《"+supplierName+"》签收", null, FinanceLog.STATUS_TWO);
             }
+            System.out.println("更新融信表开始===============>");
             zcFinanceInfService.update(zcFinanceInf,wrapper);
+            System.out.println("更新融信表结束===============>");
         } //平台审批通过
         else if("1000000004".equals(menuId)){
             LambdaQueryWrapper<ZcFinanceInf> wrapper = new LambdaQueryWrapper<>();

+ 48 - 0
sc-service/src/main/java/com/huyi/service/creditLine/controller/CreditLineController.java

@@ -23,7 +23,16 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
 import java.math.BigDecimal;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.regex.Pattern;
@@ -662,5 +671,44 @@ public class CreditLineController extends BaseController {
         }
         return AjaxResult.success();
     }
+
+
+    /**
+     * 文件下载
+     * @param pfiFileUrl 文件url
+     * @param resp
+     * @throws MalformedURLException
+     */
+    @PostMapping("/jpgAuthorization")
+    public void jpgAuthorization(@RequestParam(required=false) String pfiFileUrl, HttpServletResponse resp) throws MalformedURLException {
+        // 下载网络文件
+        int bytesum = 0;
+        int byteread = 0;
+        URL url = new URL(pfiFileUrl);
+        try {
+            URLConnection conn = url.openConnection();
+            InputStream fis = conn.getInputStream();
+            //1、得到文件的绝对路径,并且通过该路径得到一个字节输入流
+            //2、创建字节输出流
+            ServletOutputStream sos = resp.getOutputStream();
+            //4、设置文件编码
+            String filename = URLEncoder.encode("file.png", "UTF-8");//编码为UTF-8
+            //5、告知客户端(浏览器)要下载文件
+            resp.setHeader("content-disposition", "attachment;filename="+filename);
+            resp.setHeader("content-type", "image/png/pdf/doc/docx");//文件类型
+            //6、输出
+            byte[] b = new byte[1024];
+            int len = 0;
+            while((len=fis.read(b)) != -1){
+                sos.write(b, 0, len);
+            }
+            sos.close();
+            fis.close();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
 }