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