فهرست منبع

交易明细附件调整

wangjun 3 هفته پیش
والد
کامیت
7be5fb2372

+ 10 - 21
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/webapi/AttachmentFileUtil.java

@@ -88,25 +88,6 @@ public class AttachmentFileUtil {
             logger.info("FTP inputStream -- size:"+inputStream.available());
             System.out.println("inputStream:"+inputStream);
 
-            // outStream = new ByteArrayOutputStream();
-            // byte[] buffer = new byte[1024];
-            // int len = 0;
-            // while( (len = inputStream.read(buffer)) != -1 ){
-            //     outStream.write(buffer, 0, len);
-            // }
-            // byte[] bt =  outStream.toByteArray();
-
-            // if(null != bt && bt.length > 0){
-            //     DecimalFormat df = new DecimalFormat("#");
-            //     size = Integer.parseInt(df.format((double) bt.length));
-
-            //     System.out.println("文件大小=:" + size);
-            // }else{
-            //     System.out.println("没有从该连接获得内容");
-            // }
-
-            // attachItem.put("size",  size);
-//            苍穹自带
             TempFileCache cache = CacheFactory.getCommonCacheFactory().getTempFileCache();
             tempUrl = cache.saveAsFullUrl((String) attachItem.get("name"), inputStream, 1600);
             logger.info("FTP tempUrl -- inputStream -- size:" + CacheFactory.getCommonCacheFactory().getTempFileCache().getInputStream(tempUrl).available());
@@ -156,12 +137,19 @@ public class AttachmentFileUtil {
             FileItem fileItem = new FileItem(fileName, pathParam, in);
 
             //从临时上传至 文件服务器
-            String downUrl =service.upload(fileItem);
+            String downUrl = service.upload(fileItem);
             logger.info("FTP downUrl:"+downUrl);
             System.out.println("downUrl:"+downUrl);
 
+            /**
+             * 附件有2个地址
+             * 一个是 downloadID  示例:1ebecb8a91003c00
+             * 一个是 url  示例:http://192.168.1.1/1ebecb8a91003c00
+             */
+            attachItem.put("downUrl", downUrl);
             attachItem.put("url", actUrl);
             result.put("url", actUrl);
+            result.put("downUrl", downUrl);
             attachments.add(attachItem);
             //绑定单据
             AttachmentServiceHelper.upload(entity, pk, attachKey, attachments);
@@ -233,7 +221,8 @@ public class AttachmentFileUtil {
         attObj.set("name", attachment.get("name"));
         attObj.set("size", 0);
         attObj.set("uid", attachment.get("uid"));
-        attObj.set("url", attachment.get("uid"));
+        //attObj.set("url", attachment.get("url"));
+        attObj.set("url", attachment.get("downUrl"));
         String fileType = attachment.get("name").toString();
         if (fileType.contains(".")) {
             fileType = fileType.substring(fileType.lastIndexOf(".") + 1);

+ 2 - 1
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/webapi/TransDetailApiPlugin.java

@@ -439,7 +439,8 @@ public class TransDetailApiPlugin implements Serializable {
                 if(StringUtils.isNotEmpty(pathParam)){
                     elecreceiptDyn.set(BeiElecreceiptConstantInfo.FILEPATH, pathParam);
                 }
-                String url = reMap.get("url").toString();
+                //String url = reMap.get("url").toString();
+                String url = reMap.get("downUrl").toString();
                 if(StringUtils.isNotEmpty(url)){
                     elecreceiptDyn.set(BeiElecreceiptConstantInfo.UPLOADFILENAME, url);
                 }