项目结算修改
parent
7a5d7e30f0
commit
d92bb2aa3d
|
@ -1,18 +1,26 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
import cn.palmte.work.bean.*;
|
import cn.palmte.work.bean.BudgetSettleBean;
|
||||||
|
import cn.palmte.work.bean.EstimateSettleBean;
|
||||||
|
import cn.palmte.work.bean.FormerBean;
|
||||||
|
import cn.palmte.work.bean.SettleBean;
|
||||||
import cn.palmte.work.model.Project;
|
import cn.palmte.work.model.Project;
|
||||||
import cn.palmte.work.model.ProjectBudgetPlanDetail;
|
import cn.palmte.work.model.ProjectBudgetPlanDetail;
|
||||||
|
import cn.palmte.work.model.ProjectSettleIncome;
|
||||||
|
import cn.palmte.work.model.ProjectSettleIncomeRepository;
|
||||||
import cn.palmte.work.service.ProjectBudgetService;
|
import cn.palmte.work.service.ProjectBudgetService;
|
||||||
import cn.palmte.work.service.ProjectEstimateService;
|
import cn.palmte.work.service.ProjectEstimateService;
|
||||||
import cn.palmte.work.service.ProjectService;
|
import cn.palmte.work.service.ProjectService;
|
||||||
import cn.palmte.work.service.ProjectSettleService;
|
import cn.palmte.work.service.ProjectSettleService;
|
||||||
|
import cn.palmte.work.utils.DateKit;
|
||||||
import cn.palmte.work.utils.FreeMarkerUtil;
|
import cn.palmte.work.utils.FreeMarkerUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -37,16 +45,35 @@ public class ProjectSettleController extends BaseController{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSettleService projectSettleService;
|
private ProjectSettleService projectSettleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
|
||||||
|
|
||||||
@RequestMapping("/add")
|
@RequestMapping("/add")
|
||||||
public String add(@RequestParam("id") int id, Map<String, Object> model) {
|
public String add(@RequestParam("id") int id, Map<String, Object> model) {
|
||||||
Project project = projectService.getProject(id);
|
Project project = projectService.getProject(id);
|
||||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||||
String time = "2021-11";
|
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||||
|
if (projectSettleIncome != null) {
|
||||||
|
String former = projectSettleIncome.getTime();
|
||||||
|
Date date = DateKit.getDate(former, DateKit.DATE_FORMAT);
|
||||||
|
Calendar instance = Calendar.getInstance();
|
||||||
|
instance.setTime(date);
|
||||||
|
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH) + 1);
|
||||||
|
Date current = instance.getTime();
|
||||||
|
String time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||||
model.put("time", time);
|
model.put("time", time);
|
||||||
|
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
||||||
|
} else {
|
||||||
|
String time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
|
||||||
|
|
||||||
|
model.put("time", time);
|
||||||
|
model.put("formerBean", new FormerBean());
|
||||||
|
}
|
||||||
|
|
||||||
model.put("project", project);
|
model.put("project", project);
|
||||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||||
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
|
||||||
//现金表
|
//现金表
|
||||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||||
//freemarker可以利用的静态方法
|
//freemarker可以利用的静态方法
|
||||||
|
@ -57,13 +84,16 @@ public class ProjectSettleController extends BaseController{
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
||||||
Project project = projectService.getProject(id);
|
Project project = projectService.getProject(id);
|
||||||
|
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
|
||||||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||||
String time = "2021-11";
|
String time = projectSettleIncome.getTime();
|
||||||
model.put("time", time);
|
model.put("time", time);
|
||||||
model.put("project", project);
|
model.put("project", project);
|
||||||
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
model.put("estimateBean", projectEstimateService.getEstimate(project));
|
||||||
model.put("budgetBean", projectBudgetService.getBudget(project));
|
model.put("budgetBean", projectBudgetService.getBudget(project));
|
||||||
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
|
||||||
|
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
|
||||||
|
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
|
||||||
//现金表
|
//现金表
|
||||||
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
|
||||||
//freemarker可以利用的静态方法
|
//freemarker可以利用的静态方法
|
||||||
|
|
|
@ -15,4 +15,6 @@ public interface ProjectSettleCashFlowRepository extends JpaRepository<ProjectSe
|
||||||
|
|
||||||
@Query(value = "select * from project_settle_cash_flow where project_id = ?1 and time < ?2", nativeQuery = true)
|
@Query(value = "select * from project_settle_cash_flow where project_id = ?1 and time < ?2", nativeQuery = true)
|
||||||
List<ProjectSettleCashFlow> findAllByProjectIdBefore(int id, String time);
|
List<ProjectSettleCashFlow> findAllByProjectIdBefore(int id, String time);
|
||||||
|
|
||||||
|
List<ProjectSettleCashFlow> findAllByProjectId(int id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,6 @@ public interface ProjectSettleCostManageRepository extends JpaRepository<Project
|
||||||
|
|
||||||
@Query(value = "select * from project_settle_cost_manage where project_id = ?1 and time < ?2", nativeQuery = true)
|
@Query(value = "select * from project_settle_cost_manage where project_id = ?1 and time < ?2", nativeQuery = true)
|
||||||
List<ProjectSettleCostManage> findAllByProjectIdBefore(int id, String time);
|
List<ProjectSettleCostManage> findAllByProjectIdBefore(int id, String time);
|
||||||
|
|
||||||
|
List<ProjectSettleCostManage> findAllByProjectId(int id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,6 @@ public interface ProjectSettleCostRepository extends JpaRepository<ProjectSettle
|
||||||
|
|
||||||
@Query(value = "select * from project_settle_cost where project_id = ?1 and time < ?2", nativeQuery = true)
|
@Query(value = "select * from project_settle_cost where project_id = ?1 and time < ?2", nativeQuery = true)
|
||||||
List<ProjectSettleCost> findAllByProjectIdBefore(int id, String time);
|
List<ProjectSettleCost> findAllByProjectIdBefore(int id, String time);
|
||||||
|
|
||||||
|
List<ProjectSettleCost> findAllByProjectId(int id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,9 @@ public interface ProjectSettleIncomeRepository extends JpaRepository<ProjectSett
|
||||||
|
|
||||||
@Query(value = "select * from project_settle_income where project_id = ?1 and time < ?2", nativeQuery = true)
|
@Query(value = "select * from project_settle_income where project_id = ?1 and time < ?2", nativeQuery = true)
|
||||||
List<ProjectSettleIncome> findAllByProjectIdBefore(int id, String time);
|
List<ProjectSettleIncome> findAllByProjectIdBefore(int id, String time);
|
||||||
|
|
||||||
|
@Query(value = "select * from project_settle_income where project_id = ?1 order by id desc limit 0, 1", nativeQuery = true)
|
||||||
|
ProjectSettleIncome findNewByProjectId(int id);
|
||||||
|
|
||||||
|
List<ProjectSettleIncome> findAllByProjectId(int id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,6 @@ public interface ProjectSettleProfitMarginRepository extends JpaRepository<Proje
|
||||||
|
|
||||||
@Query(value = "select * from project_settle_profit_margin where project_id = ?1 and time < ?2", nativeQuery = true)
|
@Query(value = "select * from project_settle_profit_margin where project_id = ?1 and time < ?2", nativeQuery = true)
|
||||||
List<ProjectSettleProfitMargin> findAllByProjectIdBefore(int id, String time);
|
List<ProjectSettleProfitMargin> findAllByProjectIdBefore(int id, String time);
|
||||||
|
|
||||||
|
List<ProjectSettleProfitMargin> findAllByProjectId(int id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ import org.springframework.stereotype.Service;
|
||||||
import top.jfunc.common.utils.CollectionUtil;
|
import top.jfunc.common.utils.CollectionUtil;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yuanping Zhang
|
* @author Yuanping Zhang
|
||||||
|
@ -369,10 +369,7 @@ public class ProjectSettleService {
|
||||||
projectSettleCashFlowRepository.saveAndFlush(projectSettleNetIncreaseMonetaryFunds);
|
projectSettleCashFlowRepository.saveAndFlush(projectSettleNetIncreaseMonetaryFunds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormerBean getFormerSettle(Project project, String time) {
|
private void getIncomeFormerSettle(FormerBean settleBean, List<ProjectSettleIncome> incomes) {
|
||||||
FormerBean settleBean = new FormerBean();
|
|
||||||
List<ProjectSettleIncome> incomes = projectSettleIncomeRepository.findAllByProjectIdBefore(project.getId(), time);
|
|
||||||
|
|
||||||
if(CollectionUtil.isNotEmpty(incomes)){
|
if(CollectionUtil.isNotEmpty(incomes)){
|
||||||
BigDecimal incomeDevice = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_DEVICE).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal incomeDevice = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_DEVICE).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setIncomeDeviceTaxExclude(incomeDevice);
|
settleBean.setIncomeDeviceTaxExclude(incomeDevice);
|
||||||
|
@ -383,10 +380,9 @@ public class ProjectSettleService {
|
||||||
BigDecimal incomeService = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_SERVICE).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal incomeService = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_SERVICE).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setIncomeServiceTaxExclude(incomeService);
|
settleBean.setIncomeServiceTaxExclude(incomeService);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getCostFormerSettle(FormerBean settleBean, List<ProjectSettleCost> costs) {
|
||||||
List<ProjectSettleCost> costs = projectSettleCostRepository.findAllByProjectIdBefore(project.getId(), time);
|
|
||||||
|
|
||||||
if(CollectionUtil.isNotEmpty(costs)){
|
if(CollectionUtil.isNotEmpty(costs)){
|
||||||
BigDecimal costDevice = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_DEVICE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal costDevice = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_DEVICE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setCostPurchaseDeviceTaxExclude(costDevice);
|
settleBean.setCostPurchaseDeviceTaxExclude(costDevice);
|
||||||
|
@ -406,9 +402,9 @@ public class ProjectSettleService {
|
||||||
BigDecimal costOtherOther = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER_OTHER).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal costOtherOther = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER_OTHER).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setCostOtherOtherTaxExclude(costOtherOther);
|
settleBean.setCostOtherOtherTaxExclude(costOtherOther);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getCostManageFormerSettle(FormerBean settleBean, List<ProjectSettleCostManage> manages) {
|
||||||
List<ProjectSettleCostManage> manages = projectSettleCostManageRepository.findAllByProjectIdBefore(project.getId(), time);
|
|
||||||
if(CollectionUtil.isNotEmpty(manages)){
|
if(CollectionUtil.isNotEmpty(manages)){
|
||||||
BigDecimal costManageExpropriation = manages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_EXPROPRIATION).map(ProjectSettleCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal costManageExpropriation = manages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_EXPROPRIATION).map(ProjectSettleCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setCostExpropriationTaxExclude(costManageExpropriation);
|
settleBean.setCostExpropriationTaxExclude(costManageExpropriation);
|
||||||
|
@ -419,8 +415,9 @@ public class ProjectSettleService {
|
||||||
BigDecimal costIncomeTax = manages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_INCOME_TAX).map(ProjectSettleCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal costIncomeTax = manages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_INCOME_TAX).map(ProjectSettleCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setCostIncomeTax(costIncomeTax);
|
settleBean.setCostIncomeTax(costIncomeTax);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<ProjectSettleProfitMargin> profits = projectSettleProfitMarginRepository.findAllByProjectIdBefore(project.getId(), time);
|
private void getProfitFormerSettle(FormerBean settleBean, List<ProjectSettleProfitMargin> profits) {
|
||||||
if(CollectionUtil.isNotEmpty(profits)) {
|
if(CollectionUtil.isNotEmpty(profits)) {
|
||||||
BigDecimal grossProfit = profits.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_GROSS_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal grossProfit = profits.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_GROSS_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setGrossProfit(grossProfit);
|
settleBean.setGrossProfit(grossProfit);
|
||||||
|
@ -431,8 +428,9 @@ public class ProjectSettleService {
|
||||||
BigDecimal netProfit = profits.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_NET_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal netProfit = profits.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_NET_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setNetProfit(netProfit);
|
settleBean.setNetProfit(netProfit);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<ProjectSettleCashFlow> cashFlows = projectSettleCashFlowRepository.findAllByProjectIdBefore(project.getId(), time);
|
private void getCashFlowFormerSettle(FormerBean settleBean, List<ProjectSettleCashFlow> cashFlows) {
|
||||||
if(CollectionUtil.isNotEmpty(cashFlows)) {
|
if(CollectionUtil.isNotEmpty(cashFlows)) {
|
||||||
BigDecimal saleIncomeCash = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.SALE_INCOME_CASH).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal saleIncomeCash = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.SALE_INCOME_CASH).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setSaleIncomeCash(saleIncomeCash);
|
settleBean.setSaleIncomeCash(saleIncomeCash);
|
||||||
|
@ -476,6 +474,161 @@ public class ProjectSettleService {
|
||||||
BigDecimal netIncreaseMonetaryFunds = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_INCREASE_MONETARY_FUNDS).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal netIncreaseMonetaryFunds = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_INCREASE_MONETARY_FUNDS).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
settleBean.setNetIncreaseMonetaryFunds(netIncreaseMonetaryFunds);
|
settleBean.setNetIncreaseMonetaryFunds(netIncreaseMonetaryFunds);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormerBean getFormerSettle(Project project, String time) {
|
||||||
|
FormerBean settleBean = new FormerBean();
|
||||||
|
List<ProjectSettleIncome> incomes = projectSettleIncomeRepository.findAllByProjectIdBefore(project.getId(), time);
|
||||||
|
|
||||||
|
getIncomeFormerSettle(settleBean, incomes);
|
||||||
|
|
||||||
|
List<ProjectSettleCost> costs = projectSettleCostRepository.findAllByProjectIdBefore(project.getId(), time);
|
||||||
|
|
||||||
|
getCostFormerSettle(settleBean, costs);
|
||||||
|
|
||||||
|
List<ProjectSettleCostManage> manages = projectSettleCostManageRepository.findAllByProjectIdBefore(project.getId(), time);
|
||||||
|
|
||||||
|
getCostManageFormerSettle(settleBean, manages);
|
||||||
|
|
||||||
|
List<ProjectSettleProfitMargin> profits = projectSettleProfitMarginRepository.findAllByProjectIdBefore(project.getId(), time);
|
||||||
|
|
||||||
|
getProfitFormerSettle(settleBean, profits);
|
||||||
|
|
||||||
|
List<ProjectSettleCashFlow> cashFlows = projectSettleCashFlowRepository.findAllByProjectIdBefore(project.getId(), time);
|
||||||
|
|
||||||
|
getCashFlowFormerSettle(settleBean, cashFlows);
|
||||||
|
|
||||||
|
return settleBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SettleBean getMonthSettle(Project project, String time) {
|
||||||
|
SettleBean settleBean = new SettleBean();
|
||||||
|
List<ProjectSettleIncome> incomes = projectSettleIncomeRepository.findAllByProjectIdAndTime(project.getId(), time);
|
||||||
|
if(CollectionUtil.isNotEmpty(incomes)){
|
||||||
|
ProjectSettleIncome projectSettleIncomeDevice = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_DEVICE).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setIncomeDevice(projectSettleIncomeDevice.getIncomeTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleIncome projectSettleIncomeEngineer = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_ENGINEER).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setIncomeEngineer(projectSettleIncomeEngineer.getIncomeTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleIncome projectSettleIncomeService = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_SERVICE).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setIncomeService(projectSettleIncomeService.getIncomeTaxExclude());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ProjectSettleCost> costs = projectSettleCostRepository.findAllByProjectIdAndTime(project.getId(), time);
|
||||||
|
if(CollectionUtil.isNotEmpty(costs)){
|
||||||
|
ProjectSettleCost projectSettleCostDevice = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_DEVICE).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostPurchaseDevice(projectSettleCostDevice.getCostTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleCost projectSettleCostBuild = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_BUILDING).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostPurchaseBuild(projectSettleCostBuild.getCostTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleCost projectSettleCostService = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_SERVICE).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostPurchaseService(projectSettleCostService.getCostTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleCost projectSettleCostOther = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostPurchaseOther(projectSettleCostOther.getCostTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleCost projectSettleCostProjectManage = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_PROJECT_MANAGE).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostProjectManage(projectSettleCostProjectManage.getCostTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleCost projectSettleCostOtherOther = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER_OTHER).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostOther(projectSettleCostOtherOther.getCostTaxExclude());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ProjectSettleCostManage> costManages = projectSettleCostManageRepository.findAllByProjectIdAndTime(project.getId(), time);
|
||||||
|
if(CollectionUtil.isNotEmpty(costManages)){
|
||||||
|
ProjectSettleCostManage costManageExpropriation = costManages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_EXPROPRIATION).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostExpropriation(costManageExpropriation.getCostTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleCostManage costManageCompany = costManages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_COMPANY_MANAGE).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostCompanyManage(costManageCompany.getCostTaxExclude());
|
||||||
|
|
||||||
|
ProjectSettleCostManage costIncomeTax = costManages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_INCOME_TAX).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCostIncomeTax(costIncomeTax.getCostTaxExclude());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ProjectSettleProfitMargin> profitMargins = projectSettleProfitMarginRepository.findAllByProjectIdAndTime(project.getId(), time);
|
||||||
|
if(CollectionUtil.isNotEmpty(profitMargins)){
|
||||||
|
ProjectSettleProfitMargin grossProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_GROSS_PROFIT).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setGrossProfit(grossProfit.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleProfitMargin contributionProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_CONTRIBUTION_PROFIT).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setContributionProfit(contributionProfit.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleProfitMargin netProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_NET_PROFIT).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setNetProfit(netProfit.getAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ProjectSettleCashFlow> cashFlows = projectSettleCashFlowRepository.findAllByProjectIdAndTime(project.getId(), time);
|
||||||
|
if(CollectionUtil.isNotEmpty(cashFlows)){
|
||||||
|
ProjectSettleCashFlow saleIncomeCash = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.SALE_INCOME_CASH).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setSaleIncomeCash(saleIncomeCash.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow taxReturn = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.TAX_RETURN).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setTaxReturn(taxReturn.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow earnestMoneyIncome = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.EARNEST_MONEY_INCOME).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setEarnestMoneyIncome(earnestMoneyIncome.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow purchaseCost = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.PURCHASE_COST).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setPurchaseCost(purchaseCost.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow taxCost = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.TAX_COST).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setTaxCost(taxCost.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow earnestMoneyCost = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.EARNEST_MONEY_COST).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setEarnestMoneyCost(earnestMoneyCost.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow netCashFlow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_CASH_FLOW).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setNetCashFlow(netCashFlow.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow cashInflowFromInvestingActivities = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.CASH_INFLOW_FROM_INVESTING_ACTIVITIES).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCashInflowFromInvestingActivities(cashInflowFromInvestingActivities.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow cashOutflowFromInvestingActivities = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.CASH_OUTFLOW_FROM_INVESTING_ACTIVITIES).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setCashOutflowFromInvestingActivities(cashOutflowFromInvestingActivities.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow netCashFromInvestingActivities = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_CASH_FROM_INVESTING_ACTIVITIES).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setNetCashFromInvestingActivities(netCashFromInvestingActivities.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow financingCapitalInflow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_INFLOW).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setFinancingCapitalInflow(financingCapitalInflow.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow financingCapitalOutflow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_OUTFLOW).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setFinancingCapitalOutflow(financingCapitalOutflow.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow financingCapitalCashflow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_CASHFLOW).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setFinancingCapitalCashflow(financingCapitalCashflow.getAmount());
|
||||||
|
|
||||||
|
ProjectSettleCashFlow netIncreaseMonetaryFunds = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_INCREASE_MONETARY_FUNDS).collect(Collectors.toList()).get(0);
|
||||||
|
settleBean.setNetIncreaseMonetaryFunds(netIncreaseMonetaryFunds.getAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
return settleBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormerBean getCurrentSettle(Project project, String time) {
|
||||||
|
FormerBean settleBean = new FormerBean();
|
||||||
|
List<ProjectSettleIncome> incomes = projectSettleIncomeRepository.findAllByProjectId(project.getId());
|
||||||
|
|
||||||
|
getIncomeFormerSettle(settleBean, incomes);
|
||||||
|
|
||||||
|
List<ProjectSettleCost> costs = projectSettleCostRepository.findAllByProjectId(project.getId());
|
||||||
|
|
||||||
|
getCostFormerSettle(settleBean, costs);
|
||||||
|
|
||||||
|
List<ProjectSettleCostManage> manages = projectSettleCostManageRepository.findAllByProjectId(project.getId());
|
||||||
|
|
||||||
|
getCostManageFormerSettle(settleBean, manages);
|
||||||
|
|
||||||
|
List<ProjectSettleProfitMargin> profits = projectSettleProfitMarginRepository.findAllByProjectId(project.getId());
|
||||||
|
|
||||||
|
getProfitFormerSettle(settleBean, profits);
|
||||||
|
|
||||||
|
List<ProjectSettleCashFlow> cashFlows = projectSettleCashFlowRepository.findAllByProjectId(project.getId());
|
||||||
|
|
||||||
|
getCashFlowFormerSettle(settleBean, cashFlows);
|
||||||
|
|
||||||
return settleBean;
|
return settleBean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +17,7 @@ public class DateKit {
|
||||||
public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||||
public static final String DATE_FORMAT = "yyyy-MM-dd";
|
public static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||||
public static final String DATE_FORMAT_YEAR_MONTH = "yyyyMM";
|
public static final String DATE_FORMAT_YEAR_MONTH = "yyyyMM";
|
||||||
|
public static final String DATE_FORMAT_YEAR_MONTH2 = "yyyy-MM";
|
||||||
|
|
||||||
private DateKit() {
|
private DateKit() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/fourcal?\
|
spring.datasource.url=jdbc:mysql://117.174.24.18:3306/fourcal?\
|
||||||
characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
|
characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&rewriteBatchedStatements=true
|
||||||
spring.datasource.username=root
|
spring.datasource.username=root
|
||||||
spring.datasource.password=zytx123!@#
|
spring.datasource.password=zytx123!@#
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ spring.application.name=fourcal
|
||||||
server.port=8282
|
server.port=8282
|
||||||
server.context-path=/fourcal
|
server.context-path=/fourcal
|
||||||
app.version=0.0.1
|
app.version=0.0.1
|
||||||
spring.profiles.active=local
|
spring.profiles.active=sit
|
||||||
|
|
||||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<div class="am-u-sm-10">
|
<div class="am-u-sm-10">
|
||||||
<div class="am-form am-form-inline">
|
<div class="am-form am-form-inline">
|
||||||
<div class="am-form-group am-form-icon">
|
<div class="am-form-group am-form-icon">
|
||||||
<input type="text" id="time" autocomplete="off" value="${time!}">
|
<input type="text" id="time" autocomplete="off" readonly value="${time!}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<div class="am-u-sm-10">
|
<div class="am-u-sm-10">
|
||||||
<div class="am-form am-form-inline">
|
<div class="am-form am-form-inline">
|
||||||
<div class="am-form-group am-form-icon">
|
<div class="am-form-group am-form-icon">
|
||||||
<input type="text" id="time" autocomplete="off" value="${time!}">
|
<input type="text" id="time" autocomplete="off" readonly value="${time!}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<div class="am-u-sm-10">
|
<div class="am-u-sm-10">
|
||||||
<div class="am-form am-form-inline">
|
<div class="am-form am-form-inline">
|
||||||
<div class="am-form-group am-form-icon">
|
<div class="am-form-group am-form-icon">
|
||||||
<input type="text" id="time" name="time" autocomplete="off" value="${time!}">
|
<input type="text" id="time" name="time" autocomplete="off" readonly value="${time!}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -34,6 +34,14 @@
|
||||||
<div class="am-tabs-bd">
|
<div class="am-tabs-bd">
|
||||||
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
|
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
|
||||||
<input name="id" id="id" type="hidden" value="${project.id}" />
|
<input name="id" id="id" type="hidden" value="${project.id}" />
|
||||||
|
<div class="am-u-sm-10">
|
||||||
|
<div class="am-form am-form-inline">
|
||||||
|
<div class="am-form-group am-form-icon">
|
||||||
|
<input type="text" id="time" name="time" autocomplete="off" readonly value="${time!}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
<span class="am-text-lg">收入</span>
|
<span class="am-text-lg">收入</span>
|
||||||
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
|
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
|
@ -8,6 +8,13 @@
|
||||||
</div>
|
</div>
|
||||||
<!--选项卡(tabs)begin-->
|
<!--选项卡(tabs)begin-->
|
||||||
<div class="am-tabs am-margin" data-am-tabs>
|
<div class="am-tabs am-margin" data-am-tabs>
|
||||||
|
<div class="am-u-sm-10">
|
||||||
|
<div class="am-form am-form-inline">
|
||||||
|
<div class="am-form-group am-form-icon">
|
||||||
|
<input type="text" id="time" name="time" autocomplete="off" readonly value="${time!}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<ul class="am-tabs-nav am-nav am-nav-tabs">
|
<ul class="am-tabs-nav am-nav am-nav-tabs">
|
||||||
<li class="am-active"><a href="#tab1">主要指标</a></li>
|
<li class="am-active"><a href="#tab1">主要指标</a></li>
|
||||||
<li><a href="#tab2">损益表</a></li>
|
<li><a href="#tab2">损益表</a></li>
|
||||||
|
|
Loading…
Reference in New Issue