package com.kmall.api.api;

import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.kmall.api.annotation.IgnoreAuth;
import com.kmall.api.annotation.LoginUser;
import com.kmall.api.dto.GoodsDetailDto;
import com.kmall.api.entity.*;
import com.kmall.api.entity.mk.MkStorePromStatVo;
import com.kmall.api.entity.mk.MkStorePromVo;
import com.kmall.api.service.*;
import com.kmall.api.service.mk.*;
import com.kmall.api.util.ApiBaseAction;
import com.kmall.api.util.ApiPageUtils;
import com.kmall.api.util.StockUtil;
import com.kmall.common.constant.Dict;
import com.kmall.common.utils.Query;
import com.qiniu.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

/**
 * 作者: @author Scott <br>
 * 时间: 2017-08-11 08:32<br>
 * 描述: ApiIndexController <br>
 */
@RestController
@RequestMapping("/api/goods")
public class ApiGoodsController extends ApiBaseAction {
    @Autowired
    private ApiGoodsService goodsService;
    @Autowired
    private ApiGoodsSpecificationService goodsSpecificationService;
    @Autowired
    private ApiProductService productService;
    @Autowired
    private ApiGoodsGalleryService goodsGalleryService;
    @Autowired
    private ApiCategoryService categoryService;
    @Autowired
    private ApiSearchHistoryService searchHistoryService;
    @Autowired
    private ApiRelatedGoodsService relatedGoodsService;
    @Autowired
    private ApiCartService cartService;
    @Autowired
    private ApiAdService apiAdService;
    @Autowired
    private ApiBrandService apiBrandService;
    @Autowired
    private ApiThirdMerchantBizService apiThirdMerchantBizService;
    @Autowired
    private ApiStoreService apiStoreService;
    @Autowired
    private ApiMkStorePromStatService apiMkStorePromStatService;
    @Autowired
    private ApiMkStorePromService apiMkStorePromService;
    @Autowired
    private ApiMkStoreTicketDiscountGoodsService apiMkStoreTicketDiscountGoodsService;
    @Autowired
    private ApiMkStoreCampMinusGoodsService apiMkStoreCampMinusGoodsService;

    /**
     */
    @IgnoreAuth
    @GetMapping("index")
    public Object index(@LoginUser UserVo loginUser) {
        //
        Map param = Maps.newHashMap();
        List<GoodsVo> goodsList = goodsService.queryList(param);
        //
        return toResponsSuccess(goodsList);
    }

    /**
     * 获取sku信息，用于购物车编辑时选择规格
     */
    @IgnoreAuth
    @GetMapping("sku")
    public Object sku(@LoginUser UserVo loginUser, Long goodsId) {
        Map<String, Object> resultObj = Maps.newHashMap();
        //
        GoodsVo goodsVo = goodsService.queryObjectByStoreId(goodsId, getStoreId());
        //
        List<Map> goodsSpecificationEntityList = goodsSpecificationService.queryByGoodsIdGroupByNames(goodsId);
        //
        Map param = Maps.newHashMap();
        param.put("goods_id", goodsId);
        param.put("store_id", getStoreId());
        List<ProductVo> productEntityList = productService.queryList(param);

        CartVo cartVo = cartService.queryObjectByGoodsIdAndUserId(goodsId, getUserId(), getStoreId());
        if(cartVo == null){
            resultObj.put("cartNumber", 0);
        }else{
            resultObj.put("cartNumber", cartVo.getNumber());
        }
        if(goodsVo != null){
            Integer stockNum = StockUtil.setStockNumByGoodsVo(goodsVo);
            resultObj.put("stockNum", stockNum);
        }
        resultObj.put("goodsVo", goodsVo);
        resultObj.put("specificationList", goodsSpecificationEntityList);
        resultObj.put("productList", productEntityList);
        return toResponsSuccess(resultObj);
    }

    /**
     * 商品画廊数据
     */
    @IgnoreAuth
    @GetMapping("goodsGallery")
    public Object goodsGallery(Integer goods_id) {
        Map param = Maps.newHashMap();
        param.put("goods_id", goods_id);
        List<GoodsGalleryVo> gallery = goodsGalleryService.queryList(param);
        return toResponsSuccess(gallery);
    }
    /**
     * 商品详情页数据
     * */
    @GetMapping("details")
    public Object details(Long id, Long referrer,String merchSn,Long storeId,Integer promId) {
        //用户信息
        Long userId = getUserId();
        GoodsVo info = goodsService.queryObjectByStoreId(id, storeId);
        if(info == null){
            return toResponsFail("此商品不存在");
        }
        GoodsDetailDto detailDto = new GoodsDetailDto();
        detailDto.setId(id);
        detailDto.setMerchSn(merchSn);
        detailDto.setPromId(promId);
        detailDto.setReferrer(referrer);
        detailDto.setStoreId(storeId);
        detailDto.setUserId(userId);
        Map<String, Object> resultObj = goodsService.detail(info, detailDto);

        return toResponsSuccess(resultObj);
    }

    /*
     * 　用户转发获取优惠券
     */
    @IgnoreAuth
    @GetMapping("transferCoupon")
    public Object transferCoupon(@LoginUser UserVo loginUser, Long goods_id, Integer send_type, Long referrer) {
        /*Map<String, Object> resultObj = Maps.newHashMap();
        // 记录推荐人是否可以领取红包，用户登录时校验
        Long userId = getUserId();
        try {
            // 是否已经有可用的转发红包
            Map params = Maps.newHashMap();
            params.put("user_id", userId);
            params.put("send_type", send_type);
            params.put("unUsed", true);
            List<CouponVo> enabledCouponVos = apiCouponService.queryUserCoupons(params);
            if ((null == enabledCouponVos || enabledCouponVos.size() == 0)
                    && null != referrer && null != userId) {
                // 获取优惠信息提示
                Map couponParam = Maps.newHashMap();
                couponParam.put("enabled", true);
                Integer[] send_types = new Integer[]{CouponTypeEnum.COUPONTYPE2.getIndex()};
                couponParam.put("send_types", send_types);
                List<CouponVo> couponVos = apiCouponService.queryList(couponParam);
                if (null != couponVos && couponVos.size() > 0) {
                    CouponVo couponVo = couponVos.get(0);
                    Map footprintParam = Maps.newHashMap();
                    footprintParam.put("goods_id", goods_id);
                    footprintParam.put("referrer", referrer);
                    Integer footprintNum = footprintService.queryTotal(footprintParam);
                    if (null != footprintNum && null != couponVo.getMin_transmit_num()
                            && footprintNum > couponVo.getMin_transmit_num()) {
                        apiCouponService.takeCoupon(couponVo, userId, "", 0L, 1);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }*/
        return toResponsSuccess("");
    }

    /**
     * 　获取分类下的商品
     */
    @IgnoreAuth
    @GetMapping("category")
    public Object category(@LoginUser UserVo loginUser, Integer id) {
        Map<String, Object> resultObj = Maps.newHashMap();
        //
        CategoryVo currentCategory = categoryService.queryObject(id);
        //
        CategoryVo parentCategory = categoryService.queryObject(currentCategory.getParent_id());
        Map params = Maps.newHashMap();
        params.put("parent_id", currentCategory.getParent_id());
        List<CategoryVo> brotherCategory = categoryService.queryList(params);
        //
        resultObj.put("currentCategory", currentCategory);
        resultObj.put("parentCategory", parentCategory);
        resultObj.put("brotherCategory", brotherCategory);
        return toResponsSuccess(resultObj);
    }

    /**
     * 　获取品牌下的商品
     */
    @IgnoreAuth
    @GetMapping("brand")
    public Object brand(@LoginUser UserVo loginUser, Integer id) {
        Map<String, Object> resultObj = Maps.newHashMap();
        //
        BrandVo currentBrand = apiBrandService.queryObject(id);
        //
        CategoryVo parentCategory = categoryService.queryObject(currentBrand.getCategoryId());
        Map params = Maps.newHashMap();
        params.put("categoryId", currentBrand.getCategoryId());
        List<BrandVo> brandList = apiBrandService.queryList(params);
        //
        resultObj.put("currentBrand", currentBrand);
        resultObj.put("brandList", brandList);
        return toResponsSuccess(resultObj);
    }

    /**
     * 　　获取商品列表
     */
    @GetMapping("list")
    public Object list(@LoginUser UserVo loginUser, Integer categoryId,
                       Integer brandId, String keyword, Integer isNew, Integer isHot,String goodsBizType,
                       @RequestParam(value = "page", defaultValue = "1") Integer
                               page, @RequestParam(value = "size", defaultValue = "10") Integer size,
                       String sort, String order) {
        Map params = Maps.newHashMap();
        if(org.apache.commons.lang3.StringUtils.isNotEmpty(keyword)){
            try{
                keyword = new String(keyword.getBytes("iso-8859-1"),"utf-8");
            }catch (Exception e){
                logger.error("error:", e);
            }
            params.put("keyword", keyword);
        }
        params.put("brand_id", brandId);
        params.put("is_new", isNew);
        params.put("is_hot", isHot);
        params.put("page", page);
        params.put("limit", size);
//        params.put("order", sort);
//        params.put("sidx", order);
        params.put("goodsBizType", goodsBizType);
        params.put("store_id", getStoreId());
        params.put("notGoodsBizType", true);
        //
        if (null != sort && sort.equals("price")) {
            params.put("sidx", "psr1.retail_price");
            params.put("order", order);
        } else {
            params.put("sidx", "a.id");
            params.put("order", "desc");
        }
        //添加到搜索历史
        if (!StringUtils.isNullOrEmpty(keyword)) {
            SearchHistoryVo searchHistoryVo = new SearchHistoryVo();
            searchHistoryVo.setAdd_time(System.currentTimeMillis() / 1000);
            searchHistoryVo.setKeyword(keyword);
            searchHistoryVo.setUser_id(null != loginUser ? loginUser.getId().toString() : "");
            searchHistoryVo.setFrom("");
            searchHistoryService.save(searchHistoryVo);
        }
        //筛选的分类
        List<CategoryVo> filterCategory = new ArrayList();
        CategoryVo rootCategory = new CategoryVo();
        rootCategory.setId(0);
        rootCategory.setName("全部");
        rootCategory.setChecked(false);
        filterCategory.add(rootCategory);
        //
        params.put("fields", "psr1.category_id");
        params.put("limit", 1);
        List<GoodsVo> goodsVoList = goodsService.queryList(params);
        params.put("limit", size);
        params.remove("fields");
        if (null != goodsVoList && goodsVoList.size() > 0) {
            List<Integer> categoryIds = new ArrayList();
            for (GoodsVo goodsVo : goodsVoList) {
                if (null != goodsVo && null != goodsVo.getCategory_id()) {
                    categoryIds.add(goodsVo.getCategory_id());
                }
            }
            //查找二级分类的parent_id
            Map categoryParam = Maps.newHashMap();
            categoryParam.put("ids", categoryIds);
            categoryParam.put("fields", "parent_id");
            List<CategoryVo> parentCategoryList = categoryService.queryList(categoryParam);
            //
            List<Integer> parentIds = new ArrayList();
            for (CategoryVo categoryEntity : parentCategoryList) {
                parentIds.add(categoryEntity.getParent_id());
            }
            //一级分类
            categoryParam = Maps.newHashMap();
            categoryParam.put("fields", "id,name");
            categoryParam.put("order", "asc");
            categoryParam.put("sidx", "sort_order");
            categoryParam.put("ids", parentIds);
            List<CategoryVo> parentCategory = categoryService.queryList(categoryParam);
            if (null != parentCategory) {
                filterCategory.addAll(parentCategory);
            }
        }
        //查询列表数据
        params.put("fields", "distinct a.id, a.name, a.list_pic_url, psr1.market_price, psr1.retail_price, a.goods_brief");
        params.put("category_parent_id", categoryId);
        Query query = new Query(params);
        List<GoodsVo> goodsList = goodsService.queryList(query);
        int total = goodsService.queryTotal(query);
        ApiPageUtils goodsData = new ApiPageUtils(goodsList, total, query.getLimit(), query.getPage());
        //搜索到的商品
        for (CategoryVo categoryEntity : filterCategory) {
            if (null != categoryId && categoryEntity.getId() == 0 || categoryEntity.getId() == categoryId) {
                categoryEntity.setChecked(true);
            } else {
                categoryEntity.setChecked(false);
            }
        }
        goodsData.setFilterCategory(filterCategory);
        return toResponsSuccess(goodsData);
    }

    /**
     * 　　获取疯狂折扣商品列表
     */
    @IgnoreAuth
    @GetMapping("hotGoodsList")
    public Object hotGoodsList(@LoginUser UserVo loginUser, Integer categoryId,
                               @RequestParam(value = "page", defaultValue = "1") Integer
                                       page, @RequestParam(value = "size", defaultValue = "10") Integer size,
                               String sort, String order) {
        Map reusltObj = Maps.newHashMap();
        //
        Long store_id = getStoreId();
        StoreVo storeVo = apiStoreService.queryObject(store_id);
        ThirdMerchantBizVo thirdMerchantBiz = new ThirdMerchantBizVo();
        if(storeVo != null) {
            thirdMerchantBiz = apiThirdMerchantBizService.getThirdMerchangByCode(storeVo.getThirdPartyMerchCode());
            if (null == thirdMerchantBiz) {
                return toResponsFail("第三方商户为空");
            }
        }
        Map params = Maps.newHashMap();
        //筛选的分类
        List<CategoryVo> filterCategory = new ArrayList();
        CategoryVo rootCategory = new CategoryVo();
        rootCategory.setId(0);
        rootCategory.setName("全部");
        rootCategory.setChecked(true);
        filterCategory.add(rootCategory);
        //
        params.put("fields", "psr1.category_id");
        params.put("is_hot", "1");
        params.put("store_id", store_id);

        List<GoodsVo> goodsEntityList = goodsService.queryList(params);
        params.remove("fields");
        categoryService.getFilterCategory(goodsEntityList, filterCategory);

        params.put("category_parent_id", categoryId);
        params.put("fields", "a.id,a.name,a.goods_brief,a.list_pic_url,psr1.retail_price," +
                "psr1.market_price,b.id as product_id,psr1.stock_num");
        params.put("is_hot", "1");
        params.put("is_delete", 0);
        params.put("store_id", store_id);
        if (!StringUtils.isNullOrEmpty(sort) && !StringUtils.isNullOrEmpty(order)) {
            if (sort.equals("price")) {
                params.put("sidx", "psr1.retail_price");
                params.put("order", order);
            }
        }

        reusltObj.put("filterCategory", filterCategory);
        params.put("isStockShare", thirdMerchantBiz.getIsStockShare());

        params.put("page", page);
        params.put("limit", size);
        Query query = new Query(params);
        List<GoodsVo> hotGoods = goodsService.queryHotGoodsList(query);
        if (null != hotGoods && hotGoods.size() > 0) {
            for (GoodsVo goodsVo : hotGoods) {
                goodsVo.setCart_num(goodsVo.getCart_num()==null?0:goodsVo.getCart_num());
            }
        }
        reusltObj.put("goodsList", hotGoods);

        return toResponsSuccess(reusltObj);
    }

    /**
     * 　　新品首发
     */
    @IgnoreAuth
    @GetMapping("new")
    public Object newAction(@LoginUser UserVo loginUser) {
        Map<String, Object> resultObj = Maps.newHashMap();
        Map bannerInfo = Maps.newHashMap();
        bannerInfo.put("url", "");
        bannerInfo.put("name", "坚持初心，为你寻觅世间好物");
        bannerInfo.put("img_url", "http://yanxuan.nosdn.127.net/8976116db321744084774643a933c5ce.png");
        resultObj.put("bannerInfo", bannerInfo);
        return toResponsSuccess(resultObj);
    }

    /**
     * 　　人气推荐
     */
    @IgnoreAuth
    @GetMapping("hot")
    public Object hot(@LoginUser UserVo loginUser) {
        Map<String, Object> resultObj = Maps.newHashMap();
        //
        Map param = Maps.newHashMap();
        param.put("ad_position_id", 4);
        List<AdVo> adVoList = apiAdService.queryList(param);
        if (null != adVoList && adVoList.size() > 0) {
            Map bannerInfo = Maps.newHashMap();
            bannerInfo.put("url", "");
            bannerInfo.put("name", adVoList.get(0).getName());
            bannerInfo.put("img_url", adVoList.get(0).getImageUrl());
            resultObj.put("bannerInfo", bannerInfo);
        } else {
            Map bannerInfo = Maps.newHashMap();
            bannerInfo.put("url", "");
            bannerInfo.put("name", "大家都在商城选好物");
            bannerInfo.put("img_url", "https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180807/1057182334dfb2.png");
            resultObj.put("bannerInfo", bannerInfo);
        }
        return toResponsSuccess(resultObj);
    }

    /**
     * 　　商品详情页的大家都在看的商品
     */
    @IgnoreAuth
    @GetMapping("related")
    public Object related(@LoginUser UserVo loginUser, Long id,
                          @RequestParam(value = "page", defaultValue = "1") Integer
                                  page, @RequestParam(value = "size", defaultValue = "4") Integer size) {
        Map<String, Object> resultObj = Maps.newHashMap();
        Map param = Maps.newHashMap();
        param.put("goods_id", id);
        param.put("fields", "related_goods_id");
        List<RelatedGoodsVo> relatedGoodsEntityList = relatedGoodsService.queryList(param);

        List<Integer> relatedGoodsIds = new ArrayList();
        for (RelatedGoodsVo relatedGoodsEntity : relatedGoodsEntityList) {
            relatedGoodsIds.add(relatedGoodsEntity.getRelated_goods_id());
        }
        List<Integer> relatedGoods = new ArrayList();
        if (null == relatedGoodsIds || relatedGoods.size() < 1) {
            //查找同分类下的商品
            GoodsVo goodsCategory = goodsService.queryObjectByStoreId(id, getStoreId());
            if (null != goodsCategory) {
                Map paramRelated = Maps.newHashMap();
                paramRelated.put("store_id", getStoreId());
                paramRelated.put("notGoodsBizType", true);
                paramRelated.put("fields", "a.id, a.name, a.list_pic_url, psr1.retail_price,b.id as product_id");
                paramRelated.put("category_id", goodsCategory.getCategory_id());
                paramRelated.put("limit", size);
                paramRelated.put("offset", (page - 1) * size);
                paramRelated.put("sidx", "a.create_time");
                paramRelated.put("order", "desc");
                relatedGoods = goodsService.queryList(paramRelated);
            }
        } else {
            Map paramRelated = Maps.newHashMap();
            paramRelated.put("store_id", getStoreId());
            paramRelated.put("notGoodsBizType", true);
            paramRelated.put("goods_ids", relatedGoodsIds);
            paramRelated.put("fields", "a.id, a.name, a.list_pic_url, psr1.retail_price,b.id as product_id");
            paramRelated.put("limit", size);
            paramRelated.put("offset", (page - 1) * size);
            paramRelated.put("sidx", "a.create_time");
            paramRelated.put("order", "desc");
            relatedGoods = goodsService.queryList(paramRelated);
        }
        resultObj.put("goodsList", relatedGoods);
        return toResponsSuccess(resultObj);
    }

    /**
     * 在售的商品总数
     */
    @IgnoreAuth
    @GetMapping("count")
    public Object count(@LoginUser UserVo loginUser) {
        Map<String, Object> resultObj = Maps.newHashMap();
        Map param = Maps.newHashMap();
        param.put("store_id", getStoreId());
        param.put("notGoodsBizType", true);
        param.put("is_delete", 0);
        param.put("is_on_sale", 1);
        Integer goodsCount = goodsService.queryTotal(param);
        resultObj.put("goodsCount", goodsCount);
        return toResponsSuccess(resultObj);
    }

    /**
     * 　　获取商品列表
     */
    @IgnoreAuth
    @GetMapping("productlist")
    public Object productlist(@LoginUser UserVo loginUser, Integer categoryId,
                              Integer isNew, Integer discount,String goodsBizType,
                              @RequestParam(value = "page", defaultValue = "1") Integer
                                      page, @RequestParam(value = "size", defaultValue = "10") Integer size,
                              String sort, String order) {
        Long storeId = getStoreId();
        Map params = Maps.newHashMap();
        params.put("is_new", isNew);
        params.put("page", page);
        params.put("limit", size);
        params.put("order", sort);
        params.put("sidx", order);
        params.put("store_id", storeId);
        StoreVo storeVo = apiStoreService.queryObject(storeId);
        String isStockShare = "";
        if(storeVo != null) {
            ThirdMerchantBizVo thirdMerchantBiz = apiThirdMerchantBizService.getThirdMerchangByCode(storeVo.getThirdPartyMerchCode());
            if (null == thirdMerchantBiz) {
                return toResponsFail("第三方商户为空");
            }
            isStockShare = thirdMerchantBiz.getIsStockShare();
        }
        //
        if (null != sort && sort.equals("price")) {
            params.put("sidx", "psr1.retail_price");
            params.put("order", order);
        } else if (null != sort && sort.equals("sell") && Dict.isStockShare.item_0.getItem().equalsIgnoreCase(isStockShare)) {
            params.put("sidx", "psr1.sell_volume");
            params.put("order", order);
        } else if (null != sort && sort.equals("sell") && Dict.isStockShare.item_1.getItem().equalsIgnoreCase(isStockShare)) {
            params.put("sidx", "a.sell_volume");
            params.put("order", order);
        } else {
            params.put("sidx", "id");
            params.put("order", "desc");
        }
        // 0不限 1特价 2团购
        if (null != discount && discount == 1) {
            params.put("is_hot", 1);
        } else if (null != discount && discount == 2) {
            params.put("is_group", true);
        }
        params.put("goodsBizType", goodsBizType);
        CategoryVo categoryVo = categoryService.queryObject(categoryId);
        if(categoryVo != null){
            if(categoryVo.getSort_order()!= null && categoryVo.getSort_order()== 0){
            }else{
                params.put("category_parent_id", categoryId);
            }
        }
        //查询列表数据
        Query query = new Query(params);
        List<GoodsVo> goodsList = goodsService.queryCatalogProductList(query);
        int total = goodsService.selectCountByCatalogProductList(query);
        if (null != goodsList && goodsList.size() > 0) {
            for (GoodsVo goodsVo : goodsList) {
                goodsVo.setCart_num(goodsVo.getCart_num()==null?0:goodsVo.getCart_num());
            }
        }
        ApiPageUtils goodsData = new ApiPageUtils(goodsList, total, query.getLimit(), query.getPage());
        return toResponsSuccess(goodsData);
    }

    /**
     * 转发成功记录推广信息转发次数
     * @return
     */
    @IgnoreAuth
    @PostMapping("goodsSaveTransNum")
    public Object goodsSaveTransNum() {
        JSONObject jsonParam = this.getJsonRequest();
        Integer storeId = jsonParam.getInteger("storeId");
        Integer referrer = jsonParam.getInteger("referrer");
        Integer promId = jsonParam.getInteger("promId");
        //记录渠道推广浏览量
        MkStorePromVo mkStorePromVo = apiMkStorePromService.queryObject(promId);
        MkStorePromStatVo mkStorePromStatVo = new MkStorePromStatVo();
        if(mkStorePromVo != null) {
            mkStorePromStatVo.setReferrer(referrer);
            MkStorePromStatVo statVo = apiMkStorePromStatService.queryObjectByPromId(mkStorePromVo.getPromId());
            if(statVo != null){
                Integer transNum = statVo.getTransNum() == null ? 0 : statVo.getTransNum();
                mkStorePromStatVo.setPromStatId(statVo.getPromStatId());
                mkStorePromStatVo.setTransNum(transNum+1);//转发次数
                apiMkStorePromStatService.update(mkStorePromStatVo);
            }else {
                mkStorePromStatVo.setStoreId(storeId);
                mkStorePromStatVo.setPromId(mkStorePromVo.getPromId());
                mkStorePromStatVo.setTransNum(1);//转发次数
                mkStorePromVo.setIsValid("0");
                apiMkStorePromStatService.save(mkStorePromStatVo);
            }
        }
        return toResponsSuccess("");
    }

    /**
     * 门店优惠券商品列表
     * @param loginUser
     * @param storeId
     * @param categoryId
     * @param tickDiscId
     * @param page
     * @param size
     * @param sort
     * @param order
     * @return
     */
    @GetMapping("getStoreTicketDiscountGoodsList")
    public Object getStoreTicketDiscountGoodsList(@LoginUser UserVo loginUser, Integer storeId, Integer categoryId,Integer tickDiscId,
                                                  @RequestParam(value = "page", defaultValue = "1") Integer
                                                          page, @RequestParam(value = "size", defaultValue = "10") Integer size,
                                                  String sort, String order) {
        Map reusltObj = apiMkStoreTicketDiscountGoodsService.getStoreTicketDiscountGoodsList(storeId,categoryId,tickDiscId,page,size,sort,order);
        return toResponsSuccess(reusltObj);
    }


    /**
     * 门店满减满折商品列表
     * @param loginUser
     * @param storeId
     * @param categoryId
     * @param campMinusId
     * @param page
     * @param size
     * @param sort
     * @param order
     * @return
     */
    @GetMapping("getStoreCampMinusGoodsList")
    public Object getStoreCampMinusGoodsList(@LoginUser UserVo loginUser, Integer storeId, Integer categoryId,Integer campMinusId,
                                                  @RequestParam(value = "page", defaultValue = "1") Integer
                                                          page, @RequestParam(value = "size", defaultValue = "10") Integer size,
                                                  String sort, String order) {
        Map reusltObj = apiMkStoreCampMinusGoodsService.getStoreCampMinusGoodsList(storeId,categoryId,campMinusId,page,size,sort,order);
        return toResponsSuccess(reusltObj);
    }

}
