2020-10-23 16:14:41 +08:00

106 lines
3.9 KiB
Java

package com.tenwa.flow.comm.status;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_STATUS;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP;
import jbo.app.tenwa.calc.LC_CASH_FLOW;
import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.app.tenwa.calc.LC_RENT_PLAN_SP;
import jbo.app.tenwa.calc.LC_RENT_PLAN_SP_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.loan.BANK_COLLECT_TYPE_CONFIG;
import com.amarsoft.app.als.sys.tools.DateUtil;
import com.amarsoft.app.awe.config.InitDBType;
import com.amarsoft.app.util.ProductParamUtil;
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.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.reckon.executor.CreateTransactionExecutor;
/**
* 根据配置信息修改银行扣款方式
* @author zhangbeibei
*
*/
public class BankCollect {
private String contractId;
private String collectType;
private String startDate;
private String endDate;
public void customerAccountCollectTypeModify(JBOTransaction tx) throws Exception{
BizObjectManager bomCA = JBOFactory.getBizObjectManager(CUSTOMER_ACCOUNT.CLASS_NAME,tx);
if(contractId!=null||!"".equals(contractId)){
BizObject boCA = bomCA.createQuery("contract_id=:contract_id").setParameter("contract_id", contractId).getSingleResult(true);
if(boCA.getAttribute("bank_code")!=null&&!"".equals(boCA.getAttribute("bank_code").toString())){
bomCA.createQuery("update O,jbo.loan.BANK_COLLECT_TYPE_CONFIG bctc set O.collect_type=bctc.collect_type where O.bank_code=bctc.bank_code and O.contract_id=:contract_id")
.setParameter("contract_id", contractId).executeUpdate();
}
//如果没有指定的方式,则默认是银联
if(boCA.getAttribute("collect_type")==null||"".equals(boCA.getAttribute("collect_type").toString())){
boCA.setAttributeValue("collect_type", "YLcollect");
bomCA.saveObject(boCA);
}
}
}
public String changeContractCollectTypeDo(JBOTransaction tx) throws Exception{
//注意时间格式统一
String curDate = DateUtil.getToday();
//如果配置的时间小于等于当前时间,则立即改变状态,否则,按银行配置重新配置(防止先改当前日期,后改大于当前日期)
if(curDate.compareTo(startDate)>=0){
this.changeContractCollectType(tx,contractId,collectType);
}else{
this.customerAccountCollectTypeModify(tx);
}
return "";
}
public void changeContractCollectType(JBOTransaction tx,String contractId,String collectType) throws JBOException{
BizObjectManager bomCA = JBOFactory.getBizObjectManager(CUSTOMER_ACCOUNT.CLASS_NAME,tx);
BizObject boCA = bomCA.createQuery("contract_id=:contract_id").setParameter("contract_id", contractId).getSingleResult(true);
boCA.setAttributeValue("collect_type", collectType);
bomCA.saveObject(boCA);
}
public String getContractId() {
return contractId;
}
public void setContractId(String contractId) {
this.contractId = contractId;
}
public String getCollectType() {
return collectType;
}
public void setCollectType(String collectType) {
this.collectType = collectType;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}