|
|
@@ -2,9 +2,11 @@ package com.td.boss.game.complayerland.controller;
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.date.DateField;
|
|
|
+import cn.hutool.core.util.ArrayUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.td.boss.common.controller.*;
|
|
|
+import com.td.boss.common.pojo.CultivateKeys;
|
|
|
import com.td.boss.common.pojo.Result;
|
|
|
import com.td.boss.config.enums.ResultEnum;
|
|
|
import com.td.boss.game.comexplainland.service.ComExplainLandService;
|
|
|
@@ -139,7 +141,7 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
|
|
|
Date _harvestTime = DateUtil.getNowDateMinusDay(comMallSeedVo.getMaturity());
|
|
|
|
|
|
//todo [牧场养殖渔场需求] 如果是养殖类的,成熟期需要单独计算
|
|
|
- if (e.getMallType() > 0) {
|
|
|
+ if (ArrayUtil.contains(CultivateKeys.mallType,e.getMallType())) {
|
|
|
_harvestTime = comPlayerCultivateSerivce.getHarvestTime(userId, e.getConfigLandId());
|
|
|
}
|
|
|
|
|
|
@@ -152,8 +154,13 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
|
|
|
comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
|
|
|
comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
|
|
|
|
|
|
+ //todo [枯萎]
|
|
|
+ if(diff*-1/CultivateKeys.dayLong>CultivateKeys.witheredDay){
|
|
|
+ comPlayerLandAndPlantVo.setWithered(true);
|
|
|
+ }
|
|
|
+
|
|
|
//todo [牧场养殖渔场需求]如果不是养殖,是传统种植才会有灾害
|
|
|
- if (e.getMallType() == 0) {
|
|
|
+ if (ArrayUtil.contains(CultivateKeys.mallType,e.getMallType())==false) {
|
|
|
//生成第一次受灾 获取用户土地 getList
|
|
|
_InitFirstDisasterProfit(comPlayerLandAndPlantVo, comMallSeedVo);
|
|
|
}
|
|
|
@@ -221,7 +228,7 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
|
|
|
//获取当前时间 - 植物的成熟期 = 收获时间,收获时间 >= 种植时间,即可以收获
|
|
|
Date _harvestTime = DateUtil.getNowDateMinusDay(comMallSeedVo.getMaturity());
|
|
|
//todo [牧场养殖渔场需求] 如果是养殖类的,成熟期需要单独计算
|
|
|
- if (e.getMallType() > 0) {
|
|
|
+ if (ArrayUtil.contains(CultivateKeys.mallType,e.getMallType())) {
|
|
|
_harvestTime = comPlayerCultivateSerivce.getHarvestTime(userId, e.getConfigLandId());
|
|
|
}
|
|
|
|
|
|
@@ -233,8 +240,12 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
|
|
|
//说明可以收获了
|
|
|
comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
|
|
|
comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
|
|
|
+ //todo [枯萎]
|
|
|
+ if(diff*-1/CultivateKeys.dayLong>CultivateKeys.witheredDay) {
|
|
|
+ comPlayerLandAndPlantVo.setWithered(true);
|
|
|
+ }
|
|
|
//todo [牧场养殖渔场需求]如果不是养殖,是传统种植才会有灾害
|
|
|
- if (e.getMallType() == 0) {
|
|
|
+ if (ArrayUtil.contains(CultivateKeys.mallType,e.getMallType())==false) {
|
|
|
//生成第一次受灾 获取用户土地 getList
|
|
|
_InitFirstDisasterProfit(comPlayerLandAndPlantVo, comMallSeedVo);
|
|
|
}
|
|
|
@@ -373,14 +384,13 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
|
|
|
return Result.of(null, false, ResultEnum.LAND_NOT_LEASE.getMessage(), ResultEnum.LAND_NOT_LEASE.getCode());
|
|
|
}
|
|
|
//todo [牧场养殖渔场需求] 特有业务
|
|
|
- if (comPlayerLand.getMallType() > 0) {
|
|
|
+ if (ArrayUtil.contains(CultivateKeys.mallType,comPlayerLand.getMallType())) {
|
|
|
//如果剩余时间不足。不允许放养
|
|
|
if (comPlayerLand.getLeaseTime().getTime() - (cn.hutool.core.date.DateUtil.date(DateUtil.getNowDate()).offset(DateField.DAY_OF_YEAR, comMallSeedVo.getMaturity())).getTime() < 0) {
|
|
|
return Result.of(null, false, "剩余租赁时间不足!");
|
|
|
}
|
|
|
//验证该土地最大种植数量
|
|
|
- int[] amountlimit = new int[]{50, 100, 200, 200};
|
|
|
- if (amount > amountlimit[comPlayerLand.getMallType() - 1]) {
|
|
|
+ if (amount > CultivateKeys.amountLimit[comPlayerLand.getMallType() - 1]) {
|
|
|
return Result.of(null, false, "超出最大养殖数量!");
|
|
|
}
|
|
|
//lease_multiple租赁倍数 填入实际养殖数量
|
|
|
@@ -470,7 +480,7 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
|
|
|
comPlayerLandAndPlantVo.setLeaseDaysMill(leaseDaysMill);
|
|
|
|
|
|
//todo [牧场养殖渔场需求] 如果是养殖类的,计算延期后的成熟期
|
|
|
- if (comPlayerLand.getMallType() > 0) {
|
|
|
+ if (ArrayUtil.contains(CultivateKeys.mallType,comPlayerLand.getMallType())) {
|
|
|
Integer days = comPlayerCultivateSerivce.getHarvestDays(userId, comPlayerLand.getConfigLandId());
|
|
|
comMallSeedVo.setMaturity(days);
|
|
|
}
|
|
|
@@ -488,12 +498,15 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
|
|
|
//说明可以收获了
|
|
|
comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
|
|
|
comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
|
|
|
+ //todo [枯萎]
|
|
|
+ if(diff*-1/CultivateKeys.dayLong>CultivateKeys.witheredDay) {
|
|
|
+ comPlayerLandAndPlantVo.setWithered(true);
|
|
|
+ }
|
|
|
//todo [牧场养殖渔场需求]如果不是养殖,是传统种植才会有灾害
|
|
|
- if (comPlayerLand.getMallType() > 0) {
|
|
|
+ if (ArrayUtil.contains(CultivateKeys.mallType,comPlayerLand.getMallType())==false) {
|
|
|
//生成第一次受灾 plant
|
|
|
_InitFirstDisasterProfit(comPlayerLandAndPlantVo, comMallSeedVo);
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
comPlayerLandAndPlantVo.setPlantDaysRemaining(DateUtil.getDays(diff).intValue());
|
|
|
comPlayerLandAndPlantVo.setPlantHoursRemaining(DateUtil.getHours(diff).intValue());
|