Преглед на файлове

Merge branch 'master' of 450099795/FragrantTown_Server_Local into master

slambb преди 3 години
родител
ревизия
1971d0f32a

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

@@ -131,11 +131,11 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
     public Integer getTimes(String userId) {
         Integer totalcount = DappUtil.getChildrenBuyLandAmount(userId);
         long nowcount = comPlayerLandService.findAllByUserId(userId).stream()
-                .filter(a -> a.getMallType() != null && a.getMallType() > 0).count();
+                .filter(a -> a.getMallType() != null && ArrayUtil.contains(CultivateKeys.mallType,a.getMallType())).count();
         ComExplainLandVo comExplainLandVo = new ComExplainLandVo();
         comExplainLandVo.setUserId(userId);
         Result<List<ComExplainLandVo>> list = comExplainLandService.list(comExplainLandVo);
-        long historycount = list.getData().stream().filter(a -> a.getMallType() != null && a.getMallType() > 0).count();
+        long historycount = list.getData().stream().filter(a -> a.getMallType() != null && ArrayUtil.contains(CultivateKeys.mallType,a.getMallType())).count();
         return totalcount - Convert.toInt(nowcount) - Convert.toInt(historycount);
     }
 

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

@@ -556,12 +556,13 @@ public class ComPlayerGoodsController extends CommonController<ComPlayerGoodsVo,
         if (comMallSeedVo == null) {
             return Result.of(null, false, ResultEnum.SEED_DATA_ERROR.getMessage(), ResultEnum.SEED_DATA_ERROR.getCode());
         }
+        //todo [牧场养殖渔场需求] 如果是养殖类的,计算延期后的成熟期
+        if (ArrayUtil.contains(CultivateKeys.mallType,otherPlayerLand.getMallType())) {
+            Integer days = comPlayerCultivateSerivce.getHarvestDays(userId, otherPlayerLand.getConfigLandId());
+            comMallSeedVo.setMaturity(days);
+        }
         // 判断是否成熟
         Date _harvestTime = DateUtil.getNowDateMinusDay(comMallSeedVo.getMaturity());
-        //todo [牧场养殖渔场需求] 如果是养殖类的,成熟期需要单独计算
-        if (otherPlayerLand.getMallType() > 0) {
-            _harvestTime = comPlayerCultivateSerivce.getHarvestTime(userId, otherPlayerLand.getConfigLandId());
-        }
         // 两个时间差, 逻辑是_harvestTime 时间慢慢接近种植时间
         long diff = otherPlayerLand.getPlantStart().getTime() - _harvestTime.getTime();
         if (diff > 0) {

+ 10 - 9
src/main/java/com/td/boss/game/complayerland/controller/ComPlayerLandController.java

@@ -134,17 +134,17 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
                 // 如果种植了,返回一个种植数据
                 if (comPlayerLandAndPlantVo.getIsPlant().equals(1)) {
                     ComMallSeedVo comMallSeedVo = comMallSeedService.findById(comPlayerLandAndPlantVo.getPlantId());
+                    //todo [牧场养殖渔场需求] 如果是养殖类的,计算延期后的成熟期
+                    if (ArrayUtil.contains(CultivateKeys.mallType,e.getMallType())) {
+                        Integer days = comPlayerCultivateSerivce.getHarvestDays(userId, e.getConfigLandId());
+                        comMallSeedVo.setMaturity(days);
+                    }
                     comPlayerLandAndPlantVo.setSeedInfo(comMallSeedVo);
                     //种子时间
                     //当前时间 > 种植时间+成熟期  = 说明可以收获了
                     //获取当前时间 - 植物的成熟期 = 收获时间,收获时间 >= 种植时间,即可以收获
                     Date _harvestTime = DateUtil.getNowDateMinusDay(comMallSeedVo.getMaturity());
 
-                    //todo [牧场养殖渔场需求] 如果是养殖类的,成熟期需要单独计算
-                    if (ArrayUtil.contains(CultivateKeys.mallType,e.getMallType())) {
-                        _harvestTime = comPlayerCultivateSerivce.getHarvestTime(userId, e.getConfigLandId());
-                    }
-
                     // 两个时间差, 逻辑是_harvestTime 时间慢慢接近种植时间
                     long diff = comPlayerLandAndPlantVo.getPlantStart().getTime() - _harvestTime.getTime();
                     //种植的剩余时间毫秒
@@ -222,15 +222,16 @@ public class ComPlayerLandController extends CommonController<ComPlayerLandVo, C
                 // 如果种植了,返回一个种植数据
                 if (comPlayerLandAndPlantVo.getIsPlant().equals(1)) {
                     ComMallSeedVo comMallSeedVo = comMallSeedService.findById(comPlayerLandAndPlantVo.getPlantId());
+                    //todo [牧场养殖渔场需求] 如果是养殖类的,计算延期后的成熟期
+                    if (ArrayUtil.contains(CultivateKeys.mallType,e.getMallType())) {
+                        Integer days = comPlayerCultivateSerivce.getHarvestDays(userId, e.getConfigLandId());
+                        comMallSeedVo.setMaturity(days);
+                    }
                     comPlayerLandAndPlantVo.setSeedInfo(comMallSeedVo);
                     //种子时间
                     //当前时间 > 种植时间+成熟期  = 说明可以收获了
                     //获取当前时间 - 植物的成熟期 = 收获时间,收获时间 >= 种植时间,即可以收获
                     Date _harvestTime = DateUtil.getNowDateMinusDay(comMallSeedVo.getMaturity());
-                    //todo [牧场养殖渔场需求] 如果是养殖类的,成熟期需要单独计算
-                    if (ArrayUtil.contains(CultivateKeys.mallType,e.getMallType())) {
-                        _harvestTime = comPlayerCultivateSerivce.getHarvestTime(userId, e.getConfigLandId());
-                    }
 
                     // 两个时间差, 逻辑是_harvestTime 时间慢慢接近种植时间
                     long diff = comPlayerLandAndPlantVo.getPlantStart().getTime() - _harvestTime.getTime();