|
@@ -44,8 +44,14 @@ import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
import org.springblade.manager.service.*;
|
|
|
import org.springblade.manager.utils.FileUtils;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
+import org.springblade.meter.entity.ContractMeterPeriod;
|
|
|
import org.springblade.meter.entity.InterimPayCertificateItem;
|
|
|
+import org.springblade.meter.entity.MiddleMeterApply;
|
|
|
import org.springblade.meter.feign.CertificateItemClient;
|
|
|
+import org.springblade.meter.feign.MiddleMeterApplyClient;
|
|
|
+import org.springblade.meter.vo.MeterInventoryDetailVO;
|
|
|
+import org.springblade.meter.vo.MeterInventoryVO;
|
|
|
+import org.springblade.meter.vo.MeterInventoryVO1;
|
|
|
import org.springblade.resource.feign.CommonFileClient;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.resource.vo.NewBladeFile;
|
|
@@ -118,6 +124,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
private final CommonFileClient commonFileClient;
|
|
|
@Lazy
|
|
|
@Autowired
|
|
|
+ private final MiddleMeterApplyClient middleMeterApplyClient;
|
|
|
+ @Lazy
|
|
|
+ @Autowired
|
|
|
private IExcelTabService excelTabService;
|
|
|
|
|
|
@Override
|
|
@@ -2146,11 +2155,26 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ReportResult> execute4(Long contractId, Long periodId, Integer type) {
|
|
|
+ public List<ReportResult> execute4(Long contractId, Long periodId, Integer type,Long projectId) {
|
|
|
+ //判断计算的是哪一期。
|
|
|
+ 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));
|
|
|
//中间支付审核表
|
|
|
- String url = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20241120/ea6c945827dd2990a9c7b1957fe201c4.XLSX";
|
|
|
+ String url1 = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20241120/ea6c945827dd2990a9c7b1957fe201c4.XLSX";
|
|
|
+ //中间计量支付申请表
|
|
|
+ String url4="https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240828/bff82dd0a1b7394f5fdab1322a3e6023.XLSX";
|
|
|
+ //工程支付月报
|
|
|
+ String url5="https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240903/c8a5b424eace6c26b2edf9b9b33f088a.XLSX";
|
|
|
+ //清单支付报表
|
|
|
+ String url6="https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20241120/e168f024c8055362664a276ad3721cb7.XLSX";
|
|
|
//获取中间支付审核表的pdfurl
|
|
|
- ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url);
|
|
|
+ //ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1);
|
|
|
+ //获取中间支付申请表pdfUrl
|
|
|
+ //ReportResult intermediateApplyPDF=getIntermediateApplyPDF(url4);
|
|
|
+ //获取工程支付月报pdfUrl
|
|
|
+ //ReportResult monthlyReportPDF=getMonthlyReportPDF(url5);
|
|
|
+ //获取清单支付报表PDF
|
|
|
+ ReportResult inventoryPayReportPDF=getInventoryPayReportPDF(url6,contractId,periodId,projectId,list);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -2195,6 +2219,131 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
return reportResult;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 中间支付申请表获取pdfUrl CR1
|
|
|
+ * @param url
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ReportResult getIntermediateApplyPDF(String url){
|
|
|
+ InputStream modInput = null;
|
|
|
+ FileInputStream excelFileInput = null;
|
|
|
+ FileOutputStream outputStream = null;
|
|
|
+ Workbook workbook = null;
|
|
|
+ MultipartFile files = null;
|
|
|
+ try {
|
|
|
+ modInput = CommonUtil.getOSSInputStream(url);
|
|
|
+ workbook = WorkbookFactory.create(modInput);
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+ //根据坐标获取单元格
|
|
|
+ Cell c5 = getCellByAddress(sheet, "C5");
|
|
|
+ c5.setCellValue("大笨熊二号");
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ //String file_path = "C://upload1//";
|
|
|
+ String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
|
|
|
+ outputStream = new FileOutputStream(locationFile);
|
|
|
+ //生成一份新的excel
|
|
|
+ workbook.write(outputStream);
|
|
|
+ //将excel转PDF
|
|
|
+ File excelFile = new File(locationFile);
|
|
|
+ excelFileInput = new FileInputStream(excelFile);
|
|
|
+ files = new MockMultipartFile("file", excelFile.getName(), "text/plain", IOUtils.toByteArray(excelFileInput));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
|
|
|
+ ReportResult reportResult = new ReportResult();
|
|
|
+ CompletableFuture<String> stringCompletableFuture = new CompletableFuture<>();
|
|
|
+ stringCompletableFuture.complete(bladeFile.getLink());
|
|
|
+ reportResult.setPdfOssPath(stringCompletableFuture);
|
|
|
+ return reportResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 工程支付月报获取pdfUrl CR2
|
|
|
+ * @param url
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ReportResult getMonthlyReportPDF(String url){
|
|
|
+ InputStream modInput = null;
|
|
|
+ FileInputStream excelFileInput = null;
|
|
|
+ FileOutputStream outputStream = null;
|
|
|
+ Workbook workbook = null;
|
|
|
+ MultipartFile files = null;
|
|
|
+
|
|
|
+ try {
|
|
|
+ modInput = CommonUtil.getOSSInputStream(url);
|
|
|
+ workbook = WorkbookFactory.create(modInput);
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+ //根据坐标获取单元格
|
|
|
+ Cell c5 = getCellByAddress(sheet, "C5");
|
|
|
+ c5.setCellValue("大笨熊二号");
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ //String file_path = "C://upload1//";
|
|
|
+ String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
|
|
|
+ outputStream = new FileOutputStream(locationFile);
|
|
|
+ //生成一份新的excel
|
|
|
+ workbook.write(outputStream);
|
|
|
+ //将excel转PDF
|
|
|
+ File excelFile = new File(locationFile);
|
|
|
+ excelFileInput = new FileInputStream(excelFile);
|
|
|
+ files = new MockMultipartFile("file", excelFile.getName(), "text/plain", IOUtils.toByteArray(excelFileInput));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
|
|
|
+ ReportResult reportResult = new ReportResult();
|
|
|
+ CompletableFuture<String> stringCompletableFuture = new CompletableFuture<>();
|
|
|
+ stringCompletableFuture.complete(bladeFile.getLink());
|
|
|
+ reportResult.setPdfOssPath(stringCompletableFuture);
|
|
|
+ return reportResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 清单支付报表获取PDF CR3
|
|
|
+ * @param url
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ReportResult getInventoryPayReportPDF(String url,Long contractId, Long periodId, Long projectId,List<ContractMeterPeriod> list){
|
|
|
+ MiddleMeterApply middleMeterApply=new MiddleMeterApply();
|
|
|
+ middleMeterApply.setContractId(contractId);
|
|
|
+ middleMeterApply.setContractPeriodId(periodId);
|
|
|
+ middleMeterApply.setProjectId(projectId);
|
|
|
+ //本期清单明细
|
|
|
+ List<MeterInventoryDetailVO> formDetail=middleMeterApplyClient.formDetail(middleMeterApply);
|
|
|
+ //上期清单明细
|
|
|
+ List<MeterInventoryDetailVO> oldFormDetail=new ArrayList<>();
|
|
|
+ if(list.size()>0){
|
|
|
+ OptionalInt index=IntStream.range(0, list.size())
|
|
|
+ .filter(i -> list.get(i).getId().equals(periodId))
|
|
|
+ .findFirst();
|
|
|
+ //i大于0 说明需要计算上一期的
|
|
|
+ if(index.isPresent()){
|
|
|
+ int i = index.getAsInt();
|
|
|
+ if(i>0){
|
|
|
+ MiddleMeterApply oldMiddleMeterApply=new MiddleMeterApply();
|
|
|
+ oldMiddleMeterApply.setProjectId(projectId);
|
|
|
+ oldMiddleMeterApply.setContractId(contractId);
|
|
|
+ oldMiddleMeterApply.setContractPeriodId(periodId);
|
|
|
+ oldFormDetail=middleMeterApplyClient.formDetail(oldMiddleMeterApply);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //上期且需要变化的清单明细
|
|
|
+ List<MeterInventoryDetailVO> changeFormDetail=new ArrayList<>();
|
|
|
+ if(oldFormDetail.size()>0){
|
|
|
+ for (MeterInventoryDetailVO vo : oldFormDetail) {
|
|
|
+ for (MeterInventoryDetailVO vo1 : formDetail) {
|
|
|
+ if(vo.getFormNumber().equals(vo1.getFormNumber())){
|
|
|
+ changeFormDetail.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //清单支付报表对象
|
|
|
+ MeterInventoryVO1 vo=new MeterInventoryVO1();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
//根据单元格地址获取单元格对象
|
|
|
private static Cell getCellByAddress(Sheet sheet, String cellAddress) {
|
|
|
CellReference cellRef = new CellReference(cellAddress);
|