From a00007992a8543fcd48e43849f53e2a367fcd862 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 11 May 2022 09:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=8D=E6=89=B9=E8=B5=84=E6=BA=90=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E9=BB=98=E8=AE=A4=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/CorrectionListener.java | 9 ++++++++ .../listener/DataCenterListener.java | 23 +++++++++++++++++++ 2 files changed, 32 insertions(+) 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()); + } + }); + } }