123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package com.backendsys.controller.Ai;
- import com.backendsys.entity.Ai.Aizn.AiznImageStyleDTO;
- import com.backendsys.entity.Ai.Aizn.AiznIntelligentClipTaskDTO;
- import com.backendsys.entity.Ai.Aizn.AiznInteractClipTask.AiznInteractClipTaskDTO;
- import com.backendsys.entity.Ai.Aizn.AiznModel.AiznModelTaskDTO;
- import com.backendsys.entity.System.SysResourcePointsDTO;
- import com.backendsys.exception.CustomException;
- import com.backendsys.mapper.System.SysResourcePointsMapper;
- import com.backendsys.service.Ai.Aizn.AiznImageTaskService;
- import com.backendsys.service.Ai.Aizn.AiznModelService;
- import com.backendsys.service.SDKService.SDKTencent.SDKTencentCOSService;
- import com.backendsys.utils.response.Result;
- import jakarta.validation.constraints.NotEmpty;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.*;
- import java.io.IOException;
- @Validated
- @RestController
- public class AiznModelController {
- @Autowired
- private SysResourcePointsMapper sysResourcePointsMapper;
- @Autowired
- private AiznModelService aiznModelService;
- @Autowired
- private AiznImageTaskService aiznImageTaskService;
- @Autowired
- private SDKTencentCOSService sdkTencentCOSService;
- /**
- * [紫鸟] AI模特 - 获得风格/场景配置数据
- */
- @PreAuthorize("@ss.hasPermi('35')")
- @GetMapping("/api/ai/zn/getImageStyle")
- public Result getImageStyle(AiznImageStyleDTO aiznImageStyleDTO) {
- return Result.success(aiznModelService.getImageStyle(aiznImageStyleDTO));
- }
- /**
- * [紫鸟] AI模特 - 获得积分单价 (AI模特)
- */
- @PreAuthorize("@ss.hasPermi('35')")
- @GetMapping("/api/ai/zn/getResourceOfZnModel")
- public Result getImageStyle() {
- SysResourcePointsDTO sysResourcePointsDTO = new SysResourcePointsDTO();
- sysResourcePointsDTO.setResource_type("ZnModel");
- return Result.success(sysResourcePointsMapper.queryResourcePointsList(sysResourcePointsDTO));
- }
- /**
- * [紫鸟] AI模特 - 智能抠图 (发起任务)
- */
- @PreAuthorize("@ss.hasPermi('35')")
- @PostMapping("/api/ai/zn/makeIntelligentClipTask")
- public Result makeIntelligentClipTask(@Validated @RequestBody AiznIntelligentClipTaskDTO aiznIntelligentClipTaskDTO) {
- return Result.success(aiznModelService.makeIntelligentClipTask(aiznIntelligentClipTaskDTO));
- }
- /**
- * [紫鸟] AI模特 - 智能抠图 (查询任务)
- */
- @PreAuthorize("@ss.hasPermi('35')")
- @GetMapping("/api/ai/zn/getProgressOfIntelligentClipTask")
- public Result getProgressOfIntelligentClipTask(@NotEmpty(message = "任务ID 不能为空") String id) throws IOException {
- return Result.success(aiznImageTaskService.getProgressOfTask(id, 3));
- }
- /**
- * [紫鸟] AI模特 - 交互抠图 (直接返回结果)
- */
- @PreAuthorize("@ss.hasPermi('35')")
- @PostMapping("/api/ai/zn/makeInteractClipTask")
- public Result makeInteractClipTask(@Validated @RequestBody AiznInteractClipTaskDTO aiznInteractClipTaskDTO) {
- return Result.success(aiznModelService.makeInteractClipTask(aiznInteractClipTaskDTO));
- }
- /**
- * [紫鸟] AI换模特 (发起任务)
- */
- @PreAuthorize("@ss.hasPermi('35')")
- @PostMapping("/api/ai/zn/makeModelTask")
- public Result makeModelTask(@Validated @RequestBody AiznModelTaskDTO aiznModelTaskDTO) {
- return Result.success(aiznModelService.makeModelTask(aiznModelTaskDTO));
- }
- /**
- * [紫鸟] AI换模特 (查询任务)
- */
- @PreAuthorize("@ss.hasPermi('35')")
- @GetMapping("/api/ai/zn/getProgressOfModelTask")
- public Result getProgressOfModelTask(
- @RequestParam(value = "id", required = false) String id,
- @RequestParam(value = "ids", required = false) String ids
- ) throws IOException {
- if (ids != null) {
- if (id != null) throw new CustomException("id 与 ids 不能同时存在");
- return Result.success(aiznImageTaskService.getProgressOfTaskArray(ids, 9));
- } else {
- if (id == null) throw new CustomException("id 与 ids 至少一项不能为空");
- return Result.success(aiznImageTaskService.getProgressOfTask(id, 9));
- }
- }
- }
|