|
|
@@ -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<ProjectLibListItemVO> projectLibList(ProjectListReq req) { |
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
|
Page<Project> 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<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; |
|
|
|
} |
|
|
|
|
|
|
|