diff --git a/src/main/java/cn/palmte/work/bean/FinalBean.java b/src/main/java/cn/palmte/work/bean/FinalBean.java index 7107297..666afe3 100644 --- a/src/main/java/cn/palmte/work/bean/FinalBean.java +++ b/src/main/java/cn/palmte/work/bean/FinalBean.java @@ -1,6 +1,7 @@ package cn.palmte.work.bean; import java.math.BigDecimal; +import java.math.RoundingMode; public class FinalBean { @@ -137,6 +138,10 @@ public class FinalBean { BigDecimal incomeTotal = getIncomeTotal(); BigDecimal costTotal = getCostTotal(); BigDecimal costExpropriationFinalTotal = getCostExpropriationFinalTotal(); + + if (null == incomeTotal || null == costTotal || null == costExpropriationFinalTotal) { + return null; + } return incomeTotal.subtract(costTotal).subtract(costExpropriationFinalTotal); } @@ -150,7 +155,13 @@ public class FinalBean { private BigDecimal grossProfitProfitMargin; public BigDecimal getGrossProfitProfitMargin() { - return grossProfitProfitMargin; + BigDecimal grossProfitFinalTotal = getGrossProfitFinalTotal(); + BigDecimal incomeTotal = getIncomeTotal(); + + if(null == grossProfitFinalTotal || null == incomeTotal){ + return null; + } + return grossProfitFinalTotal.divide(incomeTotal,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); } public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) { @@ -165,6 +176,10 @@ public class FinalBean { public BigDecimal getContributionMarginFinalTotal() { BigDecimal grossProfitFinalTotal = getGrossProfitFinalTotal(); BigDecimal costCompanyManageFinalTotal = getCostCompanyManageFinalTotal(); + + if (null == grossProfitFinalTotal || null == costCompanyManageFinalTotal) { + return null; + } return grossProfitFinalTotal.subtract(costCompanyManageFinalTotal); } @@ -178,7 +193,14 @@ public class FinalBean { private BigDecimal contributionMarginProfitMargin; public BigDecimal getContributionMarginProfitMargin() { - return contributionMarginProfitMargin; + BigDecimal contributionMarginFinalTotal = getContributionMarginFinalTotal(); + BigDecimal incomeTotal = getIncomeTotal(); + + if(null == contributionMarginFinalTotal || null == incomeTotal){ + return null; + } + + return contributionMarginFinalTotal.divide(incomeTotal,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); } public void setContributionMarginProfitMargin(BigDecimal contributionMarginProfitMargin) { @@ -193,6 +215,9 @@ public class FinalBean { public BigDecimal getNetMarginFinalTotal() { BigDecimal contributionMarginFinalTotal = getContributionMarginFinalTotal(); BigDecimal costIncomeTaxFinalTotal = getCostIncomeTaxFinalTotal(); + if (null == contributionMarginFinalTotal || null == costIncomeTaxFinalTotal) { + return null; + } return contributionMarginFinalTotal.subtract(costIncomeTaxFinalTotal); } @@ -206,7 +231,13 @@ public class FinalBean { private BigDecimal netMarginProfitMargin; public BigDecimal getNetMarginProfitMargin() { - return netMarginProfitMargin; + BigDecimal netMarginFinalTotal = getNetMarginFinalTotal(); + BigDecimal incomeTotal = getIncomeTotal(); + + if(null == netMarginFinalTotal || null == incomeTotal){ + return null; + } + return netMarginFinalTotal.divide(incomeTotal,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); } public void setNetMarginProfitMargin(BigDecimal netMarginProfitMargin) { @@ -254,6 +285,11 @@ public class FinalBean { BigDecimal taxCost = getTaxCost(); BigDecimal earnestMoneyCost = getEarnestMoneyCost(); + if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome || + null == purchaseCost || null == taxCost || null == earnestMoneyCost) { + return null; + } + return saleIncomeCash .add(taxReturn) .add(earnestMoneyIncome) @@ -295,6 +331,10 @@ public class FinalBean { public BigDecimal getFinancingCapitalCashflow() { BigDecimal financingCapitalInflow = getFinancingCapitalInflow(); BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow(); + + if (null == financingCapitalInflow || null == financingCapitalOutflow) { + return null; + } return financingCapitalInflow.subtract(financingCapitalOutflow); } @@ -312,6 +352,10 @@ public class FinalBean { BigDecimal netCashFlow = getNetCashFlow(); BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities(); BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow(); + + if (null == netCashFlow || null == netCashFromInvestingActivities || null == financingCapitalCashflow) { + return null; + } return netCashFlow .add(netCashFromInvestingActivities) .add(financingCapitalCashflow); @@ -323,6 +367,7 @@ public class FinalBean { /** * 获取所有现金流量决算总额 + * * @return */ public BigDecimal getCashFluxTotal() { diff --git a/src/main/java/cn/palmte/work/bean/FormerBean.java b/src/main/java/cn/palmte/work/bean/FormerBean.java index b491c83..1c1d7e6 100644 --- a/src/main/java/cn/palmte/work/bean/FormerBean.java +++ b/src/main/java/cn/palmte/work/bean/FormerBean.java @@ -101,6 +101,67 @@ public class FormerBean extends IncomeCostBean{ */ private BigDecimal cashFlowTotal; + /** + * 项目毛利利润率 + */ + private BigDecimal grossProfitProfitMargin; + + public BigDecimal getGrossProfitProfitMargin() { + // 100 * grossProfit() / getIncomeTotalTaxExclude() + BigDecimal grossProfit = getGrossProfit(); + BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude(); + + if (null == grossProfit || null == incomeTotalTaxExclude) { + return handleSpecial(null); + } + return grossProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100)); + } + + public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) { + this.grossProfitProfitMargin = grossProfitProfitMargin; + } + + /** + *项目贡献利润利润率 + */ + private BigDecimal contributionProfitProfitMargin; + + public BigDecimal getContributionProfitProfitMargin() { + //100 * contributionProfit() / getIncomeTotalTaxExclude() + BigDecimal contributionProfit = getContributionProfit(); + BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude(); + + if (null == contributionProfit || null == incomeTotalTaxExclude) { + return handleSpecial(null); + } + return contributionProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100)); + + } + + public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) { + this.contributionProfitProfitMargin = contributionProfitProfitMargin; + } + + /** + * 项目净利润利润率 + */ + private BigDecimal netProfitProfitMargin; + + public BigDecimal getNetProfitProfitMargin() { + //100 * netProfit() / getIncomeTotalTaxExclude() + BigDecimal netProfit = getNetProfit(); + BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude(); + + if (null == netProfit || null == incomeTotalTaxExclude) { + return handleSpecial(null); + } + return netProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100)); + } + + public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) { + this.netProfitProfitMargin = netProfitProfitMargin; + } + public BigDecimal getCostIncomeTax() { return costIncomeTax; } diff --git a/src/main/java/cn/palmte/work/bean/ProfitAndLossBean.java b/src/main/java/cn/palmte/work/bean/ProfitAndLossBean.java new file mode 100644 index 0000000..9fa21ca --- /dev/null +++ b/src/main/java/cn/palmte/work/bean/ProfitAndLossBean.java @@ -0,0 +1,80 @@ +package cn.palmte.work.bean; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 损益表数据 + */ +@Data +public class ProfitAndLossBean { + + private String title; + + /** + * 营业收入 + */ + private BigDecimal income; + + /** + * 营业成本 + */ + private BigDecimal cost; + + /** + * 项目管理成本 + */ + private BigDecimal manageCost; + + /** + * 其他 + */ + private BigDecimal other; + + /** + * 财务费用 + */ + private BigDecimal expropriation; + + /** + * 项目毛利 + */ + private BigDecimal grossProfit; + + /** + * 项目毛利率 + */ + private BigDecimal grossProfitProfit; + + /** + * 公司管理费用 + */ + private BigDecimal CompanyManage; + + /** + * 项目贡献利润 + */ + private BigDecimal contributionMargin; + + /** + * 项目贡献利润率 + */ + private BigDecimal contributionMarginProfit; + + /** + * 所得税费用 + */ + private BigDecimal incomeTax; + + /** + * 项目净利润 + */ + private BigDecimal netMargin; + + /** + * 项目净利润率 + */ + private BigDecimal netMarginProfit; + +} diff --git a/src/main/java/cn/palmte/work/bean/StatisticsBean.java b/src/main/java/cn/palmte/work/bean/StatisticsBean.java new file mode 100644 index 0000000..3afc85d --- /dev/null +++ b/src/main/java/cn/palmte/work/bean/StatisticsBean.java @@ -0,0 +1,16 @@ +package cn.palmte.work.bean; + +import lombok.Data; + +import java.util.List; + +@Data +public class StatisticsBean { + + private List primaryIndicatorBeanList; + + private List profitAndLossBeanList; + + private List cashFlowStatisticsBeanList; + +} diff --git a/src/main/java/cn/palmte/work/controller/backend/AccountController.java b/src/main/java/cn/palmte/work/controller/backend/AccountController.java index a359ce1..aba1695 100644 --- a/src/main/java/cn/palmte/work/controller/backend/AccountController.java +++ b/src/main/java/cn/palmte/work/controller/backend/AccountController.java @@ -139,8 +139,8 @@ public class AccountController extends BaseController { accountService.saveOrUpdateAccount(userId, admin.getRoleId(), admin, privateKey); } catch (Exception e) { - logger.error("保存账号出错!" + e.toString()); - return "新增账号出错!请联系管理员处理!"; + model.put("errorMessage", "保存账号出错!请联系管理员处理"); + return "/common/error"; } return "redirect:/account/list"; } @@ -224,7 +224,7 @@ public class AccountController extends BaseController { Map searchInfo = getSearchInfo(keywords); downloadHeader(httpServletResponse, Utils.generateExcelName("人员信息"), "application/octet-stream"); String[] headers = {"工号", "手机号码", "姓名", "常驻地", "一级部门", "直接主管", "职位", "所属角色", "公司邮件地址"}; - String[] exportColumns = {"empCode", "telephone", "realName", "workLocation", "deptName", "directManager", "positionName", "roleName", "companyEmail"}; + String[] exportColumns = {"userName", "telephone", "realName", "workLocation", "deptName", "directManager", "positionName", "roleName", "companyEmail"}; ExportUtils.exportToExcel(headers, exportColumns, 1, 10000, httpServletResponse.getOutputStream(), (pN, pS) -> accountService.list(searchInfo, pN, pS).getList()); } @@ -235,7 +235,7 @@ public class AccountController extends BaseController { @RequestMapping("/template") public void template(HttpServletResponse response) throws Exception { - String[] headers = new String[]{"工号", "手机号码", "登录名称", "姓名", "常驻地", "一级部门", "直接主管", "职位", "所属角色", "公司邮件地址"}; + String[] headers = new String[]{"工号", "手机号码", "姓名", "常驻地", "一级部门", "直接主管", "职位", "所属角色", "公司邮件地址"}; downloadHeader(response, Utils.generateExcelName("人员信息批量导入模板")); ExportUtils exportUtils = new ExportUtils(headers); exportUtils.write(response.getOutputStream()); diff --git a/src/main/java/cn/palmte/work/controller/backend/ProjectController.java b/src/main/java/cn/palmte/work/controller/backend/ProjectController.java index 3b9335a..be1b8d6 100644 --- a/src/main/java/cn/palmte/work/controller/backend/ProjectController.java +++ b/src/main/java/cn/palmte/work/controller/backend/ProjectController.java @@ -66,6 +66,8 @@ public class ProjectController extends BaseController { private ProjectSettleService projectSettleService; @Autowired private ProcurementTypeService procurementTypeService; + @Autowired + private ProjectSettleIncomeRepository projectSettleIncomeRepository; /** * 项目列表 @@ -335,19 +337,19 @@ public class ProjectController extends BaseController { */ @RequestMapping("/approve") public String approve(@RequestParam("id") int id, @RequestParam String listFrom, Map model) { - String time = "2021-11"; Project project = projectService.getProject(id); - EstimateBean estimateBean = projectEstimateService.getEstimate(project); - model.put("estimateBean", estimateBean); + + //项目信息 model.put("adminId", InterfaceUtil.getAdminId()); model.put("project", project); - model.put("formerBean", projectSettleService.getFormerSettle(project, time)); - model.put("monthBean", projectSettleService.getMonthSettle(project, time)); - model.put("currentBean", projectSettleService.getCurrentSettle(project, time)); - model.put("time", time); model.put("listFrom", listFrom); + + //概算信息 + EstimateBean estimateBean = projectEstimateService.getEstimate(project); + model.put("estimateBean", estimateBean); + + //预算信息 BudgetBean budgetBean = projectBudgetService.getBudget(project); - //预算主页面数据 model.put("budgetBean", budgetBean); //收入明细 model.put("incomeDetails", projectBudgetService.getBudgetIncomeDetail(project)); @@ -364,11 +366,32 @@ public class ProjectController extends BaseController { model.put("underwrittenPlanStatistic", projectBudgetService.getProjectUnderwrittenPlanStatisticBean(projectBudgetPlanDetails)); //现金表 model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails)); + + //结算信息 + ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id); + String time = ""; + if(null == projectSettleIncome){ + model.put("time", time); + }else { + time = projectSettleIncome.getTime(); + model.put("time", time); + } + model.put("formerBean", projectSettleService.getFormerSettle(project, time)); + model.put("monthBean", projectSettleService.getMonthSettle(project, time)); + model.put("currentBean", projectSettleService.getCurrentSettle(project, time)); + + //决算信息 model.put("finalBean", projectFinalSevice.getFinal(project)); + //freemarker可以利用的静态方法 model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils")); + + //审核记录 List list = projectTaskRecordService.list(id); - model.put("taskRecords", list); + if (!list.isEmpty()) { + model.put("taskRecords", list); + } + return "admin/project_approve"; } @@ -470,6 +493,16 @@ public class ProjectController extends BaseController { return ResponseMsg.buildSuccessMsg("成功"); } + + /** + * 删除草稿状态下的概算项目 + */ + @GetMapping("/deleteProject/{id}") + @ResponseBody + public ResponseMsg deleteProject(@PathVariable int id) { + return projectService.deleteProject(id); + } + @InitBinder public void initBinder(WebDataBinder webDataBinder) { webDataBinder.addCustomFormatter(new DateFormatter("yyyy-MM-dd")); diff --git a/src/main/java/cn/palmte/work/controller/backend/StatisticsController.java b/src/main/java/cn/palmte/work/controller/backend/StatisticsController.java index e479455..f085742 100644 --- a/src/main/java/cn/palmte/work/controller/backend/StatisticsController.java +++ b/src/main/java/cn/palmte/work/controller/backend/StatisticsController.java @@ -2,6 +2,7 @@ package cn.palmte.work.controller.backend; import cn.palmte.work.bean.CashFlowStatisticsBean; import cn.palmte.work.bean.PrimaryIndicatorBean; +import cn.palmte.work.bean.StatisticsBean; import cn.palmte.work.service.StatisticsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -19,10 +20,10 @@ public class StatisticsController extends BaseController{ @RequestMapping("/month") public String month(Map model){ - List primaryIndicatorList = statisticsService.getPrimaryIndicator(); - List cashFlowList = statisticsService.getCashFlow(); - model.put("primaryIndicatorList",primaryIndicatorList); - model.put("cashFlowList",cashFlowList); + StatisticsBean statisticsData = statisticsService.getStatisticsData(); + model.put("primaryIndicatorList",statisticsData.getPrimaryIndicatorBeanList()); + model.put("profitAndLossList",statisticsData.getProfitAndLossBeanList()); + model.put("cashFlowList",statisticsData.getCashFlowStatisticsBeanList()); return "admin/month_statistics"; } diff --git a/src/main/java/cn/palmte/work/model/ProjectEstimateCostManageRepository.java b/src/main/java/cn/palmte/work/model/ProjectEstimateCostManageRepository.java index d9bbe0b..d002349 100644 --- a/src/main/java/cn/palmte/work/model/ProjectEstimateCostManageRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectEstimateCostManageRepository.java @@ -6,4 +6,6 @@ import java.util.List; public interface ProjectEstimateCostManageRepository extends JpaRepository { List findAllByProjectIdEquals(int id); + + int deleteByProjectId(int pId); } diff --git a/src/main/java/cn/palmte/work/model/ProjectEstimateCostRepository.java b/src/main/java/cn/palmte/work/model/ProjectEstimateCostRepository.java index 7af11be..f9711d5 100644 --- a/src/main/java/cn/palmte/work/model/ProjectEstimateCostRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectEstimateCostRepository.java @@ -6,4 +6,6 @@ import java.util.List; public interface ProjectEstimateCostRepository extends JpaRepository { List findAllByProjectIdEquals(int id); + + int deleteByProjectId(int pId); } diff --git a/src/main/java/cn/palmte/work/model/ProjectEstimateIncomeRepository.java b/src/main/java/cn/palmte/work/model/ProjectEstimateIncomeRepository.java index 2b51c2b..30d5b23 100644 --- a/src/main/java/cn/palmte/work/model/ProjectEstimateIncomeRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectEstimateIncomeRepository.java @@ -6,4 +6,6 @@ import java.util.List; public interface ProjectEstimateIncomeRepository extends JpaRepository { List findAllByProjectIdEquals(int id); + + int deleteByProjectId(int piId); } diff --git a/src/main/java/cn/palmte/work/model/ProjectFinalProfitMargin.java b/src/main/java/cn/palmte/work/model/ProjectFinalProfitMargin.java index 62b545e..d1ad7a9 100644 --- a/src/main/java/cn/palmte/work/model/ProjectFinalProfitMargin.java +++ b/src/main/java/cn/palmte/work/model/ProjectFinalProfitMargin.java @@ -53,6 +53,20 @@ public class ProjectFinalProfitMargin { @Column(name = "final_total_profit_margin") private BigDecimal finalTotalProfitMargin; + /** + * 利润率 + */ + @Column(name = "profit_margin") + private BigDecimal profitMargin; + + public BigDecimal getProfitMargin() { + return profitMargin; + } + + public void setProfitMargin(BigDecimal profitMargin) { + this.profitMargin = profitMargin; + } + public Integer getId() { return id; } @@ -77,5 +91,35 @@ public class ProjectFinalProfitMargin { this.type = type; } + public BigDecimal getEstimateTotalProfitMargin() { + return estimateTotalProfitMargin; + } + public void setEstimateTotalProfitMargin(BigDecimal estimateTotalProfitMargin) { + this.estimateTotalProfitMargin = estimateTotalProfitMargin; + } + + public BigDecimal getBudgetTotalProfitMargin() { + return budgetTotalProfitMargin; + } + + public void setBudgetTotalProfitMargin(BigDecimal budgetTotalProfitMargin) { + this.budgetTotalProfitMargin = budgetTotalProfitMargin; + } + + public BigDecimal getSettleTotalProfitMargin() { + return settleTotalProfitMargin; + } + + public void setSettleTotalProfitMargin(BigDecimal settleTotalProfitMargin) { + this.settleTotalProfitMargin = settleTotalProfitMargin; + } + + public BigDecimal getFinalTotalProfitMargin() { + return finalTotalProfitMargin; + } + + public void setFinalTotalProfitMargin(BigDecimal finalTotalProfitMargin) { + this.finalTotalProfitMargin = finalTotalProfitMargin; + } } \ No newline at end of file diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleProfitMargin.java b/src/main/java/cn/palmte/work/model/ProjectSettleProfitMargin.java index c903cae..b53bc5b 100644 --- a/src/main/java/cn/palmte/work/model/ProjectSettleProfitMargin.java +++ b/src/main/java/cn/palmte/work/model/ProjectSettleProfitMargin.java @@ -44,6 +44,17 @@ public class ProjectSettleProfitMargin { @Column(name = "budget") private BigDecimal budget; + @Column(name = "profit_margin") + private BigDecimal profitMargin; + + public BigDecimal getProfitMargin() { + return profitMargin; + } + + public void setProfitMargin(BigDecimal profitMargin) { + this.profitMargin = profitMargin; + } + public Integer getId() { return id; } diff --git a/src/main/java/cn/palmte/work/service/AccountService.java b/src/main/java/cn/palmte/work/service/AccountService.java index 4e63ac6..45f08e5 100644 --- a/src/main/java/cn/palmte/work/service/AccountService.java +++ b/src/main/java/cn/palmte/work/service/AccountService.java @@ -134,7 +134,7 @@ public class AccountService { oldAdmin.setRealName(admin.getRealName()); oldAdmin.setDeptName(dept.getName()); oldAdmin.setPositionName(userPosition.getPositionName()); - oldAdmin.setEmpCode(admin.getEmpCode()); + //oldAdmin.setEmpCode(admin.getEmpCode()); oldAdmin.setWorkLocation(admin.getWorkLocation()); oldAdmin.setDirectManager(admin.getDirectManager()); oldAdmin.setCompanyEmail(admin.getCompanyEmail()); @@ -174,7 +174,7 @@ public class AccountService { } //工号重复校验 - Admin empCode = adminRepository.findByEmpCode(admin.getEmpCode()); + /*Admin empCode = adminRepository.findByEmpCode(admin.getEmpCode()); if (userId == -1) { if (null != empCode) { message = "该工号已存在!"; @@ -185,7 +185,7 @@ public class AccountService { message = "该工号已存在!"; return message; } - } + }*/ //手机号重复校验 Admin byTelephoneEquals = adminRepository.findByTelephone(phone); @@ -202,18 +202,18 @@ public class AccountService { } if (StringUtils.isEmpty(admin.getUserName())) { - message = "登录名不能为空!"; + message = "工号不能为空!"; return message; } Admin existAdmin = adminRepository.getAdminByUsername(admin.getUserName()); if (userId == -1) { if (existAdmin != null) { - message = "该登录名称已存在!"; + message = "该工号已存在!"; return message; } } else { if (existAdmin != null && existAdmin.getId() != userId) { - message = "该登录名称已存在!"; + message = "该工号已存在!"; return message; } } @@ -304,7 +304,7 @@ public class AccountService { throw new Exception("工号不能为空"); } - Admin byEmpCode = adminRepository.findByEmpCode(empCode.toString()); + Admin byEmpCode = adminRepository.getAdminByUsername(empCode.toString()); if (null != byEmpCode) { throw new Exception("工号" + empCode.toString() + "已存在"); @@ -320,7 +320,7 @@ public class AccountService { throw new Exception("手机号码" + telephone.toString() + "已存在"); } - Object userName = m.get("登录名称"); + /*Object userName = m.get("登录名称"); if (userName == null || StrKit.isBlank(userName.toString())) { throw new Exception("登录名称不能为空"); } @@ -328,7 +328,7 @@ public class AccountService { Admin byUsername = adminRepository.getAdminByUsername(userName.toString()); if (null != byUsername) { throw new Exception("登录名称" + byUsername.toString() + "已存在"); - } + }*/ Object realName = m.get("姓名"); if (realName == null || StrKit.isBlank(realName.toString())) { @@ -389,9 +389,10 @@ public class AccountService { } admin = new Admin(); - admin.setEmpCode(empCode.toString()); + //admin.setEmpCode(empCode.toString()); admin.setTelephone(telephone.toString()); - admin.setUserName(userName.toString()); + admin.setUserName(empCode.toString()); + admin.setRealName(realName.toString()); admin.setWorkLocation(workLocation.toString()); admin.setDeptId(dept.getId()); admin.setDeptName(dept.getName()); @@ -399,7 +400,7 @@ public class AccountService { admin.setPositionId(userPosition.getId()); admin.setPositionName(userPosition.getPositionName()); admin.setRoleId(role.getId()); - admin.setRealName(role.getName()); + admin.setRoleName(role.getName()); admin.setCompanyEmail(companyEmail.toString()); String salt = RandomStringUtils.randomAlphanumeric(6).toUpperCase(); diff --git a/src/main/java/cn/palmte/work/service/HumanCostService.java b/src/main/java/cn/palmte/work/service/HumanCostService.java index a1518e0..c80fadc 100644 --- a/src/main/java/cn/palmte/work/service/HumanCostService.java +++ b/src/main/java/cn/palmte/work/service/HumanCostService.java @@ -2,6 +2,7 @@ package cn.palmte.work.service; import cn.palmte.work.bean.ResponseMsg; import cn.palmte.work.model.*; +import cn.palmte.work.utils.DateKit; import cn.palmte.work.utils.InterfaceUtil; import cn.palmte.work.utils.StrKit; import org.slf4j.Logger; @@ -70,6 +71,16 @@ public class HumanCostService { return list; } + public static void main(String[] args) { + String date = "2021-12"; + Date date1 = DateKit.getDate(date, DateKit.DATE_FORMAT_YEAR_MONTH2); + if (date1.getTime() - System.currentTimeMillis() > 0) { + System.out.println(date1.getTime() - System.currentTimeMillis()); + } else { + System.out.println(date1.getTime()); + } + } + @Transactional(rollbackFor = Exception.class) public ResponseMsg check(Collection excelMap, Map title, String date) { int successCount = 0; @@ -82,6 +93,12 @@ public class HumanCostService { Map staffCost = new HashMap<>(); List saveList = new ArrayList<>(); + Date date1 = DateKit.getDate(date, DateKit.DATE_FORMAT_YEAR_MONTH2); + if (date1.getTime() - System.currentTimeMillis() > 0) { + ResponseMsg msg = ResponseMsg.buildFailedMsg("填写日期须小于当前日期!"); + msg.setData(errorList); + return msg; + } if(excelMap.size() == 0){ ResponseMsg msg = ResponseMsg.buildFailedMsg("请填写人力成本数据!"); msg.setData(errorList); @@ -184,11 +201,6 @@ public class HumanCostService { return msg; } - public static void main(String[] args) { - System.out.println("0.66".matches("(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){1,2})?")); - System.out.println("0.66".matches("(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){1,2})?")); - } - public String[] getHeaders(List staff) { String[] headers = new String[staff.size() + 3]; headers[0] = "项目名称"; @@ -229,16 +241,16 @@ public class HumanCostService { Admin admin = InterfaceUtil.getAdmin(); List projectList = null; if (admin.getRoleLevel() <= 2 || admin.getRoleLevel() == 4) { - String sql = "select proj.id, proj.name from project proj where proj.status = ? order by proj.id asc"; - projectList = pagination.find(sql, Project.class, Project.STATUS_SETTLE); + String sql = "select proj.id, proj.name from project proj where (proj.status = ? or (proj.status = ? and proj.approve_status_budget = ?)) order by proj.id asc"; + projectList = pagination.find(sql, Project.class, Project.STATUS_SETTLE, Project.STATUS_BUDGET, 2); } else { - String sql = "select proj.id, proj.name from project proj where proj.status = ? and " + + String sql = "select proj.id, proj.name from project proj where (proj.status = ? or (proj.status = ? and proj.approve_status_budget = ?)) and " + " (proj.creator_id=? OR proj.id in (SELECT pv1.project_id FROM project_visible pv1 WHERE pv1.type=1 AND pv1.tid=? UNION SELECT pv2.project_id FROM project_visible pv2 WHERE pv2.type=2 AND pv2.tid=?)) order by proj.id asc"; //项目可见性,根据角色和人员id int roleId = admin.getRoleId(); Integer adminId = admin.getId(); //自己创建的肯定能看见 - projectList = pagination.find(sql, Project.class, Project.STATUS_SETTLE, adminId, roleId, adminId); + projectList = pagination.find(sql, Project.class, Project.STATUS_SETTLE, Project.STATUS_BUDGET, 2, adminId, roleId, adminId); } for (Project project : projectList) { data.add(project.getName()); diff --git a/src/main/java/cn/palmte/work/service/ProjectEstimateService.java b/src/main/java/cn/palmte/work/service/ProjectEstimateService.java index 9487a1a..2cae490 100644 --- a/src/main/java/cn/palmte/work/service/ProjectEstimateService.java +++ b/src/main/java/cn/palmte/work/service/ProjectEstimateService.java @@ -63,6 +63,15 @@ public class ProjectEstimateService { costManage(project, estimateBean); } + public void deleteEstimate(int projectId){ + //删除收入记录 + projectEstimateIncomeRepository.deleteByProjectId(projectId); + //删除成本记录 + projectEstimateCostRepository.deleteByProjectId(projectId); + //删除管理记录 + projectEstimateCostManageRepository.deleteByProjectId(projectId); + } + private void cost(Project project, EstimateBean estimateBean) { ProjectEstimateCost projectEstimateCostDevice = new ProjectEstimateCost(); projectEstimateCostDevice.setProjectId(project.getId()); diff --git a/src/main/java/cn/palmte/work/service/ProjectFinalSevice.java b/src/main/java/cn/palmte/work/service/ProjectFinalSevice.java index 21ceaeb..0adcfa4 100644 --- a/src/main/java/cn/palmte/work/service/ProjectFinalSevice.java +++ b/src/main/java/cn/palmte/work/service/ProjectFinalSevice.java @@ -55,6 +55,9 @@ public class ProjectFinalSevice { @Autowired private ProjectSettleService projectSettleService; + @Autowired + private ProjectFinalProfitMarginRepository projectFinalProfitMarginRepository; + @Transactional public void save(Project project, FinalBean finalBean) { //预算表数据 @@ -76,6 +79,9 @@ public class ProjectFinalSevice { //保存项目结算管理成本信息 saveProjectFinalCostManage(project,finalBean,estimate,budget,settle); + //保存项目决算利润率 + saveProjectFinalProfitMargin(project,finalBean,estimate,budget,settle); + //保存项目结算现金流量信息 saveProjectFinalCashFlux(project,finalBean,cashFlowBean,settle); @@ -103,6 +109,9 @@ public class ProjectFinalSevice { //保存项目结算管理成本信息 saveProjectFinalCostManage(project,finalBean,estimate,budget,settle); + //保存项目决算利润率 + saveProjectFinalProfitMargin(project,finalBean,estimate,budget,settle); + //保存项目结算现金流量信息 saveProjectFinalCashFlux(project,finalBean,cashFlowBean,settle); @@ -113,6 +122,38 @@ public class ProjectFinalSevice { } + private void saveProjectFinalProfitMargin(Project project, FinalBean finalBean, EstimateBean estimate, BudgetBean budget, FormerBean settle) { + ProjectFinalProfitMargin typeGrossProfit = new ProjectFinalProfitMargin(); + typeGrossProfit.setProjectId(project.getId()); + typeGrossProfit.setType(ProjectFinalProfitMargin.TYPE_GROSS_PROFIT); + typeGrossProfit.setEstimateTotalProfitMargin(estimate.getProjectGrossProfit()); + typeGrossProfit.setBudgetTotalProfitMargin(budget.getProjectGrossProfit()); + typeGrossProfit.setSettleTotalProfitMargin(settle.getGrossProfit()); + typeGrossProfit.setFinalTotalProfitMargin(finalBean.getGrossProfitFinalTotal()); + typeGrossProfit.setProfitMargin(finalBean.getGrossProfitProfitMargin()); + projectFinalProfitMarginRepository.saveAndFlush(typeGrossProfit); + + + ProjectFinalProfitMargin typeContributionMargin = new ProjectFinalProfitMargin(); + typeContributionMargin.setProjectId(project.getId()); + typeContributionMargin.setType(ProjectFinalProfitMargin.TYPE_CONTRIBUTION_MARGIN); + typeContributionMargin.setEstimateTotalProfitMargin(estimate.getProjectContributionProfit()); + typeContributionMargin.setBudgetTotalProfitMargin(budget.getProjectContributionProfit()); + typeContributionMargin.setSettleTotalProfitMargin(settle.getContributionProfit()); + typeContributionMargin.setFinalTotalProfitMargin(finalBean.getContributionMarginFinalTotal()); + typeContributionMargin.setProfitMargin(finalBean.getContributionMarginProfitMargin()); + projectFinalProfitMarginRepository.saveAndFlush(typeContributionMargin); + + ProjectFinalProfitMargin typeNetMargin = new ProjectFinalProfitMargin(); + typeNetMargin.setProjectId(project.getId()); + typeNetMargin.setType(ProjectFinalProfitMargin.TYPE_NET_MARGIN); + typeNetMargin.setSettleTotalProfitMargin(settle.getNetProfit()); + typeNetMargin.setFinalTotalProfitMargin(finalBean.getNetMarginFinalTotal()); + typeNetMargin.setProfitMargin(finalBean.getNetMarginProfitMargin()); + projectFinalProfitMarginRepository.saveAndFlush(typeNetMargin); + + } + public void saveProjectFinalCostManage(Project project, FinalBean finalBean,EstimateBean estimate,BudgetBean budget,FormerBean settle){ ProjectFinalCostManage expropriationManage = new ProjectFinalCostManage(); expropriationManage.setProjectId(project.getId()); diff --git a/src/main/java/cn/palmte/work/service/ProjectService.java b/src/main/java/cn/palmte/work/service/ProjectService.java index cc7bacd..5390fa5 100644 --- a/src/main/java/cn/palmte/work/service/ProjectService.java +++ b/src/main/java/cn/palmte/work/service/ProjectService.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import top.jfunc.common.db.QueryHelper; import top.jfunc.common.db.bean.Page; import top.jfunc.common.db.utils.Pagination; @@ -39,6 +40,8 @@ public class ProjectService { private SysRoleRepository sysRoleRepository; @Autowired private AdminRepository adminRepository; + @Autowired + private ProjectEstimateService projectEstimateService; private QueryHelper getQueryHelper(Map searchInfo) { @@ -300,4 +303,23 @@ public class ProjectService { } projectVisibleRepository.save(pvs); } + + @Transactional(rollbackFor = Exception.class) + public ResponseMsg deleteProject(int id) { + Project one = projectRepository.findOne(id); + if (one == null) { + return ResponseMsg.buildFailedMsg("项目不存在"); + } + + if (one.getStatus() != StatusEnum.ESTIMATE_ACCOUNTS.getStatus() + || one.getApproveStatusEstimate() != ApproveStatusEnum.APPROVAL_UNCOMMIT.getApproveStatus()) { + return ResponseMsg.buildFailedMsg("项目当前状态下不能删除"); + } + + projectRepository.delete(id); + + projectEstimateService.deleteEstimate(id); + + return ResponseMsg.buildSuccessMsg("删除成功"); + } } diff --git a/src/main/java/cn/palmte/work/service/StatisticsService.java b/src/main/java/cn/palmte/work/service/StatisticsService.java index 3c74285..bbe6da8 100644 --- a/src/main/java/cn/palmte/work/service/StatisticsService.java +++ b/src/main/java/cn/palmte/work/service/StatisticsService.java @@ -2,6 +2,8 @@ package cn.palmte.work.service; import cn.palmte.work.bean.CashFlowStatisticsBean; import cn.palmte.work.bean.PrimaryIndicatorBean; +import cn.palmte.work.bean.ProfitAndLossBean; +import cn.palmte.work.bean.StatisticsBean; import cn.palmte.work.model.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -38,15 +40,26 @@ public class StatisticsService { @Autowired private ProjectSettleCashFlowRepository projectSettleCashFlowRepository; + @Autowired + private ProjectSettleProfitMarginRepository projectSettleProfitMarginRepository; + /** - * 分月项目统计 获取主要指标数据 + * 分月项目统计 获取主要指标数据、损益表 * * @return */ - public List getPrimaryIndicator() { + public StatisticsBean getStatisticsData() { + StatisticsBean statisticsBean = new StatisticsBean(); List list = new ArrayList<>(); + List profitAndLossList = new ArrayList<>(); + PrimaryIndicatorBean include = new PrimaryIndicatorBean(); PrimaryIndicatorBean exclude = new PrimaryIndicatorBean(); + + ProfitAndLossBean profitAndLossBeanInclude = new ProfitAndLossBean(); + ProfitAndLossBean profitAndLossBeanExclude = new ProfitAndLossBean(); + profitAndLossBeanInclude.setTitle("预算金额(含税)"); + profitAndLossBeanExclude.setTitle("预算金额(不含税)"); include.setTitle("预算金额(含税)"); exclude.setTitle("预算金额(不含税)"); //收入数据 @@ -68,6 +81,10 @@ public class StatisticsService { exclude.setIncomeEngineer(engineerIncomeTaxExcludeSum); exclude.setIncomeService(serviceIncomeTaxExcludeSum); + BigDecimal incomeInclude = allIncome.stream().map(ProjectBudgetIncome::getIncomeTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add); + profitAndLossBeanInclude.setIncome(incomeInclude); + BigDecimal incomeExclude = allIncome.stream().map(ProjectBudgetIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); + profitAndLossBeanExclude.setIncome(incomeExclude); } //成本数据 @@ -101,6 +118,18 @@ public class StatisticsService { exclude.setCostPurchaseOther(otherCostTaxExcludeSum); exclude.setCostProjectManage(projectManageCostTaxExcludeSum); exclude.setCostOtherOther(otherOtherCostTaxExcludeSum); + + BigDecimal costInclude = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_DEVICE || d.getType() == ProjectBudgetCost.TYPE_BUILDING || d.getType() == ProjectBudgetCost.TYPE_SERVICE).map(ProjectBudgetCost::getCostTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal costExclude = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_DEVICE || d.getType() == ProjectBudgetCost.TYPE_BUILDING || d.getType() == ProjectBudgetCost.TYPE_SERVICE).map(ProjectBudgetCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); + + profitAndLossBeanInclude.setCost(costInclude); + profitAndLossBeanInclude.setManageCost(projectManageCostTaxIncludeSum); + profitAndLossBeanInclude.setOther(otherCostTaxIncludeSum.add(otherOtherCostTaxIncludeSum)); + + profitAndLossBeanExclude.setCost(costExclude); + profitAndLossBeanInclude.setManageCost(projectManageCostTaxExcludeSum); + profitAndLossBeanExclude.setOther(otherCostTaxExcludeSum.add(otherOtherCostTaxExcludeSum)); + } //管理成本数据 @@ -111,13 +140,20 @@ public class StatisticsService { exclude.setCostExpropriation(expropriationSum); exclude.setCostCompanyManage(companyManageSum); + + profitAndLossBeanExclude.setExpropriation(expropriationSum); + profitAndLossBeanExclude.setCompanyManage(companyManageSum); } list.add(include); list.add(exclude); + profitAndLossList.add(profitAndLossBeanInclude); + profitAndLossList.add(profitAndLossBeanExclude); PrimaryIndicatorBean allSettle = new PrimaryIndicatorBean(); + ProfitAndLossBean allProfitAndLoss = new ProfitAndLossBean(); allSettle.setTitle("实际累计(不含税)"); + allProfitAndLoss.setTitle("实际累计(不含税)"); List allSettleIncome = projectSettleIncomeRepository.findAll(); if (CollectionUtil.isNotEmpty(allSettleIncome)) { @@ -128,6 +164,9 @@ public class StatisticsService { allSettle.setIncomeDevice(incomeDeviceAll); allSettle.setIncomeEngineer(incomeEngineerAll); allSettle.setIncomeService(incomeServiceAll); + + BigDecimal incomeExclude = allSettleIncome.stream().map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); + allProfitAndLoss.setIncome(incomeExclude); } List allSettleCost = projectSettleCostRepository.findAll(); @@ -145,6 +184,12 @@ public class StatisticsService { allSettle.setCostPurchaseOther(costOtherAll); allSettle.setCostProjectManage(costProjectManageAll); allSettle.setCostOtherOther(costOtherOtherAll); + + BigDecimal cost = allSettleCost.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_DEVICE || d.getType() == ProjectSettleCost.TYPE_BUILDING || d.getType() == ProjectSettleCost.TYPE_SERVICE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); + allProfitAndLoss.setCost(cost); + allProfitAndLoss.setManageCost(costProjectManageAll); + allProfitAndLoss.setOther(costOtherAll.add(costOtherOtherAll)); + } List allSettleCostManage = projectSettleCostManageRepository.findAll(); @@ -154,15 +199,33 @@ public class StatisticsService { allSettle.setCostExpropriation(expropriationAll); allSettle.setCostCompanyManage(companyManageAll); + + allProfitAndLoss.setExpropriation(expropriationAll); + allProfitAndLoss.setCompanyManage(companyManageAll); } + + List profitMargins = projectSettleProfitMarginRepository.findAll(); + if(CollectionUtil.isNotEmpty(profitMargins)){ + BigDecimal typeGrossProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_GROSS_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal typeContributionProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_CONTRIBUTION_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal typeNetProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_NET_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + + allProfitAndLoss.setGrossProfit(typeGrossProfit); + allProfitAndLoss.setContributionMargin(typeContributionProfit); + allProfitAndLoss.setNetMargin(typeNetProfit); + } + list.add(allSettle); + profitAndLossList.add(allProfitAndLoss); List projectTime = projectSettleIncomeRepository.getProjectTime(); if (CollectionUtil.isNotEmpty(projectTime)) { for (String time : projectTime) { PrimaryIndicatorBean primaryIndicatorBean = new PrimaryIndicatorBean(); + ProfitAndLossBean profitAndLossBean = new ProfitAndLossBean(); primaryIndicatorBean.setTitle(time); + profitAndLossBean.setTitle(time); BigDecimal incomeDevice = allSettleIncome.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleIncome.TYPE_DEVICE).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal incomeEngineer = allSettleIncome.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleIncome.TYPE_ENGINEER).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); @@ -172,6 +235,9 @@ public class StatisticsService { primaryIndicatorBean.setIncomeEngineer(incomeEngineer); primaryIndicatorBean.setIncomeService(incomeService); + BigDecimal income = allSettleIncome.stream().filter(d -> d.getTime().equals(time)).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); + profitAndLossBean.setIncome(income); + BigDecimal costDevice = allSettleCost.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCost.TYPE_DEVICE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal costBuilding = allSettleCost.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCost.TYPE_BUILDING).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal costService = allSettleCost.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCost.TYPE_SERVICE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); @@ -179,7 +245,6 @@ public class StatisticsService { BigDecimal costProjectManage = allSettleCost.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCost.TYPE_PROJECT_MANAGE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal costOtherOther = allSettleCost.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCost.TYPE_OTHER_OTHER).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); - primaryIndicatorBean.setCostPurchaseDevice(costDevice); primaryIndicatorBean.setCostPurchaseBuild(costBuilding); primaryIndicatorBean.setCostPurchaseService(costService); @@ -187,28 +252,39 @@ public class StatisticsService { primaryIndicatorBean.setCostProjectManage(costProjectManage); primaryIndicatorBean.setCostOtherOther(costOtherOther); + BigDecimal cost = allSettleCost.stream().filter(d -> d.getTime().equals(time) && (d.getType() == ProjectSettleCost.TYPE_DEVICE || d.getType() == ProjectSettleCost.TYPE_BUILDING || d.getType() == ProjectSettleCost.TYPE_SERVICE)).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); + profitAndLossBean.setCost(cost); + profitAndLossBean.setManageCost(costProjectManage); + profitAndLossBean.setOther(costOther.add(costOtherOther)); + BigDecimal expropriation = allSettleCostManage.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCostManage.TYPE_EXPROPRIATION).map(ProjectSettleCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal companyManage = allSettleCostManage.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCostManage.TYPE_COMPANY_MANAGE).map(ProjectSettleCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add); primaryIndicatorBean.setCostExpropriation(expropriation); primaryIndicatorBean.setCostCompanyManage(companyManage); + profitAndLossBean.setExpropriation(expropriation); + profitAndLossBean.setCompanyManage(companyManage); + + BigDecimal typeGrossProfit = profitMargins.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleProfitMargin.TYPE_GROSS_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal typeContributionProfit = profitMargins.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleProfitMargin.TYPE_CONTRIBUTION_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal typeNetProfit = profitMargins.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleProfitMargin.TYPE_NET_PROFIT).map(ProjectSettleProfitMargin::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + + profitAndLossBean.setGrossProfit(typeGrossProfit); + profitAndLossBean.setContributionMargin(typeContributionProfit); + profitAndLossBean.setNetMargin(typeNetProfit); + list.add(primaryIndicatorBean); + profitAndLossList.add(profitAndLossBean); } } - return list; - } + List cashFlow = getCashFlow(); - /** - * 分月项目统计 获取损益表数据 - * - * @return - */ - public List getIncomeStatement() { - - - return null; + statisticsBean.setPrimaryIndicatorBeanList(list); + statisticsBean.setProfitAndLossBeanList(profitAndLossList); + statisticsBean.setCashFlowStatisticsBeanList(cashFlow); + return statisticsBean; } /** diff --git a/src/main/resources/templates/admin/account_input.ftl b/src/main/resources/templates/admin/account_input.ftl index e0231d0..6de4ed8 100644 --- a/src/main/resources/templates/admin/account_input.ftl +++ b/src/main/resources/templates/admin/account_input.ftl @@ -28,9 +28,9 @@ 工号
- readonly placeholder="请输入工号"/> @@ -56,7 +56,7 @@
-
+ <#--
* 登录名称 @@ -70,7 +70,7 @@ placeholder="请输入登录名称(20字符以内)"/>
-
+
-->
@@ -129,7 +129,7 @@ readonly + minlength="1" maxlength="10" <#if userId!=-1>readonly required placeholder="请输入直接主管"/>
diff --git a/src/main/resources/templates/admin/account_list.ftl b/src/main/resources/templates/admin/account_list.ftl index dd7f0bc..7c0fbc5 100644 --- a/src/main/resources/templates/admin/account_list.ftl +++ b/src/main/resources/templates/admin/account_list.ftl @@ -157,7 +157,7 @@ <#list pager.list as list> - ${list.empCode!} + ${list.userName!} ${list.telephone!} ${list.realName!} ${list.workLocation!} diff --git a/src/main/resources/templates/admin/month_statistics.ftl b/src/main/resources/templates/admin/month_statistics.ftl index 3cd292e..413f31c 100644 --- a/src/main/resources/templates/admin/month_statistics.ftl +++ b/src/main/resources/templates/admin/month_statistics.ftl @@ -41,17 +41,17 @@ <#list primaryIndicatorList as list> ${list.title!} - ${list.incomeDevice!} - ${list.incomeEngineer!} - ${list.incomeService!} - ${list.costPurchaseDevice!} - ${list.costPurchaseBuild!} - ${list.costPurchaseService!} - ${list.costPurchaseOther!} - ${list.costOtherOther!} - ${list.costProjectManage!} - ${list.costExpropriation!} - ${list.costCompanyManage!} + ${(list.incomeDevice!0)?string("0.##")} + ${(list.incomeEngineer!0)?string("0.##")} + ${(list.incomeService!0)?string("0.##")} + ${(list.costPurchaseDevice!0)?string("0.##")} + ${(list.costPurchaseBuild!0)?string("0.##")} + ${(list.costPurchaseService!0)?string("0.##")} + ${(list.costPurchaseOther!0)?string("0.##")} + ${(list.costOtherOther!0)?string("0.##")} + ${(list.costProjectManage!0)?string("0.##")} + ${(list.costExpropriation!0)?string("0.##")} + ${(list.costCompanyManage!0)?string("0.##")} @@ -84,24 +84,23 @@ - <#if (cashFlowList)?exists && (cashFlowList?size>0)> - <#list cashFlowList as list> + <#if (profitAndLossList)?exists && (profitAndLossList?size>0)> + <#list profitAndLossList as list> ${list.title!} - ${list.saleIncomeCash!} - ${list.taxReturn!} - ${list.earnestMoneyIncome!} - ${list.purchaseCost!} - ${list.taxCost!} - ${list.earnestMoneyCost!} - ${list.netCashFlow!} - ${list.cashInflowFromInvestingActivities!} - ${list.cashOutflowFromInvestingActivities!} - ${list.netCashFromInvestingActivities!} - ${list.financingCapitalInflow!} - ${list.financingCapitalOutflow!} - ${list.financingCapitalCashflow!} - ${list.netIncreaseMonetaryFunds!} + ${(list.cost!0)?string("0.##")} + ${(list.income!0)?string("0.##")} + ${(list.manageCost!0)?string("0.##")} + ${(list.other!0)?string("0.##")} + ${(list.expropriation!0)?string("0.##")} + ${(list.grossProfit!0)?string("0.##")} + ${(list.grossProfitProfit!0)?string("0.##")} + ${(list.companyManage!0)?string("0.##")} + ${(list.contributionMargin!0)?string("0.##")} + ${(list.contributionMarginProfit!0)?string("0.##")} + ${(list.incomeTax!0)?string("0.##")} + ${(list.netMargin!0)?string("0.##")} + ${(list.netMarginProfit!0)?string("0.##")} @@ -137,20 +136,20 @@ <#list cashFlowList as list> ${list.title!} - ${list.saleIncomeCash!} - ${list.taxReturn!} - ${list.earnestMoneyIncome!} - ${list.purchaseCost!} - ${list.taxCost!} - ${list.earnestMoneyCost!} - ${list.netCashFlow!} - ${list.cashInflowFromInvestingActivities!} - ${list.cashOutflowFromInvestingActivities!} - ${list.netCashFromInvestingActivities!} - ${list.financingCapitalInflow!} - ${list.financingCapitalOutflow!} - ${list.financingCapitalCashflow!} - ${list.netIncreaseMonetaryFunds!} + ${(list.saleIncomeCash!0)?string("0.##")} + ${(list.taxReturn!0)?string("0.##")} + ${(list.earnestMoneyIncome!0)?string("0.##")} + ${(list.purchaseCost!0)?string("0.##")} + ${(list.taxCost!0)?string("0.##")} + ${(list.earnestMoneyCost!0)?string("0.##")} + ${(list.netCashFlow!0)?string("0.##")} + ${(list.cashInflowFromInvestingActivities!0)?string("0.##")} + ${(list.cashOutflowFromInvestingActivities!0)?string("0.##")} + ${(list.netCashFromInvestingActivities!0)?string("0.##")} + ${(list.financingCapitalInflow!0)?string("0.##")} + ${(list.financingCapitalOutflow!0)?string("0.##")} + ${(list.financingCapitalCashflow!0)?string("0.##")} + ${(list.netIncreaseMonetaryFunds!0)?string("0.##")} diff --git a/src/main/resources/templates/admin/project_approve.ftl b/src/main/resources/templates/admin/project_approve.ftl index 449d65b..0bd9498 100644 --- a/src/main/resources/templates/admin/project_approve.ftl +++ b/src/main/resources/templates/admin/project_approve.ftl @@ -854,7 +854,7 @@ - + 项目贡献利润 @@ -863,7 +863,7 @@ - + 项目净利润 @@ -872,7 +872,7 @@ - + diff --git a/src/main/resources/templates/admin/project_final_edit.ftl b/src/main/resources/templates/admin/project_final_edit.ftl index bf0e8a7..5525dd8 100644 --- a/src/main/resources/templates/admin/project_final_edit.ftl +++ b/src/main/resources/templates/admin/project_final_edit.ftl @@ -232,7 +232,7 @@ 项目净利润 / - + /<#----> diff --git a/src/main/resources/templates/admin/project_list.ftl b/src/main/resources/templates/admin/project_list.ftl index 75bf09d..a26a8ab 100644 --- a/src/main/resources/templates/admin/project_list.ftl +++ b/src/main/resources/templates/admin/project_list.ftl @@ -216,6 +216,15 @@ + <#-- 项目等于概算状态、概算审核为草稿状态--> + <#if list.creatorId==adminId && list.status==1 && list.approveStatusEstimate==0> + + + <#-- <@shiro.hasPermission name="PROJECT_EDIT">--> <#-- 概算审核等于通过状态、预算审核不等于待审核状态、 决算审核不等于通过状态--> @@ -401,4 +410,23 @@ }); + + var deleteProject = function (id) { + if (window.confirm('确定要删除此项目吗?')) { + $.ajax({ + url: '${base}/project/deleteProject/' + id, + dataType: "json", + async: false, + success: function (data) { + if (data.status == 0) { + alert(data.msg); + window.location.href = window.location.href; + } else if (data.status == 1) { + alert(data.msg); + } + } + }); + } + } + diff --git a/src/main/resources/templates/admin/project_list_approve.ftl b/src/main/resources/templates/admin/project_list_approve.ftl index 6659bcd..7368019 100644 --- a/src/main/resources/templates/admin/project_list_approve.ftl +++ b/src/main/resources/templates/admin/project_list_approve.ftl @@ -181,7 +181,7 @@ <#list pager.list as list> ${list.id!} - ${list.name!} + ${list.name!} ${list.typeDesc!} ${list.statusDesc!} ${list.approveStatusDesc!} @@ -193,15 +193,15 @@
- + -->