|
|
@@ -1,7 +1,9 @@
|
|
|
package com.td.boss.game.complayergoods.controller;
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
import com.td.boss.common.controller.*;
|
|
|
import com.td.boss.common.pojo.Result;
|
|
|
+import com.td.boss.common.service.ComConfigService;
|
|
|
import com.td.boss.config.enums.ResultEnum;
|
|
|
import com.td.boss.game.comexplainland.service.ComExplainLandService;
|
|
|
import com.td.boss.game.comexplainland.vo.ComExplainLandVo;
|
|
|
@@ -35,6 +37,7 @@ import com.td.boss.game.complayers.vo.ComPlayersVo;
|
|
|
import com.td.boss.game.complayersattri.service.ComPlayersAttriService;
|
|
|
import com.td.boss.game.complayersattri.vo.ComPlayersAttriSimpleVo;
|
|
|
import com.td.boss.game.complayersattri.vo.ComPlayersAttriVo;
|
|
|
+import com.td.boss.game.complayersattri.vo.ComPlayersLuckyLandLevelUpVo;
|
|
|
import com.td.boss.game.comsetting.pojo.ComSetting;
|
|
|
import com.td.boss.game.comsetting.service.ComSettingService;
|
|
|
import com.td.boss.game.comsetting.vo.ComSettingVo;
|
|
|
@@ -281,8 +284,8 @@ public class ComPlayerGoodsController extends CommonController<ComPlayerGoodsVo,
|
|
|
Integer _profit = _amount - comPlayerLand.getLeaseMultiple() * comMallSeedVo.getPriceSnb();
|
|
|
// 配置的参数。这里先直接定义
|
|
|
Double profitConfig = comSettingVo.getProfit(), stealRatioMaxConfig = comSettingVo.getStealMaxRatio(), stealRatioMinConfig = comSettingVo.getStealMinRatio(), finallyGetRatioConfig = comSettingVo.getFinalRatio();
|
|
|
-
|
|
|
- Double _profitDouble = _profit.doubleValue();
|
|
|
+ Double landLevelInCome = getLandLevelInCome(comPlayerLand, comMallSeedVo.getPriceSnb());
|
|
|
+ Double _profitDouble = _profit.doubleValue()+landLevelInCome;
|
|
|
Double _residualProfit = DoubleUtil.mul(_profitDouble, DoubleUtil.sub(1d, profitConfig));//如果 profitConfig 0.2,剩余利润就是0.8;
|
|
|
Double _stealAmount = DoubleUtil.sub(_profitDouble, _residualProfit); //可偷取的利润
|
|
|
|
|
|
@@ -525,7 +528,8 @@ public class ComPlayerGoodsController extends CommonController<ComPlayerGoodsVo,
|
|
|
_otherAmount = otherPlayerLand.getLeaseMultiple() * comMallSeedVo.getHarvest3();
|
|
|
}
|
|
|
//todo 拿出计算利润,收获量减去种子的成本(snb)后的百分之30 ,后面需要后台可调整
|
|
|
- Integer _profit = _otherAmount - otherPlayerLand.getLeaseMultiple() * comMallSeedVo.getPriceSnb();
|
|
|
+ Double landLevelInCome = getLandLevelInCome(otherPlayerLand, comMallSeedVo.getPriceSnb());
|
|
|
+ Double _profit = _otherAmount - otherPlayerLand.getLeaseMultiple() * comMallSeedVo.getPriceSnb()+landLevelInCome;
|
|
|
// 配置的参数。这里先直接定义
|
|
|
// 需要根据 狗是否生效,小偷是否装备打狗棒来确定参数
|
|
|
Double profitConfig = _dogWork ? comSettingVo.getProfitDog() : comSettingVo.getProfit(),
|
|
|
@@ -972,6 +976,27 @@ public class ComPlayerGoodsController extends CommonController<ComPlayerGoodsVo,
|
|
|
//
|
|
|
// return Result.of(map);
|
|
|
// }
|
|
|
+ @Autowired
|
|
|
+ private ComConfigService comConfigService;
|
|
|
+ /**
|
|
|
+ * 获得土地级别收益,普通土地最后结果为0
|
|
|
+ * @param comPlayerLand
|
|
|
+ * @param priceSnb
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Double getLandLevelInCome(ComPlayerLand comPlayerLand, Integer priceSnb) {
|
|
|
+ List<ComPlayersLuckyLandLevelUpVo> comPlayersLuckyLandLevelUpVos = comConfigService.selectLandLevel();
|
|
|
+ ComPlayersLuckyLandLevelUpVo first = comPlayersLuckyLandLevelUpVos.stream()
|
|
|
+ .filter(a -> a.getId().equals(comPlayerLand.getLandLevel()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ //土地级别不存在
|
|
|
+ if (first == null) {
|
|
|
+ first = new ComPlayersLuckyLandLevelUpVo();
|
|
|
+ first.setProduct(0);
|
|
|
+ }
|
|
|
+ Integer all = comPlayerLand.getLeaseMultiple() * priceSnb;
|
|
|
+ return Convert.toDouble(all * first.getProduct() * 0.01);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|