package com.slodon.b2b2c.controller.seller.seller;

import com.slodon.b2b2c.aop.VendorLogger;
import com.slodon.b2b2c.core.constant.StoreConst;
import com.slodon.b2b2c.core.controller.BaseController;
import com.slodon.b2b2c.core.exception.MallException;
import com.slodon.b2b2c.core.response.JsonResult;
import com.slodon.b2b2c.core.response.PagerInfo;
import com.slodon.b2b2c.core.response.SldResponse;
import com.slodon.b2b2c.core.util.AssertUtil;
import com.slodon.b2b2c.core.util.FileUrlUtil;
import com.slodon.b2b2c.core.util.UserUtil;
import com.slodon.b2b2c.core.util.WebUtil;
import com.slodon.b2b2c.dao.read.system.TplPcMallDecoReadMapper;
import com.slodon.b2b2c.enums.WebSiteConstant;
import com.slodon.b2b2c.goods.example.GoodsCategoryExample;
import com.slodon.b2b2c.goods.pojo.GoodsCategory;
import com.slodon.b2b2c.model.goods.GoodsCategoryModel;
import com.slodon.b2b2c.model.seller.*;
import com.slodon.b2b2c.model.system.SettingModel;
import com.slodon.b2b2c.seller.example.*;
import com.slodon.b2b2c.seller.pojo.*;
import com.slodon.b2b2c.system.example.TplPcMallDecoExample;
import com.slodon.b2b2c.system.pojo.Setting;
import com.slodon.b2b2c.system.pojo.SysSeo;
import com.slodon.b2b2c.system.pojo.TplPcMallDeco;
import com.slodon.b2b2c.vo.seller.StoreDetailVO;
import com.slodon.b2b2c.vo.seller.StoreGoodsCateVO;
import com.slodon.b2b2c.vo.seller.StoreIndexInformationVO;
import com.slodon.b2b2c.vo.seller.StoreSettingVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.slodon.b2b2c.enums.SeoTypeConstant;

/**
 * @author slodon
 */
@Api(tags = "seller-商户后台店铺信息")
@RestController
@RequestMapping("v3/seller/seller/store")
public class SellerStoreController extends BaseController {

    @Resource
    private StoreModel storeModel;
    @Resource
    private StoreSiteInfoModel storeSiteInfoModel;
    @Resource
    private StoreNameModel storeNameModel;
    @Resource
    private SettingModel settingModel;
    @Resource
    private StoreApplyModel storeApplyModel;
    @Resource
    private StoreCertificateModel storeCertificateModel;
    @Resource
    private StoreBindCategoryModel storeBindCategoryModel;
    @Resource
    private VendorRolesModel vendorRolesModel;
    @Resource
    private GoodsCategoryModel goodsCategoryModel;
    @Resource
    private StringRedisTemplate stringRedisTemplate;
    @Resource
    private TplPcMallDecoReadMapper tplPcMallDecoReadMapper;

    @Resource
    private StoreProfileTextListModel storeProfileTextListModel;

    @ApiOperation("查看店铺信息")
    @GetMapping("detail")
    @ApiImplicitParam(name = "webSite", value = "站点", paramType = "query")
    public JsonResult<StoreDetailVO> getDetail(HttpServletRequest request, @RequestParam(value = "webSite", required = false, defaultValue = "1") String webSite) {

        Vendor vendor = UserUtil.getUser(request, Vendor.class);
        //根据vendor获取店铺信息
        Store store = storeModel.getStoreByStoreId(vendor.getStoreId());
        if (!WebSiteConstant.MEMBER_OVERSEA.equals(webSite)) {
            store = storeSiteInfoModel.getStoreByStoreIdAndWebSite(store.getStoreId(), webSite);
            //未设置国内站基本信息，则返回默认信息
            if (StringUtils.isEmpty(store.getStoreId())) {
                store = storeModel.getStoreByStoreId(vendor.getStoreId());
                store.setStoreLogo(null);
                store.setStoreBannerPc(null);
                store.setMainBusiness(null);
                store.setServicePhone(null);
                store.setAddress(null);
                store.setEmail(null);
                store.setOpenTime(null);
                store.setStoreGradeId(null);
                store.setStoreGradeName(null);
                store.setStoreMapInfo(null);
                store.setStoreMapInfoW(null);
            }
            StoreNameExample storeNameExample = new StoreNameExample();
            storeNameExample.setStoreId(vendor.getStoreId());
            List<StoreName> storeNameList = storeNameModel.getStoreNameList(storeNameExample, null);
            store.setStoreName(CollectionUtils.isEmpty(storeNameList) ? store.getStoreName() : storeNameList.get(0).getStoreName());
        }
        AssertUtil.notNull(store, "未获取到店铺信息");
        AssertUtil.isTrue(!vendor.getStoreId().equals(store.getStoreId()), "非法操作");

        //获取店铺logo
        if (StringUtils.isEmpty(store.getStoreLogo())) {
            store.setStoreLogo(stringRedisTemplate.opsForValue().get("default_image_store_logo"));
        } else {
            store.setStoreLogo(store.getStoreLogo());
        }

        //获取申请表信息
        StoreApplyExample storeApplyExample = new StoreApplyExample();
        storeApplyExample.setStoreId(store.getStoreId());
        StoreApply storeApply = storeApplyModel.getStoreApplyList(storeApplyExample, null).get(0);

        //获取店铺资质信息
        StoreCertificateExample storeCertificateExample = new StoreCertificateExample();
        storeCertificateExample.setVendorId(storeApply.getVendorId());
        StoreCertificate storeCertificate = storeCertificateModel.getStoreCertificateList(storeCertificateExample, null).get(0);

        StoreDetailVO vo = new StoreDetailVO(store, storeCertificate);
        //获取应付金额
        vo.setPayAmount(storeApply.getPayAmount());
        //获取支付方式
        vo.setPaymentCode(storeApply.getPaymentCode());
        //获取支付名称
        vo.setPaymentName(storeApply.getPaymentName());

        //获取经营类目信息
        StoreBindCategoryExample storeBindCategoryExample = new StoreBindCategoryExample();
        storeBindCategoryExample.setStoreId(storeApply.getStoreId());
        storeBindCategoryExample.setWebSite(webSite);
        storeBindCategoryExample.setState(StoreConst.STORE_CATEGORY_STATE_PASS);
        List<StoreBindCategory> storeBindCategoryList = storeBindCategoryModel.getStoreBindCategoryList(storeBindCategoryExample, null);

        List<Setting> webSiteList = settingModel.getSiteSetting();

        GoodsCategoryExample goodsCategoryExample = new GoodsCategoryExample();
        List<GoodsCategory> goodsCategoryList = goodsCategoryModel.getGoodsCategoryList(goodsCategoryExample, null);

        List<StoreGoodsCateVO> storeGoodsCateVOList = new ArrayList<>();
        if (!CollectionUtils.isEmpty(storeBindCategoryList)) {
            storeBindCategoryList.forEach(storeBindCategory -> {
                StoreGoodsCateVO storeGoodsCateVO = new StoreGoodsCateVO(storeBindCategory);
                storeGoodsCateVO.setWebSiteName(webSiteList.stream().filter(setting -> setting.getValue().equals(storeBindCategory.getWebSite())).findFirst().map(Setting::getTitle).orElse(""));
                storeGoodsCateVO.setGoodsCateName1(goodsCategoryList.stream().filter(goodsCategory -> goodsCategory.getCategoryId().equals(storeBindCategory.getGoodsCategoryId1())).findFirst().map(GoodsCategory::getCategoryName).orElse(""));
                storeGoodsCateVO.setGoodsCateName2(goodsCategoryList.stream().filter(goodsCategory -> goodsCategory.getCategoryId().equals(storeBindCategory.getGoodsCategoryId2())).findFirst().map(GoodsCategory::getCategoryName).orElse(""));
                storeGoodsCateVO.setGoodsCateName3(goodsCategoryList.stream().filter(goodsCategory -> goodsCategory.getCategoryId().equals(storeBindCategory.getGoodsCategoryId3())).findFirst().map(GoodsCategory::getCategoryName).orElse(""));
                storeGoodsCateVOList.add(storeGoodsCateVO);
            });
            vo.setStoreGoodsCateVOList(storeGoodsCateVOList);
        }

        //获取结算周期
        if (!StringUtils.isEmpty(store.getBillType()) && !StringUtils.isEmpty(store.getBillDay())) {
            if (store.getBillType() == StoreConst.BILL_TYPE_MONTH) {
                vo.setBillCycle("每月" + store.getBillDay() + "号");
            } else {
                //阿拉伯数字转化为星期
                StringBuilder builder = new StringBuilder();
                String[] dayArr = store.getBillDay().split(",");
                for (String dayStr : dayArr) {
                    AssertUtil.isTrue(Integer.parseInt(dayStr) < 0 && Integer.parseInt(dayStr) > 7, "获取的星期有误");
                    switch (Integer.parseInt(dayStr)) {
                        case 1:
                            builder.append("周一");
                            builder.append(",");
                            break;
                        case 2:
                            builder.append("周二");
                            builder.append(",");
                            break;
                        case 3:
                            builder.append("周三");
                            builder.append(",");
                            break;
                        case 4:
                            builder.append("周四");
                            builder.append(",");
                            break;
                        case 5:
                            builder.append("周五");
                            builder.append(",");
                            break;
                        case 6:
                            builder.append("周六");
                            builder.append(",");
                            break;
                        case 7:
                            builder.append("周日");
                            builder.append(",");
                            break;
                        default:
                    }
                }
                vo.setBillCycle("每" + builder.substring(0, builder.length() - 1));
            }
        }
        return SldResponse.success(vo);
    }

    @ApiOperation("获取店铺设置信息接口")
    @ApiImplicitParam(name = "webSite", value = "站点", paramType = "query")
    @GetMapping("settingDetail")
    public JsonResult<StoreSettingVO> settingDetail(HttpServletRequest request, @RequestParam(value = "webSite", required = false, defaultValue = "1") String webSite) {
        Vendor vendor = UserUtil.getUser(request, Vendor.class);

        Store store;
        if (WebSiteConstant.MEMBER_OVERSEA.equals(webSite)) {
            store = storeModel.getStoreByStoreId(vendor.getStoreId());
            SysSeo seoInfo = storeModel.getRecordByTargetIdAndType(vendor.getStoreId(), SeoTypeConstant.SEO_TYPE_SHOP, webSite);
            if (seoInfo != null) {
                store.setStoreSeoTitle(seoInfo.getTitle());
                store.setStoreSeoDesc(seoInfo.getRemark());
                store.setStoreSeoKeyword(seoInfo.getKeywords());
            }
        } else {
            store = storeSiteInfoModel.getStoreByStoreIdAndWebSite(vendor.getStoreId(), webSite);
            SysSeo seoInfo = storeModel.getRecordByTargetIdAndType(vendor.getStoreId(), SeoTypeConstant.SEO_TYPE_SHOP, webSite);
            if (seoInfo != null) {
                store.setStoreSeoTitle(seoInfo.getTitle());
                store.setStoreSeoDesc(seoInfo.getRemark());
                store.setStoreSeoKeyword(seoInfo.getKeywords());
            }
        }



        //查询店铺简介内容表里是否存在这笔数据
//        StoreProfileTextList storeProfileTextInfo = storeProfileTextListModel.getList(vendor.getStoreId());
//        if(storeProfileTextInfo!=null){
//            store.setStoreDesc(storeProfileTextInfo.getContent());
//        }

        StoreSettingVO vo = new StoreSettingVO(store);
        return SldResponse.success(vo);
    }


    /**
     * 获取店铺经营状态接口
     * @param request
     * @param webSite
     * @return
     */
    @ApiOperation("获取店铺经营信息接口")
    @ApiImplicitParam(name = "webSite", value = "站点", paramType = "query")
    @GetMapping("getBusinessState")
    public JsonResult<Integer> getBusinessState(HttpServletRequest request, @RequestParam(value = "webSite", required = false, defaultValue = "1") String webSite) {
        Vendor vendor = UserUtil.getUser(request, Vendor.class);

        Store store;
        if (WebSiteConstant.MEMBER_OVERSEA.equals(webSite)) {
            store = storeModel.getStoreByStoreId(vendor.getStoreId());
            AssertUtil.notNull(store, "未获取到店铺信息");
        } else {
            store = storeSiteInfoModel.getStoreByStoreIdAndWebSite(vendor.getStoreId(), webSite);
            if (store.getStoreId() == null) {
                throw new MallException("未获取到店铺信息");
            }
        }
        return SldResponse.success(store.getBusinessState());
    }

    /**
     * 编辑店铺经营状态接口
     * @param request
     * @param webSite
     * @param businessState
     * @return
     */
    @ApiOperation("编辑店铺经营状态接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "webSite", value = "站点", paramType = "query"),
            @ApiImplicitParam(name = "businessState", value = "经营状态", paramType = "query")
    })
    @VendorLogger(option = "编辑店铺经营状态接口")
    @PostMapping("updateBusinessState")
    public JsonResult<Boolean> updateStoreBusinessState(HttpServletRequest request,
                                                        @RequestParam(value = "webSite", required = false, defaultValue = "1") String webSite,
                                                        @RequestParam(value = "businessState") Integer businessState) {
        Vendor vendor = UserUtil.getUser(request, Vendor.class);
        String logMsg = "店铺id:" + vendor.getStoreId();
        boolean deco = false;
        if (businessState == 3) {
            TplPcMallDecoExample example = new TplPcMallDecoExample();
            example.setWebSite(webSite);
            example.setIsEnable(1);
            example.setStoreId(vendor.getStoreId());
            int i = tplPcMallDecoReadMapper.countByExample(example);
            if(i==0){
                deco = true;
            }
            return SldResponse.success("设置失败", logMsg, deco);
        }
        if (WebSiteConstant.MEMBER_OVERSEA.equals(webSite)) {
            Store store = new Store();
            store.setStoreId(vendor.getStoreId());
            store.setBusinessState(businessState);
            storeModel.updateStore(store);
        } else {
            StoreSiteInfoExample storeSiteInfoExample = new StoreSiteInfoExample();
            storeSiteInfoExample.setStoreId(vendor.getStoreId());
            storeSiteInfoExample.setWebSite(webSite);
            Store store = storeSiteInfoModel.getStoreByStoreIdAndWebSite(vendor.getStoreId(), webSite);

            StoreSiteInfo storeSiteInfo = new StoreSiteInfo();
            storeSiteInfo.setStoreId(vendor.getStoreId());
            storeSiteInfo.setWebSite(webSite);
            storeSiteInfo.setBusinessState(businessState);
            if (StringUtils.isEmpty(store.getStoreId())) {
                storeSiteInfo.setCreateId(vendor.getVendorId());
                storeSiteInfo.setCreateTime(new Date());
                storeSiteInfoModel.saveStoreSiteInfo(storeSiteInfo);
            } else {
                storeSiteInfo.setUpdateId(vendor.getVendorId());
                storeSiteInfo.setUpdateTime(new Date());
                storeSiteInfoModel.updateStoreSiteInfo(storeSiteInfo);
            }
        }

        return SldResponse.success("设置成功", logMsg, deco);
    }


    @ApiOperation("编辑店铺设置接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "webSite", value = "站点", paramType = "query"),
            @ApiImplicitParam(name = "mainBusiness", value = "店铺主营商品名称，用','分隔，例如'男装,女装,童装'"),
            @ApiImplicitParam(name = "storeLogo", value = "店铺logo"),
            @ApiImplicitParam(name = "servicePhone", value = "店铺客服电话"),
            @ApiImplicitParam(name = "address", value = "店铺地址"),
            @ApiImplicitParam(name = "email", value = "店铺邮箱"),
            @ApiImplicitParam(name = "storeBannerPc", value = "pc端店铺横幅"),
            @ApiImplicitParam(name = "storeBannerMobile", value = "移动端店铺横幅"),
            @ApiImplicitParam(name = "storeBackdrop", value = "店铺背景"),
            @ApiImplicitParam(name = "storeSeoKeyword", value = "店铺seo keyword"),
            @ApiImplicitParam(name = "storeSeoTitle", value = "店铺SEO标题"),
            @ApiImplicitParam(name = "storeSeoDesc", value = "店铺SEO描述"),
            @ApiImplicitParam(name = "storeMapInfo", value = "店铺地图参数配置-经度"),
            @ApiImplicitParam(name = "storeMapInfoW", value = "店铺地图参数配置-维度"),
            @ApiImplicitParam(name = "storeDesc", value = "店铺介绍")
    })
    @VendorLogger(option = "编辑店铺设置接口")
    @PostMapping("updateSetting")
    public JsonResult<Integer> updateStoreSetting(HttpServletRequest request,
                                                  @RequestParam(value = "webSite", required = false, defaultValue = "1") String webSite,
                                                  @RequestParam(value = "mainBusiness", required = false) String mainBusiness,
                                                  @RequestParam(value = "storeLogo", required = false) String storeLogo,
                                                  @RequestParam(value = "servicePhone", required = false) String servicePhone,
                                                  @RequestParam(value = "address", required = false) String address,
                                                  @RequestParam(value = "email", required = false) String email,
                                                  @RequestParam(value = "storeBannerPc", required = false) String storeBannerPc,
                                                  @RequestParam(value = "storeBannerMobile", required = false) String storeBannerMobile,
                                                  @RequestParam(value = "storeBackdrop", required = false) String storeBackdrop,
                                                  @RequestParam(value = "storeSeoKeyword", required = false) String storeSeoKeyword,
                                                  @RequestParam(value = "storeSeoTitle", required = false) String storeSeoTitle,
                                                  @RequestParam(value = "storeSeoDesc", required = false) String storeSeoDesc,
                                                  @RequestParam(value = "storeMapInfo", required = false) String storeMapInfo,
                                                  @RequestParam(value = "storeMapInfoW", required = false) String storeMapInfoW,
                                                  @RequestParam(value = "storeDesc", required = false) String storeDesc ) throws ParseException {
        Vendor vendor = UserUtil.getUser(request, Vendor.class);

        String logMsg = "店铺id:" + vendor.getStoreId();

        if (WebSiteConstant.MEMBER_OVERSEA.equals(webSite)) {
            Store store = new Store();
            store.setStoreId(vendor.getStoreId());
            store.setMainBusiness(mainBusiness);
            store.setStoreLogo(storeLogo);
            store.setServicePhone(servicePhone);
            store.setAddress(address);
            store.setEmail(email);
            store.setStoreBannerPc(storeBannerPc);
            store.setStoreBannerMobile(storeBannerMobile);
            store.setStoreBackdrop(storeBackdrop);
            store.setStoreMapInfo(storeMapInfo);
            store.setStoreMapInfoW(storeMapInfoW);
            storeModel.updateStore(store);
        }else {
            StoreSiteInfoExample storeSiteInfoExample = new StoreSiteInfoExample();
            storeSiteInfoExample.setStoreId(vendor.getStoreId());
            storeSiteInfoExample.setWebSite(webSite);
            Store store = storeSiteInfoModel.getStoreByStoreIdAndWebSite(vendor.getStoreId(), webSite);

            StoreSiteInfo storeSiteInfo = new StoreSiteInfo();
            storeSiteInfo.setStoreId(vendor.getStoreId());
            storeSiteInfo.setWebSite(webSite);
            storeSiteInfo.setMainBusiness(mainBusiness);
            storeSiteInfo.setStoreLogo(storeLogo);
            storeSiteInfo.setServicePhone(servicePhone);
            storeSiteInfo.setAddress(address);
            storeSiteInfo.setEmail(email);
            storeSiteInfo.setStoreBannerPc(storeBannerPc);
            storeSiteInfo.setStoreMapInfo(storeMapInfo);
            storeSiteInfo.setStoreMapInfoW(storeMapInfoW);

            if (StringUtils.isEmpty(store.getStoreId())) {
                storeSiteInfo.setCreateId(vendor.getVendorId());
                storeSiteInfo.setCreateTime(new Date());
                storeSiteInfoModel.saveStoreSiteInfo(storeSiteInfo);
            } else {
                storeSiteInfo.setUpdateId(vendor.getVendorId());
                storeSiteInfo.setUpdateTime(new Date());
                storeSiteInfoModel.updateStoreSiteInfo(storeSiteInfo);
            }
        }


        //以下为新增SEO表
        SysSeo sysSeo = new SysSeo();
        sysSeo.setTenant(0L);
        sysSeo.setType(SeoTypeConstant.SEO_TYPE_SHOP);
        sysSeo.setWebSite(webSite);
        sysSeo.setName("店铺SEO");
//        sysSeo.setCode(SeoTypeConstant.SEO_TYPE_SHOP+"_"+vendor.getStoreId());
        sysSeo.setTargetId(vendor.getStoreId());
        sysSeo.setTitle(storeSeoTitle);
        sysSeo.setRemark(storeSeoDesc);
        sysSeo.setKeywords(storeSeoKeyword);

        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = simpleDateFormat.format(date);

        //判断此条seoId对应的记录是否为空
        SysSeo seoInfo = storeModel.getRecordByTargetIdAndType(sysSeo.getTargetId(), sysSeo.getType(), webSite);
        if(seoInfo !=null){
            sysSeo.setUpdateUid(vendor.getVendorId());
            sysSeo.setUpdateTime(time);
            storeModel.updateSeo(sysSeo,sysSeo.getTargetId(),sysSeo.getType());
//            storeModel.updateSeoByTargetIdAndType(sysSeo,sysSeo.getTargetId(),sysSeo.getType());
        }else{
            sysSeo.setCode(SeoTypeConstant.SEO_TYPE_SHOP + "_" + vendor.getStoreId());
            sysSeo.setCreateUid(vendor.getVendorId());
            sysSeo.setCreateTime(time);
            storeModel.saveSeo(sysSeo);
        }

        //更新店铺简介内容表
//        StoreProfileTextList storeProfileTextList = new StoreProfileTextList();
//        storeProfileTextList.setContent(storeDesc);
//        //查询店铺简介内容表里是否存在这笔数据
//        StoreProfileTextList storeProfileTextInfo = storeProfileTextListModel.getList(vendor.getStoreId());
//        if(storeProfileTextInfo!=null){//更新
//            storeProfileTextList.setUpdateId(vendor.getVendorId());
//            storeProfileTextList.setUpdateTime(new Date());
//            storeProfileTextListModel.updateProfileText(storeProfileTextList,vendor.getStoreId());
//        }else{
//            storeProfileTextList.setStoreId(vendor.getStoreId());
//            storeProfileTextList.setCreateId(vendor.getVendorId());
//            storeProfileTextList.setCreateTime(new Date());
//            storeProfileTextListModel.saveProfileText(storeProfileTextList);
//        }

        return SldResponse.success("设置成功", logMsg);
    }

    @ApiOperation("获取商户首页店铺信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "webSite", value = "站点", dataType = "String", paramType = "query"),
    })
    @GetMapping("indexStoreInfor")
    public JsonResult<StoreIndexInformationVO> getIndexStoreInfor(HttpServletRequest request,@RequestParam(value = "webSite", required = false,defaultValue = "1") String webSite) {
        Vendor vendor = UserUtil.getUser(request, Vendor.class);

        Store store = storeModel.getStoreByStoreId(vendor.getStoreId());
        if (!WebSiteConstant.MEMBER_OVERSEA.equals(webSite)) {
            StoreNameExample storeNameExample = new StoreNameExample();
            storeNameExample.setStoreId(vendor.getStoreId());
            List<StoreName> storeNameList = storeNameModel.getStoreNameList(storeNameExample, null);
            store.setStoreName(CollectionUtils.isEmpty(storeNameList) ? store.getStoreName() : storeNameList.get(0).getStoreName());

            StoreSiteInfoExample storeSiteInfoExample = new StoreSiteInfoExample();
            storeSiteInfoExample.setStoreId(vendor.getStoreId());
            StoreSiteInfo storeSiteInfo = storeSiteInfoModel.getStoreSiteInfo(storeSiteInfoExample);
            if (storeSiteInfo != null) {
                store.setStoreGradeId(storeSiteInfo.getStoreGradeId());
                store.setStoreGradeName(storeSiteInfo.getStoreGradeName());
                store.setStoreExpireTime(storeSiteInfo.getStoreExpireTime());
                store.setStoreLogo(storeSiteInfo.getStoreLogo());
                store.setStoreBannerPc(storeSiteInfo.getStoreBannerPc());
                store.setBusinessState(storeSiteInfo.getBusinessState());
            }
        }
        //店铺默认logo
        if (StringUtils.isEmpty(store.getStoreLogo())) {
            store.setStoreLogo(stringRedisTemplate.opsForValue().get("default_image_store_logo"));
        }
        StoreIndexInformationVO vo = new StoreIndexInformationVO(store, vendor);
        //获取角色名称
        VendorRoles vendorRoles = vendorRolesModel.getVendorRolesByRolesId(vendor.getRolesId());
        vo.setRolesName(vendorRoles.getRolesName());
        vo.setAdminLogoUrl(FileUrlUtil.getFileUrl(stringRedisTemplate.opsForValue().get("main_admin_top_logo"), null));
        return SldResponse.success(vo);
    }
}
