oper
package main.java.com.zte.controller.ems; import java.util.HashMap;
import java.util.List;
import java.util.Map; import javax.annotation.Resource; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import main.java.com.zte.controller.base.BaseController;
import main.java.com.zte.entity.Page;
import main.java.com.zte.service.ems.OperationService;
import main.java.com.zte.util.DateUtil;
import main.java.com.zte.util.PageData;
import main.java.com.zte.util.Tools; /**
* EMS上用户操作日志处理类
*
* @author 10183302
*
*/
@Controller
@RequestMapping(value = "/ems/operation")
public class OperationController extends BaseController {
private static final String FAILD = "Failed";
private static final String OPERATION_RESULT = "operationResult";
private static final String OPER_COUNT = "OPER_COUNT";
private static final String EMS_USER_OPERATION_CHARTS = "ems/user_operation_charts";
private static final String USER_OPERATION_FAILED_COUNT = "userOperationFailedCount";
private static final String USER_OPERATION_NAME_COUNT = "userOperationNameCount";
private static final String USER_COUNT = "userCount";
private static final String OPERATION_NAME_LIST = "operationNameList";
private static final String IP_LIST = "ipList";
private static final String START_TIME = "START_TIME";
private static final String TASK_ID_STR = "taskId";
private static final String TASK_ID_NUM_STR = "1470880530369";
private static final String HOST_STR_UPPER = "HOST";
private static final String HOST_STR_LOWER = "ip";
private static final String OPERATION_NAME_STR_LOWER = "operationName";
private static final String LOG_NAME_STR_UPPER = "OPERATION_NAME"; @Resource(name = "operationService")
private OperationService operationService; @RequestMapping(value = "/to_user_operation_charts")
public ModelAndView toUserOperationCharts(Page page,
@RequestParam(value = TASK_ID_STR, required = false) String taskId)
throws Exception {
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
List<PageData> ipList = null;
List<PageData> operationNameList = null;
List<PageData> userCount = null;
List<PageData> userOperationNameCount = null;
List<PageData> userOperationFailedCount = null;
try {
pd = this.getPageData();
if (!Tools.notEmpty(taskId)) {
taskId = TASK_ID_NUM_STR;
}
pd.put(TASK_ID_STR, taskId);
ipList = operationService.getOperationIp(pd);
if (null != ipList) {
pd.put(HOST_STR_LOWER, ipList.get(0).get(HOST_STR_UPPER));
operationNameList = operationService.getOperationName(pd);
pd.put(OPERATION_NAME_STR_LOWER,
operationNameList.get(0).get(LOG_NAME_STR_UPPER));
page.setPd(pd);
userCount = operationService.userCount(pd);
userOperationNameCount = operationService
.userOperationNameCount(pd);
pd.put(OPERATION_RESULT, FAILD);
userOperationFailedCount = operationService
.userOperationFailedCount(pd);
}
} catch (Exception e) {
logger.error(e.toString(), e);
}
mv.addObject(IP_LIST, ipList);
mv.addObject(OPERATION_NAME_LIST, operationNameList);
mv.addObject(USER_COUNT, userCount);
mv.addObject(USER_OPERATION_NAME_COUNT, userOperationNameCount);
mv.addObject(USER_OPERATION_FAILED_COUNT, userOperationFailedCount);
mv.setViewName(EMS_USER_OPERATION_CHARTS);
return mv;
} @RequestMapping(value = "/user_operation_charts")
@ResponseBody
public Map userOperationCharts(Page page,
@RequestParam(value = TASK_ID_STR, required = false) String taskId) {
PageData pd = new PageData();
List<PageData> userOperDatas = null;
JSONObject chartsUserOperJson = new JSONObject();
Map<String, Double> userOperDataMap = new HashMap<String, Double>();
try {
pd = this.getPageData();
if (!Tools.notEmpty(taskId)) {
taskId = TASK_ID_NUM_STR;
}
pd.put(TASK_ID_STR, taskId);
/*
* pd.put(HOST_STR_LOWER, ip); pd.put(OPERATION_NAME_STR_LOWER,
* operationName);
*/
userOperDatas = operationService.userOperationCharts(pd);
// 存放一个图表OPER_COUNT,START_TIME
if (!userOperDatas.isEmpty()) {
String time = "";
double operCount = 0;
for (PageData userOperData : userOperDatas) {
time = DateUtil.convertUTCTimeMillis(userOperData.get(
START_TIME).toString());
operCount = Double.valueOf(userOperData.get(OPER_COUNT)
.toString());
userOperDataMap.put(time, operCount);
}
chartsUserOperJson = JSONObject.fromObject(userOperDataMap);
}
} catch (Exception e) {
logger.error(e.toString(), e);
} Map<String, Double> map = new HashMap<String, Double>();
map.put("1", 21.1);
map.put("2", 33.3);
map.put("3", 44.4);
JSONObject jsonObject = JSONObject.fromObject(map);
return userOperDataMap;
} @RequestMapping(value = "/get_operation_name")
@ResponseBody
public String getOperationName(
@RequestParam(value = HOST_STR_LOWER, required = false) String ip) {
PageData pd = new PageData();
List<PageData> operationNameList = null;
try {
pd = this.getPageData();
pd.put(HOST_STR_LOWER, ip);
operationNameList = operationService.getOperationName(pd);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return JSONArray.fromObject(operationNameList).toString();
}
}
oper的更多相关文章
- ERROR 1227 (42000): Access denied; you need (at least one of) the PROCESS privilege(s) for this oper
1 用以往的mysql登陆模式登陆 [mysql@eanintmydbc002db1 mysqllog]$ mysql Enter password: Welcome to the MySQL m ...
- 函数指针 如:void (*oper)(ChainBinTreee *p)
在C语言中,一个函数总是占用一段连续的内存区,而函数名就是该函数所占内存区的首地址.我们可以把函数的这个首地址(或称入口地址)赋予一个指针变量,使该指针变量指向该函数.然后通过指针变量就可以找到并调用 ...
- scala mysql jdbc oper
package egsql import java.util.Properties import com.sun.org.apache.xalan.internal.xsltc.compiler.ut ...
- Linux碎碎念
在学习Linux过程中,有许多有用的小技巧.如果放在纸质的笔记本上,平时查阅会相当不方便.现在以一种“碎碎念”的方式,汇集整理在此,目前还不是很多,但随着学习.工作的深入,后续会陆陆续续添加更多的小技 ...
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(12)-系统日志和异常的处理②
系列目录 上一讲我们做了日志与异常的结果显示列表,这一节我们讲要把他应用系统中来. 首先我们在App.Common类库中创建一个通用类ResultHelper,这个类里面写了,获取一个GUID,获取当 ...
- VS2013:Unit Test 单元测试入门
一.打开VS ,找到工具栏的“工具->扩展和更新”,添加图片内容 二.新建控制台应用程序: CalculatorDemo 三.新建类:Operation.cs,并添加方法 namespace C ...
- 从接口、抽象类到工厂模式再到JVM来总结一些问题
俗话说,自己写的代码,6个月后也是别人的代码……复习!复习!复习! 涉及到的知识点总结如下: 为什么使用接口? 接口和抽象类的区别 简单工厂模式总结 Java中new和newInstance的区别 J ...
- Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考
操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)目标:创建单机11g + ASM存储 数据库 1. 主机准备 2. 创建ORACLE 用户和组成员 3. 创建以下目录并赋予对应权 ...
- Linux平台 Oracle 11gR2 RAC安装Part1:准备工作
一.实施前期准备工作 1.1 服务器安装操作系统 1.2 Oracle安装介质 1.3 共享存储规划 1.4 网络规范分配 二.安装前期准备工作 2.1 各节点系统时间校对 2.2 各节点关闭防火墙和 ...
随机推荐
- pytest文档24-fixture的作用范围(scope)
fixture作用范围 fixture里面有个scope参数可以控制fixture的作用范围:session > module > class > function fixture( ...
- quartz 中JobExecutionContext的使用
假如execute方法中需要一些额外的数据怎么办?比如说execute 中希望发送一封邮件,但是我需要知道邮件的发送者.接收者等信息? 存在两种解决方案: 1.JobDataMap类: 每个Jo ...
- linux 复制目录结构,但不复制文件
find src -type d | sed 's/src/mkdir -p dst/'|sh
- 版本号控制-git(二)
上次文章给大家介绍了Git的一些基本知识(http://www.cnblogs.com/jerehedu/p/4582398.html).并介绍了使用git init初始化化版本号库.使用git ad ...
- [4] 圆锥(Cone)图形的生成算法
顶点数据的生成 bool YfBuildConeVertices ( Yreal radius, Yreal height, Yuint slices, YeOriginPose originPose ...
- windows media server 组件安装后流媒体服务器启动失败
做好的web应用,去客户现场部署的时候发现流媒体服务器不能启动.(现场服务器系统为windows server2008 R2) 自己测试的时候搭建环境没什么问题.从来没有遇到安装windows med ...
- Oracle中的数值处理方法
求绝对值函数 ) from dual; 求平方根函数 ) from dual; 求幂函数 ,3) from dual; 求余弦三角函数 select cos(3.14159) from dual; 求 ...
- JavaScript 与 PHP 的语法区别
1. 基本类型 php的基本类型分别: .基本数据类型:整型.小数(float/double).字符串.布尔类型 .复合类型:数组.对象 .特殊类型:Null,资源类型 JavaScript的基本类型 ...
- 【Nodejs】理想论坛帖子下载爬虫1.04
一直想做一个能把理想论坛指定页范围的帖子都能完整下载下来的爬虫,但未能如愿. 主要的障碍在并发数的控制和长时间任务的突然退出,比如想下载前五页的帖子,分析后可得到大约15000个主贴或子贴,如果用回调 ...
- QoS的构建模块与机制
本文翻译自ITU-T的Technical Paper:<How to increase QoS/QoE of IP-based platform(s) to regionally agreed ...