package com.finance.web.controller.api;
|
|
|
import com.finance.common.core.domain.R;
|
import com.finance.common.exception.ServiceException;
|
import com.finance.system.dto.update.DataIndicatorsUpdDTO;
|
import com.finance.system.dto.update.FormalIndicatorsUpdDTO;
|
import com.finance.system.dto.update.RiskLevelUpdDTO;
|
import com.finance.system.query.DataScreenConfigQuery;
|
import com.finance.system.service.TbDataScreenConfigService;
|
import com.finance.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;
|
|
/**
|
* <p>
|
* 大屏数据配置表 前端控制器
|
* </p>
|
*
|
* @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<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.getType()));
|
} catch (Exception e) {
|
if (e instanceof ServiceException) {
|
return R.fail(e.getMessage());
|
}
|
throw new RuntimeException(e);
|
}
|
}
|
|
@PostMapping("/edit-data-indicators")
|
@ApiOperation("编辑数据指标标级配置")
|
public R<List<DataScreenConfigVO>> editDataIndicatorsConfig(
|
@Validated @RequestBody List<DataIndicatorsUpdDTO> dtoList) {
|
try {
|
return R.ok(tbDataScreenConfigService.editDataIndicatorsConfig(dtoList));
|
} catch (Exception e) {
|
if (e instanceof ServiceException) {
|
return R.fail(e.getMessage());
|
}
|
throw new RuntimeException(e);
|
}
|
}
|
|
@PostMapping("/edit-formal-indicators")
|
@ApiOperation("编辑形式指标标级配置")
|
public R<List<DataScreenConfigVO>> editFormalIndicatorsConfig(
|
@Validated @RequestBody List<FormalIndicatorsUpdDTO> dtoList) {
|
try {
|
return R.ok(tbDataScreenConfigService.editFormalIndicatorsConfig(dtoList));
|
} catch (Exception e) {
|
if (e instanceof ServiceException) {
|
return R.fail(e.getMessage());
|
}
|
throw new RuntimeException(e);
|
}
|
}
|
}
|