83 lines
3.3 KiB
Plaintext

<%@page import="com.tenwa.reckon.copydata.FileCopyToOtherPath"%>
<%@page import="com.tenwa.officetempalte.action.CreateOfficeAction"%>
<%@page import="com.tenwa.officetempalte.exportcallback.impl.ZipUtils"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.io.FileOutputStream"%>
<%@page import="java.io.File"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.UUID"%>
<%@page import="jbo.app.tenwa.doc.LC_COPYFILE_LOG"%>
<%@page import="com.amarsoft.are.util.StringFunction"%>
<%@page import="com.amarsoft.are.jbo.JBOFactory"%>
<%@page import="com.amarsoft.are.jbo.JBOTransaction"%>
<%@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 contractNos = CurPage.getParameter("contractNos");
String batchNos = CurPage.getParameter("batchNos");
String userid = CurPage.getParameter("userid");
String sParam = CurPage.getParameter("sParam");
String templateNo = "8c0b32eefcf349e5b5f76d898df0bbbb";
String fileSavePath = CurPage.getParameter("fileSavePath");
//´´½¨ÁÙʱ·¾¶
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(sParam.contains("PayFileList")){
cp.copyFile("PayFileList");
}
if(sParam.contains("FileList")){
cp.copyFile("FileList");
}
if(sParam.contains("RentPlan")){
String[] contractNoArray = contractNos.split("@");
String[] batchNoArray = batchNos.split("@");
for(int i=0;i<contractNoArray.length;i++){
String fileSavePath_xml = fileSavePath_temp+"/"+contractNoArray[i]+"/";
String templateParam = "{\"OBJECTTYPE\":\"×â½ðÖ§¸¶±íµ¼³ö\"@\"CurUserId\":\""+userid+"\"@\"fileSavePath\":\""+fileSavePath_xml+"\"@\"CONTRACT_NO\":\""+contractNoArray[i]+"\"}";
File temDir = new File(fileSavePath_xml);
if(!temDir.exists()){
temDir.mkdirs();
}
coa.setTemplateNo(templateNo);
coa.setTemplateParam(templateParam);
String result = coa.createOfficeByTemplate(tx);
if("success".equals(result)){
BizObjectManager bom = JBOFactory.getBizObjectManager(LC_COPYFILE_LOG.CLASS_NAME);
BizObject nbom = bom.newObject();
nbom.setAttributeValue("CONTRACT_NO", contractNoArray[i]);
nbom.setAttributeValue("BATCH_NO", batchNoArray[i]);
nbom.setAttributeValue("COPY_TYPE","×â½ð¼Æ»®");
nbom.setAttributeValue("INPUTTIME",StringFunction.getTodayNow());
nbom.setAttributeValue("INPUTUSERID",userid);
bom.saveObject(nbom);
}
}
}
tx.commit();
//ѹËõ
FileOutputStream fos1 = new FileOutputStream(new File(fileSavePath+"/"+time+".zip"));
ZipUtils zdo = new ZipUtils();
zdo.toZip(fileSavePath_temp, fos1, true);
//ɾ³ýÔ­Îļþ
File f = new File(fileSavePath_temp);
zdo.deleteFile(f);
out.print("SUCCESS");
%><%@ include file="/IncludeEndAJAX.jsp"%>