某APP实时登录分析项目下
来源:互联网 发布:淘宝客服外包公司注册 编辑:程序博客网 时间:2024/05/22 14:14
- 这一节主要介绍如何使用highmaps制作中国地图,参考地址https://www.hcharts.cn/demo/highmaps/china/grid-light
- 为了简化,这里把下钻的功能去掉,比较源代码和我的代码就能看见哪部分是指的下钻功能。这个地方最重要的构造返回的json数据格式,分析过程有点麻烦,这里我直接写出该结果,返回的格式应为
{"features":[{'properties':{'name':'台湾','filename':'taiwan','num':12},{'properties':{'name':'天津','filename':'tianjin','num':122},{'properties':{'name':'山西','filename':'shanxi','num':32}},{'properties':{'name':'辽宁','filename':'liaoning','num':32}},{'properties':{'name':'北京','filename':'beijing','num':52}},{'properties':{'name':'上海','filename':'shanghai','num':12}},{'properties':{'name':'江苏','filename':'jiangsu','num':132}},{'properties':{'name':'浙江','filename':'zhejiang','num':112}},{'properties':{'name':'吉林','filename':'jilin','num':62}},{'properties':{'name':'湖南','filename':'hunam','num':72}},{'properties':{'name':'江西','filename':'jiangxi','num':52}},{'properties':{'name':'安徽','filename':'anhui','num':12}},{'properties':{'name':'河北','filename':'hubei','num':12}},{'properties':{'name':'福建','filename':'fujian','num':12}},{'properties':{'name':'山东','filename':'shandong','num':12}},{'properties':{'name':'重庆','filename':'zhongqing','num':12}},{'properties':{'name':'河南','filename':'henan','num':32}},{'properties':{'name':'广东','filename':'guangdong','num':52}},{'properties':{'name':'广西','filename':'guangxi','num':12}},{'properties':{'name':'湖北','filename':'hubei','num':12}},{'properties':{'name':'青海','filename':'qinghai','num':62}},{'properties':{'name':'西藏','filename':'xicang','num':62}},{'properties':{'name':'云南','filename':'yunnan','num':82}},{'properties':{'name':'海南','filename':'hainan','num':92}},{'properties':{'name':'陕西','filename':'shanxi2','num':12}},{'properties':{'name':'贵州','filename':'guizhou','num':12}},{'properties':{'name':'香港','filename':'xianggang','num':12}},{'properties':{'name':'宁夏','filename':'ningxia','num':12}},{'properties':{'name':'新疆','filename':'xinjiang','num':12}},{'properties':{'name':'澳门','filename':'aomen','num':12}},{'properties':{'name':'黑龙江','filename':'heilongjiang','num':12}},{'properties':{'name':'四川','filename':'sichuan','num':32}},{'properties':{'name':'甘肃','filename':'gansu','num':22}},{'properties':{'name':'内蒙古','filename':'neimenggu','num':22}},{'properties':{'name':'南海诸岛','filename':'nanhai','num':12}}]}
3.分析servlet
package com.servlet;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import net.sf.json.JSONObject;/** * Servlet implementation class ChinaMapServlet */public class ChinaMapServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ChinaMapServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("post得到请求"); //得到数据 String json=DaoUtil.getMessage().toString(); response.setContentType("application/x-json"); response.setContentType("text/html;charset=utf-8"); PrintWriter print=response.getWriter(); JSONObject jsonArray = JSONObject.fromObject(json); //转换成json数据格式 print.print(jsonArray); print.flush(); print.close(); }}
4.工具类分析,重点在于2中数据格式的构建
public class DaoUtil { static String sql="select * from position"; static Statement st; static String result; public static StringBuffer getMessage() { StringBuffer str=new StringBuffer("{'features':["); try { Connection conn=Dao.getConn(); st=conn.createStatement(); ResultSet re=(ResultSet) st.executeQuery(sql); //re.next(); while (re.next()) { str.append("{'properties':{'name':"+"'"+re.getString(1)+"'"); str.append(",'filename':"+"'"+re.getString(3)+"'"); str.append(",'num':"+re.getInt(2)+"}},"); } result=str.substring(0, str.length()-1); str.delete(0, str.length()); str.append(result); str.append("]}"); System.out.println(str); return str; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } public static void main(String[] args) { System.out.println(DaoUtil.getMessage().toString());}}
5.github地址https://github.com/iareuniqe/web-storm
6.备注为了让两个程序同时跑,我是把代码分成storm和展示层两部分,分别放在了两个eclipse中,同时运行的。如果有问题,可以下面留言解决。
阅读全文
0 0
- 某APP实时登录分析项目下
- 某APP实时登录分析项目上
- 北京实时公交app优缺点分析
- 关于某ios app登录关键字加密分析
- 实时分析之客户画像项目实践
- iOS App 自动登录的安全性分析
- iOS App 自动登录的安全性分析
- iOS App 自动登录的安全性分析
- 利用RunTrace实时跟踪分析iOS App视图
- 商业级项目登录模块源码分析
- 关于某社交app的安全分析,简单介绍下app防止反编译的方法
- (1)Storm实时日志分析实战--项目准备
- Flink实时营销分析--数据部分--项目背景(一)
- Spark项目:知名手机厂商用户行为实时分析系统
- app中使用用户名/邮箱/手机号登录的思路分析
- 百度登录加密协议分析(下)
- Spark 基于pyspark下的实时日志分析
- 源码推荐(10.20):GitHub iPhone 客户端--MrCode,实时跟踪分析iOS App视图的小工具
- C++求圆面积和周长
- Android OpenGL资源汇总
- Spring Boot整合Swagger2
- php微信
- 走进西方音乐感受音乐语言的魅力·六
- 某APP实时登录分析项目下
- 专业课程设计之客户与服务器程序的同步与通信机制的设计(一)项目介绍
- 获取网络图片缓存并展示
- 【剑指offer】面试题15:链表中倒数第k个结点
- php 5.3.9 + apache 2.2.17安装配置教程
- docker下载与安装
- IntelliJ Idea 常用快捷键列表
- Tomcat中JVM内存溢出及合理配置
- Android Things资源汇总