package com.ruoyi.ibs.list.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ibs.list.domain.CustInfoBusiness;
import com.ruoyi.ibs.list.service.ICorporateShareholderService;
import com.ruoyi.ibs.list.service.ICustInfoBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 企业客户基本信息Controller
 * 
 * @author ruoyi
 * @date 2024-10-28
 */
@RestController
@RequestMapping("/system/business")
@Api("企业客户信息")
public class CustInfoBusinessController extends BaseController
{
    @Autowired
    private ICustInfoBusinessService custInfoBusinessService;
    @Autowired
    private ICorporateShareholderService corporateShareholderService;



    /**
     * 获取企业客户基本信息详细信息
     */
    //@PreAuthorize("@ss.hasPermi('system:business:query')")
    @GetMapping(value = "/getInfoByCustId")
    @Log(title = "根据客户号查询企业360客户详情")
    @ApiOperation("根据客户号查询企业360客户详情")
    public AjaxResult getInfo(String custId)
    {

        return success(custInfoBusinessService.selectCustInfoBusinessVoByCustId(custId));
    }


    /**
     * 修改企业客户基本信息
     */
    //@PreAuthorize("@ss.hasPermi('system:business:edit')")
    @Log(title = "编辑企业客户详情", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("编辑企业客户详情")
    public AjaxResult edit( CustInfoBusiness custInfoBusiness)
    {
        return custInfoBusinessService.updateCustInfoBusiness(custInfoBusiness);
    }

    @ApiOperation("获取对公经营状态码值")
    @Log(title = "获取对公经营状态码值;", businessType = BusinessType.UPDATE)
    @GetMapping("/getRegStatus")
    public R<List<SysDictData>> getRegStatus() {
        List<SysDictData> paramList = custInfoBusinessService.getRegStatus();
        return R.ok(paramList);
    }
}
