@@ -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); | |||
} | |||
} |
@@ -11,7 +11,7 @@ import lombok.Data; | |||
* @date 2022-12-05 | |||
*/ | |||
@Data | |||
public class ExportReportRequest extends BaseQuery { | |||
public class ExportReportRequest { | |||
/** | |||
* 任务ID |
@@ -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("添加大气数据报告导出记录失败"); |
@@ -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"); |
@@ -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); | |||
} | |||