Commit 60c88e7c by huluobin

bug fix

parent eeadc9d1
......@@ -2,6 +2,7 @@ package com.blt.other.module.cost.service.impl.costplan;
import com.bailuntec.common.ListUtil;
import com.bailuntec.cost.api.dto.CostPlanDto;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.*;
import com.blt.other.module.cost.dto.CostPlanApiDto;
......@@ -15,9 +16,9 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
......@@ -63,6 +64,13 @@ public abstract class AbstractCostPlanService implements CostPlanService {
CostDetailDao costDetailDao;
void check(CostPlanDomain planDomain) {
if (planDomain.getPlanAmount().compareTo(BigDecimal.ZERO) <= 0) {
throw new BizRuntimeException("金额必须大于0元");
}
}
/**
* <p>
* 保存填写的财务信息到历史记录
......
......@@ -44,6 +44,7 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
planDomain.setTypeNo(costTypeKindDomain.getTypeNo());
planDomain.setTypeName(costTypeKindDomain.getTypeName());
this.check(planDomain);
costPlanDao.insert(planDomain);
}
......
......@@ -33,10 +33,8 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
this.doSaveFinansyRecord(planDomain);
this.completedCostPlan(planDomain);
planDomain.setCostPlanStatus(0);
if (null == planDomain.getIsTax()) {
planDomain.setIsTax(0);
}
this.check(planDomain);
CostTypeKindDomain costTypeKindDomain = costTypeKindDao.selectByKindNo(planDomain.getKindNo());
planDomain.setKindName(costTypeKindDomain.getKindName());
......
......@@ -40,6 +40,8 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
BigDecimal planAmount = list.stream().map(CostPlanTempDomain::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
planDomain.setPlanAmount(planAmount);
planDomain.setCostPlanStatus(0);
this.check(planDomain);
costPlanDao.insert(planDomain);
}
......
......@@ -36,6 +36,7 @@ public class CostPlanNewReceiptServiceImpl extends AbstractCostPlanService imple
planDomain.setTypeNo(costTypeKindDomain.getTypeNo());
planDomain.setTypeName(costTypeKindDomain.getTypeName());
this.check(planDomain);
costPlanDao.insert(planDomain);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment