集成CID仿真评审流
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.sdm.grpc.server;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.grpc.lib.ApproveFlowReply;
|
||||
import com.sdm.grpc.lib.ApproveFlowRequest;
|
||||
import com.sdm.grpc.lib.ApproveFlowServiceGrpc;
|
||||
import com.sdm.system.service.ISimulatinoApprovalService;
|
||||
import com.sdm.system.service.impl.SimulationApproveServiceImpl;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.devh.boot.grpc.server.service.GrpcService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@Slf4j
|
||||
@GrpcService
|
||||
public class CidApproveFlowServer extends ApproveFlowServiceGrpc.ApproveFlowServiceImplBase{
|
||||
|
||||
public CidApproveFlowServer(){
|
||||
log.info("CidApproveFlowServer init");
|
||||
}
|
||||
@Autowired
|
||||
ISimulatinoApprovalService approvalService ;
|
||||
@Override
|
||||
public void launchApproveFlow(ApproveFlowRequest request, StreamObserver<ApproveFlowReply> responseObserver) {
|
||||
String approveTitle = request.getApproveTitle();
|
||||
int innerFlowId = request.getInnerFlowId();
|
||||
String comment = request.getComment();
|
||||
int approveType = request.getApproveType();
|
||||
String tenantId = request.getTenantId();
|
||||
String user = request.getUser();
|
||||
String replayUrl = request.getReplayUrl();
|
||||
|
||||
|
||||
|
||||
//responseObserver.onNext(reply.build());
|
||||
//responseObserver.onCompleted();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.sdm.grpc.server;
|
||||
|
||||
import com.sdm.grpc.lib.ApproveFlowServiceGrpc;
|
||||
import com.sdm.grpc.lib.ApproveNoticeReply;
|
||||
import com.sdm.grpc.lib.ApproveResultRequest;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import net.devh.boot.grpc.server.service.GrpcService;
|
||||
|
||||
public class ReceiveCidApproveFlowNoticeService{// extends ApproveFlowServiceGrpc.ApproveFlowServiceImplBase {
|
||||
//@Override
|
||||
public void approveFlowResultNotice(ApproveResultRequest request, StreamObserver<ApproveNoticeReply> responseObserver) {
|
||||
int approveStatus = request.getApproveStatus();
|
||||
int innerApproveId = request.getInnerFlowId();
|
||||
/******* ToDo ********/
|
||||
/*********************/
|
||||
ApproveNoticeReply.Builder reply = ApproveNoticeReply.newBuilder();
|
||||
reply.setInnerFlowId(innerApproveId);
|
||||
reply.setSuccess(true);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.system.model.entity.ApproveFlowBean;
|
||||
import com.sdm.system.service.ISimulatinoApprovalService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -26,7 +25,7 @@ public class SystemApproveController {
|
||||
|
||||
@PostMapping("/launchApprove")
|
||||
public SdmResponse launchApproval(@RequestBody ApproveFlowBean flowBean){
|
||||
return approveServer.launchApproval(flowBean.approveTitle,flowBean.approveType,flowBean.innerFlowId,flowBean.comment);
|
||||
return approveServer.launchApproval(flowBean.approveTitle,flowBean.templateName,flowBean.templateId,flowBean.approveType,flowBean.innerFlowId,flowBean.comment,flowBean.replyUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,11 +38,26 @@ public class SystemApproveController {
|
||||
return approveServer.receiveApprovalResult(flowBean.cidFlowId,flowBean.approveStatus);
|
||||
}
|
||||
|
||||
/*@PostMapping("/stopApprove")
|
||||
public SdmResponse stopApproval(@Param("flowId") String flowId, @Param("userId") String userId) {
|
||||
approveServer.stopCidApprovalFlow(flowId,userId);
|
||||
@GetMapping("queryApproveFlowStatus")
|
||||
public SdmResponse queryApproveFlowStatus(@RequestParam("flowId") String flowId) {
|
||||
return approveServer.queryApproveFlowStatus(flowId);
|
||||
}
|
||||
|
||||
@PostMapping("/stopApprove")
|
||||
public SdmResponse stopApproval(@RequestParam ("flowId") String flowId) {
|
||||
return approveServer.stopCidApprovalFlow(flowId);
|
||||
}
|
||||
|
||||
@PostMapping("/approveInnerNotice")
|
||||
public SdmResponse systemApproveInnerNotice(@RequestBody ApproveFlowBean flowBean) {
|
||||
return SdmResponse.success();
|
||||
}*/
|
||||
}
|
||||
|
||||
@GetMapping("/queryApproveFlowTempalte")
|
||||
public SdmResponse queryApproveFlowTemplate()
|
||||
{
|
||||
return approveServer.queryApprovalTemplates();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,12 +13,15 @@ import java.util.List;
|
||||
public interface SimulationApproveMapper {
|
||||
|
||||
|
||||
@Insert("INSERT INTO simulation_approve_flow(innerFlowId,cidFlowId,approveTitle,approveStatus,approveType,comment,creator) VALUES (#{flowBean.innerFlowId},#{flowBean.cidFlowId},#{flowBean.approveTitle},#{flowBean.approveStatus},#{flowBean.approveType},#{flowBean.comment},#{flowBean.creator})")
|
||||
@Insert("INSERT INTO simulation_approve_flow(innerFlowId,cidFlowId,templateName,templateId,approveTitle,approveStatus,approveType,comment,tenantId,userId,replyUrl,creator) VALUES (#{flowBean.innerFlowId},#{flowBean.cidFlowId},#{flowBean.templateName},#{flowBean.templateId},#{flowBean.approveTitle},#{flowBean.approveStatus},#{flowBean.approveType},#{flowBean.comment},#{flowBean.tenantId},#{flowBean.userId},#{flowBean.replyUrl},#{flowBean.creator})")
|
||||
int addSimulationApproveFlow(@Param("flowBean") ApproveFlowBean flowBean);
|
||||
|
||||
@Update("UPDATE simulation_approve_flow SET approveStatus=#{status} WHERE cidFlowId=#{cidFlowId}")
|
||||
int updateSimulationApproveFlowStatus(@Param("cidFlowId") String cidFlowId,@Param("status") int status);
|
||||
|
||||
@Update("UPDATE simulation_approve_flow SET replyStatus=#{replyStatus} WHERE cidFlowid=#{cidFlowId}")
|
||||
int updateSimulationApproveFlowReplyStatus(@Param("cidFlowId") String cidFlowId,@Param("replyStatus") int replyStatus);
|
||||
|
||||
@Select("SELECT * FROM simulation_approve_flow WHERE innerFlowId=#{flowId}")
|
||||
ApproveFlowBean querySimulationApproveFlowByInnerFlowId(@Param("flowId") int flowId);
|
||||
|
||||
|
||||
@@ -21,6 +21,18 @@ public class ApproveFlowBean extends BaseBean {
|
||||
|
||||
public String comment; //审批描述
|
||||
|
||||
public long tenantId; //租户ID
|
||||
|
||||
public String replyUrl; //审批回复URL
|
||||
|
||||
public String templateName; //模版名称
|
||||
|
||||
public String templateId; //评审流程模版ID
|
||||
|
||||
public int replyStatus; //审批回复状态 0:未回复 1:已回复
|
||||
|
||||
public long userId; //用户ID
|
||||
|
||||
public String creator; //审批创建者
|
||||
|
||||
public String createTime; //审批创建时间
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.sdm.system.model.entity;
|
||||
|
||||
public class ApproveTemplateBean {
|
||||
public String templateId;
|
||||
public String templateName;
|
||||
}
|
||||
@@ -2,9 +2,6 @@ package com.sdm.system.service;
|
||||
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.utils.SystemOperate;
|
||||
import com.sdm.system.model.entity.AppCenterItemBean;
|
||||
import com.sdm.system.model.entity.AppConfigureBean;
|
||||
import com.sdm.system.model.entity.ApproveFlowBean;
|
||||
|
||||
/**
|
||||
@@ -18,14 +15,16 @@ import com.sdm.system.model.entity.ApproveFlowBean;
|
||||
public interface ISimulatinoApprovalService {
|
||||
|
||||
|
||||
SdmResponse queryApprovalTemplates(String group,String tenantId);
|
||||
SdmResponse queryApprovalTemplates();
|
||||
|
||||
boolean stopCidApprovalFlow(String flowId,String userId,String url);
|
||||
SdmResponse stopCidApprovalFlow(String flowId);
|
||||
|
||||
SdmResponse launchApproval(String approveTitle,int approveType,int innerFlowId,String comment);
|
||||
SdmResponse launchApproval(String approveTitle,String templateName,String templateId,int approveType,int innerFlowId,String comment,String replayUrl);
|
||||
|
||||
SdmResponse receiveApprovalResult(String cidFlowId,int status);
|
||||
|
||||
SdmResponse approvalResultNotice(ApproveFlowBean flowBean);
|
||||
|
||||
SdmResponse queryApproveFlowStatus(String flowId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
package com.sdm.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.utils.HttpClientUtil;
|
||||
import com.sdm.system.dao.SimulationApproveMapper;
|
||||
import com.sdm.system.model.entity.ApproveConfigBean;
|
||||
import com.sdm.system.model.entity.ApproveFlowBean;
|
||||
import com.sdm.system.model.entity.ApproveTemplateBean;
|
||||
import com.sdm.system.service.ISimulatinoApprovalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -20,12 +27,27 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
@Autowired
|
||||
private HttpClientUtil httpClientUtil;
|
||||
|
||||
|
||||
@Autowired
|
||||
private SimulationApproveMapper approveMapper;
|
||||
@Override
|
||||
public SdmResponse queryApprovalTemplates(String group, String tenantId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Value("${cid.url}")
|
||||
private String cidUrl;
|
||||
|
||||
@Value("${cid.flow.queryFlowTemplate}")
|
||||
private String queryFlowTemplatePath;
|
||||
|
||||
@Value("${cid.flow.launchApprove}")
|
||||
private String launchApprovePath;
|
||||
|
||||
@Value("${cid.flow.queryApproveDetail}")
|
||||
private String queryFlowDetailPath;
|
||||
|
||||
@Value("${cid.flow.stopApproveFlow}")
|
||||
private String stopFlowPath;
|
||||
|
||||
@Value("${cid.flow.group}")
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 向CID发起审批流程
|
||||
@@ -33,7 +55,7 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
* @param userId
|
||||
* @return string 返回审批流ID
|
||||
*/
|
||||
private String launchCidApprovalFlow(String flowId,String userId,String tenantId,String url)
|
||||
private String launchCidApprovalFlow(String flowId,long userId,long tenantId,String url)
|
||||
{
|
||||
JSONObject paramJson = new JSONObject();
|
||||
paramJson.put("flowId",flowId);
|
||||
@@ -41,7 +63,7 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
paramJson.put("tenantId",tenantId);
|
||||
String cidFlowId = "";
|
||||
try {
|
||||
String resultString = httpClientUtil.doPostJson(url+"/startFlow", paramJson.toJSONString());
|
||||
String resultString = httpClientUtil.doPostJson(url, paramJson.toJSONString());
|
||||
if (resultString != null && !resultString.isEmpty()) {
|
||||
JSONObject resultJson = JSONObject.parseObject(resultString);
|
||||
if (resultJson != null && resultJson.containsKey("success")) {
|
||||
@@ -60,22 +82,59 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止cid评审流程
|
||||
* 获取Cid评审流程状态
|
||||
* @param flowId
|
||||
* @param userId
|
||||
* @param tenantId
|
||||
* @return
|
||||
*/
|
||||
public boolean stopCidApprovalFlow(String flowId,String userId,String url)
|
||||
private JSONArray queryCidApproveFlowStatus(String flowId, String templateId, long tenantId, String url)
|
||||
{
|
||||
JSONObject paramJson = new JSONObject();
|
||||
paramJson.put("flowId",templateId);
|
||||
paramJson.put("processInstanceId",flowId);
|
||||
paramJson.put("userId",userId);
|
||||
paramJson.put("tenantId",tenantId);
|
||||
JSONArray array = null;
|
||||
try {
|
||||
String resultString = httpClientUtil.doPostJson(url+"/stopFlow", paramJson.toJSONString());
|
||||
String resultString = httpClientUtil.doPostJson(url, paramJson.toJSONString());
|
||||
if (resultString != null && !resultString.isEmpty()) {
|
||||
JSONObject resultJson = JSONObject.parseObject(resultString);
|
||||
if (resultJson != null && resultJson.containsKey("success")) {
|
||||
return resultJson.getBoolean("success");
|
||||
boolean success = resultJson.getBoolean("success");
|
||||
if (success) {
|
||||
array = resultJson.getJSONArray("data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止CID评审流程
|
||||
* @param cidFlowId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
private boolean stopCidApprovalFlow(String cidFlowId,long userId)
|
||||
{
|
||||
JSONObject paramJson = new JSONObject();
|
||||
paramJson.put("processInstanceId", cidFlowId);
|
||||
paramJson.put("userId", userId);
|
||||
try
|
||||
{
|
||||
String url = cidUrl + stopFlowPath;
|
||||
String resultString = httpClientUtil.doPostJson(url, paramJson.toJSONString());
|
||||
if (resultString != null && !resultString.isEmpty()) {
|
||||
JSONObject resultJson = JSONObject.parseObject(resultString);
|
||||
if (resultJson != null && resultJson.containsKey("success")) {
|
||||
if(resultJson.getBoolean("success"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +145,40 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止cid评审流程
|
||||
* @param flowId
|
||||
* @return
|
||||
*/
|
||||
public SdmResponse stopCidApprovalFlow(String flowId)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
ApproveFlowBean flowBean = approveMapper.querySimulationApproveFlowByCidFlowId(flowId);
|
||||
if (flowBean == null) {
|
||||
response = SdmResponse.failed("评审流程不存在");
|
||||
}
|
||||
else {
|
||||
JSONObject paramJson = new JSONObject();
|
||||
paramJson.put("processInstanceId", flowBean.cidFlowId);
|
||||
paramJson.put("userId", flowBean.creator);
|
||||
try
|
||||
{
|
||||
String url = cidUrl+stopFlowPath;
|
||||
String resultString = httpClientUtil.doPostJson(url, paramJson.toJSONString());
|
||||
if (resultString != null && !resultString.isEmpty()) {
|
||||
JSONObject resultJson = JSONObject.parseObject(resultString);
|
||||
if (resultJson == null || !resultJson.containsKey("success")) {
|
||||
response = SdmResponse.failed("停止评审失败");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发起审批流
|
||||
@@ -96,15 +189,16 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SdmResponse launchApproval(String approveTitle, int approveType, int approveId,String comment) {
|
||||
public SdmResponse launchApproval(String approveTitle,String templateName,String templateId, int approveType, int approveId,String comment,String replayUrl) {
|
||||
|
||||
|
||||
SdmResponse sdmResponse = SdmResponse.success();
|
||||
ApproveConfigBean configBean = approveMapper.querySimulationApproveConfig(approveType);
|
||||
if(configBean == null){
|
||||
sdmResponse = SdmResponse.failed("评审配置信息不存在");
|
||||
return sdmResponse;
|
||||
}
|
||||
String cidFlowId = launchCidApprovalFlow(configBean.cidFlowTemplate, "1979078323595476993","1979091834410176514",configBean.url);
|
||||
long userId = ThreadLocalContext.getUserId();
|
||||
long tenantId = ThreadLocalContext.getTenantId();
|
||||
String userName = ThreadLocalContext.getUserName();
|
||||
String url = cidUrl+launchApprovePath;
|
||||
|
||||
String cidFlowId = launchCidApprovalFlow(templateId, userId,tenantId,url);
|
||||
if (cidFlowId.isEmpty()) {
|
||||
sdmResponse = SdmResponse.failed("发起Cid审批流程失败");
|
||||
} else {
|
||||
@@ -114,9 +208,16 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
approveFlowBean.approveType = approveType;
|
||||
approveFlowBean.comment = comment;
|
||||
approveFlowBean.innerFlowId = approveId;
|
||||
approveFlowBean.creator = userName;
|
||||
approveFlowBean.tenantId = tenantId;
|
||||
approveFlowBean.replyUrl = replayUrl;
|
||||
approveFlowBean.userId = userId;
|
||||
approveFlowBean.creator = userName;
|
||||
approveFlowBean.templateId = templateId;
|
||||
approveFlowBean.templateName = templateName;
|
||||
if (approveMapper.addSimulationApproveFlow(approveFlowBean) <= 0) {
|
||||
sdmResponse = SdmResponse.failed("保存审批流程失败");
|
||||
if(!stopCidApprovalFlow(cidFlowId,"1979078323595476993",configBean.url))
|
||||
if(!stopCidApprovalFlow(cidFlowId,userId))
|
||||
{
|
||||
log.error("删除CID审批流["+cidFlowId+"]失败");
|
||||
}
|
||||
@@ -129,6 +230,33 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
return sdmResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前评审流程的状态详情
|
||||
* @param flowId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SdmResponse queryApproveFlowStatus( String flowId)
|
||||
{
|
||||
SdmResponse sdmResponse = SdmResponse.success();
|
||||
ApproveFlowBean flowBean = approveMapper.querySimulationApproveFlowByCidFlowId(flowId);
|
||||
if(flowBean == null){
|
||||
sdmResponse = SdmResponse.failed("评审流程不存在");
|
||||
}
|
||||
else
|
||||
{
|
||||
String url = cidUrl+queryFlowDetailPath;
|
||||
JSONArray array = queryCidApproveFlowStatus(flowBean.cidFlowId, flowBean.templateId,flowBean.tenantId,url);
|
||||
if(array != null){
|
||||
sdmResponse.setData(array);
|
||||
}
|
||||
else{
|
||||
sdmResponse = SdmResponse.failed("获取评审流程状态信息失败");
|
||||
}
|
||||
}
|
||||
return sdmResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收CID审批流状态
|
||||
* @param cidFlowId
|
||||
@@ -153,7 +281,10 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
else
|
||||
{
|
||||
if(status > 1) { //评审结束后通知评审发起模块
|
||||
approvalResultNotice(flowBean);
|
||||
if(approvalResultNotice(flowBean).isSuccess())
|
||||
{
|
||||
approveMapper.updateSimulationApproveFlowReplyStatus(cidFlowId,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,8 +298,69 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
*/
|
||||
@Override
|
||||
public SdmResponse approvalResultNotice(ApproveFlowBean flowBean) {
|
||||
return null;
|
||||
SdmResponse sdmResponse = SdmResponse.success();
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("flowId", flowBean.innerFlowId);
|
||||
param.put("approveType", flowBean.approveType);
|
||||
try {
|
||||
String result = httpClientUtil.doPostJson(flowBean.replyUrl, param.toJSONString());
|
||||
if(result == null) {
|
||||
sdmResponse = SdmResponse.failed("发送评审状态通知失败");
|
||||
}
|
||||
else
|
||||
{
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
if(!resultJson.containsKey("success")) {
|
||||
sdmResponse = SdmResponse.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sdmResponse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询评审流程模版
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SdmResponse queryApprovalTemplates()
|
||||
{
|
||||
SdmResponse sdmResponse = SdmResponse.success();
|
||||
long tenantId = ThreadLocalContext.getTenantId();
|
||||
String url = cidUrl+queryFlowTemplatePath+"?groupName="+groupName+"&tenantId="+tenantId;
|
||||
try
|
||||
{
|
||||
String result = httpClientUtil.doGet(url);
|
||||
if(result == null) {
|
||||
sdmResponse = SdmResponse.failed("获取评审流程模版失败");
|
||||
}
|
||||
else {
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
if(!resultJson.containsKey("success")) {
|
||||
sdmResponse = SdmResponse.failed();
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ApproveTemplateBean> templateBeanList = new ArrayList<>();
|
||||
JSONArray dataArray = resultJson.getJSONArray("data");
|
||||
for(int i=0;i<dataArray.size();i++)
|
||||
{
|
||||
JSONObject templateObj = dataArray.getJSONObject(i);
|
||||
ApproveTemplateBean templateBean = new ApproveTemplateBean();
|
||||
templateBean.templateName = templateObj.getString("name");
|
||||
templateBean.templateId = templateObj.getString("flowId");
|
||||
templateBeanList.add(templateBean);
|
||||
}
|
||||
sdmResponse.setData(templateBeanList);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sdmResponse;
|
||||
}
|
||||
}
|
||||
|
||||
52
system/src/main/proto/approve.proto
Normal file
52
system/src/main/proto/approve.proto
Normal file
@@ -0,0 +1,52 @@
|
||||
syntax = "proto3";
|
||||
|
||||
//package com.sdm.grpc.server;
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_package = "com.sdm.grpc.lib";
|
||||
option java_outer_classname = "ApproveFlowProto";
|
||||
|
||||
// The greeting service definition.
|
||||
service ApproveFlowService {
|
||||
//发起评审流程
|
||||
rpc LaunchApproveFlow(ApproveFlowRequest) returns (ApproveFlowReply) {
|
||||
}
|
||||
|
||||
//通知评审结果
|
||||
rpc ApproveFlowResultNotice(ApproveResultRequest) returns(ApproveNoticeReply){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 发起评审请求
|
||||
message ApproveFlowRequest {
|
||||
string approveTitle = 1;
|
||||
int32 approveType = 2;
|
||||
int32 innerFlowId = 3;
|
||||
string comment = 4;
|
||||
string tenantId = 5;
|
||||
string user = 6;
|
||||
string replayUrl = 7;
|
||||
}
|
||||
|
||||
// 发起评审回复
|
||||
message ApproveFlowReply {
|
||||
bool success = 1;
|
||||
string cidFlowId = 2;
|
||||
}
|
||||
|
||||
// 评审状态通知结构
|
||||
message ApproveResultRequest {
|
||||
int32 approveStatus = 1;
|
||||
int32 innerFlowId = 2;
|
||||
}
|
||||
|
||||
// 发起评审回复
|
||||
message ApproveNoticeReply {
|
||||
bool success = 1;
|
||||
int32 innerFlowId = 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -140,4 +140,11 @@ cid:
|
||||
listRoles: /spdm-role/listRoles
|
||||
tenant:
|
||||
getTenantDetailById: /spdm-tenant/getTenantDetailById
|
||||
listTenant: /spdm-tenant/listTenant
|
||||
listTenant: /spdm-tenant/listTenant
|
||||
flow:
|
||||
launchApprove: /spdm-flow/startFlow
|
||||
queryFlowTemplate: /spdm-flow/listProcessByGroup
|
||||
queryApproveDetail: /spdm-flow/queryFlowNodeDetail
|
||||
stopApproveFlow: /spdm-flow/stopFlow
|
||||
group: SPDM
|
||||
|
||||
|
||||
@@ -159,4 +159,11 @@ cid:
|
||||
listRoles: /spdm-role/listRoles
|
||||
tenant:
|
||||
getTenantDetailById: /spdm-tenant/getTenantDetailById
|
||||
listTenant: /spdm-tenant/listTenant
|
||||
listTenant: /spdm-tenant/listTenant
|
||||
|
||||
flow:
|
||||
launchApprove: /spdm-flow/startFlow
|
||||
queryFlowTemplate: /spdm-flow/listProcessByGroup
|
||||
queryApproveDetail: /spdm-flow/queryFlowNodeDetail
|
||||
stopApproveFlow: /spdm-flow/stopFlow
|
||||
group: SPDM
|
||||
Reference in New Issue
Block a user