博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
oper
阅读量:6090 次
发布时间:2019-06-20

本文共 5686 字,大约阅读时间需要 18 分钟。

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
ipList = null; List
operationNameList = null; List
userCount = null; List
userOperationNameCount = null; List
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
userOperDatas = null; JSONObject chartsUserOperJson = new JSONObject(); Map
userOperDataMap = new HashMap
(); 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
map = new HashMap
(); 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
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(); }}

 

转载地址:http://hymwa.baihongyu.com/

你可能感兴趣的文章
php中的短标签 太坑人了
查看>>
[译] 可维护的 ETL:使管道更容易支持和扩展的技巧
查看>>
### 继承 ###
查看>>
数组扩展方法之求和
查看>>
astah-professional-7_2_0安装
查看>>
函数是对象-有属性有方法
查看>>
uva 10107 - What is the Median?
查看>>
Linux下基本栈溢出攻击【转】
查看>>
c# 连等算式都在做什么
查看>>
使用c:forEach 控制5个换行
查看>>
java web轻量级开发面试教程摘录,java web面试技巧汇总,如何准备Spring MVC方面的面试...
查看>>
使用ansible工具部署ceph
查看>>
linux系列博文---->深入理解linux启动运行原理(一)
查看>>
Android反编译(一) 之反编译JAVA源码
查看>>
结合当前公司发展情况,技术团队情况,设计一个适合的技术团队绩效考核机制...
查看>>
python-45: opener 的使用
查看>>
cad图纸转换完成的pdf格式模糊应该如何操作?
查看>>
Struts2与Struts1区别
查看>>
网站内容禁止复制解决办法
查看>>
Qt多线程
查看>>