Browse Source

修改导出报告代码

tags/V1.0.1^2
wanjing 1 year ago
parent
commit
0241d48132
5 changed files with 19 additions and 12 deletions
  1. +5
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirDataController.java
  2. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/report/ExportReportRequest.java
  3. +6
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/ExportReportService.java
  4. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/drone/hover/DroneHoverService.java
  5. +6
    -0
      tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/ExportReportServiceTest.java

+ 5
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirDataController.java View File

import com.tuoheng.common.core.utils.JsonResult; import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

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


/** /**
/** /**
* 导出报告 * 导出报告
*/ */
@GetMapping("/export")
public void exportReport(ExportReportRequest request) {
@PostMapping("/export")
public JsonResult exportReport(@RequestBody ExportReportRequest request) {
// log.info("进入导出报告接口"); // log.info("进入导出报告接口");
airDataService.exportReport(request);
return airDataService.exportReport(request);
} }


} }

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/report/ExportReportRequest.java View File

* @date 2022-12-05 * @date 2022-12-05
*/ */
@Data @Data
public class ExportReportRequest extends BaseQuery {
public class ExportReportRequest {


/** /**
* 任务ID * 任务ID

+ 6
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/ExportReportService.java View File

import com.tuoheng.admin.mapper.AirDataTypeMapper; import com.tuoheng.admin.mapper.AirDataTypeMapper;
import com.tuoheng.admin.mapper.InspectionMapper; import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.utils.AliyunOSSUtil; import com.tuoheng.admin.utils.AliyunOSSUtil;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.config.UploadFileConfig; import com.tuoheng.common.core.config.UploadFileConfig;
import com.tuoheng.common.core.exception.ServiceException; import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.FileUtils; import com.tuoheng.common.core.utils.FileUtils;
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;


AirDataExport airDataExport = this.checkAirDataExport(request); AirDataExport airDataExport = this.checkAirDataExport(request);
if (ObjectUtil.isNotEmpty(airDataExport)) { if (ObjectUtil.isNotEmpty(airDataExport)) {
return JsonResult.success(airDataExport);
return JsonResult.success( airDataExport.getOssUrl(), "导出成功");
} }


Inspection inspection = (Inspection) result.getData(); Inspection inspection = (Inspection) result.getData();
// 删除原文件 // 删除原文件
FileUtils.deleteFile(filePath); FileUtils.deleteFile(filePath);


return JsonResult.success();
return JsonResult.success(ossUrl, "导出成功");
} }


/** /**
airDataExport.setAirDataTypeId(airDataType.getId()); airDataExport.setAirDataTypeId(airDataType.getId());
airDataExport.setGridSize(request.getGridSize()); airDataExport.setGridSize(request.getGridSize());
airDataExport.setOssUrl(ossUrl); airDataExport.setOssUrl(ossUrl);

airDataExport.setCreateUser(CurrentUserUtil.getUserId());
airDataExport.setCreateTime(DateUtils.now());
Integer count = airDataExportMapper.insert(airDataExport); Integer count = airDataExportMapper.insert(airDataExport);
if (count <= 0) { if (count <= 0) {
log.info("添加大气数据报告导出记录失败"); log.info("添加大气数据报告导出记录失败");

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/drone/hover/DroneHoverService.java View File

} }
Inspection inspection = (Inspection) jsonResult.getData(); Inspection inspection = (Inspection) jsonResult.getData();
Integer airportId = inspection.getAirportId(); Integer airportId = inspection.getAirportId();
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_DRONE_CONTROL; String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_DRONE_CONTROL;
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("zhilin", "01"); jsonObject.put("zhilin", "01");

+ 6
- 0
tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/ExportReportServiceTest.java View File

package com.tuoheng.admin.service; package com.tuoheng.admin.service;


import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.entity.request.report.ExportReportRequest; import com.tuoheng.admin.entity.request.report.ExportReportRequest;
import com.tuoheng.admin.entity.request.third.DspCallbackRequest; import com.tuoheng.admin.entity.request.third.DspCallbackRequest;
import com.tuoheng.admin.service.airData.report.ExportReportService; import com.tuoheng.admin.service.airData.report.ExportReportService;
import com.tuoheng.admin.service.third.dsp.IDspCallbackService; import com.tuoheng.admin.service.third.dsp.IDspCallbackService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
request.setSinglePointConcentrationMax("25000ug/m3(1187718318252N)2022/04/29 14:06:40"); // 单点浓度最高值 request.setSinglePointConcentrationMax("25000ug/m3(1187718318252N)2022/04/29 14:06:40"); // 单点浓度最高值
request.setSinglePointConcentrationMix("16000ug/m3(1187753318286 N)2022/04/2914:02:21"); // 单点浓度最低值 request.setSinglePointConcentrationMix("16000ug/m3(1187753318286 N)2022/04/2914:02:21"); // 单点浓度最低值
request.setGridSize(1); request.setGridSize(1);

JSONObject json = (JSONObject) JSONObject.toJSON(request);
log.info("-----> json={}", json);

// exportReportService.exportReport(request); // exportReportService.exportReport(request);
} }



Loading…
Cancel
Save