diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java index e5545df4..5989c205 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java @@ -186,6 +186,8 @@ public class AbilityCenterControllerV2 { tAbilityApplicationDTO.setEnclosureName(abilityBatchApplicationDTO.getEnclosureName()); tAbilityApplicationDTO.setCreateDate(new Date()); tAbilityApplicationDTO.setExpireDate(abilityBatchApplicationDTO.getExpireDate()); + tAbilityApplicationDTO.setResourceOwnerDept(sysDeptService.getByName(index.get("managementUnitName"))); + // 归为同一次申请 tAbilityApplicationDTO.setApplyFlag(abilityBatchApplicationDTO.getApplyFlag()); @@ -209,6 +211,9 @@ public class AbilityCenterControllerV2 { .filter(Objects::nonNull) .filter(index -> StringUtils.isNotEmpty(index.getResourceId())) .collect(Collectors.groupingBy(t -> { + if(t.getResourceOwnerDept() != null){ + return t.getResourceOwnerDept().getId(); + } ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId())); if (resourceDTO == null && deptDTO.isPresent()) { // 资源不存在时 return deptDTO.get().getId(); diff --git a/renren-admin/src/main/java/io/renren/modules/device/controller/TbDeviceApplyController.java b/renren-admin/src/main/java/io/renren/modules/device/controller/TbDeviceApplyController.java index 88d3f595..8994b523 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/controller/TbDeviceApplyController.java +++ b/renren-admin/src/main/java/io/renren/modules/device/controller/TbDeviceApplyController.java @@ -120,7 +120,7 @@ public class TbDeviceApplyController { @ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType="int") }) public Result> myDonePage(@ApiIgnore @RequestParam Map params){ - if(params.get("state") == null){ + if(params.get("state") == null || "".equals(params.get("state"))){ params.put("states", ImmutableList.of(2,3)); }else{ params.put("states", ImmutableList.of(params.get("state"))); diff --git a/renren-admin/src/main/java/io/renren/modules/device/dto/TbDeviceApplyDTO.java b/renren-admin/src/main/java/io/renren/modules/device/dto/TbDeviceApplyDTO.java index 34142071..e6b2f17a 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/dto/TbDeviceApplyDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/device/dto/TbDeviceApplyDTO.java @@ -47,6 +47,8 @@ public class TbDeviceApplyDTO implements Serializable { private String auditViem; @ApiModelProperty(value = "审核者") private Long auditor; + @ApiModelProperty(value = "审核人名称") + private String auditorName; @ApiModelProperty(value = "审核时间") private Date auditTime; @ApiModelProperty(value = "删除标志") diff --git a/renren-admin/src/main/java/io/renren/modules/device/service/Impl/TbDeviceApplyServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/device/service/Impl/TbDeviceApplyServiceImpl.java index 0aa7ba86..308ffa94 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/service/Impl/TbDeviceApplyServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/device/service/Impl/TbDeviceApplyServiceImpl.java @@ -9,6 +9,7 @@ import io.renren.modules.device.entity.TbDeviceApplyEntity; import io.renren.modules.device.service.TbDeviceApplyService; import io.renren.modules.device.service.TbDeviceService; import io.renren.modules.security.user.SecurityUser; +import io.renren.modules.sys.service.SysUserService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,6 +31,8 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl getWrapper(Map params) { @@ -50,13 +53,16 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl dtoList = tbDeviceApplyDao.queryListForAudit(params); List resultList; - if(params.get("deviceName") != null){ + if(params.get("deviceName") != null && !"".equals(params.get("deviceName"))){ resultList = dtoList.stream().filter(it->tbDeviceService.get(it.getDeviceId()).getName().contains(params.get("deviceName").toString())).collect(Collectors.toList()); }else{ resultList=dtoList; } List result = resultList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); - result.stream().forEach(it->it.setTbDeviceDTO(tbDeviceService.get(it.getDeviceId()))); + result.stream().forEach(it->{ + it.setTbDeviceDTO(tbDeviceService.get(it.getDeviceId())); + it.setAuditorName(sysUserService.get(it.getAuditor()).getRealName()); + }); return new PageData(result, resultList.size()); } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v2/CorrectionListenerV2.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v2/CorrectionListenerV2.java index 4d6fe46e..23639cd4 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v2/CorrectionListenerV2.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v2/CorrectionListenerV2.java @@ -21,11 +21,13 @@ import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysRoleService; import io.renren.modules.sys.service.SysRoleUserService; import io.renren.modules.sys.service.SysUserService; +import org.activiti.engine.HistoryService; import org.activiti.engine.ProcessEngines; import org.activiti.engine.TaskService; import org.activiti.engine.delegate.*; import org.activiti.engine.delegate.event.ActivitiEvent; import org.activiti.engine.delegate.event.ActivitiEventListener; +import org.activiti.engine.history.HistoricActivityInstance; import org.activiti.engine.task.Task; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -58,6 +60,8 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac @Autowired private TaskService taskService; @Autowired + private HistoryService historyService; + @Autowired private SysUserService sysUserService; @Autowired private SysRoleUserService sysRoleUserService; @@ -170,18 +174,6 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac Long deptId; if (kv.containsKey("deptId")) { // 存在部门id deptId = Long.valueOf(kv.get("deptId").toString()); - SysDeptDTO deptDTO = sysDeptService.get(deptId); - if (deptDTO != null && deptDTO.getName().equals(bigDateDeptName)) { // 二级审批依然为大数据局,默认审核通过 - logger.error("第二级别审批仍然为 {}", bigDateDeptName); - SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人 - if (userDTO != null) { - taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); - } - taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "默认通过"); - taskService.complete(delegateTask.getId(), delegateTask.getVariables()); - return; - } // 二级审批依然为大数据局 - SysUserDTO userDTO = null; if (deptId != null) { userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人 @@ -227,13 +219,25 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac return; } + List historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId()) + .activityType("userTask").unfinished().orderByHistoricActivityInstanceEndTime().desc().list(); + if (!historicActivityInstanceList.isEmpty() && historicActivityInstanceList.get(0).getAssignee().equals(assignee)) { + taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人重复,默认通过"); + taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE); + taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE); + taskService.setVariable(delegateTask.getId(), "autoApply", delegateTask.getId()); + taskService.complete(delegateTask.getId(), delegateTask.getVariables()); + return; + } + List dtoList = delegateTask.getVariable("tAbilityApplicationDTOList", List.class); Optional tAbilityApplicationDTO = dtoList.stream().filter(index -> { Optional resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(index.getResourceId()))); if (resourceDTOOptional.isPresent()) { return !StringUtils.contains(resourceDTOOptional.get().getShareCondition(), "免批"); // 存在非免批 } else { - return false; + //未查询到,则认为是基础设施,为非免批申请 + return true; } }).findAny(); if (!tAbilityApplicationDTO.isPresent()) { // 全是免批