1.文件拷贝增加日志表

This commit is contained in:
zhangbb 2019-04-26 10:12:30 +08:00
parent 168d8fa7bc
commit 25928381f4
4 changed files with 64 additions and 11 deletions

View File

@ -0,0 +1,15 @@
<%@page import="com.tenwa.reckon.copydata.FileCopyToOtherPath"%>
<%@page import="com.amarsoft.are.jbo.JBOFactory"%>
<%@page import="com.amarsoft.are.jbo.BizObjectManager"%>
<%@page import="com.amarsoft.are.jbo.BizObjectQuery"%>
<%@page import="com.amarsoft.are.jbo.BizObject"%>
<%@ page contentType="text/html; charset=GBK"%><%@ include file="/IncludeBeginMDAJAX.jsp"%><%
String param = CurPage.getParameter("contractNos");
FileCopyToOtherPath cp = new FileCopyToOtherPath();
cp.setContractNos(param);
String result = cp.copyFile();
out.print(result);
%><%@ include file="/IncludeEndAJAX.jsp"%>

View File

@ -44,18 +44,21 @@
<script type="text/javascript">
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function copyPath(){
//正式采用代码
/* var contractNoArray=getItemValueArray(0,"CONTRACT_NO");
var contractNos = contractNoArray.join("@"); */
var contractNoArray=getItemValueArray(0,"CONTRACT_NO");
if(typeof(contractNoArray)=="undefined"||contractNoArray==null||contractNoArray==""){alert("ÇëÑ¡ÔñÊý¾Ý");return;}
var contractNos = contractNoArray.join("@");
var sUrl = "/Tenwa/Core/FlowManager/CopyFileToOther.jsp";
var param = "contractNos="+contractNos;
AsControl.RunJsp(sUrl,param);
//本地测试数据
var contractNos="BQAP(AH)201904230002";
var sparam = "contractNos="+contractNos;
//var contractNos="BQAP(AH)201904230002";
/* var sparam = "contractNos="+contractNos;
var result=RunJavaMethod("com.tenwa.reckon.copydata.FileCopyToOtherPath","copyFile",sparam);
if(result=="SUCCESS"){
alert("拷贝成功!!");
}else{
alert(result);
}
} */
}
//生成数据
function createPlan(){

View File

@ -195,6 +195,24 @@
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="LC_COPYFILE_LOG" label="文件拷贝日志表" keyAttributes="ID">
<attributes>
<attribute name="ID" label="主键" type="STRING" length="32"/>
<attribute name="CONTRACT_NO" label="合同编号" type="STRING" length="32"/>
<attribute name="BATCH_NO" label="批次号" type="STRING" length="32"/>
<attribute name="DEST_PATH" label="目标文档路径" type="STRING" length="100"/>
<attribute name="FILE_COUNT" label="文件数量" type="STRING" length="32"/>
<attribute name="INPUTUSERID" label="上传人" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="上传时间" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="lc_copyfile_log" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
</jbo>

View File

@ -7,13 +7,23 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jbo.app.tenwa.doc.LC_COPYFILE_LOG;
import org.apache.commons.io.FileUtils;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.Configure;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
public class FileCopyToOtherPath {
private String contractNos;
public String getContractNo() {
@ -28,7 +38,7 @@ public class FileCopyToOtherPath {
//原路径
String srcPath ;
//目标相对路径
String destPath ;
String destPath = null ;
//目标根目录
String rootPath;
try {
@ -45,8 +55,6 @@ public class FileCopyToOtherPath {
for(Map<String, String> path:pathList){
srcPath = path.get("FULLPATH");
destPath =rootPath+"/"+path.get("TARGET_FILE_PATH");
System.out.println("srcPath="+srcPath);
System.out.println("destPath="+destPath);
File srcFile = new File(srcPath);
File destFile = new File(destPath);
try {
@ -57,8 +65,17 @@ public class FileCopyToOtherPath {
e.printStackTrace();
}
}
System.out.println("合同"+contractNo+"一共有"+pathList.size()+"条数据!!");
}else{
System.out.println("================"+contractNo+"没有关联到文件"+"===============");
}
System.out.println("合同"+contractNo+"一共有"+pathList.size()+"条数据!!");
BizObjectManager bom = JBOFactory.getBizObjectManager(LC_COPYFILE_LOG.CLASS_NAME);
BizObject nbom = bom.newObject();
nbom.setAttributeValue("CONTRACT_NO", contractNo);
nbom.setAttributeValue("BATCH_NO", contractNo);
nbom.setAttributeValue("DEST_PATH", destPath);
nbom.setAttributeValue("FILE_COUNT", pathList.size());
bom.saveObject(nbom);
} catch (Exception e) {
e.printStackTrace();
return contractNo;