|
@@ -2214,6 +2214,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
public List<ReportResult> execute4(Long reportId,Long contractId, Long periodId, Integer type,Long projectId) throws FileNotFoundException, IllegalAccessException {
|
|
public List<ReportResult> execute4(Long reportId,Long contractId, Long periodId, Integer type,Long projectId) throws FileNotFoundException, IllegalAccessException {
|
|
|
|
+ //获取当前合同段保证金比例
|
|
|
|
+ String sqlForRatio = "select bl_reserve_funds_ratio from s_meter_contract_info where contract_id = '"+contractId+"' and is_deleted = 0";
|
|
|
|
+ BigDecimal blReserveFundsRatio = jdbcTemplate.queryForObject(sqlForRatio, BigDecimal.class);
|
|
|
|
+ BigDecimal blReserveFundsRatioNew = (new BigDecimal(100).subtract(blReserveFundsRatio).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
+
|
|
|
|
+
|
|
Long redisId = SnowFlakeUtil.getId();
|
|
Long redisId = SnowFlakeUtil.getId();
|
|
//判断计算的是哪一期。
|
|
//判断计算的是哪一期。
|
|
String sql="Select * from s_contract_meter_period where contract_id="+contractId+" and is_deleted=0"+" order by start_date";
|
|
String sql="Select * from s_contract_meter_period where contract_id="+contractId+" and is_deleted=0"+" order by start_date";
|
|
@@ -2262,11 +2268,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
// 获取中期支付报表封面的pdfurl
|
|
// 获取中期支付报表封面的pdfurl
|
|
ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url,contractId,periodId,htmlUrl);
|
|
ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url,contractId,periodId,htmlUrl);
|
|
//获取中间支付审核表的pdfurl
|
|
//获取中间支付审核表的pdfurl
|
|
- ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1,contractId,periodId,list,redisId,htmlUrl1);
|
|
|
|
|
|
+ ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1,contractId,periodId,list,redisId,htmlUrl1,blReserveFundsRatioNew);
|
|
//获取补助款申请支付审核表pdfUrl
|
|
//获取补助款申请支付审核表pdfUrl
|
|
- ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list,htmlUrl2);
|
|
|
|
|
|
+ ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list,htmlUrl2,blReserveFundsRatioNew);
|
|
//获取中间计量支付证书pdfUrl
|
|
//获取中间计量支付证书pdfUrl
|
|
- ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3,contractId,periodId,list,htmlUrl3);
|
|
|
|
|
|
+ ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3,contractId,periodId,list,htmlUrl3,blReserveFundsRatioNew);
|
|
//获取清单支付报表PDF
|
|
//获取清单支付报表PDF
|
|
ReportResult inventoryPayReportPDF=getInventoryPayReportPDF(url6,contractId,periodId,projectId,list,redisId,htmlUrl6);
|
|
ReportResult inventoryPayReportPDF=getInventoryPayReportPDF(url6,contractId,periodId,projectId,list,redisId,htmlUrl6);
|
|
//获取工程支付月报pdfUrl
|
|
//获取工程支付月报pdfUrl
|
|
@@ -2319,20 +2325,24 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
Cell d4 = getCellByAddress(sheet, "D4");
|
|
Cell d4 = getCellByAddress(sheet, "D4");
|
|
d4.setCellValue(periodNumber);
|
|
d4.setCellValue(periodNumber);
|
|
|
|
|
|
|
|
+ //日期
|
|
|
|
+ Cell c11 = getCellByAddress(sheet, "C11");
|
|
|
|
+ c11.setCellValue(endDate.toString());
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(contractId)){
|
|
if(ObjectUtil.isNotEmpty(contractId)){
|
|
|
|
+ CellStyle cellStyle = c11.getCellStyle();
|
|
//获取合同段信息
|
|
//获取合同段信息
|
|
ContractInfo contractInfo = getContractInfo(contractId);
|
|
ContractInfo contractInfo = getContractInfo(contractId);
|
|
//施工单位
|
|
//施工单位
|
|
Cell c9 = getCellByAddress(sheet, "C9");
|
|
Cell c9 = getCellByAddress(sheet, "C9");
|
|
|
|
+ c9.setCellStyle(cellStyle);
|
|
c9.setCellValue(contractInfo.getConstructionUnitName());
|
|
c9.setCellValue(contractInfo.getConstructionUnitName());
|
|
//监理单位
|
|
//监理单位
|
|
Cell c10 = getCellByAddress(sheet, "C10");
|
|
Cell c10 = getCellByAddress(sheet, "C10");
|
|
|
|
+ c10.setCellStyle(cellStyle);
|
|
c10.setCellValue(contractInfo.getContractorUnitName());
|
|
c10.setCellValue(contractInfo.getContractorUnitName());
|
|
}
|
|
}
|
|
- //日期
|
|
|
|
- Cell c11 = getCellByAddress(sheet, "C11");
|
|
|
|
- c11.setCellValue(endDate.toString());
|
|
|
|
|
|
+
|
|
|
|
|
|
for (Sheet sheet1 : workbook) {
|
|
for (Sheet sheet1 : workbook) {
|
|
for (Row row : sheet1) {
|
|
for (Row row : sheet1) {
|
|
@@ -2376,7 +2386,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
/**
|
|
/**
|
|
*中间计量支付证书获取PDFurl
|
|
*中间计量支付证书获取PDFurl
|
|
*/
|
|
*/
|
|
- private ReportResult getIntermediateMeasurementPaymentCertificatePDF(String url3, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl) {
|
|
|
|
|
|
+ private ReportResult getIntermediateMeasurementPaymentCertificatePDF(String url3, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl,BigDecimal blReserveFundsRatioNew) {
|
|
//判断当前是否是第一期
|
|
//判断当前是否是第一期
|
|
Boolean isOnePeriod = false;
|
|
Boolean isOnePeriod = false;
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
@@ -2412,7 +2422,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
if(isOnePeriod){
|
|
if(isOnePeriod){
|
|
lastEndMeasurement = "0";
|
|
lastEndMeasurement = "0";
|
|
}else {
|
|
}else {
|
|
- HashMap<String, BigDecimal> lastEndData = getLastEndData(list, startDate, contractId, lastEndPay, lastEndDeduct, allMoney);
|
|
|
|
|
|
+ HashMap<String, BigDecimal> lastEndData = getLastEndData(list, startDate, contractId, lastEndPay, lastEndDeduct, allMoney,blReserveFundsRatioNew);
|
|
lastEndPay = lastEndData.get("lastEndPay");
|
|
lastEndPay = lastEndData.get("lastEndPay");
|
|
lastEndDeduct = lastEndData.get("lastEndDeduct");
|
|
lastEndDeduct = lastEndData.get("lastEndDeduct");
|
|
allMoney = lastEndData.get("allMoney");
|
|
allMoney = lastEndData.get("allMoney");
|
|
@@ -2421,7 +2431,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
"WHERE contract_id = '"+contractId+"' and contract_period_id = "+contractMeterPeriodNowId;*/
|
|
"WHERE contract_id = '"+contractId+"' and contract_period_id = "+contractMeterPeriodNowId;*/
|
|
BigDecimal AllcurrentMeterTotal = getCurrentMeter(contractId, periodId, jdbcTemplate);
|
|
BigDecimal AllcurrentMeterTotal = getCurrentMeter(contractId, periodId, jdbcTemplate);
|
|
//------------------------------------------------------------同意本期支付工程款------------------------------------------------------------
|
|
//------------------------------------------------------------同意本期支付工程款------------------------------------------------------------
|
|
- BigDecimal currentPay = AllcurrentMeterTotal.multiply(new BigDecimal(0.75)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ BigDecimal currentPay = AllcurrentMeterTotal.multiply(blReserveFundsRatioNew).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
//小写
|
|
//小写
|
|
Cell c7 = getCellByAddress(sheet, "C7");
|
|
Cell c7 = getCellByAddress(sheet, "C7");
|
|
c7.setCellValue(currentPay.toString());
|
|
c7.setCellValue(currentPay.toString());
|
|
@@ -2497,7 +2507,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
/**
|
|
/**
|
|
*补助款申请支付审核表获取PDFurl
|
|
*补助款申请支付审核表获取PDFurl
|
|
*/
|
|
*/
|
|
- private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl) {
|
|
|
|
|
|
+ private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl,BigDecimal blReserveFundsRatioNew) {
|
|
//判断当前是否是只有1期计量
|
|
//判断当前是否是只有1期计量
|
|
Boolean isOnePeriod = false;
|
|
Boolean isOnePeriod = false;
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
@@ -2542,7 +2552,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
if(isOnePeriod){
|
|
if(isOnePeriod){
|
|
lastEndMeasurement = "0";
|
|
lastEndMeasurement = "0";
|
|
}else {
|
|
}else {
|
|
- HashMap<String, BigDecimal> lastEndData = getLastEndData(list, startDate, contractId, lastEndPay, lastEndDeduct, allMoney);
|
|
|
|
|
|
+ HashMap<String, BigDecimal> lastEndData = getLastEndData(list, startDate, contractId, lastEndPay, lastEndDeduct, allMoney,blReserveFundsRatioNew);
|
|
lastEndPay = lastEndData.get("lastEndPay");
|
|
lastEndPay = lastEndData.get("lastEndPay");
|
|
lastEndDeduct = lastEndData.get("lastEndDeduct");
|
|
lastEndDeduct = lastEndData.get("lastEndDeduct");
|
|
allMoney = lastEndData.get("allMoney");
|
|
allMoney = lastEndData.get("allMoney");
|
|
@@ -2564,7 +2574,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
Cell h6 = getCellByAddress(sheet, "H6");
|
|
Cell h6 = getCellByAddress(sheet, "H6");
|
|
h6.setCellValue(allMoneyNow.toString());
|
|
h6.setCellValue(allMoneyNow.toString());
|
|
//------------------------------------------------------------本期支付金额------------------------------------------------------------
|
|
//------------------------------------------------------------本期支付金额------------------------------------------------------------
|
|
- BigDecimal currentPay = AllcurrentMeterTotal.multiply(new BigDecimal(0.75)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ BigDecimal currentPay = AllcurrentMeterTotal.multiply(blReserveFundsRatioNew).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
Cell i6 = getCellByAddress(sheet, "I6");
|
|
Cell i6 = getCellByAddress(sheet, "I6");
|
|
i6.setCellValue(currentPay.toString());
|
|
i6.setCellValue(currentPay.toString());
|
|
//------------------------------------------------------------本期末累计支付金额------------------------------------------------------------
|
|
//------------------------------------------------------------本期末累计支付金额------------------------------------------------------------
|
|
@@ -2573,8 +2583,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
Cell k6 = getCellByAddress(sheet, "K6");
|
|
Cell k6 = getCellByAddress(sheet, "K6");
|
|
k6.setCellValue(endPay.toString());
|
|
k6.setCellValue(endPay.toString());
|
|
//------------------------------------------------------------支付比例------------------------------------------------------------
|
|
//------------------------------------------------------------支付比例------------------------------------------------------------
|
|
|
|
+ BigDecimal multiply = blReserveFundsRatioNew.multiply(BigDecimal.valueOf(100));
|
|
Cell m6 = getCellByAddress(sheet, "M6");
|
|
Cell m6 = getCellByAddress(sheet, "M6");
|
|
- m6.setCellValue("75.00%");
|
|
|
|
|
|
+ m6.setCellValue(multiply+"%");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2706,7 +2717,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
/**
|
|
/**
|
|
* 中间支付审核表获取PDFurl
|
|
* 中间支付审核表获取PDFurl
|
|
*/
|
|
*/
|
|
- public ReportResult getIntermediatePaymentPDF(String url,Long contractId,Long periodId,List<ContractMeterPeriod> list,Long redisId,String htmlUrl) {
|
|
|
|
|
|
+ public ReportResult getIntermediatePaymentPDF(String url,Long contractId,Long periodId,List<ContractMeterPeriod> list,Long redisId,String htmlUrl,BigDecimal blReserveFundsRatioNew) {
|
|
//判断当前是否是只有1期计量
|
|
//判断当前是否是只有1期计量
|
|
Boolean isOnePeriod = false;
|
|
Boolean isOnePeriod = false;
|
|
ContractMeterPeriod contractMeterPeriod1 = list.get(0);
|
|
ContractMeterPeriod contractMeterPeriod1 = list.get(0);
|
|
@@ -2805,7 +2816,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
if(isOnePeriod){
|
|
if(isOnePeriod){
|
|
lastEndMeasurement = "0";
|
|
lastEndMeasurement = "0";
|
|
}else {
|
|
}else {
|
|
- HashMap<String, BigDecimal> lastEndData = getLastEndData(list, startDate, contractId, lastEndPay, lastEndDeduct, allMoney);
|
|
|
|
|
|
+ HashMap<String, BigDecimal> lastEndData = getLastEndData(list, startDate, contractId, lastEndPay, lastEndDeduct, allMoney,blReserveFundsRatioNew);
|
|
lastEndPay = lastEndData.get("lastEndPay");
|
|
lastEndPay = lastEndData.get("lastEndPay");
|
|
lastEndDeduct = lastEndData.get("lastEndDeduct");
|
|
lastEndDeduct = lastEndData.get("lastEndDeduct");
|
|
allMoney = lastEndData.get("allMoney");
|
|
allMoney = lastEndData.get("allMoney");
|
|
@@ -2827,8 +2838,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
Cell g7 = getCellByAddress(sheet, "G7");
|
|
Cell g7 = getCellByAddress(sheet, "G7");
|
|
g7.setCellValue(endMoney.toString());
|
|
g7.setCellValue(endMoney.toString());
|
|
//------------------------------------------------------------本期支付------------------------------------------------------------
|
|
//------------------------------------------------------------本期支付------------------------------------------------------------
|
|
- //本期计量 * 0.75
|
|
|
|
- BigDecimal currentPay = AllcurrentMeterTotal.multiply(new BigDecimal(0.75)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ //本期计量 *blReserveFundsRatioNew
|
|
|
|
+ BigDecimal currentPay = AllcurrentMeterTotal.multiply(blReserveFundsRatioNew).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
Cell i7 = getCellByAddress(sheet, "I7");
|
|
Cell i7 = getCellByAddress(sheet, "I7");
|
|
i7.setCellValue(currentPay.toString());
|
|
i7.setCellValue(currentPay.toString());
|
|
//------------------------------------------------------------本期末累计支付------------------------------------------------------------
|
|
//------------------------------------------------------------本期末累计支付------------------------------------------------------------
|
|
@@ -2950,7 +2961,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
|
|
|
|
- public HashMap<String,BigDecimal> getLastEndData(List<ContractMeterPeriod> list,LocalDate startDate,Long contractId,BigDecimal lastEndPay, BigDecimal lastEndDeduct ,BigDecimal allMoney){
|
|
|
|
|
|
+ public HashMap<String,BigDecimal> getLastEndData(List<ContractMeterPeriod> list,LocalDate startDate,Long contractId,BigDecimal lastEndPay, BigDecimal lastEndDeduct ,BigDecimal allMoney,BigDecimal blReserveFundsRatioNew){
|
|
//根据开始时间获取当前计量期之前的所有计量期
|
|
//根据开始时间获取当前计量期之前的所有计量期
|
|
List<Long> lastAllPeriodIds = list.stream().filter(item -> item.getStartDate().isBefore(startDate)).map(ContractMeterPeriod::getId).collect(Collectors.toList());
|
|
List<Long> lastAllPeriodIds = list.stream().filter(item -> item.getStartDate().isBefore(startDate)).map(ContractMeterPeriod::getId).collect(Collectors.toList());
|
|
//获取之前所有计量期的本期计量之和=上期末累计计量
|
|
//获取之前所有计量期的本期计量之和=上期末累计计量
|
|
@@ -2989,7 +3000,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
money = money.add(sum.multiply(contractInventoryFormNow.getCurrentPrice()).setScale(0, BigDecimal.ROUND_HALF_UP));
|
|
money = money.add(sum.multiply(contractInventoryFormNow.getCurrentPrice()).setScale(0, BigDecimal.ROUND_HALF_UP));
|
|
}
|
|
}
|
|
//本期支付
|
|
//本期支付
|
|
- BigDecimal nowPeriodPay = money.multiply(new BigDecimal(0.75)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ BigDecimal nowPeriodPay = money.multiply(blReserveFundsRatioNew).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
//上期末累计支付
|
|
//上期末累计支付
|
|
lastEndPay = lastEndPay.add(nowPeriodPay);
|
|
lastEndPay = lastEndPay.add(nowPeriodPay);
|
|
//上期末累计扣取保留金
|
|
//上期末累计扣取保留金
|
|
@@ -3381,14 +3392,17 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
//项目名称
|
|
//项目名称
|
|
Cell b3 = getCellByAddress(sheet, "B3");
|
|
Cell b3 = getCellByAddress(sheet, "B3");
|
|
b3.setCellValue(projectName);
|
|
b3.setCellValue(projectName);
|
|
|
|
+ CellStyle cellStyle = b3.getCellStyle();
|
|
//合同号
|
|
//合同号
|
|
Cell b4 = getCellByAddress(sheet, "B4");
|
|
Cell b4 = getCellByAddress(sheet, "B4");
|
|
b4.setCellValue(contractInfo.getContractNumber());
|
|
b4.setCellValue(contractInfo.getContractNumber());
|
|
//承包单位
|
|
//承包单位
|
|
Cell g3 = getCellByAddress(sheet, "G3");
|
|
Cell g3 = getCellByAddress(sheet, "G3");
|
|
|
|
+ g3.setCellStyle(cellStyle);
|
|
g3.setCellValue(contractInfo.getConstructionUnitName());
|
|
g3.setCellValue(contractInfo.getConstructionUnitName());
|
|
//监理单位
|
|
//监理单位
|
|
Cell g4 = getCellByAddress(sheet, "G4");
|
|
Cell g4 = getCellByAddress(sheet, "G4");
|
|
|
|
+ g4.setCellStyle(cellStyle);
|
|
g4.setCellValue(contractInfo.getSupervisionUnitName());
|
|
g4.setCellValue(contractInfo.getSupervisionUnitName());
|
|
//截至时间
|
|
//截至时间
|
|
Cell m_3 = getCellByAddress(sheet, "M3");
|
|
Cell m_3 = getCellByAddress(sheet, "M3");
|
|
@@ -3683,14 +3697,17 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
//项目名称
|
|
//项目名称
|
|
Cell b3=getCellByAddress(sheet,"B3");
|
|
Cell b3=getCellByAddress(sheet,"B3");
|
|
b3.setCellValue(projectName);
|
|
b3.setCellValue(projectName);
|
|
|
|
+ CellStyle cellStyle = b3.getCellStyle();
|
|
//合同号
|
|
//合同号
|
|
Cell b4=getCellByAddress(sheet,"B4");
|
|
Cell b4=getCellByAddress(sheet,"B4");
|
|
b4.setCellValue(contractInfo.getContractNumber());
|
|
b4.setCellValue(contractInfo.getContractNumber());
|
|
//承包单位
|
|
//承包单位
|
|
Cell l3=getCellByAddress(sheet,"L3");
|
|
Cell l3=getCellByAddress(sheet,"L3");
|
|
|
|
+ l3.setCellStyle(cellStyle);
|
|
l3.setCellValue(contractInfo.getConstructionUnitName());
|
|
l3.setCellValue(contractInfo.getConstructionUnitName());
|
|
//监理单位
|
|
//监理单位
|
|
Cell l4=getCellByAddress(sheet,"L4");
|
|
Cell l4=getCellByAddress(sheet,"L4");
|
|
|
|
+ l4.setCellStyle(cellStyle);
|
|
l4.setCellValue(contractInfo.getSupervisionUnitName());
|
|
l4.setCellValue(contractInfo.getSupervisionUnitName());
|
|
}
|
|
}
|
|
|
|
|