@@ -1,7 +1,8 @@ | |||||
package com.ningdatech.pmapi.declared.controller; | package com.ningdatech.pmapi.declared.controller; | ||||
import com.ningdatech.basic.model.PageVo; | 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.ningdatech.pmapi.declared.manage.DeclaredProjectManage; | ||||
import com.wflow.bean.vo.NdDeclaredProjectVo; | import com.wflow.bean.vo.NdDeclaredProjectVo; | ||||
import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | ||||
@@ -26,13 +27,11 @@ import org.springframework.web.bind.annotation.*; | |||||
@Api(value = "DeclaredProject", tags = "申报管理-申报项目") | @Api(value = "DeclaredProject", tags = "申报管理-申报项目") | ||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class DeclaredProjectController { | public class DeclaredProjectController { | ||||
private final ProcessInstanceService processService; | |||||
private final DeclaredProjectManage declaredProjectManage; | private final DeclaredProjectManage declaredProjectManage; | ||||
@ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") | @ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") | ||||
@GetMapping("/list") | @GetMapping("/list") | ||||
public PageVo<NdDeclaredProjectVo> list(@Validated @ModelAttribute DeclaredProjectParamDto params) {; | |||||
public PageVo<NdDeclaredProjectVo> list(@Validated @ModelAttribute DeclaredProjectListParamDto params) {; | |||||
return declaredProjectManage.page(params); | return declaredProjectManage.page(params); | ||||
} | } | ||||
@@ -43,10 +42,9 @@ public class DeclaredProjectController { | |||||
} | } | ||||
@ApiOperation(value = "申报项目", notes = "申报项目") | @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 + " 成功"; | return "启动流程实例 " + instanceId + " 成功"; | ||||
} | } | ||||
} | } |
@@ -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; | |||||
} |
@@ -16,7 +16,7 @@ import lombok.NoArgsConstructor; | |||||
@Builder | @Builder | ||||
@NoArgsConstructor | @NoArgsConstructor | ||||
@AllArgsConstructor | @AllArgsConstructor | ||||
public class DeclaredProjectParamDto extends PagePo { | |||||
public class DeclaredProjectListParamDto extends PagePo { | |||||
private String projectName; | private String projectName; | ||||
@@ -4,16 +4,22 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.ningdatech.basic.model.PageVo; | 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.NdDeclaredProject; | ||||
import com.wflow.bean.entity.WflowModels; | |||||
import com.wflow.bean.vo.NdDeclaredProjectVo; | import com.wflow.bean.vo.NdDeclaredProjectVo; | ||||
import com.wflow.service.NdDeclaredProjectService; | 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.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.Collections; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | import java.util.Objects; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
@@ -31,7 +37,11 @@ public class DeclaredProjectManage { | |||||
private final NdDeclaredProjectService declaredProjectService; | 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(); | Page<NdDeclaredProject> page = params.page(); | ||||
LambdaQueryWrapper<NdDeclaredProject> wrapper = Wrappers.lambdaQuery(NdDeclaredProject.class) | LambdaQueryWrapper<NdDeclaredProject> wrapper = Wrappers.lambdaQuery(NdDeclaredProject.class) | ||||
.ge(Objects.nonNull(params.getStartTime()), NdDeclaredProject::getCreateOn, params.getStartTime()) | .ge(Objects.nonNull(params.getStartTime()), NdDeclaredProject::getCreateOn, params.getStartTime()) | ||||
@@ -53,4 +63,25 @@ public class DeclaredProjectManage { | |||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
return PageVo.of(res,page.getTotal()); | 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); | |||||
} | |||||
} | } |