2018-06-03 22:26:41 +08:00

88 lines
3.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.tenwa.flow.fund.copyebank;
import java.math.BigDecimal;
import java.util.List;
import jbo.app.tenwa.calc.LC_RENT_INCOME_TEMP;
import jbo.app.tenwa.calc.VI_LC_RENT_PLAN;
import com.amarsoft.app.awe.config.InitDBType;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.template.check.DefaultBussinessCheck;
public class RentIncomeCheck extends DefaultBussinessCheck {
@Override
public Object run(Transaction Sqlca) throws Exception {
String flowunid=this.getAttribute("ObjectNo").toString();
List<BizObject> boLRIT = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME).createQuery("flowunid=:flowunid").setParameter("flowunid", flowunid).getResultList(false);
boolean flag = true;
boolean flag1 = false;
String messageAll = "";
String message = "";
if(boLRIT.size() > 0){
for(BizObject bo:boLRIT){
String rent = bo.getAttribute("rent").getString();
String penalty = bo.getAttribute("penalty").getString();
String penaltyAdjust = bo.getAttribute("penalty_adjust").getString();
flag = true;
message = "投放编号为【"+bo.getAttribute("payment_number").getString()+"】编号为【"+bo.getAttribute("plan_list").getInt()+"】的";
if(new BigDecimal(rent).add(new BigDecimal(penalty)).add(new BigDecimal(penaltyAdjust)).compareTo(new BigDecimal(0)) == 0){
message += "收款金额为0";
flag = false;
}
BizObject boVLRP = JBOFactory.getBizObjectManager(VI_LC_RENT_PLAN.CLASS_NAME).createQuery("payment_number=:payment_number and plan_list=:plan_list")
.setParameter("payment_number", bo.getAttribute("payment_number").getString()).setParameter("plan_list", bo.getAttribute("plan_list").getString()).getSingleResult(false);
String rent_over = boVLRP.getAttribute("rent_over").getString();
String corpus_over = boVLRP.getAttribute("corpus_over").getString();
String interest_over = boVLRP.getAttribute("interest_over").getString();
String sql="select getRentPenalty('"+bo.getAttribute("payment_number").getString()+"','"+bo.getAttribute("plan_list").getInt()+"','"+bo.getAttribute("hire_date").getString()+"')";
//if("ORACLE".equals(InitDBType.DBTYPE)){
// sql="select getRentPenalty('"+bo.getAttribute("payment_number").getString()+"','"+bo.getAttribute("plan_list").getInt()+"','"+bo.getAttribute("hire_date").getString()+"') from dual";
//}
String penalty_over = Sqlca.getString(sql);
if(new BigDecimal(rent_over).compareTo(new BigDecimal(0)) < 0){
message += "回笼租金大于计划租金,";
flag = false;
flag1 = true;
}
if(new BigDecimal(corpus_over).compareTo(new BigDecimal(0)) < 0){
message += "回笼本金大于计划本金,";
flag = false;
flag1 = true;
}
if(new BigDecimal(interest_over).compareTo(new BigDecimal(0)) < 0){
message += "回笼利息大于计划利息,";
flag = false;
flag1 = true;
}
if(new BigDecimal(penalty_over).compareTo(new BigDecimal(0)) < 0){
message += "回笼罚息大于计划罚息,";
flag = false;
flag1 = true;
}
if(flag1){
message = message.substring(0,message.length()-1) + "";
}
if(!flag){
messageAll += message;
}
}
if("".equals(messageAll)){
putMsg("验证通过!");
this.setPass(true);
}else{
putMsg(messageAll);
this.setPass(false);
}
}else{
putMsg("验证通过!");
this.setPass(true);
}
return null;
}
}