From 980d22035786cafae6d902cd427fd900b2911c2d Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 17 Feb 2023 11:23:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=B4=AF=E7=A7=AF=E6=8A=95=E8=B5=84?= =?UTF-8?q?=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/ProjectLibManage.java | 41 ++++++++++++------ .../ProjectAnnualAccumulateAmountMapper.java | 16 +++++++ .../mapper/ProjectAnnualAccumulateAmountMapper.xml | 5 +++ .../dto/ProjectAnnualAccumulateAmountSaveDTO.java | 34 +++++++++++++++ .../entity/ProjectAnnualAccumulateAmount.java | 50 ++++++++++++++++++++++ .../model/vo/ProjectAnnualAccumulateAmountVO.java | 36 ++++++++++++++++ .../pmapi/projectlib/model/vo/ProjectDetailVO.java | 3 ++ .../IProjectAnnualAccumulateAmountService.java | 16 +++++++ .../ProjectAnnualAccumulateAmountServiceImpl.java | 22 ++++++++++ pmapi/src/test/resources/security/auth-dev.yml | 3 +- 10 files changed, 212 insertions(+), 14 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectAnnualAccumulateAmountSaveDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectAnnualAccumulateAmountVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectAnnualAccumulateAmountService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectAnnualAccumulateAmountServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index c3cbd08..1bac8b5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -7,11 +7,13 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; +import com.ningdatech.pmapi.projectlib.service.IProjectAnnualAccumulateAmountService; import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import lombok.RequiredArgsConstructor; @@ -38,6 +40,8 @@ public class ProjectLibManage { private final IProjectApplicationService applicationService; + private final IProjectAnnualAccumulateAmountService announcementAccumulateAmountService; + public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); Page page = projectService.page(req.page(), query); @@ -79,19 +83,30 @@ public class ProjectLibManage { BeanUtils.copyProperties(projectInfo, vo); vo.buildDynamicForm(projectInfo.getDynamicForm()); // 查询应用 - if(Objects.nonNull(vo)){ - List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, vo.getId())); - Optional.ofNullable(applications).ifPresent(apps -> - vo.setProjectApplications(CollUtils.convert(apps, - app-> { - ProjectApplicationVO appVo = new ProjectApplicationVO(); - BeanUtils.copyProperties(app, appVo); - return appVo; - } - ) - )); - } + List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, vo.getId())); + Optional.ofNullable(applications).ifPresent(apps -> + vo.setProjectApplications(CollUtils.convert(apps, + app-> { + ProjectApplicationVO appVo = new ProjectApplicationVO(); + BeanUtils.copyProperties(app, appVo); + return appVo; + } + ) + )); + //查询年度投资金额 + List annualAmount = announcementAccumulateAmountService.list(Wrappers.lambdaQuery(ProjectAnnualAccumulateAmount.class) + .eq(ProjectAnnualAccumulateAmount::getProjectId, vo.getId()) + .orderByAsc(ProjectAnnualAccumulateAmount::getProjectYear)); + Optional.ofNullable(annualAmount).ifPresent(amounts -> + vo.setAnnualAccumulateAmountDetail(CollUtils.joinByComma(amounts, + amount-> { + StringBuffer sb = new StringBuffer(); + sb.append(amount.getProjectYear() + "年投资" + amount.getConvertTenThousand() + "万元。\n"); + return sb.toString(); + } + ) + )); return vo; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.java new file mode 100644 index 0000000..4f4ac5e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.projectlib.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-02-17 + */ +public interface ProjectAnnualAccumulateAmountMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.xml new file mode 100644 index 0000000..1761eee --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectAnnualAccumulateAmountSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectAnnualAccumulateAmountSaveDTO.java new file mode 100644 index 0000000..69068a2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectAnnualAccumulateAmountSaveDTO.java @@ -0,0 +1,34 @@ +package com.ningdatech.pmapi.projectlib.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Classname ProjectAnnualAccumulateAmountSaveDTO + * @Description + * @Date 2023/2/17 10:49 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ProjectAnnualAccumulateAmountSaveDTO", description = "项目年度累积投资资金保存") +public class ProjectAnnualAccumulateAmountSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目ID") + @NotNull + private Long projectId; + + @NotNull + @ApiModelProperty("年份") + private Integer projectYear; + + @NotNull + @ApiModelProperty("年度投资金额") + private BigDecimal annualAccumulateAmount; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java new file mode 100644 index 0000000..622f27c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java @@ -0,0 +1,50 @@ +package com.ningdatech.pmapi.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Objects; + +/** + * @Classname NdProjectAnnualAccumulateAmount + * @Description + * @Date 2023/2/17 10:49 + * @Author PoffyZhang + */ +@Data +@TableName("nd_project_annual_accumulate_amount") +@ApiModel(value = "NdProjectAnnualAccumulateAmount", description = "项目年度累积投资资金表") +public class ProjectAnnualAccumulateAmount implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("年份") + private Integer projectYear; + + @ApiModelProperty("年度投资金额") + private BigDecimal annualAccumulateAmount; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + + public BigDecimal getConvertTenThousand() { + if(Objects.nonNull(this.annualAccumulateAmount)){ + return this.annualAccumulateAmount.divide(BigDecimal.valueOf(10000),2, RoundingMode.HALF_UP); + } + return BigDecimal.ZERO; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectAnnualAccumulateAmountVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectAnnualAccumulateAmountVO.java new file mode 100644 index 0000000..f15ba35 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectAnnualAccumulateAmountVO.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.projectlib.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Classname ProjectAnnualAccumulateAmountVO + * @Description + * @Date 2023/2/17 10:49 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ProjectAnnualAccumulateAmountVO", description = "项目年度累积投资资金VO") +public class ProjectAnnualAccumulateAmountVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("年份") + private Integer projectYear; + + @ApiModelProperty("年度投资金额") + private BigDecimal annualAccumulateAmount; + + private Long createBy; + private Long updateBy; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index 231b312..a805d44 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -274,6 +274,9 @@ public class ProjectDetailVO { @ApiModelProperty("动态form") private Map dynamicForm; + @ApiModelProperty("年度投资金额详情") + private String annualAccumulateAmountDetail; + private String projectTypeName; public String getProjectTypeName() { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectAnnualAccumulateAmountService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectAnnualAccumulateAmountService.java new file mode 100644 index 0000000..070b391 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectAnnualAccumulateAmountService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.projectlib.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-02-17 + */ +public interface IProjectAnnualAccumulateAmountService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectAnnualAccumulateAmountServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectAnnualAccumulateAmountServiceImpl.java new file mode 100644 index 0000000..72f1914 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectAnnualAccumulateAmountServiceImpl.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.projectlib.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.projectlib.mapper.ProjectAnnualAccumulateAmountMapper; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; +import com.ningdatech.pmapi.projectlib.service.IProjectAnnualAccumulateAmountService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-02-05 + */ +@Service +public class ProjectAnnualAccumulateAmountServiceImpl + extends ServiceImpl + implements IProjectAnnualAccumulateAmountService { + +} diff --git a/pmapi/src/test/resources/security/auth-dev.yml b/pmapi/src/test/resources/security/auth-dev.yml index 448ffa2..b6e94cf 100644 --- a/pmapi/src/test/resources/security/auth-dev.yml +++ b/pmapi/src/test/resources/security/auth-dev.yml @@ -49,4 +49,5 @@ security: - /api/v1/user-info/save - /api/v1/user-info/del - /api/v1/user-info/kick-off/** - - /api/v1/user-info/password/mod \ No newline at end of file + - /api/v1/user-info/password/mod + - /api/v1/** \ No newline at end of file From 7da22f9a8b1234955fcc9d737daa244061eb1b2c Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 17 Feb 2023 11:48:41 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=B4=AF=E7=A7=AF=E6=8A=95=E8=B5=84?= =?UTF-8?q?=E9=87=91=E9=A2=9D=20=E6=94=BE=E5=88=B0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/helper/ProjectHelper.java | 25 ++++++++++++++++++++++ .../pmapi/projectlib/manage/ProjectLibManage.java | 17 +++------------ .../entity/ProjectAnnualAccumulateAmount.java | 8 +++---- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java index ad3203c..e69c008 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java @@ -3,7 +3,11 @@ package com.ningdatech.pmapi.projectlib.helper; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; +import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; +import org.springframework.beans.BeanUtils; /** *

@@ -48,4 +52,25 @@ public class ProjectHelper { return query; } + /** + * 转换年度投资详情 + * @param amount + * @return + */ + public static String convertAnnualAmountDetail(ProjectAnnualAccumulateAmount amount) { + StringBuffer sb = new StringBuffer(); + sb.append(amount.getProjectYear() + "年投资" + amount.getConvertTenThousand() + "万元。\n"); + return sb.toString(); + } + + /** + * 转换VO + * @param app + * @return + */ + public static ProjectApplicationVO convertVO(ProjectApplication app) { + ProjectApplicationVO appVo = new ProjectApplicationVO(); + BeanUtils.copyProperties(app, appVo); + return appVo; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 1bac8b5..8b1888a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -10,7 +10,6 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.service.IProjectAnnualAccumulateAmountService; @@ -87,25 +86,15 @@ public class ProjectLibManage { .eq(ProjectApplication::getProjectId, vo.getId())); Optional.ofNullable(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, - app-> { - ProjectApplicationVO appVo = new ProjectApplicationVO(); - BeanUtils.copyProperties(app, appVo); - return appVo; - } - ) + ProjectHelper::convertVO) )); //查询年度投资金额 List annualAmount = announcementAccumulateAmountService.list(Wrappers.lambdaQuery(ProjectAnnualAccumulateAmount.class) .eq(ProjectAnnualAccumulateAmount::getProjectId, vo.getId()) .orderByAsc(ProjectAnnualAccumulateAmount::getProjectYear)); Optional.ofNullable(annualAmount).ifPresent(amounts -> - vo.setAnnualAccumulateAmountDetail(CollUtils.joinByComma(amounts, - amount-> { - StringBuffer sb = new StringBuffer(); - sb.append(amount.getProjectYear() + "年投资" + amount.getConvertTenThousand() + "万元。\n"); - return sb.toString(); - } - ) + vo.setAnnualAccumulateAmountDetail(CollUtils.joinByComma( + amounts,ProjectHelper::convertAnnualAmountDetail) )); return vo; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java index 622f27c..d896cb6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java @@ -7,6 +7,7 @@ import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.LocalDateTime; import java.util.Objects; /** @@ -35,11 +36,8 @@ public class ProjectAnnualAccumulateAmount implements Serializable { @ApiModelProperty("年度投资金额") private BigDecimal annualAccumulateAmount; - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; + private LocalDateTime createOn; + private LocalDateTime updateOn; public BigDecimal getConvertTenThousand() { if(Objects.nonNull(this.annualAccumulateAmount)){ From b4ee2ba1365031cf406704f1c11d1f54fc3a212a Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 17 Feb 2023 13:53:10 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=B4=AF=E7=A7=AF=E6=8A=95=E8=B5=84?= =?UTF-8?q?=E9=87=91=E9=A2=9D=20=E6=94=BE=E5=88=B0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/helper/ProjectHelper.java | 12 ------ .../pmapi/projectlib/manage/ProjectLibManage.java | 41 +++++++++++++----- .../ProjectAnnualAccumulateAmountMapper.java | 16 -------- .../mapper/ProjectAnnualAccumulateAmountMapper.xml | 5 --- .../dto/ProjectAnnualAccumulateAmountSaveDTO.java | 34 --------------- .../pmapi/projectlib/model/entity/Project.java | 34 +++++++-------- .../entity/ProjectAnnualAccumulateAmount.java | 48 ---------------------- .../pmapi/projectlib/model/vo/AnnualAmountVO.java | 32 +++++++++++++++ .../model/vo/ProjectAnnualAccumulateAmountVO.java | 36 ---------------- .../pmapi/projectlib/model/vo/ProjectDetailVO.java | 2 +- .../IProjectAnnualAccumulateAmountService.java | 16 -------- .../ProjectAnnualAccumulateAmountServiceImpl.java | 22 ---------- 12 files changed, 80 insertions(+), 218 deletions(-) delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.xml delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectAnnualAccumulateAmountSaveDTO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectAnnualAccumulateAmountVO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectAnnualAccumulateAmountService.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectAnnualAccumulateAmountServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java index e69c008..a6c7d3a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java @@ -3,7 +3,6 @@ package com.ningdatech.pmapi.projectlib.helper; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; @@ -53,17 +52,6 @@ public class ProjectHelper { } /** - * 转换年度投资详情 - * @param amount - * @return - */ - public static String convertAnnualAmountDetail(ProjectAnnualAccumulateAmount amount) { - StringBuffer sb = new StringBuffer(); - sb.append(amount.getProjectYear() + "年投资" + amount.getConvertTenThousand() + "万元。\n"); - return sb.toString(); - } - - /** * 转换VO * @param app * @return diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 8b1888a..d75c9d2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -3,22 +3,26 @@ package com.ningdatech.pmapi.projectlib.manage; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; +import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.projectlib.service.IProjectAnnualAccumulateAmountService; import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; +import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -39,7 +43,7 @@ public class ProjectLibManage { private final IProjectApplicationService applicationService; - private final IProjectAnnualAccumulateAmountService announcementAccumulateAmountService; + private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -88,14 +92,29 @@ public class ProjectLibManage { vo.setProjectApplications(CollUtils.convert(apps, ProjectHelper::convertVO) )); - //查询年度投资金额 - List annualAmount = announcementAccumulateAmountService.list(Wrappers.lambdaQuery(ProjectAnnualAccumulateAmount.class) - .eq(ProjectAnnualAccumulateAmount::getProjectId, vo.getId()) - .orderByAsc(ProjectAnnualAccumulateAmount::getProjectYear)); - Optional.ofNullable(annualAmount).ifPresent(amounts -> - vo.setAnnualAccumulateAmountDetail(CollUtils.joinByComma( - amounts,ProjectHelper::convertAnnualAmountDetail) - )); + + //查询年度投资金额 要是已验收的项目 + if(ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())){ + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(projectInfo.getProjectYear()) + .annualAmount(projectInfo.getAnnualPlanAmount()) + .build()); + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> + declarations.forEach(declaration -> { + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .build()); + }) + ); + vo.setAnnualAccumulateAmountList(annualAmounts); + } return vo; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.java deleted file mode 100644 index 4f4ac5e..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; - -/** - *

- * Mapper 接口 - *

- * - * @author zpf - * @since 2023-02-17 - */ -public interface ProjectAnnualAccumulateAmountMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.xml deleted file mode 100644 index 1761eee..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectAnnualAccumulateAmountMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectAnnualAccumulateAmountSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectAnnualAccumulateAmountSaveDTO.java deleted file mode 100644 index 69068a2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectAnnualAccumulateAmountSaveDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * @Classname ProjectAnnualAccumulateAmountSaveDTO - * @Description - * @Date 2023/2/17 10:49 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "ProjectAnnualAccumulateAmountSaveDTO", description = "项目年度累积投资资金保存") -public class ProjectAnnualAccumulateAmountSaveDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目ID") - @NotNull - private Long projectId; - - @NotNull - @ApiModelProperty("年份") - private Integer projectYear; - - @NotNull - @ApiModelProperty("年度投资金额") - private BigDecimal annualAccumulateAmount; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index 8f61c13..121ac74 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -118,52 +118,52 @@ public class Project implements Serializable { @ApiModelProperty("项目简介") private String projectIntroduction; - @ApiModelProperty("资金申报情况-申报金额(万元)") + @ApiModelProperty("资金申报情况-申报金额(元)") private BigDecimal declareAmount; - @ApiModelProperty("资金申报情况-自有金额(万元)") + @ApiModelProperty("资金申报情况-自有金额(元)") private BigDecimal declareHaveAmount; - @ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)") + @ApiModelProperty("资金申报情况-政府投资-本级财政资金(元)") private BigDecimal declareGovOwnFinanceAmount; - @ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)") + @ApiModelProperty("资金申报情况-政府投资-上级补助资金(元)") private BigDecimal declareGovSuperiorFinanceAmount; - @ApiModelProperty("银行贷款(万元)") + @ApiModelProperty("银行贷款(元)") private BigDecimal declareBankLendingAmount; - @ApiModelProperty("其它资金(万元)") + @ApiModelProperty("其它资金(元)") private BigDecimal declareOtherAmount; - @ApiModelProperty("资金分配情况-软件开发(万元)") + @ApiModelProperty("资金分配情况-软件开发(元)") private BigDecimal softwareDevelopmentAmount; - @ApiModelProperty("资金分配情况-云资源、硬件购置(万元)") + @ApiModelProperty("资金分配情况-云资源、硬件购置(元)") private BigDecimal cloudHardwarePurchaseAmount; - @ApiModelProperty("资金分配情况-第三方服务(万元)") + @ApiModelProperty("资金分配情况-第三方服务(元)") private BigDecimal thirdPartyAmount; - @ApiModelProperty("年度支付计划-年度支付计划(万元)") + @ApiModelProperty("年度支付计划-年度支付计划(元)") private BigDecimal annualPlanAmount; - @ApiModelProperty("年度支付计划-自有金额(万元)") + @ApiModelProperty("年度支付计划-自有金额(元)") private BigDecimal annualPlanHaveAmount; - @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(元)") private BigDecimal annualPlanGovOwnFinanceAmount; - @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(元)") private BigDecimal annualPlanGovSuperiorFinanceAmount; - @ApiModelProperty("年度支付计划-银行贷款(万元)") + @ApiModelProperty("年度支付计划-银行贷款(元)") private BigDecimal annualPlanBankLendingAmount; - @ApiModelProperty("年度支付计划-其它资金(万元)") + @ApiModelProperty("年度支付计划-其它资金(元)") private BigDecimal annualPlanOtherAmount; - @ApiModelProperty("立项批复资金(万元)") + @ApiModelProperty("立项批复资金(元)") private BigDecimal approvalAmount; private LocalDateTime annualPlanAddTime; @@ -177,7 +177,7 @@ public class Project implements Serializable { @ApiModelProperty("安全投入-内容描述") private String safetyInputDescribe; - @ApiModelProperty("安全投入-金额(万元)") + @ApiModelProperty("安全投入-金额(元)") private BigDecimal safetyInputAmount; @ApiModelProperty("附件-初步方案") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java deleted file mode 100644 index d896cb6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectAnnualAccumulateAmount.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.io.Serializable; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * @Classname NdProjectAnnualAccumulateAmount - * @Description - * @Date 2023/2/17 10:49 - * @Author PoffyZhang - */ -@Data -@TableName("nd_project_annual_accumulate_amount") -@ApiModel(value = "NdProjectAnnualAccumulateAmount", description = "项目年度累积投资资金表") -public class ProjectAnnualAccumulateAmount implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - @TableId(type = IdType.AUTO) - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("年份") - private Integer projectYear; - - @ApiModelProperty("年度投资金额") - private BigDecimal annualAccumulateAmount; - - private LocalDateTime createOn; - private LocalDateTime updateOn; - - public BigDecimal getConvertTenThousand() { - if(Objects.nonNull(this.annualAccumulateAmount)){ - return this.annualAccumulateAmount.divide(BigDecimal.valueOf(10000),2, RoundingMode.HALF_UP); - } - return BigDecimal.ZERO; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java new file mode 100644 index 0000000..53a1f27 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/AnnualAmountVO.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.projectlib.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @Classname AnnualAmountVO + * @Description + * @Date 2023/2/17 13:37 + * @Author PoffyZhang + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AnnualAmountVO { + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("年份") + private Integer projectYear; + + @ApiModelProperty("年度投资资金") + private BigDecimal annualAmount; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectAnnualAccumulateAmountVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectAnnualAccumulateAmountVO.java deleted file mode 100644 index f15ba35..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectAnnualAccumulateAmountVO.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * @Classname ProjectAnnualAccumulateAmountVO - * @Description - * @Date 2023/2/17 10:49 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "ProjectAnnualAccumulateAmountVO", description = "项目年度累积投资资金VO") -public class ProjectAnnualAccumulateAmountVO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("年份") - private Integer projectYear; - - @ApiModelProperty("年度投资金额") - private BigDecimal annualAccumulateAmount; - - private Long createBy; - private Long updateBy; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index a805d44..a15c074 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -275,7 +275,7 @@ public class ProjectDetailVO { private Map dynamicForm; @ApiModelProperty("年度投资金额详情") - private String annualAccumulateAmountDetail; + private List annualAccumulateAmountList; private String projectTypeName; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectAnnualAccumulateAmountService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectAnnualAccumulateAmountService.java deleted file mode 100644 index 070b391..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectAnnualAccumulateAmountService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-02-17 - */ -public interface IProjectAnnualAccumulateAmountService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectAnnualAccumulateAmountServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectAnnualAccumulateAmountServiceImpl.java deleted file mode 100644 index 72f1914..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectAnnualAccumulateAmountServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ningdatech.pmapi.projectlib.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectlib.mapper.ProjectAnnualAccumulateAmountMapper; -import com.ningdatech.pmapi.projectlib.model.entity.ProjectAnnualAccumulateAmount; -import com.ningdatech.pmapi.projectlib.service.IProjectAnnualAccumulateAmountService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author WendyYang - * @since 2023-02-05 - */ -@Service -public class ProjectAnnualAccumulateAmountServiceImpl - extends ServiceImpl - implements IProjectAnnualAccumulateAmountService { - -}