|
|
@@ -1,13 +1,28 @@ |
|
|
|
package com.tuoheng.admin.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.tuoheng.admin.entity.Inspection; |
|
|
|
import com.tuoheng.admin.entity.InspectionFile; |
|
|
|
import com.tuoheng.admin.entity.QuestionType; |
|
|
|
import com.tuoheng.admin.mapper.InspectionFileMapper; |
|
|
|
import com.tuoheng.admin.mapper.InspectionMapper; |
|
|
|
import com.tuoheng.admin.mapper.QuestionTypeMapper; |
|
|
|
import com.tuoheng.admin.service.IInspectionFileService; |
|
|
|
import com.tuoheng.admin.utils.ShiroUtils; |
|
|
|
import com.tuoheng.admin.vo.InspectionFileVo; |
|
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
|
import com.tuoheng.common.core.utils.StringUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 任务问题管理 前端控制器 |
|
|
|
* |
|
|
@@ -24,17 +39,60 @@ public class InspectionFileServiceImpl implements IInspectionFileService { |
|
|
|
@Autowired |
|
|
|
private InspectionMapper inspectionMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QuestionTypeMapper questionTypeMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 问题类型和任务名称 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JsonResult getQuestionList() { |
|
|
|
//String tenantId = ShiroUtils.getTenantId(); |
|
|
|
String tenantId = "0"; |
|
|
|
//查询区域范范围问题 |
|
|
|
List<InspectionFile> inspectionFileLists = new ArrayList<>(); |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
.eq(InspectionFile::getMark, 1) |
|
|
|
.eq(InspectionFile::getTenantId, tenantId)); |
|
|
|
if (null == inspectionFileList) { |
|
|
|
return JsonResult.error("该覆盖区域范围内没有问题"); |
|
|
|
} |
|
|
|
for (InspectionFile inspectionFile : inspectionFileList) { |
|
|
|
//任务状态判断 |
|
|
|
Inspection inspection = inspectionMapper.selectById(inspectionFile.getInspectionId()); |
|
|
|
if (ObjectUtil.isNull(inspection)) { |
|
|
|
JsonResult.error("问题所属的任务不存在"); |
|
|
|
} |
|
|
|
//任务状态判断,已生成工单,问题未解决 |
|
|
|
Integer status = inspection.getStatus(); |
|
|
|
if (20 == status) { |
|
|
|
inspectionFileLists.add(inspectionFile); |
|
|
|
} |
|
|
|
} |
|
|
|
List<InspectionFileVo> list = inspectionFileLists.stream().map(x -> { |
|
|
|
InspectionFileVo vo = new InspectionFileVo(); |
|
|
|
BeanUtils.copyProperties(x, vo); |
|
|
|
//任务名称 |
|
|
|
if (StringUtils.isNotEmpty(x.getInspectionId())) { |
|
|
|
Inspection inspection = inspectionMapper.selectById(x.getInspectionId()); |
|
|
|
if (ObjectUtil.isNull(inspection)) { |
|
|
|
JsonResult.error(); |
|
|
|
} |
|
|
|
vo.setName(inspection.getName()); |
|
|
|
//问题类型 |
|
|
|
if (StringUtils.isNotEmpty(x.getQuestionId())) { |
|
|
|
QuestionType questionType = questionTypeMapper.selectById(x.getQuestionId()); |
|
|
|
if (null != questionType) { |
|
|
|
vo.setType(questionType.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return JsonResult.success(list); |
|
|
|
} |
|
|
|
} |