dev_1.0.0
‘wangjiuyun 2024-10-28 20:04:02 +08:00
commit 750b55940b
5 changed files with 82 additions and 45 deletions

View File

@ -605,15 +605,15 @@ public class ProjectController extends BaseController {
public ResponseMsg budgetEditSaveBudgetPayPlan(@RequestBody String body) { public ResponseMsg budgetEditSaveBudgetPayPlan(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body); JSONObject jsonObject = JSON.parseObject(body);
JSONArray details = jsonObject.getJSONArray(DETAILS); JSONArray details = jsonObject.getJSONArray(DETAILS);
List<ProjectBudgetPayPlan> detailList = new ArrayList<>(details.size()); List<ProjectBudgetPayPlanTemp> detailList = new ArrayList<>(details.size());
for (int i = 0; i < details.size(); i++) { for (int i = 0; i < details.size(); i++) {
ProjectBudgetPayPlan detail = details.getObject(i, ProjectBudgetPayPlan.class); ProjectBudgetPayPlanTemp detail = details.getObject(i, ProjectBudgetPayPlanTemp.class);
detailList.add(detail); detailList.add(detail);
} }
Project project = projectService.getProject(jsonObject.getInteger(PROJECT_ID)); Project project = projectService.getProject(jsonObject.getInteger(PROJECT_ID));
projectBudgetService.saveBudgetPayPlan(project, detailList); projectBudgetService.saveBudgetPayPlanTemp(project, detailList);
return ResponseMsg.buildSuccessMsg("成功"); return ResponseMsg.buildSuccessMsg("成功");
} }
@ -1254,8 +1254,8 @@ public class ProjectController extends BaseController {
//收入明细 //收入明细
List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project); List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project);
BigDecimal incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project); BigDecimal incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project);
String[] headers2 = {"序号", "", "名称", "规格类型", "参数", "单位", "数量", "单价", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)"}; String[] headers2 = {"序号", "产品大类", "名称", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)"};
String[] columns2 = {"tempId", "type", "name", "spec", "param", "unit", "amount", "price", "taxRate", "totalTaxInclude", "totalTaxExclude", "totalTax"}; String[] columns2 = {"tempId", "type", "name", "taxRate", "totalTaxInclude", "totalTaxExclude", "totalTax"};
exportExcelUtils.exportIncomeDetailExcel(headers2, columns2, project, budgetBean, budgetIncomeDetail, incomeTotalAmount, "yyyy-MM-dd", 0, "收入明细表", outputStream); exportExcelUtils.exportIncomeDetailExcel(headers2, columns2, project, budgetBean, budgetIncomeDetail, incomeTotalAmount, "yyyy-MM-dd", 0, "收入明细表", outputStream);
exportExcelUtils.end(outputStream); exportExcelUtils.end(outputStream);
@ -1302,8 +1302,8 @@ public class ProjectController extends BaseController {
BigDecimal costPayAmountTotal = projectBudgetService.getBudgetCostPayAmountTotal(project); BigDecimal costPayAmountTotal = projectBudgetService.getBudgetCostPayAmountTotal(project);
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList(); List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
Map<Integer, String> procurementMap = procurementTypes.stream().collect(Collectors.toMap(ProcurementType::getId, ProcurementType::getName)); Map<Integer, String> procurementMap = procurementTypes.stream().collect(Collectors.toMap(ProcurementType::getId, ProcurementType::getName));
String[] headers3 = {"序号", "费用项目", "采购类别", "名称", "单位", "数量", "单价", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)", "签约方", "是否垫资", "预估垫资金额(元)", "支出时间", "支出金额(元)", "付款方式", "备注"}; String[] headers3 = {"序号", "采购成本项目", "产品大类", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)", "供应商", "备注"};
String[] columns3 = {"tempId", "type", "category", "name", "unit", "amount", "price", "taxRate", "totalTaxInclude", "totalTaxExclude", "totalTax", "contractParty", "isUnderwritten", "underwrittenAmount", "payTime", "payAmount", "payWay", "remark"}; String[] columns3 = {"tempId", "type", "category", "taxRate", "totalTaxInclude", "totalTaxExclude", "totalTax", "contractParty", "remark"};
exportExcelUtils.exportCostDetailExcel(headers3, columns3, project, budgetBean, budgetCostDetail, costTotalAmount, costUnderwrittenAmountTotal, costPayAmountTotal, procurementMap, "yyyy-MM-dd", 0, "采购成本明细表", outputStream); exportExcelUtils.exportCostDetailExcel(headers3, columns3, project, budgetBean, budgetCostDetail, costTotalAmount, costUnderwrittenAmountTotal, costPayAmountTotal, procurementMap, "yyyy-MM-dd", 0, "采购成本明细表", outputStream);
exportExcelUtils.end(outputStream); exportExcelUtils.end(outputStream);
@ -1325,8 +1325,8 @@ public class ProjectController extends BaseController {
List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail = projectBudgetService.getBudgetCostProjectManageDetail(project); List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail = projectBudgetService.getBudgetCostProjectManageDetail(project);
BigDecimal costProjectManageTotalAmount = projectBudgetService.getBudgetCostProjectManageAmount(project); BigDecimal costProjectManageTotalAmount = projectBudgetService.getBudgetCostProjectManageAmount(project);
BigDecimal managePayAmountTotal = projectBudgetService.getBudgetCostProjectManagePayAmount(project); BigDecimal managePayAmountTotal = projectBudgetService.getBudgetCostProjectManagePayAmount(project);
String[] headers4 = {"序号", "财务费用类别", "业务项目", "项目明细", "单位", "数量", "单价", "总金额(元)", "支出时间", "支出金额(元)", "预估计算方法", "预估依据", "备注"}; String[] headers4 = {"序号", "费用类别", "业务项目", "项目明细", "总金额(元)", "支出时间", "支出金额(元)", "预估计算方法", "预估依据", "备注"};
String[] columns4 = {"tempId", "type", "name", "detail", "unit", "amount", "price", "total", "payTime", "payAmount", "predictMethod", "predictWhy", "remark"}; String[] columns4 = {"tempId", "type", "name", "detail", "total", "payTime", "payAmount", "predictMethod", "predictWhy", "remark"};
exportExcelUtils.exportCostManageDetailExcel(headers4, columns4, project, budgetBean, budgetCostProjectManageDetail, costProjectManageTotalAmount, managePayAmountTotal, "yyyy-MM-dd", 0, "项目管理成本表", outputStream); exportExcelUtils.exportCostManageDetailExcel(headers4, columns4, project, budgetBean, budgetCostProjectManageDetail, costProjectManageTotalAmount, managePayAmountTotal, "yyyy-MM-dd", 0, "项目管理成本表", outputStream);
exportExcelUtils.end(outputStream); exportExcelUtils.end(outputStream);

View File

@ -0,0 +1,19 @@
package cn.palmte.work.model;
import org.springframework.beans.BeanUtils;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
*
*/
@Entity
@Table(name = "project_budget_pay_plan_temp")
public class ProjectBudgetPayPlanTemp extends ProjectBudgetPayPlanBase {
public ProjectBudgetPayPlan toProjectBudgetPayPlanDetail() {
ProjectBudgetPayPlan projectBudgetPayPlan = new ProjectBudgetPayPlan();
BeanUtils.copyProperties(this, projectBudgetPayPlan);
return projectBudgetPayPlan;
}
}

View File

@ -0,0 +1,10 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectBudgetPayPlanTempRepository extends JpaRepository<ProjectBudgetPayPlanTemp,Integer> {
List<ProjectBudgetPayPlanTemp> findAllByProjectIdEquals(int id);
}

View File

@ -13,7 +13,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import top.jfunc.common.utils.CollectionUtil; import top.jfunc.common.utils.CollectionUtil;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -41,6 +40,8 @@ public class ProjectBudgetService {
@Autowired @Autowired
private ProjectBudgetPayPlanRepository projectBudgetPayPlanRepository; private ProjectBudgetPayPlanRepository projectBudgetPayPlanRepository;
@Autowired @Autowired
private ProjectBudgetPayPlanTempRepository projectBudgetPayPlanTempRepository;
@Autowired
private ProjectBudgetIncomePlanDetailTempRepository projectBudgetIncomePlanDetailTempRepository; private ProjectBudgetIncomePlanDetailTempRepository projectBudgetIncomePlanDetailTempRepository;
@Autowired @Autowired
private ProjectBudgetCostDetailRepository projectBudgetCostDetailRepository; private ProjectBudgetCostDetailRepository projectBudgetCostDetailRepository;
@ -1105,6 +1106,14 @@ public class ProjectBudgetService {
.collect(Collectors.toList()); .collect(Collectors.toList());
projectBudgetCostDetailRepository.save(costDetails); projectBudgetCostDetailRepository.save(costDetails);
} }
//付款计划表
List<ProjectBudgetPayPlanTemp> projectBudgetPayPlanTemps = projectBudgetPayPlanTempRepository.findAllByProjectIdEquals(p.getId());
if(CollectionUtil.isNotEmpty(projectBudgetPayPlanTemps)){
List<ProjectBudgetPayPlan> costDetails = projectBudgetPayPlanTemps.stream()
.map(ProjectBudgetPayPlanTemp::toProjectBudgetPayPlanDetail)
.collect(Collectors.toList());
projectBudgetPayPlanRepository.save(costDetails);
}
//项目管理明细 //项目管理明细
List<ProjectBudgetCostProjectManageDetailTemp> projectBudgetCostProjectManageDetailTemps = projectBudgetCostProjectManageDetailTempRepository.findAllByProjectIdEquals(p.getId()); List<ProjectBudgetCostProjectManageDetailTemp> projectBudgetCostProjectManageDetailTemps = projectBudgetCostProjectManageDetailTempRepository.findAllByProjectIdEquals(p.getId());
if(CollectionUtil.isNotEmpty(projectBudgetCostProjectManageDetailTemps)){ if(CollectionUtil.isNotEmpty(projectBudgetCostProjectManageDetailTemps)){
@ -1345,13 +1354,13 @@ public class ProjectBudgetService {
return projectBudgetPayPlanRepository.findAllByProjectIdEquals(project.getId()); return projectBudgetPayPlanRepository.findAllByProjectIdEquals(project.getId());
} }
public void saveBudgetPayPlan(Project project, List<ProjectBudgetPayPlan> detailList) { public void saveBudgetPayPlanTemp(Project project, List<ProjectBudgetPayPlanTemp> detailList) {
if(CollectionUtil.isNotEmpty(detailList)){ if(CollectionUtil.isNotEmpty(detailList)){
for (ProjectBudgetPayPlan temp : detailList) { for (ProjectBudgetPayPlanTemp temp : detailList) {
temp.setProjectId(project.getId()); temp.setProjectId(project.getId());
// temp.setUnderwrittenTaxRate(project.getUnderwrittenTaxRate()); // temp.setUnderwrittenTaxRate(project.getUnderwrittenTaxRate());
} }
projectBudgetPayPlanRepository.save(detailList); projectBudgetPayPlanTempRepository.save(detailList);
} }
} }
} }

View File

@ -7,18 +7,14 @@ import cn.palmte.work.utils.ObjectKit;
import cn.palmte.work.utils.Utils; import cn.palmte.work.utils.Utils;
import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import top.jfunc.common.db.bean.Record;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -196,7 +192,7 @@ public class ExportExcelUtils {
index = index + 3; index = index + 3;
// 成本 // 成本
Row costRow = sheet.createRow(index++); Row costRow = sheet.createRow(index++);
createTitleRow(costRow, "成本"); createTitleRow(costRow, "采购成本");
index = createCostRow(budgetBean, sheet, index, otherName, costTaxRates); index = createCostRow(budgetBean, sheet, index, otherName, costTaxRates);
index = index + 3; index = index + 3;
// 管理 // 管理
@ -363,7 +359,7 @@ public class ExportExcelUtils {
createEngineerCostRow(budgetBean, sheet, index++); createEngineerCostRow(budgetBean, sheet, index++);
createServiceCostRow(budgetBean, sheet, index++); createServiceCostRow(budgetBean, sheet, index++);
createOtherCostRow(budgetBean, sheet, index++); createOtherCostRow(budgetBean, sheet, index++);
createManageCostRow(budgetBean, sheet, index++); // createManageCostRow(budgetBean, sheet, index++);
createOtherRow(budgetBean, sheet, index++, otherName); createOtherRow(budgetBean, sheet, index++, otherName);
createTotalCostRow(budgetBean, sheet, index++); createTotalCostRow(budgetBean, sheet, index++);
Row row = sheet.createRow(index++); Row row = sheet.createRow(index++);
@ -443,7 +439,7 @@ public class ExportExcelUtils {
Cell thirdCell = row.createCell(2); Cell thirdCell = row.createCell(2);
thirdCell.setCellStyle(style2); thirdCell.setCellStyle(style2);
thirdCell.setCellType(CellType.STRING); thirdCell.setCellType(CellType.STRING);
thirdCell.setCellValue("工"); thirdCell.setCellValue("");
Cell fourthCell = row.createCell(3); Cell fourthCell = row.createCell(3);
fourthCell.setCellStyle(style2); fourthCell.setCellStyle(style2);
fourthCell.setCellType(CellType.NUMERIC); fourthCell.setCellType(CellType.NUMERIC);
@ -523,23 +519,11 @@ public class ExportExcelUtils {
Cell secondCell = row.createCell(1); Cell secondCell = row.createCell(1);
secondCell.setCellStyle(style2); secondCell.setCellStyle(style2);
secondCell.setCellType(CellType.STRING); secondCell.setCellType(CellType.STRING);
secondCell.setCellValue("项目管理成本"); secondCell.setCellValue("项目管理费用");
Cell thirdCell = row.createCell(2); Cell thirdCell = row.createCell(2);
thirdCell.setCellStyle(style2); thirdCell.setCellStyle(style2);
thirdCell.setCellType(CellType.STRING); thirdCell.setCellType(CellType.STRING);
thirdCell.setCellValue("项目管理成本"); thirdCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude()));
Cell fourthCell = row.createCell(3);
fourthCell.setCellStyle(style2);
fourthCell.setCellType(CellType.NUMERIC);
fourthCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxInclude()));
Cell fifthCell = row.createCell(4);
fifthCell.setCellStyle(style2);
fifthCell.setCellType(CellType.NUMERIC);
fifthCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude()));
Cell sixthCell = row.createCell(5);
sixthCell.setCellStyle(style2);
sixthCell.setCellType(CellType.STRING);
sixthCell.setCellValue("财务计取以不含税方式核算");
} }
private void createOtherRow(BudgetBean budgetBean, XSSFSheet sheet, int index, String otherName) { private void createOtherRow(BudgetBean budgetBean, XSSFSheet sheet, int index, String otherName) {
@ -598,10 +582,28 @@ public class ExportExcelUtils {
sixthCell.setCellValue(Utils.format(budgetBean.getCostTotalTax())); sixthCell.setCellValue(Utils.format(budgetBean.getCostTotalTax()));
} }
private void createManageTotalCostRow(BudgetBean budgetBean, XSSFSheet sheet, int index) {
Row row = sheet.createRow(index);
Cell firstCell = row.createCell(0);
firstCell.setCellStyle(style2);
firstCell.setCellType(CellType.STRING);
firstCell.setCellValue("合计");
Cell secondCell = row.createCell(1);
secondCell.setCellStyle(style2);
secondCell.setCellType(CellType.STRING);
secondCell.setCellValue("");
Cell thirdCell = row.createCell(2);
thirdCell.setCellStyle(style2);
thirdCell.setCellType(CellType.STRING);
thirdCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude().add(budgetBean.getCostExpropriationTaxExclude())));
}
private int createManageRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { private int createManageRow(BudgetBean budgetBean, XSSFSheet sheet, int index) {
createSubTitleManageRow(sheet, index++); createSubTitleManageRow(sheet, index++);
createExpropriationRow(budgetBean, sheet, index++); createExpropriationRow(budgetBean, sheet, index++);
createCompanyManageRow(budgetBean, sheet, index++); createManageCostRow(budgetBean, sheet, index++);
createManageTotalCostRow(budgetBean, sheet, index++);
// createCompanyManageRow(budgetBean, sheet, index++);
Row row = sheet.createRow(index++); Row row = sheet.createRow(index++);
Cell remarkCell = row.createCell(0); Cell remarkCell = row.createCell(0);
remarkCell.setCellStyle(style); remarkCell.setCellStyle(style);
@ -663,7 +665,7 @@ public class ExportExcelUtils {
createGrossProfitARow(budgetBean, sheet, index++); createGrossProfitARow(budgetBean, sheet, index++);
createGrossProfitRow(budgetBean, sheet, index++); createGrossProfitRow(budgetBean, sheet, index++);
// createGrossProfitMarginRow(budgetBean, sheet, index++); // createGrossProfitMarginRow(budgetBean, sheet, index++);
createContributionProfitRow(budgetBean, sheet, index++); // createContributionProfitRow(budgetBean, sheet, index++);
// createContributionProfitRateRow(budgetBean, sheet, index++); // createContributionProfitRateRow(budgetBean, sheet, index++);
return index; return index;
} }
@ -706,7 +708,7 @@ public class ExportExcelUtils {
Cell fourthCell = row.createCell(3); Cell fourthCell = row.createCell(3);
fourthCell.setCellStyle(style2); fourthCell.setCellStyle(style2);
fourthCell.setCellType(CellType.STRING); fourthCell.setCellType(CellType.STRING);
fourthCell.setCellValue("毛利=收入总计(不含税)-成本总计(不含税)"); fourthCell.setCellValue("项目毛利A=收入合计(不含税)-采购成本合计(不含税)");
} }
private void createGrossProfitRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { private void createGrossProfitRow(BudgetBean budgetBean, XSSFSheet sheet, int index) {
@ -714,7 +716,7 @@ public class ExportExcelUtils {
Cell firstCell = row.createCell(0); Cell firstCell = row.createCell(0);
firstCell.setCellStyle(style2); firstCell.setCellStyle(style2);
firstCell.setCellType(CellType.STRING); firstCell.setCellType(CellType.STRING);
firstCell.setCellValue("项目毛利(元)"); firstCell.setCellValue("项目毛利B(元)");
Cell secondCell = row.createCell(1); Cell secondCell = row.createCell(1);
secondCell.setCellStyle(style2); secondCell.setCellStyle(style2);
secondCell.setCellType(CellType.NUMERIC); secondCell.setCellType(CellType.NUMERIC);
@ -722,11 +724,11 @@ public class ExportExcelUtils {
Cell thirdCell = row.createCell(2); Cell thirdCell = row.createCell(2);
thirdCell.setCellStyle(style2); thirdCell.setCellStyle(style2);
thirdCell.setCellType(CellType.NUMERIC); thirdCell.setCellType(CellType.NUMERIC);
thirdCell.setCellValue(Utils.format(budgetBean.getProjectGrossProfit())); thirdCell.setCellValue(Utils.format(budgetBean.getProjectGrossProfitA().subtract(budgetBean.getCostProjectManageTaxExclude()).subtract(budgetBean.getCostExpropriationTaxExclude())));
Cell fourthCell = row.createCell(3); Cell fourthCell = row.createCell(3);
fourthCell.setCellStyle(style2); fourthCell.setCellStyle(style2);
fourthCell.setCellType(CellType.STRING); fourthCell.setCellType(CellType.STRING);
fourthCell.setCellValue("毛利=收入总计(不含税)-成本总计(不含税)-财务费用总计(不含税)"); fourthCell.setCellValue("项目毛利B=项目毛利A-财务费用-项目管理费用");
} }
// private void createGrossProfitMarginRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { // private void createGrossProfitMarginRow(BudgetBean budgetBean, XSSFSheet sheet, int index) {
@ -1375,13 +1377,10 @@ public class ExportExcelUtils {
if (i == 0) { if (i == 0) {
totalCell.setCellType(CellType.STRING); totalCell.setCellType(CellType.STRING);
totalCell.setCellValue("总计"); totalCell.setCellValue("总计");
} else if (i == 5) { } else if (i == 4) {
totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue(Utils.format(costProjectManageTotalAmount));
} else if (i == 7) {
totalCell.setCellType(CellType.NUMERIC); totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude())); totalCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude()));
} else if (i == 9) { } else if (i == 6) {
totalCell.setCellType(CellType.NUMERIC); totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue(Utils.format(managePayAmountTotal)); totalCell.setCellValue(Utils.format(managePayAmountTotal));
} else { } else {