增加大数据动态审批人
This commit is contained in:
parent
b4bbdd1194
commit
8a594d2180
|
@ -76,6 +76,8 @@ public class AbilityCenterController {
|
|||
tAbilityApplicationDTO.setInstanceId(abilityBatchApplicationDTO.getInstanceId());
|
||||
tAbilityApplicationDTO.setUnit(abilityBatchApplicationDTO.getUnit());
|
||||
tAbilityApplicationDTO.setUser(abilityBatchApplicationDTO.getUser());
|
||||
tAbilityApplicationDTO.setResourceId(abilityBatchApplicationDTO.getResourceId());
|
||||
tAbilityApplicationDTO.setUser(abilityBatchApplicationDTO.getUser());
|
||||
tAbilityApplicationDTO.setSystem(index);
|
||||
// 仿照请求接口 /processForm/tabilityapplication
|
||||
ValidatorUtils.validateEntity(tAbilityApplicationDTO, AddGroup.class, DefaultGroup.class);
|
||||
|
|
|
@ -37,4 +37,9 @@ public class TAbilityApplicationDTO implements Serializable {
|
|||
@ApiModelProperty(value = "实例ID")
|
||||
private String instanceId;
|
||||
|
||||
@ApiModelProperty(value = "资源id")
|
||||
private String resourceId;
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
|
||||
}
|
|
@ -32,4 +32,9 @@ public class TAbilityBatchApplicationDTO implements Serializable {
|
|||
private String attachment;
|
||||
@ApiModelProperty(value = "实例ID")
|
||||
private String instanceId;
|
||||
|
||||
@ApiModelProperty(value = "资源id")
|
||||
private String resourceId;
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
}
|
||||
|
|
|
@ -55,4 +55,15 @@ public class TAbilityApplicationEntity {
|
|||
* 实例ID
|
||||
*/
|
||||
private String instanceId;
|
||||
|
||||
|
||||
/**
|
||||
* 资源id
|
||||
*/
|
||||
private String resourceId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
}
|
|
@ -3,6 +3,8 @@ package io.renren.modules.processForm.listener;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
|
@ -38,20 +40,33 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
|||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
@Autowired
|
||||
private ResourceService resourceService;
|
||||
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
Gson gson = new Gson();
|
||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
||||
logger.info(abilityApplicationDTO.toString());
|
||||
|
||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.info("roleDTOId:" + roleDTO.getId());
|
||||
|
||||
logger.info("abilityApplicationDTO:" + abilityApplicationDTO.toString());
|
||||
ResourceDTO resourceEntityDto = resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId()));
|
||||
Long deptId = null;
|
||||
if (resourceEntityDto != null && resourceEntityDto.getDeptId() != null) {
|
||||
deptId = resourceEntityDto.getDeptId();
|
||||
} else {
|
||||
logger.info("表单内单位名称:" + abilityApplicationDTO.getUnit());
|
||||
SysDeptDTO deptDTO = sysDeptService.getByName(abilityApplicationDTO.getUnit());
|
||||
logger.info("deptDTOId:" + deptDTO.getId());
|
||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.info("roleDTOId:" + roleDTO.getId());
|
||||
deptId = deptDTO.getId();
|
||||
}
|
||||
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人
|
||||
|
||||
delegateTask.setAssignee("1513432847327199233");
|
||||
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
|
||||
if (userDTO != null) {
|
||||
logger.info("审批人id:" + userDTO.getId());
|
||||
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
|
||||
|
@ -62,12 +77,12 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
|||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
logger.info("事件:" + delegateExecution.getEventName());
|
||||
delegateExecution.getVariableNames().stream().forEach(index -> logger.info("variable:" + index));
|
||||
delegateExecution.getVariables().values().stream().filter(index -> index != null).forEach(value -> logger.info(value.toString()));
|
||||
// taskService.setAssignee(delegateExecution.getProcessInstanceId(), "1516307964617076737");// 可以设置
|
||||
|
||||
logger.info("修改审批人成功!" + delegateExecution.getCurrentActivityId() + " " + delegateExecution.getProcessInstanceId() + " " + delegateExecution.getProcessBusinessKey());
|
||||
// logger.info("事件:" + delegateExecution.getEventName());
|
||||
// delegateExecution.getVariableNames().stream().forEach(index -> logger.info("variable:" + index));
|
||||
// delegateExecution.getVariables().values().stream().filter(index -> index != null).forEach(value -> logger.info(value.toString()));
|
||||
// // taskService.setAssignee(delegateExecution.getProcessInstanceId(), "1516307964617076737");// 可以设置
|
||||
//
|
||||
// logger.info("修改审批人成功!" + delegateExecution.getCurrentActivityId() + " " + delegateExecution.getProcessInstanceId() + " " + delegateExecution.getProcessBusinessKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package io.renren.modules.processForm.listener;
|
||||
|
||||
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;
|
||||
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.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
public class DataCenterListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
|
||||
private static Logger logger = LoggerFactory.getLogger(DataCenterListener.class);
|
||||
|
||||
private static String deptName = "青岛市大数据发展管理局";
|
||||
private static String roleName = "部门审批人";
|
||||
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private SysRoleUserService sysRoleUserService;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
SysDeptDTO deptDTO = sysDeptService.getByName(deptName);
|
||||
logger.info("deptDTOId:" + deptDTO.getId());
|
||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.info("roleDTOId:" + roleDTO.getId());
|
||||
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
|
||||
delegateTask.setAssignee("1513432847327199233");
|
||||
if (userDTO != null) {
|
||||
logger.info("审批人id:" + userDTO.getId());
|
||||
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
|
||||
} else {
|
||||
logger.info("未查到该部门对应 " + roleName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(ActivitiEvent activitiEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFailOnException() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
<fileNamePattern>${LOG_HOME}/info.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<MaxHistory>120</MaxHistory>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>500MB</maxFileSize>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
|
|
Loading…
Reference in New Issue