|
@@ -7,7 +7,6 @@ import cn.hutool.core.util.HashUtil;
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -22,17 +21,14 @@ import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.ss.util.CellReference;
|
|
|
import org.apache.poi.util.IOUtils;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
-import org.springblade.common.constant.MeasurementStorage;
|
|
|
import org.springblade.common.utils.BaseUtils;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
-import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseEntity;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
@@ -92,8 +88,6 @@ import java.util.stream.Collectors;
|
|
|
import java.util.stream.IntStream;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
-import static org.springblade.manager.utils.TableCoordinates.*;
|
|
|
-
|
|
|
/**
|
|
|
* @author yangyj
|
|
|
* @Date 2022/6/9 14:29
|
|
@@ -2501,7 +2495,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
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 p.p_key_id,e.name,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 p.project_id=" + projectId;
|
|
|
+ String sqlForExcel = "SELECT p.p_key_id,e.name,e.id,p.html_url,e.file_url,p.init_table_name as tabName 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 p.project_id=" + projectId;
|
|
|
List<ExcelTabVo1> excelTabs = jdbcTemplate.query(sqlForExcel, new BeanPropertyRowMapper<>(ExcelTabVo1.class));
|
|
|
ArrayList<ReportResult> reportResults = new ArrayList<>();
|
|
|
//中期支付报表封面
|
|
@@ -2547,25 +2541,25 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
String htmlUrl6 = excel6.get().getHtmlUrl();
|
|
|
Long pKeyId6 = excel6.get().getPKeyId();
|
|
|
// 获取中期支付报表封面的pdfurl
|
|
|
- ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url, contractId, periodId, htmlUrl, projectName, list, pKeyId);
|
|
|
+ ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url, contractId, periodId, htmlUrl, projectName, list, pKeyId, excel.get().getTabName());
|
|
|
|
|
|
//获取中间支付审核表的pdfurl
|
|
|
- ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1, contractId, periodId, list, redisId, htmlUrl1, blReserveFundsRatioNew, projectName, changeMoneyNew, pKeyId1);
|
|
|
+ ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1, contractId, periodId, list, redisId, htmlUrl1, blReserveFundsRatioNew, projectName, changeMoneyNew, pKeyId1, excel1.get().getTabName());
|
|
|
|
|
|
//获取补助款申请支付审核表pdfUrl
|
|
|
- ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2, contractId, periodId, list, htmlUrl2, blReserveFundsRatioNew, projectName, projectId, reportId, pKeyId2);
|
|
|
+ ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2, contractId, periodId, list, htmlUrl2, blReserveFundsRatioNew, projectName, projectId, reportId, pKeyId2,excel2.get().getTabName());
|
|
|
|
|
|
//获取中间计量支付证书pdfUrl
|
|
|
- ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3, contractId, periodId, list, htmlUrl3, blReserveFundsRatioNew, projectName, pKeyId3);
|
|
|
+ ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3, contractId, periodId, list, htmlUrl3, blReserveFundsRatioNew, projectName, pKeyId3,excel3.get().getTabName());
|
|
|
|
|
|
//获取清单支付报表PDF
|
|
|
- ReportResult inventoryPayReportPDF = getInventoryPayReportPDF(url6, contractId, periodId, projectId, list, redisId, htmlUrl6, pKeyId6);
|
|
|
+ ReportResult inventoryPayReportPDF = getInventoryPayReportPDF(url6, contractId, periodId, projectId, list, redisId, htmlUrl6, pKeyId6, excel6.get().getTabName());
|
|
|
|
|
|
//获取工程支付月报pdfUrl
|
|
|
- ReportResult monthlyReportPDF = getMonthlyReportPDF(url5, reportId, contractId, periodId, projectId, list, redisId, htmlUrl5, pKeyId5);
|
|
|
+ ReportResult monthlyReportPDF = getMonthlyReportPDF(url5, reportId, contractId, periodId, projectId, list, redisId, htmlUrl5, pKeyId5, excel5.get().getTabName());
|
|
|
|
|
|
//获取中间支付申请表pdfUrl
|
|
|
- ReportResult intermediateApplyPDF = getIntermediateApplyPDF(url4, periodId, projectId, htmlUrl4, projectName, contractId, pKeyId4);
|
|
|
+ ReportResult intermediateApplyPDF = getIntermediateApplyPDF(url4, periodId, projectId, htmlUrl4, projectName, contractId, pKeyId4, excel4.get().getTabName());
|
|
|
|
|
|
reportResults.add(CoverOfMidtermPaymentReportPDF);
|
|
|
reportResults.add(intermediatePaymentPDF);
|
|
@@ -2583,7 +2577,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/**
|
|
|
* 中期支付报表封面
|
|
|
*/
|
|
|
- private ReportResult getCoverOfMidtermPaymentReportPDF(String url, Long contractId, Long periodId, String htmlUrl, String projectName, List<ContractMeterPeriod> list, Long pkeyId) {
|
|
|
+ private ReportResult getCoverOfMidtermPaymentReportPDF(String url, Long contractId, Long periodId, String htmlUrl, String projectName, List<ContractMeterPeriod> list, Long pkeyId, String tabName) {
|
|
|
|
|
|
//获取本期计量期
|
|
|
String sqlForMeterPeriodById = "SELECT id,period_number,start_date,end_date FROM s_contract_meter_period WHERE id=" + periodId + " and is_deleted = 0 ";
|
|
@@ -2634,7 +2628,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Cell c10 = getCellByAddress(sheet, "C10");
|
|
|
c10.setCellValue(contractInfo.getSupervisionUnitName());
|
|
|
}
|
|
|
- dianqian(htmlUrl, sheet, workbook);
|
|
|
+ dianqian(htmlUrl, sheet, workbook, tabName);
|
|
|
if (!periodId.equals(1867838908899852290L)) {
|
|
|
dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
|
|
|
}
|
|
@@ -2670,7 +2664,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
|
|
|
/*设置电签ID*/
|
|
|
- public void dianqian(String htmlUrl, Sheet sheet, Workbook workbook) {
|
|
|
+ public void dianqian(String htmlUrl, Sheet sheet, Workbook workbook, String tabName) {
|
|
|
try {
|
|
|
InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(htmlUrl);
|
|
|
String htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
@@ -2678,8 +2672,30 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Element table = doc.select("table").first();
|
|
|
// 组装电签设置
|
|
|
Elements dqids = table.getElementsByAttribute("dqid");
|
|
|
+ // 电签组装2
|
|
|
+ String dqSql = "select e_key,GROUP_CONCAT(DISTINCT concat('*✹',id)) ids from u_sign_key_role_info where tab_en_name='" + tabName + "' GROUP BY e_key";
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(dqSql);
|
|
|
+ if(mapList!=null && mapList.size()>0){
|
|
|
+ for(Map<String, Object> map : mapList) {
|
|
|
+ Elements elementsBy = table.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "_");
|
|
|
+ if(elementsBy!=null && elementsBy.size()>0){
|
|
|
+ for(Element element : elementsBy){
|
|
|
+ String dqIds = (String) map.get("ids");
|
|
|
+ dqIds = dqIds.replace(",","");
|
|
|
+ dqIds = dqIds.substring(1);
|
|
|
+ element.attr("sign_type", dqIds);
|
|
|
+ dqids.add(element);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
for (Element element : dqids) {
|
|
|
- String dqid = element.attr("dqid");
|
|
|
+ String dqid="";
|
|
|
+ if(element.hasAttr("sign_type")){
|
|
|
+ dqid = element.attr("sign_type");
|
|
|
+ }else{
|
|
|
+ dqid = element.attr("dqid");
|
|
|
+ }
|
|
|
|
|
|
int x1 = 0;
|
|
|
int y1 = 0;
|
|
@@ -2773,7 +2789,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, String projectName, Long pkeyId) {
|
|
|
+ private ReportResult getIntermediateMeasurementPaymentCertificatePDF(String url3, Long contractId, Long periodId, List<ContractMeterPeriod> list, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, Long pkeyId, String tabName) {
|
|
|
//判断当前是否是第一期
|
|
|
Boolean isOnePeriod = false;
|
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
@@ -2854,7 +2870,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Cell c3 = getCellByAddress(sheet, "C3");
|
|
|
c3.setCellValue(projectName);
|
|
|
|
|
|
- dianqian(htmlUrl, sheet, workbook);
|
|
|
+ dianqian(htmlUrl, sheet, workbook, tabName);
|
|
|
if (!periodId.equals(1867838908899852290L)) {
|
|
|
dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
|
|
|
}
|
|
@@ -2900,7 +2916,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, String projectName, Long projectId, Long reportId, Long pkeyId) {
|
|
|
+ private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, Long projectId, Long reportId, Long pkeyId, String tabName) {
|
|
|
//判断当前是否是只有1期计量
|
|
|
Boolean isOnePeriod = false;
|
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
@@ -3174,7 +3190,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Cell a2 = getCellByAddress(sheet, "A2");
|
|
|
a2.setCellValue(projectName);
|
|
|
// 电签
|
|
|
- dianqian(htmlUrl, sheet, workbook);
|
|
|
+ dianqian(htmlUrl, sheet, workbook, tabName);
|
|
|
if (!periodId.equals(1867838908899852290L)) {
|
|
|
dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
|
|
|
}
|
|
@@ -3214,7 +3230,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, String projectName, BigDecimal changeMoneyNew, Long pkeyId) {
|
|
|
+ public ReportResult getIntermediatePaymentPDF(String url, Long contractId, Long periodId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, BigDecimal changeMoneyNew, Long pkeyId, String tabName) {
|
|
|
//判断当前是否是只有1期计量
|
|
|
Boolean isOnePeriod = false;
|
|
|
ContractMeterPeriod contractMeterPeriod1 = list.get(0);
|
|
@@ -3486,7 +3502,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
//顶部项目名称
|
|
|
Cell a1 = getCellByAddress(sheet, "A1");
|
|
|
a1.setCellValue(projectName);
|
|
|
- dianqian(htmlUrl, sheet, workbook);
|
|
|
+ dianqian(htmlUrl, sheet, workbook, tabName);
|
|
|
if (!periodId.equals(1867838908899852290L)) {
|
|
|
dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
|
|
|
}
|
|
@@ -3638,7 +3654,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
* @param tabName
|
|
|
* @return
|
|
|
*/
|
|
|
- public ReportResult getIntermediateApplyPDF(String url, Long periodId, Long projectId, String htmlUrl, String projectName, Long contractId, Long pkeyId) {
|
|
|
+ public ReportResult getIntermediateApplyPDF(String url, Long periodId, Long projectId, String htmlUrl, String projectName, Long contractId, Long pkeyId, String tabName) {
|
|
|
InputStream modInput = null;
|
|
|
FileInputStream excelFileInput = null;
|
|
|
FileOutputStream outputStream = null;
|
|
@@ -3648,7 +3664,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
modInput = CommonUtil.getOSSInputStream(url);
|
|
|
workbook = WorkbookFactory.create(modInput);
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
- dianqian(htmlUrl, sheet, workbook);
|
|
|
+ dianqian(htmlUrl, sheet, workbook, tabName);
|
|
|
if (!periodId.equals(1867838908899852290L)) {
|
|
|
dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
|
|
|
}
|
|
@@ -3718,7 +3734,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
* @param tabName
|
|
|
* @return
|
|
|
*/
|
|
|
- public ReportResult getMonthlyReportPDF(String url, Long reportId, Long contractId, Long periodId, Long projectId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, Long pkeyId) throws IllegalAccessException {
|
|
|
+ public ReportResult getMonthlyReportPDF(String url, Long reportId, Long contractId, Long periodId, Long projectId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, Long pkeyId, String tabName) throws IllegalAccessException {
|
|
|
//获取本期计量期
|
|
|
String sqlForMeterPeriodById = "SELECT id,period_number,start_date,end_date FROM s_contract_meter_period WHERE id=" + periodId + " and is_deleted = 0 ";
|
|
|
ContractMeterPeriod contractMeterPeriodNow = jdbcTemplate.queryForObject(sqlForMeterPeriodById, new BeanPropertyRowMapper<>(ContractMeterPeriod.class));
|
|
@@ -4176,7 +4192,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
m_3.setCellValue(formattedDate);
|
|
|
}
|
|
|
}
|
|
|
- dianqian(htmlUrl, sheet, workbook);
|
|
|
+ dianqian(htmlUrl, sheet, workbook, tabName);
|
|
|
if (!periodId.equals(1867838908899852290L)) {
|
|
|
dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
|
|
|
}
|
|
@@ -4216,7 +4232,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
* @return
|
|
|
*/
|
|
|
|
|
|
- public ReportResult getInventoryPayReportPDF(String url, Long contractId, Long periodId, Long projectId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, Long pkeyId) throws FileNotFoundException, IllegalAccessException {
|
|
|
+ public ReportResult getInventoryPayReportPDF(String url, Long contractId, Long periodId, Long projectId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, Long pkeyId, String tabName) throws FileNotFoundException, IllegalAccessException {
|
|
|
MiddleMeterApply middleMeterApply = new MiddleMeterApply();
|
|
|
middleMeterApply.setContractId(contractId);
|
|
|
middleMeterApply.setContractPeriodId(periodId);
|
|
@@ -4585,7 +4601,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
l4.setCellStyle(cellStyle);
|
|
|
l4.setCellValue(contractInfo.getSupervisionUnitName());
|
|
|
}
|
|
|
- dianqian(htmlUrl, sheet, workbook);
|
|
|
+ dianqian(htmlUrl, sheet, workbook, tabName);
|
|
|
if (!periodId.equals(1867838908899852290L)) {
|
|
|
dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
|
|
|
}
|