瀏覽代碼

成本测算,必填项校验

qianxb 2 年之前
父節點
當前提交
ca794b0d60

+ 28 - 0
blade-service/blade-control/src/main/java/org/springblade/control/service/impl/ProjectCostBudgetServiceImpl.java

@@ -21,6 +21,7 @@ import org.springblade.control.service.IProjectCostBudgetService;
 import org.springblade.control.service.IProjectInfoService;
 import org.springblade.control.service.IProjectProcessService;
 import org.springblade.control.vo.*;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.SecureUtil;
@@ -60,6 +61,15 @@ public class ProjectCostBudgetServiceImpl extends BaseServiceImpl<ProjectCostBud
         //施工单位
         if (dto.getBuildUnit() != null && dto.getBuildUnit().size() > 0){
             dto.getBuildUnit().stream().forEach(l->{
+                if (l.getDeptId() == null){
+                    throw new ServiceException("请选择费用分摊部门");
+                }
+                if (l.getCostType() == null){
+                    throw new ServiceException("请选择费用分类");
+                }
+                if (l.getProjectProcess() == null){
+                    throw new ServiceException("请选择项目环节");
+                }
               l.setProjectId(dto.getProjectId());
               l.setUnitType(1);
               countMoney(l);
@@ -69,6 +79,15 @@ public class ProjectCostBudgetServiceImpl extends BaseServiceImpl<ProjectCostBud
         //监理单位
         if (dto.getSupervisorUnit() != null && dto.getSupervisorUnit().size() > 0){
             dto.getSupervisorUnit().stream().forEach(l->{
+                if (l.getDeptId() == null){
+                    throw new ServiceException("请选择费用分摊部门");
+                }
+                if (l.getCostType() == null){
+                    throw new ServiceException("请选择费用分类");
+                }
+                if (l.getProjectProcess() == null){
+                    throw new ServiceException("请选择项目环节");
+                }
                 l.setProjectId(dto.getProjectId());
                 l.setUnitType(2);
                 countMoney(l);
@@ -78,6 +97,15 @@ public class ProjectCostBudgetServiceImpl extends BaseServiceImpl<ProjectCostBud
         //建设单位
         if (dto.getConstructUnit() != null && dto.getConstructUnit().size() > 0){
             dto.getConstructUnit().stream().forEach(l->{
+                if (l.getDeptId() == null){
+                    throw new ServiceException("请选择费用分摊部门");
+                }
+                if (l.getCostType() == null){
+                    throw new ServiceException("请选择费用分类");
+                }
+                if (l.getProjectProcess() == null){
+                    throw new ServiceException("请选择项目环节");
+                }
                 l.setProjectId(dto.getProjectId());
                 l.setUnitType(3);
                 countMoney(l);