1.资金红冲,租金红冲提交时bug

This commit is contained in:
zhangbb 2020-10-13 18:03:52 +08:00
parent ba7b662ce6
commit d88b4344a7

View File

@ -1,77 +1,78 @@
package com.tenwa.lease.flow.rent.rentreback;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import jbo.app.tenwa.calc.LC_FUND_INCOME;
import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP;
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 com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.lease.flow.comm.service.LeaseFlowBaseService;
import com.tenwa.lease.flow.comm.service.ServiceOperatorEnum;
import com.tenwa.lease.flow.comm.serviceImp.LeaseFlowBaseServiceImp;
public class LCRentIncomeTempToFormalBusiness extends BaseBussiness{
public Object run(Transaction Sqlca) throws Exception{
this.initBussinessParam(Sqlca);
LeaseFlowBaseService service=new LeaseFlowBaseServiceImp();
Map<String,String>fromCondtion=this.getDefaultTempToFormalFromCondtion();
//将正式表中状态改为红冲状态
BizObjectManager fiFormal = JBOFactory.getBizObjectManager(LC_FUND_INCOME.CLASS_NAME);
BizObjectManager fiTemp = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
BizObjectManager riFormal = JBOFactory.getBizObjectManager(LC_RENT_INCOME.CLASS_NAME);
BizObjectManager riTemp = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME);
BizObjectManager bom_lrp = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME);
Sqlca.join(fiFormal);
Sqlca.join(fiTemp);
Sqlca.join(riFormal);
Sqlca.join(riTemp);
Sqlca.join(bom_lrp);
List<BizObject> fits = DataOperatorUtil.getSetJBO(LC_FUND_INCOME_TEMP.CLASS_NAME, fromCondtion, Sqlca);
List<BizObject> rits = DataOperatorUtil.getSetJBO(LC_RENT_INCOME_TEMP.CLASS_NAME, fromCondtion, Sqlca);
String fsql="update O set ROLL_BACK=1 where ID=:ID ";
String tsql="update O set IS_FLOWING=1 where ID=:ID ";
String lsql = "update O set collect_status=:collect_status,collect_msg='租金红冲' where ID=:ID";
Map<String,String>otherProperty=this.getDefaultOtherProperty();
if(fits.size()>0){
for(BizObject fit:fits){
fiFormal.createQuery(fsql).setParameter("ID", fit.getAttribute("INCOME_ID").getString()).executeUpdate();
fiTemp.createQuery(tsql).setParameter("ID", fit.getAttribute("ID").getString()).executeUpdate();
}
service.copyFundIncomeInfo(Sqlca, fromCondtion, null, otherProperty, ServiceOperatorEnum.TempToFormal,null);
}
if(rits.size()>0){
for(BizObject rit:rits){
riFormal.createQuery(fsql).setParameter("ID", rit.getAttribute("INCOME_ID").getString()).executeUpdate();
riTemp.createQuery(tsql).setParameter("ID", rit.getAttribute("ID").getString()).executeUpdate();
}
service.copyRentIncomeInfo(Sqlca, fromCondtion, null, otherProperty, ServiceOperatorEnum.TempToFormal,null);
}
List<BizObject> lrits = riTemp.createQuery("select plan_id from O where flowunid=:flowunid group by plan_id").setParameter("flowunid", this.getAttribute("flowunid").toString()).getResultList(false);
if(lrits.size()>0){
for(BizObject lrit:lrits){
String status = "";
String planId = lrit.getAttribute("plan_id").toString();
BizObject bo_lrp = bom_lrp.createQuery("select rent from O where id=:id").setParameter("id", planId).getSingleResult(false);
BizObject bo_lri = riFormal.createQuery("select sum(rent) as rent from O where plan_id=:plan_id group by plan_id").setParameter("plan_id", planId).getSingleResult(false);
String lriRent = bo_lri.getAttribute("rent").toString();
if(new BigDecimal(lriRent).compareTo(new BigDecimal("0"))==1&&new BigDecimal(lriRent).compareTo(new BigDecimal(bo_lrp.getAttribute("rent").toString()))==-1){
status = "部分收款";
}
bom_lrp.createQuery(lsql).setParameter("collect_status", status).setParameter("ID", planId).executeUpdate();
}
}
String sMessage="true";
return sMessage;
}
}
package com.tenwa.lease.flow.rent.rentreback;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import jbo.app.tenwa.calc.LC_FUND_INCOME;
import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP;
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 com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.lease.flow.comm.service.LeaseFlowBaseService;
import com.tenwa.lease.flow.comm.service.ServiceOperatorEnum;
import com.tenwa.lease.flow.comm.serviceImp.LeaseFlowBaseServiceImp;
public class LCRentIncomeTempToFormalBusiness extends BaseBussiness{
public Object run(Transaction Sqlca) throws Exception{
this.initBussinessParam(Sqlca);
LeaseFlowBaseService service=new LeaseFlowBaseServiceImp();
Map<String,String>fromCondtion=this.getDefaultTempToFormalFromCondtion();
//将正式表中状态改为红冲状态
BizObjectManager fiFormal = JBOFactory.getBizObjectManager(LC_FUND_INCOME.CLASS_NAME);
BizObjectManager fiTemp = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
BizObjectManager riFormal = JBOFactory.getBizObjectManager(LC_RENT_INCOME.CLASS_NAME);
BizObjectManager riTemp = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME);
BizObjectManager bom_lrp = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME);
Sqlca.join(fiFormal);
Sqlca.join(fiTemp);
Sqlca.join(riFormal);
Sqlca.join(riTemp);
Sqlca.join(bom_lrp);
List<BizObject> fits = DataOperatorUtil.getSetJBO(LC_FUND_INCOME_TEMP.CLASS_NAME, fromCondtion, Sqlca);
List<BizObject> rits = DataOperatorUtil.getSetJBO(LC_RENT_INCOME_TEMP.CLASS_NAME, fromCondtion, Sqlca);
String fsql="update O set ROLL_BACK=1 where ID=:ID ";
String tsql="update O set IS_FLOWING=1 where ID=:ID ";
String lsql = "update O set collect_status=:collect_status,collect_msg='租金红冲' where ID=:ID";
Map<String,String>otherProperty=this.getDefaultOtherProperty();
if(fits.size()>0){
for(BizObject fit:fits){
fiFormal.createQuery(fsql).setParameter("ID", fit.getAttribute("INCOME_ID").getString()).executeUpdate();
fiTemp.createQuery(tsql).setParameter("ID", fit.getAttribute("ID").getString()).executeUpdate();
}
service.copyFundIncomeInfo(Sqlca, fromCondtion, null, otherProperty, ServiceOperatorEnum.TempToFormal,null);
}
if(rits.size()>0){
for(BizObject rit:rits){
riFormal.createQuery(fsql).setParameter("ID", rit.getAttribute("INCOME_ID").getString()).executeUpdate();
riTemp.createQuery(tsql).setParameter("ID", rit.getAttribute("ID").getString()).executeUpdate();
}
service.copyRentIncomeInfo(Sqlca, fromCondtion, null, otherProperty, ServiceOperatorEnum.TempToFormal,null);
}
String flowunid= this.getAttribute("FlowUnid").toString();
List<BizObject> lrits = riTemp.createQuery("select plan_id from O where flowunid=:flowunid group by plan_id").setParameter("flowunid", flowunid).getResultList(false);
if(lrits.size()>0){
for(BizObject lrit:lrits){
String status = "";
String planId = lrit.getAttribute("plan_id").toString();
BizObject bo_lrp = bom_lrp.createQuery("select rent from O where id=:id").setParameter("id", planId).getSingleResult(false);
BizObject bo_lri = riFormal.createQuery("select sum(rent) as v.rent from O where plan_id=:plan_id group by plan_id").setParameter("plan_id", planId).getSingleResult(false);
String lriRent = bo_lri.getAttribute("rent").toString();
if(new BigDecimal(lriRent).compareTo(new BigDecimal("0"))==1&&new BigDecimal(lriRent).compareTo(new BigDecimal(bo_lrp.getAttribute("rent").toString()))==-1){
status = "部分收款";
}
bom_lrp.createQuery(lsql).setParameter("collect_status", status).setParameter("ID", planId).executeUpdate();
}
}
String sMessage="true";
return sMessage;
}
}