Merge remote-tracking branch 'origin/ap007' into ap007
This commit is contained in:
commit
f78e6b8cb5
@ -25,7 +25,7 @@ public class FileMailingMessage extends BaseBussinessMessage {
|
||||
messageManager.createQuery(" delete from O where message_content='Óʼĵµ°¸¹éµµ' ").executeUpdate();
|
||||
|
||||
String sql = "SELECT COUNT(O.PROJECT_MANAGE) number,O.PROJECT_MANAGE PROJECT_MANAGE FROM LB_CONTRACT_INFO O LEFT JOIN LB_FILE_MAILARCHIVING_INFO lfi ON lfi.contract_id = O.id LEFT JOIN ORG_INFO oi ON oi.orgid = O.PROJECT_DEPT LEFT JOIN LC_CALC_CONDITION lcc ON lcc.contract_id = O.id WHERE (lfi.ALLHANDOVERSTATUS IS NULL OR lfi.ALLHANDOVERSTATUS = 'part' OR lfi.ALLHANDOVERSTATUS = 'none') AND NOT EXISTS (SELECT 1 FROM LB_FILE_MAILARCHIVING_INFO_TEMP lfmit WHERE lfmit.contract_id = O.id AND lfmit.is_flowing = '0') AND EXISTS (SELECT 1 FROM LB_FILE_ARCHIVING_INFO lfai WHERE lfai.contract_id = O.id) GROUP BY O.PROJECT_MANAGE";
|
||||
List<Map<String,String>> lciList=DataOperatorUtil.getDataBySql(sql, null);
|
||||
List<Map<String,String>> lciList=DataOperatorUtil.getDataBySql(sql);
|
||||
|
||||
for(Map<String,String> lci : lciList){
|
||||
Map<String,String>message=new HashMap<String,String>();
|
||||
|
||||
@ -563,7 +563,16 @@ public class DataOperatorUtil {
|
||||
public static List<Map<String,String>> getDataBySql( String sql, Map<String,String> params ) throws Exception {
|
||||
return getDataBySql( null, sql, params );
|
||||
}
|
||||
|
||||
/**
|
||||
* 重构一个简便调用
|
||||
* @param sql
|
||||
* @param tx
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<Map<String,String>> getDataBySql(String sql , JBOTransaction tx) throws Exception {
|
||||
return getDataBySql( tx, sql, null );
|
||||
}
|
||||
/**
|
||||
* 再重构一个更简便调用
|
||||
* @param sql
|
||||
|
||||
@ -461,7 +461,7 @@ public class DocListInitAction {
|
||||
}
|
||||
String sql = "SELECT FLOWNO FROM flow_catalog WHERE flowname='"
|
||||
+ flowName + "'";
|
||||
List<Map<String, String>> ds = DataOperatorUtil.getDataBySql( sql, null);
|
||||
List<Map<String, String>> ds = DataOperatorUtil.getDataBySql( sql);
|
||||
String flowno = GetValueByKey("docpreview.properties",
|
||||
ds.get(0).get("FLOWNO"));
|
||||
// ¸ù¾ÝÒªÇóÍϳµÉêÇëÊÇ
|
||||
@ -584,7 +584,7 @@ public class DocListInitAction {
|
||||
public static List<String> nextImageForMailDoc(String contract_id) throws Exception{
|
||||
List<String> list = new ArrayList<String>();
|
||||
String sql = "select lda.id attrid from lb_docrelative ldr left join lb_doclibrary ldl on ldl.RELATIVE_ID = ldr.id left join lb_docattribute lda on lda.LIBRARY_ID = ldl.ID where ldr.OBJECTTYPE = 'MortgageFileMailFlow' and contract_id = '"+contract_id+"' and lda.id is not null";
|
||||
List<Map<String, String>> ds = DataOperatorUtil.getDataBySql( sql, null );
|
||||
List<Map<String, String>> ds = DataOperatorUtil.getDataBySql( sql );
|
||||
for(Map<String, String> map:ds){
|
||||
list.add(map.get("attrid"));
|
||||
}
|
||||
@ -593,7 +593,7 @@ public class DocListInitAction {
|
||||
public static List<String> nextImageForMailHisDoc(String contract_id) throws Exception{
|
||||
List<String> list = new ArrayList<String>();
|
||||
String sql = "select lda.id attrid from lb_docrelative ldr left join lb_doclibrary ldl on ldl.RELATIVE_ID = ldr.id left join lb_docattribute lda on lda.LIBRARY_ID = ldl.ID where ldr.OBJECTTYPE IN ('BusinessApplyFlow','FundPaymentCarFlow','MortgageFileFlow') and proj_id = '"+contract_id+"' and lda.id is not null";
|
||||
List<Map<String, String>> ds = DataOperatorUtil.getDataBySql( sql, null );
|
||||
List<Map<String, String>> ds = DataOperatorUtil.getDataBySql( sql );
|
||||
for(Map<String, String> map:ds){
|
||||
list.add(map.get("attrid"));
|
||||
}
|
||||
|
||||
@ -2,29 +2,23 @@ package com.tenwa.lease.app.quartzmession;
|
||||
|
||||
import com.amarsoft.are.jbo.*;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.amarsoft.awe.util.ASResultSet;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.base.util.QuartzUtil;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.reckon.executor.CreateTransactionExecutor;
|
||||
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
|
||||
import jbo.app.tenwa.calc.LC_RENT_PLAN;
|
||||
import jbo.oti.FC_FILE_PUSH;
|
||||
import jbo.oti.FC_YC_FILE_REPAY_PLAN;
|
||||
import jbo.oti.LC_PROFIT_PLAN;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static java.math.BigDecimal.ROUND_HALF_UP;
|
||||
|
||||
@ -33,25 +27,7 @@ import static java.math.BigDecimal.ROUND_HALF_UP;
|
||||
*/
|
||||
public class CorpusSourceRentPlanCopy implements Job {
|
||||
|
||||
Set<String> contractSet = null;
|
||||
JBOTransaction tx = null;
|
||||
Transaction Sqlca = null;
|
||||
{
|
||||
try {
|
||||
tx = JBOFactory.createJBOTransaction();
|
||||
Sqlca = Transaction.createTransaction(tx);
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
if (Sqlca != null) {
|
||||
Sqlca.rollback();
|
||||
}
|
||||
} catch (JBOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String contractId;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
@ -62,7 +38,13 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
|
||||
BizObjectManager ffpBom = null;
|
||||
BizObjectManager fyfrpBom = null;
|
||||
|
||||
JBOTransaction tx = null;
|
||||
Transaction Sqlca = null;
|
||||
|
||||
try {
|
||||
tx = JBOFactory.createJBOTransaction();
|
||||
Sqlca = Transaction.createTransaction(tx);
|
||||
ffpBom = JBOFactory.getBizObjectManager(FC_FILE_PUSH.CLASS_NAME,tx);
|
||||
fyfrpBom = JBOFactory.getBizObjectManager(FC_YC_FILE_REPAY_PLAN.CLASS_NAME,tx);
|
||||
//todo 添加渠道商的选择,哪些需要拷表哪些不需要
|
||||
@ -72,11 +54,17 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
//1.更新租金计划租金信息,并获取每个文件的contract_id
|
||||
String sql = "select fr.CONTRACT_ID,O.LEND_TERM,O.ANS_REPAYMENT_DATE,O.ANS_PRINCIPAL,O.ANS_INTEREST,ANS_REPAYMENT_MONEY from O left join jbo.oti.FC_REQUEST fr on O.FC_REQUEST_ID=fr.ID where fr.DEL_FLAG='0' and O.FC_FILE_ID=:fcFileId";
|
||||
List<BizObject> fyfrpBoList = fyfrpBom.createQuery(sql).setParameter("fcFileId",fcFileId).getResultList(false);
|
||||
contractSet = this.updateRentPlan(fyfrpBoList);
|
||||
//2.更新租金计划剩余本金
|
||||
updateAllRemainCorpus();
|
||||
//3.更新租金计划分润信息
|
||||
updateSplitSP();
|
||||
|
||||
Set<String> contractSet = this.updateRentPlan(fyfrpBoList,tx);
|
||||
for(String contractId : contractSet){
|
||||
Map<String,String> param= this.getParamByContractId(contractId,tx);
|
||||
//2.更新租金计划剩余本金
|
||||
this.updateAllRemainCorpus(contractId,tx);
|
||||
//3.更新租金计划分润信息
|
||||
this.updateSplitSP(param,Sqlca);
|
||||
//4.插入分润计划
|
||||
this.insertProfitPlan(param,tx);
|
||||
}
|
||||
ffpBo.setAttributeValue("FILE_STS","3");
|
||||
ffpBo.setAttributeValue("FILE_STS_DESC","拷贝成功");
|
||||
ffpBom.saveObject(ffpBo);
|
||||
@ -105,10 +93,10 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
* @throws JBOException
|
||||
* @throws ParseException
|
||||
*/
|
||||
public Set<String> updateRentPlan(List<BizObject> fyfrpBoList) throws JBOException, ParseException {
|
||||
public Set<String> updateRentPlan(List<BizObject> fyfrpBoList,JBOTransaction tx) throws JBOException, ParseException {
|
||||
BizObjectManager lrpBom = null;
|
||||
lrpBom = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME,tx);
|
||||
contractSet = new HashSet<>();
|
||||
Set<String> contractSet = new HashSet<>();
|
||||
//更新租金计划表
|
||||
for(BizObject bo : fyfrpBoList){
|
||||
//获取参数
|
||||
@ -141,73 +129,142 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
* 更新剩余本金信息
|
||||
* @throws JBOException
|
||||
*/
|
||||
public void updateAllRemainCorpus() throws JBOException {
|
||||
public void updateAllRemainCorpus(String contractId,JBOTransaction tx) throws JBOException {
|
||||
BizObjectManager lrpBom = null;
|
||||
lrpBom = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME,tx);
|
||||
BizObjectManager lccBom = null;
|
||||
lccBom = JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME,tx);
|
||||
//根据contractId遍历循环来更新租金计划表中剩余本金字段
|
||||
for(String contractId : contractSet){
|
||||
BizObject lccBo = lccBom.createQuery("select CLEAN_LEASE_MONEY from O where contract_id=:contractId").setParameter("contractId",contractId).getSingleResult(false);
|
||||
String clean_lease_money = lccBo.getAttribute("CLEAN_LEASE_MONEY").toString();
|
||||
BigDecimal cleanLeaseMoneyBd = new BigDecimal(clean_lease_money);
|
||||
List<BizObject> lrpBos= lrpBom.createQuery("contract_id=:contractId order by plan_list").setParameter("contractId",contractId).getResultList(true);
|
||||
for(BizObject bo :lrpBos){
|
||||
String corpus = bo.getAttribute("corpus").toString();
|
||||
BigDecimal corpusBd = new BigDecimal(corpus);
|
||||
cleanLeaseMoneyBd = cleanLeaseMoneyBd.subtract(corpusBd).setScale(2,ROUND_HALF_UP);
|
||||
bo.setAttributeValue("ALL_REMAIN_CORPUS",cleanLeaseMoneyBd.toString());
|
||||
lrpBom.saveObject(bo);
|
||||
}
|
||||
|
||||
BizObject lccBo = lccBom.createQuery("select CLEAN_LEASE_MONEY from O where contract_id=:contractId").setParameter("contractId",contractId).getSingleResult(false);
|
||||
String clean_lease_money = lccBo.getAttribute("CLEAN_LEASE_MONEY").toString();
|
||||
BigDecimal cleanLeaseMoneyBd = new BigDecimal(clean_lease_money);
|
||||
List<BizObject> lrpBos= lrpBom.createQuery("contract_id=:contractId order by plan_list").setParameter("contractId",contractId).getResultList(true);
|
||||
for(BizObject bo :lrpBos){
|
||||
String corpus = bo.getAttribute("corpus").toString();
|
||||
BigDecimal corpusBd = new BigDecimal(corpus);
|
||||
cleanLeaseMoneyBd = cleanLeaseMoneyBd.subtract(corpusBd).setScale(2,ROUND_HALF_UP);
|
||||
bo.setAttributeValue("ALL_REMAIN_CORPUS",cleanLeaseMoneyBd.toString());
|
||||
lrpBom.saveObject(bo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新剩余本金信息
|
||||
* @throws JBOException
|
||||
*/
|
||||
public void updateAllRemainCorpus(JBOTransaction tx) throws JBOException {
|
||||
this.updateAllRemainCorpus(contractId,tx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分润信息
|
||||
* @throws Exception
|
||||
*/
|
||||
public void updateSplitSP() throws Exception {
|
||||
public void updateSplitSP(Map<String,String> param,Transaction Sqlca) throws Exception {
|
||||
|
||||
for(String contractId : contractSet) {
|
||||
String sql = "select lci.product_id,lci.distributor_id,lcc.payment_number from lb_contract_info lci left join lc_calc_condition lcc on lci.id=lcc.contract_id where lci.id='" + contractId + "'";
|
||||
SqlObject sqlBo = null;
|
||||
String productId = null;
|
||||
String distributorId = null;
|
||||
String paymentNumber = null;
|
||||
ASResultSet rs = null;
|
||||
String splittingRatio = param.get("splittingRatio");
|
||||
//必须的判断条件(配置了灵活分润的产品可能没有配置分润)
|
||||
// 判断顺序,是否分润--》是否灵活分润
|
||||
//是否灵活分润在insertRentPlan_SP()方法中判断
|
||||
if (!"".equals(splittingRatio) && splittingRatio != null) {
|
||||
String paymentNumber = param.get("paymentNumber");
|
||||
String splitType = param.get("splitType");
|
||||
CreateTransactionExecutor cre = new CreateTransactionExecutor();
|
||||
cre.setPlannumber(paymentNumber);
|
||||
cre.insertRentPlan_SP(splittingRatio, Sqlca, splitType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分润信息
|
||||
* @throws Exception
|
||||
*/
|
||||
public void updateSplitSP(JBOTransaction tx) {
|
||||
Transaction Sqlca = null;
|
||||
try {
|
||||
Sqlca = Transaction.createTransaction(tx);
|
||||
Map<String,String> param = this.getParamByContractId(contractId,tx);
|
||||
this.updateSplitSP(param,Sqlca);
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
sqlBo = new SqlObject(sql);
|
||||
rs = Sqlca.getASResultSet(sqlBo);
|
||||
if ( rs.next() ) {
|
||||
productId = rs.getString( "product_id" );
|
||||
distributorId = rs.getString( "distributor_id" );
|
||||
paymentNumber = rs.getString( "payment_number" );
|
||||
String splitType = Sqlca.getString("select attribute5 from business_type where typeno = '" + productId + "'");
|
||||
String splittingRatio = Sqlca.getString("select splitting_ratio from lb_splitting_ratio where distributor_id='" + distributorId + "' and product_id='" + productId + "'");
|
||||
if (!"".equals(splittingRatio) && splittingRatio != null) {
|
||||
CreateTransactionExecutor cre = new CreateTransactionExecutor();
|
||||
cre.setPlannumber(paymentNumber);
|
||||
cre.insertRentPlan_SP(splittingRatio, Sqlca, splitType);
|
||||
}
|
||||
if (Sqlca != null) {
|
||||
Sqlca.rollback();
|
||||
}
|
||||
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}finally {
|
||||
rs.close();
|
||||
} catch (JBOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getContractSet() {
|
||||
return contractSet;
|
||||
/**
|
||||
* 获取每个合同的参数
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String,String> getParamByContractId(String contractId,JBOTransaction tx) throws Exception {
|
||||
String sql = "select * from vi_corpus_source_param where contractId='" + contractId + "'";
|
||||
List<Map<String,String>> data = DataOperatorUtil.getDataBySql(sql,tx);
|
||||
return data.get(0);
|
||||
}
|
||||
|
||||
public void setContractSet(Set<String> contractSet) {
|
||||
this.contractSet = contractSet;
|
||||
/**
|
||||
* 获取每个合同的参数
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String,String> getParamByContractId(JBOTransaction tx) throws Exception {
|
||||
return this.getParamByContractId(contractId,tx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入分润计划
|
||||
* @param param
|
||||
* @throws JBOException
|
||||
*/
|
||||
public void insertProfitPlan(Map<String,String> param,JBOTransaction tx) throws JBOException {
|
||||
BizObjectManager lppBom = null;
|
||||
lppBom = JBOFactory.getBizObjectManager(LC_PROFIT_PLAN.CLASS_NAME,tx);
|
||||
BizObjectManager lrpBom = null;
|
||||
lrpBom = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME,tx);
|
||||
BizObject lppBo = null;
|
||||
String paymentNumber = param.get("paymentNumber");
|
||||
List<BizObject> lrpBos = lrpBom.createQuery("PAYMENT_NUMBER=:paymentNumber order by plan_list").setParameter("paymentNumber",paymentNumber).getResultList(false);
|
||||
for(BizObject bo :lrpBos){
|
||||
String rentPlanId = bo.getAttribute("ID").toString();
|
||||
String interest = bo.getAttribute("INTEREST").toString();
|
||||
String yearRate = bo.getAttribute("YEAR_RATE").toString();
|
||||
String corpusSourceRate = param.get("corpusSourceRate");
|
||||
String profit = new BigDecimal(yearRate).subtract(new BigDecimal(corpusSourceRate)).divide(new BigDecimal(yearRate),6,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(interest)).setScale(2,BigDecimal.ROUND_HALF_UP).toString();
|
||||
lppBo = lppBom.newObject();
|
||||
lppBo.setAttributeValue("rent_plan_id",rentPlanId);
|
||||
lppBo.setAttributeValue("profit",profit);
|
||||
lppBo.setAttributeValue("inputtime",StringFunction.getTodayNow());
|
||||
lppBom.saveObject(lppBo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入分润计划
|
||||
* @param tx
|
||||
* @throws JBOException
|
||||
*/
|
||||
public void insertProfitPlan(JBOTransaction tx) throws Exception {
|
||||
Map<String,String> param = this.getParamByContractId(contractId,tx);
|
||||
this.insertProfitPlan(param,tx);
|
||||
}
|
||||
|
||||
public String getContractId() {
|
||||
return contractId;
|
||||
}
|
||||
|
||||
public void setContractId(String contractId) {
|
||||
this.contractId = contractId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user