能力上架 所有部门审批人 动态设置
This commit is contained in:
parent
f059f2b76a
commit
453dc0a6d6
|
@ -10,6 +10,8 @@ import io.renren.common.utils.MessageUtils;
|
|||
import io.renren.modules.activiti.dto.TaskDTO;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
||||
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.sys.service.SysRoleUserService;
|
||||
import org.activiti.engine.HistoryService;
|
||||
|
@ -63,6 +65,9 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
@Autowired
|
||||
private TAbilityApplicationService tAbilityApplicationService;
|
||||
|
||||
@Autowired
|
||||
private TResourceMountApplyService tResourceMountApplyService;
|
||||
|
||||
/**
|
||||
* 根据参数获取当前运行的任务信息
|
||||
*
|
||||
|
@ -107,11 +112,17 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
this.convertTaskInfo(task, dto);
|
||||
TAbilityApplicationDTO abilityApplicationDTO =
|
||||
tAbilityApplicationService.get(Long.valueOf(dto.getBusinessKey()));
|
||||
TResourceMountApplyDTO resourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(dto.getBusinessKey()));
|
||||
if (abilityApplicationDTO != null) {
|
||||
ObjectMapper oMapper = new ObjectMapper();
|
||||
Map<String, Object> variables = oMapper.convertValue(abilityApplicationDTO, Map.class);
|
||||
dto.setParams(variables);
|
||||
} else if (resourceMountApplyDTO != null) {
|
||||
ObjectMapper oMapper = new ObjectMapper();
|
||||
Map<String, Object> variables = oMapper.convertValue(resourceMountApplyDTO, Map.class);
|
||||
dto.setParams(variables);
|
||||
}
|
||||
|
||||
listDto.add(dto);
|
||||
}
|
||||
return new PageData<>(listDto, (int) taskQuery.count());
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
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.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
||||
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.SysRoleUserService;
|
||||
|
@ -14,6 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 资源所有者节点审批
|
||||
*/
|
||||
|
@ -51,6 +61,51 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
|
|||
public void notify(DelegateTask delegateTask) {
|
||||
logger.error("----------------------进入资源所有者节点---------------------------");
|
||||
logger.info("事件类型:" + delegateTask.getEventName());
|
||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.error("roleDTOId:" + roleDTO.getId());
|
||||
final String eventName = delegateTask.getEventName();
|
||||
switch (eventName) {
|
||||
case EVENTNAME_CREATE: // 创建当前审批节点事件
|
||||
{
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
Gson gson = new Gson();
|
||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||
TResourceMountApplyDTO resourceMountApplyDTO = gson.fromJson(jsonElement, TResourceMountApplyDTO.class);
|
||||
logger.info(JSONObject.toJSONString(resourceMountApplyDTO));
|
||||
ResourceDTO re = resourceMountApplyDTO.getResourceDTO();
|
||||
if (re.getDeptId() != null) {
|
||||
SysDeptDTO deptDTO =
|
||||
sysDeptService.get(re.getDeptId());
|
||||
SysUserDTO userDTO = null;
|
||||
if (deptDTO.getId() != null) {
|
||||
userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); // 搜出审批人
|
||||
}
|
||||
if (userDTO != null) {
|
||||
logger.error("审批人id:" + userDTO.getId());
|
||||
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
|
||||
} else {
|
||||
logger.error("未查到该部门对应的 " + roleName);
|
||||
taskService.setAssignee(delegateTask.getId(), "1513432847327199233");
|
||||
}
|
||||
} else {
|
||||
logger.info("大数据局名称:" + bigDateDeptName);
|
||||
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
|
||||
logger.info("roleDTOId:" + roleDTO.getId());
|
||||
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
|
||||
|
||||
if (userDTO != null) {
|
||||
logger.info("大数据审批人id:" + userDTO.getId());
|
||||
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
|
||||
} else {
|
||||
delegateTask.setAssignee("1513432847327199233");
|
||||
logger.info("未查到大数据部门对应 " + roleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
logger.info("未处理该事件:" + eventName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue