*/ | */ | ||||
@GetMapping("/page/list") | @GetMapping("/page/list") | ||||
public JsonResult getPageList(QueryReportPageListRequest request) { | public JsonResult getPageList(QueryReportPageListRequest request) { | ||||
log.info("进入查询报告分页列表接口"); | |||||
// log.info("进入查询报告分页列表接口"); | |||||
return reportService.getPageList(request); | return reportService.getPageList(request); | ||||
} | } | ||||
*/ | */ | ||||
@GetMapping("/inspection/{id}") | @GetMapping("/inspection/{id}") | ||||
public JsonResult getInspectionReport(@PathVariable("id") String id) { | public JsonResult getInspectionReport(@PathVariable("id") String id) { | ||||
log.info("进入查看巡检报告接口"); | |||||
// log.info("进入查看巡检报告接口"); | |||||
return reportService.getInspectionReport(id); | return reportService.getInspectionReport(id); | ||||
} | } | ||||
*/ | */ | ||||
@GetMapping("/export/inspection/{id}") | @GetMapping("/export/inspection/{id}") | ||||
public void exportInspectionReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) { | public void exportInspectionReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) { | ||||
log.info("进入导出巡检报告接口"); | |||||
// log.info("进入导出巡检报告接口"); | |||||
reportService.exportInspectionReport(request, response, id); | reportService.exportInspectionReport(request, response, id); | ||||
} | } | ||||
*/ | */ | ||||
@GetMapping("/inspection/handle/{id}") | @GetMapping("/inspection/handle/{id}") | ||||
public JsonResult getHandleReport(@PathVariable("id") String id) { | public JsonResult getHandleReport(@PathVariable("id") String id) { | ||||
log.info("进入查看处理报告接口"); | |||||
// log.info("进入查看处理报告接口"); | |||||
return reportService.getInspectionHandleReport(id); | return reportService.getInspectionHandleReport(id); | ||||
} | } | ||||
*/ | */ | ||||
@GetMapping("/export/inspection/handle/{id}") | @GetMapping("/export/inspection/handle/{id}") | ||||
public void exportHandleReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) { | public void exportHandleReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) { | ||||
log.info("进入导出处理报告接口"); | |||||
// log.info("进入导出处理报告接口"); | |||||
reportService.exportInspectionHandleReport(request, response, id); | reportService.exportInspectionHandleReport(request, response, id); | ||||
} | } | ||||
*/ | */ | ||||
private String patrolLocation; | private String patrolLocation; | ||||
/** | |||||
* 问题总数 | |||||
*/ | |||||
private Integer problemTotalCount; | |||||
/** | |||||
* 问题处理数 | |||||
*/ | |||||
private Integer problemHandleCount; | |||||
} | } |
* @author chenyukun | * @author chenyukun | ||||
*/ | */ | ||||
public enum MarkTypeEnum { | public enum MarkTypeEnum { | ||||
VALID(1,"有效"), | |||||
VALID(1,"有效"), | |||||
NOTVALID(0,"失效"); | NOTVALID(0,"失效"); | ||||
MarkTypeEnum(int code, String description){ | MarkTypeEnum(int code, String description){ |
report.setInspectionName(inspection.getName()); | report.setInspectionName(inspection.getName()); | ||||
report.setCreateUser(userId); | report.setCreateUser(userId); | ||||
report.setCreateTime(DateUtils.now()); | 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; | return report; | ||||
} | } | ||||
package com.tuoheng.admin.service.report.query; | 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.metadata.IPage; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.admin.conver.ReportConverMapper; | 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.Report; | ||||
import com.tuoheng.admin.entity.User; | 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.request.report.QueryReportPageListRequest; | ||||
import com.tuoheng.admin.utils.CurrentUserUtil; | import com.tuoheng.admin.utils.CurrentUserUtil; | ||||
import com.tuoheng.admin.vo.ReportPageListVo; | import com.tuoheng.admin.vo.ReportPageListVo; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* 查询报告分页列表业务层处理 | * 查询报告分页列表业务层处理 | ||||
@Autowired | @Autowired | ||||
private ReportMapper reportMapper; | private ReportMapper reportMapper; | ||||
@Autowired | |||||
private InspectionFileMapper inspectionFileMapper; | |||||
@Autowired | |||||
private InspectionFileHandleMapper inspectionFileHandleMapper; | |||||
/** | /** | ||||
* | |||||
* 查询报告分页列表 | * 查询报告分页列表 | ||||
* 用户只能查看自己生成的报告 | |||||
* 用户只能查看自己生成的报告 | |||||
* | * | ||||
* @param request | * @param request | ||||
* @return | * @return | ||||
*/ | */ | ||||
private List<ReportPageListVo> buildReportPageListVoList(List<Report> reportList) { | private List<ReportPageListVo> buildReportPageListVoList(List<Report> reportList) { | ||||
List<ReportPageListVo> reportPageListVoList = ReportConverMapper.INSTANCE.fromReportListToReportPageListList(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; | return reportPageListVoList; | ||||
} | } | ||||
} | } |
*/ | */ | ||||
private String id; | private String id; | ||||
/** | |||||
* 任务ID | |||||
*/ | |||||
private String inspectionId; | |||||
/** | /** | ||||
* 任务编号 | * 任务编号 | ||||
*/ | */ | ||||
* 问题处理数 | * 问题处理数 | ||||
*/ | */ | ||||
private Integer problemHandleCount; | private Integer problemHandleCount; | ||||
} | } |
<result property="endLatitude" column="end_latitude" /> | <result property="endLatitude" column="end_latitude" /> | ||||
<result property="mobile" column="mobile" /> | <result property="mobile" column="mobile" /> | ||||
<result property="patrolLocation" column="patrol_location" /> | <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="createUser" column="create_user" /> | ||||
<result property="createTime" column="create_time" /> | <result property="createTime" column="create_time" /> | ||||
<result property="updateUser" column="update_user" /> | <result property="updateUser" column="update_user" /> | ||||
</resultMap> | </resultMap> | ||||
<sql id="selectReportVo"> | <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> | </sql> | ||||
<select id="selectPageList" parameterType="com.tuoheng.admin.request.report.QueryReportPageListRequest" resultMap="ReportResult"> | <select id="selectPageList" parameterType="com.tuoheng.admin.request.report.QueryReportPageListRequest" resultMap="ReportResult"> |