调整全局配置接口
This commit is contained in:
parent
5c63190f1c
commit
b45df0d2ea
|
|
@ -5,9 +5,7 @@ import com.hxkj.admin.service.common.IIndexService;
|
|||
import com.hxkj.common.config.GlobalConfig;
|
||||
import com.hxkj.common.entity.article.Article;
|
||||
import com.hxkj.common.mapper.article.ArticleMapper;
|
||||
import com.hxkj.common.utils.ConfigUtil;
|
||||
import com.hxkj.common.utils.TimeUtil;
|
||||
import com.hxkj.common.utils.UrlUtil;
|
||||
import com.hxkj.common.utils.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -73,21 +71,15 @@ public class IndexServiceImpl implements IIndexService {
|
|||
@Override
|
||||
public Map<String, Object> config() {
|
||||
Map<String, String> website = ConfigUtil.get("website");
|
||||
Map<String, String> copyright = ConfigUtil.get("copyright");
|
||||
String copyright = ConfigUtil.get("website", "copyright", "");
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("lawPrivilege", copyright.getOrDefault("privilege", ""));
|
||||
map.put("lawIcpNumber", copyright.getOrDefault("icpNumber", ""));
|
||||
map.put("lawIcpLink", copyright.getOrDefault("icpLink", ""));
|
||||
map.put("lawGaNumber", copyright.getOrDefault("gaNumber", ""));
|
||||
map.put("lawGaLink", copyright.getOrDefault("gaLink", ""));
|
||||
|
||||
map.put("webName", website.getOrDefault("name", ""));
|
||||
map.put("webLogo", UrlUtil.toAbsoluteUrl(website.getOrDefault("logo", "")));
|
||||
map.put("webFavicon", UrlUtil.toAbsoluteUrl(website.getOrDefault("favicon", "")));
|
||||
map.put("webBackdrop", UrlUtil.toAbsoluteUrl(website.getOrDefault("backdrop", "")));
|
||||
|
||||
map.put("ossDomain", UrlUtil.domain());
|
||||
map.put("copyright", ArrayUtil.stringToListAsMapStr(copyright));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -239,6 +240,9 @@ public class ArrayUtil {
|
|||
* @return Map<String, Object>
|
||||
*/
|
||||
public static List<Map<String, Object>> stringToListAsMapObj(String s) {
|
||||
if (StringUtil.isEmpty(s)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Type type = new TypeToken<List<Map<String, Object>>>() {}.getType();
|
||||
return JSON.parseObject(s, type);
|
||||
}
|
||||
|
|
@ -251,6 +255,9 @@ public class ArrayUtil {
|
|||
* @return Map<String, String>
|
||||
*/
|
||||
public static List<Map<String, String>> stringToListAsMapStr(String s) {
|
||||
if (StringUtil.isEmpty(s)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Type type = new TypeToken<List<Map<String, String>>>() {}.getType();
|
||||
return JSON.parseObject(s, type);
|
||||
}
|
||||
|
|
@ -263,6 +270,9 @@ public class ArrayUtil {
|
|||
* @return List<Long>
|
||||
*/
|
||||
public static List<Integer> objectToListAsLong(Object object) {
|
||||
if (StringUtil.isNull(object)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Type type = new TypeToken<List<Long>>() {}.getType();
|
||||
return JSON.parseObject(JSONObject.toJSONString(object), type);
|
||||
}
|
||||
|
|
@ -275,6 +285,9 @@ public class ArrayUtil {
|
|||
* @return List<Integer>
|
||||
*/
|
||||
public static List<Integer> objectToListAsInt(Object object) {
|
||||
if (StringUtil.isNull(object)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Type type = new TypeToken<List<Integer>>() {}.getType();
|
||||
return JSON.parseObject(JSONObject.toJSONString(object), type);
|
||||
}
|
||||
|
|
@ -287,6 +300,9 @@ public class ArrayUtil {
|
|||
* @return List<String>
|
||||
*/
|
||||
public static List<Integer> objectToListAsStr(Object object) {
|
||||
if (StringUtil.isNull(object)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Type type = new TypeToken<List<String>>() {}.getType();
|
||||
return JSON.parseObject(JSONObject.toJSONString(object), type);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue