2617 lines
108 KiB
Java
2617 lines
108 KiB
Java
package com.tenwa.channelportal.action;
|
||
|
||
import java.io.File;
|
||
import java.io.FileOutputStream;
|
||
import java.io.InputStream;
|
||
import java.io.OutputStream;
|
||
import java.net.MalformedURLException;
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.ArrayList;
|
||
import java.util.Date;
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
import org.apache.log4j.Logger;
|
||
|
||
import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP;
|
||
import jbo.app.tenwa.customer.CUSTOMER_PERSON;
|
||
import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP;
|
||
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.app.tenwa.doc.LB_ONEDIMENSIONALCODE;
|
||
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
|
||
import jbo.com.tenwa.lease.carbrand.BUSINESS_STATUS;
|
||
import jbo.com.tenwa.lease.carbrand.LB_CONTRACT_SIGN_LOG;
|
||
import jbo.com.tenwa.lease.comm.LB_CONTRACT_TEMPLATE;
|
||
import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP;
|
||
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO;
|
||
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP;
|
||
import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE;
|
||
import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP;
|
||
import jbo.sys.CODE_LIBRARY;
|
||
|
||
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.amarsoft.are.util.StringFunction;
|
||
import com.amarsoft.awe.Configure;
|
||
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.caucho.hessian.client.HessianProxyFactory;
|
||
import com.tenwa.app.dao.ContractSignInfo;
|
||
import com.tenwa.lease.app.service.HttpRequestAppService;
|
||
import com.tenwa.lease.flow.contract.contractapproval.ContractTemplateCache;
|
||
import com.tenwa.makeContract.util.MakeOneCodeAndContractModel;
|
||
import com.tenwa.channelportal.action.generativecontract.Word2PdfUtil;
|
||
import com.tenwa.channelportal.action.generativecontract.WordToPDFUtil;
|
||
import com.tenwa.comm.util.date.DateAssistant;
|
||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||
import com.tenwa.doc.util.BASE64;
|
||
import com.tenwa.officetempalte.util.FileOperatorUtil;
|
||
import com.tenwa.quartz.DateUtil;
|
||
import com.tenwa.reckon.util.UUIDUtil;
|
||
|
||
public class ContractSignAction{
|
||
public String file_id;
|
||
public String cust_phone;
|
||
public String cust_id;
|
||
public String library_id;
|
||
public String customerType;
|
||
public String CurUserID;
|
||
public String ProjectId;
|
||
public String contract_id;
|
||
public String FlowUnid;
|
||
public String InputOrgid;
|
||
public String id;
|
||
private String attrId;
|
||
public String flagType;
|
||
public HessianProxyFactory factory = new HessianProxyFactory();
|
||
public HttpRequestAppService requestService;
|
||
public String PAYMENT_NUMBER;
|
||
public String PLAN_LIST;
|
||
public String Ttype;
|
||
public String contractNo;
|
||
public String leasform;
|
||
private static Logger logger=Logger.getLogger(ContractSignAction.class);
|
||
@SuppressWarnings("deprecation")
|
||
public static String getConfigRequestUrl() throws Exception{
|
||
return Configure.getInstance().getConfigure("RequestHessionUrl");
|
||
}
|
||
@SuppressWarnings("deprecation")
|
||
public static String getFileSavePath() throws Exception{
|
||
return Configure.getInstance().getConfigure("FileSavePath");
|
||
}
|
||
|
||
public String getCurUserID() {
|
||
return CurUserID;
|
||
}
|
||
|
||
public String getContract_id() {
|
||
return contract_id;
|
||
}
|
||
|
||
public void setContract_id(String contract_id) {
|
||
this.contract_id = contract_id;
|
||
}
|
||
|
||
public void setCurUserID(String curUserID) {
|
||
CurUserID = curUserID;
|
||
}
|
||
|
||
public String getCustomerType() {
|
||
return customerType;
|
||
}
|
||
|
||
public void setCustomerType(String customerType) {
|
||
this.customerType = customerType;
|
||
}
|
||
|
||
public String getFile_id() {
|
||
return file_id;
|
||
}
|
||
|
||
public void setFile_id(String file_id) {
|
||
this.file_id = file_id;
|
||
}
|
||
|
||
|
||
public String getCust_id() {
|
||
return cust_id;
|
||
}
|
||
|
||
public void setCust_id(String cust_id) {
|
||
this.cust_id = cust_id;
|
||
}
|
||
|
||
public String getCust_phone() {
|
||
return cust_phone;
|
||
}
|
||
public void setCust_phone(String cust_phone) {
|
||
this.cust_phone = cust_phone;
|
||
}
|
||
|
||
public String getLibrary_id() {
|
||
return library_id;
|
||
}
|
||
public void setLibrary_id(String library_id) {
|
||
this.library_id = library_id;
|
||
}
|
||
|
||
public String getProjectId() {
|
||
return ProjectId;
|
||
}
|
||
|
||
public void setProjectId(String projectId) {
|
||
ProjectId = projectId;
|
||
}
|
||
|
||
public String getFlowUnid() {
|
||
return FlowUnid;
|
||
}
|
||
|
||
public void setFlowUnid(String flowUnid) {
|
||
FlowUnid = flowUnid;
|
||
}
|
||
|
||
public String getInputOrgid() {
|
||
return InputOrgid;
|
||
}
|
||
|
||
public void setInputOrgid(String inputOrgid) {
|
||
InputOrgid = inputOrgid;
|
||
}
|
||
|
||
public String getId() {
|
||
return id;
|
||
}
|
||
|
||
public void setId(String id) {
|
||
this.id = id;
|
||
}
|
||
//<2F><><EFBFBD><EFBFBD>
|
||
public String getFlagType() {
|
||
return flagType;
|
||
}
|
||
|
||
public void setFlagType(String flagType) {
|
||
this.flagType = flagType;
|
||
}
|
||
public String getAttrId() {
|
||
return attrId;
|
||
}
|
||
public void setAttrId(String attrId) {
|
||
this.attrId = attrId;
|
||
}
|
||
|
||
|
||
public String getPAYMENT_NUMBER() {
|
||
return PAYMENT_NUMBER;
|
||
}
|
||
public void setPAYMENT_NUMBER(String pAYMENT_NUMBER) {
|
||
PAYMENT_NUMBER = pAYMENT_NUMBER;
|
||
}
|
||
public String getPLAN_LIST() {
|
||
return PLAN_LIST;
|
||
}
|
||
public void setPLAN_LIST(String pLAN_LIST) {
|
||
PLAN_LIST = pLAN_LIST;
|
||
}
|
||
public String getTtype() {
|
||
return Ttype;
|
||
}
|
||
public void setTtype(String ttype) {
|
||
Ttype = ttype;
|
||
}
|
||
public String getContractNo() {
|
||
return contractNo;
|
||
}
|
||
public void setContractNo(String contractNo) {
|
||
this.contractNo = contractNo;
|
||
}
|
||
public String getLeasform() {
|
||
return leasform;
|
||
}
|
||
public void setLeasform(String leasform) {
|
||
this.leasform = leasform;
|
||
}
|
||
/**
|
||
* <20><>Ȼ<EFBFBD>˵<EFBFBD><CBB5><EFBFBD>ǩԼ
|
||
*
|
||
* @author tenwa518
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
public String signIng(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
//BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx);
|
||
BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx);
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
BizObjectManager lcslBom = JBOFactory.getBizObjectManager(LB_CONTRACT_SIGN_LOG.CLASS_NAME,tx);
|
||
Map<String, List<ContractSignInfo>> map = new HashMap<String, List<ContractSignInfo>>();
|
||
ContractSignInfo con = null;
|
||
List<BizObject> bo = null;
|
||
BizObject ldclBo = null;
|
||
try {
|
||
//BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true);
|
||
BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true);
|
||
// <20><>ѯlb_doc_contract_list<73><74>
|
||
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("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString();
|
||
StringBuffer manyPeople = this.manyPeople();
|
||
if(manyPeople.length()>0){
|
||
info=info+"@applicant,"+manyPeople.deleteCharAt(manyPeople.length() - 1);
|
||
}
|
||
List<ContractSignInfo> list = map.get(info);
|
||
if (list == null) {
|
||
list = new ArrayList<ContractSignInfo>();
|
||
map.put(info, list);
|
||
}
|
||
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());
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||
String makefullPath = keys.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
list.add(con);
|
||
}
|
||
Map<String,String> fromCondtion = new HashMap<String, String>();
|
||
Map<String,String> otherProperty = new HashMap<String, String>();
|
||
Map<String, String> resultMap = requestService.createContractSign(map);
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
// <20>洢<EFBFBD><E6B4A2>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>صĺ<D8B5>ͬid<69>ͺ<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>id
|
||
if (key.indexOf("contract_") == -1) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
// <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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", "SIGNING");
|
||
ldclBo.setAttributeValue("SENDPROCESS", sendProcess);
|
||
contBom.saveObject(ldclBo);
|
||
|
||
String contractDocId = ldclBo.getAttribute("id").toString();
|
||
fromCondtion.put("id", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "0");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID", contractDocId);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
}
|
||
}
|
||
pbo.setAttributeValue("DATA_STATE", "8");// ״̬<D7B4>ijɵ<C4B3><C9B5><EFBFBD>ǩԼ<C7A9><D4BC>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>
|
||
pbm.saveObject(pbo);
|
||
//<2F><>¼<EFBFBD><C2BC>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||
/*Transaction tran = Transaction.createTransaction(tx);
|
||
ASUser user = ASUser.getUser(CurUserID, tran);
|
||
JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx)
|
||
.createQuery("UPDATE O SET BUSINESS_STATUS='8',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+ProjectId+"')").executeUpdate();
|
||
SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'8','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "<22><>")+"' FROM LB_PROJECT_INFO WHERE ID='"+ProjectId+"'");
|
||
so.setDebugSql(so.getDebugSql().replaceAll("<22><>", ":"));
|
||
so.setOriginalSql(so.getOriginalSql().replaceAll("<22><>", ":"));
|
||
so.setRunSql(so.getRunSql().replaceAll("<22><>", ":"));
|
||
tran.executeSQL(so);*/
|
||
return "success";
|
||
} else {
|
||
Boolean flag = false;
|
||
String getMessage = resultMap.get("error");
|
||
logger.info("<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>Ϣ" + getMessage);
|
||
for (String key : resultMap.keySet()) {
|
||
// <20>洢<EFBFBD><E6B4A2>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>صĺ<D8B5>ͬid<69>ͺ<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>id
|
||
if (key.indexOf("contract_") == -1 && !"error".equals(key)) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
// <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID",contractDocId);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
}
|
||
}
|
||
// <20>жϲ<D0B6>ͬ<EFBFBD><CDAC><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>
|
||
if (getMessage.indexOf("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>") != -1) {
|
||
getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3);
|
||
return flag + "@" + getMessage;
|
||
} else if (getMessage.indexOf("contractId<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>") != -1) {
|
||
return flag + "@" + getMessage;
|
||
} else {
|
||
return flag + "@" + "error";
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
tx.rollback();
|
||
e.printStackTrace();
|
||
logger.info("<EFBFBD><EFBFBD>Ȼ<EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>ǩԼ<EFBFBD>쳣:" + e.getMessage());
|
||
return "flase@error";
|
||
}
|
||
}
|
||
/**
|
||
* <20><><EFBFBD>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD>ͬ<EFBFBD><CDAC>ֱ<EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD>
|
||
* @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 pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx);
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
Map<String, ContractSignInfo> map = new HashMap<String, ContractSignInfo>();
|
||
ContractSignInfo con = null;
|
||
List<BizObject> bo = null;
|
||
BizObject ldclBo = null;
|
||
try {
|
||
//BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true);
|
||
BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true);
|
||
// <20><>ѯlb_doc_contract_list<73><74>
|
||
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());
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||
String makefullPath = keys.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
map.put(info, con);
|
||
}
|
||
Map<String,String> fromCondtion = new HashMap<String, String>();
|
||
Map<String,String> otherProperty = new HashMap<String, String>();
|
||
Map<String, String> resultMap = requestService.compnySign(map);
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
// <20>洢<EFBFBD><E6B4A2>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>صĺ<D8B5>ͬid<69>ͺ<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>id
|
||
if (key.indexOf("contract_") == -1) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
// <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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");//<2F><><EFBFBD>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>״̬
|
||
ldclBo.setAttributeValue("SENDPROCESS", sendProcess);
|
||
contBom.saveObject(ldclBo);
|
||
|
||
String contractDocId = ldclBo.getAttribute("id").toString();
|
||
fromCondtion.put("id", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "0");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID", contractDocId);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
}
|
||
}
|
||
pbo.setAttributeValue("DATA_STATE", "8");// ״̬<D7B4>ijɵ<C4B3><C9B5><EFBFBD>ǩԼ<C7A9><D4BC>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>
|
||
pbm.saveObject(pbo);
|
||
downloadDoc(tx);
|
||
return "success";
|
||
} else {
|
||
Boolean flag = false;
|
||
String getMessage = resultMap.get("error");
|
||
logger.info("<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>Ϣ" + getMessage);
|
||
for (String key : resultMap.keySet()) {
|
||
// <20>洢<EFBFBD><E6B4A2>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>صĺ<D8B5>ͬid<69>ͺ<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>id
|
||
if (key.indexOf("contract_") == -1 && !"error".equals(key)) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
// <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID",contractDocId);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
}
|
||
}
|
||
// <20>жϲ<D0B6>ͬ<EFBFBD><CDAC><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>
|
||
if (getMessage.indexOf("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>") != -1) {
|
||
getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3);
|
||
return flag + "@" + getMessage;
|
||
} else if (getMessage.indexOf("contractId<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>") != -1) {
|
||
return flag + "@" + getMessage;
|
||
} else {
|
||
return flag + "@" + "error";
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
tx.rollback();
|
||
e.printStackTrace();
|
||
logger.info("<EFBFBD><EFBFBD><EFBFBD>˿ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>" + e.getMessage());
|
||
return "flase@error";
|
||
}
|
||
}
|
||
|
||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ǩԼ<C7A9><D4BC>Ա<EFBFBD>б<EFBFBD>
|
||
public StringBuffer manyPeople() throws JBOException{
|
||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||
StringBuffer info = new StringBuffer();
|
||
BizObjectManager cptm = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME);
|
||
List<BizObject> cpts = cptm.createQuery("select * from O where flowunid=:flowUnid").setParameter("flowUnid", FlowUnid).getResultList(false);
|
||
for(BizObject cpt:cpts){
|
||
String name = cpt.getAttribute("FULLNAME").toString();
|
||
String mobile = cpt.getAttribute("mobile").toString();
|
||
if(name.length()>0 && mobile.length()>0){
|
||
info.append(name+"@"+mobile+"@guarantee,");
|
||
}
|
||
}
|
||
//<2F><>ȡ<EFBFBD><C8A1>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Ϣ
|
||
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){
|
||
info.append(name+"@"+mobile+"@comm,");
|
||
}
|
||
}
|
||
|
||
return info;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ί<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
* @author tenwa518
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
public String companySignIng(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<String, List<ContractSignInfo>> map = new HashMap<String, List<ContractSignInfo>>();
|
||
ContractSignInfo con = null;
|
||
List<BizObject> bo = null;
|
||
BizObject ldclBo = null;
|
||
try {
|
||
BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true);
|
||
// <20><>ѯlb_doc_contract_list<73><74>
|
||
bo = contBom.createQuery("project_id=:projectId and file_flag='yes' and (sendprocess='0' or sendprocess='2' ) and doc_name='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'").setParameter("projectId", ProjectId).getResultList(true);
|
||
for (BizObject keys : bo) {
|
||
String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString();
|
||
List<ContractSignInfo> list = map.get(info);
|
||
if (list == null) {
|
||
list = new ArrayList<ContractSignInfo>();
|
||
map.put(info, list);
|
||
}
|
||
con = new ContractSignInfo();
|
||
con.setCustname(keys.getAttribute("CUSTOMERNAME").toString());
|
||
con.setCustphone(keys.getAttribute("TELEPHONE").toString());
|
||
con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString());
|
||
con.setFilename(keys.getAttribute("FILENAME").toString());
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||
String makefullPath = keys.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
list.add(con);
|
||
}
|
||
|
||
Map<String,String> fromCondtion=new HashMap<String, String>();
|
||
Map<String, String>otherProperty=new HashMap<String, String>();
|
||
Map<String, String> resultMap = requestService.createComContractSign(map);
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
// <20>洢<EFBFBD><E6B4A2>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>صĺ<D8B5>ͬid<69>ͺ<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>id
|
||
if (key.indexOf("contract_") == -1) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
//<2F><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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", "SIGNING");
|
||
ldclBo.setAttributeValue("SENDPROCESS",sendProcess);
|
||
contBom.saveObject(ldclBo);
|
||
|
||
String contractDocId =ldclBo .getAttribute("id").toString();
|
||
fromCondtion.put("id", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "0");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID", contractDocId);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion,LB_CONTRACT_SIGN_LOG.CLASS_NAME,
|
||
null,otherProperty,tx);
|
||
}
|
||
}
|
||
pbo.setAttributeValue("project_status","8");//״̬<D7B4>ijɵ<C4B3><C9B5><EFBFBD>ǩԼ<C7A9><D4BC>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>
|
||
pbm.saveObject(pbo);
|
||
//<2F><>¼<EFBFBD><C2BC>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||
Transaction tran = Transaction.createTransaction(tx);
|
||
ASUser user = ASUser.getUser(CurUserID, tran);
|
||
JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME,tx)
|
||
.createQuery("UPDATE O SET BUSINESS_STATUS='8',UPDATEUSERID='"+user.getUserID()+"',UPDATEORGID='"+user.getOrgID()+"',UPDATETIME='"+StringFunction.getTodayNow()+"' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM "+LB_PROJECT_INFO.CLASS_NAME+" LPI WHERE LPI.ID='"+ProjectId+"')").executeUpdate();
|
||
SqlObject so = new SqlObject("INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'8','"+user.getUserID()+"','"+user.getOrgID()+"','"+StringFunction.getTodayNow().replaceAll(":", "<EFBFBD><EFBFBD>")+"' FROM LB_PROJECT_INFO WHERE ID='"+ProjectId+"'");
|
||
so.setDebugSql(so.getDebugSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
so.setOriginalSql(so.getOriginalSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
so.setRunSql(so.getRunSql().replaceAll("<EFBFBD><EFBFBD>", ":"));
|
||
tran.executeSQL(so);
|
||
return "success";
|
||
} else {
|
||
Boolean falg=false;
|
||
String getMessage = resultMap.get("error");
|
||
logger.info("<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>Ϣ" + getMessage);
|
||
for (String key : resultMap.keySet()) {
|
||
// <20>洢<EFBFBD><E6B4A2>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>صĺ<D8B5>ͬid<69>ͺ<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>id
|
||
if (key.indexOf("contract_") == -1 && !"error".equals(key)) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
// <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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)) {
|
||
falg=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");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID",contractDocId);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
}
|
||
}
|
||
// <20>жϲ<D0B6>ͬ<EFBFBD><CDAC><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>
|
||
if (getMessage.indexOf("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>") != -1) {
|
||
getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3);
|
||
return getMessage;
|
||
} else if (getMessage.indexOf("contractId<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>") != -1) {
|
||
return getMessage;
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
tx.rollback();
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
|
||
}
|
||
|
||
/**
|
||
* (<28>ۿ<DBBF><EEBFA8><EFBFBD><EFBFBD>)<29><>Ȼ<EFBFBD><C8BB>ί<EFBFBD>пۿ<D0BF><DBBF><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* @author tenwa518
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public String PersonDeductSignIng(JBOTransaction tx) throws Exception{
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
Map<String, List<ContractSignInfo>> map = new HashMap<String, List<ContractSignInfo>>();
|
||
ContractSignInfo con = null;
|
||
List<BizObject> bo = null;
|
||
BizObject ldclBo = null;
|
||
try {
|
||
// <20><>ѯlb_doc_contract_list<73><74>
|
||
bo = contBom.createQuery("flow_unid=:flow_unid and (sendprocess='0' or sendprocess='2' ) and file_flag='yes'").setParameter("flow_unid", FlowUnid).getResultList(true);
|
||
|
||
for (BizObject keys : bo) {
|
||
String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString();
|
||
List<ContractSignInfo> list = map.get(info);
|
||
if (list == null) {
|
||
list = new ArrayList<ContractSignInfo>();
|
||
map.put(info, list);
|
||
}
|
||
con = new ContractSignInfo();
|
||
con.setCustname(keys.getAttribute("CUSTOMERNAME").toString());
|
||
con.setCustphone(keys.getAttribute("TELEPHONE").toString());
|
||
con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString());
|
||
con.setFilename(keys.getAttribute("FILENAME").toString());
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||
String makefullPath = keys.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
list.add(con);
|
||
}
|
||
|
||
|
||
Map<String, String> fromCondtion=new HashMap<String, String>();
|
||
Map<String, String>otherProperty=new HashMap<String, String>();
|
||
Map<String, String> resultMap = null;
|
||
if ("01".equals(customerType)) {
|
||
resultMap = requestService.createComContractSign(map);
|
||
} else {
|
||
resultMap = requestService.createEntrustmentSign(map);
|
||
}
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
if (key.indexOf("contract_") == -1) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
//<2F><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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", "SIGNING");
|
||
ldclBo.setAttributeValue("SENDPROCESS",sendProcess);
|
||
contBom.saveObject(ldclBo);
|
||
|
||
String contractDocId = ldclBo.getAttribute("id").toString();
|
||
fromCondtion.put("id", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "0");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID", contractDocId);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
}
|
||
}
|
||
|
||
return "success";
|
||
|
||
} else {
|
||
Boolean flag = false;
|
||
String getMessage = resultMap.get("error");
|
||
logger.info("<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>Ϣ" + getMessage);
|
||
for (String key : resultMap.keySet()) {
|
||
// <20>洢<EFBFBD><E6B4A2>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>صĺ<D8B5>ͬid<69>ͺ<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>id
|
||
if (key.indexOf("contract_") == -1 && !"error".equals(key)) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
// <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID",contractDocId);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME",DateAssistant.getTodayNow());
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
}
|
||
}
|
||
// <20>жϲ<D0B6>ͬ<EFBFBD><CDAC><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>
|
||
if (getMessage.indexOf("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>") != -1) {
|
||
getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3);
|
||
return getMessage;
|
||
} else if (getMessage.indexOf("contractId<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>") != -1) {
|
||
return getMessage;
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
tx.rollback();
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>ǩԼ
|
||
*
|
||
* @author
|
||
* @param
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public String AdjustFordSignIng(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
Map<String, List<ContractSignInfo>> map = new HashMap<String, List<ContractSignInfo>>();
|
||
ContractSignInfo con = null;
|
||
List<BizObject> bo = null;
|
||
BizObject ldclBo = null;
|
||
try {
|
||
// <20><>ѯlb_doc_contract_list<73><74>
|
||
bo = contBom.createQuery("flow_unid=:flow_unid and file_flag='yes'").setParameter("flow_unid", FlowUnid).getResultList(true);
|
||
for (BizObject keys : bo) {
|
||
String info = keys.getAttribute("CUSTOMERNAME").toString() + "@" + keys.getAttribute("TELEPHONE").toString();
|
||
List<ContractSignInfo> list = map.get(info);
|
||
if (list == null) {
|
||
list = new ArrayList<ContractSignInfo>();
|
||
map.put(info, list);
|
||
}
|
||
con = new ContractSignInfo();
|
||
con.setCustname(keys.getAttribute("CUSTOMERNAME").toString());
|
||
con.setCustphone(keys.getAttribute("TELEPHONE").toString());
|
||
con.setFileid(keys.getAttribute("ATTRIBUTE_ID").toString());
|
||
con.setFilename(keys.getAttribute("FILENAME").toString());
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||
String makefullPath = keys.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
list.add(con);
|
||
}
|
||
Map<String, String> fromCondtion = new HashMap<String, String>();
|
||
Map<String, String> otherProperty = new HashMap<String, String>();
|
||
Map<String, String> resultMap = null;
|
||
resultMap = requestService.createAdjustFordContractDSign(map);
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
if (key.indexOf("contract_") == -1) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
// <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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", "SIGNING");
|
||
ldclBo.setAttributeValue("SENDPROCESS", sendProcess);
|
||
// ldclBo.setAttributeValue("PROCESS", "4");
|
||
contBom.saveObject(ldclBo);
|
||
|
||
String contractDocId = ldclBo.getAttribute("id").toString();
|
||
fromCondtion.put("id", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "0");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("CONTRACTDOCID", contractDocId);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
otherProperty.put("INPUTTIME", DateAssistant.getTodayNow());
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
}
|
||
}
|
||
return "success";
|
||
} else {
|
||
Boolean flag = false;
|
||
String getMessage = resultMap.get("error");
|
||
logger.info("<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>Ϣ" + getMessage);
|
||
for (String key : resultMap.keySet()) {
|
||
// <20>洢<EFBFBD><E6B4A2>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>صĺ<D8B5>ͬid<69>ͺ<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>id
|
||
if (key.indexOf("contract_") == -1 && !"error".equals(key)) {
|
||
fromCondtion.clear();
|
||
otherProperty.clear();
|
||
// <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
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");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
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);
|
||
}
|
||
}
|
||
// <20>жϲ<D0B6>ͬ<EFBFBD><CDAC><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>
|
||
if (getMessage.indexOf("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>") != -1) {
|
||
getMessage = getMessage.substring((getMessage.indexOf("message")) + 10, (getMessage.indexOf("code")) - 3);
|
||
return getMessage;
|
||
} else if (getMessage.indexOf("contractId<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>") != -1) {
|
||
return getMessage;
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
tx.rollback();
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
|
||
}
|
||
/**
|
||
* <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯǩԼ״̬
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public String getAdjustFordSignStatus(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx);
|
||
List<BizObject> ldclBoList = ldclBom.createQuery("flow_unid='" + FlowUnid + "' and file_flag='yes' and "
|
||
+ "sendprocess='1'").getResultList(true);
|
||
String signContractId = "";
|
||
String customerName = "";
|
||
String contractDocId = "";
|
||
StringBuffer result = new StringBuffer();
|
||
Map<String, String> fromCondtion = new HashMap<String, String>();
|
||
Map<String, String> otherProperty = new HashMap<String, String>();
|
||
for (BizObject key : ldclBoList) {
|
||
signContractId = key.getAttribute("singcontract_id").toString();
|
||
customerName = key.getAttribute("customername").toString();
|
||
contractDocId = key.getAttribute("id").toString();
|
||
try {
|
||
String signType = requestService.getContractSignStatus(signContractId);
|
||
String signstatus = clBom.createQuery("itemno='" + signType + "'").getSingleResult(false).getAttribute("itemname").toString();
|
||
key.setAttributeValue("sign_type", signType);
|
||
if("COMPLETE".equals(signType)){
|
||
key.setAttributeValue("PROCESS", "5.1");
|
||
}
|
||
ldclBom.saveObject(key);
|
||
result.append("," + customerName + "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ״̬:" + signstatus);
|
||
//<2F><>־<EFBFBD><D6BE>¼
|
||
|
||
fromCondtion.put("ID", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "1");// <20><>ѯ״̬
|
||
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);
|
||
} catch (Exception e) {
|
||
fromCondtion.put("ID", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "1");// <20><>ѯ״̬
|
||
otherProperty.put("CONTRACTDOCID", contractDocId);
|
||
otherProperty.put("MESSAGE", e.getMessage());
|
||
otherProperty.put("INPUTTIME", DateAssistant.getTodayNow());
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
return "error"+"@"+e.getMessage();
|
||
}
|
||
|
||
}
|
||
return result.toString().substring(1);
|
||
}
|
||
|
||
/**
|
||
* (<28>ۿ<DBBF><EEBFA8><EFBFBD><EFBFBD>)<29><>Ȼ<EFBFBD><C8BB>ί<EFBFBD>пۿ<D0BF><DBBF><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ǩԼ״̬ ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @throws Exception
|
||
*/
|
||
public String contractSignStatusForContract(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx);
|
||
List<BizObject> ldclBoList = ldclBom.createQuery("flow_unid='" + FlowUnid + "' and file_flag='yes' and "
|
||
+ "sendprocess='1'").getResultList(true);
|
||
String signContractId = "";
|
||
String customerName = "";
|
||
String contractDocId = "";
|
||
StringBuffer result = new StringBuffer();
|
||
Map<String, String> fromCondtion = new HashMap<String, String>();
|
||
Map<String, String> otherProperty = new HashMap<String, String>();
|
||
for (BizObject key : ldclBoList) {
|
||
signContractId = key.getAttribute("singcontract_id").toString();
|
||
customerName = key.getAttribute("customername").toString();
|
||
contractDocId = key.getAttribute("id").toString();
|
||
try {
|
||
String signType = requestService.getContractSignStatus(signContractId);
|
||
String signstatus = clBom.createQuery("itemno='" + signType + "'").getSingleResult(false).getAttribute("itemname").toString();
|
||
key.setAttributeValue("sign_type", signType);
|
||
if("COMPLETE".equals(signType)){
|
||
key.setAttributeValue("PROCESS", "5.1");
|
||
}
|
||
ldclBom.saveObject(key);
|
||
result.append("," + customerName + "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ״̬:" + signstatus);
|
||
//<2F><>־<EFBFBD><D6BE>¼
|
||
|
||
fromCondtion.put("ID", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "1");// <20><>ѯ״̬
|
||
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);
|
||
} catch (Exception e) {
|
||
fromCondtion.put("ID", contractDocId);
|
||
otherProperty.put("SIGNPROCESS", "1");// <20><>ѯ״̬
|
||
otherProperty.put("CONTRACTDOCID", contractDocId);
|
||
otherProperty.put("MESSAGE", e.getMessage());
|
||
otherProperty.put("INPUTTIME", DateAssistant.getTodayNow());
|
||
DataOperatorUtil.copySingleJBO(LB_DOC_CONTRACT_LIST.CLASS_NAME, fromCondtion, LB_CONTRACT_SIGN_LOG.CLASS_NAME, null,
|
||
otherProperty, tx);
|
||
return "error"+"@"+e.getMessage();
|
||
}
|
||
|
||
}
|
||
return result.toString().substring(1);
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ǩԼ״̬
|
||
*
|
||
* @throws Exception
|
||
*/
|
||
public String contractSignStatus(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
//BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx);
|
||
BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx);
|
||
BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx);
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
BizObjectManager ldBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
//BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true);
|
||
BizObject pbo = pbm.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(true);
|
||
String status = "";
|
||
String peopleStatus="";
|
||
String sql = "";
|
||
if ("01".equals(customerType)) {
|
||
sql = "project_id=:projectId and file_flag='yes' and doc_name='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' and sendprocess='1'";
|
||
} else {
|
||
sql = "project_id=:projectId and file_flag='yes' and sendprocess='1'";
|
||
}
|
||
@SuppressWarnings("unchecked")
|
||
List<BizObject> bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true);
|
||
if (bo != null) {
|
||
boolean flag = true;
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
for (BizObject keys : bo) {
|
||
map.put(keys.getAttribute("singcontract_id").toString(), keys.getAttribute("customername").toString());
|
||
}
|
||
for (String key : map.keySet()) {
|
||
try {
|
||
String signStatu = requestService.getContractSignStatus(key);
|
||
int index = signStatu.indexOf("$");
|
||
String signStatus = signStatu.substring(0, index);
|
||
peopleStatus = signStatu.substring(index+1);
|
||
String signStatusName =
|
||
clBom.createQuery("itemno='" + signStatus + "'").getSingleResult(false).getAttribute("itemname").toString();
|
||
List<BizObject> ldclList =
|
||
contBom.createQuery("project_id=:projectId and file_flag='yes' and singcontract_id='" + key + "'")
|
||
.setParameter("projectId", ProjectId).getResultList(true);
|
||
for (BizObject keys : ldclList) {
|
||
keys.setAttributeValue("SIGN_TYPE", signStatus);
|
||
// <20>ͻ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ4
|
||
if ("REQUIRED".equals(signStatus)) {
|
||
this.sign(tx);
|
||
downloadDoc(tx);
|
||
keys.setAttributeValue("PROCESS", "4");
|
||
}
|
||
contBom.saveObject(keys);
|
||
}
|
||
if (!"REQUIRED".equals(signStatus) && !"COMPLETE".equals(signStatus) ) {
|
||
flag = false;
|
||
}
|
||
if ("REQUIRED".equals(signStatus)) {
|
||
status += ";<br><3E>ͻ<EFBFBD>" + map.get(key) + "ǩԼ״̬:<3A><>ǩ<EFBFBD><C7A9>";
|
||
} else {
|
||
status += ";<br><3E>ͻ<EFBFBD>" + map.get(key) + "ǩԼ״̬:" + signStatusName;
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "<EFBFBD><EFBFBD>ȡǩԼ״̬ʧ<EFBFBD><EFBFBD>!";
|
||
}
|
||
}
|
||
// <20><>ͬǩԼ<C7A9><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if (flag) {
|
||
pbo.setAttributeValue("DATA_STATE", "4");// ״̬<D7B4>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>ǩԼ
|
||
pbm.saveObject(pbo);
|
||
// <20><>¼<EFBFBD><C2BC>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||
/* Transaction tran = Transaction.createTransaction(tx);
|
||
ASUser user = ASUser.getUser(CurUserID, tran);
|
||
JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME, tx)
|
||
.createQuery("UPDATE O SET BUSINESS_STATUS='4',UPDATEUSERID='" + user.getUserID() + "',UPDATEORGID='"
|
||
+ user.getOrgID() + "',UPDATETIME='" + StringFunction.getTodayNow()
|
||
+ "' WHERE CONTRACT_NUMBER=(SELECT LPI.CONTRACT_NUMBER FROM " + LB_PROJECT_INFO.CLASS_NAME
|
||
+ " LPI WHERE LPI.ID='" + ProjectId + "')")
|
||
.executeUpdate();
|
||
SqlObject so = new SqlObject(
|
||
"INSERT INTO BUSINESS_DETAIL(ID,CONTRACT_NUMBER,BUSINESS_STATUS,INPUTUSERID,INPUTORGID,INPUTTIME) SELECT SYS_GUID(),CONTRACT_NUMBER,'4','"
|
||
+ user.getUserID() + "','" + user.getOrgID() + "','" + StringFunction.getTodayNow().replaceAll(":", "<22><>")
|
||
+ "' FROM LB_PROJECT_INFO WHERE ID='" + ProjectId + "'");
|
||
so.setDebugSql(so.getDebugSql().replaceAll("<22><>", ":"));
|
||
so.setOriginalSql(so.getOriginalSql().replaceAll("<22><>", ":"));
|
||
so.setRunSql(so.getRunSql().replaceAll("<22><>", ":"));
|
||
tran.executeSQL(so);*/
|
||
for (BizObject keys : bo) {
|
||
/* ldBom.createQuery("update O set status='' where id='" + keys.getAttribute("attribute_id").toString() + "'")
|
||
.executeUpdate();*/
|
||
}
|
||
status = ";<br><3E>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>ǩԼ";
|
||
}
|
||
}
|
||
if (status.length() < 1) {
|
||
return "<EFBFBD><EFBFBD>ȡǩԼ״̬ʧ<EFBFBD><EFBFBD>,û<>к<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>";
|
||
} else {
|
||
status = status.substring(5);
|
||
String[] peopleStat = peopleStatus.split(",");
|
||
if(peopleStat.length>1){
|
||
status = status+"<br>";
|
||
for(int i=0;i<peopleStat.length;i++){
|
||
String[] stat = peopleStat[i].split("@");
|
||
status = status+stat[0]+":"+stat[1]+";";
|
||
}
|
||
}
|
||
return status;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD>ۿ<DBBF><EEBFA8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ״̬
|
||
*
|
||
* @throws Exception
|
||
*/
|
||
public String changeCarSignStatus(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx);
|
||
BizObjectManager ldlMange = JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME, tx);
|
||
BizObjectManager ldMange = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME, tx);
|
||
BizObjectManager lulMange = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME, tx);
|
||
BizObjectManager ldaMange = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
BizObject lul = lulMange.createQuery("CONTRACT_ID=:contractid").setParameter("contractid",contract_id).getSingleResult(false);
|
||
String status = "";
|
||
String peopleStatus="";
|
||
String sql = "OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ";
|
||
@SuppressWarnings("unchecked")
|
||
BizObject ldb = ldMange.createQuery(sql).setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true);
|
||
BizObject lda = null;
|
||
if (ldb != null) {
|
||
boolean flag = true;
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
|
||
map.put(ldb.getAttribute("TEMPLATE_ID").toString(),lul.getAttribute("CUSTOMER_NAME").toString());
|
||
|
||
for (String key : map.keySet()) {
|
||
try {
|
||
String signStatu = requestService.getContractSignStatus(key);
|
||
int index = signStatu.indexOf("$");
|
||
String signStatus = signStatu.substring(0, index);
|
||
peopleStatus = signStatu.substring(index+1);
|
||
String signStatusName =
|
||
clBom.createQuery("itemno='" + signStatus + "'").getSingleResult(false).getAttribute("itemname").toString();
|
||
BizObject ldl = ldlMange.createQuery("RELATIVE_ID=:relativeid").setParameter("relativeid", ldb.getAttribute("ID").getString()).getSingleResult(false);
|
||
lda = ldaMange.createQuery("LIBRARY_ID=:libraryid").setParameter("libraryid", ldl.getAttribute("ID").getString()).getSingleResult(true);
|
||
if (signStatu.indexOf("<EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>")>0) {
|
||
signStatus = "REQUIRED";
|
||
}else{
|
||
flag = false;
|
||
}
|
||
if ("REQUIRED".equals(signStatus)) {
|
||
status += ";<br><3E>ͻ<EFBFBD>" + map.get(key) + "ǩԼ״̬:<3A><>ǩ<EFBFBD><C7A9>";
|
||
} else {
|
||
status += ";<br><3E>ͻ<EFBFBD>" + map.get(key) + "ǩԼ״̬:" + signStatusName;
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "<EFBFBD><EFBFBD>ȡǩԼ״̬ʧ<EFBFBD><EFBFBD>!";
|
||
}
|
||
}
|
||
// <20><>ͬǩԼ<C7A9><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if (flag) {
|
||
lda.setAttributeValue("REMARK", "COMPLETE");// ״̬<D7B4>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>ǩԼ
|
||
BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
|
||
BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true);
|
||
if(ldcl != null){
|
||
ldcl.setAttributeValue("sign_type", "COMPLETE");
|
||
ldclManage.saveObject(ldcl);
|
||
}
|
||
ldaMange.saveObject(lda);
|
||
status = ";<br><3E>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>ǩԼ";
|
||
changedownloadDoc(tx);
|
||
}
|
||
}
|
||
|
||
if (status.length() < 1) {
|
||
return "<EFBFBD><EFBFBD>ȡǩԼ״̬ʧ<EFBFBD><EFBFBD>,û<>к<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD>";
|
||
} else {
|
||
status = status.substring(5);
|
||
String[] peopleStat = peopleStatus.split(",");
|
||
if(peopleStat.length>1){
|
||
status = status+"<br>";
|
||
for(int i=0;i<peopleStat.length;i++){
|
||
String[] stat = peopleStat[i].split("@");
|
||
status = status+stat[0]+":"+stat[1]+";";
|
||
}
|
||
}
|
||
return status;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ǩԼ״̬
|
||
*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* @throws Exception
|
||
*/
|
||
public String contractSignStatusList(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager pbm = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx);
|
||
BizObjectManager clBom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME, tx);
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
BizObjectManager ldBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
BizObject pbo = pbm.createQuery("id=:id").setParameter("id", ProjectId).getSingleResult(true);
|
||
String status = "";
|
||
String sql = "";
|
||
List<String> contractIds = new ArrayList<String>();
|
||
if ("01".equals(customerType)) {
|
||
sql = "project_id=:projectId and file_flag='yes' and doc_name='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' and sendprocess='1'";
|
||
} else {
|
||
sql = "project_id=:projectId and file_flag='yes' and sendprocess='1'";
|
||
}
|
||
@SuppressWarnings("unchecked")
|
||
List<BizObject> bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true);
|
||
if (bo != null) {
|
||
boolean flag = true;
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
for (BizObject keys : bo) {
|
||
map.put(keys.getAttribute("singcontract_id").toString(), keys.getAttribute("customername").toString());
|
||
contractIds.add(keys.getAttribute("singcontract_id").toString());
|
||
}
|
||
|
||
Map<String,String> resultMap = requestService.getContractSignListStatus(contractIds);
|
||
}
|
||
return "";
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>
|
||
*
|
||
* @param tx
|
||
* @return
|
||
* @throws MalformedURLException
|
||
* @throws Exception
|
||
*/
|
||
public String sign(JBOTransaction tx) throws MalformedURLException, Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
@SuppressWarnings("unchecked")
|
||
List<BizObject> bo = contBom.createQuery("project_id=:projectId and file_flag='yes'")
|
||
.setParameter("projectId", ProjectId).getResultList(true);
|
||
if (bo != null) {
|
||
Map<String, List<String>> map = new HashMap<String, List<String>>();
|
||
for (BizObject keys : bo) {
|
||
List<String> list = map.get(keys.getAttribute("singcontract_id").toString());
|
||
if (list == null) {
|
||
list = new ArrayList<String>();
|
||
}
|
||
list.add(keys.getAttribute("DOCUMENT_ID").toString()+"@"+keys.getAttribute("doc_name").toString());
|
||
map.put(keys.getAttribute("singcontract_id").toString(), list);
|
||
}
|
||
Map<String, String> resultMap = requestService.Sign(map);
|
||
String statu = resultMap.get("error");
|
||
if (statu == null) {
|
||
return "success";
|
||
}
|
||
}
|
||
|
||
return "error";
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>document_id<69><64><EFBFBD>غ<EFBFBD>ͬ
|
||
*
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
* @throws MalformedURLException
|
||
*/
|
||
public String downloadDoc(JBOTransaction tx) throws MalformedURLException, Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
String sql = "";
|
||
if ("01".equals(customerType)) {
|
||
sql = "project_id=:projectId and file_flag='yes' and doc_name='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'";
|
||
} else {
|
||
sql = "project_id=:projectId and file_flag='yes'";
|
||
}
|
||
try {
|
||
|
||
@SuppressWarnings("unchecked")
|
||
List<BizObject> bo = contBom.createQuery(sql).setParameter("projectId", ProjectId).getResultList(true);
|
||
if (bo != null) {
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
for (BizObject keys : bo) {
|
||
map.put(keys.getAttribute("DOCUMENT_ID").toString(), keys.getAttribute("FULLPATH").toString());
|
||
}
|
||
Map<String, String> result = requestService.downloadDoc(map);
|
||
if (!result.containsKey("error")) {
|
||
for (String contractId : map.keySet()) {
|
||
try {
|
||
if ("success".equals(result.get(contractId))) {
|
||
String fileString = result.get("file_" + contractId);
|
||
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
|
||
OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO
|
||
byte[] buffByte = new byte[1024];
|
||
int size = 0;
|
||
while ((size = fileInput.read(buffByte)) != -1) {
|
||
fileOut.write(buffByte, 0, size);
|
||
}
|
||
fileInput.close();
|
||
fileOut.close();
|
||
} else if ("error".equals(result.get(contractId))) {
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
return "success";
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
return "error";
|
||
}
|
||
return "success";
|
||
}
|
||
|
||
/**
|
||
* <20>ۿ<DBBF><EEBFA8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>document_id<69><64><EFBFBD>غ<EFBFBD>ͬ
|
||
*
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
* @throws MalformedURLException
|
||
*/
|
||
public String changedownloadDoc(JBOTransaction tx) throws MalformedURLException, Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager ldMange = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME, tx);
|
||
String sql = "OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ";
|
||
@SuppressWarnings("unchecked")
|
||
BizObject ldb = ldMange.createQuery(sql).setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true);
|
||
BizObjectManager clBom = JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME, tx);
|
||
try {
|
||
if (ldb != null) {
|
||
BizObject ldl = clBom.createQuery("RELATIVE_ID=:relativeid").setParameter("relativeid", ldb.getAttribute("ID").getString()).getSingleResult(false);
|
||
BizObjectManager ldaMange = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
BizObject lda = ldaMange.createQuery("LIBRARY_ID=:libraryid").setParameter("libraryid", ldl.getAttribute("ID").getString()).getSingleResult(false);
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
map.put(ldl.getAttribute("REMARK").toString(), lda.getAttribute("FULLPATH").toString());
|
||
Map<String, String> result = requestService.downloadDoc(map);
|
||
if (!result.containsKey("error")) {
|
||
for (String contractId : map.keySet()) {
|
||
try {
|
||
if ("success".equals(result.get(contractId))) {
|
||
String fileString = result.get("file_" + contractId);
|
||
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
|
||
OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO
|
||
byte[] buffByte = new byte[1024];
|
||
int size = 0;
|
||
while ((size = fileInput.read(buffByte)) != -1) {
|
||
fileOut.write(buffByte, 0, size);
|
||
}
|
||
fileInput.close();
|
||
fileOut.close();
|
||
} else if ("error".equals(result.get(contractId))) {
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
return "success";
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
return "error";
|
||
}
|
||
return "success";
|
||
}
|
||
|
||
//<2F>ۿ<DBBF><EEBFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD>ͬ
|
||
public String downloadDocContract(JBOTransaction tx) throws MalformedURLException, Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
String sql = "";
|
||
sql = "flow_unid=:flow_unid and file_flag='yes'";
|
||
String attributeId = "";
|
||
try {
|
||
@SuppressWarnings("unchecked")
|
||
List<BizObject> bo = contBom.createQuery(sql).setParameter("flow_unid", FlowUnid).getResultList(true);
|
||
if (bo != null) {
|
||
Map<String, String> map = new HashMap<String, String>();
|
||
for (BizObject keys : bo) {
|
||
map.put(keys.getAttribute("DOCUMENT_ID").toString(), keys.getAttribute("FULLPATH").toString());
|
||
attributeId = keys.getAttribute("ATTRIBUTE_ID").toString();
|
||
}
|
||
Map<String, String> result = requestService.downloadDoc(map);
|
||
|
||
if (!result.containsKey("error")) {
|
||
for (String contractId : map.keySet()) {
|
||
try {
|
||
if ("success".equals(result.get(contractId))) {
|
||
String fileString = result.get("file_" + contractId);
|
||
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
|
||
OutputStream fileOut = new FileOutputStream(map.get(contractId));// TODO
|
||
byte[] buffByte = new byte[1024];
|
||
int size = 0;
|
||
while ((size = fileInput.read(buffByte)) != -1) {
|
||
fileOut.write(buffByte, 0, size);
|
||
}
|
||
fileInput.close();
|
||
fileOut.close();
|
||
} else if ("error".equals(result.get(contractId))) {
|
||
return "error@";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
return "success@" + attributeId;
|
||
} else {
|
||
return "error@";
|
||
}
|
||
} else {
|
||
System.out.println("û<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
return "error@";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error@";
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20>ۿ<DBBF><EEBFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>zip<69><70>ͬ
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
* @throws MalformedURLException
|
||
*/
|
||
public String downloadZipContract(JBOTransaction tx) throws MalformedURLException, Exception{
|
||
requestService = (HttpRequestAppService) factory.create(
|
||
HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
try{
|
||
String path=null;
|
||
@SuppressWarnings("unchecked")
|
||
String sql="";
|
||
sql="flow_unid=:flow_unid and file_flag='yes'";
|
||
@SuppressWarnings("unchecked")
|
||
List<BizObject> bo = contBom.createQuery(sql).setParameter("flow_unid",FlowUnid).getResultList(true);
|
||
|
||
if(bo!=null){
|
||
Map<String,String> map=new HashMap<String,String>();
|
||
for(BizObject keys:bo){
|
||
path="D://"+keys.getAttribute("singcontract_id").toString()+"DocList.zip";
|
||
map.put(keys.getAttribute("singcontract_id").toString(),path);
|
||
}
|
||
String result=requestService.download(map);
|
||
if(result.equals("success")){
|
||
return "success";
|
||
}else{
|
||
return "error";
|
||
}
|
||
}
|
||
}catch(Exception e){
|
||
return "error";
|
||
}
|
||
return "success";
|
||
}
|
||
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>contract_id<69><64><EFBFBD>غ<EFBFBD>ͬ
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
* @throws MalformedURLException
|
||
*/
|
||
public String download(JBOTransaction tx) throws MalformedURLException, Exception{
|
||
requestService = (HttpRequestAppService) factory.create(
|
||
HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
try{
|
||
String path=null;
|
||
@SuppressWarnings("unchecked")
|
||
List<BizObject> bo = contBom.createQuery("project_id=:projectId and file_flag='yes'").setParameter("projectId",ProjectId).getResultList(true);
|
||
if(bo!=null){
|
||
Map<String,String> map=new HashMap<String,String>();
|
||
for(BizObject keys:bo){
|
||
path="D://"+keys.getAttribute("singcontract_id").toString()+"DocList.zip";
|
||
map.put(keys.getAttribute("singcontract_id").toString(),path);
|
||
}
|
||
String result=requestService.download(map);
|
||
if(result.equals("success")){
|
||
return "success";
|
||
}else{
|
||
return "error";
|
||
}
|
||
}
|
||
}catch(Exception e){
|
||
return "error";
|
||
}
|
||
return "success";
|
||
}
|
||
|
||
/**
|
||
*jar<61><72><EFBFBD><EFBFBD>ʽwordת<64><D7AA>pdf
|
||
*<2A><>jar<61><72><EFBFBD><EFBFBD>
|
||
*wordת<64><D7AA>pdf
|
||
*/
|
||
public void wordToPdfJar(JBOTransaction tx){
|
||
try {
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
|
||
String sql="";
|
||
if(flagType==null || "word".equals(flagType)){
|
||
sql="project_id='"+ProjectId+"' and file_flag='yes' and process='1'";
|
||
}else if("contract".equals(flagType)){
|
||
sql="contract_id='"+contract_id+"' and file_flag='yes' and process='1'";
|
||
}else if("pdfFalse".equals(flagType)){
|
||
sql="project_id='"+ProjectId+"' and file_flag='yes' and process='3'";
|
||
}else if ("flowunid".equals(flagType)){
|
||
sql = "flow_unid='"+FlowUnid+"' and file_flag='yes' and process='1'";
|
||
}
|
||
List<BizObject> bo = contBom.createQuery(sql).getResultList(false);
|
||
if(bo!=null){
|
||
for(BizObject key:bo){
|
||
String lastFilePath= key.getAttribute("FULLPATH").toString().replace(".docx", ".pdf");
|
||
try {
|
||
WordToPdfThread wtpt = new WordToPdfThread(key.getAttribute("FULLPATH").toString(),lastFilePath,key.getAttribute("ATTRIBUTE_ID").toString());
|
||
wtpt.start();
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
}
|
||
} catch (JBOException e) {
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
/**
|
||
* LibreOfficeʵ<65><CAB5>wordת<64><D7AA>pdf
|
||
* wordת<64><D7AA>pdf
|
||
* @throws JBOException
|
||
*/
|
||
@SuppressWarnings({ "unchecked", "static-access" })
|
||
public void wordToPdf(JBOTransaction tx) throws JBOException {
|
||
try {
|
||
BizObjectManager fbo = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME, tx);
|
||
BizObject fbos = fbo.createQuery("FLOW_UNID=:flowunid").setParameter("flowunid", FlowUnid).getSingleResult(false);
|
||
//<2F><>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
|
||
BizObjectManager lult = JBOFactory.getBizObjectManager(LB_UNION_LESSEE_TEMP.CLASS_NAME);
|
||
BizObjectManager customer = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME);
|
||
BizObject lults = lult.createQuery("flowunid=:flowUnid").setParameter("flowUnid", FlowUnid).getSingleResult(false);
|
||
BizObject cust = customer.createQuery("flowunid=:flowUnid and customerid=:customerid").setParameter("flowUnid", FlowUnid).setParameter("customerid", lults.getAttribute("customer_id").toString()).getSingleResult(false);
|
||
String customername = null;
|
||
String telephone = null;
|
||
String ids =null;
|
||
|
||
if(cust!=null){
|
||
customername = cust.getAttribute("FULLNAME").toString();
|
||
telephone = cust.getAttribute("mobile").toString();
|
||
ids = cust.getAttribute("CUSTOMERID").toString();
|
||
}
|
||
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
BizObjectManager attrBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
WordToPDFUtil wordTopdf = new WordToPDFUtil();
|
||
File file = null;
|
||
Boolean result = null;
|
||
String sql = "";
|
||
/*if (flagType == null || "word".equals(flagType)) {
|
||
sql = "project_id='" + ProjectId + "' and file_flag='yes' and process='1'";
|
||
} else if ("contract".equals(flagType)) {
|
||
sql = "contract_id='" + contract_id + "' and file_flag='yes' and process='1'";
|
||
} else if ("pdfFalse".equals(flagType)) {
|
||
sql = "project_id='" + ProjectId + "' and file_flag='yes' and process='3'";
|
||
} else if ("flowunid".equals(flagType)){
|
||
sql = "flow_unid='"+FlowUnid+"' and file_flag='yes' and (process='1' or process='3')";
|
||
}*/
|
||
List<BizObject> bo = contBom.createQuery("flow_unid=:flowUnid and file_flag='yes' and process='1'").setParameter("flowUnid", FlowUnid).getResultList(true);
|
||
if (bo != null) {
|
||
for (BizObject contBo : bo) {
|
||
String attrId = contBo.getAttribute("ATTRIBUTE_ID").toString();
|
||
BizObject attrBo = attrBom.createQuery("id='" +attrId+"'").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ת<EFBFBD><EFBFBD>pdf<EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
continue;
|
||
}
|
||
String lastFilePathpdf = filePath.getParent();
|
||
try {
|
||
result = wordTopdf.Word2Pdf(path, lastFilePathpdf);
|
||
} catch (Exception e) {
|
||
result = false;
|
||
e.printStackTrace();
|
||
}
|
||
if (result) {
|
||
file =new File(lastFilePath);
|
||
contBo.setAttributeValue("FULLPATH",lastFilePath);
|
||
contBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".docx",".pdf" ));
|
||
contBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf"));
|
||
contBo.setAttributeValue("CONTENT_TYPE","application/pdf");
|
||
contBo.setAttributeValue("PROCESS","2");
|
||
contBo.setAttributeValue("PROJECT_ID",fbos.getAttribute("proj_id").toString());
|
||
contBo.setAttributeValue("CUSTOMERNAME",customername);
|
||
contBo.setAttributeValue("TELEPHONE",telephone);
|
||
contBo.setAttributeValue("IDS",ids);
|
||
contBom.saveObject(contBo);
|
||
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);
|
||
}else{
|
||
contBo.setAttributeValue("PROCESS","3");
|
||
contBom.saveObject(contBo);
|
||
}
|
||
}
|
||
}
|
||
} catch (JBOException e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD>֪ͨ<CDA8>鸽<EFBFBD><E9B8BD><EFBFBD><EFBFBD>LibreOfficeʵ<65><CAB5>wordת<64><D7AA>pdf
|
||
* wordת<64><D7AA>pdf
|
||
* @throws JBOException
|
||
*/
|
||
@SuppressWarnings({ "unchecked", "static-access" })
|
||
public String wordToPdfAnnex(JBOTransaction tx) throws JBOException {
|
||
|
||
PLAN_LIST=PLAN_LIST.split("\\.")[0];
|
||
BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME);
|
||
BizObject DOCRELATIVE = null;
|
||
if("null".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery("plan_number=:plan_number and OBJECTTYPE='<27><>ӡ<EFBFBD>߿' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false);
|
||
}else if("rights".equals(PLAN_LIST)){
|
||
DOCRELATIVE = bom.createQuery("CONTRACT_ID=:CONTRACT_ID and objecttype='rights'").setParameter("CONTRACT_ID",contract_id).getSingleResult(false);
|
||
}else if("settle".equals(PLAN_LIST)){
|
||
DOCRELATIVE = bom.createQuery("CONTRACT_ID=:CONTRACT_ID and objecttype='settle'").setParameter("CONTRACT_ID",contract_id).getSingleResult(false);
|
||
}else if("TX".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype='AdjustInterst' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false);
|
||
}else if("ChangeCar".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false);
|
||
}else if("transfer".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='transfer' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false);
|
||
}else if("AdjustmentNotice".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='AdjustmentNotice' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false);
|
||
}else if("TriditionCollection".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionCollection' and plan_number=:plan_number").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false);
|
||
}else if("TriditionSuspension".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionSuspension' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false);
|
||
}else if("settletradition".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='settletradition' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false);
|
||
}else if("LetterApprova".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LetterApprova' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false);
|
||
}else if("LoanNotice".equals(PLAN_LIST)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LoanNotice' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false);
|
||
}
|
||
else{
|
||
DOCRELATIVE=bom.createQuery("plan_number=:plan_number and plan_list=:plan_list").setParameter("plan_number",PAYMENT_NUMBER).setParameter("plan_list", PLAN_LIST).getSingleResult(false);
|
||
}
|
||
|
||
BizObjectManager attrBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME);
|
||
BizObject attrBo=null;
|
||
WordToPDFUtil wordTopdf = new WordToPDFUtil();
|
||
File file = null;
|
||
Boolean result = null;
|
||
String sql = "";
|
||
try {
|
||
if (DOCRELATIVE != null) {
|
||
|
||
String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString();
|
||
BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.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);
|
||
|
||
String path = attrBo.getAttribute("FULLPATH").toString();
|
||
String lastFilePath = path.replace(".docx", ".pdf");
|
||
File filePath = new File(path);
|
||
if(!filePath.exists()){
|
||
logger.info("wordת<EFBFBD><EFBFBD>pdf<EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
String lastFilePathpdf = filePath.getParent();
|
||
try {
|
||
result = wordTopdf.Word2Pdf(path, lastFilePathpdf);
|
||
} catch (Exception e) {
|
||
result = false;
|
||
e.printStackTrace();
|
||
}
|
||
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);
|
||
}else{
|
||
}
|
||
if("ChangeCar".equals(PLAN_LIST)){
|
||
BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
|
||
BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true);
|
||
file =new File(lastFilePath);
|
||
ldcl.setAttributeValue("FULLPATH",lastFilePath);
|
||
ldcl.setAttributeValue("FILENAME",ldcl.getAttribute("FILENAME").toString().replace(".docx",".pdf" ));
|
||
ldcl.setAttributeValue("FILEPATH",ldcl.getAttribute("FILEPATH").toString().replace(".docx", ".pdf"));
|
||
ldcl.setAttributeValue("CONTENT_TYPE","application/pdf");
|
||
ldcl.setAttributeValue("PROCESS","2");
|
||
ldclManage.saveObject(ldcl);
|
||
}
|
||
}
|
||
|
||
} catch (JBOException e) {
|
||
e.printStackTrace();
|
||
}
|
||
return attrBo.getAttribute("ID").toString();
|
||
}
|
||
/**
|
||
* <20><><EFBFBD>߳<EFBFBD>wordת<64><D7AA>pdf
|
||
* @author tenwa518
|
||
*
|
||
*/
|
||
class WordToPdfThread extends Thread{
|
||
final String fullPath;
|
||
final String lastFilePath;
|
||
final String attrId;
|
||
public WordToPdfThread(String fullPath,String lastFilePath,String attrId){
|
||
this.fullPath = fullPath;
|
||
this.lastFilePath = lastFilePath;
|
||
this.attrId = attrId;
|
||
|
||
}
|
||
@Override
|
||
public void run() {
|
||
Word2PdfUtil wP = new Word2PdfUtil();
|
||
// WordToPDFUtil w2P = new WordToPDFUtil();
|
||
try {
|
||
// w2P.Word2Pdf(fullPath, lastFilePathpdf);
|
||
wP.doc2pdf(fullPath,lastFilePath,attrId);
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
* <20>鿴word<72>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD>תΪ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("project_id='"+ProjectId+"' 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++;
|
||
// return "error";
|
||
}else if("2".equals(process)){
|
||
pdfTrue++;
|
||
// return "wording";
|
||
}else if("3".equals(process)){
|
||
pdfFalse++;
|
||
// return "success";
|
||
}
|
||
}
|
||
}else{
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
||
return "0";
|
||
}
|
||
if(wordIng>0 && pdfFalse>0 && pdfTrue>0){
|
||
//wordת<64><D7AA>PDF<44><46><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||
return "1";
|
||
}else if(wordIng==0 && pdfFalse>0 && pdfTrue>0){
|
||
//wordתPDFʧ<46><CAA7>
|
||
return "2";
|
||
}else if(wordIng==0 && pdfFalse>0 && pdfTrue>0){
|
||
//wordת<64><D7AA>PDF<44><46><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>
|
||
return "3";
|
||
}else if(wordIng>0 && pdfFalse==0 && pdfTrue>0){
|
||
//word<72><64><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>pdf
|
||
return "4";
|
||
}else if(wordIng>0 && pdfFalse==0 && pdfTrue==0){
|
||
//wordû<64><C3BB>ת<EFBFBD><D7AA>pdf
|
||
return "5";
|
||
}else if(wordIng==0 && pdfFalse==0 && pdfTrue>0){
|
||
//wordת<64><D7AA>PDF<44>ɹ<EFBFBD>
|
||
return "6";
|
||
}
|
||
return "error";
|
||
}
|
||
//(<28>ۿ<DBBF><EEBFA8><EFBFBD><EFBFBD>)<29><><EFBFBD>ݺ<EFBFBD>ͬ<EFBFBD>Ż<EFBFBD>ȡ<EFBFBD>ļ<EFBFBD>״̬
|
||
public String getMakeContractProcessContract(JBOTransaction tx) throws JBOException{
|
||
BizObjectManager ldclBom=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
BizObject ldclBo = null;
|
||
ldclBo=ldclBom.createQuery("flow_unid='"+FlowUnid+"'and file_flag='yes' ").getSingleResult(false);
|
||
if(ldclBo!=null){
|
||
String process = ldclBo.getAttribute("process").toString();
|
||
String signType = ldclBo.getAttribute("sign_type").toString();
|
||
if("1".equals(process)){
|
||
return "isDoc";
|
||
}else if("2".equals(process)&&"DRAFT".equals(signType)){
|
||
return "isPdf";
|
||
}else if("COMPLETE".equals(signType)){
|
||
return "complete";
|
||
}else if("SIGNING".equals(signType)){
|
||
return "isSigning";
|
||
}
|
||
}
|
||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||
return "notExsit";
|
||
}
|
||
/**
|
||
* ת<><D7AA><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* @param tx
|
||
* @return
|
||
* @throws InterruptedException
|
||
*/
|
||
@SuppressWarnings("unchecked")
|
||
public String AccountAccreditSign(JBOTransaction tx){
|
||
try{
|
||
this.wordToPdf(tx);
|
||
tx.commit();
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
List<BizObject> boList = contBom.createQuery("file_flag='yes' and (process='2' or process='5') and flow_unid='"+FlowUnid+"'").getResultList(true);
|
||
if(boList.size()>0){
|
||
try {
|
||
String result =this.accountSign(tx,FlowUnid,InputOrgid);
|
||
if("success".equals(result)){
|
||
return "success";
|
||
}else{
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}else{
|
||
return "error";
|
||
}
|
||
} catch (JBOException e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
public String accountSign(JBOTransaction tx,String flowunid,String orgid) throws Exception{
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager ldclBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
|
||
BizObjectManager attrBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);
|
||
Map<String,ContractSignInfo> map=new HashMap<String,ContractSignInfo>();
|
||
ContractSignInfo con=null;
|
||
BizObject ldclBo=null;
|
||
try{
|
||
//<2F><>ѯlb_doc_contract_list<73><74>
|
||
ldclBo = ldclBom.createQuery("file_flag='yes' and process='2' and flow_unid='" + flowunid + "'").getSingleResult(true);
|
||
if (ldclBo != null) {
|
||
con = new ContractSignInfo();
|
||
con.setFileid(ldclBo.getAttribute("ATTRIBUTE_ID").toString());
|
||
con.setFilename(ldclBo.getAttribute("FILENAME").toString());
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||
String makefullPath = ldclBo.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
map.put(flowunid, con);
|
||
Map<String, String> resultMap = null;
|
||
if (orgid.indexOf("8002003001") >= 0) {
|
||
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>Ȩ
|
||
resultMap = requestService.createAccountContractSign(map);
|
||
} else {
|
||
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>Ȩ
|
||
resultMap = requestService.createAccountContractDSign(map);
|
||
}
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
if (key.indexOf("contract_") == -1) {
|
||
ldclBo.setAttributeValue("DOCUMENT_ID", resultMap.get(key));
|
||
ldclBo.setAttributeValue("SINGCONTRACT_ID", resultMap.get("contract_" + key));
|
||
}
|
||
}
|
||
ldclBo.setAttributeValue("PROCESS", "5");
|
||
ldclBom.saveObject(ldclBo);
|
||
tx.commit();
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
//<2F><>ȡ<EFBFBD>ļ<EFBFBD>
|
||
ldclBo = ldclBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + flowunid + "'").getSingleResult(true);
|
||
if (ldclBo != null) {
|
||
BizObject attrBo = attrBom.createQuery("id='"+ldclBo.getAttribute("attribute_id")+"'").getSingleResult(true);
|
||
Map<String, String> mapFile = new HashMap<String, String>();
|
||
String fileName = ldclBo.getAttribute("FILENAME").toString();
|
||
String fullPath =FileOperatorUtil.getuploadFileDir(this.getFileSavePath())+UUIDUtil.getUUID()+"_"+fileName;
|
||
String filePath = fullPath.replaceAll(this.getFileSavePath(),"");
|
||
mapFile.put(ldclBo.getAttribute("DOCUMENT_ID").toString(),fullPath);
|
||
Map<String, String> result = requestService.downloadDoc(mapFile);
|
||
if (!result.containsKey("error")) {
|
||
for (String documentId : mapFile.keySet()) {
|
||
try {
|
||
if ("success".equals(result.get(documentId))) {
|
||
String fileString = result.get("file_" + documentId);
|
||
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
|
||
OutputStream fileOut = new FileOutputStream(mapFile.get(documentId));// TODO
|
||
byte[] buffByte = new byte[1024];
|
||
int size = 0;
|
||
while ((size = fileInput.read(buffByte)) != -1) {
|
||
fileOut.write(buffByte, 0, size);
|
||
}
|
||
fileInput.close();
|
||
fileOut.close();
|
||
} else if ("error".equals(result.get(documentId))) {
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
ldclBo.setAttributeValue("FILEPATH",filePath);
|
||
ldclBo.setAttributeValue("FULLPATH",fullPath);
|
||
ldclBo.setAttributeValue("PROCESS", "6");
|
||
ldclBom.saveObject(ldclBo);
|
||
attrBo.setAttributeValue("FILEPATH",filePath);
|
||
attrBo.setAttributeValue("FULLPATH",fullPath);
|
||
attrBo.setAttributeValue("FileSize",new File(fullPath).length());
|
||
attrBom.saveObject(attrBo);
|
||
return "success";
|
||
} else {
|
||
return "error";
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
|
||
}
|
||
public String getFlowUnid(JBOTransaction tx) throws JBOException{
|
||
BizObjectManager fboBom=JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME,tx);
|
||
BizObject fboBo=fboBom.createQuery("CHANNELAPPLYID='"+id+"'").getSingleResult(false);
|
||
return fboBo.getAttribute("flow_unid").toString();
|
||
}
|
||
|
||
/*
|
||
* <20><><EFBFBD>·<EFBFBD><C2B7>Ͷ<EFBFBD><CDB6><EFBFBD>
|
||
* */
|
||
public String sendMessageAgain(JBOTransaction tx) {
|
||
try{
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
List<BizObject> bo = null;
|
||
String file = new String();
|
||
Map<String,String> contractmap = new HashMap<String,String>();
|
||
List<String> list = new ArrayList<String>();
|
||
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).getResultList(true);
|
||
for (BizObject temp : bo) {
|
||
String singcontractid = temp.getAttribute("singcontract_id").toString();
|
||
String filename = temp.getAttribute("filename").toString();
|
||
contractmap.put(singcontractid, filename);
|
||
}
|
||
list.addAll(contractmap.keySet());
|
||
Map<String,String> map = requestService.sendNotice(list);
|
||
if(!map.containsKey("error")){
|
||
return "success";
|
||
}else{
|
||
for(String singcontractid:map.keySet()){
|
||
String sendStatus = map.get(singcontractid);
|
||
if("2"==sendStatus){
|
||
file += contractmap.get(singcontractid)+";";
|
||
}
|
||
}
|
||
return file;
|
||
}
|
||
|
||
} catch (Exception e) {
|
||
try {
|
||
tx.rollback();
|
||
} catch (JBOException e1) {
|
||
e1.printStackTrace();
|
||
}
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
|
||
/*
|
||
* <20>ۿ<DBBF><EEBFA8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>Ͷ<EFBFBD><CDB6><EFBFBD>
|
||
* */
|
||
public String ChangesendMessageAgain(JBOTransaction tx) {
|
||
try{
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
List<BizObject> bo = null;
|
||
String file = new String();
|
||
Map<String,String> contractmap = new HashMap<String,String>();
|
||
List<String> list = new ArrayList<String>();
|
||
BizObjectManager ldMange = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME, tx);
|
||
String status = "";
|
||
String peopleStatus="";
|
||
String sql = "OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ";
|
||
@SuppressWarnings("unchecked")
|
||
BizObject ldb = ldMange.createQuery(sql).setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true);
|
||
if(ldb!=null){
|
||
String singcontractid = ldb.getAttribute("TEMPLATE_ID").toString();
|
||
contractmap.put(singcontractid, "ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȨЭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.pdf");
|
||
}
|
||
list.addAll(contractmap.keySet());
|
||
Map<String,String> map = requestService.sendNotice(list);
|
||
if(!map.containsKey("error")){
|
||
return "success";
|
||
}else{
|
||
for(String singcontractid:map.keySet()){
|
||
String sendStatus = map.get(singcontractid);
|
||
if("2"==sendStatus){
|
||
file += contractmap.get(singcontractid)+";";
|
||
}
|
||
}
|
||
return file;
|
||
}
|
||
|
||
} catch (Exception e) {
|
||
try {
|
||
tx.rollback();
|
||
} catch (JBOException e1) {
|
||
e1.printStackTrace();
|
||
}
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
|
||
public String getProcess(JBOTransaction tx){
|
||
try {
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
|
||
BizObject bo = contBom.createQuery("file_flag='yes' and process is not null and flow_unid='"+FlowUnid+"'").getSingleResult(false);
|
||
if(bo==null){
|
||
return "success";
|
||
}else{
|
||
return bo.getAttribute("PROCESS").toString();
|
||
}
|
||
} catch (JBOException e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
|
||
}
|
||
|
||
public String claimSign(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx);
|
||
ContractSignInfo con = null;
|
||
BizObject bo = null;
|
||
String doc_name = new String();
|
||
String[] attrIdList=attrId.split("@");
|
||
try{
|
||
for(String attribute_id:attrIdList){
|
||
Map<String,ContractSignInfo> map=new HashMap<String,ContractSignInfo>();
|
||
bo = contBom.createQuery("file_flag='yes' and process='2' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true);
|
||
if(bo != null){
|
||
con = new ContractSignInfo();
|
||
con.setFileid(attribute_id);
|
||
con.setFilename(bo.getAttribute("FILENAME").toString());
|
||
String makefullPath = bo.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
map.put(FlowUnid, con);
|
||
Map<String, String> resultMap = null;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľӿ<C4BD>
|
||
doc_name = bo.getAttribute("doc_name").toString();
|
||
if("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(doc_name)){
|
||
//<2F><><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD>
|
||
resultMap = requestService.createPaymentofHireSign(map);
|
||
}
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
if (key.indexOf("contract_") == -1) {
|
||
bo.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key));
|
||
bo.setAttributeValue("DOCUMENT_ID", resultMap.get(key));
|
||
}
|
||
}
|
||
bo.setAttributeValue("PROCESS", "5");
|
||
contBom.saveObject(bo);
|
||
tx.commit();
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
bo = contBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true);
|
||
if (bo != null) {
|
||
Map<String, String> map1 = new HashMap<String, String>();
|
||
map1.put(bo.getAttribute("DOCUMENT_ID").toString(), bo.getAttribute("FULLPATH").toString());
|
||
Map<String, String> result1 = requestService.downloadDoc(map1);
|
||
if (!result1.containsKey("error")) {
|
||
for (String contractId : map1.keySet()) {
|
||
try {
|
||
if ("success".equals(result1.get(contractId))) {
|
||
String fileString = result1.get("file_" + contractId);
|
||
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
|
||
OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO
|
||
byte[] buffByte = new byte[1024];
|
||
int size = 0;
|
||
while ((size = fileInput.read(buffByte)) != -1) {
|
||
fileOut.write(buffByte, 0, size);
|
||
}
|
||
fileInput.close();
|
||
fileOut.close();
|
||
} else if ("error".equals(result1.get(contractId))) {
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
bo.setAttributeValue("PROCESS", "6");
|
||
contBom.saveObject(bo);
|
||
} else {
|
||
return "error";
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
return "success";
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>֪ͨ<CDA8>鲢<EFBFBD><E9B2A2><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8>ͻ<EFBFBD>
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public String claimSignA(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
String libraryid="";
|
||
PLAN_LIST=PLAN_LIST.split("\\.")[0];
|
||
BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME);
|
||
BizObject DOCRELATIVE=bom.createQuery("plan_number=:plan_number and plan_list=:plan_list").setParameter("plan_number",PAYMENT_NUMBER).setParameter("plan_list", PLAN_LIST).getSingleResult(false);
|
||
if (DOCRELATIVE != null) {
|
||
String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString();
|
||
BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME);
|
||
libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString();
|
||
}
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
ContractSignInfo con = null;
|
||
BizObject bo = null;
|
||
// String contract_id="";
|
||
String info="";
|
||
try{
|
||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵绰<CDB5><E7BBB0>
|
||
BizObjectManager lulManager = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME, tx);
|
||
String customerid = lulManager.createQuery("CONTRACT_ID=:contractId").setParameter("contractId", contract_id).getSingleResult(false).getAttribute("CUSTOMER_ID").toString();
|
||
BizObjectManager crManage = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME, tx);
|
||
BizObject cr = crManage.createQuery("CUSTOMERID=:customerid").setParameter("customerid", customerid).getSingleResult(false);
|
||
if(cr != null){
|
||
info = cr.getAttribute("FULLNAME").toString() + "@" + cr.getAttribute("mobile").toString()+"@"+flagType;
|
||
}else{
|
||
info = "flagType@flagType@"+flagType;
|
||
}
|
||
//<2F><>ȡ<EFBFBD><C8A1>Ҫ<EFBFBD><D2AA><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
|
||
Map<String,ContractSignInfo> map=new HashMap<String,ContractSignInfo>();
|
||
bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true);
|
||
if(bo != null){
|
||
id = bo.getAttribute("id").toString();
|
||
con = new ContractSignInfo();
|
||
con.setFileid(id);
|
||
con.setFilename(bo.getAttribute("FILENAME").toString());
|
||
String makefullPath = bo.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
map.put(info, con);
|
||
Map<String, String> resultMap = null;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľӿ<C4BD>
|
||
// doc_name = bo.getAttribute("doc_name").toString();
|
||
// if("<22><><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD>".equals(doc_name)){
|
||
//<2F><><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD>
|
||
resultMap = requestService.createPaymentofHireSign(map);
|
||
// }
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
if (key.indexOf("contract_") == -1) {
|
||
// bo.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key));
|
||
// bo.setAttributeValue("DOCUMENT_ID", resultMap.get(key));
|
||
contract_id = resultMap.get(key);
|
||
}
|
||
}
|
||
// bo.setAttributeValue("PROCESS", "5");
|
||
// contBom.saveObject(bo);
|
||
// tx.commit();
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
// bo = contBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true);
|
||
if (bo != null) {
|
||
Map<String, String> map1 = new HashMap<String, String>();
|
||
map1.put(contract_id, bo.getAttribute("FULLPATH").toString());
|
||
Map<String, String> result1 = requestService.downloadDoc(map1);
|
||
if (!result1.containsKey("error")) {
|
||
for (String contractId : map1.keySet()) {
|
||
try {
|
||
if ("success".equals(result1.get(contractId))) {
|
||
String fileString = result1.get("file_" + contractId);
|
||
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
|
||
OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO
|
||
byte[] buffByte = new byte[1024];
|
||
int size = 0;
|
||
while ((size = fileInput.read(buffByte)) != -1) {
|
||
fileOut.write(buffByte, 0, size);
|
||
}
|
||
fileInput.close();
|
||
fileOut.close();
|
||
} else if ("error".equals(result1.get(contractId))) {
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
// bo.setAttributeValue("PROCESS", "6");
|
||
// contBom.saveObject(bo);
|
||
} else {
|
||
return "error";
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
|
||
return "success";
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20>ۿ<DBBF><EEBFA8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩԼ
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public String changeCarSignA(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
String libraryid="";
|
||
BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME,tx);
|
||
BizObjectManager bom1=null;
|
||
BizObject DOCRELATIVE= null;
|
||
BizObject library= null;
|
||
DOCRELATIVE=bom.createQuery("OBJECTTYPE='ChangeCar' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(true);
|
||
if (DOCRELATIVE != null) {
|
||
String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString();
|
||
bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME,tx);
|
||
library=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(true);
|
||
libraryid = library.getAttribute("id").toString();
|
||
}
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
ContractSignInfo con = null;
|
||
BizObject bo = null;
|
||
// String contract_id="";
|
||
String info="";
|
||
try{
|
||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵绰<CDB5><E7BBB0>
|
||
BizObjectManager lulManager = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME, tx);
|
||
String customerid = lulManager.createQuery("CONTRACT_ID=:contractId").setParameter("contractId", contract_id).getSingleResult(false).getAttribute("CUSTOMER_ID").toString();
|
||
BizObjectManager crManage = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME, tx);
|
||
BizObject cr = crManage.createQuery("CUSTOMERID=:customerid").setParameter("customerid", customerid).getSingleResult(false);
|
||
if(cr != null){
|
||
info = cr.getAttribute("FULLNAME").toString() + "@" + cr.getAttribute("mobile").toString()+"@"+flagType;
|
||
}else{
|
||
return "error";
|
||
}
|
||
//<2F><>ȡ<EFBFBD><C8A1>Ҫ<EFBFBD><D2AA><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
|
||
Map<String,ContractSignInfo> map=new HashMap<String,ContractSignInfo>();
|
||
bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true);
|
||
if(bo != null){
|
||
id = bo.getAttribute("id").toString();
|
||
con = new ContractSignInfo();
|
||
con.setFileid(id);
|
||
con.setFilename(bo.getAttribute("FILENAME").toString());
|
||
String makefullPath = bo.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
map.put(info, con);
|
||
Map<String, String> resultMap = null;
|
||
resultMap = requestService.createAccountContractDSign(map);
|
||
|
||
if (!resultMap.containsKey("error")) {
|
||
BizObjectManager ldclManage=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
|
||
BizObject ldcl = ldclManage.createQuery(" FLOW_UNID=:flowunid and CONTRACT_ID=:contractid and file_flag='yes' ").setParameter("flowunid", FlowUnid).setParameter("contractid", contract_id).getSingleResult(true);
|
||
if(ldcl != null){
|
||
ldcl.setAttributeValue("sign_type", "SIGNING");
|
||
ldclManage.saveObject(ldcl);
|
||
}
|
||
for (String key : resultMap.keySet()) {
|
||
if (key.indexOf("contract_") == -1) {
|
||
// DOCRELATIVE.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key));
|
||
DOCRELATIVE.setAttributeValue("TEMPLATE_ID", resultMap.get("contract_" + key));
|
||
library.setAttributeValue("REMARK",resultMap.get(key));
|
||
bo.setAttributeValue("REMARK","SIGNING");
|
||
contract_id = resultMap.get(key);
|
||
}
|
||
}
|
||
bom.saveObject(DOCRELATIVE);
|
||
bom1.saveObject(library);
|
||
contBom.saveObject(bo);
|
||
tx.commit();
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
return "success";
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD>պ<EFBFBD><D5BA>ǹ<EFBFBD>˾<EFBFBD><CBBE>
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
public String collectionSignA(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
String libraryid="";
|
||
BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME);
|
||
BizObject DOCRELATIVE = null;
|
||
if("settle".equals(flagType)){
|
||
DOCRELATIVE=bom.createQuery("CONTRACT_ID=:contractid and objecttype='settle' ").setParameter("contractid",contract_id).getSingleResult(false);
|
||
}else if("LetterApprova".equals(flagType)){
|
||
DOCRELATIVE=bom.createQuery("PROJ_ID=:projectId and objecttype='LetterApprova' ").setParameter("projectId",ProjectId).getSingleResult(false);
|
||
}else{
|
||
DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype LIKE '%<25><>ӡ<EFBFBD>߿%' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false);
|
||
}
|
||
if (DOCRELATIVE != null) {
|
||
String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString();
|
||
BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME);
|
||
libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString();
|
||
}
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
ContractSignInfo con = null;
|
||
BizObject bo = null;
|
||
String info="";
|
||
try{
|
||
info = libraryid + "@" + libraryid+"@"+flagType;
|
||
//<2F><>ȡ<EFBFBD><C8A1>Ҫ<EFBFBD><D2AA><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
|
||
Map<String,ContractSignInfo> map=new HashMap<String,ContractSignInfo>();
|
||
bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true);
|
||
if(bo != null){
|
||
id = bo.getAttribute("id").toString();
|
||
con = new ContractSignInfo();
|
||
con.setFileid(id);
|
||
con.setFilename(bo.getAttribute("FILENAME").toString());
|
||
String makefullPath = bo.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
map.put(info, con);
|
||
Map<String, String> resultMap = null;
|
||
resultMap = requestService.createPaymentofHireSign(map);
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
if (key.indexOf("contract_") == -1) {
|
||
contract_id = resultMap.get(key);
|
||
}
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
if (bo != null) {
|
||
Map<String, String> map1 = new HashMap<String, String>();
|
||
map1.put(contract_id, bo.getAttribute("FULLPATH").toString());
|
||
Map<String, String> result1 = requestService.downloadDoc(map1);
|
||
if (!result1.containsKey("error")) {
|
||
for (String contractId : map1.keySet()) {
|
||
try {
|
||
if ("success".equals(result1.get(contractId))) {
|
||
String fileString = result1.get("file_" + contractId);
|
||
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
|
||
OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO
|
||
byte[] buffByte = new byte[1024];
|
||
int size = 0;
|
||
while ((size = fileInput.read(buffByte)) != -1) {
|
||
fileOut.write(buffByte, 0, size);
|
||
}
|
||
fileInput.close();
|
||
fileOut.close();
|
||
} else if ("error".equals(result1.get(contractId))) {
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
|
||
return "success";
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/***
|
||
* <20>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ɵĺ<C9B5>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>
|
||
* @param tx
|
||
* @return
|
||
* @throws JBOException
|
||
*/
|
||
|
||
public String updateDocContractStatus(JBOTransaction tx) throws JBOException{
|
||
// BizObjectManager attBom=JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx);ProjectId
|
||
BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
|
||
BizObjectManager lpiManager=JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx);
|
||
try{
|
||
// BizObject lcl = lclManager.createQuery("file_flag='yes' and attribute_id='"+file_id+"'").getSingleResult(true);
|
||
|
||
lclManager.createQuery("update O set file_flag='no',message='1' where attribute_id=:attributeid").setParameter("attributeid",file_id).executeUpdate();
|
||
lpiManager.createQuery("update O set PROJECT_STATUS=13 where id=:id").setParameter("id",ProjectId).executeUpdate();
|
||
//attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate();
|
||
tx.commit();
|
||
}catch(Exception e){
|
||
tx.rollback();
|
||
e.printStackTrace();
|
||
System.out.println(e.getMessage());
|
||
return "error";
|
||
}
|
||
return "success";
|
||
}
|
||
|
||
public String companyUpdateDocContractStatus(JBOTransaction tx) throws Exception{
|
||
BizObjectManager fboManger=JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME,tx);
|
||
BizObjectManager lctManger=JBOFactory.getBizObjectManager(LB_CONTRACT_TEMPLATE.CLASS_NAME,tx);
|
||
BizObject fbo = fboManger.createQuery("flow_unid=:flowunid").setParameter("flowunid",FlowUnid).getSingleResult(false);
|
||
BizObject lct = lctManger.createQuery("Contract_id=:contractid").setParameter("contractid", fbo.getAttribute("CONTRACT_ID").getString()).getSingleResult(false);
|
||
String attId = ContractTemplateCache.getContractTemplateID(lct.getAttribute("ID").getString());
|
||
lctManger.deleteObject(lct);
|
||
BizObjectManager lclManager=JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME,tx);
|
||
BizObjectManager lpiManager=JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME,tx);
|
||
try{
|
||
lclManager.createQuery("update O set file_flag='no',message='1' where attribute_id=:attributeid").setParameter("attributeid",attId).executeUpdate();
|
||
lpiManager.createQuery("update O set PROJECT_STATUS=13 where id=:id").setParameter("id",ProjectId).executeUpdate();
|
||
//attBom.createQuery("update O set status='1' WHERE id='"+key.getAttribute("ATTRIBUTE_ID").toString()+"'").executeUpdate();
|
||
tx.commit();
|
||
}catch(Exception e){
|
||
tx.rollback();
|
||
e.printStackTrace();
|
||
System.out.println(e.getMessage());
|
||
return "error";
|
||
}
|
||
return "success";
|
||
}
|
||
|
||
/**
|
||
* <20><>ͳ<EFBFBD><CDB3>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>
|
||
* @param tx
|
||
* @return
|
||
* @throws Exception
|
||
|
||
*/
|
||
public String TcollectionSignA(JBOTransaction tx) throws Exception {
|
||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||
String libraryid="";
|
||
BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME);
|
||
BizObject DOCRELATIVE = null;
|
||
if("transfer".equals(flagType)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='transfer' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false);
|
||
}else if("AdjustmentNotice".equals(flagType)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='AdjustmentNotice' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false);
|
||
}else if("TriditionCollection".equals(flagType)){
|
||
DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype='TriditionCollection' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false);
|
||
}else if("TriditionSuspension".equals(flagType)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='TriditionSuspension' and FLOW_UNID=:flowunid ").setParameter("flowunid",FlowUnid).getSingleResult(false);
|
||
}else if("settletradition".equals(flagType)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='settletradition' and FLOW_UNID=:flowunid and CONTRACT_ID=:contractid ").setParameter("flowunid",FlowUnid).setParameter("contractid",contract_id).getSingleResult(false);
|
||
}else if("LoanNotice".equals(flagType)){
|
||
DOCRELATIVE=bom.createQuery(" OBJECTTYPE='LoanNotice' and PROJ_ID=:projectId ").setParameter("projectId",ProjectId).getSingleResult(false);
|
||
}else{
|
||
DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype LIKE '%<25><>ӡ<EFBFBD>߿%' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false);
|
||
}
|
||
if (DOCRELATIVE != null) {
|
||
String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString();
|
||
BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME);
|
||
libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString();
|
||
}
|
||
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
|
||
ContractSignInfo con = null;
|
||
BizObject bo = null;
|
||
String info="";
|
||
try{
|
||
info = libraryid + "@" + libraryid+"@"+flagType;
|
||
//<2F><>ȡ<EFBFBD><C8A1>Ҫ<EFBFBD><D2AA><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
|
||
Map<String,ContractSignInfo> map=new HashMap<String,ContractSignInfo>();
|
||
bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true);
|
||
if(bo != null){
|
||
id = bo.getAttribute("id").toString();
|
||
con = new ContractSignInfo();
|
||
con.setFileid(id);
|
||
con.setFilename(bo.getAttribute("FILENAME").toString());
|
||
String makefullPath = bo.getAttribute("FULLPATH").toString();
|
||
File file = new File(makefullPath);
|
||
if (!file.exists()) {
|
||
throw new RuntimeException("Ҫ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
con.setInputfile(BASE64.encodeImgageToBase64(file));
|
||
map.put(info, con);
|
||
Map<String, String> resultMap = null;
|
||
resultMap = requestService.createPaymentofHireSign(map);
|
||
if (!resultMap.containsKey("error")) {
|
||
for (String key : resultMap.keySet()) {
|
||
if (key.indexOf("contract_") == -1) {
|
||
contract_id = resultMap.get(key);
|
||
}
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
}
|
||
if (bo != null) {
|
||
Map<String, String> map1 = new HashMap<String, String>();
|
||
map1.put(contract_id, bo.getAttribute("FULLPATH").toString());
|
||
Map<String, String> result1 = requestService.downloadDoc(map1);
|
||
if (!result1.containsKey("error")) {
|
||
for (String contractId : map1.keySet()) {
|
||
try {
|
||
if ("success".equals(result1.get(contractId))) {
|
||
String fileString = result1.get("file_" + contractId);
|
||
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
|
||
OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO
|
||
byte[] buffByte = new byte[1024];
|
||
int size = 0;
|
||
while ((size = fileInput.read(buffByte)) != -1) {
|
||
fileOut.write(buffByte, 0, size);
|
||
}
|
||
fileInput.close();
|
||
fileOut.close();
|
||
} else if ("error".equals(result1.get(contractId))) {
|
||
return "error";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
} else {
|
||
return "error";
|
||
}
|
||
|
||
return "success";
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
}
|
||
//<2F><><EFBFBD><EFBFBD>һά
|
||
public String SystemMakeOneDimensionalCode(JBOTransaction tx){
|
||
Configure CurConfig = Configure.getInstance();
|
||
try {
|
||
String diskPath=CurConfig.getConfigure("OneDimensionalCode");
|
||
MakeOneCodeAndContractModel mocacm = new MakeOneCodeAndContractModel();
|
||
BizObjectManager loManage = JBOFactory.getBizObjectManager(LB_ONEDIMENSIONALCODE.CLASS_NAME,tx);
|
||
BizObject lom = loManage.createQuery(" PROJECT_ID=:projectid and CONTRACT_NO=:contractNo and CONTRACT_ID=:contractId").setParameter("projectid", ProjectId).setParameter("contractNo", contractNo).setParameter("contractId", contract_id).getSingleResult(false);
|
||
if(lom == null){
|
||
//<2F><><EFBFBD><EFBFBD>һά<D2BB><CEAC>
|
||
mocacm.MOneDimensionalCode(contractNo, contract_id, ProjectId, diskPath, tx);
|
||
}
|
||
String outPdfFile = CurConfig.getConfigure("BQcontract");
|
||
mocacm.pdfAndMark(outPdfFile, "", contract_id,leasform, tx);
|
||
}catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "error";
|
||
}
|
||
return "success";
|
||
}
|
||
} |