|
@@ -51,10 +51,7 @@ import org.springblade.manager.utils.FileUtils;
|
|
|
import org.springblade.manager.utils.PeriodContractUtil;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
import org.springblade.meter.entity.*;
|
|
|
-import org.springblade.meter.feign.CertificateItemClient;
|
|
|
-import org.springblade.meter.feign.CollectionUtilsClient;
|
|
|
-import org.springblade.meter.feign.IContractInventoryFormClient;
|
|
|
-import org.springblade.meter.feign.MiddleMeterApplyClient;
|
|
|
+import org.springblade.meter.feign.*;
|
|
|
import org.springblade.meter.vo.*;
|
|
|
import org.springblade.resource.feign.CommonFileClient;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
@@ -132,6 +129,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
private final CertificateItemClient certificateItemClient;
|
|
|
private final NewIOSSClient newIOSSClient;
|
|
|
private final CommonFileClient commonFileClient;
|
|
|
+ private final InterimPayCertificateItemClient interimPayCertificateItemClient;
|
|
|
@Lazy
|
|
|
@Autowired
|
|
|
private final MiddleMeterApplyClient middleMeterApplyClient;
|
|
@@ -2353,7 +2351,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
//获取中间支付审核表的pdfurl
|
|
|
ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1,contractId,periodId,list,redisId,htmlUrl1,blReserveFundsRatioNew,projectName,changeMoneyNew);
|
|
|
//获取补助款申请支付审核表pdfUrl
|
|
|
- ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list,htmlUrl2,blReserveFundsRatioNew,projectName);
|
|
|
+ ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2,contractId,periodId,list,htmlUrl2,blReserveFundsRatioNew,projectName,projectId,reportId);
|
|
|
//获取中间计量支付证书pdfUrl
|
|
|
ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3,contractId,periodId,list,htmlUrl3,blReserveFundsRatioNew,projectName);
|
|
|
//获取清单支付报表PDF
|
|
@@ -2593,7 +2591,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/**
|
|
|
*补助款申请支付审核表获取PDFurl
|
|
|
*/
|
|
|
- private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl,BigDecimal blReserveFundsRatioNew,String projectName) {
|
|
|
+ private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list,String htmlUrl,BigDecimal blReserveFundsRatioNew,String projectName,Long projectId,Long reportId) {
|
|
|
//判断当前是否是只有1期计量
|
|
|
Boolean isOnePeriod = false;
|
|
|
ContractMeterPeriod contractMeterPeriod = list.get(0);
|
|
@@ -2618,7 +2616,6 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
modInput = CommonUtil.getOSSInputStream(url2);
|
|
|
workbook = WorkbookFactory.create(modInput);
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
-
|
|
|
//***************************************************************建安费*************************************************************************
|
|
|
Cell a6 = getCellByAddress(sheet, "A6");
|
|
|
a6.setCellValue("建安费");
|
|
@@ -2678,15 +2675,53 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
//***************************************************************其他费用*************************************************************************
|
|
|
Cell a7 = getCellByAddress(sheet, "A7");
|
|
|
a7.setCellValue("其他费用");
|
|
|
+ //上期末累计支付(其他费用)
|
|
|
+ BigDecimal beforeEndMoney=new BigDecimal("0");
|
|
|
+ //本期累计支付(其他费用)
|
|
|
+ BigDecimal nowMoney=new BigDecimal("0");
|
|
|
+ //本期末累计支付(其他费用)
|
|
|
+ BigDecimal endMoney=new BigDecimal("0");
|
|
|
+ if(list.size()>0){
|
|
|
+ OptionalInt index=IntStream.range(0, list.size())
|
|
|
+ .filter(i -> list.get(i).getId().equals(periodId))
|
|
|
+ .findFirst();
|
|
|
+ //j大于0 说明需要计算之前的值
|
|
|
+ if(index.isPresent()){
|
|
|
+ int j = index.getAsInt();
|
|
|
+ if(j>0){
|
|
|
+ String reportIdSql="Select id from s_interim_pay_certificate where contract_period_id="+list.get(j-1).getId()+" and is_deleted=0";
|
|
|
+ Long cerid = jdbcTemplate.queryForObject(reportIdSql, Long.class);
|
|
|
+ Object o = bladeRedis.get("repordId" + cerid + "elseEndMoney");
|
|
|
+ if(o!=null){
|
|
|
+ beforeEndMoney =(BigDecimal) o;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String sql3="Select * From s_interim_pay_certificate_item where certificate_id="+reportId+" and chapter_seq='其他费用'"+" and is_deleted=0";
|
|
|
+ List<InterimPayCertificateItem> query3 = jdbcTemplate.query(sql3, new BeanPropertyRowMapper<>(InterimPayCertificateItem.class));
|
|
|
+ if(!query3.isEmpty()){
|
|
|
+ InterimPayCertificateItem item = query3.get(0);
|
|
|
+ if(ObjectUtil.isNotEmpty(item.getCurrentPeriodPay())){
|
|
|
+ nowMoney=nowMoney.add(new BigDecimal(item.getCurrentPeriodPay()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ endMoney=beforeEndMoney.add(nowMoney);
|
|
|
+ bladeRedis.set("repordId"+reportId+"elseEndMoney",endMoney);
|
|
|
+
|
|
|
//------------------------------------------------------------项目总投资------------------------------------------------------------
|
|
|
Cell b7 = getCellByAddress(sheet, "B7");
|
|
|
- b7.setCellValue("");
|
|
|
+ if(projectId.equals(1701065246615506946L)&&contractId.equals(1701169960321519618L)){
|
|
|
+ b7.setCellValue("1129800");
|
|
|
+ }else {
|
|
|
+ b7.setCellValue("");
|
|
|
+ }
|
|
|
//------------------------------------------------------------上期末累计计量金额------------------------------------------------------------
|
|
|
Cell d7 = getCellByAddress(sheet, "D7");
|
|
|
d7.setCellValue("0");
|
|
|
//------------------------------------------------------------上期末累计支付金额------------------------------------------------------------
|
|
|
Cell e7 = getCellByAddress(sheet, "E7");
|
|
|
- e7.setCellValue("0");
|
|
|
+ e7.setCellValue(beforeEndMoney.toString());
|
|
|
//------------------------------------------------------------本期计量金额------------------------------------------------------------
|
|
|
Cell g7 = getCellByAddress(sheet, "G7");
|
|
|
g7.setCellValue("0");
|
|
@@ -2696,24 +2731,27 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
h7.setCellValue("0");
|
|
|
//------------------------------------------------------------本期支付金额------------------------------------------------------------
|
|
|
Cell i7 = getCellByAddress(sheet, "I7");
|
|
|
- i7.setCellValue("0");
|
|
|
+ i7.setCellValue(nowMoney.toString());
|
|
|
//------------------------------------------------------------本期末累计支付金额------------------------------------------------------------
|
|
|
Cell k7 = getCellByAddress(sheet, "K7");
|
|
|
- k7.setCellValue("0");
|
|
|
+ k7.setCellValue(endMoney.toString());
|
|
|
//------------------------------------------------------------支付比例------------------------------------------------------------
|
|
|
Cell m7 = getCellByAddress(sheet, "M7");
|
|
|
|
|
|
-
|
|
|
//***************************************************************合计*************************************************************************
|
|
|
//------------------------------------------------------------项目总投资------------------------------------------------------------
|
|
|
Cell b8 = getCellByAddress(sheet, "B8");
|
|
|
- b8.setCellValue(totalMoney.toString());
|
|
|
+ if(projectId.equals(1701065246615506946L)&&contractId.equals(1701169960321519618L)){
|
|
|
+ b8.setCellValue(totalMoney.add(new BigDecimal("1129800")).toString());
|
|
|
+ }else {
|
|
|
+ b8.setCellValue(totalMoney.toString());
|
|
|
+ }
|
|
|
//------------------------------------------------------------上期末累计计量金额------------------------------------------------------------
|
|
|
Cell d8 = getCellByAddress(sheet, "D8");
|
|
|
d8.setCellValue(allMoney.toString());
|
|
|
//------------------------------------------------------------上期末累计支付金额------------------------------------------------------------
|
|
|
Cell e8 = getCellByAddress(sheet, "E8");
|
|
|
- e8.setCellValue(lastEndPay.toString());
|
|
|
+ e8.setCellValue(lastEndPay.add(beforeEndMoney).toString());
|
|
|
//------------------------------------------------------------本期计量金额------------------------------------------------------------
|
|
|
Cell g8 = getCellByAddress(sheet, "G8");
|
|
|
g8.setCellValue(AllcurrentMeterTotal.toString());
|
|
@@ -2723,10 +2761,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
h8.setCellValue(allMoneyNow.toString());
|
|
|
//------------------------------------------------------------本期支付金额------------------------------------------------------------
|
|
|
Cell i8 = getCellByAddress(sheet, "I8");
|
|
|
- i8.setCellValue(currentPay.toString());
|
|
|
+ i8.setCellValue(currentPay.add(nowMoney).toString());
|
|
|
//------------------------------------------------------------本期末累计支付金额------------------------------------------------------------
|
|
|
Cell k8 = getCellByAddress(sheet, "K8");
|
|
|
- k8.setCellValue(endPay.toString());
|
|
|
+ k8.setCellValue(endPay.add(endMoney).toString());
|
|
|
//------------------------------------------------------------支付比例------------------------------------------------------------
|
|
|
Cell m8 = getCellByAddress(sheet, "M8");
|
|
|
|
|
@@ -2841,32 +2879,47 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
a5.setCellValue(totalMoney.toString());
|
|
|
//------------------------------------------------------------上期末累计变更------------------------------------------------------------
|
|
|
BigDecimal lastEndChangeMoney = new BigDecimal(0);
|
|
|
-
|
|
|
if (isOnePeriod){
|
|
|
lastEndChangeMoney = lastEndChangeMoney;
|
|
|
}else {
|
|
|
- //根据开始时间获取当前计量期之前的所有计量期
|
|
|
- List<ContractMeterPeriod> listFlitered = list.stream().filter(item -> item.getStartDate().isBefore(startDate)).collect(Collectors.toList());
|
|
|
- for (ContractMeterPeriod contractMeterPeriod : listFlitered) {
|
|
|
- //本期变更
|
|
|
- BigDecimal changeMoneyNow = new BigDecimal(0);
|
|
|
- String sql2 = "SELECT change_money, change_approval_date FROM `s_change_token_form` WHERE contract_id = '"+contractId +"' and approve_status = 2 and command_status = 1 and is_deleted = 0 ";
|
|
|
- List<ChangeToken> changeTokens = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(ChangeToken.class));
|
|
|
- List<ChangeToken> collect = changeTokens.stream()
|
|
|
- .filter(c -> c.getChangeApprovalDate().isAfter(contractMeterPeriod.getStartDate()) && c.getChangeApprovalDate().isBefore(contractMeterPeriod.getEndDate()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if(ObjectUtil.isNotEmpty(collect)){
|
|
|
- for (ChangeToken changeToken : collect) {
|
|
|
- changeMoneyNow = changeMoneyNow.add(changeToken.getChangeMoney());
|
|
|
+ if(list.size()>0){
|
|
|
+ OptionalInt index=IntStream.range(0, list.size())
|
|
|
+ .filter(i -> list.get(i).getId().equals(periodId))
|
|
|
+ .findFirst();
|
|
|
+ //j大于0 说明需要计算之前的值
|
|
|
+ //到上期末完成金额 从redis里面取
|
|
|
+ BigDecimal beforeEndMoney=BigDecimal.ZERO;
|
|
|
+ if(index.isPresent()){
|
|
|
+ int j = index.getAsInt();
|
|
|
+ if(j>0){
|
|
|
+ Object o = bladeRedis.get("periodId" + list.get(j - 1).getId() + "lastEndChangeMoneySum");
|
|
|
+ if(o!=null){
|
|
|
+ lastEndChangeMoney=(BigDecimal) o;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- changeMoneyNow = changeMoneyNow.setScale(0, RoundingMode.HALF_UP);
|
|
|
- lastEndChangeMoney = lastEndChangeMoney.add(changeMoneyNow);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- /*Cell c5 = getCellByAddress(sheet, "C5");
|
|
|
- c5.setCellValue(lastEndChangeMoney.toString());*/
|
|
|
+ //List<ContractMeterPeriod> listFlitered = list.stream().filter(item -> item.getStartDate().isBefore(startDate)).collect(Collectors.toList());
|
|
|
+// for (ContractMeterPeriod contractMeterPeriod : listFlitered) {
|
|
|
+// //本期变更
|
|
|
+// BigDecimal changeMoneyNow = new BigDecimal(0);
|
|
|
+// String sql2 = "SELECT change_money, change_approval_date FROM `s_change_token_form` WHERE contract_id = '"+contractId +"' and approve_status = 2 and command_status = 1 and is_deleted = 0 ";
|
|
|
+// List<ChangeToken> changeTokens = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(ChangeToken.class));
|
|
|
+// List<ChangeToken> collect = changeTokens.stream()
|
|
|
+// .filter(c -> c.getChangeApprovalDate().isAfter(contractMeterPeriod.getStartDate()) && c.getChangeApprovalDate().isBefore(contractMeterPeriod.getEndDate()))
|
|
|
+// .collect(Collectors.toList());
|
|
|
+// if(ObjectUtil.isNotEmpty(collect)){
|
|
|
+// for (ChangeToken changeToken : collect) {
|
|
|
+// changeMoneyNow = changeMoneyNow.add(changeToken.getChangeMoney());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// changeMoneyNow = changeMoneyNow.setScale(0, RoundingMode.HALF_UP);
|
|
|
+// lastEndChangeMoney = lastEndChangeMoney.add(changeMoneyNow);
|
|
|
+// }
|
|
|
+
|
|
|
+ }
|
|
|
+ Cell c5 = getCellByAddress(sheet, "C5");
|
|
|
+ c5.setCellValue(lastEndChangeMoney==null?"0":lastEndChangeMoney.toString());
|
|
|
//------------------------------------------------------------本期变更------------------------------------------------------------
|
|
|
//获取当前合同段的所有已审批并且已下达的变更令
|
|
|
/*String sql4 = "SELECT id,change_money,change_approval_date from s_change_token_form where contract_id = '"+contractId +"' and approve_status = 2 and command_status = 1 and is_deleted = 0";
|
|
@@ -2883,14 +2936,15 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
}
|
|
|
changeMoneySum = changeMoneySum.setScale(0, RoundingMode.HALF_UP);*/
|
|
|
- BigDecimal changemoneySum = changeMoneyNew.subtract(totalMoney).setScale(0, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal changemoneySum = changeMoneyNew.subtract(totalMoney).subtract(lastEndChangeMoney).setScale(0, RoundingMode.HALF_UP);
|
|
|
Cell e5 = getCellByAddress(sheet, "E5");
|
|
|
e5.setCellValue(changemoneySum.toString());
|
|
|
//------------------------------------------------------------本期末累计变更------------------------------------------------------------
|
|
|
//上期末累计变更+本期变更
|
|
|
- /*BigDecimal lastEndChangeMoneySum = lastEndChangeMoney.add(changeMoneySum);
|
|
|
+ BigDecimal lastEndChangeMoneySum = lastEndChangeMoney.add(changemoneySum);
|
|
|
Cell g5 = getCellByAddress(sheet, "G5");
|
|
|
- g5.setCellValue(lastEndChangeMoneySum.toString());*/
|
|
|
+ g5.setCellValue(lastEndChangeMoneySum.toString());
|
|
|
+ bladeRedis.set("periodId"+periodId+"lastEndChangeMoneySum",lastEndChangeMoneySum);
|
|
|
//------------------------------------------------------------变更后合同价------------------------------------------------------------
|
|
|
Cell i5 = getCellByAddress(sheet, "I5");
|
|
|
i5.setCellValue(changeMoneyNew.toString());
|
|
@@ -3230,6 +3284,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
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()));
|
|
|
+ monthlyReport.setChapterSeq(vo.getChapterNumber());
|
|
|
String key=vo.getChapterNumber();
|
|
|
if(list.size()>0){
|
|
|
OptionalInt index=IntStream.range(0, list.size())
|
|
@@ -3295,6 +3350,40 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
bladeRedis.set("periodId:"+periodId+"formNumber:"+key+"nowEndMoney",monthlyReport.getNowEndMoney());
|
|
|
values.add(monthlyReport);
|
|
|
}
|
|
|
+ //处理跨期 到上期末完成金额和工程量
|
|
|
+ for (MonthlyReportVo vo1 : values) {
|
|
|
+ if(vo1.getBeforeEndMoney()==null){
|
|
|
+ if(list.size()>0){
|
|
|
+ OptionalInt index=IntStream.range(0, list.size())
|
|
|
+ .filter(i -> list.get(i).getId().equals(periodId))
|
|
|
+ .findFirst();
|
|
|
+ //i大于0 说明需要计算之前的值
|
|
|
+ if(index.isPresent()){
|
|
|
+ int j = index.getAsInt();
|
|
|
+ if(j>0){
|
|
|
+ List<ContractMeterPeriod> list2 = list.subList(0, j);
|
|
|
+ BigDecimal money=new BigDecimal("0");
|
|
|
+ for (ContractMeterPeriod period : list2) {
|
|
|
+ Object o = bladeRedis.get("periodId:"+period.getId()+"formNumber:"+vo1.getChapterSeq()+"nowMoney");
|
|
|
+ if(o!=null){
|
|
|
+ BigDecimal money1=(BigDecimal) o;
|
|
|
+ money= money.add(money1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo1.setBeforeEndMoney(money);
|
|
|
+ if(vo1.getNowMoney()!=null){
|
|
|
+ vo1.setNowEndMoney(money.add(vo1.getNowMoney()));
|
|
|
+ }else {
|
|
|
+ vo1.setNowEndMoney(money);
|
|
|
+ }
|
|
|
+ if(vo1.getNowEndMoney().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ bladeRedis.set("periodId:"+periodId+"formNumber:"+vo1.getChapterSeq()+"nowEndMoney",vo1.getNowEndMoney());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
MonthlyReportVo m1 = new MonthlyReportVo();
|
|
|
m1.setFormNumber("D");
|
|
|
m1.setFormName("暂定金");
|
|
@@ -3431,17 +3520,76 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
|
|
|
MonthlyReportVo m17 = new MonthlyReportVo();
|
|
|
m17.setFormName("其他扣款");
|
|
|
+ if(list.size()>0){
|
|
|
+ OptionalInt index=IntStream.range(0, list.size())
|
|
|
+ .filter(i -> list.get(i).getId().equals(periodId))
|
|
|
+ .findFirst();
|
|
|
+ //j大于0 说明需要计算之前的值
|
|
|
+ if(index.isPresent()){
|
|
|
+ int j = index.getAsInt();
|
|
|
+ if(j>0){
|
|
|
+ String reportIdSql="Select id from s_interim_pay_certificate where contract_period_id="+list.get(j-1).getId()+" and is_deleted=0";
|
|
|
+ Long cerid = jdbcTemplate.queryForObject(reportIdSql, Long.class);
|
|
|
+ String sql1="Select * From s_interim_pay_certificate_item where certificate_id="+cerid+" and chapter_seq='其他扣款'";
|
|
|
+ List<InterimPayCertificateItem> query = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(InterimPayCertificateItem.class));
|
|
|
+ if(!query.isEmpty()){
|
|
|
+ InterimPayCertificateItem item = query.get(0);
|
|
|
+ if(item.getCurrentPeriodEndPay()!=null){
|
|
|
+ m17.setBeforeEndMoney(new BigDecimal(item.getCurrentPeriodEndPay()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String sql2="Select * From s_interim_pay_certificate_item where certificate_id="+reportId+" and chapter_seq='其他扣款'"+" and is_deleted=0";
|
|
|
+ List<InterimPayCertificateItem> query = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(InterimPayCertificateItem.class));
|
|
|
+ if(!query.isEmpty()){
|
|
|
+ InterimPayCertificateItem item = query.get(0);
|
|
|
+ if(ObjectUtil.isNotEmpty(item.getCurrentPeriodPay())){
|
|
|
+ m17.setNowMoney(new BigDecimal(item.getCurrentPeriodPay()));
|
|
|
+ }
|
|
|
+ }
|
|
|
values.add(m17);
|
|
|
+ //支付项里面的其他费用;
|
|
|
+ MonthlyReportVo m = new MonthlyReportVo();
|
|
|
+ m.setFormName("其他费用");
|
|
|
+ if(list.size()>0){
|
|
|
+ OptionalInt index=IntStream.range(0, list.size())
|
|
|
+ .filter(i -> list.get(i).getId().equals(periodId))
|
|
|
+ .findFirst();
|
|
|
+ //j大于0 说明需要计算之前的值
|
|
|
+ if(index.isPresent()){
|
|
|
+ int j = index.getAsInt();
|
|
|
+ if(j>0){
|
|
|
+ //上一期的支付项其他费用
|
|
|
+ String reportIdSql="Select id from s_interim_pay_certificate where contract_period_id="+list.get(j-1).getId()+" and is_deleted=0"+" and is_deleted=0";
|
|
|
+ Long cerid = jdbcTemplate.queryForObject(reportIdSql, Long.class);
|
|
|
+ String sql1="Select * From s_interim_pay_certificate_item where certificate_id="+cerid+" and chapter_seq='其他费用'";
|
|
|
+ List<InterimPayCertificateItem> query1 = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(InterimPayCertificateItem.class));
|
|
|
+ if(!query1.isEmpty()){
|
|
|
+ InterimPayCertificateItem item = query1.get(0);
|
|
|
+ if(item.getCurrentPeriodEndPay()!=null){
|
|
|
+ m.setBeforeEndMoney(new BigDecimal(item.getCurrentPeriodEndPay()));
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String sql3="Select * From s_interim_pay_certificate_item where certificate_id="+reportId+" and chapter_seq='其他费用'"+" and is_deleted=0";
|
|
|
+ List<InterimPayCertificateItem> query3 = jdbcTemplate.query(sql3, new BeanPropertyRowMapper<>(InterimPayCertificateItem.class));
|
|
|
+ if(!query3.isEmpty()){
|
|
|
+ InterimPayCertificateItem item = query3.get(0);
|
|
|
+ if(ObjectUtil.isNotEmpty(item.getCurrentPeriodPay())){
|
|
|
+ m.setNowMoney(new BigDecimal(item.getCurrentPeriodPay()));
|
|
|
+ }
|
|
|
+ }
|
|
|
MonthlyReportVo m18 = new MonthlyReportVo();
|
|
|
m18.setFormName("扣款合计");
|
|
|
- if(ObjectUtil.isNotEmpty(m13.getBeforeEndMoney())){
|
|
|
- m18.setBeforeEndMoney(m13.getBeforeEndMoney());
|
|
|
- }
|
|
|
- m18.setNowMoney(m13.getNowMoney());
|
|
|
- m18.setNowEndMoney(m13.getNowEndMoney());
|
|
|
+ m18.setBeforeEndMoney(addWithNullCheck(m13.getBeforeEndMoney(),m17.getBeforeEndMoney()));
|
|
|
+ m18.setNowMoney(addWithNullCheck(m13.getNowMoney(),m17.getNowMoney()));
|
|
|
+ m18.setNowEndMoney(addWithNullCheck(m18.getBeforeEndMoney(),m18.getNowMoney()));
|
|
|
values.add(m18);
|
|
|
-
|
|
|
MonthlyReportVo m19 = new MonthlyReportVo();
|
|
|
m19.setFormName("实际支付");
|
|
|
if(ObjectUtil.isNotEmpty(m11.getBeforeEndMoney())&&ObjectUtil.isNotEmpty(m18.getBeforeEndMoney())){
|
|
@@ -3451,7 +3599,6 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
if(percentage4.compareTo(BigDecimal.ZERO)!=0){
|
|
|
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"));
|
|
@@ -3470,6 +3617,32 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
bladeRedis.set("periodId:"+periodId+"nowMoney",m19.getNowMoney());
|
|
|
values.add(m19);
|
|
|
setZeroBigDecimalFieldsToNullInList(values);
|
|
|
+ List<MonthlyReportVo>vos=new ArrayList<>(values);
|
|
|
+ int i = vos.indexOf(m17);
|
|
|
+ if(i!=-1){
|
|
|
+ vos.add(i+1,m);
|
|
|
+ }
|
|
|
+ String sql4="Select * From s_interim_pay_certificate_item where certificate_id="+reportId+" and is_deleted=0";
|
|
|
+ List<InterimPayCertificateItem> list4 = jdbcTemplate.query(sql4, new BeanPropertyRowMapper<>(InterimPayCertificateItem.class));
|
|
|
+ if(list4.isEmpty()){
|
|
|
+ //第一次需要新增支付项
|
|
|
+ interimPayCertificateItemClient.addInterimPayCertificateItem(reportId,vos);
|
|
|
+ }else {
|
|
|
+ //第二次后就是更新
|
|
|
+ for (InterimPayCertificateItem item : list4) {
|
|
|
+ for (MonthlyReportVo vo : vos) {
|
|
|
+ if(item.getChapterSeq().equals(vo.getFormName())){
|
|
|
+ item.setCurrentPeriodEndPay(vo.getNowEndMoney()==null?null:vo.getNowEndMoney().toString());
|
|
|
+ item.setCurrentPeriodPay(vo.getNowMoney()==null?null:vo.getNowMoney().toString());
|
|
|
+ item.setPreviousPeriodEndPay(vo.getBeforeEndMoney()==null?null:vo.getBeforeEndMoney().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ interimPayCertificateItemClient.updateInterimPayCertificateItem(list4);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
InputStream modInput = null;
|
|
|
FileInputStream excelFileInput = null;
|
|
|
FileOutputStream outputStream = null;
|
|
@@ -3550,7 +3723,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
reportResult.setName("工程支付月报");
|
|
|
return reportResult;
|
|
|
}
|
|
|
-
|
|
|
+ public static BigDecimal addWithNullCheck(BigDecimal b, BigDecimal c) {
|
|
|
+ // 使用 BigDecimal.ZERO 作为默认值
|
|
|
+ BigDecimal bValue = (b == null) ? BigDecimal.ZERO : b;
|
|
|
+ BigDecimal cValue = (c == null) ? BigDecimal.ZERO : c;
|
|
|
+ // 执行加法操作
|
|
|
+ return bValue.add(cValue);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 清单支付报表获取PDF
|
|
@@ -3653,7 +3832,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
vo.setNowTotal(detailVO.getAllMeterTotal());
|
|
|
//本期完成金额
|
|
|
vo.setNowMoney(detailVO.getAllMeterTotal().multiply(detailVO.getCurrentPrice()).setScale(0, RoundingMode.HALF_UP));
|
|
|
-
|
|
|
+ bladeRedis.set("periodId:"+periodId+"formNumber:"+vo.getFormNumber()+"nowTotal",vo.getNowTotal());
|
|
|
+ bladeRedis.set("periodId:"+periodId+"formNumber:"+vo.getFormNumber()+"nowMoney",vo.getNowMoney());
|
|
|
|
|
|
//大于0表示有上期的 需要添加上期末数据
|
|
|
if(changeFormDetailMap.size()>0){
|
|
@@ -3697,6 +3877,54 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
list1.add(vo);
|
|
|
}
|
|
|
list1=list1.stream().sorted(Comparator.comparing(MeterInventoryVO1::getSort)).collect(Collectors.toList());
|
|
|
+ //处理跨期 到上期末完成金额和工程量
|
|
|
+ for (MeterInventoryVO1 vo1 : list1) {
|
|
|
+ if(vo1.getBeforeEndMoney()==null){
|
|
|
+ if(vo1.getFormNumber().equals("419-1-a")){
|
|
|
+ System.out.println("111");
|
|
|
+ }
|
|
|
+ if(list.size()>0){
|
|
|
+ OptionalInt index=IntStream.range(0, list.size())
|
|
|
+ .filter(i -> list.get(i).getId().equals(periodId))
|
|
|
+ .findFirst();
|
|
|
+ //i大于0 说明需要计算之前的值
|
|
|
+ if(index.isPresent()){
|
|
|
+ int j = index.getAsInt();
|
|
|
+ if(j>0){
|
|
|
+ List<ContractMeterPeriod> list2 = list.subList(0, j);
|
|
|
+ BigDecimal total=new BigDecimal("0");
|
|
|
+ BigDecimal money=new BigDecimal("0");
|
|
|
+ for (ContractMeterPeriod period : list2) {
|
|
|
+ Object o = bladeRedis.get("periodId:" + period.getId() + "formNumber:" + vo1.getFormNumber() + "nowMoney");
|
|
|
+ Object o1 = bladeRedis.get("periodId:" + period.getId() + "formNumber:" + vo1.getFormNumber() + "nowTotal");
|
|
|
+ if(o!=null){
|
|
|
+ BigDecimal money1=(BigDecimal) o;
|
|
|
+ money= money.add(money1);
|
|
|
+ }
|
|
|
+ if(o1!=null){
|
|
|
+ BigDecimal total1=(BigDecimal) o1;
|
|
|
+ total= total.add(total1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo1.setBeforeEndMoney(money);
|
|
|
+ vo1.setBeforeEndTotal(total);
|
|
|
+ if(vo1.getNowMoney()!=null){
|
|
|
+ vo1.setNowEndMoney(money.add(vo1.getNowMoney()));
|
|
|
+ }
|
|
|
+ if(vo1.getNowTotal()!=null){
|
|
|
+ vo1.setNowEndTotal(total.add(vo1.getNowTotal()));
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotEmpty(vo1.getNowEndTotal())&&vo1.getNowEndTotal().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ bladeRedis.set("periodId:"+periodId+"formNumber:"+vo1.getFormNumber()+"detailsTotal",vo1.getNowEndTotal());
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotEmpty(vo1.getNowEndMoney())&&vo1.getNowEndMoney().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ bladeRedis.set("periodId:"+periodId+"formNumber:"+vo1.getFormNumber()+"detailsMoney",vo1.getNowEndMoney());}
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
setZeroBigDecimalFieldsToNullInList(list1);
|
|
|
ReportResult reportResult = new ReportResult();
|
|
|
String suffix=SnowFlakeUtil.getId()+".pdf";
|
|
@@ -3704,8 +3932,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
String localImgUrl=sysLocalFileUrl+suffix;
|
|
|
for (MeterInventoryVO1 vo1 : list1) {
|
|
|
for (ContractInventoryForm form : query) {
|
|
|
- if(vo1.getFormName().equals(form.getFormName())){
|
|
|
+ if(vo1.getFormNumber().equals(form.getFormNumber())){
|
|
|
vo1.setImportNumber(form.getChapterNumber()!=null?form.getChapterNumber():vo1.getFormNumber());
|
|
|
+ break;
|
|
|
+ }else {
|
|
|
+ if(vo1.getFormName().equals(form.getFormName())){
|
|
|
+ vo1.setImportNumber(form.getChapterNumber()!=null?form.getChapterNumber():vo1.getFormNumber());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|