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