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

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

View File

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

View File

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

View File

@ -1,12 +1,14 @@
package io.renren.modules.demanData.dto;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.Optional;
/**
* 能力需求评审主体
@ -45,6 +47,8 @@ public class TDemandDataDTO extends AuditingBaseDTO implements Serializable {
private String enclosure;
@ApiModelProperty(value = "业务标志0:初始化 1:审批中 2:审批拒绝 3:审批通过)")
private Integer flag;
@ApiModelProperty(value = "业务标志提示0:初始化 1:审批中 2:审批拒绝 3:审批通过)")
private String flagTip;
@ApiModelProperty(value = "审批意见")
private String approvalOpinions;
@ApiModelProperty(value = "审批人姓名")
@ -58,7 +62,17 @@ public class TDemandDataDTO extends AuditingBaseDTO implements Serializable {
private String instanceId;
public TDemandDataDTO() {
this.flag = 0;
this.flag = TDemandDataEntityFlag.INIT.getFlag();
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.JsonElement;
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.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysRoleDTO;
@ -161,13 +162,19 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
if (demandDataDTO != null) {
logger.error(JSONObject.toJSONString(demandDataDTO));
SysUserDTO userDTO = sysUserService.get(Long.valueOf(delegateTask.getAssignee()));
taskService.getTaskComments(delegateTask.getId());
// tDemandDataService.updateFlag(3, demandDataDTO.getId());// 更新状态为已审批通过
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("---------------------------更新状态为已审批通过---------------------------------");
if (demandDataDTO.getReject() != null && demandDataDTO.getReject() == Boolean.TRUE) { // 拒绝
demandDataDTO.setFlag(TDemandDataEntityFlag.REJECT.getFlag());
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.setApprovalUserName(userDTO != null ? userDTO.getRealName() : null);
demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage());
logger.error("---------------------------更新状态为已审批通过---------------------------------");
}
logger.error("demandDataDTO:" + demandDataDTO);
tDemandDataService.update(demandDataDTO);
}

View File

@ -122,10 +122,17 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
JsonElement jsonElement = gson.toJsonTree(kv);
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
if (abilityApplicationDTO != null) {
abilityApplicationDTO.setDelFlag(0);
abilityApplicationDTO.setApproveStatus("通过");
tAbilityApplicationService.update(abilityApplicationDTO);
logger.error("审批通过申请id:" + abilityApplicationDTO.getId());
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.setApproveStatus("通过");
tAbilityApplicationService.update(abilityApplicationDTO);
logger.error("审批通过申请id:" + abilityApplicationDTO.getId());
}
}
}

View File

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

View File

@ -98,9 +98,15 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class);
if (re != null) {
logger.error(kv.toString());
re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag());
resourceService.update(re);
logger.error("下架审批通过 资源id:" + re.getId());
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());
resourceService.update(re);
logger.error("下架审批通过 资源id:" + re.getId());
}
}
}