!70 fix(tasktask): 修正业务状态码值对齐super_status字典
* fix(tasktask): 修正业务状态码值对齐super_status字典 * feat(tasktask): 新增业务状态查询接口
This commit is contained in:
+28
@@ -21,6 +21,7 @@ import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.extbpm.process.service.impl.BpmBaseExtApiImpl;
|
||||
import org.jeecg.modules.tasktask.constant.FlowConstants;
|
||||
import org.jeecg.modules.tasktask.dto.BusinessStatusDTO;
|
||||
import org.jeecg.modules.tasktask.dto.RecurringTaskDTO;
|
||||
import org.jeecg.modules.tasktask.entity.TaskTask;
|
||||
import org.jeecg.modules.tasktask.mapper.TaskTaskMapper;
|
||||
@@ -46,8 +47,10 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.api.CommonAPI;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
/**
|
||||
* @Description: 事项任务计划表(发起流程)
|
||||
@@ -63,6 +66,10 @@ public class TaskTaskController extends JeecgController<TaskTask, ITaskTaskServi
|
||||
@Autowired
|
||||
private ITaskTaskService taskTaskService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CommonAPI commonApi;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -205,6 +212,27 @@ public class TaskTaskController extends JeecgController<TaskTask, ITaskTaskServi
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询业务状态(未开始/进行中/已完成)
|
||||
*
|
||||
* @param businessId 业务ID
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "事项任务计划表(发起流程)-查询业务状态")
|
||||
@GetMapping(value = "/getBusinessStatus")
|
||||
public Result<BusinessStatusDTO> getBusinessStatus(@RequestParam(name = "businessId", required = true) String businessId) {
|
||||
if (oConvertUtils.isEmpty(businessId)) {
|
||||
return Result.error("businessId不能为空");
|
||||
}
|
||||
String status = taskTaskService.getBusinessStatusByBusinessId(businessId);
|
||||
String statusText = commonApi.translateDict("super_status", status);
|
||||
BusinessStatusDTO dto = new BusinessStatusDTO();
|
||||
dto.setBusinessId(businessId);
|
||||
dto.setStatus(status);
|
||||
dto.setStatusDictText(statusText);
|
||||
return Result.OK(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部门经办人姓名
|
||||
*/
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package org.jeecg.modules.tasktask.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
@Data
|
||||
@Schema(description = "业务状态DTO")
|
||||
public class BusinessStatusDTO {
|
||||
|
||||
@Schema(description = "业务ID")
|
||||
private String businessId;
|
||||
|
||||
@Dict(dicCode = "super_status")
|
||||
@Schema(description = "业务状态: 0未开始 1进行中 2已完成")
|
||||
private String status;
|
||||
|
||||
@JsonProperty("status_dictText")
|
||||
@Schema(description = "业务状态字典翻译文本")
|
||||
private String statusDictText;
|
||||
|
||||
}
|
||||
+1
@@ -21,4 +21,5 @@ public interface ITaskTaskService extends IService<TaskTask> {
|
||||
boolean deleteSingleProcess(String processInstId);
|
||||
boolean deletePendingTask(String taskId);
|
||||
boolean updateTitleAndDeadline(String taskId, String title, String requireFinishDate);
|
||||
String getBusinessStatusByBusinessId(String businessId);
|
||||
}
|
||||
|
||||
+44
@@ -262,4 +262,48 @@ public class TaskTaskServiceImpl extends ServiceImpl<TaskTaskMapper, TaskTask> i
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBusinessStatusByBusinessId(String businessId) {
|
||||
if (StringUtils.isBlank(businessId)) {
|
||||
log.warn("【督办-查询业务状态】businessId为空, 状态: 1(未开始)");
|
||||
return "1";
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<TaskTask> queryWrapper = new LambdaQueryWrapper<TaskTask>()
|
||||
.eq(TaskTask::getBusinessId, businessId);
|
||||
List<TaskTask> taskList = this.list(queryWrapper);
|
||||
|
||||
// 中间表无数据 -> 未开始
|
||||
if (taskList == null || taskList.isEmpty()) {
|
||||
log.info("【督办-查询业务状态】无关联流程实例, businessId: {}, 状态: 1(未开始)", businessId);
|
||||
return "1";
|
||||
}
|
||||
|
||||
// 逐个检查关联的流程实例是否已结束
|
||||
boolean hasAnyProcess = false;
|
||||
for (TaskTask tt : taskList) {
|
||||
if (StringUtils.isBlank(tt.getProcessInstId())) {
|
||||
continue;
|
||||
}
|
||||
hasAnyProcess = true;
|
||||
long running = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(tt.getProcessInstId())
|
||||
.count();
|
||||
if (running > 0) {
|
||||
// 存在运行中的流程 -> 督办中
|
||||
log.info("【督办-查询业务状态】存在运行中的流程实例, businessId: {}, processInstId: {}, 状态: 2(督办中)",
|
||||
businessId, tt.getProcessInstId());
|
||||
return "2";
|
||||
}
|
||||
}
|
||||
|
||||
// 有关联流程且全部结束 -> 已完成; 仅有待发起记录 -> 督办中
|
||||
if (hasAnyProcess) {
|
||||
log.info("【督办-查询业务状态】所有关联流程均已结束, businessId: {}, 状态: 3(已完成)", businessId);
|
||||
return "3";
|
||||
}
|
||||
log.info("【督办-查询业务状态】仅有待发起任务记录, businessId: {}, 状态: 2(督办中)", businessId);
|
||||
return "2";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user