| | |
| | | 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("/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); |
| | | } |
| | | } |
| | | } |
| | | |