预算格式化和空判断

master
xxssyyyyssxx 2021-11-05 15:05:33 +08:00
parent bdb3064ce8
commit 2afa992665
3 changed files with 68 additions and 57 deletions

View File

@ -117,6 +117,8 @@ public class ProjectController extends BaseController{
model.put("project", project); model.put("project", project);
EstimateBean estimateBean = projectEstimateService.getEstimate(project); EstimateBean estimateBean = projectEstimateService.getEstimate(project);
model.put("estimateBean", estimateBean); model.put("estimateBean", estimateBean);
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_estimate_edit"; return "admin/project_estimate_edit";
} }
@RequestMapping("/estimateEditSave") @RequestMapping("/estimateEditSave")

View File

@ -142,6 +142,7 @@ public class ProjectEstimateService {
EstimateBean estimateBean = new EstimateBean(); EstimateBean estimateBean = new EstimateBean();
List<ProjectEstimateIncome> incomes = projectEstimateIncomeRepository.findAllByProjectIdEquals(project.getId()); List<ProjectEstimateIncome> incomes = projectEstimateIncomeRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(incomes)){
ProjectEstimateIncome projectEstimateIncomeDevice = incomes.stream().filter(d -> d.getType() == ProjectEstimateIncome.TYPE_DEVICE).collect(Collectors.toList()).get(0); ProjectEstimateIncome projectEstimateIncomeDevice = incomes.stream().filter(d -> d.getType() == ProjectEstimateIncome.TYPE_DEVICE).collect(Collectors.toList()).get(0);
estimateBean.setIncomeDeviceTaxInclude(projectEstimateIncomeDevice.getIncomeTaxInclude()); estimateBean.setIncomeDeviceTaxInclude(projectEstimateIncomeDevice.getIncomeTaxInclude());
estimateBean.setIncomeDeviceTaxExclude(projectEstimateIncomeDevice.getIncomeTaxExclude()); estimateBean.setIncomeDeviceTaxExclude(projectEstimateIncomeDevice.getIncomeTaxExclude());
@ -153,9 +154,12 @@ public class ProjectEstimateService {
ProjectEstimateIncome projectEstimateIncomeService = incomes.stream().filter(d -> d.getType() == ProjectEstimateIncome.TYPE_SERVICE).collect(Collectors.toList()).get(0); ProjectEstimateIncome projectEstimateIncomeService = incomes.stream().filter(d -> d.getType() == ProjectEstimateIncome.TYPE_SERVICE).collect(Collectors.toList()).get(0);
estimateBean.setIncomeServiceTaxInclude(projectEstimateIncomeService.getIncomeTaxInclude()); estimateBean.setIncomeServiceTaxInclude(projectEstimateIncomeService.getIncomeTaxInclude());
estimateBean.setIncomeServiceTaxExclude(projectEstimateIncomeService.getIncomeTaxExclude()); estimateBean.setIncomeServiceTaxExclude(projectEstimateIncomeService.getIncomeTaxExclude());
}
List<ProjectEstimateCost> costs = projectEstimateCostRepository.findAllByProjectIdEquals(project.getId()); List<ProjectEstimateCost> costs = projectEstimateCostRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(costs)){
ProjectEstimateCost projectEstimateCostDevice = costs.stream().filter(d -> d.getType() == ProjectEstimateCost.TYPE_DEVICE).collect(Collectors.toList()).get(0); ProjectEstimateCost projectEstimateCostDevice = costs.stream().filter(d -> d.getType() == ProjectEstimateCost.TYPE_DEVICE).collect(Collectors.toList()).get(0);
estimateBean.setCostPurchaseDeviceTaxInclude(projectEstimateCostDevice.getCostTaxInclude()); estimateBean.setCostPurchaseDeviceTaxInclude(projectEstimateCostDevice.getCostTaxInclude());
estimateBean.setCostPurchaseDeviceTaxExclude(projectEstimateCostDevice.getCostTaxExclude()); estimateBean.setCostPurchaseDeviceTaxExclude(projectEstimateCostDevice.getCostTaxExclude());
@ -180,11 +184,16 @@ public class ProjectEstimateService {
estimateBean.setCostOtherOtherTaxInclude(projectEstimateCostOtherOther.getCostTaxInclude()); estimateBean.setCostOtherOtherTaxInclude(projectEstimateCostOtherOther.getCostTaxInclude());
estimateBean.setCostOtherOtherTaxExclude(projectEstimateCostOtherOther.getCostTaxExclude()); estimateBean.setCostOtherOtherTaxExclude(projectEstimateCostOtherOther.getCostTaxExclude());
}
List<ProjectEstimateCostManage> manages = projectEstimateCostManageRepository.findAllByProjectIdEquals(project.getId()); List<ProjectEstimateCostManage> manages = projectEstimateCostManageRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(manages)){
ProjectEstimateCostManage costManageExpropriation = manages.stream().filter(d -> d.getType() == ProjectEstimateCostManage.TYPE_EXPROPRIATION).collect(Collectors.toList()).get(0); ProjectEstimateCostManage costManageExpropriation = manages.stream().filter(d -> d.getType() == ProjectEstimateCostManage.TYPE_EXPROPRIATION).collect(Collectors.toList()).get(0);
estimateBean.setCostExpropriationTaxExclude(costManageExpropriation.getCostTaxExclude()); estimateBean.setCostExpropriationTaxExclude(costManageExpropriation.getCostTaxExclude());
ProjectEstimateCostManage costManageCompany = manages.stream().filter(d -> d.getType() == ProjectEstimateCostManage.TYPE_COMPANY_MANAGE).collect(Collectors.toList()).get(0); ProjectEstimateCostManage costManageCompany = manages.stream().filter(d -> d.getType() == ProjectEstimateCostManage.TYPE_COMPANY_MANAGE).collect(Collectors.toList()).get(0);
estimateBean.setCostCompanyManageTaxExclude(costManageCompany.getCostTaxExclude()); estimateBean.setCostCompanyManageTaxExclude(costManageCompany.getCostTaxExclude());
}
return estimateBean; return estimateBean;
} }

View File

@ -190,26 +190,26 @@
<tr> <tr>
<td>收入</td> <td>收入</td>
<td>设备类</td> <td>设备类</td>
<td><input name="incomeDeviceTaxInclude" value="${estimateBean.incomeDeviceTaxInclude}" required></td> <td><input name="incomeDeviceTaxInclude" value="${Utils.format(estimateBean.incomeDeviceTaxInclude)}" required></td>
<td><input name="incomeDeviceTaxExclude" value="${estimateBean.incomeDeviceTaxExclude}" required></td> <td><input name="incomeDeviceTaxExclude" value="${Utils.format(estimateBean.incomeDeviceTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>收入</td> <td>收入</td>
<td>工程类</td> <td>工程类</td>
<td><input name="incomeEngineerTaxInclude" value="${estimateBean.incomeEngineerTaxInclude}" required></td> <td><input name="incomeEngineerTaxInclude" value="${Utils.format(estimateBean.incomeEngineerTaxInclude)}" required></td>
<td><input name="incomeEngineerTaxExclude" value="${estimateBean.incomeEngineerTaxExclude}" required></td> <td><input name="incomeEngineerTaxExclude" value="${Utils.format(estimateBean.incomeEngineerTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>收入</td> <td>收入</td>
<td>服务类</td> <td>服务类</td>
<td><input name="incomeServiceTaxInclude" value="${estimateBean.incomeServiceTaxInclude}" required></td> <td><input name="incomeServiceTaxInclude" value="${Utils.format(estimateBean.incomeServiceTaxInclude)}" required></td>
<td><input name="incomeServiceTaxExclude" value="${estimateBean.incomeServiceTaxExclude}" required></td> <td><input name="incomeServiceTaxExclude" value="${Utils.format(estimateBean.incomeServiceTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>合计</td> <td>合计</td>
<td></td> <td></td>
<td><input name="incomeTotalTaxInclude" value="${estimateBean.incomeTotalTaxInclude}" readonly title="此列累计"></td> <td><input name="incomeTotalTaxInclude" value="${Utils.format(estimateBean.incomeTotalTaxInclude)}" readonly title="此列累计"></td>
<td><input name="incomeTotalTaxExclude" value="${estimateBean.incomeTotalTaxExclude}" readonly title="此列累计"></td> <td><input name="incomeTotalTaxExclude" value="${Utils.format(estimateBean.incomeTotalTaxExclude)}" readonly title="此列累计"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -227,50 +227,50 @@
<td>成本</td> <td>成本</td>
<td>采购成本</td> <td>采购成本</td>
<td>设备</td> <td>设备</td>
<td><input name="costPurchaseDeviceTaxInclude" value="${estimateBean.costPurchaseDeviceTaxInclude}" required></td> <td><input name="costPurchaseDeviceTaxInclude" value="${Utils.format(estimateBean.costPurchaseDeviceTaxInclude)}" required></td>
<td><input name="costPurchaseDeviceTaxExclude" value="${estimateBean.costPurchaseDeviceTaxExclude}" required></td> <td><input name="costPurchaseDeviceTaxExclude" value="${Utils.format(estimateBean.costPurchaseDeviceTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>采购成本</td> <td>采购成本</td>
<td>施工</td> <td>施工</td>
<td><input name="costPurchaseBuildTaxInclude" value="${estimateBean.costPurchaseBuildTaxInclude}" required></td> <td><input name="costPurchaseBuildTaxInclude" value="${Utils.format(estimateBean.costPurchaseBuildTaxInclude)}" required></td>
<td><input name="costPurchaseBuildTaxExclude" value="${estimateBean.costPurchaseBuildTaxExclude}" required></td> <td><input name="costPurchaseBuildTaxExclude" value="${Utils.format(estimateBean.costPurchaseBuildTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>采购成本</td> <td>采购成本</td>
<td>服务</td> <td>服务</td>
<td><input name="costPurchaseServiceTaxInclude" value="${estimateBean.costPurchaseServiceTaxInclude}" required></td> <td><input name="costPurchaseServiceTaxInclude" value="${Utils.format(estimateBean.costPurchaseServiceTaxInclude)}" required></td>
<td><input name="costPurchaseServiceTaxExclude" value="${estimateBean.costPurchaseServiceTaxExclude}" required></td> <td><input name="costPurchaseServiceTaxExclude" value="${Utils.format(estimateBean.costPurchaseServiceTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>采购成本</td> <td>采购成本</td>
<td>其他</td> <td>其他</td>
<td><input name="costPurchaseOtherTaxInclude" value="${estimateBean.costPurchaseOtherTaxInclude}" required></td> <td><input name="costPurchaseOtherTaxInclude" value="${Utils.format(estimateBean.costPurchaseOtherTaxInclude)}" required></td>
<td><input name="costPurchaseOtherTaxExclude" value="${estimateBean.costPurchaseOtherTaxExclude}" required></td> <td><input name="costPurchaseOtherTaxExclude" value="${Utils.format(estimateBean.costPurchaseOtherTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>项目管理成本</td> <td>项目管理成本</td>
<td>项目管理成本</td> <td>项目管理成本</td>
<td><#--<input name="costProjectManageTaxInclude" value="${estimateBean.costProjectManageTaxInclude}" required>-->/</td> <td><#--<input name="costProjectManageTaxInclude" value="${estimateBean.costProjectManageTaxInclude}" required>-->/</td>
<td><input name="costProjectManageTaxExclude" value="${estimateBean.costProjectManageTaxExclude}" required></td> <td><input name="costProjectManageTaxExclude" value="${Utils.format(estimateBean.costProjectManageTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>其他</td> <td>其他</td>
<td>其他</td> <td>其他</td>
<td><input name="costOtherOtherTaxInclude" value="${estimateBean.costOtherOtherTaxInclude}" required></td> <td><input name="costOtherOtherTaxInclude" value="${Utils.format(estimateBean.costOtherOtherTaxInclude)}" required></td>
<td><input name="costOtherOtherTaxExclude" value="${estimateBean.costOtherOtherTaxExclude}" required></td> <td><input name="costOtherOtherTaxExclude" value="${Utils.format(estimateBean.costOtherOtherTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>合计</td> <td>合计</td>
<td></td> <td></td>
<td></td> <td></td>
<td><input name="costTotalTaxInclude" value="${estimateBean.costTotalTaxInclude}" readonly title="此列累计"></td> <td><input name="costTotalTaxInclude" value="${Utils.format(estimateBean.costTotalTaxInclude)}" readonly title="此列累计"></td>
<td><input name="costTotalTaxExclude" value="${estimateBean.costTotalTaxExclude}" readonly title="此列累计"></td> <td><input name="costTotalTaxExclude" value="${Utils.format(estimateBean.costTotalTaxExclude)}" readonly title="此列累计"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -285,12 +285,12 @@
<tr> <tr>
<td>财务费用</td> <td>财务费用</td>
<td>资金占用成本</td> <td>资金占用成本</td>
<td><input name="costExpropriationTaxExclude" value="${estimateBean.costExpropriationTaxExclude}" required></td> <td><input name="costExpropriationTaxExclude" value="${Utils.format(estimateBean.costExpropriationTaxExclude)}" required></td>
</tr> </tr>
<tr> <tr>
<td>公司管理费用</td> <td>公司管理费用</td>
<td></td> <td></td>
<td><input name="costCompanyManageTaxExclude" value="${estimateBean.costCompanyManageTaxExclude}" required></td> <td><input name="costCompanyManageTaxExclude" value="${Utils.format(estimateBean.costCompanyManageTaxExclude)}" required></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -305,13 +305,13 @@
</tr> </tr>
<tr> <tr>
<td>项目毛利</td> <td>项目毛利</td>
<td><input name="projectGrossProfit" value="${estimateBean.projectGrossProfit}" readonly title="收入总计(不含税)-成本总计(不含税)-财务费用总计(不含税)"></td> <td><input name="projectGrossProfit" value="${Utils.format(estimateBean.projectGrossProfit)}" readonly title="收入总计(不含税)-成本总计(不含税)-财务费用总计(不含税)"></td>
<td><input name="projectGrossProfitRate" value="${estimateBean.projectGrossProfitRate}" readonly title="毛利(不含税)/收入总计(不含税)"></td> <td><input name="projectGrossProfitRate" value="${Utils.format(estimateBean.projectGrossProfitRate)}" readonly title="毛利(不含税)/收入总计(不含税)"></td>
</tr> </tr>
<tr> <tr>
<td>项目贡献利润率</td> <td>项目贡献利润率</td>
<td><input name="projectContributionProfit" value="${estimateBean.projectContributionProfit}" readonly title="项目毛利(不含税)-公司管理费用总计(不含税)"></td> <td><input name="projectContributionProfit" value="${Utils.format(estimateBean.projectContributionProfit)}" readonly title="项目毛利(不含税)-公司管理费用总计(不含税)"></td>
<td><input name="projectContributionProfitRate" value="${estimateBean.projectContributionProfitRate}" readonly title="贡献利润(不含税)/收入总计(不含税)"></td> <td><input name="projectContributionProfitRate" value="${Utils.format(estimateBean.projectContributionProfitRate)}" readonly title="贡献利润(不含税)/收入总计(不含税)"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>