cloudroam
4 天以前 46715d892da947c31f07796fdc79dbbef06677b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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));
    }
 
}