diff --git a/src/com/tenwa/app/baseFileTemplate/handle/FileTemplateUtil.java b/src/com/tenwa/app/baseFileTemplate/handle/FileTemplateUtil.java index e89531fa0..7e680bc40 100644 --- a/src/com/tenwa/app/baseFileTemplate/handle/FileTemplateUtil.java +++ b/src/com/tenwa/app/baseFileTemplate/handle/FileTemplateUtil.java @@ -9,6 +9,7 @@ import jbo.app.tenwa.doc.LB_DOCRELATIVE; import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST; import jbo.com.tenwa.entity.comm.officetempalte.BF_TEMPLATE; import jbo.com.tenwa.lease.comm.LB_CONTRACT_TEMPLATE; +import jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR_TEMP; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; @@ -169,7 +170,25 @@ public class FileTemplateUtil { return message.toString(); } - public String jiaoyan(JBOTransaction tx) throws Exception{ + public String CheckCar(JBOTransaction tx) throws Exception{ + String message = ""; + BizObjectManager lrct = JBOFactory.getBizObjectManager(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME); + BizObject lrc = lrct.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + if(lrc!= null){ + int length = lrc.getAttribute("FRAME_NUMBER").toString().length(); + if(lrc.getAttribute("FRAME_NUMBER").toString().length()==0){ + message = "车架号、"; + } + if(lrc.getAttribute("CAR_COLOUR").toString().length()==0){ + message = message+"车辆颜色、"; + } + if(lrc.getAttribute("ENGINE_NUMBER").toString().length()==0){ + message = message+ "发动机号、"; + } + } + if(message.length()>0){ + return "请先填写:"+message.substring(0,message.length() - 1)+"!"; + } String docName=""; String[] bfids = templateIds.split("&"); BizObjectManager btManager = JBOFactory.getBizObjectManager(BF_TEMPLATE.CLASS_NAME); diff --git a/src/com/tenwa/channelportal/action/ContractSignAction.java b/src/com/tenwa/channelportal/action/ContractSignAction.java index eb8c29851..917b28aee 100644 --- a/src/com/tenwa/channelportal/action/ContractSignAction.java +++ b/src/com/tenwa/channelportal/action/ContractSignAction.java @@ -221,26 +221,18 @@ public class ContractSignAction{ // 查询lb_doc_contract_list表 bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) ").setParameter("projectId", ProjectId).getResultList(true); for (BizObject keys : bo) { - String info = null; - String docName = keys.getAttribute("DOC_NAME").toString(); - if(docName.indexOf("融资租赁合同")>-1){ - //需要多个人签约的info.deleteCharAt(info.length() - 1) - info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); - StringBuffer manyPeople = this.manyPeople(); - if(manyPeople.length()>0){ - info=info+"@applicant,"+manyPeople.deleteCharAt(manyPeople.length() - 1); - } - }else{ - //需要一个人签字的 - info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); + String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString(); + StringBuffer manyPeople = this.manyPeople(); + if(manyPeople.length()>0){ + info=info+"@applicant,"+manyPeople.deleteCharAt(manyPeople.length() - 1); } - List list = map.get(info); + List list = map.get(info); if (list == null) { list = new ArrayList(); map.put(info, list); } con = new ContractSignInfo(); - con.setCustname(keys.getAttribute("CUSTOMERNAME").toString()); + con.setCustname(keys.getAttribute("DOC_NAME").toString()); con.setCustphone(keys.getAttribute("TELEPHONE").toString()); con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); con.setFilename(keys.getAttribute("FILENAME").toString()); @@ -345,6 +337,125 @@ public class ContractSignAction{ return "flase@error"; } } + /** + * 法人客户在生成合同是直接盖章 + * @param tx + * @return + * @throws Exception + */ + + @SuppressWarnings("unchecked") + public String compnySignIng(JBOTransaction tx) throws Exception { + requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); + BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + Map map = new HashMap(); + ContractSignInfo con = null; + List bo = null; + BizObject ldclBo = null; + try { + BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).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).getResultList(true); + for (BizObject keys : bo) { + String info = keys.getAttribute("id").toString(); + con = new ContractSignInfo(); + con.setCustname(keys.getAttribute("DOC_NAME").toString()); + con.setCustphone(keys.getAttribute("TELEPHONE").toString()); + con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString()); + con.setFilename(keys.getAttribute("FILENAME").toString()); + // 获取生成文件路径 + String makefullPath = keys.getAttribute("FULLPATH").toString(); + File file = new File(makefullPath); + if (!file.exists()) { + throw new RuntimeException("要读取的文件不存在"); + } + con.setInputfile(BASE64.encodeImgageToBase64(file)); + map.put(info, con); + } + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + Map resultMap = requestService.compnySign(map); + if (!resultMap.containsKey("error")) { + for (String key : resultMap.keySet()) { + // 存储契约锁返回的合同id和合同文件id + if (key.indexOf("contract_") == -1) { + fromCondtion.clear(); + otherProperty.clear(); + // 契约锁合同号 + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SIGN_TYPE", "COMPLETE");//法人客户当盖完章改为完成状态 + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + contBom.saveObject(ldclBo); + + String contractDocId = ldclBo.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("project_status", "8");// 状态改成电子签约,签署中 + pbm.saveObject(pbo); + downloadDoc(tx); + return "success"; + } else { + Boolean flag = false; + String getMessage = resultMap.get("error"); + logger.info("契约锁反馈的异常信息" + getMessage); + for (String key : resultMap.keySet()) { + // 存储契约锁返回的合同id和合同文件id + if (key.indexOf("contract_") == -1 && !"error".equals(key)) { + fromCondtion.clear(); + otherProperty.clear(); + // 契约锁合同号 + String contractId = resultMap.get("contract_" + key); + String sendProcess = resultMap.get("contract_" + contractId); + ldclBo = contBom.createQuery("ATTRIBUTE_ID='" + key + "'").getSingleResult(true); + ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key)); + ldclBo.setAttributeValue("SINGCONTRACT_ID", contractId); + ldclBo.setAttributeValue("SENDPROCESS", sendProcess); + if ("1".equals(sendProcess)) { + flag = true; + ldclBo.setAttributeValue("SIGN_TYPE", "SIGNING"); + }else if("2".equals(sendProcess)){ + ldclBo.setAttributeValue("MESSAGE",getMessage ); + } + contBom.saveObject(ldclBo); + + String contractDocId = ldclBo.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); + } + } + // 判断不同的异常反馈给前端 + if (getMessage.indexOf("用户认证信息与合同签署方信息不匹配") != -1) { + getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3); + return flag + "@" + getMessage; + } else if (getMessage.indexOf("contractId不能为空") != -1) { + return flag + "@" + getMessage; + } else { + return flag + "@" + "error"; + } + } + } catch (Exception e) { + tx.rollback(); + e.printStackTrace(); + logger.info("法人客户生成合同盖章失败" + e.getMessage()); + return "flase@error"; + } + } //获取电子签约人员列表 public StringBuffer manyPeople() throws JBOException{ @@ -905,6 +1016,7 @@ public class ContractSignAction{ keys.setAttributeValue("SIGN_TYPE", signStatus); // 客户签署完成,合同制作过程为4 if ("REQUIRED".equals(signStatus)) { + this.sign(tx); keys.setAttributeValue("PROCESS", "4"); } contBom.saveObject(keys); @@ -1772,6 +1884,12 @@ public String claimSign(JBOTransaction tx) throws Exception { } } + /** + * 打印租金通知书并发短信给客户 + * @param tx + * @return + * @throws Exception + */ public String claimSignA(JBOTransaction tx) throws Exception { requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl()); String libraryid=""; diff --git a/src_sys/com/tenwa/flow/action/comm/FlowBussionAction.java b/src_sys/com/tenwa/flow/action/comm/FlowBussionAction.java index 2dd426d48..25da4111d 100644 --- a/src_sys/com/tenwa/flow/action/comm/FlowBussionAction.java +++ b/src_sys/com/tenwa/flow/action/comm/FlowBussionAction.java @@ -38,6 +38,7 @@ public class FlowBussionAction extends CommonAction { public String customertype; public String custname; public String leasform; + public String carAttributes; public List FlowMutexConfig; public Map FlowParam = new HashMap(); @@ -236,5 +237,11 @@ public class FlowBussionAction extends CommonAction { public void setLeasform(String leasform) { this.leasform = leasform; } + public String getCarAttributes() { + return carAttributes; + } + public void setCarAttributes(String carAttributes) { + this.carAttributes = carAttributes; + } } diff --git a/src_tenwa/com/tenwa/lease/flow/contract/contractapproval/ContractApprovalStartAction.java b/src_tenwa/com/tenwa/lease/flow/contract/contractapproval/ContractApprovalStartAction.java index 3faa6c88f..9c0553edf 100644 --- a/src_tenwa/com/tenwa/lease/flow/contract/contractapproval/ContractApprovalStartAction.java +++ b/src_tenwa/com/tenwa/lease/flow/contract/contractapproval/ContractApprovalStartAction.java @@ -67,5 +67,6 @@ public class ContractApprovalStartAction extends BaseFlowStartAction{ this.FlowParam.put("customertype", customertype); this.FlowParam.put("IsMakeContract", "yes"); this.FlowParam.put("leasform", leasform); + this.FlowParam.put("carAttributes", carAttributes); } }