1.网银收款后,如果代偿状态,部分还款依然为代偿状态

This commit is contained in:
zhangbb 2020-10-12 18:52:42 +08:00
parent 36f4f819d4
commit ba7b662ce6

View File

@ -1,52 +1,53 @@
package com.tenwa.flow.rent.copyrent;
import java.math.BigDecimal;
import java.util.List;
import jbo.app.tenwa.calc.LC_RENT_INCOME;
import jbo.app.tenwa.calc.LC_RENT_INCOME_TEMP;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.com.tenwa.entity.comm.flow.D_DEPOSITCHARGE_INFO;
import jbo.com.tenwa.entity.comm.flow.D_DEPOSITRETURN_INFO;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.collectaudit.cache.CollectAuditInfoCache;
import com.tenwa.flow.baseBussion.BaseBussiness;
public class InsertRentPlanStatus extends BaseBussiness{
public Object run(Transaction Sqlca) throws Exception{
this.initBussinessParam(Sqlca.getTransaction());
String flowunid = (String)this.getAttribute("ObjectNo");
List<BizObject> boLRITs=JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME,"flowunid=:flowunid").setParameter("flowunid", flowunid).getResultList(false);
BizObjectManager bomLRP = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME, Sqlca.getTransaction());
CollectAuditInfoCache calc = new CollectAuditInfoCache();
for(int i=0;i<boLRITs.size();i++){
BizObject boLRIT = boLRITs.get(i);
String contractId = boLRIT.getAttribute("CONTRACT_ID").toString();
String planList = boLRIT.getAttribute("PLAN_LIST").toString();
String rentPlanId = boLRIT.getAttribute("PLAN_ID").toString();
String rent = boLRIT.getAttribute("rent").toString();
calc.writeBackDistributor(rentPlanId, rent, Sqlca);
//判断是否还完
String sSql = "SELECT SUM(IFNULL(O.rent,0)) + SUM(IFNULL(O.penalty,0)) + SUM(IFNULL(O.corpus_adjust,0)) + SUM(IFNULL(O.interest_adjust,0)) + SUM(IFNULL(O.penalty_adjust,0)) - lrp.rent - getRentPenalty(lrp.payment_number,lrp.plan_list,DATE_FORMAT(SYSDATE(),'%Y/%m/%d')) AS flag FROM lc_rent_income O LEFT JOIN LC_RENT_PLAN lrp ON O.plan_id=lrp.id WHERE O.PLAN_ID='"+rentPlanId+"'";
String money = Sqlca.getString(sSql);
BigDecimal balance_money = new BigDecimal(money).setScale(2, BigDecimal.ROUND_HALF_UP);
System.out.println("===========租金差额为: "+money);
if(balance_money.compareTo(new BigDecimal("0"))==-1){
bomLRP.createQuery("update O set COLLECT_STATUS='部分收款',COLLECT_MSG='网银收款' where CONTRACT_ID=:CONTRACT_ID and PLAN_LIST=:PLAN_LIST")
.setParameter("CONTRACT_ID", contractId).setParameter("PLAN_LIST", planList).executeUpdate();
}else{
bomLRP.createQuery("update O set COLLECT_STATUS='网银收款',COLLECT_MSG='网银收款' where CONTRACT_ID=:CONTRACT_ID and PLAN_LIST=:PLAN_LIST")
.setParameter("CONTRACT_ID", contractId).setParameter("PLAN_LIST", planList).executeUpdate();
}
}
String sMessage="true";
return sMessage;
}
}
package com.tenwa.flow.rent.copyrent;
import java.math.BigDecimal;
import java.util.List;
import jbo.app.tenwa.calc.LC_RENT_INCOME;
import jbo.app.tenwa.calc.LC_RENT_INCOME_TEMP;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.com.tenwa.entity.comm.flow.D_DEPOSITCHARGE_INFO;
import jbo.com.tenwa.entity.comm.flow.D_DEPOSITRETURN_INFO;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.collectaudit.cache.CollectAuditInfoCache;
import com.tenwa.flow.baseBussion.BaseBussiness;
public class InsertRentPlanStatus extends BaseBussiness{
public Object run(Transaction Sqlca) throws Exception{
this.initBussinessParam(Sqlca.getTransaction());
String flowunid = (String)this.getAttribute("ObjectNo");
List<BizObject> boLRITs=JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME,"flowunid=:flowunid").setParameter("flowunid", flowunid).getResultList(false);
BizObjectManager bomLRP = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME, Sqlca.getTransaction());
CollectAuditInfoCache calc = new CollectAuditInfoCache();
for(int i=0;i<boLRITs.size();i++){
BizObject boLRIT = boLRITs.get(i);
String contractId = boLRIT.getAttribute("CONTRACT_ID").toString();
String planList = boLRIT.getAttribute("PLAN_LIST").toString();
String rentPlanId = boLRIT.getAttribute("PLAN_ID").toString();
String rent = boLRIT.getAttribute("rent").toString();
calc.writeBackDistributor(rentPlanId, rent, Sqlca);
//判断是否还完
String sSql = "SELECT SUM(IFNULL(O.rent,0)) + SUM(IFNULL(O.penalty,0)) + SUM(IFNULL(O.corpus_adjust,0)) + SUM(IFNULL(O.interest_adjust,0)) + SUM(IFNULL(O.penalty_adjust,0)) - lrp.rent - getRentPenalty(lrp.payment_number,lrp.plan_list,DATE_FORMAT(SYSDATE(),'%Y/%m/%d')) AS flag FROM lc_rent_income O LEFT JOIN LC_RENT_PLAN lrp ON O.plan_id=lrp.id WHERE O.PLAN_ID='"+rentPlanId+"'";
String money = Sqlca.getString(sSql);
BigDecimal balance_money = new BigDecimal(money).setScale(2, BigDecimal.ROUND_HALF_UP);
System.out.println("===========租金差额为: "+money);
//如果为代偿的则依然是代偿状态如果非代偿则状态为部分收款
if(balance_money.compareTo(new BigDecimal("0"))==-1){
bomLRP.createQuery("update O set COLLECT_STATUS='部分收款',COLLECT_MSG='网银收款' where CONTRACT_ID=:CONTRACT_ID and PLAN_LIST=:PLAN_LIST and (collect_status <>'代偿' or collect_status is null)")
.setParameter("CONTRACT_ID", contractId).setParameter("PLAN_LIST", planList).executeUpdate();
}else{
bomLRP.createQuery("update O set COLLECT_STATUS='网银收款',COLLECT_MSG='网银收款' where CONTRACT_ID=:CONTRACT_ID and PLAN_LIST=:PLAN_LIST")
.setParameter("CONTRACT_ID", contractId).setParameter("PLAN_LIST", planList).executeUpdate();
}
}
String sMessage="true";
return sMessage;
}
}