1.文件复制下载重构;

2.增加消息通知;
3.租金计划模板完善;
4.excel默认路径更改;
This commit is contained in:
zhangbb 2019-05-26 21:17:33 +08:00
parent 07e30a36ad
commit e69d6d8164
6 changed files with 132 additions and 95 deletions

View File

@ -1,20 +1,59 @@
<%@page import="com.tenwa.reckon.copydata.FileCopyToOtherPath"%>
<%@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 batchNos = CurPage.getParameter("batchNos");
//创建资料
String contractNos = CurPage.getParameter("contractNos");
String type = CurPage.getParameter("type");
String batchNos = CurPage.getParameter("batchNos");
String userid = CurPage.getParameter("userid");
String sParam = CurPage.getParameter("sParam");
String templateNo = "8c0b32eefcf349e5b5f76d898df0bbbb";
FileCopyToOtherPath cp = new FileCopyToOtherPath();
cp.setContractNos(contractNos);
cp.setBatchNos(batchNos);
cp.setUserid(userid);
String result = cp.copyFile(type);
out.print(result);
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 = CurPage.getParameter("fileSavePath")+"/"+contractNoArray[i]+"/";
String templateParam = "{\"OBJECTTYPE\":\"租金支付表导出\"@\"CurUserId\":\""+userid+"\"@\"fileSavePath\":\""+fileSavePath+"\"@\"CONTRACT_NO\":\""+contractNoArray[i]+"\"}";
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);
}
}
}
out.print("SUCCESS");
%><%@ include file="/IncludeEndAJAX.jsp"%>

View File

@ -1,36 +0,0 @@
<%@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"%>

View File

@ -43,73 +43,33 @@
<script type="text/javascript">
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
var Id;
var CONTRACT_NO;
var BATCH_NO;
var contractNoArray;
var batchNoArray;
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");
contractNoArray = getItemValueArray(0,"CONTRACT_NO");
batchNoArray = 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");
}
}
doCopy(sReturn);
});
}
function createPlan(){
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];
//tempParam["contract_id"]=Id[i];
//生成模板固定参数
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileCopyPath")%>"+"/"+CONTRACT_NO[i];
param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据
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){
});
}
}
function copyList(type){
var contractNoArray=CONTRACT_NO;
var batchNoArray=BATCH_NO;
if(typeof(contractNoArray)=="undefined"||contractNoArray==null||contractNoArray==""){alert("请选择数据");return;}
function doCopy(sParam){
var contractNos = contractNoArray.join("@");
var batchNos = batchNoArray.join("@");
contractNos.replace(/\s+/g, "");
var batchNos = batchNoArray.join("@");
var fileSavePath = "<%=CurConfig.getConfigure("FileCopyPath")%>"
var sUrl = "/Tenwa/Core/FlowManager/CopyFileToOther.jsp";
var param = "contractNos="+contractNos+"&batchNos="+batchNos+"&type="+type+"&userid="+"<%=userid%>";
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");
});
}
}
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(){

View File

@ -59,7 +59,7 @@ public class FileCopyToOtherPath {
try {
Configure config = Configure.getInstance();
rootPath = config.getConfigure("FileCopyPath");
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"
String sql = "SELECT O.FULLPATH AS FULLPATH, CONCAT(REPLACE(LCI.CONTRACT_NO,'/','-'), '/','"+type+"','/', REPLACE(LDL.ONE_CLASSIFY,'/','-'), '/' , REPLACE(LDL.DOC_NAME,'/','-'), '/', REPLACE(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"

View File

@ -0,0 +1,74 @@
package com.tenwa.officetempalte.exportcallback.impl;
import java.io.File;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import jbo.app.tenwa.calc.LC_CARD_DEDUCT_INFO;
import jbo.app.tenwa.calc.LC_CARD_EXPORT_DATA;
import jbo.com.tenwa.entity.comm.officetempalte.BF_LABLECONFIG;
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.lang.DataElement;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.exception.BusinessException;
import com.tenwa.officetempalte.service.BaseLableDataService;
import com.tenwa.officetempalte.serviceImp.BaseExcelCallBackServiceImpl;
import com.tenwa.officetempalte.util.FileOperatorUtil;
import com.tenwa.reckon.util.UUIDUtil;
public class CopyFIileExportCallBack extends BaseExcelCallBackServiceImpl {
@Override
public void run(BizObject templateConfig, Map<String, String> paramMap,
JBOTransaction tx) throws Exception {
BaseLableDataService dataSer=new BaseLableDataService(tx);
//获取模板配置
List<BizObject> exportConfig=dataSer.getTemplateExportConfig(templateConfig.getAttribute("id").getString());
Map<String,Object> tempModel=new HashMap<String, Object>();
tempModel.putAll(paramMap);
//获取生成文件实际路径
String fileName="";
String filePath="";
String fullPath="";
fileName=FileOperatorUtil.getFileNameByFormual(templateConfig.getAttribute("templateshowname").getString(), tempModel);
String uuid=UUID.randomUUID().toString().replaceAll("-", "");
fullPath=paramMap.get("fileSavePath")+fileName;
filePath=fullPath.replace(paramMap.get("fileSavePath"), "");
//获取模板文件
String tempName=templateConfig.getAttribute("templatepath").getString();
String rootPath=this.getClass().getResource("/").getPath();
rootPath=rootPath.substring(0, rootPath.indexOf("WEB-INF")-1);
tempName=rootPath+"/fileTemplate/"+tempName;
File file = new File(tempName);
if (file.isFile()) {
try {
//生成excel
this.writeDatatoTemplateExcel(templateConfig,tempName, paramMap, fullPath,exportConfig,tx);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("写入word模板时出错"+e.getMessage());
}
} else {
throw new Exception(templateConfig.getAttribute("templateshowname").getString() + "没有模板");
}
//生成成功 维护关系进附件表
this.createRelative(templateConfig, paramMap, fileName, filePath, fullPath, tx);
}
}