2026-01-23 18:42:11 +08:00
|
|
|
|
package com.ruoyi.airline.controller;
|
|
|
|
|
|
|
2026-03-06 10:48:49 +08:00
|
|
|
|
import com.ruoyi.airline.api.domain.AirlineFileGroupInfoVO;
|
2026-01-23 18:42:11 +08:00
|
|
|
|
import com.ruoyi.airline.api.domain.AirlineFileVO;
|
|
|
|
|
|
import com.ruoyi.airline.controller.convert.AirlineFileControllerConvert;
|
|
|
|
|
|
import com.ruoyi.airline.service.api.IAirlineFileService;
|
|
|
|
|
|
import com.ruoyi.airline.service.dto.AirlineFileDTO;
|
|
|
|
|
|
import com.ruoyi.common.core.exception.base.BaseException;
|
|
|
|
|
|
import com.ruoyi.common.core.web.controller.BaseController;
|
|
|
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
2026-01-24 11:29:55 +08:00
|
|
|
|
import com.ruoyi.common.log.annotation.Log;
|
|
|
|
|
|
import com.ruoyi.common.log.enums.BusinessType;
|
2026-01-24 16:17:41 +08:00
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
2026-01-24 11:29:55 +08:00
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
2026-01-23 18:42:11 +08:00
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 航线文件Controller
|
|
|
|
|
|
*
|
2026-02-11 13:36:37 +08:00
|
|
|
|
* @author 拓恒
|
2026-01-23 18:42:11 +08:00
|
|
|
|
* @date 2026-01-17
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RestController
|
2026-01-26 16:37:58 +08:00
|
|
|
|
@RequestMapping("/file")
|
2026-01-24 11:29:55 +08:00
|
|
|
|
@Tag(name = "航线管理")
|
2026-01-23 18:42:11 +08:00
|
|
|
|
public class AirlineFileController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(AirlineFileController.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private IAirlineFileService airlineFileService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 编辑航线文件信息
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param entity 实体对象
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2026-01-24 16:17:41 +08:00
|
|
|
|
// @RequiresPermissions("airline:file:edit")
|
2026-02-26 17:33:13 +08:00
|
|
|
|
// @Log(title = "修改航线属性", businessType = BusinessType.UPDATE)
|
2026-01-23 18:42:11 +08:00
|
|
|
|
@PutMapping("/edit")
|
2026-01-28 09:11:59 +08:00
|
|
|
|
@Operation(summary = "编辑航线文件描述信息")
|
2026-03-06 10:48:49 +08:00
|
|
|
|
public AjaxResult edit(@RequestBody AirlineFileGroupInfoVO entity) {
|
2026-03-06 11:07:43 +08:00
|
|
|
|
log.info("编辑航线文件信息请求: {}", entity);
|
2026-03-06 10:48:49 +08:00
|
|
|
|
AirlineFileDTO dto = AirlineFileControllerConvert.to(entity.getAirlineFileVO());
|
2026-03-06 11:07:43 +08:00
|
|
|
|
log.info("转换后的DTO: {}", dto);
|
|
|
|
|
|
Long result = airlineFileService.update(dto);
|
|
|
|
|
|
log.info("更新结果: {}", result);
|
|
|
|
|
|
return success(result);
|
2026-01-23 18:42:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-26 17:33:13 +08:00
|
|
|
|
* 创建航线
|
2026-01-23 18:42:11 +08:00
|
|
|
|
* <p>
|
|
|
|
|
|
* kmz类似zip,一般情况下内部包含kml和wpml两个文件
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param vo
|
|
|
|
|
|
*/
|
2026-01-24 16:17:41 +08:00
|
|
|
|
// @RequiresPermissions("airline:file:parseAndUpload")
|
2026-02-26 17:33:13 +08:00
|
|
|
|
// @Log(title = "创建航线", businessType = BusinessType.UPDATE)
|
2026-01-24 16:17:41 +08:00
|
|
|
|
@PostMapping("/createOrUpdate")
|
2026-01-28 09:11:59 +08:00
|
|
|
|
@Operation(summary = "编辑航线文件内容,生产航点新文件")
|
2026-01-24 11:29:55 +08:00
|
|
|
|
public AjaxResult createOrUpdate(@RequestBody AirlineFileVO vo) {
|
2026-01-28 20:15:05 +08:00
|
|
|
|
AirlineFileDTO airlineFile = AirlineFileControllerConvert.to(vo);
|
2026-01-23 18:42:11 +08:00
|
|
|
|
try {
|
|
|
|
|
|
return success(airlineFileService.createOrupdate(airlineFile));
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
throw new BaseException("更新航线失败", e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-13 13:44:41 +08:00
|
|
|
|
@GetMapping("/{id}")
|
|
|
|
|
|
@Operation(summary = "根据ID查询航线文件详情")
|
|
|
|
|
|
public AjaxResult getById(@PathVariable Long id) {
|
|
|
|
|
|
AirlineFileDTO dto = airlineFileService.selectById(id);
|
|
|
|
|
|
if (dto == null) {
|
|
|
|
|
|
return error("航线文件不存在");
|
|
|
|
|
|
}
|
|
|
|
|
|
AirlineFileVO vo = AirlineFileControllerConvert.from(dto);
|
|
|
|
|
|
return success(vo);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-23 18:42:11 +08:00
|
|
|
|
}
|