fix(征求意见流程): 设计工程师填写征求意见问题修复

This commit is contained in:
yjz
2024-01-11 16:05:50 +08:00
parent e96a84d3cd
commit a29007a5ee
@@ -3,6 +3,7 @@ package com.jero.modules.activiti.process.fb.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.common.api.vo.ResultCommon; import com.jero.common.api.vo.ResultCommon;
import com.jero.common.util.SnowflakeUtils;
import com.jero.common.util.UUIDUtils; import com.jero.common.util.UUIDUtils;
import com.jero.modules.activiti.entity.ProcessAll; import com.jero.modules.activiti.entity.ProcessAll;
import com.jero.modules.activiti.entity.ProcessApprovalRecord; import com.jero.modules.activiti.entity.ProcessApprovalRecord;
@@ -618,31 +619,36 @@ public class ProcessFbStandardConsultationServiceImpl extends ServiceImpl<Proces
String userLinkId = task.getFormKey(); String userLinkId = task.getFormKey();
log.info("userLinkId: {}", userLinkId); log.info("userLinkId: {}", userLinkId);
processFbConsultationUserLinkService.update( // processFbConsultationUserLinkService.update(
new LambdaUpdateWrapper<ProcessFbConsultationUserLink>() // new LambdaUpdateWrapper<ProcessFbConsultationUserLink>()
.eq(ProcessFbConsultationUserLink::getId, userLinkId) // .eq(ProcessFbConsultationUserLink::getId, userLinkId)
.set(ProcessFbConsultationUserLink::getDesignEngineerId, designEngineerId)); // .set(ProcessFbConsultationUserLink::getDesignEngineerId, designEngineerId));
// ProcessFbConsultationUserLink processFbConsultationUserLink = processFbConsultationUserLinkService.getById(userLinkId); ProcessFbConsultationUserLink processFbConsultationUserLink =
processFbConsultationUserLinkService.listByIds(Arrays.asList(userLinkId.split(","))).get(0);
// //
List<String> designEngineerIdList = Arrays.asList(designEngineerId.split(",")); List<String> designEngineerIdList = Arrays.asList(designEngineerId.split(","));
// List<ProcessFbConsultationUserLink> userLinkList = new ArrayList<>(); List<ProcessFbConsultationUserLink> userLinkList = new ArrayList<>();
// List<String> idList =new ArrayList<>();
// designEngineerIdList.forEach(designEngineer -> {
// ProcessFbConsultationUserLink userLink = new ProcessFbConsultationUserLink();
// userLink.setUserType(FbCommon.USER_TYPE_MODULE_OWNER);
// userLink.setBusinessId(processFbConsultationUserLink.getBusinessId());
// userLink.setDepartLeaderId(processFbConsultationUserLink.getDepartLeaderId());
// userLink.setModuleOwnerId(processFbConsultationUserLink.getModuleOwnerId());
// userLink.setDesignEngineerId(designEngineer);
// userLinkList.add(userLink);
// });
//
// processFbConsultationUserLinkService.removeById(userLinkId); // 先删除
// processFbConsultationUserLinkService.saveBatch(userLinkList, userLinkList.size()); // 后新增
// List<String> idList = userLinkList.stream().map(ProcessFbConsultationUserLink::getId).collect(Collectors.toList()); designEngineerIdList.forEach(designEngineer -> {
ProcessFbConsultationUserLink userLink = new ProcessFbConsultationUserLink();
userLink.setId(String.valueOf(SnowflakeUtils.snowflake()));
userLink.setUserType(FbCommon.USER_TYPE_MODULE_OWNER);
userLink.setBusinessId(processFbConsultationUserLink.getBusinessId());
userLink.setDepartLeaderId(processFbConsultationUserLink.getDepartLeaderId());
userLink.setModuleOwnerId(processFbConsultationUserLink.getModuleOwnerId());
userLink.setDesignEngineerId(designEngineer);
userLinkList.add(userLink);
idList.add(userLink.getId());
});
task.setFormKey(String.join(",", idList));
processFbConsultationUserLinkService.removeByIds(Arrays.asList(userLinkId.split(","))); // 先删除
processFbConsultationUserLinkService.saveBatch(userLinkList, userLinkList.size()); // 后新增
List<String> ids = userLinkList.stream().map(ProcessFbConsultationUserLink::getId).collect(Collectors.toList());
String processInstanceId = task.getProcessInstanceId(); String processInstanceId = task.getProcessInstanceId();
runtimeService.setVariableLocal(processInstanceId, FbCommon.VARIABLE_DESIGN_ENGINEER_LIST, designEngineerIdList); runtimeService.setVariableLocal(processInstanceId, FbCommon.VARIABLE_DESIGN_ENGINEER_LIST, ids);
saveNodeUserLink(processInstanceId, ConsultationNodeSort.DESIGN_ENGINEER_LIST, designEngineerIdList); saveNodeUserLink(processInstanceId, ConsultationNodeSort.DESIGN_ENGINEER_LIST, designEngineerIdList);
// 完成任务 // 完成任务
@@ -664,30 +670,37 @@ public class ProcessFbStandardConsultationServiceImpl extends ServiceImpl<Proces
Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String userLinkId = task.getFormKey(); String userLinkId = task.getFormKey();
processFbConsultationUserLinkService.update( // processFbConsultationUserLinkService.update(
new LambdaUpdateWrapper<ProcessFbConsultationUserLink>() // new LambdaUpdateWrapper<ProcessFbConsultationUserLink>()
.eq(ProcessFbConsultationUserLink::getId, userLinkId) // .eq(ProcessFbConsultationUserLink::getId, userLinkId)
.set(ProcessFbConsultationUserLink::getDesignEngineerId, designEngineerId)); // .set(ProcessFbConsultationUserLink::getDesignEngineerId, designEngineerId));
// ProcessFbConsultationUserLink processFbConsultationUserLink = processFbConsultationUserLinkService.getById(userLinkId); ProcessFbConsultationUserLink processFbConsultationUserLink =
// List<String> designEngineerIdList = Arrays.asList(designEngineerId.split(",")); processFbConsultationUserLinkService.listByIds(Arrays.asList(userLinkId.split(","))).get(0);
// List<ProcessFbConsultationUserLink> userLinkList = new ArrayList<>(); List<String> designEngineerIdList = Arrays.asList(designEngineerId.split(","));
List<ProcessFbConsultationUserLink> userLinkList = new ArrayList<>();
// designEngineerIdList.forEach(designEngineer -> { List<String> idList =new ArrayList<>();
// ProcessFbConsultationUserLink userLink = new ProcessFbConsultationUserLink(); designEngineerIdList.forEach(designEngineer -> {
// userLink.setUserType(FbCommon.USER_TYPE_MODULE_OWNER); ProcessFbConsultationUserLink userLink = new ProcessFbConsultationUserLink();
// userLink.setBusinessId(processFbConsultationUserLink.getBusinessId()); userLink.setId(String.valueOf(SnowflakeUtils.snowflake()));
// userLink.setBusinessId(processInfoVO.getBusinessId()); userLink.setUserType(FbCommon.USER_TYPE_MODULE_OWNER);
// userLink.setDepartLeaderId(processFbConsultationUserLink.getDepartLeaderId()); userLink.setBusinessId(processFbConsultationUserLink.getBusinessId());
// userLink.setModuleOwnerId(processFbConsultationUserLink.getModuleOwnerId()); userLink.setBusinessId(processInfoVO.getBusinessId());
// userLink.setDesignEngineerId(designEngineer); userLink.setDepartLeaderId(processFbConsultationUserLink.getDepartLeaderId());
// userLinkList.add(userLink); userLink.setModuleOwnerId(processFbConsultationUserLink.getModuleOwnerId());
// }); userLink.setDesignEngineerId(designEngineer);
// userLink.setParentExecutionId(processFbConsultationUserLink.getParentExecutionId());
// int size = userLinkList.size(); userLinkList.add(userLink);
// if (size > 0) { idList.add(userLink.getId());
// processFbConsultationUserLinkService.removeById(userLinkId); // 先删除 });
// processFbConsultationUserLinkService.saveBatch(userLinkList, size); // 后新增
// } int size = userLinkList.size();
if (size > 0) {
task.setFormKey(String.join(",", idList));
taskService.saveTask(task);
processFbConsultationUserLinkService.removeByIds(Arrays.asList(userLinkId.split(","))); // 先删除
processFbConsultationUserLinkService.saveBatch(userLinkList, size); // 后新增
}
} }