下架通过 资源状态改变
This commit is contained in:
parent
a53b817aec
commit
830c09feaf
|
@ -8,13 +8,37 @@ import java.util.Arrays;
|
||||||
*/
|
*/
|
||||||
public enum ResourceEntityDelFlag {
|
public enum ResourceEntityDelFlag {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正常
|
||||||
|
*/
|
||||||
NORMAL(0, "正常"),
|
NORMAL(0, "正常"),
|
||||||
|
/**
|
||||||
|
* 已删除
|
||||||
|
*/
|
||||||
DELETED(1, "已删除"),
|
DELETED(1, "已删除"),
|
||||||
|
/**
|
||||||
|
* 上架待审核
|
||||||
|
*/
|
||||||
PENDING_REVIEW(2, "上架待审核"),
|
PENDING_REVIEW(2, "上架待审核"),
|
||||||
|
/**
|
||||||
|
* 上架审核中
|
||||||
|
*/
|
||||||
UNDER_REVIEW(3, "上架审核中"),
|
UNDER_REVIEW(3, "上架审核中"),
|
||||||
|
/**
|
||||||
|
* 下架审核中
|
||||||
|
*/
|
||||||
UNDERCARRIAGE_REVIEW(4, "下架审核中"),
|
UNDERCARRIAGE_REVIEW(4, "下架审核中"),
|
||||||
|
/**
|
||||||
|
* 已下架
|
||||||
|
*/
|
||||||
UNDERCARRIAGE(5, "已下架"),
|
UNDERCARRIAGE(5, "已下架"),
|
||||||
|
/**
|
||||||
|
* 其他
|
||||||
|
*/
|
||||||
OTHER(9, "其他"),
|
OTHER(9, "其他"),
|
||||||
|
/**
|
||||||
|
* 未知
|
||||||
|
*/
|
||||||
UNKNOWN(10, "未知");
|
UNKNOWN(10, "未知");
|
||||||
|
|
||||||
private int flag;
|
private int flag;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.renren.modules.resource.listener;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
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.resource.service.ResourceService;
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
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.SysRoleService;
|
||||||
import io.renren.modules.sys.service.SysUserService;
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
import org.activiti.engine.TaskService;
|
import org.activiti.engine.TaskService;
|
||||||
|
import org.activiti.engine.delegate.DelegateExecution;
|
||||||
import org.activiti.engine.delegate.DelegateTask;
|
import org.activiti.engine.delegate.DelegateTask;
|
||||||
|
import org.activiti.engine.delegate.ExecutionListener;
|
||||||
import org.activiti.engine.delegate.TaskListener;
|
import org.activiti.engine.delegate.TaskListener;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -26,7 +29,7 @@ import java.util.Map;
|
||||||
* 资源下线审核
|
* 资源下线审核
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ResourceUndercarriageListener implements TaskListener {
|
public class ResourceUndercarriageListener implements TaskListener, ExecutionListener {
|
||||||
private static Logger logger = LoggerFactory.getLogger(ResourceUndercarriageListener.class);
|
private static Logger logger = LoggerFactory.getLogger(ResourceUndercarriageListener.class);
|
||||||
|
|
||||||
@Value("${big_date.name}")
|
@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<String, Object> 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();
|
Gson gson = new Gson();
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||||
ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class);
|
ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class);
|
||||||
;
|
|
||||||
if (re.getDeptId() != null) {
|
if (re.getDeptId() != null) {
|
||||||
SysDeptDTO deptDTO =
|
SysDeptDTO deptDTO =
|
||||||
sysDeptService.get(re.getDeptId());
|
sysDeptService.get(re.getDeptId());
|
||||||
|
@ -114,4 +141,6 @@ public class ResourceUndercarriageListener implements TaskListener {
|
||||||
taskService.setAssignee(taskId, "1516728698224427010");
|
taskService.setAssignee(taskId, "1516728698224427010");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue