package cn.hanghui.outapi.platform.tenant.controller;

import cn.hanghui.outapi.platform.common.entity.rest.RestResponse;
import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
import cn.hanghui.outapi.platform.common.utils.Preconditions;
import cn.hanghui.outapi.platform.tenant.entity.dto.RiskPcDto;
import cn.hanghui.outapi.platform.tenant.entity.dto.RiskPcVo;
import cn.hanghui.outapi.platform.tenant.service.OpenApiService;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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 shisl
 * @package cn.hanghui.outapi.platform.tenant.controller
 * @class RiskPcController
 * @date 2024/1/17 上午9:38
 * @description
 */
@Api(tags = "用户风险评测")
@Slf4j
@RestController
@RequestMapping("/api/v1/risk")
public class RiskPcController {

    @Autowired
    private OpenApiService openApiService;

    @ApiOperation(value = "自然人风险评分查询接口")
    @PostMapping("/query")
    public RestResult<RiskPcVo> query(@RequestBody RiskPcDto dto) {
        if (Preconditions.isBlank(dto.getAppId())) {
            return RestResponse.error("参数有误");
        }
        return openApiService.queryRisk(dto);
    }

}
