Merge branch 'dev' of http://221.0.232.152:9393/ability-center/share-platform into dev
This commit is contained in:
commit
2b1bc48814
File diff suppressed because it is too large
Load Diff
|
@ -95,6 +95,7 @@ public class ActivitiNoticeAspect {
|
|||
task_complete_notice(delegateTask, activitiNoticeOperation);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
} // 任务监听器类型
|
||||
|
@ -323,7 +324,7 @@ public class ActivitiNoticeAspect {
|
|||
private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
LOGGER.error("表单:{}", JSON.toJSONString(kv));
|
||||
if(delegateTask.getId().equals(kv.get("autoApply"))){
|
||||
if (delegateTask.getId().equals(kv.get("autoApply"))) {
|
||||
LOGGER.error("------------自动审批通过,不通知------------");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import com.google.gson.JsonDeserializer;
|
|||
import com.google.gson.JsonElement;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
|
@ -17,6 +19,7 @@ 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.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -24,7 +27,9 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 发起人部门负责人
|
||||
|
@ -42,6 +47,8 @@ public class ApplyDeptListener implements TaskListener, ExecutionListener, Activ
|
|||
private SysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
@Autowired
|
||||
private ResourceService resourceService;
|
||||
@Value("${big_date.assignee_role_name}")
|
||||
private String roleName; // 具备审批的角色名称
|
||||
|
||||
|
@ -123,5 +130,19 @@ public class ApplyDeptListener implements TaskListener, ExecutionListener, Activ
|
|||
assignee = defaultAssigneeRoleId;
|
||||
}
|
||||
logger.error("分配的用户id为:{}", assignee);
|
||||
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;
|
||||
}
|
||||
}).findAny();
|
||||
if (!tAbilityApplicationDTO.isPresent()) { // 全是免批
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.activiti.service.ActTaskService;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
|
@ -52,6 +55,8 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
|||
private SysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private SysRegionService sysRegionService;
|
||||
@Autowired
|
||||
private ResourceService resourceService;
|
||||
@Value("${big_date.assignee_district_role_name}")
|
||||
private String roleName; // 具备审批的角色名称
|
||||
|
||||
|
@ -89,9 +94,9 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
|||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.error("roleDTOId:" + roleDTO.getId());
|
||||
|
||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId(), "status", "1"));
|
||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||
Optional<SysUserEntity> userEntityOptional = userList.stream().sorted(Comparator.comparing(SysUserEntity::getUpdateDate).reversed()).collect(Collectors.toList()).stream()
|
||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId()) && user.getStatus()==1).findFirst();
|
||||
if (userEntityOptional.isPresent()) {
|
||||
userId = userEntityOptional.get().getId().toString();
|
||||
}
|
||||
|
@ -118,6 +123,7 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
|||
|
||||
/**
|
||||
* 审批人去重
|
||||
*
|
||||
* @param delegateTask
|
||||
* @param assignee
|
||||
*/
|
||||
|
@ -134,9 +140,9 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
|||
return;
|
||||
}
|
||||
//规则2:同一审批人连续出现时(仅保留第一个)
|
||||
List<HistoricActivityInstance> historicActivityInstanceList=historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId())
|
||||
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId())
|
||||
.activityType("userTask").finished().orderByHistoricActivityInstanceEndTime().desc().list();
|
||||
if(!historicActivityInstanceList.isEmpty() && historicActivityInstanceList.get(0).getAssignee().equals(assignee)){
|
||||
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);
|
||||
|
@ -144,6 +150,21 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
|||
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;
|
||||
}
|
||||
}).findAny();
|
||||
if (!tAbilityApplicationDTO.isPresent()) { // 全是免批
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.activiti.service.ActTaskService;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
|
@ -52,6 +55,8 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
|||
private SysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private SysRegionService sysRegionService;
|
||||
@Autowired
|
||||
private ResourceService resourceService;
|
||||
@Value("${big_date.assignee_city_role_name}")
|
||||
private String roleName; // 具备审批的角色名称
|
||||
|
||||
|
@ -90,9 +95,9 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
|||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.error("roleDTOId:" + roleDTO.getId());
|
||||
|
||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId(), "status", "1"));
|
||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||
Optional<SysUserEntity> userEntityOptional = userList.stream().sorted(Comparator.comparing(SysUserEntity::getUpdateDate).reversed()).collect(Collectors.toList()).stream()
|
||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.TWO).getId())).findFirst();
|
||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.TWO).getId()) && user.getStatus()==1).findFirst();
|
||||
if (userEntityOptional.isPresent()) {
|
||||
userId = userEntityOptional.get().getId().toString();
|
||||
}
|
||||
|
@ -119,6 +124,7 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
|||
|
||||
/**
|
||||
* 审批人去重
|
||||
*
|
||||
* @param delegateTask
|
||||
* @param assignee
|
||||
*/
|
||||
|
@ -135,9 +141,9 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
|||
return;
|
||||
}
|
||||
//规则2:同一审批人连续出现时(仅保留第一个)
|
||||
List<HistoricActivityInstance> historicActivityInstanceList=historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId())
|
||||
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId())
|
||||
.activityType("userTask").finished().orderByHistoricActivityInstanceEndTime().desc().list();
|
||||
if(!historicActivityInstanceList.isEmpty() && historicActivityInstanceList.get(0).getAssignee().equals(assignee)){
|
||||
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);
|
||||
|
@ -145,6 +151,21 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
|||
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;
|
||||
}
|
||||
}).findAny();
|
||||
if (!tAbilityApplicationDTO.isPresent()) { // 全是免批
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -209,13 +209,14 @@ public class CorrectionListenerV3 implements TaskListener, ExecutionListener, Ac
|
|||
|
||||
private void mpComplete(List<TAbilityApplicationDTO> abilityApplicationDTO, DelegateTask delegateTask, final String assignee) { // 处理免批或申请人为资源提供方部门审批人
|
||||
Optional<TAbilityApplicationDTO> abilityApplicationDTOOptional = abilityApplicationDTO.stream().findAny();
|
||||
abilityApplicationDTOOptional.ifPresent(index -> {
|
||||
if (abilityApplicationDTOOptional.isPresent()) {
|
||||
if (abilityApplicationDTOOptional.get().getUserId().equals(delegateTask.getAssignee())) {
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "申请人为资源提供方部门审批人,默认通过");
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(assignee)
|
||||
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
|
||||
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
|
||||
|
@ -227,9 +228,9 @@ public class CorrectionListenerV3 implements TaskListener, ExecutionListener, Ac
|
|||
return;
|
||||
}
|
||||
|
||||
List<HistoricActivityInstance> historicActivityInstanceList=historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId())
|
||||
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(delegateTask.getProcessInstanceId())
|
||||
.activityType("userTask").unfinished().orderByHistoricActivityInstanceEndTime().desc().list();
|
||||
if(!historicActivityInstanceList.isEmpty() && historicActivityInstanceList.get(0).getAssignee().equals(assignee)){
|
||||
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);
|
||||
|
|
|
@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.activiti.service.ActTaskService;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
|
@ -49,6 +52,8 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
|||
private SysRegionService sysRegionService;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
@Autowired
|
||||
private ResourceService resourceService;
|
||||
@Value("${big_date.assignee_district_role_name}")
|
||||
private String roleName; // 具备审批的角色名称
|
||||
|
||||
|
@ -86,9 +91,9 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
|||
logger.error("regionEntityId:" + regionEntity.getId());
|
||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||
logger.error("roleDTOId:" + roleDTO.getId());
|
||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId(), "status", "1"));
|
||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||
Optional<SysUserEntity> userEntityOptional = userList.stream().sorted(Comparator.comparing(SysUserEntity::getUpdateDate).reversed()).collect(Collectors.toList()).stream()
|
||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId()) && user.getStatus()==1).findFirst();
|
||||
if (userEntityOptional.isPresent()) {
|
||||
userId = userEntityOptional.get().getId().toString();
|
||||
}
|
||||
|
@ -141,6 +146,21 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
|||
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;
|
||||
}
|
||||
}).findAny();
|
||||
if (!tAbilityApplicationDTO.isPresent()) { // 全是免批
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue