summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwangwei <[email protected]>2018-12-21 15:05:27 +0800
committerwangwei <[email protected]>2018-12-21 15:05:27 +0800
commitd007a8d286d9960677a1d492cf5ce913767c6f06 (patch)
treed8d810724fd2c25f08e38b44985022f45dc625f9
parent192b44bb2e2d9ca317641e53b49f45c624aee940 (diff)
通过index页面传参,实现语言的动态切换。
-rw-r--r--src/main/java/com/nis/galaxy/config/MyLoad.java14
-rw-r--r--src/main/java/com/nis/galaxy/web/controller/CfgParam.java61
-rw-r--r--src/main/resources/static/index.html37
3 files changed, 105 insertions, 7 deletions
diff --git a/src/main/java/com/nis/galaxy/config/MyLoad.java b/src/main/java/com/nis/galaxy/config/MyLoad.java
index 8f47530..4d50c68 100644
--- a/src/main/java/com/nis/galaxy/config/MyLoad.java
+++ b/src/main/java/com/nis/galaxy/config/MyLoad.java
@@ -121,11 +121,7 @@ public class MyLoad {
}
}
- @Scheduled(fixedRate = 999999999)
- public void run() {
- if (a++ > 1) {
- return;
- }
+ public void MyloadArea() {
if (ConfigUtil.languageChose == 3) {
listAreaDictInfo.put("1", new AreaDictInfo("1", "Астана"));
listAreaDictInfo.put("2", new AreaDictInfo("1", "Алматы"));
@@ -137,6 +133,14 @@ public class MyLoad {
listAreaDictInfo.put("2", new AreaDictInfo("2", "阿拉木图市"));
}
logger.info("目前地域表为:" + listAreaDictInfo);
+ }
+
+ @Scheduled(fixedRate = 999999999)
+ public void run() {
+ if (a++ > 1) {
+ return;
+ }
+ MyloadArea();
MyLoadService();
MyLoadProtocol();
MyLoadTag();
diff --git a/src/main/java/com/nis/galaxy/web/controller/CfgParam.java b/src/main/java/com/nis/galaxy/web/controller/CfgParam.java
new file mode 100644
index 0000000..feeb36e
--- /dev/null
+++ b/src/main/java/com/nis/galaxy/web/controller/CfgParam.java
@@ -0,0 +1,61 @@
+package com.nis.galaxy.web.controller;
+
+import com.nis.galaxy.config.MyLoad;
+import com.nis.galaxy.template.ForEventsInterface;
+import com.nis.galaxy.util.ConfigUtil;
+import org.apache.ibatis.annotations.Param;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author GouGe
+ * @data 2018/12/21 9:42
+ */
+
+@Controller
+public class CfgParam {
+ protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ @Autowired
+ ForEventsInterface forEventsInterface;
+ @Autowired
+ MyLoad myLoad;
+
+ @RequestMapping("/cfgParam")
+ public String upImage() {
+ return "index";
+ }
+
+ /**
+ * 语言选择配置
+ *
+ * @param language
+ * @return
+ */
+ @RequestMapping(value = "/cfgLanguageParam", method = RequestMethod.GET)
+ @ResponseBody
+ public String cfgLanguageParam(@Param("language") int language) {
+ ConfigUtil.languageChose = language;
+ myLoad.MyloadArea();
+ return "SUCCEED";
+ }
+
+ /**
+ * 设备参数配置修改
+ *
+ * @param request
+ * @return
+ */
+// @RequestMapping(value = "/cfgDeviceParamData", method = RequestMethod.POST)
+// @ResponseBody
+// public String cfgDeviceParamData(HttpServletRequest request) {
+// return "SUCCEED";
+// }
+}
diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html
index 129850f..48f220f 100644
--- a/src/main/resources/static/index.html
+++ b/src/main/resources/static/index.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<head>
<meta charset="UTF-8"/>
- <title>Insert title here</title>
+ <title>配置参数修改、图片上传</title>
</head>
<body>
<form action="/upImageData" enctype="multipart/form-data" method="POST">
@@ -18,7 +18,40 @@
请选择上传的图片:
<input type="file" name="myfile"/><br>
<input type="submit" value="上传" style="width: 50px;height: 25px"/>
- </h3><br>
+ </h3>
+ <br>
+</form>
+<!--
+<form action="/cfgDeviceParamData" enctype="multipart/form-data" method="post">
+ <h3>
+ 地域名称
+ <select name="area" style="align-content: center">
+ <option value="Astana">Astana</option>
+ <option value="Almaty">Almaty</option>
+ </select><br/>
+ 设备名称<br/>
+ <h6>
+ Server<input type="number" name="server"/><br/>
+ CoreSwtich<input type="number" name="coreSwtich"/><br/>
+ AccessSwitch<input type="number" name="accessSwitch"/><br/>
+ Asem<input type="number" name="asem"/><br/>
+ Adc<input type="number" name="adc"/><br/>
+ <input type="reset">
+ <input type="submit">
+ </h6>
+ </h3>
+</form>
+-->
+<form action="/cfgLanguageParam" enctype="multipart/form-data" method="get">
+ <h3>
+ 语言选择<br/>
+ <h5>
+ <input type="radio" name="language" value="1"/>中文
+ <input type="radio" name="language" value="2" checked="checked"/>English
+ <input type="radio" name="language" value="3"/>Русский язык
+ </h5>
+ <input type="submit">
+ </h3>
</form>
</body>
</html> \ No newline at end of file