cuixubin 4 years ago
commit
a9077d97db
100 changed files with 40941 additions and 0 deletions
  1. 4 0
      .gitignore
  2. 36 0
      .project
  3. 27 0
      EMS_Weather.iml
  4. 3 0
      WebContent/META-INF/MANIFEST.MF
  5. 62 0
      WebContent/WEB-INF/web.xml
  6. 10 0
      WebContent/index.html
  7. BIN
      lib/alibaba-dingtalk-service-sdk-1.0.1.jar
  8. BIN
      lib/aopalliance-1.0.jar
  9. BIN
      lib/aspectjrt.jar
  10. BIN
      lib/aspectjweaver.jar
  11. BIN
      lib/c3p0-0.9.2.1.jar
  12. BIN
      lib/commons-codec-1.9.jar
  13. BIN
      lib/commons-fileupload-1.2.jar
  14. BIN
      lib/commons-logging-1.2.jar
  15. BIN
      lib/ehcache-core-2.4.3.jar
  16. BIN
      lib/ems_data.jar
  17. BIN
      lib/fastjson-1.2.47.jar
  18. BIN
      lib/fluent-hc-4.5.jar
  19. BIN
      lib/freemarker-2.3.21.jar
  20. BIN
      lib/hibernate-c3p0-4.2.12.Final.jar
  21. BIN
      lib/hibernate-ehcache-4.2.12.Final.jar
  22. BIN
      lib/httpclient-4.5.jar
  23. BIN
      lib/httpclient-cache-4.5.jar
  24. BIN
      lib/httpclient-win-4.5.jar
  25. BIN
      lib/httpcore-4.4.1.jar
  26. BIN
      lib/httpmime-4.5.jar
  27. BIN
      lib/jackson-annotations-2.2.0.jar
  28. BIN
      lib/jackson-core-2.2.0.jar
  29. BIN
      lib/jackson-databind-2.2.0.jar
  30. BIN
      lib/jackson-dataformat-xml-2.2.0.jar
  31. BIN
      lib/javacsv-2.0.jar
  32. BIN
      lib/jna-4.1.0.jar
  33. BIN
      lib/jna-platform-4.1.0.jar
  34. BIN
      lib/jsr311-api-1.1.1.jar
  35. BIN
      lib/log4j-1.2.16.jar
  36. BIN
      lib/mchange-commons-java-0.2.3.4.jar
  37. BIN
      lib/mysql-connector-java-5.1.13-bin.jar
  38. BIN
      lib/poi-3.11-20141221.jar
  39. BIN
      lib/poi-examples-3.11-20141221.jar
  40. BIN
      lib/poi-excelant-3.11-20141221.jar
  41. BIN
      lib/poi-ooxml-3.11-20141221.jar
  42. BIN
      lib/poi-ooxml-schemas-3.11-20141221.jar
  43. BIN
      lib/poi-scratchpad-3.11-20141221.jar
  44. BIN
      lib/slf4j-api-1.6.1.jar
  45. BIN
      lib/spring-aop-3.2.8.RELEASE.jar
  46. BIN
      lib/spring-aspects-3.2.8.RELEASE.jar
  47. BIN
      lib/spring-beans-3.2.8.RELEASE.jar
  48. BIN
      lib/spring-context-3.2.8.RELEASE.jar
  49. BIN
      lib/spring-context-support-3.2.8.RELEASE.jar
  50. BIN
      lib/spring-core-3.2.8.RELEASE.jar
  51. BIN
      lib/spring-expression-3.2.8.RELEASE.jar
  52. BIN
      lib/spring-framework-bom-3.2.8.RELEASE.jar
  53. BIN
      lib/spring-instrument-3.2.8.RELEASE.jar
  54. BIN
      lib/spring-instrument-tomcat-3.2.8.RELEASE.jar
  55. BIN
      lib/spring-jdbc-3.2.8.RELEASE.jar
  56. BIN
      lib/spring-jms-3.2.8.RELEASE.jar
  57. BIN
      lib/spring-orm-3.2.8.RELEASE.jar
  58. BIN
      lib/spring-oxm-3.2.8.RELEASE.jar
  59. BIN
      lib/spring-struts-3.2.8.RELEASE.jar
  60. BIN
      lib/spring-test-3.2.8.RELEASE.jar
  61. BIN
      lib/spring-tx-3.2.8.RELEASE.jar
  62. BIN
      lib/spring-web-3.2.8.RELEASE.jar
  63. BIN
      lib/spring-webmvc-3.2.8.RELEASE.jar
  64. BIN
      lib/spring-webmvc-portlet-3.2.8.RELEASE.jar
  65. BIN
      lib/xmlbeans-2.6.0.jar
  66. 38576 0
      resource/config/business/Geography.json
  67. BIN
      resource/config/business/WandaCityCodeName.xlsx
  68. BIN
      resource/config/business/cityList.xlsx
  69. BIN
      resource/config/business/cityListData.xlsx
  70. 14 0
      resource/config/business/longhuConfig.json
  71. 5 0
      resource/config/domain.json
  72. 23 0
      resource/config/log4j/log4j.properties
  73. 13 0
      resource/config/schema.json
  74. 78 0
      resource/config/spring/spring-base.xml
  75. 72 0
      resource/config/spring/spring-mvc.xml
  76. 27 0
      resource/config/system.properties
  77. 101 0
      resource/documentation.md
  78. 43 0
      src/com/framework/util/BeanUtils.java
  79. 622 0
      src/com/framework/util/DateUtils.java
  80. 20 0
      src/com/persagy/business/HelloWorld.java
  81. 50 0
      src/com/persagy/business/maintain/ConfigShow.java
  82. 52 0
      src/com/persagy/business/maintain/FileData2DB.java
  83. 110 0
      src/com/persagy/business/maintain/HourData2VersionTrans.java
  84. 51 0
      src/com/persagy/business/maintain/HourDataDelete.java
  85. 48 0
      src/com/persagy/business/maintain/HourDataRepair.java
  86. 53 0
      src/com/persagy/business/maintain/HourToDayAvgData.java
  87. 66 0
      src/com/persagy/business/maintain/HourToDayData.java
  88. 53 0
      src/com/persagy/business/maintain/HourToDayMaxData.java
  89. 169 0
      src/com/persagy/business/maintain/LonghuOldDataTransfer.java
  90. 149 0
      src/com/persagy/business/maintain/WRecord.java
  91. 5 0
      src/com/persagy/constant/ConstTime.java
  92. 34 0
      src/com/persagy/constant/EnumHolidayDayType.java
  93. 95 0
      src/com/persagy/constant/WeatherConstant.java
  94. 46 0
      src/com/persagy/dto/CityDataLogContent.java
  95. 38 0
      src/com/persagy/dto/CityDataLogItem.java
  96. 33 0
      src/com/persagy/dto/DayHolidayDTO.java
  97. 53 0
      src/com/persagy/dto/HistoryWeatherCityDTO.java
  98. 66 0
      src/com/persagy/dto/TempStatisticsDTO.java
  99. 34 0
      src/com/persagy/dto/WeatherDTO.java
  100. 0 0
      src/com/persagy/ems/pojo/TypicalWeather.java

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+/WebContent/WEB-INF/classes/
+/bin/
+/.settings/
+/.classpath

+ 36 - 0
.project

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>EMS_Weather</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+	</natures>
+</projectDescription>

+ 27 - 0
EMS_Weather.iml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="web" name="Web">
+      <configuration>
+        <descriptors>
+          <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/WebContent/WEB-INF/web.xml" />
+        </descriptors>
+        <webroots>
+          <root url="file://$MODULE_DIR$/WebContent" relative="/" />
+        </webroots>
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager">
+    <output url="file://$MODULE_DIR$/WebContent/WEB-INF/classes" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/resource" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="lib" level="project" />
+    <orderEntry type="library" name="jsp-api" level="project" />
+  </component>
+</module>

+ 3 - 0
WebContent/META-INF/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+

+ 62 - 0
WebContent/WEB-INF/web.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+  <display-name>EMS_Weather</display-name>
+  <!-- 加载Spring配置 -->
+	<context-param>
+		<param-name>contextConfigLocation</param-name>
+		<param-value>classpath:config/spring/spring-base.xml</param-value>
+	</context-param>
+
+	<!-- 加载Log4j配置 -->
+	<context-param>
+		<param-name>log4jConfigLocation</param-name>
+		<param-value>classpath:config/log4j/log4j.properties</param-value>
+	</context-param>
+
+	<!-- 启动Log4j -->
+	<listener>
+		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+	</listener>
+
+	<!-- 启动Spring -->
+	<listener>
+		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+	</listener>
+	
+	<!-- 系统初始化 -->
+	<servlet>
+		<servlet-name>SystemInitServlet</servlet-name>
+		<servlet-class>com.persagy.init.SystemInitServlet</servlet-class>
+		<load-on-startup>0</load-on-startup>
+	</servlet>
+
+	<!-- 解决乱码 -->
+	<filter>
+		<filter-name>CharacterEncodingFilter</filter-name>
+		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
+		<init-param>
+			<param-name>encoding</param-name>
+			<param-value>utf-8</param-value>
+		</init-param>
+	</filter>
+	<filter-mapping>
+		<filter-name>CharacterEncodingFilter</filter-name>
+		<url-pattern>/*</url-pattern>
+	</filter-mapping>
+	
+	<!-- Spring MVC -->
+	<servlet>
+		<servlet-name>SpringMVC</servlet-name>
+		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+		<init-param>
+			<param-name>contextConfigLocation</param-name>
+			<param-value>classpath:config/spring/spring-mvc.xml</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+
+	<servlet-mapping>
+		<servlet-name>SpringMVC</servlet-name>
+		<url-pattern>/Spring/MVC/*</url-pattern>
+	</servlet-mapping>
+</web-app>

+ 10 - 0
WebContent/index.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>hello</title>
+</head>
+<body style="background-color: black;">
+<img alt="天气图片" src="http://114.215.64.204:9092/EMS_Weather/Spring/MVC/entrance/download/icon/1-light-big">
+</body>
+</html>

BIN
lib/alibaba-dingtalk-service-sdk-1.0.1.jar


BIN
lib/aopalliance-1.0.jar


BIN
lib/aspectjrt.jar


BIN
lib/aspectjweaver.jar


BIN
lib/c3p0-0.9.2.1.jar


BIN
lib/commons-codec-1.9.jar


BIN
lib/commons-fileupload-1.2.jar


BIN
lib/commons-logging-1.2.jar


BIN
lib/ehcache-core-2.4.3.jar


BIN
lib/ems_data.jar


BIN
lib/fastjson-1.2.47.jar


BIN
lib/fluent-hc-4.5.jar


BIN
lib/freemarker-2.3.21.jar


BIN
lib/hibernate-c3p0-4.2.12.Final.jar


BIN
lib/hibernate-ehcache-4.2.12.Final.jar


BIN
lib/httpclient-4.5.jar


BIN
lib/httpclient-cache-4.5.jar


BIN
lib/httpclient-win-4.5.jar


BIN
lib/httpcore-4.4.1.jar


BIN
lib/httpmime-4.5.jar


BIN
lib/jackson-annotations-2.2.0.jar


BIN
lib/jackson-core-2.2.0.jar


BIN
lib/jackson-databind-2.2.0.jar


BIN
lib/jackson-dataformat-xml-2.2.0.jar


BIN
lib/javacsv-2.0.jar


BIN
lib/jna-4.1.0.jar


BIN
lib/jna-platform-4.1.0.jar


BIN
lib/jsr311-api-1.1.1.jar


BIN
lib/log4j-1.2.16.jar


BIN
lib/mchange-commons-java-0.2.3.4.jar


BIN
lib/mysql-connector-java-5.1.13-bin.jar


BIN
lib/poi-3.11-20141221.jar


BIN
lib/poi-examples-3.11-20141221.jar


BIN
lib/poi-excelant-3.11-20141221.jar


BIN
lib/poi-ooxml-3.11-20141221.jar


BIN
lib/poi-ooxml-schemas-3.11-20141221.jar


BIN
lib/poi-scratchpad-3.11-20141221.jar


BIN
lib/slf4j-api-1.6.1.jar


BIN
lib/spring-aop-3.2.8.RELEASE.jar


BIN
lib/spring-aspects-3.2.8.RELEASE.jar


BIN
lib/spring-beans-3.2.8.RELEASE.jar


BIN
lib/spring-context-3.2.8.RELEASE.jar


BIN
lib/spring-context-support-3.2.8.RELEASE.jar


BIN
lib/spring-core-3.2.8.RELEASE.jar


BIN
lib/spring-expression-3.2.8.RELEASE.jar


BIN
lib/spring-framework-bom-3.2.8.RELEASE.jar


BIN
lib/spring-instrument-3.2.8.RELEASE.jar


BIN
lib/spring-instrument-tomcat-3.2.8.RELEASE.jar


BIN
lib/spring-jdbc-3.2.8.RELEASE.jar


BIN
lib/spring-jms-3.2.8.RELEASE.jar


BIN
lib/spring-orm-3.2.8.RELEASE.jar


BIN
lib/spring-oxm-3.2.8.RELEASE.jar


BIN
lib/spring-struts-3.2.8.RELEASE.jar


BIN
lib/spring-test-3.2.8.RELEASE.jar


BIN
lib/spring-tx-3.2.8.RELEASE.jar


BIN
lib/spring-web-3.2.8.RELEASE.jar


BIN
lib/spring-webmvc-3.2.8.RELEASE.jar


BIN
lib/spring-webmvc-portlet-3.2.8.RELEASE.jar


BIN
lib/xmlbeans-2.6.0.jar


File diff suppressed because it is too large
+ 38576 - 0
resource/config/business/Geography.json


BIN
resource/config/business/WandaCityCodeName.xlsx


BIN
resource/config/business/cityList.xlsx


BIN
resource/config/business/cityListData.xlsx


+ 14 - 0
resource/config/business/longhuConfig.json

@@ -0,0 +1,14 @@
+{
+	"北京":"WX4FBXXFKE4F",
+	"北京朝阳":"WX4G17JWZEK7",
+	"佛山":"WS06YNEMPP18",
+	"成都":"WM6N2PM3WY2K",
+	"上海":"WTW3SJ5ZBJUY",
+	"青岛":"WWMT5Q64CR3G",
+	"沈阳":"WXRVB9QYXKY8",
+	"西安":"WQJ6YY8MHZP0",
+	"长沙":"WT027GXDDZVH",
+	"济南":"WWE0TGW4PX6N",
+	"南京":"WTSQQYHVQ973",
+	"武汉":"WT3Q0FW9ZJ3Q"
+}

+ 5 - 0
resource/config/domain.json

@@ -0,0 +1,5 @@
+{
+	"symbol": "PersagyCloud",
+	"domain": "192.168.100.3:55555",
+	"context": "EMS_Cloud"
+}

+ 23 - 0
resource/config/log4j/log4j.properties

@@ -0,0 +1,23 @@
+log4j.rootLogger=INFO,ConsoleAppender,RollingLogFileAppender
+
+## class setting
+log4j.logger.org.springframework=INFO
+log4j.logger.org.apache.axis=INFO
+log4j.logger.org.apache.cxf=INFO
+log4j.logger.com.mchange.v2=INFO
+
+log4j.appender.RollingLogFileAppender=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.RollingLogFileAppender.Threshold=INFO
+log4j.appender.RollingLogFileAppender.ImmediateFlush=true
+log4j.appender.RollingLogFileAppender.File=../logs/EMS_Weather_2020_Monitor/log.log
+log4j.appender.RollingLogFileAppender.DatePattern=yyyy-MM-dd'.log'
+log4j.appender.RollingLogFileAppender.Append=true
+log4j.appender.RollingLogFileAppender.layout=org.apache.log4j.PatternLayout
+log4j.appender.RollingLogFileAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %m%n
+
+log4j.appender.ConsoleAppender=org.apache.log4j.ConsoleAppender
+log4j.appender.ConsoleAppender.Threshold=INFO
+log4j.appender.ConsoleAppender.ImmediateFlush=true
+log4j.appender.ConsoleAppender.Target=System.out
+log4j.appender.ConsoleAppender.layout=org.apache.log4j.PatternLayout
+log4j.appender.ConsoleAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} %m%n

+ 13 - 0
resource/config/schema.json

@@ -0,0 +1,13 @@
+{
+    "ems": "persagy_weather",
+    "udm": "weather_ems",
+    "emsvdata": "yun_emsvdata",
+    "objectdata": "yun_objectdata",
+    "meterdata": "yun_meterdata",
+    "originaldata": "yun_originaldata",
+    "servicedata": "yun_servicedata",
+    "energyundata": "yun_energyundata",
+    "tenementdata": "yun_tenementdata",
+    "tenant": "yun_tenant",
+    "workflow": "yun_workflow"
+}

+ 78 - 0
resource/config/spring/spring-base.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
+	xmlns:cache="http://www.springframework.org/schema/cache" xmlns:aop="http://www.springframework.org/schema/aop"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans     
+	http://www.springframework.org/schema/beans/spring-beans-3.2.xsd    
+	http://www.springframework.org/schema/context    
+	http://www.springframework.org/schema/context/spring-context-3.2.xsd    
+	http://www.springframework.org/schema/tx
+    http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
+    http://www.springframework.org/schema/cache
+    http://www.springframework.org/schema/cache/spring-cache.xsd
+    http://www.springframework.org/schema/aop
+    http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
+    ">
+
+	<!-- spring3 @value 特性加载属性文件内容 -->
+	<context:property-placeholder location="classpath:config/system.properties" />
+	<!-- 使用spring注解 -->
+	<context:annotation-config />
+	<!-- spring扫描目录 -->
+	<context:component-scan base-package="com.persagy">
+		<!-- 不包括@Controller -->
+		<context:exclude-filter type="annotation"
+			expression="org.springframework.stereotype.Controller" />
+	</context:component-scan>
+	<!-- 切面编程 -->
+	<aop:aspectj-autoproxy />
+
+	<!-- 数据库连接池 -->
+	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
+		destroy-method="close">
+		<!-- 数据库驱动 -->
+		<property name="driverClass" value="${jdbc.driverClass}" />
+		<!-- 数据库连接串 -->
+		<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />
+		<!-- 用户名 -->
+		<property name="user" value="${jdbc.user}" />
+		<!-- 密码 -->
+		<property name="password" value="${jdbc.password}" />
+		<!-- 连接池维持连接数最小值 -->
+		<property name="minPoolSize" value="${jdbc.miniPoolSize}" />
+		<!-- 连接池维持链接数最大值 -->
+		<property name="maxPoolSize" value="${jdbc.maxPoolSize}" />
+		<!-- 连接池初始化链接数 -->
+		<property name="initialPoolSize" value="${jdbc.initialPoolSize}" />
+		<!-- 最大空闲时间,设置秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
+		<property name="maxIdleTime" value="${jdbc.maxIdleTime}" />
+		<!-- 当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
+		<property name="acquireIncrement" value="${jdbc.acquireIncrement}" />
+		<!-- 定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
+		<property name="acquireRetryAttempts" value="${jdbc.acquireRetryAttempts}" />
+		<!-- 两次连接中间隔时间,单位毫秒。Default: 1000 -->
+		<property name="acquireRetryDelay" value="${jdbc.acquireRetryDelay}" />
+		<!-- 如果设为true那么在取得连接的同时将校验连接的有效性。Default: false -->
+		<property name="testConnectionOnCheckin" value="${jdbc.testConnectionOnCheckin}" />
+		<!-- c3p0将建一张名为设置表名的空表,并使用其自带的查询语句进行测试。Default: null -->
+		<property name="automaticTestTable" value="${jdbc.automaticTestTable}" />
+		<!--每设置秒检查所有连接池中的空闲连接。Default: 0 -->
+		<property name="idleConnectionTestPeriod" value="${jdbc.idleConnectionTestPeriod}" />
+		<!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出SQLException,如设为0则无限期等待。单位毫秒。Default: 
+			0 -->
+		<property name="checkoutTimeout" value="${jdbc.checkoutTimeout}" />
+	</bean>
+
+	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+		<property name="dataSource" ref="dataSource" />
+	</bean>
+
+	<bean id="transactionManager"
+		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+		<property name="dataSource" ref="dataSource" />
+	</bean>
+
+	<tx:annotation-driven transaction-manager="transactionManager" />
+
+</beans>	

+ 72 - 0
resource/config/spring/spring-mvc.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans     
+	http://www.springframework.org/schema/beans/spring-beans-3.2.xsd    
+	http://www.springframework.org/schema/context    
+	http://www.springframework.org/schema/context/spring-context-3.2.xsd    
+	http://www.springframework.org/schema/mvc  
+    http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
+    ">
+
+	<!-- Spring MVC 扫描目录 -->
+	<context:component-scan base-package="com.persagy.web.controller">
+		<!-- 只包括@Controller -->
+		<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
+	</context:component-scan>
+
+	<!-- 文件上传解析器 -->
+	<bean id="multipartResolver"
+		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
+		<!-- 表示用来解析request请求的默认编码格式,当没有指定的时候根据Servlet规范会使用默认值ISO-8859-1。当request自己指明了它的编码格式的时候就会忽略这里指定的defaultEncoding -->
+		<property name="defaultEncoding" value="UTF-8" />
+		<!-- 设置上传文件时的临时目录,默认是Servlet容器的临时目录。 -->
+		<!--<property name="uploadTempDir" value=""/> -->
+		<!-- 设置允许上传的最大文件大小,以字节为单位计算。当设为-1时表示无限制,默认是-1。 -->
+		<property name="maxUploadSize" value="-1" />
+		<!-- 设置在文件上传时允许写到内存中的最大值,以字节为单位计算,默认是10240。 -->
+		<!--<property name="maxInMemorySize" value="200000"/> -->
+	</bean>
+
+	<bean id="mappingJackson2HttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
+		<property name="objectMapper" ref="objectMapper"></property>
+		<property name="supportedMediaTypes">
+			<list>
+				<value>application/json;charset=UTF-8</value>
+				<value>text/html;charset=UTF-8</value><!-- 避免IE出现下载JSON文件的情况 -->
+			</list>
+		</property>
+	</bean>
+
+	<!-- 二进制数据 -->
+	<bean id="byteArrayHttpMessageConverter" class="org.springframework.http.converter.ByteArrayHttpMessageConverter">
+	</bean>
+
+	<!-- 文本数据 -->
+	<bean id="stringHttpMessageConverter" class="org.springframework.http.converter.StringHttpMessageConverter">
+		<!--避免出现乱码 -->
+		<constructor-arg value="UTF-8" index="0"></constructor-arg>
+		<property name="supportedMediaTypes">
+			<list>
+				<value>text/plain;charset=UTF-8</value>
+				<value>text/html;charset=UTF-8</value>
+			</list>
+		</property>
+	</bean>
+
+	<mvc:annotation-driven>
+		<mvc:message-converters>
+			<ref bean="stringHttpMessageConverter" />
+			<ref bean="byteArrayHttpMessageConverter" />
+			<ref bean="mappingJackson2HttpMessageConverter" />
+		</mvc:message-converters>
+	</mvc:annotation-driven>
+
+	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+		<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
+		<property name="prefix" value="/WEB-INF/jsp/" />
+		<property name="suffix" value=".jsp" />
+	</bean>
+
+</beans>

+ 27 - 0
resource/config/system.properties

@@ -0,0 +1,27 @@
+######################### database setting ########################
+jdbc.driverClass=com.mysql.jdbc.Driver
+#jdbc.jdbcUrl=jdbc\:mysql\://127.0.0.1\:3306/test?useUnicode=true&characterEncoding=utf-8
+jdbc.jdbcUrl=jdbc\:mysql\://114.215.64.204\:3306/test?useUnicode=true&characterEncoding=utf-8
+#jdbc.user=root
+#jdbc.password=root
+jdbc.user=pbsage
+jdbc.password=Persagy_!@#2019
+jdbc.miniPoolSize=50
+jdbc.maxPoolSize=300
+jdbc.initialPoolSize=50
+jdbc.maxIdleTime=7200
+jdbc.acquireIncrement=10
+jdbc.acquireRetryAttempts=10
+jdbc.acquireRetryDelay=1000
+jdbc.testConnectionOnCheckin=true
+jdbc.automaticTestTable=c3p0TestTable
+jdbc.idleConnectionTestPeriod=3600
+jdbc.checkoutTimeout=10000
+######################### system parameter #########################
+system.printSql=false
+system.repairTable=false
+system.cacheInMemory=100
+######################## file parameter ############################
+file.storage.directory=D:/develop/file
+######################## thread run set ############################
+thread.model=false

+ 101 - 0
resource/documentation.md

@@ -0,0 +1,101 @@
+# 说明
+本天气服务(EMS_Weather),以购买的第三方天气数据服务商(心知天气,https://www.seniverse.com/)的接口为数据源,通过a转发请求,b定时任务将数据存库两种方式来获取天气数据,并提供相关查询接口;
+## 天气数据说明
+### 单位
+接口返回数据默认单位说明:
+
+- 温度(体感温度),c,摄氏度
+- 相对湿度,数值在0~100之间,是百分比数值
+- 气压,mbar,百帕
+- 能见度,km,千米
+- 风向角度,数值在0~360,0为正北,90为正东,180为正南
+- 风速,km/h,千米每小时
+- 风力等级,数值>=0,无单位,数值越大风力越大
+- 降水量,mm,毫米
+- aqi,数值,无单位
+- pm25,1小时平均值。单位:μg/m³
+- pm10,1小时平均值。单位:μg/m³
+- so2,1小时平均值。单位:μg/m³
+- no2,1小时平均值。单位:μg/m³
+- co,1小时平均值。单位:mg/m³
+- o3,1小时平均值。单位:mg/m³
+
+### 空气质量枚举值
+"优"、"良"、"轻度污染"、"中度污染"、"重度污染"、"严重污染"
+
+### 天气现象编码与天气气象文字枚举值
+    {
+    	"0": "晴",
+    	"1": "晴",
+    	"2": "晴",
+    	"3": "晴",
+    	"4": "多云",
+    	"5": "晴间多云",
+    	"6": "晴间多云",
+    	"7": "大部多云",
+    	"8": "大部多云",
+    	"9": "阴",
+    	"10": "阵雨",
+    	"11": "雷阵雨",
+    	"12": "雷阵雨伴有冰雹",
+    	"13": "小雨",
+    	"14": "中雨",
+    	"15": "大雨",
+    	"16": "暴雨",
+    	"17": "大暴雨",
+    	"18": "特大暴雨",
+    	"19": "冻雨",
+    	"20": "雨夹雪",
+    	"21": "阵雪",
+    	"22": "小雪",
+    	"23": "中雪",
+    	"24": "大雪",
+    	"25": "暴雪",
+    	"26": "浮尘",
+    	"27": "扬沙",
+    	"28": "沙尘暴",
+    	"29": "强沙尘暴",
+    	"30": "雾",
+    	"31": "霾",
+    	"32": "风",
+    	"33": "大风",
+    	"34": "飓风",
+    	"35": "热带风暴",
+    	"36": "龙卷风",
+    	"37": "冷",
+    	"38": "热",
+    	"99": "未知"
+    }
+
+### 灾害预警
+- 类型:["台风", "暴雨", "暴雪", "寒潮", "大风", "沙尘暴", "高温", "干旱", "雷电", "冰雹", "霜冻", "大雾", "道路结冰", "雷雨大风"]
+- 灾害级别:["白色", "蓝色", "黄色", "橙色", "红色"]
+
+## 支持的气象指标
+
+### 小时级别数据
+温度、体感温度、相对湿度、气压、能见度、气象文字、风向、风向角风速、风力等级、空气质量、云量、pm25、pm10、so2、no2、co、o3
+
+### 日级别数据
+- 日概况数据:最高温、最低温、白天气象文字、夜晚气象文字、风力等级、风向、风速、降水量
+- 统计数据:以下指标的最大最小值以及均值,[温度, 相对湿度, 风速, 气压, 能见度]
+
+### 灾害预警数据
+16种灾害类型:台风, 暴雨, 暴雪, 寒潮, 大风, 沙尘暴, 高温, 干旱, 雷电, 冰雹, 霜冻, 大雾, 道路结冰, 雷雨  大风
+
+## 数据类型(按时间划分)
+### 24小时预报
+温度、相对湿度、能见度、气象文字、气象代码、风向、风速
+
+### 14日预报
+最高/低温、相对湿度、白天气象文字/代码、夜晚气象文字/代码、风向文字、风向角、风速、风力等级、降水量
+
+### 小时数据历史记录(最早2017.01.01开始)
+温度、相对湿度、气象文字、气压、能见度、风向文字、风速、风向角风速、风力等级、(2020.07.01之前不包含以下指标)体感温度、空气质量、云量、pm25、pm10、so2、no2、co、o3
+
+### 日历史数据(最早2017.01.01开始)
+[温度, 相对湿度, 风速, 气压, 能见度]的最大(最小,平均)值、白天\夜晚气象文字、风向文字、风速、风向角风速、风力等级、(2020.07.01之前不包含以下指标)白天夜晚\气象代码、降雨量
+
+## 支持城市
+- 小时级数据和日统计数据支持1189个城市地区(涵盖全国所有一、二、三、四、五线城市的市级,市属区级)
+- 日天气数据和灾害预警数据支持3000+个城市地区(几乎涵盖全国所有地区)

+ 43 - 0
src/com/framework/util/BeanUtils.java

@@ -0,0 +1,43 @@
+package com.framework.util;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+public class BeanUtils {
+
+	/**
+	 * 通过get、set方法复制类属性,不复制为值null的属性
+	 * @param fromObj
+	 * @param toObj
+	 * @throws Exception
+	 */
+	public static void copyBean(Object fromObj, Object toObj) throws Exception{
+		Map<String, Object> mname_value = new HashMap<>();
+		Map<String, Class> mname_Type = new HashMap<>();
+		
+		
+		for(Method m : fromObj.getClass().getDeclaredMethods()) {
+			String mname = m.getName();
+			if(mname.startsWith("get") && m.getParameterTypes().length == 0) {
+				mname = "set" + mname.substring(3);
+				Object value = m.invoke(fromObj);
+				if(value != null) {
+					mname_value.put(mname, value);
+					mname_Type.put(mname, value.getClass());
+				}
+			}
+		}
+		
+		if(!mname_value.isEmpty()) {
+			Class toClass = toObj.getClass();
+			for(String setName : mname_value.keySet()) {
+				Method m = toClass.getDeclaredMethod(setName, mname_Type.get(setName));
+				if(m != null) {
+					m.invoke(toObj, mname_value.get(setName));
+				}
+			}
+		}
+	}
+	
+}

+ 622 - 0
src/com/framework/util/DateUtils.java

@@ -0,0 +1,622 @@
+package com.framework.util;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ * 时间相关的工具类
+ */
+public class DateUtils {
+	public static final String SECOND = "0";
+	public static final String MINUTE = "1";
+	public static final String HOUR = "2";
+	public static final String DAY = "3";
+	public static final String MONTH = "4";
+	public static final String YEAR = "5";
+	public static final String SDF_SECOND = "yyyy-MM-dd HH:mm:ss";
+	public static final String SDF_MINUTE = "yyyy-MM-dd HH:mm";
+	public static final String SDF_HOUR = "yyyy-MM-dd HH";
+	public static final String SDF_DAY = "yyyy-MM-dd";
+	public static final String SDFDAY = "yyyyMMdd";
+	public static final String SDF_DOT_DAY = "yyyy.MM.dd";
+	public static final String SDFDAY2 = "yyyy.MM.dd";
+	public static final String SDFSECOND = "yyyyMMddHHmmss";
+	public static final String SDF_MONTH = "yyyy-MM-01";
+	public static final String SDF_DOT_MONTH = "yyyy.MM";
+	public static final String SDFMONTH2 = "yyyy.MM";
+	public static final String SDF_YEAR = "yyyy-01-01";
+	public static final String SDF_ONLY_HOUR_MINUTE = "HH:mm";
+
+	public static final String SDF_DOT_SECOND = "yyyy-MM-dd'T'HH:mm:ss";
+	
+	public static void main(String[] args) throws Exception {
+		Date endDate = str2Date("2017-1-1 13:00:00", "yyyy-MM-dd HH:mm:ss");
+		System.out.println(endDate);
+	}
+	/**
+	 * 将 yyyy-MM-ddTHH:mm:ss+08:00格式的时间字符串转换为日期对象
+	 * @param dataStr
+	 * @return java.util.Date
+	 * @throws Exception
+	 */
+	public static Date t8DateStr2Date(String dataStr) throws Exception {
+		return str2Date(dataStr, "yyyy-MM-dd'T'HH:mm:ss+08:00");
+	}
+	
+	/**
+	 * 日期抹去零头
+	 * @param date
+	 * @param type 1精确到分钟;2精确到小时...5精确到年
+	 * @return
+	 * @throws Exception
+	 */
+	public static Date getShortDate(Date date, int type) throws Exception {
+		String dateStr = null;
+		Date dateR = null;
+		switch (type) {
+		case 1:
+			dateStr = date2Str(date, SDF_MINUTE);
+			dateR = str2Date(dateStr, SDF_MINUTE);
+			break;
+		case 2:
+			dateStr = date2Str(date, SDF_HOUR);
+			dateR = str2Date(dateStr, SDF_HOUR);
+			break;
+		case 3:
+			dateStr = date2Str(date, SDF_DAY);
+			dateR = str2Date(dateStr, SDF_DAY);
+			break;
+		case 4:
+			dateStr = date2Str(date, SDFMONTH2);
+			dateR = str2Date(dateStr, SDFMONTH2);
+			break;
+		case 5:
+			dateStr = date2Str(date, SDF_YEAR);
+			dateR = str2Date(dateStr, SDF_YEAR);
+			break;
+		default:
+			dateR = date;
+		}
+		
+		return dateR;
+	}
+	
+	/**
+	 * 将pattern格式的字符串日期转换为Date类型日期
+	 * @param source pattern格式的字符串日期
+	 * @param pattern 日期格式如yyyy-MM-dd HH:mm:ss
+	 * @return
+	 * @throws Exception
+	 */
+	public static Date str2Date(String source, String pattern) throws Exception {
+		SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+		return sdf.parse(source);
+	}
+	
+	/**
+	 * Description:返回两个日期间相差多少天 
+	 * @param start
+	 * @param end
+	 * @return Integer
+	 * @author cuixubin
+	 * @since 2018年9月18日: 下午12:12:38
+	 * Update By cuixubin 2018年9月18日: 下午12:12:38
+	 */
+	public static Integer getDayNum(Date start, Date end) {
+		if(null == start || end == null) {
+			return null;
+		}
+		
+		if(start.getTime() == end.getTime()) {
+			return 0;
+		}
+		
+		int num = 0;
+		Date temp = start.before(end) ? start : end;
+		Date endDate = start.before(end) ? end : start;
+		while(temp.before(endDate)) {
+			num ++;
+			temp = getDayOff(temp, 1);
+		}
+		return num;
+	}
+	
+	/**
+	 * 将Date类型的日期转换成pattern格式的字符串日期
+	 * @param date
+	 * @param pattern
+	 * @return
+	 * @throws Exception
+	 */
+	public static String date2Str(Date date, String pattern) throws Exception {
+		SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+		return sdf.format(date);
+	}
+	 
+	/**
+	 * 获取时间按年偏移offset个单位后的时间
+	 * @param date
+	 * @param offset
+	 * @return
+	 */
+	public static Date getYearOff(Date date, int offset) {
+		return getOffset(date, offset, 5);
+	}
+	/**
+	 * 获取时间按月偏移offset个单位后的时间
+	 * @param date
+	 * @param offset
+	 * @return
+	 */
+	public static Date getMonthOff(Date date, int offset) {
+		return getOffset(date, offset, 4);
+	}
+	/**
+	 * 获取时间按日偏移offset个单位后的时间
+	 * @param date
+	 * @param offset
+	 * @return
+	 */
+	public static Date getDayOff(Date date, int offset) {
+		return getOffset(date, offset, 2);
+	}
+	/**
+	 * 获取时间按周偏移offset个单位后的时间
+	 * @param date
+	 * @param offset
+	 * @return
+	 */
+	public static Date getWeekOff(Date date, int offset) {
+		return getOffset(date, offset, 3);
+	}
+	/**
+	 * 获取时间按小时偏移offset个单位后的时间
+	 * @param date
+	 * @param offset
+	 * @return
+	 */
+	public static Date getHourOff(Date date, int offset) {
+		return getOffset(date, offset, 1);
+	}
+
+	/**
+	 * description 获取时间按分钟偏移offset个单位后的时间
+	 * @param date
+	 * @param offset
+	 * @return java.util.Date
+	 * @author feng
+	 * @since 18:51 2018/12/10
+	 */
+	public static Date getMinuteOff(Date date, int offset) {
+		return getOffset(date, offset, 0);
+	}
+	
+	
+	/**
+	 * 获取指定时间粒度偏移量偏移后的时间
+	 * @param date 
+	 * @param offset int 偏移量
+	 * @param type int 时间粒度0-分,1-时,2-天,3-周,4-月,5-年
+	 * @return
+	 */
+	private static Date getOffset(Date date, int offset, int type) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(date);
+		switch (type) {
+		case 0:
+			cal.add(Calendar.MINUTE, offset);
+			break;
+		case 1:
+			cal.add(Calendar.HOUR_OF_DAY, offset);
+			break;
+		case 2:
+			cal.add(Calendar.DAY_OF_MONTH, offset);
+			break;
+		case 3:
+			cal.add(Calendar.DAY_OF_MONTH, offset * 7);
+			break;
+		case 4:
+			cal.add(Calendar.MONTH, offset);
+			break;
+		case 5:
+			cal.add(Calendar.YEAR, offset);
+			break;
+		default:
+			break;
+		}
+		return cal.getTime();
+	}
+	
+	/**
+	 * 得到某月最后一天的结束时间 即2017-01-31 23:59:59.999
+	 * @param date 时间参数
+	 * @return
+	 */
+	public static Date getLastDayOfMonth(Date date) {
+		Calendar c = Calendar.getInstance();
+		c.setTime(date);
+		int year = c.get(Calendar.YEAR);
+		int month = c.get(Calendar.MONTH);
+		c.set(Calendar.HOUR_OF_DAY, 23);
+		c.set(Calendar.DAY_OF_MONTH, 1);
+		c.set(Calendar.MINUTE, 59);
+		c.set(Calendar.SECOND, 59);
+		c.set(Calendar.MILLISECOND, 999);
+		c.set(Calendar.YEAR, year);
+		c.set(Calendar.MONTH, month);
+		// 月加1,日减1 得到当前月最后1天
+		c.add(Calendar.MONTH, 1);
+		c.add(Calendar.DAY_OF_YEAR, -1);
+		return c.getTime();
+	}
+
+	/**
+	 * 获取某一时间所在月某月第一天的开始时间 即2017-01-01 00:00:00.000
+	 * @param date 时间参数
+	 * @return
+	 */
+	public static Date getFirstDayOfMonth(Date date) {
+		Calendar c = Calendar.getInstance();
+		c.setTime(date);
+		int year = c.get(Calendar.YEAR);
+		int month = c.get(Calendar.MONTH);
+		c.set(Calendar.HOUR_OF_DAY, 0);
+		c.set(Calendar.DAY_OF_MONTH, 1);
+		c.set(Calendar.MINUTE, 0);
+		c.set(Calendar.SECOND, 0);
+		c.set(Calendar.MILLISECOND, 0);
+		c.set(Calendar.YEAR, year);
+		c.set(Calendar.MONTH, month);
+		return c.getTime();
+	}
+	
+	/**
+	 * 获取某一天的开始时间 即2017-01-01 00:00:00
+	 * @param date 时间参数
+	 * @return
+	 * @throws ParseException 
+	 */
+	public static Date getStartTimeOfDay(Date date) throws ParseException {
+		Calendar c = Calendar.getInstance();
+		c.setTime(date);
+		int year = c.get(Calendar.YEAR);
+		int month = c.get(Calendar.MONTH);
+		int day = c.get(Calendar.DAY_OF_MONTH);
+		c.set(Calendar.HOUR_OF_DAY, 0);
+		c.set(Calendar.MINUTE, 0);
+		c.set(Calendar.SECOND, 0);
+		c.set(Calendar.MILLISECOND, 0);
+		c.set(Calendar.DAY_OF_MONTH, day);
+		c.set(Calendar.YEAR, year);
+		c.set(Calendar.MONTH, month);
+		return c.getTime();
+	}
+	
+	/**
+	 * 获取某一天的开始时间 即2017-01-01 00:00:00
+	 * @param date 时间参数
+	 * @return
+	 * @throws ParseException 
+	 */
+	public static String getStartTimeOfDayStr(Date date) throws ParseException {
+		if (date == null) {
+			return null;
+		}
+		SimpleDateFormat sdfDay = new SimpleDateFormat(SDF_DAY);
+		return sdfDay.format(getStartTimeOfDay(date));
+	}
+	
+	/**
+	 * endDate比beginDate多的天数
+	 * 
+	 * @param beginDate
+	 * @param endDate
+	 * @return
+	 */
+	public static int differentDays(Date beginDate, Date endDate) {
+		Calendar cal1 = Calendar.getInstance();
+		cal1.setTime(beginDate);
+		Calendar cal2 = Calendar.getInstance();
+		cal2.setTime(endDate);
+		int day1 = cal1.get(Calendar.DAY_OF_YEAR);
+		int day2 = cal2.get(Calendar.DAY_OF_YEAR);
+		int year1 = cal1.get(Calendar.YEAR);
+		int year2 = cal2.get(Calendar.YEAR);
+		if (year1 != year2) {
+			int timeDistance = 0;
+			for (int i = year1; i < year2; i++) {
+				// 闰年
+				if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
+					timeDistance += 366;
+				} else {
+					timeDistance += 365;
+				}
+			}
+			return timeDistance + (day2 - day1);
+		} else {
+			return day2 - day1;
+		}
+	}
+	
+	/**
+	 * 获取周几(周一为1,周二为2,周日为7)
+	 * @param date
+	 * @return
+	 */
+	public static int getDayOfWeek(Date date) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		int day = calendar.get(Calendar.DAY_OF_WEEK);
+		if (day > 1) {
+			day = day - 1;
+		} else {
+			day = 7;
+		}
+		return day;
+	}
+	
+	/**
+	 * 获取月份
+	 * @param date
+	 * @return
+	 */
+	public static int getMonthOfYear(Date date) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		int month = calendar.get(Calendar.MONTH);
+		return month + 1;
+	}
+	/**
+	 * 获取年份
+	 * @param date
+	 * @return
+	 */
+	public static int getYear(Date date) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		int year = calendar.get(Calendar.YEAR);
+		return year;
+	}
+	
+	/**
+	 * 返回小时 0~23
+	 * @param date
+	 * @return
+	 */
+	public static int getHour(Date date){
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		int hour = calendar.get(Calendar.HOUR_OF_DAY);
+		return hour;
+	}
+	
+	/**
+	 * Description: 返回0-59
+	 * @param date
+	 * @return int
+	 * @author cuixubin
+	 * @since 2018年12月18日: 下午6:29:43
+	 */
+	public static int getMinute(Date date) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		int minute = calendar.get(Calendar.MINUTE);
+		return minute;
+	}
+	/**
+	 * 获取某一月的总天数
+	 * @param date
+	 * @return
+	 */
+	public static int getTotalDaysOfMonth(Date date){
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
+	}
+	
+	/**
+	 * 获得本周星期一的日期
+	 * @param time
+	 * @return
+	 */
+	public static Date getCurrentMonday(Date time) {
+		int mondayPlus = 0;
+		Calendar cd = Calendar.getInstance();
+		cd.setTime(time);
+		// 获得今天是一周的第几天,星期日是第一天,星期二是第二天......
+		int dayOfWeek = cd.get(Calendar.DAY_OF_WEEK);
+		if (dayOfWeek == 1) {
+			mondayPlus = -6;
+		} else {
+			mondayPlus = 2 - dayOfWeek;
+		}
+		GregorianCalendar currentDate = new GregorianCalendar();
+		currentDate.add(GregorianCalendar.DATE, mondayPlus);
+		Date monday = currentDate.getTime();
+		return monday;
+	}
+	
+	/**
+	 * 返回同一年中两个时间点相差的天数,两个时间点若不是同一年则返回0
+	 * @param fromDate
+	 * @param toDate
+	 * @return
+	 */
+	public static int dayNumber(Date fromDate, Date toDate) {
+		int num = 0;
+		if(fromDate.after(toDate)) {
+			Date temp = fromDate;
+			fromDate = toDate;
+			toDate = temp;
+		}
+		
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(fromDate);
+		Calendar cal2 = Calendar.getInstance();
+		cal2.setTime(toDate);
+		
+		
+		if(cal.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)) {
+			num = cal2.get(Calendar.DAY_OF_YEAR) - cal.get(Calendar.DAY_OF_YEAR);
+		}
+		
+		return num;
+	}
+	
+	/**
+	 * 获取某月的第几天 如month="2017-11-23 00:00:00",返回23
+	 * @param month
+	 * @return
+	 */
+	public static int getDayOfMonth(Date month) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(month);
+		return cal.get(Calendar.DAY_OF_MONTH);
+	}
+	
+	/**
+	 * 判断某一时间所在年是否为润年
+	 * @param date
+	 * @return
+	 */
+	public static boolean ifRunYear(Date date) {
+		int year = getYear(date);
+		if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+	
+	/**
+	 * 获取日期所在周为本年第几周
+	 * @param date
+	 * @return
+	 */
+	public static int getWeekNum(Date date) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(date);
+		return cal.get(Calendar.WEEK_OF_YEAR);
+	}
+	
+	public static Date getWeekStart(Date date, int weekNumOfYear) {
+		Calendar cal = Calendar.getInstance();
+		cal.set(Calendar.WEEK_OF_YEAR, weekNumOfYear);
+		
+		return cal.getTime();
+	}
+	
+	/**
+	 * 获取日期信息
+	 * @param date
+	 * @param field 0-秒,1-分,2-时(24),3-天(月),4-月,5-年
+	 * @return
+	 */
+	public static int getFieldOfDate(Date date, int field) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(date);
+		int num = 0;
+		switch (field) {
+		case 0:
+			num = cal.get(Calendar.MILLISECOND);
+			break;
+		case 1:
+			num = cal.get(Calendar.MILLISECOND);
+			break;
+		case 2:
+			num = cal.get(Calendar.HOUR_OF_DAY);
+			break;
+		case 3:
+			num = cal.get(Calendar.DAY_OF_MONTH);
+			break;
+		case 4:
+			num = cal.get(Calendar.MONTH);
+			break;
+		case 5:
+			num = cal.get(Calendar.YEAR);
+			break;
+		case 21:
+			num = cal.get(Calendar.HOUR);
+			break;
+		case 22:
+			num = cal.get(Calendar.DAY_OF_YEAR);
+			break;
+		default:
+			break;
+		}
+		return num;
+	}
+	
+	/**
+	 * 获取当前时间所处于本年第几
+	 * 
+	 * @param date
+	 * @return
+	 */
+	public static int getWeeksOfYear(Date date) {
+		Calendar c = new GregorianCalendar();
+		c.setFirstDayOfWeek(Calendar.MONDAY);
+		c.setMinimalDaysInFirstWeek(7);
+		c.setTime(date);
+
+		return c.get(Calendar.WEEK_OF_YEAR);
+	}
+
+	/**
+	 * 获取某一年共有多少周
+	 * @param year
+	 * @return
+	 */
+	public static int getMaxWeekNumOfYear(int year) {
+		Calendar c = new GregorianCalendar();
+		c.set(year, Calendar.DECEMBER, 31, 23, 59, 59);
+
+		return getWeeksOfYear(c.getTime());
+	}
+
+	/**
+	 * 获取某年的第几周的开始日期
+	 * 
+	 * @param year
+	 * @param week 从1开始
+	 * @return
+	 */
+	public static Date getFirstDayOfWeek(int year, int week) {
+		week--;
+		
+		Date startDate = null;
+		try {
+			startDate = str2Date(year + "-01-01", SDF_DAY);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		// 周几
+		int weekDayNum = getDayOfWeek(startDate);
+		int offset = 0;
+		if(weekDayNum > 1) {
+			offset = 8 - weekDayNum;
+		}
+		
+		Date returnDay = getDayOff(startDate, offset);
+		
+		return getDayOff(returnDay, 7 * week);
+	}
+	
+	/**
+	 * 是否当前月
+	 * @param date
+	 * @return
+	 * @throws Exception
+	 */
+	public static boolean isCurrentMonth(Date date) throws Exception{
+		if (getFirstDayOfMonth(date).getTime() == getFirstDayOfMonth(new Date()).getTime()) {
+			return true;
+		}
+		return false;
+	}
+}

+ 20 - 0
src/com/persagy/business/HelloWorld.java

@@ -0,0 +1,20 @@
+package com.persagy.business;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+
+@Service("HelloWorld")
+@Scope("prototype")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class HelloWorld extends BaseBusinessService<Map> implements BusinessService {
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		content.add("helloworld");
+	}
+}

+ 50 - 0
src/com/persagy/business/maintain/ConfigShow.java

@@ -0,0 +1,50 @@
+package com.persagy.business.maintain;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.weather.util.ConfigUtil;
+
+@Service("ConfigShow")
+@SuppressWarnings({"unchecked","rawtypes" })
+public class ConfigShow extends BaseBusinessService<Map> implements BusinessService {
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String method = (String) dto.get("method");
+		List<String> paramList = (List)dto.get("paramList");
+		
+		if(method == null) {
+			throw new Exception("method不能为空!");
+		}
+		
+		Method m = null;
+		Object result = null;
+		try {
+			if(paramList != null) {
+				int paramNum = paramList.size();
+				if(paramNum > 0) {
+					Class[] clzAray = new Class[paramNum];
+					String[] paramValue = new String[paramNum];
+					for (int i = 0; i < paramNum; i++) {
+						clzAray[i] = String.class;
+						paramValue[i] = paramList.get(i);
+					}
+					m = ConfigUtil.class.getMethod(method, clzAray);
+					result = m.invoke(new ConfigUtil(), paramValue);
+				}
+			}else {
+				m = ConfigUtil.class.getMethod(method);
+				result = m.invoke(new ConfigUtil());
+			}
+		}catch (Exception e) {
+			result = "Error! " + e.getMessage();
+		}
+		
+		content.add(result);
+	}
+}

+ 52 - 0
src/com/persagy/business/maintain/FileData2DB.java

@@ -0,0 +1,52 @@
+package com.persagy.business.maintain;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.weather.service.HourRecordService;
+import com.persagy.weather.thread.FileDataTransThread;
+
+/**
+ * 城市小时历史文件数据入库
+ *
+ */
+@Service("FileData2DB")
+@SuppressWarnings({"unchecked","rawtypes" })
+public class FileData2DB extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	HourRecordService hourRecordService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String dirPath = (String) dto.get("dirPath");
+		List<String> cityList = (List<String>) dto.get("cityList");
+		
+		File dir = new File(dirPath);
+		if(!dir.exists() || !dir.isDirectory()) {
+			throw new Exception("dirPath不是有效的目录");
+		}
+		
+		if(null == cityList || cityList.isEmpty()) {
+			throw new Exception("cityList不能为空");
+		}
+		
+		Set<String> cityIds = new HashSet<>(cityList);
+		
+		if(FileDataTransThread.runningLogic.contains(dirPath)) {
+			content.add("Task is Running");
+		}else {
+			new Thread(new FileDataTransThread(dirPath, hourRecordService, cityIds)).start();
+			content.add("Task start Running");
+		}
+		
+	}
+}

+ 110 - 0
src/com/persagy/business/maintain/HourData2VersionTrans.java

@@ -0,0 +1,110 @@
+package com.persagy.business.maintain;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Resource;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Service;
+
+import com.framework.util.DateUtils;
+import com.persagy.core.enumeration.SpecialOperator;
+import com.persagy.core.mvc.service.CoreService;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.old.WeatherHourData;
+import com.persagy.ems.pojo.wz.HourRecordData;
+import com.persagy.weather.service.HourRecordService;
+import com.persagy.weather.util.ConfigUtil;
+
+/**
+ * 将老系统中的小时数据传到新系统
+ */
+@Service("HourData2VersionTrans")
+@SuppressWarnings({"unchecked","rawtypes" })
+public class HourData2VersionTrans extends BaseBusinessService<Map> implements BusinessService {
+	private static final Logger LOGGER = Logger.getLogger(HourData2VersionTrans.class);
+	
+	@Resource(name="coreService")
+	private CoreService coreService;
+	
+	@Resource
+	private HourRecordService hourDataService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String hourStart = (String) dto.get("hourStart");
+		String hourEnd = (String) dto.get("hourEnd");
+		final Date start = DateUtils.str2Date(hourStart, "yyyyMMddHH");
+		final Date end = DateUtils.str2Date(hourEnd, "yyyyMMddHH");
+		final Set<String> cities = ConfigUtil.getHourCitySet();
+		final int ctall = cities.size();
+		
+		new Thread(new Runnable() {
+			@Override
+			public void run() {
+				int cindex = 1;
+				for(String cityId : cities) {
+					List<WeatherHourData> oldList = queryOld(cityId, start, end);
+					if(null != oldList && !oldList.isEmpty()) {
+						List<HourRecordData> listSave = new ArrayList<>();
+						for(WeatherHourData obj : oldList) {
+							HourRecordData sobj = new HourRecordData();
+							sobj.setCityId(cityId);
+							sobj.setClouds(obj.getClouds());
+							sobj.setCo(obj.getCo());
+							sobj.setCode(obj.getCode());
+							sobj.setDew_point(obj.getDewPoint());
+							sobj.setHourTime(obj.getReceivetime());
+							sobj.setFeels_like(obj.getFeelsLike());
+							sobj.setHumidity(obj.getHumidity());
+							sobj.setLastUpdateAir(obj.getReceivetime());
+							sobj.setLastUpdateNow(obj.getReceivetime());
+							sobj.setNo2(obj.getNo2());
+							sobj.setO3(obj.getO3());
+							sobj.setPm10(obj.getPm10());
+							sobj.setPm25(obj.getPm25());
+							sobj.setPressure(obj.getPressure());
+							sobj.setQuality(obj.getQuality());
+							sobj.setSo2(obj.getSo2());
+							sobj.setText(obj.getText());
+							sobj.setTemperature(obj.getTemperature());
+							sobj.setVisibility(obj.getVisibility());
+							sobj.setWind_direction(obj.getWindDirection());
+							sobj.setWind_direction_degree(obj.getWindDirectionDegree());
+							sobj.setWind_scale(obj.getWindScale());
+							sobj.setWind_speed(obj.getWindSpeed());
+							listSave.add(sobj);
+						}
+						try {
+							hourDataService.saveBatch(listSave);
+							LOGGER.error("Success " +cindex + "/" + ctall);
+						}catch (Exception e) {
+							LOGGER.error("Error city=" + cityId + " --- " +cindex + "/" + ctall);
+						}
+					}
+				}
+			}
+		}).start();
+		
+		content.add("Task start running...");
+	}
+	
+	private List<WeatherHourData> queryOld(String cityId, Date start, Date end) {
+		List<WeatherHourData> list = new ArrayList<>();
+		try {
+			WeatherHourData obj = new WeatherHourData();
+			obj.setBuildingForContainer(cityId);
+			obj.setSpecialOperation("receivetime", SpecialOperator.$gte, start);
+			obj.setSpecialOperation("receivetime", SpecialOperator.$lt, end);
+			list = coreService.query(obj);
+		}catch (Exception e) {
+			// TODO: handle exception
+		}
+		return list;
+	}
+}

+ 51 - 0
src/com/persagy/business/maintain/HourDataDelete.java

@@ -0,0 +1,51 @@
+package com.persagy.business.maintain;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.framework.util.DateUtils;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.weather.constant.Const;
+import com.persagy.weather.service.HourRecordService;
+import com.persagy.weather.util.ConfigUtil;
+
+/**
+ * 删除城市某一日的小时数据
+ */
+@Service("HourDataDelete")
+@SuppressWarnings({"rawtypes"})
+public class HourDataDelete extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	private HourRecordService hourDataService;
+	
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		// ALL,所有城市
+		String cityId = (String) dto.get("cityId");
+		
+		// yyyy-MM-dd
+		String dayDateStr = (String) dto.get("dayDate");
+		
+		if(cityId == null || dayDateStr == null) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		Date dayDate = DateUtils.str2Date(dayDateStr, DateUtils.SDF_DAY);
+		
+		if(cityId.equals("ALL")) {
+			for(String city : ConfigUtil.getHourCitySet()) {
+				hourDataService.deleteOneDayOfCity(city, dayDate);
+			}
+		}else {
+			hourDataService.deleteOneDayOfCity(cityId, dayDate);
+		}
+	}
+	
+}

+ 48 - 0
src/com/persagy/business/maintain/HourDataRepair.java

@@ -0,0 +1,48 @@
+package com.persagy.business.maintain;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.framework.util.DateUtils;
+import com.persagy.core.mvc.service.CoreService;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.weather.constant.Const;
+import com.persagy.weather.thread.HourRepairThread;
+
+/**
+ * 修复小时数据 
+ */
+@Service("HourDataRepair")
+@SuppressWarnings({"unchecked","rawtypes" })
+public class HourDataRepair extends BaseBusinessService<Map> implements BusinessService {
+	@Resource(name="coreService")
+	private CoreService coreService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		// ALL,所有城市, ALL_12,跳过12个城市从第13个城市开始计算
+		String cityId = (String) dto.get("cityId");
+		
+		// yyyy-MM-dd
+		String startDay = (String) dto.get("startDay");
+		String endDay = (String) dto.get("endDay");
+		
+		if(cityId == null || startDay == null || endDay == null) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		Date fromDay = DateUtils.str2Date(startDay, DateUtils.SDF_DAY);
+		Date toDay = DateUtils.str2Date(endDay, DateUtils.SDF_DAY);
+		
+		new Thread(new HourRepairThread(coreService, cityId, fromDay, toDay)).start();
+		
+		content.add("HourRepairThread task start running...");
+	}
+	
+}

+ 53 - 0
src/com/persagy/business/maintain/HourToDayAvgData.java

@@ -0,0 +1,53 @@
+package com.persagy.business.maintain;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.framework.util.DateUtils;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.weather.constant.Const;
+import com.persagy.weather.service.DayStaticService;
+import com.persagy.weather.service.HourRecordService;
+import com.persagy.weather.thread.HourToDayAvgDataComputeThread;
+
+/**
+ * 通过日小时数据来计算得出日统计均值数据 
+ */
+@Service("HourToDayAvgData")
+@SuppressWarnings({"unchecked","rawtypes" })
+public class HourToDayAvgData extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	private HourRecordService hourDataService;
+	
+	@Resource
+	private DayStaticService dayStaticService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		// ALL,所有城市
+		String cityId = (String) dto.get("cityId");
+		
+		// yyyy-MM-dd
+		String startDay = (String) dto.get("startDay");
+		String endDay = (String) dto.get("endDay");
+		
+		if(cityId == null || startDay == null || endDay == null) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		Date fromDay = DateUtils.str2Date(startDay, DateUtils.SDF_DAY);
+		Date toDay = DateUtils.str2Date(endDay, DateUtils.SDF_DAY);
+		
+		new Thread(new HourToDayAvgDataComputeThread(hourDataService, dayStaticService, 
+				cityId, fromDay, toDay)).start();
+		
+		content.add("Task start running...");
+	}
+	
+}

+ 66 - 0
src/com/persagy/business/maintain/HourToDayData.java

@@ -0,0 +1,66 @@
+package com.persagy.business.maintain;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.framework.util.DateUtils;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.weather.constant.Const;
+import com.persagy.weather.constant.ConstStaticType;
+import com.persagy.weather.service.DayHisRecordService;
+import com.persagy.weather.service.DayStaticService;
+import com.persagy.weather.service.HourRecordService;
+import com.persagy.weather.thread.HourToDayDataComputeThread;
+
+/**
+ * 通过日小时数据来计算得出日数据和日统计数据 
+ */
+@Service("HourToDayData")
+@SuppressWarnings({"unchecked","rawtypes" })
+public class HourToDayData extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	private HourRecordService hourDataService;
+	
+	@Resource
+	private DayHisRecordService dayHisRecordService;
+	
+	@Resource
+	private DayStaticService dayStaticService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		// ALL,所有城市
+		String cityId = (String) dto.get("cityId");
+		List<String> cityIdList = (List<String>) dto.get("cityIds");
+		// yyyy-MM-dd
+		String startDay = (String) dto.get("startDay");
+		String endDay = (String) dto.get("endDay");
+		String type = (String) dto.get("type");
+		ConstStaticType stype = ConstStaticType.getItem(type);
+		
+		if((cityId == null && cityIdList == null) || startDay == null || endDay == null || stype == null) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		Date fromDay = DateUtils.str2Date(startDay, DateUtils.SDF_DAY);
+		Date toDay = DateUtils.str2Date(endDay, DateUtils.SDF_DAY);
+		
+		if(cityId != null) {
+			new Thread(new HourToDayDataComputeThread(hourDataService, dayHisRecordService, dayStaticService, 
+					cityId, fromDay, toDay, stype)).start();
+		}else {
+			new Thread(new HourToDayDataComputeThread(hourDataService, dayHisRecordService, dayStaticService, 
+					new HashSet<>(cityIdList), fromDay, toDay, stype)).start();
+		}
+		
+		content.add("Task start running...statisticType="+type);
+	}
+	
+}

+ 53 - 0
src/com/persagy/business/maintain/HourToDayMaxData.java

@@ -0,0 +1,53 @@
+package com.persagy.business.maintain;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.framework.util.DateUtils;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.weather.constant.Const;
+import com.persagy.weather.service.DayStaticService;
+import com.persagy.weather.service.HourRecordService;
+import com.persagy.weather.thread.HourToDayMaxDataComputeThread;
+
+/**
+ * 通过日小时数据来计算得出日统计最值数据 
+ */
+@Service("HourToDayMaxData")
+@SuppressWarnings({"unchecked","rawtypes" })
+public class HourToDayMaxData extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	private HourRecordService hourDataService;
+	
+	@Resource
+	private DayStaticService dayStaticService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		// ALL,所有城市, ALL_12,跳过12个城市从第13个城市开始计算
+		String cityId = (String) dto.get("cityId");
+		
+		// yyyy-MM-dd
+		String startDay = (String) dto.get("startDay");
+		String endDay = (String) dto.get("endDay");
+		
+		if(cityId == null || startDay == null || endDay == null) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		Date fromDay = DateUtils.str2Date(startDay, DateUtils.SDF_DAY);
+		Date toDay = DateUtils.str2Date(endDay, DateUtils.SDF_DAY);
+		
+		new Thread(new HourToDayMaxDataComputeThread(hourDataService, dayStaticService, 
+				cityId, fromDay, toDay)).start();
+		
+		content.add("HourToDayMaxDataComputeThread task start running...");
+	}
+	
+}

+ 169 - 0
src/com/persagy/business/maintain/LonghuOldDataTransfer.java

@@ -0,0 +1,169 @@
+package com.persagy.business.maintain;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.framework.util.DateUtils;
+import com.persagy.core.enumeration.SpecialOperator;
+import com.persagy.core.mvc.service.CoreService;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.old.WeatherMonthData;
+import com.persagy.ems.pojo.wz.MinuteRecordData;
+import com.persagy.weather.util.FileTools;
+
+/**
+ * 龙湖5分钟数据由旧库转移到新库
+ */
+@Service("LonghuOldDataTransfer")
+@SuppressWarnings({"unchecked","rawtypes" })
+public class LonghuOldDataTransfer extends BaseBusinessService<Map> implements BusinessService {
+	@Resource(name="coreService")
+	private CoreService coreService;
+	
+	private String fileName;
+	
+	private String cityId;
+	
+	private static Map<String, String> locationId_cityId = new HashMap<>();
+	static {
+		locationId_cityId.put("4c0e3f42-4ca7-46a8-9644-3aa4d84940aa", "WX4FBXXFKE4F");
+		locationId_cityId.put("28c5fe36-f78c-4c31-9281-22f8bd7064d4", "WX4G17JWZEK7");
+		locationId_cityId.put("f71c922e-4187-405a-b4f0-8f01c2b8f891", "WS06YNEMPP18");
+		locationId_cityId.put("d6f114d1-5b00-4f2e-8a29-6bb77a771f40", "WM6N2PM3WY2K");
+		locationId_cityId.put("b9034233-987b-4fa5-a521-611992585174", "WTW3SJ5ZBJUY");
+		locationId_cityId.put("ae2352ce-be0b-4a22-ab4b-f06b87db2a12", "WWMT5Q64CR3G");
+		locationId_cityId.put("e05554cd-d3a6-4471-868a-70f4aefd0b32", "WXRVB9QYXKY8");
+		locationId_cityId.put("7467e7a6-b959-4192-9bd2-a610fa1eb4c9", "WQJ6YY8MHZP0");
+		locationId_cityId.put("48ba42b1-781c-4827-abf2-e2487259a060", "WT027GXDDZVH");
+		locationId_cityId.put("34d51629-9a2a-4e00-90ab-ff027e2ac26c", "WWE0TGW4PX6N");
+		locationId_cityId.put("af948a05-8210-45f0-9fcf-49d34e31d263", "WTSQQYHVQ973");
+		locationId_cityId.put("fb14830b-f436-4d16-9d75-d88f75715864", "WT3Q0FW9ZJ3Q");
+	}
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String locationId = (String) dto.get("locationId");
+		String endTimeStr = (String) dto.get("endTime");
+		String startTimeStr = (String) dto.get("startTime");
+		
+		Date startTime = DateUtils.str2Date(startTimeStr, "yyyyMMddHHss");
+		Date endTime = DateUtils.str2Date(endTimeStr, "yyyyMMddHHmmss");
+		
+		if(null != locationId && locationId_cityId.containsKey(locationId)) {
+			cityId = locationId_cityId.get(locationId);
+			fileName = "D:/wz/olddata/" + cityId + "-" + startTimeStr + "-" + endTimeStr + ".sql";
+			
+			if(FileTools.createFile(fileName)) {
+				handleRecords2(locationId, startTime, endTime);
+			}
+		}
+	}
+
+	private void handleRecords2(final String locationId, final Date startTime, final Date endTimeP) throws Exception {
+		new Thread(new Runnable() {
+			@Override
+			public void run() {
+				Date endTime = endTimeP;
+				Date tempTime = DateUtils.getDayOff(endTime, -5);
+				while(endTime.after(startTime)) {
+					List<WeatherMonthData> oldDataList = getOldData(locationId, tempTime, endTime);
+					
+					if(null != oldDataList && !oldDataList.isEmpty()) {
+						String head = "INSERT INTO `persagy_weather`.`t_minute_" + cityId + 
+								"` (`c_city_id`, `c_minute_time`, `c_data`, `c_type`) VALUES ('" + cityId + "','";
+						String tail = "', '1');";
+						
+						StringBuilder sqlSB = new StringBuilder();
+						
+						for(WeatherMonthData obj : oldDataList) {
+							try {
+								sqlSB.append(head + DateUtils.date2Str(obj.getReceivetime(), "yyyy-MM-dd HH:mm:ss") + "','");
+							} catch (Exception e) {
+								e.printStackTrace();
+							}
+							sqlSB.append(obj.getData() + tail + "\n");
+						}
+						
+						try {
+							FileTools.writeInFile(new File(fileName), sqlSB.toString(), true);
+						} catch (Exception e) {
+							e.printStackTrace();
+						}
+						try {
+							System.out.println(oldDataList.size() + "records transfered. startTime:" + DateUtils.date2Str(tempTime, "yyyy-MM-dd HH:mm:ss"));
+						} catch (Exception e) {
+							e.printStackTrace();
+						}
+						endTime = tempTime;
+						tempTime = DateUtils.getDayOff(endTime, -5);
+						if(tempTime.before(startTime)) {
+							tempTime = startTime;
+						}
+					}else {
+						break;
+					}
+			}
+		}}).start();
+	}
+	
+	private void handleRecords(String locationId, Date startTime, Date endTime) throws Exception {
+		Date tempTime = DateUtils.getDayOff(endTime, -30);
+		while(endTime.after(startTime)) {
+			List<WeatherMonthData> oldDataList = getOldData(locationId, tempTime, endTime);
+			
+			if(null != oldDataList && !oldDataList.isEmpty()) {
+				List<MinuteRecordData> saveList = new ArrayList<>();
+				
+				String cityId = null;
+				for(WeatherMonthData obj : oldDataList) {
+					cityId = locationId_cityId.get(obj.getLocationId());
+					
+					MinuteRecordData mrd = new MinuteRecordData();
+					mrd.setBuildingForContainer(cityId);
+					mrd.setCityId(cityId);
+					mrd.setType(1);
+					mrd.setMinuteTime(obj.getReceivetime());
+					mrd.setData(obj.getData());
+					
+					saveList.add(mrd);
+					if(saveList.size() == 1000) {
+						coreService.save(saveList);
+						saveList.clear();
+					}
+				}
+				coreService.save(saveList);
+				
+				System.out.println(saveList.size() + "records transfered. startTime:" + DateUtils.date2Str(tempTime, "yyyy-MM-dd HH:mm:ss"));
+				endTime = tempTime;
+				tempTime = DateUtils.getDayOff(endTime, -30);
+			}else {
+				break;
+			}
+		}
+	}
+	
+	private List<WeatherMonthData> getOldData(String locationId, Date startTime, Date endTime) {
+		List<WeatherMonthData> resultList = new ArrayList<>();
+		
+		WeatherMonthData queryObj = new WeatherMonthData();
+		queryObj.setLocationId(locationId);
+		queryObj.setSpecialOperation("receivetime", SpecialOperator.$gte, startTime);
+		queryObj.setSpecialOperation("receivetime", SpecialOperator.$lt, endTime);
+		try {
+			resultList = coreService.query(queryObj);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return resultList;
+	}
+}

+ 149 - 0
src/com/persagy/business/maintain/WRecord.java

@@ -0,0 +1,149 @@
+package com.persagy.business.maintain;
+
+import java.util.Date;
+
+import com.framework.util.DateUtils;
+import com.persagy.ems.pojo.wz.HourRecordData;
+
+public class WRecord {
+	public String CITY_ID;
+	public String TIME;
+	public String TEM;
+	public String RHU;
+	public String PRE;
+	public String PRS;
+	public String WND;
+	public String WND_DIRECTION;
+	public String WNS;
+	public String WNS_SCALE;
+	public String VIS;
+	public String WEATHER;
+	@Override
+	public String toString() {
+		return "WRecord [CITY_ID=" + CITY_ID + ", TIME=" + TIME + ", TEM=" + TEM + ", RHU=" + RHU + ", PRE=" + PRE
+				+ ", PRS=" + PRS + ", WND=" + WND + ", WND_DIRECTION=" + WND_DIRECTION + ", WNS=" + WNS + ", WNS_SCALE="
+				+ WNS_SCALE + ", VIS=" + VIS + ", WEATHER=" + WEATHER + "]";
+	}
+	/**
+	 * 校验数据
+	 * @return null或异常信息
+	 */
+	public String validField() {
+		String str = "";
+		
+		if(TEM == null || TEM.trim().length() == 0) {
+			str = "TEM:null";
+		}else {
+			if(TEM.length() > 10) {
+				TEM = TEM.substring(0, 10);
+			}
+			Double tem = Double.parseDouble(TEM);
+			if(tem < -58 || tem > 45) {
+				str = "TEM:" + TEM;
+			}
+		}
+		
+		if(RHU == null || RHU.trim().length() == 0) {
+			str += "RHU:null;";
+		}else {
+			if(RHU.length() > 10) {
+				RHU = RHU.substring(0, 10);
+			}
+			Double reh = Double.parseDouble(RHU);
+			if(reh < 0 || reh > 100) {
+				str += "RHU:" + RHU +";";
+			}
+		}
+		
+		if(PRS == null || PRS.trim().length() == 0) {
+			str += "PRS:null;";
+		}else {
+			if(PRS.length() > 10) {
+				PRS = PRS.substring(0, 10);
+			}
+			Double prs = Double.parseDouble(PRS);
+			if(prs < 500 || prs > 1200) {
+				str += "PRS:" + PRS +";";
+			}
+		}
+		
+		if(WND == null || WND.trim().length() == 0) {
+			str += "WND:null;";
+		}else {
+			if(WND.length() > 10) {
+				WND = WND.substring(0, 10);
+			}
+			Double prs = Double.parseDouble(WND);
+			if(prs < 0 || prs > 360) {
+				str += "WND:" + WND +";";
+				WND = null;
+			}
+		}
+		
+		if(WNS == null || WNS.trim().length() == 0) {
+			str += "WNS:null;";
+		}else {
+			if(WNS.length() > 10) {
+				WNS = WNS.substring(0, 10);
+			}
+			Double prs = Double.parseDouble(WNS);
+			if(prs < 0 || prs > 75) {
+				str += "WNS:" + WNS +";";
+				WNS = null;
+			}
+		}
+		
+		if(VIS == null || VIS.trim().length() == 0) {
+			str += "VIS:null;";
+		}else {
+			if(VIS.length() > 10) {
+				VIS = VIS.substring(0, 10);
+			}
+			Double prs = Double.parseDouble(VIS);
+			if(prs < 0 || prs > 50000) {
+				str += "VIS:" + VIS +";";
+			}else {
+				prs = prs / 1000.0;
+				VIS = prs + "";
+				VIS = VIS.length() > 10 ? VIS.substring(0, 6) : VIS;
+			}
+		}
+		
+		if("".equals(str)) {
+			str = null;
+		}else if(str.endsWith(";")) {
+			str = str.substring(0, str.length()-1);
+		}
+		
+		return str;
+	}
+	public HourRecordData getDaoObj() {
+//		HourRecordData
+		if(TIME != null) {
+			Date hourTime = null;
+			try {
+				hourTime = DateUtils.str2Date(TIME, "yyyy-MM-dd HH:mm:ss");
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			if(null != hourTime) {
+				HourRecordData obj = new HourRecordData();
+				obj.setCityId(CITY_ID);
+				obj.setHourTime(hourTime);
+				obj.setTemperature(TEM);
+				obj.setHumidity(RHU);
+				obj.setPressure(PRS);
+				obj.setWind_direction_degree(WND);
+				obj.setWind_direction(WND_DIRECTION);
+				obj.setWind_speed(WNS);
+				obj.setWind_scale(WNS_SCALE);
+				obj.setVisibility(VIS);
+				obj.setText(WEATHER);
+				return obj;
+			}
+		}
+		return null;
+	}
+	
+}

+ 5 - 0
src/com/persagy/constant/ConstTime.java

@@ -0,0 +1,5 @@
+package com.persagy.constant;
+
+public class ConstTime {
+	public static final long ms_year = 366 * 24 * 60 * 60 * 1000L;
+}

+ 34 - 0
src/com/persagy/constant/EnumHolidayDayType.java

@@ -0,0 +1,34 @@
+package com.persagy.constant;
+
+public enum EnumHolidayDayType {
+	WORK_DAY(0, "正常工作日"),
+	WEEK_DAY(1, "法定节假日"),
+	REST_DAY(2, "节假日调休补班");
+	private int code;
+	private String descrip;
+	
+	EnumHolidayDayType(int code, String descrip) {
+		this.code = code;
+		this.descrip = descrip;
+	}
+
+	public int getCode() {
+		return code;
+	}
+
+	public String getDescrip() {
+		return descrip;
+	}
+	
+	public static EnumHolidayDayType getEnum(int code) {
+		EnumHolidayDayType enumItem = null;
+		for(EnumHolidayDayType enumObj : EnumHolidayDayType.values()) {
+			if(code == enumObj.getCode()) {
+				enumItem = enumObj;
+				break;
+			}
+		}
+		
+		return enumItem;
+	}
+}

+ 95 - 0
src/com/persagy/constant/WeatherConstant.java

@@ -0,0 +1,95 @@
+package com.persagy.constant;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Description: 天气信息码常量   
+ */
+public class WeatherConstant {
+	// 数据字典天气信息码及对应描述信息
+	private static final Map<String, String> code2DescMap = new HashMap<>();
+	/** 获取天气现象代码及描述信息 */
+	public static Map<String, String> getCode2descmap() {
+		return code2DescMap;
+	}
+	// 第三方天气服务气象编码和气象文字说明
+	private static final Map<String, String> standCodeDesc = new LinkedHashMap<>();
+	public static Map<String, String> getStandCodeDesc() {
+		return standCodeDesc;
+	}
+	
+	public static void main(String[] args) {
+		Map<String, String> smap = getStandCodeDesc();
+		for(String key : smap.keySet()) {
+			System.out.println("\"" + key + "\": " + "\"" + smap.get(key) + "\",");
+		}
+	}
+	
+	static {
+		code2DescMap.put("1", "晴"); code2DescMap.put("2", "多云");
+		code2DescMap.put("3", "阴"); code2DescMap.put("4", "阵雨");
+		code2DescMap.put("5", "雷阵雨"); code2DescMap.put("6", "雷阵雨伴有冰雹");
+		code2DescMap.put("7", "雨夹雪"); code2DescMap.put("8", "小雨");
+		code2DescMap.put("9", "中雨"); code2DescMap.put("A", "大雨");
+		code2DescMap.put("B", "暴雨"); code2DescMap.put("C", "大暴雨");
+		code2DescMap.put("D", "特大暴雨"); code2DescMap.put("E", "阵雪");
+		code2DescMap.put("F", "小雪"); code2DescMap.put("G", "中雪");
+		code2DescMap.put("H", "大雪"); code2DescMap.put("I", "暴雪");
+		code2DescMap.put("J", "雾"); code2DescMap.put("K", "冻雨");
+		code2DescMap.put("L", "沙尘暴"); code2DescMap.put("M", "浮沉");
+		code2DescMap.put("N", "扬沙"); code2DescMap.put("O", "强沙尘暴");
+		code2DescMap.put("P", "霾"); code2DescMap.put("Q", "其他");
+		
+		standCodeDesc.put("0", "晴"); standCodeDesc.put("1", "晴");
+		standCodeDesc.put("2", "晴"); standCodeDesc.put("3", "晴");
+		standCodeDesc.put("4", "多云"); standCodeDesc.put("5", "晴间多云");
+		standCodeDesc.put("6", "晴间多云"); standCodeDesc.put("7", "大部多云");
+		standCodeDesc.put("8", "大部多云"); standCodeDesc.put("9", "阴");
+		standCodeDesc.put("10", "阵雨"); standCodeDesc.put("11", "雷阵雨");
+		standCodeDesc.put("12", "雷阵雨伴有冰雹"); standCodeDesc.put("13", "小雨");
+		standCodeDesc.put("14", "中雨"); standCodeDesc.put("15", "大雨");
+		standCodeDesc.put("16", "暴雨"); standCodeDesc.put("17", "大暴雨");
+		standCodeDesc.put("18", "特大暴雨"); standCodeDesc.put("19", "冻雨");
+		standCodeDesc.put("20", "雨夹雪"); standCodeDesc.put("21", "阵雪");
+		standCodeDesc.put("22", "小雪"); standCodeDesc.put("23", "中雪");
+		standCodeDesc.put("24", "大雪"); standCodeDesc.put("25", "暴雪");
+		standCodeDesc.put("26", "浮尘"); standCodeDesc.put("27", "扬沙");
+		standCodeDesc.put("28", "沙尘暴"); standCodeDesc.put("29", "强沙尘暴");
+		standCodeDesc.put("30", "雾"); standCodeDesc.put("31", "霾");
+		standCodeDesc.put("32", "风"); standCodeDesc.put("33", "大风");
+		standCodeDesc.put("34", "飓风"); standCodeDesc.put("35", "热带风暴");
+		standCodeDesc.put("36", "龙卷风"); standCodeDesc.put("37", "冷");
+		standCodeDesc.put("38", "热"); standCodeDesc.put("99", "未知");
+	}
+	
+	// 第三方天气信息编码与数据字典编码对应关系
+	private static final Map<String, String> code2DicCodeMap = new HashMap<>();
+	public static Map<String, String> getCode2DicCodeMap() {
+		return code2DicCodeMap;
+	}
+	static {
+		code2DicCodeMap.put("0", "1"); code2DicCodeMap.put("1", "1");
+		code2DicCodeMap.put("2", "1"); code2DicCodeMap.put("3", "1");
+		code2DicCodeMap.put("4", "2"); code2DicCodeMap.put("5", "2");
+		code2DicCodeMap.put("6", "2"); code2DicCodeMap.put("7", "2");
+		code2DicCodeMap.put("8", "2"); code2DicCodeMap.put("9", "3");
+		code2DicCodeMap.put("10", "4"); code2DicCodeMap.put("11", "5");
+		code2DicCodeMap.put("12", "6"); code2DicCodeMap.put("13", "8");
+		code2DicCodeMap.put("14", "9"); code2DicCodeMap.put("15", "A");
+		code2DicCodeMap.put("16", "B"); code2DicCodeMap.put("17", "C");
+		code2DicCodeMap.put("18", "D"); code2DicCodeMap.put("19", "K");
+		code2DicCodeMap.put("20", "7"); code2DicCodeMap.put("21", "E");
+		code2DicCodeMap.put("22", "F"); code2DicCodeMap.put("23", "G");
+		code2DicCodeMap.put("24", "H"); code2DicCodeMap.put("25", "I");
+		code2DicCodeMap.put("26", "M"); code2DicCodeMap.put("27", "N");
+		code2DicCodeMap.put("28", "N"); code2DicCodeMap.put("29", "O");
+		code2DicCodeMap.put("30", "J"); code2DicCodeMap.put("31", "P");
+		code2DicCodeMap.put("32", "Q"); code2DicCodeMap.put("33", "Q");
+		code2DicCodeMap.put("34", "Q"); code2DicCodeMap.put("35", "Q");
+		code2DicCodeMap.put("36", "Q"); code2DicCodeMap.put("37", "Q");
+		code2DicCodeMap.put("38", "Q"); code2DicCodeMap.put("99", "Q");
+	}
+}

+ 46 - 0
src/com/persagy/dto/CityDataLogContent.java

@@ -0,0 +1,46 @@
+package com.persagy.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CityDataLogContent {
+	private String dataType;
+	private String statistics;
+	private List<CityDataLogItem> errorDataList = new ArrayList<>();
+	
+	public CityDataLogContent(String dataType) {
+		super();
+		this.dataType = dataType;
+	}
+	public String getDataType() {
+		return dataType;
+	}
+	public void setDataType(String dataType) {
+		this.dataType = dataType;
+	}
+	public String getStatistics() {
+		return statistics;
+	}
+	public void setStatistics(String statistics) {
+		this.statistics = statistics;
+	}
+	public List<CityDataLogItem> getErrorDataList() {
+		return errorDataList;
+	}
+	public void setErrorDataList(List<CityDataLogItem> errorDataList) {
+		this.errorDataList = errorDataList;
+	}
+	
+	public String getMarkdownString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append("## 【数据异常】\n\n");
+		sb.append("### 异常类型:"+dataType+" \n");
+		sb.append("### 异常城市数量:"+statistics+" \n");
+		sb.append("### 详情如下:\n\n");
+		for(int i=0; i<errorDataList.size(); i++) {
+			sb.append((i+1)+". "+errorDataList.get(i).getCityId()+" \n\n");
+			sb.append("> "+errorDataList.get(i).getInfo());
+		}
+		return sb.toString();
+	}
+}

+ 38 - 0
src/com/persagy/dto/CityDataLogItem.java

@@ -0,0 +1,38 @@
+package com.persagy.dto;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class CityDataLogItem {
+	private String cityId;
+	private String info;
+	
+	public CityDataLogItem(String cityId, String info) {
+		super();
+		this.cityId = cityId;
+		this.info = info;
+	}
+	public String getCityId() {
+		return cityId;
+	}
+	public void setCityId(String cityId) {
+		this.cityId = cityId;
+	}
+	public String getInfo() {
+		return info;
+	}
+	public void setInfo(String info) {
+		this.info = info;
+	}
+	
+	public static void main(String[] args) {
+		ObjectMapper objectMapper = new ObjectMapper();
+		CityDataLogItem ct = new CityDataLogItem("FFFAABBCC", "error");
+		try {
+			System.out.println(objectMapper.writeValueAsString(ct));
+		} catch (JsonProcessingException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+}

+ 33 - 0
src/com/persagy/dto/DayHolidayDTO.java

@@ -0,0 +1,33 @@
+package com.persagy.dto;
+
+import java.util.Date;
+
+/**
+ * Description:  日工作日信息DTO 
+ * Company: Persagy 
+ * @author cuixubin 
+ * @since: 2019年1月14日: 上午9:24:59
+ */
+public class DayHolidayDTO {
+	private Date dayTime;
+	/** 正常工作日-0, 法定节假日-1, 节假日调休补班-2 */
+	private Integer code;
+	
+	public DayHolidayDTO(Date dayTime, Integer code) {
+		super();
+		this.dayTime = dayTime;
+		this.code = code;
+	}
+	public Date getDayTime() {
+		return dayTime;
+	}
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
+	public Integer getCode() {
+		return code;
+	}
+	public void setCode(Integer code) {
+		this.code = code;
+	}
+}

+ 53 - 0
src/com/persagy/dto/HistoryWeatherCityDTO.java

@@ -0,0 +1,53 @@
+package com.persagy.dto;
+
+/**
+ * Description: 需要爬取历史天气的城市
+ * Company: Persagy 
+ * @author fenghanchao 
+ * @version 1.0
+ * @since: 2019年2月28日: 下午3:01:45
+ * Update By fenghanchao 2019年2月28日: 下午3:01:45
+ */
+public class HistoryWeatherCityDTO {
+	
+	private String cityName;
+	
+	private String cityTag;
+	
+	private String cityCode;
+	
+	private String relatedCity;
+
+	public String getCityName() {
+		return cityName;
+	}
+
+	public void setCityName(String cityName) {
+		this.cityName = cityName;
+	}
+
+	public String getCityTag() {
+		return cityTag;
+	}
+
+	public void setCityTag(String cityTag) {
+		this.cityTag = cityTag;
+	}
+
+	public String getCityCode() {
+		return cityCode;
+	}
+
+	public void setCityCode(String cityCode) {
+		this.cityCode = cityCode;
+	}
+
+	public String getRelatedCity() {
+		return relatedCity;
+	}
+
+	public void setRelatedCity(String relatedCity) {
+		this.relatedCity = relatedCity;
+	}
+	
+}

+ 66 - 0
src/com/persagy/dto/TempStatisticsDTO.java

@@ -0,0 +1,66 @@
+package com.persagy.dto;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * Description: 温度统计信息
+ * Company: Persagy 
+ * @author fenghanchao 
+ * @version 1.0
+ * @since: 2019年4月28日: 下午3:01:45
+ * Update By fenghanchao 2019年4月28日: 下午3:01:45
+ */
+public class TempStatisticsDTO {
+
+    private Double maxTemp;
+
+    private Double minTemp;
+
+    private Double avgTemp;
+    
+    private Map<Date, Double> monthTempMap;
+    
+    private Map<String, Double> buildingTempMap;
+
+	public Double getMaxTemp() {
+		return maxTemp;
+	}
+
+	public void setMaxTemp(Double maxTemp) {
+		this.maxTemp = maxTemp;
+	}
+
+	public Double getMinTemp() {
+		return minTemp;
+	}
+
+	public void setMinTemp(Double minTemp) {
+		this.minTemp = minTemp;
+	}
+
+	public Double getAvgTemp() {
+		return avgTemp;
+	}
+
+	public void setAvgTemp(Double avgTemp) {
+		this.avgTemp = avgTemp;
+	}
+
+	public Map<Date, Double> getMonthTempMap() {
+		return monthTempMap;
+	}
+
+	public void setMonthTempMap(Map<Date, Double> monthTempMap) {
+		this.monthTempMap = monthTempMap;
+	}
+
+	public Map<String, Double> getBuildingTempMap() {
+		return buildingTempMap;
+	}
+
+	public void setBuildingTempMap(Map<String, Double> buildingTempMap) {
+		this.buildingTempMap = buildingTempMap;
+	}
+	
+}

+ 34 - 0
src/com/persagy/dto/WeatherDTO.java

@@ -0,0 +1,34 @@
+package com.persagy.dto;
+
+import java.util.Date;
+
+/**
+ * WeatherDTO.java.
+ * <p>Description: 天气信息.</p>
+ * <p>Company: www.persagy.com<p>
+ * @author fenghanchao
+ * 2019年3月1日: 下午4:33:35
+ */
+public class WeatherDTO {
+	private Date dayTime;
+	/** 正常工作日-0, 法定节假日-1, 节假日调休补班-2 */
+	private Integer code;
+	
+	public WeatherDTO(Date dayTime, Integer code) {
+		super();
+		this.dayTime = dayTime;
+		this.code = code;
+	}
+	public Date getDayTime() {
+		return dayTime;
+	}
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
+	public Integer getCode() {
+		return code;
+	}
+	public void setCode(Integer code) {
+		this.code = code;
+	}
+}

+ 0 - 0
src/com/persagy/ems/pojo/TypicalWeather.java


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