From 8fc658179241a8f01d054f8659c98d160b2c4a9d Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Sat, 18 Nov 2023 10:51:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/ProjectRenewalFundManage.java | 8 +-- .../pmapi/sys/model/req/WarningListReq.java | 3 ++ .../impl/EarlyWarningRecordsServiceImpl.java | 1 + .../workbench/converter/WorkbenchConverter.java | 7 ++- .../pmapi/workbench/manage/WorkbenchManage.java | 58 +++++++++++++++++--- .../pmapi/workbench/model/vo/WorkbenchVO.java | 63 +++++++++++++++++++++- 6 files changed, 126 insertions(+), 14 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java index 313096f..dd1ce2c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java @@ -126,9 +126,8 @@ public class ProjectRenewalFundManage { query.eq(Project::getNewest, Boolean.TRUE); //自己单位 query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - //立项批复到初验 + //立项批复后 都可以 query.gt(Project::getStatus,ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); - query.le(Project::getStatus,ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); Page page = projectService.page(req.page(), query); if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); @@ -419,9 +418,10 @@ public class ProjectRenewalFundManage { int year = plan.getPaymentTime().getYear(); if(Objects.nonNull(year) && projectYear.equals(year)){ hasYearPlan = Boolean.TRUE; - //2 如果有 这一年的实际支付金额有没有填 + }else if(Objects.nonNull(year) && projectYear.compareTo(year) > 0){ + //2 如果有 这一年前的实际支付金额有没有填 VUtils.isTrue(Objects.isNull(plan.getActualPaymentAmount())) - .throwMessage("未填写当年度的实际支付金额,请去合同备案补充"); + .throwMessage("有漏填写此年度之前年度的实际支付金额,请去合同备案补充"); } } VUtils.isTrue(!hasYearPlan).throwMessage("未有所选年度的支付计划,无法提交"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java index 7613b7c..db6dbae 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java @@ -28,6 +28,9 @@ public class WarningListReq extends PagePo { @ApiModelProperty("申报单位") private String buildOrgName; + @ApiModelProperty("申报单位code") + private String buildOrgCode; + @ApiModelProperty("提醒开始时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java index 1c3ffb1..1a402eb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java @@ -44,6 +44,7 @@ public class EarlyWarningRecordsServiceImpl extends ServiceImpl { //2.项目统计数据 - res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year, user))); + res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage + .declaredProjectOrgStatistics(year, user),defaultDeclaredProjectManage.declaredProjectOrgStatistics(year - 1, user))); if (userInfoHelper.isSuperOrRegionAdmin(user.getUserId())) { - res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year, user))); + res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage + .declaredProjectRegionStatistics(year, user),defaultDeclaredProjectManage.declaredProjectRegionStatistics(year - 1, user))); } }, ForkJoinPool.commonPool()), CompletableFuture.runAsync(() -> { @@ -77,6 +82,45 @@ public class WorkbenchManage { noticeListReq.setPageNumber(1); noticeListReq.setPageSize(1000); res.setNoticeList(noticeManage.listToMapByManager(noticeListReq,user)); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> { + //4.预警记录 + List eaylies = Lists.newArrayList(); + WarningListReq req = new WarningListReq(); +// req.setBuildOrgCode(user.getEmpPosUnitCode()); + WorkbenchVO.EarlyWarning early1 = new WorkbenchVO.EarlyWarning(); + early1.setType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); + early1.setTypeName(WarningRuleTypeEnum.PROCESS_WARNING.getDesc()); + PageVo records1 = earlyWarningRecordsService + .records(WarningRuleTypeEnum.PROCESS_WARNING.getCode(), req); + early1.setTotal(records1.getTotal().intValue()); + early1.setRecords(Lists.newArrayList(records1.getRecords())); + eaylies.add(early1); + WorkbenchVO.EarlyWarning early2 = new WorkbenchVO.EarlyWarning(); + early2.setType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); + early1.setTypeName(WarningRuleTypeEnum.DECLARED_WARNING.getDesc()); + PageVo records2 = earlyWarningRecordsService + .records(WarningRuleTypeEnum.DECLARED_WARNING.getCode(), req); + early2.setRecords(Lists.newArrayList(records2.getRecords())); + early2.setTotal(records2.getTotal().intValue()); + eaylies.add(early2); + WorkbenchVO.EarlyWarning early3 = new WorkbenchVO.EarlyWarning(); + early3.setType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); + early3.setTypeName(WarningRuleTypeEnum.OPERATION_WARNING.getDesc()); + PageVo records3 = earlyWarningRecordsService + .records(WarningRuleTypeEnum.OPERATION_WARNING.getCode(), req); + early3.setRecords(Lists.newArrayList(records3.getRecords())); + early3.setTotal(records3.getTotal().intValue()); + eaylies.add(early3); + WorkbenchVO.EarlyWarning early4 = new WorkbenchVO.EarlyWarning(); + early4.setType(WarningRuleTypeEnum.RENEWAL_FUND.getCode()); + early4.setTypeName(WarningRuleTypeEnum.RENEWAL_FUND.getDesc()); + PageVo records4 = earlyWarningRecordsService + .records(WarningRuleTypeEnum.RENEWAL_FUND.getCode(), req); + early4.setRecords(Lists.newArrayList(records4.getRecords())); + early4.setTotal(records4.getTotal().intValue()); + eaylies.add(early4); + res.setEarlyWarning(eaylies); }, ForkJoinPool.commonPool()) ).join(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java index 997de62..d20c7a0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java @@ -2,14 +2,17 @@ package com.ningdatech.pmapi.workbench.model.vo; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; +import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO; import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.List; import java.util.Map; +import java.util.Objects; /** * @Classname WorkbenchVO @@ -35,6 +38,24 @@ public class WorkbenchVO implements Serializable { @ApiModelProperty("公告列表") public Map> noticeList; + @ApiModelProperty("预警记录") + public List earlyWarning; + + @Data + public static class EarlyWarning { + @ApiModelProperty("类型") + private Integer type; + + @ApiModelProperty("类型名称") + private String typeName; + + @ApiModelProperty("总数") + private Integer total; + + @ApiModelProperty("预警记录") + private List records; + } + @Data public static class DeclaredStatistics { @ApiModelProperty("总项目数") @@ -56,8 +77,46 @@ public class WorkbenchVO implements Serializable { private Integer archivedNum; @ApiModelProperty("申报总金额") - private BigDecimal declaredAmount; + private BigDecimal declaredAmount = BigDecimal.ZERO; @ApiModelProperty("立项总金额") - private BigDecimal approvalAmount; + private BigDecimal approvalAmount = BigDecimal.ZERO; + + + @ApiModelProperty("申报总金额-去年") + private BigDecimal declaredAmountLastYear = BigDecimal.ZERO; + @ApiModelProperty("立项总金额-去年") + private BigDecimal approvalAmountLastYear = BigDecimal.ZERO; + @ApiModelProperty("申报总金额-较去年 增长") + private BigDecimal declaredAmountGrowthRate; + @ApiModelProperty("立项总金额-较去年 增长") + private BigDecimal approvalAmountGrowthRate; + + public BigDecimal getDeclaredAmountGrowthRate(){ +// if((Objects.nonNull(declaredAmount)&&declaredAmount.compareTo(BigDecimal.ZERO) > 0) && (Objects.isNull(declaredAmountLastYear) || +// declaredAmountLastYear.compareTo(BigDecimal.ZERO) == 0)){ +// return BigDecimal.valueOf(100); +// } + + if(Objects.nonNull(declaredAmountLastYear) && declaredAmountLastYear.compareTo(BigDecimal.ZERO) > 0){ + return declaredAmount.subtract(declaredAmountLastYear).multiply(BigDecimal.valueOf(100)) + .divide(declaredAmountLastYear,BigDecimal.ROUND_CEILING) + .setScale(BigDecimal.ROUND_CEILING, RoundingMode.CEILING); + } + return BigDecimal.ZERO; + } + + public BigDecimal getDeclaredApprovalAmountGrowthRate(){ +// if((Objects.nonNull(approvalAmount)&&approvalAmount.compareTo(BigDecimal.ZERO) > 0) && (Objects.isNull(approvalAmountLastYear) || +// approvalAmountLastYear.compareTo(BigDecimal.ZERO) == 0)){ +// return BigDecimal.valueOf(100); +// } + + if(Objects.nonNull(declaredAmountLastYear) && approvalAmountLastYear.compareTo(BigDecimal.ZERO) > 0){ + return approvalAmount.subtract(approvalAmountLastYear).multiply(BigDecimal.valueOf(100)) + .divide(approvalAmountLastYear,BigDecimal.ROUND_CEILING) + .setScale(BigDecimal.ROUND_CEILING, RoundingMode.CEILING); + } + return BigDecimal.ZERO; + } } }