From e4968a5c4f5a7dc518a2fa6574071084eceefb74 Mon Sep 17 00:00:00 2001 From: zhanglei Date: Fri, 14 May 2021 09:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E7=B3=BB=E7=BB=9F-=E5=96=9C?= =?UTF-8?q?=E7=9B=B8=E9=80=A2=E6=B8=A0=E9=81=93=E4=BD=BF=E7=94=A8=E7=94=B5?= =?UTF-8?q?=E5=AD=90=E7=AD=BE=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Comm/LBContract/LBContractPrintList.jsp | 19 +- .../handle/FileTemplateUtil.java | 2 + .../util/KHSQContractSignActionTwoUtil.java | 571 ++++++++++++++++++ .../action/ContractSignActionNewUtils.java | 474 ++++++++------- .../sdk/controller/CmbToPayController.java | 237 ++++---- 5 files changed, 955 insertions(+), 348 deletions(-) create mode 100644 src/com/tenwa/app/manage/util/KHSQContractSignActionTwoUtil.java diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp index 6f178a260..8927d8bab 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp @@ -126,8 +126,12 @@ //自然人电子签约 var operationType = "<%=operationType%>"; var sReturn = ""; - if("LHZL"==operationType || "SQSYC"==operationType ){ + // alert("客户签约类型:operationType=" + operationType); + if("LHZL"==operationType || "SQSYC"==operationType){ sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionTwo","signIng","ProjectId=<%=projectId%>,CurUserID=<%=CurUser.getUserID()%>,FlowUnid=<%=flowunid%>,,SubjectId=<%=SubjectId%>,operationType="+operationType); + }else if("CYSHDZ"==operationType ){ + // alert("契约锁2.0"); + sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionNewUtils","signIng","ProjectId=<%=projectId%>,CurUserID=<%=CurUser.getUserID()%>,FlowUnid=<%=flowunid%>,,SubjectId=<%=SubjectId%>,operationType="+operationType); }else{ sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","signIng","ProjectId=<%=projectId%>,CurUserID=<%=CurUser.getUserID()%>,FlowUnid=<%=flowunid%>,,SubjectId=<%=SubjectId%>"); } @@ -176,9 +180,13 @@ } var sParams="ProjectId=<%=projectId%>,customerType=<%=custtype%>,FlowUnid=<%=flowunid%>,CurUserID=<%=CurUser.getUserID()%>,SubjectId=<%=SubjectId%>"; var operationType = "<%=operationType%>"; + // alert("客户签约类型:operationType=" + operationType); var sReturn = ""; - if("LHZL"==operationType || "SQSYC"==operationType ){ - sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionTwo","contractSignStatus",sParams+",operationType="+operationType); + if("LHZL"==operationType || "SQSYC"==operationType) { + sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionTwo", "contractSignStatus", sParams + ",operationType=" + operationType); + }else if("CYSHDZ"==operationType ){ + // alert("契约锁2.0"); + sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionNewUtils","contractSignStatus",sParams+",operationType="+operationType); }else{ sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","contractSignStatus",sParams); } @@ -189,7 +197,7 @@ } - $(function (){ + $(function (){ var html=""; if("<%=custtype%>"=="03"){ //(无法完成电子签约,请采用下载纸质合同) @@ -332,6 +340,9 @@ var sReturn = ""; if("LHZL"==operationType || "SQSYC"==operationType ){ sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionTwo","sendMessageAgain","ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>,operationType="+operationType); + }else if("CYSHDZ"==operationType ){ + // alert("契约锁2.0"); + sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignActionNewUtils","sendMessageAgain","ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>,operationType="+operationType); }else{ sReturn = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","sendMessageAgain","ProjectId=<%=projectId%>,SubjectId=<%=SubjectId%>"); } diff --git a/src/com/tenwa/app/baseFileTemplate/handle/FileTemplateUtil.java b/src/com/tenwa/app/baseFileTemplate/handle/FileTemplateUtil.java index d12e79e23..751ae8d30 100644 --- a/src/com/tenwa/app/baseFileTemplate/handle/FileTemplateUtil.java +++ b/src/com/tenwa/app/baseFileTemplate/handle/FileTemplateUtil.java @@ -175,6 +175,8 @@ public class FileTemplateUtil { return "[{'fileTemplate':\""+"[{'text':'狮桥商用车合同模板','value':'93e4194efb604c71b394d902b2060da8'}]"+"\"}]"; }else if("KJLHZL".equals(operationType)){ return "[{'fileTemplate':\""+"[{'text':'凯捷联合融资租赁合同模板','value':'5e1b90d31c4749e2af83891b48ccbe19'}]"+"\"}]"; + }else if("CYSHDZ".equals(operationType)){ + return "[{'fileTemplate':\""+"[{'text':'乘用车售后回租电子签约','value':'e6972f1da71f11ebbfe100163e0e11e6'}]"+"\"}]"; }else if("ZC".equals(operationType)){ return "[{'fileTemplate':\""+"[{'text':'中车合同模板','value':'a37a3bc1919c4ba39d8ba6348fb1962e'}]"+"\"}]"; }else{ diff --git a/src/com/tenwa/app/manage/util/KHSQContractSignActionTwoUtil.java b/src/com/tenwa/app/manage/util/KHSQContractSignActionTwoUtil.java new file mode 100644 index 000000000..deb2073d3 --- /dev/null +++ b/src/com/tenwa/app/manage/util/KHSQContractSignActionTwoUtil.java @@ -0,0 +1,571 @@ +package com.tenwa.app.manage.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.qiyuesuo.sdk.v2.SdkClient; +import com.qiyuesuo.sdk.v2.bean.Action; +import com.qiyuesuo.sdk.v2.bean.Contract; +import com.qiyuesuo.sdk.v2.bean.Signatory; +import com.qiyuesuo.sdk.v2.bean.Stamper; +import com.qiyuesuo.sdk.v2.bean.User; +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.ContractDetailRequest; +import com.qiyuesuo.sdk.v2.request.ContractDraftRequest; +import com.qiyuesuo.sdk.v2.request.ContractNoticeRequest; +import com.qiyuesuo.sdk.v2.request.ContractSendRequest; +import com.qiyuesuo.sdk.v2.request.ContractSignCompanyRequest; +import com.qiyuesuo.sdk.v2.request.DocumentAddByFileRequest; +import com.qiyuesuo.sdk.v2.request.DocumentDownloadRequest; +import com.qiyuesuo.sdk.v2.response.DocumentAddResult; +import com.qiyuesuo.sdk.v2.response.SdkResponse; +import com.qiyuesuo.sdk.v2.utils.IOUtils; +import com.tenwa.util.MultiSubjectUtil; + +public class KHSQContractSignActionTwoUtil { + private static final Logger logger = LoggerFactory.getLogger(KHSQContractSignActionTwoUtil.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 createContract(Map>> parameter,String subjectId,String fileNme) throws Exception { + SdkClient client = this.getSdkClient(subjectId); + Contract draftContract = new Contract(); + draftContract.setSubject(fileNme); + draftContract.setOrdinal(false); + List> list = parameter.get("PERSONAL"); + if(list!=null && list.size()>0){ + for (Map 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 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 sdkResponse = JSONUtils.toQysResponse(response, + Contract.class); + if (!sdkResponse.getCode().equals(0)) { + throw new Exception("创建合同草稿失败,失败原因:" + sdkResponse.getMessage()); + } + return sdkResponse; + } + + //添加本地文件 + public SdkResponse addDocumentByFile(String filePath,String subjectId,Long contractId)throws Exception { + SdkClient client = this.getSdkClient(subjectId); + // 进入本地文件 + StreamFile file = new StreamFile(new FileInputStream(new File(filePath))); + String response = null; + try { + // PDF为本地文件的类型,请修改为对应的本地文件类型 + response = client.service(new DocumentAddByFileRequest(contractId,file, "pdf", "由文件创建文档")); + } catch (Exception e) { + throw new Exception("根据文件添加文档请求服务器失败,失败原因:" + e.getMessage()); + } + SdkResponse sdkResponse = JSONUtils.toQysResponse( + response, DocumentAddResult.class); + if (!sdkResponse.getCode().equals(0)) { + throw new Exception("根据文件添加文档失败,失败原因:" + sdkResponse.getMessage()); + } + return sdkResponse; + } + + //发起合同 + public SdkResponse send(List> 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 stampers = new LinkedList(); + // 获取SignatoryId与ActionId,用于指定签署位置,公司签署位置需要指定ActionId,个人签署位置需要指定SignatoryId + Long platformSignatoryId = null; + Long personalSignatoryId = null; + Long companySealActionId = null; + int dbcont = 0; + 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 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); + if("sq".equals(type)){//承租人 + //承租人 + personalStamper.setKeyword("乙方(承租人):"); + personalStamper.setOffsetX(-0.05); + + //申请人添加第二个签字位置 + 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 personalStamper3 = new Stamper(); + personalStamper3.setPage(0); + personalStamper3.setType("PERSONAL"); + personalStamper3.setSignatoryId(personalSignatoryId); + personalStamper3.setDocumentId(documentId); + personalStamper3.setKeyword("(本人签字并按手印/公司公章)"); + personalStamper3.setOffsetX(-0.43); + stampers.add(personalStamper3); + + //申请人添加第4个签字位置 + Stamper personalStamper4 = new Stamper(); + personalStamper4.setPage(0); + personalStamper4.setType("PERSONAL"); + personalStamper4.setSignatoryId(personalSignatoryId); + personalStamper4.setDocumentId(documentId); + personalStamper4.setKeyword("承租人:"); + personalStamper4.setOffsetX(-0.3); + personalStamper4.setOffsetY(-0.006); + stampers.add(personalStamper4); + + //申请人添加第5个签字位置 + Stamper personalStamper5 = new Stamper(); + personalStamper5.setPage(0); + personalStamper5.setType("PERSONAL"); + personalStamper5.setSignatoryId(personalSignatoryId); + personalStamper5.setDocumentId(documentId); + personalStamper5.setKeyword("承租人(自然人签字并按印)/(法人签字并盖章):"); + personalStamper5.setOffsetX(-0.01); + personalStamper5.setOffsetY(-0.006); + stampers.add(personalStamper5); + + //添加一个签署时间 + 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); + + //添加二个签署时间 + 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); + + //添加三个签署时间 + Stamper personalStamperTime3 = new Stamper(); + personalStamperTime3.setPage(0); + personalStamperTime3.setType("TIMESTAMP"); + personalStamperTime3.setSignatoryId(personalSignatoryId); + personalStamperTime3.setDocumentId(documentId); + personalStamperTime3.setKeyword("乙方:"); + personalStamperTime3.setOffsetX(-0.03); + personalStamperTime3.setOffsetY(-0.03); + stampers.add(personalStamperTime3); + + //添加五个签署时间 + Stamper personalStamperTime5 = new Stamper(); + personalStamperTime5.setPage(0); + personalStamperTime5.setType("TIMESTAMP"); + personalStamperTime5.setSignatoryId(personalSignatoryId); + personalStamperTime5.setDocumentId(documentId); + personalStamperTime5.setKeyword("(本人签字并按手印/公司公章)"); + personalStamperTime5.setOffsetX(-0.35); + personalStamperTime5.setOffsetY(-0.03); + stampers.add(personalStamperTime5); + + //添加四个签署时间 + Stamper personalStamperTime4 = new Stamper(); + personalStamperTime4.setPage(0); + personalStamperTime4.setType("TIMESTAMP"); + personalStamperTime4.setSignatoryId(personalSignatoryId); + personalStamperTime4.setDocumentId(documentId); + personalStamperTime4.setKeyword("承租人(自然人签字并按印)/(法人签字并盖章):"); + personalStamperTime4.setOffsetX(0.18); + personalStamperTime4.setOffsetY(-0.006); + stampers.add(personalStamperTime4); + + }else if("gt".equals(type)){//共同申请人 + personalStamper.setKeyword("乙方(承租人):"); + personalStamper.setOffsetX(-0.05); + personalStamper.setOffsetY(-0.075); + + //共同申请人添加第二个签字位置 + Stamper personalStamper2 = new Stamper(); + personalStamper2.setPage(0); + personalStamper2.setType("PERSONAL"); + personalStamper2.setSignatoryId(personalSignatoryId); + personalStamper2.setDocumentId(documentId); + personalStamper2.setKeyword("(共同承租人)(若有)"); + personalStamper2.setOffsetX(-0.35); + stampers.add(personalStamper2); + + //共同申请人添加第三个签字位置 + Stamper personalStamper3 = new Stamper(); + personalStamper3.setPage(0); + personalStamper3.setType("PERSONAL"); + personalStamper3.setSignatoryId(personalSignatoryId); + personalStamper3.setDocumentId(documentId); + personalStamper3.setKeyword("(共同承租人)(若有):"); + personalStamper3.setOffsetX(-0.01); + personalStamper3.setOffsetY(-0.03); + stampers.add(personalStamper3); + + //添加一个签署时间 + Stamper personalStamperTime1 = new Stamper(); + personalStamperTime1.setPage(0); + personalStamperTime1.setType("TIMESTAMP"); + personalStamperTime1.setSignatoryId(personalSignatoryId); + personalStamperTime1.setDocumentId(documentId); + personalStamperTime1.setKeyword("(共同承租人)(若有)"); + personalStamperTime1.setOffsetX(-0.25); + personalStamperTime1.setOffsetY(-0.03); + stampers.add(personalStamperTime1); + + //添加二个签署时间 + Stamper personalStamperTime2 = new Stamper(); + personalStamperTime2.setPage(0); + personalStamperTime2.setType("TIMESTAMP"); + personalStamperTime2.setSignatoryId(personalSignatoryId); + personalStamperTime2.setDocumentId(documentId); + personalStamperTime2.setKeyword("(共同承租人)(若有):"); + personalStamperTime2.setOffsetX(0.18); + personalStamperTime2.setOffsetY(-0.006); + stampers.add(personalStamperTime2); + }else if("db".equals(type)){ + if(dbcont==0){ + personalStamper.setKeyword("丙方 1(保证人):"); + personalStamper.setOffsetX(-0.05); + }else if(dbcont==1){ + personalStamper.setKeyword("丙方 2(保证人):"); + personalStamper.setOffsetX(-0.05); + } + dbcont++; + } + stampers.add(personalStamper); + } + // 获取平台方SignatoryId,以及对应的公章签署ActionId和法人章签署ActionId + if (signatory.getTenantType().equals("COMPANY")) { + for (Action action : signatory.getActions()) { + platformSignatoryId = signatory.getId(); + companySealActionId = action.getId(); + Stamper sealStamper = new Stamper(); + sealStamper.setPage(0); + sealStamper.setType("COMPANY"); + sealStamper.setActionId(companySealActionId); + sealStamper.setSignatoryId(platformSignatoryId); + sealStamper.setDocumentId(documentId); + sealStamper.setKeyword("甲方(出租人):(公章) "); + sealStamper.setOffsetX(-0.13); + sealStamper.setOffsetY(-0.1); + stampers.add(sealStamper); + + //添加第二个盖章位置 + Stamper sealStamper2 = new Stamper(); + sealStamper2.setPage(0); + sealStamper2.setType("COMPANY"); + sealStamper2.setActionId(companySealActionId); + sealStamper2.setSignatoryId(platformSignatoryId); + sealStamper2.setDocumentId(documentId); + sealStamper2.setKeyword("甲方:安鹏融资租赁(天津)有限公司"); + sealStamper2.setOffsetX(-0.13); + sealStamper2.setOffsetY(-0.04); + stampers.add(sealStamper2); + + //添加第三个盖章位置 + Stamper sealStamper3 = new Stamper(); + sealStamper3.setPage(0); + sealStamper3.setType("COMPANY"); + sealStamper3.setActionId(companySealActionId); + sealStamper3.setSignatoryId(platformSignatoryId); + sealStamper3.setDocumentId(documentId); + sealStamper3.setKeyword("出租人(公章)"); + sealStamper3.setOffsetX(-0.13); + sealStamper3.setOffsetY(-0.04); + stampers.add(sealStamper3); + + //添加一个公司盖章时间 + Stamper sealStamperTime = new Stamper(); + sealStamperTime.setPage(0); + sealStamperTime.setType("TIMESTAMP"); + sealStamperTime.setActionId(companySealActionId); + sealStamperTime.setSignatoryId(platformSignatoryId); + sealStamperTime.setDocumentId(documentId); + sealStamperTime.setKeyword("签署日期:"); + sealStamperTime.setOffsetY(-0.006); + stampers.add(sealStamperTime); + } + } + } + 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 companySealSign(String subjectId,Long contractId) throws Exception { + String response = null; + try { + SdkClient client = this.getSdkClient(subjectId); + Contract contract = this.getContract(subjectId,contractId).getResult(); + logger.info("companySealSign20210428#companySealSign contract=【{}】", JSONUtils.toJson(contract)); + List signatories = contract.getSignatories(); + if(signatories!=null && signatories.size()>0){ + logger.info("companySealSign20210428#companySealSign1 signatories=【{}】", JSONUtils.toJson(signatories)); + for (Signatory signatory : signatories) { + logger.info("companySealSign20210428#companySealSign2 signatory=【{}】", JSONUtils.toJson(signatory)); + String tenantType = signatory.getTenantType(); + String status = signatory.getStatus(); + if(tenantType!=null && "COMPANY".equals(tenantType) && status!=null && "SIGNING".equals(status)){ + logger.info("companySealSign20210428#companySealSign3 tenantType=【{}】", tenantType); + logger.info("companySealSign20210428#companySealSign3 status=【{}】", status); + SignParam param = new SignParam(); + param.setContractId(contractId); + String company = signatory.getTenantName(); + System.out.println("盖章公司名称:"+company); + param.setTenantName(company); + + if(sZ_CompanyName.equals(company)){ + param.setSealId(new Long(sZ_OfficialSealId)); + }else if(tJ_CompanyName.equals(company)){ + param.setSealId(new Long(tJ_OfficialSealId)); + }else if(hH_CompanyName.equals(company)){ + param.setSealId(new Long(hH_OfficialSealId)); + } + logger.info("companySealSign20210428#companySealSign4 param=【{}】", JSONUtils.toJson(param)); + response = client.service(new ContractSignCompanyRequest(param)); + logger.info("companySealSign20210428#companySealSign5 response=【{}】", response); + } + } + } + } catch (Exception e) { + logger.error("companySealSign20210428 errorMsg=【{}】", e.getMessage(), e); + throw new Exception("公章签署请求服务器失败,失败原因:" + e.getMessage()); + } + logger.info("companySealSign20210429#companySealSign6 response=【{}】", response); + SdkResponse sdkResponse = JSONUtils.toQysResponse(response); + logger.info("companySealSign20210429#companySealSign7 sdkResponse=【{}】", JSONUtils.toJson(sdkResponse)); + if (!sdkResponse.getCode().equals(0)) { + logger.error("companySealSign20210429 errorMsg=【{}】", sdkResponse.getMessage()); + 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 "complete"; + } + boolean stu = true; + StringBuffer sb = new StringBuffer(); + List 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 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 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 "合同下载成功!"; + } + + public String messageSend(String subjectId,Long signContractId){ + SdkClient client = this.getSdkClient(subjectId); + ContractNoticeRequest request = new ContractNoticeRequest(signContractId); + String response = client.service(request); + SdkResponse responseObj = JSONUtils.toQysResponse(response); + if(responseObj.getCode() == 0) { + return "success"; + } else { + System.out.println("短信重发失败:"+responseObj.getCode()+":"+responseObj.getMessage()); + return responseObj.getMessage(); + } + } +} diff --git a/src/com/tenwa/channelportal/action/ContractSignActionNewUtils.java b/src/com/tenwa/channelportal/action/ContractSignActionNewUtils.java index aa6074633..5fd46608e 100644 --- a/src/com/tenwa/channelportal/action/ContractSignActionNewUtils.java +++ b/src/com/tenwa/channelportal/action/ContractSignActionNewUtils.java @@ -9,6 +9,7 @@ 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; @@ -23,7 +24,6 @@ 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.app.manage.util.ContractSignActionTwoUtil; import com.tenwa.comm.util.date.DateAssistant; import com.tenwa.comm.util.jboutil.DataOperatorUtil; import org.apache.log4j.Logger; @@ -48,7 +48,6 @@ public class ContractSignActionNewUtils { BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); BizObject bo = null; try { - ContractSignActionTwoUtil catu = new ContractSignActionTwoUtil(); BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); // 查询lb_doc_contract_list表 bo = contBom.createQuery("project_id=:projectId and flow_unid=:flowunid and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) ") @@ -102,236 +101,257 @@ public class ContractSignActionNewUtils { return "flase@error"; } } - - //个人直接发起电子签约 - public String signIng(JBOTransaction tx) throws Exception { - 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 { - BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid") - .setParameter("flowunid", FlowUnid).getSingleResult(true); - // 查询lb_doc_contract_list表 - bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) ") - .setParameter("projectId", ProjectId).getSingleResult(true); - if(bo == null ){ - throw new RuntimeException("请检查合同文件是否生成!"); - } else { - Map>> parameter = new HashMap>>(); - List> companyPar = new LinkedList>(); - // 添加公司公章 - Map param1 = new HashMap(); - param1.put("type", "1");// 1标识当期发起公司公章,2标识当前公司下的子公司 - param1.put("mobile", "12599998888");//子公司添加接收手机号,如果不需要接收,直接填写一个虚拟不存在就行,如果需要传真实手机号 - companyPar.add(param1); - if( "LHZL".equals(operationType) ){ - Map param2 = new HashMap(); - param2.put("type", "2");// 1标识当期发起公司公章,2标识当前公司下的子公司 - param2.put("mobile", "12599998888");//子公司添加接收手机号,如果不需要接收,直接填写一个虚拟不存在就行,如果需要传真实手机号 - companyPar.add(param2); - } - parameter.put("COMPANY", companyPar); - //添加个人基本信息 - List> personPar = new LinkedList>(); - Map sqPar = new HashMap(); - sqPar.put("name",bo.getAttribute("CUSTOMERNAME").toString()); - sqPar.put("type", "sq"); - sqPar.put("mobile",bo.getAttribute("TELEPHONE").toString()); - personPar.add(sqPar); - Map gtPar = new HashMap(); - //获取共同申请人的信息 - BizObjectManager cftm = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME); - BizObject cft = cftm.createQuery("flowunid=:FLowUnid and Partner_='Y'").setParameter("FLowUnid", FlowUnid).getSingleResult(false); - if(cft!=null){ - String name = cft.getAttribute("name").toString(); - String mobile = cft.getAttribute("tel").toString(); - if(name.length()>0 && mobile.length()>0){ - gtPar.put("name",name); - gtPar.put("type", "gt"); - gtPar.put("mobile",mobile); - personPar.add(gtPar); - } - } - //获取担保人信息 - BizObjectManager cptm = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME); - List cpts = cptm.createQuery("select * from O where flowunid=:flowUnid and CERTTYPE='Ind01' ").setParameter("flowUnid", FlowUnid).getResultList(false); - int count = 0; - if(cpts!=null && cpts.size()>2){ - count = 2; - }else{ - count = cpts.size(); - } - for(int i=0;i0 && mobile.length()>0){ - Map dbPar = new HashMap(); - dbPar.put("name",name); - dbPar.put("type", "db"); - dbPar.put("mobile",mobile); - personPar.add(dbPar); - } - } - parameter.put("PERSONAL", personPar); - ContractSignActionTwoUtil catu = new ContractSignActionTwoUtil(); - //创建合同 - SdkResponse createContract = catu.createContract(parameter, SubjectId,bo.getAttribute("filename").getString()); - Long contractId = createContract.getResult().getId(); - //添加本地生成的合同文件 - String makefullPath = bo.getAttribute("FULLPATH").toString();// 获取生成文件路径 - SdkResponse addDocumentByFile = catu.addDocumentByFile(makefullPath, SubjectId, contractId); - Long 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 fromCondtion = new HashMap(); - Map otherProperty = new HashMap(); - 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); - - pbo.setAttributeValue("DATA_STATE", "8");// 状态改成电子签约,签署中 - pbm.saveObject(pbo); - return "success"; - } - - } catch (Exception e) { - tx.rollback(); - e.printStackTrace(); - System.out.println("自然人电子签约异常:" + e.getMessage()); - return "flase@error"; - } - } - - //查出签约结果 - public String contractSignStatus(JBOTransaction tx) throws Exception { - 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("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='1' ) ") - .setParameter("projectId", ProjectId).getSingleResult(true); - if(bo == null ){ - return "请检查合同文件是否生成!"; - } else { - 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();// 获取生成文件路径 - ContractSignActionTwoUtil catu = new ContractSignActionTwoUtil(); - String contractStatus = catu.getContractStatus(SubjectId, signContractId); - if("success".equals(contractStatus)){ - //调用公司盖章 - catu.companySealSign(SubjectId, signContractId); - bo.setAttributeValue("SIGN_TYPE", "COMPLETE"); - bo.setAttributeValue("PROCESS", "5"); - // contBom.saveObject(bo); - Map fromCondtion = new HashMap(); - Map otherProperty = new HashMap(); - 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); - - BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); - pbo.setAttributeValue("DATA_STATE", "8");// 状态改成电子签约,签署中 - pbm.saveObject(pbo); - String downloadstatus = catu.contractDownload(SubjectId, documentId, makefullPath); - System.out.println("合同下载log===" + downloadstatus); - bo.setAttributeValue("PROCESS", "6"); - contBom.saveObject(bo); - return "已完成"; - }else{ - return contractStatus; - } - } - } - - public String sendMessageAgain(JBOTransaction tx) { - try{ - BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); - BizObject bo = null; - bo = contBom.createQuery("select singcontract_id,filename from O where project_id =:projectId" - +" and file_flag = 'yes' and sendprocess = '1' and sign_type = 'SIGNING'") - .setParameter("projectId", ProjectId).getSingleResult(true); - if(bo == null ){ - return "请检查合同文件是否生成!"; - } else { - long signContractId =new Long(bo.getAttribute("SINGCONTRACT_ID")==null ? null : bo.getAttribute("SINGCONTRACT_ID").getString()); - ContractSignActionTwoUtil catu = new ContractSignActionTwoUtil(); - 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) { - FlowUnid = flowUnid; - } - public String getFlagType() { - return flagType; - } - public void setFlagType(String flagType) { - this.flagType = flagType; - } - public String getProjectId() { - return ProjectId; - } - public void setProjectId(String projectId) { - ProjectId = projectId; - } - public String getSubjectId() { - return SubjectId; - } - public void setSubjectId(String subjectId) { - SubjectId = subjectId; - } + //个人直接发起电子签约 + public String signIng(JBOTransaction tx) throws Exception { + logger.info("compnySignIng#20210422 个人直接发起电子签约,需要个人签约"); + 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 { + BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid") + .setParameter("flowunid", FlowUnid).getSingleResult(true); + // 查询lb_doc_contract_list表 + bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) ") + .setParameter("projectId", ProjectId).getSingleResult(true); + if(bo == null ){ + throw new RuntimeException("请检查合同文件是否生成!"); + } else { + Map>> parameter = new HashMap>>(); + List> companyPar = new LinkedList>(); + // 添加公司公章 + Map param1 = new HashMap(); + param1.put("type", "1");// 1标识当期发起公司公章,2标识当前公司下的子公司 + param1.put("mobile", "12599998888");//子公司添加接收手机号,如果不需要接收,直接填写一个虚拟不存在就行,如果需要传真实手机号 + companyPar.add(param1); + if( "LHZL".equals(operationType) ){ + Map param2 = new HashMap(); + param2.put("type", "2");// 1标识当期发起公司公章,2标识当前公司下的子公司 + param2.put("mobile", "12599998888");//子公司添加接收手机号,如果不需要接收,直接填写一个虚拟不存在就行,如果需要传真实手机号 + companyPar.add(param2); + } + parameter.put("COMPANY", companyPar); + //添加个人基本信息 + List> personPar = new LinkedList>(); + Map sqPar = new HashMap(); + sqPar.put("name",bo.getAttribute("CUSTOMERNAME").toString()); + sqPar.put("type", "sq"); + sqPar.put("mobile",bo.getAttribute("TELEPHONE").toString()); + personPar.add(sqPar); + Map gtPar = new HashMap(); + //获取共同申请人的信息 + BizObjectManager cftm = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME); + BizObject cft = cftm.createQuery("flowunid=:FLowUnid and Partner_='Y'").setParameter("FLowUnid", FlowUnid).getSingleResult(false); + if(cft!=null){ + String name = cft.getAttribute("name").toString(); + String mobile = cft.getAttribute("tel").toString(); + if(name.length()>0 && mobile.length()>0){ + gtPar.put("name",name); + gtPar.put("type", "gt"); + gtPar.put("mobile",mobile); + personPar.add(gtPar); + } + } + //获取担保人信息 + BizObjectManager cptm = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME); + List cpts = cptm.createQuery("select * from O where flowunid=:flowUnid and CERTTYPE='Ind01' ").setParameter("flowUnid", FlowUnid).getResultList(false); + int count = 0; + if(cpts!=null && cpts.size()>2){ + count = 2; + }else{ + count = cpts.size(); + } + for(int i=0;i0 && mobile.length()>0){ + Map dbPar = new HashMap(); + dbPar.put("name",name); + dbPar.put("type", "db"); + dbPar.put("mobile",mobile); + personPar.add(dbPar); + } + } + parameter.put("PERSONAL", personPar); + KHSQContractSignActionTwoUtil catu = new KHSQContractSignActionTwoUtil(); + //创建合同 + SdkResponse createContract = catu.createContract(parameter, SubjectId,bo.getAttribute("filename").getString()); + Long contractId = createContract.getResult().getId(); + //添加本地生成的合同文件 + String makefullPath = bo.getAttribute("FULLPATH").toString();// 获取生成文件路径 + SdkResponse addDocumentByFile = catu.addDocumentByFile(makefullPath, SubjectId, contractId); + Long documentId = addDocumentByFile.getResult().getDocumentId(); + //发起合同 + catu.send(personPar, SubjectId, contractId, documentId); - public String getCustomerType() { - return customerType; - } + bo.setAttributeValue("DOCUMENT_ID",documentId); + bo.setAttributeValue("SINGCONTRACT_ID", contractId); + bo.setAttributeValue("SIGN_TYPE", "SIGNING"); + bo.setAttributeValue("SENDPROCESS", "1"); + contBom.saveObject(bo); + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + 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); - public void setCustomerType(String customerType) { - this.customerType = customerType; - } + pbo.setAttributeValue("DATA_STATE", "8");// 状态改成电子签约,签署中 + pbm.saveObject(pbo); + return "success"; + } - public String getCurUserID() { - return CurUserID; - } + } catch (Exception e) { + tx.rollback(); + e.printStackTrace(); + System.out.println("自然人电子签约异常:" + e.getMessage()); + return "flase@error"; + } + } - public void setCurUserID(String curUserID) { - CurUserID = curUserID; - } + //查出签约结果 + public String contractSignStatus(JBOTransaction tx) throws Exception { + 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("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='1' ) ") + .setParameter("projectId", ProjectId).getSingleResult(true); + if(bo == null ){ + return "请检查合同文件是否生成!"; + } else { + 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();// 获取生成文件路径 - public String getOperationType() { - return operationType; - } + KHSQContractSignActionTwoUtil catu = new KHSQContractSignActionTwoUtil(); + String contractStatus = catu.getContractStatus(SubjectId, signContractId); + if("complete".equals(contractStatus)){ + logger.info("contractSignStatus20210429 电子签约已完成,无需执行合同盖章。"); + return "已完成"; + }else if("success".equals(contractStatus)){ + logger.info("contractSignStatus20210429 执行合同盖章。"); + //调用公司盖章 + catu.companySealSign(SubjectId, signContractId); + bo.setAttributeValue("SIGN_TYPE", "COMPLETE"); + bo.setAttributeValue("PROCESS", "5"); + // contBom.saveObject(bo); + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + 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); + + BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true); + pbo.setAttributeValue("DATA_STATE", "8");// 状态改成电子签约,签署中 + pbm.saveObject(pbo); + String downloadstatus = catu.contractDownload(SubjectId, documentId, makefullPath); + logger.info("合同下载log===" + downloadstatus); + bo.setAttributeValue("PROCESS", "6"); + contBom.saveObject(bo); + return "已完成"; + }else{ + return contractStatus; + } + } + } + + public String sendMessageAgain(JBOTransaction tx) { + try{ + + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + BizObject bo = null; + bo = contBom.createQuery("select singcontract_id,filename from O where project_id =:projectId" + +" and file_flag = 'yes' and sendprocess = '1' and sign_type = 'SIGNING'") + .setParameter("projectId", ProjectId).getSingleResult(true); + if(bo == null ){ + // 查询lb_doc_contract_list表 + bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='1' ) ") + .setParameter("projectId", ProjectId).getSingleResult(true); + if(bo == null ){ + logger.info("contractSignStatus20210429 请检查合同文件是否生成111"); + return "请检查合同文件是否生成!"; + } + long signContractId = + new Long(bo.getAttribute("SINGCONTRACT_ID") == null ? null : bo.getAttribute("SINGCONTRACT_ID").getString()); + KHSQContractSignActionTwoUtil catu = new KHSQContractSignActionTwoUtil(); + String contractStatus = catu.getContractStatus(SubjectId, signContractId); + if("complete".equals(contractStatus)){ + logger.info("contractSignStatus20210429 电子签约已完成,无需执行合同盖章。"); + return "签约已完成,无需再发送短信。"; + } + logger.info("contractSignStatus20210429 请检查合同文件是否生成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) { + FlowUnid = flowUnid; + } + public String getFlagType() { + return flagType; + } + public void setFlagType(String flagType) { + this.flagType = flagType; + } + public String getProjectId() { + return ProjectId; + } + public void setProjectId(String projectId) { + ProjectId = projectId; + } + public String getSubjectId() { + return SubjectId; + } + public void setSubjectId(String subjectId) { + SubjectId = subjectId; + } + + public String getCustomerType() { + return customerType; + } + + public void setCustomerType(String customerType) { + this.customerType = customerType; + } + + public String getCurUserID() { + return CurUserID; + } + + public void setCurUserID(String curUserID) { + CurUserID = curUserID; + } + + public String getOperationType() { + return operationType; + } + + public void setOperationType(String operationType) { + this.operationType = operationType; + } - public void setOperationType(String operationType) { - this.operationType = operationType; - } - } diff --git a/src_cmb/com/tenwa/sdk/controller/CmbToPayController.java b/src_cmb/com/tenwa/sdk/controller/CmbToPayController.java index fdfd85e7f..d5635a1b6 100644 --- a/src_cmb/com/tenwa/sdk/controller/CmbToPayController.java +++ b/src_cmb/com/tenwa/sdk/controller/CmbToPayController.java @@ -30,20 +30,16 @@ import com.thoughtworks.xstream.XStream; import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP; import jbo.com.tenwa.entity.comm.own.OWN_ACCOUNT; -import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO; -import jbo.com.tenwa.lease.comm.LC_FUND_INCOME_CALLBACK_DETAIL_TEMP; -import jbo.com.tenwa.lease.comm.LC_FUND_INCOME_CALLBACK_INFO_TEMP; -import jbo.com.tenwa.lease.comm.LC_FUND_INCOME_PAY_DETAIL_TEMP; -import jbo.com.tenwa.lease.comm.LC_FUND_INCOME_PAY_INFO_TEMP; +import jbo.com.tenwa.lease.comm.*; import jbo.prd.LB_PRODUCTTOCOMPANY_INFO; import jbo.sys.CODE_LIBRARY; import net.sf.json.JSONObject; public class CmbToPayController extends BaseFlowStartAction { - private String distributor_ids; //获取选择的 经销商ID + private String distributor_ids; //获取选择的 经销商ID private String contract_ids; //获取选择的合同ID private String FLOWUNID ; //流程号、 - + public String getContract_ids() { return contract_ids; @@ -60,7 +56,7 @@ public class CmbToPayController extends BaseFlowStartAction { public void setFLOWUNID(String fLOWUNID) { FLOWUNID = fLOWUNID; } - + public String getDistributor_ids() { return distributor_ids; } @@ -68,7 +64,7 @@ public class CmbToPayController extends BaseFlowStartAction { public void setDistributor_ids(String distributor_ids) { this.distributor_ids = distributor_ids; } - + @SuppressWarnings({ "unchecked", "unused" }) public synchronized String action(JBOTransaction tx) throws Exception { /* @@ -77,7 +73,7 @@ public class CmbToPayController extends BaseFlowStartAction { Map map = new HashMap(); map.put("code", "0") ; map.put("msg", "") ; - + /* * 基本参数检查######开始 */ @@ -116,7 +112,7 @@ public class CmbToPayController extends BaseFlowStartAction { /* * 基本参数检查######开始 */ - + /* * 本方放款账户获取######开始 */ @@ -139,37 +135,37 @@ public class CmbToPayController extends BaseFlowStartAction { JSONObject jsonObj = JSONObject.fromObject(map); return jsonObj.toString(); } - BizObject accountBo = accountBoList.get(0); + BizObject accountBo = accountBoList.get(0); /* * 本方放款账户获取######结束 */ - - + + /* * 付款申请基础信息定义######开始 */ - + //安鹏要求改为从配置文件中读取。 //String LGNNAM = accountBo.getAttribute("OWN_NAME").toString(); // String LGNNAM = "安鹏经办"; // String LGNNAM = "银企直连测试用户113"; Configure config = Configure.getInstance(); - String LGNNAM = config.getConfigure("LGNNAM"); + String LGNNAM = config.getConfigure("LGNNAM"); String FUNNAM = "DCPAYREQ"; int DATTYP = 2; String BUSMOD = "00001"; //默认参数 请按照实际情况谨慎修改 String BUSCOD = "N02030"; //默认参数 请按照实际情况谨慎修改 String DBTBBK = accountBo.getAttribute("branch_code").toString(); String DBTACC = accountBo.getAttribute("acc_number").toString(); - String STLCHN = "F"; //默认参数 - String CCYNBR = "10"; //默认参数 - String TRSTYP = "100001"; //默认参数 - String RCVCHK = "1"; //默认参数 + String STLCHN = "F"; //默认参数 + String CCYNBR = "10"; //默认参数 + String TRSTYP = "100001"; //默认参数 + String RCVCHK = "1"; //默认参数 /* * 付款申请基础信息定义######结束 */ - - + + /* * 获取常用代码并将codeno存为主键 方便下面代码调用######开始 */ @@ -178,7 +174,7 @@ public class CmbToPayController extends BaseFlowStartAction { Map bank_reqsts = new HashMap(); //业务请求状态 Map bank_rtnflg = new HashMap(); //业务处理结果 Map fee_type = new HashMap(); //费用类型 - + for(BizObject code_bo:bank_code_list) { String itemno = code_bo.getAttribute("itemno").toString(); String itemname = code_bo.getAttribute("itemname").toString(); @@ -191,17 +187,17 @@ public class CmbToPayController extends BaseFlowStartAction { fee_type.put(itemno, itemname); } } - String[] bank_reqsts_array = {"AUT","NTE","WCF","BNK","FIN","ACK","APD","OPR"}; - String[] bank_rtnflg_array = {"S","F","B","R","D","C","M","V","U","T"}; + String[] bank_reqsts_array = {"AUT","NTE","WCF","BNK","FIN","ACK","APD","OPR"}; + String[] bank_rtnflg_array = {"S","F","B","R","D","C","M","V","U","T"}; List bank_reqsts_list = Arrays.asList(bank_reqsts_array); List bank_rtnflg_list = Arrays.asList(bank_rtnflg_array); /* * 获取常用代码并将codeno存为主键 方便下面代码调用######结束 */ - - + + /* - * + * */ SDKToPayVO sDKToPayVO = new SDKToPayVO(); SDKInfoVO sDKInfoVO = new SDKInfoVO(); @@ -214,10 +210,10 @@ public class CmbToPayController extends BaseFlowStartAction { sDKPayRqxVO.setBUSCOD(BUSCOD); sDKPayRqxVO.setBUSMOD(BUSMOD); - + BizObjectManager pay_info_bom = JBOFactory.getBizObjectManager(LC_FUND_INCOME_PAY_INFO_TEMP.CLASS_NAME); BizObject pay_info_bo = pay_info_bom.newObject(); - + String CMB_PAY_NO = UUID.randomUUID().toString().replaceAll("-", "") ; // 付款流水号 pay_info_bo.setAttributeValue("ID", UUID.randomUUID().toString().replaceAll("-", "")); pay_info_bo.setAttributeValue("FLOWUNID", FLOWUNID); @@ -227,39 +223,39 @@ public class CmbToPayController extends BaseFlowStartAction { pay_info_bo.setAttributeValue("SDKPAYRQX_BUSCOD", BUSCOD); pay_info_bo.setAttributeValue("SDKPAYRQX_BUSMOD", BUSMOD); this.initTabeUserInfo(pay_info_bo); - - - List pay_detail_list = null;// 声明 付款发起详情list + + + List pay_detail_list = null;// 声明 付款发起详情list BizObjectManager bankBo = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME); - BizObject infoOne = null ; - SDKDcPayReqxVO pay_detail = null ; + BizObject infoOne = null ; + SDKDcPayReqxVO pay_detail = null ; SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); - BizObjectManager pay_detail_bom = null ; + BizObjectManager pay_detail_bom = null ; String error_msg_tips = ""; //定义错误信息 是否存在 String error_null_tips = ""; //定义错误信息 是否为空 - - - if(contract_id_list.size() > 30){ //招行文档规定 单次批量申请不能超过30条 + + + if(contract_id_list.size() > 30){ //招行文档规定 单次批量申请不能超过30条 map.put("code", "1") ; map.put("msg", "单次处理不能超过30条,请检查") ; JSONObject jsonObj = JSONObject.fromObject(map); return jsonObj.toString(); } - + pay_detail_bom = JBOFactory.getBizObjectManager(LC_FUND_INCOME_PAY_DETAIL_TEMP.CLASS_NAME); BizObject pay_detail_bo = null; - + BizObjectManager call_back_detail_bom = JBOFactory.getBizObjectManager(LC_FUND_INCOME_CALLBACK_DETAIL_TEMP.CLASS_NAME); BizObject call_back_detail_bo = null ; - + tx.join(call_back_detail_bom); - + pay_detail_list = new ArrayList(); - - String temp_str = UUID.randomUUID().toString().replaceAll("-", "").substring(0, 14) ; + + String temp_str = UUID.randomUUID().toString().replaceAll("-", "").substring(0, 14) ; String date = df.format(new Date()); BigDecimal all_money = new BigDecimal("0"); - + List income_all_list = bankBo.createQuery("select o.CMB_PAY_NO,o.FACT_MONEY,o.FLOWUNID,contract_info.ID,contract_info.CONTRACT_NO,distributor.distributor_id,distributor.acc_number,distributor.open_bank,distributor.account,distributor.district,distributor.provinceInfo from o join jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO contract_info on o.CONTRACT_ID = contract_info.id join jbo.app.tenwa.customer.DISTRIBUTOR_ACCOUNT distributor on contract_info.distributor_id = distributor.distributor_id and distributor.is_main='Y' where FLOWUNID=:FLOWUNID and o.PAY_TYPE = 'pay_type_out' ").setParameter("FLOWUNID", FLOWUNID).getResultList(false); if(income_all_list==null) { map.put("code", "1") ; @@ -267,21 +263,21 @@ public class CmbToPayController extends BaseFlowStartAction { JSONObject jsonObj = JSONObject.fromObject(map); return jsonObj.toString(); } - int index = 1 ; + int index = 1 ; for (String contract_id : contract_id_list) { - - infoOne = null ; + + infoOne = null ; BigDecimal contract_all_money = new BigDecimal("0"); for(BizObject income_one : income_all_list) { String income_one_contract_id = income_one.getAttribute("ID").toString(); if(contract_id.equals(income_one_contract_id)) { BigDecimal income_one_fact_money = new BigDecimal(income_one.getAttribute("FACT_MONEY").toString()); contract_all_money = contract_all_money.add(income_one_fact_money); - infoOne = income_one ; + infoOne = income_one ; } } all_money=all_money.add(contract_all_money); - if(infoOne==null) { + if(infoOne==null) { map.put("code", "1") ; map.put("msg", "第["+index+"]笔数据不存在,请检查") ; JSONObject jsonObj = JSONObject.fromObject(map); @@ -289,11 +285,17 @@ public class CmbToPayController extends BaseFlowStartAction { } String acc_number = infoOne.getAttribute("acc_number").toString(); String open_bank = infoOne.getAttribute("open_bank").toString(); - String account = infoOne.getAttribute("account").toString(); - String province = infoOne.getAttribute("provinceInfo").toString(); - String city = infoOne.getAttribute("district").toString(); + String account = infoOne.getAttribute("account").toString(); + String province = infoOne.getAttribute("provinceInfo").toString(); + String city = infoOne.getAttribute("district").toString(); + BizObject bo_lci = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME).createQuery("id=:id").setParameter("id", contract_id).getSingleResult(false); String productId = bo_lci.getAttribute("product_id").toString(); + String contractNoZC = bo_lci.getAttribute("ZC_CONTRACT_NUMBER")==null?"":bo_lci.getAttribute("ZC_CONTRACT_NUMBER").toString(); + String contractNo = bo_lci.getAttribute("CONTRACT_NO").toString(); + + BizObject bo_lul = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME).createQuery("contract_id=:contractId").setParameter("contractId", contract_id).getSingleResult(false); + String customerName = bo_lul.getAttribute("CUSTOMER_NAME").toString(); BizObject bo_lpi = JBOFactory.getBizObjectManager(LB_PRODUCTTOCOMPANY_INFO.CLASS_NAME).createQuery("product_id=:product_id").setParameter("product_id", productId).getSingleResult(false); if(bo_lpi!=null&&bo_lpi.getAttribute("product_id")!=null){ acc_number = bo_lpi.getAttribute("acc_number").toString(); @@ -302,18 +304,18 @@ public class CmbToPayController extends BaseFlowStartAction { province = bo_lpi.getAttribute("province").toString(); city = bo_lpi.getAttribute("city").toString(); } - - String FLOWUNID = this.FLOWUNID ; + + String FLOWUNID = this.FLOWUNID ; String DISTRIBUTOR_ID = infoOne.getAttribute("distributor_id").toString(); String CONTRACT_ID = infoOne.getAttribute("ID").toString(); - String CRTACC = acc_number; - String BANK_NAME = open_bank; - String CRTNAM = account; - String CRTPVC = province; - String CRTCTY = city; + String CRTACC = acc_number; + String BANK_NAME = open_bank; + String CRTNAM = account; + String CRTPVC = province; + String CRTCTY = city; String NUSAGE = infoOne.getAttribute("memo").toString(); String CMB_PAY_NO_ONE = infoOne.getAttribute("CMB_PAY_NO").toString(); - + /* * 检查当前付款信息是否存在######开始 */ @@ -322,7 +324,7 @@ public class CmbToPayController extends BaseFlowStartAction { BizObjectQuery call_back_detail_boo= call_back_detail_bom.createQuery(temp_sql); call_back_detail_boo.setParameter("FLOWUNID",FLOWUNID) ; call_back_detail_boo.setParameter("CMB_PAY_NO_ONE",CMB_PAY_NO_ONE) ; - call_back_detail_bo = call_back_detail_boo.getSingleResult(false) ; + call_back_detail_bo = call_back_detail_boo.getSingleResult(false) ; if(call_back_detail_bo!=null) { String CALL_BACK_DETAIL_REQSTS = call_back_detail_bo.getAttribute("REQSTS").toString(); String CALL_BACK_DETAIL_RTNFLG = call_back_detail_bo.getAttribute("RTNFLG").toString(); @@ -337,23 +339,23 @@ public class CmbToPayController extends BaseFlowStartAction { } /* * 检查当前付款信息是否存在######结束 - */ - - int check=contract_all_money.compareTo(BigDecimal.ZERO); - - if( CONTRACT_ID==null || "".equals( CONTRACT_ID ) - || CRTACC==null || "".equals( CRTACC ) - || BANK_NAME==null || "".equals( BANK_NAME ) - || CRTNAM==null || "".equals( CRTNAM ) - || CRTPVC==null || "".equals( CRTPVC ) - || CRTCTY==null || "".equals( CRTCTY ) - || CRTPVC==null || "".equals( CRTPVC ) - || check==-1 - || CRTPVC==null || "".equals( CRTPVC ) - ){ - error_null_tips = error_null_tips+ "第["+index+"]笔相关数据不存在,请检查\n" ; + */ + + int check=contract_all_money.compareTo(BigDecimal.ZERO); + + if( CONTRACT_ID==null || "".equals( CONTRACT_ID ) + || CRTACC==null || "".equals( CRTACC ) + || BANK_NAME==null || "".equals( BANK_NAME ) + || CRTNAM==null || "".equals( CRTNAM ) + || CRTPVC==null || "".equals( CRTPVC ) + || CRTCTY==null || "".equals( CRTCTY ) + || CRTPVC==null || "".equals( CRTPVC ) + || check==-1 + || CRTPVC==null || "".equals( CRTPVC ) + ){ + error_null_tips = error_null_tips+ "第["+index+"]笔相关数据不存在,请检查\n" ; } - + if(CRTPVC!=null && !"".equals(CRTPVC)) { if(CRTCTY.indexOf(CRTPVC)!=-1) { CRTCTY = CRTCTY.substring(CRTPVC.length()); @@ -367,19 +369,20 @@ public class CmbToPayController extends BaseFlowStartAction { CRTPVC="重庆"; CRTCTY="重庆"; } - - String YURREF_INDEX = index+"" ; + + String YURREF_INDEX = index+"" ; if(index<10) { - YURREF_INDEX = String.format("%02d", index); + YURREF_INDEX = String.format("%02d", index); } - + String TRSAMT = contract_all_money.toPlainString(); - String YURREF = YURREF_INDEX + date+ temp_str; + String YURREF = YURREF_INDEX + date+ temp_str; String BNKFLG = checkCMB(BANK_NAME); - NUSAGE = "客户["+CRTACC+"]发起申请"; + //NUSAGE = "客户["+CRTACC+"]发起申请"; String BUSNAR = "[实际付款][客户:"+CRTACC+"][支付金额:"+TRSAMT+"]"; - - pay_detail = new SDKDcPayReqxVO(); + NUSAGE = customerName+"-"+contractNoZC+"-"+contractNo; + + pay_detail = new SDKDcPayReqxVO(); pay_detail.setYURREF(YURREF); pay_detail.setDBTACC(DBTACC); pay_detail.setDBTBBK(DBTBBK); @@ -396,11 +399,11 @@ public class CmbToPayController extends BaseFlowStartAction { pay_detail.setRCVCHK(RCVCHK); pay_detail.setCRTPVC(CRTPVC); pay_detail.setCRTCTY(CRTCTY); - + sDKDcPayReqxVOList.add(pay_detail); - + pay_detail_bo = pay_detail_bom.newObject(); - + pay_detail_bo.setAttributeValue("ID", UUID.randomUUID().toString().replaceAll("-", "")); pay_detail_bo.setAttributeValue("CMB_PAY_NO", CMB_PAY_NO); pay_detail_bo.setAttributeValue("DISTRIBUTOR_ID", DISTRIBUTOR_ID); @@ -426,15 +429,15 @@ public class CmbToPayController extends BaseFlowStartAction { pay_detail_list.add(pay_detail_bo); ++index; } - - + + if(!"".equals(error_msg_tips)) { map.put("code", "1") ; map.put("msg", error_msg_tips) ; JSONObject jsonObj = JSONObject.fromObject(map); return jsonObj.toString(); } - + if(!"".equals(error_null_tips)) { map.put("code", "1") ; map.put("msg", error_null_tips) ; @@ -467,7 +470,7 @@ public class CmbToPayController extends BaseFlowStartAction { JSONObject jsonObj = JSONObject.fromObject(map); return jsonObj.toString(); } - + if(result.getInfo().getSTATUS()==1) { if("0".equals( result.getInfo().getRETCOD() )) { pay_info_bo.setAttributeValue("FACT_MONEY",all_money.toPlainString()); @@ -479,25 +482,25 @@ public class CmbToPayController extends BaseFlowStartAction { BizObjectManager income_bom = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME); tx.join(pay_detail_bom); tx.join(income_bom); - + if(pay_detail_list!=null && pay_detail_list.size()>0) - for (BizObject pay_detail_one : pay_detail_list) { - BizObjectQuery income_boo= income_bom.createQuery("update o join jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO lcf on o.contract_id = lcf.id set o.CMB_PAY_NO=:CMB_PAY_NO where o.PAY_TYPE = 'pay_type_out' and o.FLOWUNID=:FLOWUNID and lcf.ID=:CONTRACT_ID"); - income_boo.setParameter("CMB_PAY_NO",CMB_PAY_NO) ; - income_boo.setParameter("FLOWUNID",pay_detail_one.getAttribute("FLOWUNID").toString()) ; - income_boo.setParameter("CONTRACT_ID",pay_detail_one.getAttribute("CONTRACT_ID").toString()) ; - income_boo.setParameter("DISTRIBUTOR_ID",pay_detail_one.getAttribute("DISTRIBUTOR_ID").toString()) ; - income_boo.executeUpdate();//更新资金收付表 - pay_detail_bom.saveObject(pay_detail_one); //插入支付详情表 - } + for (BizObject pay_detail_one : pay_detail_list) { + BizObjectQuery income_boo= income_bom.createQuery("update o join jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO lcf on o.contract_id = lcf.id set o.CMB_PAY_NO=:CMB_PAY_NO where o.PAY_TYPE = 'pay_type_out' and o.FLOWUNID=:FLOWUNID and lcf.ID=:CONTRACT_ID"); + income_boo.setParameter("CMB_PAY_NO",CMB_PAY_NO) ; + income_boo.setParameter("FLOWUNID",pay_detail_one.getAttribute("FLOWUNID").toString()) ; + income_boo.setParameter("CONTRACT_ID",pay_detail_one.getAttribute("CONTRACT_ID").toString()) ; + income_boo.setParameter("DISTRIBUTOR_ID",pay_detail_one.getAttribute("DISTRIBUTOR_ID").toString()) ; + income_boo.executeUpdate();//更新资金收付表 + pay_detail_bom.saveObject(pay_detail_one); //插入支付详情表 + } } - - BizObjectManager callback_info_bom = JBOFactory.getBizObjectManager(LC_FUND_INCOME_CALLBACK_INFO_TEMP.CLASS_NAME) ; - BizObjectManager callback_detail_bom = null; - + + BizObjectManager callback_info_bom = JBOFactory.getBizObjectManager(LC_FUND_INCOME_CALLBACK_INFO_TEMP.CLASS_NAME) ; + BizObjectManager callback_detail_bom = null; + BizObject callback_info_bo = callback_info_bom.newObject(); BizObject callback_detail_bo = null; - + tx.join(callback_info_bom); callback_info_bo.setAttributeValue("ID", UUID.randomUUID().toString().replaceAll("-", "")); callback_info_bo.setAttributeValue("CMB_PAY_NO",CMB_PAY_NO); @@ -508,14 +511,14 @@ public class CmbToPayController extends BaseFlowStartAction { callback_info_bo.setAttributeValue("INFO_ERRMSG",result.getInfo().getERRMSG()); this.initTabeUserInfo(callback_info_bo); callback_info_bom.saveObject(callback_info_bo); //插入支付回调信息表 - - List details = result.getDetails() ; + + List details = result.getDetails() ; String error_info = ""; if(details!=null && details.size()>0) { - callback_detail_bom = JBOFactory.getBizObjectManager(LC_FUND_INCOME_CALLBACK_DETAIL_TEMP.CLASS_NAME) ; + callback_detail_bom = JBOFactory.getBizObjectManager(LC_FUND_INCOME_CALLBACK_DETAIL_TEMP.CLASS_NAME) ; tx.join(callback_detail_bom); - int call_index = 1 ; - for (SDKPayCallDetail detail : details) { + int call_index = 1 ; + for (SDKPayCallDetail detail : details) { if (detail.getREQSTS().equals("FIN") && detail.getRTNFLG().equals("F")) { error_info= error_info+"\n"+ "第["+call_index+"]笔数据 "+detail.getERRTXT() ; } @@ -533,16 +536,16 @@ public class CmbToPayController extends BaseFlowStartAction { callback_detail_bo.setAttributeValue("OPRALS",detail.getOPRALS()); callback_detail_bo.setAttributeValue("ERRCOD",detail.getERRCOD()); callback_detail_bo.setAttributeValue("ERRTXT",detail.getERRTXT()); - + if(pay_detail_list!=null && pay_detail_list.size()>0) { - for (BizObject pay_detail_one : pay_detail_list) { + for (BizObject pay_detail_one : pay_detail_list) { if(DETAIL_YURREF.equals( pay_detail_one.getAttribute("YURREF").toString() )) { callback_detail_bo.setAttributeValue("CONTRACT_ID",pay_detail_one.getAttribute("CONTRACT_ID").toString()); callback_detail_bo.setAttributeValue("DISTRIBUTOR_ID",pay_detail_one.getAttribute("DISTRIBUTOR_ID").toString()); } } } - + this.initTabeUserInfo(callback_detail_bo); callback_detail_bom.saveObject(callback_detail_bo);//插入支付回调详情表 ++call_index;