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.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ibs.list.domain.CustInfoRetail;
import com.ruoyi.ibs.list.service.*;
import com.ruoyi.system.service.ISysIndustryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 对私客户信息Controller
 *
 * @author ruoyi
 * @date 2024-09-19
 */
@RestController
@RequestMapping("/system/retail")
@Api("对私客户信息")
public class CustInfoRetailController extends BaseController {
    @Autowired
    private ICustInfoRetailService custInfoRetailService;
    @Autowired
    private ICustInfoBusinessService custInfoBusinessService;
    @Autowired
    private ICustInfoMerchantService custInfoMerchantService;
    @Autowired
    private IFamilyMembersService familyMembersService;
    @Autowired
    private ISignedProductsService signedProductsService;
    @Autowired
    private ISysIndustryService iSysIndustryService;


    /**
     * 获取对私客户信息详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:retail:query')")
    @GetMapping(value = "/getInfoByCustId")
    @Log(title = "根据客户号查询客户360视图详情")
    @ApiOperation("根据客户号查询客户360视图详情")
    public AjaxResult getInfoByCustId(String custId) {
        return success(custInfoRetailService.selectCustInfoRetailVoByCustId(custId));
    }

    /**
     * 修改对私客户信息
     */
//    @PreAuthorize("@ss.hasPermi('system:retail:edit')")
    @Log(title = "对私客户信息", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    @ApiOperation("编辑客户详情")
    public AjaxResult edit(CustInfoRetail custInfoRetail) {
            return custInfoRetailService.updateCustInfoRetail(custInfoRetail);
    }

    /**
     * 查询产业树
     */
    @GetMapping(value = "selectIndustryTree")
    @ApiOperation("查询产业树")
    public AjaxResult selectIndustryTree() {
        return AjaxResult.success(iSysIndustryService.getIndustryTree());
    }

}
