浏览代码

薪酬导入插件

13246659623 4 月之前
父节点
当前提交
5e63338392

+ 5 - 10
src/main/java/fi/em/formPlugin/SalaryFileUploadEditPlugin.java

@@ -7,6 +7,8 @@ import kd.bos.cache.CacheFactory;
 import kd.bos.cache.TempFileCache;
 import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.exception.KDBizException;
+import kd.bos.fileservice.FileService;
+import kd.bos.fileservice.FileServiceFactory;
 import kd.bos.form.control.AttachmentPanel;
 import kd.bos.form.control.Toolbar;
 import kd.bos.form.control.events.UploadEvent;
@@ -53,16 +55,9 @@ public class SalaryFileUploadEditPlugin extends AbstractBillPlugIn implements Up
       //  List<Map<String,Object>> attachmentData=attachmentPanel.getAttachmentData();
         //获取最新上传的文件路径
         String fileurl = evt.getUrls()[0]+"";
-        File ff = new File(fileurl);
-        //获取文件缓存
-        TempFileCache cache = CacheFactory.getCommonCacheFactory().getTempFileCache();
-        //从缓存中拿到输入流
-        InputStream inputStream = null;
-        try {
-            inputStream = new FileInputStream(ff);
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException(e);
-        }
+        FileService attService = FileServiceFactory.getAttachmentFileService();
+        InputStream inputStream = attService.getInputStream(fileurl);
+
         String billtype="";
         //根据分录类型获取对应分录标识
         if ("A".equals(nckd_entrytype)) {

+ 4 - 10
src/main/java/fi/em/formPlugin/SalaryFileUploadEditPluginCp.java

@@ -7,6 +7,8 @@ import kd.bos.cache.CacheFactory;
 import kd.bos.cache.TempFileCache;
 import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.exception.KDBizException;
+import kd.bos.fileservice.FileService;
+import kd.bos.fileservice.FileServiceFactory;
 import kd.bos.form.control.AttachmentPanel;
 import kd.bos.form.control.Toolbar;
 import kd.bos.form.control.events.UploadEvent;
@@ -53,16 +55,8 @@ public class SalaryFileUploadEditPluginCp extends AbstractBillPlugIn implements
         //  List<Map<String,Object>> attachmentData=attachmentPanel.getAttachmentData();
         //获取最新上传的文件路径
         String fileurl = evt.getUrls()[0]+"";
-        File ff = new File(fileurl);
-        //获取文件缓存
-        TempFileCache cache = CacheFactory.getCommonCacheFactory().getTempFileCache();
-        //从缓存中拿到输入流
-        InputStream inputStream = null;
-        try {
-            inputStream = new FileInputStream(ff);
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException(e);
-        }
+        FileService attService = FileServiceFactory.getAttachmentFileService();
+        InputStream inputStream = attService.getInputStream(fileurl);
         String billtype="";
         //根据分录类型获取对应分录标识
         if ("A".equals(nckd_entrytype)) {