Browse Source

1、修改任务问题确认接口参数;2、修改任务问题忽略接口参数;3、提交查询任务问题分页列表接口

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
3574fdd859
9 changed files with 162 additions and 38 deletions
  1. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +3
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileConverMapper.java
  3. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java
  4. +20
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFilePageListRequest.java
  5. +7
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByInspectionIdService.java
  6. +46
    -21
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java
  7. +55
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFilePageListByInspectionIdVo.java
  8. +6
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFilePageListVo.java
  9. +20
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml

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

@@ -66,8 +66,8 @@ public class InspectionFileController {
*
* @return
*/
@PostMapping("/confirm")
public JsonResult confirm(@RequestParam("idList") List<String> idList){
@PostMapping("/confirm/{idList}")
public JsonResult confirm(@PathVariable("idList") List<String> idList){
return iInspectionFileService.confirm(idList);
}

@@ -76,8 +76,8 @@ public class InspectionFileController {
*
* @return
*/
@PostMapping("/ignore")
public JsonResult ignore(@RequestParam("idList") List<String> idList){
@PostMapping("/ignore/{idList}")
public JsonResult ignore(@PathVariable("idList") List<String> idList){
return iInspectionFileService.ignore(idList);
}


+ 3
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileConverMapper.java View File

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

import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import com.tuoheng.admin.vo.InspectionFileVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@@ -13,6 +13,8 @@ public interface InspectionFileConverMapper {

InspectionFileConverMapper INSTANCE = Mappers.getMapper(InspectionFileConverMapper.class);

List<InspectionFilePageListByInspectionIdVo> fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(List<InspectionFile> inspectionFileList);

List<InspectionFilePageListVo> fromInspectionFileListToInspectionFilePageListVoList(List<InspectionFile> inspectionFileList);

}

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

@@ -58,6 +58,6 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> {
* @param request 巡检任务查询实体
* @return 巡检任务集合
*/
Page<InspectionFile> selectPageListByInspectionId(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request);
Page<InspectionFile> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request);

}

+ 20
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFilePageListRequest.java View File

@@ -1,8 +1,11 @@
package com.tuoheng.admin.request.inspectionfile;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

import java.util.Date;

/**
* 查询巡检任务请求实体
*
@@ -14,14 +17,29 @@ import lombok.Data;
public class QueryInspectionFilePageListRequest extends BaseQuery {

/**
* 任务Id
* 关键字,匹配任务编号和任务名称
*/
private String inspectionId;
private String key;

/**
* 问题类型
*/
private String questionId;

/**
* 问题状态
*/
private Integer status;

/**
* 部门Id
*/
private String deptId;

/**
* 核实时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date checkTime;

}

+ 7
- 8
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByInspectionIdService.java View File

@@ -11,7 +11,7 @@ import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
@@ -61,10 +61,10 @@ public class QueryInspectionFilePageListByInspectionIdService {
}

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

// 重写返回结果对象
IPage<InspectionFilePageListVo> inspectionFilePageListVoPageData = new Page<>();
IPage<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoPageData = new Page<>();
inspectionFilePageListVoPageData.setPages(pageData.getPages());
inspectionFilePageListVoPageData.setCurrent(pageData.getCurrent());
inspectionFilePageListVoPageData.setSize(pageData.getSize());
@@ -99,22 +99,21 @@ public class QueryInspectionFilePageListByInspectionIdService {
}

/**
* 1)、查找已确认问题数、发现问题数字段
* 2)、判断是否有操作权限:立即执行、直播、回放、问题详情、问题核实、重新提交
* 1)、查找问题类型字段
*
* @param inspectionFileList
* @return
*/
private List<InspectionFilePageListVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) {
private List<InspectionFilePageListByInspectionIdVo> 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);
List<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(inspectionFileList);
QuestionType questionType;
Integer questionName;
for (InspectionFilePageListVo inspectionFilePageListVo : inspectionFilePageListVoList) {
for (InspectionFilePageListByInspectionIdVo inspectionFilePageListVo : inspectionFilePageListVoList) {
questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId());
if (null != questionType) {
questionName = questionType.getName();

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

@@ -4,16 +4,15 @@ 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.DeptMapper;
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.InspectionFilePageListByInspectionIdVo;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
@@ -27,7 +26,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;

/**
* 查询巡检任务问题分页列表业务层处理
* 查询任务问题分页列表业务层处理
*
* @author wanjing
* @team tuoheng
@@ -37,6 +36,9 @@ import java.util.stream.Collectors;
@Service
public class QueryInspectionFilePageListService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private InspectionMapper inspectionMapper;

@@ -47,17 +49,17 @@ public class QueryInspectionFilePageListService {
private QuestionTypeMapper questionTypeMapper;

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

// 设置分页参数
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageListByInspectionId(page, request);
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageList(page, request);
if (null == pageData || pageData.getTotal() == 0) {
log.info("获取任务分页列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
@@ -85,20 +87,44 @@ public class QueryInspectionFilePageListService {
* @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));
return JsonResult.success();
}

if (null == inspection) {
return JsonResult.error(QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg());
/**
* 超级管理员可查全部的任务
*
* @param request
* @return
*/
private IPage<InspectionFile> getAllList(QueryInspectionFilePageListRequest request) {
// 设置分页参数
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageList(page, request);
return pageData;
}

/**
* 管理员和普通用户可查本部门及子部门的任务
* 1)、如果前端检索条件,传了部门Id,则根据deptId来查
* 2)、如果前端检索条件,部门Id为空,则表示查本部门及子部门的任务
*
* @param request
* @return
*/
private IPage<InspectionFile> getListByDept(QueryInspectionFilePageListRequest request) {
// 获取本部门及子孙部门id列表
if (StringUtils.isEmpty(request.getDeptId())) {
List<String> deptIdList = deptMapper.selectAllChildListById(request.getDeptId());
// request.setDeptIdList(deptIdList);
}
return JsonResult.success(inspection);

// 设置分页参数
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageList(page, request);
return pageData;
}

/**
@@ -116,12 +142,11 @@ public class QueryInspectionFilePageListService {

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));
inspectionFilePageListVo.setQuestionName(Integer.toString(questionType.getName()));
inspectionFilePageListVo.setQuestionContent(questionType.getContent());
}
}
return inspectionFilePageListVoList;

+ 55
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFilePageListByInspectionIdVo.java View File

@@ -0,0 +1,55 @@
package com.tuoheng.admin.vo;

import lombok.Data;

/**
* 返回任务详情视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-12-05
*/
@Data
public class InspectionFilePageListByInspectionIdVo {

/**
* 问题id
*/
private String id;

/**
* 问题类型:1坑槽,2积水,3裂缝
*/
private String questionId;

/**
* 类型名称:1坑槽,2积水,3裂缝
*/
private String questionName;

/**
* 缩略图
*/
private String fileThumbnail;

/**
* 经度
*/
private String latitude;

/**
* 经度
*/
private String longitude;

/**
* 位置信息
*/
private String location;

/**
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理
*/
private Integer status;

}

+ 6
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFilePageListVo.java View File

@@ -23,10 +23,15 @@ public class InspectionFilePageListVo {
private String questionId;

/**
* 类型名称:1坑槽,2积水,3裂缝
* 问题名称:1坑槽,2积水,3裂缝
*/
private String questionName;

/**
* 问题内容
*/
private String questionContent;

/**
* 缩略图
*/

+ 20
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml View File

@@ -82,6 +82,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc
</select>

<select id="selectPageList" parameterType="com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest" resultMap="InspectionFileResult">
select <include refid="Base_Column_List"/>
from th_inspection_file tif
<!-- left join th_inspection ti on tif.inspection_id = ti.id-->
<!-- <where>-->
<!-- <if test="1 == 1"> and tif.mark = 1 </if>-->
<!-- <if test="request.questionId != null and request.questionId != ''"> and tif.question_id = #{request.questionId} </if>-->
<!-- <if test="request.status != null and request.status != 0"> and tif.status = #{request.status} </if>-->
<!-- <if test="request.key != null and request.key != 0"> and (ti.code liek concat('%', #{request.key}, '%') or ti.name liek concat('%', #{request.key}, '%')) </if>-->
<!-- <if test="request.deptIdList != null and request.deptIdList.size() > 0">-->
<!-- and ti.dept_id in-->
<!-- <foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">-->
<!-- #{deptId}-->
<!-- </foreach>-->
<!-- </if>-->

<!-- </where>-->
order by create_time desc
</select>

<update id="updateByIdList" parameterType="hashmap">
update th_inspection_file
<trim prefix="SET" suffixOverrides=",">

Loading…
Cancel
Save