From 09b56b653a7a4b08eb3910a9871b39f9cb5e070d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Wed, 2 Aug 2023 17:05:43 +0800 Subject: [PATCH] queryYearBO --- .../dashboard/manage/DashboardProjectManage.java | 41 ++++++++++++++++++++++ .../dashboard/model/basic/QueryTimeYearBO.java | 21 +++++++++++ .../model/vo/DashboardProjectSummaryVO.java | 13 +++++++ 3 files changed, 75 insertions(+) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/QueryTimeYearBO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java index ab4ccad..7eb05db 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.dashboard.manage; +import com.ningdatech.pmapi.dashboard.model.basic.QueryTimeYearBO; import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO; import com.ningdatech.pmapi.dashboard.model.vo.DashboardInvestmentSummaryVO; import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectCntSummaryVO; @@ -7,6 +8,12 @@ import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectSummaryVO; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAdjusters; + /** * @author liuxinxin * @date 2023/8/2 上午10:39 @@ -16,7 +23,41 @@ import org.springframework.stereotype.Component; @RequiredArgsConstructor public class DashboardProjectManage { + private static String timeFormat = "%s-01-01 00:00:00"; + + + /** + * 查询年份BO 装配 + * + * @param year + * @return + */ + private QueryTimeYearBO getQueryTimeYearBO(Integer year) { + QueryTimeYearBO queryTimeYearBO = new QueryTimeYearBO(); + if (year == null) { + //获取今年第一天 + LocalDate lastYearStrDay = LocalDate.of(LocalDate.now().minusYears(1).getYear(), 1, 1); + LocalDate firstDayOfYear = lastYearStrDay.with(TemporalAdjusters.firstDayOfYear()); + LocalDate lastDayOfYear = lastYearStrDay.with(TemporalAdjusters.lastDayOfYear()); + //获取今年第一天 + LocalDateTime firstDateOfYear = LocalDateTime.of(firstDayOfYear, LocalTime.MIN); + //获取今年最后一天 + LocalDateTime lastDateOfYear = LocalDateTime.of(lastDayOfYear, LocalTime.MAX); + + queryTimeYearBO.setStartYearTime(firstDateOfYear); + queryTimeYearBO.setEndYearTime(lastDateOfYear); + } else { + String startTimeStr = String.format(timeFormat, year); + String endTimeStr = String.format(timeFormat, year + 1); + queryTimeYearBO.setStartYearTime(LocalDateTime.parse(startTimeStr, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + queryTimeYearBO.setEndYearTime(LocalDateTime.parse(endTimeStr, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + } + return queryTimeYearBO; + } + public DashboardInvestmentSummaryVO getInvestmentSummary(QueryYearPO queryYearPO) { + Integer year = queryYearPO.getYear(); + return null; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/QueryTimeYearBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/QueryTimeYearBO.java new file mode 100644 index 0000000..066b646 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/QueryTimeYearBO.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.dashboard.model.basic; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2023/7/27 下午3:24 + */ + +@Data +public class QueryTimeYearBO { + + @ApiModelProperty("开始年份时间") + private LocalDateTime startYearTime; + + @ApiModelProperty("截止年份时间") + private LocalDateTime endYearTime; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java index 908c5b1..2a98f87 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java @@ -1,6 +1,7 @@ package com.ningdatech.pmapi.dashboard.model.vo; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -25,4 +26,16 @@ public class DashboardProjectSummaryVO { * 项目变更数量 * 项目变更金额 */ + + @ApiModelProperty("项目总数") + private Integer projectCnt; + + @ApiModelProperty("待立项项目数") + private Integer toBeApprovedProjectCnt; + + @ApiModelProperty("已立项项目数") + private Integer approvedProjectCnt; + + + }