Browse Source

Merge remote-tracking branch 'origin/develop' into develop

tags/V1.3.3^2
suqin 11 months ago
parent
commit
23c106d817
7 changed files with 195 additions and 4 deletions
  1. +11
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +9
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java
  3. +25
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileListByInspectionIdRequest.java
  4. +7
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/IInspectionFileService.java
  5. +13
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/InspectionFileServiceImpl.java
  6. +112
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileListByInspectionIdService.java
  7. +18
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml

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

@@ -1,10 +1,7 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileWorkOrderPageListRequest;
import com.tuoheng.admin.request.inspectionfile.*;
import com.tuoheng.admin.service.inspectionfile.IInspectionFileService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
@@ -66,6 +63,16 @@ public class InspectionFileController {
return iInspectionFileService.getPageListByInspectionId(request);
}

/**
* 根据任务id查询问题列表
* @param request
* @return
*/
@GetMapping("/list/by/inspectionid")
public JsonResult getListByInspectionId(QueryInspectionFileListByInspectionIdRequest request){
return iInspectionFileService.getListByInspectionId(request);
}

/**
* 任务问题确认
*

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

@@ -9,6 +9,7 @@ import com.tuoheng.admin.entity.InspectionFileDistribution;
import com.tuoheng.admin.entity.InspectionFileExtend;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import org.apache.ibatis.annotations.Param;
@@ -81,4 +82,12 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> {
* @return 巡检任务集合
*/
List<InspectionFileDistribution> selectDistributionList(@Param("request") QueryInspectionFileDistributionListRequest request);

/**
* 查询任务ID查询任务问题列表
*
* @param request 巡检任务查询实体
* @return 巡检任务集合
*/
List<InspectionFile> selectListByInspectionId( @Param("request") QueryInspectionFileListByInspectionIdRequest request);
}

+ 25
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileListByInspectionIdRequest.java View File

@@ -0,0 +1,25 @@
package com.tuoheng.admin.request.inspectionfile;

import lombok.Data;

/**
* 查询巡检任务请求实体
*
* @author wanjing
* @team tuoheng
* @date 2022-12-05
*/
@Data
public class QueryInspectionFileListByInspectionIdRequest {

/**
* 任务Id
*/
private String inspectionId;

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

}

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

@@ -26,6 +26,13 @@ public interface IInspectionFileService {
*/
JsonResult getPageListByInspectionId(QueryInspectionFilePageListByInspectionIdRequest request);

/**
* 根据任务id查询问题列表
* @param request
* @return
*/
JsonResult getListByInspectionId(QueryInspectionFileListByInspectionIdRequest request);

/**
*
* 查询任务分页列表

+ 13
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/InspectionFileServiceImpl.java View File

@@ -63,6 +63,9 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
@Autowired
private QueryInspectionFilePageListByInspectionIdService queryInspectionFilePageListByInspectionIdService;

@Autowired
private QueryInspectionFileListByInspectionIdService queryInspectionFileListByInspectionIdService;

@Autowired
private QueryInspectionFilePageListService queryInspectionFilePageListService;

@@ -216,6 +219,16 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
return queryInspectionFilePageListByInspectionIdService.getPageListByInspectionId(request);
}

/**
* 根据任务id查询问题列表
* @param request
* @return
*/
@Override
public JsonResult getListByInspectionId(QueryInspectionFileListByInspectionIdRequest request) {
return queryInspectionFileListByInspectionIdService.getListByInspectionId(request);
}

/**
* 查询任务问题分页列表
*

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

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

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.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.enums.MarkEnum;
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.QueryInspectionFileListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.vo.inspection.InspectionFilePageListByInspectionIdVo;
import com.tuoheng.common.core.config.common.CommonConfig;
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;

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

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

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


// 查询结果
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectListByInspectionId(request);
if (CollectionUtil.isEmpty(inspectionFileList) || inspectionFileList.size() == 0) {
log.info("获取任务列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
}

// 构造返回结果对象
List<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoList = this.buildInspectionFilePageListVoList(inspection, inspectionFileList);

return JsonResult.success(inspectionFilePageListVoList);

}

/**
* 检查参数
*
* @param request
* @return
*/
private JsonResult check(QueryInspectionFileListByInspectionIdRequest 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, MarkEnum.VALID.getCode()));

if (ObjectUtil.isEmpty(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<InspectionFilePageListByInspectionIdVo> buildInspectionFilePageListVoList(Inspection inspection, List<InspectionFile> inspectionFileList) {
List<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(inspectionFileList);
for (InspectionFilePageListByInspectionIdVo inspectionFilePageListVo : inspectionFilePageListVoList) {
inspectionFilePageListVo.setFileImage(CommonConfig.imageURL + inspectionFilePageListVo.getFileImage());
inspectionFilePageListVo.setFileThumbnail(CommonConfig.imageURL + inspectionFilePageListVo.getFileThumbnail());
inspectionFilePageListVo.setFileOriginal(CommonConfig.imageURL + inspectionFilePageListVo.getFileOriginal());
}
return inspectionFilePageListVoList;
}
}

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

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

<select id="selectListByInspectionId" parameterType="com.tuoheng.admin.request.inspectionfile.QueryInspectionFileListByInspectionIdRequest" resultMap="InspectionFileResult">
select <include refid="Base_Column_List"/>
from th_inspection_file
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.inspectionId != null and request.inspectionId != ''"> and inspection_id = #{request.inspectionId} </if>
<choose>
<when test="request.status != null and request.status != 0">
and status = #{request.status}
</when>
<otherwise>
and status in (5, 10, 15, 20, 25)
</otherwise>
</choose>
</where>
order by create_time desc
</select>

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

Loading…
Cancel
Save