package com.yh.saas.plugin.yiliangyiyun.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.SalePlanInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.SettledCompanyError;
import com.yh.saas.plugin.yiliangyiyun.entity.SettledCompanyInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.TranCarInfo;
import com.yh.saas.plugin.yiliangyiyun.exception.ServiceException;
import com.yh.saas.plugin.yiliangyiyun.service.ISettledCompanyInfoService;
import com.yh.saas.plugin.yiliangyiyun.service.ITranCarInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 入驻公司信息 前端控制器
 * </p>
 *
 * @author Gongdc
 * @since 2021-08-28
 */
@RestController
@RequestMapping("/settledCompanyInfo")
public class SettledCompanyInfoController {


    @Autowired
    private ISettledCompanyInfoService settledCompanyInfoService;

    /**
     * 添加入驻公司信息
     *
     * @param settledCompanyInfo
     * @return
     */
    @PostMapping("/api/addSettledCompanyInfo")
    public String addSettledCompanyInfo(@RequestBody SettledCompanyInfo settledCompanyInfo) throws ServiceException {
        return settledCompanyInfoService.addSettledCompanyInfo(settledCompanyInfo);
    }

    /**
     * 编辑入住公司信息
     *
     * @param settledCompanyInfo
     * @return
     */
    @PostMapping("/api/editSettledCompanyInfo")
    public String editSettledCompanyInfo(@RequestBody SettledCompanyInfo settledCompanyInfo) throws ServiceException {
        return settledCompanyInfoService.editSettledCompanyInfo(settledCompanyInfo);
    }

    /**
     * 列表
     *
     * @param settledCompanyInfo
     * @return
     */
    @GetMapping("/selectSettledCompanyInfo")
    public Page<SettledCompanyInfo> selectSettledCompanyInfo(SettledCompanyInfo settledCompanyInfo) {
        return settledCompanyInfoService.selectSettledCompanyInfo(settledCompanyInfo);
    }

    /**
     * 查看详情
     *
     * @param id
     * @return
     */
    @GetMapping("/getSettledCompanyInfo")
    public SettledCompanyInfo getSettledCompanyInfo(String id) {
        return settledCompanyInfoService.getSettledCompanyInfo(id);
    }


    /**
     * 删除
     *
     * @param settledCompanyInfo
     * @return
     */
    @PostMapping("/api/deleteSettledCompanyInfo")
    public void deleteSettledCompanyInfo(@RequestBody SettledCompanyInfo settledCompanyInfo) {
        settledCompanyInfoService.deleteSettledCompanyInfo(settledCompanyInfo.getId());
    }


    /**
     * 审核
     *
     * @param settledCompanyInfo
     * @return
     */
    @PostMapping("/api/examine")
    public String examine(@RequestBody SettledCompanyInfo settledCompanyInfo) {
        return settledCompanyInfoService.examine(settledCompanyInfo);

    }


    /**
     * 显示隐藏
     *
     * @param settledCompanyInfo
     * @return
     */
    @PostMapping("/api/showHidden")
    public void showHidden(@RequestBody SettledCompanyInfo settledCompanyInfo) {
        settledCompanyInfoService.showHidden(settledCompanyInfo.getId());
    }

    /**
     * 收藏
     *
     * @param settledCompanyInfo
     * @return
     */
    @PostMapping("/api/collection")
    public String collection(@RequestBody SettledCompanyInfo settledCompanyInfo) {
        return settledCompanyInfoService.collection(settledCompanyInfo);

    }

    /**
     * 取消收藏
     *
     * @param settledCompanyInfo
     * @return
     */
    @PostMapping("/api/collectionNot")
    public String collectionNot(@RequestBody SettledCompanyInfo settledCompanyInfo) {
        return settledCompanyInfoService.collectionNot(settledCompanyInfo);

    }

    /**
     * 我的收藏
     *
     * @param settledCompanyInfo
     * @return
     */
    @GetMapping("/myCollection")
    public Page<SettledCompanyInfo> myCollection(SettledCompanyInfo settledCompanyInfo) {
        return settledCompanyInfoService.myCollection(settledCompanyInfo);
    }



    /**
     * 纠错举报
     *
     * @param settledCompanyError
     * @return
     */
    @PostMapping("/api/addSettledCompanyError")
    public String addSettledCompanyError(@RequestBody SettledCompanyError settledCompanyError) throws ServiceException {
        return settledCompanyInfoService.addSettledCompanyError(settledCompanyError);
    }

    /**
     * 我的入驻公司
     *
     * @param settledCompanyInfo
     * @return
     */
    @GetMapping("/companyList")
    public List<SettledCompanyInfo> companyList(SettledCompanyInfo settledCompanyInfo) {
        return settledCompanyInfoService.companyList(settledCompanyInfo);
    }



}

