From 1b0820a5aa99c2047797bc0723d19883175322d7 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 1 Feb 2023 16:41:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=A1=B9=E7=9B=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmapi/pom.xml | 6 ++- .../common/constant/ProjectDeclareConstants.java | 2 +- .../controller/DeclaredProjectController.java | 53 ++++++++++++++++++++ .../entity/dto/DeclaredProjectParamDto.java | 34 +++++++++++++ .../declared/manage/DeclaredProjectManage.java | 56 ++++++++++++++++++++++ .../controller/OrganizationProcdefController.java | 4 +- .../pmapi/sys/controller/SysProcdefController.java | 4 +- 7 files changed, 153 insertions(+), 6 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/declared/controller/DeclaredProjectController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectParamDto.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/declared/manage/DeclaredProjectManage.java diff --git a/pmapi/pom.xml b/pmapi/pom.xml index bbc5acf..3748d36 100644 --- a/pmapi/pom.xml +++ b/pmapi/pom.xml @@ -258,6 +258,11 @@ nd-file-starter 1.0.0 + + com.ningdatech + nd-zwdd-starter + 1.0.0 + @@ -337,7 +342,6 @@ org.apache.maven.plugins maven-surefire-plugin - true diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java index 0f18c2b..d0409a0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java @@ -34,7 +34,7 @@ public interface ProjectDeclareConstants { // 是否首次新建 public static final String FIRST_NEW_CONSTRUCTION = "firstNewConstruction"; // 预算年度 - public static final String BUDGET_YEAR = "budgetYear"; + public static final String BUDGET_YEAR = "projectYear"; // 建设开始时间 public static final String CONSTRUCTION_START_TIME = "constructionStartTime"; // 建设结束时间 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/declared/controller/DeclaredProjectController.java b/pmapi/src/main/java/com/ningdatech/pmapi/declared/controller/DeclaredProjectController.java new file mode 100644 index 0000000..cabc31e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/declared/controller/DeclaredProjectController.java @@ -0,0 +1,53 @@ +package com.ningdatech.pmapi.declared.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.declared.entity.dto.DeclaredProjectParamDto; +import com.ningdatech.pmapi.declared.manage.DeclaredProjectManage; +import com.wflow.bean.vo.NdDeclaredProjectVo; +import com.wflow.workflow.bean.vo.ProcessStartParamsVo; +import com.wflow.workflow.service.ProcessInstanceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * @Classname DeclaredProjectController + * @Description 申报项目 + * @Date 2023/1/31 11:29 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/declared") +@Api(value = "DeclaredProject", tags = "申报管理-申报项目") +@RequiredArgsConstructor +public class DeclaredProjectController { + private final ProcessInstanceService processService; + + private final DeclaredProjectManage declaredProjectManage; + + @ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") + @GetMapping("/list") + public PageVo list(@Validated @ModelAttribute DeclaredProjectParamDto params) {; + return declaredProjectManage.page(params); + } + + @ApiOperation(value = "申报项目草稿箱", notes = "申报项目草稿箱") + @GetMapping("/draft") + public PageVo draft(@Validated @ModelAttribute ProcessStartParamsVo params) { + return PageVo.empty(); + } + + @ApiOperation(value = "申报项目", notes = "申报项目") + @PostMapping("/start/{defId}") + public String startTheProcess(@PathVariable String defId, + @RequestBody ProcessStartParamsVo params) { + String instanceId = processService.startProcess(defId, params); + return "启动流程实例 " + instanceId + " 成功"; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectParamDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectParamDto.java new file mode 100644 index 0000000..04f1a2b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectParamDto.java @@ -0,0 +1,34 @@ +package com.ningdatech.pmapi.declared.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname DeclaredProjectParamDto + * @Description + * @Date 2023/2/1 14:52 + * @Author PoffyZhang + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeclaredProjectParamDto extends PagePo { + + private String projectName; + + private Integer projectType; + + private Integer projectStatusFirst; + + private Integer projectStatusSecond; + + private Integer projectYear; + + private String startTime; + + private String endTime; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/declared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/declared/manage/DeclaredProjectManage.java new file mode 100644 index 0000000..0e8f80d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/declared/manage/DeclaredProjectManage.java @@ -0,0 +1,56 @@ +package com.ningdatech.pmapi.declared.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.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.declared.entity.dto.DeclaredProjectParamDto; +import com.wflow.bean.entity.NdDeclaredProject; +import com.wflow.bean.vo.NdDeclaredProjectVo; +import com.wflow.service.NdDeclaredProjectService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname DeclaredProjectManage + * @Description + * @Date 2023/2/1 14:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class DeclaredProjectManage { + + private final NdDeclaredProjectService declaredProjectService; + + public PageVo page(DeclaredProjectParamDto params) { + Page page = params.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdDeclaredProject.class) + .ge(Objects.nonNull(params.getStartTime()), NdDeclaredProject::getCreateOn, params.getStartTime()) + .le(Objects.nonNull(params.getEndTime()), NdDeclaredProject::getCreateOn, params.getEndTime()) + .eq(Objects.nonNull(params.getProjectType()), NdDeclaredProject::getProjectType, params.getProjectType()) + .eq(Objects.nonNull(params.getProjectYear()), NdDeclaredProject::getProjectYear, params.getProjectYear()) + .eq(Objects.nonNull(params.getProjectStatusFirst()), NdDeclaredProject::getProjectStatusFirst, params.getProjectStatusFirst()) + .eq(Objects.nonNull(params.getProjectStatusSecond()), NdDeclaredProject::getProjectStatusSecond, params.getProjectStatusSecond()) + .like(StringUtils.isNotBlank(params.getProjectName()), NdDeclaredProject::getProjectName, params.getProjectName()) + .orderByDesc(NdDeclaredProject::getUpdateOn); + declaredProjectService.page(page,wrapper); + if(0L == page.getTotal()){ + return PageVo.empty(); + } + List res = page.getRecords().stream().map(record -> { + NdDeclaredProjectVo vo = new NdDeclaredProjectVo(); + BeanUtils.copyProperties(record, vo); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationProcdefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationProcdefController.java index ec2c093..92e7e96 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationProcdefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationProcdefController.java @@ -34,9 +34,9 @@ public class OrganizationProcdefController { @ApiOperation(value = "单位流程配置列表", notes = "单位流程配置列表") @GetMapping("/list") - public PageVo list(@RequestParam String orgCode, @RequestParam(defaultValue = "1") Integer pageNum, + public PageVo list(@RequestParam String orgCode, @RequestParam(defaultValue = "1") Integer pageNumber, @RequestParam(defaultValue = "10") Integer pageSize) { - return orgProcdefService.getOrgProcessByOrgCode(orgCode, pageNum, pageSize); + return orgProcdefService.getOrgProcessByOrgCode(orgCode, pageNumber, pageSize); } @ApiOperation(value = "单位流程配置详情", notes = "单位流程配置详情") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java index 63375a3..6e93851 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java @@ -33,9 +33,9 @@ public class SysProcdefController { @ApiOperation(value = "系统流程配置列表", notes = "系统流程配置列表") @GetMapping("/list") - public PageVo list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNum, + public PageVo list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNumber, @RequestParam(defaultValue = "10") Integer pageSize) { - return modelGroupService.getModelsPage(regionCode,pageNum,pageSize); + return modelGroupService.getModelsPage(regionCode,pageNumber,pageSize); } @ApiOperation(value = "系统流程配置详情", notes = "系统流程配置详情")