Commit 9bf841ee authored by zhangfeng's avatar zhangfeng

积分规则触发缓存

parent adc0eb3d
...@@ -10,6 +10,7 @@ import org.springframework.data.redis.core.StringRedisTemplate; ...@@ -10,6 +10,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/** /**
* 会员积分规则 Redis DAO * 会员积分规则 Redis DAO
...@@ -57,7 +58,7 @@ public class ScoreRuleRedisDao { ...@@ -57,7 +58,7 @@ public class ScoreRuleRedisDao {
ScoreRuleOrderVExtraVO scoreRuleOrderVExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleOrderVExtraVO.class); ScoreRuleOrderVExtraVO scoreRuleOrderVExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleOrderVExtraVO.class);
stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), scoreRuleOrderVExtraVO.getTransportType()), JsonUtils.toJsonString(scoreRuleDO)); stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), scoreRuleOrderVExtraVO.getTransportType()), JsonUtils.toJsonString(scoreRuleDO));
} }
stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), null), JsonUtils.toJsonString(scoreRuleDO)); stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), null), JsonUtils.toJsonString(scoreRuleDO),24L, TimeUnit.HOURS);
} }
public void deleteEnableScoreRule(Integer type) { public void deleteEnableScoreRule(Integer type) {
......
...@@ -415,15 +415,11 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -415,15 +415,11 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
if (enableScoreRule == null) { if (enableScoreRule == null) {
return null; return null;
} }
// 校验一下活动开始结束时间
if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) {
return null;
}
scoreRuleRedisDao.setEnableScoreRule(enableScoreRule); scoreRuleRedisDao.setEnableScoreRule(enableScoreRule);
} else { // 校验一下活动开始结束时间
if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) { }
return null; if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) {
} return null;
} }
return enableScoreRule; return enableScoreRule;
} }
...@@ -439,14 +435,10 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -439,14 +435,10 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
if (enableScoreRule == null) { if (enableScoreRule == null) {
return null; return null;
} }
if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) {
return null;
}
scoreRuleRedisDao.setEnableScoreRule(enableScoreRule); scoreRuleRedisDao.setEnableScoreRule(enableScoreRule);
} else { }
if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) { if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) {
return null; return null;
}
} }
return enableScoreRule; return enableScoreRule;
case RECOMMEND: case RECOMMEND:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment