自然人发起电子签约

This commit is contained in:
tangfutang 2018-06-10 20:49:28 +08:00
parent 4992ac876a
commit 1afdb94406
12 changed files with 2863 additions and 3 deletions

View File

@ -0,0 +1,328 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2017-09-28
Content:
History Log:
*/
String custtype = CurPage.getParameter("CustomerType");
String projectId = CurPage.getParameter("ProjectId");
// String signStatus = CurPage.getParameter("SignStatus");
String contractNumber = CurPage.getParameter("ContractNumber");
String productId = CurPage.getParameter("ProductId");
String flowunid = CurPage.getParameter("FlowUnid");
String action = CurPage.getParameter("action");
ASObjectModel doTemp = new ASObjectModel("LBContractPrintList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(20);
String id=projectId;
dwTemp.genHTMLObjectWindow(id+","+flowunid);
String btnflag = "true";
String btnflagcom = "false";
if("01".equals(custtype)){
btnflagcom = "true";
}
if("queryContract".equals(action)){
btnflag = "false";
btnflagcom = "false";
}
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{btnflag,"","Button","发起电子签约","电子签章合同","signOnLine()","","","","btn_icon_sign",""},
{btnflag,"","Button","查询签约结果","查询签约结果","getStatus()","","","","btn_icon_obtain",""},
{btnflag,"","Button","重新发送短信","重新发送短信","sendMessageAgain()","","","","btn_icon_refresh",""},
{btnflagcom,"","Button","下载纸质合同","下载纸质合同","downFile()","","","","btn_icon_down",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<style>
.test>td{
color:red;
}
</style>
<script type="text/javascript">
//测试电子签约
<%-- function signOnLinetest(){
var sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","signIng","ProjectId=<%=projectId%>,CurUserID=<%=CurUser.getUserID()%>");
} --%>
//完成电子签约
function signOnLine(){
var results = RunJavaMethodTrans("com.tenwa.action.channelportal.businesshanding.contractaward.ContractAward","projectStatus","project_id=<%=projectId%>");
var result = results.split("@");
if(eval(result[0])<3){
AsDebug.showMessage("提示","请生成合同,在电子签约","","",true);
return;
};
if(eval(result[0]) > 4 && eval(result[0]) < 7){
AsDebug.showMessage("提示","合同状态为:"+result[1]+"不可以电子签章","","",true,'','','',function(){
reloadSelf();
});
return;
}
if(eval(result[0])==4){
AsDebug.showMessage("提示","电子签约已完成,无需重复发起!","","",true);
return;
};
if(eval(result[0])==8){
AsDebug.showMessage("提示","电子签约已发起,请签署电子合同!","","",true);
return;
};
//查看合同word转换pdf进度
var result=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","getMakeContractProcess","ProjectId=<%=projectId%>");
if(eval(result)==1){
wordToPdfFalse();
alert("word转换PDF格式部分失败,");
return;
}else if(eval(result)==2){
wordToPdfFalse();
alert("word转换PDF格式失败");
return;
}else if(eval(result)==3){
alert("word转换PDF格式部分失败");
wordToPdfFalse();
return;
}else if(eval(result)==4){
alert("word文件正在转换PDF文件格式");
}else if(eval(result)==5){
wordToPdf();
alert("word文件没有转换PDF文件格式");
return;
}
//自然人电子签约
var sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","signIng","ProjectId=<%=projectId%>,CurUserID=<%=CurUser.getUserID()%>");
var sReturns = sReturn.split("@");
if("success"==sReturns[0]){
AsDebug.showMessage("提示","电子签约发起成功!","","",true,"","","",function(){
window.location.reload();
});
}else if(sReturns[1].indexOf("用户认证信息与合同签署方信息不匹配")!=-1){
var message="";
if("true"==sReturns[0]){
message = "部分合同发送成功;注意发送失败合同:";
}
AsDebug.showMessage("提示",message+sReturns[1],"","",true,"","","",function(){
window.location.reload();
});
}else{
var message="";
if("true"==sReturns[0]){
message = "部分合同发送成功;注意发送失败合同";
}else{
message = "电子签约发送失败";
}
AsDebug.showMessage("提示",message,"","",true,"","","",function(){
window.location.reload();
});
}
}
//查询电子签约状态
function getStatus(){
var results = RunJavaMethodTrans("com.tenwa.action.channelportal.businesshanding.contractaward.ContractAward","projectStatus","project_id=<%=projectId%>");
var result=results.split("@");
if(eval(result[0])<3){
AsDebug.showMessage("提示","请生成合同,在电子签约","","",true);
return;
};
if(eval(result[0])==4){
AsDebug.showMessage("提示","电子签约已完成!","","",true);
return;
}
if(eval(result[0])!=8 && result[2]=="false"){
AsDebug.showMessage("提示","没有发起电子签约,无法获取签约状态!","","",true);
return;
}
var sParams="ProjectId=<%=projectId%>,customerType=<%=custtype%>,CurUserID=<%=CurUser.getUserID()%>";
var sReturn=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","contractSignStatus",sParams);
AsDebug.showMessage("提示",sReturn,"","",true,'','','',function(){
window.location.reload();
});
}
$(function (){
var html="";
if("<%=custtype%>"=="03"){
//(无法完成电子签约,请采用下载纸质合同)
html='<tr id="contractsign" class="test"><td>合同签约操作步骤:<br/>1.制作合同<br/>2.发起电子签约<br/>3.完成电子签约</td></tr>';
}else{
html='<tr id="contractsign" class="test"><td>合同签约操作步骤:<br/>1.制作合同<br/>2.下载纸质合同</td></tr>';
}
$("#ListTable").prepend(html);
$("#myiframe0_static").height($("#myiframe0_static").height()-78);
$("#myiframe0_cells").height($("#myiframe0_cells").height()-78);
// setTimes1();
})
//定时器
function setTimes(){
var a=setInterval(function(){
var result=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","getMakeContractProcess","ProjectId=<%=projectId%>");
if("success"==result){
clearInterval(a);
AsDebug.showMessage("提示","生成的合同文件转换PDF格式已完成","","",true,"","","",function(){
window.location.reload();
});
}else{
AsDebug.showMessage("提示","生成的合同文件正在转换PDF格式......","","",true,"","","",function(){
window.location.reload();
});
// wordToPdf();
}
},5000);
}
//定时器
function setTimes1(){
var a=setInterval(function(){
var result=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","getMakeContractProcess","ProjectId=<%=projectId%>");
if("success"==result){
clearInterval(a);
}else{
AsDebug.showMessage("提示","生成的合同文件正在转换PDF格式......","","",true,"","","",function(){
window.location.reload();
});
// wordToPdf();
}
},3000);
}
//在加载完表格后调用
function afterSearch(){
for(var i=0;i<getRowCount(0);i++){
var fileinfo=getObj(0,i,"fileinfo").innerHTML;
var obj=eval('('+fileinfo+')');
var html="";
for(var file in obj){
if(obj[file]['pdf']=="true"){
html+='<a class="btn_icon btn_icon_search" onclick="showPDF(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\');">&nbsp;</a>';
}
html+='<a onclick="downloadFile(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\');">&nbsp;';
html+='<font color="blue">'+obj[file]['filename']+'</font></a>';
html+='【操作时间:'+obj[file]['inputtime']+'】';
html+='【操作人:'+obj[file]['inputuser']+'】';
html+='【大小:'+Math.floor(obj[file]['FileSize']/1024*100)/100+'kb】';
html+='</br>';
}
getObj(0,i,"fileinfo").innerHTML=html;
getObj(0,i,"fileinfo").style["white-space"]="pre-wrap";
}
}
function downloadFile(id){
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/docDownloadServlet?CompClientID=<%=sCompClientID%>&sqlString=save@"+id, "downloadTemplate");
}
function downFile(){
var results = RunJavaMethodTrans("com.tenwa.action.channelportal.businesshanding.contractaward.ContractAward","projectStatus","project_id=<%=projectId%>");
var result = results.split("@");
if("<%=custtype%>"=="01"){
if(eval(result[0])<3){
AsDebug.showMessage("提示","请生成合同,在下载纸质合同","","",true);
return;
};
//查看合同word转换pdf进度
var result=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","getMakeContractProcess","ProjectId=<%=projectId%>");
if(result=="error"){
AsDebug.showMessage("提示","合同文件正在转换pdf......","","",true,"","","",function(){
window.location.reload();
});
return;
}else{
downloadZipFile();
}
}else{
if(eval(result[0])<3){
AsDebug.showMessage("提示","请生成合同,自然人没有权限下载纸质合同!","","",true);
return;
};
AsDebug.showMessage("提示","自然人没有权限下载纸质合同,请电子签约!","","",true);
}
}
function downloadZipFile(){
var id="<%=projectId%>";
//打包文件名
var fileName="ContractSign<%=contractNumber%>";
//打包类型为合同签约模块
var packageType="contractSign";
var filePath = "<%=CurConfig.getConfigure("FileSavePath")%>";
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/ContractSigndocDownloadServlet?CompClientID=<%=sCompClientID%>&id="+id+"&filePath="+filePath+"&fileName="+fileName+"&packageType="+packageType, "downloadTemplate");
}
function showPDF(id,name){
var sUrl="/Tenwa/Comm/DocList/showPDF.jsp";
var param="attrid="+id;
AsControl.OpenPage(sUrl,param,"","");
}
//重新发送短信
function sendMessageAgain(){
var results = RunJavaMethodTrans("com.tenwa.action.channelportal.businesshanding.contractaward.ContractAward","projectStatus","project_id=<%=projectId%>");
var result=results.split("@");
debugger;
if(eval(result[0])<3){
AsDebug.showMessage("提示","请先制作合同!","","",true);
return;
};
if(eval(result[0])==4){
AsDebug.showMessage("提示","电子签约已完成,无法发送短信!","","",true);
return;
}
if(eval(result[0])!=8 && result[2]=="false"){
AsDebug.showMessage("提示","没有发起电子签约,无法发送短信!","","",true);
return;
}
var sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","sendMessageAgain","ProjectId=<%=projectId%>");
if("success"==sReturn){
AsDebug.showMessage("提示","短信发送成功!","","",true);
}else{
AsDebug.showMessage("提示","短信发送失败!["+sReturn+"]","","",true);
}
}
//当前日期
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
var strMinutes = date.getMinutes()
var strSeconds = date.getSeconds();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
if (strMinutes >= 0 && strMinutes <= 9) {
strMinutes = "0" + strMinutes;
}
if (strSeconds >= 0 && strSeconds <= 9) {
strSeconds = "0" + strSeconds;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + date.getHours() + seperator2 + strMinutes
+ seperator2 + strSeconds;
return currentdate;
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -198,7 +198,6 @@
alert("请勾选合同模板!");
return;
}
alert(tempids);
var param={};
var tempParam={};
var sparam="";
@ -225,6 +224,7 @@ alert(tempids);
if(sReturn0.length>2){
alert(sReturn0);
}else{
RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","wordToPdf","FlowUnid=<%=flowunid%>,flagType=word");
alert("生成成功");
}
reloadSelf();

View File

@ -16,11 +16,13 @@
//alert(getHtmlMessage('1'));//ÇëÑ¡ÔñÒ»ÌõÐÅÏ¢£¡
return;
}
debugger;
sReturn = sReturn.split("@");
var id=sReturn[0];
var product_id=sReturn[1];
var project_id = sReturn[2];
var project_name = sReturn[3];
var customertype = sReturn[4];
var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>";
sParams =sParams+",ProductId="+product_id+",ProjectId="+id+",ProjectNo="+project_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>";
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.contract.contractapproval.ContractApprovalStartAction","initFLow",sParams);

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,104 @@
package com.tenwa.channelportal.action.generativecontract;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import jbo.app.tenwa.doc.LB_DOCATTRIBUTE;
import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST;
import org.apache.log4j.Logger;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.aspose.words.Document;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
public class Word2PdfUtil {
private static Logger logger = Logger.getLogger(Word2PdfUtil.class);
public static void main(String[] args) throws Exception {
// doc2pdf("D:/光大金融租赁公司融资租赁合同(201801-200385).docx", "D:/光大融资租赁公司抵押合同(201801-200385-D001).pdf","aa");
}
public static boolean getLicense() {
boolean result = false;
try {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("license.xml");
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public static void doc2pdf(String inPath,String outPath,String attrid) throws JBOException {
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
Boolean flag=false;
try {
File inputFile = new File(inPath);
if (!inputFile.exists()) {
throw new RuntimeException("要读取的文件不存在");
}
long old = System.currentTimeMillis();
logger.info("============转换pdf开始============");
File file = new File(outPath); // 新建一个空白pdf文档
FileOutputStream os = new FileOutputStream(file);
Document doc = new Document(inPath); // Address是将要被转化的word文档
doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,
// EPUB, XPS, SWF 相互转换
long now = System.currentTimeMillis();
logger.info("共耗时:" + (now - old) + "毫秒");
logger.info("============转换pdf结束============");
} catch (Exception e) {
e.printStackTrace();
flag=true;
}finally{
JBOTransaction tx = JBOFactory.createJBOTransaction();
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
BizObjectManager attrBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);
if(flag){
File file =new File(inPath);
BizObject contBo = contBom.createQuery("attribute_id='"+attrid+"'").getSingleResult(true);
contBo.setAttributeValue("FULLPATH",inPath);
contBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".pdf",".docx" ));
contBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".pdf", ".docx"));
contBo.setAttributeValue("CONTENT_TYPE","application/vnd.openxmlformats-officedocument.wordprocessingml.document");
contBo.setAttributeValue("PROCESS","3");
contBom.saveObject(contBo);
BizObject attrBo = attrBom.createQuery("id='"+attrid+"'").getSingleResult(true);
attrBo.setAttributeValue("FULLPATH",inPath);
attrBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".pdf", ".docx"));
attrBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".pdf", ".docx"));
attrBo.setAttributeValue("FileSize",file.length());
attrBo.setAttributeValue("CONTENT_TYPE","application/vnd.openxmlformats-officedocument.wordprocessingml.document");
attrBom.saveObject(attrBo);
tx.commit();
}else{
BizObject contBo = contBom.createQuery("attribute_id='"+attrid+"'").getSingleResult(true);
File file =new File(outPath);
contBo.setAttributeValue("FULLPATH",outPath);
contBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".docx",".pdf" ));
contBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf"));
contBo.setAttributeValue("CONTENT_TYPE","application/pdf");
contBo.setAttributeValue("PROCESS","2");
contBom.saveObject(contBo);
BizObject attrBo = attrBom.createQuery("id='"+attrid+"'").getSingleResult(true);
attrBo.setAttributeValue("FULLPATH",outPath);
attrBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf"));
attrBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf"));
attrBo.setAttributeValue("FileSize",file.length());
attrBo.setAttributeValue("CONTENT_TYPE","application/pdf");
attrBom.saveObject(attrBo);
tx.commit();
}
}
}
}

View File

@ -0,0 +1,54 @@
package com.tenwa.channelportal.action.generativecontract;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import org.apache.log4j.Logger;
public class WordToPDFUtil {
private static Logger logger = Logger.getLogger(WordToPDFUtil.class);
// 将word格式的文件转换为pdf格式
public synchronized static Boolean Word2Pdf(String srcPath, String desPath) throws Exception {
// 源文件目录
File inputFile = new File(srcPath);
if (!inputFile.exists()) {
System.out.println("word转换pdf源文件不存在");
return false;
}
// 输出文件目录
File outputFile = new File(desPath);
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
Process process = null;
//获取当前时间的毫秒数
long start= System.currentTimeMillis();
logger.info("============转换pdf开始============");
try{
String cmd = "D:\\office\\program\\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){
logger.info(cmdMsg);
}
process.waitFor();
}catch(Exception e){
e.printStackTrace();
return false;
}finally{
if(null!=process){
process.destroy();
}
long end = System.currentTimeMillis();
//输出转换pdf所需毫秒数
logger.info(end-start+"毫秒");
logger.info("============转换pdf结束============");
}
return true;
}
public static void main(String[] args) throws Exception {
WordToPDFUtil.Word2Pdf("d:\\1、光大金融租赁公司融资租赁合同法人—保证保险模式.doc", "d:\\woqu");
}
}

View File

@ -0,0 +1,47 @@
package com.tenwa.doc.util;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class BASE64 {
/**
* 将本地图片进行Base64位编码
*
* @param imgUrl
* 图片的url路径如d:\\中文.jpg
* @return
*/
public static String encodeImgageToBase64(File imageFile) {// 将图片文件转化为字节数组字符串并对其进行Base64编码处理
// 其进行Base64编码处理
byte[] data = null;
// 读取图片字节数组
try {
InputStream in = new FileInputStream(imageFile);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
// 对字节数组Base64编码
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);// 返回Base64编码过的字节数组字符串
}
public static InputStream encodeFileToBase64(String filestr) {
InputStream stream=null;
try{
BASE64Decoder decoder = new BASE64Decoder();
byte[] bytes1 = decoder.decodeBuffer(filestr);
stream = new ByteArrayInputStream(bytes1);
} catch (IOException e) {
e.printStackTrace();
}
return stream;
}
}

View File

@ -5,8 +5,10 @@ import java.util.HashMap;
import java.util.Map;
import jbo.app.tenwa.doc.LB_DOCATTRIBUTE;
import jbo.app.tenwa.doc.LB_DOCCONFIG;
import jbo.app.tenwa.doc.LB_DOCLIBRARY;
import jbo.app.tenwa.doc.LB_DOCRELATIVE;
import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
@ -89,5 +91,43 @@ public abstract class CreateOfficeCallBackService {
}
attr.setAttributeValue("FileSize",file.length());
attrBm.saveObject(attr);
// 写入LB_DOC_CONTRACT_LIST
// 根据模板参数获取到lb_docconfig表信息
String attrId = attr.getAttribute("id").getString();
BizObjectManager lbcontractBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
Map<String, String> contractMap = new HashMap<String, String>();
String[] ss = new String[] {"CUSTOMERNAME", "TELEPHONE", "CONTRACT_NO", "CONTRACT_ID", "PROJECT_ID", "PRODECT_ID", "IDS",
"FLOW_UNID"};
for (int i = 0; i < ss.length; i++) {
if (paramMap.containsKey(ss[i])) {
contractMap.put(ss[i], paramMap.get(ss[i]));
}
}
BizObject contract = lbcontractBom.newObject();
for (Map.Entry<String, String> entry : contractMap.entrySet()) {
contract.setAttributeValue(entry.getKey(), entry.getValue());
}
contract.setAttributeValue("InputUserId", paramMap.get("CurUserId"));
contract.setAttributeValue("InputOrgId", paramMap.get("CurOrgId"));
contract.setAttributeValue("FILENAME", attr.getAttribute("FILENAME").toString());
contract.setAttributeValue("ATTRIBUTE_ID", attrId);
contract.setAttributeValue("LIBRARY_ID", libraryId);
contract.setAttributeValue("FILE_TYPE", "扫描件");
contract.setAttributeValue("FILE_FLAG", "yes");
contract.setAttributeValue("DOC_NAME", templateConfig.getAttribute("TEMPLATENAME").getString());
contract.setAttributeValue("FILEPATH", attr.getAttribute("FILEPATH").toString());
contract.setAttributeValue("FULLPATH", attr.getAttribute("FULLPATH").toString());
contract.setAttributeValue("InputTime", StringFunction.getTodayNow());
// contract.setAttributeValue("CONFIG_ID", templateConfig.getAttribute("CONFIG_ID").getString());
// contract.setAttributeValue("DOC_CLASS_ITEMNO", bo.getAttribute("DOC_CLASS_ITEMNO").getString());
if (fullpath.endsWith(".pdf")) {
contract.setAttributeValue("PROCESS", "2");
} else if (fullpath.endsWith(".docx") || fullpath.endsWith(".doc")) {
contract.setAttributeValue("PROCESS", "1");
}
contract.setAttributeValue("SIGN_TYPE", "DRAFT");// 签约状态默认为草稿
contract.setAttributeValue("SENDPROCESS", "0");// 发送状态默认未发送
lbcontractBom.saveObject(contract);
}
}

View File

@ -0,0 +1,558 @@
package com.tenwa.action.channelportal.businesshanding.contractaward;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jbo.app.tenwa.calc.LC_PROJ_CONDITION;
import jbo.app.tenwa.doc.LB_DOCATTRIBUTE;
import jbo.app.tenwa.doc.LB_DOCLIBRARY;
import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST;
import jbo.com.tenwa.lease.comm.BUSINESS_STATUS;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_STATUS;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO;
import jbo.sys.CHANNEL_SUBMIT_APPLICATIONS;
import com.amarsoft.app.als.bizobject.customer.CustomerManager;
import com.amarsoft.app.util.ProductParamUtil;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.BizObjectQuery;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.Configure;
import com.amarsoft.awe.control.model.Page;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.context.ASUser;
import com.tenwa.channelportal.action.ContractSignAction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import common.Logger;
/**
* 合同签约
* @author tenwa518
*
*/
public class ContractAward {
private Logger logger=Logger.getLogger(this.getClass());
public String libraryId;
public String project_id;
public String contract_id;
public String ProjectId;
public String CustomerType;
public String ProductId;
public String ContractId;
public Page CurPage;
public Configure Curconf;
public String CurUserID;
public String FlowUnid;
public String getFlowUnid() {
return FlowUnid;
}
public void setFlowUnid(String flowUnid) {
FlowUnid = flowUnid;
}
public String getCurUserID() {
return CurUserID;
}
public void setCurUserID(String curUserID) {
CurUserID = curUserID;
}
public String getContract_id() {
return contract_id;
}
public void setContract_id(String contract_id) {
this.contract_id = contract_id;
}
public Configure getCurconf() {
return Curconf;
}
public void setCurconf(Configure curconf) {
Curconf = curconf;
}
public Page getCurPage() {
return CurPage;
}
public void setCurPage(Page curPage) {
CurPage = curPage;
}
public String getContractId() {
return ContractId;
}
public void setContractId(String contractId) {
ContractId = contractId;
}
public String getProductId() {
return ProductId;
}
public void setProductId(String productId) {
ProductId = productId;
}
public String getCustomerType() {
return CustomerType;
}
public void setCustomerType(String customerType) {
CustomerType = customerType;
}
public String getProjectId() {
return ProjectId;
}
public void setProjectId(String projectId) {
ProjectId = projectId;
}
public String getLibraryId() {
return libraryId;
}
public void setLibraryId(String libraryId) {
this.libraryId = libraryId;
}
public String getProject_id() {
return project_id;
}
public void setProject_id(String project_id) {
this.project_id = project_id;
}
//校验退回的单子是否包含审批意见
public String checkOpion(JBOTransaction tx){
String sql = "select case when count(*)>0 then 'true' else 'false' end FLAG from lb_project_info O , lb_contract_approve A where O.id=A.Project_Id and O.id='"+project_id+"'";
try {
List<Map<String,String>> data = DataOperatorUtil.getDataBySql(tx, sql, null);
return data.get(0).get("FLAG").toString();
} catch (Exception e) {
e.printStackTrace();
}
return "true";
}
public String GenerativeContractDelete(JBOTransaction tx){
try{
BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME);
@SuppressWarnings("unchecked")
BizObject doclib=bom1.createQuery("id=:id").setParameter("id", libraryId).getSingleResult(true);
String DOCRELATIVEid=doclib.getAttribute("relative_id").toString();
BizObjectManager bom2=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME);
List<BizObject> DOCATTRIBUTEids=bom2.createQuery("library_id=:library_id").setParameter("library_id",libraryId ).getResultList(false);
Map<String,String> condtion= new HashMap<String,String>();
condtion.put("id", DOCRELATIVEid);
DataOperatorUtil.deleteJBOByCondtion(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME, condtion, tx);
condtion.clear();
condtion.put("id",libraryId );
DataOperatorUtil.deleteJBOByCondtion(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME, condtion, tx);
condtion.clear();
for(BizObject key:DOCATTRIBUTEids){
condtion.put("id", key.getAttribute("id").toString());
DataOperatorUtil.deleteJBOByCondtion(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME, condtion, tx);
}
}catch(Exception e){
return "ERROR";
}
return "SUCCESS";
}
public String selectAttributeId(JBOTransaction tx) throws JBOException{
BizObjectManager bom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME);
String ids="";
@SuppressWarnings("unchecked")
List<BizObject> bo=bom.createQuery("library_id=:libraryId").setParameter("libraryId",libraryId).getResultList(false);
for(BizObject key:bo){
ids+=key.getAttribute("id").toString()+"@";
}
System.out.println("附件id"+ids);
return ids;
}
public String uploadConFileChangeStatus(JBOTransaction tx)throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME);
BizObjectManager libbom = JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME);
tx.join(bom);
BizObject libo=libbom.createQuery("id='"+libraryId+"'").getSingleResult(false);
String docName=libo.getAttribute("DOC_NAME").toString();
//将合同状态改为已生成合同
if(docName.equals("融资租赁合同") || docName.equals("担保人合同")){
BizObjectQuery boq = bom.createQuery("update O set project_status = '5' where id=:project_id ").setParameter("project_id",project_id);
boq.executeUpdate();
}
return "success";
}
/***
* 已经生成的合同作废
* @param tx
* @return
* @throws JBOException
*/
public String updateDocContractStatus(JBOTransaction tx) throws JBOException{
BizObjectManager attBom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);
BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
try{
List<BizObject> lcl=lclManager.createQuery("file_flag='yes' and project_id='"+project_id+"'").getResultList(false);
for(BizObject key:lcl){
lclManager.createQuery("update O set file_flag='no',message='1' where id=:id").setParameter("id",key.getAttribute("id").toString()).executeUpdate();
attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate();
}
}catch(Exception e){
tx.rollback();
e.printStackTrace();
System.out.println(e.getMessage());
return "error";
}
return "success";
}
//根据合同id改变合同文件的状态
public String updateDocContractStatusContract(JBOTransaction tx) throws JBOException{
BizObjectManager attBom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);
BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
try{
List<BizObject> lcl = null;
lcl=lclManager.createQuery("flow_unid='"+FlowUnid+"'and file_flag='yes' ").getResultList(false);
if(lcl!=null){
for(BizObject key:lcl){
lclManager.createQuery("update O set file_flag='no' where flow_unid=:flow_unid and file_flag='yes'").setParameter("flow_unid",key.getAttribute("flow_unid").toString()).executeUpdate();
attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate();
}
}
}catch(Exception e){
tx.rollback();
e.printStackTrace();
System.out.println(e.getMessage());
return "error";
}
return "success";
}
public String projectStatus(JBOTransaction tx) throws JBOException{
BizObjectManager bom = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx);
BizObjectManager bomstatus = JBOFactory.getBizObjectManager(LB_CONTRACT_STATUS.CLASS_NAME,tx);
BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
Boolean flag=false;
List<BizObject> ldclBo = ldclBom.createQuery("project_id='"+project_id+"' and file_flag='yes' and sendprocess='1'").getResultList(false);
if(ldclBo.size()>0){
flag=true;
}
BizObject bo=bom.createQuery("id='"+project_id+"'").getSingleResult(false);
BizObject bostatus=bomstatus.createQuery("status_code='"+bo.getAttribute("PROJECT_STATUS").toString()+"'").getSingleResult(false);
String projstatus=bostatus!=null?bostatus.getAttribute("STATUS_NAME").toString():"";
return bo.getAttribute("PROJECT_STATUS").toString()+"@"+projstatus+"@"+flag;
}
public String customerinfo(JBOTransaction tx) throws JBOException, SQLException{
Transaction Sqlca = Transaction.createTransaction(tx);
String customerinfo="";
SqlObject sqlcustomer;
ASResultSet rs = null;
String sql = "SELECT ci.customerid,ci.customername,ct.telephone FROM lb_project_info O LEFT JOIN lb_union_lessee lul ON lul.project_id=O.id LEFT JOIN customer_info ci ON ci.customerid=lul.customer_id LEFT JOIN customer_tel ct ON ct.customerid=ci.customerid where O.id=:projectId";
sqlcustomer = new SqlObject(sql);
sqlcustomer.setParameter("projectId",ProjectId);
rs = Sqlca.getASResultSet(sqlcustomer);
while(rs.next()){
customerinfo+=rs.getStringValue("customerid").toString()+","+rs.getStringValue("customername")+","+rs.getStringValue("telephone")+"@";
}
System.out.println(customerinfo);
return customerinfo;
}
/* public String backContractFileUp(JBOTransaction tx) throws JBOException{
BizObjectManager csaManager = JBOFactory.getBizObjectManager(CHANNEL_SUBMIT_APPLICATIONS.CLASS_NAME,tx);
BizObjectManager aicManager = JBOFactory.getBizObjectManager(APPLY_INFO_CONTRACT.CLASS_NAME,tx);
BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
BizObjectManager attBom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);
BizObjectManager lpiBom=JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx);
Transaction Sqlca=Transaction.createTransaction(tx);
BizObject proj ;
try{
proj = lpiBom.createQuery("select CONTRACT_NUMBER,PRODUCT_ID FROM O WHERE ID=:id ").setParameter("id",ProjectId).getSingleResult(false);
String contractNumber = proj.getAttribute("CONTRACT_NUMBER").getString();
BizObject csa= csaManager.createQuery("select ID,APPLY_DATA FROM O WHERE CONTRACT_NUMBER=:contractnumber and FLOWNO='BusinessApproveFlow' and STATUS='approve_status05' ").setParameter("contractnumber",contractNumber).getSingleResult(false);
String channelApplyId = csa.getAttribute("ID").getString();
@SuppressWarnings("unchecked")
List<BizObject> lcl=lclManager.createQuery("file_flag='yes' and project_id='"+ProjectId+"'").getResultList(false);
for(BizObject key:lcl){
lclManager.createQuery("update O set file_flag='no' , message='0' where id=:id").setParameter("id",key.getAttribute("id").toString()).executeUpdate();
attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate();
}
String sql="select lib.id from lb_docrelative rel left join lb_doclibrary lib on lib.relative_id = rel.id where rel.proj_id = '"+ProjectId+"' and rel.objecttype='PROJECT' and lib.doc_name in ('融资租赁合同','担保人合同','抵押物合同')";
ASResultSet rs=Sqlca.getASResultSet(new SqlObject(sql));
while(rs.next()){
attBom.createQuery("update O set status='1' WHERE status is null and LIBRARY_ID='"+rs.getStringValue("id").toString()+"'").executeUpdate();
}
Transaction tran = Transaction.createTransaction(tx);
ASUser user = ASUser.getUser(CurUserID, tran);
csaManager.createQuery("update O SET STATUS=:status where ID=:id ").setParameter("status","approve_status07").setParameter("id",channelApplyId).executeUpdate();
aicManager.createQuery("update O SET STATUS=:status where ID=:id ").setParameter("status","approve_status07").setParameter("id",channelApplyId).executeUpdate();
lpiBom.createQuery("update O set PROJECT_STATUS='7',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE id=:id " ).setParameter("id",ProjectId).executeUpdate();
//记录项目进程日志
JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx)
.createQuery("UPDATE O SET BUSINESS_STATUS='7',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+ProjectId+"')").executeUpdate();
SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'7','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "")+"' FROM LB_PROJECT_INFO WHERE ID='"+ProjectId+"'");
so.setDebugSql(so.getDebugSql().replaceAll("", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("", ":"));
so.setRunSql(so.getRunSql().replaceAll("", ":"));
tran.executeSQL(so);
}catch(Exception e){
tx.rollback();
return "error";
}
System.out.println("success"+"&"+ProjectId+"&"+ProductId+"&"+CustomerType);
return "success"+"&"+ProjectId+"&"+ProductId+"&"+CustomerType;
}
public String backContractSign(JBOTransaction tx) throws JBOException{
BizObjectManager csaManager = JBOFactory.getBizObjectManager(CHANNEL_SUBMIT_APPLICATIONS.CLASS_NAME,tx);
BizObjectManager aicManager = JBOFactory.getBizObjectManager(APPLY_INFO_CONTRACT.CLASS_NAME,tx);
BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
BizObjectManager attBom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);
BizObjectManager libBom=JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME,tx);
BizObjectManager lpiBom=JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx);
Transaction Sqlca=Transaction.createTransaction(tx);
BizObject proj ;
try{
proj = lpiBom.createQuery("select CONTRACT_NUMBER,PRODUCT_ID FROM O WHERE ID=:id ").setParameter("id",ProjectId).getSingleResult(false);
String contractNumber = proj.getAttribute("CONTRACT_NUMBER").getString();
BizObject csa= csaManager.createQuery("select ID,APPLY_DATA FROM O WHERE CONTRACT_NUMBER=:contractnumber and FLOWNO='BusinessApproveFlow' and STATUS='approve_status05' ").setParameter("contractnumber",contractNumber).getSingleResult(false);
String channelApplyId = csa.getAttribute("ID").getString();
List<BizObject> lcl=lclManager.createQuery("file_flag='yes' and project_id='"+ProjectId+"'").getResultList(false);
for(BizObject key:lcl){
lclManager.createQuery("update O set file_flag='no' , message='0' where id=:id").setParameter("id",key.getAttribute("id").toString()).executeUpdate();
attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate();
}
String sql="select lib.id from lb_docrelative rel left join lb_doclibrary lib on lib.relative_id = rel.id "
+ "where rel.proj_id = '"+ProjectId+"' and rel.objecttype='PROJECT' and lib.doc_name in ('融资租赁合同','担保人合同','抵押物合同')";
ASResultSet rs=Sqlca.getASResultSet(sql);
while(rs.next()){
attBom.createQuery("update O set status='1' WHERE status is null and LIBRARY_ID='"+rs.getStringValue("id").toString()+"'").executeUpdate();
}
Transaction tran = Transaction.createTransaction(tx);
ASUser user = ASUser.getUser(CurUserID, tran);
csaManager.createQuery("update O SET STATUS=:status where ID=:id ").setParameter("status","approve_status07").setParameter("id",channelApplyId).executeUpdate();
aicManager.createQuery("update O SET STATUS=:status where ID=:id ").setParameter("status","approve_status07").setParameter("id",channelApplyId).executeUpdate();
lpiBom.createQuery("update O set PROJECT_STATUS='7',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE id=:id " ).setParameter("id",ProjectId).executeUpdate();
//记录项目进程日志
JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx)
.createQuery("UPDATE O SET BUSINESS_STATUS='7',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+ProjectId+"')").executeUpdate();
SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'7','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "")+"' FROM LB_PROJECT_INFO WHERE ID='"+ProjectId+"'");
so.setDebugSql(so.getDebugSql().replaceAll("", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("", ":"));
so.setRunSql(so.getRunSql().replaceAll("", ":"));
tran.executeSQL(so);
}catch(Exception e){
tx.rollback();
return "error";
}
System.out.println("success");
return "success";
}
*/
public String selectmethodtype(JBOTransaction tx) throws Exception{
String pranayamaType="";
Map<String,Map<String,String>> map=ProductParamUtil.getProductComponentType(ProductId, "PRD0320");
//是否调息
if(!map.isEmpty()){
Map<String,String> maps=map.get("ADJUST_INTEREST");
pranayamaType = maps.get("ISADJUST_INTEREST");
}
BizObjectManager bom=JBOFactory.getBizObjectManager(LC_PROJ_CONDITION.CLASS_NAME, tx);
BizObject bo=bom.createQuery("project_id='"+ProjectId+"'").getSingleResult(false);
return bo.getAttribute("SETTLE_METHOD").toString()+"@"+pranayamaType;
}
/* public String docList(JBOTransaction tx) throws Exception{
String sFlowNo= "PROJECT";
String product=ProductId ;
Map<String,String> docParam=new HashMap<String,String>();
Map<String,String> other=new HashMap<String,String>();
docParam.put("ObjectType","PROJECT");
docParam.put("proj_id",ProjectId );
docParam.put("contract_id",ContractId);
List<Object> list=ProductParamUtil.getProductDocInfo(product,"PRD0412");
String type="";
String docList="";
for(int i=0;i<list.size();i++){
Map<String,Object> map=(Map<String,Object>)list.get(i);
if(sFlowNo.equals(map.get("FLOW_INFO").toString())){
type=map.get("TYPE").toString();
if("SingleRow".equals(type)){
docList=map.get("DOCLIST").toString();
}else{
List l=(List)map.get("DOCCONFIG");
docList=l.toString();
}
}
}
//判断是否存在不存在就从配置表倒到临时表
DocListInitAction.initDocList(CurPage,docParam,other,docList,Curconf);
return "success";
}*/
/**
* 判断法人是否有委托代偿
* @param tx
* @return
*/
/*public String checkEntrustment(JBOTransaction tx){
try{
BizObjectManager ldcBom=JBOFactory.getBizObjectManager(LB_DEDUCT_CARD.CLASS_NAME,tx);
BizObject ldcBo=ldcBom.createQuery("project_id='"+ProjectId+"' and IS_CONSIGN_REPAY='yes'").getSingleResult(false);
if(ldcBo!=null){
return ldcBo.getAttribute("id").toString()+","+ldcBo.getAttribute("ACCOUNT").toString()+","+ldcBo.getAttribute("CONSIGN_REPAY_PHONE").toString();
}
}catch(Exception e){
e.printStackTrace();
return "false";
}
return "false";
}*/
/**
* 判断已婚自然人的租赁本金是否大于30万
* @param tx
* @return
* @throws JBOException
*/
public String checkMarryPerson(JBOTransaction tx){
try{
//1.获取婚姻状况
String sql="select case when cp.marriage='20' then 'true' else 'false' end marriage,"+
"customer_name||'@'||(select cf.fullname from customer_family cf where cf.customerid=ul.customer_id) customername,"+
"(select ct.telephone||'@'||(select cf1.mobilephone from customer_family cf1 where cf1.customerid=ul.customer_id) from customer_tel ct where ct.customerid = ul.customer_id ) telephone"+
" from lb_project_info lpi left join lb_union_lessee ul on lpi.id=ul.project_id left join customer_person cp on ul.customer_id=cp.customerid where lpi.id='"+project_id+"'";
List<Map<String,String>> ds = DataOperatorUtil.getDataBySql(tx, sql, null);
String marraged = "";
if(ds.size()>0){
marraged = ds.get(0).get("MARRIAGE").toString();
}
String names = "";
String phones = "";
//2.已婚
names = ds.get(0).get("CUSTOMERNAME").toString();
phones = ds.get(0).get("TELEPHONE").toString();
if("true".equals(marraged)){
//获取租赁本金
sql = "select case when CLEAN_LEASE_MONEY>300000 then 'true' else 'false' end moneyflag from lc_proj_condition where project_id='"+project_id+"'";
List<Map<String,String>> ds1 = DataOperatorUtil.getDataBySql(tx, sql, null);
if(ds1.size()>0&&"true".equals(ds1.get(0).get("MONEYFLAG").toString())){
return ds1.get(0).get("MONEYFLAG").toString()+","+names+","+phones;
}else{
return "true"+","+names.split("@")[0]+","+phones.split("@")[0];
}
}else{
return "true"+","+names.replace("@","")+","+phones.replace("@","");
}
}catch(Exception e){
e.printStackTrace();
return "false";
}
}
/*public String updateProjectStatus(JBOTransaction tx) throws JBOException{
BizObjectManager lpiBom;
BizObjectManager csaBom;
BizObjectManager aicBom;
try {
Transaction tran = Transaction.createTransaction(tx);
ASUser user = ASUser.getUser(CurUserID, tran);
lpiBom = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx);
csaBom = JBOFactory.getBizObjectManager(CHANNEL_SUBMIT_APPLICATIONS.CLASS_NAME,tx);
aicBom = JBOFactory.getBizObjectManager(APPLY_INFO_CONTRACT.CLASS_NAME,tx);
//作废
lpiBom.createQuery("update o set project_status='12',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' where id='"+project_id+"'").executeUpdate();
//废弃
csaBom.createQuery("update o set STATUS='approve_status06',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' where objectno='"+project_id+"' and (STATUS='approve_status05' or STATUS='approve_status07')").executeUpdate();
aicBom.createQuery("update o set STATUS='approve_status06',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' where objectno='"+project_id+"' and (STATUS='approve_status05' or STATUS='approve_status07')").executeUpdate();
//记录项目进程日志
JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx)
.createQuery("UPDATE O SET BUSINESS_STATUS='12',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+project_id+"')").executeUpdate();
SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'12','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "")+"' FROM LB_PROJECT_INFO WHERE ID='"+project_id+"'");
so.setDebugSql(so.getDebugSql().replaceAll("", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("", ":"));
so.setRunSql(so.getRunSql().replaceAll("", ":"));
tran.executeSQL(so);
} catch (Exception e) {
tx.rollback();
e.printStackTrace();
return "error";
}
return "success";
}*/
/**
*
*
* @return
* @throws Exception
*/
public String setProjectStatus(JBOTransaction tx) throws Exception{
try {
Transaction tran = Transaction.createTransaction(tx);
BizObjectManager lpiBom = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx);
ASUser user = ASUser.getUser(CurUserID, tran);
//资料上传
lpiBom.createQuery("update o set project_status='5',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' where id='"+project_id+"'").executeUpdate();
JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx)
.createQuery("UPDATE O SET BUSINESS_STATUS='5',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+project_id+"')").executeUpdate();
SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'5','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "")+"' FROM LB_PROJECT_INFO WHERE ID='"+project_id+"'");
so.setDebugSql(so.getDebugSql().replaceAll("", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("", ":"));
so.setRunSql(so.getRunSql().replaceAll("", ":"));
tran.executeSQL(so);
// 拉取合同文件
ContractSignAction csa = new ContractSignAction();
csa.setProjectId(project_id);
csa.setCustomerType(CustomerType);
String result ="";
try{
result=csa.downloadDoc(tx);
}catch(Exception e){
e.printStackTrace();
}
logger.info("合同拉取状态:"+result);
} catch (Exception e) {
e.printStackTrace();
tx.rollback();
return "error";
}
return "success";
}
}

View File

@ -0,0 +1,50 @@
package com.tenwa.app.dao;
import java.io.Serializable;
public class ContractSignInfo implements Serializable{
private String id;
private String fileid;//模板ID
private String custphone;//客户电话
private String custname;//客户名称
private String inputfile;//文件流
private String filename;//文件名称
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFileid() {
return fileid;
}
public void setFileid(String fileid) {
this.fileid = fileid;
}
public String getCustphone() {
return custphone;
}
public void setCustphone(String custphone) {
this.custphone = custphone;
}
public String getCustname() {
return custname;
}
public void setCustname(String custname) {
this.custname = custname;
}
public String getInputfile() {
return inputfile;
}
public void setInputfile(String inputfile) {
this.inputfile = inputfile;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
}

View File

@ -3,7 +3,7 @@ package com.tenwa.lease.app.service;
import java.util.List;
import java.util.Map;
import com.tenwa.lease.app.dao.ContractSignInfo;
import com.tenwa.app.dao.ContractSignInfo;
public interface HttpRequestAppService {
@ -16,7 +16,7 @@ public interface HttpRequestAppService {
* @param map
* @return
*/
Map<String,String> createContractSign(Map<String,List<ContractSignInfo>> map);
Map<String,String> createContractSign(Map<String, List<com.tenwa.app.dao.ContractSignInfo>> map);
/**
* 创建法人合同文本
* @param map