feat 收入明细表:

1:付款计划改为临时表  整体保存
dev_1.0.0
chenhao 2024-10-28 20:30:29 +08:00
parent 750b55940b
commit 5c10b6a64e
3 changed files with 40 additions and 75 deletions

View File

@ -1132,7 +1132,7 @@ public class ProjectController extends BaseController {
@RequestMapping("/incomeTemplate")
public void incomeTemplate(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());
@ -1167,7 +1167,7 @@ public class ProjectController extends BaseController {
@RequestMapping("/costTemplate")
public void costTemplate(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());
@ -1254,7 +1254,7 @@ public class ProjectController extends BaseController {
//收入明细
List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project);
BigDecimal incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project);
String[] headers2 = {"序号", "产品大类", "名称", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)"};
String[] headers2 = {"序号", "类别", "产品大类", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)"};
String[] columns2 = {"tempId", "type", "name", "taxRate", "totalTaxInclude", "totalTaxExclude", "totalTax"};
exportExcelUtils.exportIncomeDetailExcel(headers2, columns2, project, budgetBean, budgetIncomeDetail, incomeTotalAmount, "yyyy-MM-dd", 0, "收入明细表", outputStream);
@ -1347,7 +1347,7 @@ public class ProjectController extends BaseController {
//资金计划明细
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
ProjectBudgetPlanDetail projectBudgetPlanDetailTotal = projectBudgetService.getProjectBudgetPlanDetailTotal(project, projectBudgetPlanDetails);
String[] headers5 = {"月份", "设备支出", "工程支出(含服务+施工+其他)", "经营性开支", "保证金支出", "支出合计", "销售收款", "保证金收款", "收款合计", "资金余额", "资金利息", "垫资计划", "还款计划"};
String[] headers5 = {"月份", "设备支出", "工程支出(含服务+施工+其他)", "项目管理费用付款", "保证金付款", "付款合计", "销售收款", "保证金收款", "收款合计", "资金余额", "资金利息", "垫资计划", "还款计划"};
String[] row5 = {"month", "deviceCost", "engineerCost", "projectManageCost", "earnestMoneyCost", "totalCost", "saleIncome", "earnestMoneyIncome", "totalIncome", "fundBalance", "capitalInterest", "underwrittenPlan", "repaymentPlan"};
exportExcelUtils.exportPlanDetailExcel(headers5, row5, project, budgetBean, projectBudgetPlanDetails, projectBudgetPlanDetailTotal, "yyyy-MM-dd", 0, "资金计划表", outputStream);

View File

@ -14,6 +14,7 @@ public class ProjectBudgetPayPlanTemp extends ProjectBudgetPayPlanBase {
public ProjectBudgetPayPlan toProjectBudgetPayPlanDetail() {
ProjectBudgetPayPlan projectBudgetPayPlan = new ProjectBudgetPayPlan();
BeanUtils.copyProperties(this, projectBudgetPayPlan);
projectBudgetPayPlan.setId(null);
return projectBudgetPayPlan;
}
}

View File

@ -1143,6 +1143,15 @@ public class ProjectBudgetService {
clearBudgetCostProjectManageDetail(p);
//资金计划明细
clearBudgetPlanDetail(p);
//付款计划表
clearBudgetPayPlan(p);
}
private void clearBudgetPayPlan(Project p) {
List<ProjectBudgetPayPlan> costDetails = projectBudgetPayPlanRepository.findAllByProjectIdEquals(p.getId());
if(CollectionUtil.isNotEmpty(costDetails)){
projectBudgetPayPlanRepository.deleteInBatch(costDetails);
}
}
@Transactional(rollbackFor = Exception.class)
@ -1192,36 +1201,22 @@ public class ProjectBudgetService {
} else {
throw new Exception("该类别不存在");
}
key = "名称";
key = "产品大类";
o1 = m.get(key);
temp.setName((String) o1);
key = "规格类型";
o1 = m.get(key);
temp.setSpec((String) o1);
key = "参数";
o1 = m.get(key);
temp.setParam((String) o1);
key = "单位";
o1 = m.get(key);
temp.setUnit((String) o1);
try {
key = "数量";
o1 = m.get(key);
if (o1 != null) {
temp.setAmount(new BigDecimal((String) o1));
}
key = "单价";
o1 = m.get(key);
if (o1 != null) {
temp.setPrice(new BigDecimal((String) o1));
}
key = "税率(%)";
o1 = m.get(key);
if (o1 != null) {
temp.setTaxRate(new BigDecimal((String) o1));
}
key = "含税总金额(元)";
o1 = m.get(key);
if (o1 != null) {
temp.setTotalTaxInclude(new BigDecimal((String) o1));
}
} catch (Exception e) {
throw new Exception("数量、单价、税率需为数字");
throw new Exception("税率、含税总金额需为数字");
}
incomeDetailTempList.add(temp);
}
@ -1261,7 +1256,7 @@ public class ProjectBudgetService {
String key;
Object o1;
temp.setProjectId(id);
key = "费用项目";
key = "采购成本项目";
o1 = m.get(key);
String type = (String) o1;
if ("设备".equals(type)) {
@ -1275,75 +1270,36 @@ public class ProjectBudgetService {
} else {
throw new Exception("该费用项目不存在");
}
key = "采购类别";
key = "产品大类";
o1 = m.get(key);
String category = (String) o1;
ProcurementType procurementType = procurementTypeRepository.findByName(category);
if (procurementType != null && procurementType.getType() == temp.getType()) {
temp.setCategory(procurementType.getId());
} else {
throw new Exception("该采购类别不存在或者与费用项目不匹配");
throw new Exception("该采购类别不存在或者与采购成本项目不匹配");
}
key = "名称";
o1 = m.get(key);
temp.setName((String) o1);
key = "单位";
o1 = m.get(key);
temp.setUnit((String) o1);
key = "签约方";
key = "供应商";
o1 = m.get(key);
temp.setContractParty((String) o1);
key = "是否垫资";
o1 = m.get(key);
String isUnderwritten = (String) o1;
if ("是".equals(isUnderwritten)) {
temp.setIsUnderwritten(1);
} else if ("否".equals(isUnderwritten)) {
temp.setIsUnderwritten(2);
} else {
temp.setIsUnderwritten(0);
}
try {
key = "数量";
o1 = m.get(key);
if (o1 != null) {
temp.setAmount(new BigDecimal((String) o1));
}
key = "单价";
o1 = m.get(key);
if (o1 != null) {
temp.setPrice(new BigDecimal((String) o1));
}
key = "税率(%)";
o1 = m.get(key);
if (o1 != null) {
temp.setTaxRate(new BigDecimal((String) o1));
}
key = "预估垫资金额(元)";
key = "含税总金额(元)";
o1 = m.get(key);
if (o1 != null) {
temp.setUnderwrittenAmount(new BigDecimal((String) o1));
}
key = "支出金额(元)";
o1 = m.get(key);
if (o1 != null) {
temp.setPayAmount(new BigDecimal((String) o1));
temp.setTotalTaxInclude(new BigDecimal((String) o1));
}
} catch (Exception e) {
throw new Exception("数量、单价、税率、预估垫资金额和支出金额需为数字");
throw new Exception("税率、含税总金额(元)需为数字");
}
try {
key = "支出时间";
o1 = m.get(key);
if (o1 != null) {
temp.setPayTime(DateKit.getDate((String) o1, DateKit.DATE_FORMAT));
}
} catch (Exception e) {
throw new Exception("支出时间需为时间格式yyyy-MM-dd");
}
key = "付款方式";
o1 = m.get(key);
temp.setPayWay((String) o1);
key = "备注";
o1 = m.get(key);
temp.setRemark((String) o1);
@ -1355,6 +1311,7 @@ public class ProjectBudgetService {
}
public void saveBudgetPayPlanTemp(Project project, List<ProjectBudgetPayPlanTemp> detailList) {
clearBudgetPauPlanTemp(project);
if(CollectionUtil.isNotEmpty(detailList)){
for (ProjectBudgetPayPlanTemp temp : detailList) {
temp.setProjectId(project.getId());
@ -1363,4 +1320,11 @@ public class ProjectBudgetService {
projectBudgetPayPlanTempRepository.save(detailList);
}
}
private void clearBudgetPauPlanTemp(Project project) {
List<ProjectBudgetPayPlanTemp> allByProjectIdEquals = projectBudgetPayPlanTempRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(allByProjectIdEquals)){
projectBudgetPayPlanTempRepository.deleteInBatch(allByProjectIdEquals);
}
}
}