Merge branch 'master' into docker_package
This commit is contained in:
commit
00592c3242
|
@ -0,0 +1,110 @@
|
|||
package io.renren.modules.processForm.listener;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.renren.modules.sys.service.SysRoleService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
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.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.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 申请发起人区市管理员审批
|
||||
*/
|
||||
@Component
|
||||
public class ApplyDistrictListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApplyDistrictListener.class);
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
@Value("${big_date.assignee_role_name}")
|
||||
private String roleName; // 具备审批的角色名称
|
||||
|
||||
@Override
|
||||
@ActivitiNoticeOperation(value = "申请发起人区市管理员审批", process = "能力申请流程")
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
logger.error("事件类型:" + delegateTask.getEventName());
|
||||
final String eventName = delegateTask.getEventName();
|
||||
switch (eventName) {
|
||||
case EVENTNAME_CREATE:
|
||||
create(delegateTask);
|
||||
break;
|
||||
case EVENTNAME_COMPLETE:
|
||||
logger.error("----------------------申请发起人区市管理员审批通过-complete------------------------------");
|
||||
break;
|
||||
default:
|
||||
logger.error("未处理该事件:" + eventName);
|
||||
}
|
||||
}
|
||||
|
||||
private void create(DelegateTask delegateTask) {
|
||||
// TODO 暂时使用部门代替行政区
|
||||
String assignee;
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
||||
|
||||
Gson gson = builder.create();
|
||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
||||
|
||||
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(Long.parseLong(abilityApplicationDTO.getUserId())).getDeptId());
|
||||
logger.error("deptDTOId:" + deptDTO.getId());
|
||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.error("roleDTOId:" + roleDTO.getId());
|
||||
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
|
||||
|
||||
if (userDTO != null) {
|
||||
logger.error("审批人id:" + userDTO.getId());
|
||||
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
|
||||
assignee = userDTO.getId().toString();
|
||||
} else {
|
||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||
assignee = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(ActivitiEvent activitiEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFailOnException() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package io.renren.modules.processForm.listener;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.renren.modules.sys.service.SysRoleService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
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.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.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 市级区市管理员审批
|
||||
*/
|
||||
@Component
|
||||
public class CityListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApplyDistrictListener.class);
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
@Value("${big_date.assignee_role_name}")
|
||||
private String roleName; // 具备审批的角色名称
|
||||
|
||||
@Override
|
||||
@ActivitiNoticeOperation(value = "市级区市管理员审批", process = "能力申请流程")
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
logger.error("事件类型:" + delegateTask.getEventName());
|
||||
final String eventName = delegateTask.getEventName();
|
||||
switch (eventName) {
|
||||
case EVENTNAME_CREATE:
|
||||
create(delegateTask);
|
||||
break;
|
||||
case EVENTNAME_COMPLETE:
|
||||
logger.error("----------------------市级区市管理员审批通过-complete------------------------------");
|
||||
break;
|
||||
default:
|
||||
logger.error("未处理该事件:" + eventName);
|
||||
}
|
||||
}
|
||||
|
||||
private void create(DelegateTask delegateTask) {
|
||||
// TODO 暂时使用部门代替市
|
||||
String assignee;
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
||||
|
||||
Gson gson = builder.create();
|
||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
||||
|
||||
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(Long.parseLong(abilityApplicationDTO.getUserId())).getDeptId());
|
||||
logger.error("deptDTOId:" + deptDTO.getId());
|
||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.error("roleDTOId:" + roleDTO.getId());
|
||||
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
|
||||
|
||||
if (userDTO != null) {
|
||||
logger.error("审批人id:" + userDTO.getId());
|
||||
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
|
||||
assignee = userDTO.getId().toString();
|
||||
} else {
|
||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||
assignee = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(ActivitiEvent activitiEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFailOnException() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package io.renren.modules.processForm.listener;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysRoleService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
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.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.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 资源所属区市管理员审批
|
||||
*/
|
||||
@Component
|
||||
public class OwnerDistrictListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApplyDistrictListener.class);
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
@Value("${big_date.assignee_role_name}")
|
||||
private String roleName; // 具备审批的角色名称
|
||||
|
||||
@Override
|
||||
@ActivitiNoticeOperation(value = "资源所属区市管理员审批", process = "能力申请流程")
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
logger.error("事件类型:" + delegateTask.getEventName());
|
||||
final String eventName = delegateTask.getEventName();
|
||||
switch (eventName) {
|
||||
case EVENTNAME_CREATE:
|
||||
create(delegateTask);
|
||||
break;
|
||||
case EVENTNAME_COMPLETE:
|
||||
logger.error("----------------------资源所属区市管理员审批通过-complete------------------------------");
|
||||
break;
|
||||
default:
|
||||
logger.error("未处理该事件:" + eventName);
|
||||
}
|
||||
}
|
||||
|
||||
private void create(DelegateTask delegateTask) {
|
||||
// TODO 暂时使用部门代替资源所属区
|
||||
String assignee;
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
||||
|
||||
Gson gson = builder.create();
|
||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
||||
|
||||
SysDeptDTO deptDTO = abilityApplicationDTO.getResourceOwnerDept();
|
||||
logger.error("deptDTOId:" + deptDTO.getId());
|
||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.error("roleDTOId:" + roleDTO.getId());
|
||||
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
|
||||
|
||||
if (userDTO != null) {
|
||||
logger.error("审批人id:" + userDTO.getId());
|
||||
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
|
||||
assignee = userDTO.getId().toString();
|
||||
} else {
|
||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||
assignee = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(ActivitiEvent activitiEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFailOnException() {
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue