Browse Source

1、新增查询问题类型列表接口;2、信息查询问题分页列表接口;

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
2a26a63834
11 changed files with 268 additions and 38 deletions
  1. +1
    -12
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +16
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/QuestionTypeController.java
  3. +10
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java
  4. +17
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java
  5. +0
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IQuestionTypeService.java
  6. +18
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java
  7. +0
    -14
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/QuestionTypeServiceImpl.java
  8. +129
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java
  9. +22
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/questiontype/IQuestionTypeService.java
  10. +20
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/questiontype/QuestionTypeServiceImpl.java
  11. +35
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/questiontype/query/QueryQuestionTypeListService.java

+ 1
- 12
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java View File

@@ -48,7 +48,7 @@ public class InspectionFileController {
*/
@GetMapping("/page/list")
public JsonResult getPageList(@RequestBody QueryInspectionFilePageListRequest request){
return null;
return iInspectionFileService.getPageList(request);
}

/**
@@ -81,15 +81,4 @@ public class InspectionFileController {
return iInspectionFileService.ignore(idList);
}

/**
* 生成报告
*
* @param inspectionId 巡检ID
* @return
*/
@GetMapping("/generate/report")
public JsonResult generateReport(Integer inspectionId) {
return JsonResult.success();
}

}

+ 16
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/QuestionTypeController.java View File

@@ -1,5 +1,9 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.service.questiontype.IQuestionTypeService;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@@ -8,10 +12,20 @@ import org.springframework.web.bind.annotation.RestController;
* @Date 2022/11/29
*/
@RestController
@RequestMapping("/questionType")
@RequestMapping("/question/type")
public class QuestionTypeController {

@Autowired
private IQuestionTypeService questionTypeService;


/**
* 查询问题类型列表
*
* @return
*/
@GetMapping("/list")
public JsonResult getList() {
return questionTypeService.getList();
}

}

+ 10
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java View File

@@ -7,6 +7,7 @@ import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import org.apache.ibatis.annotations.Param;

import java.util.List;
@@ -44,11 +45,19 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> {
List<InspectionFile> selectListByInspectIdList(List<String> inspectionIdList);

/**
* 查询任务ID查询任务分页列表
* 查询任务ID查询任务问题分页列表
*
* @param request 巡检任务查询实体
* @return 巡检任务集合
*/
Page<InspectionFile> selectPageListByInspectionId(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListByInspectionIdRequest request);

/**
* 查询任务问题分页列表
*
* @param request 巡检任务查询实体
* @return 巡检任务集合
*/
Page<InspectionFile> selectPageListByInspectionId(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request);

}

+ 17
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java View File

@@ -2,6 +2,7 @@ package com.tuoheng.admin.service;

import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.common.core.utils.JsonResult;

import java.util.List;
@@ -15,8 +16,24 @@ public interface IInspectionFileService {

JsonResult getListByDeptUserType(InspectionFileQuery query);

/**
*
* 根据任务Id查询任务分页列表
*
* @param request
* @return
*/
JsonResult getPageListByInspectionId(QueryInspectionFilePageListByInspectionIdRequest request);

/**
*
* 查询任务分页列表
*
* @param request
* @return
*/
JsonResult getPageList(QueryInspectionFilePageListRequest request);

/**
*
* 确认

+ 0
- 8
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IQuestionTypeService.java View File

@@ -1,8 +0,0 @@
package com.tuoheng.admin.service;

/**
* @Author ChengWang
* @Date 2022/11/29
*/
public interface IQuestionTypeService {
}

+ 18
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java View File

@@ -14,10 +14,12 @@ import com.tuoheng.admin.enums.code.questionType.QuestionTypeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.service.IInspectionFileService;
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService;
import com.tuoheng.admin.service.inspectionfile.ignore.InspectionFileIgnoreService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByInspectionIdService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListService;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.InspectionFileVo;
import com.tuoheng.admin.vo.ListByDeptUserTypeVo;
@@ -65,6 +67,9 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
@Autowired
private QueryInspectionFilePageListByInspectionIdService queryInspectionFilePageListByInspectionIdService;

@Autowired
private QueryInspectionFilePageListService queryInspectionFilePageListService;

@Autowired
private InspectionFileIgnoreService inspectionFileIgnoreService;

@@ -259,7 +264,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
}

/**
* 根据任务ID查询任务分页列表
* 根据任务ID查询任务问题分页列表
*
* @return
*/
@@ -268,6 +273,18 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
return queryInspectionFilePageListByInspectionIdService.getPageListByInspectionId(request);
}

/**
*
* 查询任务问题分页列表
*
* @param request
* @return
*/
@Override
public JsonResult getPageList(QueryInspectionFilePageListRequest request) {
return queryInspectionFilePageListService.getPageList(request);
}

/**
*
* 确认

+ 0
- 14
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/QuestionTypeServiceImpl.java View File

@@ -1,14 +0,0 @@
package com.tuoheng.admin.service.impl;

import com.tuoheng.admin.service.IQuestionTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
* @Author ChengWang
* @Date 2022/11/29
*/
@Service
@Slf4j
public class QuestionTypeServiceImpl implements IQuestionTypeService {
}

+ 129
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java View File

@@ -0,0 +1,129 @@
package com.tuoheng.admin.service.inspectionfile.query;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.InspectionFileConverMapper;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.QuestionType;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.QuestionTypeMapper;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* 查询巡检任务问题分页列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-05
*/
@Slf4j
@Service
public class QueryInspectionFilePageListService {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private QuestionTypeMapper questionTypeMapper;

public JsonResult getPageList(QueryInspectionFilePageListRequest request) {
log.info("进入根据任务ID查询巡检任务问题分页列表业务, inspectionId:{}, questionId:{}", request.getInspectionId(), request.getQuestionId());
JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("进入根据任务ID查询巡检任务问题分页列表业务:校验失败:{}", result.getMsg());
return result;
}

// 设置分页参数
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageListByInspectionId(page, request);
if (null == pageData || pageData.getTotal() == 0) {
log.info("获取任务分页列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
}

// 构造返回结果对象
List<InspectionFilePageListVo> inspectionFilePageListVoList = this.buildInspectionFilePageListVoList(pageData.getRecords());

// 重写返回结果对象
IPage<InspectionFilePageListVo> inspectionFilePageListVoPageData = new Page<>();
inspectionFilePageListVoPageData.setPages(pageData.getPages());
inspectionFilePageListVoPageData.setCurrent(pageData.getCurrent());
inspectionFilePageListVoPageData.setSize(pageData.getSize());
inspectionFilePageListVoPageData.setTotal(pageData.getTotal());
inspectionFilePageListVoPageData.setRecords(inspectionFilePageListVoList);

return JsonResult.success(inspectionFilePageListVoPageData);

}

/**
* 检查参数
*
* @param request
* @return
*/
private JsonResult check(QueryInspectionFilePageListRequest request) {
// 判断任务id是否为空
if (StringUtils.isEmpty(request.getInspectionId())) {
return JsonResult.error(QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_ID_IS_NULL.getCode(), QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_ID_IS_NULL.getMsg());
}

// 判断任务是否存在
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getId, request.getInspectionId())
.eq(Inspection::getMark, 1));

if (null == inspection) {
return JsonResult.error(QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(inspection);
}

/**
* 1)、查找已确认问题数、发现问题数字段
* 2)、判断是否有操作权限:立即执行、直播、回放、问题详情、问题核实、重新提交
*
* @param inspectionFileList
* @return
*/
private List<InspectionFilePageListVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) {
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>()
.eq(QuestionType::getMark, 1));

Map<String, QuestionType> questionTypeMap = questionTypeList.stream().collect(Collectors.toMap(QuestionType::getId, Function.identity()));

List<InspectionFilePageListVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageListVoList(inspectionFileList);
QuestionType questionType;
Integer questionName;
for (InspectionFilePageListVo inspectionFilePageListVo : inspectionFilePageListVoList) {
questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId());
if (null != questionType) {
questionName = questionType.getName();
inspectionFilePageListVo.setQuestionName(Integer.toString(questionName));
}
}
return inspectionFilePageListVoList;
}
}

+ 22
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/questiontype/IQuestionTypeService.java View File

@@ -0,0 +1,22 @@
package com.tuoheng.admin.service.questiontype;

import com.tuoheng.common.core.utils.JsonResult;

/**
* 问题类型Service接口
*
* @author wanjing
* @team tuoheng
* @date 2022-12-06
*/
public interface IQuestionTypeService {


/**
* 查询任务问题类型列表
*
* @return
*/
JsonResult getList();

}

+ 20
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/questiontype/QuestionTypeServiceImpl.java View File

@@ -0,0 +1,20 @@
package com.tuoheng.admin.service.questiontype;

import com.tuoheng.admin.service.questiontype.query.QueryQuestionTypeListService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class QuestionTypeServiceImpl implements IQuestionTypeService {

@Autowired
private QueryQuestionTypeListService queryQuestionTypeListService;

@Override
public JsonResult getList() {
return queryQuestionTypeListService.getist();
}
}

+ 35
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/questiontype/query/QueryQuestionTypeListService.java View File

@@ -0,0 +1,35 @@
package com.tuoheng.admin.service.questiontype.query;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.QuestionType;
import com.tuoheng.admin.entity.Structure;
import com.tuoheng.admin.mapper.QuestionTypeMapper;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 查询问题类型列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-06
*/
@Slf4j
@Service
public class QueryQuestionTypeListService {

@Autowired
private QuestionTypeMapper questionTypeMapper;

public JsonResult getist() {
log.info("进入查询问题类型列表业务");
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>()
.eq(QuestionType::getMark, 1));
return JsonResult.success(questionTypeList);
}

}

Loading…
Cancel
Save