|
@@ -0,0 +1,107 @@
|
|
|
|
+package com.zglc.kg.controller;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
|
+import com.zglc.kg.base.Result;
|
|
|
|
+import com.zglc.kg.entity.FlightDataEntity;
|
|
|
|
+import com.zglc.kg.entity.DeleteEntity;
|
|
|
|
+import com.zglc.kg.service.FlightDataService;
|
|
|
|
+import com.zglc.kg.utils.FileTool;
|
|
|
|
+import com.zglc.kg.utils.FileTypeUtil;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+@Api(tags = "飞参数据管理接口")
|
|
|
|
+@RequestMapping("api/flightData")
|
|
|
|
+@CrossOrigin(allowCredentials = "true")
|
|
|
|
+@RestController
|
|
|
|
+public class FlightDataController {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private final FlightDataService flightDataService;
|
|
|
|
+ @Autowired(required = false)
|
|
|
|
+ public FlightDataController(FlightDataService flightDataService){
|
|
|
|
+ this.flightDataService = flightDataService;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("分页列出所有飞参数据信息")
|
|
|
|
+ @ApiResponses({
|
|
|
|
+ @ApiResponse(code = 0, message = "成功")
|
|
|
|
+ })
|
|
|
|
+ @GetMapping("listpage")
|
|
|
|
+ public Result<PageInfo<FlightDataEntity>> listpage(Integer page, Integer size) {
|
|
|
|
+ PageHelper.startPage(page, size, "id desc");
|
|
|
|
+ return Result.success(new PageInfo<>(flightDataService.listAll()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("列出所有飞参数据")
|
|
|
|
+ @ApiResponses({
|
|
|
|
+ @ApiResponse(code = 0, message = "成功")
|
|
|
|
+ })
|
|
|
|
+ @GetMapping("listAll")
|
|
|
|
+ public Result<List<FlightDataEntity>> listAll() {
|
|
|
|
+ return Result.success(flightDataService.listAll());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("按参数ID查找飞参数据")
|
|
|
|
+ @ApiResponses({
|
|
|
|
+ @ApiResponse(code = 0, message = "成功")
|
|
|
|
+ })
|
|
|
|
+ @GetMapping("get")
|
|
|
|
+ public Result<FlightDataEntity> get(@RequestParam Integer id){return Result.success(flightDataService.getAlgorithmParam(id));}
|
|
|
|
+
|
|
|
|
+// @ApiOperation("按算法名称数据源")
|
|
|
|
+// @GetMapping("getByName")
|
|
|
|
+// public Result<List<FlightDataEntity>> findByName(@RequestParam("name") String name){
|
|
|
|
+// return flightDataService.findByName(name);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("增添飞参数据")
|
|
|
|
+ @ApiResponses({
|
|
|
|
+ @ApiResponse(code = 0, message = "成功")
|
|
|
|
+ })
|
|
|
|
+ @PostMapping("add")
|
|
|
|
+ public Result<String> add(@RequestBody FlightDataEntity data){return flightDataService.add(data);}
|
|
|
|
+
|
|
|
|
+ @ApiOperation("删除飞参数据")
|
|
|
|
+ @ApiResponses({
|
|
|
|
+ @ApiResponse(code = 0, message = "成功")
|
|
|
|
+ })
|
|
|
|
+ @PostMapping("delete")
|
|
|
|
+ public Result<String> delete(@RequestBody DeleteEntity deleteEntity){return flightDataService.delete(deleteEntity.getIds());}
|
|
|
|
+
|
|
|
|
+ @ApiOperation("修改飞参数据")
|
|
|
|
+ @ApiResponses({
|
|
|
|
+ @ApiResponse(code = 0, message = "成功")
|
|
|
|
+ })
|
|
|
|
+ @PostMapping("edit")
|
|
|
|
+ public Result<String> edit( @RequestBody FlightDataEntity data){return flightDataService.edit(data);}
|
|
|
|
+
|
|
|
|
+ @ApiOperation("导入数据")
|
|
|
|
+ @ApiResponses({
|
|
|
|
+ @ApiResponse(code = 0, message = "成功")
|
|
|
|
+ })
|
|
|
|
+ @PostMapping("importData")
|
|
|
|
+ public Result<Object> importFile(HttpServletRequest request, @RequestParam("file") MultipartFile file){
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ String sourcePath1;
|
|
|
|
+ sourcePath1 = "d:\\sourcekg";
|
|
|
|
+ String extName = ""; // 扩展名格式:
|
|
|
|
+ extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
|
|
|
+ String filePath = FileTool.fileUp(file, sourcePath1, date.getTime() + extName);
|
|
|
|
+ filePath = filePath.replaceAll( "d:","");
|
|
|
|
+ return Result.success(filePath);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|