|
|
@@ -38,6 +38,7 @@ import com.xunmei.system.api.RemoteOrgService;
|
|
|
import com.xunmei.system.api.RemoteRoleService;
|
|
|
import com.xunmei.system.api.RemoteUserService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
+import com.xunmei.system.api.domain.SysUser;
|
|
|
import com.xunmei.system.api.model.LoginUser;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -98,9 +99,9 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
|
|
|
wrapper.eq(CoreSafetyTask::getOrgId, dto.getBeCheckedOrgId());
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(dto.getCheckOrgId())) {
|
|
|
- wrapper.and(w->w.eq(CoreSafetyTask::getCheckOrgId, dto.getCheckOrgId())
|
|
|
+ wrapper.and(w -> w.eq(CoreSafetyTask::getCheckOrgId, dto.getCheckOrgId())
|
|
|
.or()
|
|
|
- .eq(CoreSafetyTask::getGrantUserId,SecurityUtils.getUserId()));
|
|
|
+ .eq(CoreSafetyTask::getGrantUserId, SecurityUtils.getUserId()));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(dto.getStatus())) {
|
|
|
wrapper.eq(CoreSafetyTask::getStatus, dto.getStatus());
|
|
|
@@ -121,7 +122,7 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
|
|
|
page.getRecords().forEach(vo -> {
|
|
|
List<CoreSafetyTask> v = list.stream()
|
|
|
.filter(i -> ObjectUtil.equal(i.getPlanId(), vo.getPlanId()) && ObjectUtil.equal(vo.getCount(), i.getCount())
|
|
|
- && ObjectUtil.equal(vo.getTaskName(),i.getTitle())
|
|
|
+ && ObjectUtil.equal(vo.getTaskName(), i.getTitle())
|
|
|
&& ObjectUtil.equal(i.getPlanStartTime(), vo.getPlanStartTime()) && ObjectUtil.equal(i.getPlanEndTime(), vo.getPlanEndTime()))
|
|
|
.collect(Collectors.toList());
|
|
|
List<Long> roleIds = planToRoles.stream().filter(p -> ObjectUtil.equal(p.getPlanId(), vo.getPlanId()))
|
|
|
@@ -229,7 +230,7 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
|
|
|
List<AppTaskRegisterPointVo> points = new ArrayList<>();
|
|
|
List<TaskRegisterNfcVo> nfcs = new ArrayList<>();
|
|
|
if (ObjectUtil.equal(task.getStatus(), SafetyCheckTaskStatus.Completed.getValue()) || ObjectUtils.isNull(plan)) {
|
|
|
- points = baseMapper.selectPoint(null, taskId);
|
|
|
+ points = baseMapper.selectPointByTask(taskId);
|
|
|
nfcs = baseMapper.selectNfcByTask(taskId);
|
|
|
} else {
|
|
|
points = baseMapper.selectPoint(plan.getId(), taskId);
|
|
|
@@ -609,17 +610,26 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
|
|
|
|
|
|
Long loginUserId = SecurityUtils.getUserId();
|
|
|
if (ObjectUtil.isNotNull(dto.getUserId())) {
|
|
|
- List<IdNameVo> roles = remoteUserService.getRoleInfoOfUser(dto.getUserId(), SecurityConstants.INNER);
|
|
|
- if (CollectionUtil.isNotEmpty(roles)) {
|
|
|
- LambdaQueryWrapper<CoreSafecheckPlanToRole> prWrapper = new LambdaQueryWrapper<>();
|
|
|
- prWrapper.eq(CoreSafecheckPlanToRole::getPlanId, dto.getPlanId())
|
|
|
- .select(CoreSafecheckPlanToRole::getRoleId);
|
|
|
- List<Long> planRoles = coreSafecheckPlanToRoleMapper.selectList(prWrapper).stream()
|
|
|
- .map(CoreSafecheckPlanToRole::getRoleId)
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- if (CollectionUtil.intersection(roles.stream().map(IdNameVo::getId).collect(Collectors.toList()), planRoles).size() > 0) {
|
|
|
- throw new ServiceException("用户已在检查角色中,无需授权");
|
|
|
+ SysUser user = remoteUserService.getUserById(dto.getUserId(), SecurityConstants.INNER);
|
|
|
+ if (ObjectUtil.isNull(user)) {
|
|
|
+ throw new ServiceException("用户不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ObjectUtil.equal(user.getOrgId(), task.getCheckOrgId())) {
|
|
|
+ //同一个机构,才判断是否在角色内
|
|
|
+ List<IdNameVo> roles = remoteUserService.getRoleInfoOfUser(dto.getUserId(), SecurityConstants.INNER);
|
|
|
+ if (CollectionUtil.isNotEmpty(roles)) {
|
|
|
+ LambdaQueryWrapper<CoreSafecheckPlanToRole> prWrapper = new LambdaQueryWrapper<>();
|
|
|
+ prWrapper.eq(CoreSafecheckPlanToRole::getPlanId, dto.getPlanId())
|
|
|
+ .select(CoreSafecheckPlanToRole::getRoleId);
|
|
|
+ List<Long> planRoles = coreSafecheckPlanToRoleMapper.selectList(prWrapper).stream()
|
|
|
+ .map(CoreSafecheckPlanToRole::getRoleId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (CollectionUtil.intersection(roles.stream().map(IdNameVo::getId).collect(Collectors.toList()), planRoles).size() > 0) {
|
|
|
+
|
|
|
+ throw new ServiceException("用户已在检查角色中,无需授权");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|