diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java index 82b6acbd..04e4828d 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java @@ -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 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()); + } + }); } } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java index 03f307e5..24cf119c 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java @@ -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 kv = delegateTask.getVariables(); + Gson gson = new Gson(); + JsonElement jsonElement = gson.toJsonTree(kv); + TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class); + Optional 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()); + } + }); + } }