|
|
@@ -3,6 +3,7 @@ package com.tuoheng.admin.service.inspectionfile; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.tuoheng.admin.entity.Inspection; |
|
|
|
import com.tuoheng.admin.entity.InspectionFile; |
|
|
@@ -104,25 +105,66 @@ public class InspectionFileServiceImpl implements IInspectionFileService { |
|
|
|
public JsonResult getQuestionList() { |
|
|
|
//获取当前登录人租户id |
|
|
|
String tenantId = CurrentUserUtil.getTenantId(); |
|
|
|
//获取当前登录人信息 |
|
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
|
//获取用户角色 |
|
|
|
Integer roleId = user.getRoleId(); |
|
|
|
if(roleId ==null){ |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//查询区域范范围问题 |
|
|
|
List<InspectionFile> inspectionFileLists = new ArrayList<>(); |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
.eq(InspectionFile::getMark, 1) |
|
|
|
.eq(InspectionFile::getTenantId, tenantId)); |
|
|
|
if (CollectionUtil.isEmpty(inspectionFileList)) { |
|
|
|
return JsonResult.success("该覆盖区域范围内没有问题"); |
|
|
|
//超级管理员 |
|
|
|
if(RoleEnum.SUPER_ADMIN.getCode()==roleId){ |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
.eq(InspectionFile::getMark, 1) |
|
|
|
.eq(InspectionFile::getTenantId, tenantId)); |
|
|
|
if (CollectionUtil.isEmpty(inspectionFileList)) { |
|
|
|
return JsonResult.success("该覆盖区域范围内没有问题"); |
|
|
|
} |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
//任务状态判断 |
|
|
|
if(20 == inspectionFile.getStatus()){ |
|
|
|
//任务状态判断,已生成工单,问题未解决 |
|
|
|
Inspection inspection = inspectionMapper.selectById(inspectionFile.getInspectionId()); |
|
|
|
if (ObjectUtil.isNull(inspection)) { |
|
|
|
JsonResult.error("问题所属的任务不存在"); |
|
|
|
} |
|
|
|
inspectionFileLists.add(inspectionFile); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
//任务状态判断 |
|
|
|
if(20 == inspectionFile.getStatus()){ |
|
|
|
//任务状态判断,已生成工单,问题未解决 |
|
|
|
Inspection inspection = inspectionMapper.selectById(inspectionFile.getInspectionId()); |
|
|
|
if (ObjectUtil.isNull(inspection)) { |
|
|
|
JsonResult.error("问题所属的任务不存在"); |
|
|
|
//部门管理员及普通用户 本部门的问题 |
|
|
|
if(RoleEnum.ADMIN.getCode()== user.getRoleId() || RoleEnum.ORDINARY_USER.getCode()== user.getRoleId()){ |
|
|
|
//根据用户查询对应的巡检任务id |
|
|
|
List<Inspection> inspectionList = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>() |
|
|
|
.eq(Inspection::getTenantId, tenantId) |
|
|
|
.eq(Inspection::getMark, 1) |
|
|
|
.eq(Inspection::getDeptId, user.getDeptId())); |
|
|
|
//查询对应的问题 |
|
|
|
for (Inspection inspection : inspectionList) { |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
.eq(InspectionFile::getMark, 1) |
|
|
|
.eq(InspectionFile::getTenantId, tenantId) |
|
|
|
.eq(InspectionFile::getInspectionId, inspection.getId())); |
|
|
|
if (CollectionUtil.isEmpty(inspectionFileList)) { |
|
|
|
return JsonResult.success("该覆盖区域范围内没有问题"); |
|
|
|
} |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
//任务状态判断 |
|
|
|
if(20 == inspectionFile.getStatus()){ |
|
|
|
//任务状态判断,已生成工单,问题未解决 |
|
|
|
Inspection inspections = inspectionMapper.selectById(inspectionFile.getInspectionId()); |
|
|
|
if (ObjectUtil.isNull(inspections)) { |
|
|
|
JsonResult.error("问题所属的任务不存在"); |
|
|
|
} |
|
|
|
inspectionFileLists.add(inspectionFile); |
|
|
|
} |
|
|
|
} |
|
|
|
inspectionFileLists.add(inspectionFile); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<InspectionFileVo> list = inspectionFileLists.stream().map(x -> { |
|
|
|
InspectionFileVo vo = new InspectionFileVo(); |
|
|
|
BeanUtils.copyProperties(x, vo); |
|
|
@@ -234,11 +276,6 @@ public class InspectionFileServiceImpl implements IInspectionFileService { |
|
|
|
vo5.setType(QuestionTypeEnum.LONGITUDINAL_CRACK_NAME.getCode()); |
|
|
|
vo5.setNum(longitudinalCrackNum); |
|
|
|
Collections.addAll(list,vo,vo1,vo2,vo3,vo4,vo5); |
|
|
|
// list.add(vo); |
|
|
|
// list.add(vo1); |
|
|
|
// list.add(vo2); |
|
|
|
// list.add(vo3); |
|
|
|
// list.add(vo4); |
|
|
|
} |
|
|
|
//若角色为部门管理员或普通用户 |
|
|
|
if(RoleEnum.ADMIN.getCode()== user.getRoleId() || RoleEnum.ORDINARY_USER.getCode()== user.getRoleId()){ |