package com.td.boss.game.complayerprofit.service;

import com.td.boss.common.service.CommonService;
import com.td.boss.game.commallseed.vo.ComMallSeedVo;
import com.td.boss.game.complayerland.pojo.ComPlayerLand;
import com.td.boss.game.complayerprofit.pojo.ComPlayerProfit;
import com.td.boss.game.complayerprofit.vo.ComPlayerProfitVo;

import java.util.List;

public interface ComPlayerProfitService extends CommonService<ComPlayerProfitVo, ComPlayerProfit, String> {

    /**
     * 获取被偷取的信息，表里面 targetId 对应自己的用户的 userId
     *
     * @param userId
     * @param plantFlag
     * @param landId
     * @return
     */
    List<ComPlayerProfit> findByUserIdAndPlantFlagAndLandId(String userId, String plantFlag, Integer landId);

    ComPlayerProfit findByUserIdAndPlantFlag(String userId, String plantFlag);

    ComPlayerProfit findByUserIdAndOtherUserIdAndPlantFlag(String userId, String otherUserId, String plantFlag);

    ComPlayerProfit findByUserIdAndTargetIdAndLandIdAndPlantFlag(String userId, String targetId, Integer configLandId, String plantFlag);

    /**
     * 根据灾难类型进行调用，犹豫灾难只发生一次，所以lossType对于flag只有一条数据
     * @param plantFlag
     * @param lossType {2：自然灾难，3：野兽灾难}
     * @return
     */
    ComPlayerProfit findByPlantFlagAndLossTypeAndDsasterId(String plantFlag,Integer lossType,long dsasterId);


    Double getStolenSumByOtherUserIdAndPlantFlagAndLossType(String otherUserId, String plantFlag,Integer lossType);

    /**
     * 必然灾难减扣
     * @param comPlayerLand
     * @param comMallSeedVo
     * @param lossType
     * @param allLossProfit
     * @return
     */
    ComPlayerProfitVo addFirstDisasterAndLoss(ComPlayerLand comPlayerLand, ComMallSeedVo comMallSeedVo, Integer lossType,Double allLossProfit,long _dsasterId);

    ComPlayerProfitVo addOtherDisasterAndLoss(ComPlayerLand comPlayerLand, ComMallSeedVo comMallSeedVo, Integer lossType, Double allLossProfit,Integer disasterCount,long _dsasterId);

}
