直接终止拒绝时,各类审批流程的处理

This commit is contained in:
wangliwen 2022-05-16 15:47:24 +08:00
parent 9d06c43739
commit 34fd01f208
9 changed files with 117 additions and 17 deletions

View File

@ -12,6 +12,7 @@ import io.renren.modules.activiti.dto.ProcessStartDTO;
import io.renren.modules.activiti.service.ActProcessService; import io.renren.modules.activiti.service.ActProcessService;
import io.renren.modules.activiti.service.ActRunningService; import io.renren.modules.activiti.service.ActRunningService;
import io.renren.modules.demanData.dto.TDemandDataDTO; import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
import io.renren.modules.demanData.service.TDemandDataService; import io.renren.modules.demanData.service.TDemandDataService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -60,7 +61,7 @@ public class DemandDataController {
logger.info("---------------------------------------------------"); logger.info("---------------------------------------------------");
logger.info(JSONObject.toJSONString(tDemandDataDTO)); logger.info(JSONObject.toJSONString(tDemandDataDTO));
logger.info("####################################################"); logger.info("####################################################");
tDemandDataDTO.setFlag(1); tDemandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag());
ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class);
tDemandDataService.save(tDemandDataDTO); tDemandDataService.save(tDemandDataDTO);

View File

@ -30,4 +30,9 @@ public class AuditingBaseDTO implements Serializable {
*/ */
private Boolean completeEntry = null; private Boolean completeEntry = null;
/**
* 回退任务到上一节点
*/
private Boolean backPreviousTask = null;
} }

View File

@ -399,6 +399,7 @@ public class ActTaskService extends BaseServiceImpl {
commentMode += "[" + comment + "]"; commentMode += "[" + comment + "]";
} }
taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_BACK); taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_BACK);
taskService.setVariable(task.getId(), "backPreviousTask", Boolean.TRUE);
taskService.addComment(task.getId(), task.getProcessInstanceId(), commentMode); taskService.addComment(task.getId(), task.getProcessInstanceId(), commentMode);
taskService.complete(task.getId(), variables); taskService.complete(task.getId(), variables);
} }
@ -487,6 +488,7 @@ public class ActTaskService extends BaseServiceImpl {
comment = message + "[" + comment + "]"; comment = message + "[" + comment + "]";
taskService.addComment(task.getId(), task.getProcessInstanceId(), comment); taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_STOP); taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_STOP);
taskService.setVariable(task.getId(), "reject", Boolean.TRUE); // 存在被拒绝的批示
taskService.complete(taskId); taskService.complete(taskId);
pointActivity.getIncomingTransitions().remove(newTransition); pointActivity.getIncomingTransitions().remove(newTransition);
List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions(); List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions();

View File

@ -1,12 +1,14 @@
package io.renren.modules.demanData.dto; package io.renren.modules.demanData.dto;
import io.renren.common.dto.AuditingBaseDTO; import io.renren.common.dto.AuditingBaseDTO;
import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Optional;
/** /**
* 能力需求评审主体 * 能力需求评审主体
@ -45,6 +47,8 @@ public class TDemandDataDTO extends AuditingBaseDTO implements Serializable {
private String enclosure; private String enclosure;
@ApiModelProperty(value = "业务标志0:初始化 1:审批中 2:审批拒绝 3:审批通过)") @ApiModelProperty(value = "业务标志0:初始化 1:审批中 2:审批拒绝 3:审批通过)")
private Integer flag; private Integer flag;
@ApiModelProperty(value = "业务标志提示0:初始化 1:审批中 2:审批拒绝 3:审批通过)")
private String flagTip;
@ApiModelProperty(value = "审批意见") @ApiModelProperty(value = "审批意见")
private String approvalOpinions; private String approvalOpinions;
@ApiModelProperty(value = "审批人姓名") @ApiModelProperty(value = "审批人姓名")
@ -58,7 +62,17 @@ public class TDemandDataDTO extends AuditingBaseDTO implements Serializable {
private String instanceId; private String instanceId;
public TDemandDataDTO() { public TDemandDataDTO() {
this.flag = 0; this.flag = TDemandDataEntityFlag.INIT.getFlag();
this.visits = 0l; this.visits = 0l;
} }
public String getFlagTip() {
if (this.flag != null) {
Optional<TDemandDataEntityFlag> tDemandDataEntityFlag = Optional.ofNullable(TDemandDataEntityFlag.getByFlag(this.flag));
if (tDemandDataEntityFlag.isPresent()) {
return tDemandDataEntityFlag.get().getTip();
}
}
return "";
}
} }

View File

@ -0,0 +1,59 @@
package io.renren.modules.demanData.entity;
import java.util.Arrays;
/**
* 业务标志0:初始化 1:审批中 2:审批拒绝 3:审批通过
*/
public enum TDemandDataEntityFlag {
/**
* 0:初始化
*/
INIT(0, "初始化"),
/**
* 1:审批中
*/
UNDER_REVIEW(1, "审批中"),
/**
* 2审批拒绝
*/
REJECT(2, "审批拒绝"),
/**
* 3:审批通过
*/
APPROVE(3, "审批通过"),
/**
* 4:未知
*/
UNKNOWN(4, "未知");
private int flag;
private String tip;
TDemandDataEntityFlag(int i, String s) {
this.flag = i;
this.tip = s;
}
public static TDemandDataEntityFlag getByFlag(int flag) {
TDemandDataEntityFlag[] index = TDemandDataEntityFlag.values();
return Arrays.asList(index).stream().filter(index_ -> index_.flag == flag).findAny().orElse(TDemandDataEntityFlag.UNKNOWN);
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public String getTip() {
return tip;
}
public void setTip(String tip) {
this.tip = tip;
}
}

View File

@ -6,6 +6,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer; import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import io.renren.modules.demanData.dto.TDemandDataDTO; import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
import io.renren.modules.demanData.service.TDemandDataService; import io.renren.modules.demanData.service.TDemandDataService;
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;
@ -161,13 +162,19 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
if (demandDataDTO != null) { if (demandDataDTO != null) {
logger.error(JSONObject.toJSONString(demandDataDTO)); logger.error(JSONObject.toJSONString(demandDataDTO));
SysUserDTO userDTO = sysUserService.get(Long.valueOf(delegateTask.getAssignee())); SysUserDTO userDTO = sysUserService.get(Long.valueOf(delegateTask.getAssignee()));
taskService.getTaskComments(delegateTask.getId()); if (demandDataDTO.getReject() != null && demandDataDTO.getReject() == Boolean.TRUE) { // 拒绝
// tDemandDataService.updateFlag(3, demandDataDTO.getId());// 更新状态为已审批通过 demandDataDTO.setFlag(TDemandDataEntityFlag.REJECT.getFlag());
demandDataDTO.setFlag(3); demandDataDTO.setApprovalUserDeptName(userDTO != null ? userDTO.getDeptName() : null);
demandDataDTO.setApprovalUserName(userDTO != null ? userDTO.getRealName() : null);
demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage());
logger.error("---------------------------更新状态为审批未通过---------------------------------");
} else {
demandDataDTO.setFlag(TDemandDataEntityFlag.APPROVE.getFlag());
demandDataDTO.setApprovalUserDeptName(userDTO != null ? userDTO.getDeptName() : null); demandDataDTO.setApprovalUserDeptName(userDTO != null ? userDTO.getDeptName() : null);
demandDataDTO.setApprovalUserName(userDTO != null ? userDTO.getRealName() : null); demandDataDTO.setApprovalUserName(userDTO != null ? userDTO.getRealName() : null);
demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage()); demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage());
logger.error("---------------------------更新状态为已审批通过---------------------------------"); logger.error("---------------------------更新状态为已审批通过---------------------------------");
}
logger.error("demandDataDTO:" + demandDataDTO); logger.error("demandDataDTO:" + demandDataDTO);
tDemandDataService.update(demandDataDTO); tDemandDataService.update(demandDataDTO);
} }

View File

@ -122,12 +122,19 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
JsonElement jsonElement = gson.toJsonTree(kv); JsonElement jsonElement = gson.toJsonTree(kv);
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class); TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
if (abilityApplicationDTO != null) { if (abilityApplicationDTO != null) {
if (abilityApplicationDTO.getReject() != null && abilityApplicationDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
abilityApplicationDTO.setDelFlag(0);
abilityApplicationDTO.setApproveStatus("不通过");
tAbilityApplicationService.update(abilityApplicationDTO);
logger.error("审批不通过申请id:" + abilityApplicationDTO.getId());
} else {
abilityApplicationDTO.setDelFlag(0); abilityApplicationDTO.setDelFlag(0);
abilityApplicationDTO.setApproveStatus("通过"); abilityApplicationDTO.setApproveStatus("通过");
tAbilityApplicationService.update(abilityApplicationDTO); tAbilityApplicationService.update(abilityApplicationDTO);
logger.error("审批通过申请id:" + abilityApplicationDTO.getId()); logger.error("审批通过申请id:" + abilityApplicationDTO.getId());
} }
} }
}
/** /**
* 节点创建时动态分配资源部门审核人 * 节点创建时动态分配资源部门审核人

View File

@ -108,7 +108,6 @@ public class ResourceDTO extends AuditingBaseDTO implements Serializable {
if (resourceEntityDelFlagOptional.isPresent()) { if (resourceEntityDelFlagOptional.isPresent()) {
return resourceEntityDelFlagOptional.get().getTip(); return resourceEntityDelFlagOptional.get().getTip();
} }
return "";
} }
return ""; return "";
} }

View File

@ -98,11 +98,17 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class); ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class);
if (re != null) { if (re != null) {
logger.error(kv.toString()); logger.error(kv.toString());
if (re.getReject() != null && re.getReject() == Boolean.TRUE) { // 下架被拒绝 重新上线
re.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
resourceService.update(re);
logger.error("下架审批未通过 资源id:" + re.getId());
} else { // 下架成功
re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag()); re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag());
resourceService.update(re); resourceService.update(re);
logger.error("下架审批通过 资源id:" + re.getId()); logger.error("下架审批通过 资源id:" + re.getId());
} }
} }
}
/** /**
* 节点创建时动态分配资源部门审核人 * 节点创建时动态分配资源部门审核人