@@ -7,11 +7,13 @@ import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | 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.ProjectApplication; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | 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.IProjectApplicationService; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -38,6 +40,8 @@ public class ProjectLibManage { | |||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final IProjectAnnualAccumulateAmountService announcementAccumulateAmountService; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
Page<Project> page = projectService.page(req.page(), query); | Page<Project> page = projectService.page(req.page(), query); | ||||
@@ -79,19 +83,30 @@ public class ProjectLibManage { | |||||
BeanUtils.copyProperties(projectInfo, vo); | BeanUtils.copyProperties(projectInfo, vo); | ||||
vo.buildDynamicForm(projectInfo.getDynamicForm()); | vo.buildDynamicForm(projectInfo.getDynamicForm()); | ||||
// 查询应用 | // 查询应用 | ||||
if(Objects.nonNull(vo)){ | |||||
List<ProjectApplication> 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<ProjectApplication> 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<ProjectAnnualAccumulateAmount> 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; | return vo; | ||||
} | } | ||||
@@ -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; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author zpf | |||||
* @since 2023-02-17 | |||||
*/ | |||||
public interface ProjectAnnualAccumulateAmountMapper extends BaseMapper<ProjectAnnualAccumulateAmount> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.ningdatech.pmapi.projectlib.mapper.ProjectAnnualAccumulateAmountMapper"> | |||||
</mapper> |
@@ -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; | |||||
} |
@@ -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; | |||||
} | |||||
} |
@@ -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; | |||||
} |
@@ -274,6 +274,9 @@ public class ProjectDetailVO { | |||||
@ApiModelProperty("动态form") | @ApiModelProperty("动态form") | ||||
private Map<String, Object> dynamicForm; | private Map<String, Object> dynamicForm; | ||||
@ApiModelProperty("年度投资金额详情") | |||||
private String annualAccumulateAmountDetail; | |||||
private String projectTypeName; | private String projectTypeName; | ||||
public String getProjectTypeName() { | public String getProjectTypeName() { | ||||
@@ -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; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author zpf | |||||
* @since 2023-02-17 | |||||
*/ | |||||
public interface IProjectAnnualAccumulateAmountService extends IService<ProjectAnnualAccumulateAmount> { | |||||
} |
@@ -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; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 2023-02-05 | |||||
*/ | |||||
@Service | |||||
public class ProjectAnnualAccumulateAmountServiceImpl | |||||
extends ServiceImpl<ProjectAnnualAccumulateAmountMapper, ProjectAnnualAccumulateAmount> | |||||
implements IProjectAnnualAccumulateAmountService { | |||||
} |
@@ -49,4 +49,5 @@ security: | |||||
- /api/v1/user-info/save | - /api/v1/user-info/save | ||||
- /api/v1/user-info/del | - /api/v1/user-info/del | ||||
- /api/v1/user-info/kick-off/** | - /api/v1/user-info/kick-off/** | ||||
- /api/v1/user-info/password/mod | |||||
- /api/v1/user-info/password/mod | |||||
- /api/v1/** |