From 8b02c916fec8819f4f1b27b21a26cca6c41b5f5d Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期一, 14 七月 2025 09:54:05 +0800 Subject: [PATCH] add:定时任务配置,热门城市 --- src/main/java/com/mzl/flower/web/film/AiContentTaskConfigController.java | 81 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/mzl/flower/web/film/AiContentTaskConfigController.java b/src/main/java/com/mzl/flower/web/film/AiContentTaskConfigController.java new file mode 100644 index 0000000..8158160 --- /dev/null +++ b/src/main/java/com/mzl/flower/web/film/AiContentTaskConfigController.java @@ -0,0 +1,81 @@ +package com.mzl.flower.web.film; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mzl.flower.base.BaseController; +import com.mzl.flower.base.R; +import com.mzl.flower.base.ReturnDataDTO; +import com.mzl.flower.constant.Constants; +import com.mzl.flower.dto.request.film.AiContentTaskConfigDTO; +import com.mzl.flower.dto.request.film.AiContentTaskConfigQueryDTO; +import com.mzl.flower.dto.response.film.AiContentTaskConfigVO; +import com.mzl.flower.schedule.TaskExecutor; +import com.mzl.flower.service.film.AiContentTaskConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author fanghaowei + * @version version2.0 + * @className FilmWorksController + * @date 2024/8/26 + * @description 模型任务配置 + */ +@Api(value = "模型任务配置", tags = "模型任务配置") +@RestController +@RequestMapping("/api") +@RequiredArgsConstructor +public class AiContentTaskConfigController extends BaseController { + + private final AiContentTaskConfigService aiContentTaskConfigService; + private final TaskExecutor taskExecutor; + + @GetMapping("/aiTaskConfig/all") + @ApiOperation(value = "模型任务配置列表", httpMethod = "GET") + public ResponseEntity<ReturnDataDTO<List<AiContentTaskConfigVO>>> getFilmWorksAll() { + return returnData(R.SUCCESS.getCode(), aiContentTaskConfigService.getEnabledAiContentTaskConfig()); + } + + @GetMapping("/aiTaskConfig/list") + @ApiOperation(value = "模型任务配置列表", httpMethod = "GET") + public ResponseEntity<ReturnDataDTO<Page<AiContentTaskConfigVO>>> getFilmWorksList(Page page, AiContentTaskConfigQueryDTO dto) { + dto.setType(Constants.GENERATOR_CONTENT.film_content.name()); + return returnData(R.SUCCESS.getCode(), aiContentTaskConfigService.queryPage(dto, page)); + } + + + @GetMapping(value = "/aiTaskConfig/delete") + @ApiOperation(value = "删除模型任务配置 ", httpMethod = "GET", notes = "ID") + public ResponseEntity delete(@NotNull(message = "id不能为空") Long id) { + aiContentTaskConfigService.deleteAiContentTaskConfig(String.valueOf(id)); + return returnData(R.SUCCESS.getCode(), null); + } + + @PostMapping(value = "/aiTaskConfig/new") + @ApiOperation(value = "保存模型任务配置", httpMethod = "POST") + public ResponseEntity insert(@RequestBody AiContentTaskConfigDTO aiContentTaskConfigDTO) { + aiContentTaskConfigDTO.setType(Constants.GENERATOR_CONTENT.film_content.name()); + aiContentTaskConfigService.saveAiContentTaskConfig(aiContentTaskConfigDTO); + return returnData(R.SUCCESS.getCode(), null); + } + + @PostMapping(value = "/aiTaskConfig/edit") + @ApiOperation(value = "更新模型任务配置", httpMethod = "POST") + public ResponseEntity update(@RequestBody AiContentTaskConfigDTO aiContentTaskConfigDTO) { + aiContentTaskConfigService.updateAiContentTaskConfig(aiContentTaskConfigDTO); + return returnData(R.SUCCESS.getCode(), null); + } + + @GetMapping("/aiTaskConfig/list/view") + @ApiOperation(value = "详情", notes = "详情") + public ResponseEntity<ReturnDataDTO<AiContentTaskConfigVO>> detail(@NotNull(message = "id不能为空") Long id) { + return returnData(R.SUCCESS.getCode(),aiContentTaskConfigService.detail(id)); + } + +} + -- Gitblit v1.9.3