修改合同模板

This commit is contained in:
yjf 2021-11-02 16:53:01 +08:00
parent 28672114ab
commit 7243eb88f4
4 changed files with 273 additions and 197 deletions

View File

@ -134,6 +134,7 @@
html+='<a onclick=downloadFile(\''+getItemValue(0,i,"fileid")+'\')><font color="blue">'+getObj(0,i,"filename").innerHTML+'</font></a>';
getObj(0,i,"filename").innerHTML=html;
if(fileid.length>0){
if(getObj(0,i,"operation")!= null){
if("<%=RightType%>"=="ReadOnly"){
getObj(0,i,"operation").innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn_icon_detail" onclick="editOffice(\''+fileid+'\',\''+filename+'\',\'1\')" title="²é¿´">&nbsp;</a>';
}else{
@ -142,6 +143,7 @@
}
}
}
}
//ÔÚÏ߱༭
function editOffice(id,filename,status){

View File

@ -269,75 +269,99 @@
$("#filetemplatemodel").append("</table>");
}
function createContractByTemplate(){
var checkbox=$("#filetemplatemodel").html()||"";
if(checkbox==""){alert("请选择合同模板下面的分类,或分类下面没有模板");return false;}
var tempids="";
$('input[name="fileTemplate"]:checked').each(function(){
if(tempids.length>0){
tempids+="&";
function popupShade() {
var d = top.dialog({
callbacks: {
cancel: function () {
return false
}
},
width: '200',
height: '40',
innerHTML: '<span id="dialogSpanId" style="font-size: 20px;color: #ccc">正在执行中......</span>'
});
d.showModal();
return d;
}
function createContractByTemplate() {
var d = popupShade();
setTimeout(function () {
var checkbox = $("#filetemplatemodel").html() || "";
if (checkbox == "") {
alert("请选择合同模板下面的分类,或分类下面没有模板");
return false;
}
var tempids = "";
$('input[name="fileTemplate"]:checked').each(function () {
if (tempids.length > 0) {
tempids += "&";
}
tempids += $(this).attr('value');
});
if(tempids.length<=0){
if (tempids.length <= 0) {
alert("请勾选合同模板!");
d.close().remove();
return;
}
if("BContractChangeApply"!="<%=CurPage.getParameter("ApplyType")%>"){
var contractNomessage = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil","CheckContractNo","contractId="+"<%=sContractId%>"+",contractNo="+"<%=CurPage.getParameter("ContractNo")%>");
if("error"==contractNomessage){
if ("BContractChangeApply" != "<%=CurPage.getParameter("ApplyType")%>") {
var contractNomessage = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil", "CheckContractNo", "contractId=" + "<%=sContractId%>" + ",contractNo=" + "<%=CurPage.getParameter("ContractNo")%>");
if ("error" == contractNomessage) {
alert("合同编号重复,请联系后台人员处理!");
d.close().remove();
return;
}
}
var message = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil","CheckCar","contractId="+"<%=sContractId%>"+",templateIds="+tempids+",flowunid="+"<%=flowunid%>"+",operationType="+"<%=CurPage.getParameter("operationType")%>");
if(""!=message){
if("01"=="<%=customertype%>"){
if(message.indexOf("请先删除后再生成")>0){
var message = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil", "CheckCar", "contractId=" + "<%=sContractId%>" + ",templateIds=" + tempids + ",flowunid=" + "<%=flowunid%>" + ",operationType=" + "<%=CurPage.getParameter("operationType")%>");
if ("" != message) {
if ("01" == "<%=customertype%>") {
if (message.indexOf("请先删除后再生成") > 0) {
alert("合同已生成,无法再次生成!");
location.reload();
d.close().remove();
return;
}
}
alert(message);
location.reload();
d.close().remove();
return;
}
//检查扣款卡信息是否签约
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.contract.check.ContractInfoCheck","ProjectSignStatus","projectid=<%=projectId%>");
if("success"!=sReturnInfo){
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.contract.check.ContractInfoCheck", "ProjectSignStatus", "projectid=<%=projectId%>");
if ("success" != sReturnInfo) {
alert(sReturnInfo);
d.close().remove();
return;
}
var param={};
var tempParam={};
var sparam="";
var param = {};
var tempParam = {};
var sparam = "";
// param["templateNo"]="0010";
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
tempParam["OBJECTTYPE"]="<%=CurPage.getParameter("FLOW_NO")%>";
tempParam["FLOW_UNID"]="<%=flowunid%>";
tempParam["CONTRACT_ID"]="<%=sContractId%>";
tempParam["PROJ_ID"]="<%=sProjId%>";
tempParam["PROJECT_ID"]="<%=projectId%>";
tempParam["contractNo"]="<%=contractNo%>";
tempParam["certid"]="<%=certid%>";
tempParam["mobile"]="<%=mobile%>";
tempParam["address"]="<%=address%>";
tempParam["NETMORTGAGOR"]="<%=NetMortgagor%>";
tempParam["NETCERTID"]="<%=NetCertid%>";
tempParam["NETMOBILE"]="<%=NetMobile%>";
tempParam["NETADDRESS"]="<%=Netaddress%>";
tempParam["CurUserId"] = "<%=CurUser.getUserID()%>";
tempParam["CurOrgId"] = "<%=CurUser.getOrgID()%>";
tempParam["OBJECTTYPE"] = "<%=CurPage.getParameter("FLOW_NO")%>";
tempParam["FLOW_UNID"] = "<%=flowunid%>";
tempParam["CONTRACT_ID"] = "<%=sContractId%>";
tempParam["PROJ_ID"] = "<%=sProjId%>";
tempParam["PROJECT_ID"] = "<%=projectId%>";
tempParam["contractNo"] = "<%=contractNo%>";
tempParam["certid"] = "<%=certid%>";
tempParam["mobile"] = "<%=mobile%>";
tempParam["address"] = "<%=address%>";
tempParam["NETMORTGAGOR"] = "<%=NetMortgagor%>";
tempParam["NETCERTID"] = "<%=NetCertid%>";
tempParam["NETMOBILE"] = "<%=NetMobile%>";
tempParam["NETADDRESS"] = "<%=Netaddress%>";
tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileSavePath")%>";
tempParam["fileSavePath"] = "<%=CurConfig.getConfigure("FileSavePath")%>";
//专用车产品、网约车、大通 使用手签的模板生成合同
var operationType2 = "<%=CurPage.getParameter("operationType")%>";
//alert(operationType2);
if("ZYC"==operationType2||"WYC"==operationType2||"DT"==operationType2){
param["templateIds"]='5c494617683548a49cfc050f60067ea2';//选择的模板ID
}else{
param["templateIds"]=tempids;//选择的模板ID
if ("ZYC" == operationType2 || "WYC" == operationType2 || "DT" == operationType2) {
param["templateIds"] = '5c494617683548a49cfc050f60067ea2';//选择的模板ID
} else {
param["templateIds"] = tempids;//选择的模板ID
}
//20210922 合同模板调整
@ -347,77 +371,81 @@
// 专用车产品、商用车一车一挂 商用车手签
// 商用车一车一挂电子签约 商用车电子签约
if("KHSQ"==operationType2){
param["templateIds"]='f57aa80567853aa37fd6dd902021a';//选择的模板ID
tempids='f57aa80567853aa37fd6dd902021a';
}else if("CYSHDZ"==operationType2){
param["templateIds"]='f57aa80567853aa37fd6dd902021b';//选择的模板ID
tempids='f57aa80567853aa37fd6dd902021b';
}else if("ZYC"==operationType2||"SYCSHHZ"==operationType2){
param["templateIds"]='f57aa80567853aa37fd6dd902021c';//选择的模板ID
tempids='f57aa80567853aa37fd6dd902021c';
}else if("SYCSHHZDZQ"==operationType2){
param["templateIds"]='f57aa80567853aa37fd6dd902021d';//选择的模板ID
tempids='f57aa80567853aa37fd6dd902021d';
if ("KHSQ" == operationType2) {
param["templateIds"] = 'f57aa80567853aa37fd6dd902021a';//选择的模板ID
tempids = 'f57aa80567853aa37fd6dd902021a';
} else if ("CYSHDZ" == operationType2) {
param["templateIds"] = 'f57aa80567853aa37fd6dd902021b';//选择的模板ID
tempids = 'f57aa80567853aa37fd6dd902021b';
} else if ("ZYC" == operationType2 || "SYCSHHZ" == operationType2) {
param["templateIds"] = 'f57aa80567853aa37fd6dd902021c';//选择的模板ID
tempids = 'f57aa80567853aa37fd6dd902021c';
} else if ("SYCSHHZDZQ" == operationType2) {
param["templateIds"] = 'f57aa80567853aa37fd6dd902021d';//选择的模板ID
tempids = 'f57aa80567853aa37fd6dd902021d';
}
param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据
for(var key in param){
if(sparam.length>0){sparam+=",";}
sparam+=key+"="+param[key];
param["templateParam"] = JSON.stringify(tempParam).replace(/,/g, "@");//生成模板的参数据
for (var key in param) {
if (sparam.length > 0) {
sparam += ",";
}
sparam += key + "=" + param[key];
}
var sReturn0 = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil","createContractTemplate",sparam);
var sReturn0 = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil", "createContractTemplate", sparam);
if(sReturn0.length>2){
if (sReturn0.length > 2) {
alert(sReturn0);
}else{
var pdfPath=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","wordToPdf","FlowUnid=<%=flowunid%>,flagType=word");
<%-- if("01"=="<%=customertype%>"||"1"=="<%=CurPage.getParameter("isNetCar")%>"||"BAIC_MOTOR"=="<%=CurPage.getParameter("operationType")%>"||"ZYC"=="<%=CurPage.getParameter("operationType")%>"||"KHSQ"=="<%=CurPage.getParameter("operationType")%>"||"KJZL"=="<%=CurPage.getParameter("operationType")%>"){ --%>
d.close().remove();
} else {
var pdfPath = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction", "wordToPdf", "FlowUnid=<%=flowunid%>,flagType=word");
<%-- if("01"=="<%=customertype%>"||"1"=="<%=CurPage.getParameter("isNetCar")%>"||"BAIC_MOTOR"=="<%=CurPage.getParameter("operationType")%>"||"ZYC"=="<%=CurPage.getParameter("operationType")%>"||"KHSQ"=="<%=CurPage.getParameter("operationType")%>"||"KJZL"=="<%=CurPage.getParameter("operationType")%>"){ --%>
var operationType = "<%=CurPage.getParameter("operationType")%>";
if("ZC"!=operationType){
var OwmMessage = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","SystemMakeOneDimensionalCode","ProjectId=<%=projectId%>,contract_id=<%=sContractId%>,contractNo=<%=contractNo%>,leasform=<%=leasform%>");
if("error"==OwmMessage){
RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","companyUpdateDocContractStatus","FlowUnid=<%=flowunid%>"+",ProjectId=<%=projectId%>");
if ("ZC" != operationType) {
var OwmMessage = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction", "SystemMakeOneDimensionalCode", "ProjectId=<%=projectId%>,contract_id=<%=sContractId%>,contractNo=<%=contractNo%>,leasform=<%=leasform%>");
if ("error" == OwmMessage) {
RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction", "companyUpdateDocContractStatus", "FlowUnid=<%=flowunid%>" + ",ProjectId=<%=projectId%>");
alert("生成失败1");
reloadSelf();
d.close().remove();
return;
}
}else{
} else {
//中车pdf添加水印
var OwmMessage = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","SystemMakeOneDimensionalCode","ProjectId=<%=projectId%>,contract_id=<%=sContractId%>,contractNo=<%=contractNo%>,leasform=<%=leasform%>");
var OwmMessage = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction", "SystemMakeOneDimensionalCode", "ProjectId=<%=projectId%>,contract_id=<%=sContractId%>,contractNo=<%=contractNo%>,leasform=<%=leasform%>");
}
if(("01"=="<%=customertype%>"&&"Auto" == "<%=sealType%>" )||("Auto" == "<%=sealType%>" && "Hand" == "<%=signType%>" )){
if (("01" == "<%=customertype%>" && "Auto" == "<%=sealType%>") || ("Auto" == "<%=sealType%>" && "Hand" == "<%=signType%>")) {
var falg = "";
if("LHZL"==operationType || "SQSYC"==operationType){
falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionTwo","compnySignIng","FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>,operationType="+operationType);
if ("LHZL" == operationType || "SQSYC" == operationType) {
falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionTwo", "compnySignIng", "FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>,operationType=" + operationType);
//商用车一车一挂、专用车产品、网约车、大通、C端直租、客户手签、商用车手签、乘用车手签
}else if ("SYCSHHZ"==operationType||"ZYC"==operationType||"WYC"==operationType||"DT"==operationType||"CDZZ"==operationType
||"CYCSQ"==operationType ||"KHSQ"==operationType ||"SYCSQ"==operationType||"5c494617683548a49cfc050f60067ea2"==tempids){
falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionTwoOwn","compnySignIng","FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>,tempid="+tempids);
}else if("ZC"==operationType){
falg="success";
}else if("KJLHZL"==operationType||"KJLHZLCYC"==operationType||"KJLHZLSYC"==operationType ||"KJCYYQR"==operationType
||"KJSYYQR"==operationType||"CYCDZQ"==operationType||"SYCDZQ"==operationType){//凯捷联合租赁商用车手签、乘用车手签
} else if ("SYCSHHZ" == operationType || "ZYC" == operationType || "WYC" == operationType || "DT" == operationType || "CDZZ" == operationType
|| "CYCSQ" == operationType || "KHSQ" == operationType || "SYCSQ" == operationType || "5c494617683548a49cfc050f60067ea2" == tempids) {
falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionTwoOwn", "compnySignIng", "FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>,tempid=" + tempids);
} else if ("ZC" == operationType) {
falg = "success";
} else if ("KJLHZL" == operationType || "KJLHZLCYC" == operationType || "KJLHZLSYC" == operationType || "KJCYYQR" == operationType
|| "KJSYYQR" == operationType || "CYCDZQ" == operationType || "SYCDZQ" == operationType) {//凯捷联合租赁商用车手签、乘用车手签
// alert("凯捷联合租赁合同模板id=" + tempids);
falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionNewUtils","compnySignIng","FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>,operationType="+operationType);
} else{
falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","compnySignIng","FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>");
falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionNewUtils", "compnySignIng", "FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>,operationType=" + operationType);
} else {
falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction", "compnySignIng", "FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>");
}
if("success"!= falg ){
RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","companyUpdateDocContractStatus","FlowUnid=<%=flowunid%>"+",ProjectId=<%=projectId%>");
if ("success" != falg) {
RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction", "companyUpdateDocContractStatus", "FlowUnid=<%=flowunid%>" + ",ProjectId=<%=projectId%>");
alert("生成失败!!!");
reloadSelf();
d.close().remove();
return;
}
}
alert("生成成功");
d.close().remove();
}
reloadSelf();
}, '200');
}
function downloadFile(id){
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");

14
config/license.xml Normal file
View File

@ -0,0 +1,14 @@
<License>
<!-- pdf去水印 -->
<Data>
<Products>
<Product>Aspose.Total for Java</Product>
<Product>Aspose.Words for Java</Product>
</Products>
<EditionType>Enterprise</EditionType>
<SubscriptionExpiry>20991231</SubscriptionExpiry>
<LicenseExpiry>20991231</LicenseExpiry>
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
</Data>
<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>
</License>

View File

@ -1,15 +1,47 @@
package com.tenwa.channelportal.action.generativecontract;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;
import com.tenwa.httpclient.resources.QuartzPropertiesUtil;
import org.apache.log4j.Logger;
import com.tenwa.httpclient.resources.QuartzPropertiesUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
public class WordToPDFUtil {
private static Logger logger = Logger.getLogger(WordToPDFUtil.class);
public synchronized static Boolean Word2Pdf(String inPath, String outPath) throws Exception {
// 验证License 若不验证则转化出的pdf文档会有水印产生
if (!Word2PdfUtil.getLicense()) {
throw new RuntimeException("转PDF工具,验证License失败");
}
if (inPath.contains(".doc")) outPath = inPath.replace(".docx", ".pdf").replace(".doc", ".pdf");
File inputFile = new File(inPath);
if (!inputFile.exists()) {
logger.error("word转换pdf源文件不存在:" + inPath);
return false;
}
try {
long old = System.currentTimeMillis();
logger.info("============转换pdf开始============");
File file = new File(outPath);
FileOutputStream os = new FileOutputStream(file);
Document doc = new Document(inPath);
doc.save(os, SaveFormat.PDF);
logger.info("共耗时:" + (System.currentTimeMillis() - old) + "毫秒");
logger.info("============转换pdf结束============");
} catch (Exception e) {
logger.error(e.getMessage());
return false;
}
return true;
}
// 将word格式的文件转换为pdf格式
public synchronized static Boolean Word2Pdf(String srcPath, String desPath) throws Exception {
public synchronized static Boolean Word2Pdf1(String srcPath, String desPath) throws Exception {
// 源文件目录
File inputFile = new File(srcPath);
if (!inputFile.exists()) {
@ -23,29 +55,29 @@ public class WordToPDFUtil {
}
Process process = null;
//获取当前时间的毫秒数
long start= System.currentTimeMillis();
long start = System.currentTimeMillis();
logger.info("============转换pdf开始============");
try{
try {
String path = QuartzPropertiesUtil.get("libreOffice_path");
String cmd = path+"soffice --headless -invisible --convert-to pdf "+srcPath+" --outdir "+desPath;
logger.info("python:"+cmd);
String cmd = path + "soffice --headless -invisible --convert-to pdf " + srcPath + " --outdir " + desPath;
logger.info("python:" + cmd);
process = Runtime.getRuntime().exec(cmd);
String cmdMsg = "";
BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream()));
while((cmdMsg=bufferedReader.readLine()) !=null){
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((cmdMsg = bufferedReader.readLine()) != null) {
logger.info(cmdMsg);
}
process.waitFor();
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
return false;
}finally{
if(null!=process){
} finally {
if (null != process) {
process.destroy();
}
long end = System.currentTimeMillis();
//输出转换pdf所需毫秒数
logger.info(end-start+"ºÁÃë");
logger.info(end - start + "毫秒");
logger.info("============转换pdf结束============");
}
return true;