Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9478a26bde
|
|
@ -0,0 +1,286 @@
|
|||
package com.ai.cloud.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.ai.cloud.service.inter.IAlarmRuleSer;
|
||||
import com.ai.cloud.util.Constants;
|
||||
import com.ai.cloud.util.common.StringUtil;
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
@Controller
|
||||
public class AlarmRuleCtl {
|
||||
|
||||
@Autowired
|
||||
IAlarmRuleSer alarmRuleSer;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(AlarmRuleCtl.class);
|
||||
|
||||
/***
|
||||
* 查询用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/default", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String queryUserDefaultAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String json) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setUid(uid);
|
||||
|
||||
ruleMVO = alarmRuleSer.queryUserDefaultAlarmRule(ruleMVO);
|
||||
|
||||
|
||||
if (ruleMVO != null && !StringUtil.isBlank(ruleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "查询到默认数据");
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_DATA, JSON.toJSONString(ruleMVO));
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未查询到默认数据");
|
||||
}
|
||||
|
||||
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
* 查询用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/{appId}", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String queryAppAlarmRule(HttpServletRequest request, ModelMap root, @PathVariable("appId") String appId) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setAppId(appId);
|
||||
ruleMVO.setUid(uid);
|
||||
|
||||
ruleMVO = alarmRuleSer.queryAppAlarmRule(ruleMVO);
|
||||
|
||||
if (ruleMVO != null && !StringUtil.isBlank(ruleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "查询到默认数据");
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_DATA, JSON.toJSONString(ruleMVO));
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未查询到默认数据");
|
||||
}
|
||||
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
* 创建用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/create", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String createAppAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String jsonStr) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
JSONObject json = JSON.parseObject(jsonStr);
|
||||
if(!json.containsKey("isGlobal")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到isGlobal参数信息");
|
||||
}
|
||||
String isGlobal = json.getString("isGlobal");
|
||||
if(!json.containsKey("period")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警间隔参数信息");
|
||||
}
|
||||
String period = json.getString("period");
|
||||
if(!json.containsKey("todoType")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到操作类型参数信息");
|
||||
}
|
||||
String todoType = json.getString("todoType");
|
||||
if(!json.containsKey("todoContent")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
if("1".equals(todoType)){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到回调地址参数信息");
|
||||
}
|
||||
else{
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到邮件模板参数信息");
|
||||
}
|
||||
}
|
||||
String todoContent = json.getString("todoContent");
|
||||
|
||||
AlarmRuleMVO srchRuleMVO = new AlarmRuleMVO();
|
||||
srchRuleMVO.setUid(uid);
|
||||
srchRuleMVO.setSts(Constants.STR_VAL_A);
|
||||
srchRuleMVO.setIsGlobal(isGlobal);
|
||||
|
||||
//判断是否为全局规则
|
||||
if(Constants.IS_GLOBAL_FALG_1.equals(isGlobal)){
|
||||
srchRuleMVO = alarmRuleSer.queryUserDefaultAlarmRule(srchRuleMVO);
|
||||
if (srchRuleMVO != null && !StringUtil.isBlank(srchRuleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "默认告警规则已经存在");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
}else{
|
||||
if(!json.containsKey("appId")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到appId参数信息");
|
||||
return reJson.toJSONString();
|
||||
}else{
|
||||
srchRuleMVO.setAppId(json.getString("appId"));
|
||||
srchRuleMVO = alarmRuleSer.queryAppAlarmRule(srchRuleMVO);
|
||||
if (srchRuleMVO != null && !StringUtil.isBlank(srchRuleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "当前应用已经存在告警规则");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setUid(uid);
|
||||
ruleMVO.setAppId(json.getString("appId"));
|
||||
ruleMVO.setSts(Constants.STR_VAL_A);
|
||||
ruleMVO.setIsGlobal(isGlobal);
|
||||
ruleMVO.setTodoType(todoType);
|
||||
ruleMVO.setTodoContent(todoContent);
|
||||
JSONObject confArgs = new JSONObject();
|
||||
confArgs.put("period", period);
|
||||
ruleMVO.setConfigArgs(confArgs.toJSONString());
|
||||
|
||||
try{
|
||||
ruleMVO = alarmRuleSer.createAlarmRule(ruleMVO);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "操作成功");
|
||||
|
||||
}catch(Exception e){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建告警规则失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
* 创建用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/modify", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String modifyAppAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String jsonStr) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
JSONObject json = JSON.parseObject(jsonStr);
|
||||
if(!json.containsKey("isGlobal")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到isGlobal参数信息");
|
||||
}
|
||||
String isGlobal = json.getString("isGlobal");
|
||||
if(!json.containsKey("period")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警间隔参数信息");
|
||||
}
|
||||
String period = json.getString("period");
|
||||
if(!json.containsKey("todoType")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到操作类型参数信息");
|
||||
}
|
||||
String ruleId = json.getString("ruleId");
|
||||
if(!json.containsKey("ruleId")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警规则参数信息");
|
||||
}
|
||||
String todoType = json.getString("todoType");
|
||||
if(!json.containsKey("todoContent")){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
if("1".equals(todoType)){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到回调地址参数信息");
|
||||
}
|
||||
else{
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到邮件模板参数信息");
|
||||
}
|
||||
}
|
||||
String todoContent = json.getString("todoContent");
|
||||
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setRuleId(ruleId);
|
||||
ruleMVO.setTodoType(todoType);
|
||||
ruleMVO.setTodoContent(todoContent);
|
||||
JSONObject confArgs = new JSONObject();
|
||||
confArgs.put("period", period);
|
||||
ruleMVO.setConfigArgs(confArgs.toJSONString());
|
||||
|
||||
try{
|
||||
ruleMVO = alarmRuleSer.modifyAlarmRule(ruleMVO);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "操作成功");
|
||||
|
||||
}catch(Exception e){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建告警规则失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
package com.ai.cloud.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.ai.cloud.service.inter.IApplicationSer;
|
||||
import com.ai.cloud.util.Constants;
|
||||
import com.ai.cloud.util.common.StringUtil;
|
||||
import com.ai.cloud.vo.mvo.ApplicationInfoMVO;
|
||||
import com.ai.cloud.vo.svo.ApplicationInfoSVO;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 用户应用请求处理
|
||||
*
|
||||
* @author tz
|
||||
* @date 2015年11月10日 下午2:41:30
|
||||
* @version V0.3
|
||||
*/
|
||||
@Controller
|
||||
public class ApplicationCtl {
|
||||
|
||||
@Autowired
|
||||
IApplicationSer applicationSer;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(ApplicationCtl.class);
|
||||
|
||||
/***
|
||||
* 登录后默认页面
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/applist")
|
||||
public String showIndexPage(HttpServletRequest request, ModelMap root) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
if(StringUtil.isBlank(uid)){
|
||||
return "404";
|
||||
}
|
||||
|
||||
List<ApplicationInfoMVO> appList = applicationSer.queryUserAppListByUid(uid);
|
||||
root.put("applist", appList);
|
||||
return "applist";
|
||||
}
|
||||
|
||||
/***
|
||||
* 创建app_code
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/appinfo/create", method = RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String createAppInfo(HttpServletRequest request, ModelMap root, @RequestBody String json) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if(StringUtil.isBlank(uid)){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
JSONObject appJson = JSON.parseObject(json);
|
||||
|
||||
String appCode = null;
|
||||
if(appJson.containsKey("appCode")){
|
||||
appCode = appJson.getString("appCode");
|
||||
}
|
||||
if(StringUtil.isBlank(appCode)){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建应用名称为空");
|
||||
}
|
||||
|
||||
ApplicationInfoSVO appSVO = new ApplicationInfoSVO();
|
||||
appSVO.setAppCode(appCode);
|
||||
appSVO.setUid(uid);
|
||||
appSVO.setSts(Constants.STR_VAL_A);
|
||||
return applicationSer.createApplicationInfo(appSVO);
|
||||
}
|
||||
|
||||
/***
|
||||
* 登录后默认页面
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/appinfo/delete/{appId}", method = RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String deleteAppInfo(HttpServletRequest request, ModelMap root, @PathVariable("appId") String appId) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if(StringUtil.isBlank(uid)){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
if(StringUtil.isBlank(appId)){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "删除应用编码不存在");
|
||||
}
|
||||
|
||||
ApplicationInfoSVO appSVO = new ApplicationInfoSVO();
|
||||
appSVO.setAppId(appId);
|
||||
return applicationSer.delete(appSVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -25,8 +25,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
import com.ai.cloud.service.inter.IQueryTraceLogSer;
|
||||
import com.ai.cloud.service.inter.IUserSer;
|
||||
import com.ai.cloud.util.Constants;
|
||||
import com.ai.cloud.vo.mvo.MenuInfoMVO;
|
||||
import com.ai.cloud.vo.mvo.TraceLogEntry;
|
||||
import com.ai.cloud.vo.mvo.UserInfoMVO;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
|
|
@ -121,10 +123,10 @@ public class HelloSkyWalkingUICtl {
|
|||
return arg0.getColId().compareTo(arg1.getColId());
|
||||
}
|
||||
});
|
||||
int m = 1;
|
||||
for (TraceLogEntry tmpEntry : valueList) {
|
||||
logger.info("sort result level:{} : {}", m++, tmpEntry);
|
||||
}
|
||||
// int m = 1;
|
||||
// for (TraceLogEntry tmpEntry : valueList) {
|
||||
// logger.info("sort result level:{} : {}", m++, tmpEntry);
|
||||
// }
|
||||
long beginTime = valueList.get(0).getStartDate();
|
||||
root.put("traceId", traceId);
|
||||
root.put("valueList", valueList);
|
||||
|
|
@ -172,13 +174,50 @@ public class HelloSkyWalkingUICtl {
|
|||
session.setAttribute("isLogin", "1");
|
||||
session.setAttribute("uid", reUserInfo.getUid());
|
||||
session.setAttribute("userName", reUserInfo.getUserName());
|
||||
session.setAttribute("menuList", "");
|
||||
|
||||
JSONArray menuArr = new JSONArray();
|
||||
List<MenuInfoMVO> menuList = new ArrayList<MenuInfoMVO>();
|
||||
menuList.add(new MenuInfoMVO("1", "应用配置", "applist"));
|
||||
menuArr.addAll(menuList);
|
||||
session.setAttribute("menuList", menuArr.toJSONString());
|
||||
}else{
|
||||
json.put("result", "FAIL");
|
||||
json.put("msg", "用户名或者密码错误");
|
||||
}
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
* 登录页面
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/regist")
|
||||
public String registPage(ModelMap root) throws Exception {
|
||||
return "regist";
|
||||
}
|
||||
|
||||
/***
|
||||
* 登录页面
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
@RequestMapping(value = "/regist/{userName}/{password}", method = RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String registAction(HttpServletRequest request, ModelMap root, @PathVariable("userName") String userName, @PathVariable("password") String password) throws Exception {
|
||||
UserInfoMVO userInfo = new UserInfoMVO();
|
||||
userInfo.setUserName(userName);
|
||||
userInfo.setPassword(password);
|
||||
userInfo.setRoleType(Constants.ROLE_TYPE_USER);
|
||||
userInfo.setSts(Constants.STR_VAL_A);
|
||||
JSONObject reUserInfo = userSer.regist(userInfo);
|
||||
return reUserInfo.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
* 退出
|
||||
|
|
@ -188,8 +227,17 @@ public class HelloSkyWalkingUICtl {
|
|||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/logout")
|
||||
public String logout(ModelMap root) throws Exception {
|
||||
return "traceLog";
|
||||
@ResponseBody
|
||||
public String logout(HttpServletRequest request, ModelMap root) throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
session.removeAttribute("isLogin");
|
||||
session.removeAttribute("uid");
|
||||
session.removeAttribute("userName");
|
||||
session.removeAttribute("menuList");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
json.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "退出成功");
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
|
|||
|
|
@ -0,0 +1,122 @@
|
|||
package com.ai.cloud.dao.impl;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.PreparedStatementCreator;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
||||
import org.springframework.jdbc.support.KeyHolder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ai.cloud.dao.inter.IAlarmRuleMDAO;
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
|
||||
@Repository
|
||||
public class AlarmRuleMDAO implements IAlarmRuleMDAO {
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(AlarmRuleMDAO.class);
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO queryUserDefaultAlarmRule(AlarmRuleMVO rule) {
|
||||
final AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
String sql = "select rule_id,app_id,uid,config_args,is_global,todo_type,todo_content,create_time,sts,modify_time from alarm_rule a where a.uid = ? and a.is_global = '1' and a.sts='A'";
|
||||
final Object[] params = new Object[] { rule.getUid() };
|
||||
jdbcTemplate.query(sql, params, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ruleMVO.setRuleId(rs.getString("rule_id"));
|
||||
ruleMVO.setAppId(rs.getString("app_id"));
|
||||
ruleMVO.setUid(rs.getString("uid"));
|
||||
ruleMVO.setConfigArgs(rs.getString("config_args"));
|
||||
ruleMVO.setIsGlobal(rs.getString("is_global"));
|
||||
ruleMVO.setTodoType(rs.getString("todo_type"));
|
||||
ruleMVO.setTodoContent(rs.getString("todo_content"));
|
||||
ruleMVO.setCreateTime(rs.getTimestamp("create_time"));
|
||||
ruleMVO.setSts(rs.getString("sts"));
|
||||
ruleMVO.setModifyTime(rs.getTimestamp("modify_time"));
|
||||
}
|
||||
});
|
||||
logger.info("result : {}", ruleMVO);
|
||||
return ruleMVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO queryAppAlarmRule(AlarmRuleMVO rule) {
|
||||
final AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
String sql = "select rule_id,app_id,uid,config_args,is_global,todo_type,todo_content,create_time,sts,modify_time from alarm_rule a where a.uid = ? and app_id = ? and a.is_global = '0' and a.sts='A'";
|
||||
final Object[] params = new Object[] { rule.getUid(), rule.getAppId() };
|
||||
jdbcTemplate.query(sql, params, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ruleMVO.setRuleId(rs.getString("rule_id"));
|
||||
ruleMVO.setAppId(rs.getString("app_id"));
|
||||
ruleMVO.setUid(rs.getString("uid"));
|
||||
ruleMVO.setConfigArgs(rs.getString("config_args"));
|
||||
ruleMVO.setIsGlobal(rs.getString("is_global"));
|
||||
ruleMVO.setTodoType(rs.getString("todo_type"));
|
||||
ruleMVO.setTodoContent(rs.getString("todo_content"));
|
||||
ruleMVO.setCreateTime(rs.getTimestamp("create_time"));
|
||||
ruleMVO.setSts(rs.getString("sts"));
|
||||
ruleMVO.setModifyTime(rs.getTimestamp("modify_time"));
|
||||
}
|
||||
});
|
||||
logger.info("result : {}", ruleMVO);
|
||||
return ruleMVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO createAlarmRule(final AlarmRuleMVO ruleMVO) {
|
||||
final String sql = "insert into alarm_rule (app_id,uid,config_args,is_global,todo_type,todo_content,create_time,sts,modify_time) values (?,?,?,?,?,?,sysdate(),?,sysdate())";
|
||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||
|
||||
int count = jdbcTemplate.update(new PreparedStatementCreator() {
|
||||
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
||||
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 0;
|
||||
pstmt.setString(++i, ruleMVO.getAppId());
|
||||
pstmt.setString(++i, ruleMVO.getUid());
|
||||
pstmt.setString(++i, ruleMVO.getConfigArgs());
|
||||
pstmt.setString(++i, ruleMVO.getIsGlobal());
|
||||
pstmt.setString(++i, ruleMVO.getTodoType());
|
||||
pstmt.setString(++i, ruleMVO.getTodoContent());
|
||||
pstmt.setString(++i, ruleMVO.getSts());
|
||||
return pstmt;
|
||||
}
|
||||
}, keyHolder);
|
||||
logger.info("创建应用成功:{}", keyHolder.getKey().intValue());
|
||||
ruleMVO.setRuleId(keyHolder.getKey().toString());
|
||||
|
||||
return ruleMVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO modifyAlarmRule(final AlarmRuleMVO ruleMVO) {
|
||||
final String sql = "update alarm_rule set config_args = ?,todo_type = ?,todo_content = ? where rule_id = ?";
|
||||
|
||||
int count = jdbcTemplate.update(new PreparedStatementCreator() {
|
||||
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
||||
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 0;
|
||||
pstmt.setString(++i, ruleMVO.getConfigArgs());
|
||||
pstmt.setString(++i, ruleMVO.getTodoType());
|
||||
pstmt.setString(++i, ruleMVO.getTodoContent());
|
||||
pstmt.setString(++i, ruleMVO.getRuleId());
|
||||
return pstmt;
|
||||
}
|
||||
});
|
||||
|
||||
return ruleMVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.ai.cloud.dao.impl;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.PreparedStatementCreator;
|
||||
import org.springframework.jdbc.core.PreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
||||
import org.springframework.jdbc.support.KeyHolder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ai.cloud.dao.inter.IApplicationMDAO;
|
||||
import com.ai.cloud.vo.mvo.ApplicationInfoMVO;
|
||||
import com.ai.cloud.vo.svo.ApplicationInfoSVO;
|
||||
|
||||
@Repository
|
||||
public class ApplicationMDAO implements IApplicationMDAO {
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(ApplicationMDAO.class);
|
||||
|
||||
@Override
|
||||
public List<ApplicationInfoMVO> queryAppListByUid(String uid) {
|
||||
String sqlQuery = "select a.app_id,a.uid,a.app_code,a.create_time,a.sts from application_info a where a.uid = ? and a.sts= 'A'";
|
||||
final Object[] params = new Object[] { uid };
|
||||
final List<ApplicationInfoMVO> appList = new ArrayList<ApplicationInfoMVO>();
|
||||
jdbcTemplate.query(sqlQuery, params, new RowCallbackHandler() { // editing
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ApplicationInfoMVO mvo = new ApplicationInfoMVO();
|
||||
mvo.setAppId(rs.getString("app_id"));
|
||||
mvo.setUid(rs.getString("uid"));
|
||||
mvo.setAppCode(rs.getString("app_code"));
|
||||
mvo.setCreateTime(rs.getTimestamp("create_time"));
|
||||
mvo.setSts(rs.getString("sts"));
|
||||
appList.add(mvo);
|
||||
}
|
||||
});
|
||||
|
||||
return appList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationInfoSVO addApplicationInfo(final ApplicationInfoSVO appSVO) {
|
||||
final String sql = "insert into application_info(uid,app_code,create_time,sts) values(?,?,sysdate(),?)";
|
||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||
|
||||
int count = jdbcTemplate.update(new PreparedStatementCreator() {
|
||||
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
||||
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 0;
|
||||
pstmt.setString(++i, appSVO.getUid());
|
||||
pstmt.setString(++i, appSVO.getAppCode());
|
||||
pstmt.setString(++i, appSVO.getSts());
|
||||
return pstmt;
|
||||
}
|
||||
}, keyHolder);
|
||||
logger.info("创建应用成功:{}", keyHolder.getKey().intValue());
|
||||
appSVO.setAppId(keyHolder.getKey().toString());
|
||||
|
||||
return appSVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAppInfoById(final ApplicationInfoSVO appSVO) {
|
||||
String sql = "update application_info set sts = 'P' where app_id = ?";
|
||||
int count = jdbcTemplate.update(sql, new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement pstmt) throws SQLException {
|
||||
pstmt.setString(1, appSVO.getAppId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationInfoMVO> queryUserAppListByAppCode(ApplicationInfoSVO appSVO) {
|
||||
String sqlQuery = "select a.app_id,a.uid,a.app_code,a.create_time,a.sts from application_info a where a.app_code = ? and a.uid= ? and a.sts= 'A'";
|
||||
final Object[] params = new Object[] { appSVO.getAppCode(), appSVO.getUid() };
|
||||
final List<ApplicationInfoMVO> appList = new ArrayList<ApplicationInfoMVO>();
|
||||
jdbcTemplate.query(sqlQuery, params, new RowCallbackHandler() { // editing
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ApplicationInfoMVO mvo = new ApplicationInfoMVO();
|
||||
mvo.setAppId(rs.getString("app_id"));
|
||||
mvo.setUid(rs.getString("uid"));
|
||||
mvo.setAppCode(rs.getString("app_code"));
|
||||
mvo.setCreateTime(rs.getTimestamp("create_time"));
|
||||
mvo.setSts(rs.getString("sts"));
|
||||
appList.add(mvo);
|
||||
}
|
||||
});
|
||||
|
||||
return appList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +1,20 @@
|
|||
package com.ai.cloud.dao.impl;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.PreparedStatementCreator;
|
||||
import org.springframework.jdbc.core.PreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
||||
import org.springframework.jdbc.support.KeyHolder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ai.cloud.dao.inter.IUserInfoMDAO;
|
||||
|
|
@ -15,10 +22,10 @@ import com.ai.cloud.vo.mvo.UserInfoMVO;
|
|||
|
||||
@Repository
|
||||
public class UserInfoMDAO implements IUserInfoMDAO {
|
||||
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
|
||||
private static Logger logger = LogManager.getLogger(UserInfoMDAO.class);
|
||||
|
||||
@Override
|
||||
|
|
@ -28,14 +35,36 @@ public class UserInfoMDAO implements IUserInfoMDAO {
|
|||
final Object[] params = new Object[] { userName };
|
||||
jdbcTemplate.query(sql, params, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
userInfo.setUid(rs.getString("uid"));
|
||||
userInfo.setUserName(rs.getString("user_name"));
|
||||
userInfo.setPassword(rs.getString("password"));
|
||||
}
|
||||
}
|
||||
});
|
||||
logger.info("result : {}", userInfo);
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserInfoMVO addUser(final UserInfoMVO userInfo) {
|
||||
final String sql = "insert into user_info(user_name,password,role_type,create_time,sts,modify_time) values (?,?,?,sysdate(),?,sysdate())";
|
||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||
|
||||
int count = jdbcTemplate.update(new PreparedStatementCreator() {
|
||||
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
||||
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 0;
|
||||
pstmt.setString(++i, userInfo.getUserName());
|
||||
pstmt.setString(++i, userInfo.getPassword());
|
||||
pstmt.setString(++i, userInfo.getRoleType());
|
||||
pstmt.setString(++i, userInfo.getSts());
|
||||
return pstmt;
|
||||
}
|
||||
}, keyHolder);
|
||||
logger.info("用户注册成功:{}", keyHolder.getKey().intValue());
|
||||
|
||||
userInfo.setUid(keyHolder.getKey().toString());
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package com.ai.cloud.dao.inter;
|
||||
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
|
||||
public interface IAlarmRuleMDAO {
|
||||
|
||||
public AlarmRuleMVO queryUserDefaultAlarmRule(AlarmRuleMVO rule);
|
||||
|
||||
public AlarmRuleMVO queryAppAlarmRule(AlarmRuleMVO ruleMVO);
|
||||
|
||||
public AlarmRuleMVO createAlarmRule(AlarmRuleMVO ruleMVO);
|
||||
|
||||
public AlarmRuleMVO modifyAlarmRule(AlarmRuleMVO ruleMVO);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.ai.cloud.dao.inter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ai.cloud.vo.mvo.ApplicationInfoMVO;
|
||||
import com.ai.cloud.vo.svo.ApplicationInfoSVO;
|
||||
|
||||
public interface IApplicationMDAO {
|
||||
|
||||
public List<ApplicationInfoMVO> queryAppListByUid(String uid);
|
||||
|
||||
public ApplicationInfoSVO addApplicationInfo(ApplicationInfoSVO appSVO);
|
||||
|
||||
public List<ApplicationInfoMVO> queryUserAppListByAppCode(ApplicationInfoSVO appCode);
|
||||
|
||||
public void deleteAppInfoById(ApplicationInfoSVO appSVO);
|
||||
}
|
||||
|
|
@ -6,4 +6,6 @@ public interface IUserInfoMDAO {
|
|||
|
||||
public UserInfoMVO queryUserInfoByName(String userName);
|
||||
|
||||
public UserInfoMVO addUser(final UserInfoMVO userInfo);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.ai.cloud.service.impl;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ai.cloud.dao.inter.IAlarmRuleMDAO;
|
||||
import com.ai.cloud.service.inter.IAlarmRuleSer;
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
|
||||
@Service
|
||||
public class AlarmRuleSerImpl implements IAlarmRuleSer {
|
||||
|
||||
@Autowired
|
||||
IAlarmRuleMDAO alarmRuleMDAO;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(ApplicationSerImpl.class);
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO queryUserDefaultAlarmRule(AlarmRuleMVO rule) {
|
||||
return alarmRuleMDAO.queryUserDefaultAlarmRule(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO queryAppAlarmRule(AlarmRuleMVO ruleMVO) {
|
||||
return alarmRuleMDAO.queryAppAlarmRule(ruleMVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO createAlarmRule(AlarmRuleMVO ruleMVO) {
|
||||
return alarmRuleMDAO.createAlarmRule(ruleMVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO modifyAlarmRule(AlarmRuleMVO ruleMVO) {
|
||||
return alarmRuleMDAO.modifyAlarmRule(ruleMVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.ai.cloud.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ai.cloud.dao.impl.ApplicationMDAO;
|
||||
import com.ai.cloud.dao.inter.IApplicationMDAO;
|
||||
import com.ai.cloud.service.inter.IApplicationSer;
|
||||
import com.ai.cloud.util.Constants;
|
||||
import com.ai.cloud.vo.mvo.ApplicationInfoMVO;
|
||||
import com.ai.cloud.vo.svo.ApplicationInfoSVO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
@Service
|
||||
public class ApplicationSerImpl implements IApplicationSer {
|
||||
|
||||
@Autowired
|
||||
IApplicationMDAO applicationMDAO;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(ApplicationSerImpl.class);
|
||||
|
||||
@Override
|
||||
public List<ApplicationInfoMVO> queryUserAppListByUid(String uid) {
|
||||
return applicationMDAO.queryAppListByUid(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createApplicationInfo(ApplicationInfoSVO appSVO) {
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
List<ApplicationInfoMVO> appList = applicationMDAO.queryUserAppListByAppCode(appSVO);
|
||||
if(appList != null && appList.size()>0){
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "当前用户下存在相同应用名");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
try {
|
||||
applicationMDAO.addApplicationInfo(appSVO);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建应用信息成功");
|
||||
} catch (Exception e) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建应用信息异常");
|
||||
e.printStackTrace();
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String delete(ApplicationInfoSVO appSVO) {
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
try {
|
||||
applicationMDAO.deleteAppInfoById(appSVO);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "删除应用信息成功");
|
||||
} catch (Exception e) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "删除应用信息异常");
|
||||
e.printStackTrace();
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,23 +1,55 @@
|
|||
package com.ai.cloud.service.impl;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ai.cloud.dao.inter.IUserInfoMDAO;
|
||||
import com.ai.cloud.service.inter.IUserSer;
|
||||
import com.ai.cloud.util.Constants;
|
||||
import com.ai.cloud.util.common.StringUtil;
|
||||
import com.ai.cloud.vo.mvo.UserInfoMVO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
@Service
|
||||
public class UserSerImpl implements IUserSer {
|
||||
|
||||
|
||||
@Autowired
|
||||
IUserInfoMDAO userInfoMDAO;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(UserSerImpl.class);
|
||||
|
||||
@Override
|
||||
public UserInfoMVO login(UserInfoMVO userInfo){
|
||||
public UserInfoMVO login(UserInfoMVO userInfo) {
|
||||
String userName = userInfo.getUserName();
|
||||
userInfo = userInfoMDAO.queryUserInfoByName(userName);
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject regist(UserInfoMVO userInfo) {
|
||||
String userName = userInfo.getUserName();
|
||||
JSONObject reJson = new JSONObject();
|
||||
UserInfoMVO reUserInfo = userInfoMDAO.queryUserInfoByName(userName);
|
||||
if (reUserInfo != null && !StringUtil.isBlank(reUserInfo.getUid())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户已经存在");
|
||||
return reJson;
|
||||
} else {
|
||||
try {
|
||||
userInfoMDAO.addUser(userInfo);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "注册成功");
|
||||
} catch (Exception e) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户注册失败");
|
||||
e.printStackTrace();
|
||||
return reJson;
|
||||
}
|
||||
}
|
||||
|
||||
return reJson;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package com.ai.cloud.service.inter;
|
||||
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
|
||||
public interface IAlarmRuleSer {
|
||||
|
||||
public AlarmRuleMVO queryUserDefaultAlarmRule(AlarmRuleMVO rule);
|
||||
|
||||
public AlarmRuleMVO queryAppAlarmRule(AlarmRuleMVO ruleMVO);
|
||||
|
||||
public AlarmRuleMVO createAlarmRule(AlarmRuleMVO ruleMVO);
|
||||
|
||||
public AlarmRuleMVO modifyAlarmRule(AlarmRuleMVO ruleMVO);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ai.cloud.service.inter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ai.cloud.vo.mvo.ApplicationInfoMVO;
|
||||
import com.ai.cloud.vo.svo.ApplicationInfoSVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tz
|
||||
* @date 2015年11月18日 下午5:56:04
|
||||
* @version V0.1
|
||||
*/
|
||||
public interface IApplicationSer {
|
||||
|
||||
public List<ApplicationInfoMVO> queryUserAppListByUid(String uid);
|
||||
|
||||
public String createApplicationInfo(ApplicationInfoSVO appSVO);
|
||||
|
||||
public String delete(ApplicationInfoSVO appSVO);
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
package com.ai.cloud.service.inter;
|
||||
|
||||
import com.ai.cloud.vo.mvo.UserInfoMVO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public interface IUserSer {
|
||||
|
||||
public UserInfoMVO login(UserInfoMVO userInfo);
|
||||
|
||||
public JSONObject regist(UserInfoMVO userInfo);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,5 +57,21 @@ public class Constants {
|
|||
put("9", "MISSING");
|
||||
}
|
||||
};
|
||||
|
||||
public static final String JSON_RESULT_KEY_RESULT = "result";
|
||||
public static final String JSON_RESULT_KEY_RESULT_OK = "OK";
|
||||
public static final String JSON_RESULT_KEY_RESULT_FAIL = "FAIL";
|
||||
|
||||
public static final String JSON_RESULT_KEY_RESULT_MSG = "msg";
|
||||
public static final String JSON_RESULT_KEY_RESULT_DATA = "data";
|
||||
|
||||
public static final String ROLE_TYPE_USER = "user";
|
||||
public static final String ROLE_TYPE_ADMIN = "admin";
|
||||
|
||||
public static final String STR_VAL_A = "A";
|
||||
public static final String STR_VAL_P = "P";
|
||||
|
||||
public static final String IS_GLOBAL_FALG_0 = "0";
|
||||
public static final String IS_GLOBAL_FALG_1 = "1";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package com.ai.cloud.vo.mvo;
|
||||
|
||||
import com.ai.cloud.vo.svo.AlarmRuleSVO;
|
||||
|
||||
public class AlarmRuleMVO extends AlarmRuleSVO {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.ai.cloud.vo.mvo;
|
||||
|
||||
import com.ai.cloud.vo.svo.ApplicationInfoSVO;
|
||||
|
||||
public class ApplicationInfoMVO extends ApplicationInfoSVO{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.ai.cloud.vo.mvo;
|
||||
|
||||
public class MenuInfoMVO {
|
||||
|
||||
private String menuId;
|
||||
|
||||
private String menuName;
|
||||
|
||||
private String url;
|
||||
|
||||
public MenuInfoMVO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MenuInfoMVO(String menuId, String menuName, String url) {
|
||||
super();
|
||||
this.menuId = menuId;
|
||||
this.menuName = menuName;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getMenuId() {
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(String menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
public String getMenuName() {
|
||||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName) {
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MenuInfoMVO [menuId=" + menuId + ", menuName=" + menuName + ", url=" + url + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -149,9 +149,9 @@ public class TraceLogEntry extends Span {
|
|||
result.statusCodeName = statusCodeName;
|
||||
|
||||
result.applicationIdStr = result.applicationId;
|
||||
if (!StringUtil.isBlank(result.viewPointId) && result.viewPointId.length() > 40) {
|
||||
result.viewPointIdSub = result.viewPointId.substring(0, 20) + "..."
|
||||
+ result.viewPointId.substring(result.viewPointId.length() - 20);
|
||||
if (!StringUtil.isBlank(result.viewPointId) && result.viewPointId.length() > 60) {
|
||||
result.viewPointIdSub = result.viewPointId.substring(0, 30) + "..."
|
||||
+ result.viewPointId.substring(result.viewPointId.length() - 30);
|
||||
} else {
|
||||
result.viewPointIdSub = result.viewPointId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +1,7 @@
|
|||
package com.ai.cloud.vo.mvo;
|
||||
|
||||
public class UserInfoMVO {
|
||||
private String uid;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
import com.ai.cloud.vo.svo.UserInfoSVO;
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
public class UserInfoMVO extends UserInfoSVO {
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInfoMVO [uid=" + uid + ", userName=" + userName + ", password=" + password + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
package com.ai.cloud.vo.svo;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class AlarmRuleSVO {
|
||||
|
||||
private String ruleId;
|
||||
|
||||
private String appId;
|
||||
|
||||
private String uid;
|
||||
|
||||
private String configArgs;
|
||||
|
||||
private String isGlobal;
|
||||
|
||||
private String todoType;
|
||||
|
||||
private String todoContent;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private String sts;
|
||||
|
||||
private Timestamp modifyTime;
|
||||
|
||||
public String getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId(String ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getConfigArgs() {
|
||||
return configArgs;
|
||||
}
|
||||
|
||||
public void setConfigArgs(String configArgs) {
|
||||
this.configArgs = configArgs;
|
||||
}
|
||||
|
||||
public String getIsGlobal() {
|
||||
return isGlobal;
|
||||
}
|
||||
|
||||
public void setIsGlobal(String isGlobal) {
|
||||
this.isGlobal = isGlobal;
|
||||
}
|
||||
|
||||
public String getTodoType() {
|
||||
return todoType;
|
||||
}
|
||||
|
||||
public void setTodoType(String todoType) {
|
||||
this.todoType = todoType;
|
||||
}
|
||||
|
||||
public Timestamp getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Timestamp createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getSts() {
|
||||
return sts;
|
||||
}
|
||||
|
||||
public void setSts(String sts) {
|
||||
this.sts = sts;
|
||||
}
|
||||
|
||||
public String getTodoContent() {
|
||||
return todoContent;
|
||||
}
|
||||
|
||||
public void setTodoContent(String todoContent) {
|
||||
this.todoContent = todoContent;
|
||||
}
|
||||
|
||||
public Timestamp getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Timestamp modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AlarmRuleSVO [ruleId=" + ruleId + ", appId=" + appId + ", uid=" + uid + ", configArgs=" + configArgs
|
||||
+ ", isGlobal=" + isGlobal + ", todoType=" + todoType + ", todoContent=" + todoContent + ", createTime="
|
||||
+ createTime + ", sts=" + sts + ", modifyTime=" + modifyTime + ", getRuleId()=" + getRuleId()
|
||||
+ ", getAppId()=" + getAppId() + ", getUid()=" + getUid() + ", getConfigArgs()=" + getConfigArgs()
|
||||
+ ", getIsGlobal()=" + getIsGlobal() + ", getTodoType()=" + getTodoType() + ", getCreateTime()="
|
||||
+ getCreateTime() + ", getSts()=" + getSts() + ", getTodoContent()=" + getTodoContent()
|
||||
+ ", getModifyTime()=" + getModifyTime() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode()
|
||||
+ ", toString()=" + super.toString() + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.ai.cloud.vo.svo;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class ApplicationInfoSVO {
|
||||
|
||||
private String appId;
|
||||
|
||||
private String uid;
|
||||
|
||||
private String appCode;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private String sts;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getAppCode() {
|
||||
return appCode;
|
||||
}
|
||||
|
||||
public void setAppCode(String appCode) {
|
||||
this.appCode = appCode;
|
||||
}
|
||||
|
||||
public Timestamp getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Timestamp createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getSts() {
|
||||
return sts;
|
||||
}
|
||||
|
||||
public void setSts(String sts) {
|
||||
this.sts = sts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApplicationInfoSVO [appId=" + appId + ", uid=" + uid + ", appCode=" + appCode + ", createTime="
|
||||
+ createTime + ", sts=" + sts + "]";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.ai.cloud.vo.svo;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class UserInfoSVO {
|
||||
private String uid;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
|
||||
private String roleType;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private String sts;
|
||||
|
||||
private Timestamp modifyTime;
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getRoleType() {
|
||||
return roleType;
|
||||
}
|
||||
|
||||
public void setRoleType(String roleType) {
|
||||
this.roleType = roleType;
|
||||
}
|
||||
|
||||
public Timestamp getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Timestamp createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getSts() {
|
||||
return sts;
|
||||
}
|
||||
|
||||
public void setSts(String sts) {
|
||||
this.sts = sts;
|
||||
}
|
||||
|
||||
public Timestamp getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Timestamp modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInfoSVO [uid=" + uid + ", userName=" + userName + ", password=" + password + ", roleType="
|
||||
+ roleType + ", createTime=" + createTime + ", sts=" + sts + ", modifyTime=" + modifyTime + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
DROP TABLE IF EXISTS `user_info` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_info` (
|
||||
`uid` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`user_name` VARCHAR(100) NOT NULL COMMENT '',
|
||||
`password` VARCHAR(32) NOT NULL COMMENT '',
|
||||
`role_type` VARCHAR(45) NOT NULL DEFAULT 'user' COMMENT '',
|
||||
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
|
||||
`sts` VARCHAR(2) NOT NULL COMMENT '',
|
||||
`modify_time` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
|
||||
PRIMARY KEY (`uid`) COMMENT '',
|
||||
UNIQUE INDEX `user_name_UNIQUE` (`user_name` ASC) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `user_info_ext`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `user_info_ext` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_info_ext` (
|
||||
`eid` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`uid` INT NOT NULL COMMENT '',
|
||||
`email` VARCHAR(200) NULL COMMENT '',
|
||||
`create_time` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
|
||||
PRIMARY KEY (`eid`) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `login_log`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `login_log` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `login_log` (
|
||||
`log_id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`uid` INT NOT NULL COMMENT '',
|
||||
`login_time` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
|
||||
PRIMARY KEY (`log_id`) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `application_info`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `application_info` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `application_info` (
|
||||
`app_id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`uid` INT NOT NULL COMMENT '',
|
||||
`app_code` VARCHAR(200) NOT NULL COMMENT '',
|
||||
`create_time` DATETIME NULL COMMENT '',
|
||||
`sts` VARCHAR(2) NULL COMMENT '',
|
||||
PRIMARY KEY (`app_id`) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `data_info`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `data_info` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `data_info` (
|
||||
`did` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`tab_info` VARCHAR(45) NOT NULL COMMENT '',
|
||||
`col_info` VARCHAR(45) NOT NULL COMMENT '',
|
||||
`code` VARCHAR(45) NOT NULL COMMENT '',
|
||||
`word` VARCHAR(45) NOT NULL COMMENT '',
|
||||
`word_desc` VARCHAR(200) NULL COMMENT '',
|
||||
`sts` VARCHAR(2) NULL COMMENT '',
|
||||
`create_time` DATETIME NULL COMMENT '',
|
||||
PRIMARY KEY (`did`) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `alarm_rule`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `alarm_rule` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `alarm_rule` (
|
||||
`rule_id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`app_id` VARCHAR(45) NULL COMMENT '',
|
||||
`uid` VARCHAR(45) NOT NULL COMMENT '',
|
||||
`config_args` VARCHAR(200) NULL COMMENT '',
|
||||
`is_global` VARCHAR(2) NOT NULL COMMENT '',
|
||||
`todo_type` VARCHAR(4) NOT NULL COMMENT '',
|
||||
`todo_content` VARCHAR(1000) NULL COMMENT '',
|
||||
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
|
||||
`sts` VARCHAR(2) NULL COMMENT '',
|
||||
`modify_time` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
|
||||
PRIMARY KEY (`rule_id`) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `include_rule`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `include_rule` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `include_rule` (
|
||||
`irid` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`rule_value` VARCHAR(200) NULL COMMENT '',
|
||||
`create_time` DATETIME NULL COMMENT '',
|
||||
`sts` VARCHAR(2) NULL COMMENT '',
|
||||
`rule_id` INT UNSIGNED NOT NULL COMMENT '',
|
||||
PRIMARY KEY (`irid`) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `exclude_rule`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `exclude_rule` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `exclude_rule` (
|
||||
`erid` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`rule_value` VARCHAR(200) NULL COMMENT '',
|
||||
`create_time` DATETIME NULL COMMENT '',
|
||||
`sts` VARCHAR(2) NULL COMMENT '',
|
||||
`rule_id` INT UNSIGNED NOT NULL COMMENT '',
|
||||
PRIMARY KEY (`erid`) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `email_expression`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `email_expression` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `email_expression` (
|
||||
`tid` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
|
||||
`expr_name` VARCHAR(100) NOT NULL COMMENT '',
|
||||
`expr_val` VARCHAR(100) NOT NULL COMMENT '',
|
||||
`create_time` DATETIME NULL COMMENT '',
|
||||
`sts` VARCHAR(2) NULL COMMENT '',
|
||||
PRIMARY KEY (`tid`) COMMENT '')
|
||||
ENGINE = InnoDB;
|
||||
|
|
@ -0,0 +1,398 @@
|
|||
<#import "./lib/ai.cloud/common.ftl" as common>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<!-- 创建应用-->
|
||||
<div id="createAppDiv" style="display:none" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="appCode" class="col-sm-4 control-label">应用名称:</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="appCode" type="text" class="form-control" placeholder="应用名称"
|
||||
autofocus>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-4">
|
||||
<button id="crtBtn" class="btn btn-lg btn-primary" type="button">创建应用</button>
|
||||
<button id="cannelBtn" class="btn btn-lg btn-primary" type="button">取消创建</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 创建规则-->
|
||||
<div class="form-horizontal" id="crtAlarmDiv" style="display:none">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">应用名称:</label>
|
||||
<div class="col-sm-4">
|
||||
<p class="form-control-static" id="appName"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="period" class="col-sm-4 control-label">告警频率:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="period" placeholder="告警发送时间间隔(秒)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="todoType" class="col-sm-4 control-label">告警操作:</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" id="todoType" >
|
||||
<option value="0">发送邮件</option>
|
||||
<option value="1">回调接口</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="emailTemplateDiv" style="display:block">
|
||||
<label for="emailTemplate" class="col-sm-4 control-label">邮件模板:</label>
|
||||
<div class="col-sm-4">
|
||||
<textarea class="form-control" id="emailTemplate" rows="4" placeholder="邮件模板"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="callBackDiv" style="display:none">
|
||||
<label for="callBackUrl" class="col-sm-4 control-label">回调接口:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="callBackUrl" placeholder="回调接口地址">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-4">
|
||||
<input type='hidden' id="ruleId">
|
||||
<input type='hidden' id="appId">
|
||||
<input type='hidden' id="isGlobal">
|
||||
<button id="crtRuleBtn" class="btn btn-lg btn-primary " type="button">创建规则</button>
|
||||
<button id="cannelRuleBtn" class="btn btn-lg btn-primary " type="button">取消创建</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-condensed">
|
||||
<caption>
|
||||
<button id="crtApp" type="button" class="btn btn-warning" href="#">创建应用</button>
|
||||
|
||||
<button id="crtAlarm" type="button" class="btn btn-warning" href="#">默认告警规则</button>
|
||||
|
||||
<button type="button" class="btn btn-success" href="#" onclick="window.location.reload(); return false;">刷新</button>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:5%">序号</th>
|
||||
<th style="width:60%">应用名称</th>
|
||||
<th style="width:20%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<#if applist??>
|
||||
<tbody>
|
||||
<#list applist as appInfo>
|
||||
<tr>
|
||||
<th scope="row">${appInfo_index + 1}</th>
|
||||
<td>${appInfo.appCode!}</td>
|
||||
<td>
|
||||
<button name="conf" appId="${appInfo.appId!}" appCode="${appInfo.appCode!}" type="button" class="btn btn-default btn-xs">配置告警规则</button>
|
||||
<button name="export" appId="${appInfo.appId!}" type="button" class="btn btn-default btn-xs">生成授权</button>
|
||||
<button name="del" appId="${appInfo.appId!}" type="button" class="btn btn-default btn-xs">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</tbody>
|
||||
</#if>
|
||||
</table>
|
||||
</div>
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
$("#crtApp").bind("click",function(){
|
||||
$("#cannelRuleBtn").click();
|
||||
$("#createAppDiv").show();
|
||||
});
|
||||
|
||||
$("#crtBtn").bind("click",function(){
|
||||
if($("#appCode").val() == ''){
|
||||
alert("请输入应用名称");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/appinfo/create';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:"{'appCode':'" + $("#appCode").val() + "'}",
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
alert(data.msg);
|
||||
//$("#createAppDiv").hide();
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("button[name='del']").each(function(){
|
||||
$(this).bind("click",function(){
|
||||
var appId = $(this).attr("appId");
|
||||
if(appId < 0){
|
||||
alert("请选择应用");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/appinfo/delete/' + appId;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:{},
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
alert(data.msg);
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#cannelBtn").bind("click",function(){
|
||||
$("#appCode").val("");
|
||||
$("#createAppDiv").hide();
|
||||
});
|
||||
|
||||
$("#cannelRuleBtn").bind("click",function(){
|
||||
$("#crtAlarmDiv").hide();
|
||||
});
|
||||
|
||||
$("#crtAlarm").bind("click",function(){
|
||||
$("#cannelBtn").click();
|
||||
$("#crtAlarmDiv").show();
|
||||
|
||||
var urlStr = '${base}/alarmRule/default';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:"{}",
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
$("#isGlobal").val("1");
|
||||
$("#appName").text("所有应用");
|
||||
if(result == 'OK'){
|
||||
var obj = jQuery.parseJSON(data.data);
|
||||
var periodJson = jQuery.parseJSON(obj.configArgs);
|
||||
$("#period").val(periodJson.period);
|
||||
$("#todoType").val(obj.todoType).change();
|
||||
if(obj.todoType == 1){
|
||||
$("#callBackUrl").val(obj.todoContent);
|
||||
}else {
|
||||
$("#emailTemplate").val(obj.todoContent);
|
||||
}
|
||||
$("#ruleId").val(obj.ruleId);
|
||||
$("#crtRuleBtn").text("修改规则");
|
||||
$("#cannelRuleBtn").text("取消修改");
|
||||
$("#appId").val("");
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#todoType").bind("change",function(){
|
||||
if($(this).val() == 0){
|
||||
$("#emailTemplateDiv").show();
|
||||
$("#callBackDiv").hide();
|
||||
}else if($(this).val() == 1){
|
||||
$("#emailTemplateDiv").hide();
|
||||
$("#callBackDiv").show();
|
||||
}
|
||||
});
|
||||
|
||||
$("button[name='conf']").each(function(){
|
||||
$(this).bind("click",function(){
|
||||
$("#cannelBtn").click();
|
||||
$("#crtAlarmDiv").show();
|
||||
|
||||
var appId = $(this).attr("appId");
|
||||
var appCode = $(this).attr("appCode");
|
||||
if(appId < 0){
|
||||
alert("请选择应用");
|
||||
return false;
|
||||
}
|
||||
|
||||
var urlStr = '${base}/alarmRule/' + appId;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:"{}",
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
$("#isGlobal").val("0");
|
||||
$("#appId").val(appId);
|
||||
if(result == 'OK'){
|
||||
$("#appName").text(appCode);
|
||||
var obj = jQuery.parseJSON(data.data);
|
||||
var periodJson = jQuery.parseJSON(obj.configArgs);
|
||||
$("#period").val(periodJson.period);
|
||||
if(obj.todoType == 1){
|
||||
$("#todoType").val(obj.todoType).change();
|
||||
$("#callBackUrl").val(obj.todoContent);
|
||||
}else {
|
||||
$("#emailTemplate").val(obj.todoContent);
|
||||
}
|
||||
$("#ruleId").val(obj.ruleId);
|
||||
$("#crtRuleBtn").text("修改规则");
|
||||
$("#cannelRuleBtn").text("取消修改");
|
||||
}else{
|
||||
$("#appName").html(appCode+"(<b>使用默认规则</b>)");
|
||||
$("#period").val("");
|
||||
$("#todoType").val("0").change();
|
||||
$("#callBackUrl").val("");
|
||||
$("#emailTemplate").val("");
|
||||
$("#ruleId").val("");
|
||||
$("#crtRuleBtn").text("创建规则");
|
||||
$("#cannelRuleBtn").text("取消创建");
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#crtRuleBtn").bind("click",function(){
|
||||
var ruleId = $("#ruleId").val();
|
||||
|
||||
var appId = $("#appId").val();//可空
|
||||
var period = $("#period").val();//不可空
|
||||
if(period == null || period.length < 1){
|
||||
alert("告警频率不能为空");
|
||||
return false;
|
||||
}
|
||||
var isGlobal = $("#isGlobal").val();//不可空
|
||||
if(isGlobal == null || isGlobal.length < 1){
|
||||
alert("规则标识不能为空");
|
||||
return false;
|
||||
}else{
|
||||
if(isGlobal ==0){
|
||||
if(appId == null || appId.length < 1){
|
||||
alert("应用标识不能为空");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var todoType = $("#todoType").val();//不可空
|
||||
if(todoType == null || todoType.length < 1){
|
||||
alert("告警操作不能为空");
|
||||
return false;
|
||||
}
|
||||
var callBackUrl = $("#callBackUrl").val();
|
||||
var emailTemplate = $("#emailTemplate").val();
|
||||
var todoContent = "";
|
||||
if(todoType == 1){
|
||||
if(callBackUrl == null || callBackUrl.length < 1){
|
||||
alert("回调接口不能为空");
|
||||
return false;
|
||||
}
|
||||
todoContent = callBackUrl;
|
||||
}else{
|
||||
if(emailTemplate == null || emailTemplate.length < 1){
|
||||
alert("邮件模板不能为空");
|
||||
return false;
|
||||
}
|
||||
todoContent = emailTemplate;
|
||||
}
|
||||
var ruleId = $("#ruleId").val();
|
||||
var jsonData = "";
|
||||
if(ruleId > 0){
|
||||
//调用修改规则
|
||||
if(ruleId == null || ruleId.length < 0){
|
||||
alert("告警规则不能为空");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/alarmRule/modify';
|
||||
jsonData = "{ruleId:'"+ruleId+"',appId:'"+appId+"',period:'"+period+"',isGlobal:'"+isGlobal+"',todoType:'"+todoType+"',todoContent:'"+todoContent+"'}";
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:jsonData,
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
if(data.result == "OK"){
|
||||
alert(data.msg);
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
//调用创建规则
|
||||
var urlStr = '${base}/alarmRule/create';
|
||||
jsonData = "{appId:'"+appId+"',period:'"+period+"',isGlobal:'"+isGlobal+"',todoType:'"+todoType+"',todoContent:'"+todoContent+"'}";
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:jsonData,
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
if(data.result == "OK"){
|
||||
alert(data.msg);
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<!-- 菜单(不要太多) -->
|
||||
<@common.importMenuInfo menuInfo="${userInfo}" />
|
||||
<#--<@common.importMenuInfo menuInfo="${userInfo}" />-->
|
||||
|
||||
<!-- 搜索栏 -->
|
||||
<@common.importSearchInfo isLogin="${userInfo}" />
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
height=100% marginheight=0 marginwidth=0 scrolling=yes src=""></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="uid" value="${(userInfo?eval).uid!''}">
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
<script src="${base}/js/webui-0.1.js"></script>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<script src="${base}/js/jquery/jquery-2.1.4.js"></script>
|
||||
<script src="${base}/js/jquery/jquery-ui-1.11.4.js"></script>
|
||||
<script src="${base}/js/jquery/jquery.treetable-3.2.0.js"></script>
|
||||
<script src="${base}/js/jquery/jquery-md5.js"></script>
|
||||
<script src="${base}/js/bootstrap.min-3.3.5.js"></script>
|
||||
</#macro>
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ ${userInfo}
|
|||
<form class="navbar-form navbar-left" role="search">
|
||||
<div class="form-group">
|
||||
<#if json.isLogin == '1'>
|
||||
<input id="srchKey" type="text" class="form-control" style="width: 450px" placeholder="TraceId">
|
||||
<input id="srchKey" type="text" class="form-control" style="width: 750px" placeholder="TraceId">
|
||||
<#else>
|
||||
<input id="srchKey" type="text" class="form-control" style="width: 750px" placeholder="TraceId">
|
||||
</#if>
|
||||
|
|
@ -48,15 +49,20 @@ ${userInfo}
|
|||
<#if json.isLogin == '1'>
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle"
|
||||
data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||
aria-expanded="false"> ${json.userName} <span class="caret"></span></a>
|
||||
aria-expanded="false"> ${json.userName!} <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a name="menuUrl" href="#" url="user/setting/${json.uid}">设置</a></li>
|
||||
<#if json.menuList??>
|
||||
<#list json.menuList?eval as menu>
|
||||
<li><a name="menuUrl" href="#" url="${menu.url!}">${menu.menuName!}</a></li>
|
||||
</#list>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li><a name="menuUrl" href="#" url="logout">退出</a></li>
|
||||
</#if>
|
||||
<li><a id="logout" href="#" url="logout">退出</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<#else>
|
||||
<li><a name="menuUrl" href="#" url="login">登录</a></li>
|
||||
<li><a id="login" href="#" url="login">登录</a></li>
|
||||
<li><a id="regist" name="menuUrl" href="#" url="regist">注册</a></li>
|
||||
</#if>
|
||||
</ul>
|
||||
</#macro>
|
||||
|
|
@ -128,8 +134,8 @@ ${userInfo}
|
|||
<#--服务端结束时间 小于等于 客户端结束时间(客户端时间段包含服务端时间段)-->
|
||||
<#assign a=(logInfo.timeLineList[0].startTime - beginTime)! />
|
||||
<#assign b=(logInfo.timeLineList[1].startTime - logInfo.timeLineList[0].startTime)! />
|
||||
<#assign c=(logInfo.timeLineList[1].startTime + logInfo.timeLineList[1].cost - logInfo.timeLineList[1].startTime) />
|
||||
<#assign d=(logInfo.timeLineList[0].startTime + logInfo.timeLineList[0].cost - logInfo.timeLineList[1].startTime - logInfo.timeLineList[1].cost) />
|
||||
<#assign c=(logInfo.timeLineList[1].startTime + logInfo.timeLineList[1].cost - logInfo.timeLineList[1].startTime)! />
|
||||
<#assign d=(logInfo.timeLineList[0].startTime + logInfo.timeLineList[0].cost - logInfo.timeLineList[1].startTime - logInfo.timeLineList[1].cost)! />
|
||||
<input type="hidden" a="${a!}" b="${b!}" c="${c!}" d="${d!}" beginTime="${beginTime!}" totalTime="${totalTime!}">
|
||||
<div class="progress-bar" style="width: ${100*(a)/totalTime}%"></div>
|
||||
<div class="progress-bar progress-bar-b progress-bar-striped" style="color:black;min-width: ${100*(b)/totalTime}%;"></div>
|
||||
|
|
@ -138,9 +144,9 @@ ${userInfo}
|
|||
<div class="progress-bar progress-split progress-bar-striped" style="color:black;"> ${b}/${c}/${d}ms</div>
|
||||
<#else>
|
||||
<#--服务端开始时间 大于 客户端开始时间(客户端时间轴与服务端时间轴有一部分重合,重合后的部分算为服务端)-->
|
||||
<#assign a=(logInfo.timeLineList[0].startTime - beginTime) />
|
||||
<#assign b=(logInfo.timeLineList[1].startTime - logInfo.timeLineList[0].startTime) />
|
||||
<#assign c=(logInfo.timeLineList[1].startTime + logInfo.timeLineList[1].cost - logInfo.timeLineList[1].startTime) />
|
||||
<#assign a=(logInfo.timeLineList[0].startTime - beginTime)! />
|
||||
<#assign b=(logInfo.timeLineList[1].startTime - logInfo.timeLineList[0].startTime)! />
|
||||
<#assign c=(logInfo.timeLineList[1].startTime + logInfo.timeLineList[1].cost - logInfo.timeLineList[1].startTime)! />
|
||||
<input type="hidden" a="${a!}" b="${b!}" c="${c!}" totalTime="${totalTime!}">
|
||||
<div class="progress-bar" style="width: ${100*(a)/totalTime}%"></div>
|
||||
<div class="progress-bar progress-bar-b progress-bar-striped" style="color:black;min-width: ${100*(b)/totalTime}%;"></div>
|
||||
|
|
@ -149,7 +155,16 @@ ${userInfo}
|
|||
</#if>
|
||||
<#else>
|
||||
<#--服务端开始时间 大于 客户端结束始时间(客户端一段时间,一段空格,一段服务端时间)-->
|
||||
3333
|
||||
<#assign a=(logInfo.timeLineList[0].startTime - beginTime)! />
|
||||
<#assign b=(logInfo.timeLineList[0].cost)! />
|
||||
<#assign c=(logInfo.timeLineList[1].startTime - logInfo.timeLineList[0].startTime)! />
|
||||
<#assign d=(logInfo.timeLineList[1].cost)! />
|
||||
<input type="hidden" a="${a!}" b="${b!}" c="${c!}" d="${d!}" beginTime="${beginTime!}" totalTime="${totalTime!}">
|
||||
<div class="progress-bar" style="width: ${100*(a)/totalTime}%"></div>
|
||||
<div class="progress-bar progress-bar-b progress-bar-striped" style="color:black;min-width: ${100*(b)/totalTime}%;"></div>
|
||||
<div class="progress-bar progress-bar-striped" style="color:black;min-width: ${100*(c)/totalTime}%;"></div>
|
||||
<div class="progress-bar progress-bar-b progress-bar-striped" style="color:black;min-width: ${100*(d)/totalTime}%;"></div>
|
||||
<div class="progress-bar progress-split progress-bar-striped" style="color:black;"> ${b}/${d}ms</div>
|
||||
</#if>
|
||||
</#if>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,9 +40,10 @@
|
|||
alert("请输入密码");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/login/'+$("#a").val()+'/'+$.md5($("#b").val());
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '${base}/login/'+$("#a").val()+'/'+$("#b").val(),
|
||||
url: urlStr,
|
||||
data:{},
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
|
|
@ -50,7 +51,6 @@
|
|||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
alert(data.msg);
|
||||
parent.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
<#import "./lib/ai.cloud/common.ftl" as common>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<form class="form-signin">
|
||||
<h2 class="form-signin-heading">注册</h2>
|
||||
<label for="inputEmail" class="sr-only">用户名/邮箱</label>
|
||||
<input id="a" type="text" class="form-control" placeholder="用户名"
|
||||
autofocus>
|
||||
<label for="inputPassword" class="sr-only">密码</label>
|
||||
<input id="b" type="password" id="inputPassword"
|
||||
class="form-control" placeholder="密码">
|
||||
<button id="regist" class="btn btn-lg btn-primary btn-block" type="submit">注册</button>
|
||||
</form>
|
||||
</div>
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
$("#regist").bind("click",function(){
|
||||
if($("#a").val() == ''){
|
||||
alert("请输入用户名");
|
||||
return false;
|
||||
}
|
||||
if($("#b").val() == ''){
|
||||
alert("请输入密码");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/regist/'+$("#a").val()+'/'+$.md5($("#b").val());
|
||||
var refUrl = '${base}/login';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
data:{},
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
alert(data.msg);
|
||||
window.parent.changeFrameUrl(refUrl);
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("注册失败");
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
/**
|
||||
* jQuery MD5 hash algorithm function
|
||||
*
|
||||
* <code>
|
||||
* Calculate the md5 hash of a String
|
||||
* String $.md5 ( String str )
|
||||
* </code>
|
||||
*
|
||||
* Calculates the MD5 hash of str using the » RSA Data Security, Inc. MD5
|
||||
* Message-Digest Algorithm, and returns that hash. MD5 (Message-Digest
|
||||
* algorithm 5) is a widely-used cryptographic hash function with a 128-bit hash
|
||||
* value. MD5 has been employed in a wide variety of security applications, and
|
||||
* is also commonly used to check the integrity of data. The generated hash is
|
||||
* also non-reversable. Data cannot be retrieved from the message digest, the
|
||||
* digest uniquely identifies the data. MD5 was developed by Professor Ronald L.
|
||||
* Rivest in 1994. Its 128 bit (16 byte) message digest makes it a faster
|
||||
* implementation than SHA-1. This script is used to process a variable length
|
||||
* message into a fixed-length output of 128 bits using the MD5 algorithm. It is
|
||||
* fully compatible with UTF-8 encoding. It is very useful when u want to
|
||||
* transfer encrypted passwords over the internet. If you plan using UTF-8
|
||||
* encoding in your project don't forget to set the page encoding to UTF-8
|
||||
* (Content-Type meta tag). This function orginally get from the WebToolkit and
|
||||
* rewrite for using as the jQuery plugin.
|
||||
*
|
||||
* Example Code <code>
|
||||
* $.md5("I'm Persian.");
|
||||
* </code> Result <code>
|
||||
* "b8c901d0f02223f9761016cfff9d68df"
|
||||
* </code>
|
||||
*
|
||||
* @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
|
||||
* @link http://www.semnanweb.com/jquery-plugin/md5.html
|
||||
* @see http://www.webtoolkit.info/
|
||||
* @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
|
||||
* @param {jQuery}
|
||||
* {md5:function(string))
|
||||
* @return string
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var rotateLeft = function(lValue, iShiftBits) {
|
||||
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
|
||||
}
|
||||
|
||||
var addUnsigned = function(lX, lY) {
|
||||
var lX4, lY4, lX8, lY8, lResult;
|
||||
lX8 = (lX & 0x80000000);
|
||||
lY8 = (lY & 0x80000000);
|
||||
lX4 = (lX & 0x40000000);
|
||||
lY4 = (lY & 0x40000000);
|
||||
lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
|
||||
if (lX4 & lY4)
|
||||
return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
|
||||
if (lX4 | lY4) {
|
||||
if (lResult & 0x40000000)
|
||||
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
|
||||
else
|
||||
return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
|
||||
} else {
|
||||
return (lResult ^ lX8 ^ lY8);
|
||||
}
|
||||
}
|
||||
|
||||
var F = function(x, y, z) {
|
||||
return (x & y) | ((~x) & z);
|
||||
}
|
||||
|
||||
var G = function(x, y, z) {
|
||||
return (x & z) | (y & (~z));
|
||||
}
|
||||
|
||||
var H = function(x, y, z) {
|
||||
return (x ^ y ^ z);
|
||||
}
|
||||
|
||||
var I = function(x, y, z) {
|
||||
return (y ^ (x | (~z)));
|
||||
}
|
||||
|
||||
var FF = function(a, b, c, d, x, s, ac) {
|
||||
a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));
|
||||
return addUnsigned(rotateLeft(a, s), b);
|
||||
};
|
||||
|
||||
var GG = function(a, b, c, d, x, s, ac) {
|
||||
a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));
|
||||
return addUnsigned(rotateLeft(a, s), b);
|
||||
};
|
||||
|
||||
var HH = function(a, b, c, d, x, s, ac) {
|
||||
a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));
|
||||
return addUnsigned(rotateLeft(a, s), b);
|
||||
};
|
||||
|
||||
var II = function(a, b, c, d, x, s, ac) {
|
||||
a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));
|
||||
return addUnsigned(rotateLeft(a, s), b);
|
||||
};
|
||||
|
||||
var convertToWordArray = function(string) {
|
||||
var lWordCount;
|
||||
var lMessageLength = string.length;
|
||||
var lNumberOfWordsTempOne = lMessageLength + 8;
|
||||
var lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64;
|
||||
var lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16;
|
||||
var lWordArray = Array(lNumberOfWords - 1);
|
||||
var lBytePosition = 0;
|
||||
var lByteCount = 0;
|
||||
while (lByteCount < lMessageLength) {
|
||||
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
||||
lBytePosition = (lByteCount % 4) * 8;
|
||||
lWordArray[lWordCount] = (lWordArray[lWordCount] | (string
|
||||
.charCodeAt(lByteCount) << lBytePosition));
|
||||
lByteCount++;
|
||||
}
|
||||
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
||||
lBytePosition = (lByteCount % 4) * 8;
|
||||
lWordArray[lWordCount] = lWordArray[lWordCount]
|
||||
| (0x80 << lBytePosition);
|
||||
lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
|
||||
lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
|
||||
return lWordArray;
|
||||
};
|
||||
|
||||
var wordToHex = function(lValue) {
|
||||
var WordToHexValue = "", WordToHexValueTemp = "", lByte, lCount;
|
||||
for (lCount = 0; lCount <= 3; lCount++) {
|
||||
lByte = (lValue >>> (lCount * 8)) & 255;
|
||||
WordToHexValueTemp = "0" + lByte.toString(16);
|
||||
WordToHexValue = WordToHexValue
|
||||
+ WordToHexValueTemp.substr(WordToHexValueTemp.length - 2,
|
||||
2);
|
||||
}
|
||||
return WordToHexValue;
|
||||
};
|
||||
|
||||
var uTF8Encode = function(string) {
|
||||
string = string.replace(/\x0d\x0a/g, "\x0a");
|
||||
var output = "";
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
var c = string.charCodeAt(n);
|
||||
if (c < 128) {
|
||||
output += String.fromCharCode(c);
|
||||
} else if ((c > 127) && (c < 2048)) {
|
||||
output += String.fromCharCode((c >> 6) | 192);
|
||||
output += String.fromCharCode((c & 63) | 128);
|
||||
} else {
|
||||
output += String.fromCharCode((c >> 12) | 224);
|
||||
output += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
output += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
$.extend({
|
||||
md5 : function(string) {
|
||||
var x = Array();
|
||||
var k, AA, BB, CC, DD, a, b, c, d;
|
||||
var S11 = 7, S12 = 12, S13 = 17, S14 = 22;
|
||||
var S21 = 5, S22 = 9, S23 = 14, S24 = 20;
|
||||
var S31 = 4, S32 = 11, S33 = 16, S34 = 23;
|
||||
var S41 = 6, S42 = 10, S43 = 15, S44 = 21;
|
||||
string = uTF8Encode(string);
|
||||
x = convertToWordArray(string);
|
||||
a = 0x67452301;
|
||||
b = 0xEFCDAB89;
|
||||
c = 0x98BADCFE;
|
||||
d = 0x10325476;
|
||||
for (k = 0; k < x.length; k += 16) {
|
||||
AA = a;
|
||||
BB = b;
|
||||
CC = c;
|
||||
DD = d;
|
||||
a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
|
||||
d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
|
||||
c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
|
||||
b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
|
||||
a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
|
||||
d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
|
||||
c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
|
||||
b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
|
||||
a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
|
||||
d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
|
||||
c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
|
||||
b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
|
||||
a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
|
||||
d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
|
||||
c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
|
||||
b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
|
||||
a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
|
||||
d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
|
||||
c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
|
||||
b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
|
||||
a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
|
||||
d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
|
||||
c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
|
||||
b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
|
||||
a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
|
||||
d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
|
||||
c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
|
||||
b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
|
||||
a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
|
||||
d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
|
||||
c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
|
||||
b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
|
||||
a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
|
||||
d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
|
||||
c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
|
||||
b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
|
||||
a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
|
||||
d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
|
||||
c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
|
||||
b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
|
||||
a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
|
||||
d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
|
||||
c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
|
||||
b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
|
||||
a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
|
||||
d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
|
||||
c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
|
||||
b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
|
||||
a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
|
||||
d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
|
||||
c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
|
||||
b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
|
||||
a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
|
||||
d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
|
||||
c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
|
||||
b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
|
||||
a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
|
||||
d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
|
||||
c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
|
||||
b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
|
||||
a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
|
||||
d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
|
||||
c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
|
||||
b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
|
||||
a = addUnsigned(a, AA);
|
||||
b = addUnsigned(b, BB);
|
||||
c = addUnsigned(c, CC);
|
||||
d = addUnsigned(d, DD);
|
||||
}
|
||||
var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c)
|
||||
+ wordToHex(d);
|
||||
return tempValue.toLowerCase();
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
|
@ -7,6 +7,7 @@ $().ready(function() {
|
|||
|
||||
var baseUrl = $("#baseUrl").val();
|
||||
var traceId = $("#traceId").val();
|
||||
var uid = $("#uid").val();
|
||||
|
||||
/** 搞个默认值测试*/
|
||||
// traceId = "6fbbe463f5b74873aecaf9eb3511846e123";
|
||||
|
|
@ -21,6 +22,9 @@ $().ready(function() {
|
|||
changeFrameUrl(baseUrl + "/showTraceLog/" + srchKey);
|
||||
}
|
||||
} else {
|
||||
if(uid>0){
|
||||
changeFrameUrl(baseUrl + "/applist");
|
||||
}
|
||||
$("#srchKey").val("");
|
||||
}
|
||||
|
||||
|
|
@ -38,4 +42,35 @@ $().ready(function() {
|
|||
});
|
||||
});
|
||||
|
||||
$("#regist").bind('click', function() {
|
||||
changeFrameUrl(baseUrl + "/" + $(this).attr("url"));
|
||||
});
|
||||
|
||||
$("#login").bind('click', function() {
|
||||
changeFrameUrl(baseUrl + "/" + $(this).attr("url"));
|
||||
});
|
||||
|
||||
$("#logout").bind('click', function() {
|
||||
var urlStr = baseUrl + '/logout';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
data:{},
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("退出失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue