浏览代码

修改导出报告代码

tags/V1.0.1^2
wanjing 1年前
父节点
当前提交
0241d48132
共有 5 个文件被更改,包括 19 次插入12 次删除
  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 查看文件

@@ -6,10 +6,8 @@ import com.tuoheng.admin.service.airData.IAirDataService;
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.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;

/**
@@ -59,10 +57,10 @@ public class AirDataController {
/**
* 导出报告
*/
@GetMapping("/export")
public void exportReport(ExportReportRequest request) {
@PostMapping("/export")
public JsonResult exportReport(@RequestBody ExportReportRequest request) {
// 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 查看文件

@@ -11,7 +11,7 @@ import lombok.Data;
* @date 2022-12-05
*/
@Data
public class ExportReportRequest extends BaseQuery {
public class ExportReportRequest {

/**
* 任务ID

+ 6
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/ExportReportService.java 查看文件

@@ -13,8 +13,10 @@ import com.tuoheng.admin.mapper.AirDataMapper;
import com.tuoheng.admin.mapper.AirDataTypeMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.utils.AliyunOSSUtil;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.config.UploadFileConfig;
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.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
@@ -58,7 +60,7 @@ public class ExportReportService {

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

Inspection inspection = (Inspection) result.getData();
@@ -113,7 +115,7 @@ public class ExportReportService {
// 删除原文件
FileUtils.deleteFile(filePath);

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

/**
@@ -182,7 +184,8 @@ public class ExportReportService {
airDataExport.setAirDataTypeId(airDataType.getId());
airDataExport.setGridSize(request.getGridSize());
airDataExport.setOssUrl(ossUrl);

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

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/drone/hover/DroneHoverService.java 查看文件

@@ -39,7 +39,7 @@ public class DroneHoverService {
}
Inspection inspection = (Inspection) jsonResult.getData();
Integer airportId = inspection.getAirportId();
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_DRONE_CONTROL;
JSONObject jsonObject = new JSONObject();
jsonObject.put("zhilin", "01");

+ 6
- 0
tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/ExportReportServiceTest.java 查看文件

@@ -1,9 +1,11 @@
package com.tuoheng.admin.service;

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

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

// exportReportService.exportReport(request);
}


正在加载...
取消
保存