|
@@ -12,6 +12,7 @@ import com.citu.module.menduner.reward.enums.config.PointRuleConfigStatusEnum;
|
|
import com.citu.module.menduner.system.enums.MendunerStatusEnum;
|
|
import com.citu.module.menduner.system.enums.MendunerStatusEnum;
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
|
+import org.springframework.cache.annotation.Caching;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
@@ -20,7 +21,6 @@ import java.util.List;
|
|
|
|
|
|
import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static com.citu.module.menduner.reward.enums.ErrorCodeConstants.POINT_RULE_CONFIG_NOT_EXISTS;
|
|
import static com.citu.module.menduner.reward.enums.ErrorCodeConstants.POINT_RULE_CONFIG_NOT_EXISTS;
|
|
-import static com.citu.module.menduner.reward.enums.ErrorCodeConstants.POINT_RULE_CONFIG_URL_EXISTS;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 积分规则配置 Service 实现类
|
|
* 积分规则配置 Service 实现类
|
|
@@ -36,6 +36,10 @@ public class PointRuleConfigServiceImpl implements PointRuleConfigService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@DSTransactional
|
|
@DSTransactional
|
|
|
|
+ @Caching(evict = {
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, key = "#updateReqVO.url"),
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG_LIST)
|
|
|
|
+ })
|
|
public Long createPointRuleConfig(PointRuleConfigSaveReqVO createReqVO) {
|
|
public Long createPointRuleConfig(PointRuleConfigSaveReqVO createReqVO) {
|
|
// 插入
|
|
// 插入
|
|
PointRuleConfigDO pointRuleConfig = BeanUtils.toBean(createReqVO, PointRuleConfigDO.class);
|
|
PointRuleConfigDO pointRuleConfig = BeanUtils.toBean(createReqVO, PointRuleConfigDO.class);
|
|
@@ -51,7 +55,10 @@ public class PointRuleConfigServiceImpl implements PointRuleConfigService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@DSTransactional
|
|
@DSTransactional
|
|
- @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, key = "#updateReqVO.url")
|
|
|
|
|
|
+ @Caching(evict = {
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, key = "#updateReqVO.url"),
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG_LIST)
|
|
|
|
+ })
|
|
public void updatePointRuleConfig(PointRuleConfigSaveReqVO updateReqVO) {
|
|
public void updatePointRuleConfig(PointRuleConfigSaveReqVO updateReqVO) {
|
|
// 校验存在
|
|
// 校验存在
|
|
validatePointRuleConfigExists(updateReqVO.getId());
|
|
validatePointRuleConfigExists(updateReqVO.getId());
|
|
@@ -67,7 +74,10 @@ public class PointRuleConfigServiceImpl implements PointRuleConfigService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@DSTransactional
|
|
@DSTransactional
|
|
- @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, key = "#id")
|
|
|
|
|
|
+ @Caching(evict = {
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, key = "#id"),
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG_LIST)
|
|
|
|
+ })
|
|
public void deletePointRuleConfig(Long id) {
|
|
public void deletePointRuleConfig(Long id) {
|
|
// 校验存在
|
|
// 校验存在
|
|
validatePointRuleConfigExists(id);
|
|
validatePointRuleConfigExists(id);
|
|
@@ -92,13 +102,15 @@ public class PointRuleConfigServiceImpl implements PointRuleConfigService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Cacheable(value = RedisKeyConstants.POINT_RULE_CONFIG, key = "#url",
|
|
|
|
|
|
+ @Cacheable(value = RedisKeyConstants.POINT_RULE_CONFIG + "#1h", key = "#url",
|
|
unless = "#result == null")
|
|
unless = "#result == null")
|
|
public List<PointRuleConfigDO> getByUrlList(String url) {
|
|
public List<PointRuleConfigDO> getByUrlList(String url) {
|
|
return mapper.selectByUrlAndStatus(url, PointRuleConfigStatusEnum.ENABLE);
|
|
return mapper.selectByUrlAndStatus(url, PointRuleConfigStatusEnum.ENABLE);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Cacheable(value = RedisKeyConstants.POINT_RULE_CONFIG_LIST + "#1h",
|
|
|
|
+ unless = "#result == null")
|
|
public List<PointRuleConfigDO> selectDistinctUrlList() {
|
|
public List<PointRuleConfigDO> selectDistinctUrlList() {
|
|
return mapper.selectDistinctUrlList();
|
|
return mapper.selectDistinctUrlList();
|
|
}
|
|
}
|
|
@@ -115,7 +127,10 @@ public class PointRuleConfigServiceImpl implements PointRuleConfigService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@DSTransactional
|
|
@DSTransactional
|
|
- @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, allEntries = true)
|
|
|
|
|
|
+ @Caching(evict = {
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, allEntries = true),
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG_LIST)
|
|
|
|
+ })
|
|
public boolean enable(List<Long> ids) {
|
|
public boolean enable(List<Long> ids) {
|
|
for (Long id : ids) {
|
|
for (Long id : ids) {
|
|
PointRuleConfigDO configDO = valid(id);
|
|
PointRuleConfigDO configDO = valid(id);
|
|
@@ -130,7 +145,10 @@ public class PointRuleConfigServiceImpl implements PointRuleConfigService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@DSTransactional
|
|
@DSTransactional
|
|
- @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, allEntries = true)
|
|
|
|
|
|
+ @Caching(evict = {
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG, allEntries = true),
|
|
|
|
+ @CacheEvict(value = RedisKeyConstants.POINT_RULE_CONFIG_LIST)
|
|
|
|
+ })
|
|
public boolean disable(List<Long> ids) {
|
|
public boolean disable(List<Long> ids) {
|
|
for (Long id : ids) {
|
|
for (Long id : ids) {
|
|
PointRuleConfigDO configDO = valid(id);
|
|
PointRuleConfigDO configDO = valid(id);
|