Browse Source

解决养殖成熟后,重新放养后,不用喂养的bug
将枯萎和最大种植数量提到配置中

xst 3 years ago
parent
commit
3177690e85

+ 11 - 6
src/main/java/com/td/boss/common/pojo/CultivateKeys.java

@@ -9,14 +9,19 @@ public class CultivateKeys {
      * 1、牧场 2、养殖 3、渔场淡水区 4、渔场海水区
      * 1、牧场 2、养殖 3、渔场淡水区 4、渔场海水区
      */
      */
     public static final Integer[] mallType = new Integer[]{1, 2, 3, 4};
     public static final Integer[] mallType = new Integer[]{1, 2, 3, 4};
+
+    public static final long dayLong = 1000 * 60 * 60 * 24;
+
     /**
     /**
-     * 土堆分别最大种植数量
+     * 获取土地最大养殖数量。是个数组。对应1234类型
      */
      */
-    public static final int[] amountLimit = new int[]{50, 100, 200, 200};
-
+    public static final String maxAmount = "max_amount";
+    /**
+     * 获取枯萎最大天数
+     */
+    public static final String witheredDay = "withered_day";
     /**
     /**
-     * 超过这个值就枯萎
+     * 获取 喂粮饲料 key
      */
      */
-    public static final int witheredDay=10;
-    public static final long dayLong= 1000*60*60*24;
+    public static final String cultivateFood = "cultivate_food";
 }
 }

+ 2 - 1
src/main/java/com/td/boss/common/service/ComConfigService.java

@@ -9,5 +9,6 @@ public interface ComConfigService {
 
 
     List<ComPlayersLuckyLandLevelUpVo> selectLandLevel();
     List<ComPlayersLuckyLandLevelUpVo> selectLandLevel();
 
 
-    <T> List<T> selectByKey(String key, Class<T> clazz);
+    <T> List<T> selectListByKey(String key, Class<T> clazz);
+    <T> T selectByKey(String key, Class<T> clazz);
 }
 }

+ 11 - 1
src/main/java/com/td/boss/common/service/ComConfigServiceImpl.java

@@ -2,6 +2,7 @@ package com.td.boss.common.service;
 
 
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
 import com.td.boss.common.pojo.ComConfig;
 import com.td.boss.common.pojo.ComConfig;
 import com.td.boss.common.repository.ComConfigRepository;
 import com.td.boss.common.repository.ComConfigRepository;
 import com.td.boss.game.complayersattri.vo.ComPlayersLuckyLandLevelUpVo;
 import com.td.boss.game.complayersattri.vo.ComPlayersLuckyLandLevelUpVo;
@@ -56,7 +57,7 @@ public class ComConfigServiceImpl implements ComConfigService {
     }
     }
 
 
     @Override
     @Override
-    public <T> List<T> selectByKey(String key, Class<T> clazz) {
+    public <T> List<T> selectListByKey(String key, Class<T> clazz) {
         String json = selectByKey(key);
         String json = selectByKey(key);
         if (StrUtil.isBlank(json)) {
         if (StrUtil.isBlank(json)) {
             return new ArrayList<>();
             return new ArrayList<>();
@@ -64,4 +65,13 @@ public class ComConfigServiceImpl implements ComConfigService {
             return JSONUtil.toList(json, clazz);
             return JSONUtil.toList(json, clazz);
         }
         }
     }
     }
+    @Override
+    public <T> T selectByKey(String key, Class<T> clazz) {
+        String json = selectByKey(key);
+        if (StrUtil.isBlank(json)) {
+            return null;
+        } else {
+            return JSON.parseObject(json, clazz);
+        }
+    }
 }
 }

+ 4 - 0
src/main/java/com/td/boss/game/complayercultivate/pojo/ComPlayerCultivate.java

@@ -53,4 +53,8 @@ public class ComPlayerCultivate implements Serializable{
      * 土地租赁截止日期
      * 土地租赁截止日期
      */
      */
     private double snb;
     private double snb;
+    /**
+     * 每次种植生成一个唯一标识
+     */
+    private String plantFlag;
 }
 }

+ 7 - 7
src/main/java/com/td/boss/game/complayercultivate/serivce/ComPlayerCultivateSerivce.java

@@ -55,13 +55,13 @@ public interface ComPlayerCultivateSerivce {
 
 
     /**
     /**
      * 是否已经喂养
      * 是否已经喂养
-     *
-     * @param userId       用户编号
-     * @param landType     土地类型 具体是养殖、渔场、放养
-     * @param configLandId
-     * @param begin
-     * @param end
+     * @param userId 用户编号
+     * @param landType 土地类型 具体是养殖、渔场、放养
+     * @param configLandId 土地配置表id
+     * @param plantFlag 种植唯一标识
+     * @param begin 查询开始时间
+     * @param end 查询截止时间
      * @return
      * @return
      */
      */
-    boolean isAnimalEat(String userId, Integer landType, Integer configLandId, Date begin, Date end);
+    boolean isAnimalEat(String userId, Integer landType, Integer configLandId,String plantFlag, Date begin, Date end) ;
 }
 }

+ 29 - 14
src/main/java/com/td/boss/game/complayercultivate/serivce/ComPlayerCultivateSerivceImpl.java

@@ -108,7 +108,7 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
             comPlayerLand.setMallType(comConfigLand.getMallType());
             comPlayerLand.setMallType(comConfigLand.getMallType());
 
 
             comPlayerLand.setLandDescribe("养殖场租赁,每次租赁日期为1个月.");
             comPlayerLand.setLandDescribe("养殖场租赁,每次租赁日期为1个月.");
-            comPlayerLand.setLeaseMultiple(CultivateKeys.amountLimit[comConfigLand.getMallType() - 1]); // 养殖场倍数,暂时设置最大值
+            comPlayerLand.setLeaseMultiple(getMaxAmount(comConfigLand.getMallType())); // 养殖场倍数,暂时设置最大值
             comPlayerLand.setLeaseDate(4); // 租赁类型改成 4
             comPlayerLand.setLeaseDate(4); // 租赁类型改成 4
             //设置租赁日期,定义一个30天日期
             //设置租赁日期,定义一个30天日期
             comPlayerLand.setLeaseTime(com.td.boss.util.DateUtil.getOldDateAddDay(nowDate,30));
             comPlayerLand.setLeaseTime(com.td.boss.util.DateUtil.getOldDateAddDay(nowDate,30));
@@ -151,8 +151,8 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
             return Result.of(null, false, ResultEnum.LAND_DATA_ERROR.getMessage(), ResultEnum.LAND_DATA_ERROR.getCode());
             return Result.of(null, false, ResultEnum.LAND_DATA_ERROR.getMessage(), ResultEnum.LAND_DATA_ERROR.getCode());
         }
         }
         //不能超过最大值,倍数
         //不能超过最大值,倍数
-        if (CultivateKeys.amountLimit[comPlayerLand.getMallType() - 1] < multiple) {
-            return Result.of(null, false, "最大养殖量:" + CultivateKeys.amountLimit[comPlayerLand.getMallType() - 1], ResultEnum.LAND_MULTIPLE_CONFIG_ERROR.getCode());
+        if (getMaxAmount(comPlayerLand.getMallType()) < multiple) {
+            return Result.of(null, false, "最大养殖量:" + getMaxAmount(comPlayerLand.getMallType()), ResultEnum.LAND_MULTIPLE_CONFIG_ERROR.getCode());
         }
         }
         String _redisKey = "LOCK:COM_PLAYER_CULTIVATE_LAND:" + userId;
         String _redisKey = "LOCK:COM_PLAYER_CULTIVATE_LAND:" + userId;
         long landTime = System.currentTimeMillis() + RedisData.getLandTimeout();
         long landTime = System.currentTimeMillis() + RedisData.getLandTimeout();
@@ -222,7 +222,7 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
             return Result.of(null, false, ResultEnum.LAND_NO_PLANT_ERROR.getMessage(), ResultEnum.LAND_NO_PLANT_ERROR.getCode());
             return Result.of(null, false, ResultEnum.LAND_NO_PLANT_ERROR.getMessage(), ResultEnum.LAND_NO_PLANT_ERROR.getCode());
         }
         }
         //通过判断土地类型,获取喂粮饲料
         //通过判断土地类型,获取喂粮饲料
-        List<ComPlayerCultivateSeedVo> SeedList = comConfigService.selectByKey("cultivate_food", ComPlayerCultivateSeedVo.class);
+        List<ComPlayerCultivateSeedVo> SeedList = comConfigService.selectListByKey(CultivateKeys.cultivateFood, ComPlayerCultivateSeedVo.class);
         ComPlayerCultivateSeedVo seedVo = SeedList.stream().filter(a -> a.getSeedId().equals(comPlayerLand.getMallType())).findFirst().orElse(null);
         ComPlayerCultivateSeedVo seedVo = SeedList.stream().filter(a -> a.getSeedId().equals(comPlayerLand.getMallType())).findFirst().orElse(null);
         if (seedVo == null) {
         if (seedVo == null) {
             return Result.of(null, false, ResultEnum.FOOD_NO_ERROR.getMessage(), ResultEnum.FOOD_NO_ERROR.getCode());
             return Result.of(null, false, ResultEnum.FOOD_NO_ERROR.getMessage(), ResultEnum.FOOD_NO_ERROR.getCode());
@@ -230,7 +230,7 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
         //判断今天是否已经喂过
         //判断今天是否已经喂过
         Date begin = DateUtil.beginOfDay(new Date());
         Date begin = DateUtil.beginOfDay(new Date());
         Date end = DateUtil.endOfDay(new Date());
         Date end = DateUtil.endOfDay(new Date());
-        if (isAnimalEat(userId, comPlayerLand.getMallType(), configLandId, begin, end)) {
+        if (isAnimalEat(userId, comPlayerLand.getMallType(), configLandId,comPlayerLand.getPlantFlag(), begin, end)) {
             return Result.of(null, false, ResultEnum.FOOD_REPEAT_ERROR.getMessage(), ResultEnum.FOOD_REPEAT_ERROR.getCode());
             return Result.of(null, false, ResultEnum.FOOD_REPEAT_ERROR.getMessage(), ResultEnum.FOOD_REPEAT_ERROR.getCode());
         }
         }
         long time = System.currentTimeMillis() + RedisData.getPlayerCultivateBuyFoodTimeout();
         long time = System.currentTimeMillis() + RedisData.getPlayerCultivateBuyFoodTimeout();
@@ -259,6 +259,7 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
             //记录修改的数据
             //记录修改的数据
             comUsersService.save(comUsersVo);
             comUsersService.save(comUsersVo);
 
 
+            //持久化喂养记录
             ComPlayerCultivate comPlayerCultivate = new ComPlayerCultivate();
             ComPlayerCultivate comPlayerCultivate = new ComPlayerCultivate();
             comPlayerCultivate.setLandId(comPlayerLand.getId());
             comPlayerCultivate.setLandId(comPlayerLand.getId());
             comPlayerCultivate.setLandType(comPlayerLand.getMallType());
             comPlayerCultivate.setLandType(comPlayerLand.getMallType());
@@ -268,6 +269,7 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
             comPlayerCultivate.setAmount(buyAmount);
             comPlayerCultivate.setAmount(buyAmount);
             comPlayerCultivate.setActivtyTime(new Date());
             comPlayerCultivate.setActivtyTime(new Date());
             comPlayerCultivate.setSnb(_needPrice);
             comPlayerCultivate.setSnb(_needPrice);
+            comPlayerCultivate.setPlantFlag(comPlayerLand.getPlantFlag());
             cultivateRepository.save(comPlayerCultivate);
             cultivateRepository.save(comPlayerCultivate);
 
 
 
 
@@ -308,16 +310,16 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
 
 
     /**
     /**
      * 是否已经喂养
      * 是否已经喂养
-     *
-     * @param userId       用户编号
-     * @param landType     土地类型 具体是养殖、渔场、放养
-     * @param configLandId
-     * @param begin
-     * @param end
+     * @param userId 用户编号
+     * @param landType 土地类型 具体是养殖、渔场、放养
+     * @param configLandId 土地配置表id
+     * @param plantFlag 种植唯一标识
+     * @param begin 查询开始时间
+     * @param end 查询截止时间
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public boolean isAnimalEat(String userId, Integer landType, Integer configLandId, Date begin, Date end) {
+    public boolean isAnimalEat(String userId, Integer landType, Integer configLandId,String plantFlag, Date begin, Date end) {
         Specification specification = new Specification<ComPlayerDisaster>() {
         Specification specification = new Specification<ComPlayerDisaster>() {
             @Override
             @Override
             public Predicate toPredicate(Root<ComPlayerDisaster> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
             public Predicate toPredicate(Root<ComPlayerDisaster> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
@@ -326,6 +328,7 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
                 predicates.add(criteriaBuilder.equal(root.get("userId"), userId));
                 predicates.add(criteriaBuilder.equal(root.get("userId"), userId));
                 predicates.add(criteriaBuilder.equal(root.get("landType"), landType));
                 predicates.add(criteriaBuilder.equal(root.get("landType"), landType));
                 predicates.add(criteriaBuilder.equal(root.get("configLandId"), configLandId));
                 predicates.add(criteriaBuilder.equal(root.get("configLandId"), configLandId));
+                predicates.add(criteriaBuilder.equal(root.get("plantFlag"), plantFlag));
                 return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
                 return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
             }
             }
         };
         };
@@ -362,7 +365,7 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
                 //获取并设置今日喂养状态
                 //获取并设置今日喂养状态
                 Date begin = cn.hutool.core.date.DateUtil.beginOfDay(new Date());
                 Date begin = cn.hutool.core.date.DateUtil.beginOfDay(new Date());
                 Date end = cn.hutool.core.date.DateUtil.endOfDay(new Date());
                 Date end = cn.hutool.core.date.DateUtil.endOfDay(new Date());
-                boolean animalEat = isAnimalEat(comPlayerLandAndPlantVo.getUserId(), comPlayerLandAndPlantVo.getMallType(), comPlayerLandAndPlantVo.getConfigLandId(), begin, end);
+                boolean animalEat = isAnimalEat(comPlayerLandAndPlantVo.getUserId(), comPlayerLandAndPlantVo.getMallType(), comPlayerLandAndPlantVo.getConfigLandId(),comPlayerLandAndPlantVo.getPlantFlag(), begin, end);
                 comPlayerLandAndPlantVo.setAnimalEat(animalEat);
                 comPlayerLandAndPlantVo.setAnimalEat(animalEat);
             }
             }
             comPlayerLandAndPlantVo.setSeedInfo(comMallSeedVo);
             comPlayerLandAndPlantVo.setSeedInfo(comMallSeedVo);
@@ -374,7 +377,8 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
                 comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
                 comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
                 comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
                 comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
                 //todo [枯萎]
                 //todo [枯萎]
-                if (diff * -1 / CultivateKeys.dayLong > CultivateKeys.witheredDay) {
+                Integer witheredDay = comConfigService.selectByKey(CultivateKeys.witheredDay, Integer.class);
+                if (diff * -1 / CultivateKeys.dayLong > witheredDay) {
                     comPlayerLandAndPlantVo.setWithered(true);
                     comPlayerLandAndPlantVo.setWithered(true);
                 }
                 }
                 //这里不触发灾害
                 //这里不触发灾害
@@ -390,4 +394,15 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
 
 
         return comPlayerLandAndPlantVo;
         return comPlayerLandAndPlantVo;
     }
     }
+
+    /**
+     * 获取最大种植数量
+     * @param mallType
+     * @return
+     */
+    private Integer getMaxAmount(Integer mallType){
+        //获取配置 土堆分别最大种植数量,对应类型mallType:1、2、3、4的值
+        List<Map> maps = comConfigService.selectListByKey(CultivateKeys.maxAmount, Map.class);
+        return maps.stream().filter(a->a.get("key").equals(mallType)).map(a-> Convert.toInt(a.get("value"),0)).findFirst().orElse(10000);
+    }
 }
 }

+ 5 - 2
src/main/java/com/td/boss/game/complayergoods/controller/ComPlayerGoodsController.java

@@ -255,7 +255,8 @@ public class ComPlayerGoodsController extends CommonController<ComPlayerGoodsVo,
             return Result.of(null, false, ResultEnum.SEED_DATE_ERROR.getMessage(), ResultEnum.SEED_DATE_ERROR.getCode());
             return Result.of(null, false, ResultEnum.SEED_DATE_ERROR.getMessage(), ResultEnum.SEED_DATE_ERROR.getCode());
         } else {
         } else {
             //判断是否枯萎
             //判断是否枯萎
-            isWithered = diff * -1 / CultivateKeys.dayLong > CultivateKeys.witheredDay;
+            Integer witheredDay = comConfigService.selectByKey(CultivateKeys.witheredDay, Integer.class);
+            isWithered = diff * -1 / CultivateKeys.dayLong > witheredDay;
         }
         }
         //获取数据库相关配置
         //获取数据库相关配置
         ComSettingVo comSettingVo = comSettingService.get("1").getData();
         ComSettingVo comSettingVo = comSettingService.get("1").getData();
@@ -575,6 +576,8 @@ public class ComPlayerGoodsController extends CommonController<ComPlayerGoodsVo,
             Integer days = comPlayerCultivateSerivce.getHarvestDays(otherUserId, otherPlayerLand.getConfigLandId());
             Integer days = comPlayerCultivateSerivce.getHarvestDays(otherUserId, otherPlayerLand.getConfigLandId());
             comMallSeedVo.setMaturity(days);
             comMallSeedVo.setMaturity(days);
         }
         }
+        Integer witheredDay = comConfigService.selectByKey( CultivateKeys.witheredDay, Integer.class);
+
         // 判断是否成熟
         // 判断是否成熟
         Date _harvestTime = DateUtil.getNowDateMinusDay(comMallSeedVo.getMaturity());
         Date _harvestTime = DateUtil.getNowDateMinusDay(comMallSeedVo.getMaturity());
         // 两个时间差, 逻辑是_harvestTime 时间慢慢接近种植时间
         // 两个时间差, 逻辑是_harvestTime 时间慢慢接近种植时间
@@ -584,7 +587,7 @@ public class ComPlayerGoodsController extends CommonController<ComPlayerGoodsVo,
             return Result.of(null, false, ResultEnum.SEED_DATE_ERROR.getMessage(), ResultEnum.SEED_DATE_ERROR.getCode());
             return Result.of(null, false, ResultEnum.SEED_DATE_ERROR.getMessage(), ResultEnum.SEED_DATE_ERROR.getCode());
         }
         }
         //todo [枯萎] 超过一定时间不收取 就枯萎
         //todo [枯萎] 超过一定时间不收取 就枯萎
-        else if (diff < 0 && diff * -1 / CultivateKeys.dayLong > CultivateKeys.witheredDay) {
+        else if (diff < 0 && diff * -1 / CultivateKeys.dayLong >witheredDay) {
             return Result.of(null, false, ResultEnum.SEED_LAND_WITHERED.getMessage(), ResultEnum.SEED_LAND_WITHERED.getCode());
             return Result.of(null, false, ResultEnum.SEED_LAND_WITHERED.getMessage(), ResultEnum.SEED_LAND_WITHERED.getCode());
         }
         }
 
 

+ 22 - 5
src/main/java/com/td/boss/game/complayerland/controller/ComPlayerLandController.java

@@ -8,6 +8,7 @@ import cn.hutool.json.JSONUtil;
 import com.td.boss.common.controller.*;
 import com.td.boss.common.controller.*;
 import com.td.boss.common.pojo.CultivateKeys;
 import com.td.boss.common.pojo.CultivateKeys;
 import com.td.boss.common.pojo.Result;
 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.config.enums.ResultEnum;
 import com.td.boss.game.comexplainland.service.ComExplainLandService;
 import com.td.boss.game.comexplainland.service.ComExplainLandService;
 import com.td.boss.game.comexplainland.vo.ComExplainLandVo;
 import com.td.boss.game.comexplainland.vo.ComExplainLandVo;
@@ -71,6 +72,8 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
     private ComPlayerCultivateSerivce comPlayerCultivateSerivce;
     private ComPlayerCultivateSerivce comPlayerCultivateSerivce;
     @Autowired
     @Autowired
     private ComPlayerProfitService comPlayerProfitService;
     private ComPlayerProfitService comPlayerProfitService;
+    @Autowired
+    private ComConfigService comConfigService;
 
 
     @Autowired
     @Autowired
     private RedisLock redisLock;
     private RedisLock redisLock;
@@ -142,7 +145,7 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
                         //获取并设置今日喂养状态
                         //获取并设置今日喂养状态
                         Date begin = cn.hutool.core.date.DateUtil.beginOfDay(new Date());
                         Date begin = cn.hutool.core.date.DateUtil.beginOfDay(new Date());
                         Date end = cn.hutool.core.date.DateUtil.endOfDay(new Date());
                         Date end = cn.hutool.core.date.DateUtil.endOfDay(new Date());
-                        boolean animalEat = comPlayerCultivateSerivce.isAnimalEat(userId, e.getMallType(), e.getConfigLandId(), begin, end);
+                        boolean animalEat = comPlayerCultivateSerivce.isAnimalEat(userId, e.getMallType(), e.getConfigLandId(),e.getPlantFlag(), begin, end);
                         comPlayerLandAndPlantVo.setAnimalEat(animalEat);
                         comPlayerLandAndPlantVo.setAnimalEat(animalEat);
                     }
                     }
                     comPlayerLandAndPlantVo.setSeedInfo(comMallSeedVo);
                     comPlayerLandAndPlantVo.setSeedInfo(comMallSeedVo);
@@ -161,7 +164,8 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
                         comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
                         comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
 
 
                         //todo [枯萎]
                         //todo [枯萎]
-                        if(diff*-1/CultivateKeys.dayLong>CultivateKeys.witheredDay){
+                        Integer witheredDay = comConfigService.selectByKey(CultivateKeys.witheredDay, Integer.class);
+                        if(diff*-1/CultivateKeys.dayLong>witheredDay){
                             comPlayerLandAndPlantVo.setWithered(true);
                             comPlayerLandAndPlantVo.setWithered(true);
                         }
                         }
 
 
@@ -248,7 +252,8 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
                         comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
                         comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
                         comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
                         comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
                         //todo [枯萎]
                         //todo [枯萎]
-                        if(diff*-1/CultivateKeys.dayLong>CultivateKeys.witheredDay) {
+                        Integer witheredDay = comConfigService.selectByKey(CultivateKeys.witheredDay, Integer.class);
+                        if(diff*-1/CultivateKeys.dayLong>witheredDay) {
                             comPlayerLandAndPlantVo.setWithered(true);
                             comPlayerLandAndPlantVo.setWithered(true);
                         }
                         }
                         //todo [牧场养殖渔场需求]如果不是养殖,是传统种植才会有灾害
                         //todo [牧场养殖渔场需求]如果不是养殖,是传统种植才会有灾害
@@ -397,7 +402,7 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
                     return Result.of(null, false, "剩余租赁时间不足!");
                     return Result.of(null, false, "剩余租赁时间不足!");
                 }
                 }
                 //验证该土地最大种植数量
                 //验证该土地最大种植数量
-                if (comPlayerLand.getLeaseMultiple() > CultivateKeys.amountLimit[comPlayerLand.getMallType() - 1]) {
+                if (comPlayerLand.getLeaseMultiple() > getMaxAmount(comPlayerLand.getMallType())) {
                     return Result.of(null, false, "超出最大养殖数量!");
                     return Result.of(null, false, "超出最大养殖数量!");
                 }
                 }
                 //lease_multiple租赁倍数 填入实际养殖数量
                 //lease_multiple租赁倍数 填入实际养殖数量
@@ -506,7 +511,8 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
                 comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
                 comPlayerLandAndPlantVo.setPlantDaysRemaining(0);
                 comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
                 comPlayerLandAndPlantVo.setPlantHoursRemaining(0);
                 //todo [枯萎]
                 //todo [枯萎]
-                if(diff*-1/CultivateKeys.dayLong>CultivateKeys.witheredDay) {
+                Integer witheredDay = comConfigService.selectByKey(CultivateKeys.witheredDay, Integer.class);
+                if(diff*-1/CultivateKeys.dayLong>witheredDay) {
                     comPlayerLandAndPlantVo.setWithered(true);
                     comPlayerLandAndPlantVo.setWithered(true);
                 }
                 }
                 //todo [牧场养殖渔场需求]如果不是养殖,是传统种植才会有灾害
                 //todo [牧场养殖渔场需求]如果不是养殖,是传统种植才会有灾害
@@ -665,4 +671,15 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
         }
         }
 
 
     }
     }
+
+    /**
+     * 获取最大种植数量
+     * @param mallType
+     * @return
+     */
+    private Integer getMaxAmount(Integer mallType){
+        //获取配置 土堆分别最大种植数量,对应类型mallType:1、2、3、4的值
+        List<Map> maps = comConfigService.selectListByKey(CultivateKeys.maxAmount, Map.class);
+        return maps.stream().filter(a->a.get("key").equals(mallType)).map(a-> Convert.toInt(a.get("value"),0)).findFirst().orElse(10000);
+    }
 }
 }