Browse Source

单位子流程 发布

master
PoffyZhang 1 year ago
parent
commit
46ece12dc1
4 changed files with 73 additions and 11 deletions
  1. +6
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/declared/controller/DeclaredProjectController.java
  2. +33
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectDto.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectListParamDto.java
  4. +33
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/declared/manage/DeclaredProjectManage.java

+ 6
- 8
pmapi/src/main/java/com/ningdatech/pmapi/declared/controller/DeclaredProjectController.java View File

@@ -1,7 +1,8 @@
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.wflow.workflow.bean.vo.ProcessStartParamsVo;
@@ -26,13 +27,11 @@ 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<NdDeclaredProjectVo> list(@Validated @ModelAttribute DeclaredProjectParamDto params) {;
public PageVo<NdDeclaredProjectVo> list(@Validated @ModelAttribute DeclaredProjectListParamDto params) {;
return declaredProjectManage.page(params);
}

@@ -43,10 +42,9 @@ public class DeclaredProjectController {
}

@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 + " 成功";
}
}

+ 33
- 0
pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectDto.java View File

@@ -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<String,Object> formData;

@NotBlank
private String regionCode;
}

pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectParamDto.java → pmapi/src/main/java/com/ningdatech/pmapi/declared/entity/dto/DeclaredProjectListParamDto.java View File

@@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DeclaredProjectParamDto extends PagePo {
public class DeclaredProjectListParamDto extends PagePo {

private String projectName;


+ 33
- 2
pmapi/src/main/java/com/ningdatech/pmapi/declared/manage/DeclaredProjectManage.java View File

@@ -4,16 +4,22 @@ 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.ningdatech.pmapi.declared.entity.dto.DeclaredProjectDto;
import com.ningdatech.pmapi.declared.entity.dto.DeclaredProjectListParamDto;
import com.wflow.bean.entity.NdDeclaredProject;
import com.wflow.bean.entity.WflowModels;
import com.wflow.bean.vo.NdDeclaredProjectVo;
import com.wflow.service.NdDeclaredProjectService;
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.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -31,7 +37,11 @@ public class DeclaredProjectManage {

private final NdDeclaredProjectService declaredProjectService;

public PageVo<NdDeclaredProjectVo> page(DeclaredProjectParamDto params) {
private final ProcessInstanceService processService;

private final ProcessModelService processModelService;

public PageVo<NdDeclaredProjectVo> page(DeclaredProjectListParamDto params) {
Page<NdDeclaredProject> page = params.page();
LambdaQueryWrapper<NdDeclaredProject> wrapper = Wrappers.lambdaQuery(NdDeclaredProject.class)
.ge(Objects.nonNull(params.getStartTime()), NdDeclaredProject::getCreateOn, params.getStartTime())
@@ -53,4 +63,25 @@ public class DeclaredProjectManage {
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

/**
* 启动实例
* @param dto
* @return
*/
public String startTheProcess(DeclaredProjectDto dto) {
String defId = null;
String regionCode = dto.getRegionCode();

processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode,regionCode)
.eq(WflowModels::getFormName,"单位内部审批流程")
.last("limit 1"));

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setDeptId("6179678");
params.setProcessUsers(Collections.emptyMap());
params.setFormData(dto.getFormData());
return processService.startProcess(defId, params);
}
}

Loading…
Cancel
Save