微信支付 问题 调整
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.czg.service.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.system.mapper.SysParamsMapper;
|
||||
@@ -11,11 +13,11 @@ import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 服务层实现。
|
||||
@@ -25,7 +27,6 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@DubboService
|
||||
@CacheConfig(cacheNames = "params")
|
||||
public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams> implements SysParamsService {
|
||||
|
||||
@Override
|
||||
@@ -62,7 +63,10 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(key = "#paramsDTO.paramCode")
|
||||
@Caching(evict = {
|
||||
@CacheEvict(cacheNames = "params:entity", allEntries = true),
|
||||
@CacheEvict(cacheNames = "params", key = "#paramsDTO.paramCode")
|
||||
})
|
||||
public CzgResult<String> updateParams(SysParamsDTO paramsDTO) {
|
||||
// 查询 paramCode 是否存在
|
||||
SysParams sysParams = getOne(new QueryWrapper().eq(SysParams::getParamCode, paramsDTO.getParamCode())
|
||||
@@ -90,7 +94,10 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(key = "#code")
|
||||
@Caching(evict = {
|
||||
@CacheEvict(cacheNames = "params:entity", allEntries = true),
|
||||
@CacheEvict(cacheNames = "params", key = "#code")
|
||||
})
|
||||
public CzgResult<Boolean> deleteParams(String code) {
|
||||
SysParams sysParams = getById(code);
|
||||
if (sysParams == null) {
|
||||
@@ -130,4 +137,18 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
|
||||
}
|
||||
return sysParam.getParamValue();
|
||||
}
|
||||
|
||||
@Cacheable(cacheNames = "params:entity", key = "#type")
|
||||
@Override
|
||||
public Map<String, String> getParamsByMap(String type, Set<String> keyList) throws CzgException{
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (String key : keyList) {
|
||||
SysParams sysParam = getSysParam(key);
|
||||
if (sysParam == null || StrUtil.isBlank(sysParam.getParamValue())) {
|
||||
throw new CzgException(key + "参数不存在");
|
||||
}
|
||||
map.put(key, sysParam.getParamValue());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user