From b7b283959648e7ab7faad6e77e0e97892fbd900a Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 30 Nov 2023 15:41:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=20=E5=85=BC=E5=AE=B9=20?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java index d7ae477..e76a9ed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java @@ -169,7 +169,19 @@ public class ProjectConvertUtil { if(StringUtils.isNotBlank(endTime)){ apply.setBaseProjEndTime(BizUtils.convertLocalDateTime(endTime)); } - apply.setBaseProjDuration(project.getBuildCycle()); + if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){ + try{ + String yearEnd = endTime.split(StrPool.DASH)[0]; + String yearStart = beginTime.split(StrPool.DASH)[0]; + String monthEnd = endTime.split(StrPool.DASH)[1]; + String monthStart = beginTime.split(StrPool.DASH)[1]; + Integer duration = Integer.parseInt(monthEnd) - Integer.parseInt(monthStart) + + (Integer.parseInt(yearEnd) - Integer.parseInt(yearStart)) * 12; + apply.setBaseProjDuration(String.valueOf(duration)); + }catch (Exception e){ + log.error("日期转换失败:",e); + } + } apply.setBaseProjConsClass(project.getBuildLevel()); apply.setBaseProjIntro(project.getProjectIntroduction()); apply.setBaseProjBasis(project.getBaseProjBasis());