feat(erp): 添加售后流程自动抄送项目管理功能并完善工时表提交逻辑

dev
Yangk 5 days ago
parent 85be59a474
commit 15f00340a9

@ -39,11 +39,17 @@ import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.context.event.EventListener;
import org.dromara.workflow.api.event.ProcessEvent;
import org.dromara.workflow.api.event.ProcessTaskEvent;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.system.api.RemoteUserService;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.dromara.workflow.api.domain.RemoteFlowCopy;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.Collections;
/**
* Service
@ -64,6 +70,9 @@ public class ErpAfterSalesServiceImpl implements IErpAfterSalesService {
@DubboReference()
private RemoteCodeRuleService remoteCodeRuleService;
@DubboReference
private RemoteUserService remoteUserService;
private final IErpAfterSalesLaborCostsService laborCostsService;
private final IErpAfterSalesMaterialCostsService materialCostsService;
@ -313,6 +322,17 @@ public class ErpAfterSalesServiceImpl implements IErpAfterSalesService {
bo.setVariables(new HashMap<>());
}
bo.getVariables().put("ignore", true);
// 预设抄送用户变量:查询"项目管理"角色下的用户ID
Long projectMgrRoleId = 1985260184236380162L;
List<RemoteUserVo> copyUsers = remoteUserService.selectUsersByRoleIds(
Collections.singletonList(projectMgrRoleId));
if (CollUtil.isNotEmpty(copyUsers)) {
String copyUserIds = StreamUtils.join(copyUsers, user -> String.valueOf(user.getUserId()));
bo.getVariables().put("afterSalesCopyUsers", copyUserIds);
log.info("【售后抄送】预设抄送用户变量: {}", copyUserIds);
}
RemoteStartProcess startProcess = new RemoteStartProcess();
startProcess.setBusinessId(bo.getAfterSalesId().toString());
startProcess.setFlowCode(bo.getFlowCode());

@ -344,6 +344,8 @@ public class ErpTimesheetInfoServiceImpl implements IErpTimesheetInfoService {
completeTask.setTaskId(result.getTaskId());
// 审批意见,提交时默认为 "提交申请"
completeTask.setMessage("提交申请");
// 消息类型 1=站内信
completeTask.setMessageType(Collections.singletonList("1"));
completeTask.setVariables(variables);
boolean completeFlag = remoteWorkflowService.completeTask(completeTask);
if (!completeFlag) {

Loading…
Cancel
Save