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/FilmContentTaskConfigController.java | 91 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 91 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/mzl/flower/web/film/FilmContentTaskConfigController.java b/src/main/java/com/mzl/flower/web/film/FilmContentTaskConfigController.java new file mode 100644 index 0000000..f374c03 --- /dev/null +++ b/src/main/java/com/mzl/flower/web/film/FilmContentTaskConfigController.java @@ -0,0 +1,91 @@ +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.BatchDTO; +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.validation.annotation.Validated; +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 FilmContentTaskConfigController extends BaseController { + + private final AiContentTaskConfigService aiContentTaskConfigService; + private final TaskExecutor taskExecutor; + + @GetMapping("/filmTaskConfig/all") + @ApiOperation(value = "影视作品任务配置列表", httpMethod = "GET") + public ResponseEntity<ReturnDataDTO<List<AiContentTaskConfigVO>>> getFilmWorksAll() { + return returnData(R.SUCCESS.getCode(), aiContentTaskConfigService.getAiContentTaskConfigAll()); + } + + @GetMapping("/filmTaskConfig/list") + @ApiOperation(value = "影视作品任务配置列表", httpMethod = "GET") + public ResponseEntity<ReturnDataDTO<Page<AiContentTaskConfigVO>>> getFilmWorksList(Page page, AiContentTaskConfigQueryDTO dto) { + dto.setType(Constants.GENERATOR_CONTENT.film_name.name()); + return returnData(R.SUCCESS.getCode(), aiContentTaskConfigService.queryPage(dto, page)); + } + + + @GetMapping(value = "/filmTaskConfig/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 = "/filmTaskConfig/new") + @ApiOperation(value = "保存影视作品任务配置", httpMethod = "POST") + public ResponseEntity insert(@RequestBody AiContentTaskConfigDTO aiContentTaskConfigDTO) { + aiContentTaskConfigDTO.setType(Constants.GENERATOR_CONTENT.film_name.name()); + aiContentTaskConfigService.saveAiContentTaskConfig(aiContentTaskConfigDTO); +// taskExecutor.callPythonAiService(aiContentTaskConfigDTO.getAiParams()); + return returnData(R.SUCCESS.getCode(), null); + } + + @PostMapping(value = "/filmTaskConfig/edit") + @ApiOperation(value = "更新影视作品任务配置", httpMethod = "POST") + public ResponseEntity update(@RequestBody AiContentTaskConfigDTO aiContentTaskConfigDTO) { + aiContentTaskConfigService.updateAiContentTaskConfig(aiContentTaskConfigDTO); + return returnData(R.SUCCESS.getCode(), null); + } + + @GetMapping("/filmTaskConfig/list/view") + @ApiOperation(value = "详情", notes = "详情") + public ResponseEntity<ReturnDataDTO<AiContentTaskConfigVO>> detail(@NotNull(message = "id不能为空") Long id) { + return returnData(R.SUCCESS.getCode(),aiContentTaskConfigService.detail(id)); + } + + @PostMapping("/filmTaskConfig/delete/batch") + @ApiOperation(value = "批量删除", notes = "批量删除") + public ResponseEntity<ReturnDataDTO> batchDelete(@Validated @RequestBody BatchDTO dto) { + aiContentTaskConfigService.batchDelete(dto); + return returnData(R.SUCCESS.getCode(),null); + } + +} + -- Gitblit v1.9.3