44 lines
1.5 KiB
Java
44 lines
1.5 KiB
Java
|
|
package com.cmvr.web.controller;
|
||
|
|
|
||
|
|
import com.cmvr.common.core.controller.BaseController;
|
||
|
|
import com.cmvr.common.core.domain.AjaxResult;
|
||
|
|
import com.cmvr.edge.client.service.EdgeHlcService;
|
||
|
|
import io.swagger.annotations.Api;
|
||
|
|
import io.swagger.annotations.ApiOperation;
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
||
|
|
import org.springframework.web.bind.annotation.RequestPart;
|
||
|
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
import org.springframework.web.multipart.MultipartFile;
|
||
|
|
|
||
|
|
import java.io.File;
|
||
|
|
import java.io.IOException;
|
||
|
|
|
||
|
|
@Api(tags = "通用--测试")
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/common/test")
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
public class TestController extends BaseController {
|
||
|
|
|
||
|
|
private final EdgeHlcService edgeHlcService;
|
||
|
|
|
||
|
|
@ApiOperation("图片标注")
|
||
|
|
@PostMapping("/mark")
|
||
|
|
public AjaxResult mark(
|
||
|
|
@RequestPart("image") MultipartFile image,
|
||
|
|
@RequestParam("x") Integer x,
|
||
|
|
@RequestParam("y") Integer y
|
||
|
|
) {
|
||
|
|
try {
|
||
|
|
File tempFile = File.createTempFile("upload_", "_" + image.getOriginalFilename());
|
||
|
|
image.transferTo(tempFile);
|
||
|
|
edgeHlcService.markPoint(tempFile,x,y);
|
||
|
|
} catch (IOException e) {
|
||
|
|
throw new RuntimeException(e);
|
||
|
|
}
|
||
|
|
return AjaxResult.ok();
|
||
|
|
}
|
||
|
|
}
|