|
@@ -179,7 +179,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 (exists(userId, comPlayerLand.getMallType(), configLandId, begin, end)) {
|
|
|
|
|
|
|
+ if (isAnimalEat(userId, comPlayerLand.getMallType(), configLandId, 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();
|
|
@@ -253,7 +253,17 @@ public class ComPlayerCultivateSerivceImpl implements ComPlayerCultivateSerivce
|
|
|
return Convert.toInt(l, 0) + comPlayerLand.getPlantMature() - 1;
|
|
return Convert.toInt(l, 0) + comPlayerLand.getPlantMature() - 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private boolean exists(String userId, Integer landType, Integer configLandId, Date begin, Date end) {
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 是否已经喂养
|
|
|
|
|
+ * @param userId 用户编号
|
|
|
|
|
+ * @param landType 土地类型 具体是养殖、渔场、放养
|
|
|
|
|
+ * @param configLandId
|
|
|
|
|
+ * @param begin
|
|
|
|
|
+ * @param end
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean isAnimalEat(String userId, Integer landType, Integer configLandId, 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) {
|