@@ -42,7 +42,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult getPageList(QueryReportPageListRequest request) { | |||
log.info("进入查询报告分页列表接口"); | |||
// log.info("进入查询报告分页列表接口"); | |||
return reportService.getPageList(request); | |||
} | |||
@@ -51,7 +51,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/inspection/{id}") | |||
public JsonResult getInspectionReport(@PathVariable("id") String id) { | |||
log.info("进入查看巡检报告接口"); | |||
// log.info("进入查看巡检报告接口"); | |||
return reportService.getInspectionReport(id); | |||
} | |||
@@ -60,7 +60,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/export/inspection/{id}") | |||
public void exportInspectionReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) { | |||
log.info("进入导出巡检报告接口"); | |||
// log.info("进入导出巡检报告接口"); | |||
reportService.exportInspectionReport(request, response, id); | |||
} | |||
@@ -69,7 +69,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/inspection/handle/{id}") | |||
public JsonResult getHandleReport(@PathVariable("id") String id) { | |||
log.info("进入查看处理报告接口"); | |||
// log.info("进入查看处理报告接口"); | |||
return reportService.getInspectionHandleReport(id); | |||
} | |||
@@ -78,7 +78,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/export/inspection/handle/{id}") | |||
public void exportHandleReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) { | |||
log.info("进入导出处理报告接口"); | |||
// log.info("进入导出处理报告接口"); | |||
reportService.exportInspectionHandleReport(request, response, id); | |||
} | |||
@@ -275,14 +275,4 @@ public class Report extends BaseEntity { | |||
*/ | |||
private String patrolLocation; | |||
/** | |||
* 问题总数 | |||
*/ | |||
private Integer problemTotalCount; | |||
/** | |||
* 问题处理数 | |||
*/ | |||
private Integer problemHandleCount; | |||
} |
@@ -7,8 +7,8 @@ import lombok.Getter; | |||
* @author chenyukun | |||
*/ | |||
public enum MarkTypeEnum { | |||
VALID(1,"有效"), | |||
VALID(1,"有效"), | |||
NOTVALID(0,"失效"); | |||
MarkTypeEnum(int code, String description){ |
@@ -108,23 +108,6 @@ public class GenerateReportService { | |||
report.setInspectionName(inspection.getName()); | |||
report.setCreateUser(userId); | |||
report.setCreateTime(DateUtils.now()); | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() | |||
.eq(InspectionFile::getInspectionId, inspection.getId()) | |||
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList()) | |||
.eq(InspectionFile::getMark, 1)); | |||
List<String> inspectionFileIdList = null; | |||
if (!CollectionUtil.isEmpty(inspectionFileList)) { | |||
report.setProblemTotalCount(inspectionFileList.size()); | |||
inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList()); | |||
} | |||
if (!CollectionUtil.isEmpty(inspectionFileIdList)) { | |||
List<InspectionFileHandle> inspectionFileHandleList = inspectionFileHandleMapper.selectList(Wrappers.<InspectionFileHandle>lambdaQuery() | |||
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList) | |||
.eq(InspectionFileHandle::getMark, 1)); | |||
if (!CollectionUtil.isEmpty(inspectionFileHandleList)) { | |||
report.setProblemHandleCount(inspectionFileHandleList.size()); | |||
} | |||
} | |||
return report; | |||
} | |||
@@ -1,15 +1,16 @@ | |||
package com.tuoheng.admin.service.report.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.ReportConverMapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileHandle; | |||
import com.tuoheng.admin.entity.Report; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.ReportMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.report.QueryReportPageListRequest; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.ReportPageListVo; | |||
@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 查询报告分页列表业务层处理 | |||
@@ -40,10 +42,15 @@ public class QueryReportPageListService { | |||
@Autowired | |||
private ReportMapper reportMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
@Autowired | |||
private InspectionFileHandleMapper inspectionFileHandleMapper; | |||
/** | |||
* | |||
* 查询报告分页列表 | |||
* 用户只能查看自己生成的报告 | |||
* 用户只能查看自己生成的报告 | |||
* | |||
* @param request | |||
* @return | |||
@@ -114,6 +121,25 @@ public class QueryReportPageListService { | |||
*/ | |||
private List<ReportPageListVo> buildReportPageListVoList(List<Report> reportList) { | |||
List<ReportPageListVo> reportPageListVoList = ReportConverMapper.INSTANCE.fromReportListToReportPageListList(reportList); | |||
for (ReportPageListVo reportPageListVo : reportPageListVoList) { | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() | |||
.eq(InspectionFile::getInspectionId, reportPageListVo.getInspectionId()) | |||
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList()) | |||
.eq(InspectionFile::getMark, MarkTypeEnum.VALID.getCode())); | |||
List<String> inspectionFileIdList = null; | |||
if (!CollectionUtil.isEmpty(inspectionFileList)) { | |||
reportPageListVo.setProblemTotalCount(inspectionFileList.size()); | |||
inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList()); | |||
} | |||
if (!CollectionUtil.isEmpty(inspectionFileIdList)) { | |||
List<InspectionFileHandle> inspectionFileHandleList = inspectionFileHandleMapper.selectList(Wrappers.<InspectionFileHandle>lambdaQuery() | |||
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList) | |||
.eq(InspectionFileHandle::getMark, MarkTypeEnum.VALID.getCode())); | |||
if (!CollectionUtil.isEmpty(inspectionFileHandleList)) { | |||
reportPageListVo.setProblemHandleCount(inspectionFileHandleList.size()); | |||
} | |||
} | |||
} | |||
return reportPageListVoList; | |||
} | |||
} |
@@ -21,6 +21,11 @@ public class ReportPageListVo { | |||
*/ | |||
private String id; | |||
/** | |||
* 任务ID | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 任务编号 | |||
*/ | |||
@@ -59,4 +64,5 @@ public class ReportPageListVo { | |||
* 问题处理数 | |||
*/ | |||
private Integer problemHandleCount; | |||
} |
@@ -56,8 +56,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
<result property="endLatitude" column="end_latitude" /> | |||
<result property="mobile" column="mobile" /> | |||
<result property="patrolLocation" column="patrol_location" /> | |||
<result property="problemTotalCount" column="problem_total_count" /> | |||
<result property="problemHandleCount" column="problem_handle_count" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
@@ -66,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</resultMap> | |||
<sql id="selectReportVo"> | |||
select id, tenant_id, dept_id, report_code, inspection_id, inspection_code, inspection_name, type, road_id, road_name, section_id, section_name, inspection_type, airport_id, airport_name, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location, problem_total_count, problem_handle_count, create_user, create_time, update_user, update_time, mark from th_report | |||
select id, tenant_id, dept_id, report_code, inspection_id, inspection_code, inspection_name, type, road_id, road_name, section_id, section_name, inspection_type, airport_id, airport_name, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location, create_user, create_time, update_user, update_time, mark from th_report | |||
</sql> | |||
<select id="selectPageList" parameterType="com.tuoheng.admin.request.report.QueryReportPageListRequest" resultMap="ReportResult"> |