From 09f15a63f0174c9694691f44d61f257157f47518 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 27 Jul 2023 13:53:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E4=BF=A1=E6=81=AF=E6=8B=9B=E6=A0=87=E7=99=BB=E8=AE=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=8E=E9=87=87=E8=B4=AD=E5=A4=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ningda-generator/pom.xml | 5 - .../pmapi/projectlib/manage/ProjectLibManage.java | 243 +++++++++++---------- .../pmapi/projectlib/model/vo/ProjectDetailVO.java | 4 +- 3 files changed, 126 insertions(+), 126 deletions(-) diff --git a/ningda-generator/pom.xml b/ningda-generator/pom.xml index 3b78753..e2362fc 100644 --- a/ningda-generator/pom.xml +++ b/ningda-generator/pom.xml @@ -26,11 +26,6 @@ freemarker - - - - - com.kingbase8 kingbase8-8.2.0 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 239faa4..04fb567 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 @@ -116,7 +116,7 @@ public class ProjectLibManage { public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); long total; if ((total = page.getTotal()) == 0) { @@ -142,11 +142,11 @@ public class ProjectLibManage { return PageVo.of(records, total); } - public PageVo projectLibListWithPermission(ProjectListReq req,UserFullInfoDTO user) { + public PageVo projectLibListWithPermission(ProjectListReq req, UserFullInfoDTO user) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - user = buildProjectLibPermission(query,user); + user = buildProjectLibPermission(query, user); //项目查最新 - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); long total; if ((total = page.getTotal()) == 0) { @@ -187,14 +187,15 @@ public class ProjectLibManage { /** * 申报新项目时 保存项目信息和其它相关联的信息 + * * @param projectDto * @param instanceId * @param employeeCode * @return */ public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, - String employeeCode) { - Project project = saveProjectNewVersion(projectDto,instanceId,employeeCode); + String employeeCode) { + Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode); //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -219,12 +220,12 @@ public class ProjectLibManage { public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId, String employeeCode, Project oldProject) { - Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode,oldProject); + Project project = saveConstructProjectNewVersion(projectDto, instanceId, employeeCode, oldProject); // 将旧的项目状态、阶段置为null,防止项目还会出现在待申报列表 LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Project.class); - updateWrapper.set(Project::getStage,null) - .set(Project::getStatus,null) - .eq(Project::getId,oldProject.getId()); + updateWrapper.set(Project::getStage, null) + .set(Project::getStatus, null) + .eq(Project::getId, oldProject.getId()); projectService.update(updateWrapper); //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); @@ -239,6 +240,7 @@ public class ProjectLibManage { /** * 申报新项目时 保存项目信息和其它相关联的信息 + * * @param projectDto * @param instanceId * @param employeeCode @@ -250,7 +252,7 @@ public class ProjectLibManage { try { Project project = new Project(); //为空 代表是新申报的 - if(Objects.isNull(projectDto.getId())){ + if (Objects.isNull(projectDto.getId())) { BeanUtils.copyProperties(projectDto, project); project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); @@ -261,10 +263,10 @@ public class ProjectLibManage { String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); project.setProjectCode(projectCode); projectService.save(project); - }else{ + } else { //否则是重新提交的 新生成一个新版本的项目 project = newProjectWithVersion(projectDto); - if(Objects.nonNull(project)){ + if (Objects.nonNull(project)) { project.setInstCode(instanceId); project.setSponsor(employeeCode); projectService.updateById(project); @@ -277,8 +279,8 @@ public class ProjectLibManage { //采取批量删除 批量添加的方式 Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion,version)); + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion, version)); if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { Project finalProject = project; List applications = projectDto.getApplicationList().stream().map(application -> { @@ -316,7 +318,7 @@ public class ProjectLibManage { try { Project project = new Project(); //为空 代表是新申报的 - if(Objects.isNull(projectDto.getId())){ + if (Objects.isNull(projectDto.getId())) { BeanUtils.copyProperties(projectDto, project); // 被撤回重新申报的项目,项目ID要置空 project.setId(null); @@ -332,23 +334,23 @@ public class ProjectLibManage { // 标记为建设方案申报 project.setIsConstruct(Boolean.TRUE); // 保存初步方案项目ID - if (Boolean.TRUE.equals(oldProject.getIsConstruct())){ + if (Boolean.TRUE.equals(oldProject.getIsConstruct())) { // 重新提交 project.setPrePlanProjectId(oldProject.getPrePlanProjectId()); - }else { + } else { project.setPrePlanProjectId(oldProject.getId()); } projectService.save(project); // 将旧的项目版本置为不是最新 projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest,Boolean.FALSE) - .ne(Project::getId,project.getId()) - .eq(Project::getProjectCode,project.getProjectCode())); - }else{ + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + } else { //否则是被驳回,重新提交的 新生成一个新版本的项目 project = newProjectWithVersion(projectDto); - if(Objects.nonNull(project)){ + if (Objects.nonNull(project)) { project.setInstCode(instanceId); project.setSponsor(employeeCode); projectService.updateById(project); @@ -360,9 +362,9 @@ public class ProjectLibManage { ? Boolean.TRUE : Boolean.FALSE; //采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion,project.getVersion()) - .eq(ProjectApplication::getIsConstruct,Boolean.TRUE)); + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion, project.getVersion()) + .eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { Project finalProject = project; @@ -390,6 +392,7 @@ public class ProjectLibManage { /** * 在其它项目阶段 保存项目信息和其它相关联的信息 + * * @param projectDto * @return */ @@ -403,8 +406,8 @@ public class ProjectLibManage { ? Boolean.TRUE : Boolean.FALSE; //采取批量删除 批量添加的方式 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion,project.getVersion())); + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion, project.getVersion())); if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { Project finalProject = project; List applications = projectDto.getApplicationList().stream().map(application -> { @@ -429,14 +432,14 @@ public class ProjectLibManage { * 重新提交工作流时 舍弃在原有项目修改 * 新增一个新的项目 新的版本号 */ - public Project newProjectWithVersion(ProjectDTO projecDto){ + public Project newProjectWithVersion(ProjectDTO projecDto) { Project oldProject = projectService.getById(projecDto.getId()); Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + .throwMessage("项目不存在!"); + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projecDto,project, CopyOptions.create() + BeanUtil.copyProperties(projecDto, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); project.setId(null); @@ -446,38 +449,38 @@ public class ProjectLibManage { projectService.save(project); projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest,Boolean.FALSE) - .ne(Project::getId,project.getId()) - .eq(Project::getProjectCode,project.getProjectCode())); + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); return project; } - public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto,Integer stageCode,Integer statusCode,Boolean isConstruct){ + public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { Project oldProject = projectService.getById(projecDto.getId()); Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projecDto,project, CopyOptions.create() + BeanUtil.copyProperties(projecDto, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); project.setId(null); project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); - if(Objects.nonNull(stageCode)){ + if (Objects.nonNull(stageCode)) { project.setStage(stageCode); } - if(Objects.nonNull(statusCode)){ + if (Objects.nonNull(statusCode)) { project.setStatus(statusCode); } - if(projectService.save(project)){ + if (projectService.save(project)) { projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest,Boolean.FALSE) - .ne(Project::getId,project.getId()) - .eq(Project::getProjectCode,project.getProjectCode())); + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); //采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息 List projectCodeList = projectService.list(Wrappers.lambdaQuery(Project.class) @@ -485,17 +488,17 @@ public class ProjectLibManage { .eq(Project::getIsConstruct, isConstruct)).stream() .map(Project::getProjectCode).collect(Collectors.toList()); projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode()) - .in(CollUtil.isNotEmpty(projectCodeList),ProjectApplication::getProjectCode,projectCodeList) - .eq(ProjectApplication::getIsConstruct,isConstruct) - .eq(ProjectApplication::getProjectVersion,project.getVersion())); + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .in(CollUtil.isNotEmpty(projectCodeList), ProjectApplication::getProjectCode, projectCodeList) + .eq(ProjectApplication::getIsConstruct, isConstruct) + .eq(ProjectApplication::getProjectVersion, project.getVersion())); //app List applicationList = projecDto.getApplicationList(); - if(CollUtil.isNotEmpty(applicationList)){ + if (CollUtil.isNotEmpty(applicationList)) { List apps = applicationList.stream() .map(a -> { - ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class); + ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class); app.setId(null); app.setProjectId(project.getId()); app.setBuildOrgName(project.getBuildOrgName()); @@ -512,14 +515,14 @@ public class ProjectLibManage { return project; } - public Project saveProjectWithVersion(ProjectDTO projecDto,String instanceId,Integer instType){ + public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType) { Project oldProject = projectService.getById(projecDto.getId()); Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projecDto,project, CopyOptions.create() + BeanUtil.copyProperties(projecDto, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); project.setId(null); @@ -527,7 +530,7 @@ public class ProjectLibManage { project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); - if(projectService.save(project)){ + if (projectService.save(project)) { //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -538,21 +541,21 @@ public class ProjectLibManage { projectInstService.save(projectInst); projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest,Boolean.FALSE) - .ne(Project::getId,project.getId()) - .eq(Project::getProjectCode,project.getProjectCode())); + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); //app //采取批量删除 批量添加的方式 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode,project.getProjectCode()) - .eq(ProjectApplication::getProjectVersion,project.getVersion())); + .eq(ProjectApplication::getProjectCode, project.getProjectCode()) + .eq(ProjectApplication::getProjectVersion, project.getVersion())); List applicationList = projecDto.getApplicationList(); - if(CollUtil.isNotEmpty(applicationList)){ + if (CollUtil.isNotEmpty(applicationList)) { List apps = applicationList.stream() .map(a -> { - ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class); + ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class); app.setId(null); app.setProjectId(project.getId()); app.setProjectCode(project.getProjectCode()); @@ -568,11 +571,12 @@ public class ProjectLibManage { return project; } - public Project saveProjectWithVersion(Project oldProject,String instanceId,Integer instType){ + + public Project saveProjectWithVersion(Project oldProject, String instanceId, Integer instType) { Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); project.setId(null); @@ -580,7 +584,7 @@ public class ProjectLibManage { project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); - if(projectService.save(project)){ + if (projectService.save(project)) { //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -591,18 +595,19 @@ public class ProjectLibManage { projectInstService.save(projectInst); projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest,Boolean.FALSE) - .ne(Project::getId,project.getId()) - .eq(Project::getProjectCode,project.getProjectCode())); + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); } return project; } - public Project saveProjectWithVersionAndPass(Project oldProject,String instanceId,Integer instType){ + + public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) { Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); project.setId(null); @@ -613,7 +618,7 @@ public class ProjectLibManage { project.setIsConstruct(Boolean.TRUE); stateMachineUtils.pass(project); - if(projectService.save(project)){ + if (projectService.save(project)) { //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -624,19 +629,19 @@ public class ProjectLibManage { projectInstService.save(projectInst); projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest,Boolean.FALSE) - .ne(Project::getId,project.getId()) - .eq(Project::getProjectCode,project.getProjectCode())); + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); } return project; } - public Project saveConstructProjectWithVersionAndPass(Project oldProject,String instanceId,Integer instType){ + public Project saveConstructProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) { Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); - BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); project.setId(null); @@ -647,7 +652,7 @@ public class ProjectLibManage { project.setIsConstruct(Boolean.TRUE); stateMachineUtils.pass(project); - if(projectService.save(project)){ + if (projectService.save(project)) { //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -658,9 +663,9 @@ public class ProjectLibManage { projectInstService.save(projectInst); projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest,Boolean.FALSE) - .ne(Project::getId,project.getId()) - .eq(Project::getProjectCode,project.getProjectCode())); + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); } return project; @@ -684,8 +689,8 @@ public class ProjectLibManage { // 查询应用 List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) - .eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct()) - .eq(ProjectApplication::getProjectVersion,projectInfo.getVersion())); + .eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) + .eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); Optional.ofNullable(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, @@ -694,10 +699,8 @@ public class ProjectLibManage { List allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); //查询采购备案 - Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId, allVersionProjectId) - .last(BizConst.LIMIT_1)); - vo.setPurchase(BeanUtil.copyProperties(purchase, PurchaseVO.class)); + List purchases = purchaseService.listByProjectId(projectId); + vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); //查询合同备案 Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) @@ -708,7 +711,7 @@ public class ProjectLibManage { List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) .in(PaymentPlan::getProjectId, allVersionProjectId) .orderByAsc(PaymentPlan::getPaymentTime)); - if(Objects.nonNull(contractVO)){ + if (Objects.nonNull(contractVO)) { contractVO.setPayments(convertPayments(payments, contractVO.getTotalAmount())); } @@ -774,8 +777,8 @@ public class ProjectLibManage { // 查询应用 List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) - .eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct()) - .eq(ProjectApplication::getProjectVersion,projectInfo.getVersion())); + .eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) + .eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); Optional.ofNullable(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, @@ -790,10 +793,8 @@ public class ProjectLibManage { List allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); //查询采购备案 - Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class) - .in(Purchase::getProjectId, allVersionProjectId) - .last(BizConst.LIMIT_1)); - vo.setPurchase(BeanUtil.copyProperties(purchase, PurchaseVO.class)); + List purchases = purchaseService.listByProjectId(projectId); + vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); //查询合同备案 Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) @@ -804,7 +805,7 @@ public class ProjectLibManage { List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) .in(PaymentPlan::getProjectId, allVersionProjectId) .orderByAsc(PaymentPlan::getPaymentTime)); - if(Objects.nonNull(contractVO)){ + if (Objects.nonNull(contractVO)) { contractVO.setPayments(convertPayments(payments, contractVO.getTotalAmount())); } @@ -854,6 +855,7 @@ public class ProjectLibManage { /** * 获取项目初步方案详情 + * * @param projectId * @return com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO * @author CMM @@ -871,7 +873,7 @@ public class ProjectLibManage { // 查询应用 List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) - .eq(ProjectApplication::getIsConstruct,Boolean.FALSE)); + .eq(ProjectApplication::getIsConstruct, Boolean.FALSE)); Optional.ofNullable(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, @@ -916,7 +918,7 @@ public class ProjectLibManage { param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); List projects = projectService.list(query); ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -944,7 +946,7 @@ public class ProjectLibManage { * * @param query */ - public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query,UserFullInfoDTO user) { + public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); if (!currentUserDataScope.isPresent()) { log.warn("没有取到权限信息 当前查询 没有权限条件"); @@ -1052,49 +1054,50 @@ public class ProjectLibManage { /** * 应用列表 + * * @param req * @return */ public PageVo applicationList(ProjectApplicationListReq req) { Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) - .eq(StringUtils.isNotBlank(req.getBuildOrgName()),ProjectApplication::getBuildOrgName,req.getBuildOrgName()); + .eq(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectApplication::getBuildOrgName, req.getBuildOrgName()); - if(StringUtils.isNotBlank(req.getApplicationName())){ - wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName,req.getApplicationName()) - .or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication,req.getApplicationName()))); + if (StringUtils.isNotBlank(req.getApplicationName())) { + wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName, req.getApplicationName()) + .or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication, req.getApplicationName()))); } wrapper.orderByDesc(ProjectApplication::getUpdateOn); - projectApplicationService.page(page,wrapper); + projectApplicationService.page(page, wrapper); - if(0L == page.getTotal()){ + if (0L == page.getTotal()) { return PageVo.empty(); } List res = page.getRecords().stream() - .map(app -> BeanUtil.copyProperties(app,ProjectApplicationVO.class)) + .map(app -> BeanUtil.copyProperties(app, ProjectApplicationVO.class)) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } private List convertPersons(List acceptancePersons) { - if(CollUtil.isEmpty(acceptancePersons)){ + if (CollUtil.isEmpty(acceptancePersons)) { return Collections.emptyList(); } - return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u,PreInsAcceptancePersonVO.class)).collect(Collectors.toList()); + return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u, PreInsAcceptancePersonVO.class)).collect(Collectors.toList()); } private List convertPayments(List payments, BigDecimal totalAmount) { - if(CollUtil.isEmpty(payments)){ + if (CollUtil.isEmpty(payments)) { return Collections.emptyList(); } return payments.stream().map(p -> { PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); - vo.setRatio((Objects.isNull(totalAmount)||totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" + vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" : p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) - .divide(totalAmount,BigDecimal.ROUND_CEILING,BigDecimal.ROUND_CEILING) + "%"); + .divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%"); return vo; }) .collect(Collectors.toList()); @@ -1102,6 +1105,7 @@ public class ProjectLibManage { /** * 历史版本 项目列表 + * * @param id * @return */ @@ -1109,7 +1113,7 @@ public class ProjectLibManage { JSONObject res = new JSONObject(); Project project = projectService.getById(id); - if(Objects.isNull(project)){ + if (Objects.isNull(project)) { return res; } @@ -1117,25 +1121,26 @@ public class ProjectLibManage { .eq(Project::getProjectCode, project.getProjectCode()) .orderByDesc(Project::getCreateOn)); - if(CollUtil.isEmpty(historyProjects)){ + if (CollUtil.isEmpty(historyProjects)) { return res; } - List basicProjects = historyProjects.stream() + List basicProjects = historyProjects.stream() .map(p -> this.getProjectDetailThisVersion(p.getId())) .filter(p -> Objects.isNull(p.getIsConstruct()) || !p.getIsConstruct()) .collect(Collectors.toList()); - List constructProjects = historyProjects.stream() + List constructProjects = historyProjects.stream() .map(p -> this.getProjectDetailThisVersion(p.getId())) .filter(p -> Objects.nonNull(p.getIsConstruct()) && p.getIsConstruct()) .collect(Collectors.toList()); - res.put(ProjectConstant.ProjectLib.PROJECT_BASIC,basicProjects); - res.put(ProjectConstant.ProjectLib.PROJECT_CONSTRUCT,constructProjects); + res.put(ProjectConstant.ProjectLib.PROJECT_BASIC, basicProjects); + res.put(ProjectConstant.ProjectLib.PROJECT_CONSTRUCT, constructProjects); return res; } /** * 查看 项目的 变更记录(驳回 重新发起的 和上个版本的变更字段) + * * @param projectId * @return */ @@ -1150,7 +1155,7 @@ public class ProjectLibManage { //2.要判断 项目在当前状态 有没有被驳回和退回过 //当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 Boolean isChangeRecord = todoService.isChangeRecord(projectId); - if(!isChangeRecord){ + if (!isChangeRecord) { return res; } @@ -1160,18 +1165,18 @@ public class ProjectLibManage { .eq(Project::getProjectCode, projectCode) .orderByDesc(Project::getVersion) .last("limit 2")); - if(CollUtil.isEmpty(twoVersions) || twoVersions.size() < 2){ + if (CollUtil.isEmpty(twoVersions) || twoVersions.size() < 2) { return res; } Project lastProject = twoVersions.get(1); Project thisProject = twoVersions.get(0); res.put(ProjectConstant.ProjectLib.CHANGES_KEY, - new CompareUtils().compareToJson(thisProject, lastProject,null)); + new CompareUtils().compareToJson(thisProject, lastProject, null)); ProcessDetailReq req = new ProcessDetailReq(); req.setProjectId(lastProject.getId()); req.setInstanceId(lastProject.getInstCode()); - res.put(ProjectConstant.ProjectLib.PROCESS_KEY,todoService.getProcessDetail(req)); + res.put(ProjectConstant.ProjectLib.PROCESS_KEY, todoService.getProcessDetail(req)); return res; } } 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 49349e4..21ded6a 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 @@ -369,7 +369,7 @@ public class ProjectDetailVO { private ContractVO contract; @ApiModelProperty("采购信息") - private PurchaseVO purchase; + private List purchases; @ApiModelProperty("初审人员") private List acceptancePersons; @@ -400,7 +400,7 @@ public class ProjectDetailVO { this.versionStr = "当前版本"; return this.versionStr; } - this.versionStr = "v" + NdDateUtils.format(this.createOn,"yyyyMMddHHmmss"); + this.versionStr = "v" + NdDateUtils.format(this.createOn, "yyyyMMddHHmmss"); return this.versionStr; }