修复充值配置保存失败
This commit is contained in:
parent
252f9cf723
commit
af927ba3ce
|
|
@ -39,7 +39,8 @@ public class MarketingRechargeServiceImpl implements IMarketingRechargeService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void save(MarketingRechargeValidate rechargeValidate) {
|
public void save(MarketingRechargeValidate rechargeValidate) {
|
||||||
|
ConfigUtils.set("recharge", "openRecharge", rechargeValidate.getOpenRecharge().toString());
|
||||||
|
ConfigUtils.set("recharge", "minRechargeMoney", rechargeValidate.getMinRechargeMoney().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,18 +22,15 @@ public class ConfigUtils {
|
||||||
* @return Map<String, String>
|
* @return Map<String, String>
|
||||||
*/
|
*/
|
||||||
public static Map<String, String> get(String type) {
|
public static Map<String, String> get(String type) {
|
||||||
|
|
||||||
// 读取缓存
|
|
||||||
Map<String, String> cache = ConfigCache.get(type);
|
Map<String, String> cache = ConfigCache.get(type);
|
||||||
if (!cache.isEmpty()) {
|
if (!cache.isEmpty()) {
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemConfigMapper model = SpringUtils.getBean(SystemConfigMapper.class);
|
SystemConfigMapper model = SpringUtils.getBean(SystemConfigMapper.class);
|
||||||
|
|
||||||
List<SystemConfig> configs = model.selectList(
|
List<SystemConfig> configs = model.selectList(
|
||||||
new QueryWrapper<SystemConfig>()
|
new QueryWrapper<SystemConfig>()
|
||||||
.select("id", "type", "name", "value")
|
.select("id", "type"+"", "name", "value")
|
||||||
.eq("type", type));
|
.eq("type", type));
|
||||||
|
|
||||||
Map<String, String> map = new LinkedHashMap<>();
|
Map<String, String> map = new LinkedHashMap<>();
|
||||||
|
|
@ -53,19 +50,17 @@ public class ConfigUtils {
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static String get(String type, String name) {
|
public static String get(String type, String name) {
|
||||||
// 获取缓存配置
|
|
||||||
String cache = ConfigCache.get(type, name);
|
String cache = ConfigCache.get(type, name);
|
||||||
if (!StringUtils.isNull(cache) && !StringUtils.isEmpty(cache)) {
|
if (!StringUtils.isNull(cache) && !StringUtils.isEmpty(cache)) {
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemConfigMapper model = SpringUtils.getBean(SystemConfigMapper.class);
|
SystemConfigMapper model = SpringUtils.getBean(SystemConfigMapper.class);
|
||||||
|
|
||||||
SystemConfig config = model.selectOne(
|
SystemConfig config = model.selectOne(
|
||||||
new QueryWrapper<SystemConfig>()
|
new QueryWrapper<SystemConfig>()
|
||||||
.select("id", "type", "name", "value")
|
.select("id", "type", "name", "value")
|
||||||
.eq("type", type)
|
.eq("name", name)
|
||||||
.eq("name", name));
|
.eq("type", type));
|
||||||
|
|
||||||
return config.getValue();
|
return config.getValue();
|
||||||
}
|
}
|
||||||
|
|
@ -79,15 +74,12 @@ public class ConfigUtils {
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static String get(String type, String name, String defaults) {
|
public static String get(String type, String name, String defaults) {
|
||||||
|
|
||||||
// 获取缓存配置
|
|
||||||
String cache = ConfigCache.get(type, name);
|
String cache = ConfigCache.get(type, name);
|
||||||
if (!StringUtils.isNull(cache) && !StringUtils.isEmpty(cache)) {
|
if (!StringUtils.isNull(cache) && !StringUtils.isEmpty(cache)) {
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemConfigMapper model = SpringUtils.getBean(SystemConfigMapper.class);
|
SystemConfigMapper model = SpringUtils.getBean(SystemConfigMapper.class);
|
||||||
|
|
||||||
SystemConfig config = model.selectOne(
|
SystemConfig config = model.selectOne(
|
||||||
new QueryWrapper<SystemConfig>()
|
new QueryWrapper<SystemConfig>()
|
||||||
.select("id", "type", "name", "value")
|
.select("id", "type", "name", "value")
|
||||||
|
|
@ -110,11 +102,8 @@ public class ConfigUtils {
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static Map<String, String> getMap(String type, String name) {
|
public static Map<String, String> getMap(String type, String name) {
|
||||||
|
|
||||||
// 获取缓存
|
|
||||||
String cache = ConfigCache.get(type, name);
|
String cache = ConfigCache.get(type, name);
|
||||||
if (!StringUtils.isNull(cache) && !StringUtils.isEmpty(cache)) {
|
if (!StringUtils.isNull(cache) && !StringUtils.isEmpty(cache)) {
|
||||||
System.out.println("获取到缓存了");
|
|
||||||
return MapUtils.jsonToMap(cache);
|
return MapUtils.jsonToMap(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,7 +136,6 @@ public class ConfigUtils {
|
||||||
*/
|
*/
|
||||||
public static void set(String type, String name, String val) {
|
public static void set(String type, String name, String val) {
|
||||||
SystemConfigMapper model = SpringUtils.getBean(SystemConfigMapper.class);
|
SystemConfigMapper model = SpringUtils.getBean(SystemConfigMapper.class);
|
||||||
|
|
||||||
SystemConfig config = model.selectOne(
|
SystemConfig config = model.selectOne(
|
||||||
new QueryWrapper<SystemConfig>()
|
new QueryWrapper<SystemConfig>()
|
||||||
.eq("type", type)
|
.eq("type", type)
|
||||||
|
|
@ -167,7 +155,7 @@ public class ConfigUtils {
|
||||||
model.insert(systemConfig);
|
model.insert(systemConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置缓存
|
|
||||||
ConfigCache.set();
|
ConfigCache.set();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue