diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java index df8f4661..f6dd149a 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java @@ -8,13 +8,37 @@ import java.util.Arrays; */ public enum ResourceEntityDelFlag { + /** + * 正常 + */ NORMAL(0, "正常"), + /** + * 已删除 + */ DELETED(1, "已删除"), + /** + * 上架待审核 + */ PENDING_REVIEW(2, "上架待审核"), + /** + * 上架审核中 + */ UNDER_REVIEW(3, "上架审核中"), + /** + * 下架审核中 + */ UNDERCARRIAGE_REVIEW(4, "下架审核中"), + /** + * 已下架 + */ UNDERCARRIAGE(5, "已下架"), + /** + * 其他 + */ OTHER(9, "其他"), + /** + * 未知 + */ UNKNOWN(10, "未知"); private int flag; diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index 14683698..dfa97fc2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -3,6 +3,7 @@ package io.renren.modules.resource.listener; import com.google.gson.Gson; import com.google.gson.JsonElement; import io.renren.modules.resource.dto.ResourceDTO; +import io.renren.modules.resource.entity.ResourceEntityDelFlag; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysRoleDTO; @@ -11,7 +12,9 @@ import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysRoleService; import io.renren.modules.sys.service.SysUserService; import org.activiti.engine.TaskService; +import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.DelegateTask; +import org.activiti.engine.delegate.ExecutionListener; import org.activiti.engine.delegate.TaskListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,7 +29,7 @@ import java.util.Map; * 资源下线审核 */ @Component -public class ResourceUndercarriageListener implements TaskListener { +public class ResourceUndercarriageListener implements TaskListener, ExecutionListener { private static Logger logger = LoggerFactory.getLogger(ResourceUndercarriageListener.class); @Value("${big_date.name}") @@ -64,6 +67,31 @@ public class ResourceUndercarriageListener implements TaskListener { } + @Override + public void notify(DelegateExecution execution) throws Exception { + logger.error("----------------------进入审批通过节点---------------------------"); + logger.error("事件类型:" + execution.getEventName()); + final String eventName = execution.getEventName(); + + switch (eventName) { + case EVENTNAME_END: { + endTake(execution.getVariables()); + } + break; + } + } + + private void endTake(Map kv) { // 进入最后结束节点 + Gson gson = new Gson(); + JsonElement jsonElement = gson.toJsonTree(kv); + ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class); + if (re != null) { + re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag()); + resourceService.update(re); + logger.error("审批通过!资源id:" + re.getId()); + } + } + /** * 节点创建时动态分配资源部门审核人 * @@ -75,7 +103,6 @@ public class ResourceUndercarriageListener implements TaskListener { Gson gson = new Gson(); JsonElement jsonElement = gson.toJsonTree(kv); ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class); - ; if (re.getDeptId() != null) { SysDeptDTO deptDTO = sysDeptService.get(re.getDeptId()); @@ -114,4 +141,6 @@ public class ResourceUndercarriageListener implements TaskListener { taskService.setAssignee(taskId, "1516728698224427010"); } } + + }