Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

xuhao 5 сар өмнө
parent
commit
b46adf48f3

+ 6 - 0
src/main/java/fi/cas/formplugin/AgpaybillButPlugin.java

@@ -50,6 +50,12 @@ public class AgpaybillButPlugin extends AbstractFormPlugin implements Plugin {
         if ("B".equals(paystatus)&&"B".equals(nckdHxzt)||"A".equals(nckdHxzt)) {
             this.getView().setVisible(true,"nckd_payclose");
         }
+
+        //支付状态为支付成功,单据状态为已审核则隐藏提交,反审核
+        if ("C".equals(paystatus)&&"C".equals(billstatus)) {
+            this.getView().setVisible(false,"bar_submit");
+            this.getView().setVisible(false,"bar_unaudit");
+        }
     }
 
 }

+ 24 - 13
src/main/java/fi/em/formPlugin/SalaryDownloadFilePlugin.java

@@ -1,5 +1,7 @@
 package fi.em.formPlugin;
 
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.entity.property.ComboProp;
 import kd.bos.form.events.AfterDoOperationEventArgs;
 import kd.bos.form.plugin.AbstractFormPlugin;
 import org.apache.commons.io.FileUtils;
@@ -30,6 +32,8 @@ public class SalaryDownloadFilePlugin extends AbstractFormPlugin {
     String filename= interFaceImgUtils.getFileName();
     //获取文件路径
     String fileurl= interFaceImgUtils.getServerUrl();
+    //文件保存路径
+    String fileLocalpath= interFaceImgUtils.getFileLocalPath();
 
     //获取sftp链接对象
     public SftpClient sftpClient=new SftpClient(serverurl,user,password,port);
@@ -41,22 +45,29 @@ public class SalaryDownloadFilePlugin extends AbstractFormPlugin {
         String operateKey = arg.getOperateKey();
         //审核操作代码
         String downloadBut="download";
+        DynamicObject dynamicObject=this.getModel().getDataEntity(true);
+        String nckd_entrytype= dynamicObject.getString("nckd_entrytype");
         if (downloadBut.equals(operateKey)) {
-            //获取桌面路径
-            String path ="C:/Users";
-            try {
-                //获取服务器链接
-                sftpClient.connect();
-                File file=new File(path+File.separator+"模板文件.xls");
-                FileUtils.copyInputStreamToFile(sftpClient.downloadFile(fileurl+ File.separator+filename),file);
-                sftpClient.disconnect();
-                this.getView().showMessage("文件生成成功,文件位置为:"+path);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-
+            //通用薪酬(一般员工)
+            downFileToLocal(nckd_entrytype);
         }
+    }
 
+    //根据分录类型,下载对应的分录模板
+    public void downFileToLocal(String nckd_entrytype) {
+        //获取下拉列表字段
+        ComboProp comboProp = (ComboProp) getModel().getProperty("nckd_entrytype");
+        try {
+//            //通过下拉值获取下拉标题
+            String displayName = comboProp.getItemByName(nckd_entrytype);
+//            //获取服务器链接
+            sftpClient.connect();
+            sftpClient.downloadFile(fileurl+"/"+displayName+filename,fileLocalpath);
+            sftpClient.disconnect();
+            this.getView().showMessage("文件生成成功,文件位置为:"+fileLocalpath+"/"+displayName+filename);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
     }
 
 }

+ 4 - 0
src/main/java/sys/sc/opplugin/utils/InterFaceImgUtils.java

@@ -51,6 +51,10 @@ public class InterFaceImgUtils {
     }
     //获取文件名
     public String getFileName() {return jkpzxx.getString("nckd_filename");}
+    //获取文件保存路径
+    public String getFileLocalPath(){
+        return jkpzxx.getString("nckd_downloadfile");
+    }
 
 
 }

+ 3 - 3
src/main/java/sys/sc/opplugin/utils/SftpClient.java

@@ -65,9 +65,9 @@ public class SftpClient {
         }
     }
 
-    //下载文件到桌面
-    public InputStream downloadFile(String url) throws SftpException {
-        return   sftpChannel.get(url);
+    //下载文件到指定位置
+    public void downloadFile(String url,String localpath) throws SftpException {
+        sftpChannel.get(url,localpath);
     }
 
     public ChannelSftp getSftpChannel() {