parent
d85fb7522d
commit
acdec70da5
Binary file not shown.
|
Before Width: | Height: | Size: 205 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 139 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 214 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 215 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<modules>
|
||||
<module>yudao-module-annotation-biz</module>
|
||||
<module>yudao-module-annotation-api</module>
|
||||
</modules>
|
||||
<artifactId>yudao-module-annotation</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
注解模块
|
||||
|
||||
</description>
|
||||
</project>
|
||||
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.annotation.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration;
|
||||
import org.springdoc.core.models.GroupedOpenApi;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* infra 模块的 web 组件的 Configuration
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class AnnotationWebConfiguration {
|
||||
|
||||
/**
|
||||
* infra 模块的 API 分组
|
||||
*/
|
||||
@Bean
|
||||
public GroupedOpenApi AnnotationGroupedOpenApi() {
|
||||
return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("annotation");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.datas;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.datas.vo.DatasPageReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.datas.vo.DatasRespVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.datas.vo.DatasSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.datas.DatasDO;
|
||||
import cn.iocoder.yudao.module.annotation.service.datas.DatasService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 数据集管理")
|
||||
@RestController
|
||||
@RequestMapping("/annotation/datas")
|
||||
@Validated
|
||||
public class DatasController {
|
||||
|
||||
@Resource
|
||||
private DatasService datasService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建数据集管理")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:create')")
|
||||
public CommonResult<Integer> createDatas(@Valid @RequestBody DatasSaveReqVO createReqVO) {
|
||||
return success(datasService.createDatas(createReqVO));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新数据集管理")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:update')")
|
||||
public CommonResult<Boolean> updateDatas(@Valid @RequestBody DatasSaveReqVO updateReqVO) {
|
||||
datasService.updateDatas(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除数据集管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:delete')")
|
||||
public CommonResult<Boolean> deleteDatas(@RequestParam("id") Integer id) {
|
||||
datasService.deleteDatas(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得数据集管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:query')")
|
||||
public CommonResult<DatasRespVO> getDatas(@RequestParam("id") Integer id) {
|
||||
DatasDO datas = datasService.getDatas(id);
|
||||
return success(BeanUtils.toBean(datas, DatasRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "获得数据集管理列表")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:query')")
|
||||
public CommonResult<List<DatasDO>> list() {
|
||||
List<DatasDO> result = datasService.list();
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得数据集管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:query')")
|
||||
public CommonResult<PageResult<DatasRespVO>> getDatasPage(@Valid DatasPageReqVO pageReqVO) {
|
||||
PageResult<DatasDO> pageResult = datasService.getDatasPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DatasRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出数据集管理 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportDatasExcel(@Valid DatasPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DatasDO> list = datasService.getDatasPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "数据集管理.xls", "数据", DatasRespVO.class,
|
||||
BeanUtils.toBean(list, DatasRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.datas.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 数据集管理分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DatasPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "项目名称", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "描述", example = "你猜")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "类型,还未标注,正在标注,正在训练,训练完成", example = "1")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "图片总数", example = "4380")
|
||||
private Long count;
|
||||
|
||||
@Schema(description = "识别类型", example = "2")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "进度")
|
||||
private Integer progress;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.datas.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 数据集管理 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DatasRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4113")
|
||||
@ExcelProperty("id")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "项目名称", example = "芋艿")
|
||||
@ExcelProperty("项目名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "描述", example = "你猜")
|
||||
@ExcelProperty("描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "类型,还未标注,正在标注,正在训练,训练完成", example = "1")
|
||||
@ExcelProperty("类型,还未标注,正在标注,正在训练,训练完成")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "路径")
|
||||
@ExcelProperty("路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "图片总数", example = "4380")
|
||||
@ExcelProperty("图片总数")
|
||||
private Long count;
|
||||
|
||||
@Schema(description = "识别类型", example = "2")
|
||||
@ExcelProperty("识别类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "进度")
|
||||
@ExcelProperty("进度")
|
||||
private Integer progress;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.datas.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 数据集管理新增/修改 Request VO")
|
||||
@Data
|
||||
public class DatasSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4113")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "项目名称", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "描述", example = "你猜")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "类型,还未标注,正在标注,正在训练,训练完成", example = "1")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "图片总数", example = "4380")
|
||||
private Long count;
|
||||
|
||||
@Schema(description = "识别类型", example = "2")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "进度")
|
||||
private Integer progress;
|
||||
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.mark;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.MarkPageReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.MarkRespVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.MarkSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.mark.MarkDO;
|
||||
import cn.iocoder.yudao.module.annotation.service.mark.MarkService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 标注")
|
||||
@RestController
|
||||
@RequestMapping("/annotation/mark")
|
||||
@Validated
|
||||
public class MarkController {
|
||||
|
||||
@Resource
|
||||
private MarkService markService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建标注")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:mark:create')")
|
||||
public CommonResult<Integer> createMark(@Valid @RequestBody MarkSaveReqVO createReqVO) {
|
||||
return success(markService.createMark(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新类别")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:types:update')")
|
||||
public CommonResult<Boolean> updateStatus(@Valid @RequestBody MarkSaveReqVO updateReqVO) {
|
||||
markService.updateMark(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "获得图片列表")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:query')")
|
||||
public CommonResult<List<MarkDO>> list(@Valid @RequestBody MarkSaveReqVO createReqVO) {
|
||||
List<MarkDO> result = markService.list(new QueryWrapper<MarkDO>().eq("data_id",createReqVO.getDataId()));
|
||||
return success(result);
|
||||
}
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新标注")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:mark:update')")
|
||||
public CommonResult<Boolean> updateMark(@Valid @RequestBody MarkSaveReqVO updateReqVO) {
|
||||
markService.updateMark(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除标注")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('annotation:mark:delete')")
|
||||
public CommonResult<Boolean> deleteMark(@RequestParam("id") Integer id) {
|
||||
markService.deleteMark(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得标注")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:mark:query')")
|
||||
public CommonResult<MarkRespVO> getMark(@RequestParam("id") Integer id) {
|
||||
MarkDO mark = markService.getMark(id);
|
||||
return success(BeanUtils.toBean(mark, MarkRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得标注分页")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:mark:query')")
|
||||
public CommonResult<PageResult<MarkRespVO>> getMarkPage(@Valid MarkPageReqVO pageReqVO) {
|
||||
PageResult<MarkDO> pageResult = markService.getMarkPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, MarkRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出标注 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:mark:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportMarkExcel(@Valid MarkPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<MarkDO> list = markService.getMarkPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "标注.xls", "数据", MarkRespVO.class,
|
||||
BeanUtils.toBean(list, MarkRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.mark;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.mark.MarkInfoDO;
|
||||
import cn.iocoder.yudao.module.annotation.service.MarkInfo.MarkInfoService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 标注详情")
|
||||
@RestController
|
||||
@RequestMapping("/annotation/markInfo")
|
||||
@Validated
|
||||
public class MarkInfoController {
|
||||
|
||||
@Resource
|
||||
private MarkInfoService markService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建标注详情")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:mark:create')")
|
||||
public CommonResult<Integer> createMark(@Valid @RequestBody List<MarkInfoDO> createReqVO) {
|
||||
for (MarkInfoDO markInfoDO : createReqVO){
|
||||
markInfoDO.setAnnotationDataString(markInfoDO.getAnnotationData().toString());
|
||||
markService.saveOrUpdate(markInfoDO);
|
||||
}
|
||||
return success(1);
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "获得标注详情列表")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:query')")
|
||||
public CommonResult<List<MarkInfoDO>> list(@RequestParam("markId") Integer markId) {
|
||||
List<MarkInfoDO> result = markService.list(new QueryWrapper<MarkInfoDO>()
|
||||
.eq("mark_id",markId));
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除标注详情")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('annotation:mark:delete')")
|
||||
public CommonResult<Boolean> deleteMark(@RequestParam("id") Integer id) {
|
||||
markService.deleteMarkInfo(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.mark.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 标注分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MarkPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "项目id", example = "4064")
|
||||
private Integer dataId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.mark.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 标注新增/修改 Request VO")
|
||||
@Data
|
||||
public class MarkSaveReqVO {
|
||||
private Integer dataId;
|
||||
private Integer id;
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.train;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.train.vo.*;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.train.TrainDO;
|
||||
import cn.iocoder.yudao.module.annotation.service.train.TrainService;
|
||||
|
||||
@Tag(name = "管理后台 - 训练")
|
||||
@RestController
|
||||
@RequestMapping("/annotation/train")
|
||||
@Validated
|
||||
public class TrainController {
|
||||
|
||||
@Resource
|
||||
private TrainService trainService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建训练")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train:create')")
|
||||
public CommonResult<Integer> createTrain(@Valid @RequestBody TrainSaveReqVO createReqVO) {
|
||||
return success(trainService.createTrain(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新训练")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train:update')")
|
||||
public CommonResult<Boolean> updateTrain(@Valid @RequestBody TrainSaveReqVO updateReqVO) {
|
||||
trainService.updateTrain(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除训练")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train:delete')")
|
||||
public CommonResult<Boolean> deleteTrain(@RequestParam("id") Integer id) {
|
||||
trainService.deleteTrain(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得训练")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train:query')")
|
||||
public CommonResult<TrainRespVO> getTrain(@RequestParam("id") Integer id) {
|
||||
TrainDO train = trainService.getTrain(id);
|
||||
return success(BeanUtils.toBean(train, TrainRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得训练分页")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train:query')")
|
||||
public CommonResult<PageResult<TrainRespVO>> getTrainPage(@Valid TrainPageReqVO pageReqVO) {
|
||||
PageResult<TrainDO> pageResult = trainService.getTrainPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TrainRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出训练 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportTrainExcel(@Valid TrainPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<TrainDO> list = trainService.getTrainPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "训练.xls", "数据", TrainRespVO.class,
|
||||
BeanUtils.toBean(list, TrainRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.trainresult;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.trainresult.vo.*;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.trainresult.TrainResultDO;
|
||||
import cn.iocoder.yudao.module.annotation.service.trainresult.TrainResultService;
|
||||
|
||||
@Tag(name = "管理后台 - 识别结果")
|
||||
@RestController
|
||||
@RequestMapping("/annotation/train-result")
|
||||
@Validated
|
||||
public class TrainResultController {
|
||||
|
||||
@Resource
|
||||
private TrainResultService trainResultService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建识别结果")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train-result:create')")
|
||||
public CommonResult<Integer> createTrainResult(@Valid @RequestBody TrainResultSaveReqVO createReqVO) {
|
||||
return success(trainResultService.createTrainResult(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新识别结果")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train-result:update')")
|
||||
public CommonResult<Boolean> updateTrainResult(@Valid @RequestBody TrainResultSaveReqVO updateReqVO) {
|
||||
trainResultService.updateTrainResult(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除识别结果")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train-result:delete')")
|
||||
public CommonResult<Boolean> deleteTrainResult(@RequestParam("id") Integer id) {
|
||||
trainResultService.deleteTrainResult(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得识别结果")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train-result:query')")
|
||||
public CommonResult<TrainResultRespVO> getTrainResult(@RequestParam("id") Integer id) {
|
||||
TrainResultDO trainResult = trainResultService.getTrainResult(id);
|
||||
return success(BeanUtils.toBean(trainResult, TrainResultRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得识别结果分页")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train-result:query')")
|
||||
public CommonResult<PageResult<TrainResultRespVO>> getTrainResultPage(@Valid TrainResultPageReqVO pageReqVO) {
|
||||
PageResult<TrainResultDO> pageResult = trainResultService.getTrainResultPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TrainResultRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出识别结果 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:train-result:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportTrainResultExcel(@Valid TrainResultPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<TrainResultDO> list = trainResultService.getTrainResultPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "识别结果.xls", "数据", TrainResultRespVO.class,
|
||||
BeanUtils.toBean(list, TrainResultRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.trainresult.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 识别结果分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TrainResultPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "数据集", example = "196")
|
||||
private Integer dataId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.trainresult.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 识别结果 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TrainResultRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15312")
|
||||
@ExcelProperty("id")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "训练id", example = "27530")
|
||||
@ExcelProperty("训练id")
|
||||
private Integer trainId;
|
||||
|
||||
@Schema(description = "输出路径")
|
||||
@ExcelProperty("输出路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "识别结果rate")
|
||||
@ExcelProperty("识别结果rate")
|
||||
private String rate;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
@ExcelProperty("修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "数据集", example = "196")
|
||||
@ExcelProperty("数据集")
|
||||
private Integer dataId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.trainresult.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 识别结果新增/修改 Request VO")
|
||||
@Data
|
||||
public class TrainResultSaveReqVO {
|
||||
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.types;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.MarkSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.types.vo.TypesPageReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.types.vo.TypesRespVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.types.vo.TypesSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.types.TypesDO;
|
||||
import cn.iocoder.yudao.module.annotation.service.types.TypesService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 类别")
|
||||
@RestController
|
||||
@RequestMapping("/annotation/types")
|
||||
@Validated
|
||||
public class TypesController {
|
||||
|
||||
@Resource
|
||||
private TypesService typesService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建类别")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:types:create')")
|
||||
public CommonResult<Integer> createTypes(@Valid @RequestBody TypesSaveReqVO createReqVO) {
|
||||
return success(typesService.createTypes(createReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "获得类别列表")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:datas:query')")
|
||||
public CommonResult<List<TypesDO>> list(@Valid @RequestBody MarkSaveReqVO createReqVO) {
|
||||
List<TypesDO> result = typesService.list(new QueryWrapper<TypesDO>().eq("data_id",createReqVO.getDataId()));
|
||||
return success(result);
|
||||
}
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新类别")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:types:update')")
|
||||
public CommonResult<Boolean> updateTypes(@Valid @RequestBody TypesSaveReqVO updateReqVO) {
|
||||
typesService.updateTypes(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除类别")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('annotation:types:delete')")
|
||||
public CommonResult<Boolean> deleteTypes(@RequestParam("id") Integer id) {
|
||||
typesService.deleteTypes(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得类别")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:types:query')")
|
||||
public CommonResult<TypesRespVO> getTypes(@RequestParam("id") Integer id) {
|
||||
TypesDO types = typesService.getTypes(id);
|
||||
return success(BeanUtils.toBean(types, TypesRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得类别分页")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:types:query')")
|
||||
public CommonResult<PageResult<TypesRespVO>> getTypesPage(@Valid TypesPageReqVO pageReqVO) {
|
||||
PageResult<TypesDO> pageResult = typesService.getTypesPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TypesRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出类别 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('annotation:types:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportTypesExcel(@Valid TypesPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<TypesDO> list = typesService.getTypesPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "类别.xls", "数据", TypesRespVO.class,
|
||||
BeanUtils.toBean(list, TypesRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.types.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 类别分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TypesPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "项目id", example = "1481")
|
||||
private Integer dataId;
|
||||
|
||||
@Schema(description = "index")
|
||||
private Integer index;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
private String color;
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.types.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 类别 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TypesRespVO {
|
||||
|
||||
@Schema(description = "id", example = "9740")
|
||||
@ExcelProperty("id")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "名称", example = "李四")
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "项目id", example = "1481")
|
||||
@ExcelProperty("项目id")
|
||||
private Integer dataId;
|
||||
|
||||
@Schema(description = "index")
|
||||
@ExcelProperty("index")
|
||||
private Integer index;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
@ExcelProperty("颜色")
|
||||
private String color;
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.types.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 类别新增/修改 Request VO")
|
||||
@Data
|
||||
public class TypesSaveReqVO {
|
||||
|
||||
@Schema(description = "id", example = "9740")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "项目id", example = "1481")
|
||||
private Integer dataId;
|
||||
|
||||
@Schema(description = "index")
|
||||
private Integer index;
|
||||
@Schema(description = "index")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
private String color;
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.annotation.controller.admin.yolo;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.ExportResult;
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.PredictionResult;
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.ValidationResult;
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.YoloConfig;
|
||||
import cn.iocoder.yudao.module.annotation.service.yolo.AsyncYoloService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
// YoloController.java
|
||||
@RestController
|
||||
@RequestMapping("/api/yolo")
|
||||
public class YoloController {
|
||||
|
||||
private final AsyncYoloService yoloService;
|
||||
|
||||
public YoloController(AsyncYoloService yoloService) {
|
||||
this.yoloService = yoloService;
|
||||
}
|
||||
|
||||
@PostMapping("/train")
|
||||
public ResponseEntity<String> trainAsync(@RequestBody YoloConfig config) {
|
||||
yoloService.trainAsync(config)
|
||||
.thenAccept(result -> {
|
||||
if (result.isSuccess()) {
|
||||
System.out.println("Training completed successfully");
|
||||
} else {
|
||||
System.err.println("Training failed: " + result.getMessage());
|
||||
}
|
||||
});
|
||||
return ResponseEntity.ok("Training started asynchronously");
|
||||
}
|
||||
|
||||
@PostMapping("/validate")
|
||||
public CompletableFuture<ValidationResult> validateAsync(@RequestBody YoloConfig config) {
|
||||
return yoloService.validateAsync(config);
|
||||
}
|
||||
|
||||
@PostMapping("/predict")
|
||||
public CompletableFuture<PredictionResult> predictAsync(
|
||||
@RequestBody YoloConfig config,
|
||||
@RequestParam String imagePath) {
|
||||
return yoloService.predictAsync(config, imagePath);
|
||||
}
|
||||
|
||||
@PostMapping("/export")
|
||||
public CompletableFuture<ExportResult> exportAsync(
|
||||
@RequestBody YoloConfig config,
|
||||
@RequestParam String format) {
|
||||
return yoloService.exportAsync(config, format);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.dataobject.mark;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AnnotationItem {
|
||||
private Integer class_id;
|
||||
private Double center_x;
|
||||
private Double center_y;
|
||||
private Double width;
|
||||
private Double height;
|
||||
private String polygon_points;
|
||||
private String angle;
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.dataobject.mark;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.annotation.service.MarkInfo.AnnotationData;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 标注 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName(value = "annotation_mark_info",autoResultMap = true)
|
||||
@KeySequence("annotation_mark_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MarkInfoDO extends BaseDO {
|
||||
private Long id;
|
||||
private Integer classId;
|
||||
@TableField(exist = false)
|
||||
private Integer className;
|
||||
private Integer markId;
|
||||
private Double centerX;
|
||||
private Double centerY;
|
||||
private Double width;
|
||||
private Double height;
|
||||
private Integer polygon_points;
|
||||
private Double anagle;
|
||||
private Integer dataId;
|
||||
|
||||
@TableField(value = "annotation_data_string")
|
||||
private String annotationDataString;
|
||||
|
||||
@TableField(exist = false)
|
||||
private AnnotationData annotationData;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.dataobject.trainresult;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 识别结果 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("annotation_train_result")
|
||||
@KeySequence("annotation_train_result_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TrainResultDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 训练id
|
||||
*/
|
||||
private Integer trainId;
|
||||
/**
|
||||
* 输出路径
|
||||
*/
|
||||
private String path;
|
||||
/**
|
||||
* 识别结果rate
|
||||
*/
|
||||
private String rate;
|
||||
/**
|
||||
* 数据集
|
||||
*/
|
||||
private Integer dataId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.dataobject.types;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 类别 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("annotation_types")
|
||||
@KeySequence("annotation_types_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TypesDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField(value = "`name`")
|
||||
private String name;
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Integer dataId;
|
||||
/**
|
||||
* index
|
||||
*/
|
||||
@TableField(value = "`index`")
|
||||
private Integer index;
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
private String color;
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.mysql.datas;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.datas.DatasDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.datas.vo.*;
|
||||
|
||||
/**
|
||||
* 数据集管理 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface DatasMapper extends BaseMapperX<DatasDO> {
|
||||
|
||||
default PageResult<DatasDO> selectPage(DatasPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DatasDO>()
|
||||
.likeIfPresent(DatasDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DatasDO::getDescription, reqVO.getDescription())
|
||||
.eqIfPresent(DatasDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(DatasDO::getPath, reqVO.getPath())
|
||||
.eqIfPresent(DatasDO::getCount, reqVO.getCount())
|
||||
.eqIfPresent(DatasDO::getType, reqVO.getType())
|
||||
.eqIfPresent(DatasDO::getProgress, reqVO.getProgress())
|
||||
.betweenIfPresent(DatasDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DatasDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.mysql.mark;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.mark.MarkInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 标注 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface MarkInfoMapper extends BaseMapperX<MarkInfoDO> {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.mysql.mark;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.mark.MarkDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.*;
|
||||
|
||||
/**
|
||||
* 标注 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface MarkMapper extends BaseMapperX<MarkDO> {
|
||||
|
||||
default PageResult<MarkDO> selectPage(MarkPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MarkDO>()
|
||||
.eqIfPresent(MarkDO::getDataId, reqVO.getDataId())
|
||||
.orderByDesc(MarkDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.mysql.train;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.train.TrainDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.train.vo.*;
|
||||
|
||||
/**
|
||||
* 训练 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface TrainMapper extends BaseMapperX<TrainDO> {
|
||||
|
||||
default PageResult<TrainDO> selectPage(TrainPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TrainDO>()
|
||||
.eqIfPresent(TrainDO::getDataId, reqVO.getDataId())
|
||||
.eqIfPresent(TrainDO::getTrain, reqVO.getTrain())
|
||||
.eqIfPresent(TrainDO::getVal, reqVO.getVal())
|
||||
.eqIfPresent(TrainDO::getTest, reqVO.getTest())
|
||||
.eqIfPresent(TrainDO::getRound, reqVO.getRound())
|
||||
.eqIfPresent(TrainDO::getSize, reqVO.getSize())
|
||||
.eqIfPresent(TrainDO::getImageSize, reqVO.getImageSize())
|
||||
.eqIfPresent(TrainDO::getModelPath, reqVO.getModelPath())
|
||||
.eqIfPresent(TrainDO::getPath, reqVO.getPath())
|
||||
.eqIfPresent(TrainDO::getTrainType, reqVO.getTrainType())
|
||||
.betweenIfPresent(TrainDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(TrainDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.mysql.trainresult;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.trainresult.TrainResultDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.trainresult.vo.*;
|
||||
|
||||
/**
|
||||
* 识别结果 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface TrainResultMapper extends BaseMapperX<TrainResultDO> {
|
||||
|
||||
default PageResult<TrainResultDO> selectPage(TrainResultPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TrainResultDO>()
|
||||
.eqIfPresent(TrainResultDO::getDataId, reqVO.getDataId())
|
||||
.orderByDesc(TrainResultDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.mysql.types;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.types.TypesDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.types.vo.*;
|
||||
|
||||
/**
|
||||
* 类别 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface TypesMapper extends BaseMapperX<TypesDO> {
|
||||
|
||||
default PageResult<TypesDO> selectPage(TypesPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TypesDO>()
|
||||
.likeIfPresent(TypesDO::getName, reqVO.getName())
|
||||
.eqIfPresent(TypesDO::getDataId, reqVO.getDataId())
|
||||
.eqIfPresent(TypesDO::getIndex, reqVO.getIndex())
|
||||
.betweenIfPresent(TypesDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(TypesDO::getColor, reqVO.getColor())
|
||||
.orderByDesc(TypesDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.yolo;
|
||||
// ExportResult.java
|
||||
public class ExportResult {
|
||||
private boolean success;
|
||||
private String output;
|
||||
private String format;
|
||||
|
||||
public ExportResult(boolean success, String output, String format) {
|
||||
this.success = success;
|
||||
this.output = output;
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public boolean isSuccess() { return success; }
|
||||
public String getOutput() { return output; }
|
||||
public String getFormat() { return format; }
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.yolo;
|
||||
// PredictionResult.java
|
||||
public class PredictionResult {
|
||||
private boolean success;
|
||||
private String output;
|
||||
private String imagePath;
|
||||
|
||||
public PredictionResult(boolean success, String output, String imagePath) {
|
||||
this.success = success;
|
||||
this.output = output;
|
||||
this.imagePath = imagePath;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public boolean isSuccess() { return success; }
|
||||
public String getOutput() { return output; }
|
||||
public String getImagePath() { return imagePath; }
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.yolo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
// TrainingResult.java
|
||||
@Data
|
||||
public class TrainingResult {
|
||||
private boolean success;
|
||||
private String message;
|
||||
private String output;
|
||||
|
||||
public TrainingResult(boolean success, String message, String output) {
|
||||
this.success = success;
|
||||
this.message = message;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public boolean isSuccess() { return success; }
|
||||
public String getMessage() { return message; }
|
||||
public String getOutput() { return output; }
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.yolo;
|
||||
// ValidationResult.java
|
||||
public class ValidationResult {
|
||||
private boolean success;
|
||||
private String output;
|
||||
|
||||
public ValidationResult(boolean success, String output) {
|
||||
this.success = success;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public boolean isSuccess() { return success; }
|
||||
public String getOutput() { return output; }
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.yolo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
// YoloConfig.java
|
||||
@Data
|
||||
public class YoloConfig {
|
||||
private String modelPath;
|
||||
private String datasetPath;
|
||||
private String outputPath;
|
||||
private int epochs = 100;
|
||||
private int batchSize = 16;
|
||||
private double learningRate = 0.01;
|
||||
private String device = "cpu"; // or "cuda"
|
||||
private boolean pretrained = true;
|
||||
}
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.annotation.dal.yolo;// YoloProgress.java
|
||||
|
||||
|
||||
public class YoloProgress {
|
||||
private int currentEpoch;
|
||||
private int totalEpochs;
|
||||
private double progress; // 0-100
|
||||
private int processedItems;
|
||||
private int totalItems;
|
||||
private String statusMessage;
|
||||
private boolean completed;
|
||||
private boolean success;
|
||||
|
||||
public YoloProgress() {
|
||||
this.currentEpoch = 0;
|
||||
this.totalEpochs = 0;
|
||||
this.progress = 0.0;
|
||||
this.processedItems = 0;
|
||||
this.totalItems = 0;
|
||||
this.statusMessage = "Initializing...";
|
||||
this.completed = false;
|
||||
this.success = false;
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
public int getCurrentEpoch() { return currentEpoch; }
|
||||
public void setCurrentEpoch(int currentEpoch) { this.currentEpoch = currentEpoch; }
|
||||
|
||||
public int getTotalEpochs() { return totalEpochs; }
|
||||
public void setTotalEpochs(int totalEpochs) { this.totalEpochs = totalEpochs; }
|
||||
|
||||
public double getProgress() { return progress; }
|
||||
public void setProgress(double progress) { this.progress = progress; }
|
||||
|
||||
public int getProcessedItems() { return processedItems; }
|
||||
public void setProcessedItems(int processedItems) { this.processedItems = processedItems; }
|
||||
|
||||
public int getTotalItems() { return totalItems; }
|
||||
public void setTotalItems(int totalItems) { this.totalItems = totalItems; }
|
||||
|
||||
public String getStatusMessage() { return statusMessage; }
|
||||
public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; }
|
||||
|
||||
public boolean isCompleted() { return completed; }
|
||||
public void setCompleted(boolean completed) { this.completed = completed; }
|
||||
|
||||
public boolean isSuccess() { return success; }
|
||||
public void setSuccess(boolean success) { this.success = success; }
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
// AnnotationData.java
|
||||
package cn.iocoder.yudao.module.annotation.service.MarkInfo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true) // 忽略未知属性
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AnnotationData {
|
||||
private String id;
|
||||
private List<String> bodies;
|
||||
private Target target;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Target {
|
||||
private String annotation;
|
||||
private Selector selector;
|
||||
private Creator creator;
|
||||
private String created;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Selector {
|
||||
private String type;
|
||||
private Geometry geometry;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Geometry {
|
||||
private Bounds bounds;
|
||||
private Double x;
|
||||
private Double y;
|
||||
private Double w;
|
||||
private Double h;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Bounds {
|
||||
private Double minX;
|
||||
private Double minY;
|
||||
private Double maxX;
|
||||
private Double maxY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Creator {
|
||||
private Boolean isGuest;
|
||||
private String id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.MarkInfo;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.mark.MarkInfoDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标注 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface MarkInfoService extends IService<MarkInfoDO> {
|
||||
|
||||
/**
|
||||
* 创建标注
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createMarkInfo(@Valid MarkInfoDO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新标注
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMarkInfo(@Valid MarkInfoDO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除标注
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMarkInfo(Integer id);
|
||||
|
||||
/**
|
||||
* 获得标注
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 标注
|
||||
*/
|
||||
MarkInfoDO getMarkInfo(Integer id);
|
||||
|
||||
/**
|
||||
* 获得标注分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 标注分页
|
||||
*/
|
||||
List<MarkInfoDO> getMarkList(MarkInfoDO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.MarkInfo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.mark.MarkInfoDO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.mysql.mark.MarkInfoMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
//import static cn.iocoder.yudao.module.annotation.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 标注 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MarkInfoServiceImpl extends ServiceImpl<MarkInfoMapper, MarkInfoDO> implements MarkInfoService {
|
||||
|
||||
@Resource
|
||||
private MarkInfoMapper MarkInfoMapper;
|
||||
|
||||
@Override
|
||||
public Long createMarkInfo(MarkInfoDO markInfoDO) {
|
||||
// 插入
|
||||
|
||||
|
||||
// MarkInfoDO MarkInfo = BeanUtils.toBean(createReqVO, MarkInfoDO.class);
|
||||
MarkInfoMapper.insert(markInfoDO);
|
||||
// 返回
|
||||
return markInfoDO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMarkInfo(MarkInfoDO updateReqVO) {
|
||||
// 校验存在
|
||||
// validateMarkInfoExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MarkInfoDO updateObj = BeanUtils.toBean(updateReqVO, MarkInfoDO.class);
|
||||
MarkInfoMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMarkInfo(Integer id) {
|
||||
// 校验存在
|
||||
validateMarkInfoExists(id);
|
||||
// 删除
|
||||
MarkInfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateMarkInfoExists(Integer id) {
|
||||
if (MarkInfoMapper.selectById(id) == null) {
|
||||
// throw exception(MarkInfo_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MarkInfoDO getMarkInfo(Integer id) {
|
||||
return MarkInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MarkInfoDO> getMarkList(MarkInfoDO pageReqVO) {
|
||||
|
||||
return MarkInfoMapper.selectList(new QueryWrapper<MarkInfoDO>()
|
||||
.eq(pageReqVO.getMarkId() != null,"mark_id", pageReqVO.getMarkId()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.datas;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.datas.vo.DatasPageReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.datas.vo.DatasSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.datas.DatasDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 数据集管理 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface DatasService extends IService<DatasDO> {
|
||||
|
||||
/**
|
||||
* 创建数据集管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createDatas(@Valid DatasSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新数据集管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDatas(@Valid DatasSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除数据集管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDatas(Integer id);
|
||||
|
||||
/**
|
||||
* 获得数据集管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 数据集管理
|
||||
*/
|
||||
DatasDO getDatas(Integer id);
|
||||
|
||||
/**
|
||||
* 获得数据集管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 数据集管理分页
|
||||
*/
|
||||
PageResult<DatasDO> getDatasPage(DatasPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.mark;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.MarkPageReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.MarkSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.mark.MarkDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 标注 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface MarkService extends IService<MarkDO> {
|
||||
|
||||
/**
|
||||
* 创建标注
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createMark(@Valid MarkSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新标注
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMark(@Valid MarkSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除标注
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMark(Integer id);
|
||||
|
||||
/**
|
||||
* 获得标注
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 标注
|
||||
*/
|
||||
MarkDO getMark(Integer id);
|
||||
|
||||
/**
|
||||
* 获得标注分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 标注分页
|
||||
*/
|
||||
PageResult<MarkDO> getMarkPage(MarkPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.mark;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.MarkPageReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.mark.vo.MarkSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.mark.MarkDO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.mysql.mark.MarkMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
//import static cn.iocoder.yudao.module.annotation.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 标注 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MarkServiceImpl extends ServiceImpl<MarkMapper, MarkDO> implements MarkService {
|
||||
|
||||
@Resource
|
||||
private MarkMapper markMapper;
|
||||
|
||||
@Override
|
||||
public Integer createMark(MarkSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
MarkDO mark = BeanUtils.toBean(createReqVO, MarkDO.class);
|
||||
markMapper.insert(mark);
|
||||
// 返回
|
||||
return mark.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMark(MarkSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
// validateMarkExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MarkDO updateObj = BeanUtils.toBean(updateReqVO, MarkDO.class);
|
||||
markMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMark(Integer id) {
|
||||
// 校验存在
|
||||
validateMarkExists(id);
|
||||
// 删除
|
||||
markMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateMarkExists(Integer id) {
|
||||
if (markMapper.selectById(id) == null) {
|
||||
// throw exception(MARK_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MarkDO getMark(Integer id) {
|
||||
return markMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MarkDO> getMarkPage(MarkPageReqVO pageReqVO) {
|
||||
return markMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.train;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.train.vo.*;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.train.TrainDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 训练 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface TrainService {
|
||||
|
||||
/**
|
||||
* 创建训练
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createTrain(@Valid TrainSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新训练
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateTrain(@Valid TrainSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除训练
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteTrain(Integer id);
|
||||
|
||||
/**
|
||||
* 获得训练
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 训练
|
||||
*/
|
||||
TrainDO getTrain(Integer id);
|
||||
|
||||
/**
|
||||
* 获得训练分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 训练分页
|
||||
*/
|
||||
PageResult<TrainDO> getTrainPage(TrainPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.train;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.train.vo.*;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.train.TrainDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.mysql.train.TrainMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
//import static cn.iocoder.yudao.module.annotation.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 训练 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TrainServiceImpl implements TrainService {
|
||||
|
||||
@Resource
|
||||
private TrainMapper trainMapper;
|
||||
|
||||
@Override
|
||||
public Integer createTrain(TrainSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
TrainDO train = BeanUtils.toBean(createReqVO, TrainDO.class);
|
||||
trainMapper.insert(train);
|
||||
// 返回
|
||||
return train.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTrain(TrainSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTrainExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TrainDO updateObj = BeanUtils.toBean(updateReqVO, TrainDO.class);
|
||||
trainMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTrain(Integer id) {
|
||||
// 校验存在
|
||||
validateTrainExists(id);
|
||||
// 删除
|
||||
trainMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateTrainExists(Integer id) {
|
||||
if (trainMapper.selectById(id) == null) {
|
||||
// throw exception(TRAIN_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainDO getTrain(Integer id) {
|
||||
return trainMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TrainDO> getTrainPage(TrainPageReqVO pageReqVO) {
|
||||
return trainMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.trainresult;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.trainresult.vo.*;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.trainresult.TrainResultDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 识别结果 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface TrainResultService {
|
||||
|
||||
/**
|
||||
* 创建识别结果
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createTrainResult(@Valid TrainResultSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新识别结果
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateTrainResult(@Valid TrainResultSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除识别结果
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteTrainResult(Integer id);
|
||||
|
||||
/**
|
||||
* 获得识别结果
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 识别结果
|
||||
*/
|
||||
TrainResultDO getTrainResult(Integer id);
|
||||
|
||||
/**
|
||||
* 获得识别结果分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 识别结果分页
|
||||
*/
|
||||
PageResult<TrainResultDO> getTrainResultPage(TrainResultPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.trainresult;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.trainresult.vo.*;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.trainresult.TrainResultDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.mysql.trainresult.TrainResultMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
//import static cn.iocoder.yudao.module.annotation.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 识别结果 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TrainResultServiceImpl implements TrainResultService {
|
||||
|
||||
@Resource
|
||||
private TrainResultMapper trainResultMapper;
|
||||
|
||||
@Override
|
||||
public Integer createTrainResult(TrainResultSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
TrainResultDO trainResult = BeanUtils.toBean(createReqVO, TrainResultDO.class);
|
||||
trainResultMapper.insert(trainResult);
|
||||
// 返回
|
||||
return trainResult.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTrainResult(TrainResultSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
// validateTrainResultExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TrainResultDO updateObj = BeanUtils.toBean(updateReqVO, TrainResultDO.class);
|
||||
trainResultMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTrainResult(Integer id) {
|
||||
// 校验存在
|
||||
validateTrainResultExists(id);
|
||||
// 删除
|
||||
trainResultMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateTrainResultExists(Integer id) {
|
||||
if (trainResultMapper.selectById(id) == null) {
|
||||
// throw exception(TRAIN_RESULT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainResultDO getTrainResult(Integer id) {
|
||||
return trainResultMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TrainResultDO> getTrainResultPage(TrainResultPageReqVO pageReqVO) {
|
||||
return trainResultMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.types;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.types.vo.TypesPageReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.types.vo.TypesSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.types.TypesDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 类别 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface TypesService extends IService<TypesDO> {
|
||||
|
||||
/**
|
||||
* 创建类别
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createTypes(@Valid TypesSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新类别
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateTypes(@Valid TypesSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除类别
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteTypes(Integer id);
|
||||
|
||||
/**
|
||||
* 获得类别
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 类别
|
||||
*/
|
||||
TypesDO getTypes(Integer id);
|
||||
|
||||
/**
|
||||
* 获得类别分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 类别分页
|
||||
*/
|
||||
PageResult<TypesDO> getTypesPage(TypesPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.types;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.types.vo.TypesPageReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.controller.admin.types.vo.TypesSaveReqVO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.dataobject.types.TypesDO;
|
||||
import cn.iocoder.yudao.module.annotation.dal.mysql.types.TypesMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
//import static cn.iocoder.yudao.module.annotation.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 类别 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TypesServiceImpl extends ServiceImpl<TypesMapper, TypesDO> implements TypesService {
|
||||
|
||||
@Resource
|
||||
private TypesMapper typesMapper;
|
||||
|
||||
@Override
|
||||
public Integer createTypes(TypesSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
// 在这里不添加index 在生成的时候添加
|
||||
TypesDO types = BeanUtils.toBean(createReqVO, TypesDO.class);
|
||||
typesMapper.insert(types);
|
||||
// 返回
|
||||
return types.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTypes(TypesSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTypesExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TypesDO updateObj = BeanUtils.toBean(updateReqVO, TypesDO.class);
|
||||
typesMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTypes(Integer id) {
|
||||
// 校验存在
|
||||
validateTypesExists(id);
|
||||
// 删除
|
||||
typesMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateTypesExists(Integer id) {
|
||||
if (typesMapper.selectById(id) == null) {
|
||||
// throw exception(TYPES_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypesDO getTypes(Integer id) {
|
||||
return typesMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TypesDO> getTypesPage(TypesPageReqVO pageReqVO) {
|
||||
return typesMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.yolo;
|
||||
// AsyncYoloService.java
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.*;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public interface AsyncYoloService extends YoloService {
|
||||
CompletableFuture<TrainingResult> trainAsync(YoloConfig config);
|
||||
CompletableFuture<ValidationResult> validateAsync(YoloConfig config);
|
||||
CompletableFuture<PredictionResult> predictAsync(YoloConfig config, String imagePath);
|
||||
CompletableFuture<ExportResult> exportAsync(YoloConfig config, String format);
|
||||
}
|
||||
@ -0,0 +1,205 @@
|
||||
// AsyncYoloServiceImpl.java
|
||||
package cn.iocoder.yudao.module.annotation.service.yolo;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.*;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Service
|
||||
public class AsyncYoloServiceImpl implements AsyncYoloService {
|
||||
|
||||
@Override
|
||||
@Async("yoloTaskExecutor")
|
||||
public CompletableFuture<TrainingResult> trainAsync(YoloConfig config) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
ProcessBuilder pb = buildTrainCommand(config);
|
||||
Process process = pb.start();
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream())
|
||||
);
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append("\n");
|
||||
System.out.println(line); // 可用于日志记录
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
if (exitCode == 0) {
|
||||
return new TrainingResult(true, "Training completed successfully", output.toString());
|
||||
} else {
|
||||
return new TrainingResult(false, "Training failed with exit code: " + exitCode, output.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return new TrainingResult(false, "Training error: " + e.getMessage(), "");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("yoloTaskExecutor")
|
||||
public CompletableFuture<ValidationResult> validateAsync(YoloConfig config) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
ProcessBuilder pb = buildValidateCommand(config);
|
||||
Process process = pb.start();
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream())
|
||||
);
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append("\n");
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
return new ValidationResult(exitCode == 0, output.toString());
|
||||
} catch (Exception e) {
|
||||
return new ValidationResult(false, "Validation error: " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("yoloTaskExecutor")
|
||||
public CompletableFuture<PredictionResult> predictAsync(YoloConfig config, String imagePath) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
ProcessBuilder pb = buildPredictCommand(config, imagePath);
|
||||
Process process = pb.start();
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream())
|
||||
);
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append("\n");
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
return new PredictionResult(exitCode == 0, output.toString(), imagePath);
|
||||
} catch (Exception e) {
|
||||
return new PredictionResult(false, "Prediction error: " + e.getMessage(), imagePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("yoloTaskExecutor")
|
||||
public CompletableFuture<ExportResult> exportAsync(YoloConfig config, String format) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
ProcessBuilder pb = buildExportCommand(config, format);
|
||||
Process process = pb.start();
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream())
|
||||
);
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append("\n");
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
return new ExportResult(exitCode == 0, output.toString(), format);
|
||||
} catch (Exception e) {
|
||||
return new ExportResult(false, "Export error: " + e.getMessage(), format);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 同步方法实现(可选)
|
||||
@Override
|
||||
public TrainingResult train(YoloConfig config) {
|
||||
return trainAsync(config).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(YoloConfig config) {
|
||||
return validateAsync(config).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PredictionResult predict(YoloConfig config, String imagePath) {
|
||||
return predictAsync(config, imagePath).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExportResult export(YoloConfig config, String format) {
|
||||
return exportAsync(config, format).join();
|
||||
}
|
||||
|
||||
private ProcessBuilder buildTrainCommand(YoloConfig config) {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(
|
||||
"python", "-m", "ultralytics", "train",
|
||||
"--model", config.getModelPath(),
|
||||
"--data", config.getDatasetPath(),
|
||||
"--epochs", String.valueOf(config.getEpochs()),
|
||||
"--batch", String.valueOf(config.getBatchSize()),
|
||||
"--lr", String.valueOf(config.getLearningRate()),
|
||||
"--device", config.getDevice(),
|
||||
"--project", config.getOutputPath()
|
||||
);
|
||||
|
||||
if (config.isPretrained()) {
|
||||
pb.command().add("--pretrained");
|
||||
pb.command().add("True");
|
||||
}
|
||||
|
||||
pb.redirectErrorStream(true);
|
||||
return pb;
|
||||
}
|
||||
|
||||
private ProcessBuilder buildValidateCommand(YoloConfig config) {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(
|
||||
"python", "-m", "ultralytics", "val",
|
||||
"--model", config.getModelPath(),
|
||||
"--data", config.getDatasetPath(),
|
||||
"--device", config.getDevice()
|
||||
);
|
||||
|
||||
pb.redirectErrorStream(true);
|
||||
return pb;
|
||||
}
|
||||
|
||||
private ProcessBuilder buildPredictCommand(YoloConfig config, String imagePath) {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(
|
||||
"python", "-m", "ultralytics", "predict",
|
||||
"--model", config.getModelPath(),
|
||||
"--source", imagePath,
|
||||
"--device", config.getDevice(),
|
||||
"--project", config.getOutputPath()
|
||||
);
|
||||
|
||||
pb.redirectErrorStream(true);
|
||||
return pb;
|
||||
}
|
||||
|
||||
private ProcessBuilder buildExportCommand(YoloConfig config, String format) {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(
|
||||
"python", "-m", "ultralytics", "export",
|
||||
"--model", config.getModelPath(),
|
||||
"--format", format
|
||||
);
|
||||
|
||||
pb.redirectErrorStream(true);
|
||||
return pb;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.yolo;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.YoloProgress;
|
||||
|
||||
public interface YoloProgressListener {
|
||||
void onProgressUpdate(YoloProgress progress);
|
||||
void onComplete(YoloProgress finalProgress);
|
||||
void onError(Exception e);
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
// YoloProgressParser.java
|
||||
package cn.iocoder.yudao.module.annotation.service.yolo;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.YoloProgress;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class YoloProgressParser {
|
||||
|
||||
// 匹配训练进度的正则表达式
|
||||
private static final Pattern EPOCH_PATTERN = Pattern.compile("Epoch\\s+(\\d+)/(\\d+)");
|
||||
private static final Pattern PROGRESS_PATTERN = Pattern.compile("(\\d+)/(\\d+)\\s+\\[.*?([0-9.]+)%.*?\\]");
|
||||
private static final Pattern LOSS_PATTERN = Pattern.compile("loss:\\s*([0-9.]+)");
|
||||
|
||||
public static YoloProgress parseLine(String line, YoloProgress currentProgress) {
|
||||
if (currentProgress == null) {
|
||||
currentProgress = new YoloProgress();
|
||||
}
|
||||
|
||||
// 解析Epoch信息
|
||||
Matcher epochMatcher = EPOCH_PATTERN.matcher(line);
|
||||
if (epochMatcher.find()) {
|
||||
currentProgress.setCurrentEpoch(Integer.parseInt(epochMatcher.group(1)));
|
||||
currentProgress.setTotalEpochs(Integer.parseInt(epochMatcher.group(2)));
|
||||
currentProgress.setStatusMessage("Training epoch " +
|
||||
currentProgress.getCurrentEpoch() + "/" + currentProgress.getTotalEpochs());
|
||||
}
|
||||
|
||||
// 解析进度条信息
|
||||
Matcher progressMatcher = PROGRESS_PATTERN.matcher(line);
|
||||
if (progressMatcher.find()) {
|
||||
currentProgress.setProcessedItems(Integer.parseInt(progressMatcher.group(1)));
|
||||
currentProgress.setTotalItems(Integer.parseInt(progressMatcher.group(2)));
|
||||
currentProgress.setProgress(Double.parseDouble(progressMatcher.group(3)));
|
||||
}
|
||||
|
||||
// 解析Loss信息
|
||||
Matcher lossMatcher = LOSS_PATTERN.matcher(line);
|
||||
if (lossMatcher.find()) {
|
||||
currentProgress.setStatusMessage(currentProgress.getStatusMessage() +
|
||||
" | Loss: " + lossMatcher.group(1));
|
||||
}
|
||||
|
||||
return currentProgress;
|
||||
}
|
||||
|
||||
public static boolean isCompletionIndicator(String line) {
|
||||
return line.contains("Training completed") ||
|
||||
line.contains("completed successfully") ||
|
||||
line.contains("finished");
|
||||
}
|
||||
|
||||
public static boolean isErrorIndicator(String line) {
|
||||
return line.contains("error") ||
|
||||
line.contains("failed") ||
|
||||
line.contains("exception") ||
|
||||
line.contains("Error");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.yolo;
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.*;
|
||||
|
||||
// YoloService.java
|
||||
public interface YoloService {
|
||||
/**
|
||||
* 训练模型
|
||||
*/
|
||||
TrainingResult train(YoloConfig config);
|
||||
|
||||
/**
|
||||
* 验证模型
|
||||
*/
|
||||
ValidationResult validate(YoloConfig config);
|
||||
|
||||
/**
|
||||
* 进行预测
|
||||
*/
|
||||
PredictionResult predict(YoloConfig config, String imagePath);
|
||||
|
||||
/**
|
||||
* 导出模型
|
||||
*/
|
||||
ExportResult export(YoloConfig config, String format);
|
||||
}
|
||||
@ -0,0 +1,172 @@
|
||||
package cn.iocoder.yudao.module.annotation.service.yolo;
|
||||
// YoloServiceImpl.java
|
||||
|
||||
import cn.iocoder.yudao.module.annotation.dal.yolo.*;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class YoloServiceImpl implements YoloService {
|
||||
|
||||
@Override
|
||||
public TrainingResult train(YoloConfig config) {
|
||||
try {
|
||||
// 构建训练命令
|
||||
ProcessBuilder pb = buildTrainCommand(config);
|
||||
Process process = pb.start();
|
||||
|
||||
// 读取输出
|
||||
StringBuilder output = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream())
|
||||
);
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append("\n");
|
||||
// 可以在这里解析训练进度
|
||||
System.out.println(line);
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
if (exitCode == 0) {
|
||||
return new TrainingResult(true, "Training completed successfully", output.toString());
|
||||
} else {
|
||||
return new TrainingResult(false, "Training failed with exit code: " + exitCode, output.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return new TrainingResult(false, "Training error: " + e.getMessage(), "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(YoloConfig config) {
|
||||
try {
|
||||
ProcessBuilder pb = buildValidateCommand(config);
|
||||
Process process = pb.start();
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream())
|
||||
);
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append("\n");
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
return new ValidationResult(exitCode == 0, output.toString());
|
||||
} catch (Exception e) {
|
||||
return new ValidationResult(false, "Validation error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PredictionResult predict(YoloConfig config, String imagePath) {
|
||||
try {
|
||||
ProcessBuilder pb = buildPredictCommand(config, imagePath);
|
||||
Process process = pb.start();
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream())
|
||||
);
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append("\n");
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
return new PredictionResult(exitCode == 0, output.toString(), imagePath);
|
||||
} catch (Exception e) {
|
||||
return new PredictionResult(false, "Prediction error: " + e.getMessage(), imagePath);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExportResult export(YoloConfig config, String format) {
|
||||
try {
|
||||
ProcessBuilder pb = buildExportCommand(config, format);
|
||||
Process process = pb.start();
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream())
|
||||
);
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
output.append(line).append("\n");
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
return new ExportResult(exitCode == 0, output.toString(), format);
|
||||
} catch (Exception e) {
|
||||
return new ExportResult(false, "Export error: " + e.getMessage(), format);
|
||||
}
|
||||
}
|
||||
|
||||
private ProcessBuilder buildTrainCommand(YoloConfig config) {
|
||||
// 假设使用Python脚本调用YOLO
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(
|
||||
"python", "-m", "ultralytics", "train",
|
||||
"--model", config.getModelPath(),
|
||||
"--data", config.getDatasetPath(),
|
||||
"--epochs", String.valueOf(config.getEpochs()),
|
||||
"--batch", String.valueOf(config.getBatchSize()),
|
||||
"--lr", String.valueOf(config.getLearningRate()),
|
||||
"--device", config.getDevice(),
|
||||
"--project", config.getOutputPath()
|
||||
);
|
||||
|
||||
if (config.isPretrained()) {
|
||||
pb.command().add("--pretrained");
|
||||
pb.command().add("True");
|
||||
}
|
||||
|
||||
pb.redirectErrorStream(true);
|
||||
return pb;
|
||||
}
|
||||
|
||||
private ProcessBuilder buildValidateCommand(YoloConfig config) {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(
|
||||
"python", "-m", "ultralytics", "val",
|
||||
"--model", config.getModelPath(),
|
||||
"--data", config.getDatasetPath(),
|
||||
"--device", config.getDevice()
|
||||
);
|
||||
|
||||
pb.redirectErrorStream(true);
|
||||
return pb;
|
||||
}
|
||||
|
||||
private ProcessBuilder buildPredictCommand(YoloConfig config, String imagePath) {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(
|
||||
"python", "-m", "ultralytics", "predict",
|
||||
"--model", config.getModelPath(),
|
||||
"--source", imagePath,
|
||||
"--device", config.getDevice(),
|
||||
"--project", config.getOutputPath()
|
||||
);
|
||||
|
||||
pb.redirectErrorStream(true);
|
||||
return pb;
|
||||
}
|
||||
|
||||
private ProcessBuilder buildExportCommand(YoloConfig config, String format) {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(
|
||||
"python", "-m", "ultralytics", "export",
|
||||
"--model", config.getModelPath(),
|
||||
"--format", format
|
||||
);
|
||||
|
||||
pb.redirectErrorStream(true);
|
||||
return pb;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package cn.iocoder.yudao.module.camera.controller.admin.specificationConf;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.camera.controller.admin.specificationConf.vo.SpecificationConfPageReqVO;
|
||||
import cn.iocoder.yudao.module.camera.controller.admin.specificationConf.vo.SpecificationConfRespVO;
|
||||
import cn.iocoder.yudao.module.camera.controller.admin.specificationConf.vo.SpecificationConfSaveReqVO;
|
||||
import cn.iocoder.yudao.module.camera.dal.dataobject.specificationConf.SpecificationConfDO;
|
||||
import cn.iocoder.yudao.module.camera.service.specificationConf.SpecificationConfService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 品规配置")
|
||||
@RestController
|
||||
@RequestMapping("/logistics/specification-conf")
|
||||
@Validated
|
||||
public class SpecificationConfController {
|
||||
|
||||
@Resource
|
||||
private SpecificationConfService specificationConfService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建品规配置")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:specification-conf:create')")
|
||||
public CommonResult<Integer> createSpecificationConf(@Valid @RequestBody SpecificationConfSaveReqVO createReqVO) {
|
||||
return success(specificationConfService.createSpecificationConf(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新品规配置")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:specification-conf:update')")
|
||||
public CommonResult<Boolean> updateSpecificationConf(@Valid @RequestBody SpecificationConfSaveReqVO updateReqVO) {
|
||||
specificationConfService.updateSpecificationConf(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除品规配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('logistics:specification-conf:delete')")
|
||||
public CommonResult<Boolean> deleteSpecificationConf(@RequestParam("id") Integer id) {
|
||||
specificationConfService.deleteSpecificationConf(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得品规配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:specification-conf:query')")
|
||||
public CommonResult<SpecificationConfRespVO> getSpecificationConf(@RequestParam("id") Integer id) {
|
||||
SpecificationConfDO specificationConf = specificationConfService.getSpecificationConf(id);
|
||||
return success(BeanUtils.toBean(specificationConf, SpecificationConfRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得品规配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:specification-conf:query')")
|
||||
public CommonResult<PageResult<SpecificationConfRespVO>> getSpecificationConfPage(@Valid SpecificationConfPageReqVO pageReqVO) {
|
||||
PageResult<SpecificationConfDO> pageResult = specificationConfService.getSpecificationConfPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, SpecificationConfRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出品规配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:specification-conf:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportSpecificationConfExcel(@Valid SpecificationConfPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<SpecificationConfDO> list = specificationConfService.getSpecificationConfPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "品规配置.xls", "数据", SpecificationConfRespVO.class,
|
||||
BeanUtils.toBean(list, SpecificationConfRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.camera.controller.admin.specificationConf.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 品规配置分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SpecificationConfPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "宽度单位mm")
|
||||
private Integer width;
|
||||
|
||||
@Schema(description = "长度单位mm")
|
||||
private Integer length;
|
||||
|
||||
@Schema(description = "整堆高度单位mm")
|
||||
private Integer height;
|
||||
|
||||
@Schema(description = "最小面积")
|
||||
private Integer minArea;
|
||||
|
||||
@Schema(description = "截取高度")
|
||||
private Integer tolerance;
|
||||
|
||||
@Schema(description = "名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "高度单位mm")
|
||||
private Integer high;
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.camera.controller.admin.specificationConf.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 品规配置 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SpecificationConfRespVO {
|
||||
|
||||
@Schema(description = "id")
|
||||
@ExcelProperty("id")
|
||||
private Integer id;
|
||||
@Schema(description = "宽度单位mm")
|
||||
@ExcelProperty("宽度单位mm")
|
||||
private Integer width;
|
||||
|
||||
@Schema(description = "长度单位mm")
|
||||
@ExcelProperty("长度单位mm")
|
||||
private Integer length;
|
||||
|
||||
@Schema(description = "整堆高度单位mm")
|
||||
@ExcelProperty("整堆高度单位mm")
|
||||
private Integer height;
|
||||
|
||||
@Schema(description = "最小面积")
|
||||
@ExcelProperty("最小面积")
|
||||
private Integer minArea;
|
||||
|
||||
@Schema(description = "截取高度")
|
||||
@ExcelProperty("截取高度")
|
||||
private Integer tolerance;
|
||||
|
||||
@Schema(description = "名称", example = "张三")
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类型", example = "1")
|
||||
@ExcelProperty("类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "高度单位mm")
|
||||
@ExcelProperty("高度单位mm")
|
||||
private Integer high;
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.camera.controller.admin.specificationConf.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 品规配置新增/修改 Request VO")
|
||||
@Data
|
||||
public class SpecificationConfSaveReqVO {
|
||||
|
||||
@Schema(description = "宽度单位mm")
|
||||
private Integer width;
|
||||
|
||||
@Schema(description = "长度单位mm")
|
||||
private Integer length;
|
||||
|
||||
@Schema(description = "整堆高度单位mm")
|
||||
private Integer height;
|
||||
|
||||
@Schema(description = "最小面积")
|
||||
private Integer minArea;
|
||||
|
||||
@Schema(description = "截取高度")
|
||||
private Integer tolerance;
|
||||
|
||||
@Schema(description = "名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "高度单位mm")
|
||||
private Integer high;
|
||||
@Schema(description = "高度单位mm")
|
||||
private Integer id;
|
||||
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package cn.iocoder.yudao.module.camera.controller.admin.warn;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.camera.controller.admin.warn.vo.WarnPageReqVO;
|
||||
import cn.iocoder.yudao.module.camera.controller.admin.warn.vo.WarnRespVO;
|
||||
import cn.iocoder.yudao.module.camera.controller.admin.warn.vo.WarnSaveReqVO;
|
||||
import cn.iocoder.yudao.module.camera.dal.dataobject.warn.WarnDO;
|
||||
import cn.iocoder.yudao.module.camera.service.warn.WarnService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 报警信息")
|
||||
@RestController
|
||||
@RequestMapping("/logistics/warn")
|
||||
@Validated
|
||||
public class WarnController {
|
||||
|
||||
@Resource
|
||||
private WarnService warnService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建报警信息")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:warn:create')")
|
||||
public CommonResult<Long> createWarn(@Valid @RequestBody WarnSaveReqVO createReqVO) {
|
||||
return success(warnService.createWarn(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新报警信息")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:warn:update')")
|
||||
public CommonResult<Boolean> updateWarn(@Valid @RequestBody WarnSaveReqVO updateReqVO) {
|
||||
warnService.updateWarn(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除报警信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('logistics:warn:delete')")
|
||||
public CommonResult<Boolean> deleteWarn(@RequestParam("id") Long id) {
|
||||
warnService.deleteWarn(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得报警信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:warn:query')")
|
||||
public CommonResult<WarnRespVO> getWarn(@RequestParam("id") Long id) {
|
||||
WarnDO warn = warnService.getWarn(id);
|
||||
return success(BeanUtils.toBean(warn, WarnRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得报警信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:warn:query')")
|
||||
public CommonResult<PageResult<WarnRespVO>> getWarnPage(@Valid WarnPageReqVO pageReqVO) {
|
||||
PageResult<WarnDO> pageResult = warnService.getWarnPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, WarnRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出报警信息 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('logistics:warn:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportWarnExcel(@Valid WarnPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<WarnDO> list = warnService.getWarnPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "报警信息.xls", "数据", WarnRespVO.class,
|
||||
BeanUtils.toBean(list, WarnRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.camera.controller.admin.warn.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 报警信息分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class WarnPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "巷道标识", example = "19536")
|
||||
private Integer streetId;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] startTime;
|
||||
|
||||
@Schema(description = "位置")
|
||||
private String location;
|
||||
|
||||
@Schema(description = "报警信号")
|
||||
private String signal;
|
||||
|
||||
@Schema(description = "左右")
|
||||
private Integer direction;
|
||||
|
||||
@Schema(description = "内外")
|
||||
private Integer side;
|
||||
|
||||
@Schema(description = "层")
|
||||
private Integer row;
|
||||
|
||||
@Schema(description = "列")
|
||||
private Integer column;
|
||||
|
||||
@Schema(description = "uuid", example = "8373")
|
||||
private String uuid;
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.camera.controller.admin.warn.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 报警信息 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WarnRespVO {
|
||||
|
||||
@Schema(description = "巷道标识", example = "19536")
|
||||
@ExcelProperty("巷道标识")
|
||||
private Integer streetId;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@ExcelProperty("开始时间")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@Schema(description = "位置")
|
||||
@ExcelProperty("位置")
|
||||
private String location;
|
||||
|
||||
@Schema(description = "报警信号")
|
||||
@ExcelProperty("报警信号")
|
||||
private String signal;
|
||||
|
||||
@Schema(description = "左右")
|
||||
@ExcelProperty("左右")
|
||||
private Integer direction;
|
||||
|
||||
@Schema(description = "内外")
|
||||
@ExcelProperty("内外")
|
||||
private Integer side;
|
||||
|
||||
@Schema(description = "层")
|
||||
@ExcelProperty("层")
|
||||
private Integer row;
|
||||
|
||||
@Schema(description = "列")
|
||||
@ExcelProperty("列")
|
||||
private Integer column;
|
||||
|
||||
@Schema(description = "uuid", example = "8373")
|
||||
@ExcelProperty("uuid")
|
||||
private String uuid;
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.camera.controller.admin.warn.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 报警信息新增/修改 Request VO")
|
||||
@Data
|
||||
public class WarnSaveReqVO {
|
||||
|
||||
@Schema(description = "uuid", example = "8373")
|
||||
private String uuid;
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.camera.dal.dataobject.specificationConf;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 品规配置 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("logistics_specification_conf")
|
||||
@KeySequence("logistics_specification_conf_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SpecificationConfDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 宽度单位mm
|
||||
*/
|
||||
private Integer width;
|
||||
/**
|
||||
* 长度单位mm
|
||||
*/
|
||||
private Integer length;
|
||||
/**
|
||||
* 整堆高度单位mm
|
||||
*/
|
||||
private Integer height;
|
||||
/**
|
||||
* 最小面积
|
||||
*/
|
||||
private Integer minArea;
|
||||
/**
|
||||
* 截取高度
|
||||
*/
|
||||
private Integer tolerance;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 高度单位mm
|
||||
*/
|
||||
private Integer high;
|
||||
private Integer id;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue