yc征信授权电子签页面初始化0713

This commit is contained in:
zhanglei 2021-07-13 19:51:07 +08:00
parent 4dc8ff9cf5
commit 46e42b2f45
9 changed files with 1723 additions and 66 deletions

View File

@ -132,7 +132,7 @@
var flag = window.confirm("已经生成过合同,是否重新制作委托扣款授权书");
if(flag==true){
//废除之前生成过的合同
var resultStatus = RunJavaMethodTrans("com.tenwa.action.channelportal.businesshanding.contractaward.ContractAward","updateDocContractStatusContract","contract_id=<%=ContractId%>,CustomerType=<%=customerType%>,FlowUnid=<%=applyId%>");
var resultStatus = RunJavaMethodTrans("com.tenwa.action.channelportal.businesshanding.contractaward.CreditAuthAward","updateDocContractStatusContract","contract_id=<%=ContractId%>,CustomerType=<%=customerType%>,FlowUnid=<%=applyId%>");
if("error"==resultStatus){
AsDebug.showMessage("提示","生成合同失败!","","",true);
return;
@ -270,7 +270,7 @@
var flag = window.confirm("修改数据会作废已制作或已签约的合同,是否修改");
if(flag==true){
//废除之前生成过的合同
var resultStatus = RunJavaMethodTrans("com.tenwa.action.channelportal.businesshanding.contractaward.ContractAward","updateDocContractStatusContract","contract_id=<%=ContractId%>,CustomerType=<%=customerType%>,FlowUnid=<%=applyId%>");
var resultStatus = RunJavaMethodTrans("com.tenwa.action.channelportal.businesshanding.contractaward.CreditAuthAward","updateDocContractStatusContract","contract_id=<%=ContractId%>,CustomerType=<%=customerType%>,FlowUnid=<%=applyId%>");
if("error"==resultStatus){
AsDebug.showMessage("提示","修改失败!","","",true);
return;

View File

@ -0,0 +1,235 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2020-04-30
Content:
History Log:
*/
String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号
String SubjectId = CurPage.getParameter("SubjectId");//主体编号
String userId = CurUser.getUserID();
String projectNo = Sqlca.getString("select PROJECT_NO from lb_project_info_temp where FLOWUNID='"+sFlowUnid+"'");
ASObjectModel doTemp = new ASObjectModel("creditAuthList");
// doTemp.setHtmlEvent("filePath","onclick","openfile");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(sFlowUnid);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","All","Button","生成征信授权书","生成征信授权书","createCreditPdf()","","","","btn_icon_generate",""},
{"true","All","Button","发起电子签约","发起电子签约","signOnLine()","","","","btn_icon_generate",""},
{"true","All","Button","查看签约状态","查看签约状态","getStatus()","","","","btn_icon_detail",""},
{"true","All","Button","重发签约短信","重发签约短信","sendMessageAgain()","","","","btn_icon_refresh",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
$(document).ready(function(){
for(var i=0;i<getRowCount(0);i++){
$("#DIV_Data_myiframe0_"+i+"_4").css("color","Blue");
}
})
//在加载完表格后调用
function afterSearch(){
for(var i=0;i<getRowCount(0);i++){
var html="";
html+='<a onclick=downloadFile(\''+getItemValue(0,i,"ID")+'\')><font color="blue">'+"下载&nbsp&nbsp&nbsp&nbsp&nbsp"+'</font></a>';
getObj(0,i,"FILENAME").innerHTML=html+'<font >'+getObj(0,i,"FILENAME").innerHTML+'</font>';
}
}
function downloadFile(id){
if(typeof(id)==undefined || id=='') {
alert("请先生成征信授权书再下载!");
return;
}
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 createCreditPdf(){
var fullName = getItemValue(0,getRow(0),'fullName');
var certId = getItemValue(0,getRow(0),'certId');
var phone = getItemValue(0,getRow(0),'phone');
var flowunid = getItemValue(0,getRow(0),'flowunid');
var creditauth = getItemValue(0,getRow(0),'creditauth');
var credittype = getItemValue(0,getRow(0),'credittype');
var objectType = credittype;
var operationType = objectType;
var param={};
var tempParam={};
var sparam="";
//模板号
var relation = getItemValue(0,getRow(0),'relation');
var tempId = "65b12cbfd98611eb970e00163e0ad612";
/**creditauth
* 征信授权书_安鹏
征信授权书_安鹏
征信授权书_邮储
借款服务确认书_邮储
*/
if("申请人"== relation && "征信授权书_邮储" == creditauth){
tempId = "65bd277ad98611eb970e00163e0ad612";//申请人的情况下征信授权书_邮储
}else if("申请人"== relation && "借款服务确认书_邮储" == creditauth){
tempId = "134f3d88e2f811eb970e00163e0ad612";//申请人的情况下借款服务确认书_邮储
}
param["templateNo"]= tempId;
var projectNo = "<%=projectNo%>";
//生成文件关联关系
tempParam["OBJECTTYPE"] = objectType;
tempParam["insurance_no"] = flowunid;
tempParam["contract_no"] = certId;
tempParam["contract_id"] = "<%=projectNo%>";
tempParam["project_id"] = "<%=projectNo%>";
tempParam["PROJ_ID"] = "<%=projectNo%>";//注意变量名,不要改
tempParam["CONTRACT_ID"] = "<%=projectNo%>";//注意变量名,不要改
tempParam["CUST_ID"] = certId;//注意变量名,不要改
tempParam["PLAN_NUMBER"] = phone;//注意变量名,不要改
tempParam["customername"] = fullName;
//生成模板固定参数
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileSavePath")%>";
param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据
for(var key in param){
if(sparam.length>0){sparam+=",";}
sparam+=key+"="+param[key];
}
var deleteresult = RunJavaMethodTrans("com.tenwa.channelportal.action.alpha.CreditAuthDeleteAction","deleteCreditAuth","certId="+certId+",projectNo="+projectNo+",objectType="+objectType);
var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate", sparam);
// word转pdf
var id = RunJavaMethodTrans("com.tenwa.channelportal.action.alpha.CreditAuthSignAction","wordToPdfCreditAuth",
"projectNo="+projectNo+",operationType="+objectType
+",fullName="+fullName+",certId="+certId+",phone="+phone+",flowUnid="+flowunid);
if(typeof(id)=="undefined" || id.length <= 0 || id==""){
RunJavaMethodTrans("com.tenwa.channelportal.action.alpha.CreditAuthDeleteAction","deleteCreditAuth","certId="+certId+",projectNo="+projectNo+",objectType="+objectType);
}else {
alert("生成成功!!!");
}
reloadSelf();
}
/**
* 发起电子签约
*/
function signOnLine(){
var fullName = getItemValue(0,getRow(0),'fullName');
var certId = getItemValue(0,getRow(0),'certId');
var phone = getItemValue(0,getRow(0),'phone');
var flowunid = getItemValue(0,getRow(0),'flowunid');
var projectNo = "<%=projectNo%>";
//模板号
var relation = getItemValue(0,getRow(0),'relation');
var attributeId = getItemValue(0,getRow(0),'ID');
var creditauth = getItemValue(0,getRow(0),'creditauth');
var credittype = getItemValue(0,getRow(0),'credittype');
var objectType = credittype;
var operationType = objectType;
if(typeof(attributeId)==undefined || attributeId=='') {
alert("请先生成征信授权书,再发起电子签约!");
return;
}
/**creditauth
* 征信授权书_安鹏
征信授权书_安鹏
征信授权书_邮储
借款服务确认书_邮储
*/
if("申请人"== relation && "征信授权书_邮储" == creditauth){
tempId = "65bd277ad98611eb970e00163e0ad612";//申请人的情况下征信授权书_邮储
}else if("申请人"== relation && "借款服务确认书_邮储" == creditauth){
tempId = "134f3d88e2f811eb970e00163e0ad612";//申请人的情况下借款服务确认书_邮储
}
//自然人电子签约
var sReturn = "";
sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.alpha.CreditAuthActionNewUtils","signIng",
"attributeId="+attributeId+",projectNo="+projectNo+",operationType="+objectType +",relation="+relation
+",fullName="+fullName+",certId="+certId+",phone="+phone+",flowUnid="+flowunid+",creditauth="+credittype);
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 fullName = getItemValue(0,getRow(0),'fullName');
var certId = getItemValue(0,getRow(0),'certId');
var phone = getItemValue(0,getRow(0),'phone');
var flowunid = getItemValue(0,getRow(0),'flowunid');
var relation = getItemValue(0,getRow(0),'relation');
var creditauth = getItemValue(0,getRow(0),'creditauth');
var credittype = getItemValue(0,getRow(0),'credittype');
var objectType = credittype;
var operationType = objectType;
var projectNo = "<%=projectNo%>";
var attributeId = getItemValue(0,getRow(0),'ID');
if(typeof(attributeId)==undefined || attributeId=='') {
alert("请先生成征信授权书,再发起电子签约!");
return;
}
var sReturn = "";
sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.alpha.CreditAuthActionNewUtils","contractSignStatus",
"attributeId="+attributeId+",projectNo="+projectNo+",operationType="+objectType+",relation="+relation
+",fullName="+fullName+",certId="+certId+",phone="+phone+",flowUnid="+flowunid);
AsDebug.showMessage("提示",sReturn,"","",true,'','','',function(){
<%-- var sReturns = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","downloadDoc","ProjectId=<%=projectId%>,CurUserID=<%=CurUser.getUserID()%>"); --%>
window.location.reload();
});
}
//重新发送短信
function sendMessageAgain(){
var fullName = getItemValue(0,getRow(0),'fullName');
var certId = getItemValue(0,getRow(0),'certId');
var phone = getItemValue(0,getRow(0),'phone');
var relation = getItemValue(0,getRow(0),'relation');
var flowunid = getItemValue(0,getRow(0),'flowunid');
var creditauth = getItemValue(0,getRow(0),'creditauth');
var objectType = creditauth;
var operationType = objectType;
var projectNo = "<%=projectNo%>";
var attributeId = getItemValue(0,getRow(0),'ID');
if(typeof(attributeId)==undefined || attributeId=='') {
alert("请先生成征信授权书,再发起电子签约!");
return;
}
var sReturn = "";
sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.alpha.CreditAuthActionNewUtils","sendMessageAgain",
"attributeId="+attributeId+",projectNo="+projectNo+",operationType="+objectType+",relation="+relation
+",fullName="+fullName+",certId="+certId+",phone="+phone+",flowUnid="+flowunid);
if("success"==sReturn){
AsDebug.showMessage("提示","短信发送成功!","","",true);
}else{
AsDebug.showMessage("提示","短信发送失败!["+sReturn+"]","","",true);
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -2740,7 +2740,22 @@
</managerProperties>
</manager>
</class>
<class name="VI_LB_IDENTITY_CHECK_CREDITAUTH" label="身份校验视图表" keyAttributes="">
<attributes>
<attribute name="fullName" label="姓名" type="STRING"/>
<attribute name="certId" label="身份证编号" type="STRING"/>
<attribute name="relation" label="身份" type="STRING"/>
<attribute name="flowunid" label="流程编号" type="STRING"/>
<attribute name="phone" label="电话号" type="STRING"/>
<attribute name="creditauth" label="授权模板名称" type="STRING"/>
<attribute name="credittype" label="授权模板类型" type="STRING"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="vi_lb_identity_check_creditauth" />
</managerProperties>
</manager>
</class>
<class name="LB_CAR_CREDIT_PERSONAL_INFO_TEMP" label="个人风险信息表" keyAttributes="ID">
<attributes>
<attribute name="ID" label="标识编号" type="STRING" length="32"/>
@ -3408,40 +3423,40 @@
</class>
<class name="LC_OVERDUE_RENT_PLAN" label="" keyAttributes="">
<attributes>
<attribute name="ID" label="ID" type="STRING" length="96"/>
<attribute name="QUOT_ID" label="QUOT_ID" type="STRING" length="96"/>
<attribute name="CUST_ID" label="CUST_ID" type="STRING" length="96"/>
<attribute name="PROJECT_ID" label="PROJECT_ID" type="STRING" length="96"/>
<attribute name="PROJECT_PLAN_NUMBER" label="PROJECT_PLAN_NUMBER" type="STRING" length="96"/>
<attribute name="CONTRACT_ID" label="CONTRACT_ID" type="STRING" length="96"/>
<attribute name="CONTRACT_PLAN_NUMBER" label="CONTRACT_PLAN_NUMBER" type="STRING" length="96"/>
<attribute name="PAYMENT_NUMBER" label="PAYMENT_NUMBER" type="STRING" length="96"/>
<attribute name="PLAN_LIST" label="PLAN_LIST" type="STRING" length="60"/>
<attribute name="PLAN_DATE" label="PLAN_DATE" type="STRING" length="60"/>
<attribute name="RENT" label="RENT" type="STRING" length="60"/>
<attribute name="CORPUS" label="CORPUS" type="STRING" length="60"/>
<attribute name="HIRE_DATE" label="HIRE_DATE" type="STRING" length="60"/>
<attribute name="fact_rent" label="fact_rent" type="STRING" length="60"/>
<attribute name="fact_corpus" label="fact_corpus" type="STRING" length="60"/>
<attribute name="fact_penalty" label="fact_penalty" type="STRING" length="60"/>
<attribute name="overduerent" label="overduerent" type="STRING" length="60"/>
<attribute name="overinterest" label="overinterest" type="STRING" length="60"/>
<attribute name="penalty" label="penalty" type="STRING" length="60"/>
<attribute name="Overdue_days" label="Overdue_days" type="STRING" length="60"/>
<attribute name="PLAN_STATUS" label="PLAN_STATUS" type="STRING" length="60"/>
<attribute name="inputtime" label="inputtime" type="STRING" length="60"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="lc_overdue_rent_plan" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="VI_CSAN" label="" keyAttributes="">
<attributes>
<class name="LC_OVERDUE_RENT_PLAN" label="" keyAttributes="">
<attributes>
<attribute name="ID" label="ID" type="STRING" length="96"/>
<attribute name="QUOT_ID" label="QUOT_ID" type="STRING" length="96"/>
<attribute name="CUST_ID" label="CUST_ID" type="STRING" length="96"/>
<attribute name="PROJECT_ID" label="PROJECT_ID" type="STRING" length="96"/>
<attribute name="PROJECT_PLAN_NUMBER" label="PROJECT_PLAN_NUMBER" type="STRING" length="96"/>
<attribute name="CONTRACT_ID" label="CONTRACT_ID" type="STRING" length="96"/>
<attribute name="CONTRACT_PLAN_NUMBER" label="CONTRACT_PLAN_NUMBER" type="STRING" length="96"/>
<attribute name="PAYMENT_NUMBER" label="PAYMENT_NUMBER" type="STRING" length="96"/>
<attribute name="PLAN_LIST" label="PLAN_LIST" type="STRING" length="60"/>
<attribute name="PLAN_DATE" label="PLAN_DATE" type="STRING" length="60"/>
<attribute name="RENT" label="RENT" type="STRING" length="60"/>
<attribute name="CORPUS" label="CORPUS" type="STRING" length="60"/>
<attribute name="HIRE_DATE" label="HIRE_DATE" type="STRING" length="60"/>
<attribute name="fact_rent" label="fact_rent" type="STRING" length="60"/>
<attribute name="fact_corpus" label="fact_corpus" type="STRING" length="60"/>
<attribute name="fact_penalty" label="fact_penalty" type="STRING" length="60"/>
<attribute name="overduerent" label="overduerent" type="STRING" length="60"/>
<attribute name="overinterest" label="overinterest" type="STRING" length="60"/>
<attribute name="penalty" label="penalty" type="STRING" length="60"/>
<attribute name="Overdue_days" label="Overdue_days" type="STRING" length="60"/>
<attribute name="PLAN_STATUS" label="PLAN_STATUS" type="STRING" length="60"/>
<attribute name="inputtime" label="inputtime" type="STRING" length="60"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="lc_overdue_rent_plan" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="VI_CSAN" label="" keyAttributes="">
<attributes>
<attribute name="TYPENO" label="TYPENO" type="STRING"/>
<attribute name="SORTNO" label="SORTNO" type="STRING"/>
<attribute name="TYPENAME" label="TYPENAME" type="STRING"/>
@ -3458,34 +3473,34 @@
<attribute name="modelid" label="modelid" type="STRING"/>
<attribute name="modelname" label="modelname" type="STRING"/>
<attribute name="operationType" label="operationType" type="STRING"/>
<attribute name="ManySubject" label="ManySubject" type="STRING"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="vi_csan" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="BANK_CODE" label="银行编码" keyAttributes="id">
<attributes>
<attribute name="id" label="主键" type="STRING" length="32"/>
<attribute name="bank_code" label="银行编码" type="STRING" length="10"/>
<attribute name="bank_name" label="银行名称" type="STRING" length="20"/>
<attribute name="is_use" label="是否使用" type="STRING" length="1"/>
<attribute name="inputuserid" label="登记人" type="STRING" length="32"/>
<attribute name="inputorgid" label="登记部门" type="STRING" length="32"/>
<attribute name="inputtime" label="登记时间" type="STRING" length="32"/>
<attribute name="updateuserid" label="更新人" type="STRING" length="32"/>
<attribute name="updateorgid" label="更新部门" type="STRING" length="32"/>
<attribute name="updatetime" label="更新时间" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="bank_code" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<attribute name="ManySubject" label="ManySubject" type="STRING"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="vi_csan" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="BANK_CODE" label="银行编码" keyAttributes="id">
<attributes>
<attribute name="id" label="主键" type="STRING" length="32"/>
<attribute name="bank_code" label="银行编码" type="STRING" length="10"/>
<attribute name="bank_name" label="银行名称" type="STRING" length="20"/>
<attribute name="is_use" label="是否使用" type="STRING" length="1"/>
<attribute name="inputuserid" label="登记人" type="STRING" length="32"/>
<attribute name="inputorgid" label="登记部门" type="STRING" length="32"/>
<attribute name="inputtime" label="登记时间" type="STRING" length="32"/>
<attribute name="updateuserid" label="更新人" type="STRING" length="32"/>
<attribute name="updateorgid" label="更新部门" type="STRING" length="32"/>
<attribute name="updatetime" label="更新时间" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="bank_code" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
</jbo>

View File

@ -0,0 +1,414 @@
package com.tenwa.channelportal.action.alpha;
import java.util.*;
import com.alibaba.fastjson.JSONObject;
import com.tenwa.app.manage.qiyuesuo.v2.ContractSignEnums;
import com.tenwa.app.manage.qiyuesuo.v2.ContractSignVtwoUtils;
import com.tenwa.app.manage.qiyuesuo.v2.QYSParams;
import com.tenwa.app.manage.util.KHSQContractSignActionTwoUtil;
import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP;
import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST;
import jbo.com.tenwa.lease.carbrand.LB_CONTRACT_SIGN_LOG;
import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP;
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.qiyuesuo.sdk.v2.bean.Contract;
import com.qiyuesuo.sdk.v2.response.DocumentAddResult;
import com.qiyuesuo.sdk.v2.response.SdkResponse;
import com.tenwa.comm.util.date.DateAssistant;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
/**
* 最新版契约锁盖章
* 20210415
*/
public class CreditAuthActionNewUtils {
private static Logger logger=Logger.getLogger(CreditAuthActionNewUtils.class);
private String operationType;
private String creditauth;
private String attributeId;
private String projectNo;
private String fullName;
private String certId;
private String phone;
private String flowUnid;
private String relation;
/**
* 个人征信授权
* @param tx
* @return
* @throws Exception
*/
public String signIng(JBOTransaction tx) throws Exception {
logger.info("signIng0708 个人征信授权,需要个人签约");
logger.info("signIng0708 个人征信授权 operationType=" + operationType + " attributeId="+ attributeId
+ " projectNo="+ projectNo+ " fullName="+ fullName+ " certId="+ certId+ " flowUnid="+ flowUnid
+ " phone="+ phone+ " relation="+ relation+ " creditauth="+ creditauth);
// TODO: 2021/7/12 判断是否申请人
BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx);
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
BizObject bo = null;
try {
Map<String, String> docAttrIdMap = new HashMap<String, String>();
if("申请人".equals(relation)){
// TODO: 2021/7/12 申请人安鹏征信授权邮储征信授权邮储借款告知书一起签
// TODO: 2021/7/12 判断所有证书是不是生成完毕
String msg = checkPerson(docAttrIdMap);
if(null != msg){
logger.info("申请人添加合同文件失败 msg=" + msg);
return "flase@" + msg;
}
}
BizObject pbo = pbm.createQuery("FLOWUNID=:flowUnid")
.setParameter("flowUnid", flowUnid).getSingleResult(true);
// 查询lb_doc_contract_list表
bo = contBom.createQuery("attribute_id=:attributeId and file_flag='yes' and sendprocess='0' ")
.setParameter("attributeId", attributeId).getSingleResult(true);
if(pbo == null || bo == null ){
throw new RuntimeException("请检查合同文件是否生成!");
} else {
String subjectId = pbo.getAttribute("subjectid").getString();
logger.info("signIng0708 个人征信授权 subjectId=" + subjectId);
Map<String, List<Map<String, String>>> parameter = new HashMap<String, List<Map<String, String>>>();
// List<Map<String, String>> companyPar = new LinkedList<Map<String, String>>();
// // 添加公司公章
// Map<String, String> param1 = new HashMap<String, String>();
// param1.put("type", "1");// 1标识当期发起公司公章2标识当前公司下的子公司
// param1.put("mobile", "12599998888");//子公司添加接收手机号如果不需要接收直接填写一个虚拟不存在就行如果需要传真实手机号
// companyPar.add(param1);
// parameter.put("COMPANY", companyPar);
//添加个人基本信息
List<Map<String, String>> personPar = new LinkedList<Map<String, String>>();
Map<String, String> sqPar = new HashMap<String, String>();
sqPar.put("name", fullName);
sqPar.put("type", "db");
if("申请人".equals(relation)){
sqPar.put("type", "sq");
}
sqPar.put("mobile", phone);
personPar.add(sqPar);
parameter.put("PERSONAL", personPar);
CreditAuthActionTwoUtil catu = new CreditAuthActionTwoUtil();
//创建合同
SdkResponse<Contract> createContract = catu.createContract(parameter, subjectId, bo.getAttribute("filename").getString());
Long contractId = createContract.getResult().getId();
//添加本地生成的合同文件
String makefullPath = bo.getAttribute("FULLPATH").toString();// 获取生成文件路径
Long documentId = null;
if("申请人".equals(relation)){
// TODO: 2021/7/12 申请人安鹏征信授权邮储征信授权邮储借款告知书一起签
logger.info("申请人一起签");
Map<String, String> docAttrMap = new HashMap<>();
for(String createType : docAttrIdMap.keySet()){
String attrId = docAttrIdMap.get(createType);
BizObject boTemp = contBom.createQuery("attribute_id=:attributeId and file_flag='yes' and sendprocess='0' ")
.setParameter("attributeId", attrId).getSingleResult(true);
if(null == boTemp || null == boTemp.getAttribute("FULLPATH")){
logger.info("申请人添加合同文件失败 attributeId=" + attrId);
return "flase@添加合同文件失败";
}
docAttrMap.put(attrId, boTemp.getAttribute("FULLPATH").toString());
}
Map<String, Long> attrDocumentMap = catu.addDocumentByFileList(docAttrMap, subjectId, contractId);
Map<String, Long> typeDocumentIdMap = new HashMap<>();
for(String createType : docAttrIdMap.keySet()){
logger.info("申请人添加合同文件 数据处理 createType=" + createType);
String attrId = docAttrIdMap.get(createType);
Long documentIdTemp = attrDocumentMap.get(attrId);
typeDocumentIdMap.put(createType, documentIdTemp);
}
//发起合同
logger.info("申请人一起签 发起合同" );
catu.sendFileList(personPar, subjectId, contractId, typeDocumentIdMap);
for(String createType : docAttrIdMap.keySet()){
logger.info("申请人一起签 发起合同完成修改文件状态 createType=" + createType);
String attrId = docAttrIdMap.get(createType);
BizObject boTemp = contBom.createQuery("attribute_id=:attributeId and file_flag='yes' and sendprocess='0' ")
.setParameter("attributeId", attrId).getSingleResult(true);
Long documentIdTemp = attrDocumentMap.get(attrId);
boTemp.setAttributeValue("DOCUMENT_ID", documentIdTemp);
boTemp.setAttributeValue("SINGCONTRACT_ID", contractId);
boTemp.setAttributeValue("SIGN_TYPE", "SIGNING");
boTemp.setAttributeValue("SENDPROCESS", "1");
contBom.saveObject(boTemp);
Map<String, String> fromCondtion = new HashMap<String, String>();
Map<String, String> otherProperty = new HashMap<String, String>();
String contractDocId = boTemp.getAttribute("id")
.toString();
fromCondtion.put("id", contractDocId);
otherProperty.put("SIGNPROCESS", "0");// 发起电子签约
otherProperty.put("CONTRACTDOCID", contractDocId);// 发起电子签约
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
// 拷表的方法
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion,LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,otherProperty, tx);
}
}else {
SdkResponse<DocumentAddResult> addDocumentByFile = catu.addDocumentByFile(makefullPath, subjectId, contractId);
documentId = addDocumentByFile.getResult().getDocumentId();
//发起合同
catu.send(personPar, subjectId, contractId, documentId);
bo.setAttributeValue("DOCUMENT_ID", documentId);
bo.setAttributeValue("SINGCONTRACT_ID", contractId);
bo.setAttributeValue("SIGN_TYPE", "SIGNING");
bo.setAttributeValue("SENDPROCESS", "1");
contBom.saveObject(bo);
Map<String, String> fromCondtion = new HashMap<String, String>();
Map<String, String> otherProperty = new HashMap<String, String>();
String contractDocId = bo.getAttribute("id")
.toString();
fromCondtion.put("id", contractDocId);
otherProperty.put("SIGNPROCESS", "0");// 发起电子签约
otherProperty.put("CONTRACTDOCID", contractDocId);// 发起电子签约
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
// 拷表的方法
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion,LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,otherProperty, tx);
}
return "success";
}
} catch (Exception e) {
tx.rollback();
e.printStackTrace();
System.out.println("自然人电子签约异常:" + e.getMessage());
return "flase@error";
}
}
private String checkPerson(Map<String, String> docAttrIdMap) throws JBOException {
//安鹏征信授权邮储征信授权邮储借款告知书
Map<String, String> creditAuthMap = new HashMap<>();
creditAuthMap.put("99001", "安鹏征信授权");
creditAuthMap.put("99002", "邮储征信授权");
creditAuthMap.put("99003", "邮储借款告知书");
for(String creditAuth : creditAuthMap.keySet()){
BizObjectManager bom = JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME);
BizObject lbDocBiz = bom.createQuery("OBJECTTYPE=:objectType and CUST_ID=:certId and PROJ_ID=:projectNo ")
.setParameter("objectType",creditAuth).setParameter("certId",certId).setParameter("projectNo",projectNo).getSingleResult(false);
if(null != lbDocBiz) {
String lbDocBizId = lbDocBiz.getAttribute("id").toString();
BizObjectManager bom1 = JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME);
String lbDocLibraryId = bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", lbDocBizId).getSingleResult(false).getAttribute("id").toString();
BizObjectManager bom2 = JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME);
String docAttributeId = bom2.createQuery("library_id=:library_id").setParameter("library_id", lbDocLibraryId).getSingleResult(false).getAttribute("id").toString();
if(StringUtils.isEmpty(docAttributeId)){
return "请先生成申请人【" + creditAuthMap.get(creditAuth) + "】文件。";
}
docAttrIdMap.put(creditAuth, docAttributeId);
}else {
return "请先生成申请人【" + creditAuthMap.get(creditAuth) + "】文件。";
}
}
return null;
}
/**
* 查看签约结果
* @param tx
* @return
* @throws Exception
*/
public String contractSignStatus(JBOTransaction tx) throws Exception {
logger.info("contractSignStatus20210708 个人征信授权 projectNo="+ projectNo+ " fullName="+ fullName);
BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx);
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
// 查询lb_doc_contract_list表
BizObject bo = contBom.createQuery("attribute_id=:attributeId and file_flag='yes' and sendprocess='1' ")
.setParameter("attributeId", attributeId).getSingleResult(true);
BizObject pbo = pbm.createQuery("FLOWUNID=:flowUnid").setParameter("flowUnid", flowUnid).getSingleResult(true);
if(null == pbo || bo == null ){
return "请检查合同文件是否生成!";
} else {
String subjectId = pbo.getAttribute("subjectid").getString();
logger.info("contractSignStatus0708 个人征信授权 subjectId=" + subjectId);
long signContractId = new Long(
bo.getAttribute("SINGCONTRACT_ID") == null ?
null : bo.getAttribute("SINGCONTRACT_ID").getString());
long documentId = new Long(
bo.getAttribute("DOCUMENT_ID") == null ?
null : bo.getAttribute("DOCUMENT_ID").getString());
String makefullPath = bo.getAttribute("FULLPATH") == null ?
null : bo.getAttribute("FULLPATH").getString();// 获取生成文件路径
CreditAuthActionTwoUtil catu = new CreditAuthActionTwoUtil();
String contractStatus = catu.getContractStatus(subjectId, signContractId);
if("success".equals(contractStatus)){
logger.info("contractSignStatus20210712 征信授权,不执行合同盖章。");
if("申请人".equals(relation)){
logger.info("contractSignStatus20210712 申请人下载,所有授权信息。");
Map<String, String> docAttrIdMap = new HashMap<String, String>();
String msg = checkPerson(docAttrIdMap);
if(null != msg){
logger.info("申请人添加合同文件失败 msg=" + msg);
return "flase@" + msg;
}
for(String createType : docAttrIdMap.keySet()){
String attrId = docAttrIdMap.get(createType);
BizObject boTemp = contBom.createQuery("attribute_id=:attributeId and file_flag='yes' and sendprocess='1' ")
.setParameter("attributeId", attrId).getSingleResult(true);
long documentIdSub = new Long(boTemp.getAttribute("DOCUMENT_ID").getString());
String filePath = boTemp.getAttribute("FULLPATH") == null ?
null : boTemp.getAttribute("FULLPATH").getString();// 获取生成文件路径
logger.info("个人征信授权 无需执行合同盖章。 createType===" + createType);
String downloadstatus = catu.contractDownload(subjectId, documentIdSub, filePath);
logger.info("个人征信授权 无需执行合同盖章。 合同下载log===" + downloadstatus);
boTemp.setAttributeValue("PROCESS", "6");
boTemp.setAttributeValue("SIGN_TYPE", "COMPLETE");// 法人客户当盖完章改为完成状态
boTemp.setAttributeValue("SENDPROCESS", "2");
contBom.saveObject(boTemp);
}
logger.info("contractSignStatus20210712 电子签约已完成,个人征信授权 无需执行合同盖章。");
return "已完成";
}else {
// contBom.saveObject(bo);
Map<String, String> fromCondtion = new HashMap<String, String>();
Map<String, String> otherProperty = new HashMap<String, String>();
String contractDocId = bo.getAttribute("id").toString();
fromCondtion.put("id", contractDocId);
otherProperty.put("SIGNPROCESS", "2");// 已完成电子签约
otherProperty.put("CONTRACTDOCID", contractDocId);// 已完成电子签约
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
// 拷表的方法
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion,LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,otherProperty, tx);
String downloadstatus = catu.contractDownload(subjectId, documentId, makefullPath);
logger.info("个人征信授权 无需执行合同盖章。 合同下载log===" + downloadstatus);
bo.setAttributeValue("PROCESS", "6");
bo.setAttributeValue("SIGN_TYPE", "COMPLETE");// 法人客户当盖完章改为完成状态
bo.setAttributeValue("SENDPROCESS", "2");
contBom.saveObject(bo);
logger.info("contractSignStatus20210429 电子签约已完成,个人征信授权 无需执行合同盖章。");
return "已完成";
}
}else{
return contractStatus;
}
}
}
public String sendMessageAgain(JBOTransaction tx) {
try{
logger.info("sendMessageAgain20210708 个人征信授权 projectNo="+ projectNo+ " fullName="+ fullName);
BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx);
BizObject pbo = pbm.createQuery("FLOWUNID=:flowUnid").setParameter("flowUnid", flowUnid).getSingleResult(true);
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
BizObject bo = null;
bo = contBom.createQuery("select singcontract_id,filename from O where attribute_id=:attributeId"
+" and file_flag = 'yes' and sendprocess = '1' and sign_type = 'SIGNING'")
.setParameter("attributeId", attributeId).getSingleResult(true);
String subjectId = pbo.getAttribute("subjectid").getString();
logger.info("sendMessageAgain20210708 个人征信授权 subjectId=" + subjectId);
if(bo == null ){
// 查询lb_doc_contract_list表
bo = contBom.createQuery("attribute_id=:attributeId and file_flag='yes' and (sendprocess='0' or sendprocess='1' ) ")
.setParameter("attributeId", attributeId).getSingleResult(true);
if(bo == null ){
logger.info("sendMessageAgain20210708 请检查合同文件是否生成");
return "请检查合同文件是否生成!";
}
long signContractId =
new Long(bo.getAttribute("SINGCONTRACT_ID") == null ? null : bo.getAttribute("SINGCONTRACT_ID").getString());
CreditAuthActionTwoUtil catu = new CreditAuthActionTwoUtil();
String contractStatus = catu.getContractStatus(subjectId, signContractId);
if("success".equals(contractStatus)){
logger.info("sendMessageAgain20210708 电子签约已完成,无需再发送短信。");
return "签约已完成,无需再发送短信。";
}
logger.info("sendMessageAgain20210708 请检查合同文件是否生成111");
return "请检查合同文件是否生成!";
}
long signContractId =new Long(bo.getAttribute("SINGCONTRACT_ID")==null ? null : bo.getAttribute("SINGCONTRACT_ID").getString());
KHSQContractSignActionTwoUtil catu = new KHSQContractSignActionTwoUtil();
return catu.messageSend(subjectId, signContractId);
} catch (Exception e) {
try {
tx.rollback();
} catch (JBOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
return "error";
}
}
public String getFlowUnid() {
return flowUnid;
}
public void setFlowUnid(String flowUnid) {
this.flowUnid = flowUnid;
}
public String getOperationType() {
return operationType;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}
public String getAttributeId() {
return attributeId;
}
public void setAttributeId(String attributeId) {
this.attributeId = attributeId;
}
public String getProjectNo() {
return projectNo;
}
public void setProjectNo(String projectNo) {
this.projectNo = projectNo;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getCertId() {
return certId;
}
public void setCertId(String certId) {
this.certId = certId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getRelation() {
return relation;
}
public void setRelation(String relation) {
this.relation = relation;
}
public String getCreditauth() {
return creditauth;
}
public void setCreditauth(String creditauth) {
this.creditauth = creditauth;
}
}

View File

@ -0,0 +1,501 @@
package com.tenwa.channelportal.action.alpha;
import com.qiyuesuo.sdk.v2.SdkClient;
import com.qiyuesuo.sdk.v2.bean.*;
import com.qiyuesuo.sdk.v2.http.StreamFile;
import com.qiyuesuo.sdk.v2.json.JSONUtils;
import com.qiyuesuo.sdk.v2.param.SignParam;
import com.qiyuesuo.sdk.v2.request.*;
import com.qiyuesuo.sdk.v2.response.DocumentAddResult;
import com.qiyuesuo.sdk.v2.response.SdkResponse;
import com.qiyuesuo.sdk.v2.utils.CollectionUtils;
import com.qiyuesuo.sdk.v2.utils.IOUtils;
import com.tenwa.util.MultiSubjectUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.*;
public class CreditAuthActionTwoUtil {
private static final Logger logger = LoggerFactory.getLogger(CreditAuthActionTwoUtil.class);
private static final ResourceBundle resourceBunlde = ResourceBundle.getBundle("qiyuesuo");
//深圳公司参数
private static final String sZ_Url = resourceBunlde.getString("SZ_Url");
private static final String sZ_Key = resourceBunlde.getString("SZ_Key");
private static final String sZ_Secret = resourceBunlde.getString("SZ_Secret");
private static final String sZ_OfficialSealId = resourceBunlde.getString("SZ_OfficialSealId");
private static final String sZ_CompanyName = resourceBunlde.getString("SZ_CompanyName");
//天津公司参数
private static final String tJ_Url = resourceBunlde.getString("TJ_Url");
private static final String tJ_Key = resourceBunlde.getString("TJ_Key");
private static final String tJ_Secret = resourceBunlde.getString("TJ_Secret");
private static final String tJ_OfficialSealId = resourceBunlde.getString("TJ_OfficialSealId");
private static final String tJ_CompanyName = resourceBunlde.getString("TJ_CompanyName");
//子公司参数辉煌
private static final String hH_CompanyName = resourceBunlde.getString("HH_CompanyName");
private static final String hH_OfficialSealId = resourceBunlde.getString("HH_OfficialSealId");
private SdkClient getSdkClient(String subjectId){
if(MultiSubjectUtil.SZSUBJECTID.equals(subjectId)){
return new SdkClient(sZ_Url, sZ_Key, sZ_Secret);
}else if (MultiSubjectUtil.TJSUBJECTID.equals(subjectId)){
return new SdkClient(sZ_Url, sZ_Key, sZ_Secret);//应客户要求现在都是以深圳主体发起
//return new SdkClient(tJ_Url, tJ_Key, tJ_Secret);
}
return null;
}
private String getComPanyName(String subjectId){
if(MultiSubjectUtil.SZSUBJECTID.equals(subjectId)){
return sZ_CompanyName;
}else if (MultiSubjectUtil.TJSUBJECTID.equals(subjectId)){
return tJ_CompanyName;
}
return null;
}
//创建合同
public SdkResponse<Contract> createContract(Map<String, List<Map<String, String>>> parameter,String subjectId,String fileNme) throws Exception {
SdkClient client = this.getSdkClient(subjectId);
Contract draftContract = new Contract();
draftContract.setSubject(fileNme);
draftContract.setOrdinal(false);
List<Map<String, String>> list = parameter.get("PERSONAL");
if(list!=null && list.size()>0){
for (Map<String, String> map : list) {
Signatory persoanlSignatory = new Signatory();
persoanlSignatory.setTenantType("PERSONAL");
persoanlSignatory.setTenantName(map.get("name"));
persoanlSignatory.setReceiver(new User(map.get("type"), map.get("mobile"), "MOBILE"));
draftContract.addSignatory(persoanlSignatory);
}
}
list = parameter.get("COMPANY");
if(list!=null && list.size()>0){
for (Map<String, String> map : list) {
Signatory platformSignatory = new Signatory();
platformSignatory.setTenantType("COMPANY");
Action sealAction = new Action();
sealAction.setType("COMPANY");
if ("1".equals(map.get("type"))) {
if(MultiSubjectUtil.SZSUBJECTID.equals(subjectId)){
platformSignatory.setTenantName(sZ_CompanyName);
sealAction.setName(sZ_CompanyName);
sealAction.setSealId(new Long(sZ_OfficialSealId));
}else if (MultiSubjectUtil.TJSUBJECTID.equals(subjectId)){
platformSignatory.setTenantName(tJ_CompanyName);
sealAction.setName(tJ_CompanyName);
sealAction.setSealId(new Long(tJ_OfficialSealId));
}
} else {
platformSignatory.setTenantName(hH_CompanyName);
sealAction.setName(hH_CompanyName);
sealAction.setSealId(new Long(hH_OfficialSealId) );
}
platformSignatory.setReceiver(new User(map.get("mobile"), "MOBILE"));//子公司必须设置接收方不管是否是子公司都设置了一个
platformSignatory.addAction(sealAction);
draftContract.addSignatory(platformSignatory);
}
}
draftContract.setSend(false);
String response = null;
try {
response = client.service(new ContractDraftRequest(draftContract));
} catch (Exception e) {
throw new Exception("创建合同草稿请求服务/器失败,失败原因:" + e.getMessage());
}
SdkResponse<Contract> sdkResponse = JSONUtils.toQysResponse(response,
Contract.class);
if (!sdkResponse.getCode().equals(0)) {
throw new Exception("创建合同草稿失败,失败原因:" + sdkResponse.getMessage());
}
return sdkResponse;
}
/**
* 添加多个文件
* @param docAttrMap
* @param subjectId
* @param contractId
* @return
* @throws Exception
*/
public Map<String, Long> addDocumentByFileList(Map<String, String> docAttrMap, String subjectId, Long contractId )throws Exception {
logger.info("addDocumentByFile20210708 申请人征信授权多条 subjectId=【"+subjectId+"】 contractId=【"+contractId+"");
SdkClient client = this.getSdkClient(subjectId);
Map<String, Long> attrDocumentMap = new HashMap<>();
for(String docArrtId : docAttrMap.keySet()){
String filePath = docAttrMap.get(docArrtId);
logger.info("addDocumentByFile20210708 申请人征信授权多条 docArrtId=【"+docArrtId+"】 filePath=【"+filePath+"");
// 进入本地文件
StreamFile file = new StreamFile(new FileInputStream(new File(filePath)));
if(null == file){
logger.info("addDocumentByFile20210708 文件不存在 filePath=【"+filePath+"】 subjectId=【"+subjectId+"】 contractId=【"+contractId+"");
}
String response = null;
try {
// PDF为本地文件的类型请修改为对应的本地文件类型
response = client.service(new DocumentAddByFileRequest(contractId,file, "pdf", "由文件创建文档"));
} catch (Exception e) {
throw new Exception("根据文件添加文档请求服务器失败,失败原因:" + e.getMessage());
}
SdkResponse<DocumentAddResult> sdkResponse = JSONUtils.toQysResponse(
response, DocumentAddResult.class);
if (!sdkResponse.getCode().equals(0)) {
throw new Exception("根据文件添加文档失败,失败原因:" + sdkResponse.getMessage());
}
attrDocumentMap.put(docArrtId, sdkResponse.getResult().getDocumentId());
}
return attrDocumentMap;
}
/**
* 添加单个文件
* @param filePath
* @param subjectId
* @param contractId
* @return
* @throws Exception
*/
public SdkResponse<DocumentAddResult> addDocumentByFile(String filePath,String subjectId,Long contractId)throws Exception {
logger.info("addDocumentByFile20210708 filePath=【"+filePath+"】 subjectId=【"+subjectId+"】 contractId=【"+contractId+"");
SdkClient client = this.getSdkClient(subjectId);
// 进入本地文件
StreamFile file = new StreamFile(new FileInputStream(new File(filePath)));
if(null == file){
logger.info("addDocumentByFile20210708 文件不存在 filePath=【"+filePath+"】 subjectId=【"+subjectId+"】 contractId=【"+contractId+"");
}
String response = null;
try {
// PDF为本地文件的类型请修改为对应的本地文件类型
response = client.service(new DocumentAddByFileRequest(contractId,file, "pdf", "由文件创建文档"));
} catch (Exception e) {
throw new Exception("根据文件添加文档请求服务器失败,失败原因:" + e.getMessage());
}
SdkResponse<DocumentAddResult> sdkResponse = JSONUtils.toQysResponse(
response, DocumentAddResult.class);
if (!sdkResponse.getCode().equals(0)) {
throw new Exception("根据文件添加文档失败,失败原因:" + sdkResponse.getMessage());
}
return sdkResponse;
}
/**
* 发起合同
*/
public SdkResponse send(List<Map<String, String>> personList,String subjectId, Long contractId,Long documentId) throws Exception {
SdkClient client = this.getSdkClient(subjectId);
Contract draft = getContract(subjectId, contractId).getResult();
String contractName = draft.getSubject();
List<Stamper> stampers = new LinkedList<Stamper>();
// 获取SignatoryId与ActionId用于指定签署位置公司签署位置需要指定ActionId,个人签署位置需要指定SignatoryId
Long personalSignatoryId = null;
for (Signatory signatory : draft.getSignatories()) {
// 获取个人签署方
if (signatory.getTenantType().equals("PERSONAL")) {
personalSignatoryId = signatory.getId();
String typeName = signatory.getTenantName();
String type = "";
if (personList != null && personList.size() > 0) {
for (Map<String, String> person : personList) {
if (person.get("name").equals(typeName)) {
type = person.get("type");
break;
}
}
}
Stamper personalStamper = new Stamper();
personalStamper.setPage(0);
personalStamper.setType("PERSONAL");
personalStamper.setSignatoryId(personalSignatoryId);
personalStamper.setDocumentId(documentId);
personalStamper.setKeyword("授权人签章:");
personalStamper.setOffsetX(-0.05);
//添加一个签署时间
Stamper personalStamperTime1 = new Stamper();
personalStamperTime1.setPage(0);
personalStamperTime1.setType("TIMESTAMP");
personalStamperTime1.setSignatoryId(personalSignatoryId);
personalStamperTime1.setDocumentId(documentId);
personalStamperTime1.setKeyword("授权人签章:");
personalStamperTime1.setOffsetX(0.025);
personalStamperTime1.setOffsetY(-0.0025);
stampers.add(personalStamperTime1);
if ("sq".equals(type)) {//承租人
//申请人添加第二个签字位置
Stamper personalStamper2 = new Stamper();
personalStamper2.setPage(0);
personalStamper2.setType("PERSONAL");
personalStamper2.setSignatoryId(personalSignatoryId);
personalStamper2.setDocumentId(documentId);
personalStamper2.setKeyword("授权人(签名):");
personalStamper2.setOffsetX(-0.05);
stampers.add(personalStamper2);
//添加二个签署时间
Stamper personalStamperTime2 = new Stamper();
personalStamperTime2.setPage(0);
personalStamperTime2.setType("TIMESTAMP");
personalStamperTime2.setSignatoryId(personalSignatoryId);
personalStamperTime2.setDocumentId(documentId);
personalStamperTime2.setKeyword("授权日期:");
personalStamperTime2.setOffsetX(0.025);
personalStamperTime2.setOffsetY(-0.0025);
stampers.add(personalStamperTime2);
}
stampers.add(personalStamper);
}
}
String response = null;
try {
response = client.service(new ContractSendRequest(draft.getId(),stampers));
} catch (Exception e) {
throw new Exception("发起合同请求服务器失败,失败原因:" + e.getMessage());
}
SdkResponse sdkResponse = JSONUtils.toQysResponse(response);
if (!sdkResponse.getCode().equals(0)) {
throw new Exception("发起合同失败,失败原因:" + sdkResponse.getMessage());
}
return sdkResponse;
}
/**
* 发起合同
*/
public SdkResponse sendFileList(List<Map<String, String>> personList, String subjectId, Long contractId, Map<String, Long> typeDocumentIdMap) throws Exception {
SdkClient client = this.getSdkClient(subjectId);
Contract draft = getContract(subjectId, contractId).getResult();
String contractName = draft.getSubject();
List<Stamper> stampers = new LinkedList<Stamper>();
// 获取SignatoryId与ActionId用于指定签署位置公司签署位置需要指定ActionId,个人签署位置需要指定SignatoryId
Long personalSignatoryId = null;
for (Signatory signatory : draft.getSignatories()) {
// 获取个人签署方
if (signatory.getTenantType().equals("PERSONAL")) {
personalSignatoryId = signatory.getId();
String typeName = signatory.getTenantName();
for(String createType : typeDocumentIdMap.keySet()){
logger.info("当前合同类型createType=" + createType);
Long documentId = typeDocumentIdMap.get(createType);
// TODO: 2021/7/12 安鹏征信授权
if("99001".equals(createType)){
Stamper personalStamper = new Stamper();
personalStamper.setPage(0);
personalStamper.setType("PERSONAL");
personalStamper.setSignatoryId(personalSignatoryId);
personalStamper.setDocumentId(documentId);
personalStamper.setKeyword("授权人签章:");
personalStamper.setOffsetX(-0.03);
personalStamper.setOffsetY(-0.02);
//添加一个签署时间
Stamper personalStamperTime1 = new Stamper();
personalStamperTime1.setPage(0);
personalStamperTime1.setType("TIMESTAMP");
personalStamperTime1.setSignatoryId(personalSignatoryId);
personalStamperTime1.setDocumentId(documentId);
personalStamperTime1.setKeyword("授权人签章:");
personalStamperTime1.setOffsetX(0.17);
personalStamperTime1.setOffsetY(-0.02);
stampers.add(personalStamperTime1);
stampers.add(personalStamper);
}else if("99002".equals(createType)){
// TODO: 2021/7/12 邮储征信授权
//申请人添加第二个签字位置
Stamper personalStamper2 = new Stamper();
personalStamper2.setPage(0);
personalStamper2.setType("PERSONAL");
personalStamper2.setSignatoryId(personalSignatoryId);
personalStamper2.setDocumentId(documentId);
personalStamper2.setKeyword("授权人(签名):");
personalStamper2.setOffsetX(-0.03);
stampers.add(personalStamper2);
//添加二个签署时间
Stamper personalStamperTime2 = new Stamper();
personalStamperTime2.setPage(0);
personalStamperTime2.setType("TIMESTAMP");
personalStamperTime2.setSignatoryId(personalSignatoryId);
personalStamperTime2.setDocumentId(documentId);
personalStamperTime2.setKeyword("授权日期:");
personalStamperTime2.setOffsetX(0.025);
personalStamperTime2.setOffsetY(-0.0025);
stampers.add(personalStamperTime2);
}else if("99003".equals(createType)){
// TODO: 2021/7/12 邮储借款告知书
//申请人添加第二个签字位置
Stamper personalStamper2 = new Stamper();
personalStamper2.setPage(0);
personalStamper2.setType("PERSONAL");
personalStamper2.setSignatoryId(personalSignatoryId);
personalStamper2.setDocumentId(documentId);
personalStamper2.setKeyword("贷款申请人签字:");
personalStamper2.setOffsetX(-0.03);
personalStamper2.setOffsetY(-0.02);
stampers.add(personalStamper2);
//添加二个签署时间
Stamper personalStamperTime2 = new Stamper();
personalStamperTime2.setPage(0);
personalStamperTime2.setType("TIMESTAMP");
personalStamperTime2.setSignatoryId(personalSignatoryId);
personalStamperTime2.setDocumentId(documentId);
personalStamperTime2.setKeyword("日期:");
// TODO: 2021/7/13 太靠右了
personalStamperTime2.setOffsetX(-0.55);
personalStamperTime2.setOffsetY(-0.0025);
stampers.add(personalStamperTime2);
}
}
}
}
String response = null;
try {
response = client.service(new ContractSendRequest(draft.getId(),stampers));
} catch (Exception e) {
throw new Exception("发起合同请求服务器失败,失败原因:" + e.getMessage());
}
SdkResponse sdkResponse = JSONUtils.toQysResponse(response);
if (!sdkResponse.getCode().equals(0)) {
throw new Exception("发起合同失败,失败原因:" + sdkResponse.getMessage());
}
return sdkResponse;
}
public String getContractStatus(String subjectId, Long contractId) throws Exception{
Contract contract = this.getContract(subjectId,contractId).getResult();
logger.info("getContractStatus#20210422 查询合同信息 contract=" + JSONUtils.toJson(contract));
if("COMPLETE".equals(contract.getStatus())){
logger.info("getContractStatus#20210429 查询合同信息已签约完成。");
return "success";
}
boolean stu = true;
StringBuffer sb = new StringBuffer();
List<Signatory> signatories = contract.getSignatories();
if(signatories!=null && signatories.size()>0){
for (Signatory signatory : signatories) {
String tenantType = signatory.getTenantType();
String status = signatory.getStatus();
if(tenantType!=null && "PERSONAL".equals(tenantType)){
if(stu && status != null && (!status.equals("SIGNED")) ){
stu = false ;
}
String statusName = "";
switch (status) {
case "DRAFT":
statusName="草稿";
break;
case "RECALLED":
statusName="已撤回";
break;
case "SIGNING":
statusName="签署中";
break;
case "REJECTED":
statusName="已退回";
break;
case "SIGNED":
statusName="已完成";
break;
case "EXPIRED":
statusName="已过期";
break;
case "FILLING":
statusName="拟定中";
break;
case "WAITING":
statusName="待签署";
break;
case "INVALIDING":
statusName="作废中";
break;
case "INVALIDED":
statusName="已作废";
break;
default:
statusName="状态未匹配";
break;
}
sb.append(signatory.getTenantName()).append(":").append(statusName).append("");
}
}
}
if(stu){
return "success";
}else{
return sb.substring(0, sb.length()-1);
}
}
public SdkResponse<Contract> getContract(String subjectId, Long contractId) throws Exception {
SdkClient client = this.getSdkClient(subjectId);
ContractDetailRequest request = new ContractDetailRequest(contractId);
String response;
try {
response = client.service(request);
} catch (Exception e) {
throw new Exception("合同详情查询,失败原因:" + e.getMessage());
}
SdkResponse<Contract> sdkResponse = JSONUtils.toQysResponse(response, Contract.class);
if (!sdkResponse.getCode().equals(0)) {
throw new Exception("合同详情查询,失败原因:" + sdkResponse.getMessage());
}
return sdkResponse;
}
//合同下载
public String contractDownload(String subjectId, Long documentId, String filePath) throws Exception {
SdkClient client = this.getSdkClient(subjectId);
DocumentDownloadRequest request = new DocumentDownloadRequest(documentId);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(filePath);
client.download(request, fos);
IOUtils.safeClose(fos);
} catch (FileNotFoundException e) {
throw new Exception("合同文件下载,失败原因:" + e.getMessage());
}finally{
fos.close();
}
return "合同下载成功!";
}
/**
* 合同催签
* @param subjectId
* @param signContractId
* @return
*/
public String messageSend(String subjectId,Long signContractId) throws Exception{
Contract contract = this.getContract(subjectId, signContractId).getResult();
logger.info("messageSend#20210521 查询合同信息 contract=" + JSONUtils.toJson(contract));
if("COMPLETE".equals(contract.getStatus())){
logger.info("messageSend#20210521 查询合同信息已签约完成。");
return "success";
}
List<Signatory> signatories = contract.getSignatories();
if(CollectionUtils.isNotEmpty(signatories)) {
SdkClient client = this.getSdkClient(subjectId);
for (Signatory signatory : signatories) {
if (StringUtils.isNotEmpty(signatory.getTenantType()) && "PERSONAL".equals(signatory.getTenantType())
&& StringUtils.isNotEmpty(signatory.getStatus()) && "SIGNING".equals(signatory.getStatus())) {
logger.info("messageSend#20210521 当前客户状态签署中重新发送短信。signatory=" + JSONUtils.toJson(signatory));
ContractNoticeRequest request = new ContractNoticeRequest(signContractId);
request.setSigantoryId(signatory.getId());
String response = client.service(request);
SdkResponse responseObj = JSONUtils.toQysResponse(response);
logger.info("messageSend#20210521 重新发送短信返回。response=" + response);
logger.info("messageSend#20210521 重新发送短信返回。response=" + +responseObj.getCode()+":"+responseObj.getMessage());
}
}
}
return "success";
}
}

View File

@ -0,0 +1,171 @@
package com.tenwa.channelportal.action.alpha;
import com.amarsoft.app.util.ProductParamUtil;
import com.amarsoft.are.jbo.*;
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;
import jbo.app.tenwa.calc.LC_PROJ_CONDITION;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT;
import jbo.app.tenwa.doc.LB_DOCATTRIBUTE;
import jbo.app.tenwa.doc.LB_DOCLIBRARY;
import jbo.app.tenwa.doc.LB_DOCRELATIVE;
import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST;
import jbo.com.tenwa.lease.carbrand.BUSINESS_STATUS;
import jbo.com.tenwa.lease.carbrand.VI_CONTRACTMAKEPRINTLIST;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_STATUS;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* ºÏͬǩԼ
* @author tenwa518
*
*/
public class CreditAuthAward {
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 String projectStatus(JBOTransaction tx) throws JBOException{
//BizObjectManager bom = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx);
BizObjectManager bom = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME,tx);
BizObjectManager bomstatus = JBOFactory.getBizObjectManager(LB_CONTRACT_STATUS.CLASS_NAME,tx);
BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
BizObjectManager vc = JBOFactory.getBizObjectManager(VI_CONTRACTMAKEPRINTLIST.CLASS_NAME,tx);
Boolean flag=false;
Boolean unflag=true;
List<BizObject> ldclBo = ldclBom.createQuery("project_id='"+project_id+"' and file_flag='yes' and sendprocess='1'").getResultList(false);
if(ldclBo.size()>0){
flag=true;
}
List<BizObject> vcs = vc.createQuery("id=:projectid and flowunid=:flowunid").setParameter("projectid", project_id).setParameter("flowunid", FlowUnid).getResultList(false);
if(vcs.size()>0){
unflag=false;
}
//BizObject bo=bom.createQuery("id='"+project_id+"'").getSingleResult(false);
BizObject bo=bom.createQuery("FLOWUNID='"+FlowUnid+"'").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("DATA_STATE").toString()+"@"+projstatus+"@"+flag+"@"+unflag;
}
}

View File

@ -0,0 +1,71 @@
package com.tenwa.channelportal.action.alpha;
import java.util.HashMap;
import java.util.Map;
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.tenwa.comm.util.jboutil.DataOperatorUtil;
/**
* 删除征信合同记录
*/
public class CreditAuthDeleteAction {
String objectType;//文件类型
String projectNo;//项目编号
String certId;//身份证号
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
public String getProjectNo() {
return projectNo;
}
public void setProjectNo(String projectNo) {
this.projectNo = projectNo;
}
public String getCertId() {
return certId;
}
public void setCertId(String certId) {
this.certId = certId;
}
/**
* 删除征信授权文件
* @param tx
* @throws Exception
*/
public void deleteCreditAuth(JBOTransaction tx) throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME);
BizObject lbDocBiz = bom.createQuery("OBJECTTYPE=:objectType and CUST_ID=:certId and PROJ_ID=:projectNo ")
.setParameter("objectType",objectType).setParameter("certId",certId).setParameter("projectNo",projectNo).getSingleResult(false);
if(null != lbDocBiz){
String lbDocBizId = lbDocBiz.getAttribute("id").toString();
BizObjectManager bom1 = JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME);
String lbDocLibraryId = bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", lbDocBizId).getSingleResult(false).getAttribute("id").toString();
BizObjectManager bom2 = JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME);
String docAttributeId = bom2.createQuery("library_id=:library_id").setParameter("library_id", lbDocLibraryId).getSingleResult(false).getAttribute("id").toString();
Map<String,String> condtion= new HashMap<String,String>();
condtion.put("id", lbDocBizId);
DataOperatorUtil.deleteJBOByCondtion(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME, condtion, tx);
condtion.clear();
condtion.put("id", lbDocLibraryId);
DataOperatorUtil.deleteJBOByCondtion(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME, condtion, tx);
condtion.clear();
condtion.put("id", docAttributeId);
DataOperatorUtil.deleteJBOByCondtion(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME, condtion, tx);
}
}
}

View File

@ -0,0 +1,207 @@
package com.tenwa.channelportal.action.alpha;
import com.alibaba.fastjson.JSONObject;
import com.amarsoft.are.jbo.*;
import com.tenwa.app.dao.ContractSignInfo;
import com.tenwa.app.manage.qiyuesuo.v2.ContractSignEnums;
import com.tenwa.app.manage.qiyuesuo.v2.ContractSignVtwoUtils;
import com.tenwa.app.manage.qiyuesuo.v2.QYSParams;
import com.tenwa.channelportal.action.generativecontract.WordToPDFUtil;
import jbo.app.tenwa.doc.*;
import org.apache.log4j.Logger;
import java.io.File;
import java.util.List;
public class CreditAuthSignAction {
private static Logger logger=Logger.getLogger(CreditAuthSignAction.class);
private String attributeId;
private String phone;
private String projectNo;
private String certId;;
private String fullName;
private String tempId;
private String operationType;
public String getOperationType() {
return operationType;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}
public String getAttributeId() {
return attributeId;
}
public void setAttributeId(String attributeId) {
this.attributeId = attributeId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getProjectNo() {
return projectNo;
}
public void setProjectNo(String projectNo) {
this.projectNo = projectNo;
}
public String getCertId() {
return certId;
}
public void setCertId(String certId) {
this.certId = certId;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getTempId() {
return tempId;
}
public void setTempId(String tempId) {
this.tempId = tempId;
}
/**
* 征信授权书附件用LibreOffice实现word转换pdf
* word转换pdf
* @throws JBOException
*/
@SuppressWarnings({ "unchecked", "static-access" })
public String wordToPdfCreditAuth(JBOTransaction tx) throws JBOException {
BizObjectManager bom=JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME);
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
logger.info("word转换pdf 开始 projectNo=" + projectNo);
logger.info("word转换pdf 开始 fullName=" + fullName);
logger.info("word转换pdf 开始 certId=" + certId);
logger.info("word转换pdf 开始 phone=" + phone);
logger.info("word转换pdf 开始 operationType=" + operationType);
BizObject DOCRELATIVE =
bom.createQuery(" OBJECTTYPE=:operationType and PROJ_ID=:projectId and CUST_ID=:certId ")
.setParameter("operationType", operationType).setParameter("projectId", projectNo).setParameter("certId", certId).getSingleResult(false);
BizObjectManager attrBom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME);
BizObject attrBo=null;
BizObject contBo=null;
WordToPDFUtil wordTopdf = new WordToPDFUtil();
File file = null;
Boolean result = null;
String sql = "";
try {
logger.info("word转换pdf 开始");
if (DOCRELATIVE != null) {
logger.info("word转换pdf 存在文件信息。");
String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString();
BizObjectManager bom1=JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME);
String DOCLIBRARYid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString();
attrBo = attrBom.createQuery("library_id=:library_id").setParameter("library_id", DOCLIBRARYid).getSingleResult(true);
contBo = contBom.createQuery("attribute_id=:attributeId").setParameter("attributeId", attrBo.getAttribute("id").toString()).getSingleResult(true);
String path = attrBo.getAttribute("FULLPATH").toString();
String lastFilePath = path.replace(".docx", ".pdf");
File filePath = new File(path);
if(!filePath.exists()){
logger.info("word转换pdf的源文件不存在");
}
String lastFilePathpdf = filePath.getParent();
try {
result = wordTopdf.Word2Pdf(path, lastFilePathpdf);
} catch (Exception e) {
result = false;
e.printStackTrace();
logger.error("word转换pdf 报错 errorMsg=" + e.getMessage(), e);
}
if (result) {
file =new File(lastFilePath);
attrBo.setAttributeValue("FULLPATH",attrBo.getAttribute("FULLPATH").toString().replace(".docx", ".pdf"));
attrBo.setAttributeValue("FILENAME",attrBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf"));
attrBo.setAttributeValue("FILEPATH",attrBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf"));
attrBo.setAttributeValue("FileSize",file.length());
attrBo.setAttributeValue("CONTENT_TYPE","application/pdf");
attrBom.saveObject(attrBo);
contBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf"));
contBo.setAttributeValue("FULLPATH",contBo.getAttribute("FULLPATH").toString().replace(".docx", ".pdf"));
contBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf"));
contBom.saveObject(contBo);
}
}
} catch (JBOException e) {
e.printStackTrace();
logger.error("word转换pdf 报错 errorMsg=" + e.getMessage(), e);
}
return attrBo.getAttribute("FILENAME").toString() +"@"+attrBo.getAttribute("ID").toString();
}
/**
* 查看word文件是否都转为pdf
* @param tx
* @return
* @throws JBOException
*/
public String getMakeContractProcess(JBOTransaction tx) throws JBOException{
BizObjectManager ldclBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
int wordIng=0;
int pdfFalse=0;
int pdfTrue=0;
List<BizObject> ldclBo2=ldclBom.createQuery("attribute_id='"+attributeId+"' and file_flag='yes' ").getResultList(false);
if(ldclBo2.size()>0){
for(BizObject key:ldclBo2){
String process = key.getAttribute("process").toString();
if("1".equals(process)){
wordIng++;
}else if("2".equals(process)){
pdfTrue++;
}else if("3".equals(process)){
pdfFalse++;
}
}
}else{
//制作合同
return "0";
}
if(wordIng>0 && pdfFalse>0 && pdfTrue>0){
//word转换PDF部分失败
return "1";
}else if(wordIng==0 && pdfFalse>0 && pdfTrue>0){
//word转PDF失败
return "2";
}else if(wordIng==0 && pdfFalse>0 && pdfTrue>0){
//word转换PDF部分失败
return "3";
}else if(wordIng>0 && pdfFalse==0 && pdfTrue>0){
//word正在转换pdf
return "4";
}else if(wordIng>0 && pdfFalse==0 && pdfTrue==0){
//word没有转换pdf
return "5";
}else if(wordIng==0 && pdfFalse==0 && pdfTrue>0){
//word转换PDF成功
return "6";
}
return "error";
}
}

View File

@ -0,0 +1,43 @@
package jbo.app.tenwa.customer;
import java.lang.String;
/**
* 身份校验视图表 - JBO命名常量类<br><br>
* Note: This file is generated by ADE tools, <em>dont</em> modify it.<br>
*/
public interface VI_LB_IDENTITY_CHECK_CREDITAUTH {
/**
* 身份校验视图表<br><br>
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.app.tenwa.customer.VI_LB_IDENTITY_CHECK_CREDITAUTH";
/**
* 姓名 STRING(20)<br>
*/
public static final String fullName = "fullName";
/**
* 身份证编号 STRING(20)<br>
*/
public static final String certId = "certId";
/**
* 身份 STRING(20)<br>
*/
public static final String relation = "relation";
/**
* 流程编号 STRING(20)<br>
*/
public static final String flowunid = "flowunid";
/**
* 电话号 STRING(20)<br>
*/
public static final String phone = "phone";
/**
* 电话号 STRING(20)<br>
*/
public static final String creditauth = "creditauth";
public static final String credittype = "credittype";
}