Browse Source

重构报告代码

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
4d0c2b9f2c
6 changed files with 25 additions and 13 deletions
  1. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/report/QueryReportPageListRequest.java
  2. +2
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionHandleReportService.java
  3. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionReportService.java
  4. +2
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryReportPageListService.java
  5. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionFileReportVo.java
  6. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/ReportMapper.xml

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/report/QueryReportPageListRequest.java View File

public class QueryReportPageListRequest extends BaseQuery { public class QueryReportPageListRequest extends BaseQuery {


/** /**
* 任务名称
* 任务编码
*/ */
private String inspectionName;
private String inspectionCode;


/** /**
* 巡检任务类型: 1 临时巡检(目前只有该一种类型) * 巡检任务类型: 1 临时巡检(目前只有该一种类型)

+ 2
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionHandleReportService.java View File



public JsonResult getInspectionHandleReport(String id) { public JsonResult getInspectionHandleReport(String id) {
log.info("进入查看巡检处理报告业务"); log.info("进入查看巡检处理报告业务");

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId(); String tenantId = CurrentUserUtil.getTenantId();

JsonResult result = this.check(tenantId, id); JsonResult result = this.check(tenantId, id);
if (0 != result.getCode()) { if (0 != result.getCode()) {
log.info("进入查看巡检处理报告业务:校验失败:{}", result.getMsg()); log.info("进入查看巡检处理报告业务:校验失败:{}", result.getMsg());
return result; return result;
} }

Report report = (Report) result.getData(); Report report = (Report) result.getData();

InspectionReportVo inspectionReportVo = this.buildInspectionReportVo(report); InspectionReportVo inspectionReportVo = this.buildInspectionReportVo(report);

return JsonResult.success(inspectionReportVo); return JsonResult.success(inspectionReportVo);
} }


List<String> handlerImageList = null; List<String> handlerImageList = null;
for (InspectionFileReportVo inspectionFileReportVo : inspectionFileHandleVoList) { for (InspectionFileReportVo inspectionFileReportVo : inspectionFileHandleVoList) {
inspectionFileHandle = inspectionFileHandleMap.get(inspectionFileReportVo.getId()); inspectionFileHandle = inspectionFileHandleMap.get(inspectionFileReportVo.getId());
inspectionFileReportVo.setFileThumbnail(CommonConfig.imageURL + inspectionFileReportVo.getFileThumbnail());
inspectionFileReportVo.setFileOriginal(CommonConfig.imageURL + inspectionFileReportVo.getFileOriginal());
if (null != inspectionFileHandle) { if (null != inspectionFileHandle) {
handlerImageList = new ArrayList<>(); handlerImageList = new ArrayList<>();
String[] arr = inspectionFileHandle.getHandlerImage().split(","); String[] arr = inspectionFileHandle.getHandlerImage().split(",");

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionReportService.java View File

package com.tuoheng.admin.service.report.query; package com.tuoheng.admin.service.report.query;


import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.InspectionFileConverMapper; import com.tuoheng.admin.conver.InspectionFileConverMapper;
import com.tuoheng.admin.conver.ReportConverMapper; import com.tuoheng.admin.conver.ReportConverMapper;
import com.tuoheng.admin.vo.inspection.InspectionFileReportVo; import com.tuoheng.admin.vo.inspection.InspectionFileReportVo;
import com.tuoheng.admin.vo.inspection.InspectionReportVo; import com.tuoheng.admin.vo.inspection.InspectionReportVo;
import com.tuoheng.admin.vo.inspection.InspectionResultVo; import com.tuoheng.admin.vo.inspection.InspectionResultVo;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.JsonResult; import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils; import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
String deptName = this.getDeptName(report.getDeptId()); String deptName = this.getDeptName(report.getDeptId());
List<InspectionResultVo> inspectionResultVoList = this.buildInspectionResult(report); List<InspectionResultVo> inspectionResultVoList = this.buildInspectionResult(report);
List<InspectionFileReportVo> inspectionFileHandleVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFileHandleVoList(inspectionFileList); List<InspectionFileReportVo> inspectionFileHandleVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFileHandleVoList(inspectionFileList);
if (CollectionUtil.isNotEmpty(inspectionFileHandleVoList)) {
for (InspectionFileReportVo inspectionFileReportVo : inspectionFileHandleVoList) {
inspectionFileReportVo.setFileThumbnail(CommonConfig.imageURL + inspectionFileReportVo.getFileThumbnail());
inspectionFileReportVo.setFileOriginal(CommonConfig.imageURL + inspectionFileReportVo.getFileOriginal());
}
}
inspectionReportVo.setDeptName(deptName); inspectionReportVo.setDeptName(deptName);
inspectionReportVo.setInspectionResultVoList(inspectionResultVoList); inspectionReportVo.setInspectionResultVoList(inspectionResultVoList);
inspectionReportVo.setInspectionFileReportVoList(inspectionFileHandleVoList); inspectionReportVo.setInspectionFileReportVoList(inspectionFileHandleVoList);

+ 2
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryReportPageListService.java View File

IPage<Report> pageData = reportMapper.selectPageList(page, request); IPage<Report> pageData = reportMapper.selectPageList(page, request);


// 构造返回结果对象 // 构造返回结果对象
List<ReportPageListVo> reportPageListVoList = this.buildReportPageListVoList(user, dept, pageData.getRecords());
List<ReportPageListVo> reportPageListVoList = this.buildReportPageListVoList(pageData.getRecords());


// 重写返回结果对象 // 重写返回结果对象
IPage<ReportPageListVo> reportVoPageData = new Page<>(); IPage<ReportPageListVo> reportVoPageData = new Page<>();
/** /**
* 构造返回的数据列表 * 构造返回的数据列表
* *
* @param user
* @param dept
* @param reportList * @param reportList
* @return * @return
*/ */
private List<ReportPageListVo> buildReportPageListVoList(User user, Dept dept, List<Report> reportList) {
private List<ReportPageListVo> buildReportPageListVoList(List<Report> reportList) {
List<ReportPageListVo> reportPageListVoList = ReportConverMapper.INSTANCE.fromReportListToReportPageListList(reportList); List<ReportPageListVo> reportPageListVoList = ReportConverMapper.INSTANCE.fromReportListToReportPageListList(reportList);
return reportPageListVoList; return reportPageListVoList;
} }

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionFileReportVo.java View File

*/ */
private String questionName; private String questionName;


/**
* 文件名称
*/
private String fileName;

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


/**
* 原图
*/
private String fileOriginal;

/** /**
* 纬度 * 纬度
*/ */

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/mapper/ReportMapper.xml View File

<include refid="selectReportVo"/> <include refid="selectReportVo"/>
<where> <where>
<if test="1 == 1"> and mark = 1 </if> <if test="1 == 1"> and mark = 1 </if>
<if test="request.inspectionName != null and request.inspectionName != ''"> and inspection_name like concat('%', #{request.code}, '%') </if>
<if test="request.inspectionCode!= null and request.inspectionCode != ''"> and inspection_code like concat('%', #{request.inspectionCode}, '%') </if>
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.airportId} </if> <if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.airportId} </if>
<if test="request.type != null and request.type != 0"> and type = #{request.type} </if> <if test="request.type != null and request.type != 0"> and type = #{request.type} </if>
<if test="request.createUser != null and request.createUser != ''"> and create_user = #{request.createUser} </if> <if test="request.createUser != null and request.createUser != ''"> and create_user = #{request.createUser} </if>

Loading…
Cancel
Save