77 lines
3.4 KiB
Java
77 lines
3.4 KiB
Java
package com.tenwa.flow.fund.copyebank;
|
||
|
||
import java.math.BigDecimal;
|
||
import java.util.List;
|
||
|
||
import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP;
|
||
import jbo.app.tenwa.calc.VI_LC_FUND_PLAN;
|
||
|
||
import com.amarsoft.are.jbo.BizObject;
|
||
import com.amarsoft.are.jbo.JBOFactory;
|
||
import com.amarsoft.awe.util.Transaction;
|
||
import com.amarsoft.dict.als.cache.CodeCache;
|
||
import com.tenwa.template.check.DefaultBussinessCheck;
|
||
|
||
public class PaymentCheck extends DefaultBussinessCheck {
|
||
|
||
@Override
|
||
public Object run(Transaction Sqlca) throws Exception {
|
||
String flowunid=this.getAttribute("ObjectNo").toString();
|
||
List<BizObject> boLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME).createQuery("flowunid=:flowunid").setParameter("flowunid", flowunid).getResultList(false);
|
||
boolean flag = true;
|
||
String messageAll = "";
|
||
String message = "";
|
||
if(boLFIT.size() > 0){
|
||
for(BizObject bo:boLFIT){
|
||
flag = true;
|
||
message = "投放编号为【"+bo.getAttribute("payment_number").getString()+"】编号为【"+bo.getAttribute("plan_list").getString()+"】的【"+CodeCache.getItemName("FeeType", bo.getAttribute("fee_type").getString())+"】";
|
||
String fact_money = bo.getAttribute("fact_money").getString();
|
||
String fee_adjust = bo.getAttribute("fee_adjust").getString();
|
||
if("pay_type_out".equals(bo.getAttribute("pay_type").getString())){
|
||
if(new BigDecimal(fact_money).add(new BigDecimal(fee_adjust)).compareTo(new BigDecimal(0)) <= 0){
|
||
message += "付款金额小于等于0!";
|
||
flag = false;
|
||
}
|
||
}
|
||
if("pay_type_out".equals(bo.getAttribute("pay_type").getString()) && !"settlemethod11".equals(bo.getAttribute("settle_method").getString())){
|
||
BizObject boVLFP = JBOFactory.getBizObjectManager(VI_LC_FUND_PLAN.CLASS_NAME).createQuery("payment_number=:payment_number and fee_type=:fee_type and plan_list=:plan_list")
|
||
.setParameter("payment_number", bo.getAttribute("payment_number").getString()).setParameter("fee_type", bo.getAttribute("fee_type").getString()).setParameter("plan_list", bo.getAttribute("plan_list").getString()).getSingleResult(false);
|
||
String overmoney = boVLFP.getAttribute("overmoney").getString();
|
||
if(new BigDecimal(overmoney).compareTo(new BigDecimal(0)) < 0){
|
||
message += "付款金额大于计划余额!";
|
||
flag = false;
|
||
}
|
||
}
|
||
if("pay_type_in".equals(bo.getAttribute("pay_type").getString())){
|
||
if(new BigDecimal(fact_money).add(new BigDecimal(fee_adjust)).compareTo(new BigDecimal(0)) <= 0){
|
||
message += "收款金额小于等于0!";
|
||
flag = false;
|
||
}
|
||
BizObject boVLRP = JBOFactory.getBizObjectManager(VI_LC_FUND_PLAN.CLASS_NAME).createQuery("payment_number=:payment_number and fee_type=:fee_type and plan_list=:plan_list")
|
||
.setParameter("payment_number", bo.getAttribute("payment_number").getString()).setParameter("fee_type", bo.getAttribute("fee_type").getString()).setParameter("plan_list", bo.getAttribute("plan_list").getString()).getSingleResult(false);
|
||
String overmoney = boVLRP.getAttribute("overmoney").getString();
|
||
if(new BigDecimal(overmoney).compareTo(new BigDecimal(0)) < 0){
|
||
message += "货扣金额大于计划余额!";
|
||
flag = false;
|
||
}
|
||
}
|
||
if(!flag){
|
||
messageAll+=message;
|
||
}
|
||
}
|
||
if("".equals(messageAll)){
|
||
putMsg("验证通过!");
|
||
this.setPass(true);
|
||
}else{
|
||
putMsg(messageAll);
|
||
this.setPass(false);
|
||
}
|
||
}else{
|
||
putMsg("验证通过!");
|
||
this.setPass(true);
|
||
}
|
||
return null;
|
||
}
|
||
|
||
}
|