diff --git a/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundArrivedOut.java b/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundArrivedOut.java index 7b2042b8916e809a7ba5830db8e590f813424156..2af1922b4032009757b80bc15d8d2f4406331e6b 100644 --- a/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundArrivedOut.java +++ b/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundArrivedOut.java @@ -1,5 +1,6 @@ package com.seasky.budgetmiddleoffice.dto.fund; +import com.fasterxml.jackson.annotation.JsonInclude; import com.seasky.core.ddd.base.objects.middlegound.BaseMiddleGroundDto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -23,6 +24,7 @@ import java.util.List; @Data @ApiModel(value = "缁忚垂鍒拌处绫籵ut") @EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.ALWAYS) public class FundArrivedOut extends BaseMiddleGroundDto { @ApiModelProperty("fundId") @@ -43,6 +45,9 @@ public class FundArrivedOut extends BaseMiddleGroundDto { @ApiModelProperty("棰勭畻鎬婚噾棰�") private BigDecimal budgetTotalMoney; + @ApiModelProperty("棰勭畻鍖归厤閲戦") + private BigDecimal budgetMatchingMoney; + @ApiModelProperty("鍒拌处鎬婚噾棰�") private BigDecimal arriveTotalMoney; @@ -52,7 +57,17 @@ public class FundArrivedOut extends BaseMiddleGroundDto { @ApiModelProperty("鍘嗗彶璁板綍out") private List<FundArrivedHistoryOut> fundArrivedHistoryOutList = new ArrayList<>(); - public FundArrivedOut(Long fundId,Integer year,String fundCode,Long instanceId,String fundName,String fundSource,BigDecimal budgetTotalMoney,List<FundArrivedHistoryOut> fundArrivedHistoryOutList){ + public FundArrivedOut(Long fundId, + Integer year, + String fundCode, + Long instanceId, + String fundName, + String fundSource, + BigDecimal budgetTotalMoney, + BigDecimal budgetMatchingMoney, + BigDecimal arriveTotalMoney, + BigDecimal currentAmountApproved, + List<FundArrivedHistoryOut> fundArrivedHistoryOutList){ this.fundId = fundId; this.year = year; this.fundCode = fundCode; @@ -60,6 +75,9 @@ public class FundArrivedOut extends BaseMiddleGroundDto { this.fundName = fundName; this.fundSource = fundSource; this.budgetTotalMoney = budgetTotalMoney; + this.budgetMatchingMoney = budgetMatchingMoney; + this.arriveTotalMoney = arriveTotalMoney; + this.currentAmountApproved = currentAmountApproved; this.fundArrivedHistoryOutList = fundArrivedHistoryOutList; } } diff --git a/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundCodeAndNameOut.java b/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundCodeAndNameOut.java new file mode 100644 index 0000000000000000000000000000000000000000..cb05e352de11f8889180d113e7ebc34cade3bb1b --- /dev/null +++ b/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundCodeAndNameOut.java @@ -0,0 +1,10 @@ +package com.seasky.budgetmiddleoffice.dto.fund; + +/** + * Description锛� + * + * @author 灏忓懆(喔� 鈥� 虁 _ 鈥� 虂)喔� + * @since 2023/3/27 17:29 + */ +public class FundCodeAndNameOut { +} diff --git a/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundQuery.java b/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundQuery.java index c161d656bb797e286d3355d7cad3fe65ad822e8b..00266d3926ead4038df8b141258299537132aa14 100644 --- a/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundQuery.java +++ b/ServiceSite/facade/src/main/java/com/seasky/budgetmiddleoffice/dto/fund/FundQuery.java @@ -1,6 +1,5 @@ package com.seasky.budgetmiddleoffice.dto.fund; -import com.seasky.budgetmiddleoffice.dto.tests.TestQuery; import com.seasky.core.ddd.base.objects.middlegound.BaseMiddleGroundDto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/ServiceSite/pom.xml b/ServiceSite/pom.xml index 29ce1261d8b9bc323727c47a7782b5ac63113699..d7123f2586a250baae88d375ca5a604916f59bef 100644 --- a/ServiceSite/pom.xml +++ b/ServiceSite/pom.xml @@ -41,6 +41,11 @@ <artifactId>budgetmiddleoffice-api</artifactId> <version>4.0.0.0</version> </dependency> + <!--project-plan--> + <dependency> + <groupId>com.seasky</groupId> + <artifactId>projectplan-api</artifactId> + </dependency> <!-- 娴佺▼涓績 --> <dependency> <groupId>com.seasky</groupId> diff --git a/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/domain/aggregate/fund/FundArrivedAgg.java b/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/domain/aggregate/fund/FundArrivedAgg.java index 21db5a7b7fa11e5683937f198e67dafb213f38d6..efc4bcec425314adc0870046df08572cca0dba4e 100644 --- a/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/domain/aggregate/fund/FundArrivedAgg.java +++ b/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/domain/aggregate/fund/FundArrivedAgg.java @@ -31,6 +31,8 @@ public class FundArrivedAgg extends BaseMiddleGroundAggregate { private String fundSource; /** 棰勭畻鎬婚噾棰� **/ private BigDecimal budgetTotalMoney; + /** 棰勭畻鍖归厤閲戦 **/ + private BigDecimal budgetMatchingMoney; /** 鍒拌处鎬婚噾棰� **/ private BigDecimal arriveTotalMoney; /** 宸叉嫧閲戦 **/ @@ -38,6 +40,30 @@ public class FundArrivedAgg extends BaseMiddleGroundAggregate { /** 缁忚垂鍒拌处鍘嗗彶璁板綍闆嗗悎 **/ private List<FundArrivedHistoryEntity> fundArrivedHistoryEntityList; + /** 鍏ㄥ弬杩斿洖Agg鏋勫缓 **/ + public FundArrivedAgg(Long id, + Integer year, + String fundCode, + Long instanceId, + String fundName, + String fundSource, + BigDecimal budgetTotalMoney, + BigDecimal budgetMatchingMoney, + BigDecimal arriveTotalMoney, + BigDecimal currentAmountApproved, + List<FundArrivedHistoryEntity> fundArrivedHistoryEntityList){ + this.fundId = id; + this.year = year; + this.fundCode = fundCode; + this.instanceId = instanceId; + this.fundName = fundName; + this.fundSource = fundSource; + this.budgetTotalMoney = budgetTotalMoney; + this.budgetMatchingMoney = budgetMatchingMoney; + this.arriveTotalMoney = arriveTotalMoney; + this.currentAmountApproved = currentAmountApproved; + this.fundArrivedHistoryEntityList = fundArrivedHistoryEntityList; + } /** 淇濆瓨淇敼cmd杞琣gg */ public FundArrivedAgg(Long id, diff --git a/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/infrastructure/repository/fund/FundArrivedConvert.java b/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/infrastructure/repository/fund/FundArrivedConvert.java index 7dbfc9fefa4f7b0ab239d9e66bcd2a9aabfe271d..f13f8319da424dbda735fd1ceea90d23f0626b41 100644 --- a/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/infrastructure/repository/fund/FundArrivedConvert.java +++ b/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/infrastructure/repository/fund/FundArrivedConvert.java @@ -7,6 +7,7 @@ import com.seasky.budgetmiddleoffice.dto.fund.FundArrivedOut; import com.seasky.budgetmiddleoffice.infrastructure.dataobject.po.FundArrivedHistoryPO; import com.seasky.budgetmiddleoffice.infrastructure.dataobject.po.FundArrivedPO; import com.seasky.core.util.StreamUtils; +import com.seasky.projectplan.dto.projectplan.ProjectPlanBookOut; import java.util.List; @@ -61,7 +62,7 @@ public class FundArrivedConvert { * @author 灏忓懆(喔� 鈥⑻€_鈥⑻�)喔� * @date 2023/3/15 16:16 */ - public static FundArrivedAgg buildFundArrivedAgg(FundArrivedPO fundArrivedPo, List<FundArrivedHistoryPO> fundArrivedHistoryPoList) { + public static FundArrivedAgg buildFundArrivedAgg(ProjectPlanBookOut projectPlanBookOut,FundArrivedPO fundArrivedPo, List<FundArrivedHistoryPO> fundArrivedHistoryPoList) { // 鍏堟瀯寤哄瓙琛ㄥ璞� List<FundArrivedHistoryEntity> fundArrivedHistoryEntities = StreamUtils.convertList(fundArrivedHistoryPoList, fundArrivedHistoryPO -> { FundArrivedHistoryEntity fundArrivedHistoryEntity = new FundArrivedHistoryEntity( @@ -80,6 +81,9 @@ public class FundArrivedConvert { fundArrivedPo.getFundName(), fundArrivedPo.getFundSource(), fundArrivedPo.getBudgetTotalMoney(), + projectPlanBookOut.getTotalMoney(), + fundArrivedPo.getArriveTotalMoney(), + fundArrivedPo.getCurrentAmountApproved(), fundArrivedHistoryEntities); } @@ -100,6 +104,9 @@ public class FundArrivedConvert { fundArrivedAgg.getFundName(), fundArrivedAgg.getFundSource(), fundArrivedAgg.getBudgetTotalMoney(), + fundArrivedAgg.getBudgetMatchingMoney(), + fundArrivedAgg.getArriveTotalMoney(), + fundArrivedAgg.getCurrentAmountApproved(), fundArrivedHistoryOutList ); return fundArrivedOut; diff --git a/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/infrastructure/repository/fund/FundArrivedRepositoryImpl.java b/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/infrastructure/repository/fund/FundArrivedRepositoryImpl.java index d40aa90cd37f9d3bf374808fe2ae2fee7b942c3a..6fae763be3c58d83ec1a247192a199c81e38846a 100644 --- a/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/infrastructure/repository/fund/FundArrivedRepositoryImpl.java +++ b/ServiceSite/src/main/java/com/seasky/budgetmiddleoffice/infrastructure/repository/fund/FundArrivedRepositoryImpl.java @@ -10,11 +10,14 @@ import com.seasky.budgetmiddleoffice.infrastructure.dataobject.po.FundArrivedPO; import com.seasky.budgetmiddleoffice.infrastructure.mapper.table.FundArrivedHistoryMapper; import com.seasky.budgetmiddleoffice.infrastructure.mapper.table.FundArrivedMapper; import com.seasky.core.util.ExceptionUtil; +import com.seasky.projectplan.api.IProjectPlan; +import com.seasky.projectplan.dto.projectplan.ProjectPlanBookOut; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.List; /** @@ -30,6 +33,8 @@ public class FundArrivedRepositoryImpl implements IFundArrivedRepository { private FundArrivedMapper fundArrivedMapper; @Resource private FundArrivedHistoryMapper fundArrivedHistoryMapper; + @Resource + private IProjectPlan iProjectPlan; /** * @description 淇濆瓨 @@ -88,8 +93,12 @@ public class FundArrivedRepositoryImpl implements IFundArrivedRepository { // 鏍规嵁id鏌ヨ涓昏〃鏁版嵁 FundArrivedPO fundArrivedPo = fundArrivedMapper.selectById(persistentId); ExceptionUtil.isNull(fundArrivedPo,"涓昏〃鏁版嵁宸茶鍒犻櫎"); + // 鑾峰彇棰勭畻鍖归厤閲戦 + ProjectPlanBookOut projectPlanBookOut = iProjectPlan.queryTotalMoneyByFundCode(fundArrivedPo.getFundCode()); // 鏌ヨ瀛愯〃鏁版嵁 List<FundArrivedHistoryPO> fundArrivedHistoryPoList = fundArrivedHistoryMapper.selectList(new LambdaQueryWrapper<FundArrivedHistoryPO>().eq(FundArrivedHistoryPO::getParentId, fundArrivedPo.getId())); - return FundArrivedConvert.buildFundArrivedAgg(fundArrivedPo,fundArrivedHistoryPoList); + BigDecimal arriveTotalMoney = fundArrivedHistoryPoList.stream().map(FundArrivedHistoryPO::getArriveMoney).reduce(BigDecimal.ZERO, BigDecimal::add); + fundArrivedPo.setArriveTotalMoney(arriveTotalMoney); + return FundArrivedConvert.buildFundArrivedAgg(projectPlanBookOut,fundArrivedPo,fundArrivedHistoryPoList); } }