apzl_leasing/calc/com/tenwa/reckon/bean/KnowingTableBean.java
2018-06-03 22:26:41 +08:00

55 lines
1.6 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.reckon.bean;
import com.tenwa.comm.exception.BusinessException;
import com.tenwa.reckon.util.DateUtils;
public class KnowingTableBean {
//起始期次
private String palnList;
//结束期次
private String plandate;
//计划金额
private String planMoney;
public String getPalnList() {
return palnList;
}
public void setPalnList(String palnList) {
this.palnList = palnList;
}
public String getPlandate() {
return plandate;
}
public void setPlandate(String plandate) {
this.plandate = plandate;
}
public String getPlanMoney() {
return planMoney;
}
public void setPlanMoney(String planMoney) {
this.planMoney = planMoney;
}
public static void checkKnowingTableBean(KnowingTableBean bean,int index) throws BusinessException{
index++;
String intRegex = "[\\+]?\\d+";
String pmoneyRegex = "[-\\+]?\\d+(\\.[0-9]{1,2})?";
if(bean.getPalnList() == null ){
throw new BusinessException(""+index+"行的期项不能为空!");
}else if(!bean.getPalnList().matches(intRegex)){
throw new BusinessException(""+index+"行的期项格式不正确!");
}else if (bean.getPlanMoney() == null){
throw new BusinessException(""+index+"行的金额不能为空!");
}else if(!bean.getPlanMoney().matches(pmoneyRegex)){
throw new BusinessException(""+index+"行的金额格式格式不正确!正确格式为小数点后保留俩位!");
}else if(bean.getPlandate() == null){
throw new BusinessException(""+index+"行的计划日期不能为空!");
}else if(!DateUtils.isValidDate(bean.getPlandate())){
throw new BusinessException(""+index+"行的计划日期格式不正确正确格式为yyyy/MM/dd");
}
}
}