|
|
@@ -314,24 +314,11 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
|
|
|
return ErrorResult("喂养失败!");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获得养殖类种子实际成熟日期:正常成熟天数+延期天数(一次不喂延迟2天)
|
|
|
- * 成熟时间的具体值 (取时间差(今天-种植当天)-喂的次数)*2
|
|
|
- *
|
|
|
- * @return 延期后的成熟期
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Date getHarvestTime(String userId, Integer configLandId) {
|
|
|
- ComPlayerLand comPlayerLand = comPlayerLandService.findByUserIdAndLandId(userId, configLandId);
|
|
|
- Integer harvestDays = getHarvestDays(userId, configLandId);
|
|
|
- return DateUtil.offset(comPlayerLand.getPlantStart(), DateField.DAY_OF_YEAR, harvestDays);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
- public Integer getHarvestDays(String userId, Integer configLandId) {
|
|
|
+ public Integer getHarvestDays(String userId, Integer configLandId,String plantFlag) {
|
|
|
ComPlayerLand comPlayerLand = comPlayerLandService.findByUserIdAndLandId(userId, configLandId);
|
|
|
//实际上一共喂几次
|
|
|
- long times = cultivateRepository.countComPlayerCultivateByUserIdAndLandTypeAndConfigLandId(userId, comPlayerLand.getMallType(), configLandId);
|
|
|
+ long times = cultivateRepository.countComPlayerCultivateByUserIdAndLandTypeAndConfigLandIdAndPlantFlag(userId, comPlayerLand.getMallType(), configLandId,plantFlag);
|
|
|
//从当天到现在。一共过了几天
|
|
|
long days = DateUtil.betweenDay(new Date(), comPlayerLand.getPlantStart(), true) + 1;
|
|
|
//延期追加天数
|
|
|
@@ -392,7 +379,7 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
|
|
|
ComMallSeedVo comMallSeedVo = comMallSeedService.findById(comPlayerLandAndPlantVo.getPlantId());
|
|
|
//todo [牧场养殖渔场需求] 如果是养殖类的,计算延期后的成熟期
|
|
|
if (ArrayUtil.contains(CultivateKeys.mallType, comPlayerLandAndPlantVo.getMallType())) {
|
|
|
- Integer days = getHarvestDays(comPlayerLandAndPlantVo.getUserId(), comPlayerLandAndPlantVo.getConfigLandId());
|
|
|
+ Integer days = getHarvestDays(comPlayerLandAndPlantVo.getUserId(), comPlayerLandAndPlantVo.getConfigLandId(),comPlayerLandAndPlantVo.getPlantFlag());
|
|
|
comMallSeedVo.setMaturity(days);
|
|
|
|
|
|
//获取并设置今日喂养状态
|