From b5ca925d1500e6085dc49ba03133b415cac12b32 Mon Sep 17 00:00:00 2001 From: zhangbb Date: Thu, 28 May 2020 18:11:19 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=94=B9=E4=B8=BA=E6=96=B0=E5=A2=9E=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=9D=A5=E5=AE=9E=E7=8E=B0=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?414=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/Frame/page/js/as_control.js | 38 ++++- .../FileDownloadImportList.jsp | 8 +- .../reckon/copydata/CopyFileToOther.java | 137 ++++++++++++++++++ 3 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 calc/com/tenwa/reckon/copydata/CopyFileToOther.java diff --git a/WebContent/Frame/page/js/as_control.js b/WebContent/Frame/page/js/as_control.js index 8ee88dd66..1a9b1666b 100644 --- a/WebContent/Frame/page/js/as_control.js +++ b/WebContent/Frame/page/js/as_control.js @@ -445,6 +445,19 @@ AsControl.RunJavaMethodSqlca = function (ClassName,MethodName,Args) { AsControl.RunJavaMethodTrans = function (ClassName,MethodName,Args) { return AsControl.GetJavaMethodReturn(AsControl.CallJavaMethod(ClassName,MethodName,Args,"&ArgsObject=Trans"),ClassName); }; + +/** + * 运行后台java方法 + * @param ClassName 类路径字符串,且必须有空构造 + * @param MethodName 调用方法名称,没有形参,且返回值必须是String类型 + * @param Args 参数,格式为Field1=Value1,Field2=Value2,...,FieldN=ValueN,对应的ClassName中必须有方法setField1(String)、setField2(String)、...、 setFieldN(String)等 + * @param Sychronized false同步;true异步; + * @returns {String} 后台方法返回的字符串,或异常信息 + */ +AsControl.RunJavaMethodTransAsynch = function (ClassName,MethodName,Args,Sychronized) { + return AsControl.CallJavaMethodAsynch(ClassName,MethodName,Args,"&ArgsObject=Trans",Sychronized); +}; + /** * 重写自定义流程方法、请叫我张幕庆。 */ @@ -512,6 +525,26 @@ AsControl.RewriteCallJavaMethod = function (ClassName,MethodName,Args,ArgsObject }).responseText.trim()); }; +AsControl.CallJavaMethodAsynch = function (ClassName,MethodName,Args,ArgsObjectText,Sychronized) { + if(Args.length>0){ + Args=Args+AsControl.getParamToFixedParam(Args); + } + jQuery.ajax({ + type: "POST", + url: sWebRootPath+"/servlet/run?1=1"+ArgsObjectText, + data : { + "ClassName":ClassName, + "MethodName":MethodName, + "Args":Args.replace(/\+/g, 'Ж').replace(/\%/g, 'ё') + }, + async: Sychronized, + error: AsControl.ajaxError, + success:function(result){ + // AsDebug.showMessage("提示",result.replace("00000000",""),"","",true); + } + }); + return "true"; +}; AsControl.getParamToFixedParam = function(Args) { var params=Args.split(","); @@ -618,6 +651,7 @@ function OpenPage(sURL,sTargetWindow,sStyle) {return AsControl.OpenPageOld(sURL, function RunJavaMethod(ClassName,MethodName,Args) {return AsControl.RunJavaMethod(ClassName,MethodName,Args);} function RunJavaMethodSqlca(ClassName,MethodName,Args) {return AsControl.RunJavaMethodSqlca(ClassName,MethodName,Args);} function RunJavaMethodTrans(ClassName,MethodName,Args) {return AsControl.RunJavaMethodTrans(ClassName,MethodName,Args);} +function RunJavaMethodTransAsynch(ClassName,MethodName,Args,Sychronized) {return AsControl.CallJavaMethodAsynch(ClassName,MethodName,Args,Sychronized);} function PopPageAjax(sURL,sTargetWindow,sStyle){return AsControl.RunJspOne(sURL);} function RunJspAjax(sURL,sTargetWindow,sStyle){return AsControl.RunJspOne(sURL);} function RunMethod(ClassName,MethodName,Args){return AsControl.RunASMethod(ClassName,MethodName,Args); } @@ -1169,4 +1203,6 @@ function setObjectValuePretreat(sObjectType,sParaString,sValueString,iArgDW,iArg } } AsDialog.setObjectValue(sObjectType,sParaString,sValueString,iArgDW,iArgRow,sStyle); -} \ No newline at end of file +} + + diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp index 9bd67547c..bde7c49e8 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp @@ -68,11 +68,15 @@ alert("文件保存路径未配置"); return; } - var sUrl = "/Tenwa/Core/FlowManager/CopyFileToOther.jsp"; + sParam = sParam.replace(/@~/g, ""); + var param = "contractNos="+contractNos+",batchNos="+batchNos+",userid="+"<%=userid%>"+",fileSavePath="+fileSavePath+",fileList="+sParam; + <%-- var sUrl = "/Tenwa/Core/FlowManager/CopyFileToOther.jsp"; var param = "contractNos="+contractNos+"&batchNos="+batchNos+"&userid="+"<%=userid%>"+"&sParam="+sParam+"&fileSavePath="+fileSavePath; AsControl.RunJsp(sUrl,param,function(result){ var messageResult=RunJavaMethodTrans("com.tenwa.comm.message.controller.BaseBussinessMessage","saveBaseMessageSimple","messageId="+"3389471a244d41e584232854c8526f6b"); - }); + }); --%> + AsControl.RunJavaMethodTransAsynch("com.tenwa.reckon.copydata.CopyFileToOther", "runCopy", param, true); + } function newRecord(){ diff --git a/calc/com/tenwa/reckon/copydata/CopyFileToOther.java b/calc/com/tenwa/reckon/copydata/CopyFileToOther.java new file mode 100644 index 000000000..6253406fd --- /dev/null +++ b/calc/com/tenwa/reckon/copydata/CopyFileToOther.java @@ -0,0 +1,137 @@ +package com.tenwa.reckon.copydata; + +import java.io.File; +import java.io.FileOutputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +import jbo.app.tenwa.doc.LC_COPYFILE_LOG; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.util.StringFunction; +import com.tenwa.comm.message.controller.BaseBussinessMessage; +import com.tenwa.officetempalte.action.CreateOfficeAction; +import com.tenwa.officetempalte.exportcallback.impl.ZipUtils; + +public class CopyFileToOther { + private String contractNos; + private String batchNos; + private String userid; + private String fileList; + private String templateNo="8c0b32eefcf349e5b5f76d898df0bbbb"; + private String fileSavePath; + + public String runCopy(JBOTransaction tx) throws Exception{ + + //创建临时路径 + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + String time = sdf.format(new Date()); + String uuid=UUID.randomUUID().toString().replaceAll("-", ""); + String fileSavePath_temp = fileSavePath+"/"+time+uuid; + + FileCopyToOtherPath cp = new FileCopyToOtherPath(); + cp.setContractNos(contractNos); + cp.setBatchNos(batchNos); + cp.setUserid(userid); + cp.setFileSavePath_temp(fileSavePath_temp); + + CreateOfficeAction coa = new CreateOfficeAction(); + //JBOTransaction tx = JBOFactory.createJBOTransaction(); + + if(fileList.contains("PayFileList")){ + cp.copyFile("PayFileList"); + } + if(fileList.contains("FileList")){ + cp.copyFile("FileList"); + } + if(fileList.contains("Other")){ + cp.copyFile("Other"); + } + if(fileList.contains("RentPlan")){ + + String[] contractNoArray = contractNos.split("@"); + String[] batchNoArray = batchNos.split("@"); + for(int i=0;i