|
@@ -61,11 +61,11 @@ import org.springblade.resource.vo.NewBladeFile;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
-import org.springframework.dao.DataAccessException;
|
|
|
import org.springframework.dao.EmptyResultDataAccessException;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.jdbc.core.SingleColumnRowMapper;
|
|
|
import org.springframework.mock.web.MockMultipartFile;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -2235,12 +2235,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
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));
|
|
|
-
|
|
|
+ //项目名称
|
|
|
+ String sqlForProjectName = "select project_name from m_project_info where id = "+projectId;
|
|
|
+ String projectName = jdbcTemplate.queryForObject(sqlForProjectName, new SingleColumnRowMapper<>(String.class));
|
|
|
Long redisId = SnowFlakeUtil.getId();
|
|
|
//判断计算的是哪一期。
|
|
|
String sql="Select * from s_contract_meter_period where contract_id="+contractId+" and is_deleted=0"+" order by start_date";
|
|
|
List<ContractMeterPeriod> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ContractMeterPeriod.class));
|
|
|
-
|
|
|
//获取所有excel报表源数据
|
|
|
String sqlForExcel = "SELECT e.id,p.html_url,e.file_url FROM m_wbs_tree_private as p LEFT JOIN m_excel_tab as e on p.excel_id=e.id where p.wbs_type=3 AND p.is_deleted=0 AND p.type=2"+" and project_id="+projectId;
|
|
|
List<ExcelTabVo1> excelTabs = jdbcTemplate.query(sqlForExcel, new BeanPropertyRowMapper<>(ExcelTabVo1.class));
|
|
@@ -2282,19 +2283,19 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
String url6=excel6.get().getFileUrl();
|
|
|
String htmlUrl6=excel6.get().getHtmlUrl();
|
|
|
// 获取中期支付报表封面的pdfurl
|
|
|
- ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url,contractId,periodId,htmlUrl);
|
|
|
+ ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url,contractId,periodId,htmlUrl, projectName);
|
|
|
//获取中间支付审核表的pdfurl
|
|
|
- ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1,contractId,periodId,list,redisId,htmlUrl1,blReserveFundsRatioNew);
|
|
|
+ ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1,contractId,periodId,list,redisId,htmlUrl1,blReserveFundsRatioNew,projectName);
|
|
|
//获取补助款申请支付审核表pdfUrl
|
|
|
- ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list,htmlUrl2,blReserveFundsRatioNew);
|
|
|
+ ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list,htmlUrl2,blReserveFundsRatioNew,projectName);
|
|
|
//获取中间计量支付证书pdfUrl
|
|
|
- ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3,contractId,periodId,list,htmlUrl3,blReserveFundsRatioNew);
|
|
|
+ ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3,contractId,periodId,list,htmlUrl3,blReserveFundsRatioNew,projectName);
|
|
|
//获取清单支付报表PDF
|
|
|
ReportResult inventoryPayReportPDF=getInventoryPayReportPDF(url6,contractId,periodId,projectId,list,redisId,htmlUrl6);
|
|
|
//获取工程支付月报pdfUrl
|
|
|
ReportResult monthlyReportPDF=getMonthlyReportPDF(url5,reportId,contractId,periodId,projectId,list,redisId,htmlUrl5);
|
|
|
//获取中间支付申请表pdfUrl
|
|
|
- ReportResult intermediateApplyPDF=getIntermediateApplyPDF(url4,periodId,projectId,htmlUrl4);
|
|
|
+ ReportResult intermediateApplyPDF=getIntermediateApplyPDF(url4,periodId,projectId,htmlUrl4,projectName);
|
|
|
|
|
|
reportResults.add(CoverOfMidtermPaymentReportPDF);
|
|
|
reportResults.add(intermediatePaymentPDF);
|
|
@@ -2310,7 +2311,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/**
|
|
|
* 中期支付报表封面
|
|
|
*/
|
|
|
- private ReportResult getCoverOfMidtermPaymentReportPDF(String url, Long contractId, Long periodId,String htmlUrl) {
|
|
|
+ private ReportResult getCoverOfMidtermPaymentReportPDF(String url, Long contractId, Long periodId,String htmlUrl,String projectName) {
|
|
|
|
|
|
//获取本期计量期
|
|
|
String sqlForMeterPeriodById = "SELECT id,period_number,start_date,end_date FROM s_contract_meter_period WHERE id="+periodId+" and is_deleted = 0 ";
|
|
@@ -2330,13 +2331,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
modInput = CommonUtil.getOSSInputStream(url);
|
|
|
workbook = WorkbookFactory.create(modInput);
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
-
|
|
|
+ //顶部项目名称
|
|
|
+ Cell a1 = getCellByAddress(sheet, "A1");
|
|
|
+ a1.setCellValue(projectName);
|
|
|
//期号
|
|
|
String periodNumber = contractMeterPeriodNow.getPeriodNumber();
|
|
|
if(ObjectUtil.isNotEmpty(periodNumber) && periodNumber.contains("第")){
|
|
|
int i = periodNumber.indexOf("第");
|
|
|
periodNumber = periodNumber.substring(i+1,i+2);
|
|
|
-
|
|
|
}
|
|
|
Cell d4 = getCellByAddress(sheet, "D4");
|
|
|
d4.setCellValue(periodNumber);
|
|
@@ -2403,7 +2405,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/**
|
|
|
*中间计量支付证书获取PDFurl
|
|
|
*/
|
|
|
- private ReportResult getIntermediateMeasurementPaymentCertificatePDF(String url3, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl,BigDecimal blReserveFundsRatioNew) {
|
|
|
+ private ReportResult getIntermediateMeasurementPaymentCertificatePDF(String url3, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl,BigDecimal blReserveFundsRatioNew,String projectName) {
|
|
|
//判断当前是否是第一期
|
|
|
Boolean isOnePeriod = false;
|
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
@@ -2474,14 +2476,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
//底部日期
|
|
|
/*Cell f25 = getCellByAddress(sheet, "F25");
|
|
|
f25.setCellValue(endDate.toString());*/
|
|
|
+ //顶部项目名称
|
|
|
+ Cell a1 = getCellByAddress(sheet, "A1");
|
|
|
+ a1.setCellValue(projectName);
|
|
|
+
|
|
|
//工程名称
|
|
|
- if (ObjectUtil.isNotEmpty(contractId)){
|
|
|
- ContractInfo contractInfo = getContractInfo(contractId);
|
|
|
- String pId = contractInfo.getPId();
|
|
|
- String projectName = getProjectName(pId);
|
|
|
- Cell c3 = getCellByAddress(sheet, "C3");
|
|
|
- c3.setCellValue(projectName);
|
|
|
- }
|
|
|
+ Cell c3 = getCellByAddress(sheet, "C3");
|
|
|
+ c3.setCellValue(projectName);
|
|
|
+
|
|
|
dianqian(htmlUrl,sheet,workbook);
|
|
|
for (Sheet sheet1 : workbook) {
|
|
|
for (Row row : sheet1) {
|
|
@@ -2525,7 +2527,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/**
|
|
|
*补助款申请支付审核表获取PDFurl
|
|
|
*/
|
|
|
- private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl,BigDecimal blReserveFundsRatioNew) {
|
|
|
+ private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl,BigDecimal blReserveFundsRatioNew,String projectName) {
|
|
|
//判断当前是否是只有1期计量
|
|
|
Boolean isOnePeriod = false;
|
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
@@ -2699,6 +2701,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Cell d4 = getCellByAddress(sheet, "D4");
|
|
|
d4.setCellValue(contractInfo.getContractorUnitName());
|
|
|
}
|
|
|
+ //顶部项目名称
|
|
|
+ Cell a2 = getCellByAddress(sheet, "A2");
|
|
|
+ a2.setCellValue(projectName);
|
|
|
dianqian(htmlUrl,sheet,workbook);
|
|
|
for (Sheet sheet1 : workbook) {
|
|
|
for (Row row : sheet1) {
|
|
@@ -2736,7 +2741,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/**
|
|
|
* 中间支付审核表获取PDFurl
|
|
|
*/
|
|
|
- public ReportResult getIntermediatePaymentPDF(String url,Long contractId,Long periodId,List<ContractMeterPeriod> list,Long redisId,String htmlUrl,BigDecimal blReserveFundsRatioNew) {
|
|
|
+ public ReportResult getIntermediatePaymentPDF(String url,Long contractId,Long periodId,List<ContractMeterPeriod> list,Long redisId,String htmlUrl,BigDecimal blReserveFundsRatioNew,String projectName) {
|
|
|
//判断当前是否是只有1期计量
|
|
|
Boolean isOnePeriod = false;
|
|
|
ContractMeterPeriod contractMeterPeriod1 = list.get(0);
|
|
@@ -2925,6 +2930,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Cell b3 = getCellByAddress(sheet, "B3");
|
|
|
b3.setCellValue(contractInfo.getConstructionUnitName());
|
|
|
}
|
|
|
+ //顶部项目名称
|
|
|
+ Cell a1 = getCellByAddress(sheet, "A1");
|
|
|
+ a1.setCellValue(projectName);
|
|
|
dianqian(htmlUrl,sheet,workbook);
|
|
|
for (Sheet sheet1 : workbook) {
|
|
|
for (Row row : sheet1) {
|
|
@@ -3066,15 +3074,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
* @param url
|
|
|
* @return
|
|
|
*/
|
|
|
- public ReportResult getIntermediateApplyPDF(String url,Long periodId,Long projectId,String htmlUrl){
|
|
|
- String projectName = null;
|
|
|
- try {
|
|
|
- String sql="Select project_name from m_project_info where id='"+projectId+"'";
|
|
|
- ProjectInfo projectInfo = jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(ProjectInfo.class));
|
|
|
- projectName = projectInfo.getProjectName();
|
|
|
- } catch (DataAccessException e) {
|
|
|
- projectName=null;
|
|
|
- }
|
|
|
+ public ReportResult getIntermediateApplyPDF(String url,Long periodId,Long projectId,String htmlUrl,String projectName){
|
|
|
|
|
|
InputStream modInput = null;
|
|
|
FileInputStream excelFileInput = null;
|
|
@@ -3090,6 +3090,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
c3.setCellValue(projectName);
|
|
|
Cell d5=getCellByAddress(sheet,"D5");
|
|
|
d5.setCellValue(projectName);
|
|
|
+ //顶部项目名称
|
|
|
+ Cell a1=getCellByAddress(sheet,"A1");
|
|
|
+ a1.setCellValue(projectName);
|
|
|
//根据坐标获取单元格
|
|
|
Cell c = getCellByAddress(sheet, "E6");
|
|
|
//本期计量
|
|
@@ -3439,6 +3442,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
if(ObjectUtil.isNotEmpty(contractId)){
|
|
|
ContractInfo contractInfo = getContractInfo(contractId);
|
|
|
String projectName = getProjectName(contractInfo.getPId());
|
|
|
+ //顶部项目名称
|
|
|
+ Cell a1 = getCellByAddress(sheet, "A1");
|
|
|
+ a1.setCellValue(projectName);
|
|
|
//项目名称
|
|
|
Cell b3 = getCellByAddress(sheet, "B3");
|
|
|
b3.setCellValue(projectName);
|
|
@@ -3756,6 +3762,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
if(ObjectUtil.isNotEmpty(contractId)){
|
|
|
ContractInfo contractInfo = getContractInfo(contractId);
|
|
|
String projectName = getProjectName(contractInfo.getPId());
|
|
|
+ //顶部项目名称
|
|
|
+ Cell a1 =getCellByAddress(sheet,"A1");
|
|
|
+ a1.setCellValue(projectName);
|
|
|
//项目名称
|
|
|
Cell b3=getCellByAddress(sheet,"B3");
|
|
|
b3.setCellValue(projectName);
|