Ver código fonte

Merge branch 'wanjing' into develop

tags/v1.0.0^2
wanjing 1 ano atrás
pai
commit
8f78cda947
32 arquivos alterados com 3036 adições e 13 exclusões
  1. +40
    -0
      tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/config/UploadFileConfig.java
  2. +13
    -0
      tuoheng-service/tuoheng-admin/pom.xml
  3. +85
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/ReportController.java
  4. +4
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileConverMapper.java
  5. +23
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/ReportConverMapper.java
  6. +288
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Report.java
  7. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfilehandle/InspectionFileProcessingCodeEnum.java
  8. +50
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/report/GenerateReportCodeEnum.java
  9. +50
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/report/QueryInspectionHandleReportCodeEnum.java
  10. +50
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/report/QueryInspectionReportCodeEnum.java
  11. +27
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/ReportMapper.java
  12. +36
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/report/QueryReportPageListRequest.java
  13. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java
  14. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/processing/InspectionFileProcessingService.java
  15. +67
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/IReportService.java
  16. +101
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/IReportServiceImpl.java
  17. +702
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/export/ExportInspectionReportService.java
  18. +158
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/generate/GenerateReportService.java
  19. +154
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionHandleReportService.java
  20. +104
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionReportService.java
  21. +131
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryReportPageListService.java
  22. +373
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/WordUtils.java
  23. +40
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileHandleReportVo.java
  24. +80
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileReportVo.java
  25. +283
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionReportVo.java
  26. +52
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/ReportPageListVo.java
  27. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/application-dev.yml
  28. +10
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-local.yml
  29. +9
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml
  30. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml
  31. +84
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/ReportMapper.xml
  32. +1
    -4
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java

+ 40
- 0
tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/config/UploadFileConfig.java Ver arquivo

@@ -0,0 +1,40 @@
package com.tuoheng.common.core.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
* 文件上传配置
*/
@Configuration
@Data
public class UploadFileConfig {
/**
* 上传目录
*/
public static String uploadFolder;
/**
* 访问路径
*/
public static String staticAccessPath;
/**
* 上传服务器的映射文件夹
*/
public static String accessPath;

@Value("${file.uploadFolder}")
public void setUploadFolder(String path) {
uploadFolder = path;
}

@Value("${file.staticAccessPath}")
public void setStaticAccessPath(String path) {
staticAccessPath = path;
}

@Value("${file.accessPath}")
public void setAccessPath(String path) {
accessPath = path;
}
}

+ 13
- 0
tuoheng-service/tuoheng-admin/pom.xml Ver arquivo

@@ -142,6 +142,19 @@
<artifactId>mapstruct-processor</artifactId>
<version>1.5.3.Final</version>
</dependency>

<!-- 处理word -->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext-rtf</artifactId>
<version>2.1.7</version>
</dependency>

</dependencies>

<!-- 环境变量配置 -->

+ 85
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/ReportController.java Ver arquivo

@@ -0,0 +1,85 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.request.report.QueryReportPageListRequest;
import com.tuoheng.admin.service.report.IReportService;
import com.tuoheng.admin.service.report.query.QueryInspectionReportService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* @desc: 巡检报告
* @team: tuoheng
* @author: wanjing
* @date: 2022-12-09
*/
@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

@Autowired
private IReportService reportService;

@Autowired
private QueryInspectionReportService queryInspectionReportService;

/**
* 生成巡检报告
*/
@PostMapping("/generate/{id}")
public JsonResult generate(@PathVariable("id") String id) {
log.info("进入生成报告接口");
return reportService.generate(id);
}

/**
* 查看巡检报告分页列表
*/
@GetMapping("/page/list")
public JsonResult getPageList(QueryReportPageListRequest request) {
log.info("进入查询报告分页列表接口");
return reportService.getPageList(request);
}

/**
* 查看巡检报告
*/
@GetMapping("/inspection/{id}")
public JsonResult getInspectionReport(@PathVariable("id") String id) {
log.info("进入查看巡检报告接口");
return reportService.getInspectionReport(id);
}

/**
* 导出巡检报告
*/
@GetMapping("/export/inspection/{id}")
public void exportInspectionReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) {
log.info("进入导出巡检报告接口");
reportService.exportInspectionReport(id, request, response);
}

/**
* 查看处理报告
*/
@GetMapping("/inspection/handle/{id}")
public JsonResult getHandleReport(@PathVariable("id") String id) {
log.info("进入查看处理报告接口");
return reportService.getInspectionHandleReport(id);
}

/**
* 导出处理报告
*/
@GetMapping("/export/inspection/handle/{id}")
public void exportHandleReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) {
log.info("进入导出处理报告接口");
reportService.exportInspectionHandleReport(id, request, response);
}

}

+ 4
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileConverMapper.java Ver arquivo

@@ -3,9 +3,7 @@ package com.tuoheng.admin.conver;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.InspectionFileDistribution;
import com.tuoheng.admin.entity.InspectionFileExtend;
import com.tuoheng.admin.vo.InspectionFileDistributionListVo;
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import com.tuoheng.admin.vo.*;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@@ -21,4 +19,7 @@ public interface InspectionFileConverMapper {
List<InspectionFilePageListVo> fromInspectionFileExtendListToInspectionFilePageListVoList(List<InspectionFileExtend> inspectionFileExtendList);

List<InspectionFileDistributionListVo> fromInspectionFileDistributionListToInspectionFileDistributionListVoList(List<InspectionFileDistribution> inspectionFileDistributionList);

List<InspectionFileReportVo> fromInspectionFileListToInspectionFileHandleVoList(List<InspectionFile> inspectionFileList);

}

+ 23
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/ReportConverMapper.java Ver arquivo

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

import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.Report;
import com.tuoheng.admin.vo.InspectionReportVo;
import com.tuoheng.admin.vo.ReportPageListVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface ReportConverMapper {

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

Report fromInspectionToReport(Inspection inspection);

List<ReportPageListVo> fromReportListToReportPageListList(List<Report> reportList);

InspectionReportVo fromReportToInspectionReportVo(Report report);

}

+ 288
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Report.java Ver arquivo

@@ -0,0 +1,288 @@
package com.tuoheng.admin.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
/**
* 巡检报告对象 th_report
*
* @team tuoheng
* @author wanjing
* @date 2022-12-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_report")
public class Report extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 租户ID
*/
private String tenantId;
/**
* 部门ID
*/
private String deptId;
/**
* 报告编号
*/
private String reportCode;
/**
* 巡检任务ID
*/
private String inspectionId;
/**
* 巡检任务编码
*/
private String inspectionCode;
/**
* 巡检任务名称
*/
private String inspectionName;
/**
* 巡检任务类型 1 临时巡检
*/
private Integer type;
/**
* 公路ID
*/
private String roadId;
/**
* 公路名称
*/
private String roadName;
/**
* 路段ID
*/
private String sectionId;
/**
* 路段名称
*/
private String sectionName;
/**
* 巡检方式类型 1 无人机 2机场巡逻 3 飞手值飞
*/
private Long inspectionType;
/**
* 巡检机场id
*/
private Long airportId;
/**
* 巡检机场名称
*/
private String airportName;
/**
* 巡检线路id
*/
private Long inspectionLine;
/**
* 巡检线路名称
*/
private String inspectionLineName;
/**
* 飞行设备
*/
private String equipmentId;
/**
* 飞行设备名称
*/
private String equipmentName;
/**
* 挂载设备(多选逗号","分隔)
*/
private String equipmentMountId;
/**
* 挂载设备名称(多选逗号","分隔)
*/
private String equipmentMountName;
/**
* 5G云盒ID
*/
private String cloudBoxId;
/**
* 云盒名称
*/
private String cloudBoxName;
/**
* 云盒SN号
*/
private String boxSn;
/**
* 飞手(多选逗号","分隔)
*/
private String flightHand;
/**
* 飞手姓名(多选逗号","分隔)
*/
private String flightHandName;
/**
* 计划巡检日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectionTime;
/**
* 执行开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date executionStartTime;
/**
* 执行结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date executionEndTime;
/**
* 是否实时,1:实时 2:离线 默认:null
*/
private Long isLive;
/**
* 是否正摄:1是 2否
*/
private String isTaken;
/**
* 是否倾斜摄影:1是 2否
*/
private String isTilt;
/**
* 原视频地址
*/
private String videoUrl;
/**
* AI识别后视频地址
*/
private String aiVideoUrl;
/**
* 报告地址
*/
private String reportUrl;
/**
* SRT文件地址
*/
private String srtUrl;
/**
* 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成
*/
private String status;
/**
* 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败
*/
private Long analyseStatus;
/**
* ai任务分析进度
*/
private BigDecimal progressbar;
/**
* 备注
*/
private String note;
/**
* 巡检时天气情况
*/
private String weather;
/**
* 飞行高度
*/
private String flyHeight;
/**
* srt文件名称 */
private String srtName;
/**
* ai心跳更新时间 */
private Long heartbeatTime;
/**
* 定时任务的执行状态。1:未执行,2:已执行 */
private Long executionStatus;
/**
* 起点经度
*/
private String startLongitude;
/**
* 起点纬度
*/
private String startLatitude;
/**
* 终点经度
*/
private String endLongitude;
/**
* 终点纬度
*/
private String endLatitude;
/**
* 联系方式
*/
private String mobile;
/**
* 巡逻地点
*/
private String patrolLocation;
/**
* 问题总数
*/
private Integer problemTotalCount;
/**
* 问题处理数
*/
private Integer problemHandleCount;
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspectionfilehandle/InspectionFileProcessingCodeEnum.java Ver arquivo

@@ -11,7 +11,7 @@ package com.tuoheng.admin.enums.code.inspectionfilehandle;
*/
public enum InspectionFileProcessingCodeEnum {

PROCESSINGIS_FAILED(1250100, "处理失败"),
PROCESSING_IS_FAILED(1250100, "处理失败"),
WORK_ORDER_ID_IS_NULL(1250101, "工单id为空"),
WORK_ORDER_IS_NOT_EXIST(1250102, "工单不存在"),
INSPECTION_FILE_ID_IS_NULL(1250103, "任务问题id为空"),

+ 50
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/report/GenerateReportCodeEnum.java Ver arquivo

@@ -0,0 +1,50 @@
package com.tuoheng.admin.enums.code.report;

/**
* 生成报告返回码
* 模块代码:27(报告管理)
* 接口代码:01 (生成报告)
*
* @author wanjing
* @team tuoheng
* @date 2022-12-09
*/
public enum GenerateReportCodeEnum {

GENERATE_IS_FAILED(1270100, "生成报告失败"),
INSPECTION_ID_IS_NULL(1270101, "任务id为空"),
INSPECTION_IS_NOT_EXIST(1270102, "任务不存在");

/**
* 编号
*/
private int code;

/**
* 类型名称
*/
private String msg;

GenerateReportCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}


}

+ 50
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/report/QueryInspectionHandleReportCodeEnum.java Ver arquivo

@@ -0,0 +1,50 @@
package com.tuoheng.admin.enums.code.report;

/**
* 查看巡检处理报告返回码
* 模块代码:27(报告管理)
* 接口代码:03 (查看巡检处理报告)
*
* @author wanjing
* @team tuoheng
* @date 2022-12-12
*/
public enum QueryInspectionHandleReportCodeEnum {

QUERY_IS_FAILED(1270300, "查看巡检处理报告失败"),
REPORT_ID_IS_NULL(1270301, "报告id为空"),
REPORT_IS_NOT_EXIST(1270302, "报告不存在");

/**
* 编号
*/
private int code;

/**
* 类型名称
*/
private String msg;

QueryInspectionHandleReportCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}


}

+ 50
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/report/QueryInspectionReportCodeEnum.java Ver arquivo

@@ -0,0 +1,50 @@
package com.tuoheng.admin.enums.code.report;

/**
* 查看巡检报告返回码
* 模块代码:27(报告管理)
* 接口代码:02 (查看巡检报告)
*
* @author wanjing
* @team tuoheng
* @date 2022-12-12
*/
public enum QueryInspectionReportCodeEnum {

QUERY_IS_FAILED(1270200, "查看巡检报告失败"),
REPORT_ID_IS_NULL(1270201, "报告id为空"),
REPORT_IS_NOT_EXIST(1270202, "报告不存在");

/**
* 编号
*/
private int code;

/**
* 类型名称
*/
private String msg;

QueryInspectionReportCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}


}

+ 27
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/ReportMapper.java Ver arquivo

@@ -0,0 +1,27 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.Report;
import com.tuoheng.admin.request.report.QueryReportPageListRequest;
import org.apache.ibatis.annotations.Param;

/**
* 巡检报告Mapper接口
*
* @author wanjing
* @team tuoheng
* @date 2022-12-09
*/
public interface ReportMapper extends BaseMapper<Report> {

/**
* 查询巡检任务分页列表
*
* @param request 巡检任务查询实体
* @return 巡检任务集合
*/
Page<Report> selectPageList(@Param("page") IPage page, @Param("request") QueryReportPageListRequest request);

}

+ 36
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/report/QueryReportPageListRequest.java Ver arquivo

@@ -0,0 +1,36 @@
package com.tuoheng.admin.request.report;

import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

/**
* 查询报告分页列表请求实体
*
* @author wanjing
* @team tuoheng
* @date 2022-12-05
*/
@Data
public class QueryReportPageListRequest extends BaseQuery {

/**
* 任务名称
*/
private String inspectionName;

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

/**
* 巡检机场id
*/
private Integer airportId;

/**
* 创建人
*/
private String createUser;

}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java Ver arquivo

@@ -132,7 +132,7 @@ public class QueryInspectionPageListService {
}

// 构造返回结果对象
List<InspectionVo> inspectionVoList = buildIspectionVoList(user, dept, pageData.getRecords());
List<InspectionVo> inspectionVoList = this.buildIspectionVoList(user, dept, pageData.getRecords());

// 重写返回结果对象
IPage<InspectionVo> inspectionVoPageData = new Page<>();

+ 3
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/processing/InspectionFileProcessingService.java Ver arquivo

@@ -125,7 +125,7 @@ public class InspectionFileProcessingService {
inspectionFileHandle.setCreateTime(DateUtils.now());
Integer rowCount = inspectionFileHandleMapper.insert(inspectionFileHandle);
if (rowCount <= 0) {
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getMsg());
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getMsg());
}
return JsonResult.success();
}
@@ -142,7 +142,7 @@ public class InspectionFileProcessingService {

Integer rowCount = inspectionFileMapper.updateById(inspectionFile);
if (rowCount <= 0) {
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getMsg());
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getMsg());
}
return JsonResult.success();
}
@@ -172,7 +172,7 @@ public class InspectionFileProcessingService {

Integer rowCount = workOrderMapper.update(workOrder);
if (rowCount <= 0) {
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSINGIS_FAILED.getMsg());
return JsonResult.error(InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getCode(), InspectionFileProcessingCodeEnum.PROCESSING_IS_FAILED.getMsg());
}
return JsonResult.success();
}

+ 67
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/IReportService.java Ver arquivo

@@ -0,0 +1,67 @@
package com.tuoheng.admin.service.report;
import com.tuoheng.admin.request.report.QueryReportPageListRequest;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.web.bind.annotation.PathVariable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 巡检报告Service接口
*
* @team tuoheng
* @author wanjing
* @date 2022-12-09
*/
public interface IReportService {
/**
*
* 生成报告
*
* @param id
* @return
*/
JsonResult generate(String id);
/**
*
* 查询报告分页列表
*
* @return
*/
JsonResult getPageList(QueryReportPageListRequest request);
/**
*
* 查询巡检报告
*
* @return
*/
JsonResult getInspectionReport(String id);
/**
*
* 查询巡检处理报告
*
* @return
*/
JsonResult getInspectionHandleReport(String id);
/**
*
* 导出巡检报告
*
* @return
*/
void exportInspectionReport(String id, HttpServletRequest request, HttpServletResponse response);
/**
*
* 导出巡检处理报告
*
* @return
*/
void exportInspectionHandleReport(String id, HttpServletRequest request, HttpServletResponse response);
}

+ 101
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/IReportServiceImpl.java Ver arquivo

@@ -0,0 +1,101 @@
package com.tuoheng.admin.service.report;

import com.tuoheng.admin.request.report.QueryReportPageListRequest;
import com.tuoheng.admin.service.report.export.ExportInspectionReportService;
import com.tuoheng.admin.service.report.generate.GenerateReportService;
import com.tuoheng.admin.service.report.query.QueryInspectionHandleReportService;
import com.tuoheng.admin.service.report.query.QueryInspectionReportService;
import com.tuoheng.admin.service.report.query.QueryReportPageListService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@Service
public class IReportServiceImpl implements IReportService{

@Autowired
private GenerateReportService generateReportService;

@Autowired
private QueryReportPageListService queryReportPageListService;

@Autowired
private QueryInspectionReportService queryInspectionReportService;

@Autowired
private QueryInspectionHandleReportService queryInspectionHandleReportService;

@Autowired
private ExportInspectionReportService exportInspectionReportService;

/**
*
* 生成报告
*
* @param id
* @return
*/
@Override
public JsonResult generate(String id) {
return generateReportService.generate(id);
}

/**
*
* 查询报告分页列表
*
* @return
*/
@Override
public JsonResult getPageList(QueryReportPageListRequest request) {
return queryReportPageListService.getPageList(request);
}

/**
*
* 查询巡检报告
*
* @return
*/
@Override
public JsonResult getInspectionReport(String id) {
return queryInspectionReportService.getInspectionReport(id);
}

/**
*
* 查询巡检处理报告
*
* @return
*/
@Override
public JsonResult getInspectionHandleReport(String id) {
return queryInspectionHandleReportService.getInspectionHandleReport(id);
}

/**
*
* 导出巡检报告
*
* @return
*/
@Override
public void exportInspectionReport(String id, HttpServletRequest request, HttpServletResponse response) {
exportInspectionReportService.exportReport(id, response);
}

/**
*
* 导出巡检处理报告
*
* @return
*/
@Override
public void exportInspectionHandleReport(String id, HttpServletRequest request, HttpServletResponse response) {
}
}

+ 702
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/export/ExportInspectionReportService.java Ver arquivo

@@ -0,0 +1,702 @@
package com.tuoheng.admin.service.report.export;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.lowagie.text.*;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum;
import com.tuoheng.admin.enums.code.report.GenerateReportCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.utils.WordUtils;
import com.tuoheng.common.core.config.UploadFileConfig;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.UrlResource;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* 导出巡检报告业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-09
*/
@Slf4j
@Service
public class ExportInspectionReportService {

@Autowired
private ReportMapper reportMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private TenantMapper tenantMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private InspectionFileHandleMapper inspectionFileHandleMapper;

public JsonResult exportReport(String reportId, HttpServletResponse response) {
String tenantId = ShiroUtils.getTenantId();

JsonResult result = this.check(reportId);
if (0 != result.getCode()) {
log.info("导出巡检报告业务:校验失败:{}", result.getMsg());
return result;
}

//查询报告
Report report = (Report) result.getData();

// BeanUtils.copyProperties(report, reportInfoVo);

// 查询问题清单
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getTenantId, tenantId)
.eq(InspectionFile::getInspectionId, report.getInspectionId()));

// 查询问题处理结果
List<String> inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList());
List<InspectionFileHandle> inspectionFileHandleList = inspectionFileHandleMapper.selectList(new LambdaQueryWrapper<InspectionFileHandle>()
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList));

//创建word
String filename = report.getReportCode() + ".doc";
String filepath = UploadFileConfig.uploadFolder + "/doc/" + filename;
File fd = new File(UploadFileConfig.uploadFolder + "/doc");
File f = new File(filepath);
if (!fd.exists()) {
fd.mkdirs();
}

WordUtils wordUtils = new WordUtils();
try {
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId());
String areaName = "";
if(ObjectUtil.isNotNull(tenant)){
// areaName = tenant.getProvinceName() + tenant.getCityName() + tenant.getDistrictName();
if (!StringUtils.isEmpty(tenant.getProvinceName())) {
areaName += tenant.getProvinceName();
}
if (!StringUtils.isEmpty(tenant.getCityName())) {
areaName += tenant.getCityName();
}
if (!StringUtils.isEmpty(tenant.getDistrictName())) {
areaName += tenant.getDistrictName();
}
}
if (!f.exists() || f.length() < 1000) {
f.delete();
f.createNewFile();
wordUtils.openDocument(filepath);
wordUtils.getDocument().setPageSize(PageSize.A4);
wordUtils.getDocument().setMargins(71f, 71f, 72f, 72f);

//标题
wordUtils.insertTitlePattern(areaName + "高速巡检报告", wordUtils.rtfGsBt1);
wordUtils.insertContext("报告编号:" + report.getReportCode(), 10, Font.NORMAL, Element.ALIGN_RIGHT, 20, 0, 0);

// wordUtils.insertTitlePatternThird("一:高速信息", wordUtils.rtfGsBt3);
// //wordUtils.getDocument().add(new Paragraph(""));
// Table inspectionTable = this.buildInspectionTable();
// wordUtils.getDocument().add(inspectionTable);

wordUtils.insertTitlePatternThird("巡检信息", wordUtils.rtfGsBt3);
Table table2 = this.buildInspectionTable(report);
wordUtils.getDocument().add(table2);

wordUtils.insertTitlePatternThird("巡检结果", wordUtils.rtfGsBt3);
Table table3 = this.buildTable3();
wordUtils.getDocument().add(table3);

wordUtils.insertTitlePatternThird("问题清单", wordUtils.rtfGsBt3);
Table inspectionFileTable = this.buildInspectionFileTable(inspectionFileList);
wordUtils.getDocument().add(inspectionFileTable);

// if (reportInfoVo.getImageList().size() > 0) {
// wordUtils.insertTitlePatternThird("四:问题清单", wordUtils.rtfGsBt3);
// for (int i = 0; i < reportInfoVo.getImageList().size(); i++) {
// InspectionFileInfoVo inspectionFileInfoVo = reportInfoVo.getImageList().get(i);
//
// InspectionQuestionItem item = inspectionQuestionItemMapper.selectOne(new LambdaQueryWrapper<InspectionQuestionItem>()
// .eq(inspectionFileInfoVo.getId() != null, InspectionQuestionItem::getInspectionFileId, inspectionFileInfoVo.getId())
// .eq(InspectionQuestionItem::getTenantId, tenantId));
// if (item != null) {
// inspectionFileInfoVo.setHandImg(item.getHandlerImage());
// inspectionFileInfoVo.setHandContent(item.getHandlerResult());
// inspectionFileInfoVo.setHandTime(DateUtils.dateTime(item.getHandlerTime()));
// User user = userMapper.selectById(item.getHandlerUser());
// inspectionFileInfoVo.setHanderName(user.getRealname());
// }
//
// Table table4 = this.buildTable4();
// wordUtils.getDocument().add(table4);
// }
// }
wordUtils.closeDocument();
}

//清空缓存
response.reset();
// 定义浏览器响应表头,并定义下载名
String fileName = URLEncoder.encode(areaName + "高速巡检报告【" + report.getReportCode() + "】.doc", "UTF-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + URLEncoder.encode(fileName,"UTF-8"));
response.setCharacterEncoding("utf-8");
//定义下载的类型
response.setContentType("application/msword;charset=UTF-8");
OutputStream out;
File files = new File(UploadFileConfig.uploadFolder + "doc/", filename);

FileInputStream inputStream = new FileInputStream(files);
//3.通过response获取ServletOutputStream对象(out)
out = response.getOutputStream();
int b = 0;
byte[] buffer = new byte[512];
while (b != -1) {
b = inputStream.read(buffer);
//4.写到输出流(out)中
out.write(buffer, 0, b);
}
inputStream.close();
out.close();
out.flush();
System.out.println("结束。。。。。。");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
wordUtils.closeDocument();
} catch (DocumentException e) {
throw new RuntimeException(e);
}
}
return JsonResult.success();
}

/**
* 检查
*
* @param id
* @return
*/
private JsonResult check(String id) {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(GenerateReportCodeEnum.INSPECTION_ID_IS_NULL.getCode(), GenerateReportCodeEnum.INSPECTION_ID_IS_NULL.getMsg());
}
Report report = reportMapper.selectOne(Wrappers.<Report>lambdaQuery()
.eq(Report::getId, id)
.eq(Report::getMark, 1));
if (null == report) {
return JsonResult.error(GenerateReportCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), GenerateReportCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(report);
}

/**
*
* 构建巡检信息
*
*/
private Table buildInspectionTable1() throws DocumentException {
Table table = new Table(6); //生成一表格
table.setOffset(1f);
int width[] = {1, 1, 1, 1, 1, 1};
table.setWidths(width);//设置系列所占比例
table.setWidth(100);
table.setAutoFillEmptyCells(true);
table.setAlignment(Element.ALIGN_LEFT);//居中显示
for (int i = 0; i < 11; i++) {
Cell cell = new Cell();
String str = null;
cell.setVerticalAlignment(Element.ALIGN_RIGHT);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
Font font = new Font();
font.setSize(10.5f);
font.setStyle(Font.BOLD);
if (i == 0) {
str = "河道基本信息";
cell.setColspan(6);
} else if (i == 1) {
str = "责任单位";
} else if (i == 2) {
// str = reportInfoVo.getStreamArea();
font.setStyle(Font.NORMAL);
} else if (i == 3) {
str = "河流名称";
} else if (i == 4) {
// str = reportInfoVo.getStreamName();
font.setStyle(Font.NORMAL);
} else if (i == 5) {
str = "河段长度";
} else if (i == 6) {
// str = reportInfoVo.getStreamLength();
font.setStyle(Font.NORMAL);
} else if (i == 7) {
str = "起讫位置";
} else if (i == 8) {
// str = reportInfoVo.getStreamLocation();
font.setStyle(Font.NORMAL);
cell.setColspan(3);
} else if (i == 9) {
str = "巡查里程";
} else if (i == 10) {
// str = reportInfoVo.getStreamLength();
font.setStyle(Font.NORMAL);
}
Paragraph p = new Paragraph(str, font);
cell.add(p);
table.addCell(cell);
}
return table;
}

/**
*
* 构建巡检信息
*
*/
private Table buildInspectionTable(Report report) throws DocumentException {
Table table = new Table(2);//生成一表格
table.setOffset(1f);
int width2[] = {1, 1};
table.setWidths(width2);//设置系列所占比例
table.setWidth(100);
table.setAutoFillEmptyCells(true);
table.setAlignment(Element.ALIGN_CENTER); //居中显示
table.setAlignment(Element.ALIGN_MIDDLE); //垂直居中显示
for (int i = 0; i < 14; i++) {
Cell cell = new Cell();
String str = null;
cell.setVerticalAlignment(Element.ALIGN_LEFT);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
Font font = new Font();
font.setSize(10.5f);
font.setStyle(Font.BOLD);
if (i == 0) {
str = "气象信息";
} else if (i == 1) {
str = report.getWeather();
font.setStyle(Font.NORMAL);
} else if (i == 2) {
str = "巡检部门";
} else if (i == 3) {
str = "";
font.setStyle(Font.NORMAL);
} else if (i == 4) {
str = "巡检方式";
} else if (i == 5) {
if (report.getInspectionType() == 1) {
str = "无人机";
} else if (report.getInspectionType() == 2) {
str = "机场巡逻";
} else if (report.getInspectionType() == 3) {
str = "飞手值飞";
}
font.setStyle(Font.NORMAL);
} else if (i == 6) {
str = "巡查设备";
} else if (i == 7) {
str = report.getEquipmentName();
font.setStyle(Font.NORMAL);
} else if (i == 8) {
str = "巡查开始时间";
} else if (i == 9) {
str = report.getExecutionStartTime() == null ? "" : DateUtils.dateTime(report.getExecutionStartTime());
font.setStyle(Font.NORMAL);
} else if (i == 10) {
str = "巡查结束时间";
} else if (i == 11) {
str = report.getExecutionEndTime() == null ? "" : DateUtils.dateTime(report.getExecutionEndTime());
font.setStyle(Font.NORMAL);
} else if (i == 12) {
str = "巡检高速";
} else if (i == 13) {
str = "G2";
font.setStyle(Font.NORMAL);
}
Paragraph p = new Paragraph(str, font);
cell.add(p);
table.addCell(cell);
}
return table;
}

/**
*
* 构建巡检信息
*
*/
private Table buildTable3() throws DocumentException {
Table table = new Table(5);//生成一表格
// Map<String, Object> params = getInsCount(reportInfoVo);
// table.setOffset(1f);
// int width[] = {1, 2, 3, 14, 3};
// table.setWidths(width);//设置系列所占比例
// table.setWidth(100);
// table.setAutoFillEmptyCells(true);
// // table3.setAlignment(Element.ALIGN_CENTER);//居中显示
// // table3.setAlignment(Element.ALIGN_MIDDLE);//垂直居中显示
// for (int i = 0; i < 44; i++) {
// Cell cell = new Cell();
// String str = null;
// cell.setVerticalAlignment(Element.ALIGN_CENTER);
// cell.setHorizontalAlignment(Element.ALIGN_CENTER);
// Font font = new Font();
// font.setSize(10.5f);
// font.setStyle(Font.BOLD);
// if (i == 0) {
// str = "序号";
// } else if (i == 1) {
// str = "项目";
// cell.setColspan(2);
// } else if (i == 2) {
// str = "巡检内容";
// } else if (i == 3) {
// str = "巡检监测结果";
// } else if (i == 4) {
// str = "一";
// cell.setRowspan(6);
// } else if (i == 5) {
// str = QuestionNameEnum.WATER_SURFACE.getName();
// cell.setRowspan(6);
// } else if (i == 6) {
// str = QuestionTypeEnum.DAILY_MONITORING.getName();
// cell.setRowspan(3);
// } else if (i == 7) {
// str = "水面有漂浮物";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 8) {
// str = params.get("${totalCount1}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 9) {
// str = "水面有明显鱼类翻肚现象";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 10) {
// str = params.get("${totalCount2}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 11) {
// str = "河道内存在水生植被";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 12) {
// str = params.get("${totalCount3}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 13) {
// str = QuestionTypeEnum.KEY_VERIFICATION.getName();
// cell.setRowspan(3);
// } else if (i == 14) {
// str = "河道内有蓝藻爆发";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 15) {
// str = params.get("${totalCount4}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 16) {
// str = "水生动、植物死亡";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 17) {
// str = params.get("${totalCount5}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 18) {
// str = "河道有违规阻水物";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 19) {
// str = params.get("${totalCount6}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 20) {
// str = "二";
// cell.setRowspan(4);
// } else if (i == 21) {
// str = QuestionNameEnum.WATER_FRONT.getName();
// cell.setRowspan(4);
// } else if (i == 22) {
// str = QuestionTypeEnum.DAILY_MONITORING.getName();
// cell.setRowspan(3);
// } else if (i == 23) {
// str = "河道养护范围内种菜";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 24) {
// str = params.get("${totalCount7}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 25) {
// str = "河堤、栏杆等设施有损坏";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 26) {
// str = params.get("${totalCount8}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 27) {
// str = "岸坡有垃圾";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 28) {
// str = params.get("${totalCount9}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 29) {
// str = QuestionTypeEnum.KEY_VERIFICATION.getName();
// } else if (i == 30) {
// str = "河道蓝线内(岸上)新增违法建筑或构造物";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 31) {
// str = params.get("${totalCount10}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 32) {
// str = "三";
// } else if (i == 33) {
// str = QuestionNameEnum.WATER_QUALITY.getName();
// } else if (i == 34) {
// str = QuestionTypeEnum.DAILY_MONITORING.getName();
// } else if (i == 35) {
// str = "水体出现水质明显突变(感官、颜色)";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 36) {
// str = params.get("${totalCount11}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 37) {
// str = "四";
// cell.setRowspan(2);
// } else if (i == 38) {
// str = QuestionNameEnum.OUTFALL.getName();
// cell.setRowspan(2);
// } else if (i == 39) {
// str = QuestionTypeEnum.DAILY_MONITORING.getName();
// cell.setRowspan(2);
// } else if (i == 40) {
// str = "入河、湖支流、泵站、入河排口晴天排放异常水体";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 41) {
// str = params.get("${totalCount12}").toString();
// font.setStyle(Font.NORMAL);
// } else if (i == 42) {
// str = "存在排口";
// cell.setHorizontalAlignment(Element.ALIGN_LEFT);
// font.setStyle(Font.NORMAL);
// } else if (i == 43) {
// str = params.get("${totalCount13}").toString();
// font.setStyle(Font.NORMAL);
// }
// Paragraph p = new Paragraph(str, font);
// cell.add(p);
// table.addCell(cell);
// }
return table;
}

/**
*
* 构建巡检问题信息
*
*/
private Table buildInspectionFileTable(List<InspectionFile> inspectionFileList) throws DocumentException, IOException {
Table table = new Table(2); //生成一表格
table.setOffset(1f);
int width2[] = {1, 1};
table.setWidths(width2); //设置系列所占比例
table.setWidth(100);
table.setAutoFillEmptyCells(true);

InspectionFile inspectionFile;
Font font = new Font();
font.setSize(10.5f);
for (int i = 0; i < inspectionFileList.size(); i++) {
inspectionFile = inspectionFileList.get(i);
for (int j = 0; j < 7; j++) {
Cell cell = new Cell();
cell.setVerticalAlignment(Element.ALIGN_CENTER); // 设置单元格的垂直对齐方式 : 居中
cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 设置单元格的水平对齐方式 :居中对齐
String str = "";
if (j == 0) {
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
font.setSize(12);
str = " 问题" + (i + 1);
cell.add(new Paragraph(str, font));
cell.setColspan(2);
font.setStyle(Font.BOLD);
} else if (j == 1) {
str = " 坐标";
cell.add(new Paragraph(str, font));
} else if (j == 2) {
str = inspectionFile.getLongitude() + "," + inspectionFile.getLatitude();
cell.add(new Paragraph(str, font));
} else if (j == 3) {
str = " 问题描述";
cell.add(new Paragraph(str, font));
} else if (j == 4) {
str = inspectionFile.getQuestionDesc();
cell.add(new Paragraph(str, font));
} else if (j == 5) {
str = " 问题图片";
cell.add(new Paragraph(str, font));
} else if (j == 6) {
Image image = null;
String url = CommonConfig.imageURL + inspectionFile.getFileThumbnail();
url = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2Ff%2F57a42b9002e19.jpg&refer=http%3A%2F%2Fpic1.win4000.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1673509195&t=57d6710dc11bdd1ff75f5121a7d6c73f";

if (new UrlResource(url).exists()) {
image = Image.getInstance(url);
image.setAlignment(Image.ALIGN_CENTER);
image.scalePercent(100); //依照比例缩放
image.setAbsolutePosition(400, 600);
image.scaleToFit(300, 300);//自定义大
} else {
log.error("图片不存在!" + url);
}
if (new UrlResource(url).exists()) {
cell.add(image);
} else {
cell.add(new Paragraph(""));
}
}
table.addCell(cell);
}
}
return table;
}

/**
*
* 构建巡检问题信息
*
*/
private Table buildInspectionFileTable2() throws DocumentException, IOException {
Table table = new Table(2); //生成一表格
table.setOffset(1f);
int width4[] = {1, 2};
table.setWidths(width4);//设置系列所占比例
table.setWidth(100);
table.setAutoFillEmptyCells(true);
for (int i = 0; i < 8; i++) {
Cell cell = new Cell();
String str = "";
Font font = new Font();
font.setSize(10.5f);
cell.setVerticalAlignment(Element.ALIGN_CENTER);
// if (i == 0) {
// font.setSize(12);
// str = " 问题" + (i + 1);
// cell.add(new Paragraph(str, font));
// cell.setColspan(2);
// font.setStyle(Font.BOLD);
// } else if (i == 1) {
// str = " 坐标";
// cell.add(new Paragraph(str, font));
// } else if (i == 2) {
// str = report.getImageList().get(i).getLongitude() + "," + reportInfoVo.getImageList().get(i).getLatitude();
// cell.add(new Paragraph(str, font));
// } else if (i == 3) {
// str = " 问题描述";
// cell.add(new Paragraph(str, font));
// } else if (i == 4) {
// str = reportInfoVo.getImageList().get(i).getContent();
// cell.add(new Paragraph(str, font));
// } else if (i == 5) {
// str = " 问题图片";
// cell.add(new Paragraph(str, font));
// } else if (i == 6) {
// Image image = null;
// String url = CommonConfig.imageURL + reportInfoVo.getImageList().get(i).getFileImage();
// if (new UrlResource(url).exists()) {
// image = Image.getInstance(url);
// image.setAlignment(Image.ALIGN_CENTER);
// image.scalePercent(100); //依照比例缩放
// image.setAbsolutePosition(400, 600);
// image.scaleToFit(300, 300);//自定义大
// } else {
// log.error("图片不存在!" + url);
// }
// if (new UrlResource(url).exists()) {
// cell.add(image);
// } else {
// cell.add(new Paragraph(""));
// }
// } else if (i == 7) {
// str = " 处理结果";
// cell.add(new Paragraph(str, font));
// cell.setColspan(2);
// font.setStyle(Font.BOLD);
// } else if (i == 8) {
// str = " 处理人";
// cell.add(new Paragraph(str, font));
// } else if (i == 9) {
// str = inspectionFileInfoVo.getHanderName();
// cell.add(new Paragraph(str, font));
// } else if (j == 10) {
// str = " 处理时间";
// cell.add(new Paragraph(str, font));
// } else if (j == 11) {
// str = inspectionFileInfoVo.getHandTime();
// cell.add(new Paragraph(str, font));
// } else if (j == 12) {
// str = " 备注";
// cell.add(new Paragraph(str, font));
// } else if (j == 13) {
// str = inspectionFileInfoVo.getHandContent();
// cell.add(new Paragraph(str, font));
// } else if (j == 14) {
// String[] handUrls = inspectionFileInfoVo.getHandImg().split(",");
// for (int k = 0; k < handUrls.length; k++) {
// cell = new Cell();
// cell.setVerticalAlignment(Element.ALIGN_CENTER);
// if (handUrls.length == 1) {
// cell.add(new Paragraph(" 结果图片", font));
// } else {
// cell.add(new Paragraph(" 结果图片" + (k + 1), font));
// }
// table.addCell(cell);
// cell = new Cell();
// Image image = null;
// String url = CommonConfig.imageURL + handUrls[k];
// if (new UrlResource(url).exists()) {
// image = Image.getInstance(url);
// image.setAlignment(Image.ALIGN_CENTER);
// image.scalePercent(100); //依照比例缩放
// image.setAbsolutePosition(400, 600);
// image.scaleToFit(300, 300);//自定义大
// } else {
// System.out.println("图片不存在!" + url);
// }
// if (new UrlResource(url).exists()) {
// cell.add(image);
// } else {
// cell.add(new Paragraph(""));
// }
// table.addCell(cell);
// }
// }
if (i != 14) {
table.addCell(cell);
}
}
return table;
}
}

+ 158
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/generate/GenerateReportService.java Ver arquivo

@@ -0,0 +1,158 @@
package com.tuoheng.admin.service.report.generate;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.conver.InspectionConverMapper;
import com.tuoheng.admin.conver.ReportConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.InspectionFileStatusEnum;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.code.inspection.ResubmitInspectionCodeEnum;
import com.tuoheng.admin.enums.code.report.GenerateReportCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspection.EditInspectionRequest;
import com.tuoheng.admin.service.third.pilot.PilotService;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.DateUtils;
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.stream.Collectors;

/**
* 生成报告业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-09
*/
@Slf4j
@Service
public class GenerateReportService {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private InspectionFileHandleMapper inspectionFileHandleMapper;

@Autowired
private ReportMapper reportMapper;

/**
* 生成报告
*
* @return
*/
public JsonResult generate(String id) {
log.info("进入生成报告业务");
String userId = ShiroUtils.getUserId();
String tenantId = ShiroUtils.getTenantId();

JsonResult result = this.check(id);
if (0 != result.getCode()) {
log.info("生成报告业务:校验参数失败:{}", result.getMsg());
return result;
}
Inspection inspection = (Inspection) result.getData();

Report report = this.buildReport(userId, tenantId, inspection);

result = this.addReport(report);
if (0 != result.getCode()) {
log.info("生成报告业务:添加报告记录失败:{}", result.getMsg());
return result;
}

return JsonResult.success(report);
}

/**
* 检查
*
* @param id
* @return
*/
private JsonResult check(String id) {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(GenerateReportCodeEnum.INSPECTION_ID_IS_NULL.getCode(), GenerateReportCodeEnum.INSPECTION_ID_IS_NULL.getMsg());
}
Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getId, id)
.eq(Inspection::getMark, 1));
if (null == inspection) {
return JsonResult.error(GenerateReportCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), GenerateReportCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(inspection);
}

/**
*
* 生成报告实体
*
* @param inspection
*/
private Report buildReport(String userId, String tenantId, Inspection inspection) {
Report report = ReportConverMapper.INSTANCE.fromInspectionToReport(inspection);
// 任务编号:XJBG+日期+3位排序数字
String code = DateUtils.generateCode("XJBG");
report.setId("");
report.setReportCode(code);
report.setTenantId(tenantId);
report.setInspectionId(inspection.getId());
report.setInspectionCode(inspection.getCode());
report.setInspectionName(inspection.getName());
report.setCreateUser(userId);
report.setCreateTime(DateUtils.now());
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getInspectionId, inspection.getId())
.eq(InspectionFile::getStatus, InspectionFileStatusEnum.CONFIRMED.getCode())
.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;
}

/**
*
* 添加报告
* 每次生成报告,将上一次生成的报告给覆盖,因此直接将上次的删除,重新添加一条
*
* @param report
*/
private JsonResult addReport(Report report) {
Report reportTmp = reportMapper.selectOne(Wrappers.<Report>lambdaQuery()
.eq(Report::getInspectionId, report.getInspectionId())
.eq(Report::getMark, 1));
if (null != reportTmp) {
reportMapper.deleteById(reportTmp.getId());

}
Integer rowCount = reportMapper.insert(report);
if (rowCount <= 0) {
log.info("生成报告业务:添加报告记录失败");
return JsonResult.error(GenerateReportCodeEnum.GENERATE_IS_FAILED.getCode(), GenerateReportCodeEnum.GENERATE_IS_FAILED.getMsg());
}
return JsonResult.success();
}
}

+ 154
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionHandleReportService.java Ver arquivo

@@ -0,0 +1,154 @@
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.toolkit.Wrappers;
import com.tuoheng.admin.conver.InspectionFileConverMapper;
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.enums.code.report.QueryInspectionReportCodeEnum;
import com.tuoheng.admin.mapper.InspectionFileHandleMapper;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.ReportMapper;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.InspectionFileHandleReportVo;
import com.tuoheng.admin.vo.InspectionFileReportVo;
import com.tuoheng.admin.vo.InspectionReportVo;
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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* 查看巡检处理报告业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-12
*/
@Slf4j
@Service
public class QueryInspectionHandleReportService {

@Autowired
private ReportMapper reportMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private InspectionFileHandleMapper inspectionFileHandleMapper;

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

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

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

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

InspectionReportVo inspectionReportVo = this.buildInspectionReportVo(report);

return JsonResult.success(inspectionReportVo);
}

/**
* 检查参数
*
* @param tenantId
* @param id
* @return
*/
private JsonResult check(String tenantId, String id) {
// 判断id是否为空
if (StringUtils.isEmpty(id)) {
return JsonResult.error(QueryInspectionReportCodeEnum.REPORT_ID_IS_NULL.getCode(), QueryInspectionReportCodeEnum.REPORT_ID_IS_NULL.getMsg());
}

// 判断报告是否存在
Report report = reportMapper.selectOne(new LambdaQueryWrapper<Report>()
.eq(Report::getTenantId, tenantId)
.eq(Report::getId, id)
.eq(Report::getMark, 1));
if (null == report) {
return JsonResult.error(QueryInspectionReportCodeEnum.REPORT_IS_NOT_EXIST.getCode(), QueryInspectionReportCodeEnum.REPORT_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(report);
}

/**
* 构造返回的数据列
*
* @param report
* @return
*/
private InspectionReportVo buildInspectionReportVo(Report report) {
InspectionReportVo inspectionReportVo = ReportConverMapper.INSTANCE.fromReportToInspectionReportVo(report);
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getInspectionId, report.getInspectionId())
.eq(InspectionFile::getMark, 1));

List<InspectionFileReportVo> inspectionFileHandleVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFileHandleVoList(inspectionFileList);

Map<String, InspectionFileHandle> inspectionFileHandleMap = this.getInspectionFileHandleMap(inspectionFileList);
if (null != inspectionFileHandleMap) {
InspectionFileHandle inspectionFileHandle;
InspectionFileHandleReportVo inspectionFileHandleReportVo;
List<String> handlerImageList = null;
for (InspectionFileReportVo inspectionFileReportVo : inspectionFileHandleVoList) {
inspectionFileHandle = inspectionFileHandleMap.get(inspectionFileReportVo.getId());
if (null != inspectionFileHandle) {
handlerImageList = new ArrayList<>();
String[] arr = inspectionFileHandle.getHandlerImage().split(",");
List<String> list = Arrays.stream(arr).map(String::toString).collect(Collectors.toList());
for (String str : list) {
handlerImageList.add(CommonConfig.imageURL + str);
}
inspectionFileHandleReportVo = new InspectionFileHandleReportVo();
inspectionFileHandleReportVo.setHandlerUser(inspectionFileHandle.getHandlerUser());
inspectionFileHandleReportVo.setHandlerResult(inspectionFileHandle.getHandlerResult());
inspectionFileHandleReportVo.setHandlerTime(inspectionFileHandle.getHandlerTime());
inspectionFileHandleReportVo.setHandlerImageList(handlerImageList);
inspectionFileReportVo.setInspectionFileHandleReportVo(inspectionFileHandleReportVo);
}
}
}
inspectionReportVo.setInspectionFileReportVoList(inspectionFileHandleVoList);

return inspectionReportVo;
}

private Map<String, InspectionFileHandle> getInspectionFileHandleMap(List<InspectionFile> inspectionFileList) {
List<String> inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList());
List<InspectionFileHandle> inspectionFileHandleList = null;
if (!CollectionUtil.isEmpty(inspectionFileIdList)) {
inspectionFileHandleList = inspectionFileHandleMapper.selectList(Wrappers.<InspectionFileHandle>lambdaQuery()
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList)
.eq(InspectionFileHandle::getMark, 1));

}
if (CollectionUtil.isEmpty(inspectionFileIdList)) {
return null;
}
Map<String, InspectionFileHandle> inspectionFileHandleMap = inspectionFileHandleList.stream().collect(Collectors.toMap(InspectionFileHandle::getInspectionFileId, Function.identity()));
return inspectionFileHandleMap;
}
}

+ 104
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionReportService.java Ver arquivo

@@ -0,0 +1,104 @@
package com.tuoheng.admin.service.report.query;

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.conver.ReportConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.code.report.QueryInspectionReportCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.ReportMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.request.report.QueryReportPageListRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.InspectionFileHandleVo;
import com.tuoheng.admin.vo.InspectionFileReportVo;
import com.tuoheng.admin.vo.InspectionReportVo;
import com.tuoheng.admin.vo.ReportPageListVo;
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;

/**
* 查询巡检报告业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-12
*/
@Slf4j
@Service
public class QueryInspectionReportService {

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private ReportMapper reportMapper;

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

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

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

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

InspectionReportVo inspectionReportVo = this.buildInspectionReportVo(report);

return JsonResult.success(inspectionReportVo);
}

/**
* 检查参数
*
* @param tenantId
* @param id
* @return
*/
private JsonResult check(String tenantId, String id) {
// 判断id是否为空
if (StringUtils.isEmpty(id)) {
return JsonResult.error(QueryInspectionReportCodeEnum.REPORT_ID_IS_NULL.getCode(), QueryInspectionReportCodeEnum.REPORT_ID_IS_NULL.getMsg());
}

// 判断报告是否存在
Report report = reportMapper.selectOne(new LambdaQueryWrapper<Report>()
.eq(Report::getTenantId, tenantId)
.eq(Report::getId, id)
.eq(Report::getMark, 1));
if (null == report) {
return JsonResult.error(QueryInspectionReportCodeEnum.REPORT_IS_NOT_EXIST.getCode(), QueryInspectionReportCodeEnum.REPORT_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(report);
}

/**
* 构造返回的数据列
*
* @param report
* @return
*/
private InspectionReportVo buildInspectionReportVo(Report report) {
InspectionReportVo inspectionReportVo = ReportConverMapper.INSTANCE.fromReportToInspectionReportVo(report);
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getInspectionId, report.getInspectionId())
.eq(InspectionFile::getMark, 1));

List<InspectionFileReportVo> inspectionFileHandleVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFileHandleVoList(inspectionFileList);
inspectionReportVo.setInspectionFileReportVoList(inspectionFileHandleVoList);
return inspectionReportVo;
}
}

+ 131
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryReportPageListService.java Ver arquivo

@@ -0,0 +1,131 @@
package com.tuoheng.admin.service.report.query;

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.ReportConverMapper;
import com.tuoheng.admin.entity.Dept;
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.request.report.QueryReportPageListRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.InspectionVo;
import com.tuoheng.admin.vo.ReportPageListVo;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 查询报告分页列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-09
*/
@Slf4j
@Service
public class QueryReportPageListService {

@Autowired
private UserMapper userMapper;

@Autowired
private DeptMapper deptMapper;

@Autowired
private ReportMapper reportMapper;

/**
*
* 查房报告分页列表
* 用户只能查看自己生成的报告
*
* @param request
* @return
*/
public JsonResult getPageList(QueryReportPageListRequest request) {
log.info("进入查询巡检任务分页列表业务");

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

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询巡检任务分页列表业务:校验失败:{}", result.getMsg());
return result;
}

User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getTenantId, tenantId)
.eq(User::getId, userId)
.eq(User::getMark, 1));

Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>()
.eq(Dept::getTenantId, tenantId)
.eq(Dept::getId, user.getDeptId())
.eq(Dept::getMark, 1));

// 设置分页参数
IPage<Report> page = new Page<>(request.getPage(), request.getLimit());
// 用户只能查看自己生成的报告
request.setCreateUser(userId);
// 查询结果
IPage<Report> pageData = reportMapper.selectPageList(page, request);

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

// 重写返回结果对象
IPage<ReportPageListVo> reportVoPageData = new Page<>();
reportVoPageData.setPages(pageData.getPages());
reportVoPageData.setCurrent(pageData.getCurrent());
reportVoPageData.setSize(pageData.getSize());
reportVoPageData.setTotal(pageData.getTotal());
reportVoPageData.setRecords(reportPageListVoList);

return JsonResult.success(reportVoPageData);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(String tenantId, QueryReportPageListRequest request) {
// 判断部门id是否为空
// if (StringUtils.isEmpty(queryInspectionRequest.getDeptId())) {
// return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getMsg());
// }
//
// // 判断部门是否存在
// Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>()
// .eq(Dept::getTenantId, tenantId)
// .eq(Dept::getId, queryInspectionRequest.getDeptId())
// .eq(Dept::getMark, 1));
// if (null == dept) {
// return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getCode(), QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getMsg());
// }
return JsonResult.success();
}

/**
* 构造返回的数据列表
*
* @param user
* @param dept
* @param reportList
* @return
*/
private List<ReportPageListVo> buildReportPageListVoList(User user, Dept dept, List<Report> reportList) {
List<ReportPageListVo> reportPageListVoList = ReportConverMapper.INSTANCE.fromReportListToReportPageListList(reportList);
return reportPageListVoList;
}
}

+ 373
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/WordUtils.java Ver arquivo

@@ -0,0 +1,373 @@
package com.tuoheng.admin.utils;

import com.lowagie.text.Font;
import com.lowagie.text.Image;
import com.lowagie.text.*;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.rtf.RtfWriter2;
import com.lowagie.text.rtf.style.RtfParagraphStyle;

import java.awt.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;

/**
* word帮助文件
*/
public class WordUtils {

private Document document;

private String test;

private Map<Integer, String> fontFamily = new HashMap<Integer, String>();


public Document getDocument() {
return document;
}

public void setDocument(Document document) {
this.document = document;
}

public WordUtils() {
this.document = new Document(PageSize.A4);//����ֽ�Ŵ�С
document.newPage();
//init font
if (getSystem()) {
fontFamily.put(1, "C:\\Windows\\Fonts\\simhei.ttf");
fontFamily.put(2, "C:\\Windows\\Fonts\\STXINWEI.TTF");
fontFamily.put(3, "C:\\Windows\\Fonts\\simsun.ttc,0");
fontFamily.put(4, "C:\\Windows\\Fonts\\fangsong_GB2312.ttf");
fontFamily.put(5, "C:\\Windows\\Fonts\\times.ttf");
fontFamily.put(6, "C:\\Windows\\Fonts\\simfang.ttf");
} else {
fontFamily.put(1, "/usr/share/fonts/simhei.ttf");
fontFamily.put(2, "/usr/share/fonts/STXINWEI.TTF");
fontFamily.put(3, "/usr/share/fonts/windows/simsun.ttc,0");
fontFamily.put(4, "/usr/share/fonts/fangsong_GB2312.ttf");
fontFamily.put(5, "/usr/share/fonts/times.ttf");
}
}

/**
* 建立一个书写器(Writer)与document对象关联,通过书写器(Writer)可以将文档写入到磁盘中
*
* @param filePath 要操作的文档路径,若文档不存在会自动创建
* @throws com.lowagie.text.DocumentException
* @throws IOException
*/
public void openDocument(String filePath) throws DocumentException,
IOException {
// 建立一个书写器(Writer)与document对象关联,通过书写器(Writer)可以将文档写入到磁盘中
RtfWriter2.getInstance(this.document, new FileOutputStream(filePath));
this.document.open();
// 设置中文字体
/*this.bfChinese = BaseFont.createFont("STSongStd-Light",
"UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);*/
}

/**
* @param titleStr 标题
* @param fontsize 字体大小
* @param fontStyle 字体样式
* @param elementAlign 对齐方式
* @throws com.lowagie.text.DocumentException
*/
public void insertTitle(String titleStr, float fontsize, int fontStyle, int elementAlign, float before, float after, int fontFamliyType) throws Exception {
BaseFont fontFamliy = BaseFont.createFont(fontFamily.get(3), "GBK", BaseFont.NOT_EMBEDDED);
Font titleFont = new Font(fontFamliy, fontsize, fontStyle);
Paragraph title = new Paragraph(titleStr);
// 设置标题格式对齐方式
title.setAlignment(elementAlign);
title.setFont(titleFont);
title.setSpacingBefore(before);
title.setSpacingAfter(after);

this.document.add(title);
}


/**
* 设置带有目录格式的标题(标题1格式)
*
* @param rtfParagraphStyle 标题1样式
* @param titleStr 标题
* @throws com.lowagie.text.DocumentException
* @throws IOException
*/
public void insertTitlePattern(String titleStr, RtfParagraphStyle rtfParagraphStyle) throws DocumentException, IOException {
Paragraph title = new Paragraph(titleStr);
title.setFont(rtfParagraphStyle);
this.document.add(title);
}


/**
* 设置带有目录格式的标题(标题2格式)
*
* @param titleStr 标题
* @param rtfParagraphStyle 标题2样式
* @throws com.lowagie.text.DocumentException
*/
public void insertTitlePatternSecond(String titleStr, RtfParagraphStyle rtfParagraphStyle) throws DocumentException {
Paragraph title = new Paragraph(titleStr);
// 设置标题格式对齐方式
title.setFont(rtfParagraphStyle);
this.document.add(title);

}

/**
* 设置带有目录格式的标题(标题3格式)
*
* @param titleStr 标题
* @param rtfParagraphStyle 标题3样式
* @throws com.lowagie.text.DocumentException
*/
public void insertTitlePatternThird(String titleStr, RtfParagraphStyle rtfParagraphStyle) throws DocumentException {
Paragraph title = new Paragraph(titleStr);
// 设置标题格式对齐方式
title.setFont(rtfParagraphStyle);
this.document.add(title);
}


/**
* @param tableName 标题
* @param fontsize 字体大小
* @param fontStyle 字体样式
* @param elementAlign 对齐方式
* @throws com.lowagie.text.DocumentException
*/
public void insertTableName(String tableName, int fontsize, int fontStyle, int elementAlign) throws DocumentException {
Font titleFont = new Font();
titleFont.setColor(102, 102, 153);
Paragraph title = new Paragraph(tableName);
// 设置标题格式对齐方式
title.setAlignment(elementAlign);
title.setFont(titleFont);

this.document.add(title);
}

/**
* @param contextStr 内容
* @param fontsize 字体大小
* @param fontStyle 字体样式
* @param elementAlign 对齐方式
* @throws com.lowagie.text.DocumentException
* @throws IOException
*/
public void insertContext(String contextStr, int fontsize, int fontStyle, int elementAlign, float firstLineIndent, float before, float after) throws DocumentException, IOException {
// 正文字体风格
BaseFont fontFamliy = BaseFont.createFont(fontFamily.get(3), "GBK", BaseFont.EMBEDDED);
Font contextFont = new Font(fontFamliy, fontsize, fontStyle);
Paragraph context = new Paragraph(contextStr);
//设置行距
context.setLeading(3f);
// 正文格式左对齐
context.setAlignment(elementAlign);
context.setFont(contextFont);
// 离上一段落(标题)空的行数
//context.setSpacingBefore(1);
// 设置第一行空的列数
//context.setFirstLineIndent(20);
context.setFirstLineIndent(firstLineIndent);
context.setSpacingBefore(before);
context.setSpacingAfter(after);
document.add(context);
}

/**
* 插入正文里的注释
*
* @param contextStr 内容
* @param fontsize 字体大小 5号 10.5
* @param fontStyle 字体样式
* @param elementAlign 对齐方式
* @throws com.lowagie.text.DocumentException
*/
public void insertContextNote(String contextStr, int fontsize, int fontStyle, int elementAlign, float firstLineIndent, float before, float after) throws Exception {

BaseFont fontFamliy = BaseFont.createFont(fontFamily.get(3), "GBK", BaseFont.EMBEDDED);
Font contextFont = new Font(fontFamliy, 10.5f, fontStyle);
Paragraph context = new Paragraph(contextStr);
context.setLeading(3f);
context.setAlignment(elementAlign);
context.setFont(contextFont);
context.setFirstLineIndent(firstLineIndent);
context.setSpacingBefore(before);
context.setSpacingAfter(after);
document.add(context);
}


public void insertContext(Paragraph context) throws Exception {
BaseFont fontFamliy = BaseFont.createFont(fontFamily.get(3), "GBK", BaseFont.EMBEDDED);
Font contextFont = new Font(fontFamliy, 12);
context.setFont(contextFont);
document.add(context);
}

/**
* @param imgUrl 图片路径
* @param imageAlign 显示位置
* @param height 显示高度
* @param weight 显示宽度
* @param percent 显示比例
* @param heightPercent 显示高度比例
* @param weightPercent 显示宽度比例
* @param rotation 显示图片旋转角度
* @throws MalformedURLException
* @throws IOException
* @throws com.lowagie.text.DocumentException
*/
public void insertImg(String imgUrl, int imageAlign, int height, int weight, int percent, int heightPercent, int weightPercent, int rotation) throws MalformedURLException, IOException, DocumentException {
// 添加图片
Image img = Image.getInstance(imgUrl);
if (img == null)
return;
img.setAbsolutePosition(0, 0);
img.setAlignment(imageAlign);
img.scaleAbsolute(height, weight);
img.scaleAbsolute(1000, 1000);
img.scalePercent(percent);
img.scalePercent(heightPercent, weightPercent);
img.setRotation(rotation);
document.add(img);
}

/**
* 添加简单表格
*
* @param column 表格列数(必须)
* @param row 表格行数
* @throws com.lowagie.text.DocumentException
*/
public void insertSimpleTable(int column, int row) throws DocumentException {
Table table = new Table(column);//列数必须设置,而行数则可以按照个人要求来决定是否需要设置
table.setAlignment(Element.ALIGN_CENTER);// 居中显示
table.setAlignment(Element.ALIGN_MIDDLE);// 纵向居中显示
table.setAutoFillEmptyCells(true);// 自动填满
table.setBorderColor(new Color(0, 125, 255));// 边框颜色
table.setBorderWidth(1);// 边框宽度
table.setSpacing(2);// 衬距,
table.setPadding(2);// 即单元格之间的间距
table.setBorder(20);// 边框
for (int i = 0; i < column * 3; i++) {
table.addCell(new Cell("" + i));
}
document.add(table);
}

public void insertContext2(String contextStr, int fontsize, int fontStyle, int elementAlign, float firstLineIndent, float hangju, float before, float after, int fontFamliyType) throws DocumentException, IOException {
BaseFont fontFamliy = BaseFont.createFont(fontFamily.get(fontFamliyType), "GBK", BaseFont.EMBEDDED);
Font contextFont = new Font(fontFamliy, fontsize, fontStyle);
Paragraph context = new Paragraph(contextStr);
//设置行距
context.setLeading(hangju);
// 正文格式左对齐
context.setAlignment(elementAlign);
context.setFont(contextFont);
context.setFirstLineIndent(firstLineIndent);
context.setSpacingBefore(before);
context.setSpacingAfter(after);
document.add(context);
}

/**
* 新增
* hxl 2019-3-29
* 设置字体
*
* @param fontFamliyType
* @return
* @throws Exception
*/
public BaseFont setFont(int fontFamliyType) throws Exception {
BaseFont fontFamliy = BaseFont.createFont(fontFamily.get(3), "GBK", BaseFont.NOT_EMBEDDED);
return fontFamliy;
}


/**
* 在操作完成后必须关闭document,否则即使生成了word文档,打开也会发生错误
*
* @throws com.lowagie.text.DocumentException
*/
public void closeDocument() throws DocumentException {
this.document.close();
}

//判断操作系统类型
public boolean getSystem() {
if (System.getProperties().getProperty("os.name").toUpperCase().indexOf("WINDOWS") != -1) {
return true;
}
return false;
}

public Map<Integer, String> getFontFamily() {
return fontFamily;
}

public void setFontFamily(Map<Integer, String> fontFamily) {
this.fontFamily = fontFamily;
}

//第一级标题样式
public static RtfParagraphStyle rtfGsBt1 = RtfParagraphStyle.STYLE_HEADING_1;


//第二级标题样式
public static RtfParagraphStyle rtfGsBt2 = RtfParagraphStyle.STYLE_HEADING_2;


//第三级标题样式
public static RtfParagraphStyle rtfGsBt3 = RtfParagraphStyle.STYLE_HEADING_3;


//第四级标题样式
public static RtfParagraphStyle rtfGsBt4 = RtfParagraphStyle.STYLE_HEADING_3;

static {
rtfGsBt1.setAlignment(Element.ALIGN_CENTER);
rtfGsBt1.setStyle(Font.BOLD);
rtfGsBt1.setSize(22);
rtfGsBt1.setSpacingBefore(10);
rtfGsBt1.setSpacingAfter(10);
rtfGsBt1.setFontName("黑体");

rtfGsBt2.setAlignment(Element.ALIGN_CENTER);
rtfGsBt2.setStyle(Font.BOLD);
rtfGsBt2.setSize(14);
rtfGsBt2.setSpacingBefore(10);
rtfGsBt2.setSpacingAfter(10);
rtfGsBt2.setKeepTogether(true);
rtfGsBt2.setKeepTogetherWithNext(true);
rtfGsBt2.setFontName("黑体");

rtfGsBt3.setAlignment(Element.ALIGN_LEFT);
rtfGsBt3.setStyle(Font.BOLD);
rtfGsBt3.setSize(14);
rtfGsBt3.setSpacingBefore(10);
rtfGsBt3.setSpacingAfter(0);
rtfGsBt3.setKeepTogether(true);
//rtfGsBt3.setKeepTogetherWithNext(true);
rtfGsBt3.setFontName("FangSong_GB2312");

rtfGsBt4.setAlignment(Element.ALIGN_LEFT);
rtfGsBt4.setStyle(Font.BOLD);
rtfGsBt4.setSize(14);
rtfGsBt4.setSpacingBefore(10);
rtfGsBt4.setSpacingAfter(0);
rtfGsBt4.setKeepTogether(true);
rtfGsBt4.setKeepTogetherWithNext(true);
rtfGsBt4.setFontName("FangSong_GB2312");
}
}

+ 40
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileHandleReportVo.java Ver arquivo

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

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
* 返回巡检问题报告视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-12-12
*/
@Data
public class InspectionFileHandleReportVo {

/**
* 处理人ID
*/
private String handlerUser;

/**
* 处理后图片(多个图片逗号“,”分隔)
*/
private List<String> handlerImageList;

/**
* 处理结果
*/
private String handlerResult;

/**
* 处理完成时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date handlerTime;

}

+ 80
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileReportVo.java Ver arquivo

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

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.admin.entity.InspectionFile;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
* 返回巡检问题报告视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-12-12
*/
@Data
public class InspectionFileReportVo {

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

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

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

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

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

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

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

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

/**
* 高德地图纬度
*/
private String gaodeLongitude;

/**
* 高德地图经度
*/
private String gaodeLatitude;

/**
* 高德地图地址
*/
private String gaodeAddress;

/**
* 处理结果
*/
private InspectionFileHandleReportVo inspectionFileHandleReportVo;
}

+ 283
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionReportVo.java Ver arquivo

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

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.admin.entity.InspectionFile;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
* 返回巡检报告视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-12-12
*/
@Data
public class InspectionReportVo {

/**
* 报告ID
*/
private String id;

/**
* 租户ID
*/
private String tenantId;

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

/**
* 报告编号
*/
private String reportCode;

/**
* 巡检任务ID
*/
private String inspectionId;

/**
* 巡检任务编码
*/
private String inspectionCode;

/**
* 巡检任务名称
*/
private String inspectionName;

/**
* 巡检任务类型 1 临时巡检
*/
private Integer type;

/**
* 公路ID
*/
private String roadId;

/**
* 公路名称
*/
private String roadName;

/**
* 路段ID
*/
private String sectionId;

/**
* 路段名称
*/
private String sectionName;

/**
* 巡检方式类型 1 无人机 2机场巡逻 3 飞手值飞
*/
private Long inspectionType;

/**
* 巡检机场id
*/
private Long airportId;

/**
* 巡检机场名称
*/
private String airportName;

/**
* 巡检线路id
*/
private Long inspectionLine;

/**
* 巡检线路名称
*/
private String inspectionLineName;

/**
* 飞行设备
*/
private String equipmentId;

/**
* 飞行设备名称
*/
private String equipmentName;

/**
* 挂载设备(多选逗号","分隔)
*/
private String equipmentMountId;

/**
* 挂载设备名称(多选逗号","分隔)
*/
private String equipmentMountName;

/**
* 5G云盒ID
*/
private String cloudBoxId;

/**
* 云盒名称
*/
private String cloudBoxName;

/**
* 云盒SN号
*/
private String boxSn;

/**
* 飞手(多选逗号","分隔)
*/
private String flightHand;

/**
* 飞手姓名(多选逗号","分隔)
*/
private String flightHandName;

/**
* 计划巡检日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectionTime;

/**
* 执行开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date executionStartTime;

/**
* 执行结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date executionEndTime;

/**
* 是否实时,1:实时 2:离线 默认:null
*/
private Long isLive;

/**
* 是否正摄:1是 2否
*/
private String isTaken;

/**
* 是否倾斜摄影:1是 2否
*/
private String isTilt;

/**
* 原视频地址
*/
private String videoUrl;

/**
* AI识别后视频地址
*/
private String aiVideoUrl;

/**
* 报告地址
*/
private String reportUrl;

/**
* SRT文件地址
*/
private String srtUrl;

/**
* 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成
*/
private String status;

/**
* 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败
*/
private Long analyseStatus;

/**
* ai任务分析进度
*/
private BigDecimal progressbar;

/**
* 备注
*/
private String note;

/**
* 巡检时天气情况
*/
private String weather;

/**
* 飞行高度
*/
private String flyHeight;

/**
* srt文件名称
*/
private String srtName;

/**
* ai心跳更新时间
*/
private Long heartbeatTime;

/**
* 定时任务的执行状态。1:未执行,2:已执行
*/
private Long executionStatus;

/**
* 起点经度
*/
private String startLongitude;

/**
* 起点纬度
*/
private String startLatitude;

/**
* 终点经度
*/
private String endLongitude;

/**
* 终点纬度
*/
private String endLatitude;

/**
* 联系方式
*/
private String mobile;

/**
* 巡逻地点
*/
private String patrolLocation;

/**
* 问题列表
*/
private List<InspectionFileReportVo> inspectionFileReportVoList;
}

+ 52
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/ReportPageListVo.java Ver arquivo

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

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

/**
* 返回报告视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-12-12
*/
@Data
public class ReportPageListVo {

/**
* 任务编号
*/
private String inspectionCode;

/**
* 任务名称
*/
private String inspectionName;

/**
* 巡检任务类型 1 临时巡检
*/
private Integer type;

/**
* 生成时间
*/
private Date createTime;

/**
* 巡检时间
*/
private Date inspectionTime;

/**
* 问题总数
*/
private Integer problemTotalCount;

/**
* 问题处理数
*/
private Integer problemHandleCount;
}

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/resources/application-dev.yml Ver arquivo

@@ -114,6 +114,14 @@ spring:
# 上传文件总的最大值
max-request-size: 100MB

file:
#上传的服务器上的映射文件夹
accessPath: /uploads/
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_hhz/uploads/

# 自定义配置
tuoheng:
oidc-url: http://192.168.11.11:7011

+ 10
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-local.yml Ver arquivo

@@ -119,11 +119,20 @@ spring:
# 上传文件总的最大值
max-request-size: 100MB

file:
#上传的服务器上的映射文件夹
accessPath: /uploads/
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: E:\拓恒项目2022\tuoheng_freeway\uploads\


# 自定义配置
tuoheng:
oidc-url: http://192.168.11.11:7011
# 图片域名
image-url: http://localhost:9055/api
image-url: https://image.t-aaron.com/
# OSS域名
oss-url: https://ta-tech-image.oss-cn-shanghai.aliyuncs.com
# 视频域名

+ 9
- 0
tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml Ver arquivo

@@ -114,6 +114,15 @@ spring:
# 上传文件总的最大值
max-request-size: 100MB

file:
#上传的服务器上的映射文件夹
accessPath: /uploads/
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_hhz/uploads/


# 自定义配置
tuoheng:
oidc-url: https://oidc-admin.t-aaron.com

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml Ver arquivo

@@ -115,6 +115,14 @@ spring:
# 上传文件总的最大值
max-request-size: 100MB

file:
#上传的服务器上的映射文件夹
accessPath: /uploads/
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_hhz/uploads/

# 自定义配置
tuoheng:
oidc-url: http://172.15.1.11:7011

+ 84
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/ReportMapper.xml Ver arquivo

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.admin.mapper.ReportMapper">
<resultMap type="com.tuoheng.admin.entity.Report" id="ReportResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="deptId" column="dept_id" />
<result property="reportCode" column="report_code" />
<result property="inspectionId" column="inspection_id" />
<result property="inspectionCode" column="inspection_code" />
<result property="inspectionName" column="inspection_name" />
<result property="type" column="type" />
<result property="roadId" column="road_id" />
<result property="roadName" column="road_name" />
<result property="sectionId" column="section_id" />
<result property="sectionName" column="section_name" />
<result property="inspectionType" column="inspection_type" />
<result property="airportId" column="airport_id" />
<result property="airportName" column="airport_name" />
<result property="inspectionLine" column="inspection_line" />
<result property="inspectionLineName" column="inspection_line_name" />
<result property="equipmentId" column="equipment_id" />
<result property="equipmentName" column="equipment_name" />
<result property="equipmentMountId" column="equipment_mount_id" />
<result property="equipmentMountName" column="equipment_mount_name" />
<result property="cloudBoxId" column="cloud_box_id" />
<result property="cloudBoxName" column="cloud_box_name" />
<result property="boxSn" column="box_sn" />
<result property="flightHand" column="flight_hand" />
<result property="flightHandName" column="flight_hand_name" />
<result property="inspectionTime" column="inspection_time" />
<result property="executionStartTime" column="execution_start_time" />
<result property="executionEndTime" column="execution_end_time" />
<result property="isLive" column="is_live" />
<result property="isTaken" column="is_taken" />
<result property="isTilt" column="is_tilt" />
<result property="videoUrl" column="video_url" />
<result property="aiVideoUrl" column="ai_video_url" />
<result property="reportUrl" column="report_url" />
<result property="srtUrl" column="srt_url" />
<result property="status" column="status" />
<result property="analyseStatus" column="analyse_status" />
<result property="progressbar" column="progressbar" />
<result property="note" column="note" />
<result property="weather" column="weather" />
<result property="flyHeight" column="fly_height" />
<result property="srtName" column="srt_name" />
<result property="heartbeatTime" column="heartbeat_time" />
<result property="executionStatus" column="execution_status" />
<result property="startLongitude" column="start_longitude" />
<result property="startLatitude" column="start_latitude" />
<result property="endLongitude" column="end_longitude" />
<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" />
<result property="updateTime" column="update_time" />
<result property="mark" column="mark" />
</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
</sql>
<select id="selectPageList" parameterType="com.tuoheng.admin.request.report.QueryReportPageListRequest" resultMap="ReportResult">
<include refid="selectReportVo"/>
<where>
<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.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.createUser != null and request.createUser != ''"> and type = #{request.type} </if>
</where>
order by create_time desc
</select>
</mapper>

+ 1
- 4
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java Ver arquivo

@@ -102,10 +102,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//分配人员是当前登录用户
workOrder.setDistributionId(user.getId());
//工单编号 XJGD+日期+随机
Date now = DateUtils.now();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String str = sdf.format(now);
String code = "XJGD"+str+(int)(Math.random()*10000);
String code = DateUtils.generateCode("XJGD");
workOrder.setCode(code);
workOrder.setStatus(WorkOrderStatusEnum.STATUS_ASSIGNED.getCode());
workOrder.setAssignDeptId(deptId);

Carregando…
Cancelar
Salvar