package cn.pluss.platform.merchantMenber;

import cn.pluss.platform.api.Result;
import cn.pluss.platform.entity.Fans;
import cn.pluss.platform.entity.MerchantMenber;
import cn.pluss.platform.mapper.MerchantMenberMapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

public interface MerchantMenberService extends IService<MerchantMenber> {

    default MerchantMenber queryMerchantMenber(MerchantMenber merchantMenber) {
        return ((MerchantMenberMapper) getBaseMapper()).queryMerchantMenber(merchantMenber);
    }

    default List<MerchantMenber> queryMerchantMenberList(MerchantMenber merchantMenber) {
        return ((MerchantMenberMapper) getBaseMapper()).queryMerchantMenberList(merchantMenber);
    }

    default void saveMerchantMenber(MerchantMenber merchantMenber) {
        ((MerchantMenberMapper) getBaseMapper()).saveMerchantMenber(merchantMenber);
    }

    default void updateMerchantMenber(MerchantMenber merchantMenber) {
        ((MerchantMenberMapper) getBaseMapper()).updateMerchantMenber(merchantMenber);
    }

    default void deleteMerchantMenber(MerchantMenber merchantMenber) {
        ((MerchantMenberMapper) getBaseMapper()).deleteMerchantMenber(merchantMenber);
    }

    default List<MerchantMenber> queryMerchantMenberPage(Map map) {
        return ((MerchantMenberMapper) getBaseMapper()).queryMerchantMenberPage(map);
    }

    default Integer queryMerchantMenberPageCount(Map map) {
        return ((MerchantMenberMapper) getBaseMapper()).queryMerchantMenberPageCount(map);
    }


    default Double queryMerchantMenberUsableRechargeFee(Map map) {
        return ((MerchantMenberMapper) getBaseMapper()).queryMerchantMenberUsableRechargeFee(map) == null ? 0.0 : ((MerchantMenberMapper) getBaseMapper()).queryMerchantMenberUsableRechargeFee(map);
    }

    default Integer queryMerchantMenberNumByTime(Map map) {
        return ((MerchantMenberMapper) getBaseMapper()).queryMerchantMenberNumByTime(map);
    }

    /**
     * queryMerchantRecharge:(查询商户的账单). <br/>
     *
     * @param merchantCode
     * @param startTime    开始时间
     * @param endTime      结束时间
     * @param orderType    0：会员消费，1：会员充值'
     * @return
     *
     * @author Administrator
     * @since JDK 1.8
     */
    default Double queryMerchantMemberBill(String rechargeType, String orderType, String merchantCode, String startTime, String endTime) {
        return ((MerchantMenberMapper) getBaseMapper()).queryMerchantMemberBill(rechargeType, orderType, merchantCode, startTime, endTime) == null ? 0d : ((MerchantMenberMapper) getBaseMapper()).queryMerchantMemberBill(rechargeType, orderType, merchantCode, startTime, endTime);
    }

    /**
     * queryMerchantGiveMoney:(赠送返现金额). <br/>
     *
     * @param merchantCode
     * @return
     *
     * @author Administrator
     * @since JDK 1.8
     */
    default Double queryMerchantGiveMoney(String merchantCode) {
        return ((MerchantMenberMapper) getBaseMapper()).queryMerchantGiveMoney(merchantCode) == null ? 0d : ((MerchantMenberMapper) getBaseMapper()).queryMerchantGiveMoney(merchantCode);
    }

    /**
     * manageQueryMerchantMenberPage:(manage). <br/>
     * 所有粉丝
     * @param map
     * @return
     *
     * @author Administrator
     * @since JDK 1.8
     */
    default List<MerchantMenber> manageQueryMerchantMenberPage(Map map) {
        return ((MerchantMenberMapper) getBaseMapper()).manageQueryMerchantMenberPage(map);
    }
    //商户粉丝
    default List<MerchantMenber> manageQueryMerchantNoMenberPage(Map map) {
        return ((MerchantMenberMapper) getBaseMapper()).manageQueryMerchantNoMenberPage(map);
    }

    /**
     * manageQueryMerchantMenberPageCount:(这里用一句话描述这个方法的作用). <br/>
     *
     * @param map
     * @return
     *
     * @author Administrator
     * @since JDK 1.8
     */
    default Integer manageQueryMerchantMenberPageCount(Map map) {
        return ((MerchantMenberMapper) getBaseMapper()).manageQueryMerchantMenberPageCount(map);
    }

    default Integer manageQueryMerchantNoMenberPageCount(Map map) {
        return ((MerchantMenberMapper) getBaseMapper()).manageQueryMerchantNoMenberPageCount(map);
    }

    /**
     * 返回二维码数据, 图片链接
     *
     * @param merchantCode 商户code
     * @param storeId      店铺id
     * @param phone        手机号
     * @param checkCode    验证码
     * @param nickName     昵称
     * @param birthday     生日
     * @return 二维码数据
     */
    String queryMemberIsExist(String merchantCode, String storeId, String phone, String checkCode, String nickName, String birthday);

    /**
     * 返回二维码数据, 链接数据, 需要app上将链接转为二维码
     *
     * @param merchantCode 商户code
     * @param storeId      店铺id
     * @param phone        手机号
     * @param checkCode    验证码
     * @param nickName     昵称
     * @param birthday     生日
     * @return 二维码数据
     */
    String queryMemberIsExistV2(String merchantCode, String storeId, String phone, String checkCode, String nickName, String birthday);

    /**
     * 小程序会员开卡
     * @return
     */
    Result<JSONObject> vipOpenCard(JSONObject json);

    List<MerchantMenber> manageMerchantMenberSum(Map<String, Object> newMemberMap);

    List<String> getTitleTips(List<Map<String, Object>> lists);

    /**
     * 关联查询会员卡列表
     * @param page
     * @param menber
     * @return
     */
    Page<MerchantMenber> pageJoinData(Page<MerchantMenber> page, MerchantMenber menber);

    /**
     * 根据unionId 修改openid
     * @date: 2021/12/9 17:59
     * @param openid
     * @param unionId
     */
    void updateByUnionId(String openid,String unionId);

    /**
     * 发送会员余额变动通知
     * @date: 2021/12/9 18:44
     * @param menber:
     * @param consumeFee:
     * @param type: 1：会员充值 2：消费 3：现金充值
     */
    void sendMenberBalanceChangeNotice(MerchantMenber menber, Double consumeFee, String type);

    /**
     * 根据会员卡号获取会员信息
     * @param cardNo
     * @return
     */
    MerchantMenber getByCardNo(String cardNo);
}

