|
@@ -30,6 +30,8 @@ import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.core.mp.base.BaseEntity;
|
|
import org.springblade.core.mp.base.BaseEntity;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
|
+import org.springblade.core.oss.model.BladeFile;
|
|
|
|
+import org.springblade.core.redis.cache.BladeRedis;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.manager.bean.TableInfo;
|
|
import org.springblade.manager.bean.TableInfo;
|
|
@@ -48,7 +50,11 @@ import org.springblade.manager.utils.FileUtils;
|
|
import org.springblade.manager.vo.*;
|
|
import org.springblade.manager.vo.*;
|
|
import org.springblade.meter.entity.*;
|
|
import org.springblade.meter.entity.*;
|
|
import org.springblade.meter.feign.CertificateItemClient;
|
|
import org.springblade.meter.feign.CertificateItemClient;
|
|
|
|
+import org.springblade.meter.feign.IContractInventoryFormClient;
|
|
import org.springblade.meter.feign.MiddleMeterApplyClient;
|
|
import org.springblade.meter.feign.MiddleMeterApplyClient;
|
|
|
|
+import org.springblade.meter.utils.CollectionUtils;
|
|
|
|
+import org.springblade.meter.vo.*;
|
|
|
|
+import org.springblade.resource.builder.oss.OssBuilder;
|
|
import org.springblade.meter.vo.MeterInventoryDetailVO;
|
|
import org.springblade.meter.vo.MeterInventoryDetailVO;
|
|
import org.springblade.meter.vo.MeterInventoryVO1;
|
|
import org.springblade.meter.vo.MeterInventoryVO1;
|
|
import org.springblade.resource.feign.CommonFileClient;
|
|
import org.springblade.resource.feign.CommonFileClient;
|
|
@@ -71,6 +77,7 @@ import java.io.*;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
|
+import java.math.RoundingMode;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
@@ -133,6 +140,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
private IExcelTabService excelTabService;
|
|
private IExcelTabService excelTabService;
|
|
@Autowired
|
|
@Autowired
|
|
private StringRedisTemplate redisTemplate;
|
|
private StringRedisTemplate redisTemplate;
|
|
|
|
+ @Autowired
|
|
|
|
+ private BladeRedis bladeRedis;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IContractInventoryFormClient iContractInventoryFormClient;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void execute(TableElementConverter tec) {
|
|
public void execute(TableElementConverter tec) {
|
|
@@ -898,7 +909,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
efm.setParamId(d.getId());
|
|
efm.setParamId(d.getId());
|
|
efm.setElementId(e.getId());
|
|
efm.setElementId(e.getId());
|
|
efm.setFormulaId(tf.getId());
|
|
efm.setFormulaId(tf.getId());
|
|
- //this.elementFormulaMappingService.save(efm);
|
|
|
|
|
|
+ this.elementFormulaMappingService.save(efm);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -918,7 +929,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
efm.setParamId(d.getId());
|
|
efm.setParamId(d.getId());
|
|
efm.setElementId(e.getId());
|
|
efm.setElementId(e.getId());
|
|
efm.setFormulaId(tf.getId());
|
|
efm.setFormulaId(tf.getId());
|
|
- //this.elementFormulaMappingService.save(efm);
|
|
|
|
|
|
+ this.elementFormulaMappingService.save(efm);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -2160,12 +2171,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<ReportResult> execute4(Long contractId, Long periodId, Integer type,Long projectId) {
|
|
|
|
|
|
+ public List<ReportResult> execute4(Long reportId,Long contractId, Long periodId, Integer type,Long projectId) throws FileNotFoundException, IllegalAccessException {
|
|
|
|
|
|
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";
|
|
List<ContractMeterPeriod> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ContractMeterPeriod.class));
|
|
List<ContractMeterPeriod> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ContractMeterPeriod.class));
|
|
|
|
+
|
|
ArrayList<ReportResult> reportResults = new ArrayList<>();
|
|
ArrayList<ReportResult> reportResults = new ArrayList<>();
|
|
//中期支付报表封面
|
|
//中期支付报表封面
|
|
String url = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240828/3ee50ef54005c95bd724bcabae54058c.XLSX";
|
|
String url = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240828/3ee50ef54005c95bd724bcabae54058c.XLSX";
|
|
@@ -2175,6 +2187,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
String url2 = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20241120/970eec0eb3cf3d215263a0e2f24c142e.xlsx";
|
|
String url2 = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20241120/970eec0eb3cf3d215263a0e2f24c142e.xlsx";
|
|
//中间计量支付证书
|
|
//中间计量支付证书
|
|
String url3 = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240828/fb1110ae6aab7295759775206e5b44b8.XLSX";
|
|
String url3 = "https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240828/fb1110ae6aab7295759775206e5b44b8.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
|
|
// 获取中期支付报表封面的pdfurl
|
|
ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url,contractId,periodId);
|
|
ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url,contractId,periodId);
|
|
//获取中间支付审核表的pdfurl
|
|
//获取中间支付审核表的pdfurl
|
|
@@ -2183,24 +2201,20 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list);
|
|
ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list);
|
|
//获取中间计量支付证书pdfUrl
|
|
//获取中间计量支付证书pdfUrl
|
|
ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3,contractId,periodId,list);
|
|
ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3,contractId,periodId,list);
|
|
- //中间计量支付申请表
|
|
|
|
- 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(url1);
|
|
|
|
//获取中间支付申请表pdfUrl
|
|
//获取中间支付申请表pdfUrl
|
|
- //ReportResult intermediateApplyPDF=getIntermediateApplyPDF(url4);
|
|
|
|
- //获取工程支付月报pdfUrl
|
|
|
|
- //ReportResult monthlyReportPDF=getMonthlyReportPDF(url5);
|
|
|
|
|
|
+ ReportResult intermediateApplyPDF=getIntermediateApplyPDF(url4,redisId);
|
|
//获取清单支付报表PDF
|
|
//获取清单支付报表PDF
|
|
- //ReportResult inventoryPayReportPDF=getInventoryPayReportPDF(url6,contractId,periodId,projectId,list);
|
|
|
|
|
|
+ ReportResult inventoryPayReportPDF=getInventoryPayReportPDF(url6,contractId,periodId,projectId,list,redisId);
|
|
|
|
+ //获取工程支付月报pdfUrl
|
|
|
|
+ ReportResult monthlyReportPDF=getMonthlyReportPDF(url5,reportId,contractId,periodId,projectId,list,redisId);
|
|
reportResults.add(CoverOfMidtermPaymentReportPDF);
|
|
reportResults.add(CoverOfMidtermPaymentReportPDF);
|
|
reportResults.add(intermediatePaymentPDF);
|
|
reportResults.add(intermediatePaymentPDF);
|
|
reportResults.add(subsidyApplicationPaymentReviewPDF);
|
|
reportResults.add(subsidyApplicationPaymentReviewPDF);
|
|
reportResults.add(intermediateMeasurementPaymentCertificatePDF);
|
|
reportResults.add(intermediateMeasurementPaymentCertificatePDF);
|
|
|
|
+ reportResults.add(intermediateApplyPDF);
|
|
|
|
+ reportResults.add(monthlyReportPDF);
|
|
|
|
+ reportResults.add(inventoryPayReportPDF);
|
|
|
|
+
|
|
//reportResults.add(inventoryPayReportPDF);
|
|
//reportResults.add(inventoryPayReportPDF);
|
|
return reportResults;
|
|
return reportResults;
|
|
}
|
|
}
|
|
@@ -2908,7 +2922,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
* @param url
|
|
* @param url
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public ReportResult getIntermediateApplyPDF(String url){
|
|
|
|
|
|
+ public ReportResult getIntermediateApplyPDF(String url,Long redisId){
|
|
InputStream modInput = null;
|
|
InputStream modInput = null;
|
|
FileInputStream excelFileInput = null;
|
|
FileInputStream excelFileInput = null;
|
|
FileOutputStream outputStream = null;
|
|
FileOutputStream outputStream = null;
|
|
@@ -2919,8 +2933,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
workbook = WorkbookFactory.create(modInput);
|
|
workbook = WorkbookFactory.create(modInput);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
//根据坐标获取单元格
|
|
//根据坐标获取单元格
|
|
- Cell c5 = getCellByAddress(sheet, "C5");
|
|
|
|
- c5.setCellValue("大笨熊二号");
|
|
|
|
|
|
+ Cell c = getCellByAddress(sheet, "E6");
|
|
|
|
+ //本期计量
|
|
|
|
+ String s = redisTemplate.opsForValue().get(MeasurementStorage.CUR_MEASUREMENT + redisId);
|
|
|
|
+ c.setCellValue(s);
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
//String file_path = "C://upload1//";
|
|
//String file_path = "C://upload1//";
|
|
String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
|
|
String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
|
|
@@ -2936,9 +2952,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
|
|
NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
|
|
ReportResult reportResult = new ReportResult();
|
|
ReportResult reportResult = new ReportResult();
|
|
- CompletableFuture<String> stringCompletableFuture = new CompletableFuture<>();
|
|
|
|
- stringCompletableFuture.complete(bladeFile.getLink());
|
|
|
|
- reportResult.setPdfOssPath(stringCompletableFuture);
|
|
|
|
|
|
+ reportResult.setOssPdfUrl(bladeFile.getPdfUrl());
|
|
|
|
+ reportResult.setPdfPath(bladeFile.getPdfUrl());
|
|
|
|
+ reportResult.setName("中间支付申请表");
|
|
return reportResult;
|
|
return reportResult;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2947,7 +2963,212 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
* @param url
|
|
* @param url
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public ReportResult getMonthlyReportPDF(String url){
|
|
|
|
|
|
+ public ReportResult getMonthlyReportPDF(String url, Long reportId,Long contractId, Long periodId, Long projectId,List<ContractMeterPeriod> list,Long redisId){
|
|
|
|
+ String sql="SELECT id from s_contract_inventory_form where contract_id="+contractId+" and parent_id=0";
|
|
|
|
+ Long id = jdbcTemplate.queryForObject(sql, Long.class);
|
|
|
|
+ InventoryFormDetailVO detail = iContractInventoryFormClient.detail(id);
|
|
|
|
+ List<ContractInventoryFormVO> list1 = detail.getList();
|
|
|
|
+ List<MonthlyReportVo> values=new ArrayList<>();
|
|
|
|
+ for (ContractInventoryFormVO vo : list1) {
|
|
|
|
+ MonthlyReportVo monthlyReport=new MonthlyReportVo();
|
|
|
|
+ monthlyReport.setFormNumber(vo.getFormNumber());
|
|
|
|
+ monthlyReport.setFormName(vo.getFormName());
|
|
|
|
+ monthlyReport.setCurrentMeterMoney(vo.getContractMoney().setScale(0,RoundingMode.HALF_UP));
|
|
|
|
+ monthlyReport.setAfterCurrentMeterMoney(vo.getChangeMoney().setScale(0,RoundingMode.HALF_UP));
|
|
|
|
+ monthlyReport.setChangeMeterMoney(monthlyReport.getAfterCurrentMeterMoney().subtract(monthlyReport.getCurrentMeterMoney()));
|
|
|
|
+ String key=monthlyReport.getFormNumber().substring(0,1);
|
|
|
|
+ if(list.size()>0){
|
|
|
|
+ OptionalInt index=IntStream.range(0, list.size())
|
|
|
|
+ .filter(i -> list.get(i).getId().equals(periodId))
|
|
|
|
+ .findFirst();
|
|
|
|
+ //i大于0 说明需要计算之前的值
|
|
|
|
+ //到上期末完成金额 从redis里面取
|
|
|
|
+ BigDecimal beforeEndMoney=BigDecimal.ZERO;
|
|
|
|
+ if(index.isPresent()){
|
|
|
|
+ int j = index.getAsInt();
|
|
|
|
+ if(j>0){
|
|
|
|
+ for (int i = 0; i < j; i++) {
|
|
|
|
+ Object o = bladeRedis.get("redisId"+redisId+"periodId:"+list.get(j).getId()+"formNum:"+key+"nowMoney");
|
|
|
|
+ if(ObjectUtil.isNotEmpty(o)){
|
|
|
|
+ beforeEndMoney=beforeEndMoney.add ((BigDecimal) o);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(!beforeEndMoney.equals(BigDecimal.ZERO)){
|
|
|
|
+ monthlyReport.setBeforeEndMoney(beforeEndMoney);
|
|
|
|
+ BigDecimal percentage = monthlyReport.getBeforeEndMoney().divide(monthlyReport.getCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage = percentage.setScale(2, BigDecimal.ROUND_HALF_UP); // 设置
|
|
|
|
+ monthlyReport.setBeforeEndC(percentage);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //本期完成
|
|
|
|
+ Object o = bladeRedis.get("redisId"+redisId+"periodId:"+periodId+"formNum:"+key+"nowMoney");
|
|
|
|
+ if(ObjectUtil.isNotEmpty(o)){
|
|
|
|
+ monthlyReport.setNowMoney((BigDecimal)o);
|
|
|
|
+ BigDecimal percentage = monthlyReport.getNowMoney().divide(monthlyReport.getCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage = percentage.setScale(2, BigDecimal.ROUND_HALF_UP); // 设置小数位数为2
|
|
|
|
+ monthlyReport.setNowC(percentage);
|
|
|
|
+ }
|
|
|
|
+ //到本期末完成
|
|
|
|
+ if(ObjectUtil.isNotEmpty(monthlyReport.getBeforeEndMoney())&&ObjectUtil.isNotEmpty(monthlyReport.getNowMoney())){
|
|
|
|
+ monthlyReport.setNowEndMoney(monthlyReport.getBeforeEndMoney().add(monthlyReport.getNowMoney()));
|
|
|
|
+ }else if(ObjectUtil.isEmpty(monthlyReport.getBeforeEndMoney())&&ObjectUtil.isNotEmpty(monthlyReport.getNowMoney())){
|
|
|
|
+ monthlyReport.setNowEndMoney(monthlyReport.getNowMoney());
|
|
|
|
+ }
|
|
|
|
+ if(ObjectUtil.isNotEmpty(monthlyReport.getNowEndMoney())){
|
|
|
|
+ BigDecimal percentage = monthlyReport.getNowEndMoney().divide(monthlyReport.getCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage = percentage.setScale(2, BigDecimal.ROUND_HALF_UP); // 设置
|
|
|
|
+ monthlyReport.setNowEndC(percentage);
|
|
|
|
+ }
|
|
|
|
+ values.add(monthlyReport);
|
|
|
|
+ }
|
|
|
|
+ MonthlyReportVo m1 = new MonthlyReportVo();
|
|
|
|
+ m1.setFormNumber("D");
|
|
|
|
+ m1.setFormName("暂定金");
|
|
|
|
+ values.add(m1);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m2 = new MonthlyReportVo();
|
|
|
|
+ m2.setFormName("迟付款利息");
|
|
|
|
+ values.add(m2);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m3 = new MonthlyReportVo();
|
|
|
|
+ m3.setFormName("工程结算价款合计");
|
|
|
|
+ //工程结算价款合计 原合同总金额
|
|
|
|
+ BigDecimal currentMeterMoney = values.stream().map(MonthlyReportVo::getCurrentMeterMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ //工程结算价款合计 工程变更总金额
|
|
|
|
+ BigDecimal changeMeterMoney = values.stream().map(MonthlyReportVo::getChangeMeterMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ //工程结算价款合计 变更后合同总金额
|
|
|
|
+ BigDecimal afterCurrentMeterMoney = values.stream().map(MonthlyReportVo::getAfterCurrentMeterMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ //工程结算价款合计 到上期末完成金额
|
|
|
|
+ BigDecimal beforeEndMoney = values.stream().map(MonthlyReportVo::getBeforeEndMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ //工程结算价款合计 本期完成金额
|
|
|
|
+ BigDecimal nowMoney = values.stream().map(MonthlyReportVo::getNowMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ //工程结算价款合计 到本期末完成金额
|
|
|
|
+ BigDecimal nowEndMoney = values.stream().map(MonthlyReportVo::getNowEndMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+
|
|
|
|
+ m3.setCurrentMeterMoney(currentMeterMoney);
|
|
|
|
+ if(!changeMeterMoney.equals(BigDecimal.ZERO)){
|
|
|
|
+ m3.setChangeMeterMoney(changeMeterMoney);
|
|
|
|
+ }
|
|
|
|
+ m3.setAfterCurrentMeterMoney(afterCurrentMeterMoney);
|
|
|
|
+ if(!beforeEndMoney.equals(BigDecimal.ZERO)){
|
|
|
|
+ m3.setBeforeEndMoney(beforeEndMoney);
|
|
|
|
+ BigDecimal percentage1 = m3.getBeforeEndMoney().divide(m3.getAfterCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage1 = percentage1.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ m3.setBeforeEndC(percentage1);
|
|
|
|
+ }
|
|
|
|
+ m3.setNowMoney(nowMoney);
|
|
|
|
+ BigDecimal percentage2 = m3.getNowMoney().divide(m3.getAfterCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage2 = percentage2.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ m3.setNowC(percentage2);
|
|
|
|
+ m3.setNowEndMoney(nowEndMoney);
|
|
|
|
+ BigDecimal percentage3 = m3.getNowEndMoney().divide(m3.getAfterCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage3 = percentage3.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ m3.setNowEndC(percentage3);
|
|
|
|
+ values.add(m3);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m4 = new MonthlyReportVo();
|
|
|
|
+ m4.setFormName("业主违约罚金");
|
|
|
|
+ values.add(m4);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m5 = new MonthlyReportVo();
|
|
|
|
+ m5.setFormName("动员预付款");
|
|
|
|
+ values.add(m5);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m6 = new MonthlyReportVo();
|
|
|
|
+ m6.setFormName("其他付款");
|
|
|
|
+ values.add(m6);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m7 = new MonthlyReportVo();
|
|
|
|
+ m7.setFormName("退农民工工资保障金");
|
|
|
|
+ values.add(m7);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m8 = new MonthlyReportVo();
|
|
|
|
+ m8.setFormName("退质量保障金");
|
|
|
|
+ values.add(m8);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m9 = new MonthlyReportVo();
|
|
|
|
+ m9.setFormName("支付款合计");
|
|
|
|
+ values.add(m9);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m10 = new MonthlyReportVo();
|
|
|
|
+ m10.setFormName("材料预付款");
|
|
|
|
+ values.add(m10);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m11 = new MonthlyReportVo();
|
|
|
|
+ m11.setFormName("支付合计");
|
|
|
|
+ m11.setCurrentMeterMoney(m3.getCurrentMeterMoney());
|
|
|
|
+ if(ObjectUtil.isNotEmpty(m3.getChangeMeterMoney())){
|
|
|
|
+ m11.setChangeMeterMoney(m3.getChangeMeterMoney());
|
|
|
|
+ }
|
|
|
|
+ m11.setAfterCurrentMeterMoney(m3.getAfterCurrentMeterMoney());
|
|
|
|
+ if(ObjectUtil.isNotEmpty(m3.getBeforeEndMoney())){
|
|
|
|
+ m11.setBeforeEndMoney(m3.getBeforeEndMoney());
|
|
|
|
+ m11.setBeforeEndC(m3.getBeforeEndC());
|
|
|
|
+ }
|
|
|
|
+ m11.setNowMoney(m3.getNowMoney());
|
|
|
|
+ if(ObjectUtil.isNotEmpty(m3.getNowEndMoney())){
|
|
|
|
+ m11.setNowEndMoney(m3.getNowEndMoney());
|
|
|
|
+ m11.setNowEndC(m3.getNowC());
|
|
|
|
+ }
|
|
|
|
+ values.add(m11);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m12 = new MonthlyReportVo();
|
|
|
|
+ m12.setFormName("承包人违约罚金");
|
|
|
|
+ values.add(m12);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m13 = new MonthlyReportVo();
|
|
|
|
+ m13.setFormName("保留金");
|
|
|
|
+ //上期末扣取保留金
|
|
|
|
+ String s = redisTemplate.opsForValue().get(MeasurementStorage.PRE_END_RESERVE_MONEY + redisId);
|
|
|
|
+ if(StringUtil.isNotBlank(s)){
|
|
|
|
+ m13.setBeforeEndMoney(new BigDecimal(s));
|
|
|
|
+ }
|
|
|
|
+ m13.setNowMoney(new BigDecimal(redisTemplate.opsForValue().get(MeasurementStorage.CUR_END_RESERVE_MONEY + redisId)));
|
|
|
|
+ m13.setNowEndMoney(new BigDecimal(redisTemplate.opsForValue().get(MeasurementStorage.CUR_END_RESERVE_MONEY_SUM +redisId)));
|
|
|
|
+ values.add(m13);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m14 = new MonthlyReportVo();
|
|
|
|
+ m14.setFormName("农民工工资保障金(2%)");
|
|
|
|
+ values.add(m14);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m15 = new MonthlyReportVo();
|
|
|
|
+ m15.setFormName("扣回动员预付款");
|
|
|
|
+ values.add(m15);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m16 = new MonthlyReportVo();
|
|
|
|
+ m16.setFormName("扣回材料设备预付款");
|
|
|
|
+ values.add(m16);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m17 = new MonthlyReportVo();
|
|
|
|
+ m17.setFormName("其他扣款");
|
|
|
|
+ values.add(m17);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m18 = new MonthlyReportVo();
|
|
|
|
+ m18.setFormName("扣款合计");
|
|
|
|
+ m18.setNowMoney(m13.getNowMoney());
|
|
|
|
+ m18.setNowEndMoney(m13.getNowEndMoney());
|
|
|
|
+ values.add(m18);
|
|
|
|
+
|
|
|
|
+ MonthlyReportVo m19 = new MonthlyReportVo();
|
|
|
|
+ m19.setFormName("实际支付");
|
|
|
|
+ if(ObjectUtil.isNotEmpty(m11.getBeforeEndMoney())&&ObjectUtil.isNotEmpty(m18.getBeforeEndMoney())){
|
|
|
|
+ m19.setBeforeEndMoney(m11.getBeforeEndMoney().subtract(m18.getBeforeEndMoney()));
|
|
|
|
+ BigDecimal percentage4 = m19.getBeforeEndMoney().divide(m11.getAfterCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage4 = percentage4.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ m19.setBeforeEndC(percentage4);
|
|
|
|
+ }
|
|
|
|
+ m19.setNowMoney(m11.getNowMoney().subtract(m18.getNowMoney()));
|
|
|
|
+ BigDecimal percentage5 = m19.getNowMoney().divide(m11.getAfterCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage5 = percentage5.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ m19.setNowC(percentage5);
|
|
|
|
+ m19.setNowEndMoney(m11.getNowEndMoney().subtract(m18.getNowEndMoney()));
|
|
|
|
+ BigDecimal percentage6 = m19.getNowEndMoney().divide(m11.getAfterCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
|
|
|
|
+ percentage6 = percentage6.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ m19.setNowC(percentage6);
|
|
|
|
+ values.add(m19);
|
|
|
|
+
|
|
InputStream modInput = null;
|
|
InputStream modInput = null;
|
|
FileInputStream excelFileInput = null;
|
|
FileInputStream excelFileInput = null;
|
|
FileOutputStream outputStream = null;
|
|
FileOutputStream outputStream = null;
|
|
@@ -2959,10 +3180,28 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
workbook = WorkbookFactory.create(modInput);
|
|
workbook = WorkbookFactory.create(modInput);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
//根据坐标获取单元格
|
|
//根据坐标获取单元格
|
|
- Cell c5 = getCellByAddress(sheet, "C5");
|
|
|
|
- c5.setCellValue("大笨熊二号");
|
|
|
|
|
|
+ // 起始行号
|
|
|
|
+ int startRow =9;
|
|
|
|
+ int endRow = 35;
|
|
|
|
+ String[] letters = new String[] {
|
|
|
|
+ "A", "B", "D", "E", "F", "G", "I",
|
|
|
|
+ "J", "K", "L", "M"};
|
|
|
|
+ //循环一次 就是8到21的一行
|
|
|
|
+ for (int ii = 0; ii < values.size()&& startRow <= endRow; ii++,startRow++) {
|
|
|
|
+ MonthlyReportVo vo = values.get(ii);
|
|
|
|
+ //循环一次 就是A到S的一列
|
|
|
|
+ for (int j = 0; j < 11; j++) {
|
|
|
|
+ String index=letters[j]+startRow;
|
|
|
|
+ Cell c = getCellByAddress(sheet,index);
|
|
|
|
+ String attributeValue = getAttributeValue1(vo, j);
|
|
|
|
+ if(StringUtil.isNotBlank(attributeValue)){
|
|
|
|
+ if (c != null) {
|
|
|
|
+ c.setCellValue(attributeValue);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
- //String file_path = "C://upload1//";
|
|
|
|
String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
|
|
String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
|
|
outputStream = new FileOutputStream(locationFile);
|
|
outputStream = new FileOutputStream(locationFile);
|
|
//生成一份新的excel
|
|
//生成一份新的excel
|
|
@@ -2974,12 +3213,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
throw new RuntimeException(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;
|
|
|
|
|
|
+ ReportResult reportResult = new ReportResult();
|
|
|
|
+ NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
|
|
|
|
+ reportResult.setOssPdfUrl(bladeFile.getPdfUrl());
|
|
|
|
+ reportResult.setPdfPath(bladeFile.getPdfUrl());
|
|
|
|
+ reportResult.setName("工程支付月报");
|
|
|
|
+ return reportResult;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2988,40 +3227,50 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
* @param url
|
|
* @param url
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public ReportResult getInventoryPayReportPDF(String url,Long contractId, Long periodId, Long projectId,List<ContractMeterPeriod> list){
|
|
|
|
|
|
+
|
|
|
|
+ public ReportResult getInventoryPayReportPDF(String url,Long contractId, Long periodId, Long projectId,List<ContractMeterPeriod> list,Long redisId) throws FileNotFoundException, IllegalAccessException {
|
|
MiddleMeterApply middleMeterApply=new MiddleMeterApply();
|
|
MiddleMeterApply middleMeterApply=new MiddleMeterApply();
|
|
middleMeterApply.setContractId(contractId);
|
|
middleMeterApply.setContractId(contractId);
|
|
middleMeterApply.setContractPeriodId(periodId);
|
|
middleMeterApply.setContractPeriodId(periodId);
|
|
middleMeterApply.setProjectId(projectId);
|
|
middleMeterApply.setProjectId(projectId);
|
|
//本期清单明细
|
|
//本期清单明细
|
|
List<MeterInventoryDetailVO> formDetail=middleMeterApplyClient.formDetail(middleMeterApply);
|
|
List<MeterInventoryDetailVO> formDetail=middleMeterApplyClient.formDetail(middleMeterApply);
|
|
- //上期清单明细
|
|
|
|
- List<MeterInventoryDetailVO> oldFormDetail=new ArrayList<>();
|
|
|
|
|
|
+ //上期清单明细 期数+对应的清单明细
|
|
|
|
+ Map<String,List<MeterInventoryDetailVO>> oldFormDetailMap=new HashMap<>();
|
|
if(list.size()>0){
|
|
if(list.size()>0){
|
|
OptionalInt index=IntStream.range(0, list.size())
|
|
OptionalInt index=IntStream.range(0, list.size())
|
|
.filter(i -> list.get(i).getId().equals(periodId))
|
|
.filter(i -> list.get(i).getId().equals(periodId))
|
|
.findFirst();
|
|
.findFirst();
|
|
- //i大于0 说明需要计算上一期的
|
|
|
|
|
|
+ //i大于0 说明需要计算之前的值
|
|
if(index.isPresent()){
|
|
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);
|
|
|
|
|
|
+ int j = index.getAsInt();
|
|
|
|
+ if(j>0){
|
|
|
|
+ for (int i = 0; i < j; i++) {
|
|
|
|
+ MiddleMeterApply oldMiddleMeterApply=new MiddleMeterApply();
|
|
|
|
+ oldMiddleMeterApply.setProjectId(projectId);
|
|
|
|
+ oldMiddleMeterApply.setContractId(contractId);
|
|
|
|
+ oldMiddleMeterApply.setContractPeriodId(list.get(i).getId());
|
|
|
|
+ List<MeterInventoryDetailVO> oldFormDetail=middleMeterApplyClient.formDetail(oldMiddleMeterApply);
|
|
|
|
+ oldFormDetailMap.put("第"+i+1+"期",oldFormDetail);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//上期且需要变化的清单明细
|
|
//上期且需要变化的清单明细
|
|
- 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);
|
|
|
|
|
|
+ Map<String,List<MeterInventoryDetailVO>> changeFormDetailMap=new HashMap<>();
|
|
|
|
+ if(oldFormDetailMap.size()>0){
|
|
|
|
+ for (Map.Entry<String, List<MeterInventoryDetailVO>> entry : changeFormDetailMap.entrySet()) {
|
|
|
|
+ List<MeterInventoryDetailVO>changelist=new ArrayList<>();
|
|
|
|
+ List<MeterInventoryDetailVO> value = entry.getValue();
|
|
|
|
+ for (MeterInventoryDetailVO vo : value) {
|
|
|
|
+ for (MeterInventoryDetailVO vo1 : formDetail) {
|
|
|
|
+ if(vo.getFormNumber().equals(vo1.getFormNumber())){
|
|
|
|
+ changelist.add(vo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ changeFormDetailMap.put(entry.getKey(),changelist);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<MeterInventoryVO1>list1=new ArrayList<>();
|
|
List<MeterInventoryVO1>list1=new ArrayList<>();
|
|
@@ -3038,7 +3287,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
//原合同单价
|
|
//原合同单价
|
|
vo.setCurrentMeterPrice(form.getBidPrice());
|
|
vo.setCurrentMeterPrice(form.getBidPrice());
|
|
//原合同金额
|
|
//原合同金额
|
|
- vo.setCurrentMeterMoney(form.getContractMoney());
|
|
|
|
|
|
+ vo.setCurrentMeterMoney(form.getContractMoney().setScale(0, RoundingMode.HALF_UP));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -3048,19 +3297,19 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
//变更后工程量
|
|
//变更后工程量
|
|
vo.setAfterCurrentTotal(detailVO.getChangeTotal());
|
|
vo.setAfterCurrentTotal(detailVO.getChangeTotal());
|
|
//变更后金额 变更后工程量*单价
|
|
//变更后金额 变更后工程量*单价
|
|
- vo.setAfterCurrentMeterMoney(vo.getAfterCurrentTotal().multiply(detailVO.getCurrentPrice()));
|
|
|
|
|
|
+ vo.setAfterCurrentMeterMoney((vo.getAfterCurrentTotal().multiply(detailVO.getCurrentPrice())).setScale(0, RoundingMode.HALF_UP));
|
|
//工程变更工程量 变更后工程量-原合同工程量
|
|
//工程变更工程量 变更后工程量-原合同工程量
|
|
BigDecimal subtract = vo.getAfterCurrentTotal().subtract(vo.getCurrentMeterTotal());
|
|
BigDecimal subtract = vo.getAfterCurrentTotal().subtract(vo.getCurrentMeterTotal());
|
|
if(subtract==BigDecimal.ZERO){
|
|
if(subtract==BigDecimal.ZERO){
|
|
subtract=null;
|
|
subtract=null;
|
|
}
|
|
}
|
|
- vo.setChangeTotal(subtract);
|
|
|
|
|
|
+ vo.setChangeTotal(subtract!=null?subtract.setScale(0,RoundingMode.HALF_UP):subtract);
|
|
//工程变更金额 变更后金额-原合同金额
|
|
//工程变更金额 变更后金额-原合同金额
|
|
BigDecimal subtract1 = vo.getAfterCurrentMeterMoney().subtract(vo.getCurrentMeterMoney());
|
|
BigDecimal subtract1 = vo.getAfterCurrentMeterMoney().subtract(vo.getCurrentMeterMoney());
|
|
if(subtract1==BigDecimal.ZERO){
|
|
if(subtract1==BigDecimal.ZERO){
|
|
subtract1=null;
|
|
subtract1=null;
|
|
}
|
|
}
|
|
- vo.setChangeMeterMoney(subtract1);
|
|
|
|
|
|
+ vo.setChangeMeterMoney(subtract1!=null?subtract1.setScale(0, RoundingMode.HALF_UP):subtract1);
|
|
//工程变更单价
|
|
//工程变更单价
|
|
if(vo.getChangeMeterMoney()==null&&vo.getChangeTotal()==null){
|
|
if(vo.getChangeMeterMoney()==null&&vo.getChangeTotal()==null){
|
|
vo.setChangeMeterPrice(null);
|
|
vo.setChangeMeterPrice(null);
|
|
@@ -3068,21 +3317,27 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
vo.setChangeMeterPrice(detailVO.getCurrentPrice());
|
|
vo.setChangeMeterPrice(detailVO.getCurrentPrice());
|
|
}
|
|
}
|
|
//本期完成工程量
|
|
//本期完成工程量
|
|
- vo.setNowTotal(detailVO.getCurrentMeterTotal());
|
|
|
|
|
|
+ vo.setNowTotal(detailVO.getAllMeterTotal());
|
|
//本期完成金额
|
|
//本期完成金额
|
|
- vo.setNowMoney(detailVO.getAllMeterMoney());
|
|
|
|
|
|
+ vo.setNowMoney(detailVO.getAllMeterMoney().setScale(0, RoundingMode.HALF_UP));
|
|
//大于0表示有上期的 需要添加上期末数据
|
|
//大于0表示有上期的 需要添加上期末数据
|
|
- if(changeFormDetail.size()>0){
|
|
|
|
- for (MeterInventoryDetailVO changevo : changeFormDetail) {
|
|
|
|
- if(changevo.getFormNumber().equals(vo.getFormNumber())){
|
|
|
|
- //到上期末完成工程量
|
|
|
|
- vo.setBeforeEndTotal(changevo.getAllMeterTotal());
|
|
|
|
- //到上期末完成金额
|
|
|
|
- vo.setBeforeEndMoney(changevo.getAllMeterMoney());
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if(changeFormDetailMap.size()>0){
|
|
|
|
+ BigDecimal b1=BigDecimal.ZERO;
|
|
|
|
+ BigDecimal b2=BigDecimal.ZERO;
|
|
|
|
+ for (Map.Entry<String, List<MeterInventoryDetailVO>> entry : changeFormDetailMap.entrySet()) {
|
|
|
|
+ for (MeterInventoryDetailVO changevo : entry.getValue()) {
|
|
|
|
+ if(changevo.getFormNumber().equals(vo.getFormNumber())){
|
|
|
|
+ b1=b1.add(changevo.getCurrentMeterTotal());
|
|
|
|
+ b2=b2.add(changevo.getCurrentMeterMoney());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //到上期末完成工程量
|
|
|
|
+ vo.setBeforeEndTotal(b1.setScale(0, RoundingMode.HALF_UP));
|
|
|
|
+ //到上期末完成金额
|
|
|
|
+ vo.setBeforeEndMoney(b2.setScale(0, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
//到本期末完成工程量
|
|
//到本期末完成工程量
|
|
if(vo.getBeforeEndTotal()!=null){
|
|
if(vo.getBeforeEndTotal()!=null){
|
|
vo.setNowEndTotal(vo.getBeforeEndTotal().add(vo.getNowTotal()));
|
|
vo.setNowEndTotal(vo.getBeforeEndTotal().add(vo.getNowTotal()));
|
|
@@ -3091,17 +3346,21 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
//到本期末完成金额
|
|
//到本期末完成金额
|
|
if(vo.getBeforeEndMoney()!=null){
|
|
if(vo.getBeforeEndMoney()!=null){
|
|
- vo.setNowEndMoney(vo.getBeforeEndMoney().add(vo.getNowMoney()));
|
|
|
|
|
|
+ vo.setNowEndMoney((vo.getBeforeEndMoney().add(vo.getNowMoney())).setScale(0, RoundingMode.HALF_UP));
|
|
}else {
|
|
}else {
|
|
- vo.setNowEndMoney(vo.getNowMoney());
|
|
|
|
|
|
+ vo.setNowEndMoney(vo.getNowMoney().setScale(0, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
list1.add(vo);
|
|
list1.add(vo);
|
|
}
|
|
}
|
|
|
|
+ ReportResult reportResult = new ReportResult();
|
|
|
|
+ String suffix=SnowFlakeUtil.getId()+".pdf";
|
|
|
|
+ String localImgUrl="D://web//pdf//"+suffix;
|
|
if(list1.size()>0){
|
|
if(list1.size()>0){
|
|
//先根据根据前三个字符排序
|
|
//先根据根据前三个字符排序
|
|
list1.sort(Comparator.comparingInt(MeterInventoryVO1::getFirstThreeCharsAsInt));
|
|
list1.sort(Comparator.comparingInt(MeterInventoryVO1::getFirstThreeCharsAsInt));
|
|
//根据编号的第一个字符,分类
|
|
//根据编号的第一个字符,分类
|
|
Map<Character, List<MeterInventoryVO1>> groupedMeter = new HashMap<>();
|
|
Map<Character, List<MeterInventoryVO1>> groupedMeter = new HashMap<>();
|
|
|
|
+ List<String>listUrl=new ArrayList<>();
|
|
for (MeterInventoryVO1 vo1 : list1) {
|
|
for (MeterInventoryVO1 vo1 : list1) {
|
|
char firstChar = vo1.getFormNumber().charAt(0);
|
|
char firstChar = vo1.getFormNumber().charAt(0);
|
|
groupedMeter.computeIfAbsent(firstChar, k -> new ArrayList<>()).add(vo1);
|
|
groupedMeter.computeIfAbsent(firstChar, k -> new ArrayList<>()).add(vo1);
|
|
@@ -3109,10 +3368,40 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
//根据编号的不同建立不同的excel
|
|
//根据编号的不同建立不同的excel
|
|
for (Map.Entry<Character, List<MeterInventoryVO1>> listEntry : groupedMeter.entrySet()) {
|
|
for (Map.Entry<Character, List<MeterInventoryVO1>> listEntry : groupedMeter.entrySet()) {
|
|
List<MeterInventoryVO1> value = listEntry.getValue();
|
|
List<MeterInventoryVO1> value = listEntry.getValue();
|
|
|
|
+ //原合同金额 首页至本页
|
|
|
|
+ BigDecimal totalCurrentMeterMoney=BigDecimal.ZERO;
|
|
|
|
+ //工程变更金额 首页至本页
|
|
|
|
+ BigDecimal totalChangeMeterMoney=BigDecimal.ZERO;
|
|
|
|
+ //变更后合同金额 首页至本页
|
|
|
|
+ BigDecimal totalAfterCurrentMeterMoney=BigDecimal.ZERO;
|
|
|
|
+ //到上期末完成金额 首页至本页
|
|
|
|
+ BigDecimal totalBeforeEndMoney=BigDecimal.ZERO;
|
|
|
|
+ //本期完成金额 首页至本页
|
|
|
|
+ BigDecimal totalNowMoney=BigDecimal.ZERO;
|
|
|
|
+ //到本期末完成金额 首页至本页
|
|
|
|
+ BigDecimal totalNowEndMoney=BigDecimal.ZERO;
|
|
//编号来划分
|
|
//编号来划分
|
|
- for (int i = 0; i < value.size(); i+=16) {
|
|
|
|
- int endIndex = Math.min(i + 16, list.size());
|
|
|
|
|
|
+ for (int i = 0; i < value.size(); i+=14) {
|
|
|
|
+ int endIndex = Math.min(i + 14, value.size());
|
|
List<MeterInventoryVO1> subList = value.subList(i, endIndex);
|
|
List<MeterInventoryVO1> subList = value.subList(i, endIndex);
|
|
|
|
+ //原合同金额 本页
|
|
|
|
+ BigDecimal CurrentMeterMoney = subList.stream().map(MeterInventoryVO1::getCurrentMeterMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ totalCurrentMeterMoney= totalCurrentMeterMoney.add(CurrentMeterMoney);
|
|
|
|
+ //工程变更金额 本页
|
|
|
|
+ BigDecimal ChangeMeterMoney=subList.stream().map(MeterInventoryVO1::getChangeMeterMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ totalChangeMeterMoney=totalChangeMeterMoney.add(ChangeMeterMoney);
|
|
|
|
+ //变更后合同金额 本页
|
|
|
|
+ BigDecimal AfterCurrentMeterMoney=subList.stream().map(MeterInventoryVO1::getAfterCurrentMeterMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ totalAfterCurrentMeterMoney=totalAfterCurrentMeterMoney.add(AfterCurrentMeterMoney);
|
|
|
|
+ //到上期末完成金额 本页
|
|
|
|
+ BigDecimal BeforeEndMoney=subList.stream().map(MeterInventoryVO1::getBeforeEndMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ totalBeforeEndMoney=totalBeforeEndMoney.add(BeforeEndMoney);
|
|
|
|
+ //本期完成金额 本页
|
|
|
|
+ BigDecimal NowMoney=subList.stream().map(MeterInventoryVO1::getNowMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ totalNowMoney=totalNowMoney.add(NowMoney);
|
|
|
|
+ //到本期末完成金额 本页
|
|
|
|
+ BigDecimal NowEndMoney=subList.stream().map(MeterInventoryVO1::getNowEndMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ totalNowEndMoney=totalNowEndMoney.add(NowEndMoney);
|
|
InputStream modInput = null;
|
|
InputStream modInput = null;
|
|
FileInputStream excelFileInput = null;
|
|
FileInputStream excelFileInput = null;
|
|
FileOutputStream outputStream = null;
|
|
FileOutputStream outputStream = null;
|
|
@@ -3123,20 +3412,64 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
workbook = WorkbookFactory.create(modInput);
|
|
workbook = WorkbookFactory.create(modInput);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
// 起始行号
|
|
// 起始行号
|
|
- int startRow = 8;
|
|
|
|
- int endRow = 23;
|
|
|
|
- for (int ii = 0; ii < subList.size() && startRow <= endRow; ii++, startRow++) {
|
|
|
|
- Row row = sheet.createRow(startRow - 1); // 行号从0开始
|
|
|
|
|
|
+ int startRow =8;
|
|
|
|
+ int endRow = 21;
|
|
|
|
+ String[] letters = new String[] {
|
|
|
|
+ "A", "B", "D", "E", "F", "G", "H",
|
|
|
|
+ "I", "J", "K", "L", "M", "N", "P",
|
|
|
|
+ "Q", "R", "S"};
|
|
|
|
+ //循环一次 就是8到21的一行
|
|
|
|
+ for (int ii = 0; ii < subList.size()&& startRow <= endRow; ii++,startRow++) {
|
|
MeterInventoryVO1 obj = subList.get(ii);
|
|
MeterInventoryVO1 obj = subList.get(ii);
|
|
|
|
+ //循环一次 就是A到S的一列
|
|
for (int j = 0; j < 17; j++) {
|
|
for (int j = 0; j < 17; j++) {
|
|
- Cell cell = row.createCell(j);
|
|
|
|
|
|
+ String index=letters[j]+startRow;
|
|
|
|
+ Cell c = getCellByAddress(sheet,index);
|
|
String attributeValue = getAttributeValue(obj, j);
|
|
String attributeValue = getAttributeValue(obj, j);
|
|
if(StringUtil.isNotBlank(attributeValue)){
|
|
if(StringUtil.isNotBlank(attributeValue)){
|
|
- cell.setCellValue(attributeValue);
|
|
|
|
|
|
+ if (c != null) {
|
|
|
|
+ c.setCellValue(attributeValue);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ Cell a22=getCellByAddress(sheet,"A22");
|
|
|
|
+ a22.setCellValue("本页小计");
|
|
|
|
+ Cell g22 = getCellByAddress(sheet,"G22");
|
|
|
|
+ g22.setCellValue(CurrentMeterMoney.toString());
|
|
|
|
+ if(!ChangeMeterMoney.equals(BigDecimal.ZERO)){
|
|
|
|
+ Cell j22=getCellByAddress(sheet,"J22");
|
|
|
|
+ j22.setCellValue(ChangeMeterMoney.toString());
|
|
|
|
+ }
|
|
|
|
+ Cell l22=getCellByAddress(sheet,"L22");
|
|
|
|
+ l22.setCellValue(AfterCurrentMeterMoney.toString());
|
|
|
|
+ if(!BeforeEndMoney.equals(BigDecimal.ZERO)){
|
|
|
|
+ Cell n22=getCellByAddress(sheet,"N22");
|
|
|
|
+ n22.setCellValue(BeforeEndMoney.toString());
|
|
|
|
+ }
|
|
|
|
+ Cell q22=getCellByAddress(sheet,"Q22");
|
|
|
|
+ q22.setCellValue(NowMoney.toString());
|
|
|
|
+ Cell s22=getCellByAddress(sheet,"S22");
|
|
|
|
+ s22.setCellValue(NowEndMoney.toString());
|
|
|
|
+ Cell a23=getCellByAddress(sheet,"A23");
|
|
|
|
+ a23.setCellValue("从首页至本页合计");
|
|
|
|
+ Cell g23 = getCellByAddress(sheet,"G23");
|
|
|
|
+ g23.setCellValue(totalCurrentMeterMoney.toString());
|
|
|
|
+ if(!totalChangeMeterMoney.equals(BigDecimal.ZERO)){
|
|
|
|
+ Cell j23=getCellByAddress(sheet,"J23");
|
|
|
|
+ j23.setCellValue(totalChangeMeterMoney.toString());
|
|
|
|
+ }
|
|
|
|
+ Cell l23=getCellByAddress(sheet,"L23");
|
|
|
|
+ l23.setCellValue(totalAfterCurrentMeterMoney.toString());
|
|
|
|
+ if(!totalBeforeEndMoney.equals(BigDecimal.ZERO)){
|
|
|
|
+ Cell n23=getCellByAddress(sheet,"N23");
|
|
|
|
+ n23.setCellValue(totalBeforeEndMoney.toString());
|
|
|
|
+ }
|
|
|
|
+ Cell q23=getCellByAddress(sheet,"Q23");
|
|
|
|
+ q23.setCellValue(totalNowMoney.toString());
|
|
|
|
+ Cell s23=getCellByAddress(sheet,"S23");
|
|
|
|
+ s23.setCellValue(totalNowEndMoney.toString());
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
|
|
String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
|
|
outputStream = new FileOutputStream(locationFile);
|
|
outputStream = new FileOutputStream(locationFile);
|
|
@@ -3150,16 +3483,18 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
|
|
NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
|
|
- ReportResult reportResult = new ReportResult();
|
|
|
|
- CompletableFuture<String> stringCompletableFuture = new CompletableFuture<>();
|
|
|
|
- stringCompletableFuture.complete(bladeFile.getLink());
|
|
|
|
- reportResult.setPdfOssPath(stringCompletableFuture);
|
|
|
|
- return reportResult;
|
|
|
|
|
|
+ listUrl.add(bladeFile.getPdfUrl());
|
|
}
|
|
}
|
|
|
|
+ bladeRedis.set("redisId"+redisId+"periodId:"+periodId+"formNum:"+listEntry.getKey()+"nowMoney",totalNowMoney);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ CollectionUtils.mergePdfPublicMethods(listUrl, localImgUrl);
|
|
|
|
+ //上传oss
|
|
|
|
+ BladeFile bladeFile = newIOSSClient.uploadFile(suffix,localImgUrl);
|
|
|
|
+ reportResult.setOssPdfUrl(bladeFile.getLink());
|
|
|
|
+ reportResult.setPdfPath(bladeFile.getLink());
|
|
|
|
+ reportResult.setName("清单支付报表");
|
|
}
|
|
}
|
|
- return null;
|
|
|
|
|
|
+ return reportResult;
|
|
}
|
|
}
|
|
private static String getAttributeValue(MeterInventoryVO1 obj, int index) {
|
|
private static String getAttributeValue(MeterInventoryVO1 obj, int index) {
|
|
switch (index) {
|
|
switch (index) {
|
|
@@ -3170,33 +3505,62 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
case 2:
|
|
case 2:
|
|
return obj.getUnit();
|
|
return obj.getUnit();
|
|
case 3:
|
|
case 3:
|
|
- return obj.getCurrentMeterTotal().toString();
|
|
|
|
|
|
+ return obj.getCurrentMeterTotal()!=null?obj.getCurrentMeterTotal().toString():"";
|
|
case 4:
|
|
case 4:
|
|
- return obj.getCurrentMeterPrice().toString();
|
|
|
|
|
|
+ return obj.getCurrentMeterPrice()!=null?obj.getCurrentMeterPrice().toString():"";
|
|
case 5:
|
|
case 5:
|
|
- return obj.getCurrentMeterMoney().toString();
|
|
|
|
|
|
+ return obj.getCurrentMeterMoney()!=null?obj.getCurrentMeterMoney().toString():"";
|
|
case 6:
|
|
case 6:
|
|
- return obj.getChangeTotal().toString();
|
|
|
|
|
|
+ return obj.getChangeTotal()!=null?obj.getChangeTotal().toString():"";
|
|
case 7:
|
|
case 7:
|
|
- return obj.getChangeMeterPrice().toString();
|
|
|
|
|
|
+ return obj.getChangeMeterPrice()!=null?obj.getChangeMeterPrice().toString():"";
|
|
case 8:
|
|
case 8:
|
|
- return obj.getChangeMeterMoney().toString();
|
|
|
|
|
|
+ return obj.getChangeMeterMoney()!=null?obj.getChangeMeterMoney().toString():"";
|
|
case 9:
|
|
case 9:
|
|
- return obj.getAfterCurrentTotal().toString();
|
|
|
|
|
|
+ return obj.getAfterCurrentTotal()!=null?obj.getAfterCurrentTotal().toString():"";
|
|
case 10:
|
|
case 10:
|
|
- return obj.getAfterCurrentMeterMoney().toString();
|
|
|
|
|
|
+ return obj.getAfterCurrentMeterMoney()!=null?obj.getAfterCurrentMeterMoney().toString():"";
|
|
case 11:
|
|
case 11:
|
|
- return obj.getBeforeEndTotal().toString();
|
|
|
|
|
|
+ return obj.getBeforeEndTotal()!=null?obj.getBeforeEndTotal().toString():"";
|
|
case 12:
|
|
case 12:
|
|
- return obj.getBeforeEndMoney().toString();
|
|
|
|
|
|
+ return obj.getBeforeEndMoney()!=null?obj.getBeforeEndMoney().toString():"";
|
|
case 13:
|
|
case 13:
|
|
- return obj.getNowTotal().toString();
|
|
|
|
|
|
+ return obj.getNowTotal()!=null?obj.getNowTotal().toString():"";
|
|
case 14:
|
|
case 14:
|
|
- return obj.getNowMoney().toString();
|
|
|
|
|
|
+ return obj.getNowMoney()!=null?obj.getNowMoney().toString():"";
|
|
case 15:
|
|
case 15:
|
|
- return obj.getNowEndTotal().toString();
|
|
|
|
|
|
+ return obj.getNowEndTotal()!=null?obj.getNowEndTotal().toString():"";
|
|
case 16:
|
|
case 16:
|
|
- return obj.getNowEndMoney().toString();
|
|
|
|
|
|
+ return obj.getNowEndMoney()!=null?obj.getNowEndMoney().toString():"";
|
|
|
|
+ default:
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static String getAttributeValue1(MonthlyReportVo obj, int index) {
|
|
|
|
+ switch (index) {
|
|
|
|
+ case 0:
|
|
|
|
+ return obj.getFormNumber();
|
|
|
|
+ case 1:
|
|
|
|
+ return obj.getFormName();
|
|
|
|
+ case 2:
|
|
|
|
+ return obj.getCurrentMeterMoney()!=null?obj.getCurrentMeterMoney().toString():"";
|
|
|
|
+ case 3:
|
|
|
|
+ return obj.getChangeMeterMoney()!=null?obj.getChangeMeterMoney().toString():"";
|
|
|
|
+ case 4:
|
|
|
|
+ return obj.getAfterCurrentMeterMoney()!=null?obj.getAfterCurrentMeterMoney().toString():"";
|
|
|
|
+ case 5:
|
|
|
|
+ return obj.getBeforeEndMoney()!=null?obj.getBeforeEndMoney().toString():"";
|
|
|
|
+ case 6:
|
|
|
|
+ return obj.getBeforeEndC()!=null?obj.getBeforeEndC().toString():"";
|
|
|
|
+ case 7:
|
|
|
|
+ return obj.getNowMoney()!=null?obj.getNowMoney().toString():"";
|
|
|
|
+ case 8:
|
|
|
|
+ return obj.getNowC()!=null?obj.getNowC().toString():"";
|
|
|
|
+ case 9:
|
|
|
|
+ return obj.getNowEndMoney()!=null?obj.getNowEndMoney().toString():"";
|
|
|
|
+ case 10:
|
|
|
|
+ return obj.getNowEndC()!=null?obj.getNowEndC().toString():"";
|
|
default:
|
|
default:
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|