diff --git a/pmapi/pom.xml b/pmapi/pom.xml
index 3748d36..27b7fc7 100644
--- a/pmapi/pom.xml
+++ b/pmapi/pom.xml
@@ -187,10 +187,6 @@
org.slf4j
slf4j-log4j12
-
-
-
-
@@ -203,10 +199,6 @@
-
- com.ningdatech
- nd-flowable-starter
-
com.ningdatech
@@ -235,12 +227,10 @@
com.ningdatech
nd-cache-starter
- 1.0.0
com.ningdatech
nd-basic
- 1.0.0
com.kingbase.dialect
@@ -251,17 +241,14 @@
com.alibaba
easyexcel-core
- 3.1.2
com.ningdatech
nd-file-starter
- 1.0.0
com.ningdatech
- nd-zwdd-starter
- 1.0.0
+ nd-flowable-starter
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
index cabc31e..f559dc8 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/declared/controller/DeclaredProjectController.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/declared/controller/DeclaredProjectController.java
@@ -1,11 +1,11 @@
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.entity.dto.DeclaredProjectDto;
+import com.ningdatech.pmapi.declared.entity.dto.DeclaredProjectListParamDto;
import com.ningdatech.pmapi.declared.manage.DeclaredProjectManage;
-import com.wflow.bean.vo.NdDeclaredProjectVo;
+import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
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;
@@ -26,28 +26,24 @@ import org.springframework.web.bind.annotation.*;
@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) {;
+ public PageVo list(@Validated @ModelAttribute DeclaredProjectListParamDto params) {;
return declaredProjectManage.page(params);
}
@ApiOperation(value = "申报项目草稿箱", notes = "申报项目草稿箱")
@GetMapping("/draft")
- public PageVo draft(@Validated @ModelAttribute ProcessStartParamsVo params) {
+ 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);
+ @PostMapping("/start")
+ public String startTheProcess(@Validated @RequestBody DeclaredProjectDto dto) {
+ String instanceId = declaredProjectManage.startTheProcess(dto);
return "启动流程实例 " + instanceId + " 成功";
}
-
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectDto.java
new file mode 100644
index 0000000..2fa6883
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectDto.java
@@ -0,0 +1,33 @@
+package com.ningdatech.pmapi.declared.entity.dto;
+
+import com.ningdatech.pmapi.projectlib.model.entity.Project;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @Classname DeclaredProjectDto
+ * @Description 申报项目
+ * @Date 2023/2/1 14:52
+ * @Author PoffyZhang
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class DeclaredProjectDto implements Serializable {
+
+ @NotNull
+ private Project projectInfo;
+
+ private Map formData;
+
+ @NotBlank
+ private String regionCode;
+}
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/DeclaredProjectListParamDto.java
similarity index 91%
rename from pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectParamDto.java
rename to pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectListParamDto.java
index 04f1a2b..526e92d 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectParamDto.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectListParamDto.java
@@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
-public class DeclaredProjectParamDto extends PagePo {
+public class DeclaredProjectListParamDto extends PagePo {
private String projectName;
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
index 0e8f80d..cd74382 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/declared/manage/DeclaredProjectManage.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/declared/manage/DeclaredProjectManage.java
@@ -1,20 +1,32 @@
package com.ningdatech.pmapi.declared.manage;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
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 com.ningdatech.pmapi.declared.entity.dto.DeclaredProjectDto;
+import com.ningdatech.pmapi.declared.entity.dto.DeclaredProjectListParamDto;
+import com.ningdatech.pmapi.projectlib.enums.ProjectStatusEnum;
+import com.ningdatech.pmapi.projectlib.model.entity.Project;
+import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
+import com.ningdatech.pmapi.projectlib.service.INdProjectService;
+import com.wflow.bean.entity.WflowModels;
+import com.wflow.exception.BusinessException;
+import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
+import com.wflow.workflow.service.ProcessInstanceService;
+import com.wflow.workflow.service.ProcessModelService;
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.time.LocalDateTime;
+import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -29,28 +41,77 @@ import java.util.stream.Collectors;
@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);
+ private final INdProjectService ndProjectService;
+
+ private final ProcessInstanceService processService;
+
+ private final ProcessModelService processModelService;
+
+ public PageVo page(DeclaredProjectListParamDto params) {
+ Page page = params.page();
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class)
+ .ge(Objects.nonNull(params.getStartTime()), Project::getCreateOn, params.getStartTime())
+ .le(Objects.nonNull(params.getEndTime()), Project::getCreateOn, params.getEndTime())
+ .eq(Objects.nonNull(params.getProjectType()), Project::getProjectType, params.getProjectType())
+ .eq(Objects.nonNull(params.getProjectYear()), Project::getProjectYear, params.getProjectYear())
+ .eq(Objects.nonNull(params.getProjectStatusFirst()), Project::getProjectStatusFirst, params.getProjectStatusFirst())
+ .eq(Objects.nonNull(params.getProjectStatusSecond()), Project::getProjectStatusSecond, params.getProjectStatusSecond())
+ .like(StringUtils.isNotBlank(params.getProjectName()), Project::getProjectName, params.getProjectName())
+ .orderByDesc(Project::getUpdateOn);
+ ndProjectService.page(page,wrapper);
if(0L == page.getTotal()){
return PageVo.empty();
}
- List res = page.getRecords().stream().map(record -> {
- NdDeclaredProjectVo vo = new NdDeclaredProjectVo();
+ List res = page.getRecords().stream().map(record -> {
+ ProjectLibListItemVO vo = new ProjectLibListItemVO();
BeanUtils.copyProperties(record, vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}
+
+ /**
+ * 启动实例
+ * @param dto
+ * @return
+ */
+ public String startTheProcess(DeclaredProjectDto dto) {
+ String regionCode = dto.getRegionCode();
+
+ WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
+ .eq(WflowModels::getRegionCode, regionCode)
+ .eq(WflowModels::getFormName, "单位内部审批流程")
+ .last("limit 1"));
+
+ if(Objects.isNull(model)){
+ throw new BusinessException(String.format("此 【%s】区域找不到流程配置",regionCode));
+ }
+
+ ProcessStartParamsVo params = new ProcessStartParamsVo();
+ params.setDeptId("6179678");
+ params.setProcessUsers(Collections.emptyMap());
+ dto.getFormData().putAll(
+ JSON.parseObject(JSON.toJSONString(dto.getProjectInfo()), new TypeReference
+
+
+ com.alibaba
+ easyexcel-core
+ 3.1.2
+
+
+ com.ningdatech
+ nd-file-starter
+ 1.0.0
+
+
+ com.ningdatech
+ nd-zwdd-starter
+ 1.0.0
+
+
+ com.ningdatech
+ nd-cache-starter
+ 1.0.0
+
+
+ com.ningdatech
+ nd-log-starter
+ 1.0.0
+