完善系统与APP配置参数功能
This commit is contained in:
parent
a3681f65b3
commit
6c7ebe83bf
@ -16,5 +16,13 @@ public interface ISystemConfigManager {
|
|||||||
|
|
||||||
Map<String, String> getConfig();
|
Map<String, String> getConfig();
|
||||||
|
|
||||||
|
Map<String, String> getSystemConfigParams();
|
||||||
|
|
||||||
|
String getSystemConfigParamsValue(String key);
|
||||||
|
|
||||||
|
Map<String, String> getAppConfigParams();
|
||||||
|
|
||||||
|
String getAppConfigParamsValue(String key);
|
||||||
|
|
||||||
void refreshConfig();
|
void refreshConfig();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package ink.wgink.login.base.manager;
|
package ink.wgink.login.base.manager;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import ink.wgink.exceptions.SearchException;
|
import ink.wgink.exceptions.SearchException;
|
||||||
import ink.wgink.interfaces.manager.ISystemConfigManager;
|
import ink.wgink.interfaces.manager.ISystemConfigManager;
|
||||||
import ink.wgink.login.base.dao.config.IConfigDao;
|
import ink.wgink.login.base.dao.config.IConfigDao;
|
||||||
import ink.wgink.login.base.pojo.dtos.config.ConfigDTO;
|
import ink.wgink.login.base.pojo.dtos.config.ConfigDTO;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -51,6 +53,44 @@ public class ConfigManager implements ISystemConfigManager {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getSystemConfigParams() {
|
||||||
|
Map<String, String> config = getConfig();
|
||||||
|
String systemParams = config.get("systemConfigParams");
|
||||||
|
if (StringUtils.isBlank(systemParams)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSONObject.parseObject(systemParams, Map.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSystemConfigParamsValue(String key) {
|
||||||
|
Map<String, String> systemParams = getSystemConfigParams();
|
||||||
|
if (systemParams == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return systemParams.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getAppConfigParams() {
|
||||||
|
Map<String, String> config = getConfig();
|
||||||
|
String appParams = config.get("appConfigParams");
|
||||||
|
if (StringUtils.isBlank(appParams)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSONObject.parseObject(appParams, Map.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAppConfigParamsValue(String key) {
|
||||||
|
Map<String, String> appParams = getAppConfigParams();
|
||||||
|
if (appParams == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return appParams.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新配置
|
* 刷新配置
|
||||||
*/
|
*/
|
||||||
|
@ -72,6 +72,10 @@ public class ConfigVO {
|
|||||||
@ApiModelProperty(name = "menuMode", value = "菜单模式")
|
@ApiModelProperty(name = "menuMode", value = "菜单模式")
|
||||||
@CheckEmptyAnnotation(name = "菜单模式", types = {"fixedLeft", "floatLeft"})
|
@CheckEmptyAnnotation(name = "菜单模式", types = {"fixedLeft", "floatLeft"})
|
||||||
private String menuMode;
|
private String menuMode;
|
||||||
|
@ApiModelProperty(name = "systemConfigParams", value = "系统配置参数")
|
||||||
|
private String systemConfigParams;
|
||||||
|
@ApiModelProperty(name = "appConfigParams", value = "app配置参数")
|
||||||
|
private String appConfigParams;
|
||||||
|
|
||||||
public String getPasswordValidity() {
|
public String getPasswordValidity() {
|
||||||
return passwordValidity == null ? "" : passwordValidity.trim();
|
return passwordValidity == null ? "" : passwordValidity.trim();
|
||||||
@ -248,4 +252,20 @@ public class ConfigVO {
|
|||||||
public void setSystemShortTitle(String systemShortTitle) {
|
public void setSystemShortTitle(String systemShortTitle) {
|
||||||
this.systemShortTitle = systemShortTitle;
|
this.systemShortTitle = systemShortTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSystemConfigParams() {
|
||||||
|
return systemConfigParams == null ? "" : systemConfigParams.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSystemConfigParams(String systemConfigParams) {
|
||||||
|
this.systemConfigParams = systemConfigParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppConfigParams() {
|
||||||
|
return appConfigParams == null ? "" : appConfigParams.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppConfigParams(String appConfigParams) {
|
||||||
|
this.appConfigParams = appConfigParams;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@
|
|||||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||||
<a href="javascript:void(0);"><cite>系统参数配置(参数名唯一且只能是字母、数字与下划线的组合)</cite></a>
|
<a href="javascript:void(0);"><cite>系统参数配置(参数名唯一且只能是字母、数字与下划线的组合)</cite></a>
|
||||||
</span>
|
</span>
|
||||||
<button id="systemParamsPlusBtn" type="button" class="layui-btn layui-btn-xs" style="float: right; margin-top: 12px;">
|
<button id="systemConfigParamsPlusBtn" type="button" class="layui-btn layui-btn-xs" style="float: right; margin-top: 12px;">
|
||||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -275,7 +275,7 @@
|
|||||||
<th style="text-align: center;">操作</th>
|
<th style="text-align: center;">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="systemParamsBody"></tbody>
|
<tbody id="systemConfigParamsBody"></tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -285,7 +285,7 @@
|
|||||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||||
<a href="javascript:void(0);"><cite>APP参数配置(参数名唯一且只能是字母、数字与下划线的组合)</cite></a>
|
<a href="javascript:void(0);"><cite>APP参数配置(参数名唯一且只能是字母、数字与下划线的组合)</cite></a>
|
||||||
</span>
|
</span>
|
||||||
<button id="appParamsPlusBtn" type="button" class="layui-btn layui-btn-xs" style="float: right; margin-top: 12px;">
|
<button id="appConfigParamsPlusBtn" type="button" class="layui-btn layui-btn-xs" style="float: right; margin-top: 12px;">
|
||||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -304,7 +304,7 @@
|
|||||||
<th style="text-align: center;">操作</th>
|
<th style="text-align: center;">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="appParamsBody"></tbody>
|
<tbody id="appConfigParamsBody"></tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -380,6 +380,8 @@
|
|||||||
var photoViewer = new Viewer(document.getElementById('photoShow'), {});
|
var photoViewer = new Viewer(document.getElementById('photoShow'), {});
|
||||||
var logoViewer = new Viewer(document.getElementById('logoShow'), {});
|
var logoViewer = new Viewer(document.getElementById('logoShow'), {});
|
||||||
var shortLogoViewer = new Viewer(document.getElementById('shortLogoShow'), {});
|
var shortLogoViewer = new Viewer(document.getElementById('shortLogoShow'), {});
|
||||||
|
var systemConfigParams;
|
||||||
|
var appConfigParams;
|
||||||
|
|
||||||
// 设置logo图片
|
// 设置logo图片
|
||||||
function setLogoTemple() {
|
function setLogoTemple() {
|
||||||
@ -516,8 +518,8 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 系统参数事件
|
// 系统参数配置
|
||||||
function paramsConfigInit(idPrefix, classPrefix, initObj) {
|
function ParamsConfigInit(idPrefix, classPrefix, paramsJsonString) {
|
||||||
var paramsArray = [];
|
var paramsArray = [];
|
||||||
var keyupSetTimeout;
|
var keyupSetTimeout;
|
||||||
|
|
||||||
@ -566,11 +568,6 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
init();
|
|
||||||
|
|
||||||
$(document).on('keyup', '.'+ classPrefix +'-key', function() {
|
$(document).on('keyup', '.'+ classPrefix +'-key', function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var index = this.dataset.index;
|
var index = this.dataset.index;
|
||||||
@ -615,6 +612,31 @@
|
|||||||
paramsArray.splice(index, 1);
|
paramsArray.splice(index, 1);
|
||||||
refreshTr();
|
refreshTr();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.init = function() {
|
||||||
|
if(!paramsJsonString) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var paramsObj = JSON.parse(paramsJsonString);
|
||||||
|
console.log(paramsObj);
|
||||||
|
for(var k in paramsObj) {
|
||||||
|
paramsArray.push({
|
||||||
|
key: k,
|
||||||
|
value: paramsObj[k]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
refreshTr();
|
||||||
|
}
|
||||||
|
this.getConfigParams = function() {
|
||||||
|
var obj = {};
|
||||||
|
for(var i = 0, item; item = paramsArray[i++];) {
|
||||||
|
if(!item.key) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
obj[item.key] = item.value;
|
||||||
|
}
|
||||||
|
return JSON.stringify(obj);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
@ -640,7 +662,7 @@
|
|||||||
uKeyLogin: data.uKeyLogin,
|
uKeyLogin: data.uKeyLogin,
|
||||||
scanCodeLogin: data.scanCodeLogin,
|
scanCodeLogin: data.scanCodeLogin,
|
||||||
loginBoxPosition: data.loginBoxPosition,
|
loginBoxPosition: data.loginBoxPosition,
|
||||||
menuMode: data.menuMode
|
menuMode: data.menuMode,
|
||||||
});
|
});
|
||||||
form.render(null, 'dataForm');
|
form.render(null, 'dataForm');
|
||||||
if(data.systemLogo) {
|
if(data.systemLogo) {
|
||||||
@ -655,8 +677,11 @@
|
|||||||
photos = data.loginBackgroundImages.split(',');
|
photos = data.loginBackgroundImages.split(',');
|
||||||
}
|
}
|
||||||
setBackgroundTemple();
|
setBackgroundTemple();
|
||||||
paramsConfigInit('systemParams', 'system-params', {});
|
systemConfigParams = new ParamsConfigInit('systemConfigParams', 'system-config-params', data.systemConfigParams);
|
||||||
paramsConfigInit('appParams', 'app-params', {});
|
systemConfigParams.init();
|
||||||
|
|
||||||
|
appConfigParams = new ParamsConfigInit('appConfigParams', 'app-config-params', data.appConfigParams);
|
||||||
|
appConfigParams.init();
|
||||||
}, function(code, data) {
|
}, function(code, data) {
|
||||||
top.dialog.msg(data.msg);
|
top.dialog.msg(data.msg);
|
||||||
}, function() {
|
}, function() {
|
||||||
@ -675,6 +700,8 @@
|
|||||||
formData.field.loginBackgroundImages = photos.toString();
|
formData.field.loginBackgroundImages = photos.toString();
|
||||||
formData.field.systemLogo = logos.length > 0 ? logos[0] : '';
|
formData.field.systemLogo = logos.length > 0 ? logos[0] : '';
|
||||||
formData.field.systemShortLogo = shortLogos.length > 0 ? shortLogos[0] : '';
|
formData.field.systemShortLogo = shortLogos.length > 0 ? shortLogos[0] : '';
|
||||||
|
formData.field.systemConfigParams = systemConfigParams.getConfigParams();
|
||||||
|
formData.field.appConfigParams = appConfigParams.getConfigParams();
|
||||||
top.restAjax.put(top.restAjax.path('api/config/updateconfig', []), formData.field, null, function(code, data) {
|
top.restAjax.put(top.restAjax.path('api/config/updateconfig', []), formData.field, null, function(code, data) {
|
||||||
var layerIndex = top.dialog.msg('更新成功', {
|
var layerIndex = top.dialog.msg('更新成功', {
|
||||||
time: 0,
|
time: 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user