Merge remote-tracking branch 'origin/master'

master
xxssyyyyssxx 2021-11-19 14:50:22 +08:00
commit 8a6962d712
23 changed files with 660 additions and 148 deletions

View File

@ -0,0 +1,71 @@
package cn.palmte.work.bean;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class CashFlowStatisticsBean {
private String title;
/**
* a
* */
private BigDecimal saleIncomeCash;
/**
* b
* */
private BigDecimal taxReturn;
/**
* c
*/
private BigDecimal earnestMoneyIncome;
/**
* d+
*/
private BigDecimal purchaseCost;
/**
* e
*/
private BigDecimal taxCost;
/**
*f
*/
private BigDecimal earnestMoneyCost;
/**
* g
* g=a+c+b-d-f-e
*/
private BigDecimal netCashFlow;
/**
* h
*/
private BigDecimal cashInflowFromInvestingActivities;
/**
* i
*/
private BigDecimal cashOutflowFromInvestingActivities;
/**
* j
*/
private BigDecimal netCashFromInvestingActivities;
/**
* k
*/
private BigDecimal financingCapitalInflow;
/**
* l
*/
private BigDecimal financingCapitalOutflow;
/**
*m
* m=k-l
*/
private BigDecimal financingCapitalCashflow;
/**
* n
* n=g+j+m
*/
private BigDecimal netIncreaseMonetaryFunds;
}

View File

@ -94,7 +94,7 @@ public class ActProcInsController extends BaseController {
variables.put(ActConstant.START_PROCESS_USERID, InterfaceUtil.getAdminId());
String procInsId = null;
try {
procInsId = actProcInsService.startProcessInstance(procDefKey, "", variables);
procInsId = actProcInsService.startProcessInstance(procDefKey, "0", variables);
} catch (Exception e) {
logger.error("", e);
return ResponseMsg.buildFailedMsg("流程启动失败:" + e.getMessage());

View File

@ -95,9 +95,11 @@ public class HumanCostController extends BaseController{
Page<ProjectUserTime> project = humanCostService.project(searchInfo, admin, pageNumber, pageSize);
List<ProjectUserTime> staff = humanCostService.staff(searchInfo, admin);
Map<String, BigDecimal> map = humanCostService.map(searchInfo, admin, pageNumber, pageSize);
BigDecimal total = humanCostService.sum(searchInfo, admin);
model.put("pager", project);
model.put("staff", staff);
model.put("map", map);
model.put("total", total);
return "admin/human_cost_list";
}
@ -152,9 +154,8 @@ public class HumanCostController extends BaseController{
@RequestMapping("/batchImport")
@ResponseBody
public String batchImport(MultipartFile file) {
public String batchImport(MultipartFile file, @RequestParam(value = "date",required = false) String date) {
try {
String date = "2021-11";
Map<String, String> title = new HashMap<>();
Collection<Map> maps = ExcelUtil.importHumanCost(Map.class, file.getInputStream(),
title,0);

View File

@ -1,5 +1,6 @@
package cn.palmte.work.controller.backend;
import cn.palmte.work.bean.CashFlowStatisticsBean;
import cn.palmte.work.bean.PrimaryIndicatorBean;
import cn.palmte.work.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,7 +20,9 @@ public class StatisticsController extends BaseController{
@RequestMapping("/month")
public String month(Map<String, Object> model){
List<PrimaryIndicatorBean> primaryIndicatorList = statisticsService.getPrimaryIndicator();
List<CashFlowStatisticsBean> cashFlowList = statisticsService.getCashFlow();
model.put("primaryIndicatorList",primaryIndicatorList);
model.put("cashFlowList",cashFlowList);
return "admin/month_statistics";
}

View File

@ -26,4 +26,7 @@ public interface ProjectSettleCashFlowRepository extends JpaRepository<ProjectSe
@Query(value = "select * from project_settle_cash_flow where project_id in ?1 and time = ?2", nativeQuery = true)
List<ProjectSettleCashFlow> findAllByProjectsAndTime(List<Integer> ids, String time);
@Query(value = "SELECT time FROM project_settle_cash_flow GROUP BY time ORDER BY time", nativeQuery = true)
List<String> getProjectTime();
}

View File

@ -26,4 +26,10 @@ public interface ProjectSettleCostManageRepository extends JpaRepository<Project
@Query(value = "select * from project_settle_cost_manage where project_id in ?1 and time = ?2", nativeQuery = true)
List<ProjectSettleCostManage> findAllByProjectsAndTime(List<Integer> ids, String time);
@Query(value = "select sum(cost_tax_exclude) from project_settle_cost_manage where time = ? and type = ?", nativeQuery = true)
BigDecimal costManageTaxExcludeSumByTime(String time, int type);
@Query(value = "select sum(cost_tax_exclude) from project_settle_cost_manage where type = ?", nativeQuery = true)
BigDecimal costManageTaxExcludeSumByType(int type);
}

View File

@ -26,4 +26,10 @@ public interface ProjectSettleCostRepository extends JpaRepository<ProjectSettle
@Query(value = "select * from project_settle_cost where project_id in ?1 and time = ?2", nativeQuery = true)
List<ProjectSettleCost> findAllByProjectsAndTime(List<Integer> ids, String time);
@Query(value = "select sum(cost_tax_exclude) from project_settle_cost where time = ? and type = ?", nativeQuery = true)
BigDecimal costTaxExcludeSumByTime(String time, int type);
@Query(value = "select sum(cost_tax_exclude) from project_settle_cost where type = ?", nativeQuery = true)
BigDecimal costTaxExcludeSumByType(int type);
}

View File

@ -29,4 +29,13 @@ public interface ProjectSettleIncomeRepository extends JpaRepository<ProjectSett
@Query(value = "select * from project_settle_income where project_id in ?1 and time = ?2", nativeQuery = true)
List<ProjectSettleIncome> findAllByProjectsAndTime(List<Integer> ids, String time);
@Query(value = "SELECT time FROM project_settle_income GROUP BY time ORDER BY time", nativeQuery = true)
List<String> getProjectTime();
@Query(value = "select sum(income_tax_exclude) from project_settle_income where time = ? and type = ?", nativeQuery = true)
BigDecimal incomeTaxExcludeSumByTime(String time, int type);
@Query(value = "select sum(income_tax_exclude) from project_settle_income where type = ?", nativeQuery = true)
BigDecimal incomeTaxExcludeSumByType(int type);
}

View File

@ -37,7 +37,7 @@ public class ProjectUserTime {
private String userName;
@Column(name = "time")
private Date time;
private String time;
@Column(name = "created_by")
private int createdBy;
@ -107,11 +107,11 @@ public class ProjectUserTime {
this.userName = userName;
}
public Date getTime() {
public String getTime() {
return time;
}
public void setTime(Date time) {
public void setTime(String time) {
this.time = time;
}

View File

@ -1,16 +1,26 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* @author Yuanping Zhang
* @date 2021/11/1
*/
@Transactional(rollbackFor = Exception.class)
public interface ProjectUserTimeRepository extends JpaRepository<ProjectUserTime, Integer> {
@Query(value = "select * from project_user_time where user_id = ? and project_id = ? and time = ? limit 1", nativeQuery = true)
public ProjectUserTime findByUserIdAndProjectIdAndTime(int userId, int projectId, Date time);
@Query(value = "select * from project_user_time where user_id = ?1 and project_id = ?2 and time = ?3 limit 1", nativeQuery = true)
ProjectUserTime findByUserIdAndProjectIdAndTime(int userId, int projectId, String time);
@Query(value = "select * from project_user_time where time = ?1", nativeQuery = true)
List<ProjectUserTime> findAllByTime(String time);
@Modifying
@Query(value = "delete from project_user_time where time = ?1", nativeQuery = true)
int deleteByTime(String date);
}

View File

@ -2,6 +2,7 @@ package cn.palmte.work.model;
import top.jfunc.common.db.bean.Page;
import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@ -18,4 +19,6 @@ public interface ProjectUserTimeRepositoryCustom {
List<ProjectUserTime> list(ConcurrentHashMap<String, String> searchInfo, Admin admin, int pageNumber, int pageSize);
Page<ProjectUserTime> individual(ConcurrentHashMap<String, String> searchInfo, Integer id, int pageNumber, int pageSize);
List<ProjectUserTime> sum(ConcurrentHashMap<String, String> searchInfo, Admin admin);
}

View File

@ -53,13 +53,22 @@ public class ProjectUserTimeRepositoryImpl implements ProjectUserTimeRepositoryC
public Page<ProjectUserTime> individual(ConcurrentHashMap<String, String> searchInfo, Integer id, int pageNumber, int pageSize) {
QueryHelper helper = new QueryHelper("select put.*", "from project_user_time put");
helper.addCondition("put.user_id = ?", id);
helper.addCondition(searchInfo.containsKey("time"),"put.time = ?", searchInfo.get("time") + "-01 00:00:00");
helper.addCondition(searchInfo.containsKey("time"),"put.time = ?", searchInfo.get("time"));
helper.addOrderProperty("created_time", false);
return pagination.paginate(helper.getSql(), ProjectUserTime.class, pageNumber, pageSize);
}
@Override
public List<ProjectUserTime> sum(ConcurrentHashMap<String, String> searchInfo, Admin admin) {
QueryHelper helper = new QueryHelper("select put.user_salary, put.user_cost", "from project_user_time put");
helper.leftJoin("project proj", "put.project_id = proj.id");
helper.leftJoin("dept", "proj.dept_id = dept.id");
searchQuery(helper, searchInfo, admin);
return pagination.find(helper.getSql(), ProjectUserTime.class);
}
private QueryHelper searchQuery(QueryHelper helper, ConcurrentHashMap<String, String> searchInfo, Admin admin) {
helper.addCondition(searchInfo.containsKey("time"),"put.time = ?", searchInfo.get("time") + "-01 00:00:00");
helper.addCondition(searchInfo.containsKey("time"),"put.time = ?", searchInfo.get("time"));
helper.addCondition(searchInfo.containsKey("projectId") && !"-1".equals(searchInfo.get("projectId")), "put.project_id = ?", searchInfo.get("projectId"));
helper.addCondition(searchInfo.containsKey("deptId") && !"-1".equals(searchInfo.get("deptId")), "dept.id = ?", searchInfo.get("deptId"));
helper.addCondition(searchInfo.containsKey("userName"), "put.user_name like ?", "%'" + searchInfo.get("userName") + "'%");

View File

@ -1,6 +1,8 @@
package cn.palmte.work.service;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.AdminRepository;
import cn.palmte.work.utils.ActUtil;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.delegate.DelegateExecution;
@ -34,6 +36,9 @@ public class ActListenerService {
@Autowired
private ActUtil actUtil;
@Autowired
private AdminRepository adminRepository;
/**
*
*
@ -89,7 +94,14 @@ public class ActListenerService {
try {
int adminId = 0;
if (!candidateUsers.isEmpty()) {
adminId = Integer.parseInt(candidateUsers.get(0));
for (String id : candidateUsers) {
Admin one = adminRepository.findOne(Integer.parseInt(id));
if (!one.isDeleted() && one.getEnabled() == 1) {
//找到有效账号 发送任务
adminId = one.getId();
break;
}
}
}
projectInstanceService.updateApprover(Integer.parseInt(businessKey), adminId);
} catch (Exception e) {

View File

@ -2,7 +2,6 @@ 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;
@ -11,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.jfunc.common.db.bean.Page;
import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
import java.util.*;
@ -101,7 +101,7 @@ public class HumanCostService {
Project project = projectRepository.findByProjectName(projectName);
if (project == null) {
throw new Exception(projectName + "不存在");
} else if (project.getStatus() != 15 || project.getApproveStatusSettle() == 1 || project.getApproveStatusSettle() == 2) {
} else if (project.getStatus() != Project.STATUS_SETTLE || project.getApproveStatusSettle() == 1 || project.getApproveStatusSettle() == 2) {
throw new Exception(projectName + "不在项目结算的可编辑状态");
}
if (projectSet.contains(projectName)) {
@ -136,17 +136,15 @@ public class HumanCostService {
} else {
throw new Exception(projectName + " " + key + "的成本需为大于0的最多两位小数的的数字");
}
ProjectUserTime put = projectUserTimeRepository.findByUserIdAndProjectIdAndTime(admin.getId(), project.getId(), DateKit.getDate(date + "-01 00:00:00", DateKit.TIME_FORMAT));
if (put == null) {
put = new ProjectUserTime();
put.setCreatedBy(InterfaceUtil.getAdminId());
put.setCreatedTime(new Date());
put.setTime(DateKit.getDate(date, "yyyy-MM"));
put.setProjectId(project.getId());
put.setProjectName(project.getName());
put.setUserName(admin.getRealName());
put.setUserId(admin.getId());
}
// ProjectUserTime put = projectUserTimeRepository.findByUserIdAndProjectIdAndTime(admin.getId(), project.getId(), date);
ProjectUserTime put = new ProjectUserTime();
put.setCreatedBy(InterfaceUtil.getAdminId());
put.setCreatedTime(new Date());
put.setTime(date);
put.setProjectId(project.getId());
put.setProjectName(project.getName());
put.setUserName(admin.getRealName());
put.setUserId(admin.getId());
put.setUserCost(userCost);
put.setUserSalary(userSalary);
@ -173,6 +171,8 @@ public class HumanCostService {
}
}
if (errorCount == 0) {
int row = projectUserTimeRepository.deleteByTime(date);
logger.info("删除重复条目:" + row + "条");
projectUserTimeRepository.save(saveList);
}
final ResponseMsg msg = ResponseMsg.buildSuccessMsg(String.format("成功:%d, 失败:%d", successCount, errorCount));
@ -205,4 +205,13 @@ public class HumanCostService {
}
return columns;
}
public BigDecimal sum(ConcurrentHashMap<String, String> searchInfo, Admin admin) {
List<ProjectUserTime> sum = projectUserTimeRepositoryImpl.sum(searchInfo, admin);
if(CollectionUtil.isNotEmpty(sum)){
BigDecimal result = sum.stream().map((ProjectUserTime t) -> t.getUserCost().multiply(t.getUserSalary())).reduce(BigDecimal.ZERO, BigDecimal::add);
return result;
}
return new BigDecimal(0);
}
}

View File

@ -1,9 +1,13 @@
package cn.palmte.work.service;
import cn.palmte.work.bean.CashFlowBean;
import cn.palmte.work.bean.CashFlowStatisticsBean;
import cn.palmte.work.bean.PrimaryIndicatorBean;
import cn.palmte.work.model.*;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -21,6 +25,21 @@ public class StatisticsService {
@Autowired
private ProjectBudgetCostManageRepository projectBudgetCostManageRepository;
@Autowired
private ProjectSettleCostRepository projectSettleCostRepository;
@Autowired
private ProjectSettleIncomeRepository projectSettleIncomeRepository;
@Autowired
private ProjectSettleCostManageRepository projectSettleCostManageRepository;
@Autowired
private ProjectBudgetPlanDetailRepository projectBudgetPlanDetailRepository;
@Autowired
private ProjectSettleCashFlowRepository projectSettleCashFlowRepository;
/**
*
*
@ -29,70 +48,157 @@ public class StatisticsService {
public List<PrimaryIndicatorBean> getPrimaryIndicator() {
List<PrimaryIndicatorBean> list = new ArrayList<>();
PrimaryIndicatorBean include = new PrimaryIndicatorBean();
include.setTitle("预算金额(含税)");
//收入数据
BigDecimal deviceIncomeTaxIncludeSum = projectBudgetIncomeRepository.incomeTaxIncludeSum(ProjectBudgetIncome.TYPE_DEVICE);
BigDecimal engineerIncomeTaxIncludeSum = projectBudgetIncomeRepository.incomeTaxIncludeSum(ProjectBudgetIncome.TYPE_ENGINEER);
BigDecimal serviceIncomeTaxIncludeSum = projectBudgetIncomeRepository.incomeTaxIncludeSum(ProjectBudgetIncome.TYPE_SERVICE);
include.setIncomeDevice(deviceIncomeTaxIncludeSum);
include.setIncomeEngineer(engineerIncomeTaxIncludeSum);
include.setIncomeService(serviceIncomeTaxIncludeSum);
//成本
BigDecimal deviceCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_DEVICE);
BigDecimal buildingCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_BUILDING);
BigDecimal serviceCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_SERVICE);
BigDecimal otherCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_OTHER);
BigDecimal projectManageCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_PROJECT_MANAGE);
BigDecimal otherOtherCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_OTHER_OTHER);
include.setCostPurchaseDevice(deviceCostTaxIncludeSum);
include.setCostPurchaseBuild(buildingCostTaxIncludeSum);
include.setCostPurchaseService(serviceCostTaxIncludeSum);
include.setCostPurchaseOther(otherCostTaxIncludeSum);
include.setCostProjectManage(projectManageCostTaxIncludeSum);
include.setCostOtherOther(otherOtherCostTaxIncludeSum);
list.add(include);
PrimaryIndicatorBean exclude = new PrimaryIndicatorBean();
include.setTitle("预算金额(含税)");
exclude.setTitle("预算金额(不含税)");
//收入数据
BigDecimal deviceIncomeTaxExcludeSum = projectBudgetIncomeRepository.incomeTaxExcludeSum(ProjectBudgetIncome.TYPE_DEVICE);
BigDecimal engineerIncomeTaxExcludeSum = projectBudgetIncomeRepository.incomeTaxExcludeSum(ProjectBudgetIncome.TYPE_ENGINEER);
BigDecimal serviceIncomeTaxExcludeSum = projectBudgetIncomeRepository.incomeTaxExcludeSum(ProjectBudgetIncome.TYPE_SERVICE);
List<ProjectBudgetIncome> allIncome = projectBudgetIncomeRepository.findAll();
if (CollectionUtil.isNotEmpty(allIncome)) {
BigDecimal deviceIncomeTaxIncludeSum = allIncome.stream().filter(d -> d.getType() == ProjectBudgetIncome.TYPE_DEVICE).map(ProjectBudgetIncome::getIncomeTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal engineerIncomeTaxIncludeSum = allIncome.stream().filter(d -> d.getType() == ProjectBudgetIncome.TYPE_ENGINEER).map(ProjectBudgetIncome::getIncomeTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal serviceIncomeTaxIncludeSum = allIncome.stream().filter(d -> d.getType() == ProjectBudgetIncome.TYPE_SERVICE).map(ProjectBudgetIncome::getIncomeTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
exclude.setIncomeDevice(deviceIncomeTaxExcludeSum);
exclude.setIncomeEngineer(engineerIncomeTaxExcludeSum);
exclude.setIncomeService(serviceIncomeTaxExcludeSum);
include.setIncomeDevice(deviceIncomeTaxIncludeSum);
include.setIncomeEngineer(engineerIncomeTaxIncludeSum);
include.setIncomeService(serviceIncomeTaxIncludeSum);
//成本
BigDecimal deviceCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_DEVICE);
BigDecimal buildingCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_BUILDING);
BigDecimal serviceCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_SERVICE);
BigDecimal otherCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_OTHER);
BigDecimal projectManageCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_PROJECT_MANAGE);
BigDecimal otherOtherCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_OTHER_OTHER);
BigDecimal deviceIncomeTaxExcludeSum = allIncome.stream().filter(d -> d.getType() == ProjectBudgetIncome.TYPE_DEVICE).map(ProjectBudgetIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal engineerIncomeTaxExcludeSum = allIncome.stream().filter(d -> d.getType() == ProjectBudgetIncome.TYPE_ENGINEER).map(ProjectBudgetIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal serviceIncomeTaxExcludeSum = allIncome.stream().filter(d -> d.getType() == ProjectBudgetIncome.TYPE_SERVICE).map(ProjectBudgetIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
exclude.setCostPurchaseDevice(deviceCostTaxExcludeSum);
exclude.setCostPurchaseBuild(buildingCostTaxExcludeSum);
exclude.setCostPurchaseService(serviceCostTaxExcludeSum);
exclude.setCostPurchaseOther(otherCostTaxExcludeSum);
exclude.setCostProjectManage(projectManageCostTaxExcludeSum);
exclude.setCostOtherOther(otherOtherCostTaxExcludeSum);
exclude.setIncomeDevice(deviceIncomeTaxExcludeSum);
exclude.setIncomeEngineer(engineerIncomeTaxExcludeSum);
exclude.setIncomeService(serviceIncomeTaxExcludeSum);
//管理
BigDecimal expropriationSum = projectBudgetCostManageRepository.costTaxExcludeSum(ProjectBudgetCostManage.TYPE_EXPROPRIATION);
BigDecimal companyManageSum = projectBudgetCostManageRepository.costTaxExcludeSum(ProjectBudgetCostManage.TYPE_COMPANY_MANAGE);
}
exclude.setCostExpropriation(expropriationSum);
exclude.setCostCompanyManage(companyManageSum);
//成本数据
List<ProjectBudgetCost> allCost = projectBudgetCostRepository.findAll();
if (CollectionUtil.isNotEmpty(allCost)) {
BigDecimal deviceCostTaxIncludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_DEVICE).map(ProjectBudgetCost::getCostTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal buildingCostTaxIncludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_BUILDING).map(ProjectBudgetCost::getCostTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal serviceCostTaxIncludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_SERVICE).map(ProjectBudgetCost::getCostTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal otherCostTaxIncludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_OTHER).map(ProjectBudgetCost::getCostTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal projectManageCostTaxIncludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_PROJECT_MANAGE).map(ProjectBudgetCost::getCostTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal otherOtherCostTaxIncludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_OTHER_OTHER).map(ProjectBudgetCost::getCostTaxInclude).reduce(BigDecimal.ZERO, BigDecimal::add);
include.setCostPurchaseDevice(deviceCostTaxIncludeSum);
include.setCostPurchaseBuild(buildingCostTaxIncludeSum);
include.setCostPurchaseService(serviceCostTaxIncludeSum);
include.setCostPurchaseOther(otherCostTaxIncludeSum);
include.setCostProjectManage(projectManageCostTaxIncludeSum);
include.setCostOtherOther(otherOtherCostTaxIncludeSum);
BigDecimal deviceCostTaxExcludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_DEVICE).map(ProjectBudgetCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal buildingCostTaxExcludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_BUILDING).map(ProjectBudgetCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal serviceCostTaxExcludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_SERVICE).map(ProjectBudgetCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal otherCostTaxExcludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_OTHER).map(ProjectBudgetCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal projectManageCostTaxExcludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_PROJECT_MANAGE).map(ProjectBudgetCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal otherOtherCostTaxExcludeSum = allCost.stream().filter(d -> d.getType() == ProjectBudgetCost.TYPE_OTHER_OTHER).map(ProjectBudgetCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
exclude.setCostPurchaseDevice(deviceCostTaxExcludeSum);
exclude.setCostPurchaseBuild(buildingCostTaxExcludeSum);
exclude.setCostPurchaseService(serviceCostTaxExcludeSum);
exclude.setCostPurchaseOther(otherCostTaxExcludeSum);
exclude.setCostProjectManage(projectManageCostTaxExcludeSum);
exclude.setCostOtherOther(otherOtherCostTaxExcludeSum);
}
//管理成本数据
List<ProjectBudgetCostManage> allCostManage = projectBudgetCostManageRepository.findAll();
if (CollectionUtil.isNotEmpty(allCostManage)) {
BigDecimal expropriationSum = allCostManage.stream().filter(d -> d.getType() == ProjectBudgetCostManage.TYPE_EXPROPRIATION).map(ProjectBudgetCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal companyManageSum = allCostManage.stream().filter(d -> d.getType() == ProjectBudgetCostManage.TYPE_COMPANY_MANAGE).map(ProjectBudgetCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
exclude.setCostExpropriation(expropriationSum);
exclude.setCostCompanyManage(companyManageSum);
}
list.add(include);
list.add(exclude);
PrimaryIndicatorBean allSettle = new PrimaryIndicatorBean();
allSettle.setTitle("实际累计(不含税)");
List<ProjectSettleIncome> allSettleIncome = projectSettleIncomeRepository.findAll();
if (CollectionUtil.isNotEmpty(allSettleIncome)) {
BigDecimal incomeDeviceAll = allSettleIncome.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_DEVICE).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal incomeEngineerAll = allSettleIncome.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_ENGINEER).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal incomeServiceAll = allSettleIncome.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_SERVICE).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
allSettle.setIncomeDevice(incomeDeviceAll);
allSettle.setIncomeEngineer(incomeEngineerAll);
allSettle.setIncomeService(incomeServiceAll);
}
List<ProjectSettleCost> allSettleCost = projectSettleCostRepository.findAll();
if (CollectionUtil.isNotEmpty(allSettleCost)) {
BigDecimal costDeviceAll = allSettleCost.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_DEVICE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal costBuildingAll = allSettleCost.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_BUILDING).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal costServiceAll = allSettleCost.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_SERVICE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal costOtherAll = allSettleCost.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal costProjectManageAll = allSettleCost.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_PROJECT_MANAGE).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal costOtherOtherAll = allSettleCost.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER_OTHER).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
allSettle.setCostPurchaseDevice(costDeviceAll);
allSettle.setCostPurchaseBuild(costBuildingAll);
allSettle.setCostPurchaseService(costServiceAll);
allSettle.setCostPurchaseOther(costOtherAll);
allSettle.setCostProjectManage(costProjectManageAll);
allSettle.setCostOtherOther(costOtherOtherAll);
}
List<ProjectSettleCostManage> allSettleCostManage = projectSettleCostManageRepository.findAll();
if (CollectionUtil.isNotEmpty(allSettleCostManage)) {
BigDecimal expropriationAll = allSettleCostManage.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_EXPROPRIATION).map(ProjectSettleCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal companyManageAll = allSettleCostManage.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_COMPANY_MANAGE).map(ProjectSettleCostManage::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
allSettle.setCostExpropriation(expropriationAll);
allSettle.setCostCompanyManage(companyManageAll);
}
list.add(allSettle);
List<String> projectTime = projectSettleIncomeRepository.getProjectTime();
if (CollectionUtil.isNotEmpty(projectTime)) {
for (String time : projectTime) {
PrimaryIndicatorBean primaryIndicatorBean = new PrimaryIndicatorBean();
primaryIndicatorBean.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);
BigDecimal incomeService = allSettleIncome.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleIncome.TYPE_SERVICE).map(ProjectSettleIncome::getIncomeTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
primaryIndicatorBean.setIncomeDevice(incomeDevice);
primaryIndicatorBean.setIncomeEngineer(incomeEngineer);
primaryIndicatorBean.setIncomeService(incomeService);
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);
BigDecimal costOther = allSettleCost.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCost.TYPE_OTHER).map(ProjectSettleCost::getCostTaxExclude).reduce(BigDecimal.ZERO, BigDecimal::add);
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);
primaryIndicatorBean.setCostPurchaseOther(costOther);
primaryIndicatorBean.setCostProjectManage(costProjectManage);
primaryIndicatorBean.setCostOtherOther(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);
list.add(primaryIndicatorBean);
}
}
return list;
}
@ -112,10 +218,117 @@ public class StatisticsService {
*
* @return
*/
public List getCashFlow() {
public List<CashFlowStatisticsBean> getCashFlow() {
List<CashFlowStatisticsBean> list = new ArrayList<>();
CashFlowStatisticsBean cashFlowStatisticsBean = new CashFlowStatisticsBean();
cashFlowStatisticsBean.setTitle("预算金额");
List<ProjectBudgetPlanDetail> cashFlows = projectBudgetPlanDetailRepository.findAll();
return null;
BigDecimal saleIncome = cashFlows.stream().map(ProjectBudgetPlanDetail::getSaleIncome).reduce(BigDecimal.ZERO, BigDecimal::add);
cashFlowStatisticsBean.setSaleIncomeCash(saleIncome);
BigDecimal earnestMoneyIncome = cashFlows.stream().map(ProjectBudgetPlanDetail::getEarnestMoneyIncome).reduce(BigDecimal.ZERO, BigDecimal::add);
cashFlowStatisticsBean.setEarnestMoneyIncome(earnestMoneyIncome);
BigDecimal deviceCost = cashFlows.stream().map(ProjectBudgetPlanDetail::getDeviceCost).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal engineerCost = cashFlows.stream().map(ProjectBudgetPlanDetail::getEngineerCost).reduce(BigDecimal.ZERO, BigDecimal::add);
cashFlowStatisticsBean.setPurchaseCost(deviceCost.add(engineerCost));
BigDecimal projectManageCost = cashFlows.stream().map(ProjectBudgetPlanDetail::getProjectManageCost).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal earnestMoneyCost = cashFlows.stream().map(ProjectBudgetPlanDetail::getEarnestMoneyCost).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal capitalInterest = cashFlows.stream().map(ProjectBudgetPlanDetail::getCapitalInterest).reduce(BigDecimal.ZERO, BigDecimal::add);
cashFlowStatisticsBean.setEarnestMoneyCost(projectManageCost.add(earnestMoneyCost).add(capitalInterest));
BigDecimal underWritten = cashFlows.stream().map(ProjectBudgetPlanDetail::getUnderwrittenPlan).reduce(BigDecimal.ZERO, BigDecimal::add);
cashFlowStatisticsBean.setFinancingCapitalInflow(underWritten);
BigDecimal repaymentPlan = cashFlows.stream().map(ProjectBudgetPlanDetail::getRepaymentPlan).reduce(BigDecimal.ZERO, BigDecimal::add);
cashFlowStatisticsBean.setFinancingCapitalOutflow(repaymentPlan);
cashFlowStatisticsBean.setNetCashFlow(saleIncome.add(earnestMoneyIncome).subtract(cashFlowStatisticsBean.getEarnestMoneyCost()));
cashFlowStatisticsBean.setFinancingCapitalCashflow(underWritten.subtract(repaymentPlan));
cashFlowStatisticsBean.setNetIncreaseMonetaryFunds(cashFlowStatisticsBean.getNetCashFlow().add(cashFlowStatisticsBean.getFinancingCapitalCashflow()));
list.add(cashFlowStatisticsBean);
List<String> projectTime = projectSettleCashFlowRepository.getProjectTime();
List<ProjectSettleCashFlow> all = projectSettleCashFlowRepository.findAll();
CashFlowStatisticsBean cashFlowStatisticsAll = new CashFlowStatisticsBean();
cashFlowStatisticsAll.setTitle("实际累计");
BigDecimal saleIncomeCashAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.SALE_INCOME_CASH).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal taxReturnAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.TAX_RETURN).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal earnestMoneyIncomeTimeAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.EARNEST_MONEY_INCOME).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal purchaseCostAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.PURCHASE_COST).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal taxCostAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.TAX_COST).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal earnestMoneyCostTimeAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.EARNEST_MONEY_COST).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal netCashFlowAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_CASH_FLOW).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal cashInflowFromInvestingActivitiesAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.CASH_INFLOW_FROM_INVESTING_ACTIVITIES).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal cashOutflowFromInvestingActivitiesAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.CASH_OUTFLOW_FROM_INVESTING_ACTIVITIES).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal netCashFromInvestingActivitiesAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_CASH_FROM_INVESTING_ACTIVITIES).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal financingCapitalInflowAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_INFLOW).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal financingCapitalOutflowAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_OUTFLOW).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal financingCapitalCashFlowAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_CASHFLOW).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal netIncreaseMonetaryFundsAll = all.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_INCREASE_MONETARY_FUNDS).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
cashFlowStatisticsAll.setSaleIncomeCash(saleIncomeCashAll);
cashFlowStatisticsAll.setTaxReturn(taxReturnAll);
cashFlowStatisticsAll.setEarnestMoneyIncome(earnestMoneyIncomeTimeAll);
cashFlowStatisticsAll.setPurchaseCost(purchaseCostAll);
cashFlowStatisticsAll.setTaxCost(taxCostAll);
cashFlowStatisticsAll.setEarnestMoneyCost(earnestMoneyCostTimeAll);
cashFlowStatisticsAll.setNetCashFlow(netCashFlowAll);
cashFlowStatisticsAll.setCashInflowFromInvestingActivities(cashInflowFromInvestingActivitiesAll);
cashFlowStatisticsAll.setCashOutflowFromInvestingActivities(cashOutflowFromInvestingActivitiesAll);
cashFlowStatisticsAll.setNetCashFromInvestingActivities(netCashFromInvestingActivitiesAll);
cashFlowStatisticsAll.setFinancingCapitalInflow(financingCapitalInflowAll);
cashFlowStatisticsAll.setFinancingCapitalOutflow(financingCapitalOutflowAll);
cashFlowStatisticsAll.setFinancingCapitalCashflow(financingCapitalCashFlowAll);
cashFlowStatisticsAll.setNetIncreaseMonetaryFunds(netIncreaseMonetaryFundsAll);
list.add(cashFlowStatisticsAll);
if (CollectionUtil.isNotEmpty(projectTime)) {
for (String time : projectTime) {
CashFlowStatisticsBean cashFlowStatistics = new CashFlowStatisticsBean();
cashFlowStatistics.setTitle(time);
BigDecimal saleIncomeCash = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.SALE_INCOME_CASH).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal taxReturn = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.TAX_RETURN).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal earnestMoneyIncomeTime = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.EARNEST_MONEY_INCOME).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal purchaseCost = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.PURCHASE_COST).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal taxCost = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.TAX_COST).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal earnestMoneyCostTime = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.EARNEST_MONEY_COST).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal netCashFlow = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.NET_CASH_FLOW).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal cashInflowFromInvestingActivities = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.CASH_INFLOW_FROM_INVESTING_ACTIVITIES).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal cashOutflowFromInvestingActivities = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.CASH_OUTFLOW_FROM_INVESTING_ACTIVITIES).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal netCashFromInvestingActivities = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.NET_CASH_FROM_INVESTING_ACTIVITIES).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal financingCapitalInflow = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_INFLOW).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal financingCapitalOutflow = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_OUTFLOW).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal financingCapitalCashFlow = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_CASHFLOW).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal netIncreaseMonetaryFunds = all.stream().filter(d -> d.getTime().equals(time) && d.getType() == ProjectSettleCashFlow.NET_INCREASE_MONETARY_FUNDS).map(ProjectSettleCashFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
cashFlowStatistics.setSaleIncomeCash(saleIncomeCash);
cashFlowStatistics.setTaxReturn(taxReturn);
cashFlowStatistics.setEarnestMoneyIncome(earnestMoneyIncomeTime);
cashFlowStatistics.setPurchaseCost(purchaseCost);
cashFlowStatistics.setTaxCost(taxCost);
cashFlowStatistics.setEarnestMoneyCost(earnestMoneyCostTime);
cashFlowStatistics.setNetCashFlow(netCashFlow);
cashFlowStatistics.setCashInflowFromInvestingActivities(cashInflowFromInvestingActivities);
cashFlowStatistics.setCashOutflowFromInvestingActivities(cashOutflowFromInvestingActivities);
cashFlowStatistics.setNetCashFromInvestingActivities(netCashFromInvestingActivities);
cashFlowStatistics.setFinancingCapitalInflow(financingCapitalInflow);
cashFlowStatistics.setFinancingCapitalOutflow(financingCapitalOutflow);
cashFlowStatistics.setFinancingCapitalCashflow(financingCapitalCashFlow);
cashFlowStatistics.setNetIncreaseMonetaryFunds(netIncreaseMonetaryFunds);
list.add(cashFlowStatistics);
}
}
return list;
}
}

View File

@ -32,6 +32,7 @@
<th class="table-date">结束时间</th>
<th class="table-date">用时</th>
<th class="table-set am-text-center">意见</th>
<th class="table-set am-text-center">操作</th>
</tr>
</thead>
<tbody>
@ -47,6 +48,25 @@
</#if></td>
<td>${list.duration!}</td>
<td>${list.comments!}</td>
<td>
<#if !list.endTime??>
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="completeTask('${list.procInsId}', '${list.taskId}', 2)">
<span class="am-icon-pencil-square-o"></span>
审批通过
</button>
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="completeTask('${list.procInsId}', '${list.taskId}', 3)">
<span class="am-icon-pencil-square-o"></span>
驳回
</button>
</#if>
</td>
</tr>
</#list>
</#if>

View File

@ -254,7 +254,6 @@
var startProcIns = function (procDefKey) {
var params = {
projectId: 1,
projectType: 3
};
$.ajax({

View File

@ -29,16 +29,14 @@
<td colspan="2">
<div align='right'>
<#-- <@shiro.hasPermission name="HUMAN_QUERY">-->
<@shiro.hasPermission name="HUMAN_QUERY">
<button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
id="submit-btn">搜索
</button>
<#-- </@shiro.hasPermission>-->
<#-- <@shiro.hasPermission name="HUMAN_EXPORT">-->
<button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
id="submit-btn-export">导出
</button>
<#-- </@shiro.hasPermission>-->
</@shiro.hasPermission>
</div>
</td>
</tr>

View File

@ -85,23 +85,21 @@
<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" autocomplete="off" value="${time!}">
<input type="text" id="time" autocomplete="off" readonly value="${time!}">
</div>
</div>
</div>
</td>
<td colspan="4">
<div align='right'>
<#-- <@shiro.hasPermission name="HUMAN_COST_QUERY">-->
<@shiro.hasPermission name="HUMAN_COST_QUERY">
<button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
id="submit-btn">搜索
</button>
<#-- </@shiro.hasPermission>-->
<#-- <@shiro.hasPermission name="HUMAN_COST_QUERY">-->
<button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
id="submit-btn-export">导出
</button>
<#-- </@shiro.hasPermission>-->
</@shiro.hasPermission>
</div>
</td>
</tr>
@ -113,19 +111,18 @@
<div class="am-u-sm-12 am-u-md-12" style="padding:0 1.6rem 1.6rem 1rem;margin:0;">
<div class="am-btn-toolbar" style="padding-left:.5rem;">
<div class="am-btn-group am-btn-group-xs">
<#-- <@shiro.hasPermission name="HUMAN_COST_IMPORT">-->
<@shiro.hasPermission name="HUMAN_COST_IMPORT">
<div class="am-btn-group am-btn-group-xs am-form-file">
<button type="button" id="importAccount" class="am-btn am-btn-default"><span
<button type="button" id="importAccount" onclick="windows()" class="am-btn am-btn-default"><span
class="am-icon-archive"></span> 批量导入
</button>
<input id="doc-form-file" type="file" name="file"
onChange="ajaxUploadFile('doc-form-file','${base}/humanCost/batchImport')"
multiple>
</div>
<button type="button" id="importTemplate" class="am-btn am-btn-default" >
<span class="am-icon-arrow-circle-down"></span> 导入模板
</button>
<#-- </@shiro.hasPermission>-->
</@shiro.hasPermission>
成本总计:${(total!0)?string("0.##")}
</div>
</div>
</div>
@ -182,7 +179,6 @@
</div>
</div>
<footer class="admin-content-footer">
<hr>
</footer>
@ -190,7 +186,7 @@
</@defaultLayout.layout>
<script src="../assets/js/jquery.ajaxfileupload.js"></script>
<script src="../assets/js/amazeui.switch.js"></script>
<script src="${base}/layui/layui.js"></script>
<script src="../layui/layui.js"></script>
<script type="text/javascript">
layui.use('laydate', function(){
var laydate = layui.laydate;
@ -206,6 +202,33 @@
});
});
function windows() {
layui.use('layer', function(){
var layer = layui.layer;
var html = '<input type="text" name="layTime" id="layTime" class="form-control layer-date" readonly required value="${time!}">\n' +
'<input id="doc-form-file" type="file" name="file" onChange="ajaxUploadFile(\'doc-form-file\',\'${base}/humanCost/batchImport\')">'
layer.open({
type: 1,
title: "选择导入时间",
offset: '0px',
id: 'layerDemo',
content: html,
area: ['400px', '400px'],
success: function (layero, index) {
layui.laydate.render({
elem: "#layTime",
type: 'month',
btns: ['confirm'],
trigger: 'click',
ready: function(date){
console.log(date);
}
});
}
});
});
};
/**
*导入模板下载
*/
@ -214,22 +237,15 @@
});
function ajaxUploadFile(id, url) {
// if ($('#modal')) {
// $('#modal').modal('open');
// $('#span-' + id).html("&nbsp;&nbsp;&nbsp;&nbsp;数据正在导入,请等待");
// }
$("#exportFaildButton").hide();
var date = $("#layTime").val();
console.log("date:" + date);
$.ajaxFileUpload({
url: url,
url: url + '?date=' + date,
secureuri: false,
fileElementId: id,// file标签的id
dataType: 'json',// 返回数据的类型
success: function (data, status) {
console.log("--------success---------" + data)
// if($('#modal')){
// $('#modal').modal('close');
// $('#span-'+id).html("导入完成");
// }
if(data.status ==0) {
var list = data.data;
var content = '';
@ -251,9 +267,6 @@
error: function (data, status, e) {
console.log("--------error---------" + data)
alert("-----------------" + data);
if ($('#modal')) {
$('#modal').modal('close');
}
alert(e);
$("#" + id).val("");
}

View File

@ -64,7 +64,7 @@
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in" id="tab2">
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>
<thead>
<tr>
<td>/</td>
<td>营业收入</td>
@ -81,6 +81,30 @@
<td>项目净利润</td>
<td>项目净利润率</td>
</tr>
</thead>
<tbody>
<#if (cashFlowList)?exists && (cashFlowList?size>0)>
<#list cashFlowList as list>
<tr>
<td>${list.title!}</td>
<td>${list.saleIncomeCash!}</td>
<td>${list.taxReturn!}</td>
<td>${list.earnestMoneyIncome!}</td>
<td>${list.purchaseCost!}</td>
<td>${list.taxCost!}</td>
<td>${list.earnestMoneyCost!}</td>
<td>${list.netCashFlow!}</td>
<td>${list.cashInflowFromInvestingActivities!}</td>
<td>${list.cashOutflowFromInvestingActivities!}</td>
<td>${list.netCashFromInvestingActivities!}</td>
<td>${list.financingCapitalInflow!}</td>
<td>${list.financingCapitalOutflow!}</td>
<td>${list.financingCapitalCashflow!}</td>
<td>${list.netIncreaseMonetaryFunds!}</td>
</tr>
</#list>
</#if>
</tbody>
</table>
</div>
@ -89,7 +113,7 @@
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in" id="tab3">
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>
<thead>
<tr>
<td>/</td>
<td>销售商品、提供劳务收到的现金</td>
@ -107,6 +131,29 @@
<td>筹资活动产生的现金流量净额</td>
<td>货币资金净增加额</td>
</tr>
</thead>
<tbody>
<#if (cashFlowList)?exists && (cashFlowList?size>0)>
<#list cashFlowList as list>
<tr>
<td>${list.title!}</td>
<td>${list.saleIncomeCash!}</td>
<td>${list.taxReturn!}</td>
<td>${list.earnestMoneyIncome!}</td>
<td>${list.purchaseCost!}</td>
<td>${list.taxCost!}</td>
<td>${list.earnestMoneyCost!}</td>
<td>${list.netCashFlow!}</td>
<td>${list.cashInflowFromInvestingActivities!}</td>
<td>${list.cashOutflowFromInvestingActivities!}</td>
<td>${list.netCashFromInvestingActivities!}</td>
<td>${list.financingCapitalInflow!}</td>
<td>${list.financingCapitalOutflow!}</td>
<td>${list.financingCapitalCashflow!}</td>
<td>${list.netIncreaseMonetaryFunds!}</td>
</tr>
</#list>
</#if>
</tbody>
</table>
</div>

View File

@ -62,7 +62,7 @@
<td><input name="incomeDeviceBudgetTotal" type="number" value="${Utils.format(budgetBean.incomeDeviceTaxExclude,'0')}" required readonly title="设备类预算总额"></td>
<td><input name="incomeDeviceFormerSettleTotal" type="number" value="${Utils.format(formerBean.incomeDeviceTaxExclude,'0')}" required readonly title="设备类上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="incomeDevice" required title="本月结算金额"></td>
<td><input type="number" name="incomeDeviceSettleTotal" readonly title="设备类结算总额"></td>
<td><input type="number" name="incomeDeviceSettleTotal" readonly title="设备类结算总额" data-validate-async data-validation-message="结算总额不能大于预算总额" ></td>
</tr>
<tr>
<td>收入</td>
@ -407,38 +407,98 @@
<script>
var base = "${base}";
</script>
<script src="${base}/layui/layui.js"></script>
<#-- <script src="${base}/layui/layui.js"></script>-->
<script src="${base}/assets/js/project_common.js"></script>
<script src="${base}/assets/js/project_settle.js"></script>
<script>
$(function () {
/*表单验证begin*/
//自定义规则用法验证元素上加class="js-pattern-sort"
if ($.AMUI && $.AMUI.validator) {
$.AMUI.validator.patterns.sort = /^([0-9]+)$/;
}
$("#tmpForm").validator({
// 域通过验证时回调
onValid: function (validity) {
$(validity.field).closest('.am-form-group').find('.am-alert').hide();
},
// 域验证通过时添加的操作,通过该接口可定义各种验证提示
markValid: function (validity) {
// this is Validator instance
var $field = $(validity.field);
//add by zxl只对有required属性的字段进行验证
if (typeof ($field.attr("required")) != "undefined") {
var options = this.options;
var $parent = $field.closest('.am-form-group');
$field.addClass(options.validClass).removeClass(options.inValidClass);
layui.use('laydate', function(){
var laydate = layui.laydate;
$parent.addClass('am-form-success').removeClass('am-form-error');
laydate.render({
elem: '#time',
type: 'month',
btns: ['confirm'],
trigger: 'click',
ready: function(date){
console.log(date);
options.onValid.call(this, validity);
}
},
// 验证出错时的回调, validity 对象包含相关信息,格式通 H5 表单元素的 validity 属性
onInValid: function (validity) {
var $field = $(validity.field);
var $group = $field.closest('.am-form-group');
var $alert = $group.find('.am-alert');
// 使用自定义的提示信息 或 插件内置的提示信息
var msg = $field.data('validationMessage') || this.getValidationMessage(validity);
if (!$alert.length) {
$alert = $("<div class='am-alert am-alert-danger'></div>").hide().appendTo($group.find(".input-msg"));
}
console.log("onInValid : " + $field.val());
$alert.html(msg).show();
},
//自定义验证
validate: function (validity) {
var $field = $(validity.field);
var validityIdCard = function () {
var settle = $("#incomeDeviceSettleTotal").val();
var budget = $("#incomeDeviceBudgetTotal").val();
if (settle > budget) {
$myField = $field;
myMsg = "身份证信息不合法!";
validity.valid = false;
}
};
if ($(validity.field).is('#incomeDeviceSettleTotal')) {
validityIdCard();
};
}
});
/*表单验证end*/
});
// layui.use('laydate', function(){
// var laydate = layui.laydate;
//
// laydate.render({
// elem: '#time',
// type: 'month',
// btns: ['confirm'],
// trigger: 'click',
// ready: function(date){
// console.log(date);
// }
// });
// });
$(function () {
calculateSettle();
$("#saveSettle").click(function () {
$("#pmsForm").attr("action","${base}/project/settle/save");
$("#pmsForm").submit();
});
$("#saveApprove").click(function () {
$("#pmsForm").attr("action",base+"/project/settle/saveAndApprove");
$("#pmsForm").submit();
});
$("#saveSettle").click(function () {
$("#pmsForm").attr("action","${base}/project/settle/save");
$("#pmsForm").submit();
});
$("#saveApprove").click(function () {
$("#pmsForm").attr("action",base+"/project/settle/saveAndApprove");
$("#pmsForm").submit();
});
});
</script>
</@defaultLayout.layout>

View File

@ -407,23 +407,23 @@
<script>
var base = "${base}";
</script>
<script src="${base}/layui/layui.js"></script>
<#-- <script src="${base}/layui/layui.js"></script>-->
<script src="${base}/assets/js/project_common.js"></script>
<script src="${base}/assets/js/project_settle.js"></script>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#time',
type: 'month',
btns: ['confirm'],
trigger: 'click',
ready: function(date){
console.log(date);
}
});
});
// layui.use('laydate', function(){
// var laydate = layui.laydate;
//
// laydate.render({
// elem: '#time',
// type: 'month',
// btns: ['confirm'],
// trigger: 'click',
// ready: function(date){
// console.log(date);
// }
// });
// });
$(function () {
calculateSettle();

View File

@ -17,6 +17,7 @@
<br/>
<br/>
<form method="post" class="am-form" id="pmsForm">
<input type="hidden" id="keywords" name="keywords" value='${keywords!""}'/>
<!--选项卡tabsbegin-->
<div class="am-tabs am-margin" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">
@ -197,11 +198,30 @@
type: 'month',
btns: ['confirm'],
trigger: 'click',
ready: function(date){
console.log(date);
ready: function(){
console.log($(this.elem).val());
},
done: function() {
var time = $(this.elem).val();
console.log("time:" + time)
setKeywords(time);
$("#pmsForm").attr("action","${base}/projectSummary/list");
$("#pmsForm").submit();
}
});
});
function setKeywords(time) {
var keywordsObj = {};
keywordsObj.time = time;
var keywords = "";
if (!$.isEmptyObject(keywordsObj)) {
keywords = JSON.stringify(keywordsObj);
}
console.log("keywords = " + keywords);
$("#keywords").val(keywords);
}
</script>
</@defaultLayout.layout>