Explorar o código

万盛中期计量

chenr hai 2 días
pai
achega
f1cd60b824

+ 1 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/FormulaClient.java

@@ -38,5 +38,5 @@ public interface FormulaClient {
 
     //万盛计量专用
     @PostMapping(API_PREFIX + "execute4")
-    List<ReportResult> formulaExecute4(@RequestParam Long contractId, @RequestParam Long periodId,@RequestParam Integer type,@RequestParam Long projectId);
+    List<ReportResult> formulaExecute4(@RequestParam Long reportId,@RequestParam Long contractId, @RequestParam Long periodId,@RequestParam Integer type,@RequestParam Long projectId) throws FileNotFoundException, IllegalAccessException;
 }

+ 22 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/feign/IContractInventoryFormClient.java

@@ -0,0 +1,22 @@
+package org.springblade.meter.feign;
+
+import org.springblade.common.constant.LauncherConstant;
+import org.springblade.meter.vo.InventoryFormDetailVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient(value = LauncherConstant.APPLICATION_METER_NAME)
+public interface IContractInventoryFormClient {
+      /**
+     * 接口前缀
+     */
+    String API_PREFIX = "/ContractInventoryForm";
+
+     /**
+     * 保存中期证书项目详情
+     */
+    @PostMapping(API_PREFIX + "/detail")
+    InventoryFormDetailVO detail(@RequestParam Long id);
+
+}

+ 46 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MonthlyReportVo.java

@@ -0,0 +1,46 @@
+package org.springblade.meter.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class MonthlyReportVo {
+
+    @ApiModelProperty(value = "清单编号")
+    private String formNumber;
+
+     @ApiModelProperty(value = "项目内容")
+    private String formName;
+
+     @ApiModelProperty(value = "原合同总金额")
+    private BigDecimal currentMeterMoney;
+
+     @ApiModelProperty(value = "工程变更总金额")
+    private BigDecimal changeMeterMoney;
+
+     @ApiModelProperty(value = "变更后合同总金额")
+    private BigDecimal afterCurrentMeterMoney;
+
+      @ApiModelProperty(value = "到上期末完成金额")
+    private BigDecimal beforeEndMoney;
+
+      @ApiModelProperty(value = "到上期末占C的%")
+    private BigDecimal beforeEndC;
+
+      @ApiModelProperty(value = "本期完成金额")
+    private BigDecimal nowMoney;
+
+      @ApiModelProperty(value = "本期占C的%")
+    private BigDecimal nowC;
+
+      @ApiModelProperty(value = "到本期末完成金额")
+     private BigDecimal nowEndMoney;
+
+       @ApiModelProperty(value = "到本期末完成占C的%")
+      private BigDecimal nowEndC;
+
+
+
+}

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/FormulaClientImpl.java

@@ -73,8 +73,8 @@ public class FormulaClientImpl implements FormulaClient {
     }
 
     @Override
-    public List<ReportResult> formulaExecute4(Long contractId, Long periodId, Integer type,Long projectId) {
-        return service.execute4(contractId,periodId,type,projectId);
+    public List<ReportResult> formulaExecute4(Long reportId,Long contractId, Long periodId, Integer type,Long projectId) throws FileNotFoundException, IllegalAccessException {
+        return service.execute4(reportId,contractId,periodId,type,projectId);
     }
 
 

+ 2 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IFormulaService.java

@@ -11,6 +11,7 @@ import org.springblade.manager.formula.impl.TableElementConverter;
 import org.springblade.manager.vo.ReportResult;
 
 import javax.validation.constraints.NotNull;
+import java.io.FileNotFoundException;
 import java.util.List;
 import java.util.Map;
 
@@ -100,5 +101,5 @@ public interface IFormulaService extends BaseService<Formula> {
     R<Object> syncWorkDate(@NotNull(message = "节点ID不能为空") Long nodeId);
 
     /** 万盛计量专用统计数据*/
-    List<ReportResult> execute4(Long contractId, Long periodId, Integer type,Long projectId);
+    List<ReportResult> execute4(Long reportId,Long contractId, Long periodId, Integer type,Long projectId) throws FileNotFoundException, IllegalAccessException;
 }

+ 460 - 96
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -30,6 +30,8 @@ import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.mp.base.BaseEntity;
 import org.springblade.core.mp.base.BaseServiceImpl;
 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.utils.*;
 import org.springblade.manager.bean.TableInfo;
@@ -48,7 +50,11 @@ import org.springblade.manager.utils.FileUtils;
 import org.springblade.manager.vo.*;
 import org.springblade.meter.entity.*;
 import org.springblade.meter.feign.CertificateItemClient;
+import org.springblade.meter.feign.IContractInventoryFormClient;
 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.MeterInventoryVO1;
 import org.springblade.resource.feign.CommonFileClient;
@@ -71,6 +77,7 @@ import java.io.*;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.LocalDate;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -133,6 +140,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         private IExcelTabService excelTabService;
         @Autowired
         private StringRedisTemplate redisTemplate;
+        @Autowired
+        private BladeRedis bladeRedis;
+        @Autowired
+        private IContractInventoryFormClient iContractInventoryFormClient;
 
     @Override
     public void execute(TableElementConverter tec) {
@@ -898,7 +909,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                             efm.setParamId(d.getId());
                             efm.setElementId(e.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.setElementId(e.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
-    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();
         //判断计算的是哪一期。
         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));
+
         ArrayList<ReportResult> reportResults = new ArrayList<>();
         //中期支付报表封面
         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 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
         ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url,contractId,periodId);
         //获取中间支付审核表的pdfurl
@@ -2183,24 +2201,20 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list);
         //获取中间计量支付证书pdfUrl
         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
-        //ReportResult intermediateApplyPDF=getIntermediateApplyPDF(url4);
-        //获取工程支付月报pdfUrl
-        //ReportResult monthlyReportPDF=getMonthlyReportPDF(url5);
+        ReportResult intermediateApplyPDF=getIntermediateApplyPDF(url4,redisId);
         //获取清单支付报表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(intermediatePaymentPDF);
         reportResults.add(subsidyApplicationPaymentReviewPDF);
         reportResults.add(intermediateMeasurementPaymentCertificatePDF);
+        reportResults.add(intermediateApplyPDF);
+        reportResults.add(monthlyReportPDF);
+        reportResults.add(inventoryPayReportPDF);
+
         //reportResults.add(inventoryPayReportPDF);
         return reportResults;
     }
@@ -2908,7 +2922,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
      * @param url
      * @return
      */
-    public ReportResult getIntermediateApplyPDF(String url){
+    public ReportResult getIntermediateApplyPDF(String url,Long redisId){
     InputStream modInput = null;
         FileInputStream excelFileInput = null;
         FileOutputStream outputStream = null;
@@ -2919,8 +2933,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             workbook = WorkbookFactory.create(modInput);
             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 = "C://upload1//";
             String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
@@ -2936,9 +2952,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         }
         NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
         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;
     }
 
@@ -2947,7 +2963,212 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
      * @param url
      * @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;
         FileInputStream excelFileInput = null;
         FileOutputStream outputStream = null;
@@ -2959,10 +3180,28 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             workbook = WorkbookFactory.create(modInput);
             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 = "C://upload1//";
             String locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
             outputStream = new FileOutputStream(locationFile);
             //生成一份新的excel
@@ -2974,12 +3213,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         } 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;
+          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
      * @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.setContractId(contractId);
         middleMeterApply.setContractPeriodId(periodId);
         middleMeterApply.setProjectId(projectId);
         //本期清单明细
         List<MeterInventoryDetailVO> formDetail=middleMeterApplyClient.formDetail(middleMeterApply);
-        //上期清单明细
-        List<MeterInventoryDetailVO> oldFormDetail=new ArrayList<>();
+          //上期清单明细 期数+对应的清单明细
+          Map<String,List<MeterInventoryDetailVO>>  oldFormDetailMap=new HashMap<>();
         if(list.size()>0){
           OptionalInt index=IntStream.range(0, list.size())
                 .filter(i -> list.get(i).getId().equals(periodId))
                 .findFirst();
-              //i大于0 说明需要计算上一期的
+              //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);
+                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<>();
@@ -3038,7 +3287,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                     //原合同单价
                     vo.setCurrentMeterPrice(form.getBidPrice());
                     //原合同金额
-                    vo.setCurrentMeterMoney(form.getContractMoney());
+                    vo.setCurrentMeterMoney(form.getContractMoney().setScale(0, RoundingMode.HALF_UP));
                     break;
                 }
             }
@@ -3048,19 +3297,19 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             //变更后工程量
             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());
             if(subtract==BigDecimal.ZERO){
                 subtract=null;
             }
-            vo.setChangeTotal(subtract);
+            vo.setChangeTotal(subtract!=null?subtract.setScale(0,RoundingMode.HALF_UP):subtract);
             //工程变更金额 变更后金额-原合同金额
             BigDecimal subtract1 = vo.getAfterCurrentMeterMoney().subtract(vo.getCurrentMeterMoney());
             if(subtract1==BigDecimal.ZERO){
                 subtract1=null;
             }
-            vo.setChangeMeterMoney(subtract1);
+            vo.setChangeMeterMoney(subtract1!=null?subtract1.setScale(0, RoundingMode.HALF_UP):subtract1);
             //工程变更单价
             if(vo.getChangeMeterMoney()==null&&vo.getChangeTotal()==null){
                 vo.setChangeMeterPrice(null);
@@ -3068,21 +3317,27 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                 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表示有上期的 需要添加上期末数据
-            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){
                 vo.setNowEndTotal(vo.getBeforeEndTotal().add(vo.getNowTotal()));
@@ -3091,17 +3346,21 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             }
             //到本期末完成金额
             if(vo.getBeforeEndMoney()!=null){
-                vo.setNowEndMoney(vo.getBeforeEndMoney().add(vo.getNowMoney()));
+                vo.setNowEndMoney((vo.getBeforeEndMoney().add(vo.getNowMoney())).setScale(0, RoundingMode.HALF_UP));
             }else {
-                vo.setNowEndMoney(vo.getNowMoney());
+                vo.setNowEndMoney(vo.getNowMoney().setScale(0, RoundingMode.HALF_UP));
             }
             list1.add(vo);
         }
+        ReportResult reportResult = new ReportResult();
+          String suffix=SnowFlakeUtil.getId()+".pdf";
+          String localImgUrl="D://web//pdf//"+suffix;
         if(list1.size()>0){
             //先根据根据前三个字符排序
              list1.sort(Comparator.comparingInt(MeterInventoryVO1::getFirstThreeCharsAsInt));
              //根据编号的第一个字符,分类
          Map<Character, List<MeterInventoryVO1>> groupedMeter = new HashMap<>();
+         List<String>listUrl=new ArrayList<>();
            for (MeterInventoryVO1 vo1 : list1) {
            char firstChar = vo1.getFormNumber().charAt(0);
            groupedMeter.computeIfAbsent(firstChar, k -> new ArrayList<>()).add(vo1);
@@ -3109,10 +3368,40 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
            //根据编号的不同建立不同的excel
             for (Map.Entry<Character, List<MeterInventoryVO1>> listEntry : groupedMeter.entrySet()) {
                 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);
+                      //原合同金额 本页
+                     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;
                       FileInputStream excelFileInput = null;
                       FileOutputStream outputStream = null;
@@ -3123,20 +3412,64 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                         workbook = WorkbookFactory.create(modInput);
                         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);
+                                //循环一次 就是A到S的一列
                                 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);
                                     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 locationFile = file_path + SnowFlakeUtil.getId() + ".xlsx";
                         outputStream = new FileOutputStream(locationFile);
@@ -3150,16 +3483,18 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                         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;
+                    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) {
          switch (index) {
@@ -3170,33 +3505,62 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
              case 2:
                  return obj.getUnit();
              case 3:
-                 return obj.getCurrentMeterTotal().toString();
+                 return obj.getCurrentMeterTotal()!=null?obj.getCurrentMeterTotal().toString():"";
              case 4:
-                 return obj.getCurrentMeterPrice().toString();
+                 return obj.getCurrentMeterPrice()!=null?obj.getCurrentMeterPrice().toString():"";
              case 5:
-                 return obj.getCurrentMeterMoney().toString();
+                 return obj.getCurrentMeterMoney()!=null?obj.getCurrentMeterMoney().toString():"";
              case 6:
-                 return obj.getChangeTotal().toString();
+                 return obj.getChangeTotal()!=null?obj.getChangeTotal().toString():"";
              case 7:
-                 return obj.getChangeMeterPrice().toString();
+                 return obj.getChangeMeterPrice()!=null?obj.getChangeMeterPrice().toString():"";
              case 8:
-                 return obj.getChangeMeterMoney().toString();
+                 return obj.getChangeMeterMoney()!=null?obj.getChangeMeterMoney().toString():"";
              case 9:
-                 return obj.getAfterCurrentTotal().toString();
+                 return obj.getAfterCurrentTotal()!=null?obj.getAfterCurrentTotal().toString():"";
              case 10:
-                 return obj.getAfterCurrentMeterMoney().toString();
+                 return obj.getAfterCurrentMeterMoney()!=null?obj.getAfterCurrentMeterMoney().toString():"";
              case 11:
-                 return obj.getBeforeEndTotal().toString();
+                 return obj.getBeforeEndTotal()!=null?obj.getBeforeEndTotal().toString():"";
              case 12:
-                 return obj.getBeforeEndMoney().toString();
+                 return obj.getBeforeEndMoney()!=null?obj.getBeforeEndMoney().toString():"";
              case 13:
-                 return obj.getNowTotal().toString();
+                 return obj.getNowTotal()!=null?obj.getNowTotal().toString():"";
              case 14:
-                 return obj.getNowMoney().toString();
+                 return obj.getNowMoney()!=null?obj.getNowMoney().toString():"";
              case 15:
-                 return obj.getNowEndTotal().toString();
+                 return obj.getNowEndTotal()!=null?obj.getNowEndTotal().toString():"";
              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:
                  return "";
          }

+ 5 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -3663,16 +3663,16 @@ public class TaskController extends BladeController {
     }
 
     /*中期支付证书报表、开工、材料手册报表*/
-    public R<String> generateReportsPdf(Report report, Integer taskType) {
+    public R<String> generateReportsPdf(Report report, Integer taskType) throws FileNotFoundException, IllegalAccessException {
         /*报表记录新增或者重算的时候会调用当前方法,生成PDF*/
         /*保存两类PDF,一每种表独立一份用于浏览,二合成表用于电签*/
         /*数据完全独立互不影响,可以并发生成,预估PDF的总大小来决定是否全部在内存中生成PDF*/
         /*分为新增和更新*/
         /*如果数据没有变化,则各表的PDF可以不用更新*/
         ExecutionTime executionTime = new ExecutionTime();
-        List<ReportResult> reportResults=new ArrayList<>();
-        if(ObjectUtil.isNotEmpty(report.getPeriodId())&&report.getProjectId().equals(1764484458576179201L)){
-             reportResults=formulaClient.formulaExecute4(report.getContractId(),report.getPeriodId(),report.getType(),report.getProjectId());
+        List<ReportResult> reportResults;
+        if(ObjectUtil.isNotEmpty(report.getProjectId())&&report.getProjectId().equals(1764484458576179201L)){
+             reportResults=formulaClient.formulaExecute4(report.getId(),report.getContractId(),report.getPeriodId(),report.getType(),report.getProjectId());
             /*合并所有表*/
             String file_path = CollectionUtils.getSysLocalFileUrl();
             Long dataId = SnowFlakeUtil.getId();
@@ -4288,6 +4288,7 @@ public class TaskController extends BladeController {
         report.setContractId(Long.parseLong(map.get("contract_id").toString()));
         report.setPeriodId(Long.parseLong(map.get("period_id").toString()));
         report.setProjectId(Long.parseLong(map.get("project_id").toString()));
+
         return report;
     }
 

+ 16 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/feign/IContractInventoryFormClientImpl.java

@@ -0,0 +1,16 @@
+package org.springblade.meter.feign;
+
+import lombok.AllArgsConstructor;
+import org.springblade.meter.service.IContractInventoryFormService;
+import org.springblade.meter.vo.InventoryFormDetailVO;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@AllArgsConstructor
+public class IContractInventoryFormClientImpl implements IContractInventoryFormClient{
+    private final IContractInventoryFormService iContractInventoryFormService;
+    @Override
+    public InventoryFormDetailVO detail(Long id) {
+        return iContractInventoryFormService.detail(id);
+    }
+}