免批资源申请默认审核通过

This commit is contained in:
wangliwen 2022-05-11 09:59:39 +08:00
parent 830c09feaf
commit a00007992a
2 changed files with 32 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.Optional;
/**
* 部门动态审批人
@ -160,5 +161,13 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
}
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
resourceDTOOptional.ifPresent(resource -> {
if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}
});
}
}

View File

@ -1,5 +1,10 @@
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;
@ -17,6 +22,9 @@ 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.Optional;
/**
* 大数据局动态审批人
*/
@ -39,6 +47,8 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
private SysRoleUserService sysRoleUserService;
@Autowired
private SysDeptService sysDeptService;
@Autowired
private ResourceService resourceService;
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {
@ -96,5 +106,18 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
delegateTask.setAssignee("1516728698224427010");
logger.info("未查到该部门对应 " + roleName);
}
Map<String, Object> kv = delegateTask.getVariables();
Gson gson = new Gson();
JsonElement jsonElement = gson.toJsonTree(kv);
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
resourceDTOOptional.ifPresent(resource -> {
if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}
});
}
}