161 lines
6.0 KiB
Java
161 lines
6.0 KiB
Java
package com.ap;
|
||
|
||
import com.amarsoft.are.ARE;
|
||
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.awe.util.Transaction;
|
||
import jbo.com.tenwa.entity.comm.message.BT_BUSSINESS_MESSAGE_CONFIG;
|
||
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
|
||
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO;
|
||
import jbo.oti.FC_REQUEST;
|
||
import jbo.prd.LB_PRODUCT_CORPUS_SOURCE;
|
||
|
||
import java.util.List;
|
||
|
||
public class CorpusSourceCheck {
|
||
|
||
private String projectId;
|
||
|
||
/**
|
||
* 暂时不用,已放到接口平台执行
|
||
*
|
||
* @throws JBOException
|
||
*/
|
||
public void setNextCorpusChannel() throws JBOException {
|
||
String nextCorpusChannel = getNextCorpusChannel(projectId);
|
||
BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME);
|
||
BizObject boLPI = bomLPI.createQuery("id=:projectId").setParameter("projectId", projectId).getSingleResult(true);
|
||
boLPI.setAttributeValue("CORPUS_SOURCE", nextCorpusChannel);
|
||
bomLPI.saveObject(boLPI);
|
||
BizObjectManager bomLCI = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME);
|
||
BizObject boLCI = bomLCI.createQuery("PROJECT_ID=:projectId").setParameter("projectId", projectId).getSingleResult(true);
|
||
if (boLCI != null) {
|
||
boLCI.setAttributeValue("CORPUS_SOURCE", nextCorpusChannel);
|
||
bomLCI.saveObject(boLCI);
|
||
}
|
||
ARE.getLog().debug("项目ID:" + projectId + "的资金方变更为-->" + nextCorpusChannel);
|
||
|
||
}
|
||
|
||
/**
|
||
* 暂时不用,已放到接口平台执行
|
||
*
|
||
* @throws JBOException
|
||
*/
|
||
public String getNextCorpusChannel(String projectId) throws JBOException {
|
||
BizObjectManager bomLPCS = JBOFactory.getBizObjectManager(LB_PRODUCT_CORPUS_SOURCE.CLASS_NAME);
|
||
BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME);
|
||
BizObject boLPI = bomLPI.createQuery("id=:projectId").setParameter("projectId", projectId).getSingleResult(false);
|
||
String productId = boLPI.getAttribute("PRODUCT_ID").toString();
|
||
String corpusSource = "AP";
|
||
if (boLPI.getAttribute("CORPUS_SOURCE") != null && !"".equals(boLPI.getAttribute("CORPUS_SOURCE"))) {
|
||
corpusSource = boLPI.getAttribute("CORPUS_SOURCE").toString();
|
||
}
|
||
if ("AP".equals(corpusSource)) {
|
||
return "AP";
|
||
}
|
||
List<BizObject> boLPCSs = bomLPCS.createQuery("product_id=:productId order by order_list").setParameter("productId", productId).getResultList(false);
|
||
int nextIndex = -1;
|
||
if (boLPCSs.size() > 0) {
|
||
for (int i = 0; i < boLPCSs.size(); i++) {
|
||
String corpusSourceTable = boLPCSs.get(i).getAttribute("CORPUS_SOURCE").toString();
|
||
if (corpusSource.equals(corpusSourceTable)) {
|
||
nextIndex = i + 1;
|
||
break;
|
||
}
|
||
}
|
||
if (nextIndex >= boLPCSs.size() || nextIndex == -1) {
|
||
return "AP";
|
||
} else {
|
||
return boLPCSs.get(nextIndex).getAttribute("CORPUS_SOURCE").toString();
|
||
}
|
||
}
|
||
return "AP";
|
||
}
|
||
|
||
/**
|
||
* 发起合同制作时,检验资方是否信审通过
|
||
* @return
|
||
*/
|
||
public String corpusContractApplyCheck() {
|
||
String sResult;
|
||
try {
|
||
if(projectId==null){
|
||
sResult = "未找到对应的项目编号,请联系系统管理员";
|
||
return sResult;
|
||
}
|
||
String fcStage = this.getFcStageByProjectId();
|
||
if("-2".equals(fcStage)){
|
||
return "获取状态信息出现错误,请联系系统管理员!";
|
||
}
|
||
if ("AP".equals(fcStage)||"1".equals(fcStage)) {
|
||
sResult = "S";
|
||
} else {
|
||
sResult = "资金方尚未审批结束,请稍后再试!";
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "检验资金渠道信息出错,请联系系统管理员!";
|
||
}
|
||
return sResult;
|
||
}
|
||
/**
|
||
* 发起放款申请制作时,检验是否与资方签署合同
|
||
* @return
|
||
*/
|
||
public String corpusFundPaymentApplyCheck(){
|
||
String sResult = null;
|
||
try {
|
||
String fcStage = this.getFcStageByProjectId();
|
||
if("-2".equals(fcStage)){
|
||
return "获取状态信息出现错误,请联系系统管理员!";
|
||
}
|
||
if("2".equals(fcStage)||"AP".equals(fcStage)){
|
||
return "S";
|
||
} else {
|
||
sResult = "客户还未和资方签署合同";
|
||
}
|
||
} catch (JBOException e) {
|
||
e.printStackTrace();
|
||
return "检验资金渠道信息出错,请联系系统管理员!";
|
||
}
|
||
return sResult;
|
||
}
|
||
|
||
public String getCorpusSourceByProjectId() throws JBOException {
|
||
String corpusSource = "AP";
|
||
BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME);
|
||
BizObject boLPI = bomLPI.createQuery("id=:projectId").setParameter("projectId", projectId).getSingleResult(false);
|
||
if (boLPI.getAttribute("CORPUS_SOURCE") != null) {
|
||
corpusSource = boLPI.getAttribute("CORPUS_SOURCE").toString();
|
||
}
|
||
return corpusSource;
|
||
}
|
||
|
||
public String getFcStageByProjectId() throws JBOException {
|
||
String fcStage = "-2" ;
|
||
String corpusSource = this.getCorpusSourceByProjectId();
|
||
if("AP".equals(corpusSource)){
|
||
fcStage = "AP" ;
|
||
}else{
|
||
BizObjectManager bomFR = JBOFactory.getBizObjectManager(FC_REQUEST.CLASS_NAME);
|
||
BizObject boFR = bomFR.createQuery("PROJECT_ID=:projectId and del_flag='0'").setParameter("projectId", projectId).getSingleResult(false);
|
||
if(boFR!=null){
|
||
fcStage = boFR.getAttribute("FC_STAGE").toString();
|
||
}
|
||
}
|
||
return fcStage;
|
||
}
|
||
|
||
public String getProjectId() {
|
||
return projectId;
|
||
}
|
||
|
||
public void setProjectId(String projectId) {
|
||
this.projectId = projectId;
|
||
}
|
||
|
||
}
|