Merge branch 'dev' into docker_package

This commit is contained in:
wangliwen 2022-07-07 11:38:51 +08:00
commit 816bf600ad
8 changed files with 72 additions and 40 deletions

View File

@ -21,7 +21,6 @@ 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.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
@ -120,6 +119,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
}
private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) {
String assignee;
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
@ -139,9 +139,11 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
assignee = "1516728698224427010";
}
} else { // 填入大数据审批人
logger.error("大数据局名称:" + bigDateDeptName);
@ -152,16 +154,17 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
if (userDTO != null) {
logger.error("大数据审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
logger.error("未查到大数据部门对应 " + roleName);
assignee = "1516728698224427010";
}
}
Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).active().singleResult();
if (task != null && StringUtils.isNotEmpty(task.getAssignee())
if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(demandDataDTO.getApplyUserId())
&& demandDataDTO.getApplyUserId().equals(task.getAssignee())) {
&& demandDataDTO.getApplyUserId().equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}

View File

@ -18,6 +18,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;
@ -126,6 +127,7 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit
* @param delegateTask
*/
private void createEvent(DelegateTask delegateTask) {
String assignee;
logger.error("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.error("deptDTOId:" + deptDTO.getId());
@ -136,9 +138,26 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
delegateTask.setAssignee("1516728698224427010");
logger.error("未查到该部门对应 " + roleName);
assignee = "1516728698224427010";
}
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
TDemandCommentDTO tDemandCommentDTO = gson.fromJson(jsonElement, TDemandCommentDTO.class);
if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(tDemandCommentDTO.getCreator().toString())
&& tDemandCommentDTO.getCreator().toString().equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}
}
}

View File

@ -24,7 +24,6 @@ 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.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -154,6 +153,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
* @param delegateTask
*/
private void create(DelegateTask delegateTask) {
String assignee;
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
@ -179,6 +179,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人
if (userDTO != null) {
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
}
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
@ -200,14 +201,16 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
assignee = "1516728698224427010";
}
mpComplete(abilityApplicationDTO, delegateTask);
mpComplete(abilityApplicationDTO, delegateTask, assignee);
}
private void mpComplete(TAbilityApplicationDTO abilityApplicationDTO, DelegateTask delegateTask) {
private void mpComplete(TAbilityApplicationDTO abilityApplicationDTO, DelegateTask delegateTask, final String assignee) {
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
resourceDTOOptional.ifPresent(resource -> {
if (StringUtils.contains(resource.getShareCondition(), "免批")) { // 针对免批资源申请
@ -221,11 +224,9 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
return;
}
});
Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).active().singleResult();
if (task != null && StringUtils.isNotEmpty(task.getAssignee())
if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(abilityApplicationDTO.getUserId())
&& abilityApplicationDTO.getUserId().equals(task.getAssignee())) {
&& abilityApplicationDTO.getUserId().equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}

View File

@ -19,7 +19,6 @@ 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.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -99,6 +98,7 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
* @param delegateTask
*/
private void createEvent(DelegateTask delegateTask) {
String assignee;
logger.error("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.error("deptDTOId:" + deptDTO.getId());
@ -109,9 +109,11 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
delegateTask.setAssignee("1516728698224427010");
logger.error("未查到该部门对应 " + roleName);
assignee = "1516728698224427010";
}
Map<String, Object> kv = delegateTask.getVariables();
@ -134,11 +136,9 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
return;
}
});
Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).active().singleResult();
if (task != null && StringUtils.isNotEmpty(task.getAssignee())
if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(abilityApplicationDTO.getUserId())
&& abilityApplicationDTO.getUserId().equals(task.getAssignee())) {
&& abilityApplicationDTO.getUserId().equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}

View File

@ -25,7 +25,6 @@ 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.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -151,10 +150,11 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
* @param delegateTask
*/
private void create(DelegateTask delegateTask) {
String assignee;
Map<String, Object> kv = delegateTask.getVariables();
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
logger.error("roleDTOId:" + roleDTO.getId());
Long deptId = null;
Long deptId;
if (kv.containsKey("deptId")) { // 存在部门id
deptId = Long.valueOf(kv.get("deptId").toString());
SysDeptDTO deptDTO = sysDeptService.get(deptId);
@ -176,15 +176,15 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
delegateTask.setAssignee(userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
logger.error("未查到该部门 {} 对应的 " + roleName, deptId);
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
delegateTask.setAssignee("1516728698224427010");
assignee = "1516728698224427010";
}
if (kv.containsKey("tAbilityApplicationDTOList")) {
List<TAbilityApplicationDTO> dtoList = (List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList");
mpComplete(dtoList, delegateTask);
mpComplete(dtoList, delegateTask, assignee);
}
} else {
try {
@ -195,7 +195,7 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
}
}
private void mpComplete(List<TAbilityApplicationDTO> abilityApplicationDTO, DelegateTask delegateTask) { // 处理免批或申请人为资源提供方部门审批人
private void mpComplete(List<TAbilityApplicationDTO> abilityApplicationDTO, DelegateTask delegateTask, final String assignee) { // 处理免批或申请人为资源提供方部门审批人
Optional<TAbilityApplicationDTO> abilityApplicationDTOOptional = abilityApplicationDTO.stream().findAny();
abilityApplicationDTOOptional.ifPresent(index -> {
if (abilityApplicationDTOOptional.get().getUserId().equals(delegateTask.getAssignee())) {
@ -204,10 +204,9 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
return;
}
});
Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).active().singleResult();
if (task != null && StringUtils.isNotEmpty(task.getAssignee())
if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
&& delegateTask.getVariable("creator", String.class).equals(task.getAssignee())) {
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}

View File

@ -13,7 +13,6 @@ 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.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -89,6 +88,7 @@ public class DataCenterListenerV2 implements TaskListener, ExecutionListener, Ac
* @param delegateTask
*/
private void createEvent(DelegateTask delegateTask) {
String assignee;
logger.error("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.error("deptDTOId:" + deptDTO.getId());
@ -99,15 +99,16 @@ public class DataCenterListenerV2 implements TaskListener, ExecutionListener, Ac
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
logger.error("未查到 {} 对应 " + roleName, bigDateDeptName);
assignee = null;
}
// TODO 批量里存在免批或全为免批的情况?
Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).active().singleResult();
if (task != null && StringUtils.isNotEmpty(task.getAssignee())
if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
&& delegateTask.getVariable("creator", String.class).equals(task.getAssignee())) {
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}

View File

@ -20,7 +20,6 @@ import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.TaskListener;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -123,6 +122,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
* @param roleDTO
*/
private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) {
String assignee;
Map<String, Object> kv = delegateTask.getVariables();
ResourceDTO re = JSON.parseObject(JSON.toJSONString(kv), ResourceDTO.class);
@ -136,18 +136,18 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId() + "姓名:" + userDTO.getRealName());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
logger.error("未查到该部门对应的 " + roleName + " 将使用大数据部门审核人");
defaultUser(delegateTask.getId(), roleDTO);
assignee = defaultUser(delegateTask.getId(), roleDTO);
}
} else {
defaultUser(delegateTask.getId(), roleDTO);
assignee = defaultUser(delegateTask.getId(), roleDTO);
}
Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).active().singleResult();
if (task != null && StringUtils.isNotEmpty(task.getAssignee())
if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(re.getCreator().toString())
&& re.getCreator().toString().equals(task.getAssignee())) {
&& re.getCreator().toString().equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}
@ -158,7 +158,8 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
*
* @param taskId
*/
private void defaultUser(String taskId, final SysRoleDTO roleDTO) {
private String defaultUser(String taskId, final SysRoleDTO roleDTO) {
String assignee;
logger.error("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.error("roleDTOId:" + roleDTO.getId());
@ -167,10 +168,13 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
if (userDTO != null) {
logger.error("大数据审批人id:" + userDTO.getId() + "姓名:" + userDTO.getRealName());
taskService.setAssignee(taskId, userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
logger.error("未查到大数据部门对应 " + roleName);
taskService.setAssignee(taskId, "1516728698224427010");
assignee = "1516728698224427010";
}
return assignee;
}

View File

@ -21,7 +21,6 @@ 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.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -170,6 +169,7 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
* @param roleDTO
*/
private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) {
String assignee;
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
@ -189,18 +189,22 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId() + "姓名:" + userDTO.getRealName());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
assignee = "1516728698224427010";
}
} else if (resourceMountApplyDTO.getDeptId() != null) {
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(Long.valueOf(resourceMountApplyDTO.getDeptId()), roleDTO.getId());
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId() + "姓名:" + userDTO.getRealName());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
logger.error("未查到部门对应 " + resourceMountApplyDTO.getDeptId());
assignee = "1516728698224427010";
}
} else {
logger.error("大数据局名称:" + bigDateDeptName);
@ -211,16 +215,17 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
if (userDTO != null) {
logger.error("大数据审批人id:" + userDTO.getId() + "姓名:" + userDTO.getRealName());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
assignee = userDTO.getId().toString();
} else {
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
logger.error("未查到大数据部门对应 " + roleName);
assignee = "1516728698224427010";
}
}
Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).active().singleResult();
if (task != null && StringUtils.isNotEmpty(task.getAssignee())
if (StringUtils.isNotEmpty(assignee)
&& StringUtils.isNotEmpty(resourceMountApplyDTO.getUserId())
&& resourceMountApplyDTO.getUserId().equals(task.getAssignee())) {
&& resourceMountApplyDTO.getUserId().equals(assignee)) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}