package com.ruoyi.web.controller.app;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.ss.risk.domain.Risk;
import com.ruoyi.ss.risk.domain.RiskVO;
import com.ruoyi.ss.risk.service.RiskService;
import com.ruoyi.ss.risk.service.RiskValidator;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wjh
 * 2024/11/25
 */
@RestController
@RequestMapping("/app/risk")
public class AppRiskController extends BaseController {

    @Autowired
    private RiskService riskService;

    @Autowired
    private RiskValidator riskValidator;

    @ApiOperation("获取风控信息详情")
    @GetMapping("/{riskId}")
    public AjaxResult getInfo(@PathVariable Long riskId) {
        RiskVO risk = riskService.selectRiskByRiskId(riskId);
        if (!riskValidator.isUser(risk, getUserId())) {
            return error("您无权查看该风控信息");
        }
        return success(risk);
    }

}
