From a7a8a50f48c1bff5ddc52b3bad1782328f8043d8 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期五, 12 四月 2024 18:50:20 +0800 Subject: [PATCH] 基础数据配置接口修改 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbDataScreenConfigController.java | 91 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 90 insertions(+), 1 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbDataScreenConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbDataScreenConfigController.java index b450411..f9a2752 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbDataScreenConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbDataScreenConfigController.java @@ -1,6 +1,22 @@ package com.ruoyi.web.controller.api; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.system.dto.update.DataIndicatorsUpdDTO; +import com.ruoyi.system.dto.update.FormalIndicatorsUpdDTO; +import com.ruoyi.system.dto.update.RiskLevelUpdDTO; +import com.ruoyi.system.query.DataScreenConfigQuery; +import com.ruoyi.system.service.TbDataScreenConfigService; +import com.ruoyi.system.vo.DataScreenConfigVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -12,9 +28,82 @@ * @author mitao * @since 2024-03-13 */ +@Slf4j @RestController -@RequestMapping("/tb-data-screen-config") +@RequestMapping("/data-screen-config") +@RequiredArgsConstructor +@Api(tags = {"大屏数据配置相关接口"}) public class TbDataScreenConfigController { + private final TbDataScreenConfigService tbDataScreenConfigService; + + @PostMapping("/get-risk-level") + @ApiOperation("获取风险等级设置") + public R<DataScreenConfigVO> getRiskLevel() { + try { + return R.ok(tbDataScreenConfigService.getRiskLevel()); + } catch (Exception e) { + if (e instanceof ServiceException) { + return R.fail(e.getMessage()); + } + throw new RuntimeException(e); + } + } + + @PostMapping("/edit-risk-level") + @ApiOperation("编辑风险等级设置") + public R<DataScreenConfigVO> editRiskLevel( + @Validated @RequestBody RiskLevelUpdDTO dto) { + try { + return R.ok(tbDataScreenConfigService.editRiskLevel(dto)); + } catch (Exception e) { + if (e instanceof ServiceException) { + return R.fail(e.getMessage()); + } + throw new RuntimeException(e); + } + } + + @PostMapping("/get-indicators") + @ApiOperation("获取数据指标/形式指标级配置") + public R<List<DataScreenConfigVO>> getIndicatorsConfig( + @Validated @RequestBody DataScreenConfigQuery query) { + try { + return R.ok(tbDataScreenConfigService.getIndicatorsConfig(query)); + } catch (Exception e) { + if (e instanceof ServiceException) { + return R.fail(e.getMessage()); + } + throw new RuntimeException(e); + } + } + + @PostMapping("/edit-data-indicators") + @ApiOperation("编辑数据指标标级配置") + public R<DataScreenConfigVO> editDataIndicatorsConfig( + @Validated @RequestBody DataIndicatorsUpdDTO dto) { + try { + return R.ok(tbDataScreenConfigService.editDataIndicatorsConfig(dto)); + } catch (Exception e) { + if (e instanceof ServiceException) { + return R.fail(e.getMessage()); + } + throw new RuntimeException(e); + } + } + + @PostMapping("/edit-formal-indicators") + @ApiOperation("编辑形式指标标级配置") + public R<DataScreenConfigVO> editFormalIndicatorsConfig( + @Validated @RequestBody FormalIndicatorsUpdDTO dto) { + try { + return R.ok(tbDataScreenConfigService.editFormalIndicatorsConfig(dto)); + } catch (Exception e) { + if (e instanceof ServiceException) { + return R.fail(e.getMessage()); + } + throw new RuntimeException(e); + } + } } -- Gitblit v1.7.1