数量支持小数

master
OathK1per 2022-11-04 15:48:33 +08:00
parent bdad08ba7d
commit 3fb00e7fed
9 changed files with 34 additions and 33 deletions

View File

@ -180,7 +180,7 @@ public class ProjectController extends BaseController {
}
//收入明细
List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project);
Integer incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project);
BigDecimal incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project);
Set<String> rates = new HashSet<>();
StringBuilder incomeTaxSb = new StringBuilder();
String incomeTaxRates;
@ -206,7 +206,7 @@ public class ProjectController extends BaseController {
exportExcelUtils.exportIncomePlanDetailExcel(headers6, columns6, project, budgetBean, budgetIncomePlanDetail, incomePlanTotalReceiveAmount, "yyyy-MM-dd", 0, "收款计划表", outputStream);
//成本明细
List<ProjectBudgetCostDetail> budgetCostDetail = projectBudgetService.getBudgetCostDetail(project);
Integer costTotalAmount = projectBudgetService.getBudgetCostAmount(project);
BigDecimal costTotalAmount = projectBudgetService.getBudgetCostAmount(project);
BigDecimal costUnderwrittenAmountTotal = projectBudgetService.getBudgetCostUnderwrittenAmountTotal(project);
BigDecimal costPayAmountTotal = projectBudgetService.getBudgetCostPayAmountTotal(project);
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
@ -230,7 +230,7 @@ public class ProjectController extends BaseController {
exportExcelUtils.exportCostDetailExcel(headers3, columns3, project, budgetBean, budgetCostDetail, costTotalAmount, costUnderwrittenAmountTotal, costPayAmountTotal, procurementMap, "yyyy-MM-dd", 0, "采购成本明细表", outputStream);
//项目管理成本明细
List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail = projectBudgetService.getBudgetCostProjectManageDetail(project);
Integer costProjectManageTotalAmount = projectBudgetService.getBudgetCostProjectManageAmount(project);
BigDecimal costProjectManageTotalAmount = projectBudgetService.getBudgetCostProjectManageAmount(project);
BigDecimal managePayAmountTotal = projectBudgetService.getBudgetCostProjectManagePayAmount(project);
String[] headers4 = {"序号", "财务费用类别", "业务项目", "项目明细", "单位", "数量", "单价", "总金额(元)", "支出时间", "支出金额(元)", "预估计算方法", "预估依据", "备注"};
String[] columns4 = {"tempId", "type", "name", "detail", "unit", "amount", "price", "total", "payTime", "payAmount", "predictMethod", "predictWhy", "remark"};
@ -1164,7 +1164,7 @@ public class ProjectController extends BaseController {
BudgetBean budgetBean = projectBudgetService.getBudget(project);
//收入明细
List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project);
Integer incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project);
BigDecimal incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project);
String[] headers2 = {"序号", "类别", "名称", "单位", "数量", "单价", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)"};
String[] columns2 = {"tempId", "type", "name", "unit", "amount", "price", "taxRate", "totalTaxInclude", "totalTaxExclude", "totalTax"};
exportExcelUtils.exportIncomeDetailExcel(headers2, columns2, project, budgetBean, budgetIncomeDetail, incomeTotalAmount, "yyyy-MM-dd", 0, "收入明细表", outputStream);
@ -1208,7 +1208,7 @@ public class ProjectController extends BaseController {
BudgetBean budgetBean = projectBudgetService.getBudget(project);
//成本明细
List<ProjectBudgetCostDetail> budgetCostDetail = projectBudgetService.getBudgetCostDetail(project);
Integer costTotalAmount = projectBudgetService.getBudgetCostAmount(project);
BigDecimal costTotalAmount = projectBudgetService.getBudgetCostAmount(project);
BigDecimal costUnderwrittenAmountTotal = projectBudgetService.getBudgetCostUnderwrittenAmountTotal(project);
BigDecimal costPayAmountTotal = projectBudgetService.getBudgetCostPayAmountTotal(project);
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
@ -1234,7 +1234,7 @@ public class ProjectController extends BaseController {
BudgetBean budgetBean = projectBudgetService.getBudget(project);
//项目管理成本明细
List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail = projectBudgetService.getBudgetCostProjectManageDetail(project);
Integer costProjectManageTotalAmount = projectBudgetService.getBudgetCostProjectManageAmount(project);
BigDecimal costProjectManageTotalAmount = projectBudgetService.getBudgetCostProjectManageAmount(project);
BigDecimal managePayAmountTotal = projectBudgetService.getBudgetCostProjectManagePayAmount(project);
String[] headers4 = {"序号", "财务费用类别", "业务项目", "项目明细", "单位", "数量", "单价", "总金额(元)", "支出时间", "支出金额(元)", "预估计算方法", "预估依据", "备注"};
String[] columns4 = {"tempId", "type", "name", "detail", "unit", "amount", "price", "total", "payTime", "payAmount", "predictMethod", "predictWhy", "remark"};

View File

@ -30,7 +30,7 @@ public class ProjectBudgetCostDetailBase {
private String name;
private String unit;
private int amount;
private BigDecimal amount;
private BigDecimal price;
@Column(name = "tax_rate")
@ -106,11 +106,11 @@ public class ProjectBudgetCostDetailBase {
this.unit = unit;
}
public int getAmount() {
public BigDecimal getAmount() {
return amount;
}
public void setAmount(int amount) {
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
@ -190,7 +190,7 @@ public class ProjectBudgetCostDetailBase {
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
return price.multiply(amount);
}
public BigDecimal getTotalTaxExclude(){
BigDecimal totalTaxInclude = getTotalTaxInclude();

View File

@ -10,7 +10,7 @@ public interface ProjectBudgetCostDetailRepository extends JpaRepository<Project
List<ProjectBudgetCostDetail> findAllByProjectIdEquals(int id);
@Query(value = "select sum(amount) from project_budget_cost_detail where project_id = ?1", nativeQuery = true)
Integer findAmountByProject(int projectId);
BigDecimal findAmountByProject(int projectId);
@Query(value = "select sum(pay_amount) from project_budget_cost_detail where project_id = ?1", nativeQuery = true)
BigDecimal findPayAmountByProject(int id);

View File

@ -29,7 +29,7 @@ public class ProjectBudgetCostProjectManageDetailBase {
private String detail;
private String unit;
private int amount;
private BigDecimal amount;
private BigDecimal price;
@Column(name = "pay_time")
@ -96,11 +96,11 @@ public class ProjectBudgetCostProjectManageDetailBase {
this.unit = unit;
}
public int getAmount() {
public BigDecimal getAmount() {
return amount;
}
public void setAmount(int amount) {
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
@ -164,7 +164,7 @@ public class ProjectBudgetCostProjectManageDetailBase {
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
return price.multiply(amount);
}
public int getDeletable() {

View File

@ -10,7 +10,7 @@ public interface ProjectBudgetCostProjectManageDetailRepository extends JpaRepos
List<ProjectBudgetCostProjectManageDetail> findAllByProjectIdEquals(int id);
@Query(value = "select sum(amount) from project_budget_cost_project_manage_detail where project_id = ?1", nativeQuery = true)
Integer findAmountByProject(int id);
BigDecimal findAmountByProject(int id);
@Query(value = "select sum(pay_amount) from project_budget_cost_project_manage_detail where project_id = ?1", nativeQuery = true)
BigDecimal findPayAmountByProject(int id);

View File

@ -27,7 +27,7 @@ public class ProjectBudgetIncomeDetailBase {
private String name;
private String unit;
private int amount;
private BigDecimal amount;
private BigDecimal price;
@Column(name = "tax_rate")
@ -73,11 +73,11 @@ public class ProjectBudgetIncomeDetailBase {
this.unit = unit;
}
public int getAmount() {
public BigDecimal getAmount() {
return amount;
}
public void setAmount(int amount) {
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
@ -101,7 +101,7 @@ public class ProjectBudgetIncomeDetailBase {
if(null == price){
return null;
}
return price.multiply(new BigDecimal(amount));
return price.multiply(amount);
}
public BigDecimal getTotalTaxExclude(){
BigDecimal totalTaxInclude = getTotalTaxInclude();

View File

@ -3,11 +3,12 @@ package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.math.BigDecimal;
import java.util.List;
public interface ProjectBudgetIncomeDetailRepository extends JpaRepository<ProjectBudgetIncomeDetail,Integer> {
List<ProjectBudgetIncomeDetail> findAllByProjectIdEquals(int id);
@Query(value = "select sum(amount) from project_budget_income_detail where project_id = ?1", nativeQuery = true)
Integer findAmountByProject(int projectId);
BigDecimal findAmountByProject(int projectId);
}

View File

@ -391,7 +391,7 @@ public class ProjectBudgetService {
/**
*
*/
public Integer getBudgetIncomeAmount(Project project){
public BigDecimal getBudgetIncomeAmount(Project project){
return projectBudgetIncomeDetailRepository.findAmountByProject(project.getId());
}
@ -500,7 +500,7 @@ public class ProjectBudgetService {
/**
*
*/
public Integer getBudgetCostAmount(Project project){
public BigDecimal getBudgetCostAmount(Project project){
return projectBudgetCostDetailRepository.findAmountByProject(project.getId());
}
/**
@ -571,7 +571,7 @@ public class ProjectBudgetService {
/**
*
*/
public Integer getBudgetCostProjectManageAmount(Project project){
public BigDecimal getBudgetCostProjectManageAmount(Project project){
return projectBudgetCostProjectManageDetailRepository.findAmountByProject(project.getId());
}
/**
@ -588,7 +588,7 @@ public class ProjectBudgetService {
detail.setType(Integer.parseInt(split[0]));
detail.setName(split[1]);
detail.setPrice(new BigDecimal(0));
detail.setAmount(0);
detail.setAmount(new BigDecimal(0));
detail.setDeletable(0);
projectManageDetails.add(detail);
}
@ -1027,7 +1027,7 @@ public class ProjectBudgetService {
key = "数量";
o1 = m.get(key);
if (o1 != null) {
temp.setAmount(Integer.parseInt((String) o1));
temp.setAmount(new BigDecimal((String) o1));
}
key = "单价";
o1 = m.get(key);
@ -1126,7 +1126,7 @@ public class ProjectBudgetService {
key = "数量";
o1 = m.get(key);
if (o1 != null) {
temp.setAmount(Integer.parseInt((String) o1));
temp.setAmount(new BigDecimal((String) o1));
}
key = "单价";
o1 = m.get(key);

View File

@ -974,7 +974,7 @@ public class ExportExcelUtils {
out.close();
}
public void exportIncomeDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetIncomeDetail> budgetIncomeDetail, Integer incomeTotalAmount, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
public void exportIncomeDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetIncomeDetail> budgetIncomeDetail, BigDecimal incomeTotalAmount, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
// 遍历集合数据,产生数据行
int index = rowIndex;
XSSFSheet sheet = workbook.createSheet(sheetName);
@ -1042,7 +1042,7 @@ public class ExportExcelUtils {
totalCell.setCellValue("总计");
} else if (i == 4) {
totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue((incomeTotalAmount == null) ? 0 : incomeTotalAmount);
totalCell.setCellValue(Utils.format(incomeTotalAmount));
} else if (i == 7) {
totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue(Utils.format(budgetBean.getIncomeTotalTaxInclude()));
@ -1128,7 +1128,7 @@ public class ExportExcelUtils {
}
}
public void exportCostDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetCostDetail> budgetCostDetail, Integer costTotalAmount, BigDecimal costUnderwrittenAmountTotal, BigDecimal costPayAmountTotal, Map<Integer, String> procurementMap, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
public void exportCostDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetCostDetail> budgetCostDetail, BigDecimal costTotalAmount, BigDecimal costUnderwrittenAmountTotal, BigDecimal costPayAmountTotal, Map<Integer, String> procurementMap, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
// 遍历集合数据,产生数据行
int index = rowIndex;
XSSFSheet sheet = workbook.createSheet(sheetName);
@ -1208,7 +1208,7 @@ public class ExportExcelUtils {
totalCell.setCellValue("总计");
} else if (i == 5) {
totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue((costTotalAmount == null) ? 0 : costTotalAmount);
totalCell.setCellValue(Utils.format(costTotalAmount));
} else if (i == 8) {
totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue(Utils.format(budgetBean.getCostPurchaseTotalTaxInclude()));
@ -1231,7 +1231,7 @@ public class ExportExcelUtils {
}
}
public void exportCostManageDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail, Integer costProjectManageTotalAmount, BigDecimal managePayAmountTotal, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
public void exportCostManageDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail, BigDecimal costProjectManageTotalAmount, BigDecimal managePayAmountTotal, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
// 遍历集合数据,产生数据行
int index = rowIndex;
XSSFSheet sheet = workbook.createSheet(sheetName);
@ -1301,7 +1301,7 @@ public class ExportExcelUtils {
totalCell.setCellValue("总计");
} else if (i == 5) {
totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue((costProjectManageTotalAmount == null) ? 0 : costProjectManageTotalAmount);
totalCell.setCellValue(Utils.format(costProjectManageTotalAmount));
} else if (i == 7) {
totalCell.setCellType(CellType.NUMERIC);
totalCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude()));