diff --git a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java index 5163f391..35c9776e 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java @@ -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); diff --git a/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java b/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java index 084f6e72..1922e406 100644 --- a/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java +++ b/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java @@ -30,4 +30,9 @@ public class AuditingBaseDTO implements Serializable { */ private Boolean completeEntry = null; + /** + * 回退任务到上一节点 + */ + private Boolean backPreviousTask = null; + } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index e164b8e0..4360e268 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -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 pvmTransitionListC = currActivity.getOutgoingTransitions(); diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/dto/TDemandDataDTO.java b/renren-admin/src/main/java/io/renren/modules/demanData/dto/TDemandDataDTO.java index 81faac27..59b67084 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/dto/TDemandDataDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/dto/TDemandDataDTO.java @@ -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 = Optional.ofNullable(TDemandDataEntityFlag.getByFlag(this.flag)); + if (tDemandDataEntityFlag.isPresent()) { + return tDemandDataEntityFlag.get().getTip(); + } + } + return ""; + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/entity/TDemandDataEntityFlag.java b/renren-admin/src/main/java/io/renren/modules/demanData/entity/TDemandDataEntityFlag.java new file mode 100644 index 00000000..59ea0574 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/demanData/entity/TDemandDataEntityFlag.java @@ -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; + } +} diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java index fc198bb3..7b516a0c 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java @@ -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); } 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 4ab9689d..3fbf9866 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 @@ -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()); + } } } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java index 1d5d11a9..4093cae3 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java @@ -108,7 +108,6 @@ public class ResourceDTO extends AuditingBaseDTO implements Serializable { if (resourceEntityDelFlagOptional.isPresent()) { return resourceEntityDelFlagOptional.get().getTip(); } - return ""; } return ""; } 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 2fc9fecd..9dedbac6 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 @@ -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()); + } } }