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; /** *

* 大屏数据配置表 前端控制器 *

* * @author mitao * @since 2024-03-13 */ @Slf4j @RestController @RequestMapping("/data-screen-config") @RequiredArgsConstructor @Api(tags = {"大屏数据配置相关接口"}) public class TbDataScreenConfigController { private final TbDataScreenConfigService tbDataScreenConfigService; @PostMapping("/get-risk-level") @ApiOperation("获取风险等级设置") public R 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 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> 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 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 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); } } }