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!"); } } }