1.文件下载功能。
This commit is contained in:
parent
5fe5b2530c
commit
8e86b2ab9d
@ -5,11 +5,15 @@
|
||||
<%@page import="com.amarsoft.are.jbo.BizObject"%>
|
||||
|
||||
<%@ page contentType="text/html; charset=GBK"%><%@ include file="/IncludeBeginMDAJAX.jsp"%><%
|
||||
|
||||
String param = CurPage.getParameter("contractNos");
|
||||
String batchNos = CurPage.getParameter("batchNos");
|
||||
String contractNos = CurPage.getParameter("contractNos");
|
||||
String type = CurPage.getParameter("type");
|
||||
String userid = CurPage.getParameter("userid");
|
||||
FileCopyToOtherPath cp = new FileCopyToOtherPath();
|
||||
cp.setContractNos(param);
|
||||
String result = cp.copyFile();
|
||||
cp.setContractNos(contractNos);
|
||||
cp.setBatchNos(batchNos);
|
||||
cp.setUserid(userid);
|
||||
String result = cp.copyFile(type);
|
||||
out.print(result);
|
||||
%><%@ include file="/IncludeEndAJAX.jsp"%>
|
||||
|
||||
|
||||
36
WebContent/Tenwa/Core/FlowManager/CreatRentPlanList.jsp
Normal file
36
WebContent/Tenwa/Core/FlowManager/CreatRentPlanList.jsp
Normal file
@ -0,0 +1,36 @@
|
||||
<%@page import="com.tenwa.officetempalte.action.CreateOfficeAction"%>
|
||||
<%@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 templateNo = CurPage.getParameter("templateNo");
|
||||
String templateParam = CurPage.getParameter("templateParam");
|
||||
String contractNo = CurPage.getParameter("contractNo");
|
||||
String batchNo = CurPage.getParameter("batchNo");
|
||||
String userid = CurPage.getParameter("userid");
|
||||
CreateOfficeAction coa = new CreateOfficeAction();
|
||||
JBOTransaction tx = JBOFactory.createJBOTransaction();
|
||||
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", contractNo);
|
||||
nbom.setAttributeValue("BATCH_NO", batchNo);
|
||||
nbom.setAttributeValue("COPY_TYPE","×â½ð¼Æ»®");
|
||||
nbom.setAttributeValue("INPUTTIME",StringFunction.getTodayNow());
|
||||
nbom.setAttributeValue("INPUTUSERID",userid);
|
||||
bom.saveObject(nbom);
|
||||
}
|
||||
|
||||
//³É¹¦Îª"success"
|
||||
out.print(result);
|
||||
%><%@ include file="/IncludeEndAJAX.jsp"%>
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
String PG_TITLE = "文件下载"; // 浏览器窗口标题 <title> PG_TITLE </title>
|
||||
%>
|
||||
<%
|
||||
String userid=CurUser.getUserID();
|
||||
ASObjectModel doTemp = new ASObjectModel("li_Property_import");
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
|
||||
dwTemp.Style="1"; //--设置为Grid风格--
|
||||
@ -25,8 +26,7 @@
|
||||
{"true","All","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""},
|
||||
{"true","","Button","excel导入","excel导入","importExcel()","","","","btn_icon_import"},
|
||||
{"true","","Button","模版下载","模版下载","DiscountDownload()","","","","btn_icon_down",""},
|
||||
{"true","All","Button","生成租金计划","生成租金计划","createPlan()","","","","btn_icon_generate"},
|
||||
{"true","All","Button","测试拷贝","测试拷贝","copyPath()","","","","btn_icon_generate"},
|
||||
{"true","All","Button","苟潼","苟潼栗죕","copy()","","","","btn_icon_generate"},
|
||||
};
|
||||
%>
|
||||
<%/*~END~*/%>
|
||||
@ -42,43 +42,39 @@
|
||||
<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%>
|
||||
<script type="text/javascript">
|
||||
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
|
||||
function copyPath(){
|
||||
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,function(result){
|
||||
if(result=="SUCCESS"){
|
||||
|
||||
}
|
||||
alert("拷贝成功!!");
|
||||
});
|
||||
|
||||
//本地测试数据
|
||||
//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);
|
||||
} */
|
||||
var Id;
|
||||
var CONTRACT_NO;
|
||||
var BATCH_NO;
|
||||
function copy(){
|
||||
Id = getItemValueArray(0,"ID");
|
||||
if(typeof(Id)=="undefined"||Id==null||Id==""){alert("헝朞嶝鑒앴");return;}
|
||||
CONTRACT_NO = getItemValueArray(0,"CONTRACT_NO");
|
||||
BATCH_NO = getItemValueArray(0,"BATCH_NO");
|
||||
AsDialog.OpenSelector("selectCopyList","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.4) + "px",function(sReturn){
|
||||
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
|
||||
return;
|
||||
}
|
||||
var value = sReturn.split("@~");
|
||||
for(var i=0;i<value.length;i++){
|
||||
if(value[i]=="RentPlan"){//理쏜셕뺍
|
||||
createPlan();
|
||||
}
|
||||
if(value[i]=="PayFileList"){//마운栗죕헌데
|
||||
copyList("PayFileList");
|
||||
}
|
||||
if(value[i]=="FileList"){//도갭백도栗죕헌데
|
||||
copyList("FileList");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//生成数据
|
||||
function createPlan(){
|
||||
var Id = getItemValueArray(0,"ID");
|
||||
var CONTRACT_NO = getItemValueArray(0,"CONTRACT_NO");
|
||||
var number = 0;
|
||||
var faile_no="";
|
||||
if(typeof(Id)=="undefined"||Id==null||Id==""){alert("请选择数据");return;}
|
||||
for(var i=0;i<Id.length;i++){
|
||||
var param={};
|
||||
var tempParam={};
|
||||
var sparam="";
|
||||
//模板号
|
||||
param["templateNo"]="8c0b32eefcf349e5b5f76d898df0bbbb";
|
||||
|
||||
//生成文件关联关系
|
||||
tempParam["OBJECTTYPE"]="租金支付表导出";
|
||||
tempParam["CONTRACT_NO"]=CONTRACT_NO[i];
|
||||
@ -86,35 +82,34 @@
|
||||
//生成模板固定参数
|
||||
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
|
||||
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
|
||||
tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileSavePath")%>";
|
||||
|
||||
tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileCopyPath")%>"+"/"+CONTRACT_NO[i];
|
||||
param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据
|
||||
for(var key in param){
|
||||
if(sparam.length>0){sparam+=",";}
|
||||
sparam+=key+"="+param[key];
|
||||
}
|
||||
|
||||
var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam);
|
||||
|
||||
if(result=="success"){
|
||||
number++;
|
||||
}else{
|
||||
faile_no+=CONTRACT_NO[i]+";";
|
||||
var sUrl = "/Tenwa/Core/FlowManager/CreatRentPlanList.jsp";
|
||||
for(var key in param){
|
||||
if(sparam.length>0){sparam+="&";}
|
||||
sparam+=key+"="+param[key];
|
||||
}
|
||||
|
||||
sparam=sparam+"&contractNo="+CONTRACT_NO[i]+"&batchNo="+BATCH_NO[i]+"&userid="+"<%=userid%>";
|
||||
AsControl.RunJsp(sUrl,sparam,function(result){
|
||||
|
||||
});
|
||||
}
|
||||
if(Id.length==0){
|
||||
alert("请先选择数据!!!");
|
||||
return;
|
||||
}else if(number==0){
|
||||
alert("生成失败!!!");
|
||||
}else if(number==Id.length){
|
||||
alert("生成成功!!!");
|
||||
}else{
|
||||
alert("部分生成成功!!!"+faile_no+"生成失败!!!");
|
||||
}
|
||||
reloadSelf();
|
||||
|
||||
}
|
||||
function copyList(type){
|
||||
var contractNoArray=CONTRACT_NO;
|
||||
var batchNoArray=BATCH_NO;
|
||||
if(typeof(contractNoArray)=="undefined"||contractNoArray==null||contractNoArray==""){alert("헝朞嶝鑒앴");return;}
|
||||
var contractNos = contractNoArray.join("@");
|
||||
var batchNos = batchNoArray.join("@");
|
||||
var sUrl = "/Tenwa/Core/FlowManager/CopyFileToOther.jsp";
|
||||
var param = "contractNos="+contractNos+"&batchNos="+batchNos+"&type="+type+"&userid="+"<%=userid%>";
|
||||
AsControl.RunJsp(sUrl,param,function(result){
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function newRecord(){
|
||||
var sUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportInfo.jsp";
|
||||
AsDialog.PopView(sUrl,'',"resizable=yes;dialogWidth=800px;dialogHeight=300px;center:yes;status:no;statusbar:no",function(){
|
||||
|
||||
@ -202,8 +202,7 @@
|
||||
<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="COPY_TYPE" label="拷贝类型" type="STRING" length="32"/>
|
||||
<attribute name="INPUTUSERID" label="上传人" type="STRING" length="32"/>
|
||||
<attribute name="INPUTTIME" label="上传时间" type="STRING" length="32"/>
|
||||
</attributes>
|
||||
|
||||
BIN
WebContent/fileTemplate/租金支付计划{CONTRACT_NUMBER}.xlsx
Normal file
BIN
WebContent/fileTemplate/租金支付计划{CONTRACT_NUMBER}.xlsx
Normal file
Binary file not shown.
@ -12,6 +12,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
|
||||
|
||||
import jbo.app.tenwa.doc.LC_COPYFILE_LOG;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@ -19,21 +20,35 @@ 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.are.util.StringFunction;
|
||||
import com.amarsoft.awe.Configure;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
public class FileCopyToOtherPath {
|
||||
|
||||
private String contractNos;
|
||||
private String batchNos;
|
||||
private String userid;
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
public String getContractNo() {
|
||||
return contractNos;
|
||||
}
|
||||
public void setContractNos(String contractNos) {
|
||||
this.contractNos = contractNos;
|
||||
}
|
||||
|
||||
public String doCopy(String contractNo){
|
||||
public String getBatchNos() {
|
||||
return batchNos;
|
||||
}
|
||||
public void setBatchNos(String batchNos) {
|
||||
this.batchNos = batchNos;
|
||||
}
|
||||
public String doCopy(String contractNo,String bacthNo,String type){
|
||||
Transaction Sqlca = Transaction.createTransaction("als");
|
||||
//原路径
|
||||
String srcPath ;
|
||||
@ -44,11 +59,11 @@ public class FileCopyToOtherPath {
|
||||
try {
|
||||
Configure config = Configure.getInstance();
|
||||
rootPath = config.getConfigure("FileCopyPath");
|
||||
String sql = "SELECT O.FULLPATH AS FULLPATH, CONCAT(LCI.CONTRACT_NO, '/', LDL.ONE_CLASSIFY, '/' , LDL.DOC_NAME, '/', O.FILENAME) AS TARGET_FILE_PATH FROM LB_DOCATTRIBUTE O"
|
||||
String sql = "SELECT O.FULLPATH AS FULLPATH, CONCAT(LCI.CONTRACT_NO, '/','"+type+"','/', LDL.ONE_CLASSIFY, '/' , LDL.DOC_NAME, '/', O.FILENAME) AS TARGET_FILE_PATH FROM LB_DOCATTRIBUTE O"
|
||||
+" LEFT JOIN LB_DOCLIBRARY LDL ON LDL.ID = O.LIBRARY_ID"
|
||||
+" LEFT JOIN LB_DOCRELATIVE LDR ON LDL.RELATIVE_ID = LDR.ID"
|
||||
+" LEFT JOIN LB_CONTRACT_INFO LCI ON LDR.CONTRACT_ID = LCI.ID"
|
||||
+" WHERE LCI.CONTRACT_NO ='"+contractNo+"'";
|
||||
+" WHERE LCI.CONTRACT_NO ='"+contractNo+"' AND LDL.DOC_TYPE LIKE '"+type+"%'";
|
||||
Map<String,String> params=new HashMap<String,String>();
|
||||
List<Map<String, String>> pathList = DataOperatorUtil.getDataBySql(Sqlca,sql,params);
|
||||
if(pathList.size()>0){
|
||||
@ -57,25 +72,28 @@ public class FileCopyToOtherPath {
|
||||
destPath =rootPath+"/"+path.get("TARGET_FILE_PATH");
|
||||
File srcFile = new File(srcPath);
|
||||
File destFile = new File(destPath);
|
||||
System.out.println("原路径:"+srcPath);
|
||||
System.out.println("目标路径:"+destPath);
|
||||
try {
|
||||
//文件拷贝,true为最后修改时间不变,fail为当前时间.
|
||||
//文件拷贝,参数true为最后修改时间不变,fail为当前时间.
|
||||
//拷贝时如果目标文件已存在,则会从新覆盖。
|
||||
FileUtils.copyFile(srcFile, destFile, true);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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", bacthNo);
|
||||
nbom.setAttributeValue("COPY_TYPE",type);
|
||||
nbom.setAttributeValue("INPUTTIME",StringFunction.getTodayNow());
|
||||
nbom.setAttributeValue("INPUTUSERID",userid);
|
||||
bom.saveObject(nbom);
|
||||
}else{
|
||||
System.out.println("================"+contractNo+"没有关联到文件"+"===============");
|
||||
}
|
||||
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;
|
||||
@ -83,22 +101,30 @@ public class FileCopyToOtherPath {
|
||||
return "Y";
|
||||
}
|
||||
|
||||
public String copyFile(){
|
||||
public String copyFile(String type){
|
||||
String failNo="";
|
||||
if("PayFileList".equals(type)){
|
||||
type="放款资料";
|
||||
}
|
||||
if("FileList".equals(type)){
|
||||
type="归档资料";
|
||||
}
|
||||
List<String> cns = Arrays.asList(contractNos.split("@"));
|
||||
for(String contractNo:cns){
|
||||
if("".equals(contractNo)||contractNo==null){
|
||||
List<String> bns = Arrays.asList(batchNos.split("@"));
|
||||
for(int i=0;i<cns.size();i++){
|
||||
if("".equals(cns.get(i))||cns.get(i)==null){
|
||||
continue;
|
||||
}
|
||||
String result = doCopy(contractNo);
|
||||
String result = doCopy(cns.get(i),bns.get(i),type);
|
||||
if(!"Y".equals(result)){
|
||||
failNo+=contractNo+";";
|
||||
failNo+=cns.get(i)+";";
|
||||
}
|
||||
}
|
||||
if("".equals(failNo)){
|
||||
return "SUCCESS";
|
||||
}
|
||||
System.out.println("拷贝失败的合同:"+failNo);
|
||||
return failNo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ public class CorpusTools {
|
||||
for (int i = 0; i < rentList.size(); i++) {
|
||||
if(i + 1 == rentList.size()){
|
||||
corpus_list.add(new BigDecimal(rentList.get(i).toString())
|
||||
.subtract(new BigDecimal(inteList.get(i).toString())).add(cb.getRetainage()).setScale(RentTools.getCorpusAccuracy(), BigDecimal.ROUND_HALF_UP)
|
||||
.subtract(new BigDecimal(inteList.get(i).toString())).setScale(RentTools.getCorpusAccuracy(), BigDecimal.ROUND_HALF_UP)
|
||||
.toString());
|
||||
}else{
|
||||
corpus_list.add(new BigDecimal(rentList.get(i).toString())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user