修改tasktask新增接口适配前端修改

This commit is contained in:
wsm
2026-05-22 16:30:39 +08:00
parent fa02124672
commit 0d6ad5b459
3 changed files with 52 additions and 0 deletions
@@ -206,6 +206,22 @@ public class TaskTaskController extends JeecgController<TaskTask, ITaskTaskServi
return Result.OK(taskTaskList); return Result.OK(taskTaskList);
} }
/**
* 更新部门经办人姓名
*/
@AutoLog(value = "事项任务计划表-更新部门经办人姓名")
@Operation(summary = "事项任务计划表-更新部门经办人姓名")
@PostMapping(value = "/updateDeptHandlerName")
public Result<String> updateDeptHandlerName(@RequestBody Map<String, String> params) {
String processInstanceId = params.get("processInstanceId");
String deptHandlerName = params.get("deptHandlerName");
if (StringUtils.isBlank(processInstanceId) || StringUtils.isBlank(deptHandlerName)) {
return Result.error("processInstanceId 和 deptHandlerName 不能为空");
}
boolean success = taskTaskService.updateDeptHandlerName(processInstanceId, deptHandlerName);
return success ? Result.OK("更新成功") : Result.error("更新失败,未找到对应任务记录");
}
/** /**
* 导出excel * 导出excel
* *
@@ -17,4 +17,5 @@ public interface ITaskTaskService extends IService<TaskTask> {
boolean multiFlowStart(TaskTask taskTask,String userName,Integer intervalType, Integer startCount) throws Exception; boolean multiFlowStart(TaskTask taskTask,String userName,Integer intervalType, Integer startCount) throws Exception;
Result<?> handleFlowStart(TaskTask taskTask, String username, Integer intervalType, Integer startCount)throws Exception; Result<?> handleFlowStart(TaskTask taskTask, String username, Integer intervalType, Integer startCount)throws Exception;
List<TaskTask> getTaskTaskListByBusinessId(String businessId) throws Exception; List<TaskTask> getTaskTaskListByBusinessId(String businessId) throws Exception;
boolean updateDeptHandlerName(String processInstanceId, String deptHandlerName);
} }
@@ -2,8 +2,11 @@ package org.jeecg.modules.tasktask.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.shiro.util.Assert; import org.apache.shiro.util.Assert;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.runtime.ProcessInstance;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.extbpm.process.exception.BpmException; import org.jeecg.modules.extbpm.process.exception.BpmException;
import org.jeecg.modules.extbpm.process.service.impl.BpmBaseExtApiImpl; import org.jeecg.modules.extbpm.process.service.impl.BpmBaseExtApiImpl;
@@ -28,10 +31,13 @@ import java.util.*;
* @Date: 2026-04-17 * @Date: 2026-04-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Slf4j
@Service @Service
public class TaskTaskServiceImpl extends ServiceImpl<TaskTaskMapper, TaskTask> implements ITaskTaskService { public class TaskTaskServiceImpl extends ServiceImpl<TaskTaskMapper, TaskTask> implements ITaskTaskService {
@Autowired @Autowired
private BpmBaseExtApiImpl bpmBaseExtApiImpl; private BpmBaseExtApiImpl bpmBaseExtApiImpl;
@Autowired
private RuntimeService runtimeService;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean singleFlowStart(TaskTask taskTask, String userName) throws Exception { public boolean singleFlowStart(TaskTask taskTask, String userName) throws Exception {
String jsonString = Optional.ofNullable(taskTask.getJsonData()) String jsonString = Optional.ofNullable(taskTask.getJsonData())
@@ -139,4 +145,33 @@ public class TaskTaskServiceImpl extends ServiceImpl<TaskTaskMapper, TaskTask> i
// 2. 查询不到数据 → MP 本身会返回空集合,不是 null // 2. 查询不到数据 → MP 本身会返回空集合,不是 null
return this.list(queryWrapper); return this.list(queryWrapper);
} }
@Override
public boolean updateDeptHandlerName(String processInstanceId, String deptHandlerName) {
if (StringUtils.isBlank(processInstanceId) || StringUtils.isBlank(deptHandlerName)) {
log.warn("updateDeptHandlerName: processInstanceId 或 deptHandlerName 为空");
return false;
}
// 1. 通过 Flowable RuntimeService 获取流程实例,进而获取 businessKey(即 taskTask ID
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstanceId)
.singleResult();
if (processInstance == null) {
log.warn("updateDeptHandlerName: 未找到 processInstanceId={} 对应的流程实例", processInstanceId);
return false;
}
String businessKey = processInstance.getBusinessKey();
if (StringUtils.isBlank(businessKey)) {
log.warn("updateDeptHandlerName: processInstanceId={} 的 businessKey 为空", processInstanceId);
return false;
}
// 2. businessKey 即为 taskTask 的主键 ID,直接通过 ID 查询
TaskTask taskTask = this.getById(businessKey);
if (taskTask == null) {
log.warn("updateDeptHandlerName: 未找到 id={} 对应的 taskTask", businessKey);
return false;
}
taskTask.setDeptHandlerName(deptHandlerName);
return this.updateById(taskTask);
}
} }