diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java index 1c96e7c..8e6542f 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.task.service.impl; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -38,6 +39,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Query; @@ -100,7 +102,8 @@ public class TaskServiceImpl extends BaseServiceImpl imp private IObjectDangerService objectDangerService; @Autowired private PlanMapper planMapper; - + @Autowired + private BladeLogger logger; @Autowired private TaskNoUserDataScopeMapper taskNoUserDataScopeMapper; @@ -242,10 +245,17 @@ public class TaskServiceImpl extends BaseServiceImpl imp } //检查任务 checkOpenMutipleTask(AuthUtil.getUserId()); - TaskUserEntity userEntity = taskUserService.getOne(Wrappers.lambdaQuery().eq(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).eq(TaskUserEntity::getTaskId, task.getId())); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery().eq(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).eq(TaskUserEntity::getTaskId, task.getId()); + List claimUsers = taskUserService.list(wrapper); + TaskUserEntity userEntity = CollectionUtil.isNotEmpty(claimUsers) ? claimUsers.get(0) : null; if (Func.isNotEmpty(userEntity)) { - removeStartTaskId(id); - throw new ServiceException("该任务已被领用,请刷新页面"); + if(AuthUtil.getUserId().equals(userEntity.getUserId())) { + logger.error("hzims:inspect:startTask:taskUser","任务id[" +id+ "]领用人员为:" + JSON.toJSONString(claimUsers)); + } + else { + removeStartTaskId(id); + throw new ServiceException("该任务已被领用,请刷新页面"); + } } //给当前人领取任务