添加 ai模块
This commit is contained in:
16
pom.xml
16
pom.xml
@@ -47,6 +47,22 @@
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>*.yaml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
||||
@@ -65,11 +65,30 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!-- 监控相关 -->
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-sdk-file</artifactId>
|
||||
<artifactId>tashow-framework-monitor</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- 打包 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -2,16 +2,14 @@ package com.tashow.cloud.ai;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 应用服务启动类
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class TranslateServerApplication {
|
||||
public class AiServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(TranslateServerApplication.class, args);
|
||||
SpringApplication.run(AiServerApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ 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.annotation.security.PermitAll;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -30,14 +30,16 @@ public class AiSampleController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建样本库-上传文件")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sample:create')")
|
||||
public CommonResult<List<String>> createAiSample(FileUploadReqVO uploadReqVO) {
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sample:create')")
|
||||
public CommonResult<List<AiSampleFileRespVO>> createAiSample(FileUploadReqVO uploadReqVO) {
|
||||
return success(aiSampleService.createAiSample(uploadReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/updates")
|
||||
@Operation(summary = "更新样本库")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sample:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sample:update')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateAiSample(@Valid @RequestBody List<AiSampleSaveReqVO> updateReqVO) {
|
||||
aiSampleService.updateAiSamples(updateReqVO);
|
||||
return success(true);
|
||||
@@ -45,7 +47,8 @@ public class AiSampleController {
|
||||
|
||||
@PutMapping("/relate")
|
||||
@Operation(summary = "添加关联标签")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sample:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sample:update')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> relate(@Valid @RequestBody AiSampleRelateTagVO relateTagVO) {
|
||||
aiSampleService.relate(relateTagVO);
|
||||
return success(true);
|
||||
@@ -53,7 +56,8 @@ public class AiSampleController {
|
||||
|
||||
@DeleteMapping("/deleteRelate")
|
||||
@Operation(summary = "删除关联标签")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sample:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sample:delete')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> deleteRelate(@Valid @RequestBody AiSampleRelateTagVO relateTagVO) {
|
||||
aiSampleService.deleteRelate(relateTagVO);
|
||||
return success(true);
|
||||
@@ -62,7 +66,8 @@ public class AiSampleController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除样本库")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ai:sample:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sample:delete')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> deleteAiSample(@RequestParam("id") Long id) {
|
||||
aiSampleService.deleteAiSample(id);
|
||||
return success(true);
|
||||
@@ -70,7 +75,8 @@ public class AiSampleController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得样本库分页")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sample:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sample:query')")
|
||||
@PermitAll
|
||||
public CommonResult<PageResult<AiSampleRespVO>> getAiSamplePage(@Valid AiSamplePageReqVO pageReqVO) {
|
||||
PageResult<AiSampleDO> pageResult = aiSampleService.getAiSamplePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AiSampleRespVO.class));
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.tashow.cloud.ai.controller.admin.aisample;
|
||||
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagListRespVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagPageReqVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagRespVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagSaveReqVO;
|
||||
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagDO;
|
||||
import com.tashow.cloud.ai.service.aisample.AiSampleTagService;
|
||||
@@ -13,8 +12,8 @@ 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.annotation.security.PermitAll;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -34,14 +33,16 @@ public class AiSampleTagController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建样本标签库")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTag:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:create')")
|
||||
@PermitAll
|
||||
public CommonResult<Long> createAiSampleTag(@Valid @RequestBody AiSampleTagSaveReqVO createReqVO) {
|
||||
return success(aiSampleTagService.createAiSampleTag(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新样本标签库")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTag:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:update')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateAiSampleTag(@Valid @RequestBody AiSampleTagSaveReqVO updateReqVO) {
|
||||
aiSampleTagService.updateAiSampleTag(updateReqVO);
|
||||
return success(true);
|
||||
@@ -50,7 +51,8 @@ public class AiSampleTagController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除样本标签库")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTag:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:delete')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> deleteAiSampleTag(@RequestParam("id") Long id) {
|
||||
aiSampleTagService.deleteAiSampleTag(id);
|
||||
return success(true);
|
||||
@@ -58,17 +60,19 @@ public class AiSampleTagController {
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得样本标签库列表")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTag:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:query')")
|
||||
@PermitAll
|
||||
public CommonResult<List<AiSampleTagListRespVO>> getAiSampleTagList() {
|
||||
return success(BeanUtils.toBean(aiSampleTagService.getAiSampleTagList(), AiSampleTagListRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得样本标签库分页")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTag:query')")
|
||||
public CommonResult<PageResult<AiSampleTagRespVO>> getAiSampleTagPage(@Valid AiSampleTagPageReqVO pageReqVO) {
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTag:query')")
|
||||
@PermitAll
|
||||
public CommonResult<PageResult<AiSampleTagDO>> getAiSampleTagPage(@Valid AiSampleTagPageReqVO pageReqVO) {
|
||||
PageResult<AiSampleTagDO> pageResult = aiSampleTagService.getAiSampleTagPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AiSampleTagRespVO.class));
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,8 +10,8 @@ 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.annotation.security.PermitAll;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -31,14 +31,16 @@ public class AiSampleTagGroupController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建样本标签分组库")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:create')")
|
||||
@PermitAll
|
||||
public CommonResult<Long> createAiSampleTagGroup(@Valid @RequestBody AiSampleTagGroupSaveReqVO createReqVO) {
|
||||
return success(aiSampleTagGroupService.createAiSampleTagGroup(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新样本标签分组库")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:update')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateAiSampleTagGroup(@Valid @RequestBody AiSampleTagGroupSaveReqVO updateReqVO) {
|
||||
aiSampleTagGroupService.updateAiSampleTagGroup(updateReqVO);
|
||||
return success(true);
|
||||
@@ -47,7 +49,8 @@ public class AiSampleTagGroupController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除样本标签分组库")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:delete')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> deleteAiSampleTagGroup(@RequestParam("id") Long id) {
|
||||
aiSampleTagGroupService.deleteAiSampleTagGroup(id);
|
||||
return success(true);
|
||||
@@ -55,7 +58,8 @@ public class AiSampleTagGroupController {
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得样本标签分组库列表")
|
||||
@PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('ai:sampleTagGroup:query')")
|
||||
@PermitAll
|
||||
public CommonResult<List<AiSampleTagGroupRespVO>> getAiSampleTagGroupPage() {
|
||||
List<AiSampleTagGroupDO> aiSampleTagGroupList = aiSampleTagGroupService.getAiSampleTagGroupList();
|
||||
return success(BeanUtils.toBean(aiSampleTagGroupList, AiSampleTagGroupRespVO.class));
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 样本库 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AiSampleFileRespVO {
|
||||
|
||||
@Schema(description = "文件地址")
|
||||
private String fileUrl;
|
||||
|
||||
@Schema(description = "文件名称")
|
||||
private String fileName;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
public class AiSampleRelateTagVO {
|
||||
|
||||
@Schema(description = "标签id")
|
||||
private Long tagId;
|
||||
private List<Long> tagId;
|
||||
|
||||
@Schema(description = "样本ids")
|
||||
private List<Long> sampleIds;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.tashow.cloud.ai.controller.admin.aisample.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -38,8 +39,10 @@ public class AiSampleRespVO {
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
@Schema(description = "修改时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -1,17 +1,38 @@
|
||||
package com.tashow.cloud.ai.controller.app.translate;
|
||||
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 翻译
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ai/sample")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class TranslateController {
|
||||
|
||||
List<String> message = List.of("渴了", "饿了", "想睡觉", "想出去玩", "想溜达", "情绪低落", "很开心", "很伤心", "想哭");
|
||||
|
||||
|
||||
/**
|
||||
* 翻译
|
||||
*/
|
||||
@PostMapping("/translate")
|
||||
@PermitAll
|
||||
public CommonResult<String> translate(MultipartFile file) {
|
||||
// log.info("file:{}",file.getName());
|
||||
return success(message.get(RandomUtil.randomInt(0, message.size())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.tashow.cloud.ai.dal.dataobject.aisample;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
@@ -14,12 +13,11 @@ import lombok.*;
|
||||
@TableName("tz_ai_sample_tag_group_relate")
|
||||
@KeySequence("tz_ai_sample_tag_group_relate_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AiSampleTagGroupRelateDO extends BaseDO {
|
||||
public class AiSampleTagGroupRelateDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.tashow.cloud.ai.dal.dataobject.aisample;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 样本-标签关联 DO
|
||||
@@ -12,12 +13,11 @@ import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
@TableName("tz_ai_sample_tag_relate")
|
||||
@KeySequence("tz_ai_sample_tag_relate_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AiSampleTagRelateDO extends BaseDO {
|
||||
public class AiSampleTagRelateDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
|
||||
@@ -9,21 +9,13 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 样本库 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiSampleMapper extends BaseMapperX<AiSampleDO> {
|
||||
|
||||
default PageResult<AiSampleDO> selectPage(AiSamplePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AiSampleDO>()
|
||||
.eqIfPresent(AiSampleDO::getSampleFilePath, reqVO.getSampleFilePath())
|
||||
.likeIfPresent(AiSampleDO::getSampleName, reqVO.getSampleName())
|
||||
.betweenIfPresent(AiSampleDO::getSampleTime, reqVO.getSampleTime())
|
||||
.eqIfPresent(AiSampleDO::getSampleMineType, reqVO.getSampleMineType())
|
||||
.eqIfPresent(AiSampleDO::getSampleSize, reqVO.getSampleSize())
|
||||
.eqIfPresent(AiSampleDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(AiSampleDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(AiSampleDO::getId));
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,18 @@ public interface AiSampleTagMapper extends BaseMapperX<AiSampleTagDO> {
|
||||
|
||||
default PageResult<AiSampleTagDO> selectPage(AiSampleTagPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AiSampleTagDO>()
|
||||
.likeIfPresent(AiSampleTagDO::getTagName, reqVO.getTagName())
|
||||
.betweenIfPresent(AiSampleTagDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(AiSampleTagDO::getId));
|
||||
}
|
||||
|
||||
@Select("SELECT t.* FROM tz_ai_sample_tag t INNER JOIN tz_ai_sample_tag_group_relate r ON t.id = r.sample_tag_id \n" +
|
||||
" WHERE r.sample_tag_group_id = #{groupId} ")
|
||||
@Select("<script>" +
|
||||
"SELECT t.id,t.tag_name tagName FROM tz_ai_sample_tag t INNER JOIN tz_ai_sample_tag_group_relate r ON t.id = r.sample_tag_id " +
|
||||
"<where>" +
|
||||
"<if test='pageReqVO.groupId != null'>" +
|
||||
"AND r.sample_tag_group_id = #{pageReqVO.groupId}" +
|
||||
"</if>" +
|
||||
"</where>" +
|
||||
"order by id desc" +
|
||||
"</script>")
|
||||
IPage<AiSampleTagDO> getAiSampleTagPage(Page<AiSampleTagDO> page, AiSampleTagPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.tashow.cloud.ai.framework;
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.tashow.cloud.ai.framework.rpc.config;
|
||||
|
||||
import com.tashow.cloud.infraapi.api.file.FileApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.tashow.cloud.ai.framework.rpc;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.ai.security.config;
|
||||
package com.tashow.cloud.ai.framework.security.config;
|
||||
|
||||
import com.tashow.cloud.infraapi.enums.ApiConstants;
|
||||
import com.tashow.cloud.security.security.config.AuthorizeRequestsCustomizer;
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 占位
|
||||
*/
|
||||
package com.tashow.cloud.ai.framework.security.core;
|
||||
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* 占位
|
||||
*/
|
||||
package com.tashow.cloud.ai.security.core;
|
||||
@@ -20,7 +20,7 @@ public interface AiSampleService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
List<String> createAiSample(@Valid FileUploadReqVO createReqVO);
|
||||
List<AiSampleFileRespVO> createAiSample(@Valid FileUploadReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新样本库
|
||||
|
||||
@@ -3,10 +3,7 @@ package com.tashow.cloud.ai.service.aisample;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSamplePageReqVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleRelateTagVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleSaveReqVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.FileUploadReqVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.*;
|
||||
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleDO;
|
||||
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagDO;
|
||||
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagRelateDO;
|
||||
@@ -45,9 +42,9 @@ public class AiSampleServiceImpl implements AiSampleService {
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public List<String> createAiSample(FileUploadReqVO uploadReqVO) {
|
||||
public List<AiSampleFileRespVO> createAiSample(FileUploadReqVO uploadReqVO) {
|
||||
//返回图片路径
|
||||
List<String> urls = new ArrayList<>();
|
||||
List<AiSampleFileRespVO> urls = new ArrayList<>();
|
||||
/* 调用文件上传服务*/
|
||||
for (MultipartFile file : uploadReqVO.getFiles()) {
|
||||
//返回上传结果
|
||||
@@ -59,7 +56,7 @@ public class AiSampleServiceImpl implements AiSampleService {
|
||||
aiSampleDO.setSampleMineType(file.getContentType());
|
||||
aiSampleDO.setSampleSize(file.getSize());
|
||||
aiSampleMapper.insert(aiSampleDO);
|
||||
urls.add(file1);
|
||||
urls.add(new AiSampleFileRespVO().setFileUrl(file1).setFileName(file.getOriginalFilename()));
|
||||
}
|
||||
// 返回
|
||||
return urls;
|
||||
@@ -83,10 +80,12 @@ public class AiSampleServiceImpl implements AiSampleService {
|
||||
public void relate(AiSampleRelateTagVO relateTagVO) {
|
||||
List<AiSampleTagRelateDO> tagRelateDOS = new ArrayList<>();
|
||||
for (Long sampleId : relateTagVO.getSampleIds()) {
|
||||
AiSampleTagRelateDO relateDO = new AiSampleTagRelateDO();
|
||||
relateDO.setSampleId(sampleId);
|
||||
relateDO.setSampleTagId(relateTagVO.getTagId());
|
||||
tagRelateDOS.add(relateDO);
|
||||
for (Long tagId : relateTagVO.getTagId()) {
|
||||
AiSampleTagRelateDO relateDO = new AiSampleTagRelateDO();
|
||||
relateDO.setSampleId(sampleId);
|
||||
relateDO.setSampleTagId(tagId);
|
||||
tagRelateDOS.add(relateDO);
|
||||
}
|
||||
}
|
||||
aiSampleTagRelateMapper.insertBatch(tagRelateDOS);
|
||||
}
|
||||
@@ -95,12 +94,14 @@ public class AiSampleServiceImpl implements AiSampleService {
|
||||
public void deleteRelate(AiSampleRelateTagVO relateTagVO) {
|
||||
List<Long> tagRelateIds = new ArrayList<>();
|
||||
for (Long sampleId : relateTagVO.getSampleIds()) {
|
||||
AiSampleTagRelateDO relateDO = aiSampleTagRelateMapper.selectOne(
|
||||
new LambdaQueryWrapper<AiSampleTagRelateDO>()
|
||||
.eq(AiSampleTagRelateDO::getSampleId, sampleId)
|
||||
.eq(AiSampleTagRelateDO::getSampleTagId, relateTagVO.getTagId())
|
||||
);
|
||||
tagRelateIds.add(relateDO.getId());
|
||||
for (Long l : relateTagVO.getTagId()) {
|
||||
AiSampleTagRelateDO relateDO = aiSampleTagRelateMapper.selectOne(
|
||||
new LambdaQueryWrapper<AiSampleTagRelateDO>()
|
||||
.eq(AiSampleTagRelateDO::getSampleId, sampleId)
|
||||
.eq(AiSampleTagRelateDO::getSampleTagId, l)
|
||||
);
|
||||
tagRelateIds.add(relateDO.getId());
|
||||
}
|
||||
}
|
||||
aiSampleTagRelateMapper.deleteBatchIds(tagRelateIds);
|
||||
}
|
||||
@@ -135,10 +136,14 @@ public class AiSampleServiceImpl implements AiSampleService {
|
||||
PageResult<AiSampleDO> aiSampleDOPageResult = aiSampleMapper.selectPage(pageReqVO);
|
||||
//根据样本id获取关联的标签id
|
||||
List<Long> sampleIds = aiSampleDOPageResult.getList().stream().map(AiSampleDO::getId).toList();
|
||||
List<AiSampleTagRelateDO> tagRelateDOS = aiSampleTagRelateMapper.selectList(new LambdaQueryWrapper<AiSampleTagRelateDO>().in(AiSampleTagRelateDO::getSampleId, sampleIds));
|
||||
List<AiSampleTagRelateDO> tagRelateDOS = aiSampleTagRelateMapper.selectList(
|
||||
new LambdaQueryWrapper<AiSampleTagRelateDO>()
|
||||
.in(!sampleIds.isEmpty(),AiSampleTagRelateDO::getSampleId, sampleIds));
|
||||
List<Long> tagIds = tagRelateDOS.stream().map(AiSampleTagRelateDO::getSampleTagId).toList();
|
||||
//获取标签信息
|
||||
List<AiSampleTagDO> aiSampleTagDOS = aiSampleTagMapper.selectList(new LambdaQueryWrapper<AiSampleTagDO>().in(AiSampleTagDO::getId, tagIds));
|
||||
List<AiSampleTagDO> aiSampleTagDOS = aiSampleTagMapper.selectList(
|
||||
new LambdaQueryWrapper<AiSampleTagDO>()
|
||||
.in(!tagIds.isEmpty(),AiSampleTagDO::getId, tagIds));
|
||||
|
||||
//封装标签信息
|
||||
for (AiSampleDO aiSampleDO : aiSampleDOPageResult.getList()) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.tashow.cloud.ai.service.aisample;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagGroupPageReqVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagGroupRespVO;
|
||||
import com.tashow.cloud.ai.controller.admin.aisample.vo.AiSampleTagGroupSaveReqVO;
|
||||
import com.tashow.cloud.ai.dal.dataobject.aisample.AiSampleTagGroupDO;
|
||||
import com.tashow.cloud.ai.dal.mysql.aisample.AiSampleTagGroupMapper;
|
||||
@@ -69,6 +69,6 @@ public class AiSampleTagGroupServiceImpl implements AiSampleTagGroupService {
|
||||
|
||||
@Override
|
||||
public List<AiSampleTagGroupDO> getAiSampleTagGroupList() {
|
||||
return aiSampleTagGroupMapper.selectList();
|
||||
return aiSampleTagGroupMapper.selectList(new LambdaQueryWrapper<AiSampleTagGroupDO>().orderByDesc(AiSampleTagGroupDO::getId));
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class AiSampleTagServiceImpl implements AiSampleTagService {
|
||||
@Override
|
||||
public Long createAiSampleTag(AiSampleTagSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AiSampleTagDO aiSampleTag = BeanUtils.toBean(createReqVO, AiSampleTagDO.class);
|
||||
AiSampleTagDO aiSampleTag = BeanUtils.toBean(createReqVO, AiSampleTagDO.class);
|
||||
aiSampleTagMapper.insert(aiSampleTag);
|
||||
//插入关联
|
||||
List<AiSampleTagGroupRelateDO> tagGroupRelateDOS = new ArrayList<>();
|
||||
@@ -43,6 +43,7 @@ public class AiSampleTagServiceImpl implements AiSampleTagService {
|
||||
AiSampleTagGroupRelateDO tagGroupRelateDO = new AiSampleTagGroupRelateDO();
|
||||
tagGroupRelateDO.setSampleTagId(createReqVO.getId());
|
||||
tagGroupRelateDO.setSampleTagGroupId(groupId);
|
||||
tagGroupRelateDO.setSampleTagId(aiSampleTag.getId());
|
||||
tagGroupRelateDOS.add(tagGroupRelateDO);
|
||||
}
|
||||
tagGroupRelateMapper.insertBatch(tagGroupRelateDOS);
|
||||
@@ -97,6 +98,6 @@ public class AiSampleTagServiceImpl implements AiSampleTagService {
|
||||
|
||||
@Override
|
||||
public List<AiSampleTagDO> getAiSampleTagList() {
|
||||
return aiSampleTagMapper.selectList();
|
||||
return aiSampleTagMapper.selectList(new LambdaQueryWrapper<AiSampleTagDO>().orderByDesc(AiSampleTagDO::getId));
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,5 @@ spring:
|
||||
config: # 【注册中心】配置项
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
|
||||
ufop:
|
||||
storage-type: 0
|
||||
local-storage-path: D://test
|
||||
# 添加字符编码配置,解决YAML解析时的字符编码问题
|
||||
encode: UTF-8
|
||||
|
||||
@@ -2,7 +2,7 @@ server:
|
||||
port: 48086
|
||||
spring:
|
||||
application:
|
||||
name: translate-server
|
||||
name: ai-server
|
||||
profiles:
|
||||
active: local
|
||||
config:
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<configuration>
|
||||
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<!-- 变量 yudao.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="tashow.info.base-package" source="tashow.info.base-package"/>
|
||||
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
|
||||
<!-- 控制台 Appender -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件 Appender -->
|
||||
<!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
<!-- 日志文件名 -->
|
||||
<file>${LOG_FILE}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 滚动后的日志文件名 -->
|
||||
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
|
||||
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
|
||||
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
|
||||
<!-- 日志文件,到达多少容量,进行滚动 -->
|
||||
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
|
||||
<!-- 日志文件的总大小,0 表示不限制 -->
|
||||
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
|
||||
<!-- 日志文件的保留天数 -->
|
||||
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- 异步写入日志,提升性能 -->
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
|
||||
<queueSize>256</queueSize>
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
|
||||
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
||||
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 本地环境 -->
|
||||
<springProfile name="local">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
|
||||
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
|
||||
</root>
|
||||
</springProfile>
|
||||
<!-- 其它环境 -->
|
||||
<springProfile name="dev,test,stage,prod,default">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ASYNC"/>
|
||||
<appender-ref ref="GRPC"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
import static com.tashow.cloud.infra.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
@@ -24,11 +21,15 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
import static com.tashow.cloud.infra.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
||||
|
||||
/** 管理后台 - 文件存储 */
|
||||
@RestController
|
||||
@RequestMapping("/infra/file")
|
||||
@Validated
|
||||
@Slf4j
|
||||
@PermitAll
|
||||
public class FileController {
|
||||
|
||||
@Resource private FileService fileService;
|
||||
|
||||
@@ -240,7 +240,7 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = RedisKeyConstants.USER_ROLE_ID_LIST, key = "#userId")
|
||||
// @Cacheable(value = RedisKeyConstants.USER_ROLE_ID_LIST, key = "#userId")
|
||||
public Set<Long> getUserRoleIdListByUserIdFromCache(Long userId) {
|
||||
return getUserRoleIdListByUserId(userId);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ spring:
|
||||
- optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
|
||||
- optional:nacos:application.yaml # 加载【Nacos】通用的配置
|
||||
- optional:nacos:tenant.yaml # 加载【Nacos】通用的配置
|
||||
- optional:nacos:application-login.yaml # 加载登录配置
|
||||
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
<modules>
|
||||
<module>tashow-sdk-payment</module>
|
||||
<module>tashow-sdk-file</module>
|
||||
<module>tashow-feishu-sdk</module>
|
||||
</modules>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user