西海岸v2申请流程修改

This commit is contained in:
lizhicheng 2022-09-27 18:55:44 +08:00
parent 1eb11c53ee
commit ae3556ac3e
5 changed files with 33 additions and 16 deletions

View File

@ -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();

View File

@ -120,7 +120,7 @@ public class TbDeviceApplyController {
@ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType="int")
})
public Result<PageData<TbDeviceApplyDTO>> myDonePage(@ApiIgnore @RequestParam Map<String, Object> 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")));

View File

@ -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 = "删除标志")

View File

@ -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<TbDeviceApplyDao,
private TbDeviceApplyDao tbDeviceApplyDao;
@Autowired
private TbDeviceService tbDeviceService;
@Autowired
private SysUserService sysUserService;
@Override
public QueryWrapper<TbDeviceApplyEntity> getWrapper(Map<String, Object> params) {
@ -50,13 +53,16 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl<TbDeviceApplyDao,
params.put("userId", SecurityUser.getUserId());
List<TbDeviceApplyDTO> dtoList = tbDeviceApplyDao.queryListForAudit(params);
List<TbDeviceApplyDTO> 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<TbDeviceApplyDTO> 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());
}

View File

@ -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<HistoricActivityInstance> 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<TAbilityApplicationDTO> dtoList = delegateTask.getVariable("tAbilityApplicationDTOList", List.class);
Optional<TAbilityApplicationDTO> tAbilityApplicationDTO = dtoList.stream().filter(index -> {
Optional<ResourceDTO> 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()) { // 全是免批