Sfoglia il codice sorgente

Accept Merge Request #2: (develop-wxl -> master)

Merge Request: 提交

Created By: @万新亮
Accepted By: @万新亮
URL: https://chuanghaikeji.coding.net/p/jingandashujupingtai/d/bigdata_houtai/git/merge/2?initial=true
万新亮 2 anni fa
parent
commit
d8253c1ce7
100 ha cambiato i file con 9238 aggiunte e 63 eliminazioni
  1. 40 0
      .gitignore
  2. 13 0
      bigData/.mymetadata
  3. 125 0
      bigData/build.xml
  4. 13 0
      bigData/fuzhuang1 on Tomcat 8.x.launch
  5. 20 5
      bigData/src/applicationContext.xml
  6. 0 1
      bigData/src/com/2
  7. 0 1
      bigData/src/com/happy/3
  8. 0 1
      bigData/src/com/happy/Model/Ban/1
  9. 0 1
      bigData/src/com/happy/Model/Common/1
  10. 0 1
      bigData/src/com/happy/Model/Manager/1
  11. 0 1
      bigData/src/com/happy/Model/Mob/1
  12. 0 1
      bigData/src/com/happy/Model/Smoke/1
  13. 0 1
      bigData/src/com/happy/Model/Tour/1
  14. 68 0
      bigData/src/com/happy/Model/Tour/TravelSecond.java
  15. 0 1
      bigData/src/com/happy/Model/Travel/1
  16. 0 1
      bigData/src/com/happy/Until/1
  17. 0 1
      bigData/src/com/happy/Until/Tencent/1
  18. 0 1
      bigData/src/com/happy/action/3
  19. 125 15
      bigData/src/com/happy/action/TourAction.java
  20. 25 25
      bigData/src/com/happy/action/WarmAction.java
  21. 0 1
      bigData/src/com/happy/action2/1
  22. 0 1
      bigData/src/com/happy/common/1
  23. 519 0
      bigData/src/com/happy/common/http/HttpsClient.java
  24. 23 0
      bigData/src/com/happy/common/http/MyX509TrustManager.java
  25. 146 0
      bigData/src/com/happy/common/util/AESUtil.java
  26. 42 0
      bigData/src/com/happy/common/util/SHA1.java
  27. 53 0
      bigData/src/com/happy/common/wx/WxConfig.java
  28. 53 0
      bigData/src/com/happy/common/wx/WxConstants.java
  29. 381 0
      bigData/src/com/happy/common/wx/WxUtil.java
  30. 0 1
      bigData/src/com/happy/constant/1
  31. 98 0
      bigData/src/com/happy/constant/ConstDefault.java
  32. 86 0
      bigData/src/com/happy/constant/ResultStatusCode.java
  33. 0 1
      bigData/src/com/happy/dao/1
  34. 46 0
      bigData/src/com/happy/dao/CrossDao.java
  35. 13 0
      bigData/src/com/happy/dao/DeviceRankDao.java
  36. 14 0
      bigData/src/com/happy/dao/DevicetDao.java
  37. 12 0
      bigData/src/com/happy/dao/FirstBuffercDao.java
  38. 20 0
      bigData/src/com/happy/dao/FirstBufferpDao.java
  39. 65 0
      bigData/src/com/happy/dao/FirstBuffertDao.java
  40. 13 0
      bigData/src/com/happy/dao/GtmtDao.java
  41. 185 0
      bigData/src/com/happy/dao/Impl/CrossImplDao.java
  42. 57 0
      bigData/src/com/happy/dao/Impl/DeviceRankImplDao.java
  43. 63 0
      bigData/src/com/happy/dao/Impl/DevicetImplDao.java
  44. 65 0
      bigData/src/com/happy/dao/Impl/FirstBuffercImplDao.java
  45. 89 0
      bigData/src/com/happy/dao/Impl/FirstBufferpImplDao.java
  46. 270 0
      bigData/src/com/happy/dao/Impl/FirstBuffertImplDao.java
  47. 60 0
      bigData/src/com/happy/dao/Impl/GtmtImplDao.java
  48. 239 0
      bigData/src/com/happy/dao/Impl/ManagerImplDao.java
  49. 143 0
      bigData/src/com/happy/dao/Impl/MobImplDao.java
  50. 96 0
      bigData/src/com/happy/dao/Impl/SecondBufferPImplDao.java
  51. 488 0
      bigData/src/com/happy/dao/Impl/SecondBuffertImplDao.java
  52. 71 0
      bigData/src/com/happy/dao/Impl/SmlmtImplDao.java
  53. 74 0
      bigData/src/com/happy/dao/Impl/SmtImplDao.java
  54. 142 0
      bigData/src/com/happy/dao/Impl/ThirdBuffertImplDao.java
  55. 913 0
      bigData/src/com/happy/dao/Impl/TourImplDao.java
  56. 398 0
      bigData/src/com/happy/dao/Impl/TouristAnalysisDao.java
  57. 41 0
      bigData/src/com/happy/dao/Impl/TownImplDao.java
  58. 163 0
      bigData/src/com/happy/dao/Impl/TravelImplDao.java
  59. 675 0
      bigData/src/com/happy/dao/Impl/UserImplDao.java
  60. 57 0
      bigData/src/com/happy/dao/ManagerDao.java
  61. 52 0
      bigData/src/com/happy/dao/MobDao.java
  62. 22 0
      bigData/src/com/happy/dao/SecondBufferPDao.java
  63. 108 0
      bigData/src/com/happy/dao/SecondBuffertDao.java
  64. 17 0
      bigData/src/com/happy/dao/SmlmtDao.java
  65. 16 0
      bigData/src/com/happy/dao/SmtDao.java
  66. 35 0
      bigData/src/com/happy/dao/ThirdBuffertDao.java
  67. 207 0
      bigData/src/com/happy/dao/TourDao.java
  68. 10 0
      bigData/src/com/happy/dao/TownDao.java
  69. 31 0
      bigData/src/com/happy/dao/TravelDao.java
  70. 129 0
      bigData/src/com/happy/dao/UserDao.java
  71. 0 1
      bigData/src/com/happy/filter/1
  72. 31 0
      bigData/src/com/happy/filter/CharacterEncodingFilter.java
  73. 52 0
      bigData/src/com/happy/filter/LoginFilter.java
  74. 0 1
      bigData/src/com/happy/service/1
  75. 46 0
      bigData/src/com/happy/service/CrossService.java
  76. 13 0
      bigData/src/com/happy/service/DeviceRankService.java
  77. 14 0
      bigData/src/com/happy/service/DevicetService.java
  78. 12 0
      bigData/src/com/happy/service/FirstBuffercService.java
  79. 17 0
      bigData/src/com/happy/service/FirstBufferpService.java
  80. 47 0
      bigData/src/com/happy/service/FirstBuffertService.java
  81. 13 0
      bigData/src/com/happy/service/GtmtService.java
  82. 149 0
      bigData/src/com/happy/service/Impl/CrossImplService.java
  83. 25 0
      bigData/src/com/happy/service/Impl/DeviceRankImplService.java
  84. 26 0
      bigData/src/com/happy/service/Impl/DevicetImplService.java
  85. 24 0
      bigData/src/com/happy/service/Impl/FirstBuffercImplService.java
  86. 35 0
      bigData/src/com/happy/service/Impl/FirstBufferpImplService.java
  87. 131 0
      bigData/src/com/happy/service/Impl/FirstBuffertImplService.java
  88. 25 0
      bigData/src/com/happy/service/Impl/GtmtImplService.java
  89. 178 0
      bigData/src/com/happy/service/Impl/ManagerImplService.java
  90. 97 0
      bigData/src/com/happy/service/Impl/MobImplService.java
  91. 38 0
      bigData/src/com/happy/service/Impl/SecondBufferPImplService.java
  92. 212 0
      bigData/src/com/happy/service/Impl/SecondBuffertImplService.java
  93. 30 0
      bigData/src/com/happy/service/Impl/SmlmtImplService.java
  94. 29 0
      bigData/src/com/happy/service/Impl/SmtImplService.java
  95. 61 0
      bigData/src/com/happy/service/Impl/ThirdBuffertImplService.java
  96. 549 0
      bigData/src/com/happy/service/Impl/TourImplService.java
  97. 379 0
      bigData/src/com/happy/service/Impl/TouristAnalysisServiceImpl.java
  98. 21 0
      bigData/src/com/happy/service/Impl/TownImplService.java
  99. 55 0
      bigData/src/com/happy/service/Impl/TravelImplService.java
  100. 0 0
      bigData/src/com/happy/service/Impl/UserImplService.java

+ 40 - 0
.gitignore

@@ -0,0 +1,40 @@
+# Java
+*.class
+*.jar
+*.war
+*.ear
+
+# Eclipse
+.project
+.classpath
+.settings
+
+# Idea
+.idea
+*.iml
+*.iws
+*.ipr
+
+# OS
+Thumbs.db
+.DS_Store
+
+# Gradle
+.gradle
+!gradle-wrapper.jar
+
+# Maven
+target
+
+# Build
+out
+build
+bin
+
+# Other
+*.log
+*.swp
+*.bak
+
+*.zip
+bigData/WebRoot/

+ 13 - 0
bigData/.mymetadata

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-module
+  type="WEB"
+  name="HappysSystem"
+  id="myeclipse.1460117629151"
+  context-root="/HappysSystem"
+  j2ee-spec="5.0"
+  archive="HappysSystem.war">
+  <attributes>
+    <attribute name="webrootdir" value="WebRoot" />
+  </attributes>
+</project-module>
+

+ 125 - 0
bigData/build.xml

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="fuzhuang1" basedir=".">
+	<!-- 变量设置-->
+	<property name="debug" value="true" />
+	<property name="project.name" value="${project.name}" />
+	<property name="project.version" value="${project.version}" />
+	<property name="web" value="WebRoot" />
+	<property name="lib.dir" value="${lib.dir}" />
+	<property name="src.dir" value="src" />
+	<property name="classes" value="${web}/WEB-INF/classes" />
+	<property name="release.dir" value="dist" />
+	<property name="ear.exploded.dir" location="${release.dir}/${project.name}" />
+	<property name="context.tomcat.dir" location="${tomcat.dir}/webapps" />
+	<property name="deploy.exploded.dir" location="${release.dir}/${project.name}" />
+	<property name="context.weblogic.dir" location="${weblogic.dir}/autodeploy" />
+
+	<!-- project.class.path-->
+	<path id="project.class.path">
+		<fileset dir="${lib.dir}">
+			<include name="**/*.jar" />
+		</fileset>
+	</path>
+
+	<target name="clean">
+		<!--clean-->
+		<delete file="${release.dir}/${project.name}.war" />
+		<delete dir="${release.dir}/weblogic" />
+		<delete dir="${tomcat.dir}/webapps/${project.name}" />
+		<delete dir="${tomcat.dir}/work/Catalina/" />
+	</target>
+	<target name="init">
+		<!--clean-->
+		<delete dir="${classes}" />
+	</target>
+
+	<target name="compile">
+		<mkdir dir="${classes}" />
+		<mkdir dir="${release.dir}" />
+
+		<!--compile-->
+		<javac encoding="utf-8" deprecation="on" debug="${debug}" srcdir="${src.dir}" destdir="${classes}" target="1.8">
+			<classpath refid="project.class.path" />
+		</javac>
+	</target>
+
+	<target name="exploded-ear" depends="compile">
+		<!--<copy todir="${ear.exploded.dir}/META-INF">
+			<fileset dir="config/app" />
+		</copy>-->
+		<!--init-->
+		<tstamp />
+
+		<copy todir="${classes}">
+			<fileset dir="${src.dir}">
+				<include name="**/*.xml" />
+				<include name="**/*.properties" />
+			</fileset>
+		</copy>
+
+		<!--exploded-ear-->
+		<mkdir dir="${ear.exploded.dir}/${project.name}.war" />
+		<copy todir="${ear.exploded.dir}/${project.name}.war">
+			<fileset dir="${web}" />
+		</copy>
+
+		<copy todir="${ear.exploded.dir}/${project.name}.war/WEB-INF/lib">
+			<fileset dir="${lib.dir}" >
+				<exclude name="${project.name}-dto-${project.version}.jar" />
+			</fileset>
+		</copy>
+
+	</target>
+	
+	<target name="deploy_uat" depends="init,compile,exploded-ear">
+		<property name="host" value="${ssh.remote.host.uat}" />
+		<property name="user" value="${ssh.remote.username.uat}" />
+		<property name="pass" value="${ssh.remote.password.uat}" />
+		<property name="app.dir" value="${ssh.remote.app.dir.uat}" />
+
+		<!-- 配置文件调整 -->
+		<copy todir="${ear.exploded.dir}/${project.name}.war/WEB-INF/classes" overwrite="true">
+			<fileset dir="config/${project.config.uat}" />
+		</copy>
+		<!--前端授权文件调整-->
+		<copy todir="${ear.exploded.dir}/${project.name}.war/static/public/js" overwrite="true">
+			<fileset dir="config/${project.config.uat}/jsp" />
+		</copy>
+		<!--build-ear-->
+		<delete file="${release.dir}/${project.name}.war" />
+		<jar jarfile="${release.dir}/${project.name}.war" basedir="${ear.exploded.dir}/${project.name}.war">
+			<manifest>
+				<attribute name="Built-By" value="${user.name}" />
+				<attribute name="Specification-Version" value="${project.version}" />
+				<attribute name="CreateTime" value="${DSTAMP} ${TSTAMP}" />
+			</manifest>
+		</jar>
+
+		<delete dir="${release.dir}/${project.name}.war" />
+
+		<!--_deploy-->
+		<tstamp />
+		<echo message="上传打包文件...开始" />
+		<scp file="${release.dir}/${project.name}.war" todir="${user}:${pass}@${host}:${app.dir}" trust="true" />
+		<echo message="上传打包文件...结束" />
+
+	</target>
+
+	<target name="deploy-to-local" depends="exploded-ear">
+		<!-- 配置文件调整
+		<copy todir="${ear.exploded.dir}/${project.name}.war" overwrite="true">
+			<fileset dir="src/config/${project.config.dev}" />
+		</copy> -->
+		
+		<copy todir="${context.tomcat.dir}/${project.name}">
+			<fileset dir="${deploy.exploded.dir}/${project.name}.war" />
+		</copy>
+	</target>
+	<target name="deploy-to-tomcat" depends="exploded-ear">
+		<mkdir dir="${context.tomcat.dir}/${project.name}" />
+		<copy todir="${context.tomcat.dir}/${project.name}">
+			<fileset dir="${ear.exploded.dir}" />
+		</copy>
+	</target>
+	
+</project>

+ 13 - 0
bigData/fuzhuang1 on Tomcat 8.x.launch

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="com.genuitec.eclipse.ast.deploy.core.runonserver">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/fuzhuang1"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="runonserver.exploded" value="true"/>
+<stringAttribute key="runonserver.project" value="fuzhuang1"/>
+<stringAttribute key="runonserver.server" value="tomcat8Server"/>
+<booleanAttribute key="runoserver.restart" value="true"/>
+</launchConfiguration>

+ 20 - 5
bigData/src/applicationContext.xml

@@ -4,6 +4,7 @@
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:task="http://www.springframework.org/schema/task"
        xmlns:jee="http://www.springframework.org/schema/jee"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="
@@ -11,25 +12,36 @@
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
+        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
     <!-- 设置需要进行Spring注解扫描的类包 -->
     <context:component-scan base-package="com.happy" />
 
     <!-- 配置数据源 -->
     <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
+
+        <!--<property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>-->
+        <!--<property name="url" value="jdbc:mysql://192.168.161.220:3306/bigdata?useCursorFetch=true&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8&amp;useSSL=false&amp;serverTimezone=UTC"></property>-->
+        <!--<property name="password" value="root"></property>-->
         <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
         <property name="url" value="jdbc:mysql://6.205.66.5:3306/bigdata?useCursorFetch=true&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"></property>
-        <property name="username" value="root"></property>
         <property name="password" value="Ro0!ot_369!"></property>
+        <property name="username" value="root"></property>
+
 
         <!-- 配置获取连接等待超时的时间 -->
         <property name="maxWait" value="60000" />
-
+        <property name="maxActive" value="20" />
         <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
         <property name="timeBetweenEvictionRunsMillis" value="60000" />
 
         <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
-        <property name="minEvictableIdleTimeMillis" value="300000" />
+        <property name="minEvictableIdleTimeMillis" value="90000" />
+        <!-- 关闭长时间不使用的连接,防止连接池泄漏 -->
+        <property name="removeAbandoned"  value="true"  />
+        <!-- 打开removeAbandoned功能 -->
+        <property  name="removeAbandonedTimeout"  value="600"  />  <!-- 秒-->
+
 
         <property name="validationQuery" value="SELECT 'x'" />
         <property name="testWhileIdle" value="true" />
@@ -37,8 +49,8 @@
         <property name="testOnReturn" value="false" />
 
         <!-- 打开PSCache,并且指定每个连接上PSCache的大小(Oracle使用) -->
-        <!-- <property name="poolPreparedStatements" value="true" />
-        <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />   -->
+         <property name="poolPreparedStatements" value="true" />
+        <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
 
         <!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->
         <property name="filters" value="stat" />
@@ -88,5 +100,8 @@
                       expression="execution(* com.happy.service.*.*(..))" />
         <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" />
     </aop:config>
+    <!-- 配置定时任务 -->
+    <task:annotation-driven />
+    <task:scheduler id="dataScheduler" pool-size="5"/>
 
 </beans>

+ 0 - 1
bigData/src/com/2

@@ -1 +0,0 @@
-2

+ 0 - 1
bigData/src/com/happy/3

@@ -1 +0,0 @@
-3

+ 0 - 1
bigData/src/com/happy/Model/Ban/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/Model/Common/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/Model/Manager/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/Model/Mob/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/Model/Smoke/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/Model/Tour/1

@@ -1 +0,0 @@
-1

+ 68 - 0
bigData/src/com/happy/Model/Tour/TravelSecond.java

@@ -0,0 +1,68 @@
+package com.happy.Model.Tour;
+
+public class TravelSecond {
+
+    public Integer id;
+    public String placceName;
+    public String placceId;
+    public Integer totalNum;
+    public Integer dayNum;
+    public Integer maxValue;
+    public String dayId;
+
+
+    public String getPlaceId() {
+        return placceId;
+    }
+
+    public void setPlaceId(String placceId) {
+        this.placceId = placceId;
+    }
+    public Integer getId() {
+        return id;
+    }
+
+    public String getDayId() {
+        return dayId;
+    }
+
+    public void setDayId(String dayId) {
+        this.dayId = dayId;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getPlaceName() {
+        return placceName;
+    }
+
+    public void setPlaceName(String placceName) {
+        this.placceName = placceName;
+    }
+
+    public Integer getTotalNum() {
+        return totalNum;
+    }
+
+    public void setTotalNum(Integer totalNum) {
+        this.totalNum = totalNum;
+    }
+
+    public Integer getDayNum() {
+        return dayNum;
+    }
+
+    public void setDayNum(Integer dayNum) {
+        this.dayNum = dayNum;
+    }
+
+    public Integer getMaxValue() {
+        return maxValue;
+    }
+
+    public void setMaxValue(Integer maxValue) {
+        this.maxValue = maxValue;
+    }
+}

+ 0 - 1
bigData/src/com/happy/Model/Travel/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/Until/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/Until/Tencent/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/action/3

@@ -1 +0,0 @@
-1

+ 125 - 15
bigData/src/com/happy/action/TourAction.java

@@ -1,21 +1,27 @@
 package com.happy.action;
 
 import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 import com.happy.Model.Secondplace;
-import com.happy.Model.Tour.City;
-import com.happy.Model.Tour.Hotel;
-import com.happy.Model.Tour.TourDayt;
-import com.happy.Model.Tour.Tourx;
+import com.happy.Model.Tour.*;
 import com.happy.Model.Travel.*;
 import com.happy.Model.User;
+import com.happy.Until.GetHttpParam;
+import com.happy.Until.ResUtil;
 import com.happy.Until.ResponseUtil;
 import com.happy.Until.TimeExchange;
+import com.happy.common.util.AESUtil;
+import com.happy.dao.SecondBuffertDao;
 import com.happy.service.TourService;
+import com.happy.service.TouristAnalysisService;
 import com.opensymphony.xwork2.ActionSupport;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.interceptor.ServletRequestAware;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.scheduling.annotation.Scheduled;
 import sun.security.krb5.internal.PAForUserEnc;
 
 import javax.annotation.Resource;
@@ -24,6 +30,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
 
 public class TourAction extends ActionSupport implements ServletRequestAware {
@@ -56,6 +63,12 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
     public Integer m;
     public String gender;
 
+    @Autowired
+    public SecondBuffertDao secondBuffertDao;
+
+    @Autowired
+    private TouristAnalysisService touristAnalysisService;
+
     @Resource
     public TourService tourService;
 
@@ -274,7 +287,7 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
     // 当日访客统计
     public String queryTodayT(){
         JSONObject resultJson = new JSONObject();
-        TourDayt td = tourService.queryTotalTour("");
+        TourDayt td = tourService.queryTotalTour(TimeExchange.getDate());
         resultJson.put("code", 200);
         resultJson.put("message", "返回成功");
         resultJson.put("data", td);
@@ -363,6 +376,16 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
                     resultJson.toString());
             return null;
         }
+        for (TravelT travelT:ar) {
+            TravelSecond travelSecond=secondBuffertDao.queryTravelSecond(travelT.getPlace());
+            if(travelSecond!=null){
+                travelT.setInCount(String.valueOf(travelSecond.getDayNum()));
+            }
+            if ("中华传统文化园".equals(travelT.getPlace())){
+               TravelT travel=touristAnalysisService.getTravelRecordByDateStr(TimeExchange.getDate(),travelT.getPlace());
+                travelT.setInCount(travel.getInCount());
+            }
+        }
         resultJson.put("code", 200);
         resultJson.put("message", "返回成功");
         resultJson.put("data", ar);
@@ -481,16 +504,16 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
             Calendar calendar = Calendar.getInstance();
             calendar.add(Calendar.MONTH, i);
             String date = simpleDateFormat.format(calendar.getTime());
-            TourDayt lt = tourService.queryTotalTourOther(date);
-            if (lt==null || lt.getDateTime()==null){
-                lt = new TourDayt();
-                lt.setDateTime(date);
-                lt.setNum("0");
-            } else {
-                lt.setDateTime(date);
-            }
-            List<TourDayt> ld = tourService.queryTourByMonth(lt.getDateTime());
+            List<TourDayt> ld = tourService.queryTourByMonth(date);
             if (ld==null){
+                TourDayt lt = tourService.queryTotalTourOther(date);
+                if (lt==null || lt.getDateTime()==null){
+                    lt = new TourDayt();
+                    lt.setDateTime(date);
+                    lt.setNum("0");
+                } else {
+                    lt.setDateTime(date);
+                }
                 tourService.insertMonth(lt);
                 System.out.println(lt.getDateTime());
             }
@@ -655,6 +678,7 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
     }
 
     // 每小时数据导入
+//    @Scheduled(cron ="0 0 * * * ?")
     public String insertHour(){
         if (m==null){
             m=2;
@@ -673,6 +697,7 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
             }
             TourDayt exist = tourService.queryExistHour(date);
             if (exist==null){
+                td.setDateTime(date);
                 tourService.insertHour(td);
             }
         }
@@ -694,7 +719,7 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
         return null;
     }
 
-    // 日12小时趋势
+    // 日12小时趋势
     public String queryTodayHourHistory(){
         JSONObject resultJson = new JSONObject();
         List<TourDayt> ar = tourService.queryTodayHourHistory();
@@ -1064,6 +1089,15 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
     // 最大访客量
     public String queryMaxTour(){
         JSONObject resultJson = new JSONObject();
+        TravelSecond travelSecond=secondBuffertDao.queryTravelSecond(place_name);
+        if(travelSecond!=null){
+            resultJson.put("LjNum", travelSecond.getTotalNum());
+            resultJson.put("dayNum", travelSecond.getDayNum());
+            resultJson.put("maxNum", travelSecond.getMaxValue());
+            ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                    resultJson.toString());
+            return null;
+        }
         int m = tourService.queryMaxTour(place_name);
         int n = 0;
         String n2 = "0";
@@ -1075,6 +1109,9 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
         if (num3!=null){
             n2 = String.valueOf(num3.get(0).getInCount());
         }
+        if(place_name.equals("中华传统文化园")){
+            n=Integer.parseInt(touristAnalysisService.getTravelRecordByDateStr(TimeExchange.getDate(),place_name).inCount);
+        }
         resultJson.put("LjNum", n2);
         resultJson.put("dayNum", n);
         resultJson.put("maxNum", m);
@@ -1181,4 +1218,77 @@ public class TourAction extends ActionSupport implements ServletRequestAware {
                 resultJson.toString());
         return null;
     }
+
+    public static void main(String[] args) {
+        SimpleDateFormat sp = new SimpleDateFormat("yyyyMMdd");
+        String code=sp.format(new Date());
+        String decrypt=AESUtil.decrypt(code,"JingAnTravel");
+        String encode= AESUtil.encrypt(code,"JingAnTravel");
+        System.out.println("加密前:"+code+"加密后:"+encode);
+    }
+
+    // 景区上传信息
+    public String InUserSm(){
+        JSONObject resultjson = new JSONObject();
+        String code =request.getHeader("apikey");
+        String decrypt=AESUtil.decrypt(code,"JingAnTravel");
+        System.out.println("解密前:"+code+"解密后:"+decrypt);
+        System.out.println("景区上传信息");
+        SimpleDateFormat sp = new SimpleDateFormat("yyyyMMdd");
+        String time=sp.format(new Date());
+        if(!time.equals(decrypt)){
+            resultjson.put("msg", "key校验失败");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+            return null;
+        }
+        Gson gson=new Gson();
+        JSONObject json = GetHttpParam.getHttpParam(request);
+        System.out.println(json);
+        if (json == null){
+            resultjson.put("msg", "请传入参数");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+            return null;
+        }
+        TravelSecond travelSecond = gson.fromJson(json.toString(), new TypeToken<TravelSecond>(){}.getType());
+
+        int num =secondBuffertDao.insertTravelSecond(travelSecond,TimeExchange.getDate());
+        resultjson.put("msg", "上传"+num+"条成功");
+        resultjson.put("code", "200");
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+        return null;
+    }
+
+    // 查询景区信息
+    public String queryPlaceInfo(){
+        JSONObject resultJson = new JSONObject();
+        String code =request.getHeader("apikey");
+        String decrypt=AESUtil.decrypt(code,"JingAnTravel");
+        System.out.println("解密前:"+code+"解密后:"+decrypt);
+        System.out.println("景区上传信息");
+        SimpleDateFormat sp = new SimpleDateFormat("yyyyMMdd");
+        String time=sp.format(new Date());
+        if(!time.equals(decrypt)){
+            resultJson.put("msg", "key校验失败");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }
+        if (place_name==null||place_name==""){
+            System.out.println("查询景区信息");
+            List<Secondplace> list=secondBuffertDao.queryJd();
+            resultJson.put("msg", "查询成功");
+            resultJson.put("code", "200");
+            resultJson.put("data", list);
+            ResUtil.writeJson(ServletActionContext.getResponse(),
+                    resultJson.toString());
+            return null;
+        }
+        System.out.println("查询"+place_name+"景区信息");
+        List<Secondplace> list=secondBuffertDao.queryJdByname(place_name);
+        resultJson.put("msg", "查询成功");
+        resultJson.put("code", "200");
+        resultJson.put("data", list);
+        ResUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
 }

+ 25 - 25
bigData/src/com/happy/action/WarmAction.java

@@ -65,31 +65,31 @@ public class WarmAction extends ActionSupport implements ServletRequestAware {
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
         }
-        ApplicationContext ac = new ClassPathXmlApplicationContext(
-                "applicationContext.xml");
-        DataSource dataSource = (DataSource) ac.getBean("slaveDataSource2");
-        Connection conn = null;
-        StringBuilder sql = new StringBuilder
-                ("insert into `warning_of_smoke_record`(`publish_time`,`place`,`images`,`handle_status`,`handle_desc`) values ");
-        try{
-            conn = dataSource.getConnection();
-            sql.append("('").append(warm.getPublish_time()).append("','").append(warm.getPlace()).append("','").append(warm.getImages()).append("','").append(warm.getHandle_status()).append("','").append(warm.getHandle_desc()).append("') ");
-            PreparedStatement ps = conn.prepareStatement(sql.toString());
-            ps.execute();
-            ps.close();
-        } catch (Exception e){
-            e.printStackTrace();
-        } finally {
-            try {
-                if (conn != null) {
-                    conn.close();
-                }
-            } catch (SQLException e) {
-                // TODO: handle exception
-            }
-        }
-        resultJson.put("message", "导入成功");
-        resultJson.put("code", 200);
+//        ApplicationContext ac = new ClassPathXmlApplicationContext(
+//                "applicationContext.xml");
+//        DataSource dataSource = (DataSource) ac.getBean("slaveDataSource2");
+//        Connection conn = null;
+//        StringBuilder sql = new StringBuilder
+//                ("insert into `warning_of_smoke_record`(`publish_time`,`place`,`images`,`handle_status`,`handle_desc`) values ");
+//        try{
+//            conn = dataSource.getConnection();
+//            sql.append("('").append(warm.getPublish_time()).append("','").append(warm.getPlace()).append("','").append(warm.getImages()).append("','").append(warm.getHandle_status()).append("','").append(warm.getHandle_desc()).append("') ");
+//            PreparedStatement ps = conn.prepareStatement(sql.toString());
+//            ps.execute();
+//            ps.close();
+//        } catch (Exception e){
+//            e.printStackTrace();
+//        } finally {
+//            try {
+//                if (conn != null) {
+//                    conn.close();
+//                }
+//            } catch (SQLException e) {
+//                // TODO: handle exception
+//            }
+//        }
+        resultJson.put("message", "拒绝访问");
+        resultJson.put("code", 500);
         ResponseUtil.writeJson(ServletActionContext.getResponse(),
                 resultJson.toString());
         return null;

+ 0 - 1
bigData/src/com/happy/action2/1

@@ -1 +0,0 @@
-1

+ 0 - 1
bigData/src/com/happy/common/1

@@ -1 +0,0 @@
-1

+ 519 - 0
bigData/src/com/happy/common/http/HttpsClient.java

@@ -0,0 +1,519 @@
+package com.happy.common.http;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.Common.Message;
+import com.happy.Until.CreateSign1;
+import com.happy.Until.TimeExchange;
+import com.happy.common.wx.WxConfig;
+import com.happy.common.wx.WxConstants;
+import com.happy.common.wx.WxUtil;
+import net.sf.json.JSONArray;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * HttpsClient类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class HttpsClient {
+
+    /**
+     * GET请求方式
+     */
+    public static final String METHOD_GET = "GET";
+    /**
+     * POST请求方式
+     */
+    public static final String METHOD_POST = "POST";
+    /**
+     * 连接超时时间
+     */
+    private static Integer CONNECTION_TIMEOUT = WxConfig.connectionTimeout;
+    /**
+     * 请求超时时间
+     */
+    private static Integer READ_TIMEOUT = WxConfig.readTimeout;
+
+    /**
+     * 发起https请求
+     * @param requestUrl 请求地址
+     * @param requestMethod 请求方式(Get或者post)
+     * @param postData 提交数据
+     * @return JSONObject
+     */
+    public static JSONObject httpsRequestReturnJSONObject(String requestUrl, String requestMethod, String postData) throws Exception{
+        JSONObject  jsonObject = JSONObject.parseObject(HttpsClient.httpsRequestReturnString(requestUrl,requestMethod,postData));
+        System.out.println("jsonObjectDate:  " + jsonObject);
+        return jsonObject;
+    }
+
+
+    /**
+     * 发起https请求
+     * @param requestUrl 请求地址
+     * @param requestMethod 请求方式(Get或者post)
+     * @param postData 提交数据
+     * @return String
+     */
+    public static String httpsRequestReturnString(String requestUrl, String requestMethod, String postData) throws Exception{
+        String response;
+        HttpsURLConnection httpsUrlConnection = null;
+        try{
+            //创建https请求证书
+            TrustManager[] tm={new MyX509TrustManager()};
+            //创建SSLContext管理器对像,使用我们指定的信任管理器初始化
+            SSLContext sslContext=SSLContext.getInstance("SSL","SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            SSLSocketFactory ssf=sslContext.getSocketFactory();
+
+            // 创建URL对象
+            URL url= new URL(requestUrl);
+            // 创建HttpsURLConnection对象,并设置其SSLSocketFactory对象
+            httpsUrlConnection=(HttpsURLConnection)url.openConnection();
+            //设置ssl证书
+            httpsUrlConnection.setSSLSocketFactory(ssf);
+
+            //设置header信息
+            httpsUrlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+            //设置User-Agent信息
+            httpsUrlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
+            //设置可接受信息
+            httpsUrlConnection.setDoOutput(true);
+            //设置可输入信息
+            httpsUrlConnection.setDoInput(true);
+            //不使用缓存
+            httpsUrlConnection.setUseCaches(false);
+            //设置请求方式(GET/POST)
+            httpsUrlConnection.setRequestMethod(requestMethod);
+            //设置连接超时时间
+            if (CONNECTION_TIMEOUT > 0) {
+                httpsUrlConnection.setConnectTimeout(CONNECTION_TIMEOUT);
+            } else {
+                //默认10秒超时
+                httpsUrlConnection.setConnectTimeout(10000);
+            }
+            //设置请求超时
+            if (READ_TIMEOUT > 0) {
+                httpsUrlConnection.setReadTimeout(READ_TIMEOUT);
+            } else {
+                //默认10秒超时
+                httpsUrlConnection.setReadTimeout(10000);
+            }
+            //设置编码
+            httpsUrlConnection.setRequestProperty("Charsert", WxConstants.DEFAULT_CHARSET);
+
+            //判断是否需要提交数据
+            if(StringUtils.equals(requestMethod,HttpsClient.METHOD_POST) && StringUtils.isNotBlank(postData)){
+                //讲参数转换为字节提交
+                byte[] bytes = postData.getBytes(WxConstants.DEFAULT_CHARSET);
+                //设置头信息
+                httpsUrlConnection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
+                //开始连接
+                httpsUrlConnection.connect();
+                //防止中文乱码
+                OutputStream outputStream=httpsUrlConnection.getOutputStream();
+                outputStream.write(postData.getBytes(WxConstants.DEFAULT_CHARSET));
+                outputStream.flush();
+                outputStream.close();
+            }else{
+                //开始连接
+                httpsUrlConnection.connect();
+            }
+            response = WxUtil.getStreamString(httpsUrlConnection.getInputStream());
+        }catch (Exception e){
+            throw new Exception();
+        }finally {
+            if (httpsUrlConnection != null) {
+                // 关闭连接
+                httpsUrlConnection.disconnect();
+            }
+        }
+        return response;
+    }
+
+
+    public static void get(String url, Map<String, String> params){
+        CloseableHttpClient httpClient = null;
+        HttpGet httpGet = null;
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
+            String ps = "";
+            for (String pKey : params.keySet()) {
+                if(!"".equals(ps)){
+                    ps = ps + "&";
+                }
+                ps = pKey+"="+params.get(pKey);
+            }
+            if(!"".equals(ps)){
+                url = url + "?" + ps;
+            }
+            httpGet = new HttpGet(url);
+            httpGet.setConfig(requestConfig);
+            CloseableHttpResponse response = httpClient.execute(httpGet);
+            HttpEntity httpEntity = response.getEntity();
+            System.out.println(EntityUtils.toString(httpEntity,"utf-8"));
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }finally{
+            try {
+                if(httpGet!=null){
+                    httpGet.releaseConnection();
+                }
+                if(httpClient!=null){
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static String get(String strURL) throws Exception{
+
+        URL url = new URL(strURL);
+        HttpURLConnection httpConn = (HttpURLConnection)
+                url.openConnection();
+        httpConn.setRequestMethod("GET");
+        httpConn.connect();
+        System.out.println("bbb: "+httpConn.getResponseCode());
+        BufferedReader reader = new BufferedReader(new InputStreamReader(
+                httpConn.getInputStream(),"utf-8"));
+        String line;
+        StringBuffer buffer = new StringBuffer();
+        while ((line = reader.readLine()) != null) {
+            buffer.append(line);
+        }
+        reader.close();
+        httpConn.disconnect();
+
+        return buffer.toString();
+    }
+
+    /**
+     * 发送 post请求
+     * @param
+     * @param
+     */
+    public static void post(String url, Map<String, String> params){
+        CloseableHttpClient httpClient = null;
+        HttpPost httpPost = null;
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
+            httpPost = new HttpPost(url);
+            httpPost.setConfig(requestConfig);
+            List<NameValuePair> ps = new ArrayList<NameValuePair>();
+            for (String pKey : params.keySet()) {
+                ps.add(new BasicNameValuePair(pKey, params.get(pKey)));
+            }
+            httpPost.setEntity(new UrlEncodedFormEntity(ps));
+            CloseableHttpResponse response = httpClient.execute(httpPost);
+            HttpEntity httpEntity = response.getEntity();
+            System.out.println(EntityUtils.toString(httpEntity,"utf-8"));
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }finally{
+            try {
+                if(httpPost!=null){
+                    httpPost.releaseConnection();
+                }
+                if(httpClient!=null){
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    //url表示请求链接,param表示json格式的请求参数		//自定义菜单创建访问方式
+    public static String sendPost(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性 注意Authorization生成
+            // conn.setRequestProperty("Content-Type",
+            // "application/x-www-form-urlencoded");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(),"utf-8"));
+            // 发送请求参数
+            out.print("&"+param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream(),"utf-8"));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+
+    //url表示请求链接,param表示json格式的请求参数		//自定义菜单创建访问方式
+    public static String sendPost2(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            HttpsURLConnection httpsUrlConnection = null;
+            //创建https请求证书
+            TrustManager[] tm={new MyX509TrustManager()};
+            //创建SSLContext管理器对像,使用我们指定的信任管理器初始化
+            SSLContext sslContext=SSLContext.getInstance("SSL","SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            SSLSocketFactory ssf=sslContext.getSocketFactory();
+            // 创建URL对象
+            URL realUrl= new URL(url);
+            // 创建HttpsURLConnection对象,并设置其SSLSocketFactory对象,
+            // 打开和URL之间的连接
+            httpsUrlConnection=(HttpsURLConnection)realUrl.openConnection();
+            //设置ssl证书
+            httpsUrlConnection.setSSLSocketFactory(ssf);
+            // 设置通用的请求属性 注意Authorization生成
+            // conn.setRequestProperty("Content-Type",
+            // "application/x-www-form-urlencoded");
+            // 发送POST请求必须设置如下两行
+            httpsUrlConnection.setRequestMethod("POST");
+            httpsUrlConnection.setDoOutput(true);
+            httpsUrlConnection.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(new OutputStreamWriter(httpsUrlConnection.getOutputStream(),"utf-8"));
+            // 发送请求参数
+            out.print("&"+param);
+            // flush输出流的缓冲
+            out.flush();
+            if (httpsUrlConnection.getResponseCode()==200) {
+                // 定义BufferedReader输入流来读取URL的响应
+                in = new BufferedReader(
+                        new InputStreamReader(httpsUrlConnection.getInputStream(), "utf-8"));
+                String line;
+                while ((line = in.readLine()) != null) {
+                    result += line;
+                }
+            }else {
+                result = "获取输入流异常!";
+            }
+        } catch (Exception e) {
+            System.out.println("发送 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    public static String dateToStamp(String s) throws Exception {
+        String res = "";
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date = simpleDateFormat.parse(s);
+        long time = date.getTime();
+        res = String.valueOf(time);
+        return res;
+    }
+
+    /*
+     * 将时间戳转换为时间
+     */
+    public static String stampToDate(String s){
+        String res;
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long lt = new Long(s);
+        Date date = new Date(lt);
+        res = simpleDateFormat.format(date);
+        return res;
+    }
+
+    public static String sendJson(String request_url, JSONObject json) {
+        OutputStreamWriter out = null;
+        InputStream is = null;
+        String result = "";
+        try {
+            URL url = new URL(request_url);// 创建连接
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setUseCaches(false);
+            connection.setInstanceFollowRedirects(true);
+            connection.setRequestMethod("POST"); // 设置请求方式
+            // 设置接收数据的格式
+            connection.setRequestProperty("Accept", "application/json");
+            // 设置发送数据的格式
+            connection.setRequestProperty("Content-Type", "application/json");
+            connection.connect();
+            out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+            out.append(json.toString());
+            out.flush();
+            out.close();
+            // 读取响应
+            is = connection.getInputStream();
+            int length = (int) connection.getContentLength();// 获取字节长度
+            System.out.println(length);
+            if (length != -1) {
+                byte[] data = new byte[length];
+                byte[] temp = new byte[512];
+                int readLen = 0;
+                int destPos = 0;
+                while ((readLen = is.read(temp)) > 0) {
+                    System.arraycopy(temp, 0, data, destPos, readLen);
+                    destPos += readLen;
+                }
+                result = new String(data, "UTF-8"); // utf-8编码
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    public static String sendJson2(String request_url, JSONObject json) throws Exception{
+        OutputStreamWriter out = null;
+        InputStream is = null;
+        String result = "";
+        try {
+            //创建https请求证书
+            TrustManager[] tm={new MyX509TrustManager()};
+            //创建SSLContext管理器对像,使用我们指定的信任管理器初始化
+            SSLContext sslContext=SSLContext.getInstance("SSL","SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            SSLSocketFactory ssf=sslContext.getSocketFactory();
+
+            URL url = new URL(request_url);// 创建连接
+            HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setUseCaches(false);
+            connection.setInstanceFollowRedirects(true);
+            connection.setRequestMethod("POST"); // 设置请求方式
+            // 设置接收数据的格式
+            connection.setRequestProperty("Accept", "application/json");
+            // 设置发送数据的格式
+            connection.setRequestProperty("Content-Type", "application/json");
+            //设置ssl证书
+            connection.setSSLSocketFactory(ssf);
+            connection.connect();
+            out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+            out.append(json.toString());
+            out.flush();
+            out.close();
+            // 读取响应
+            is = connection.getInputStream();
+            BufferedReader in = new BufferedReader(new InputStreamReader(is));
+            result = in.readLine();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+//    public static void main(String[] args) {
+//        Gson gson = new Gson();
+//        JSONObject json = new JSONObject();
+//        json.put("str", "13576509111");
+//        json.put("type", "2");
+//        json.put("threshold", "50");
+//        json.put("spanTime", "60");
+//        ArrayList<HashMap<String, String>> ah = new ArrayList<>();
+//        HashMap<String, String> hs = new HashMap<>();
+//        hs.put("startTime", "1641026496");
+//        hs.put("endTime", "1641458496");
+//        ah.add(hs);
+//        // 对象转换成json
+//        // JSONObject jsonObject=JSONObject.fromObject(objectStr);
+//        // 集合转换成json
+//        JSONArray jsonArray= JSONArray.fromObject(ah);
+//        json.put("timeList", jsonArray);
+//        String msg = sendJson2("http://58.17.42.179:8000/rest/analysis/accompany", json);
+//        System.out.println(msg);
+//    }
+
+    public static void main(String[] args) throws Exception {
+        String a = URLEncoder.encode("你好","UTF-8");
+        String msg = get(Message.url2 + "" +
+                "?phone=" + "18679823739" +
+                "&str1=1" +
+                "&str2=" + a);
+        System.out.println(msg);
+    }
+}

+ 23 - 0
bigData/src/com/happy/common/http/MyX509TrustManager.java

@@ -0,0 +1,23 @@
+package com.happy.common.http;
+
+import javax.net.ssl.X509TrustManager;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+/**
+ * X509TrustManager用于实现SSL证书的安全校验
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class MyX509TrustManager implements X509TrustManager {
+    @Override
+    public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
+
+    @Override
+    public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
+
+    @Override
+    public X509Certificate[] getAcceptedIssuers() {
+        return null;
+    }
+}

+ 146 - 0
bigData/src/com/happy/common/util/AESUtil.java

@@ -0,0 +1,146 @@
+package com.happy.common.util;
+
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import sun.misc.BASE64Decoder;
+import sun.misc.BASE64Encoder;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+
+public class AESUtil {
+    private static Logger log = LoggerFactory.getLogger(AESUtil.class);
+
+    private static final String KEY_ALGORITHM = "AES";
+    /**
+     * Ĭ�ϵļ����㷨
+     */
+    private static final String DEFAULT_CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding";
+
+    /**
+     * AES ���ܲ���
+     *
+     * @param content ����������
+     * @param key     ������Կ
+     * @return ����Base64ת���ļ�������
+     */
+    public static String encrypt(String content, String key) {
+        try {
+            // ����������
+            Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);
+            byte[] byteContent = content.getBytes("utf-8");
+            // ��ʼ��Ϊ����ģʽ��������
+            cipher.init(Cipher.ENCRYPT_MODE, getSecretKey(key));
+            // ����
+            byte[] result = cipher.doFinal(byteContent);
+            //ͨ��Base64ת�뷵��
+            return byte2Base64(result);
+        } catch (Exception ex) {
+            log.error("����ʧ��", ex);
+        }
+
+        return null;
+    }
+
+    /**
+     * AES ���ܲ���
+     *
+     * @param content
+     * @param key
+     * @return
+     */
+    public static String decrypt(String content, String key) {
+        try {
+            //ʵ����
+            Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);
+            //ʹ����Կ��ʼ��������Ϊ����ģʽ
+            cipher.init(Cipher.DECRYPT_MODE, getSecretKey(key));
+            //ִ�в���
+            byte[] result = cipher.doFinal(base642Byte(content));
+            return new String(result, "utf-8");
+        } catch (Exception ex) {
+            log.error("����ʧ��", ex);
+        }
+
+        return null;
+    }
+
+    /**
+     * ���ɼ�����Կ
+     *
+     * @return
+     */
+    private static SecretKeySpec getSecretKey(final String key) {
+        //��������ָ���㷨��Կ�������� KeyGenerator ����
+        try {
+            KeyGenerator kg = KeyGenerator.getInstance(KEY_ALGORITHM);
+            // �����ṩ���ܵ�ǿ����������� (RNG)����ʵ����windows��ÿ�����ɵ�key����ͬ�������ڲ���linux��solarisϵͳ����ͬ��
+            // SecureRandom random = new SecureRandom(key.getBytes());
+            // ָ���㷨���ƣ���ͬ��ϵͳ�����ɵ�key����ͬ�ġ�
+            SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
+            random.setSeed(key.getBytes());
+            //AES Ҫ����Կ����Ϊ 128
+            kg.init(128, random);
+            //����һ����Կ
+            SecretKey secretKey = kg.generateKey();
+            // ת��ΪAESר����Կ
+            return new SecretKeySpec(secretKey.getEncoded(), KEY_ALGORITHM);
+        } catch (NoSuchAlgorithmException ex) {
+            log.info("���ɼ�����Կ�쳣��", ex);
+        }
+        return null;
+    }
+
+    /**
+     * �ֽ�����תBase64����
+     *
+     * @param bytes
+     * @return
+     */
+    public static String byte2Base64(byte[] bytes) {
+        BASE64Encoder encoder = new BASE64Encoder();
+        return encoder.encode(bytes);
+    }
+
+    /**
+     * Base64����ת�ֽ�����
+     *
+     * @param base64Key
+     * @return
+     * @throws IOException
+     */
+    public static byte[] base642Byte(String base64Key) throws IOException {
+        BASE64Decoder decoder = new BASE64Decoder();
+        return decoder.decodeBuffer(base64Key);
+    }
+
+    public static String aesDecode4a(String content, String key) {
+        try {
+            String dest = "";
+            BASE64Decoder decoder = new BASE64Decoder();
+            byte[] b = decoder.decodeBuffer(content);
+            String str = new String(b, "ISO-8859-1");
+            dest = decrypt(str, key);
+            return dest;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static String base64Decode(String base64Str) {
+        try {
+            return new String(AESUtil.base642Byte(base64Str));
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 42 - 0
bigData/src/com/happy/common/util/SHA1.java

@@ -0,0 +1,42 @@
+package com.happy.common.util;
+import java.security.MessageDigest;
+
+/**
+ * 微信SHA1算法
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public final class SHA1 {
+
+    private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+    /**
+     *  将字节并格式化
+     * @param bytes 原始字节
+     * @return 格式化字节
+     */
+    private static String getFormattedText(byte[] bytes) {
+        int len = bytes.length;
+        StringBuilder buf = new StringBuilder(len * 2);
+        // 把密文转换成十六进制的字符串形式
+        for (int j = 0; j < len; j++) {
+            buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+            buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+        }
+        return buf.toString();
+    }
+
+    public static String encode(String str) {
+        if (str == null) {
+            return null;
+        }
+        try {
+            MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
+            messageDigest.update(str.getBytes());
+            return getFormattedText(messageDigest.digest());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+}

+ 53 - 0
bigData/src/com/happy/common/wx/WxConfig.java

@@ -0,0 +1,53 @@
+package com.happy.common.wx;
+
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+
+/**
+ * 微信公众号开发配置类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+@Component
+public class WxConfig {
+
+    /**
+     * 开发者ID
+     */
+    public static String apicode = "CS0001";
+
+
+    /**
+     * 商户号
+     */
+    public static String apikey  = "XMZnRsZe61hEXyYa7JuAtUupJZ2Q5byc";
+
+
+    /**
+     * 统一下单-通知链接
+     */
+    public static String unifiedorderNotifyUrl = "https://app.dev.9kbs.com/";
+
+
+    /**
+     * 连接超时时间
+     */
+    public static Integer connectionTimeout = 15000;
+
+    /**
+     * 连接超时时间
+     */
+    public static Integer readTimeout = 15000;
+
+    //支付map缓存处理
+    private static HashMap<String,String> payMap = new HashMap<String,String>();
+    public static String getPayMap(String key) {
+        return payMap.get(key);
+    }
+    public static void setPayMap(String key,String value) {
+        payMap.put(key,value);
+    }
+
+
+}

+ 53 - 0
bigData/src/com/happy/common/wx/WxConstants.java

@@ -0,0 +1,53 @@
+package com.happy.common.wx;
+
+/**
+ * 微信公众号常量类
+ * @author lujunjie
+ * @date   2018/06/28
+ */
+public class WxConstants {
+
+    /**
+     * 默认编码
+     */
+    public static final String DEFAULT_CHARSET = "UTF-8";
+
+    /**
+     * 统一下单-扫描支付
+     */
+    public static String PAY_UNIFIEDORDER = "https://app.dev.9kbs.com/shopOpenApi/services/deviceAntiScode/getStartCode";
+
+    public static String Test = "http://localhost:8088/HotWaters/userget_stu.action";
+
+    public static String Test2 = "http://localhost:8088/HotWaters/userstu_info.action";
+
+    /**
+     * 请求成功返回码
+     */
+    public final static String ERRCODE_OK_CODE = "0";
+    /**
+     * 错误的返回码的Key
+     */
+    public final static String ERRCODE = "errcode";
+
+    /**
+     * 返回状态码
+     */
+    public final static String RETURN_CODE= "return_code";
+
+    /**
+     * access_token 字符串
+     */
+    public final static String ACCESS_TOKEN = "access_token";
+
+    /**
+     * 签名类型 MD5
+     */
+    public final static String SING_MD5 = "MD5";
+
+    /**
+     * 签名类型 HMAC-SHA256
+     */
+    public final static String SING_HMACSHA256 = "HMAC-SHA256";
+
+}

+ 381 - 0
bigData/src/com/happy/common/wx/WxUtil.java

@@ -0,0 +1,381 @@
+package com.happy.common.wx;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+import com.happy.common.util.SHA1;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.*;
+import java.security.MessageDigest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 微信公众号接口工具类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class WxUtil {
+
+	/**
+	 * 加密/校验流程如下:
+	 * 1. 将token、timestamp、nonce三个参数进行字典序排序<br>
+	 * 2. 将三个参数字符串拼接成一个字符串进行sha1加密<br>
+	 * 3. 开发者获得加密后的字符串可与signature对比,标识该请求来源于微信<br>
+	 *
+	 * @param token Token验证密钥
+	 * @param signature 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数,nonce参数
+	 * @param timestamp 时间戳
+	 * @param nonce 随机数
+	 * @return 验证成功返回:true,失败返回:false
+	 */
+	public static boolean checkSignature(String token, String signature, String timestamp, String nonce) {
+		List<String> params = new ArrayList<String>();
+		params.add(token);
+		params.add(timestamp);
+		params.add(nonce);
+		//1. 将token、timestamp、nonce三个参数进行字典序排序
+		Collections.sort(params, new Comparator<String>() {
+			@Override
+			public int compare(String o1, String o2) {
+				return o1.compareTo(o2);
+			}
+		});
+		//2. 将三个参数字符串拼接成一个字符串进行sha1加密
+		String temp = SHA1.encode(params.get(0) + params.get(1) + params.get(2));
+		//3. 开发者获得加密后的字符串可与signature对比,标识该请求来源于微信
+		return temp.equals(signature);
+	}
+
+	/**
+	 * 输入流转化为字符串
+	 * @param inputStream 流
+	 * @return String 字符串
+	 * @throws Exception
+	 */
+	public static String getStreamString(InputStream inputStream) throws Exception{
+		StringBuffer buffer=new StringBuffer();
+		InputStreamReader inputStreamReader = null;
+		BufferedReader bufferedReader = null;
+		try{
+			inputStreamReader=new InputStreamReader(inputStream, WxConstants.DEFAULT_CHARSET);
+			bufferedReader=new BufferedReader(inputStreamReader);
+			String line;
+			while((line=bufferedReader.readLine())!=null){
+				buffer.append(line);
+			}
+		}catch(Exception e){
+			throw new Exception();
+		}finally {
+			if(bufferedReader != null){
+				bufferedReader.close();
+			}
+			if(inputStreamReader != null){
+				inputStreamReader.close();
+			}
+			if(inputStream != null){
+				inputStream.close();
+			}
+		}
+		return buffer.toString();
+	}
+
+	/**
+	 * 获取随机字符串 Nonce Str
+	 * @return String 随机字符串
+	 */
+	public static String getNonceStr() {
+		return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32);
+	}
+
+	/**
+	 * 生成签名. 注意,若含有sign_type字段,必须和signType参数保持一致。
+	 * @param data 待签名数据
+	 * @param apikey API密钥
+	 * @return 签名
+	 */
+	public static String getSignature(final Map<String, String> data, String apikey,
+				String signType) throws Exception {
+		Set<String> keySet = data.keySet();
+		String[] keyArray = keySet.toArray(new String[keySet.size()]);
+		Arrays.sort(keyArray);
+		StringBuilder sb = new StringBuilder();
+		sb.append(apikey);
+		sb.append("amount10apicodeCS0001collect_code");
+		sb.append(data.get("collect_code").trim());
+		sb.append("order_no");
+		sb.append(data.get("order_no").trim());
+        sb.append("timestamp");
+        sb.append(data.get("timestamp").trim());
+        sb.append(apikey);
+		System.out.println(sb);
+		if (signType.equals(WxConstants.SING_MD5)) {
+			System.out.println(MD5(sb.toString()).toUpperCase());
+			return MD5(sb.toString()).toLowerCase();
+		}
+		else if (signType.equals(WxConstants.SING_HMACSHA256)) {
+			return HMACSHA256(sb.toString(), apikey);
+		}
+		else {
+			throw new Exception(String.format("Invalid sign_type: %s", signType));
+		}
+	}
+
+	/**
+	 * 生成 MD5
+	 * @param data 待处理数据
+	 * @return MD5结果
+	 */
+	public static String MD5(String data) throws Exception {
+		MessageDigest md = MessageDigest.getInstance("MD5");
+		byte[] array = md.digest(data.getBytes("UTF-8"));
+		StringBuilder sb = new StringBuilder();
+		for (byte item : array) {
+			sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+		}
+		return sb.toString().toUpperCase();
+	}
+
+	/**
+	 * 生成 HMACSHA256
+	 * @param data 待处理数据
+	 * @param key 密钥
+	 * @return 加密结果
+	 * @throws Exception
+	 */
+	public static String HMACSHA256(String data, String key) throws Exception {
+		Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
+		SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
+		sha256_HMAC.init(secret_key);
+		byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
+		StringBuilder sb = new StringBuilder();
+		for (byte item : array) {
+			sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+		}
+		return sb.toString().toUpperCase();
+	}
+
+	/**
+	 * @param data Map类型数据
+	 * @return XML格式的字符串
+	 * @throws Exception
+	 */
+	public static String mapToXml(Map<String, String> data) throws Exception {
+		DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+		DocumentBuilder documentBuilder= documentBuilderFactory.newDocumentBuilder();
+		org.w3c.dom.Document document = documentBuilder.newDocument();
+		org.w3c.dom.Element root = document.createElement("xml");
+		document.appendChild(root);
+		for (String key: data.keySet()) {
+			String value = data.get(key);
+			if (value == null) {
+				value = "";
+			}
+			value = value.trim();
+			org.w3c.dom.Element filed = document.createElement(key);
+			filed.appendChild(document.createTextNode(value));
+			root.appendChild(filed);
+		}
+		TransformerFactory tf = TransformerFactory.newInstance();
+		Transformer transformer = tf.newTransformer();
+		DOMSource source = new DOMSource(document);
+		transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+		transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+		StringWriter writer = new StringWriter();
+		StreamResult result = new StreamResult(writer);
+		transformer.transform(source, result);
+		String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", "");
+		try {
+			writer.close();
+		}
+		catch (Exception ex) {
+		}
+		return output;
+	}
+
+	/**
+	 * 处理 HTTPS API返回数据,转换成Map对象。return_code为SUCCESS时,验证签名。
+	 * @param xmlStr API返回的XML格式数据
+	 * @return Map类型数据
+	 * @throws Exception
+	 */
+	public static Map<String, String> processResponseXml(String xmlStr,String signType) throws Exception {
+		String RETURN_CODE = WxConstants.RETURN_CODE;
+		String return_code;
+		Map<String, String> respData = xmlToMap(xmlStr);
+		if (respData.containsKey(RETURN_CODE)) {
+			return_code = respData.get(RETURN_CODE);
+		}
+		else {
+			throw new Exception(String.format("No `return_code` in XML: %s", xmlStr));
+		}
+
+		if (return_code.equals("FAIL")) {
+			return respData;
+		}
+		else if (return_code.equals("SUCCESS")) {
+			if (isResponseSignatureValid(respData,signType)) {
+				return respData;
+			}
+			else {
+				throw new Exception(String.format("Invalid sign value in XML: %s", xmlStr));
+			}
+		}
+		else {
+			throw new Exception(String.format("return_code value %s is invalid in XML: %s", return_code, xmlStr));
+		}
+	}
+
+
+	/**
+	 * XML格式字符串转换为Map
+	 * @param strXML XML字符串
+	 * @return XML数据转换后的Map
+	 * @throws Exception
+	 */
+	public static Map<String, String> xmlToMap(String strXML) throws Exception {
+		try {
+			Map<String, String> data = new HashMap<String, String>();
+			DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+
+			String FEATURE = "http://apache.org/xml/features/disallow-doctype-decl";
+			documentBuilderFactory.setFeature(FEATURE, true);
+
+			FEATURE = "http://xml.org/sax/features/external-general-entities";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			FEATURE = "http://xml.org/sax/features/external-parameter-entities";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			FEATURE = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			documentBuilderFactory.setXIncludeAware(false);
+			documentBuilderFactory.setExpandEntityReferences(false);
+			DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+			InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
+			org.w3c.dom.Document doc = documentBuilder.parse(stream);
+			doc.getDocumentElement().normalize();
+			NodeList nodeList = doc.getDocumentElement().getChildNodes();
+			for (int idx = 0; idx < nodeList.getLength(); ++idx) {
+				Node node = nodeList.item(idx);
+				if (node.getNodeType() == Node.ELEMENT_NODE) {
+					org.w3c.dom.Element element = (org.w3c.dom.Element) node;
+					data.put(element.getNodeName(), element.getTextContent());
+				}
+			}
+			try {
+				stream.close();
+			} catch (Exception ex) {
+				// do nothing
+			}
+			return data;
+		} catch (Exception ex) {
+			throw ex;
+		}
+	}
+
+	/**
+	 * 判断xml数据的sign是否有效,必须包含sign字段,否则返回false。
+	 * @param reqData 向wxpay post的请求数据
+	 * @return 签名是否有效
+	 * @throws Exception
+	 */
+	private static boolean isResponseSignatureValid(final Map<String, String> reqData,String signType) throws Exception {
+		// 返回数据的签名方式和请求中给定的签名方式是一致的
+		return isSignatureValid(reqData,WxConfig.apikey,signType);
+	}
+
+	/**
+	 * 判断签名是否正确,必须包含sign字段,否则返回false。
+	 * @param data Map类型数据
+	 * @param key API密钥
+	 * @param signType 签名方式
+	 * @return 签名是否正确
+	 * @throws Exception
+	 */
+	public static boolean isSignatureValid(Map<String, String> data, String key, String signType) throws Exception {
+		if (!data.containsKey("sign")) {
+			return false;
+		}
+		String sign = data.get("sign");
+		return getSignature(data, key, signType).equals(sign);
+	}
+
+	/**
+	 * 生成支付二维码
+	 * @param response 响应
+	 * @param contents url链接
+	 * @throws Exception
+	 */
+	public static void writerPayImage(HttpServletResponse response, String contents) throws Exception{
+		ServletOutputStream out = response.getOutputStream();
+		try {
+			Map<EncodeHintType,Object> hints = new HashMap<EncodeHintType,Object>();
+			hints.put(EncodeHintType.CHARACTER_SET,"UTF-8");
+			hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
+			hints.put(EncodeHintType.MARGIN, 0);
+			BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE,300,300,hints);
+			MatrixToImageWriter.writeToStream(bitMatrix,"jpg",out);
+		}catch (Exception e){
+			throw new Exception("生成二维码失败!");
+		}finally {
+			if(out != null){
+				out.flush();
+				out.close();
+			}
+		}
+	}
+
+	/**
+	 * 生成商户订单号
+	 * @return String
+	 */
+	public static String mchOrderNo(){
+		SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
+		String date = sdf.format(new Date());
+
+		Random random = new Random();
+		String fourRandom = String.valueOf(random.nextInt(10000));
+		int randLength = fourRandom.length();
+		//不足4位继续补充
+		if(randLength<4){
+			for(int remain = 1; remain <= 4 - randLength; remain ++ ){
+				fourRandom += random.nextInt(10)  ;
+			}
+		}
+		return date+fourRandom;
+	}
+
+	/**
+	 * 返回信息给微信
+	 * @param response
+	 * @param content 内容
+	 * @throws Exception
+	 */
+	public static void responsePrint(HttpServletResponse response, String content) throws Exception{
+		response.setCharacterEncoding("UTF-8");
+		response.setContentType("text/xml");
+		response.getWriter().print(content);
+		response.getWriter().flush();
+		response.getWriter().close();
+	}
+
+
+}

+ 0 - 1
bigData/src/com/happy/constant/1

@@ -1 +0,0 @@
-1

+ 98 - 0
bigData/src/com/happy/constant/ConstDefault.java

@@ -0,0 +1,98 @@
+package com.happy.constant;
+
+import org.apache.http.client.HttpClient;
+
+import java.text.SimpleDateFormat;
+
+/**
+ * lockcslock
+ *
+ * @author yp
+ */
+public final class ConstDefault {
+
+    public static final String DATETIMES_FORMAT_STRING = "yyyy-MM-dd HH:mm:ss";
+    public static final String DATE_FORMAT_STRING = "yyyy-MM-dd";
+    public static final String TIMES_FORMAT_STRING = "HH:mm:ss";
+
+    public static final SimpleDateFormat DATETIMES_FORMAT = new SimpleDateFormat(DATETIMES_FORMAT_STRING);
+    public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_STRING);
+    public static final SimpleDateFormat TIMES_FORMAT = new SimpleDateFormat(TIMES_FORMAT_STRING);
+
+    public final static class USERROLE {
+        public final static int NORMMAL = 4;
+        public final static int SYSTEMADMIN = 1;
+        public final static int DEVICEADMIN = 2;
+    }
+
+    public final static class THIRDTYPE {
+
+        public final static int WEIXINPUBLIC = 1;
+        public final static int WEIXIN_MINI = 2;
+        public final static int WEIXIN_OPEN = 3;
+
+    }
+
+    public final static int ANONYMOUSID = -1;
+    public final static int DEFAULTORG = 1;
+    public final static int DEFAULTROLEPERMISSON = 0;
+    public final static int SOUND_KEY = 1;
+
+    //密码得前缀字符串
+    public static String FTSTR = "PARTYDUES";
+    //密码得后缀字符串
+    public static String BGSTR = "LYKJ";
+
+    //微信登录的token
+    public static String WXID = "wx";
+
+    public static String WXPASSWORD = "partydues";
+
+    public enum SignType {
+        MD5, HMACSHA256
+    }
+
+    public static final String DOMAIN_API = "api.mch.weixin.qq.com";
+    public static final String DOMAIN_API2 = "api2.mch.weixin.qq.com";
+    public static final String DOMAIN_APIHK = "apihk.mch.weixin.qq.com";
+    public static final String DOMAIN_APIUS = "apius.mch.weixin.qq.com";
+
+    public static final String FAIL     = "FAIL";
+    public static final String SUCCESS  = "SUCCESS";
+    public static final String HMACSHA256 = "HMAC-SHA256";
+    public static final String MD5 = "MD5";
+
+    public static final String FIELD_SIGN = "sign";
+    public static final String FIELD_SIGN_TYPE = "sign_type";
+
+    public static final String WXPAYSDK_VERSION = "WXPaySDK/3.0.9";
+    public static final String USER_AGENT = WXPAYSDK_VERSION +
+            " (" + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version") +
+            ") Java/" + System.getProperty("java.version") + " HttpClient/" + HttpClient.class.getPackage().getImplementationVersion();
+
+    public static final String MICROPAY_URL_SUFFIX     = "/pay/micropay";
+    public static final String UNIFIEDORDER_URL_SUFFIX = "/pay/unifiedorder";
+    public static final String ORDERQUERY_URL_SUFFIX   = "/pay/orderquery";
+    public static final String REVERSE_URL_SUFFIX      = "/secapi/pay/reverse";
+    public static final String CLOSEORDER_URL_SUFFIX   = "/pay/closeorder";
+    public static final String REFUND_URL_SUFFIX       = "/secapi/pay/refund";
+    public static final String REFUNDQUERY_URL_SUFFIX  = "/pay/refundquery";
+    public static final String DOWNLOADBILL_URL_SUFFIX = "/pay/downloadbill";
+    public static final String REPORT_URL_SUFFIX       = "/payitil/report";
+    public static final String SHORTURL_URL_SUFFIX     = "/tools/shorturl";
+    public static final String AUTHCODETOOPENID_URL_SUFFIX = "/tools/authcodetoopenid";
+
+    // sandbox
+    public static final String SANDBOX_MICROPAY_URL_SUFFIX     = "/sandboxnew/pay/micropay";
+    public static final String SANDBOX_UNIFIEDORDER_URL_SUFFIX = "/sandboxnew/pay/unifiedorder";
+    public static final String SANDBOX_ORDERQUERY_URL_SUFFIX   = "/sandboxnew/pay/orderquery";
+    public static final String SANDBOX_REVERSE_URL_SUFFIX      = "/sandboxnew/secapi/pay/reverse";
+    public static final String SANDBOX_CLOSEORDER_URL_SUFFIX   = "/sandboxnew/pay/closeorder";
+    public static final String SANDBOX_REFUND_URL_SUFFIX       = "/sandboxnew/secapi/pay/refund";
+    public static final String SANDBOX_REFUNDQUERY_URL_SUFFIX  = "/sandboxnew/pay/refundquery";
+    public static final String SANDBOX_DOWNLOADBILL_URL_SUFFIX = "/sandboxnew/pay/downloadbill";
+    public static final String SANDBOX_REPORT_URL_SUFFIX       = "/sandboxnew/payitil/report";
+    public static final String SANDBOX_SHORTURL_URL_SUFFIX     = "/sandboxnew/tools/shorturl";
+    public static final String SANDBOX_AUTHCODETOOPENID_URL_SUFFIX = "/sandboxnew/tools/authcodetoopenid";
+
+}

+ 86 - 0
bigData/src/com/happy/constant/ResultStatusCode.java

@@ -0,0 +1,86 @@
+package com.happy.constant;
+
+public enum ResultStatusCode {
+	/** OKlockcslock */
+	QUIT(200, "退出成功"),
+	/** OK */
+	OK(200, "OK"),
+	/** 访问超时 */
+	TIME_OUT(130, "访问超时"),
+	/** 参数解析失败 */
+	BAD_REQUEST(400, "参数解析失败"),
+	/** 记录不存在 */
+	NOT_EXIST(404, "记录不存在"),
+	/** 不支持当前请求方法 */
+	METHOD_NOT_ALLOWED(405, "不支持当前请求方法"),
+	/** 服务器运行异常 */
+	SYSTEM_ERR(500, "服务器运行异常"),
+	/** 该用户不存在或密码错误 */
+	NOT_EXIST_USER_OR_ERROR_PWD(10000, "该用户不存在或账号密码错误"),
+	/** 该用户已登录 */
+	LOGINED_IN(10001, "该用户已登录"),
+	LOGINED_IN2(10002, "该用户不存在"),
+	LOGINED_IN3(100021, "该用户登录已失效"),
+	/** 登录异常 */
+	SHIRO_ERROR(10003, "登录异常"),
+	/** 您没有该权限 */
+	UNAUTHO_ERROR(10004, "您没有该权限"),
+	/** 请绑定手机号 */
+	BIND_PHONE(10010, "请绑定手机号"),
+	/** 上传文件异常 */
+	UPLOAD_ERROR(20000, "上传文件异常"),
+	/** 无效的验证码 */
+	INVALID_CAPTCHA(30005, "无效的验证码"),
+	/** 该用户已被冻结 */
+	USER_FROZEN(40000, "该用户已被冻结"),
+	/** 该用户未绑定微信号 */
+	USER_NOT_WX_OAUTH(40004, "该用户未进行微信授权"),
+    /** 该用户未绑定微信号 */
+	USER_NOT_BIND_WX(5000, "该用户未绑定微信号"),
+    /** 该用户成功绑定微信号 */
+    USER_BIND_WX_OK(5005, "该用户成功绑定微信号"),
+	/** 该部门已存在 */
+	DEPARTMENT_EXIT(5006, "该部门已存在"),
+	/** 该用户已存在 */
+	USER_EXIST(6000, "该用户已存在"),
+	/** 该账号已存在 */
+	USERACCOUNT_EXIST(6002, "该账号已存在"),
+	/** 缴费用户信息不存在 */
+	PARTYDUES_USER_NOEXIT(6003, "缴费用户信息不存在"),
+	/** 党费信息不存在 */
+	PARTYDUES_NOEXIT(6004, "费用信息不存在"),
+	/** 党费信息党费已支付 */
+	PARTYDUES_OK(6005, "费用已支付"),
+	/** 党费订单支付失败 */
+	PARTYDUES_ERR(6009, "费用支付失败");
+
+	private int status;
+	private String msg;
+
+	public int getStatus() {
+		return status;
+	}
+
+	public void setStatus(int status) {
+		this.status = status;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	private ResultStatusCode(int code, String msg) {
+		this.status = code;
+		this.msg = msg;
+	}
+
+	@Override
+	public String toString() {
+		return "{\"status\":" + this.status + ",\"msg\":\"" + this.msg + "\",\"data\": null, \"ok\": false}";
+	}
+}
+

+ 0 - 1
bigData/src/com/happy/dao/1

@@ -1 +0,0 @@
-1

+ 46 - 0
bigData/src/com/happy/dao/CrossDao.java

@@ -0,0 +1,46 @@
+package com.happy.dao;
+
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.User;
+
+import java.util.List;
+
+public interface CrossDao {
+
+    // 各路口累计人数
+    public List<Gaosut> queryGaosuR();
+
+    // 各路口通行人员列表
+    public List<User> queryUserByCross(String sm_place, int page, int rows);
+
+    // 各路口人数总数
+    public int queryUserCrossCount(String sm_place);
+
+    // 高速口当日总人数
+    public List<Gaosut> querySumByDay();
+
+    // 高速口累积总人数
+    public List<Gaosut> querySum();
+
+    // 人流趋势分析-近12日
+    public Gaosut queryLastDay(String tj_date);
+
+    // 人流趋势分析-近12月
+    public Gaosut queryLastMonth(String month);
+
+    // 人流趋势分析-近12年
+    public Gaosut queryLastYear(String year);
+
+    // 高速口累积总人数
+    public List<Gaosut> queryTNum(String place_name);
+
+    // 高速口今日人数
+    public List<Gaosut> queryDayNum(String sm_place);
+
+    // 各路口当日通行人员列表
+    public List<User> queryUserByDay(String sm_place, int page, int rows);
+
+    // 各路口人数总数
+    public int queryUserDayCount(String sm_place);
+
+}

+ 13 - 0
bigData/src/com/happy/dao/DeviceRankDao.java

@@ -0,0 +1,13 @@
+package com.happy.dao;
+
+import com.happy.Model.DeviceRank;
+
+import java.util.List;
+
+public interface DeviceRankDao {
+
+    public int insertDeviceRank(DeviceRank deviceRank);
+
+    // 设备排行
+    public List<DeviceRank> queryRank();
+}

+ 14 - 0
bigData/src/com/happy/dao/DevicetDao.java

@@ -0,0 +1,14 @@
+package com.happy.dao;
+
+import com.happy.Model.DeviceT;
+
+import java.util.List;
+
+public interface DevicetDao {
+
+    public int insertDevicet(DeviceT deviceT);
+
+    // 设备统计
+    public List<DeviceT> queryT();
+
+}

+ 12 - 0
bigData/src/com/happy/dao/FirstBuffercDao.java

@@ -0,0 +1,12 @@
+package com.happy.dao;
+
+import com.happy.Model.FirstBufferC;
+
+import java.util.List;
+
+public interface FirstBuffercDao {
+
+    public int insertFirstBufferC(FirstBufferC firstBufferC);
+
+    public List<FirstBufferC> queryFirstBufferC();
+}

+ 20 - 0
bigData/src/com/happy/dao/FirstBufferpDao.java

@@ -0,0 +1,20 @@
+package com.happy.dao;
+
+import com.happy.Model.FirstBufferP;
+import com.happy.Model.User;
+
+import java.util.List;
+
+public interface FirstBufferpDao {
+
+    public int insertFirstBufferP(FirstBufferP firstBufferP);
+
+    // 各路口扫码详情-红黄
+    public List<FirstBufferP> queryFirstBufferP(String sm_date,String sm_place);
+
+    // 各路口扫码详情-绿
+    public List<FirstBufferP> queryFirstBufferP2(String sm_date,String sm_place);
+
+    // 各路口人员扫码信息
+    public List<User> queryByPlace(String sm_place);
+}

+ 65 - 0
bigData/src/com/happy/dao/FirstBuffertDao.java

@@ -0,0 +1,65 @@
+package com.happy.dao;
+
+import com.happy.Model.FirstBufferT;
+import com.happy.Model.Handlde;
+import com.happy.Model.SecondPlaceJc;
+import com.happy.Model.User;
+
+import java.util.List;
+
+public interface FirstBuffertDao {
+
+    public int insertFirstBufferT(FirstBufferT firstBufferT);
+
+    // 第一道防护屏障接口------汇总
+    public List<FirstBufferT> queryFirstBufferT();
+
+    // 第一道防护屏障接口------汇总
+    public List<FirstBufferT> queryFirstGreenT(String sm_date);
+
+    // 第一道防护屏障接口------红黄码汇总
+    public List<FirstBufferT> queryFirstBufferRy();
+
+    public List<Handlde> queryHandler();
+
+    // 第一道防线红码人员详情
+    public List<User> queryRed(String startDate, String endDate);
+
+    // 第一道防线黄码人员详情
+    public List<User> queryYellow(String startDate,String endDate,int page, int rows);
+
+    // 第一道防线黄码人员总数-分页
+    public int queryYellowTotal(String startDate,String endDate);
+
+    public SecondPlaceJc queryFirst();
+
+    // 首页面--处置
+    public List<Handlde> queryFirstHandler();
+
+    // 第一道防线红黄码加时间搜索
+    public List<User> queryByTimeAndColor(int page, int rows, String sqlx);
+
+    public int findUsersTotal(String s1);
+
+    // 第一道防线累积红黄码详情
+    public SecondPlaceJc queryLjRy();
+
+    // 第一道防线累积绿码详情
+    public SecondPlaceJc queryLjGreen();
+
+    /**
+     * =================昨日累积缓存 =============================
+     **/
+    // 第1道防线昨日累积扫描汇总
+    public FirstBufferT queryFbYesLj(String sm_date);
+
+    // 第1道防线查询缓存数据
+    public List<FirstBufferT> queryfbCache(String dateT);
+
+    // 第一道防护屏障接口------红黄码汇总
+    public List<FirstBufferT> queryFbByDate(String sm_date);
+
+    // 插入缓存
+    public int insertFbT(FirstBufferT firstBufferT);
+
+}

+ 13 - 0
bigData/src/com/happy/dao/GtmtDao.java

@@ -0,0 +1,13 @@
+package com.happy.dao;
+
+import com.happy.Model.GtmT;
+
+import java.util.List;
+
+public interface GtmtDao {
+
+    public int insertGtmT(GtmT gtmT);
+
+    // 赣通码详情
+    public List<GtmT> queryGtmT();
+}

+ 185 - 0
bigData/src/com/happy/dao/Impl/CrossImplDao.java

@@ -0,0 +1,185 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.User;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.CrossDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("CrossDao")
+public class CrossImplDao implements CrossDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    // 各路口累计人数
+    public List<Gaosut> queryGaosuR(){
+        String sql = "select place_name,SUM(num) as num from `gaosut` group by place_name ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各路口通行人员列表
+    public List<User> queryUserByCross(String sm_place, int page, int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from sm_message where sm_place=:sm_place order by id desc limit :start,:rows  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_place", sm_place);
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各路口人数总数
+    public int queryUserCrossCount(String sm_place){
+        String sql = "select count(*) from sm_message where sm_place=:sm_place  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_place", sm_place);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 高速口当日总人数
+    public List<Gaosut> querySumByDay(){
+        String sql = "SELECT tj_date AS tj_date, COUNT(num) AS num FROM" +
+                "(select sm_date as tj_date,ifnull(count(*),0) as num from `sm_message` where sm_date=:sm_date AND protect_type = 1 group by uuid ) a";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 高速口累积总人数
+    public List<Gaosut> querySum(){
+        String sql = "select sum(num) as num from `gaosut` ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 人流趋势分析-近12日
+    public Gaosut queryLastDay(String tj_date){
+        String sql = "select tj_date,ifnull(sum(num),0) as num from `gaosut` where tj_date=:tj_date  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("tj_date", tj_date);
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 人流趋势分析-近12月
+    public Gaosut queryLastMonth(String month){
+        String sql = "select tj_date,ifnull(sum(num),0) as num from `gaosut` where tj_date like :month  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("month", month+"%");
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 人流趋势分析-近12年
+    public Gaosut queryLastYear(String year){
+        String sql = "select tj_date,ifnull(sum(num),0) as num from `gaosut` where tj_date like :year  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("year", year+"%");
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 高速口累积总人数
+    public List<Gaosut> queryTNum(String place_name){
+        String sql = "select place_name,sum(num) as num from `gaosut` where place_name=:place_name ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_name", place_name);
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 高速口今日人数
+    public List<Gaosut> queryDayNum(String sm_place){
+        String sql = "select sm_place as place_name, count(*) as num from `sm_message` where sm_place=:sm_place and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_place", sm_place);
+        sps.addValue("sm_date", TimeExchange.getDate());
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各路口当日通行人员列表
+    public List<User> queryUserByDay(String sm_place, int page, int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from sm_message where sm_place=:sm_place and sm_date=:sm_date order by id desc limit :start,:rows  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_place", sm_place);
+        sps.addValue("sm_date",TimeExchange.getDate());
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各路口人数总数
+    public int queryUserDayCount(String sm_place){
+        String sql = "select count(*) from sm_message where sm_place=:sm_place and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_place", sm_place);
+        sps.addValue("sm_date",TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+}

+ 57 - 0
bigData/src/com/happy/dao/Impl/DeviceRankImplDao.java

@@ -0,0 +1,57 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.DeviceRank;
+import com.happy.dao.DeviceRankDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("DeviceRankDao")
+public class DeviceRankImplDao implements DeviceRankDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertDeviceRank(DeviceRank deviceRank){
+        String sql = "insert into `devicerank`(dateT,place,`rank`,passCount) values(:dateT,:place,:rank,:passCount)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", deviceRank.getDateT());
+        sps.addValue("place", deviceRank.getPlace());
+        sps.addValue("rank", deviceRank.getRank());
+        sps.addValue("passCount", deviceRank.getPassCount());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 设备排行
+    public List<DeviceRank> queryRank(){
+        String sql = "select * from `devicerank` where id in(select id from(select place,MAX(id) as id from `devicerank` group by place order by place desc limit 0, 5) a) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<DeviceRank> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<DeviceRank>(DeviceRank.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 63 - 0
bigData/src/com/happy/dao/Impl/DevicetImplDao.java

@@ -0,0 +1,63 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.DeviceT;
+import com.happy.dao.DevicetDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("DevicetDao")
+public class DevicetImplDao implements DevicetDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertDevicet(DeviceT deviceT){
+        String sql = "insert into devicet(dateT,passT,passLt,includeDevice,red_count,yellow_count,hTep,passById,passByMa,passByFace) values(:dateT,:passT,:passLt,:includeDevice,:red_count,:yellow_count,:hTep,:passById,:passByMa,:passByFace)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", deviceT.getDateT());
+        sps.addValue("passT", deviceT.getPassT());
+        sps.addValue("passLt", deviceT.getPassLt());
+        sps.addValue("includeDevice", deviceT.getIncludeDevice());
+        sps.addValue("red_count", deviceT.getRed_count());
+        sps.addValue("yellow_count", deviceT.getYellow_count());
+        sps.addValue("hTep", deviceT.gethTep());
+        sps.addValue("passById", deviceT.getPassById());
+        sps.addValue("passByMa", deviceT.getPassByMa());
+        sps.addValue("passByFace", deviceT.getPassByFace());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 设备统计
+    public List<DeviceT> queryT(){
+        String sql = "select * from devicet where id=(select max(id) from `devicet`) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<DeviceT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<DeviceT>(DeviceT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 65 - 0
bigData/src/com/happy/dao/Impl/FirstBuffercImplDao.java

@@ -0,0 +1,65 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.FirstBufferC;
+import com.happy.Model.FirstBufferT;
+import com.happy.dao.FirstBuffercDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("FirstBuffercDao")
+public class FirstBuffercImplDao implements FirstBuffercDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertFirstBufferC(FirstBufferC firstBufferC){
+        String sql = "insert into firstbufferc(dateT,dateTime,smT,smT_increase,smLt,red_count,red_increase,yellow_count,yellow_increase,green_count,green_increase) values(:dateT,:dateTime,:smT,:smT_increase,:smLt,:red_count,:red_increase,:yellow_count,:yellow_increase,:green_count,:green_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", firstBufferC.getDateT());
+        sps.addValue("dateTime", firstBufferC.getDateTime());
+        sps.addValue("smT", firstBufferC.getSmT());
+        sps.addValue("smT_increase", firstBufferC.getSmT_increase());
+        sps.addValue("smLt", firstBufferC.getSmLt());
+        sps.addValue("red_count", firstBufferC.getRed_count());
+        sps.addValue("red_increase", firstBufferC.getRed_increase());
+        sps.addValue("yellow_count", firstBufferC.getYellow_count());
+        sps.addValue("yellow_increase", firstBufferC.getYellow_increase());
+        sps.addValue("green_count", firstBufferC.getGreen_count());
+        sps.addValue("green_increase", firstBufferC.getGreen_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 第一道防护屏障接口------汇总
+    public List<FirstBufferC> queryFirstBufferC(){
+        String sql = "select * from firstbufferc where id=(select MAX(id) from firstbufferc) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<FirstBufferC> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<FirstBufferC>(FirstBufferC.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 89 - 0
bigData/src/com/happy/dao/Impl/FirstBufferpImplDao.java

@@ -0,0 +1,89 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.FirstBufferP;
+import com.happy.Model.User;
+import com.happy.dao.FirstBufferpDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("FirstBufferpDao")
+public class FirstBufferpImplDao implements FirstBufferpDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertFirstBufferP(FirstBufferP firstBufferP){
+        String sql = "insert into `firstbufferp`(dateT,place,red_count,yellow_count,green_count,url) values(:dateT,:place,:red_count,:yellow_count,:green_count,:url)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", firstBufferP.getDateT());
+        sps.addValue("place", firstBufferP.getPlace());
+        sps.addValue("red_count", firstBufferP.getRed_count());
+        sps.addValue("yellow_count", firstBufferP.getYellow_count());
+        sps.addValue("green_count", firstBufferP.getGreen_count());
+        sps.addValue("url", firstBufferP.getUrl());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 各路口扫码详情-红黄
+    public List<FirstBufferP> queryFirstBufferP(String sm_date,String sm_place){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count, IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count from `sm_message_x` where sm_date=:sm_date and sm_place=:sm_place ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        sps.addValue("sm_place", sm_place);
+        List<FirstBufferP> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<FirstBufferP>(FirstBufferP.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各路口扫码详情-绿
+    public List<FirstBufferP> queryFirstBufferP2(String sm_date,String sm_place){
+        String sql = "select IFNULL(SUM(IF(sm_color='绿码',1,0)),0) as green_count from `sm_message` where sm_date=:sm_date and sm_place=:sm_place ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        sps.addValue("sm_place", sm_place);
+        List<FirstBufferP> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<FirstBufferP>(FirstBufferP.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各路口人员扫码信息
+    public List<User> queryByPlace(String sm_place){
+        String sql = "select * from `sm_message` where protect_type='1' and sm_place=:sm_place order by `id` desc limit 0,20 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_place", sm_place);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 270 - 0
bigData/src/com/happy/dao/Impl/FirstBuffertImplDao.java

@@ -0,0 +1,270 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.*;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.FirstBuffertDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Repository("FirstBuffertDao")
+public class FirstBuffertImplDao implements FirstBuffertDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertFirstBufferT(FirstBufferT firstBufferT){
+        String sql = "insert into firstbuffert(dateT,smT,smT_increase,smLt,red_count,red_increase,yellow_count,yellow_increase,green_count,green_increase) values(:dateT,:smT,:smT_increase,:smLt,:red_count,:red_increase,:yellow_count,:yellow_increase,:green_count,:green_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", firstBufferT.getDateT());
+        sps.addValue("smT", firstBufferT.getSmT());
+        sps.addValue("smT_increase", firstBufferT.getSmT_increase());
+        sps.addValue("smLt", firstBufferT.getSmLt());
+        sps.addValue("red_count", firstBufferT.getRed_count());
+        sps.addValue("red_increase", firstBufferT.getRed_increase());
+        sps.addValue("yellow_count", firstBufferT.getYellow_count());
+        sps.addValue("yellow_increase", firstBufferT.getYellow_increase());
+        sps.addValue("green_count", firstBufferT.getGreen_count());
+        sps.addValue("green_increase", firstBufferT.getGreen_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 第一道防护屏障接口------汇总
+    public List<FirstBufferT> queryFirstBufferT(){
+        String sql = "select * from firstbuffert where id=(select MAX(id) from firstbuffert) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<FirstBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<FirstBufferT>(FirstBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防护屏障接口------绿码汇总
+    public List<FirstBufferT> queryFirstGreenT(String sm_date){
+        String sql = "select IFNULL(SUM(IF(sm_color='绿码',1,0)),0) as green_count from( select * from `sm_message` where sm_date=:sm_date and sm_color='绿码' and protect_type=1 group by UUID ) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<FirstBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<FirstBufferT>(FirstBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防护屏障接口------红黄码汇总
+    public List<FirstBufferT> queryFirstBufferRy(){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,  IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count from `sm_message_x` where protect_type='1' and sm_color in ('红码', '黄码') and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        List<FirstBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<FirstBufferT>(FirstBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防线处理情况
+    public List<Handlde> queryHandler(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=0,1,0)),0) as unhandled,  IFNULL(SUM(IF(handler_state2=1,1,0)),0) as handled from `sm_message_x` where protect_type='1' and sm_color in ('红码', '黄码') and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        List<Handlde> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Handlde>(Handlde.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防线红码人员详情
+    public List<User> queryRed(String startDate,String endDate){
+        String sql = "select * from `sm_message_x` where protect_type='1' and sm_color='红码' and sm_date between :startDate and :endDate ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startDate", startDate);
+        sps.addValue("endDate", endDate);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防线黄码人员详情
+    public List<User> queryYellow(String startDate,String endDate,int page, int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from `sm_message_x` where protect_type='1' and sm_color='黄码' and sm_date between :startDate and :endDate order by sm_time desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startDate", startDate);
+        sps.addValue("endDate", endDate);
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防线黄码人员总数-分页
+    public int queryYellowTotal(String startDate,String endDate){
+        String sql = "select count(*) from `sm_message_x` where protect_type='1' and sm_color='黄码' and sm_date between :startDate and :endDate ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startDate", startDate);
+        sps.addValue("endDate", endDate);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+
+    // 首页面--监测
+    public SecondPlaceJc queryFirst(){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count,IFNULL(SUM(IF(ishot='1',1,0)),0) as hot_count,IFNULL(SUM(IF(iskey='1',1,0)),0) as key_count,IFNULL(SUM(IF(istoken='1',1,0)),0) as token_count from `sm_message_x` where sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 首页面--处置
+    public List<Handlde> queryFirstHandler(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=0,1,0)),0) as unhandled,  IFNULL(SUM(IF(handler_state2=1,1,0)),0) as handled from `sm_message_x` where sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        List<Handlde> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Handlde>(Handlde.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防线红黄码加时间搜索
+    public List<User> queryByTimeAndColor(int page, int rows,String sqlx){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from `sm_message_x` where protect_type='1' " + sqlx +"  order by sm_time desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询用户表中的总记录数
+    public int findUsersTotal(String s1) {
+        String sql = "select count(*) from `sm_message_x` where  protect_type='1' "+s1;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 第一道防线累积红黄码详情
+    public SecondPlaceJc queryLjRy(){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count from `sm_message_x` where protect_type='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 第一道防线累积绿码详情
+    public SecondPlaceJc queryLjGreen(){
+        String sql = "select IFNULL(COUNT(distinct UUID,sm_date,protect_type),0) as green_count from `sm_message` where sm_color='绿码' and protect_type='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    /** =================昨日累积缓存 =============================**/
+    // 第1道防线昨日累积扫描汇总
+    public FirstBufferT queryFbYesLj(String sm_date){
+        String sql = "select COUNT(*) as smT from (select * from `sm_message` where protect_type=1 and sm_date=:sm_date group by UUID ) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<FirstBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(FirstBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 第1道防线查询缓存数据
+    public List<FirstBufferT> queryfbCache(String dateT){
+        String sql = "select * from `firstbuffert` where dateT=:dateT ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", dateT);
+        List<FirstBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(FirstBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防护屏障接口------红黄码汇总
+    public List<FirstBufferT> queryFbByDate(String sm_date){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,  IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count from `sm_message_x` where protect_type='1' and sm_color in ('红码', '黄码') and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<FirstBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<FirstBufferT>(FirstBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 插入缓存
+    public int insertFbT(FirstBufferT firstBufferT){
+        String sql = "insert into firstbuffert(dateT,smT,smT_increase,smLt,red_count,red_increase,yellow_count,yellow_increase,green_count,green_increase) values(:dateT,:smT,:smT_increase,:smLt,:red_count,:red_increase,:yellow_count,:yellow_increase,:green_count,:green_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", firstBufferT.getDateT());
+        sps.addValue("smT", firstBufferT.getSmT());
+        sps.addValue("smT_increase", firstBufferT.getSmT_increase());
+        sps.addValue("smLt", firstBufferT.getSmLt());
+        sps.addValue("red_count", firstBufferT.getRed_count());
+        sps.addValue("red_increase", firstBufferT.getRed_increase());
+        sps.addValue("yellow_count", firstBufferT.getYellow_count());
+        sps.addValue("yellow_increase", firstBufferT.getYellow_increase());
+        sps.addValue("green_count", firstBufferT.getGreen_count());
+        sps.addValue("green_increase", firstBufferT.getGreen_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+
+
+}

+ 60 - 0
bigData/src/com/happy/dao/Impl/GtmtImplDao.java

@@ -0,0 +1,60 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.GtmT;
+import com.happy.dao.GtmtDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("GtmtDao")
+public class GtmtImplDao implements GtmtDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    // 赣通码详情
+    public int insertGtmT(GtmT gtmT){
+        String sql = "insert into `gtmt`(dateT,dateTime,red_count,yellow_count,green_count,count) values(:dateT,:dateTime,:red_count,:yellow_count,:green_count,:count)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", gtmT.getDateT());
+        sps.addValue("dateTime", gtmT.getDateTime());
+        sps.addValue("red_count", gtmT.getRed_count());
+        sps.addValue("yellow_count", gtmT.getYellow_count());
+        sps.addValue("green_count", gtmT.getGreen_count());
+        sps.addValue("count", gtmT.getCount());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 赣通码详情
+    public List<GtmT> queryGtmT(){
+        String sql = "select * from `gtmt` where id in(select MAX(id) from `gtmt`) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<GtmT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<GtmT>(GtmT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 239 - 0
bigData/src/com/happy/dao/Impl/ManagerImplDao.java

@@ -0,0 +1,239 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.FirstBufferT;
+import com.happy.Model.Manager.DanweiDetail;
+import com.happy.Model.Manager.Danweit;
+import com.happy.Model.Manager.Firstplace;
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.Secondplacetype;
+import com.happy.dao.ManagerDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("ManagerDao")
+public class ManagerImplDao implements ManagerDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    // 高速口查询
+    public List<Firstplace> queryFirstplace(){
+        String sql = "select * from firstplace ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Firstplace> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Firstplace.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各高速口每天人数
+    public List<Gaosut> queryByDate(String sm_date,String sm_place){
+        String sql = "select sm_place as place_name,sm_date as tj_date,COUNT(*) as num from(select * from `sm_message` where sm_date=:sm_date and sm_place=:sm_place group by UUID) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        sps.addValue("sm_place", sm_place);
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询数据是否缓存
+    public List<Gaosut> queryIsR(String tj_date,String place_name){
+        String sql = "select * from `gaosut` where place_name=:place_name and tj_date=:tj_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("tj_date", tj_date);
+        sps.addValue("place_name", place_name);
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 插入缓存
+    public int insertGaosuT(Gaosut gaosut){
+        String sql = "insert into `gaosut`(place_name,tj_date,num) values(:place_name,:tj_date,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_name", gaosut.getPlace_name());
+        sps.addValue("tj_date", gaosut.getTj_date());
+        sps.addValue("num", gaosut.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 查询缓存数据
+    public List<Gaosut> queryGaosuR(String tj_date){
+        String sql = "select * from `gaosut` where tj_date=:tj_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("tj_date", tj_date);
+        List<Gaosut> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Gaosut.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /** =================================================== **/
+
+    // 单位码查询
+    public List<Secondplacetype> queryDanwei(){
+        String sql = "select * from `secondplacetype` ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Secondplacetype> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Secondplacetype.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各单位口每天人数
+    public List<Danweit> queryDwByDate(String sm_date, String place_type){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_num, IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_num,IFNULL(SUM(IF(sm_color='绿码',1,0)),0) as green_num from(select * from `sm_message` where sm_date=:sm_date and place_type=:place_type group by UUID) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        sps.addValue("place_type", place_type);
+        List<Danweit> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Danweit.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询数据是否缓存
+    public List<Danweit> queryDanweiIsR(String tj_date,String place_name){
+        String sql = "select * from `danweit` where place_name=:place_name and tj_date=:tj_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("tj_date", tj_date);
+        sps.addValue("place_name", place_name);
+        List<Danweit> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Danweit.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 插入缓存
+    public int insertDanweiT(Danweit danweit){
+        String sql = "insert into `danweit`(place_name,tj_date,red_num,yellow_num,green_num) values(:place_name,:tj_date,:red_num,:yellow_num,:green_num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_name", danweit.getPlace_name());
+        sps.addValue("tj_date", danweit.getTj_date());
+        sps.addValue("red_num", danweit.getRed_num());
+        sps.addValue("yellow_num", danweit.getYellow_num());
+        sps.addValue("green_num", danweit.getGreen_num());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 查询数据缓存中统计
+    public List<Danweit> queryDanweiByDate(String tj_date){
+        String sql = "select * from `danweit` where tj_date=:tj_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("tj_date", tj_date);
+        List<Danweit> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Danweit.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /** ===================各单位具体场所======================== **/
+    // 各单位具体场所每天人数
+    public List<DanweiDetail> queryDwplaceByDate(String sm_date, String place_type){
+        String sql = "select IFNULL(hotel, '未知') as places,IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_num,IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_num,IFNULL(SUM(IF(sm_color='绿码',1,0)),0) as green_num from ( select * from  (select * from `sm_message` where sm_date=:sm_date and place_type=:place_type ) a  group by UUID, hotel ) b group by hotel ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        sps.addValue("place_type", place_type);
+        List<DanweiDetail> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(DanweiDetail.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询数据是否缓存
+    public List<DanweiDetail> queryDanweiDIsR(String tj_date,String places){
+        String sql = "select * from `danweidetail` where places=:places and tj_date=:tj_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("tj_date", tj_date);
+        sps.addValue("places", places);
+        List<DanweiDetail> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(DanweiDetail.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 插入缓存
+    public int insertDanweiD(DanweiDetail danweiDetail){
+        String sql = "insert into `danweidetail`(placef,places,tj_date,red_num,yellow_num,green_num) values(:placef,:places,:tj_date,:red_num,:yellow_num,:green_num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("placef", danweiDetail.getPlacef());
+        sps.addValue("places", danweiDetail.getPlaces());
+        sps.addValue("tj_date", danweiDetail.getTj_date());
+        sps.addValue("red_num", danweiDetail.getRed_num());
+        sps.addValue("yellow_num", danweiDetail.getYellow_num());
+        sps.addValue("green_num", danweiDetail.getGreen_num());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 查询数据缓存中统计
+    public List<DanweiDetail> queryDanweiDByDate(String tj_date,String placef){
+        String sql = "select * from `danweidetail` where tj_date=:tj_date and placef=:placef ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("tj_date", tj_date);
+        sps.addValue("placef", placef);
+        List<DanweiDetail> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(DanweiDetail.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+}

+ 143 - 0
bigData/src/com/happy/dao/Impl/MobImplDao.java

@@ -0,0 +1,143 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.Mob.*;
+import com.happy.Model.SecondPlaceJc;
+import com.happy.Model.User;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.MobDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("MobDao")
+public class MobImplDao implements MobDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    // 处置人员详情
+    public List<User> queryHandled(String sqlx, int page, int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from `sm_message_x` where 1=1 "+ sqlx + " order by sm_time desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 处置详情总数
+    public int findUsersTotal(String s1) {
+        String sql = "select count(*) from `sm_message_x` where  1=1 "+s1;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 红码累积处置统计
+    public RedL queryLjRed(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as red_lj_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as red_lj_unhandlded from `sm_message_x` where sm_color='红码' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(RedL.class));
+    }
+
+    // 红码当日处置统计
+    public RedT queryTodayRed(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as red_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as red_unhandlded from `sm_message_x` where sm_color='红码' and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(RedT.class));
+    }
+
+    // 黄码累积处置统计
+    public YellowL queryLjYellow(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as yellow_lj_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as yellow_lj_unhandlded from `sm_message_x` where sm_color='黄码' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(YellowL.class));
+    }
+
+    // 黄码当日处置统计
+    public YellowT queryTodayYellow(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as yellow_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as yellow_unhandlded from `sm_message_x` where sm_color='黄码' and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(YellowT.class));
+    }
+
+    // 重点累积处置统计
+    public KeyL queryLjKey(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as key_lj_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as key_lj_unhandlded from `sm_message_x` where iskey='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(KeyL.class));
+    }
+
+    // 重点当日处置统计
+    public KeyT queryTodayKey(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as key_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as key_unhandlded from `sm_message_x` where iskey='1' and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(KeyT.class));
+    }
+
+    // 发热累积处置统计
+    public HotL queryLjHot(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as hot_lj_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as hot_lj_unhandlded from `sm_message_x` where ishot='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(HotL.class));
+    }
+
+    // 发热当日处置统计
+    public HotT queryTodayHot(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as hot_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as hot_unhandlded from `sm_message_x` where ishot='1' and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(HotT.class));
+    }
+
+    // 脱管累积处置统计
+    public TokenL queryLjToken(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as token_lj_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as token_lj_unhandlded from `sm_message_x` where istoken='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(TokenL.class));
+    }
+
+    // 脱管当日处置统计
+    public TokenT queryTodayToken(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as token_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as token_unhandlded from `sm_message_x` where istoken='1' and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(TokenT.class));
+    }
+
+    // 近8天红黄码重点、发热、脱管处置详情
+    public RedT queryEightRed(String sm_date, String slqx){
+        String sql = "select IFNULL(SUM(IF(handler_state2=1,1,0)),0) as red_handlded,IFNULL(SUM(IF(handler_state2=0,1,0)),0) as red_unhandlded from `sm_message_x` where sm_date=:sm_date " +slqx;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(RedT.class));
+    }
+
+    // 近8天每日处置平均时长
+    public Avg queryEightAvg(String sm_date){
+        String sql = "select IFNULL(avg(handler_duration),0) as duration from `sm_message_x` where sm_date=:sm_date and handler_state2=1 " ;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(Avg.class));
+    }
+}

+ 96 - 0
bigData/src/com/happy/dao/Impl/SecondBufferPImplDao.java

@@ -0,0 +1,96 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.SecondBufferP;
+import com.happy.Model.User;
+import com.happy.dao.SecondBufferPDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Repository("SecondBufferPDao")
+public class SecondBufferPImplDao implements SecondBufferPDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertSecondBufferP(SecondBufferP secondBufferP){
+        String sql = "insert into `secondbufferp`(dateT,`dateTime`,place,red_count,yellow_count,green_count,url) values(:dateT,:dateTime,:place,:red_count,:yellow_count,:green_count,:url)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", secondBufferP.getDateT());
+        sps.addValue("dateTime", secondBufferP.getDateTime());
+        sps.addValue("place", secondBufferP.getPlace());
+        sps.addValue("red_count", secondBufferP.getRed_count());
+        sps.addValue("yellow_count", secondBufferP.getYellow_count());
+        sps.addValue("green_count", secondBufferP.getGreen_count());
+        sps.addValue("url", secondBufferP.getUrl());
+        System.out.println(secondBufferP.getRed_count());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 各景点扫码详情
+    public List<SecondBufferP> querySecondBufferP(){
+        String sql = "select * from `secondbufferp` where id in(select MAX(id) from `secondbufferp` group by place) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<SecondBufferP> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferP>(SecondBufferP.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各景点扫码详情
+    public List<SecondBufferP> querySecondBufferpByPlace(String place){
+        String sql = "select * from `secondbufferp` where place=:place and id=(select max(id) from `secondbufferp` where place=:place) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place",place);
+        List<SecondBufferP> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferP>(SecondBufferP.class));
+        List<SecondBufferP> list2 = new ArrayList<>();
+        if (list != null && list.size() > 0) {
+            return list;
+        } else {
+            SecondBufferP sp = new SecondBufferP();
+            sp.setGreen_count("0");
+            sp.setRed_count("0");
+            sp.setYellow_count("0");
+            list2.add(sp);
+            return list2;
+        }
+    }
+
+    // 各景点人员扫码信息
+    public List<User> queryByPlace(String sm_place){
+        String sql = "select * from `sm_message` where protect_type='2' and sm_place=:sm_place order by `id` desc limit 0,20 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_place", sm_place);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 488 - 0
bigData/src/com/happy/dao/Impl/SecondBuffertImplDao.java

@@ -0,0 +1,488 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.*;
+import com.happy.Model.Common.Common;
+import com.happy.Model.Tour.TravelSecond;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.SecondBuffertDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("SecondBuffertDao")
+public class SecondBuffertImplDao implements SecondBuffertDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertSecondBufferT(SecondBufferT secondBufferT){
+        String sql = "insert into secondbuffert(dateT,smT,smT_increase,smLt,red_count,red_increase,yellow_count,yellow_increase,green_count,green_increase) values(:dateT,:smT,:smT_increase,:smLt,:red_count,:red_increase,:yellow_count,:yellow_increase,:green_count,:green_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", secondBufferT.getDateT());
+        sps.addValue("smT", secondBufferT.getSmT());
+        sps.addValue("smT_increase", secondBufferT.getSmT_increase());
+        sps.addValue("smLt", secondBufferT.getSmLt());
+        sps.addValue("red_count", secondBufferT.getRed_count());
+        sps.addValue("red_increase", secondBufferT.getRed_increase());
+        sps.addValue("yellow_count", secondBufferT.getYellow_count());
+        sps.addValue("yellow_increase", secondBufferT.getYellow_increase());
+        sps.addValue("green_count", secondBufferT.getGreen_count());
+        sps.addValue("green_increase", secondBufferT.getGreen_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 人数统计
+    public int insertSecondBufferC(SecondBufferC secondBufferC){
+        String sql = "insert into secondbufferc(dateT,dateTime,smT,smT_increase,smLt,red_count,red_increase,yellow_count,yellow_increase,green_count,green_increase) values(:dateT,:dateTime,:smT,:smT_increase,:smLt,:red_count,:red_increase,:yellow_count,:yellow_increase,:green_count,:green_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", secondBufferC.getDateT());
+        sps.addValue("dateTime", secondBufferC.getDateTime());
+        sps.addValue("smT", secondBufferC.getSmT());
+        sps.addValue("smT_increase", secondBufferC.getSmT_increase());
+        sps.addValue("smLt", secondBufferC.getSmLt());
+        sps.addValue("red_count", secondBufferC.getRed_count());
+        sps.addValue("red_increase", secondBufferC.getRed_increase());
+        sps.addValue("yellow_count", secondBufferC.getYellow_count());
+        sps.addValue("yellow_increase", secondBufferC.getYellow_increase());
+        sps.addValue("green_count", secondBufferC.getGreen_count());
+        sps.addValue("green_increase", secondBufferC.getGreen_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 第二道防线扫描汇总
+    public List<SecondBufferT> querySecondBufferT(){
+        String sql = "select * from secondbuffert where id in(select MAX(id) from secondbuffert) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<SecondBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferT>(SecondBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线景点当日绿码人数统计
+    public List<SecondBufferT> querySpjdGreen(String sm_date){
+        String sql = "select IFNULL(SUM(IF(sm_color='绿码',1,0)),0) as green_count from(select * from `sm_message` where sm_date=:sm_date and sm_color='绿码' and sm_place in (select place_name from `secondplace`)  group by UUID ) a  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<SecondBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(SecondBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线扫描汇总------红黄码发热汇总
+    public List<SecondBufferT> querySecondBufferRy(){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,  IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count,IFNULL(SUM(IF(ishot='1',1,0)),0) as hot_count from `sm_message_x` where protect_type='2' and (sm_color in ('红码', '黄码') or ishot='1') and sm_date=:sm_date  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        List<SecondBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferT>(SecondBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线扫描汇总------红黄码发热汇总
+    public List<SecondBufferT> querySbRyByDate(String sm_date){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,  IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count,IFNULL(SUM(IF(ishot='1',1,0)),0) as hot_count from `sm_message_x` where protect_type='2' and (sm_color in ('红码', '黄码') or ishot='1') and sm_date=:sm_date  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<SecondBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferT>(SecondBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 最近7天人员分布
+    public List<SecondBufferT> querySecondBufferTLastSeven(){
+        String sql = "select * from `secondbuffert` where id in(select id from(select dateT,MAX(id) as id from secondbuffert group by dateT order by dateT desc limit 0, 7) a)  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<SecondBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferT>(SecondBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线扫码人数汇总
+    public List<SecondBufferC> querySecondBufferC(){
+        String sql = "select * from `secondbufferc` where id in(select MAX(id) from `secondbufferc`) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<SecondBufferC> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferC>(SecondBufferC.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线处理情况
+    public List<Handlde> queryHandler(){
+        String sql = "select IFNULL(SUM(IF(handler_state2=0,1,0)),0) as unhandled,  IFNULL(SUM(IF(handler_state2=1,1,0)),0) as handled from `sm_message_x` where protect_type='2' and (sm_color in('红码','黄码') or ishot='1') and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        System.out.println(TimeExchange.getDate());
+        List<Handlde> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Handlde>(Handlde.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线发热人员
+    public int queryHot(){
+        String sql = "select count(*) from `sm_message_x` where ishot='1' and protect_type='2' and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 第二道防线红码人员详情
+    public List<User> queryRed(String startDate, String endDate){
+        String sql = "select * from `sm_message_x` where protect_type='2' and sm_color='红码' and sm_date between :startDate and :endDate order by sm_time desc  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startDate", startDate);
+        sps.addValue("endDate", endDate);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线黄码人员详情
+    public List<User> queryYellow(String startDate,String endDate,int page, int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from `sm_message_x` where protect_type='2' and sm_color='黄码' and sm_date between :startDate and :endDate order by sm_time desc limit :start,:rows  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startDate", startDate);
+        sps.addValue("endDate", endDate);
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第一道防线黄码人员总数-分页
+    public int queryYellowTotal(String startDate,String endDate){
+        String sql = "select count(*) from `sm_message_x` where protect_type='2' and sm_color='黄码' and sm_date between :startDate and :endDate ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startDate", startDate);
+        sps.addValue("endDate", endDate);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 第二道防线地址类型
+    public List<Secondplacetype> queryPt(){
+        String sql = "select * from `secondplacetype` ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Secondplacetype> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Secondplacetype>(Secondplacetype.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线景点名称
+    public List<Secondplace> queryJd(){
+        String sql = "select * from `secondplace` ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Secondplace> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Secondplace>(Secondplace.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 第二道防线景点名称
+    public List<Secondplace> queryJdByname(String place_name){
+        String sql = "select * from `secondplace` where place_name like :place_name ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_name", "%"+place_name+"%");
+        List<Secondplace> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Secondplace>(Secondplace.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+    //插入TravelSecond
+    public int insertTravelSecond(TravelSecond travelSecond,String dayId){
+        String sql = "SELECT * from travel_second where place_name = :place_name and day_id= :dayId limit 1";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_name", travelSecond.getPlaceName());
+        sps.addValue("place_id", travelSecond.getPlaceId());
+        sps.addValue("dayNum", travelSecond.getDayNum());
+        sps.addValue("totalNum", travelSecond.getTotalNum());
+        sps.addValue("maxValue", travelSecond.getMaxValue());
+        sps.addValue("dayId", dayId);
+        List<TravelSecond> travelSecondList= namedParameterJdbcTemplate.query(sql, sps, new BeanPropertyRowMapper<>(TravelSecond.class));
+        if(travelSecondList==null||travelSecondList.size()<1){
+            sql = "INSERT INTO `travel_second`(`place_name`, `dayNum`, `totalNum`, `maxValue`,day_id,place_id) VALUES (:place_name,:dayNum, :totalNum, :maxValue,:dayId,:place_id)";
+        }else {
+            sps.addValue("id", travelSecondList.get(0).getId());
+            sql = "update travel_second set dayNum = :dayNum, totalNum = :totalNum,`maxValue` = :maxValue where id = :id";
+        }
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public TravelSecond queryTravelSecond(String place_name){
+        String sql = "SELECT * from travel_second where place_name = :place_name and day_id= :dayId limit 1";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_name", place_name);
+        sps.addValue("dayId", TimeExchange.getDate());
+        List<TravelSecond> travelSecondList= namedParameterJdbcTemplate.query(sql, sps, new BeanPropertyRowMapper<>(TravelSecond.class));
+        if(travelSecondList!=null&&travelSecondList.size()>0){
+            return travelSecondList.get(0);
+        }
+        return null;
+    }
+
+    // 第二道防线各场所详情
+    public SecondPlaceJc querySpjc(String place_type){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count,IFNULL(SUM(IF(ishot='1',1,0)),0) as hot_count,IFNULL(SUM(IF(iskey='1',1,0)),0) as key_count from `sm_message_x` where place_type=:place_type and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_type", place_type);
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 第二道防线亮码详情
+    public SecondPlaceJc querySl(){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count,IFNULL(SUM(IF(ishot='1',1,0)),0) as hot_count,IFNULL(SUM(IF(iskey='1',1,0)),0) as key_count from `sm_message_x` where sm_type='亮码' and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 第二道防线亮码绿码详情
+    public SecondPlaceJc querySlGreen(){
+        String sql = "select IFNULL(COUNT(distinct UUID,sm_date,protect_type),0) as green_count from `sm_message` where sm_color='绿码' and sm_type='亮码' and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 第二道防线各景点详情
+    public SecondPlaceJc querySpjd(){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count,IFNULL(SUM(IF(ishot='1',1,0)),0) as hot_count,IFNULL(SUM(IF(iskey='1',1,0)),0) as key_count from `sm_message_x` where sm_place in (select place_name from `secondplace`) and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 各酒店医院详细名称
+    public List<Common> queryCommon(String place_type){
+        String sql = "select distinct hotel as common from `sm_message` where sm_date=:sm_date and place_type=:place_type ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        sps.addValue("place_type", place_type);
+        List<Common> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Common.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 根据详细名称查红黄码详情
+    public SecondPlaceJc queryByCommon(String place_type,String hotel){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count,IFNULL(SUM(IF(ishot='1',1,0)),0) as hot_count,IFNULL(SUM(IF(iskey='1',1,0)),0) as key_count from `sm_message_x` where sm_date=:sm_date and place_type=:place_type and hotel=:hotel ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        sps.addValue("place_type", place_type);
+        sps.addValue("hotel", hotel);
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 第二道防线各场所绿码详情
+    public SecondPlaceJc queryGreen(String place_type){
+        String sql = "select IFNULL(COUNT(distinct UUID,sm_date,protect_type),0) as green_count from `sm_message` where sm_color='绿码' and place_type=:place_type and sm_date=:sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_type", place_type);
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 第二道防线各门店绿码详情
+    public SecondPlaceJc queryGreenByCommon(String place_type,String hotel){
+        String sql = "select IFNULL(COUNT(distinct UUID,sm_date,protect_type),0) as green_count from `sm_message` where sm_color='绿码' and place_type=:place_type and sm_date=:sm_date and hotel=:hotel ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_type", place_type);
+        sps.addValue("sm_date", TimeExchange.getDate());
+        sps.addValue("hotel", hotel);
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 第二道防线发热加时间搜索
+    public List<User> queryByTime(int page, int rows,String sqlx){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from `sm_message_x` where protect_type='2' and ishot='1' " + sqlx +"  order by sm_time desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询用户表中的总记录数
+    public int findUsersTotal(String s1) {
+        String sql = "select count(*) from `sm_message_x` where  protect_type='2' and ishot='1' "+s1;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 第二道防线累积加时间搜索
+    public List<User> queryLjByTime(int page, int rows,String sqlx){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from `sm_message_x` where protect_type='2' " + sqlx +"  order by sm_time desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询用户表中的累积总记录数
+    public int findLjUsersTotal(String s1) {
+        String sql = "select count(*) from `sm_message_x` where  protect_type='2' "+s1;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 第二道防线累积红黄码详情
+    public SecondPlaceJc queryLjRy(){
+        String sql = "select IFNULL(SUM(IF(sm_color='红码',1,0)),0) as red_count,IFNULL(SUM(IF(sm_color='黄码',1,0)),0) as yellow_count,IFNULL(SUM(IF(ishot='1',1,0)),0) as hot_count from `sm_message_x` where protect_type='2' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 第二道防线累积绿码详情
+    public SecondPlaceJc queryLjGreen(){
+        String sql = "select IFNULL(COUNT(distinct UUID,sm_date,protect_type),0) as green_count from `sm_message` where sm_color='绿码' and protect_type='2' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<>(SecondPlaceJc.class));
+    }
+
+    // 各景点日、月、年统计
+    public Tz queryView(String sm_place){
+        String sql = "select IFNULL(SUM(IF(sm_date=:sm_day,1,0)),0) as daycount, IFNULL(SUM(IF(sm_date like :sm_month, 1,0)),0) as monthcount,IFNULL(SUM(IF(sm_date like :sm_year, 1,0)),0) as yearcount from `sm_message` where sm_place=:sm_place ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_day", TimeExchange.getDate());
+        sps.addValue("sm_month", TimeExchange.getMonth()+"%");
+        sps.addValue("sm_year", TimeExchange.getYear()+"%");
+        sps.addValue("sm_place", sm_place);
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<Tz>(Tz.class));
+    }
+
+    /** =================昨日累积缓存 =============================**/
+    // 第二道防线昨日累积扫描汇总
+    public SecondBufferT querySbYesLj(String sm_date){
+        String sql = "select COUNT(*) as smT from (select * from `sm_message` where protect_type=2 and sm_date=:sm_date group by UUID ) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<SecondBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferT>(SecondBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 第二道防线查询缓存数据
+    public List<SecondBufferT> querySbCache(String dateT){
+        String sql = "select * from `secondbuffert` where dateT=:dateT ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", dateT);
+        List<SecondBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SecondBufferT>(SecondBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 插入缓存
+    public int insertSbT(SecondBufferT secondBufferT){
+        String sql = "insert into secondbuffert(dateT,smT,smT_increase,smLt,red_count,red_increase,yellow_count,yellow_increase,green_count,green_increase) values(:dateT,:smT,:smT_increase,:smLt,:red_count,:red_increase,:yellow_count,:yellow_increase,:green_count,:green_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", secondBufferT.getDateT());
+        sps.addValue("smT", secondBufferT.getSmT());
+        sps.addValue("smT_increase", secondBufferT.getSmT_increase());
+        sps.addValue("smLt", secondBufferT.getSmLt());
+        sps.addValue("red_count", secondBufferT.getRed_count());
+        sps.addValue("red_increase", secondBufferT.getRed_increase());
+        sps.addValue("yellow_count", secondBufferT.getYellow_count());
+        sps.addValue("yellow_increase", secondBufferT.getYellow_increase());
+        sps.addValue("green_count", secondBufferT.getGreen_count());
+        sps.addValue("green_increase", secondBufferT.getGreen_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+}

+ 71 - 0
bigData/src/com/happy/dao/Impl/SmlmtImplDao.java

@@ -0,0 +1,71 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.SmlmT;
+import com.happy.dao.SmlmtDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("SmlmtDao")
+public class SmlmtImplDao implements SmlmtDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertSmlmT(SmlmT smlmT){
+        String sql = "insert into smlmt(dateT,smT,smLt,lmT,lmLt,month) values(:dateT,:smT,:smLt,:lmT,:lmLt,:month)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", smlmT.getDateT());
+        sps.addValue("smT", smlmT.getSmT());
+        sps.addValue("smLt", smlmT.getSmLt());
+        sps.addValue("lmT", smlmT.getLmT());
+        sps.addValue("lmLt", smlmT.getLmLt());
+        sps.addValue("month", smlmT.getMonth());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 今日扫码亮码
+    public List<SmlmT> query(){
+        String sql = "select * from `smlmt` where id=(select max(id) from `smlmt`) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<SmlmT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SmlmT>(SmlmT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 扫码亮码月统计
+    public List<SmlmT> queryByMonth(String month){
+        String sql = "select * from `smlmt` where id in(select id from(select dateT,MAX(id) as id from `smlmt` where dateT like '"+month+"%' group by dateT order by dateT asc ) a) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<SmlmT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SmlmT>(SmlmT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 74 - 0
bigData/src/com/happy/dao/Impl/SmtImplDao.java

@@ -0,0 +1,74 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.Hylj;
+import com.happy.Model.SmT;
+import com.happy.dao.SmtDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("SmtDao")
+public class SmtImplDao implements SmtDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertSmT(SmT smT){
+        String sql = "insert into `smt`(dateT,counts,increase,red_counts,red_increase,yellow_counts,yellow_increase,green_counts,green_increase) values(:dateT,:counts,:increase,:red_counts,:red_increase,:yellow_counts,:yellow_increase,:green_counts,:green_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", smT.getDateT());
+        sps.addValue("counts", smT.getCounts());
+        sps.addValue("increase", smT.getIncrease());
+        sps.addValue("red_counts", smT.getRed_counts());
+        sps.addValue("red_increase", smT.getRed_increase());
+        sps.addValue("yellow_counts", smT.getYellow_counts());
+        sps.addValue("yellow_increase", smT.getYellow_increase());
+        sps.addValue("green_counts", smT.getGreen_counts());
+        sps.addValue("green_increase", smT.getGreen_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 全县扫码详情
+    public List<SmT> query(){
+        String sql = "select * from `smt` where id=(select max(id) from `smt`) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<SmT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<SmT>(SmT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 红黄码累计
+    public List<Hylj> queryLj(){
+        String sql = "select SUM(IF(sm_color='红码',1,0)) as red_count, SUM(IF(sm_color='黄码',1,0)) as yellow_count from (select `uuid`,sm_name,sm_color,sm_month from `sm_message_x` group by `uuid`, sm_month) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Hylj> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Hylj>(Hylj.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+}

+ 142 - 0
bigData/src/com/happy/dao/Impl/ThirdBuffertImplDao.java

@@ -0,0 +1,142 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.ThirdBufferT;
+import com.happy.Model.ThirdJw;
+import com.happy.Model.Tz;
+import com.happy.Model.User;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.ThirdBuffertDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("ThirdBuffertDao")
+public class ThirdBuffertImplDao implements ThirdBuffertDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertThirdBufferT(ThirdBufferT thirdBufferT){
+        String sql = "insert into `thirdbuffert`(dateT,smT,smT_increase,smLt,red_count,red_increase,yellow_count,yellow_increase,green_count,green_increase) values(:dateT,:smT,:smT_increase,:smLt,:red_count,:red_increase,:yellow_count,:yellow_increase,:green_count,:green_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", thirdBufferT.getDateT());
+        sps.addValue("smT", thirdBufferT.getSmT());
+        sps.addValue("smT_increase", thirdBufferT.getSmT_increase());
+        sps.addValue("smLt", thirdBufferT.getSmLt());
+        sps.addValue("red_count", thirdBufferT.getRed_count());
+        sps.addValue("red_increase", thirdBufferT.getRed_increase());
+        sps.addValue("yellow_count", thirdBufferT.getYellow_count());
+        sps.addValue("yellow_increase", thirdBufferT.getYellow_increase());
+        sps.addValue("green_count", thirdBufferT.getGreen_count());
+        sps.addValue("green_increase", thirdBufferT.getGreen_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 第三道防线扫码汇总
+    public List<ThirdBufferT> queryThirdBufferT(){
+        String sql = "select * from `thirdbuffert` where id in(select MAX(id) from `thirdbuffert`) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<ThirdBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<ThirdBufferT>(ThirdBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 最近7天人员分布
+    public List<ThirdBufferT> queryThirdBufferTLastSeven(){
+        String sql = "select * from `thirdbuffert` where id in(select id from(select dateT,MAX(id) as id from `thirdbuffert` group by dateT order by dateT desc limit 0, 7) a)  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<ThirdBufferT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<ThirdBufferT>(ThirdBufferT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各酒店人员扫码信息
+    public List<User> queryByBuffer(){
+        String sql = "select * from `sm_message` where sm_type='亮码' order by `id` desc limit 0,50 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各酒店对应经纬度
+    public List<ThirdJw> queryJw(){
+        String sql = "select distinct sm_place as place, jingwei from `sm_message` where protect_type=3 and sm_type='扫码' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<ThirdJw> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<ThirdJw>(ThirdJw.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 脱管人员统计
+    public Tz queryTuo(){
+        String sql = "select IFNULL(SUM(IF(sm_date=:sm_day,1,0)),0) as daycount, IFNULL(SUM(IF(sm_date like :sm_year, 1,0)),0) as yearcount from `sm_message_x` where istoken='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_day", TimeExchange.getDate());
+        sps.addValue("sm_year", TimeExchange.getYear()+"%");
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<Tz>(Tz.class));
+    }
+
+    // 重点地区人员统计
+    public Tz queryZd(){
+        String sql = "select IFNULL(SUM(IF(sm_date=:sm_day,1,0)),0) as daycount, IFNULL(SUM(IF(sm_date like :sm_year, 1,0)),0) as yearcount  from `sm_message_x` where iskey='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_day", TimeExchange.getDate());
+        sps.addValue("sm_year", TimeExchange.getYear()+"%");
+        return namedParameterJdbcTemplate.queryForObject(sql,sps,new BeanPropertyRowMapper<Tz>(Tz.class));
+    }
+
+    // 第三道防线重点时间搜索
+    public List<User> queryByTime(int page, int rows,String sqlx){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from `sm_message_x` where (iskey='1' or istoken='1') " + sqlx +"  order by sm_time desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<User> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<User>(User.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询用户表中的总记录数
+    public int findUsersTotal(String s1) {
+        String sql = "select count(*) from `sm_message_x` where (iskey='1' or istoken='1') "+s1;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+}

+ 913 - 0
bigData/src/com/happy/dao/Impl/TourImplDao.java

@@ -0,0 +1,913 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.Message_handler;
+import com.happy.Model.Secondplace;
+import com.happy.Model.Tour.CommonSql;
+import com.happy.Model.Tour.Hotel;
+import com.happy.Model.Tour.TourDayt;
+import com.happy.Model.Tour.Tourx;
+import com.happy.Model.Travel.*;
+import com.happy.Model.User;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.TourDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Repository("TourDao")
+public class TourImplDao implements TourDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    // 今日旅游人数
+    public TourDayt queryTotalTour(String sm_date){
+        String sql = "SELECT 'DATETIME' AS dateTime, COUNT(DISTINCT(UUID)) AS num FROM `sm_message` WHERE sm_date LIKE :sm_date AND  protect_type =2 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        return namedParameterJdbcTemplate.queryForObject(sql, sps,new BeanPropertyRowMapper<>(TourDayt.class));
+    }
+
+    // 本-月-年旅游人数
+    public TourDayt queryTotalTourOther(String sm_date){
+        String sql = "SELECT 'DATETIME' AS dateTime, COUNT(DISTINCT(UUID)) AS num FROM `sm_message` WHERE sm_date LIKE :sm_date AND  protect_type =2 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date+"%");
+        return namedParameterJdbcTemplate.queryForObject(sql, sps,new BeanPropertyRowMapper<>(TourDayt.class));
+    }
+
+    // 往日旅游人数
+    public TourDayt queryLastTour(String dateTime){
+        String sql = "select dateTime,ifnull(sum(num),0) as num from `tourdayt` where dateTime=:dateTime ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime);
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 往-月-年旅游人数
+    public TourDayt queryLastTourOther(String dateTime){
+        String sql = "select dateTime,ifnull(sum(num),0) as num from `tourdayt` where dateTime like :dateTime ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime+"%");
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 查询缓存-天-判断是否存在
+    public List<TourDayt> queryTourByDay(String dateTime){
+        String sql = "select * from `tourdayt` where dateTime=:dateTime ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime);
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询缓存-天-判断是否存在
+    public List<TourDayt> queryTourByOther(String dateTime){
+        String sql = "select * from `tourdayt` where dateTime like :dateTime ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime+"%");
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertToday(TourDayt tourDayt){
+        String sql = "insert into `tourdayt`(dateTime,num) values(:dateTime,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", tourDayt.getDateTime());
+        sps.addValue("num", tourDayt.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 查询景点累计数据
+    public TourDayt queryTourT(){
+        String sql = "select sum(num) as num from `tourdayt` where dateTime is not null ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 查询景点每日数据
+    public TourDayt queryTourDay(){
+        String sql = "select sm_date as dateTime,COUNT(*) as num from (select * from `sm_message` where sm_date=:sm_date "+ CommonSql.sql2 +" group by UUID ) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        return namedParameterJdbcTemplate.queryForObject(sql, sps,new BeanPropertyRowMapper<>(TourDayt.class));
+    }
+
+    /**==================缓存二================**/
+    // 今日某景点游客
+    public TravelT queryDayAndPlace(String sm_date,String sm_place){
+        String sql = "select sm_date as dateTime,sm_place as place,COUNT(*) as inCount from `sm_message` where sm_date=:sm_date and sm_place=:sm_place group by uuid ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        sps.addValue("sm_place", sm_place);
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 查询缓存-天-判断是否存在
+    public List<TravelT> queryDayAndPlaceExis(String dateTime,String place){
+        String sql = "select * from `travelt` where dateTime=:dateTime and place=:place ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime);
+        sps.addValue("place", place);
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertTodayAndPlace(TravelT travelT){
+        String sql = "insert into `travelt`(dateTime,place,inCount) values(:dateTime,:place,:inCount)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelT.getDateTime());
+        sps.addValue("place", travelT.getPlace());
+        sps.addValue("inCount", travelT.getInCount());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 各景点当日人流
+    public List<TravelT> queryTravelT(){
+        String sql = "select b.place_name as place,:sm_date as dateTime,ifnull(a.num,0) as inCount from (select sm_place as place,sm_date as dateTime,COUNT(*) as num from (select * from `sm_message` where sm_date=:sm_date "+ CommonSql.sql2 +" group by UUID,sm_place ) a group by sm_place ) a right join `secondplace` b on a.place=b.place_name ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+    // 查询缓存日旅游统计
+    public List<TourDayt> queryTour(){
+        String sql = "select * from `tourdayt` order by dateTime desc limit 0,7 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 分页查找景区每日人数
+    public List<TourDayt> queryTourPage(int page, int rows,String sqlx){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from `tourdayt` where 1=1 "+sqlx+" order by dateTime desc limit :start,:rows  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 分页查找景区每日人数
+    public int queryTourPaget(String sqlx){
+        String sql = "select count(*) from `tourdayt` where 1=1 " + sqlx;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    /**================月=======================**/
+    // 本月旅游人数
+    public TourDayt queryMonthTour(String sm_date){
+        String sql = "select SUBSTR(dateTime,1,7) as dateTime, SUM(num) as num from `tourdayt` where dateTime like :sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date+"%");
+        return namedParameterJdbcTemplate.queryForObject(sql, sps,new BeanPropertyRowMapper<>(TourDayt.class));
+    }
+
+    // 查询缓存-月-判断是否存在
+    public List<TourDayt> queryTourByMonth(String dateTime){
+        String sql = "select * from `tourdayw` where dateTime=:dateTime ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime);
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertMonth(TourDayt tourDayt){
+        String sql = "insert into `tourdayw`(dateTime,num) values(:dateTime,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", tourDayt.getDateTime());
+        sps.addValue("num", tourDayt.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 查询缓存月旅游统计
+    public List<TourDayt> queryTourM(){
+        String sql = "select * from `tourdayw` order by dateTime desc limit 0,7 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /**================年=======================**/
+    // 本年旅游人数
+    public TourDayt queryYearTour(String sm_date){
+        String sql = "select SUBSTR(dateTime,1,4) as dateTime, SUM(num) as num from `tourdayt` where dateTime like :sm_date ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date+"%");
+        return namedParameterJdbcTemplate.queryForObject(sql, sps,new BeanPropertyRowMapper<>(TourDayt.class));
+    }
+
+    // 查询缓存-年-判断是否存在
+    public List<TourDayt> queryTourByYear(String dateTime){
+        String sql = "select * from `tourdayy` where dateTime=:dateTime ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime);
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertYear(TourDayt tourDayt){
+        String sql = "insert into `tourdayy`(dateTime,num) values(:dateTime,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", tourDayt.getDateTime());
+        sps.addValue("num", tourDayt.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 查询缓存月旅游统计
+    public List<TourDayt> queryTourY(){
+        String sql = "select * from `tourdayy` order by dateTime desc limit 0,7 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /**================各省-年月日统计=================**/
+    // 各省日统计
+    public List<TravelProvin> queryTourProvince(String sm_date){
+        String sql = "select sm_date as dateTime,sm_from as province,COUNT(*) as num from (select * from `sm_message` where sm_date=:sm_date and sm_from!='江西省' and sm_from!='江西' and sm_from!='36' "+ CommonSql.sql2 +" group by UUID ) a group by sm_from order by num desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<TravelProvin> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelProvin.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询缓存-省-判断是否存在
+    public List<TravelProvin> queryTourByProvince(TravelProvin travelProvin){
+        String sql = "select * from `travelprovin` where dateTime=:dateTime and province=:province ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelProvin.getDateTime());
+        sps.addValue("province",travelProvin.getProvince());
+        List<TravelProvin> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelProvin.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertProvince(TravelProvin travelProvin){
+        String sql = "insert into `travelprovin`(dateTime,province,num,pro_lei) values(:dateTime,:province,:num,:pro_lei) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelProvin.getDateTime());
+        sps.addValue("province",travelProvin.getProvince());
+        sps.addValue("num", travelProvin.getNum());
+        sps.addValue("pro_lei", travelProvin.getPro_lei());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 各省月-年统计
+    public List<TravelProvin> queryTourProvinceM(String sm_date){
+        String sql = "select province,SUM(num) as num from `travelprovin` where dateTime like :sm_date  group by province order by num desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date+"%");
+        List<TravelProvin> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelProvin.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各省月-累计统计
+    public List<TravelProvin> queryTourProvinceT(){
+        String sql = "select province,SUM(num) as num from `travelprovin` group by province order by num desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<TravelProvin> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelProvin.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /**====================近12小时人次记录===================**/
+    // 每小时人次
+    public TourDayt queryTotalHour(String sm_time){
+        String sql = "select sm_date as dateTime,COUNT(*) as num from (select * from `sm_message` where sm_time like :sm_time "+ CommonSql.sql2 +" group by UUID ) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_time", sm_time+"%");
+        return namedParameterJdbcTemplate.queryForObject(sql, sps,new BeanPropertyRowMapper<>(TourDayt.class));
+    }
+
+    // 缓存是否存在
+    public TourDayt queryExistHour(String sm_time){
+        String sql = "select * from `tourhourt` where `dateTime`=:sm_time ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_time", sm_time);
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 插入缓存
+    public int insertHour(TourDayt tourDayt){
+        String sql = "insert into `tourhourt`(dateTime,num) values(:dateTime,:num) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", tourDayt.getDateTime());
+        sps.addValue("num", tourDayt.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 查询日12小时趋势
+    public List<TourDayt> queryHourHistory(String sm_date,String sm_time, int m){
+        String sql = "select `dateTime`,`num` from `tourhourt` where `dateTime` like :sm_date and `dateTime` < :sm_time GROUP BY `dateTime` order by `dateTime` desc limit 0,:m ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date+" %");
+        sps.addValue("sm_time", sm_time);
+        sps.addValue("m", m);
+        List<TourDayt> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TourDayt.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /**================性别统计=======================**/
+    // 每日男女性统计
+    public TravelGender queryTourGenderD(String sm_date,String sm_gender){
+        String sql = "select sm_date as dateTime, sm_gender as gender,COUNT(*) as num from(select * from `sm_message` where sm_date=:sm_date  and sm_gender=:sm_gender "+CommonSql.sql+" group by UUID ) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        sps.addValue("sm_gender", sm_gender);
+        List<TravelGender> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelGender.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 查询缓存-性别-判断是否存在
+    public List<TravelGender> queryTourByGender(TravelGender travelGender){
+        String sql = "select * from `travelgender` where dateTime=:dateTime and gender=:gender ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelGender.getDateTime());
+        sps.addValue("gender",travelGender.getGender());
+        List<TravelGender> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelGender.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertGender(TravelGender travelGender){
+        String sql = "insert into `travelgender`(dateTime,gender,num) values(:dateTime,:gender,:num) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelGender.getDateTime());
+        sps.addValue("gender",travelGender.getGender());
+        sps.addValue("num", travelGender.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 男女性别年统计
+    public List<TravelGender> queryTourByGenderAndYear(String dateTime){
+        String sql = "select gender,SUM(num) as num from `travelgender`  where dateTime like :dateTime group by gender ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime+"%");
+        List<TravelGender> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelGender.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 男女性别累计统计
+    public List<TravelGender> queryGenderT(){
+        String sql = "select gender,SUM(num) as num from `travelgender` where gender is not null group by gender ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<TravelGender> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelGender.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /**================年龄统计=======================**/
+    // 年龄时间统计
+    public TravelAge queryTourAge(String sm_date, String ageArea, String sqlx){
+        String sql = "select sm_date as dateTime,:ageArea as ageArea,COUNT(*) as num from (select * from `sm_message` where sm_date=:sm_date "+ CommonSql.sql + sqlx+" group by UUID ) a";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        sps.addValue("ageArea", ageArea);
+        List<TravelAge> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelAge.class));
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    // 查询缓存-年龄-判断是否存在
+    public List<TravelAge> queryTourByAge(TravelAge travelAge){
+        String sql = "select * from `travelage` where dateTime=:dateTime and ageArea=:ageArea ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelAge.getDateTime());
+        sps.addValue("ageArea",travelAge.getAgeArea());
+        List<TravelAge> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelAge.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertAge(TravelAge travelAge){
+        String sql = "insert into `travelage`(dateTime,ageArea,num) values(:dateTime,:ageArea,:num) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelAge.getDateTime());
+        sps.addValue("ageArea",travelAge.getAgeArea());
+        sps.addValue("num", travelAge.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 年龄年统计
+    public List<TravelAge> queryTourByAgeAndYear(String dateTime){
+        String sql = "select ageArea,SUM(num) as num from `travelage` where dateTime like :dateTime group by ageArea ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime+"%");
+        List<TravelAge> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelAge.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 年龄累计统计
+    public List<TravelAge> queryAgeT(){
+        String sql = "select ageArea,SUM(num) as num from `travelage` where ageArea is not null group by ageArea ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<TravelAge> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelAge.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /**================景区游客人数统计=======================**/
+    // 景区游客日人数统计
+    public List<TravelT> queryTourNum(String sm_date){
+        String sql = "select sm_place as place,sm_date as dateTime,COUNT(*) as inCount from (select * from `sm_message` where sm_date=:sm_date "+CommonSql.sql+" group by UUID ) a group by sm_place order by inCount desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询缓存-各景区当日-判断是否存在
+    public List<TravelT> queryTourByNum(TravelT travelT){
+        String sql = "select * from `travelt` where dateTime=:dateTime and place=:place ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelT.getDateTime());
+        sps.addValue("place",travelT.getPlace());
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertNum(TravelT travelT){
+        String sql = "insert into `travelt`(dateTime,place,inCount) values(:dateTime,:place,:inCount) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelT.getDateTime());
+        sps.addValue("place",travelT.getPlace());
+        sps.addValue("inCount", travelT.getInCount());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 各景点年月年统计
+    public List<TravelT> queryTourByNumAndTime(String dateTime){
+        String sql = "select place,SUM(inCount) as inCount from `travelt` where dateTime like :dateTime group by place order by inCount desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime+"%");
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 景区游客累积人数统计
+    public List<TravelT> queryTourNumT(){
+        String sql = "select SUM(inCount) as inCount from `travelt`  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各景区游客累积人数统计
+    public List<TravelT> queryGTourNumT(){
+        String sql = "select * from (select place,SUM(inCount+0) as inCount from `travelt` where dateTime<:dateTime group by place ) a where place is not null  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", TimeExchange.getDate()+" 24:00:00");
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各景区人数排行跨日期
+    public List<TravelT> queryTourNumByDate(String startTime, String endTime){
+        String sql = "select place,SUM(inCount) as inCount from `travelt` where dateTime between :startTime and :endTime and place is not null group by place order by inCount desc  ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startTime", startTime);
+        sps.addValue("endTime", endTime);
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    /**================景区过夜人数统计=======================**/
+   // 各镇过夜日人数统计
+    public List<Travelye> queryTourYe(String sm_date){
+        String sql = "select id,place,SUM(num) as num,dateTime from (select b.id,b.`town` as place,IFNULL(a.num,0) as num,a.dateTime as dateTime from (select town as place,sm_date as dateTime,COUNT(*) as num from `sm_message` where sm_date=:sm_date and place_type='酒店' group by UUID  ) a right join towns b on a.place=b.town  ) c group by place";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", sm_date);
+        List<Travelye> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Travelye.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询缓存-各景区过夜-判断是否存在
+    public List<Travelye> queryTourByYe(Travelye travelye){
+        String sql = "select * from `travelye` where dateTime=:dateTime and place=:place ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelye.getDateTime());
+        sps.addValue("place",travelye.getPlace());
+        List<Travelye> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Travelye.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int insertYe(Travelye travelye){
+        String sql = "insert into `travelye`(dateTime,place,num) values(:dateTime,:place,:num) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelye.getDateTime());
+        sps.addValue("place",travelye.getPlace());
+        sps.addValue("num", travelye.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 各镇过夜年月年统计
+    public List<Travelye> queryTourByNumAndYe(String dateTime){
+        String sql = "select place,SUM(num) as num from `travelye` where dateTime like :dateTime group by place order by num desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", dateTime+"%");
+        List<Travelye> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Travelye.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 过夜游客按时查找
+    public List<Travelye> queryTouYeByDate(String startTime, String endTime){
+        String sql = "select place,SUM(num) as num from `travelye` where dateTime between :startTime and :endTime and place is not null group by place order by num desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startTime", startTime);
+        sps.addValue("endTime", endTime);
+        List<Travelye> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Travelye.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各酒店过夜人数
+    public List<Hotel> queryHotel(int page, int rows, String startTime,String endTime,String sqlx){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select town,hotel,COUNT(*) as num from `sm_message` where `place_type`='酒店' and sm_date between :startTime and :endTime "+sqlx+" group by hotel order by sm_time desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        sps.addValue("startTime", startTime);
+        sps.addValue("endTime", endTime);
+        List<Hotel> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Hotel.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 查询用户表中的总记录数
+    public int queryHotelTotal(String startTime,String endTime,String s1) {
+        String sql = "select COUNT(*) from(select town,hotel,COUNT(*) as num from `sm_message` where `place_type`='酒店' and sm_date between :startTime and :endTime "+s1+" group by hotel ) a" ;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startTime", startTime);
+        sps.addValue("endTime", endTime);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 最大访客量
+    public int queryMaxTour(String place_name){
+        String sql = "select sum(maxnum) from `secondplace` where place_name=:place_name ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_name", place_name);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 景区游客日人数统计
+    public List<TravelT> queryTourNumByPlace(String sm_place){
+        String sql = "select sm_place as place,sm_date as dateTime,COUNT(*) as inCount from (select * from `sm_message` where sm_date=:sm_date and sm_place=:sm_place group by UUID ) a group by sm_place order by inCount desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("sm_date", TimeExchange.getDate());
+        sps.addValue("sm_place", sm_place);
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 景区游客累计人数统计
+    public List<TravelT> queryTourNumByPlaceT(String place){
+        String sql = "select IFNULL(SUM(inCount),0) as inCount from `travelt` where place=:place";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place", place);
+        List<TravelT> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelT.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 景区最大人口修改
+    public int updateMaxT(String place_name,String maxnum){
+        String sql = "update `secondplace` set maxnum=:maxnum where place_name=:place_name ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place_name", place_name);
+        sps.addValue("maxnum",maxnum);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 36个景点
+    public List<Secondplace> queryTourPlace(){
+        String sql = "select * from `secondplace` ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Secondplace> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Secondplace.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 旅游数量参数
+    public List<Tourx> queryTx(){
+        String sql = "select * from `tourx` ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Tourx> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Tourx.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 景区参数修改
+    public int updateTx(Tourx tourx){
+        String sql = "update `tourx` set xs=:xs,xs2=:xs2,xs3=:xs3,xs4=:xs4,xs5=:xs5, " +
+                "xs6=:xs6,xs7=:xs7,xs8=:xs8,xs9=:xs9,xs10=:xs10,xs11=:xs11,xs_name=:xs_name where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", tourx.getId());
+        sps.addValue("xs", tourx.getXs());
+        sps.addValue("xs2", tourx.getXs2());
+        sps.addValue("xs3", tourx.getXs3());
+        sps.addValue("xs4", tourx.getXs4());
+        sps.addValue("xs5", tourx.getXs5());
+        sps.addValue("xs6", tourx.getXs6());
+        sps.addValue("xs7", tourx.getXs7());
+        sps.addValue("xs8", tourx.getXs8());
+        sps.addValue("xs9", tourx.getXs9());
+        sps.addValue("xs10", tourx.getXs10());
+        sps.addValue("xs11", tourx.getXs11());
+        sps.addValue("xs_name", tourx.getXs_name());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 各省月游客统计-分页
+    public List<TravelProvin> queryTourProvincePage(String time1,String time2,String sqlx,int page,int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select province,SUM(num) as num from `travelprovin` where dateTime between :time1 and :time2 "+sqlx+"  group by province order by num desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("time1", time1);
+        sps.addValue("time2", time2);
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<TravelProvin> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(TravelProvin.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    // 各省游客总数-分页
+    public int queryTourProvinceTotal(String time1,String time2,String sqlx){
+        String sql = "select count(*) from(select * from `travelprovin` where dateTime between :time1 and :time2 "+sqlx+"  group by province order by num desc) a ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("time1", time1);
+        sps.addValue("time2", time2);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+}

+ 398 - 0
bigData/src/com/happy/dao/Impl/TouristAnalysisDao.java

@@ -0,0 +1,398 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.Peopletourg;
+import com.happy.Model.Province;
+import com.happy.Model.ToiletRealDatasVO;
+import com.happy.Model.Tour.CommonSql;
+import com.happy.Model.Travel.StopSaturationStatistics;
+import com.happy.Model.Travel.ToiletRealData;
+import com.happy.Model.Travel.TravelAge;
+import com.happy.Model.Travel.TravelGender;
+import com.happy.Model.Travel.TravelLast;
+import com.happy.Model.Travel.TravelMarketingStatistics;
+import com.happy.Model.Travel.TravelProvin;
+import com.happy.Model.Travel.TravelT;
+import com.happy.Model.Travel.TravelTraff;
+import com.happy.Model.Travel.Travelye;
+import com.happy.Model.User;
+import com.happy.Until.MyPageList;
+import com.happy.vo.RealDataOfPeopleStreamVO;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.SingleColumnRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author: codingliang
+ * @Description: Travelt dao
+ * @Date: 2021-12-30 16:06
+ * @Version: V1.0
+ **/
+@Repository
+public class TouristAnalysisDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    /**
+     * 根据日期查询数据
+     * @param dateStr 日期,格式:yyyy-MM-dd HH:mm:ss
+     * @return
+     */
+    public TravelT getDataByDate(String dateStr) {
+        String sql = "select * from travelt where dateT = :dateStr limit 1";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateStr", dateStr);
+        try {
+            return namedParameterJdbcTemplate.queryForObject(sql, sps, new BeanPropertyRowMapper<>(TravelT.class));
+        } catch (EmptyResultDataAccessException e) {
+            TravelT travelT = new TravelT();
+            travelT.setDateT(dateStr);
+            travelT.setInCount("0");
+            travelT.setInCount_increase("0%");
+            return travelT;
+        }
+    }
+
+    /**
+     * 查询指定日期区间的数量
+     * @param startDate 开始时间 yyyy-MM-dd
+     * @param endDate 结束时间 yyyy-MM-dd
+     * @return
+     */
+    public Long getSumByDateSection(String startDate, String endDate) {
+        String querySql = "select ifnull(sum(inCount), 0) from travelt where dateT between :startDate and :endDate";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startDate", startDate);
+        sps.addValue("endDate", endDate);
+        return namedParameterJdbcTemplate.queryForObject(querySql, sps, new SingleColumnRowMapper<>(Long.class));
+    }
+
+    public List<TravelProvin> getTouristFrom() {
+        String sql = "select * from travelprovin order by num desc limit 16";
+        List<TravelProvin> result = namedParameterJdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TravelProvin.class));
+        return result;
+    }
+
+    public List<TravelAge> touristAgeStatistics() {
+        String sql = "select * from travelage order by id";
+        List<TravelAge> result = namedParameterJdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TravelAge.class));
+        return result;
+    }
+
+    public List<TravelGender> getTouristGenders() {
+        String sql = "select * from travelgender";
+        return namedParameterJdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TravelGender.class));
+    }
+
+    public List<TravelTraff> getTouristTrafficMethods() {
+        String sql = "select * from traveltraff order by per desc";
+        return namedParameterJdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TravelTraff.class));
+    }
+
+    public List<String> getTouristDestinations() {
+        String sql = "select distinct place from secondbufferp";
+        return namedParameterJdbcTemplate.query(sql, new SingleColumnRowMapper<>());
+    }
+
+    public String getAddUpCountOfPlace(String place) {
+        String sql = "select ifnull(sum(red_count + green_count + yellow_count), 0) total from secondbufferp where place = :place";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place", place);
+        return namedParameterJdbcTemplate.queryForObject(sql, sps, new SingleColumnRowMapper<>(String.class));
+    }
+
+    /**
+     * 查询景区某天的人流量
+     * @param place 景区名称
+     * @param dateStr 日期 yyyy-MM-dd
+     * @return
+     */
+    public String getCurrentDayCountOfPlace(String place, String dateStr) {
+        String sql = "select ifnull(sum(red_count + green_count + yellow_count), 0) total from secondbufferp where place = :place and dateT = :dateT";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place", place);
+        sps.addValue("dateT", dateStr);
+        return namedParameterJdbcTemplate.queryForObject(sql, sps, new SingleColumnRowMapper<>(String.class));
+    }
+
+    /**
+     * 查询景区指定日期的人流量
+     * @param place 景区名称
+     * @param dateStr 日期 如:yyyy-MM-dd、yyyy-MM、yyyy
+     * @return
+     */
+    public String getSpecDayCountOfPlace(String place, String dateStr) {
+        String sql = "select ifnull(sum(red_count + green_count + yellow_count), 0) total from secondbufferp where place = :place and dateT like :dateT";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place", place);
+        sps.addValue("dateT", dateStr + "%");
+        return namedParameterJdbcTemplate.queryForObject(sql, sps, new SingleColumnRowMapper<>(String.class));
+    }
+
+    public List<RealDataOfPeopleStreamVO> getRealDataOfPeopleStream(String place) {
+        String sql = "select sm_time dateTime, sm_name name, sm_phone phone, sm_color color from sm_message where sm_place = :place order by sm_time desc limit 20";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("place", place);
+        return namedParameterJdbcTemplate.query(sql, sps, new BeanPropertyRowMapper<>(RealDataOfPeopleStreamVO.class));
+    }
+
+    /**
+     * 查询dayStr日期timeStr时间扫码人数
+     * @param dayStr 日期 yyyy-MM-dd
+     * @param timeStr 时间 yyyy-MM-dd HH
+     * @return
+     */
+    public String getTodayIntoHistoryStatistics(String dayStr, String timeStr) {
+        String sql = "select count(distinct uuid) from sm_message where sm_date = :dayStr and protect_type = '1' and sm_time like :timeStr";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dayStr", dayStr);
+        sps.addValue("timeStr", timeStr + "%");
+        return namedParameterJdbcTemplate.queryForObject(sql, sps, new SingleColumnRowMapper<>(String.class));
+    }
+
+    /**
+     * 查询dayStr日期扫码人数
+     * @param dayStr 日期 yyyy-MM-dd
+     * @return
+     */
+    public String getTodayIntoHistoryStatistics(String dayStr) {
+        String sql = "select count(distinct uuid) from sm_message where sm_date = :dayStr and protect_type = '1'";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dayStr", dayStr);
+        return namedParameterJdbcTemplate.queryForObject(sql, sps, new SingleColumnRowMapper<>(String.class));
+    }
+
+    public TravelT getTravelRecord(String dateStr,String place) {
+
+        String sql = "select * from travelt where dateT = :dateStr and place = :place limit 1";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateStr", dateStr);
+        sps.addValue("place", place);
+        try {
+            return namedParameterJdbcTemplate.queryForObject(sql, sps, new BeanPropertyRowMapper<>(TravelT.class));
+        } catch (EmptyResultDataAccessException e) {
+            return null;
+        }
+    }
+
+    public void updateTravelT(TravelT travelT) {
+        String updateSql = "update travelt set inCount = :inCount,place = :place, inCount_increase = :increase, dateTime = :dateTimeStr where id = :id";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("inCount", travelT.getInCount());
+        sps.addValue("increase", travelT.getInCount_increase());
+        sps.addValue("dateTimeStr", travelT.getDateTime());
+        sps.addValue("id", travelT.getId());
+        sps.addValue("place", travelT.getPlace());
+        namedParameterJdbcTemplate.update(updateSql, sps);
+    }
+
+    public void insertTravelT(TravelT travelT) {
+        String insertSql = "insert into travelt(dateT, inCount, inCount_increase, dateTime,place) values(:dateT, :inCount, :increase, :dateTimeStr, :place)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("inCount", travelT.getInCount());
+        sps.addValue("increase", travelT.getInCount_increase());
+        sps.addValue("dateTimeStr", travelT.getDateTime());
+        sps.addValue("dateT", travelT.getDateT());
+        sps.addValue("place", travelT.getPlace());
+        namedParameterJdbcTemplate.update(insertSql, sps);
+    }
+
+    public TravelProvin getTravelProvinRecordByProvince(String province) {
+        String querySql = "select * from travelprovin where province = :province";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("province", province);
+        try {
+            return namedParameterJdbcTemplate.queryForObject(querySql, sps, new BeanPropertyRowMapper<>(TravelProvin.class));
+        } catch (EmptyResultDataAccessException e) {
+            return null;
+        }
+    }
+
+    public void updateTravelProvin(TravelProvin provin) {
+        String updateSql = "update travelprovin set province = :province, num = :num where id = :id";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("province", provin.getProvince());
+        sps.addValue("num", provin.getNum());
+        sps.addValue("id", provin.getId());
+        namedParameterJdbcTemplate.update(updateSql, sps);
+    }
+
+    public void insertTravelProvin(TravelProvin provin) {
+        String updateSql = "insert into travelprovin(province, num) values(:province, :num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("province", provin.getProvince());
+        sps.addValue("num", provin.getNum());
+        namedParameterJdbcTemplate.update(updateSql, sps);
+    }
+
+    public List<TravelAge> getTravelAgeRecords() {
+        String querySql = "select * from travelage";
+        return namedParameterJdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(TravelAge.class));
+    }
+
+    public void updateTravelAges(List<TravelAge> travelAges) {
+        travelAges.forEach(travelAge -> {
+            String updateSql = "update travelage set num = :num, per = :per where id = :id";
+            MapSqlParameterSource sps = new MapSqlParameterSource();
+            sps.addValue("num", travelAge.getNum());
+            sps.addValue("per", travelAge.getPer());
+            sps.addValue("id", travelAge.getId());
+            namedParameterJdbcTemplate.update(updateSql, sps);
+        });
+    }
+
+    public TravelGender getTravelGenderRecord(String gender) {
+        String querySql = "select * from travelgender where gender = :gender";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("gender", gender);
+        try {
+            return namedParameterJdbcTemplate.queryForObject(querySql, sps, new BeanPropertyRowMapper<>(TravelGender.class));
+        } catch (EmptyResultDataAccessException e) {
+            return null;
+        }
+    }
+
+    public void updateTravelGender(TravelGender genderReocrd) {
+        String updateSql = "update travelgender set num = :num where id = :id";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("num", genderReocrd.getNum());
+        sps.addValue("id", genderReocrd.getId());
+        namedParameterJdbcTemplate.update(updateSql, sps);
+    }
+
+    public List<Travelye> getNumsStatisticsOfStopInNightTop7() {
+        String querySql = "select * from travelye order by dateT desc limit 7";
+        return namedParameterJdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(Travelye.class));
+    }
+
+    public List<TravelLast> getTimeLongOfStopInView(int limit) {
+        String querySql = "select * from travellast order by longs desc limit :limitValue";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("limitValue", limit);
+        return namedParameterJdbcTemplate.query(querySql, sps, new BeanPropertyRowMapper<>(TravelLast.class));
+    }
+
+    public List<StopSaturationStatistics> getStopSaturationStatistics() {
+        String querySql = "select * from stop_saturation_statistics order by saturation desc";
+        return namedParameterJdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(StopSaturationStatistics.class));
+    }
+
+    public String getStopSaturationRealData() {
+        String querySql = "select format(ifnull(avg(saturation), 0), 2) from stop_saturation_statistics";
+        List<String> query = namedParameterJdbcTemplate.query(querySql, new SingleColumnRowMapper<>(String.class));
+        return query.get(0);
+    }
+
+    public ToiletRealData getToiletRealData(Long toiletId) {
+        String querySql = "select * from toilet_real_data where id = :toiletId";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("toiletId", toiletId);
+        try {
+            return namedParameterJdbcTemplate.queryForObject(querySql, sps, new BeanPropertyRowMapper<>(ToiletRealData.class));
+        } catch (EmptyResultDataAccessException e) {
+            return null;
+        }
+    }
+
+    public List<ToiletRealData> getToilets() {
+        String querySql = "select id, toilet_name from toilet_real_data";
+        return namedParameterJdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(ToiletRealData.class));
+    }
+
+    public List<ToiletRealDatasVO> getToiletDatas() {
+        String querySql = "select id, toilet_name toiletName, sum(num_male + num_female) totalNum from toilet_real_data group by id, toilet_name";
+        return namedParameterJdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(ToiletRealDatasVO.class));
+    }
+
+    public List<TravelMarketingStatistics> getTravelMarketingStatistics() {
+        String querySql = "select * from travel_marketing_statistics order by year desc limit 10";
+        return namedParameterJdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(TravelMarketingStatistics.class));
+    }
+
+    public List<Map<String,Object>> getPageSizeFromSmMessageByTime(String startTime, String endTime) {
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startTime", startTime);
+        sps.addValue("endTime", endTime);
+
+        String querySql = "select sm_place, count(distinct uuid) as total from sm_message where sm_place!='中华传统文化园' and sm_time between :startTime and :endTime "+ CommonSql.sql+"GROUP BY sm_place";
+
+        try {
+            List<Map<String, Object>> maps = namedParameterJdbcTemplate.queryForList(querySql, sps);
+            return maps;
+        } catch (EmptyResultDataAccessException e) {
+            return  null;
+        }
+    }
+
+    public MyPageList<User> getPageListFromSmMessageByTime(String startTime, String endTime, Integer currentPage, Integer pageSize) {
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("startTime", startTime);
+        sps.addValue("endTime", endTime);
+
+        // 查询sql
+        String querySql = "select distinct uuid, sm_from, sm_age, sm_gender from sm_message where protect_type = '1' and sm_time between :startTime and :endTime";
+        String sql2="select count(distinct uuid) from sm_message where protect_type = '1' and sm_time between :startTime and :endTime";
+        // 查询总记录数
+        Long rows = namedParameterJdbcTemplate.queryForObject(sql2, sps, new SingleColumnRowMapper<>(Long.class));
+
+        // 总页数
+        Long pages;
+        if (rows % pageSize == 0) {
+            pages = rows / pageSize;
+        } else {
+            pages = rows / pageSize + 1;
+        }
+
+        //查询第page页的数据sql语句
+        if (currentPage <= 1) {
+            querySql += " limit 0, " + pageSize;
+        } else {
+            querySql += " limit " + ((currentPage - 1) * pageSize) + ", " + pageSize;
+        }
+
+        List<User> records = namedParameterJdbcTemplate.query(querySql, sps, new BeanPropertyRowMapper<>(User.class));
+
+        MyPageList<User> p = new MyPageList<>();
+        p.setPage(Long.valueOf(currentPage));
+        p.setPages(pages);
+        p.setTotalRows(rows);
+        p.setRecords(records);
+        return p;
+    }
+
+    // 人流接待预警
+    public List<Peopletourg> queryPliu(){
+        String sql = "select * from `peopletourg` where id in(select MAX(id) from `peopletourg` group by place_name) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Peopletourg> list = namedParameterJdbcTemplate.query(sql,sps,
+                new BeanPropertyRowMapper<>(Peopletourg.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public List<Province> queryPro(String code){
+        String sql = "select * from `province` where code=:code ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("code",code);
+        List<Province> list = namedParameterJdbcTemplate.query(sql,sps,
+                new BeanPropertyRowMapper<>(Province.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 41 - 0
bigData/src/com/happy/dao/Impl/TownImplDao.java

@@ -0,0 +1,41 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.Town;
+import com.happy.Model.User;
+import com.happy.dao.TownDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("TownDao")
+public class TownImplDao implements TownDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public List<Town> queryTown(String town){
+        String sql = "select * from `town` where town like :town ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("town", town+"%");
+        List<Town> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Town>(Town.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 163 - 0
bigData/src/com/happy/dao/Impl/TravelImplDao.java

@@ -0,0 +1,163 @@
+package com.happy.dao.Impl;
+
+import com.happy.Model.Travel.*;
+import com.happy.dao.TravelDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+@Repository("TravelDao")
+public class TravelImplDao implements TravelDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    // 游客年龄分布
+    public int insertTravelAge(TravelAge travelAge){
+        String sql = "insert into travelage(dateTime,ageArea,num,per) values(:dateTime,:ageArea,:num,:per)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelAge.getDateTime());
+        sps.addValue("ageArea", travelAge.getAgeArea());
+        sps.addValue("num", travelAge.getNum());
+        sps.addValue("per", travelAge.getPer());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 游客性别分布
+    public int insertTravelGender(TravelGender travelGender){
+        String sql = "insert into travelgender(dateTime,gender,num) values(:dateTime,:gender,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelGender.getDateTime());
+        sps.addValue("gender", travelGender.getGender());
+        sps.addValue("num", travelGender.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 游客滞留时长分析-----地点
+    public int insertTravelLast(TravelLast travelLast){
+        String sql = "insert into travellast(dateTime,place,longs,num) values(:dateTime,:place,:longs,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelLast.getDateTime());
+        sps.addValue("place", travelLast.getPlace());
+        sps.addValue("longs", travelLast.getLongs());
+        sps.addValue("num", travelLast.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 游客来源地统计
+    public int insertTravelProvin(TravelProvin travelProvin){
+        String sql = "insert into travelprovin(dateTime,province,num) values(:dateTime,:province,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelProvin.getDateTime());
+        sps.addValue("province", travelProvin.getProvince());
+        sps.addValue("num", travelProvin.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 游客总量-----今日流入
+    public int insertTravelT(TravelT travelT){
+        String sql = "insert into travelt(dateT,dateTime,inCount,inCount_increase) values(:dateT,:dateTime,:inCount,:inCount_increase)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", travelT.getDateT());
+        sps.addValue("dateTime", travelT.getDateTime());
+        sps.addValue("inCount", travelT.getInCount());
+        sps.addValue("inCount_increase", travelT.getInCount_increase());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 游客出行方式分析
+    public int insertTravelTraff(TravelTraff travelTraff){
+        String sql = "insert into traveltraff(dateTime,traffic,per) values(:dateTime,:traffic,:per)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateTime", travelTraff.getDateTime());
+        sps.addValue("traffic", travelTraff.getTraffic());
+        sps.addValue("per", travelTraff.getPer());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 游客趋势走势----每点
+    public int insertTravelTrend(TravelTrend travelTrend){
+        String sql = "insert into traveltrend(dateT,dateTime,num) values(:dateT,:dateTime,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", travelTrend.getDateT());
+        sps.addValue("dateTime", travelTrend.getDateTime());
+        sps.addValue("num", travelTrend.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    // 过夜人数统计
+    public int insertTravelye(Travelye travelye){
+        String sql = "insert into travelye(dateT,dateTime,num) values(:dateT,:dateTime,:num)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("dateT", travelye.getDateT());
+        sps.addValue("dateTime", travelye.getDateTime());
+        sps.addValue("num", travelye.getNum());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+}

File diff suppressed because it is too large
+ 675 - 0
bigData/src/com/happy/dao/Impl/UserImplDao.java


+ 57 - 0
bigData/src/com/happy/dao/ManagerDao.java

@@ -0,0 +1,57 @@
+package com.happy.dao;
+
+import com.happy.Model.Manager.DanweiDetail;
+import com.happy.Model.Manager.Danweit;
+import com.happy.Model.Manager.Firstplace;
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.Secondplacetype;
+
+import java.util.List;
+
+public interface ManagerDao {
+
+    // 高速口查询
+    public List<Firstplace> queryFirstplace();
+
+    // 各高速口每天人数
+    public List<Gaosut> queryByDate(String sm_date, String sm_place);
+
+    // 查询数据是否缓存
+    public List<Gaosut> queryIsR(String tj_date,String place_name);
+
+    // 插入缓存
+    public int insertGaosuT(Gaosut gaosut);
+
+    // 查询缓存数据
+    public List<Gaosut> queryGaosuR(String tj_date);
+
+    /** =================================================== **/
+
+    // 单位码查询
+    public List<Secondplacetype> queryDanwei();
+
+    // 各单位口每天人数
+    public List<Danweit> queryDwByDate(String sm_date, String place_type);
+
+    // 查询数据是否缓存
+    public List<Danweit> queryDanweiIsR(String tj_date,String place_name);
+
+    // 插入缓存
+    public int insertDanweiT(Danweit danweit);
+
+    // 查询数据缓存中统计
+    public List<Danweit> queryDanweiByDate(String tj_date);
+
+    /** ===================各单位具体场所======================== **/
+    // 各单位口每天人数
+    public List<DanweiDetail> queryDwplaceByDate(String sm_date, String place_type);
+
+    // 查询数据是否缓存
+    public List<DanweiDetail> queryDanweiDIsR(String tj_date,String places);
+
+    // 插入缓存
+    public int insertDanweiD(DanweiDetail danweiDetail);
+
+    // 查询数据缓存中统计
+    public List<DanweiDetail> queryDanweiDByDate(String tj_date,String placef);
+}

+ 52 - 0
bigData/src/com/happy/dao/MobDao.java

@@ -0,0 +1,52 @@
+package com.happy.dao;
+
+import com.happy.Model.Mob.*;
+import com.happy.Model.User;
+import com.happy.Until.TimeExchange;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+
+import java.util.List;
+
+public interface MobDao {
+
+    // 处置人员详情
+    public List<User> queryHandled(String sqlx, int page, int rows);
+
+    // 处置详情总数
+    public int findUsersTotal(String s1);
+
+    // 红码累积处置统计
+    public RedL queryLjRed();
+    // 红码当日处置统计
+    public RedT queryTodayRed();
+
+    // 黄码累积处置统计
+    public YellowL queryLjYellow();
+
+    // 黄码当日处置统计
+    public YellowT queryTodayYellow();
+
+    // 重点累积处置统计
+    public KeyL queryLjKey();
+
+    // 重点当日处置统计
+    public KeyT queryTodayKey();
+
+    // 发热累积处置统计
+    public HotL queryLjHot();
+
+    // 发热当日处置统计
+    public HotT queryTodayHot();
+
+    // 脱管累积处置统计
+    public TokenL queryLjToken();
+
+    // 脱管当日处置统计
+    public TokenT queryTodayToken();
+
+    public RedT queryEightRed(String sm_date,String slqx);
+
+    // 近8天每日处置平均时长
+    public Avg queryEightAvg(String sm_date);
+}

+ 22 - 0
bigData/src/com/happy/dao/SecondBufferPDao.java

@@ -0,0 +1,22 @@
+package com.happy.dao;
+
+import com.happy.Model.SecondBufferP;
+import com.happy.Model.User;
+
+import java.util.List;
+
+public interface SecondBufferPDao {
+
+    public int insertSecondBufferP(SecondBufferP secondBufferP);
+
+    // 各景点扫码详情
+    public List<SecondBufferP> querySecondBufferP();
+
+    // 各景点扫码详情
+    public List<SecondBufferP> querySecondBufferpByPlace(String place);
+
+    // 各景点人员扫码信息
+    public List<User> queryByPlace(String sm_place);
+
+
+}

+ 108 - 0
bigData/src/com/happy/dao/SecondBuffertDao.java

@@ -0,0 +1,108 @@
+package com.happy.dao;
+
+import com.happy.Model.*;
+import com.happy.Model.Common.Common;
+import com.happy.Model.Tour.TravelSecond;
+
+import java.util.List;
+
+public interface SecondBuffertDao {
+
+    public int insertSecondBufferT(SecondBufferT secondBufferT);
+
+    public int insertSecondBufferC(SecondBufferC secondBufferC);
+
+    public List<SecondBufferT> querySecondBufferT();
+
+    // 第二道防线景点绿码人数统计
+    public List<SecondBufferT> querySpjdGreen(String sm_date);
+
+    // 第二道防线扫描汇总------红黄码发热汇总
+    public List<SecondBufferT> querySecondBufferRy();
+
+    // 第二道防线扫描汇总------红黄码发热汇总
+    public List<SecondBufferT> querySbRyByDate(String sm_date);
+
+    // 最近7天人员分布
+    public List<SecondBufferT> querySecondBufferTLastSeven();
+
+    public List<SecondBufferC> querySecondBufferC();
+
+    // 第二道防线处理情况
+    public List<Handlde> queryHandler();
+
+    public int queryHot();
+
+    // 第二道防线红码人员详情
+    public List<User> queryRed(String startDate, String endDate);
+
+    // 第二道防线黄码人员详情
+    public List<User> queryYellow(String startDate,String endDate,int page, int rows);
+
+    // 第一道防线黄码人员总数-分页
+    public int queryYellowTotal(String startDate,String endDate);
+
+    // 第二道防线地址类型
+    public List<Secondplacetype> queryPt();
+
+    // 第二道防线景点名称
+    public List<Secondplace> queryJd();
+    //根据名称查询景点
+    public List<Secondplace> queryJdByname(String place_name);
+
+    public int insertTravelSecond(TravelSecond travelSecond,String dayId);
+
+    public TravelSecond queryTravelSecond(String place_name);
+
+    // 第二道防线各场所详情
+    public SecondPlaceJc querySpjc(String place_type);
+
+    public SecondPlaceJc querySl();
+
+    // 第二道防线亮码绿码详情
+    public SecondPlaceJc querySlGreen();
+
+    // 第二道防线各景点详情
+    public SecondPlaceJc querySpjd();
+
+    // 各酒店医院详细名称
+    public List<Common> queryCommon(String place_type);
+
+    // 根据详细名称查红黄码详情
+    public SecondPlaceJc queryByCommon(String place_type,String hotel);
+
+    public SecondPlaceJc queryGreen(String place_type);
+
+    // 第二道防线各门店绿码详情
+    public SecondPlaceJc queryGreenByCommon(String place_type,String hotel);
+
+    // 第二道防线发热加时间搜索
+    public List<User> queryByTime(int page, int rows,String sqlx);
+
+    // 查询用户表中的总记录数
+    public int findUsersTotal(String s1);
+
+    // 第二道防线累积加时间搜索
+    public List<User> queryLjByTime(int page, int rows,String sqlx);
+
+    // 查询用户表中的累积总记录数
+    public int findLjUsersTotal(String s1);
+
+    // 第二道防线累积红黄码详情
+    public SecondPlaceJc queryLjRy();
+
+    // 第二道防线累积绿码详情
+    public SecondPlaceJc queryLjGreen();
+
+    public Tz queryView(String sm_place);
+
+    /** =================昨日累积缓存 =============================**/
+    // 第二道防线昨日累积扫描汇总
+    public SecondBufferT querySbYesLj(String sm_date);
+
+    // 第二道防线查询缓存数据
+    public List<SecondBufferT> querySbCache(String dateT);
+
+    // 插入缓存
+    public int insertSbT(SecondBufferT secondBufferT);
+}

+ 17 - 0
bigData/src/com/happy/dao/SmlmtDao.java

@@ -0,0 +1,17 @@
+package com.happy.dao;
+
+import com.happy.Model.SmlmT;
+
+import java.util.List;
+
+public interface SmlmtDao {
+
+    public int insertSmlmT(SmlmT smlmT);
+
+    // 今日扫码亮码
+    public List<SmlmT> query();
+
+    // 扫码亮码月统计
+    public List<SmlmT> queryByMonth(String month);
+
+}

+ 16 - 0
bigData/src/com/happy/dao/SmtDao.java

@@ -0,0 +1,16 @@
+package com.happy.dao;
+
+import com.happy.Model.Hylj;
+import com.happy.Model.SmT;
+
+import java.util.List;
+
+public interface SmtDao {
+
+    public int insertSmT(SmT smT);
+
+    public List<SmT> query();
+
+    public List<Hylj> queryLj();
+
+}

+ 35 - 0
bigData/src/com/happy/dao/ThirdBuffertDao.java

@@ -0,0 +1,35 @@
+package com.happy.dao;
+
+import com.happy.Model.ThirdBufferT;
+import com.happy.Model.ThirdJw;
+import com.happy.Model.Tz;
+import com.happy.Model.User;
+
+import java.util.List;
+
+public interface ThirdBuffertDao {
+
+    public int insertThirdBufferT(ThirdBufferT thirdBufferT);
+
+    public List<ThirdBufferT> queryThirdBufferT();
+
+    // 最近7天人员分布
+    public List<ThirdBufferT> queryThirdBufferTLastSeven();
+
+    // 各酒店人员扫码信息
+    public List<User> queryByBuffer();
+
+    public List<ThirdJw> queryJw();
+
+    // 脱管人员统计
+    public Tz queryTuo();
+
+    // 重点地区人员统计
+    public Tz queryZd();
+
+    // 第三道防线重点时间搜索
+    public List<User> queryByTime(int page, int rows,String sqlx);
+
+    // 查询用户表中的总记录数
+    public int findUsersTotal(String s1);
+}

+ 207 - 0
bigData/src/com/happy/dao/TourDao.java

@@ -0,0 +1,207 @@
+package com.happy.dao;
+
+import com.happy.Model.Secondplace;
+import com.happy.Model.Tour.Hotel;
+import com.happy.Model.Tour.TourDayt;
+import com.happy.Model.Tour.Tourx;
+import com.happy.Model.Travel.*;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+
+import java.util.List;
+
+public interface TourDao {
+
+    public int insertToday(TourDayt tourDayt);
+    public List<TourDayt> queryTourByDay(String dateTime);
+    // 今日旅游人数
+    public TourDayt queryTotalTour(String sm_date);
+
+    // 本-月-年旅游人数
+    public TourDayt queryTotalTourOther(String sm_date);
+
+    // 往日旅游人数
+    public TourDayt queryLastTour(String dateTime);
+
+    // 往-月-年旅游人数
+    public TourDayt queryLastTourOther(String dateTime);
+
+    // 查询缓存-天-判断是否存在
+    public List<TourDayt> queryTourByOther(String dateTime);
+
+    // 查询景点累计数据
+    public TourDayt queryTourT();
+
+    // 查询景点每日数据
+    public TourDayt queryTourDay();
+
+    /**==================缓存二================**/
+    // 今日某景点游客
+    public TravelT queryDayAndPlace(String sm_date,String sm_place);
+
+    // 查询缓存-天-判断是否存在
+    public List<TravelT> queryDayAndPlaceExis(String dateTime,String place);
+
+    public int insertTodayAndPlace(TravelT travelT);
+
+    // 各景点累计人流
+    public List<TravelT> queryTravelT();
+
+    public List<TourDayt> queryTour();
+
+    // 分页查找景区每日人数
+    public List<TourDayt> queryTourPage(int page, int rows,String sqlx);
+
+    // 分页查找景区每日人数
+    public int queryTourPaget(String sqlx);
+
+    /**================月=======================**/
+    // 本月旅游人数
+    public TourDayt queryMonthTour(String sm_date);
+
+    // 查询缓存-月-判断是否存在
+    public List<TourDayt> queryTourByMonth(String dateTime);
+
+    public int insertMonth(TourDayt tourDayt);
+
+    // 查询缓存月旅游统计
+    public List<TourDayt> queryTourM();
+
+    /**================年=======================**/
+    // 本年旅游人数
+    public TourDayt queryYearTour(String sm_date);
+
+    // 查询缓存-年-判断是否存在
+    public List<TourDayt> queryTourByYear(String dateTime);
+
+    public int insertYear(TourDayt tourDayt);
+    // 查询缓存月旅游统计
+    public List<TourDayt> queryTourY();
+
+    /**================各省-年月日统计=================**/
+    // 各省日统计
+    public List<TravelProvin> queryTourProvince(String sm_date);
+
+    // 查询缓存-省-判断是否存在
+    public List<TravelProvin> queryTourByProvince(TravelProvin travelProvin);
+
+    public int insertProvince(TravelProvin travelProvin);
+
+    // 各省月-年统计
+    public List<TravelProvin> queryTourProvinceM(String sm_date);
+
+    // 各省月-累计统计
+    public List<TravelProvin> queryTourProvinceT();
+
+    /**====================近12小时人次记录===================**/
+    // 每小时人次
+    public TourDayt queryTotalHour(String sm_time);
+
+    // 缓存是否存在
+    public TourDayt queryExistHour(String sm_time);
+
+    // 插入缓存
+    public int insertHour(TourDayt tourDayt);
+
+    // 查询日12小时趋势
+    public List<TourDayt> queryHourHistory(String sm_date,String sm_time, int m);
+
+    /**================性别统计=======================**/
+    // 每日男性统计
+    public TravelGender queryTourGenderD(String sm_date,String sm_gender);
+
+    // 查询缓存-省-判断是否存在
+    public List<TravelGender> queryTourByGender(TravelGender travelGender);
+
+    public int insertGender(TravelGender travelGender);
+
+    // 男女性别年统计
+    public List<TravelGender> queryTourByGenderAndYear(String dateTime);
+
+    // 男女性别累计统计
+    public List<TravelGender> queryGenderT();
+
+    /**================年龄统计=======================**/
+    // 年龄时间统计
+    public TravelAge queryTourAge(String sm_date, String ageArea, String sqlx);
+
+    // 查询缓存-年龄-判断是否存在
+    public List<TravelAge> queryTourByAge(TravelAge travelAge);
+
+    public int insertAge(TravelAge travelAge);
+
+    // 男女性别年统计
+    public List<TravelAge> queryTourByAgeAndYear(String dateTime);
+
+    // 年龄累计统计
+    public List<TravelAge> queryAgeT();
+
+    /**================景区游客人数统计=======================**/
+    // 景区游客日人数统计
+    public List<TravelT> queryTourNum(String sm_date);
+
+    // 查询缓存-各景区当日-判断是否存在
+    public List<TravelT> queryTourByNum(TravelT travelT);
+
+    // 景区游客累积人数统计
+    public List<TravelT> queryTourNumT();
+
+    // 各景区游客累积人数统计
+    public List<TravelT> queryGTourNumT();
+
+    public int insertNum(TravelT travelT);
+
+    // 各景点年月年统计
+    public List<TravelT> queryTourByNumAndTime(String dateTime);
+
+    // 各景区人数排行跨日期
+    public List<TravelT> queryTourNumByDate(String startTime, String endTime);
+
+    /**================景区过夜人数统计=======================**/
+    // 景区过夜日人数统计
+    public List<Travelye> queryTourYe(String sm_date);
+
+    // 查询缓存-各景区过夜-判断是否存在
+    public List<Travelye> queryTourByYe(Travelye travelye);
+
+    public int insertYe(Travelye travelye);
+
+    // 过夜游客按时查找
+    public List<Travelye> queryTouYeByDate(String startTime, String endTime);
+
+    // 各镇过夜年月年统计
+    public List<Travelye> queryTourByNumAndYe(String dateTime);
+
+    // 各酒店过夜人数‘
+    public List<Hotel> queryHotel(int page, int rows, String startTime, String endTime, String sqlx);
+
+    // 查询用户表中的总记录数
+    public int queryHotelTotal(String startTime,String endTime,String s1);
+
+    // 最大访客量
+    public int queryMaxTour(String place_name);
+
+    // 景区游客日人数统计
+    public List<TravelT> queryTourNumByPlace(String sm_place);
+
+    // 景区游客累计人数统计
+    public List<TravelT> queryTourNumByPlaceT(String sm_place);
+
+    // 景区最大人口修改
+    public int updateMaxT(String place_name,String maxnum);
+
+    // 36个景点
+    public List<Secondplace> queryTourPlace();
+
+    // 旅游数量参数
+    public List<Tourx> queryTx();
+
+    // 景区参数修改
+    public int updateTx(Tourx tourx);
+
+    // 各省月游客统计-分页
+    public List<TravelProvin> queryTourProvincePage(String time1,String time2,String sqlx,int page, int rows);
+
+    // 各省游客总数-分页
+    public int queryTourProvinceTotal(String time1,String time2,String sqlx);
+}

+ 10 - 0
bigData/src/com/happy/dao/TownDao.java

@@ -0,0 +1,10 @@
+package com.happy.dao;
+
+import com.happy.Model.Town;
+
+import java.util.List;
+
+public interface TownDao {
+
+    public List<Town> queryTown(String town);
+}

+ 31 - 0
bigData/src/com/happy/dao/TravelDao.java

@@ -0,0 +1,31 @@
+package com.happy.dao;
+
+import com.happy.Model.Travel.*;
+
+public interface TravelDao {
+
+    // 游客年龄分布
+    public int insertTravelAge(TravelAge travelAge);
+
+    // 游客性别分布
+    public int insertTravelGender(TravelGender travelGender);
+
+    // 游客滞留时长分析-----地点
+    public int insertTravelLast(TravelLast travelLast);
+
+    // 游客来源地统计
+    public int insertTravelProvin(TravelProvin travelProvin);
+
+    // 游客总量-----今日流入
+    public int insertTravelT(TravelT travelT);
+
+    // 游客出行方式分析
+    public int insertTravelTraff(TravelTraff travelTraff);
+
+    // 游客趋势走势----每点
+    public int insertTravelTrend(TravelTrend travelTrend);
+
+    // 过夜人数统计
+    public int insertTravelye(Travelye travelye);
+
+}

+ 129 - 0
bigData/src/com/happy/dao/UserDao.java

@@ -0,0 +1,129 @@
+package com.happy.dao;
+
+import com.happy.Model.*;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+
+import java.util.List;
+
+public interface UserDao {
+
+    public int insertUser(User user);
+
+    // 信息处理
+    public int insertMessage(Message_handler message_handler);
+
+    // 疫情响应处理---处理总数
+    public int queryTotalHandler();
+
+    // 疫情响应处理---当年处理
+    public int queryYearHandler();
+
+    // 疫情响应处理---当月处理
+    public int queryMonthHandler();
+
+    // 疫情响应处理---当日处理
+    public int queryDayHandler();
+
+    // 响应处理数据
+    public List<User> queryHandler(String sm_color,int page, int rows,String sqlx);
+
+    public int queryHandlerTotal(String sm_color,String sqlx);
+
+    // 响应处理数据--所有的
+    public List<User> queryHandlerAll();
+
+    // 红码人员-短信
+    public List<User> queryRedMes();
+
+    // 黄码人员-短信
+    public List<User> queryYellowMes();
+
+    // 重点、发热-短信
+    public List<User> queryOtherMes();
+
+    // 脱管人员-短信
+    public List<User> queryOtherTuo();
+
+    // 处理红黄码人员
+    public int updateHandlerStateM(int id,String message_time);
+
+    public List<User> queryMById(int id);
+
+    public List<User> queryGui(String uuid, String sm_time);
+
+    // 插入信息后-查询人员轨迹
+    public List<User> queryGui2(String uuid, String sm_time);
+
+    // 插入信息后-查询人员轨迹分页
+    public List<User> queryGui3(String uuid, String sm_time,int page, int rows);
+
+    // 查询轨迹总数-分页
+    public int queryGuijiTotal(String uuid, String sm_time);
+
+    public int updateGui(String trace_before, String trace_after, int id);
+
+    public List<User> queryGjById(int id);
+
+    // 根据id查询需处置的人员
+    public List<User> queryHanlerById(int id);
+
+    // 根据uuid查询需处置的人员
+    public List<User> queryHanlerByUUId(int id);
+
+    public List<Message_handler> queryMessage(String uuid, String sm_month);
+
+    // 查询红黄码、重点、发热人员
+    public List<User> queryDanger();
+
+    // 导入到处置表
+    public int insertUserX(User user);
+
+    // 查询重复
+    public List<User> queryChong(User userx);
+
+    public int updateTb(int id);
+
+    // 更新处理状态
+    public int updateHands(String uuid,String handler_message,String message_commit);
+
+    // 更新处理状态
+    public int updateHand(String uuid,String handler_message,String sm_time,String message_commit,String handler_unit,int id);
+
+    // 查看待处置人员
+    public List<User> queryCz(String startTime,String endTime, String handler_state2,String sqlx,int page, int rows);
+
+    // 第一道防线黄码人员总数-分页
+    public int queryCzTotal(String startTime,String endTime, String handler_state2,String sqlx);
+
+    public int updateGui();
+
+    public int updateJw();
+
+    // 更新定位为空
+    public int updateJwp();
+
+    public List<User> OutUser(String sqlx);
+
+    // 查询绿码人员
+    public List<User> queryGreen(int page, int rows,String sqlx);
+
+    // 查询用户表绿码中的总记录数
+    public int findGreenTotal(String sqlx);
+
+    // 根据id查询需处理的人员
+    public List<User> queryXById(int id);
+
+    public List<Town> queryTownByName(String town);
+
+    public List<Country> queryManager();
+
+    // 添加操作记录
+    public int insertRecords(Records records);
+
+    // 查询操作记录
+    public List<Records> queryRecordsByUUID(String uuid);
+
+    // 发送短信时间查询
+    public List<User> queryMesTime(String uuid);
+}

+ 0 - 1
bigData/src/com/happy/filter/1

@@ -1 +0,0 @@
-1

+ 31 - 0
bigData/src/com/happy/filter/CharacterEncodingFilter.java

@@ -0,0 +1,31 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.happy.filter;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+public class CharacterEncodingFilter implements Filter {
+	public CharacterEncodingFilter() {
+	}
+
+	public void destroy() {
+	}
+
+	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+		request.setCharacterEncoding("utf-8");
+		response.setCharacterEncoding("utf-8");
+		chain.doFilter(request, response);
+	}
+
+	public void init(FilterConfig arg0) throws ServletException {
+	}
+}

+ 52 - 0
bigData/src/com/happy/filter/LoginFilter.java

@@ -0,0 +1,52 @@
+////
+//// Source code recreated from a .class file by IntelliJ IDEA
+//// (powered by Fernflower decompiler)
+////
+//
+//package com.happy.filter;
+//
+//import javax.servlet.*;
+//import javax.servlet.http.HttpServletRequest;
+//import javax.servlet.http.HttpServletResponse;
+//import javax.servlet.http.HttpSession;
+//import java.io.IOException;
+//import java.util.Enumeration;
+//
+//public class LoginFilter implements Filter {
+//	Enumeration param;
+//
+//	public LoginFilter() {
+//	}
+//
+//	public void init(FilterConfig filterConfig) throws ServletException {
+//		this.param = filterConfig.getInitParameterNames();
+//	}
+//
+//	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+//		HttpServletRequest servletRequest = (HttpServletRequest)request;
+//		HttpServletResponse servletResponse = (HttpServletResponse)response;
+//		HttpSession session = servletRequest.getSession();
+//		String path = servletRequest.getRequestURI();
+//		String isLogin = (String)session.getAttribute("isLogin");
+//		if (path.indexOf("login.jsp") <= -1 && path.indexOf("branduserbrandlist.action") <= -1 && path.indexOf("/weixin/") <= -1 && path.indexOf("/loginlogin.action") <= -1 && path.indexOf("/WxPaylog.action") <= -1 && path.indexOf("register2.jsp") <= -1 && path.indexOf("/WxPayregister2.action") <= -1) {
+//			if (isLogin != null && !"".equals(isLogin)) {
+//				chain.doFilter(request, response);
+//			} else {
+//				StringBuffer fileURL = servletRequest.getRequestURL();
+//				if (fileURL.indexOf(".css") > 0 || fileURL.indexOf(".png") > 0 || fileURL.indexOf(".jpg") > 0 || fileURL.indexOf(".bmp") > 0 || fileURL.indexOf(".gif") > 0 || fileURL.indexOf(".apk") > 0 || fileURL.indexOf(".ipa") > 0 || fileURL.indexOf(".woff") > 0 || fileURL.indexOf(".ttf") > 0 || fileURL.indexOf("image.jsp") > 0) {
+//					chain.doFilter(servletRequest, servletResponse);
+//					return;
+//				}
+//
+//				String contextPath = servletRequest.getContextPath();
+//				servletResponse.sendRedirect(contextPath + "/jsp/login.jsp");
+//			}
+//
+//		} else {
+//			chain.doFilter(servletRequest, servletResponse);
+//		}
+//	}
+//
+//	public void destroy() {
+//	}
+//}

+ 0 - 1
bigData/src/com/happy/service/1

@@ -1 +0,0 @@
-1

+ 46 - 0
bigData/src/com/happy/service/CrossService.java

@@ -0,0 +1,46 @@
+package com.happy.service;
+
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.User;
+
+import java.util.List;
+
+public interface CrossService {
+
+    // 各路口累计人数
+    public List<Gaosut> queryGaosuR();
+
+    // 各路口通行人员列表
+    public List<User> queryUserByCross(String sm_place, int page, int rows);
+
+    // 各路口人数总数
+    public int queryUserCrossCount(String sm_place);
+
+    // 高速口当日总人数
+    public List<Gaosut> querySumByDay();
+
+    // 高速口累积总人数
+    public List<Gaosut> querySum();
+
+    // 人流趋势分析-近12日
+    public List<Gaosut> queryLastDay();
+
+    // 人流趋势分析-近12月
+    public List<Gaosut> queryLastMonth();
+
+    // 人流趋势分析-近12年
+    public List<Gaosut> queryLastYear();
+
+    // 高速口累积总人数
+    public List<Gaosut> queryTNum(String place_name);
+
+    // 高速口今日人数
+    public List<Gaosut> queryDayNum(String sm_place);
+
+    // 各路口当日通行人员列表
+    public List<User> queryUserByDay(String sm_place, int page, int rows);
+
+    // 各路口人数总数
+    public int queryUserDayCount(String sm_place);
+
+}

+ 13 - 0
bigData/src/com/happy/service/DeviceRankService.java

@@ -0,0 +1,13 @@
+package com.happy.service;
+
+import com.happy.Model.DeviceRank;
+
+import java.util.List;
+
+public interface DeviceRankService {
+
+    public int insertDeviceRank(DeviceRank deviceRank);
+
+    // 设备排行
+    public List<DeviceRank> queryRank();
+}

+ 14 - 0
bigData/src/com/happy/service/DevicetService.java

@@ -0,0 +1,14 @@
+package com.happy.service;
+
+import com.happy.Model.DeviceT;
+
+import java.util.List;
+
+public interface DevicetService {
+
+    public int insertDevicet(DeviceT deviceT);
+
+    // 设备统计
+    public List<DeviceT> queryT();
+
+}

+ 12 - 0
bigData/src/com/happy/service/FirstBuffercService.java

@@ -0,0 +1,12 @@
+package com.happy.service;
+
+import com.happy.Model.FirstBufferC;
+
+import java.util.List;
+
+public interface FirstBuffercService {
+
+    public int insertFirstBufferC(FirstBufferC firstBufferC);
+
+    public List<FirstBufferC> queryFirstBufferC();
+}

+ 17 - 0
bigData/src/com/happy/service/FirstBufferpService.java

@@ -0,0 +1,17 @@
+package com.happy.service;
+
+import com.happy.Model.FirstBufferP;
+import com.happy.Model.User;
+
+import java.util.List;
+
+public interface FirstBufferpService {
+
+    public int insertFirstBufferP(FirstBufferP firstBufferP);
+
+    // 各路口扫码详情
+    public List<FirstBufferP> queryFirstBufferP(String sm_date,String sm_place);
+
+    // 各路口人员扫码信息
+    public List<User> queryByPlace(String sm_place);
+}

+ 47 - 0
bigData/src/com/happy/service/FirstBuffertService.java

@@ -0,0 +1,47 @@
+package com.happy.service;
+
+import com.happy.Model.FirstBufferT;
+import com.happy.Model.Handlde;
+import com.happy.Model.SecondPlaceJc;
+import com.happy.Model.User;
+
+import java.text.ParseException;
+import java.util.List;
+
+public interface FirstBuffertService {
+
+    public int insertFirstBufferT(FirstBufferT firstBufferT);
+
+    public List<FirstBufferT> queryFirstBufferT();
+
+    public List<Handlde> queryHandler();
+
+    // 第一道防线红码人员详情
+    public List<User> queryRed(String startDate, String endDate);
+
+    // 第一道防线黄码人员详情
+    public List<User> queryYellow(String startDate,String endDate,int page, int rows);
+
+    // 第一道防线黄码人员总数-分页
+    public int queryYellowTotal(String startDate,String endDate);
+
+    public SecondPlaceJc queryFirst();
+
+    // 首页面--处置
+    public List<Handlde> queryFirstHandler();
+
+    // 第一道防线红黄码加时间搜索
+    public List<User> queryByTimeAndColor(int page, int rows,String sqlx);
+
+    public int findUsersTotal(String s1);
+
+    // 第一道防线累积红黄绿码详情
+    public SecondPlaceJc queryLjRyg();
+
+    /** =================昨日累积缓存 =============================**/
+    // 前7天活动人数
+    public List<FirstBufferT> queryEgihtFbLj(int m) throws ParseException;
+
+    // 插入缓存
+    public int insertFbT(int m) throws ParseException;
+}

+ 13 - 0
bigData/src/com/happy/service/GtmtService.java

@@ -0,0 +1,13 @@
+package com.happy.service;
+
+import com.happy.Model.GtmT;
+
+import java.util.List;
+
+public interface GtmtService {
+
+    public int insertGtmT(GtmT gtmT);
+
+    // 赣通码详情
+    public List<GtmT> queryGtmT();
+}

+ 149 - 0
bigData/src/com/happy/service/Impl/CrossImplService.java

@@ -0,0 +1,149 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.User;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.CrossDao;
+import com.happy.service.CrossService;
+import org.bouncycastle.asn1.x509.Time;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+@Service("CrossService")
+public class CrossImplService implements CrossService {
+
+    @Resource
+    public CrossDao crossDao;
+
+    // 各路口累计人数
+    public List<Gaosut> queryGaosuR(){
+        return crossDao.queryGaosuR();
+    }
+
+    // 各路口通行人员列表
+    public List<User> queryUserByCross(String sm_place, int page, int rows){
+        return crossDao.queryUserByCross(sm_place, page, rows);
+    }
+
+    // 各路口人数总数
+    public int queryUserCrossCount(String sm_place){
+        return crossDao.queryUserCrossCount(sm_place);
+    }
+
+    // 高速口当日总人数
+    public List<Gaosut> querySumByDay(){
+        List<Gaosut> list = crossDao.querySumByDay();
+        if (list==null){
+            Gaosut gaosut = new Gaosut();
+            gaosut.setTj_date(TimeExchange.getDate());
+            gaosut.setNum(0);
+            list = new ArrayList<>();
+            list.add(gaosut);
+        }
+        return list;
+    }
+
+    // 高速口累积总人数
+    public List<Gaosut> querySum(){
+        return crossDao.querySum();
+    }
+
+    // 人流趋势分析-近12日
+    public List<Gaosut> queryLastDay(){
+        List<Gaosut> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=0; i>-12; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            String date = simpleDateFormat.format(calendar.getTime());
+            Gaosut gaosut = crossDao.queryLastDay(date);
+            if (gaosut==null || gaosut.getTj_date()==null){
+                Gaosut gs = new Gaosut();
+                gs.setTj_date(date);
+                gs.setNum(0);
+                list.add(gs);
+            } else {
+                list.add(gaosut);
+            }
+        }
+        return list;
+    }
+
+    // 人流趋势分析-近12月
+    public List<Gaosut> queryLastMonth(){
+        List<Gaosut> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+        for (int i=0; i>-12; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.MONTH, i);
+            String month = simpleDateFormat.format(calendar.getTime());
+            Gaosut gaosut = crossDao.queryLastMonth(month);
+            if (gaosut==null || gaosut.getTj_date()==null){
+                Gaosut gs = new Gaosut();
+                gs.setTj_date(month);
+                gs.setNum(0);
+                list.add(gs);
+            } else {
+                gaosut.setTj_date(month);
+                list.add(gaosut);
+            }
+        }
+        return list;
+    }
+
+    // 人流趋势分析-近12年
+    public List<Gaosut> queryLastYear(){
+        List<Gaosut> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
+        for (int i=0; i>-12; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.YEAR, i);
+            String year = simpleDateFormat.format(calendar.getTime());
+            Gaosut gaosut = crossDao.queryLastMonth(year);
+            if (gaosut==null || gaosut.getTj_date()==null){
+                Gaosut gs = new Gaosut();
+                gs.setTj_date(year);
+                gs.setNum(0);
+                list.add(gs);
+            } else {
+                gaosut.setTj_date(year);
+                list.add(gaosut);
+            }
+        }
+        return list;
+    }
+
+    // 高速口累积总人数
+    public List<Gaosut> queryTNum(String place_name){
+        return crossDao.queryTNum(place_name);
+    }
+
+    // 高速口今日人数
+    public List<Gaosut> queryDayNum(String sm_place){
+        List<Gaosut> list = crossDao.queryDayNum(sm_place);
+        if (list==null || list.get(0).getPlace_name()==null){
+            list = new ArrayList<>();
+            Gaosut gaosut = new Gaosut();
+            gaosut.setPlace_name(sm_place);
+            gaosut.setTj_date(TimeExchange.getDate());
+            gaosut.setNum(0);
+            list.add(gaosut);
+        }
+        return list;
+    }
+
+    // 各路口当日通行人员列表
+    public List<User> queryUserByDay(String sm_place, int page, int rows){
+        return crossDao.queryUserByDay(sm_place, page, rows);
+    }
+
+    // 各路口人数总数
+    public int queryUserDayCount(String sm_place){
+        return crossDao.queryUserDayCount(sm_place);
+    }
+}

+ 25 - 0
bigData/src/com/happy/service/Impl/DeviceRankImplService.java

@@ -0,0 +1,25 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.DeviceRank;
+import com.happy.dao.DeviceRankDao;
+import com.happy.service.DeviceRankService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("DeviceRankService")
+public class DeviceRankImplService implements DeviceRankService {
+
+    @Autowired
+    public DeviceRankDao deviceRankDao;
+
+    public int insertDeviceRank(DeviceRank deviceRank){
+        return deviceRankDao.insertDeviceRank(deviceRank);
+    }
+
+    // 设备排行
+    public List<DeviceRank> queryRank(){
+        return deviceRankDao.queryRank();
+    };
+}

+ 26 - 0
bigData/src/com/happy/service/Impl/DevicetImplService.java

@@ -0,0 +1,26 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.DeviceT;
+import com.happy.dao.DevicetDao;
+import com.happy.service.DevicetService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("DevicetService")
+public class DevicetImplService implements DevicetService {
+
+    @Autowired
+    public DevicetDao devicetDao;
+
+    public int insertDevicet(DeviceT deviceT){
+        return devicetDao.insertDevicet(deviceT);
+    }
+
+    // 设备统计
+    public List<DeviceT> queryT(){
+        return devicetDao.queryT();
+    };
+
+}

+ 24 - 0
bigData/src/com/happy/service/Impl/FirstBuffercImplService.java

@@ -0,0 +1,24 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.FirstBufferC;
+import com.happy.dao.FirstBuffercDao;
+import com.happy.service.FirstBuffercService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("FirstBuffercService")
+public class FirstBuffercImplService implements FirstBuffercService {
+
+    @Resource
+    public FirstBuffercDao firstBuffercDao;
+
+    public int insertFirstBufferC(FirstBufferC firstBufferC){
+        return firstBuffercDao.insertFirstBufferC(firstBufferC);
+    }
+
+    public List<FirstBufferC> queryFirstBufferC(){
+        return firstBuffercDao.queryFirstBufferC();
+    }
+}

+ 35 - 0
bigData/src/com/happy/service/Impl/FirstBufferpImplService.java

@@ -0,0 +1,35 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.FirstBufferP;
+import com.happy.Model.User;
+import com.happy.dao.FirstBufferpDao;
+import com.happy.service.FirstBufferpService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("FirstBufferpService")
+public class FirstBufferpImplService implements FirstBufferpService {
+
+    @Autowired
+    public FirstBufferpDao firstBufferpDao;
+
+    public int insertFirstBufferP(FirstBufferP firstBufferP){
+        return firstBufferpDao.insertFirstBufferP(firstBufferP);
+    }
+
+    // 各路口扫码详情
+    public List<FirstBufferP> queryFirstBufferP(String sm_date,String sm_place){
+        List<FirstBufferP> list = firstBufferpDao.queryFirstBufferP(sm_date, sm_place);
+        List<FirstBufferP> list2 = firstBufferpDao.queryFirstBufferP2(sm_date, sm_place);
+        list.get(0).setGreen_count(list2.get(0).getGreen_count());
+        return list;
+    }
+
+    // 各路口人员扫码信息
+    public List<User> queryByPlace(String sm_place){
+        return firstBufferpDao.queryByPlace(sm_place);
+    };
+
+}

+ 131 - 0
bigData/src/com/happy/service/Impl/FirstBuffertImplService.java

@@ -0,0 +1,131 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.*;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.FirstBuffertDao;
+import com.happy.service.FirstBuffertService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+@Service("FirstBuffertService")
+public class FirstBuffertImplService implements FirstBuffertService {
+
+    @Autowired
+    public FirstBuffertDao firstBuffertDao;
+
+    public int insertFirstBufferT(FirstBufferT firstBufferT){
+        return firstBuffertDao.insertFirstBufferT(firstBufferT);
+    }
+
+    // 第一道防护屏障接口------汇总
+    public List<FirstBufferT> queryFirstBufferT(){
+        List<FirstBufferT> list = firstBuffertDao.queryFirstBufferT();
+        List<FirstBufferT> list2 = firstBuffertDao.queryFirstBufferRy();
+        List<FirstBufferT> list3 = firstBuffertDao.queryFirstGreenT(TimeExchange.getDate());
+        if (list!=null & list2!=null){
+            list.get(0).setRed_count(list2.get(0).getRed_count());
+            list.get(0).setYellow_count(list2.get(0).getYellow_count());
+            list.get(0).setGreen_count(list3.get(0).getGreen_count());
+            list.get(0).setSmT(String.valueOf(Integer.parseInt(list3.get(0).getGreen_count())
+                    +Integer.parseInt(list2.get(0).getRed_count())
+                    +Integer.parseInt(list2.get(0).getYellow_count())));
+        }
+        return list;
+    }
+
+
+    public List<Handlde> queryHandler(){
+        return firstBuffertDao.queryHandler();
+    }
+
+    // 第一道防线红码人员详情
+    public List<User> queryRed(String startDate, String endDate){
+        return firstBuffertDao.queryRed(startDate,endDate);
+    };
+
+    // 第一道防线黄码人员详情
+    public List<User> queryYellow(String startDate,String endDate,int page, int rows){
+        return firstBuffertDao.queryYellow(startDate,endDate,page,rows);
+    };
+
+    // 第一道防线黄码人员总数-分页
+    public int queryYellowTotal(String startDate,String endDate){
+        return firstBuffertDao.queryYellowTotal(startDate, endDate);
+    }
+
+    public SecondPlaceJc queryFirst(){
+        return firstBuffertDao.queryFirst();
+    }
+
+    // 首页面--处置
+    public List<Handlde> queryFirstHandler(){
+        return firstBuffertDao.queryFirstHandler();
+    }
+
+    // 第一道防线红黄码加时间搜索
+    public List<User> queryByTimeAndColor(int page, int rows,String sqlx){
+        return firstBuffertDao.queryByTimeAndColor(page,rows,sqlx);
+    };
+
+    public int findUsersTotal(String s1){
+        return firstBuffertDao.findUsersTotal(s1);
+    };
+
+    // 第一道防线累积红黄绿码详情
+    public SecondPlaceJc queryLjRyg(){
+        SecondPlaceJc sj1 = firstBuffertDao.queryLjRy();
+        SecondPlaceJc sj2 = firstBuffertDao.queryLjGreen();
+        sj1.setGreen_count(sj2.getGreen_count());
+        return sj1;
+    }
+
+    /** =================昨日累积缓存 =============================**/
+    // 前7天活动人数
+    public List<FirstBufferT> queryEgihtFbLj(int m) throws ParseException {
+        List<FirstBufferT> ar = new ArrayList<>();
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=m; i>-4; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            dateList.add(simpleDateFormat.format(calendar.getTime()));
+        }
+        for (int j=dateList.size()-1; j>=0; j--){
+            // 当日扫码数量
+            FirstBufferT td = firstBuffertDao.queryFbYesLj(dateList.get(j));
+            td.setDateT(dateList.get(j));
+            List<FirstBufferT> ryb = firstBuffertDao.queryFbByDate(dateList.get(j));
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(TimeExchange.StringToDate(dateList.get(j)+" 00:00:00"));
+            calendar.add(Calendar.DATE, -1);
+            List<FirstBufferT> td_yes = firstBuffertDao.queryfbCache(simpleDateFormat.format(calendar.getTime()));
+            if (td_yes!=null){
+                td.setSmLt(String.valueOf(Integer.parseInt(td_yes.get(0).getSmLt())+Integer.parseInt(td.getSmT())));
+                td.setRed_count(ryb.get(0).getRed_count());
+                td.setYellow_count(ryb.get(0).getYellow_count());
+            }
+            ar.add(td);
+        }
+        return ar;
+    }
+
+    // 插入缓存
+    public int insertFbT(int m) throws ParseException {
+        List<FirstBufferT> lt = queryEgihtFbLj(m);
+        if (lt!=null){
+            lt.forEach(data -> {
+                List<FirstBufferT> ld = firstBuffertDao.queryfbCache(data.getDateT());
+                if (ld==null){
+                    firstBuffertDao.insertFbT(data);
+                }
+            });
+        }
+        return 1;
+    }
+}

+ 25 - 0
bigData/src/com/happy/service/Impl/GtmtImplService.java

@@ -0,0 +1,25 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.GtmT;
+import com.happy.dao.GtmtDao;
+import com.happy.service.GtmtService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("GtmtService")
+public class GtmtImplService implements GtmtService {
+
+    @Autowired
+    public GtmtDao gtmtDao;
+
+    public int insertGtmT(GtmT gtmT){
+        return gtmtDao.insertGtmT(gtmT);
+    };
+
+    // 赣通码详情
+    public List<GtmT> queryGtmT(){
+        return gtmtDao.queryGtmT();
+    };
+}

+ 178 - 0
bigData/src/com/happy/service/Impl/ManagerImplService.java

@@ -0,0 +1,178 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.Manager.DanweiDetail;
+import com.happy.Model.Manager.Danweit;
+import com.happy.Model.Manager.Firstplace;
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.Secondplacetype;
+import com.happy.Model.Tour.TourDayt;
+import com.happy.dao.ManagerDao;
+import com.happy.service.ManagerService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+@Service("ManagerService")
+public class ManagerImplService implements ManagerService {
+
+    @Autowired
+    public ManagerDao managerDao;
+
+    // 昨日各高速路口人数统计
+    public List<Gaosut> queryByDataAndPlace(Integer d){
+        List<Firstplace> places = managerDao.queryFirstplace();
+        List<Gaosut> lists = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.add(Calendar.DATE, d);
+        places.forEach(data->{
+            List<Gaosut> list = managerDao.queryByDate(simpleDateFormat.format(calendar.getTime()), data.getPlace_name());
+            if (list!=null){
+                list.get(0).setPlace_name(data.getPlace_name());
+                list.get(0).setTj_date(simpleDateFormat.format(calendar.getTime()));
+                lists.add(list.get(0));
+            } else {
+                Gaosut gs = new Gaosut();
+                gs.setPlace_name(data.getPlace_name());
+                gs.setTj_date(simpleDateFormat.format(calendar.getTime()));
+                gs.setNum(0);
+                lists.add(gs);
+            }
+        });
+        return lists;
+    }
+
+    // 插入缓存
+    public int insertGaosuT(){
+        List<Gaosut> lt = queryByDataAndPlace(-1);
+        if (lt!=null){
+            lt.forEach(data -> {
+                List<Gaosut> ld = managerDao.queryIsR(data.getTj_date(), data.getPlace_name());
+                if (ld==null){
+                    managerDao.insertGaosuT(data);
+                }
+            });
+        }
+        return 1;
+    }
+
+    // 查询缓存数据
+    public List<Gaosut> queryGaosuR(String tj_date){
+        return managerDao.queryGaosuR(tj_date);
+    }
+
+    /** ====================================================================== **/
+
+    // 昨日各单位人数统计
+    public List<Danweit> queryDanweiByData(){
+        List<Secondplacetype> places = managerDao.queryDanwei();
+        List<Danweit> lists = new ArrayList<>();
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=0; i>-2; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            dateList.add(simpleDateFormat.format(calendar.getTime()));
+        }
+        for (int j=1; j<dateList.size(); j++) {
+            int finalJ = j;
+            places.forEach(data -> {
+                List<Danweit> list = managerDao.queryDwByDate(dateList.get(finalJ), data.getPlace_type());
+                if (list != null) {
+                    list.get(0).setPlace_name(data.getPlace_type());
+                    list.get(0).setTj_date(dateList.get(finalJ));
+                    lists.add(list.get(0));
+                } else {
+                    Danweit dw = new Danweit();
+                    dw.setPlace_name(data.getPlace_type());
+                    dw.setTj_date(dateList.get(finalJ));
+                    dw.setRed_num(0);
+                    dw.setYellow_num(0);
+                    dw.setGreen_num(0);
+                    lists.add(dw);
+                }
+            });
+        }
+        return lists;
+    }
+
+    // 插入缓存
+    public int insertDanweiT(){
+        List<Danweit> lt = queryDanweiByData();
+        if (lt!=null){
+            lt.forEach(data -> {
+                List<Danweit> ld = managerDao.queryDanweiIsR(data.getTj_date(), data.getPlace_name());
+                if (ld==null){
+                    managerDao.insertDanweiT(data);
+                }
+            });
+        }
+        return 1;
+    }
+
+    // 查询数据缓存中统计
+    public List<Danweit> queryDanweiByDate(String tj_date){
+        return managerDao.queryDanweiByDate(tj_date);
+    }
+
+    /** ====================各单位具体场所=================================== **/
+
+    // 昨日各单位具体场所人数统计
+    public List<DanweiDetail> queryDanweidByData(){
+        List<Secondplacetype> places = managerDao.queryDanwei();
+        List<DanweiDetail> lists = new ArrayList<>();
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=0; i>-2; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            dateList.add(simpleDateFormat.format(calendar.getTime()));
+        }
+        for (int j=1; j<dateList.size(); j++) {
+            int finalJ = j;
+            places.forEach(data -> {
+                List<DanweiDetail> list = managerDao.queryDwplaceByDate(dateList.get(finalJ), data.getPlace_type());
+                if (list != null) {
+                    for (int k=0;k<list.size();k++) {
+                        list.get(k).setPlacef(data.getPlace_type());
+                        list.get(k).setTj_date(dateList.get(finalJ));
+                        lists.add(list.get(k));
+                    }
+                } else {
+                    DanweiDetail dw = new DanweiDetail();
+                    dw.setPlacef(data.getPlace_type());
+                    dw.setPlaces("无");
+                    dw.setTj_date(dateList.get(finalJ));
+                    dw.setRed_num(0);
+                    dw.setYellow_num(0);
+                    dw.setGreen_num(0);
+                    lists.add(dw);
+                }
+            });
+        }
+        return lists;
+    }
+
+    // 插入缓存
+    public int insertDanweiD(){
+        List<DanweiDetail> lt = queryDanweidByData();
+        if (lt!=null){
+            lt.forEach(data -> {
+                List<DanweiDetail> ld = managerDao.queryDanweiDIsR(data.getTj_date(), data.getPlaces());
+                if (ld==null){
+                    managerDao.insertDanweiD(data);
+                }
+            });
+        }
+        return 1;
+    }
+
+    // 查询数据缓存中统计
+    public List<DanweiDetail> queryDanweiDByDate(String tj_date,String placef){
+        return managerDao.queryDanweiDByDate(tj_date, placef);
+    }
+}

+ 97 - 0
bigData/src/com/happy/service/Impl/MobImplService.java

@@ -0,0 +1,97 @@
+package com.happy.service.Impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.happy.Model.Mob.*;
+import com.happy.Model.User;
+import com.happy.dao.MobDao;
+import com.happy.service.MobService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+@Service("MobService")
+public class MobImplService implements MobService {
+
+    @Resource
+    public MobDao mobDao;
+
+    // 处置人员详情
+    public List<User> queryHandled(String sqlx, int page, int rows){
+        return mobDao.queryHandled(sqlx,page,rows);
+    }
+
+    // 处置详情总数
+    public int findUsersTotal(String s1){
+        return mobDao.findUsersTotal(s1);
+    }
+
+    public JSONObject queryDetailHandler(){
+        JSONObject resultJson = new JSONObject();
+        RedL rl = mobDao.queryLjRed();
+        RedT rt = mobDao.queryTodayRed();
+        YellowL yl = mobDao.queryLjYellow();
+        YellowT yt = mobDao.queryTodayYellow();
+        KeyL kl = mobDao.queryLjKey();
+        KeyT kt = mobDao.queryTodayKey();
+        HotL hl = mobDao.queryLjHot();
+        HotT ht = mobDao.queryTodayHot();
+        TokenL tl = mobDao.queryLjToken();
+        TokenT tt = mobDao.queryTodayToken();
+        resultJson.put("redL", rl);
+        resultJson.put("redT", rt);
+        resultJson.put("yellowL", yl);
+        resultJson.put("yellowT", yt);
+        resultJson.put("keyL", kl);
+        resultJson.put("keyT", kt);
+        resultJson.put("hotL", hl);
+        resultJson.put("hotT", ht);
+        resultJson.put("tokenL", tl);
+        resultJson.put("tokenT", tt);
+        return resultJson;
+    }
+
+    // 近8天红码处置详情
+    public JSONObject queryEightRed(String slqx){
+        JSONObject json = new JSONObject();
+        ArrayList<RedT> ar = new ArrayList<>();
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=0; i>-8; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            dateList.add(simpleDateFormat.format(calendar.getTime()));
+        }
+        for (int j=0; j<dateList.size(); j++){
+            RedT rt = mobDao.queryEightRed(dateList.get(j),slqx);
+            ar.add(rt);
+        }
+        json.put("data", ar);
+        json.put("date", dateList);
+        return json;
+    }
+
+    // 近8天处置平均时长
+    public JSONObject queryEightAvg(){
+        JSONObject json = new JSONObject();
+        ArrayList<Avg> ar = new ArrayList<>();
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=0; i>-8; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            dateList.add(simpleDateFormat.format(calendar.getTime()));
+        }
+        for (int j=0; j<dateList.size(); j++){
+            Avg rt = mobDao.queryEightAvg(dateList.get(j));
+            ar.add(rt);
+        }
+        json.put("data", ar);
+        json.put("date", dateList);
+        return json;
+    }
+
+}

+ 38 - 0
bigData/src/com/happy/service/Impl/SecondBufferPImplService.java

@@ -0,0 +1,38 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.SecondBufferP;
+import com.happy.Model.User;
+import com.happy.dao.SecondBufferPDao;
+import com.happy.service.SecondBufferPService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("SecondBufferPService")
+public class SecondBufferPImplService implements SecondBufferPService {
+
+    @Autowired
+    public SecondBufferPDao secondBufferPDao;
+
+    public int insertSecondBufferP(SecondBufferP secondBufferP){
+        return secondBufferPDao.insertSecondBufferP(secondBufferP);
+    };
+
+    // 各景点扫码详情
+    public List<SecondBufferP> querySecondBufferP(){
+        return secondBufferPDao.querySecondBufferP();
+    };
+
+    // 各景点人员扫码信息
+    public List<User> queryByPlace(String sm_place){
+        return secondBufferPDao.queryByPlace(sm_place);
+    };
+
+    // 各景点扫码详情
+    public List<SecondBufferP> querySecondBufferpByPlace(String place){
+        return secondBufferPDao.querySecondBufferpByPlace(place);
+    }
+
+
+}

+ 212 - 0
bigData/src/com/happy/service/Impl/SecondBuffertImplService.java

@@ -0,0 +1,212 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.*;
+import com.happy.Model.Common.Common;
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.Tour.TourDayt;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.SecondBuffertDao;
+import com.happy.service.SecondBuffertService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+@Service("SecondBuffertService")
+public class SecondBuffertImplService implements SecondBuffertService {
+
+    @Autowired
+    public SecondBuffertDao secondBuffertDao;
+
+    public int insertSecondBufferT(SecondBufferT secondBufferT){
+        return secondBuffertDao.insertSecondBufferT(secondBufferT);
+    }
+
+    public int insertSecondBufferC(SecondBufferC secondBufferC){
+        return secondBuffertDao.insertSecondBufferC(secondBufferC);
+    }
+
+    public List<SecondBufferT> querySecondBufferT(){
+        List<SecondBufferT> list = secondBuffertDao.querySecondBufferT();
+        List<SecondBufferT> list2 = secondBuffertDao.querySecondBufferRy();
+        if (list!=null & list2!=null){
+            list.get(0).setRed_count(list2.get(0).getRed_count());
+            list.get(0).setYellow_count(list2.get(0).getYellow_count());
+            list.get(0).setHot_count(list2.get(0).getHot_count());
+            list.get(0).setSmLt(list.get(0).getSmLt());
+        }
+        return list;
+    };
+
+    // 最近7天人员分布
+    public List<SecondBufferT> querySecondBufferTLastSeven(){
+        return secondBuffertDao.querySecondBufferTLastSeven();
+    };
+
+    public List<SecondBufferC> querySecondBufferC(){
+        return secondBuffertDao.querySecondBufferC();
+    }
+
+    // 第二道防线处理情况
+    public List<Handlde> queryHandler(){
+        return secondBuffertDao.queryHandler();
+    }
+
+    public int queryHot(){
+        return secondBuffertDao.queryHot();
+    }
+
+    // 第二道防线红码人员详情
+    public List<User> queryRed(String startDate, String endDate){
+        return secondBuffertDao.queryRed(startDate,endDate);
+    };
+
+    // 第二道防线黄码人员详情
+    public List<User> queryYellow(String startDate,String endDate,int page, int rows){
+        return secondBuffertDao.queryYellow(startDate, endDate, page, rows);
+    }
+
+    // 第一道防线黄码人员总数-分页
+    public int queryYellowTotal(String startDate,String endDate){
+        return secondBuffertDao.queryYellowTotal(startDate, endDate);
+    }
+
+    // 各地区类型详情
+    public List<SecondPlaceJc> querySpjc(){
+        List<Secondplacetype> list = secondBuffertDao.queryPt();
+        List<SecondPlaceJc> ls = new ArrayList<>();
+        int i = 1;
+        for (Secondplacetype secondplacetype : list) {
+            SecondPlaceJc sj = secondBuffertDao.querySpjc(secondplacetype.getPlace_type());
+            SecondPlaceJc sgreen = secondBuffertDao.queryGreen(secondplacetype.getPlace_type());
+            sj.setPlace_type(secondplacetype.getPlace_type());
+            sj.setGreen_count(sgreen.getGreen_count());
+            sj.setId(i);
+            ls.add(sj);
+            i++;
+        }
+        return ls;
+    }
+
+    // 各门店详细名称类型详情
+    public List<SecondPlaceJc> queryCommon(String place_type){
+        List<Common> list = secondBuffertDao.queryCommon(place_type);
+        List<SecondPlaceJc> ls = new ArrayList<>();
+        int i = 1;
+        if (list!=null) {
+            for (Common common : list) {
+                SecondPlaceJc sj = secondBuffertDao.queryByCommon(place_type, common.getCommon());
+                SecondPlaceJc sgreen = secondBuffertDao.queryGreenByCommon(place_type, common.getCommon());
+                sj.setPlace_type(place_type);
+                sj.setHotel(common.getCommon());
+                sj.setGreen_count(sgreen.getGreen_count());
+                sj.setId(i);
+                ls.add(sj);
+                i++;
+            }
+        }
+        return ls;
+    }
+
+
+    public SecondPlaceJc querySl(){
+        SecondPlaceJc sj = secondBuffertDao.querySl();
+        SecondPlaceJc sgreen = secondBuffertDao.querySlGreen();
+        sj.setPlace_type("公共区域扫码亮码人员");
+        sj.setGreen_count(sgreen.getGreen_count());
+        sj.setId(999);
+        return sj;
+    }
+
+    public SecondPlaceJc querySpjd(){
+        List<SecondBufferT> list = secondBuffertDao.querySpjdGreen(TimeExchange.getDate());
+        SecondPlaceJc sjc = secondBuffertDao.querySpjd();
+        if (list!=null){
+            String count = list.get(0).getGreen_count();
+            sjc.setGreen_count(count);
+            sjc.setPlace_type("景点");
+        }
+        return sjc;
+    }
+
+    // 第二道防线发热加时间搜索
+    public List<User> queryByTime(int page, int rows,String sqlx){
+        return secondBuffertDao.queryByTime(page,rows,sqlx);
+    };
+
+    // 查询用户表中的总记录数
+    public int findUsersTotal(String s1){
+        return secondBuffertDao.findUsersTotal(s1);
+    };
+
+    // 第二道防线累积加时间搜索
+    public List<User> queryLjByTime(int page, int rows,String sqlx){
+        return secondBuffertDao.queryLjByTime(page, rows, sqlx);
+    };
+
+    // 查询用户表中的累积总记录数
+    public int findLjUsersTotal(String s1){
+        return secondBuffertDao.findLjUsersTotal(s1);
+    };
+
+    // 第二道防线累积红黄绿码详情
+    public SecondPlaceJc queryLjRyg(){
+        SecondPlaceJc sj1 = secondBuffertDao.queryLjRy();
+        SecondPlaceJc sj2 = secondBuffertDao.queryLjGreen();
+        sj1.setGreen_count(sj2.getGreen_count());
+        return sj1;
+    }
+
+    public Tz queryView(String sm_place){
+        return secondBuffertDao.queryView(sm_place);
+    }
+
+    /** =================昨日累积缓存 =============================**/
+    // 前7天活动人数
+    public List<SecondBufferT> queryEgihtSbLj(int m) throws ParseException {
+        List<SecondBufferT> ar = new ArrayList<>();
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=m; i>-4; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            dateList.add(simpleDateFormat.format(calendar.getTime()));
+        }
+        for (int j=dateList.size()-1; j>=0; j--){
+            // 当日扫码数量
+            SecondBufferT td = secondBuffertDao.querySbYesLj(dateList.get(j));
+            td.setDateT(dateList.get(j));
+            List<SecondBufferT> ryb = secondBuffertDao.querySbRyByDate(dateList.get(j));
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(TimeExchange.StringToDate(dateList.get(j)+" 00:00:00"));
+            calendar.add(Calendar.DATE, -1);
+            List<SecondBufferT> td_yes = secondBuffertDao.querySbCache(simpleDateFormat.format(calendar.getTime()));
+            if (td_yes!=null){
+                td.setSmLt(String.valueOf(Integer.parseInt(td_yes.get(0).getSmLt())+Integer.parseInt(td.getSmT())));
+                td.setRed_count(ryb.get(0).getRed_count());
+                td.setYellow_count(ryb.get(0).getYellow_count());
+            }
+            ar.add(td);
+        }
+        return ar;
+    }
+
+    // 插入缓存
+    public int insertSbT(int m) throws ParseException {
+        List<SecondBufferT> lt = queryEgihtSbLj(m);
+        if (lt!=null){
+            lt.forEach(data -> {
+                List<SecondBufferT> ld = secondBuffertDao.querySbCache(data.getDateT());
+                if (ld==null){
+                    secondBuffertDao.insertSbT(data);
+                }
+            });
+        }
+        return 1;
+    }
+
+}

+ 30 - 0
bigData/src/com/happy/service/Impl/SmlmtImplService.java

@@ -0,0 +1,30 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.SmlmT;
+import com.happy.dao.SmlmtDao;
+import com.happy.service.SmlmtService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("SmlmtService")
+public class SmlmtImplService implements SmlmtService {
+
+    @Autowired
+    public SmlmtDao smlmtDao;
+
+    public int insertSmlmT(SmlmT smlmT){
+        return smlmtDao.insertSmlmT(smlmT);
+    }
+
+    // 今日扫码亮码
+    public List<SmlmT> query(){
+        return smlmtDao.query();
+    };
+
+    // 扫码亮码月统计
+    public List<SmlmT> queryByMonth(String month){
+        return smlmtDao.queryByMonth(month);
+    };
+}

+ 29 - 0
bigData/src/com/happy/service/Impl/SmtImplService.java

@@ -0,0 +1,29 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.Hylj;
+import com.happy.Model.SmT;
+import com.happy.dao.SmtDao;
+import com.happy.service.SmtService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("SmtService")
+public class SmtImplService implements SmtService {
+
+    @Autowired
+    public SmtDao smtDao;
+
+    public int insertSmT(SmT smT){
+        return smtDao.insertSmT(smT);
+    }
+
+    public List<SmT> query(){
+        return smtDao.query();
+    }
+
+    public List<Hylj> queryLj(){
+        return smtDao.queryLj();
+    }
+}

+ 61 - 0
bigData/src/com/happy/service/Impl/ThirdBuffertImplService.java

@@ -0,0 +1,61 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.ThirdBufferT;
+import com.happy.Model.ThirdJw;
+import com.happy.Model.Tz;
+import com.happy.Model.User;
+import com.happy.dao.ThirdBuffertDao;
+import com.happy.service.ThirdBuffertService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("ThirdBuffertService")
+public class ThirdBuffertImplService implements ThirdBuffertService {
+
+    @Autowired
+    public ThirdBuffertDao thirdBuffertDao;
+
+    public int insertThirdBufferT(ThirdBufferT thirdBufferT){
+        return thirdBuffertDao.insertThirdBufferT(thirdBufferT);
+    }
+
+    public List<ThirdBufferT> queryThirdBufferT(){
+        return thirdBuffertDao.queryThirdBufferT();
+    };
+
+    // 最近7天人员分布
+    public List<ThirdBufferT> queryThirdBufferTLastSeven(){
+        return thirdBuffertDao.queryThirdBufferTLastSeven();
+    };
+
+    // 各酒店人员扫码信息
+    public List<User> queryByBuffer(){
+        return thirdBuffertDao.queryByBuffer();
+    };
+
+    public List<ThirdJw> queryJw(){
+        return thirdBuffertDao.queryJw();
+    }
+
+    // 脱管人员统计
+    public Tz queryTuo(){
+        return thirdBuffertDao.queryTuo();
+    }
+
+    // 重点地区人员统计
+    public Tz queryZd(){
+        return thirdBuffertDao.queryZd();
+    }
+
+    // 第三道防线重点时间搜索
+    public List<User> queryByTime(int page, int rows,String sqlx){
+        return thirdBuffertDao.queryByTime(page,rows,sqlx);
+    };
+
+    // 查询用户表中的总记录数
+    public int findUsersTotal(String s1){
+        return thirdBuffertDao.findUsersTotal(s1);
+    };
+}

+ 549 - 0
bigData/src/com/happy/service/Impl/TourImplService.java

@@ -0,0 +1,549 @@
+package com.happy.service.Impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.happy.Model.Manager.Gaosut;
+import com.happy.Model.Mob.RedT;
+import com.happy.Model.Secondplace;
+import com.happy.Model.Tour.City;
+import com.happy.Model.Tour.Hotel;
+import com.happy.Model.Tour.TourDayt;
+import com.happy.Model.Tour.Tourx;
+import com.happy.Model.Travel.*;
+import com.happy.Until.TimeExchange;
+import com.happy.Until.TransactionConfig;
+import com.happy.dao.TourDao;
+import com.happy.service.TourService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+import java.sql.Connection;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+@Service("TourService")
+public class TourImplService implements TourService {
+
+    @Autowired
+    public TourDao tourDao;
+
+    @Autowired
+    public TransactionConfig transactionConfig;
+
+    // 今日旅游人数
+    public TourDayt queryTotalTour(String sm_date){
+        TourDayt tourDayt = tourDao.queryTotalTour(sm_date);
+        if (tourDayt==null || tourDayt.getDateTime()==null){
+            tourDayt = new TourDayt();
+            tourDayt.setDateTime(sm_date);
+            tourDayt.setNum("0");
+        }
+        return tourDayt;
+    }
+
+    // 本-月-年旅游人数
+    public TourDayt queryTotalTourOther(String sm_date){
+        TourDayt tourDayt = tourDao.queryTotalTourOther(sm_date);
+        if (tourDayt==null || tourDayt.getDateTime()==null){
+            tourDayt = new TourDayt();
+            tourDayt.setDateTime(sm_date);
+            tourDayt.setNum("0");
+        }
+        return tourDayt;
+    }
+
+    // 查询缓存-天-判断是否存在
+    public List<TourDayt> queryTourByDay(String dateTime){
+        return tourDao.queryTourByDay(dateTime);
+    }
+
+    // 插入前8天活动人数
+    public void insertToday(TourDayt tourDayt){
+       tourDao.insertToday(tourDayt);
+    }
+
+    // 查询景点累计数据
+    public TourDayt queryTourT(){
+        return tourDao.queryTourT();
+    }
+
+    // 查询景点每日数据
+    public TourDayt queryTourDay(){
+        TourDayt list = tourDao.queryTourDay();
+        if (list==null || list.getDateTime()==null){
+            list = new TourDayt();
+            list.setDateTime(TimeExchange.getDate());
+            list.setNum("0");
+        }
+        return list;
+    }
+
+    /**==================  插入缓存二  ================**/
+    // 插入缓存
+    // 今日某景点游客
+    public TravelT queryDayAndPlace(String sm_date,String sm_place){
+        return tourDao.queryDayAndPlace(sm_date, sm_place);
+    }
+
+    // 查询缓存-天-判断是否存在
+    public List<TravelT> queryDayAndPlaceExis(String dateTime,String place){
+        return tourDao.queryDayAndPlaceExis(dateTime, place);
+    }
+
+    public int insertTodayAndPlace(TravelT travelT){
+        return tourDao.insertTodayAndPlace(travelT);
+    }
+
+    // 各景点累计人流
+    public List<TravelT> queryTravelT(){
+        return tourDao.queryTravelT();
+    }
+
+
+    /**============================  查询缓存  ==============================**/
+    // 查询缓存中近8天访客数据
+    public List<TourDayt> queryEgihtTourH(){
+        List<TourDayt> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=-8; i<0; i++){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            String date = simpleDateFormat.format(calendar.getTime());
+            TourDayt lt = tourDao.queryLastTour(date);
+            if (lt==null || lt.getDateTime()==null){
+                lt = new TourDayt();
+                lt.setDateTime(date);
+                lt.setNum("0");
+                list.add(lt);
+            } else {
+                list.add(lt);
+            }
+        }
+//        list.add(queryTotalTour(TimeExchange.getDate()));
+        return list;
+    }
+
+    // 分页查找景区每日人数
+    public List<TourDayt> queryTourPage(int page, int rows,String sqlx){
+        return tourDao.queryTourPage(page, rows, sqlx);
+    };
+
+    // 分页查找景区每日人数
+    public int queryTourPaget(String sqlx){
+        return tourDao.queryTourPaget(sqlx);
+    };
+
+    // 与昨日人数对比
+    public int queryIncrease(){
+        // 当日人数
+        TourDayt td = tourDao.queryTotalTour(TimeExchange.getDate());
+        // 昨日人数
+        Calendar calendar = Calendar.getInstance();
+        calendar.add(Calendar.DATE, -1);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        System.out.println(simpleDateFormat.format(calendar.getTime()));
+        List<TourDayt> ye = tourDao.queryTourByDay(simpleDateFormat.format(calendar.getTime()));
+        int num = Integer.parseInt(td.getNum());
+        if (ye!=null){
+            num = num - Integer.parseInt(ye.get(0).getNum());
+        }
+        return num;
+    }
+
+    /**================月=======================**/
+    public List<TourDayt> queryTourByMonth(String dateTime){
+        return tourDao.queryTourByMonth(dateTime);
+    }
+
+    // 插入缓存
+    // 前8月活动人数
+    public void insertMonth(TourDayt tourDayt){
+        tourDao.insertMonth(tourDayt);
+    }
+
+    // 查询缓存中近8月访客数据
+    public List<TourDayt> queryEgihtTourM(){
+        List<TourDayt> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+        for (int i=-8; i<0; i++){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.MONTH, i);
+            String date = simpleDateFormat.format(calendar.getTime());
+            TourDayt lt = tourDao.queryLastTourOther(date);
+            if (lt==null || lt.getDateTime()==null){
+                lt = new TourDayt();
+                lt.setDateTime(date);
+                lt.setNum("0");
+                list.add(lt);
+            } else {
+                lt.setDateTime(date);
+                list.add(lt);
+            }
+        }
+//        list.add(queryTotalTourOther(TimeExchange.getMonth()));
+        return list;
+    }
+
+    /**================年=======================**/
+    // 查询缓存-年-判断是否存在
+    public List<TourDayt> queryTourByYear(String dateTime){
+        return tourDao.queryTourByYear(dateTime);
+    }
+    // 8年插入缓存
+    public void insertYear(TourDayt tourDayt){
+        tourDao.insertYear(tourDayt);
+    }
+
+    // 查询缓存中近8年访客数据
+    public List<TourDayt> queryEgihtTourY(){
+        List<TourDayt> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
+        for (int i=-2; i<0; i++){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.YEAR, i);
+            String date = simpleDateFormat.format(calendar.getTime());
+            TourDayt lt = tourDao.queryLastTourOther(date);
+            if (lt==null || lt.getDateTime()==null){
+                lt = new TourDayt();
+                lt.setDateTime(date);
+                lt.setNum("0");
+                list.add(lt);
+            } else {
+                lt.setDateTime(date);
+                list.add(lt);
+            }
+        }
+//        list.add(queryTotalTourOther(TimeExchange.getYear()));
+        return list;
+    }
+
+    /**================各省-年月日统计=================**/
+    // 各省日统计
+    public List<TravelProvin> queryTourProvince(String sm_date){
+        sm_date=TimeExchange.getDate();
+        return tourDao.queryTourProvince(sm_date);
+    }
+
+    // 查询缓存-省-判断是否存在
+    public List<TravelProvin> queryTourByProvince(TravelProvin travelProvin){
+        return tourDao.queryTourByProvince(travelProvin);
+    }
+    // 插入缓存
+    public void insertProvince(TravelProvin travelProvin){
+        tourDao.insertProvince(travelProvin);
+    }
+
+    // 各省月统计
+    public List<TravelProvin> queryTourProvinceM(String sm_date){
+        sm_date=TimeExchange.getMonth();
+        return tourDao.queryTourProvinceM(sm_date);
+    }
+
+    // 各省年统计
+    public List<TravelProvin> queryTourProvinceY(String sm_date){
+        sm_date = TimeExchange.getYear();
+        return tourDao.queryTourProvinceM(sm_date);
+    }
+
+    // 各省月-累计统计
+    public List<TravelProvin> queryTourProvinceT(){
+        List<TravelProvin> listT = tourDao.queryTourProvinceT();
+        List<TravelProvin> listDay = tourDao.queryTourProvince(TimeExchange.getDate());
+        for (int i = 0; i < listT.size(); i++) {
+            if (listDay!=null ){
+                for (int j = 0; j < listDay.size(); j++) {
+                    if (listT.get(i).getProvince()==listDay.get(j).getProvince()){
+                        listT.get(i).setNum(String.valueOf(Integer.parseInt(listT.get(i).getNum())+Integer.parseInt(listDay.get(j).getNum())));
+                    }
+                }
+            }
+        }
+        return listT;
+    }
+
+    /**====================近12小时人次记录===================**/
+    // 每小时人次
+    public TourDayt queryTotalHour(String sm_time){
+        return tourDao.queryTotalHour(sm_time);
+    }
+
+    // 缓存是否存在
+    public TourDayt queryExistHour(String sm_time){
+        return tourDao.queryExistHour(sm_time);
+    }
+
+    // 插入缓存
+    public int insertHour(TourDayt tourDayt){
+        return tourDao.insertHour(tourDayt);
+    }
+
+    // 查询昨日12小时趋势
+    public List<TourDayt> queryYesHourHistory(){
+        return tourDao.queryHourHistory(TimeExchange.getYesDate(),TimeExchange.getYesDate()+" "+TimeExchange.getOnlyHour(),12);
+    }
+
+    // 查询今日12小时趋势
+    public List<TourDayt> queryTodayHourHistory(){
+        List<TourDayt> all = new ArrayList<>();
+//        TourDayt listDay = tourDao.queryTotalHour(TimeExchange.getLastHour(0));
+//        if (listDay==null || listDay.getDateTime()==null){
+//            listDay=new TourDayt();
+//            listDay.setDateTime(TimeExchange.getLastHour(0));
+//            listDay.setNum("0");
+//        }
+//        all.add(listDay);
+        List<TourDayt> listT = tourDao.queryHourHistory(TimeExchange.getDate(),TimeExchange.getLastHour(0),12);
+        all.addAll(listT);
+        return all;
+
+    }
+
+    /**================性别统计=======================**/
+    // 每日男女性统计
+    public TravelGender queryTourGenderD(String sm_date,String sm_gender){
+        return tourDao.queryTourGenderD(sm_date, sm_gender);
+    }
+
+    // 查询缓存-性别-判断是否存在
+    public List<TravelGender> queryTourByGender(TravelGender travelGender){
+        return tourDao.queryTourByGender(travelGender);
+    }
+
+    // 插入缓存-性别
+    public int insertGender(TravelGender travelGender){
+        return tourDao.insertGender(travelGender);
+    }
+
+    // 男女性别年统计
+    public List<TravelGender> queryTourByGenderAndYear(String dateTime){
+        return tourDao.queryTourByGenderAndYear(dateTime);
+    }
+
+    // 男女性别累计统计
+    public List<TravelGender> queryGenderT(){
+        return tourDao.queryGenderT();
+    }
+
+    /**================年龄统计=======================**/
+    public TravelAge queryTourAge(String sm_date, String ageArea, String sqlx){
+        return tourDao.queryTourAge(sm_date, ageArea, sqlx);
+    }
+
+    // 查询缓存-年龄-判断是否存在
+    public List<TravelAge> queryTourByAge(TravelAge travelAge){
+        return tourDao.queryTourByAge(travelAge);
+    }
+
+    // 插入缓存-各年龄
+    public int insertAge(TravelAge travelAge){
+        return tourDao.insertAge(travelAge);
+    }
+
+    // 男女性别年统计
+    public List<TravelAge> queryTourByAgeAndYear(String dateTime){
+        return tourDao.queryTourByAgeAndYear(dateTime);
+    }
+
+    // 年龄累计统计
+    public List<TravelAge> queryAgeT(){
+        return tourDao.queryAgeT();
+    }
+
+    /**================景区游客人数统计=======================**/
+    // 景区游客日人数统计
+    public List<TravelT> queryTourNum(String sm_date){
+        return tourDao.queryTourNum(sm_date);
+    }
+
+    // 前7天各景点活动人数
+    public List<TravelT> queryEgihtNumTour(){
+        List<TravelT> ar = new ArrayList<>();
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=0; i>-320; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            dateList.add(simpleDateFormat.format(calendar.getTime()));
+        }
+        for (int j=1; j<dateList.size(); j++){
+            List<TravelT> td = tourDao.queryTourNum(dateList.get(j));
+            if (td!=null) {
+                ar.addAll(td);
+            }
+        }
+        return ar;
+    }
+
+    // 查询缓存-各景区当日-判断是否存在
+    public List<TravelT> queryTourByNum(TravelT travelT){
+        return tourDao.queryTourByNum(travelT);
+    }
+
+    public int insertTour(TravelT travelT){
+        return tourDao.insertNum(travelT);
+    }
+
+    // 景区游客累积人数统计
+    public List<TravelT> queryTourNumT(){
+        return tourDao.queryTourNumT();
+    }
+
+    // 各景区游客累积人数统计
+    public List<TravelT> queryGTourNumT(){
+        return tourDao.queryGTourNumT();
+    }
+
+    // 各景点年月年统计
+    public List<TravelT> queryTourByNumAndTime(String dateTime){
+        return tourDao.queryTourByNumAndTime(dateTime);
+    }
+
+    // 各景区人数排行跨日期
+    public List<TravelT> queryTourNumByDate(String startTime, String endTime){
+        return tourDao.queryTourNumByDate(startTime, endTime);
+    }
+
+    /**================景区过夜人数统计=======================**/
+    // 景区过夜日人数统计
+    public List<Travelye> queryTourYe(String sm_date){
+        List<Travelye> list = tourDao.queryTourYe(sm_date);
+        for (int i=0; i<list.size(); i++){
+            if (list.get(i).getDateTime()==null){
+                list.get(i).setDateTime(sm_date);
+            }
+        }
+        return tourDao.queryTourYe(sm_date);
+    }
+
+    // 前7天各景点过夜人数
+    public List<Travelye> queryEgihtYeTour(){
+        List<Travelye> ar = new ArrayList<>();
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i=0; i>-32; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DATE, i);
+            dateList.add(simpleDateFormat.format(calendar.getTime()));
+        }
+        for (int j=1; j<dateList.size(); j++){
+            List<Travelye> td = tourDao.queryTourYe(dateList.get(j));
+            if (td!=null) {
+                for (int i=0;i<td.size();i++){
+                    if (td.get(i).getDateTime()==null){
+                        td.get(i).setDateTime(dateList.get(j));
+                    }
+                    if (td.get(i).getNum()==null){
+                        td.get(i).setNum("0");
+                    }
+                    ar.add(td.get(i));
+                }
+            }
+
+        }
+        return ar;
+    }
+
+    // 插入缓存-各镇过夜人数
+    public int insertYe(){
+        List<Travelye> lt = queryEgihtYeTour();
+        System.out.println(lt);
+        if (lt!=null){
+            lt.forEach(data -> {
+                System.out.println(data.getDateTime());
+                List<Travelye> ld = tourDao.queryTourByYe(data);
+                if (ld==null){
+                    tourDao.insertYe(data);
+                }
+            });
+        }
+        return 1;
+    }
+
+    // 各镇过夜年月年统计
+    public List<Travelye> queryTourByNumAndYe(String dateTime){
+        List<Travelye> list = tourDao.queryTourByNumAndYe(dateTime);
+        List<Travelye> list2 = tourDao.queryTourYe(TimeExchange.getDate());
+        if (list!=null & list2!=null) {
+            for (int i = 0; i < list.size(); i++) {
+                for (int j = 0; j < list2.size(); j++) {
+                    if (list.get(i).getPlace().equals(list2.get(j).getPlace())) {
+                        System.out.println(list.get(i).getNum()+"==="+list2.get(j).getNum());
+                        System.out.println(Double.parseDouble(list.get(i).getNum()) + Double.parseDouble(list2.get(j).getNum()));
+                        list.get(i).setNum(String.valueOf(Double.parseDouble(list.get(i).getNum()) + Double.parseDouble(list2.get(j).getNum())));
+                    }
+                }
+            }
+        }
+        return list;
+    }
+
+    // 各酒店过夜人数‘
+    public List<Hotel> queryHotel(int page, int rows, String startTime, String endTime, String sqlx){
+        return tourDao.queryHotel(page, rows, startTime, endTime, sqlx);
+    };
+
+    // 过夜游客按时查找
+    public List<Travelye> queryTouYeByDate(String startTime, String endTime){
+        return tourDao.queryTouYeByDate(startTime, endTime);
+    }
+
+    // 查询用户表中的总记录数
+    public int queryHotelTotal(String startTime,String endTime,String s1){
+        return tourDao.queryHotelTotal(startTime, endTime, s1);
+    };
+
+    // 最大访客量
+    public int queryMaxTour(String place_name){
+        return tourDao.queryMaxTour(place_name);
+    }
+
+    // 景区游客日人数统计
+    public List<TravelT> queryTourNumByPlace(String sm_place){
+        return tourDao.queryTourNumByPlace(sm_place);
+    }
+
+    // 景区游客累计人数统计
+    public List<TravelT> queryTourNumByPlaceT(String sm_place){
+        return tourDao.queryTourNumByPlaceT(sm_place);
+    }
+
+    // 景区最大人口修改
+    public int updateMaxT(String place_name,String maxnum){
+        return tourDao.updateMaxT(place_name, maxnum);
+    }
+
+    // 36个景点
+    public List<Secondplace> queryTourPlace(){
+        return tourDao.queryTourPlace();
+    }
+
+    // 旅游数量参数
+    public List<Tourx> queryTx(){
+        return tourDao.queryTx();
+    }
+
+    // 景区参数修改
+    public int updateTx(Tourx tourx){
+        return tourDao.updateTx(tourx);
+    }
+
+    // 各省月游客统计-分页
+    public List<TravelProvin> queryTourProvincePage(String time1,String time2,String sqlx,int page, int rows){
+        List<TravelProvin> list = tourDao.queryTourProvincePage(time1, time2,sqlx, page, rows);
+        for (int i = 0; i < list.size(); i++) {
+            list.get(i).setId(i+1);
+        }
+        return list;
+    }
+
+    // 各省游客总数-分页
+    public int queryTourProvinceTotal(String time1,String time2,String sqlx){
+        return tourDao.queryTourProvinceTotal(time1,time2,sqlx);
+    }
+}

+ 379 - 0
bigData/src/com/happy/service/Impl/TouristAnalysisServiceImpl.java

@@ -0,0 +1,379 @@
+package com.happy.service.Impl;
+
+
+import com.happy.Model.Province;
+import com.happy.Model.SmartMarketingVO;
+import com.happy.Model.ToiletRealDatasVO;
+import com.happy.Model.Travel.StopSaturationStatistics;
+import com.happy.Model.Travel.ToiletRealData;
+import com.happy.Model.Travel.TravelAge;
+import com.happy.Model.Travel.TravelGender;
+import com.happy.Model.Travel.TravelLast;
+import com.happy.Model.Travel.TravelMarketingStatistics;
+import com.happy.Model.Travel.TravelProvin;
+import com.happy.Model.Travel.TravelT;
+import com.happy.Model.Travel.TravelTraff;
+import com.happy.Model.Travel.Travelye;
+import com.happy.Model.User;
+import com.happy.Until.MyPageList;
+import com.happy.dao.Impl.TouristAnalysisDao;
+import com.happy.service.TouristAnalysisService;
+import com.happy.vo.RealDataOfPeopleStreamVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author: codingliang
+ * @Description: 游客画像service
+ * @Date: 2021-12-30 16:00
+ * @Version: V1.0
+ **/
+@Service("TouristAnalysisService")
+public class TouristAnalysisServiceImpl implements TouristAnalysisService {
+
+    @Autowired
+    private TouristAnalysisDao touristAnalysisDao;
+
+    private DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH");
+    private DecimalFormat decimalFormat = new DecimalFormat("0.00");
+
+    /**
+     * 今日人员流入人数
+     * @return
+     */
+    @Override
+    public TravelT getTodayIntoStatistics() {
+        LocalDate today = LocalDate.now();
+        TravelT travelT = touristAnalysisDao.getDataByDate(today.toString());
+        return travelT;
+    }
+
+    @Override
+    public Map<String, String> getTodayIntoStatisticsV2() {
+        LocalDate today = LocalDate.now();
+        TravelT travelT = touristAnalysisDao.getDataByDate(today.toString());
+        Map<String, String> param = new HashMap<>();
+        param.put("dateStr", travelT.getDateT());
+        param.put("inCount", travelT.getInCount());
+        return param;
+    }
+
+    @Override
+    public Map<String, String> getWeekAndMonthIntoStatisticsV2() {
+        LocalDate today = LocalDate.now();
+        LocalDate sevenDaysAgo = today.minusDays(7);
+        LocalDate daysAgoOf30 = today.minusDays(30);
+
+        Long sum1 = touristAnalysisDao.getSumByDateSection(sevenDaysAgo.toString(), today.toString());
+        Long sum2 = touristAnalysisDao.getSumByDateSection(daysAgoOf30.toString(), today.toString());
+
+        Map<String, String> map = new HashMap<>();
+        map.put("last7DaysValue", sum1.toString());
+        map.put("last30DaysValue", sum2.toString());
+
+        return map;
+    }
+
+    @Override
+    public List<Map<String, String>> getTodayIntoHistoryStatistics() {
+        LocalDateTime currentTime = LocalDateTime.now();
+        return getCountOfHours(currentTime);
+    }
+
+
+    @Override
+    public Map<String, Object> getIntoHistoryStatistics() {
+        LocalDateTime currentTime = LocalDateTime.now();
+        LocalDateTime preTime = LocalDateTime.now().minusDays(1);
+        List<Map<String, String>> todayData = getCountOfHours(currentTime);
+        List<Map<String, String>> preDayData = getCountOfHours(preTime);
+
+        Map<String, Object> map = new HashMap<>();
+        map.put("today", todayData);
+        map.put("yesterday", preDayData);
+
+        return map;
+    }
+
+    @Override
+    public List<Map<String, String>> getIntoHistoryStatisticsV2() {
+        // 查询最近7天数据
+        LocalDate today = LocalDate.now();
+        List<Map<String, String>> param = new ArrayList<>();
+        for (int i = 7; i > 0; i--) {
+            LocalDate localDate = today.minusDays(i);
+            String nums = touristAnalysisDao.getTodayIntoHistoryStatistics(localDate.toString());
+            Map<String, String> map = new HashMap<>();
+            map.put("dateStr", localDate.getDayOfMonth() + "");
+            map.put("value", new BigDecimal(nums).setScale(0).toString());
+            param.add(map);
+        }
+
+        return param;
+    }
+
+    /**
+     * 游客来源地top16
+     * @return
+     */
+    @Override
+    public List<TravelProvin> getTouristFromTo16() {
+        return touristAnalysisDao.getTouristFrom();
+    }
+
+    /**
+     * 游客年龄分布
+     * @return
+     */
+    @Override
+    public List<TravelAge> getTouristAgeStatistics() {
+        return touristAnalysisDao.touristAgeStatistics();
+    }
+
+    @Override
+    public Map<String, Integer> getTouristGenderStatistics() {
+        List<TravelGender> travelGenders = touristAnalysisDao.getTouristGenders();
+        Map<String, Integer> map = new HashMap<>();
+        travelGenders.forEach(data -> map.put(data.getGender(), Integer.valueOf(data.getNum())));
+        return map;
+    }
+
+    @Override
+    public Map<String, String> getTouristTrafficMethodStatics() {
+        List<TravelTraff> TravelTraffs = touristAnalysisDao.getTouristTrafficMethods();
+        Map<String, String> map = new HashMap<>();
+        long count = TravelTraffs.stream().map(e -> Long.valueOf(e.getPer())).mapToLong(Long::intValue).sum();
+        BigDecimal total = new BigDecimal(Long.valueOf(count).toString());
+        TravelTraffs.forEach(data -> {
+            BigDecimal currentCount = new BigDecimal(data.getPer());
+            map.put(data.getTraffic(), currentCount.divide(total, 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).toString() + "%");
+        });
+        return map;
+    }
+
+    @Override
+    public List<String> getTouristDestinations() {
+        return touristAnalysisDao.getTouristDestinations();
+    }
+
+    @Override
+    public Map<String, Long> getTouristDestinationStatics(String place) {
+        // 累计入园人数
+        String addUpCount = touristAnalysisDao.getAddUpCountOfPlace(place);
+        // 当天入园人数
+        LocalDate now = LocalDate.now();
+        String currentDayCount = touristAnalysisDao.getCurrentDayCountOfPlace(place, now.toString());
+
+        Map<String, Long> param = new HashMap<>();
+        param.put("addUpCount", new BigDecimal(addUpCount).setScale(0).longValue());
+        param.put("currentDayCount", new BigDecimal(currentDayCount).setScale(0).longValue());
+        return param;
+    }
+
+    @Override
+    public Map<String, Long> getTouristDestinationDetailStatics(String place) {
+        LocalDate now = LocalDate.now();
+        // 当天数据
+        String currentDayCount = touristAnalysisDao.getSpecDayCountOfPlace(place, now.toString());
+        // 当月数据
+        String currentMonthCount = touristAnalysisDao.getSpecDayCountOfPlace(place, now.getYear() + "-" + now.getMonthValue());
+        // 当年数据
+        String currentYearCount = touristAnalysisDao.getSpecDayCountOfPlace(place, now.getYear() + "");
+
+        Map<String, Long> param = new HashMap<>();
+
+        param.put("currentDayCount", new BigDecimal(currentDayCount).setScale(0).longValue());
+        param.put("currentMonthCount", new BigDecimal(currentMonthCount).setScale(0).longValue());
+        param.put("currentYearCount", new BigDecimal(currentYearCount).setScale(0).longValue());
+        return param;
+    }
+
+    @Override
+    public List<Map<String, String>> getTouristDestinationHistoryStatics(String place) {
+        LocalDate now = LocalDate.now();
+        List<Map<String, String>> result = new ArrayList<>();
+        for (int i = 6; i >= 0; i--) {
+            String dateStr = now.minusDays(i).toString();
+            String currentDayCount = touristAnalysisDao.getCurrentDayCountOfPlace(place, dateStr);
+            Map<String, String> param = new HashMap<>();
+            param.put("dateStr", dateStr);
+            param.put("value", new BigDecimal(currentDayCount).setScale(0).toString());
+            result.add(param);
+        }
+        return result;
+    }
+
+    @Override
+    public List<RealDataOfPeopleStreamVO> getRealDataOfPeopleStream(String place) {
+        return touristAnalysisDao.getRealDataOfPeopleStream(place);
+    }
+
+    @Override
+    public List<Travelye> getNumsStatisticsOfStopInNight() {
+        List<Travelye> travelyes = touristAnalysisDao.getNumsStatisticsOfStopInNightTop7();
+        LocalDate currentDay = LocalDate.now();
+        for (int i = 0; i < travelyes.size(); i++) {
+            travelyes.get(i).setDateT(currentDay.minusDays(i + 1).getDayOfMonth() + "");
+        }
+        Collections.reverse(travelyes);
+        return travelyes;
+    }
+
+    @Override
+    public List<TravelLast> getTimeLongOfStopInView(int limit) {
+        return touristAnalysisDao.getTimeLongOfStopInView(limit);
+    }
+
+    @Override
+    public List<StopSaturationStatistics> getStopSaturationStatistics() {
+        return touristAnalysisDao.getStopSaturationStatistics();
+    }
+
+    @Override
+    public String getStopSaturationRealData() {
+        return touristAnalysisDao.getStopSaturationRealData();
+    }
+
+    @Override
+    public ToiletRealData getToiletRealData(Long toiletId) {
+        return touristAnalysisDao.getToiletRealData(toiletId);
+    }
+
+    @Override
+    public List<ToiletRealData> getToilets() {
+        return touristAnalysisDao.getToilets();
+    }
+
+    @Override
+    public List<ToiletRealDatasVO> getToiletDataList() {
+        return touristAnalysisDao.getToiletDatas();
+    }
+
+    @Override
+    public SmartMarketingVO getTravelMarketingStatistics() {
+        List<TravelMarketingStatistics> datas = touristAnalysisDao.getTravelMarketingStatistics();
+        if (datas != null && datas.size() > 0) {
+            TravelMarketingStatistics first = datas.get(0);
+            SmartMarketingVO vo = new SmartMarketingVO();
+            vo.setCurrentYear(first.getYear().toString());
+            vo.setCurrentYearIncome(first.getIncome());
+            vo.setCurrentYearIncrease(first.getIncomeIncrease());
+
+            Collections.reverse(datas);
+            vo.setStatistics(datas);
+            return vo;
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public MyPageList<User> getPageListFromSmMessageByTime(String startTime, String endTime, Integer currentPage, Integer pageSize) {
+        return touristAnalysisDao.getPageListFromSmMessageByTime(startTime, endTime, currentPage, pageSize);
+    }
+
+    @Override
+    public List<Map<String, Object>> getPageSizeFromSmMessageByTime(String startTime, String endTime) {
+        return touristAnalysisDao.getPageSizeFromSmMessageByTime(startTime, endTime);
+    }
+
+    @Override
+    public TravelT getTravelRecordByDateStr(String dateStr,String place) {
+        return touristAnalysisDao.getTravelRecord(dateStr,place);
+    }
+
+    @Override
+    public void updateTravelT(TravelT travel) {
+        if (travel.getId() != null) {
+            // 更新
+            touristAnalysisDao.updateTravelT(travel);
+        } else {
+            // 新增
+            touristAnalysisDao.insertTravelT(travel);
+        }
+    }
+
+    @Override
+    public void updateTravelFrom(String form, Long count) {
+        TravelProvin provin = touristAnalysisDao.getTravelProvinRecordByProvince(form);
+        if (provin == null) {
+            provin = new TravelProvin();
+            provin.setProvince(form);
+            provin.setNum(Long.toString(count));
+        } else {
+            Long num = Long.valueOf(provin.getNum()).longValue() + count;
+            provin.setNum(num.toString());
+        }
+
+        if (provin.getId() != null) {
+            // 更新
+            touristAnalysisDao.updateTravelProvin(provin);
+        } else {
+            // 新增
+            touristAnalysisDao.insertTravelProvin(provin);
+        }
+    }
+
+    @Override
+    public void updateTravelGender(String gender, Long count) {
+        TravelGender genderRecord = touristAnalysisDao.getTravelGenderRecord(gender);
+        Long newValue = Long.valueOf(genderRecord.getNum()) + count;
+        genderRecord.setNum(newValue.toString());
+
+        touristAnalysisDao.updateTravelGender(genderRecord);
+    }
+
+    @Override
+    public void updateTravelAge(int selectId, Long count) {
+        try {
+            List<TravelAge> recordByAges = touristAnalysisDao.getTravelAgeRecords();
+            for (TravelAge travelAge:recordByAges) {
+                if (travelAge.getId().intValue() == selectId) {
+                    Long currentNum = Long.valueOf(travelAge.getNum()).longValue() + count;
+                    travelAge.setNum(currentNum.toString());
+                    break;
+                }
+            }
+
+            Long sum = recordByAges.stream().map(e -> Long.valueOf(e.getNum())).mapToLong(Long::longValue).sum();
+            for (TravelAge travelAge:recordByAges) {
+                Long currentNum = Long.valueOf(travelAge.getNum()).longValue();
+                double per = currentNum.doubleValue() / sum.doubleValue() * 100;
+                travelAge.setPer(decimalFormat.format(per) + "%");
+            }
+
+            touristAnalysisDao.updateTravelAges(recordByAges);
+        } catch (Exception e) {}
+    }
+
+
+    private List<Map<String, String>> getCountOfHours(LocalDateTime currentTime) {
+        LocalDate currentDay = LocalDate.of(currentTime.getYear(), currentTime.getMonth(), currentTime.getDayOfMonth());
+        List<Map<String, String>> param = new ArrayList<>();
+        for (int i = 11; i >= 0; i--) {
+            String dateTimeStr = dtf.format(currentTime.minusHours(i));
+            String nums = touristAnalysisDao.getTodayIntoHistoryStatistics(currentDay.toString(), dateTimeStr);
+            Map<String, String> map = new HashMap<>();
+            map.put("dateTimeStr", dateTimeStr);
+            map.put("value", new BigDecimal(nums).setScale(0).toString());
+            param.add(map);
+        }
+
+        return param;
+    }
+
+    public List<Province> queryPro(String code){
+        return touristAnalysisDao.queryPro(code);
+    }
+}

+ 21 - 0
bigData/src/com/happy/service/Impl/TownImplService.java

@@ -0,0 +1,21 @@
+package com.happy.service.Impl;
+
+
+import com.happy.Model.Town;
+import com.happy.dao.TownDao;
+import com.happy.service.TownService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("TownService")
+public class TownImplService implements TownService {
+
+    @Resource
+    public TownDao townDao;
+
+    public List<Town> queryTown(String town){
+        return townDao.queryTown(town);
+    }
+}

+ 55 - 0
bigData/src/com/happy/service/Impl/TravelImplService.java

@@ -0,0 +1,55 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.Travel.*;
+import com.happy.dao.TravelDao;
+import com.happy.service.TravelService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service("TravelService")
+public class TravelImplService implements TravelService {
+
+    @Resource
+    public TravelDao travelDao;
+
+    // 游客年龄分布
+    public int insertTravelAge(TravelAge travelAge){
+        return travelDao.insertTravelAge(travelAge);
+    };
+
+    // 游客性别分布
+    public int insertTravelGender(TravelGender travelGender){
+        return travelDao.insertTravelGender(travelGender);
+    };
+
+    // 游客滞留时长分析-----地点
+    public int insertTravelLast(TravelLast travelLast){
+        return travelDao.insertTravelLast(travelLast);
+    };
+
+    // 游客来源地统计
+    public int insertTravelProvin(TravelProvin travelProvin){
+        return travelDao.insertTravelProvin(travelProvin);
+    };
+
+    // 游客总量-----今日流入
+    public int insertTravelT(TravelT travelT){
+        return travelDao.insertTravelT(travelT);
+    };
+
+    // 游客出行方式分析
+    public int insertTravelTraff(TravelTraff travelTraff){
+        return travelDao.insertTravelTraff(travelTraff);
+    };
+
+    // 游客趋势走势----每点
+    public int insertTravelTrend(TravelTrend travelTrend){
+        return travelDao.insertTravelTrend(travelTrend);
+    };
+
+    // 过夜人数统计
+    public int insertTravelye(Travelye travelye){
+        return travelDao.insertTravelye(travelye);
+    };
+}

+ 0 - 0
bigData/src/com/happy/service/Impl/UserImplService.java


Some files were not shown because too many files changed in this diff