package com.sqx.modules.app.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.bo.UpdateMoneyBO;
import com.sqx.modules.app.entity.UserMoney;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.order.entity.TbOrder;
import org.springframework.web.bind.annotation.RequestAttribute;

import java.math.BigDecimal;

public interface UserMoneyService extends IService<UserMoney> {

    UserMoney selectUserMoneyByUserId(Long userId);

    void updateMoney(int i, Long userId, double money);

    Double selectMyProfit(Long userId);

    Result balanceDetailed(@RequestAttribute Long userId, Integer page , Integer limit, Integer classify);

    Result profitDetailed(@RequestAttribute Long userId, IPage ipage);

    Result addUserMoney(Long userId, BigDecimal money, Integer type, String account, String remark);

    Result updateUserBalance(Long userId, BigDecimal money, Integer type);

    Result updateCashDeposit(Long userId, BigDecimal money, Integer type);

    void addConsumeRecord(TbOrder order);

    /**
     * 新增用户余额
     * @param updateMoneyBO 金额变动bo
     * @return
     */
    UserMoneyDetails updateUserMoney(UpdateMoneyBO updateMoneyBO);

    /**
     * 商户分账
     * @param shopId 商铺id
     * @param amount 分账金额
     */
    void splitBill(Long shopId, BigDecimal amount);

    /**
     * 根据用户id查找
     * @param userId 用户id
     * @return 用户钱包
     */
    UserMoney getByUserId(Long userId);
}
