package com.jeeplus.test.wdt.merchantCompany.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.jeeplus.aop.logging.annotation.ApiLog;
import com.jeeplus.core.excel.EasyExcelUtils;
import com.jeeplus.core.excel.ExcelOptions;
import com.jeeplus.core.excel.annotation.ExportMode;
import com.jeeplus.core.query.QueryWrapperGenerator;
import com.jeeplus.test.utils.excel.MerchantCompanyEasyExcel;
import com.jeeplus.test.wdt.merchantCompany.service.MerchantCompanyService;
import com.jeeplus.test.wdt.merchantCompany.service.MerchantDetailsService;
import com.jeeplus.test.wdt.merchantCompany.service.dto.MerchantCompanyDTO;
import com.jeeplus.test.wdt.merchantCompany.service.dto.MerchantCompanyExportDTO;
import com.jeeplus.test.wdt.merchantCompany.service.dto.MerchantDetailsDTO;
import com.jeeplus.test.wdt.merchantCompany.service.dto.SettledPlatformDTO;
import com.jeeplus.test.wdt.merchantCompany.service.mapstuct.MerchantCompanyWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


/**
 * 入驻详情controller
 * @author: 徐滕
 * @version: 2024-01-04 10:40
 */

@Api("入驻详情管理")
@RestController
@RequestMapping(value = "/wdt/merchantDetails")
public class MerchantDetailsController {
    @Autowired
    private MerchantDetailsService merchantDetailsService;


    /**
     * 根据Id获取商家基本信息
     */
    @ApiLog("获取入驻详情信息")
    @ApiOperation(value = "获取入驻详情信息")
    @GetMapping("getLimit1")
    public ResponseEntity<MerchantDetailsDTO> getLimit1() {
        MerchantDetailsDTO byId = merchantDetailsService.getLimit1();
        return ResponseEntity.ok ( byId);
    }



    /**
     * 保存入驻详情信息
     */
    @ApiLog("保存入驻详情信息")
    @ApiOperation(value = "保存入驻详情信息")
    @PostMapping("save")
    public  ResponseEntity <String> save(@Valid @RequestBody MerchantDetailsDTO merchantDetailsDTO) {
        //新增或编辑表单保存
        merchantDetailsService.saveOrUpdate (merchantDetailsDTO);
        return ResponseEntity.ok ( "保存入驻详情信息成功" );
    }

    /**
     * 保存入驻详情信息获取方式
     */
    @ApiLog("保存入驻详情信息获取方式")
    @ApiOperation(value = "保存入驻详情信息获取方式")
    @PostMapping("saveDataSources")
    public  ResponseEntity <String> saveDataSources(String dataSources) {
        //新增或编辑表单保存
        merchantDetailsService.saveDataSources (dataSources);
        return ResponseEntity.ok ( "保存入驻详情信息获取方式成功" );
    }

    /**
     * 保存入驻详情信息获取方式
     */
    @ApiLog("保存大屏名称")
    @ApiOperation(value = "保存大屏名称")
    @PostMapping("screenSave")
    public  ResponseEntity <String> screenSave(String screenName,String filePath) {
        //新增或编辑表单保存
        merchantDetailsService.screenSave (screenName,filePath);
        return ResponseEntity.ok ( "保存大屏信息成功" );
    }




    /**
     * 查询入驻信息数据(大屏数据)
     */
    @ApiLog("查询入驻信息数据(大屏数据)")
    @ApiOperation(value = "查询入驻信息数据(大屏数据)")
    @GetMapping("getScreenDetail")
    public Map<String,String> getScreenDetail(String type,String settledEnterpriseType) {
        Map<String,String> map = merchantDetailsService.getScreenDetail (type,settledEnterpriseType);
        return map;
    }


    /**
     * 查询大屏名称(大屏数据)
     */
    @ApiLog("查询大屏名称(大屏数据)")
    @ApiOperation(value = "查询大屏名称(大屏数据)")
    @GetMapping("getScreenName")
    public Map<String,String> getScreenName() {
        Map<String,String> map = merchantDetailsService.getScreenName ();
        return map;
    }


    /**
     * 查询入驻信息数据(大屏数据)
     */
    @ApiLog("查询大屏视频播放url")
    @ApiOperation(value = "查询大屏视频播放url")
    @GetMapping("getFilePathUrl")
    public Map<String,String> getFilePathUrl() {
        Map<String,String> map = merchantDetailsService.getFilePathUrl ();
        return map;
    }



}
