|
@ -0,0 +1,39 @@ |
|
|
|
|
|
package com.iflytop.nuclear.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.iflytop.nuclear.model.Camera; |
|
|
|
|
|
import com.iflytop.nuclear.service.CameraService; |
|
|
|
|
|
import com.iflytop.nuclear.utils.ResponseData; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @author cool |
|
|
|
|
|
* @date 2023/7/28 10:23 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Slf4j |
|
|
|
|
|
@RestController |
|
|
|
|
|
@CrossOrigin |
|
|
|
|
|
@RequestMapping("/camera") |
|
|
|
|
|
public class CameraController { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
CameraService cameraService; |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/add") |
|
|
|
|
|
public ResponseData addInfo(@RequestBody Map<String,String> cameraInfo) { |
|
|
|
|
|
String stationCoreId = cameraInfo.get("station_core_id"); |
|
|
|
|
|
String simulationBrightness = cameraInfo.get("simulation_brightness"); |
|
|
|
|
|
String exposure = cameraInfo.get("exposure"); |
|
|
|
|
|
boolean b = cameraService.addNewRecord(stationCoreId, simulationBrightness, exposure); |
|
|
|
|
|
return ResponseData.success(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/info/{id}") |
|
|
|
|
|
public ResponseData getInfo(@PathVariable(name="id") String coreId){ |
|
|
|
|
|
Camera camera = cameraService.getInfoByCoreId(coreId); |
|
|
|
|
|
return ResponseData.success(camera); |
|
|
|
|
|
} |
|
|
|
|
|
} |