【网关对接】修改申请字段以及流程调整
This commit is contained in:
parent
917bd4521e
commit
06085b9eea
|
@ -53,6 +53,13 @@ import java.util.*;
|
|||
*/
|
||||
@Service
|
||||
public class ActTaskService extends BaseServiceImpl {
|
||||
|
||||
public static String Task_HANDLE_STATE = "handleState"; //任务节点处理状态key
|
||||
public static String Task_HANDLE_STATE_AGREE = "agree"; //同意
|
||||
public static String Task_HANDLE_STATE_REJECTED = "rejected"; //驳回
|
||||
public static String Task_HANDLE_STATE_BACK = "back"; //回退
|
||||
public static String Task_HANDLE_STATE_STOP = "stop"; //终止
|
||||
|
||||
@Autowired
|
||||
protected TaskService taskService;
|
||||
@Autowired
|
||||
|
@ -210,6 +217,7 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
if (StringUtils.isNotEmpty(comment)) {
|
||||
taskService.addComment(taskId, task.getProcessInstanceId(), comment);
|
||||
}
|
||||
taskService.setVariable(taskId, Task_HANDLE_STATE, Task_HANDLE_STATE_AGREE);
|
||||
taskService.complete(taskId);
|
||||
}
|
||||
|
||||
|
@ -374,6 +382,7 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
if (StringUtils.isNotEmpty(comment)) {
|
||||
commentMode += "[" + comment + "]";
|
||||
}
|
||||
taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_BACK);
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), commentMode);
|
||||
taskService.complete(task.getId(), variables);
|
||||
}
|
||||
|
@ -461,6 +470,7 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
String message = MessageUtils.getMessage(ErrorCode.END_PROCESS_MESSAGE);
|
||||
comment = message + "[" + comment + "]";
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
|
||||
taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_STOP);
|
||||
taskService.complete(taskId);
|
||||
pointActivity.getIncomingTransitions().remove(newTransition);
|
||||
List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions();
|
||||
|
@ -590,6 +600,7 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
this.setTaskVariable(taskDTO.getTaskId(), key, taskDTO.getParams().get(key));
|
||||
}
|
||||
}
|
||||
taskService.setVariable(taskDTO.getTaskId(), Task_HANDLE_STATE, Task_HANDLE_STATE_REJECTED);
|
||||
this.completeTask(taskDTO.getTaskId(), taskDTO.getComment());
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ public class TAbilityApplicationEntity {
|
|||
/**
|
||||
* 申请应用系统
|
||||
*/
|
||||
@TableField("`system`")
|
||||
private String system;
|
||||
/**
|
||||
* 申请场景
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.renren.modules.processForm.listener;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import io.renren.modules.activiti.service.ActTaskService;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.processForm.service.ApiGatewayService;
|
||||
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||
|
@ -15,19 +16,24 @@ import io.renren.modules.sys.service.SysDeptService;
|
|||
import io.renren.modules.sys.service.SysRoleService;
|
||||
import io.renren.modules.sys.service.SysRoleUserService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.ProcessEngine;
|
||||
import org.activiti.engine.ProcessEngines;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.delegate.*;
|
||||
import org.activiti.engine.delegate.event.ActivitiEvent;
|
||||
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 部门动态审批人
|
||||
|
@ -46,6 +52,8 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
|||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private SysRoleUserService sysRoleUserService;
|
||||
|
@ -68,6 +76,9 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
|||
case EVENTNAME_CREATE:
|
||||
create(delegateTask);
|
||||
break;
|
||||
case EVENTNAME_COMPLETE:
|
||||
complete(delegateTask);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
logger.error("-------------------------结束部门动态审批人流程-------------------------------");
|
||||
|
@ -80,7 +91,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
|||
final String eventName = delegateExecution.getEventName();
|
||||
switch (eventName) {
|
||||
case EVENTNAME_END:
|
||||
endTake(delegateExecution.getVariables());
|
||||
endTake(delegateExecution);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -105,9 +116,10 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
|||
/**
|
||||
* 结束审批
|
||||
*
|
||||
* @param kv
|
||||
* @param delegateExecution
|
||||
*/
|
||||
private void endTake(Map<String, Object> kv) { // 进入最后结束节点
|
||||
private void endTake(DelegateExecution delegateExecution) { // 进入最后结束节点
|
||||
Map<String, Object> kv = delegateExecution.getVariables();
|
||||
Gson gson = new Gson();
|
||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
||||
|
@ -169,16 +181,27 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批通过,申请code
|
||||
* @param delegateTask
|
||||
*/
|
||||
private void complete(DelegateTask delegateTask) {
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
|
||||
//如果有code说明已经注册过了,以及只有通过的流程申请
|
||||
if (kv.get("gatewayCode") != null ||
|
||||
!ActTaskService.Task_HANDLE_STATE_AGREE.equals(kv.get(ActTaskService.Task_HANDLE_STATE))) return;
|
||||
|
||||
Gson gson = new Gson();
|
||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
||||
applyCode(delegateTask, abilityApplicationDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批通过,申请code
|
||||
* @param delegateTask
|
||||
* @param abilityApplicationDTO
|
||||
*/
|
||||
private void applyCode(DelegateTask delegateTask, TAbilityApplicationDTO abilityApplicationDTO) {
|
||||
|
||||
logger.info("-------能力申请code-------");
|
||||
ResourceEntity resourceEntity = resourceService.selectById(abilityApplicationDTO.getResourceId());
|
||||
|
||||
//没有groupid当做没有接口,直接跳过
|
||||
|
@ -192,7 +215,9 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
|||
|
||||
String apiPrefix = "/juapi/" + abilityApplicationDTO.getResourceId();
|
||||
TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
|
||||
String msg = String.format("您的能力申请已通过,接口认证code为:%s, 接口公共前缀为:%s",code, apiPrefix) ;
|
||||
String msg = String.format("您的能力申请已通过,接口认证code为:%s, 接口公共前缀为:%s",code, apiPrefix);
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), msg);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.renren.modules.resourceMountApply.listener;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import io.renren.modules.activiti.service.ActTaskService;
|
||||
import io.renren.modules.processForm.service.ApiGatewayService;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
|
@ -137,7 +138,10 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
|
|||
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||
TResourceMountApplyDTO resourceMountApplyDTO = gson.fromJson(jsonElement, TResourceMountApplyDTO.class);
|
||||
Long resourceID = resourceMountApplyDTO.getResourceDTO().getId();
|
||||
apiGatewayService.registerApi2Gateway(String.valueOf(resourceID));
|
||||
|
||||
if (ActTaskService.Task_HANDLE_STATE_AGREE.equals(kv.get(ActTaskService.Task_HANDLE_STATE))) {
|
||||
apiGatewayService.registerApi2Gateway(String.valueOf(resourceID));
|
||||
}
|
||||
|
||||
ResourceDTO re = resourceMountApplyDTO.getResourceDTO();
|
||||
if (re != null) {
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
server:
|
||||
port: 8000
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
#MySQL
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: 123456
|
||||
initial-size: 10
|
||||
max-active: 100
|
||||
min-idle: 10
|
||||
max-wait: 3000
|
||||
pool-prepared-statements: true
|
||||
max-pool-prepared-statement-per-connection-size: 20
|
||||
time-between-eviction-runs-millis: 60000
|
||||
min-evictable-idle-time-millis: 300000
|
||||
#Oracle需要打开注释
|
||||
validation-query: SELECT 1
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
#login-username: admin
|
||||
#login-password: admin
|
||||
filter:
|
||||
stat:
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: false
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
#上传的静态资源配置
|
||||
resource:
|
||||
root_url: 15.2.21.238
|
||||
path: /data/services/nengli/files/
|
||||
devModelFilePath: /data/services/nengli/files/devModelFile
|
||||
# 大数据部门相关配置
|
||||
big_date:
|
||||
name: 青岛市大数据发展管理局
|
||||
assignee_role_name: 部门审批人
|
||||
|
||||
hisense:
|
||||
gateway:
|
||||
# url: http://15.72.184.7:8080
|
||||
url: http://devtest-security-app.hismarttv.com:8080
|
||||
logging:
|
||||
level:
|
||||
org:
|
||||
activiti:
|
||||
engine:
|
||||
impl:
|
||||
persistence:
|
||||
entity: debug
|
|
@ -25,7 +25,7 @@ public class ApiGatewayServiceTest {
|
|||
@Test
|
||||
public void registerCode2Group() {
|
||||
String code = UUID.randomUUID().toString();
|
||||
apiGatewayService.subscribeCode("1522550733273112577", code);
|
||||
apiGatewayService.subscribeCode("1523913824099762177", code);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue