修改合同模板

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,9 +269,30 @@
$("#filetemplatemodel").append("</table>");
}
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;}
if (checkbox == "") {
alert("请选择合同模板下面的分类,或分类下面没有模板");
return false;
}
var tempids = "";
$('input[name="fileTemplate"]:checked').each(function () {
if (tempids.length > 0) {
@ -281,12 +302,14 @@
});
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) {
alert("合同编号重复,请联系后台人员处理!");
d.close().remove();
return;
}
}
@ -295,18 +318,19 @@
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) {
alert(sReturnInfo);
d.close().remove();
return;
}
var param = {};
@ -363,7 +387,9 @@
param["templateParam"] = JSON.stringify(tempParam).replace(/,/g, "@");//生成模板的参数据
for (var key in param) {
if(sparam.length>0){sparam+=",";}
if (sparam.length > 0) {
sparam += ",";
}
sparam += key + "=" + param[key];
}
@ -371,6 +397,7 @@
if (sReturn0.length > 2) {
alert(sReturn0);
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")%>"){ --%>
@ -381,7 +408,7 @@
if ("error" == OwmMessage) {
RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction", "companyUpdateDocContractStatus", "FlowUnid=<%=flowunid%>" + ",ProjectId=<%=projectId%>");
alert("生成失败1");
reloadSelf();
d.close().remove();
return;
}
} else {
@ -410,14 +437,15 @@
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()) {