You've already forked FrameTour-BE
Merge branch 'render-worker-microservice'
# Conflicts: # src/main/java/com/ycwl/basic/integration/scenic/service/ScenicIntegrationService.java # src/main/java/com/ycwl/basic/service/task/impl/TaskTaskServiceImpl.java
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.ycwl.basic.integration.scenic.dto.config.DefaultConfigDTO;
|
||||
import com.ycwl.basic.integration.scenic.service.DefaultConfigIntegrationService;
|
||||
import com.ycwl.basic.integration.scenic.service.ScenicDefaultConfigIntegrationService;
|
||||
import com.ycwl.basic.utils.ApiConst;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class DefaultConfigController {
|
||||
|
||||
private final DefaultConfigIntegrationService defaultConfigIntegrationService;
|
||||
private final ScenicDefaultConfigIntegrationService scenicDefaultConfigIntegrationService;
|
||||
|
||||
/**
|
||||
* 获取默认配置列表
|
||||
@@ -29,7 +29,7 @@ public class DefaultConfigController {
|
||||
public ApiResponse<List<DefaultConfigDTO>> listDefaultConfigs() {
|
||||
log.info("获取默认配置列表");
|
||||
try {
|
||||
List<DefaultConfigDTO> configs = defaultConfigIntegrationService.listDefaultConfigs();
|
||||
List<DefaultConfigDTO> configs = scenicDefaultConfigIntegrationService.listDefaultConfigs();
|
||||
return ApiResponse.success(configs);
|
||||
} catch (Exception e) {
|
||||
log.error("获取默认配置列表失败", e);
|
||||
@@ -44,7 +44,7 @@ public class DefaultConfigController {
|
||||
public ApiResponse<DefaultConfigDTO> getDefaultConfig(@PathVariable String configKey) {
|
||||
log.info("获取默认配置, configKey: {}", configKey);
|
||||
try {
|
||||
DefaultConfigDTO config = defaultConfigIntegrationService.getDefaultConfig(configKey);
|
||||
DefaultConfigDTO config = scenicDefaultConfigIntegrationService.getDefaultConfig(configKey);
|
||||
return ApiResponse.success(config);
|
||||
} catch (Exception e) {
|
||||
log.error("获取默认配置失败, configKey: {}", configKey, e);
|
||||
@@ -59,7 +59,7 @@ public class DefaultConfigController {
|
||||
public ApiResponse<DefaultConfigDTO> createDefaultConfig(@RequestBody DefaultConfigDTO request) {
|
||||
log.info("创建默认配置, configKey: {}", request.getConfigKey());
|
||||
try {
|
||||
DefaultConfigDTO config = defaultConfigIntegrationService.createDefaultConfig(request);
|
||||
DefaultConfigDTO config = scenicDefaultConfigIntegrationService.createDefaultConfig(request);
|
||||
return ApiResponse.success(config);
|
||||
} catch (Exception e) {
|
||||
log.error("创建默认配置失败, configKey: {}", request.getConfigKey(), e);
|
||||
@@ -75,7 +75,7 @@ public class DefaultConfigController {
|
||||
@RequestBody DefaultConfigDTO request) {
|
||||
log.info("更新默认配置, configKey: {}", configKey);
|
||||
try {
|
||||
DefaultConfigDTO config = defaultConfigIntegrationService.updateDefaultConfig(configKey, request);
|
||||
DefaultConfigDTO config = scenicDefaultConfigIntegrationService.updateDefaultConfig(configKey, request);
|
||||
return ApiResponse.success(config);
|
||||
} catch (Exception e) {
|
||||
log.error("更新默认配置失败, configKey: {}", configKey, e);
|
||||
@@ -90,7 +90,7 @@ public class DefaultConfigController {
|
||||
public ApiResponse<Void> deleteDefaultConfig(@PathVariable String configKey) {
|
||||
log.info("删除默认配置, configKey: {}", configKey);
|
||||
try {
|
||||
defaultConfigIntegrationService.deleteDefaultConfig(configKey);
|
||||
scenicDefaultConfigIntegrationService.deleteDefaultConfig(configKey);
|
||||
return ApiResponse.buildResponse(ApiConst.Code.CODE_SUCCESS.code(), null, "删除成功");
|
||||
} catch (Exception e) {
|
||||
log.error("删除默认配置失败, configKey: {}", configKey, e);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.ycwl.basic.integration.device.dto.config.*;
|
||||
import com.ycwl.basic.integration.common.response.PageResponse;
|
||||
import com.ycwl.basic.integration.device.dto.device.*;
|
||||
import com.ycwl.basic.integration.device.service.DeviceConfigIntegrationService;
|
||||
import com.ycwl.basic.integration.device.service.DeviceIntegrationService;
|
||||
@@ -35,7 +36,7 @@ public class DeviceV2Controller {
|
||||
* 设备V2核心信息分页列表
|
||||
*/
|
||||
@GetMapping("/")
|
||||
public ApiResponse<DeviceV2ListResponse> listDevices(@RequestParam(defaultValue = "1") Integer page,
|
||||
public ApiResponse<PageResponse<DeviceV2DTO>> listDevices(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(required = false) String no,
|
||||
@@ -51,7 +52,7 @@ public class DeviceV2Controller {
|
||||
}
|
||||
|
||||
try {
|
||||
DeviceV2ListResponse response = deviceIntegrationService.listDevices(page, pageSize, name, no, type, isActive, scenicId);
|
||||
PageResponse<DeviceV2DTO> response = deviceIntegrationService.listDevices(page, pageSize, name, no, type, isActive, scenicId);
|
||||
return ApiResponse.success(response);
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询设备核心信息列表失败", e);
|
||||
@@ -63,7 +64,7 @@ public class DeviceV2Controller {
|
||||
* 设备V2带配置信息分页列表
|
||||
*/
|
||||
@GetMapping("/with-config")
|
||||
public ApiResponse<DeviceV2WithConfigListResponse> listDevicesWithConfig(@RequestParam(defaultValue = "1") Integer page,
|
||||
public ApiResponse<PageResponse<DeviceV2WithConfigDTO>> listDevicesWithConfig(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(required = false) String no,
|
||||
@@ -79,7 +80,7 @@ public class DeviceV2Controller {
|
||||
}
|
||||
|
||||
try {
|
||||
DeviceV2WithConfigListResponse response = deviceIntegrationService.listDevicesWithConfig(page, pageSize, name, no, type, isActive, scenicId);
|
||||
PageResponse<DeviceV2WithConfigDTO> response = deviceIntegrationService.listDevicesWithConfig(page, pageSize, name, no, type, isActive, scenicId);
|
||||
return ApiResponse.success(response);
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询设备带配置信息列表失败", e);
|
||||
@@ -431,12 +432,12 @@ public class DeviceV2Controller {
|
||||
* 获取景区IPC设备列表
|
||||
*/
|
||||
@GetMapping("/scenic/{scenicId}/ipc")
|
||||
public ApiResponse<DeviceV2ListResponse> getScenicIpcDevices(@PathVariable Long scenicId,
|
||||
public ApiResponse<PageResponse<DeviceV2DTO>> getScenicIpcDevices(@PathVariable Long scenicId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
log.info("获取景区IPC设备列表, scenicId: {}, page: {}, pageSize: {}", scenicId, page, pageSize);
|
||||
try {
|
||||
DeviceV2ListResponse response = deviceIntegrationService.getScenicIpcDevices(scenicId, page, pageSize);
|
||||
PageResponse<DeviceV2DTO> response = deviceIntegrationService.getScenicIpcDevices(scenicId, page, pageSize);
|
||||
return ApiResponse.success(response);
|
||||
} catch (Exception e) {
|
||||
log.error("获取景区IPC设备列表失败, scenicId: {}", scenicId, e);
|
||||
@@ -448,12 +449,12 @@ public class DeviceV2Controller {
|
||||
* 获取景区激活设备列表
|
||||
*/
|
||||
@GetMapping("/scenic/{scenicId}/active")
|
||||
public ApiResponse<DeviceV2ListResponse> getScenicActiveDevices(@PathVariable Long scenicId,
|
||||
public ApiResponse<PageResponse<DeviceV2DTO>> getScenicActiveDevices(@PathVariable Long scenicId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
log.info("获取景区激活设备列表, scenicId: {}, page: {}, pageSize: {}", scenicId, page, pageSize);
|
||||
try {
|
||||
DeviceV2ListResponse response = deviceIntegrationService.getScenicActiveDevices(scenicId, page, pageSize);
|
||||
PageResponse<DeviceV2DTO> response = deviceIntegrationService.getScenicActiveDevices(scenicId, page, pageSize);
|
||||
return ApiResponse.success(response);
|
||||
} catch (Exception e) {
|
||||
log.error("获取景区激活设备列表失败, scenicId: {}", scenicId, e);
|
||||
@@ -465,12 +466,12 @@ public class DeviceV2Controller {
|
||||
* 获取景区所有设备列表
|
||||
*/
|
||||
@GetMapping("/scenic/{scenicId}/all")
|
||||
public ApiResponse<DeviceV2ListResponse> getScenicAllDevices(@PathVariable Long scenicId,
|
||||
public ApiResponse<PageResponse<DeviceV2DTO>> getScenicAllDevices(@PathVariable Long scenicId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
log.info("获取景区所有设备列表, scenicId: {}, page: {}, pageSize: {}", scenicId, page, pageSize);
|
||||
try {
|
||||
DeviceV2ListResponse response = deviceIntegrationService.listDevices(page, pageSize, null, null, null, null, scenicId);
|
||||
PageResponse<DeviceV2DTO> response = deviceIntegrationService.listDevices(page, pageSize, null, null, null, null, scenicId);
|
||||
return ApiResponse.success(response);
|
||||
} catch (Exception e) {
|
||||
log.error("获取景区所有设备列表失败, scenicId: {}", scenicId, e);
|
||||
|
@@ -0,0 +1,196 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.ycwl.basic.integration.render.dto.config.BatchRenderWorkerConfigRequest;
|
||||
import com.ycwl.basic.integration.render.dto.config.RenderWorkerConfigV2DTO;
|
||||
import com.ycwl.basic.integration.render.service.RenderWorkerConfigIntegrationService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 渲染工作器配置管理 V2 版本控制器
|
||||
* 基于 zt-render-worker 微服务标准接口实现
|
||||
*
|
||||
* @author Claude Code
|
||||
* @date 2025-09-06
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/render/worker/config/v2")
|
||||
@RequiredArgsConstructor
|
||||
public class RenderWorkerConfigV2Controller {
|
||||
|
||||
private final RenderWorkerConfigIntegrationService configIntegrationService;
|
||||
|
||||
/**
|
||||
* 获取工作器所有配置
|
||||
*
|
||||
* @param workerId 工作器ID
|
||||
* @return 工作器配置列表
|
||||
*/
|
||||
@GetMapping("/{workerId}")
|
||||
public ApiResponse<List<RenderWorkerConfigV2DTO>> getWorkerConfigs(@PathVariable Long workerId) {
|
||||
log.info("获取渲染工作器配置列表, workerId: {}", workerId);
|
||||
|
||||
try {
|
||||
List<RenderWorkerConfigV2DTO> configs = configIntegrationService.getWorkerConfigs(workerId);
|
||||
return ApiResponse.success(configs);
|
||||
} catch (Exception e) {
|
||||
log.error("获取渲染工作器配置列表失败, workerId: {}", workerId, e);
|
||||
return ApiResponse.fail("获取渲染工作器配置列表失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工作器平铺配置
|
||||
*
|
||||
* @param workerId 工作器ID
|
||||
* @return 平铺配置Map
|
||||
*/
|
||||
@GetMapping("/{workerId}/flat")
|
||||
public ApiResponse<Map<String, Object>> getWorkerFlatConfig(@PathVariable Long workerId) {
|
||||
log.info("获取渲染工作器平铺配置, workerId: {}", workerId);
|
||||
|
||||
try {
|
||||
Map<String, Object> flatConfig = configIntegrationService.getWorkerFlatConfig(workerId);
|
||||
return ApiResponse.success(flatConfig);
|
||||
} catch (Exception e) {
|
||||
log.error("获取渲染工作器平铺配置失败, workerId: {}", workerId, e);
|
||||
return ApiResponse.fail("获取渲染工作器平铺配置失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据配置键获取特定配置
|
||||
*
|
||||
* @param workerId 工作器ID
|
||||
* @param configKey 配置键
|
||||
* @return 配置信息
|
||||
*/
|
||||
@GetMapping("/{workerId}/key/{configKey}")
|
||||
public ApiResponse<RenderWorkerConfigV2DTO> getWorkerConfigByKey(@PathVariable Long workerId,
|
||||
@PathVariable String configKey) {
|
||||
log.info("根据配置键获取渲染工作器配置, workerId: {}, configKey: {}", workerId, configKey);
|
||||
|
||||
try {
|
||||
RenderWorkerConfigV2DTO config = configIntegrationService.getWorkerConfigByKey(workerId, configKey);
|
||||
return ApiResponse.success(config);
|
||||
} catch (Exception e) {
|
||||
log.error("根据配置键获取渲染工作器配置失败, workerId: {}, configKey: {}", workerId, configKey, e);
|
||||
return ApiResponse.fail("根据配置键获取渲染工作器配置失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建工作器配置
|
||||
*
|
||||
* @param workerId 工作器ID
|
||||
* @param config 配置信息
|
||||
* @return 创建的配置信息
|
||||
*/
|
||||
@PostMapping("/{workerId}")
|
||||
public ApiResponse<RenderWorkerConfigV2DTO> createWorkerConfig(@PathVariable Long workerId,
|
||||
@Valid @RequestBody RenderWorkerConfigV2DTO config) {
|
||||
log.info("创建渲染工作器配置, workerId: {}, configKey: {}", workerId, config.getConfigKey());
|
||||
|
||||
try {
|
||||
RenderWorkerConfigV2DTO result = configIntegrationService.createWorkerConfig(workerId, config);
|
||||
return ApiResponse.success(result);
|
||||
} catch (Exception e) {
|
||||
log.error("创建渲染工作器配置失败, workerId: {}", workerId, e);
|
||||
return ApiResponse.fail("创建渲染工作器配置失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工作器配置
|
||||
*
|
||||
* @param workerId 工作器ID
|
||||
* @param configId 配置ID
|
||||
* @param updates 更新内容
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/{workerId}/{configId}")
|
||||
public ApiResponse<Void> updateWorkerConfig(@PathVariable Long workerId,
|
||||
@PathVariable Long configId,
|
||||
@Valid @RequestBody Map<String, Object> updates) {
|
||||
log.info("更新渲染工作器配置, workerId: {}, configId: {}", workerId, configId);
|
||||
|
||||
try {
|
||||
configIntegrationService.updateWorkerConfig(workerId, configId, updates);
|
||||
return ApiResponse.success(null);
|
||||
} catch (Exception e) {
|
||||
log.error("更新渲染工作器配置失败, workerId: {}, configId: {}", workerId, configId, e);
|
||||
return ApiResponse.fail("更新渲染工作器配置失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工作器配置
|
||||
*
|
||||
* @param workerId 工作器ID
|
||||
* @param configId 配置ID
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/{workerId}/{configId}")
|
||||
public ApiResponse<Void> deleteWorkerConfig(@PathVariable Long workerId,
|
||||
@PathVariable Long configId) {
|
||||
log.info("删除渲染工作器配置, workerId: {}, configId: {}", workerId, configId);
|
||||
|
||||
try {
|
||||
configIntegrationService.deleteWorkerConfig(workerId, configId);
|
||||
return ApiResponse.success(null);
|
||||
} catch (Exception e) {
|
||||
log.error("删除渲染工作器配置失败, workerId: {}, configId: {}", workerId, configId, e);
|
||||
return ApiResponse.fail("删除渲染工作器配置失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新工作器配置
|
||||
*
|
||||
* @param workerId 工作器ID
|
||||
* @param request 批量配置请求
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("/{workerId}/batch")
|
||||
public ApiResponse<Void> batchUpdateWorkerConfigs(@PathVariable Long workerId,
|
||||
@Valid @RequestBody BatchRenderWorkerConfigRequest request) {
|
||||
log.info("批量更新渲染工作器配置, workerId: {}, configCount: {}",
|
||||
workerId, request.getConfigs() != null ? request.getConfigs().size() : 0);
|
||||
|
||||
try {
|
||||
configIntegrationService.batchUpdateWorkerConfigs(workerId, request);
|
||||
return ApiResponse.success(null);
|
||||
} catch (Exception e) {
|
||||
log.error("批量更新渲染工作器配置失败, workerId: {}", workerId, e);
|
||||
return ApiResponse.fail("批量更新渲染工作器配置失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量平铺更新工作器配置
|
||||
*
|
||||
* @param workerId 工作器ID
|
||||
* @param flatConfigs 平铺配置Map
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("/{workerId}/flat-batch")
|
||||
public ApiResponse<Void> batchFlatUpdateWorkerConfigs(@PathVariable Long workerId,
|
||||
@Valid @RequestBody Map<String, Object> flatConfigs) {
|
||||
log.info("批量平铺更新渲染工作器配置, workerId: {}, configCount: {}", workerId, flatConfigs.size());
|
||||
|
||||
try {
|
||||
configIntegrationService.batchFlatUpdateWorkerConfigs(workerId, flatConfigs);
|
||||
return ApiResponse.success(null);
|
||||
} catch (Exception e) {
|
||||
log.error("批量平铺更新渲染工作器配置失败, workerId: {}", workerId, e);
|
||||
return ApiResponse.fail("批量平铺更新渲染工作器配置失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity;
|
||||
import com.ycwl.basic.model.pc.renderWorker.req.RenderWorkerReqQuery;
|
||||
import com.ycwl.basic.service.pc.RenderWorkerService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/3 14:59
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/renderWorker/v1")
|
||||
// 渲染机管理
|
||||
public class RenderWorkerController {
|
||||
|
||||
@Autowired
|
||||
private RenderWorkerService renderWorkerService;
|
||||
|
||||
// 分页查询渲染机
|
||||
@PostMapping("/page")
|
||||
public ApiResponse pageQuery(@RequestBody RenderWorkerReqQuery renderWorkerReqQuery){
|
||||
return renderWorkerService.pageQuery(renderWorkerReqQuery);
|
||||
}
|
||||
// 渲染机列表查询
|
||||
@PostMapping("/list")
|
||||
public ApiResponse list(@RequestBody RenderWorkerReqQuery renderWorkerReqQuery){
|
||||
return renderWorkerService.list(renderWorkerReqQuery);
|
||||
}
|
||||
// 渲染机详情查询
|
||||
@GetMapping("/detail/{id}")
|
||||
public ApiResponse detail(@PathVariable Long id){
|
||||
return renderWorkerService.detail(id);
|
||||
}
|
||||
|
||||
// 渲染机新增
|
||||
@PostMapping("/add")
|
||||
public ApiResponse add(@RequestBody RenderWorkerEntity renderWorker){
|
||||
return renderWorkerService.add(renderWorker);
|
||||
}
|
||||
|
||||
// 渲染机删除
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ApiResponse deleteById(@PathVariable Long id){
|
||||
return renderWorkerService.deleteById(id);
|
||||
}
|
||||
|
||||
// 渲染机修改
|
||||
@PostMapping("/update")
|
||||
public ApiResponse update(@RequestBody RenderWorkerEntity renderWorker){
|
||||
return renderWorkerService.update(renderWorker);
|
||||
}
|
||||
|
||||
// 渲染机修改状态
|
||||
@PutMapping("/updateStatus/{id}")
|
||||
public ApiResponse updateStatus(@PathVariable Long id) {
|
||||
return renderWorkerService.updateStatus(id);
|
||||
}
|
||||
}
|
@@ -0,0 +1,142 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.ycwl.basic.integration.common.response.PageResponse;
|
||||
import com.ycwl.basic.integration.render.dto.worker.CreateRenderWorkerRequest;
|
||||
import com.ycwl.basic.integration.render.dto.worker.RenderWorkerV2DTO;
|
||||
import com.ycwl.basic.integration.render.dto.worker.UpdateRenderWorkerRequest;
|
||||
import com.ycwl.basic.integration.render.service.RenderWorkerIntegrationService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 渲染工作器管理 V2 版本控制器
|
||||
* 基于 zt-render-worker 微服务标准接口实现
|
||||
*
|
||||
* @author Claude Code
|
||||
* @date 2025-09-06
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/render/worker/v2")
|
||||
@RequiredArgsConstructor
|
||||
public class RenderWorkerV2Controller {
|
||||
|
||||
private final RenderWorkerIntegrationService renderWorkerIntegrationService;
|
||||
|
||||
/**
|
||||
* 分页查询渲染工作器列表
|
||||
*
|
||||
* @param page 页码,从1开始
|
||||
* @param pageSize 每页大小,默认10,最大100
|
||||
* @param isEnabled 是否启用(0-禁用,1-启用)
|
||||
* @param name 工作器名称(模糊搜索)
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
@GetMapping
|
||||
public ApiResponse<PageResponse<RenderWorkerV2DTO>> listWorkers(
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) Integer isEnabled,
|
||||
@RequestParam(required = false) String name) {
|
||||
|
||||
log.info("分页查询渲染工作器列表, page: {}, pageSize: {}, isEnabled: {}, name: {}",
|
||||
page, pageSize, isEnabled, name);
|
||||
|
||||
// 参数验证:限制pageSize最大值为100
|
||||
if (pageSize > 100) {
|
||||
pageSize = 100;
|
||||
}
|
||||
|
||||
try {
|
||||
PageResponse<RenderWorkerV2DTO> result = renderWorkerIntegrationService.listWorkers(
|
||||
page, pageSize, isEnabled, name);
|
||||
return ApiResponse.success(result);
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询渲染工作器列表失败", e);
|
||||
return ApiResponse.fail("分页查询渲染工作器列表失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取渲染工作器详情
|
||||
*
|
||||
* @param id 工作器ID
|
||||
* @return 工作器详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public ApiResponse<RenderWorkerV2DTO> getWorker(@PathVariable Long id) {
|
||||
log.info("获取渲染工作器详情, id: {}", id);
|
||||
|
||||
try {
|
||||
RenderWorkerV2DTO worker = renderWorkerIntegrationService.getWorker(id);
|
||||
return ApiResponse.success(worker);
|
||||
} catch (Exception e) {
|
||||
log.error("获取渲染工作器详情失败, id: {}", id, e);
|
||||
return ApiResponse.fail("获取渲染工作器详情失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建渲染工作器
|
||||
*
|
||||
* @param request 创建请求
|
||||
* @return 创建的工作器信息
|
||||
*/
|
||||
@PostMapping
|
||||
public ApiResponse<RenderWorkerV2DTO> createWorker(@Valid @RequestBody CreateRenderWorkerRequest request) {
|
||||
log.info("创建渲染工作器, name: {}, key: {}, isActive: {}",
|
||||
request.getName(), request.getKey(), request.getIsActive());
|
||||
|
||||
try {
|
||||
RenderWorkerV2DTO worker = renderWorkerIntegrationService.createWorker(request);
|
||||
return ApiResponse.success(worker);
|
||||
} catch (Exception e) {
|
||||
log.error("创建渲染工作器失败", e);
|
||||
return ApiResponse.fail("创建渲染工作器失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新渲染工作器
|
||||
*
|
||||
* @param id 工作器ID
|
||||
* @param request 更新请求
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
public ApiResponse<Void> updateWorker(@PathVariable Long id,
|
||||
@Valid @RequestBody UpdateRenderWorkerRequest request) {
|
||||
log.info("更新渲染工作器, id: {}, name: {}, isActive: {}",
|
||||
id, request.getName(), request.getIsActive());
|
||||
|
||||
try {
|
||||
renderWorkerIntegrationService.updateWorker(id, request);
|
||||
return ApiResponse.success(null);
|
||||
} catch (Exception e) {
|
||||
log.error("更新渲染工作器失败, id: {}", id, e);
|
||||
return ApiResponse.fail("更新渲染工作器失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除渲染工作器
|
||||
*
|
||||
* @param id 工作器ID
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResponse<Void> deleteWorker(@PathVariable Long id) {
|
||||
log.info("删除渲染工作器, id: {}", id);
|
||||
|
||||
try {
|
||||
renderWorkerIntegrationService.deleteWorker(id);
|
||||
return ApiResponse.success(null);
|
||||
} catch (Exception e) {
|
||||
log.error("删除渲染工作器失败, id: {}", id, e);
|
||||
return ApiResponse.fail("删除渲染工作器失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@@ -9,9 +9,8 @@ import com.ycwl.basic.integration.scenic.dto.filter.ScenicFilterPageResponse;
|
||||
import com.ycwl.basic.integration.scenic.dto.filter.ScenicFilterRequest;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.CreateScenicRequest;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2DTO;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2ListResponse;
|
||||
import com.ycwl.basic.integration.common.response.PageResponse;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2WithConfigDTO;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2WithConfigListResponse;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.UpdateScenicRequest;
|
||||
import com.ycwl.basic.integration.scenic.service.ScenicConfigIntegrationService;
|
||||
import com.ycwl.basic.integration.scenic.service.ScenicIntegrationService;
|
||||
@@ -52,7 +51,7 @@ public class ScenicV2Controller {
|
||||
* 景区V2核心信息分页列表
|
||||
*/
|
||||
@GetMapping("/")
|
||||
public ApiResponse<ScenicV2ListResponse> listScenics(@RequestParam(defaultValue = "1") Integer page,
|
||||
public ApiResponse<PageResponse<ScenicV2DTO>> listScenics(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) Integer status,
|
||||
@RequestParam(required = false) String name) {
|
||||
@@ -64,7 +63,7 @@ public class ScenicV2Controller {
|
||||
}
|
||||
|
||||
try {
|
||||
ScenicV2ListResponse response = scenicIntegrationService.listScenics(page, pageSize, status, name);
|
||||
PageResponse<ScenicV2DTO> response = scenicIntegrationService.listScenics(page, pageSize, status, name);
|
||||
return ApiResponse.success(response);
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询景区核心信息列表失败", e);
|
||||
@@ -76,7 +75,7 @@ public class ScenicV2Controller {
|
||||
* 景区V2带配置信息分页列表
|
||||
*/
|
||||
@GetMapping("/with-config")
|
||||
public ApiResponse<ScenicV2WithConfigListResponse> listScenicsWithConfig(@RequestParam(defaultValue = "1") Integer page,
|
||||
public ApiResponse<PageResponse<ScenicV2WithConfigDTO>> listScenicsWithConfig(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) Integer status,
|
||||
@RequestParam(required = false) String name) {
|
||||
@@ -88,7 +87,7 @@ public class ScenicV2Controller {
|
||||
}
|
||||
|
||||
try {
|
||||
ScenicV2WithConfigListResponse response = scenicIntegrationService.listScenicsWithConfig(page, pageSize, status, name);
|
||||
PageResponse<ScenicV2WithConfigDTO> response = scenicIntegrationService.listScenicsWithConfig(page, pageSize, status, name);
|
||||
return ApiResponse.success(response);
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询景区带配置信息列表失败", e);
|
||||
@@ -178,11 +177,11 @@ public class ScenicV2Controller {
|
||||
* 只支持根据状态筛选
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public ApiResponse<ScenicV2ListResponse> listScenicsByStatus(@RequestParam(required = false) Integer status) {
|
||||
public ApiResponse<PageResponse<ScenicV2DTO>> listScenicsByStatus(@RequestParam(required = false) Integer status) {
|
||||
log.info("查询景区列表, status: {}", status);
|
||||
try {
|
||||
// 默认查询1000条数据,第1页
|
||||
ScenicV2ListResponse scenics = scenicIntegrationService.listScenics(1, 1000, status, null);
|
||||
PageResponse<ScenicV2DTO> scenics = scenicIntegrationService.listScenics(1, 1000, status, null);
|
||||
return ApiResponse.success(scenics);
|
||||
} catch (Exception e) {
|
||||
log.error("查询景区列表失败, status: {}", status, e);
|
||||
|
Reference in New Issue
Block a user