diff --git a/src/main/java/cn/palmte/work/controller/backend/MonthlySettleController.java b/src/main/java/cn/palmte/work/controller/backend/MonthlySettleController.java index bd0fbf3..69ca538 100644 --- a/src/main/java/cn/palmte/work/controller/backend/MonthlySettleController.java +++ b/src/main/java/cn/palmte/work/controller/backend/MonthlySettleController.java @@ -60,7 +60,7 @@ public class MonthlySettleController extends BaseController { @RequestMapping("/info") public String info(@RequestParam("id") int id, Map model) { - MonthlySettle monthlySettle = monthlySettleRepository.findOne(id); + MonthlySettle monthlySettle = monthlySettleService.findById(id); model.put("monthlySettle", monthlySettle); model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils")); return "/admin/monthly_settle_info"; @@ -68,7 +68,7 @@ public class MonthlySettleController extends BaseController { @RequestMapping("/infoByTime") public String infoByTime(@RequestParam String month, @RequestParam("projectName") String projectName, Map model) { - MonthlySettle monthlySettle = monthlySettleRepository.findByMonthAndProjectName(month, projectName); + MonthlySettle monthlySettle = monthlySettleService.findByMonthAndProjectName(month, projectName); if (monthlySettle == null) { monthlySettle = new MonthlySettle(); } @@ -87,9 +87,9 @@ public class MonthlySettleController extends BaseController { downloadHeader(httpServletResponse, Utils.generateExcelName("月度结算表"), "application/octet-stream"); String[] headers = {"项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额", "销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "到货证明", "项目风险预警", "已计收金额", "未计收金额", "超期天数", "验收报告时间"}; - String[] exportColumns = {"projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmount", "contractSignTime", "owner", "totalCollect", - "totalPurchasedPaid", "totalPurchasedUnpaid", "timeOutAmount", "totalBillAmount", "saleManager", "projectManager", "collectPoint", "collectRequiredTime", "collectAmount", - "collectActualTime", "collectActualAmount", "uncollectActualAmount", "productCertificate", "riskWarning", "uncalColAmount", "calColAmount", "timeOutDay", "inspectionReportTime"}; + String[] exportColumns = {"projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound", + "totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound", + "collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "productCertificate", "riskWarning", "uncalColAmountRound", "calColAmountRound", "timeOutDay", "inspectionReportTimeStr"}; ExportUtils.exportToExcel(headers, exportColumns, 1, 10000, httpServletResponse.getOutputStream(), (pN, pS) -> monthlySettleService.list(searchInfo, pN, pS).getList()); } @@ -99,9 +99,9 @@ public class MonthlySettleController extends BaseController { downloadHeader(httpServletResponse, Utils.generateExcelName("月度结算表明细"), "application/octet-stream"); String[] headers = {"月份", "项目编号", "项目名称", "项目类型", "合同编号", "合同方", "合同金额", "合同签订时间", "最终业主", "累计已收款", "已采购累计付款", "已采购累计未付款", "超期垫资金额", "销售累计开票金额", "销售经理", "项目经理", "收款节点", "收款要求时间", "收款金额", "实际收款时间", "实际收款金额", "实际欠收金额", "超期天数", "到货证明", "验收报告时间", "项目风险预警", "已计收金额", "未计收金额"}; - String[] exportColumns = {"month", "projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmount", "contractSignTime", "owner", "totalCollect", - "totalPurchasedPaid", "totalPurchasedUnpaid", "timeOutAmount", "totalBillAmount", "saleManager", "projectManager", "collectPoint", "collectRequiredTime", "collectAmount", - "collectActualTime", "collectActualAmount", "uncollectActualAmount", "timeOutDay", "productCertificate", "inspectionReportTime", "riskWarning", "uncalColAmount", "calColAmount"}; + String[] exportColumns = {"month", "projectNo", "projectName", "projectType", "contractNo", "contractParty", "contractAmountRound", "contractSignTimeStr", "owner", "totalCollectRound", + "totalPurchasedPaidRound", "totalPurchasedUnpaidRound", "timeOutAmountRound", "totalBillAmountRound", "saleManager", "projectManager", "collectPoint", "collectRequiredTimeStr", "collectAmountRound", + "collectActualTimeStr", "collectActualAmountRound", "uncollectActualAmountRound", "timeOutDay", "productCertificate", "inspectionReportTimeStr", "riskWarning", "uncalColAmountRound", "calColAmountRound"}; ExportUtils.exportToExcel2(headers, exportColumns, 1, 10000, httpServletResponse.getOutputStream(), monthlySettleService.findOne(id, time, projectName)); } diff --git a/src/main/java/cn/palmte/work/model/MonthlySettle.java b/src/main/java/cn/palmte/work/model/MonthlySettle.java index 0ef3ad1..7c11c30 100644 --- a/src/main/java/cn/palmte/work/model/MonthlySettle.java +++ b/src/main/java/cn/palmte/work/model/MonthlySettle.java @@ -162,6 +162,74 @@ public class MonthlySettle { @Column(name = "uncal_col_amount") private BigDecimal uncalColAmount; + @Transient + private String contractSignTimeStr; + + @Transient + private String collectRequiredTimeStr; + + @Transient + private String inspectionReportTimeStr; + + @Transient + private String collectActualTimeStr; + + /** + * 合同金额 + */ + @Transient + private String contractAmountRound; + /** + * 累计已收款 + */ + @Transient + private String totalCollectRound; + /** + * 已采购累计付款 + */ + @Transient + private String totalPurchasedPaidRound; + /** + * 已采购累计未付款 + */ + @Transient + private String totalPurchasedUnpaidRound; + /** + * 超期垫资金额 + */ + @Transient + private String timeOutAmountRound; + /** + * 销售累计开票金额 + */ + @Transient + private String totalBillAmountRound; + /** + * 收款金额 + */ + @Transient + private String collectAmountRound; + /** + * 实际收款金额 + */ + @Transient + private String collectActualAmountRound; + /** + * 实际欠收金额 + */ + @Transient + private String uncollectActualAmountRound; + /** + * 已计收金额 + */ + @Transient + private String calColAmountRound; + /** + * 未计收金额 + */ + @Transient + private String uncalColAmountRound; + public int getId() { return id; } @@ -393,4 +461,124 @@ public class MonthlySettle { public void setUncalColAmount(BigDecimal uncalColAmount) { this.uncalColAmount = uncalColAmount; } + + public String getContractSignTimeStr() { + return contractSignTimeStr; + } + + public void setContractSignTimeStr(String contractSignTimeStr) { + this.contractSignTimeStr = contractSignTimeStr; + } + + public String getCollectRequiredTimeStr() { + return collectRequiredTimeStr; + } + + public void setCollectRequiredTimeStr(String collectRequiredTimeStr) { + this.collectRequiredTimeStr = collectRequiredTimeStr; + } + + public String getInspectionReportTimeStr() { + return inspectionReportTimeStr; + } + + public void setInspectionReportTimeStr(String inspectionReportTimeStr) { + this.inspectionReportTimeStr = inspectionReportTimeStr; + } + + public String getCollectActualTimeStr() { + return collectActualTimeStr; + } + + public void setCollectActualTimeStr(String collectActualTimeStr) { + this.collectActualTimeStr = collectActualTimeStr; + } + + public String getContractAmountRound() { + return contractAmountRound; + } + + public void setContractAmountRound(String contractAmountRound) { + this.contractAmountRound = contractAmountRound; + } + + public String getTotalCollectRound() { + return totalCollectRound; + } + + public void setTotalCollectRound(String totalCollectRound) { + this.totalCollectRound = totalCollectRound; + } + + public String getTotalPurchasedPaidRound() { + return totalPurchasedPaidRound; + } + + public void setTotalPurchasedPaidRound(String totalPurchasedPaidRound) { + this.totalPurchasedPaidRound = totalPurchasedPaidRound; + } + + public String getTotalPurchasedUnpaidRound() { + return totalPurchasedUnpaidRound; + } + + public void setTotalPurchasedUnpaidRound(String totalPurchasedUnpaidRound) { + this.totalPurchasedUnpaidRound = totalPurchasedUnpaidRound; + } + + public String getTimeOutAmountRound() { + return timeOutAmountRound; + } + + public void setTimeOutAmountRound(String timeOutAmountRound) { + this.timeOutAmountRound = timeOutAmountRound; + } + + public String getTotalBillAmountRound() { + return totalBillAmountRound; + } + + public void setTotalBillAmountRound(String totalBillAmountRound) { + this.totalBillAmountRound = totalBillAmountRound; + } + + public String getCollectAmountRound() { + return collectAmountRound; + } + + public void setCollectAmountRound(String collectAmountRound) { + this.collectAmountRound = collectAmountRound; + } + + public String getCollectActualAmountRound() { + return collectActualAmountRound; + } + + public void setCollectActualAmountRound(String collectActualAmountRound) { + this.collectActualAmountRound = collectActualAmountRound; + } + + public String getUncollectActualAmountRound() { + return uncollectActualAmountRound; + } + + public void setUncollectActualAmountRound(String uncollectActualAmountRound) { + this.uncollectActualAmountRound = uncollectActualAmountRound; + } + + public String getCalColAmountRound() { + return calColAmountRound; + } + + public void setCalColAmountRound(String calColAmountRound) { + this.calColAmountRound = calColAmountRound; + } + + public String getUncalColAmountRound() { + return uncalColAmountRound; + } + + public void setUncalColAmountRound(String uncalColAmountRound) { + this.uncalColAmountRound = uncalColAmountRound; + } } diff --git a/src/main/java/cn/palmte/work/service/MonthlySettleService.java b/src/main/java/cn/palmte/work/service/MonthlySettleService.java index 98a96ec..0ecfa6f 100644 --- a/src/main/java/cn/palmte/work/service/MonthlySettleService.java +++ b/src/main/java/cn/palmte/work/service/MonthlySettleService.java @@ -316,13 +316,16 @@ public class MonthlySettleService { public List findOne(String id, String time, String projectName) { List list = new ArrayList<>(); - MonthlySettle monthlySettle = monthlySettleRepository.findByMonthAndProjectName(time, projectName); + MonthlySettle monthlySettle = findByMonthAndProjectName(time, projectName); list.add(monthlySettle); return list; } private QueryHelper getQueryHelper(Map searchInfo) { - QueryHelper queryHelper = new QueryHelper("SELECT s.*, ms.*","(select project_name as name, max(ms.month) as time from monthly_settle ms group by ms.project_name)","ms"); + QueryHelper queryHelper = new QueryHelper("SELECT s.*, ms.*, FORMAT(s.contract_amount,2) as contractAmountRound, FORMAT(s.total_collect,2) as totalCollectRound, FORMAT(s.total_purchased_paid,2) as totalPurchasedPaidRound, FORMAT(s.total_purchased_unpaid,2) as totalPurchasedUnpaidRound" + + ", FORMAT(s.time_out_amount,2) as timeOutAmountRound, FORMAT(s.total_bill_amount,2) as totalBillAmountRound, FORMAT(s.collect_amount,2) as collectAmountRound, FORMAT(s.collect_actual_amount,2) as collectActualAmountRound" + + ", FORMAT(s.uncollect_actual_amount,2) as uncollectActualAmountRound, FORMAT(s.cal_col_amount,2) as calColAmountRound, FORMAT(s.uncal_col_amount,2) as uncalColAmountRound" + + ", DATE_FORMAT(s.contract_sign_time, '%Y-%m-%d') as contractSignTimeStr, DATE_FORMAT(s.collect_required_time, '%Y-%m-%d') as collectRequiredTimeStr, DATE_FORMAT(s.collect_actual_time, '%Y-%m-%d') as collectActualTimeStr, DATE_FORMAT(s.inspection_report_time, '%Y-%m-%d') as inspectionReportTimeStr ","(select project_name as name, max(ms.month) as time from monthly_settle ms group by ms.project_name)","ms"); queryHelper.leftJoin("monthly_settle s", "ms.time = s.month and ms.name = s.project_name"); queryHelper.addCondition(StrUtil.isNotEmpty(searchInfo.get("projectNo")),"s.project_no LIKE ?", "%"+searchInfo.get("projectNo")+"%"); @@ -356,4 +359,25 @@ public class MonthlySettleService { return queryHelper; } + + public MonthlySettle findById(int id) { + QueryHelper queryHelper = new QueryHelper("SELECT s.*, FORMAT(s.contract_amount,2) as contractAmountRound, FORMAT(s.total_collect,2) as totalCollectRound, FORMAT(s.total_purchased_paid,2) as totalPurchasedPaidRound, FORMAT(s.total_purchased_unpaid,2) as totalPurchasedUnpaidRound" + + ", FORMAT(s.time_out_amount,2) as timeOutAmountRound, FORMAT(s.total_bill_amount,2) as totalBillAmountRound, FORMAT(s.collect_amount,2) as collectAmountRound, FORMAT(s.collect_actual_amount,2) as collectActualAmountRound" + + ", FORMAT(s.uncollect_actual_amount,2) as uncollectActualAmountRound, FORMAT(s.cal_col_amount,2) as calColAmountRound, FORMAT(s.uncal_col_amount,2) as uncalColAmountRound " + + ", DATE_FORMAT(s.contract_sign_time, '%Y-%m-%d') as contractSignTimeStr, DATE_FORMAT(s.collect_required_time, '%Y-%m-%d') as collectRequiredTimeStr, DATE_FORMAT(s.collect_actual_time, '%Y-%m-%d') as collectActualTimeStr, DATE_FORMAT(s.inspection_report_time, '%Y-%m-%d') as inspectionReportTimeStr ","monthly_settle","s"); + queryHelper.addCondition("s.id=?", id); + MonthlySettle first = pagination.findFirst(queryHelper.getSql(), MonthlySettle.class); + return first; + } + + public MonthlySettle findByMonthAndProjectName(String month, String projectName) { + QueryHelper queryHelper = new QueryHelper("SELECT s.*, FORMAT(s.contract_amount,2) as contractAmountRound, FORMAT(s.total_collect,2) as totalCollectRound, FORMAT(s.total_purchased_paid,2) as totalPurchasedPaidRound, FORMAT(s.total_purchased_unpaid,2) as totalPurchasedUnpaidRound" + + ", FORMAT(s.time_out_amount,2) as timeOutAmountRound, FORMAT(s.total_bill_amount,2) as totalBillAmountRound, FORMAT(s.collect_amount,2) as collectAmountRound, FORMAT(s.collect_actual_amount,2) as collectActualAmountRound" + + ", FORMAT(s.uncollect_actual_amount,2) as uncollectActualAmountRound, FORMAT(s.cal_col_amount,2) as calColAmountRound, FORMAT(s.uncal_col_amount,2) as uncalColAmountRound " + + ", DATE_FORMAT(s.contract_sign_time, '%Y-%m-%d') as contractSignTimeStr, DATE_FORMAT(s.collect_required_time, '%Y-%m-%d') as collectRequiredTimeStr, DATE_FORMAT(s.collect_actual_time, '%Y-%m-%d') as collectActualTimeStr, DATE_FORMAT(s.inspection_report_time, '%Y-%m-%d') as inspectionReportTimeStr ","monthly_settle","s"); + queryHelper.addCondition("s.month=?", month); + queryHelper.addCondition("s.project_name=?", projectName); + MonthlySettle first = pagination.findFirst(queryHelper.getSql(), MonthlySettle.class); + return first; + } }