Browse Source

build init

cuixubin 3 years ago
commit
c5705e36d0
100 changed files with 12754 additions and 0 deletions
  1. 17 0
      .gitignore
  2. 37 0
      .project
  3. 3 0
      WebContent/META-INF/MANIFEST.MF
  4. 76 0
      WebContent/WEB-INF/web.xml
  5. 5 0
      WebContent/index.jsp
  6. 202 0
      pom.xml
  7. 288 0
      src/main/java/com/persagy/ems/pojo/TypicalWeather.java
  8. 79 0
      src/main/java/com/persagy/ems/pojo/holiday/HolidayGoseek.java
  9. 398 0
      src/main/java/com/persagy/ems/pojo/old/WeatherHourData.java
  10. 74 0
      src/main/java/com/persagy/ems/pojo/old/WeatherMonthData.java
  11. 61 0
      src/main/java/com/persagy/ems/pojo/system/FileResource.java
  12. 95 0
      src/main/java/com/persagy/ems/pojo/wz/ApiRequester.java
  13. 95 0
      src/main/java/com/persagy/ems/pojo/wz/ApiRequester2.java
  14. 76 0
      src/main/java/com/persagy/ems/pojo/wz/BusinessApiStatic.java
  15. 57 0
      src/main/java/com/persagy/ems/pojo/wz/CityLocation.java
  16. 229 0
      src/main/java/com/persagy/ems/pojo/wz/DayHisRecord.java
  17. 228 0
      src/main/java/com/persagy/ems/pojo/wz/DayPredictRecord.java
  18. 105 0
      src/main/java/com/persagy/ems/pojo/wz/DayStaticMoreRecord.java
  19. 165 0
      src/main/java/com/persagy/ems/pojo/wz/DayStaticRecord.java
  20. 67 0
      src/main/java/com/persagy/ems/pojo/wz/DependApiStatic.java
  21. 145 0
      src/main/java/com/persagy/ems/pojo/wz/DisasterWarning.java
  22. 337 0
      src/main/java/com/persagy/ems/pojo/wz/HourRecordData.java
  23. 72 0
      src/main/java/com/persagy/ems/pojo/wz/MinuteRecordData.java
  24. 14 0
      src/main/java/com/persagy/framework/construct/RequestProcessor.java
  25. 68 0
      src/main/java/com/persagy/framework/dto/ApiResult.java
  26. 5 0
      src/main/java/com/persagy/framework/dto/BaseDTO.java
  27. 24 0
      src/main/java/com/persagy/framework/dto/BusinessResultDTO.java
  28. 41 0
      src/main/java/com/persagy/framework/dto/FileConfigDTO.java
  29. 19 0
      src/main/java/com/persagy/framework/dto/FileResourceExtension.java
  30. 40 0
      src/main/java/com/persagy/framework/filter/CorsFilter.java
  31. 77 0
      src/main/java/com/persagy/framework/servlet/SystemInitServlet.java
  32. 340 0
      src/main/java/com/persagy/framework/util/BeanUtils.java
  33. 292 0
      src/main/java/com/persagy/framework/util/CommonToolUtils.java
  34. 838 0
      src/main/java/com/persagy/framework/util/ConfigUtil.java
  35. 35 0
      src/main/java/com/persagy/framework/util/CsvUtil.java
  36. 1088 0
      src/main/java/com/persagy/framework/util/DateUtils.java
  37. 508 0
      src/main/java/com/persagy/framework/util/ExcelUtils.java
  38. 467 0
      src/main/java/com/persagy/framework/util/FileUtil.java
  39. 90 0
      src/main/java/com/persagy/framework/util/HolidaySearchUtil.java
  40. 143 0
      src/main/java/com/persagy/framework/util/HttpUtil.java
  41. 143 0
      src/main/java/com/persagy/framework/util/JsonUtils.java
  42. 137 0
      src/main/java/com/persagy/framework/util/NumberUtils.java
  43. 22 0
      src/main/java/com/persagy/framework/util/PropertyUtil.java
  44. 155 0
      src/main/java/com/persagy/framework/util/RandomUtil.java
  45. 479 0
      src/main/java/com/persagy/framework/util/StringUtils.java
  46. 239 0
      src/main/java/com/persagy/framework/util/SunComputeUtil.java
  47. 364 0
      src/main/java/com/persagy/framework/util/WServiceUtil.java
  48. 170 0
      src/main/java/com/persagy/framework/web/controller/entrance/EntranceController.java
  49. 501 0
      src/main/java/com/persagy/framework/web/controller/entrance/UnifierController.java
  50. 15 0
      src/main/java/com/persagy/functions/common/business/HelloWorld.java
  51. 21 0
      src/main/java/com/persagy/functions/common/business/HelloWorld2.java
  52. 26 0
      src/main/java/com/persagy/functions/common/business/HelloWorld3.java
  53. 144 0
      src/main/java/com/persagy/functions/weather/business/v2020/DayStaticData.java
  54. 79 0
      src/main/java/com/persagy/functions/weather/business/v2020/DisasterWarningQuery.java
  55. 18 0
      src/main/java/com/persagy/functions/weather/business/v2020/HelloWorld.java
  56. 114 0
      src/main/java/com/persagy/functions/weather/business/v2020/NowWeatherQuery.java
  57. 120 0
      src/main/java/com/persagy/functions/weather/business/v2020/SunRiseAndSet.java
  58. 104 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/CommonTempratureDataService.java
  59. 51 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/GetCityInfoByProjectId.java
  60. 54 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/GetTempMonthStatistics.java
  61. 69 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/LongHuDataService.java
  62. 117 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/QueryHolidayOfYear.java
  63. 67 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/QueryTypicalWeather.java
  64. 33 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/QueryTypicalWeatherCity.java
  65. 80 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/QueryTypicalWeatherTimeSpan.java
  66. 124 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/SaveTypicalWeather.java
  67. 59 0
      src/main/java/com/persagy/functions/weather/business/v2020/customapi/WeatherCheckService.java
  68. 22 0
      src/main/java/com/persagy/functions/weather/business/v2020/dict/DicDisasterLevel.java
  69. 22 0
      src/main/java/com/persagy/functions/weather/business/v2020/dict/DicDisasterType.java
  70. 20 0
      src/main/java/com/persagy/functions/weather/business/v2020/dict/DicWeatherCodeName.java
  71. 103 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/CommonCityHourWeatherService.java
  72. 117 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/GetCityWeather.java
  73. 72 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/GetTempBuildingStatistics.java
  74. 42 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/HourWeatherForecastService.java
  75. 42 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/QueryCityInfoByProjectId.java
  76. 90 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/QueryDisasterService.java
  77. 74 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/QueryHistoryDisasterService.java
  78. 227 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/QueryWeatherService.java
  79. 84 0
      src/main/java/com/persagy/functions/weather/business/v2020/discard/WeatherForecastService.java
  80. 118 0
      src/main/java/com/persagy/functions/weather/business/v2020/forecast/DayForecast.java
  81. 49 0
      src/main/java/com/persagy/functions/weather/business/v2020/forecast/Hour24Forecast.java
  82. 79 0
      src/main/java/com/persagy/functions/weather/business/v2020/history/DayHistoryData.java
  83. 102 0
      src/main/java/com/persagy/functions/weather/business/v2020/history/HourHistoryData.java
  84. 50 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/ConfigShow.java
  85. 62 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/FileData2DB.java
  86. 110 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourData2VersionTrans.java
  87. 51 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourDataDelete.java
  88. 48 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourDataRepair.java
  89. 53 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourToDayAvgData.java
  90. 66 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourToDayData.java
  91. 53 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourToDayMaxData.java
  92. 149 0
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/WRecord.java
  93. 80 0
      src/main/java/com/persagy/functions/weather/constant/Const.java
  94. 38 0
      src/main/java/com/persagy/functions/weather/constant/ConstBusinessStatic.java
  95. 13 0
      src/main/java/com/persagy/functions/weather/constant/ConstStaticType.java
  96. 5 0
      src/main/java/com/persagy/functions/weather/constant/ConstTime.java
  97. 80 0
      src/main/java/com/persagy/functions/weather/constant/DisasterConstant.java
  98. 34 0
      src/main/java/com/persagy/functions/weather/constant/EnumHolidayDayType.java
  99. 94 0
      src/main/java/com/persagy/functions/weather/constant/WeatherConstant.java
  100. 0 0
      src/main/java/com/persagy/functions/weather/dto/AlarmDTO.java

+ 17 - 0
.gitignore

@@ -0,0 +1,17 @@
+target/
+*.class
+*.log
+*.svn
+
+
+# Package Files #
+*.jar
+*.war
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+.settings
+bin/
+/.classpath

+ 37 - 0
.project

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>persagy-weather</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<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>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+	</natures>
+</projectDescription>

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

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

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

@@ -0,0 +1,76 @@
+<?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_3_0.xsd" id="Saga_Dictionary_Web" version="3.0">
+  <display-name>Archetype Created Web Application</display-name>
+  <context-param>
+	<param-name>webAppRootKey</param-name>
+	<param-value>isagy_saas_web</param-value>
+  </context-param>
+  
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>classpath:config/spring/spring-base.xml</param-value>
+  </context-param>
+  
+  <context-param>
+    <param-name>log4jConfigLocation</param-name>
+    <param-value>classpath:log4j.properties</param-value>
+  </context-param>
+  
+  <listener>
+    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+  </listener>
+  <listener>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
+  
+  <servlet>
+    <servlet-name>SystemInitServlet</servlet-name>
+    <servlet-class>com.persagy.framework.servlet.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>
+  
+  
+  <!-- CORS过滤器start -->
+    <filter>
+        <filter-name>corsFilter</filter-name>
+        <filter-class>com.persagy.framework.filter.CorsFilter</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>corsFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+	<!-- CORS过滤器end -->
+  
+  <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>
+  
+  <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+  </welcome-file-list>
+</web-app>

+ 5 - 0
WebContent/index.jsp

@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>

+ 202 - 0
pom.xml

@@ -0,0 +1,202 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.persagy</groupId>
+	<artifactId>persagy-weather</artifactId>
+	<packaging>war</packaging>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>persagy-weather Webapp</name>
+	<url>http://maven.apache.org</url>
+	<repositories>
+		<repository>
+			<id>persagy</id>
+			<name>persagy</name>
+			<url>http://47.93.132.139:8081/nexus/content/groups/public/</url>
+			<snapshots>
+				<enabled>true</enabled>
+			</snapshots>
+			<releases>
+				<enabled>true</enabled>
+			</releases>
+		</repository>
+		<repository>
+			<id>mvnrepository</id>
+			<url>https://mvnrepository.com/</url>
+		</repository>
+	</repositories>
+	<properties>
+		<protostuff.version>1.3.8</protostuff.version>
+		<poi.versoin>3.11</poi.versoin>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.12</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+            <groupId>com.qcloud</groupId>
+            <artifactId>cos_api</artifactId>
+            <version>5.4.5</version>
+		</dependency>
+		<!-- ============= poi ============= -->
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi</artifactId>
+			<version>${poi.versoin}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi-examples</artifactId>
+			<version>${poi.versoin}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi-excelant</artifactId>
+			<version>${poi.versoin}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-fileupload</groupId>
+			<artifactId>commons-fileupload</artifactId>
+			<version>1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>io.protostuff</groupId>
+			<artifactId>protostuff-api</artifactId>
+			<version>${protostuff.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>io.protostuff</groupId>
+			<artifactId>protostuff-collectionschema</artifactId>
+			<version>${protostuff.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>io.protostuff</groupId>
+			<artifactId>protostuff-core</artifactId>
+			<version>${protostuff.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>io.protostuff</groupId>
+			<artifactId>protostuff-runtime</artifactId>
+			<version>${protostuff.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<!-- xstream -->
+		<dependency>
+			<groupId>com.thoughtworks.xstream</groupId>
+			<artifactId>xstream</artifactId>
+			<version>1.4.9</version>
+		</dependency>
+		<!-- javacsv -->
+		<dependency>
+		    <groupId>net.sourceforge.javacsv</groupId>
+		    <artifactId>javacsv</artifactId>
+		    <version>2.0</version>
+		</dependency>
+		<!-- ========== EMS_DATA ========== -->
+		<dependency>
+			<groupId>com.persagy.ems</groupId>
+			<artifactId>ems-data</artifactId>
+			<version>1.7.6</version>
+		</dependency>
+		<!-- ================== ems-util =============== -->
+		<dependency>
+			<groupId>com.persagy.ems</groupId>
+			<artifactId>ems-util-c8</artifactId>
+			<version>1.1-RELEASES</version>
+		</dependency>
+
+		<!-- ================ 工具类 start ================ -->
+		<dependency>
+			<groupId>net.sf.ehcache</groupId>
+			<artifactId>ehcache</artifactId>
+			<version>2.10.4</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.ehcache</groupId>
+			<artifactId>ehcache-core</artifactId>
+			<version>2.4.3</version>
+			<exclusions>
+				<exclusion>
+					<groupId>org.slf4j</groupId>
+					<artifactId>slf4j-api</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>net.lingala.zip4j</groupId>
+			<artifactId>zip4j</artifactId>
+			<version>1.3.2</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.xml.soap</groupId>
+			<artifactId>saaj-api</artifactId>
+			<version>1.3</version>
+			<exclusions>
+				<exclusion>
+					<groupId>javax.activation</groupId>
+					<artifactId>activation</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>com.sun.xml.messaging.saaj</groupId>
+			<artifactId>saaj-impl</artifactId>
+			<version>1.3</version>
+		</dependency>
+		<dependency>
+			<groupId>aopalliance</groupId>
+			<artifactId>aopalliance</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>aspectj</groupId>
+			<artifactId>aspectjrt</artifactId>
+			<version>1.5.3</version>
+		</dependency>
+		 <dependency>
+            <groupId>org.jsoup</groupId>
+            <artifactId>jsoup</artifactId>
+            <version>1.11.3</version>
+        </dependency>
+        
+        <!-- https://mvnrepository.com/artifact/com.belerweb/pinyin4j -->
+        <dependency>
+            <groupId>com.belerweb</groupId>
+            <artifactId>pinyin4j</artifactId>
+            <version>2.5.1</version>
+        </dependency>
+	</dependencies>
+	<build>
+		<finalName>persagy-weather</finalName>
+		<defaultGoal>compile</defaultGoal>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>3.0</version>
+				<configuration>
+					<source>1.8</source>
+					<target>1.8</target>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-war-plugin</artifactId>
+				<version>3.0.0</version>
+			</plugin>
+			<!-- 跳过测试 -->
+			<plugin>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<version>2.12.4</version>
+				<configuration>
+					<skipTests>true</skipTests>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>

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

@@ -0,0 +1,288 @@
+package com.persagy.ems.pojo;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+@Dimension
+@Entity(name = "TypicalWeather")
+@Table(name = "t_typical_weather", comment = "典型气象年数据表", schema = Schema.EMS, 
+		indexes = {
+				@Index(columns = { "c_city_code", "c_date" })
+	    })
+public class TypicalWeather extends BusinessObject{
+
+	private static final long serialVersionUID = 7781297687391969675L;
+
+	@JsonProperty("cityCode")
+	@Column(order = 10, name = "c_city_code", length = 10, nullable = false, comment = "数据字典 城市编码")
+	private String cityCode;
+	
+	@JsonProperty("date")
+	@Column(order = 20, name = "c_date", length = 10, nullable = false, comment = "日期")
+	private Date date;
+	
+	@JsonProperty("updateDate")
+	@Column(order = 21, name = "c_update_date", length = 10, nullable = false, comment = "日期")
+	private Date updateDate;
+	
+	@JsonProperty("fillterStart")
+	@Column(order = 22, name = "c_fillterStart", length = 10, nullable = true, comment = "计算典型年所用数据开始时间")
+	private Date fillterStart;
+	
+	@JsonProperty("fillterEnd")
+	@Column(order = 23, name = "c_fillterEnd", length = 10, nullable = true, comment = "计算典型年所用数据结束时间")
+	private Date fillterEnd;
+	
+	@JsonProperty("hdd")
+	@Column(order = 30, name = "c_hdd", length = 10, nullable = true, comment = "供暖度日数")
+	private Double hdd;
+	
+	@JsonProperty("cdd")
+	@Column(order = 31, name = "c_cdd", length = 10, nullable = true, comment = "供冷度日数")
+	private Double cdd;
+
+	@Column(order = 40, name = "c_max_temp", length = 10, scale = 2, nullable = true, comment = "最高温度,单位为c摄氏度或f华氏度")
+	@JsonProperty("maxTemp")
+	private Double maxTemp;
+	
+	@Column(order = 50, name = "c_min_temp", length = 10, scale = 2, nullable = true, comment = "最低温度,单位为c摄氏度或f华氏度")
+	@JsonProperty("minTemp")
+	private Double minTemp;
+	
+	@Column(order = 60, name = "c_avg_temp", length = 10, scale = 2, nullable = true, comment = "平均温度,单位为c摄氏度或f华氏度")
+	@JsonProperty("avgTemp")
+	private Double avgTemp;
+
+	@Column(order = 70, name = "c_max_wind_speed", length = 10, scale = 2, nullable = true, comment = "最大风速,单位为km/h公里每小时或mph英里每小时")
+	@JsonProperty("maxWindSpeed")
+	private Double maxWindSpeed;
+	
+	@Column(order = 80, name = "c_min_wind_speed", length = 10, scale = 2, nullable = true, comment = "最小风速,单位为km/h公里每小时或mph英里每小时")
+	@JsonProperty("minWindSpeed")
+	private Double minWindSpeed;
+	
+	@Column(order = 90, name = "c_avg_wind_speed", length = 10, scale = 2, nullable = true, comment = "平均风速,单位为km/h公里每小时或mph英里每小时")
+	@JsonProperty("avgWindSpeed")
+	private Double avgWindSpeed;
+	
+	@Column(order = 100, name = "c_max_humidity", length = 10, scale = 2, nullable = true, comment = "最高相对湿度,0~100,单位为百分比")
+	@JsonProperty("maxHumidity")
+	private Double maxHumidity;
+	
+	@Column(order = 110, name = "c_avg_humidity", length = 10, scale = 2,  nullable = true, comment = "平均湿度,0~100,单位为百分比")
+	@JsonProperty("avgHumidity")
+	private Double avgHumidity;
+	
+	@Column(order = 120, name = "c_min_humidity", length = 10, scale = 2,  nullable = true, comment = "最低相对湿度,0~100,单位为百分比")
+	@JsonProperty("minHumidity")
+	private Double minHumidity;
+
+	@Column(order = 130, name = "c_max_pressure", length = 10, scale = 2,  nullable = true, comment = "最高气压,单位为mb百帕或in英寸")
+	@JsonProperty("maxPressure")
+	private Double maxPressure;
+	
+	@Column(order = 140, name = "c_min_pressure", length = 10, scale = 2, nullable = true, comment = "最低气压,单位为mb百帕或in英寸")
+	@JsonProperty("minPressure")
+	private Double minPressure;
+	
+	@Column(order = 150, name = "c_avg_pressure", length = 10, scale = 2, nullable = true, comment = "平均气压,单位为mb百帕或in英寸")
+	@JsonProperty("avgPressure")
+	private Double avgPressure;
+	
+	@Column(order = 160, name = "c_max_vidibility", length = 10, scale = 2, nullable = true, comment = "最高能见度,单位为km公里或mi英里")
+	@JsonProperty("maxVidibility")
+	private Double maxVidibility;
+	
+	@Column(order = 170, name = "c_min_vidibility", length = 10, nullable = true, comment = "最低能见度,单位为km公里或mi英里")
+	@JsonProperty("minVidibility")
+	private Double minVidibility;
+	
+	@Column(order = 180, name = "c_avg_visibility", length = 10, nullable = true, comment = "平均能见度,单位为km公里或mi英里")
+	@JsonProperty("avgVidibility")
+	private Double avgVidibility;
+
+	public String getCityCode() {
+		return cityCode;
+	}
+
+	public void setCityCode(String cityCode) {
+		this.cityCode = cityCode;
+	}
+
+	public Date getDate() {
+		return date;
+	}
+
+	public void setDate(Date date) {
+		this.date = date;
+	}
+	
+	public Date getUpdateDate() {
+		return updateDate;
+	}
+
+	public void setUpdateDate(Date updateDate) {
+		this.updateDate = updateDate;
+	}
+	
+	public Date getFillterStart() {
+		return fillterStart;
+	}
+
+	public void setFillterStart(Date fillterStart) {
+		this.fillterStart = fillterStart;
+	}
+
+	public Date getFillterEnd() {
+		return fillterEnd;
+	}
+
+	public void setFillterEnd(Date fillterEnd) {
+		this.fillterEnd = fillterEnd;
+	}
+
+	public Double getHdd() {
+		return hdd;
+	}
+
+	public void setHdd(Double hdd) {
+		this.hdd = hdd;
+	}
+
+	public Double getCdd() {
+		return cdd;
+	}
+
+	public void setCdd(Double cdd) {
+		this.cdd = cdd;
+	}
+
+	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 Double getMaxWindSpeed() {
+		return maxWindSpeed;
+	}
+
+	public void setMaxWindSpeed(Double maxWindSpeed) {
+		this.maxWindSpeed = maxWindSpeed;
+	}
+
+	public Double getMinWindSpeed() {
+		return minWindSpeed;
+	}
+
+	public void setMinWindSpeed(Double minWindSpeed) {
+		this.minWindSpeed = minWindSpeed;
+	}
+
+	public Double getAvgWindSpeed() {
+		return avgWindSpeed;
+	}
+
+	public void setAvgWindSpeed(Double avgWindSpeed) {
+		this.avgWindSpeed = avgWindSpeed;
+	}
+
+	public Double getMaxHumidity() {
+		return maxHumidity;
+	}
+
+	public void setMaxHumidity(Double maxHumidity) {
+		this.maxHumidity = maxHumidity;
+	}
+
+	public Double getAvgHumidity() {
+		return avgHumidity;
+	}
+
+	public void setAvgHumidity(Double avgHumidity) {
+		this.avgHumidity = avgHumidity;
+	}
+
+	public Double getMinHumidity() {
+		return minHumidity;
+	}
+
+	public void setMinHumidity(Double minHumidity) {
+		this.minHumidity = minHumidity;
+	}
+
+	public Double getMaxPressure() {
+		return maxPressure;
+	}
+
+	public void setMaxPressure(Double maxPressure) {
+		this.maxPressure = maxPressure;
+	}
+
+	public Double getMinPressure() {
+		return minPressure;
+	}
+
+	public void setMinPressure(Double minPressure) {
+		this.minPressure = minPressure;
+	}
+
+	public Double getAvgPressure() {
+		return avgPressure;
+	}
+
+	public void setAvgPressure(Double avgPressure) {
+		this.avgPressure = avgPressure;
+	}
+
+	public Double getMaxVidibility() {
+		return maxVidibility;
+	}
+
+	public void setMaxVidibility(Double maxVidibility) {
+		this.maxVidibility = maxVidibility;
+	}
+
+	public Double getMinVidibility() {
+		return minVidibility;
+	}
+
+	public void setMinVidibility(Double minVidibility) {
+		this.minVidibility = minVidibility;
+	}
+
+	public Double getAvgVidibility() {
+		return avgVidibility;
+	}
+
+	public void setAvgVidibility(Double avgVidibility) {
+		this.avgVidibility = avgVidibility;
+	}
+
+}

+ 79 - 0
src/main/java/com/persagy/ems/pojo/holiday/HolidayGoseek.java

@@ -0,0 +1,79 @@
+package com.persagy.ems.pojo.holiday;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BaseId;
+
+@Dimension
+@Entity(name = "HolidayGoseek")
+@Table(name = "t_holiday_goseek", comment = "法定节假日信息", schema = Schema.EMS)
+public class HolidayGoseek extends BaseId {
+	private static final long serialVersionUID = 6484225657271639993L;
+
+	@JsonProperty("year")
+	@Column(order = 1, name = "c_year", length = 10, nullable = false, comment = "年份")
+	private Integer year;
+
+	@Column(order = 10, name = "c_date_time", length = 0, nullable = true, comment = "天时间")
+	@JsonProperty("dateTime")
+	private Date dateTime;
+	
+	/** 正常工作日对应结果为 0, 法定节假日对应结果为 1, 节假日调休补班对应的结果为 2 */
+	@Column(order = 20, name = "c_code", length = 10, nullable = true, comment = "编码")
+	@JsonProperty("code")
+	private Integer code;
+
+	@Column(order = 30, name = "c_codestr", length = 100, nullable = true, comment = "编码2")
+	@JsonProperty("codeStr")
+	private String codeStr;
+
+	public HolidayGoseek() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public HolidayGoseek(Integer year, Date dateTime, Integer code) {
+		super();
+		this.year = year;
+		this.dateTime = dateTime;
+		this.code = code;
+	}
+	
+	public Integer getYear() {
+		return year;
+	}
+
+	public void setYear(Integer year) {
+		this.year = year;
+	}
+
+	public Date getDateTime() {
+		return dateTime;
+	}
+
+	public void setDateTime(Date dateTime) {
+		this.dateTime = dateTime;
+	}
+
+	public Integer getCode() {
+		return code;
+	}
+
+	public void setCode(Integer code) {
+		this.code = code;
+	}
+
+	public String getCodeStr() {
+		return codeStr;
+	}
+
+	public void setCodeStr(String codeStr) {
+		this.codeStr = codeStr;
+	}
+}

+ 398 - 0
src/main/java/com/persagy/ems/pojo/old/WeatherHourData.java

@@ -0,0 +1,398 @@
+package com.persagy.ems.pojo.old;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.enumeration.EMSDimension;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ * 按城市进行分表存储,小时粒度的天气信息
+ *
+ */
+@Dimension(dimension=EMSDimension.Building)
+@Entity(name = "WeatherHourData")
+@Table(name = "t_weatherhour", schema = Schema.UDM, comment = "天气1小时的数据", indexes = {
+		@Index(columns = { "c_location_id", "c_receive_time" }, unique = true) })
+public class WeatherHourData extends BusinessObject {
+	 
+	private static final long serialVersionUID = 546310440259754238L;
+
+	@JsonProperty("locationId")
+	@Column(order = 1, name = "c_location_id", length = 40, nullable = false, comment = "主表id")
+	private String locationId;
+
+	@JsonProperty("receivetime")
+	@Column(order = 10, name = "c_receive_time", length = 0, nullable = false, comment = "数据时间")
+	private Date receivetime;
+	
+	@Column(order = 20, name = "c_pm25", length = 40, nullable = true, comment = "PM2.5颗粒物(粒径小于等于2.5μm)1小时平均值。单位:μg/m³")
+	@JsonProperty("pm25")
+	private String pm25;
+
+	@Column(order = 30, name = "c_pm10", length = 40, nullable = true, comment = "PM10颗粒物(粒径小于等于10μm)1小时平均值。单位:μg/m³")
+	@JsonProperty("pm10")
+	private String pm10;
+
+	@Column(order = 40, name = "c_so2", length = 40, nullable = true, comment = "二氧化硫1小时平均值。单位:μg/m³")
+	@JsonProperty("so2")
+	private String so2;
+
+	@Column(order = 50, name = "c_no2", length = 40, nullable = true, comment = "二氧化氮1小时平均值。单位:μg/m³")
+	@JsonProperty("no2")
+	private String no2;
+
+	@Column(order = 60, name = "c_co", length = 40, nullable = true, comment = "一氧化碳1小时平均值。单位:mg/m³")
+	@JsonProperty("co")
+	private String co;
+
+	@Column(order = 70, name = "c_o3", length = 40, nullable = true, comment = "臭氧1小时平均值。单位:μg/m³")
+	@JsonProperty("o3")
+	private String o3;
+
+	@Column(order = 80, name = "c_quality", length = 40, nullable = true, comment = "空气质量类别,有“优、良、轻度污染、中度污染、重度污染、严重污染”6类")
+	@JsonProperty("quality")
+	private String quality;
+
+	@Column(order = 90, name = "c_last_update", length = 40, nullable = true, comment = "数据更新时间(该城市的本地时间)")
+	@JsonProperty("lastUpdate")
+	private String lastUpdate;
+
+	@Column(order = 10, name = "c_aqi", length = 40, nullable = true, comment = "空气质量指数(AQI)是描述空气质量状况的定量指数")
+	@JsonProperty("aqi")
+	private String aqi;
+
+	@Column(order = 110, name = "c_text_day", length = 40, nullable = true, comment = "白天天气现象文字")
+	@JsonProperty("textDay")
+	private String textDay;
+
+	@Column(order = 120, name = "c_code_day", length = 40, nullable = true, comment = "白天天气现象代码")
+	@JsonProperty("codeDay")
+	private String codeDay;
+
+	@Column(order = 130, name = "c_text_night", length = 40, nullable = true, comment = "晚间天气现象文字")
+	@JsonProperty("textNight")
+	private String textNight;
+
+	@Column(order = 140, name = "c_code_night", length = 40, nullable = true, comment = "晚间天气现象代码")
+	@JsonProperty("codeNight")
+	private String codeNight;
+
+	@Column(order = 150, name = "c_high", length = 40, nullable = true, comment = "当天最高温度")
+	@JsonProperty("high")
+	private String high;
+
+	@Column(order = 160, name = "c_low", length = 40, nullable = true, comment = "当天最低温度")
+	@JsonProperty("low")
+	private String low;
+
+	@Column(order = 170, name = "c_precip", length = 40, nullable = true, comment = "降水概率,范围0~100,单位百分比")
+	@JsonProperty("precip")
+	private String precip;
+
+	@Column(order = 180, name = "c_wind_direction", length = 40, nullable = true, comment = "风向文字")
+	@JsonProperty("windDirection")
+	private String windDirection;
+
+	@Column(order = 190, name = "c_wind_direction_degree", length = 40, nullable = true, comment = "风向角度,范围0~360,0为正北,90为正东,180为正南,270为正西")
+	@JsonProperty("windDirectionDegree")
+	private String windDirectionDegree;
+
+	@Column(order = 200, name = "c_wind_speed", length = 40, nullable = true, comment = "风速,单位为km/h公里每小时或mph英里每小时")
+	@JsonProperty("windSpeed")
+	private String windSpeed;
+
+	@Column(order = 210, name = "c_wind_scale", length = 40, nullable = true, comment = "风力等级")
+	@JsonProperty("windScale")
+	private String windScale;
+
+	@Column(order = 220, name = "c_text", length = 40, nullable = true, comment = "天气现象文字")
+	@JsonProperty("text")
+	private String text;
+
+	@Column(order = 230, name = "c_code", length = 40, nullable = true, comment = "天气现象代码")
+	@JsonProperty("code")
+	private String code;
+
+	@Column(order = 240, name = "c_temperature", length = 40, nullable = true, comment = "温度,单位为c摄氏度或f华氏度")
+	@JsonProperty("temperature")
+	private String temperature;
+
+	@Column(order = 250, name = "c_feels_like", length = 40, nullable = true, comment = "体感温度,单位为c摄氏度或f华氏度")
+	@JsonProperty("feelsLike")
+	private String feelsLike;
+
+	@Column(order = 260, name = "c_pressure", length = 40, nullable = true, comment = "气压,单位为mb百帕或in英寸")
+	@JsonProperty("pressure")
+	private String pressure;
+
+	@Column(order = 270, name = "c_humidity", length = 40, nullable = true, comment = "相对湿度,0~100,单位为百分比")
+	@JsonProperty("humidity")
+	private String humidity;
+
+	@Column(order = 280, name = "c_visibility", length = 40, nullable = true, comment = "能见度,单位为km公里或mi英里")
+	@JsonProperty("visibility")
+	private String visibility;
+
+	@Column(order = 290, name = "c_clouds", length = 40, nullable = true, comment = "云量,范围0~100,天空被云覆盖的百分比")
+	@JsonProperty("clouds")
+	private String clouds;
+
+	@Column(order = 300, name = "c_dew_point", length = 40, nullable = true, comment = "露点温度")
+	@JsonProperty("dewPoint")
+	private String dewPoint;
+
+	public String getLocationId() {
+		return locationId;
+	}
+
+	public void setLocationId(String locationId) {
+		this.locationId = locationId;
+	}
+
+	public Date getReceivetime() {
+		return receivetime;
+	}
+
+	public void setReceivetime(Date receivetime) {
+		this.receivetime = receivetime;
+	}
+
+	public String getPm25() {
+		return pm25;
+	}
+
+	public void setPm25(String pm25) {
+		this.pm25 = pm25;
+	}
+
+	public String getPm10() {
+		return pm10;
+	}
+
+	public void setPm10(String pm10) {
+		this.pm10 = pm10;
+	}
+
+	public String getSo2() {
+		return so2;
+	}
+
+	public void setSo2(String so2) {
+		this.so2 = so2;
+	}
+
+	public String getNo2() {
+		return no2;
+	}
+
+	public void setNo2(String no2) {
+		this.no2 = no2;
+	}
+
+	public String getCo() {
+		return co;
+	}
+
+	public void setCo(String co) {
+		this.co = co;
+	}
+
+	public String getO3() {
+		return o3;
+	}
+
+	public void setO3(String o3) {
+		this.o3 = o3;
+	}
+
+	public String getQuality() {
+		return quality;
+	}
+
+	public void setQuality(String quality) {
+		this.quality = quality;
+	}
+
+	public String getLastUpdate() {
+		return lastUpdate;
+	}
+
+	public void setLastUpdate(String lastUpdate) {
+		this.lastUpdate = lastUpdate;
+	}
+
+	public String getAqi() {
+		return aqi;
+	}
+
+	public void setAqi(String aqi) {
+		this.aqi = aqi;
+	}
+
+	public String getTextDay() {
+		return textDay;
+	}
+
+	public void setTextDay(String textDay) {
+		this.textDay = textDay;
+	}
+
+	public String getCodeDay() {
+		return codeDay;
+	}
+
+	public void setCodeDay(String codeDay) {
+		this.codeDay = codeDay;
+	}
+
+	public String getTextNight() {
+		return textNight;
+	}
+
+	public void setTextNight(String textNight) {
+		this.textNight = textNight;
+	}
+
+	public String getCodeNight() {
+		return codeNight;
+	}
+
+	public void setCodeNight(String codeNight) {
+		this.codeNight = codeNight;
+	}
+
+	public String getHigh() {
+		return high;
+	}
+
+	public void setHigh(String high) {
+		this.high = high;
+	}
+
+	public String getLow() {
+		return low;
+	}
+
+	public void setLow(String low) {
+		this.low = low;
+	}
+
+	public String getPrecip() {
+		return precip;
+	}
+
+	public void setPrecip(String precip) {
+		this.precip = precip;
+	}
+
+	public String getWindDirection() {
+		return windDirection;
+	}
+
+	public void setWindDirection(String windDirection) {
+		this.windDirection = windDirection;
+	}
+
+	public String getWindDirectionDegree() {
+		return windDirectionDegree;
+	}
+
+	public void setWindDirectionDegree(String windDirectionDegree) {
+		this.windDirectionDegree = windDirectionDegree;
+	}
+
+	public String getWindSpeed() {
+		return windSpeed;
+	}
+
+	public void setWindSpeed(String windSpeed) {
+		this.windSpeed = windSpeed;
+	}
+
+	public String getWindScale() {
+		return windScale;
+	}
+
+	public void setWindScale(String windScale) {
+		this.windScale = windScale;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getTemperature() {
+		return temperature;
+	}
+
+	public void setTemperature(String temperature) {
+		this.temperature = temperature;
+	}
+
+	public String getFeelsLike() {
+		return feelsLike;
+	}
+
+	public void setFeelsLike(String feelsLike) {
+		this.feelsLike = feelsLike;
+	}
+
+	public String getPressure() {
+		return pressure;
+	}
+
+	public void setPressure(String pressure) {
+		this.pressure = pressure;
+	}
+
+	public String getHumidity() {
+		return humidity;
+	}
+
+	public void setHumidity(String humidity) {
+		this.humidity = humidity;
+	}
+
+	public String getVisibility() {
+		return visibility;
+	}
+
+	public void setVisibility(String visibility) {
+		this.visibility = visibility;
+	}
+
+	public String getClouds() {
+		return clouds;
+	}
+
+	public void setClouds(String clouds) {
+		this.clouds = clouds;
+	}
+
+	public String getDewPoint() {
+		return dewPoint;
+	}
+
+	public void setDewPoint(String dewPoint) {
+		this.dewPoint = dewPoint;
+	}
+}

+ 74 - 0
src/main/java/com/persagy/ems/pojo/old/WeatherMonthData.java

@@ -0,0 +1,74 @@
+package com.persagy.ems.pojo.old;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ * 龙湖定制
+ */
+@Dimension
+@Entity(name = "WeatherMonthData")
+@Table(name = "t_weather_month_data", schema = Schema.UDM, comment = "天气5分钟的数据", indexes = {
+		@Index(columns = { "c_location_id", "c_receive_time" }, unique = true) })
+public class WeatherMonthData extends BusinessObject {
+
+	private static final long serialVersionUID = 2389680252274743015L;
+
+	@JsonProperty("locationId")
+	@Column(order = 1, name = "c_location_id", length = 50, nullable = false, comment = "城市编码")
+	private String locationId;
+
+	@JsonProperty("receivetime")
+	@Column(order = 3, name = "c_receive_time", length = 0, nullable = false, comment = "数据时间")
+	private Date receivetime;
+
+	@JsonProperty("data")
+	@Column(order = 4, name = "c_data", length = 18, scale = 8, nullable = false, comment = "数值")
+	private Double data;
+
+	@JsonProperty("type")
+	@Column(order = 1, name = "c_type", length = 5, nullable = false, comment = "类型")
+	private Integer type;
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public String getLocationId() {
+		return locationId;
+	}
+
+	public void setLocationId(String locationId) {
+		this.locationId = locationId;
+	}
+
+	public Date getReceivetime() {
+		return receivetime;
+	}
+
+	public void setReceivetime(Date receivetime) {
+		this.receivetime = receivetime;
+	}
+
+	public Double getData() {
+		return data;
+	}
+
+	public void setData(Double data) {
+		this.data = data;
+	}
+
+}
+

+ 61 - 0
src/main/java/com/persagy/ems/pojo/system/FileResource.java

@@ -0,0 +1,61 @@
+package com.persagy.ems.pojo.system;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BaseId;
+
+/**
+ * 文件资源存储  文件,图片等信息
+ */
+@Dimension
+@Entity(name="FileResource")
+@Table(
+		name="t_file_resource",
+		comment="文件资源存储",
+		schema=Schema.EMS
+)
+public class FileResource extends BaseId {
+
+	private static final long serialVersionUID = 7471065344744148494L;
+	
+	@Column(order=10,name="c_name",length=100,nullable=true,comment="文件显示名")
+	@JsonProperty("name")
+	private String name;
+	
+	@Column(order=20,name="c_suffix",length=10,nullable=true,comment="后缀")
+	@JsonProperty("suffix")
+	private String suffix;
+	
+	@Column(order=30,name="c_subdirectory",length=500,nullable=false,comment="子目录")
+	@JsonProperty("subdirectory")
+	private String subdirectory;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getSuffix() {
+		return suffix;
+	}
+
+	public void setSuffix(String suffix) {
+		this.suffix = suffix;
+	}
+
+	public String getSubdirectory() {
+		return subdirectory;
+	}
+
+	public void setSubdirectory(String subdirectory) {
+		this.subdirectory = subdirectory;
+	}
+	
+}

+ 95 - 0
src/main/java/com/persagy/ems/pojo/wz/ApiRequester.java

@@ -0,0 +1,95 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+@Dimension
+@Entity(name = "ApiRequester")
+@Table(name = "t_apirequest_total", comment = "访问接口api信息", schema = Schema.EMS, indexes = {
+		@Index(columns = { "c_ip", "c_api_name" })})
+public class ApiRequester extends BusinessObject {
+
+	private static final long serialVersionUID = 2607036763890821951L;
+	@JsonProperty("ip")
+	@Column(order = 1, name = "c_ip", length = 100, nullable = false, comment = "ip地址")
+	private String ip;
+	@JsonProperty("name")
+	@Column(order = 2, name = "c_name", length = 100, nullable = true, comment = "名称")
+	private String name;
+	@JsonProperty("apiName")
+	@Column(order = 2, name = "c_api_name", length = 100, nullable = false, comment = "接口名称")
+	private String apiName;
+	@Column(order = 3, name = "c_api_num", length = 10, nullable = true, comment = "接口请求总次数")
+	@JsonProperty("apiNum")
+	private Integer apiNum;
+	@JsonProperty("remark")
+	@Column(order = 4, name = "c_remark", length = 255, nullable = true, comment = "备注信息")
+	private String remark;
+	@JsonProperty("dataEndTime")
+	@Column(order = 5, name = "c_data_end_time", length = 0, nullable = false, comment = "数据统计截止时间")
+	private Date dataEndTime;
+	@JsonProperty("insertTime")
+	@Column(order = 6, name = "c_insert_time", length = 0, nullable = false, comment = "新增时间")
+	private Date insertTime;
+	@JsonProperty("updateTime")
+	@Column(order = 7, name = "c_update_time", length = 0, nullable = false, comment = "更新时间")
+	private Date updateTime;
+	
+	public String getIp() {
+		return ip;
+	}
+	public void setIp(String ip) {
+		this.ip = ip;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getApiName() {
+		return apiName;
+	}
+	public void setApiName(String apiName) {
+		this.apiName = apiName;
+	}
+	public Integer getApiNum() {
+		return apiNum;
+	}
+	public void setApiNum(Integer apiNum) {
+		this.apiNum = apiNum;
+	}
+	public String getRemark() {
+		return remark;
+	}
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+	public Date getDataEndTime() {
+		return dataEndTime;
+	}
+	public void setDataEndTime(Date dataEndTime) {
+		this.dataEndTime = dataEndTime;
+	}
+	public Date getInsertTime() {
+		return insertTime;
+	}
+	public void setInsertTime(Date insertTime) {
+		this.insertTime = insertTime;
+	}
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+	
+}

+ 95 - 0
src/main/java/com/persagy/ems/pojo/wz/ApiRequester2.java

@@ -0,0 +1,95 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+@Dimension
+@Entity(name = "ApiRequester")
+@Table(name = "t_apirequest_1to5", comment = "访问接口api信息", schema = Schema.EMS, indexes = {
+		@Index(columns = { "c_ip", "c_api_name" })})
+public class ApiRequester2 extends BusinessObject {
+
+	private static final long serialVersionUID = 2607036763890821951L;
+	@JsonProperty("ip")
+	@Column(order = 1, name = "c_ip", length = 100, nullable = false, comment = "ip地址")
+	private String ip;
+	@JsonProperty("name")
+	@Column(order = 2, name = "c_name", length = 100, nullable = true, comment = "名称")
+	private String name;
+	@JsonProperty("apiName")
+	@Column(order = 2, name = "c_api_name", length = 100, nullable = false, comment = "接口名称")
+	private String apiName;
+	@Column(order = 3, name = "c_api_num", length = 10, nullable = true, comment = "接口请求总次数")
+	@JsonProperty("apiNum")
+	private Integer apiNum;
+	@JsonProperty("remark")
+	@Column(order = 4, name = "c_remark", length = 255, nullable = true, comment = "备注信息")
+	private String remark;
+	@JsonProperty("dataEndTime")
+	@Column(order = 5, name = "c_data_end_time", length = 0, nullable = false, comment = "数据统计截止时间")
+	private Date dataEndTime;
+	@JsonProperty("insertTime")
+	@Column(order = 6, name = "c_insert_time", length = 0, nullable = false, comment = "新增时间")
+	private Date insertTime;
+	@JsonProperty("updateTime")
+	@Column(order = 7, name = "c_update_time", length = 0, nullable = false, comment = "更新时间")
+	private Date updateTime;
+	
+	public String getIp() {
+		return ip;
+	}
+	public void setIp(String ip) {
+		this.ip = ip;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getApiName() {
+		return apiName;
+	}
+	public void setApiName(String apiName) {
+		this.apiName = apiName;
+	}
+	public Integer getApiNum() {
+		return apiNum;
+	}
+	public void setApiNum(Integer apiNum) {
+		this.apiNum = apiNum;
+	}
+	public String getRemark() {
+		return remark;
+	}
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+	public Date getDataEndTime() {
+		return dataEndTime;
+	}
+	public void setDataEndTime(Date dataEndTime) {
+		this.dataEndTime = dataEndTime;
+	}
+	public Date getInsertTime() {
+		return insertTime;
+	}
+	public void setInsertTime(Date insertTime) {
+		this.insertTime = insertTime;
+	}
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+	
+}

+ 76 - 0
src/main/java/com/persagy/ems/pojo/wz/BusinessApiStatic.java

@@ -0,0 +1,76 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+@Dimension
+@Entity(name = "BusinessApiStatic")
+@Table(name = "t_apibusiness_static", comment = "业务接口访问统计", schema = Schema.EMS, indexes = {
+		@Index(columns = { "c_ip", "c_hour_time" }),
+		@Index(columns = { "c_hour_time", "c_ip", "c_api" }, unique = true),
+		@Index(columns = { "c_hour_time", "c_api" })})
+public class BusinessApiStatic extends BusinessObject {
+	private static final long serialVersionUID = -3111604843136305804L;
+	@JsonProperty("ip")
+	@Column(order = 1, name = "c_ip", length = 100, nullable = false, comment = "ip地址")
+	private String ip;
+	@JsonProperty("api")
+	@Column(order = 2, name = "c_api", length = 100, nullable = false, comment = "接口名")
+	private String api;
+	@Column(order = 3, name = "c_num", length = 10, nullable = true, comment = "请求次数")
+	@JsonProperty("num")
+	private Integer num;
+	@JsonProperty("hourTime")
+	@Column(order = 4, name = "c_hour_time", length = 0, nullable = false, comment = "开始统计时间")
+	private Date hourTime;
+	@JsonProperty("updateTime")
+	@Column(order = 5, name = "c_update_time", length = 0, nullable = false, comment = "数据保存时间")
+	private Date updateTime;
+	@JsonProperty("remark")
+	@Column(order = 6, name = "c_remark", length = 255, nullable = true, comment = "备注ip地址")
+	private String remark;
+	public String getIp() {
+		return ip;
+	}
+	public void setIp(String ip) {
+		this.ip = ip;
+	}
+	public Integer getNum() {
+		return num;
+	}
+	public void setNum(Integer num) {
+		this.num = num;
+	}
+	public String getApi() {
+		return api;
+	}
+	public void setApi(String api) {
+		this.api = api;
+	}
+	public Date getHourTime() {
+		return hourTime;
+	}
+	public void setHourTime(Date hourTime) {
+		this.hourTime = hourTime;
+	}
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+	public String getRemark() {
+		return remark;
+	}
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+}

+ 57 - 0
src/main/java/com/persagy/ems/pojo/wz/CityLocation.java

@@ -0,0 +1,57 @@
+package com.persagy.ems.pojo.wz;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Id;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ * 城市信息
+ */
+@Dimension
+@Entity(name = "CityLocation")
+@Table(name = "t_city_location", schema = Schema.EMS, comment = "城市信息")
+public class CityLocation extends BusinessObject {
+	private static final long serialVersionUID = 3477628911821892063L;
+
+	@Id
+	@JsonProperty("name")
+	@Column(order = 1, name = "c_name", length = 50, nullable = false, comment = "城市")
+	private String name;
+
+	@JsonProperty("info")
+	@Column(order = 2, name = "c_info", length = 500, nullable = true, comment = "信息,json字符串")
+	private String info;
+
+	@JsonProperty("remark")
+	@Column(order = 3, name = "c_remark", length = 500, nullable = true, comment = "数值")
+	private String remark;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getInfo() {
+		return info;
+	}
+
+	public void setInfo(String info) {
+		this.info = info;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+}

+ 229 - 0
src/main/java/com/persagy/ems/pojo/wz/DayHisRecord.java

@@ -0,0 +1,229 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.enumeration.EMSDimension;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ * 日天气数据
+ */
+@Dimension(dimension = EMSDimension.Building)
+@Entity(name = "DayHisRecord")
+@Table(name = "t_day", comment = "日天气数据", schema = Schema.EMS, indexes = {
+		@Index(columns = {"c_day_time", "c_city_Id"}, unique = true),
+		@Index(columns = {"c_city_Id"})})
+public class DayHisRecord extends BusinessObject {
+	private static final long serialVersionUID = 98000227837355389L;
+
+	@Column(order = 10, name = "c_city_Id", length = 40, nullable = false, comment = "城市ID")
+	@JsonProperty("cityId")
+	private String cityId;
+
+	@Column(order = 20, name = "c_day_time", length = 0, nullable = false, comment = "日时间")
+	@JsonProperty("dayTime")
+	private Date dayTime;
+	
+	@Column(order = 30, name = "c_update_time", length = 0, nullable = false, comment = "数据更新时间")
+	@JsonProperty("updateTime")
+	private Date updateTime;
+	
+	@Column(order = 40, name = "c_text_day", length = 20, nullable = true, comment = "白天天气现象文字")
+	@JsonProperty("text_day")
+	private String text_day;
+
+	@Column(order = 50, name = "c_code_day", length = 10, nullable = true, comment = "白天天气现象代码")
+	@JsonProperty("code_day")
+	private String code_day;
+
+	@Column(order = 60, name = "c_text_night", length = 20, nullable = true, comment = "晚间天气现象文字")
+	@JsonProperty("text_night")
+	private String text_night;
+
+	@Column(order = 70, name = "c_code_night", length = 10, nullable = true, comment = "晚间天气现象代码")
+	@JsonProperty("code_night")
+	private String code_night;
+
+	@Column(order = 80, name = "c_high", length = 10, nullable = true, comment = "当天最高温度")
+	@JsonProperty("high")
+	private String high;
+
+	@Column(order = 90, name = "c_low", length = 10, nullable = true, comment = "当天最低温度")
+	@JsonProperty("low")
+	private String low;
+
+	@Column(order = 100, name = "c_precip", length = 10, nullable = true, comment = "降水概率,范围0~100,单位百分比(目前仅支持国外城市)")
+	@JsonProperty("precip")
+	private String precip;
+	
+	@Column(order = 110, name = "c_wind_direction", length = 20, nullable = true, comment = "风向文字")
+	@JsonProperty("wind_direction")
+	private String wind_direction;
+	
+	@Column(order = 120, name = "c_wind_direction_degree", length = 10, nullable = true, comment = "风向角度,范围0~360,0为正北,90为正东,180为正南,270为正西")
+	@JsonProperty("wind_direction_degree")
+	private String wind_direction_degree;
+	
+	@Column(order = 130, name = "c_wind_speed", length = 10, nullable = true, comment = "风速")
+	@JsonProperty("wind_speed")
+	private String wind_speed;
+	
+	@Column(order = 140, name = "c_wind_scale", length = 10, nullable = true, comment = "风力等级")
+	@JsonProperty("wind_scale")
+	private String wind_scale;
+	
+	@Column(order = 150, name = "c_rainfall", length = 10, nullable = true, comment = "云量,范围0~100,天空被云覆盖的百分比")
+	@JsonProperty("rainfall")
+	private String rainfall;
+	
+	@Column(order = 160, name = "c_humidity", length = 10, nullable = true, comment = "云量,范围0~100,天空被云覆盖的百分比")
+	@JsonProperty("humidity")
+	private String humidity;
+	
+	@Column(order=170, name="c_last_update", length=0, nullable=true, comment="数据最新更新时间")
+	@JsonProperty("lastUpdate")
+	private Date lastUpdate;
+
+	public String getCityId() {
+		return cityId;
+	}
+
+	public void setCityId(String cityId) {
+		this.cityId = cityId;
+	}
+
+	public Date getDayTime() {
+		return dayTime;
+	}
+
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public String getText_day() {
+		return text_day;
+	}
+
+	public void setText_day(String text_day) {
+		this.text_day = text_day;
+	}
+
+	public String getCode_day() {
+		return code_day;
+	}
+
+	public void setCode_day(String code_day) {
+		this.code_day = code_day;
+	}
+
+	public String getText_night() {
+		return text_night;
+	}
+
+	public void setText_night(String text_night) {
+		this.text_night = text_night;
+	}
+
+	public String getCode_night() {
+		return code_night;
+	}
+
+	public void setCode_night(String code_night) {
+		this.code_night = code_night;
+	}
+
+	public String getHigh() {
+		return high;
+	}
+
+	public void setHigh(String high) {
+		this.high = high;
+	}
+
+	public String getLow() {
+		return low;
+	}
+
+	public void setLow(String low) {
+		this.low = low;
+	}
+
+	public String getPrecip() {
+		return precip;
+	}
+
+	public void setPrecip(String precip) {
+		this.precip = precip;
+	}
+
+	public String getWind_direction() {
+		return wind_direction;
+	}
+
+	public void setWind_direction(String wind_direction) {
+		this.wind_direction = wind_direction;
+	}
+
+	public String getWind_direction_degree() {
+		return wind_direction_degree;
+	}
+
+	public void setWind_direction_degree(String wind_direction_degree) {
+		this.wind_direction_degree = wind_direction_degree;
+	}
+
+	public String getWind_speed() {
+		return wind_speed;
+	}
+
+	public void setWind_speed(String wind_speed) {
+		this.wind_speed = wind_speed;
+	}
+
+	public String getWind_scale() {
+		return wind_scale;
+	}
+
+	public void setWind_scale(String wind_scale) {
+		this.wind_scale = wind_scale;
+	}
+
+	public String getRainfall() {
+		return rainfall;
+	}
+
+	public void setRainfall(String rainfall) {
+		this.rainfall = rainfall;
+	}
+
+	public String getHumidity() {
+		return humidity;
+	}
+
+	public void setHumidity(String humidity) {
+		this.humidity = humidity;
+	}
+
+	public Date getLastUpdate() {
+		return lastUpdate;
+	}
+
+	public void setLastUpdate(Date lastUpdate) {
+		this.lastUpdate = lastUpdate;
+	}
+}

+ 228 - 0
src/main/java/com/persagy/ems/pojo/wz/DayPredictRecord.java

@@ -0,0 +1,228 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ * 日天气数据
+ */
+@Dimension
+@Entity(name = "DayPredictRecord")
+@Table(name = "t_day_predict15", comment = "日天气数据", schema = Schema.EMS, indexes = {
+		@Index(columns = {"c_day_time", "c_city_Id"}, unique = true),
+		@Index(columns = {"c_city_Id"})})
+public class DayPredictRecord extends BusinessObject {
+	private static final long serialVersionUID = -8754374697346443026L;
+
+	@Column(order = 10, name = "c_city_Id", length = 40, nullable = false, comment = "城市ID")
+	@JsonProperty("cityId")
+	private String cityId;
+
+	@Column(order = 20, name = "c_day_time", length = 0, nullable = false, comment = "日时间")
+	@JsonProperty("dayTime")
+	private Date dayTime;
+	
+	@Column(order = 30, name = "c_update_time", length = 0, nullable = false, comment = "数据更新时间")
+	@JsonProperty("updateTime")
+	private Date updateTime;
+	
+	@Column(order = 40, name = "c_text_day", length = 20, nullable = true, comment = "白天天气现象文字")
+	@JsonProperty("text_day")
+	private String text_day;
+
+	@Column(order = 50, name = "c_code_day", length = 10, nullable = true, comment = "白天天气现象代码")
+	@JsonProperty("code_day")
+	private String code_day;
+
+	@Column(order = 60, name = "c_text_night", length = 20, nullable = true, comment = "晚间天气现象文字")
+	@JsonProperty("text_night")
+	private String text_night;
+
+	@Column(order = 70, name = "c_code_night", length = 10, nullable = true, comment = "晚间天气现象代码")
+	@JsonProperty("code_night")
+	private String code_night;
+
+	@Column(order = 80, name = "c_high", length = 10, nullable = true, comment = "当天最高温度")
+	@JsonProperty("high")
+	private String high;
+
+	@Column(order = 90, name = "c_low", length = 10, nullable = true, comment = "当天最低温度")
+	@JsonProperty("low")
+	private String low;
+
+	@Column(order = 100, name = "c_precip", length = 10, nullable = true, comment = "降水概率,范围0~100,单位百分比(目前仅支持国外城市)")
+	@JsonProperty("precip")
+	private String precip;
+	
+	@Column(order = 110, name = "c_wind_direction", length = 20, nullable = true, comment = "风向文字")
+	@JsonProperty("wind_direction")
+	private String wind_direction;
+	
+	@Column(order = 120, name = "c_wind_direction_degree", length = 10, nullable = true, comment = "风向角度,范围0~360,0为正北,90为正东,180为正南,270为正西")
+	@JsonProperty("wind_direction_degree")
+	private String wind_direction_degree;
+	
+	@Column(order = 130, name = "c_wind_speed", length = 10, nullable = true, comment = "风速")
+	@JsonProperty("wind_speed")
+	private String wind_speed;
+	
+	@Column(order = 140, name = "c_wind_scale", length = 10, nullable = true, comment = "风力等级")
+	@JsonProperty("wind_scale")
+	private String wind_scale;
+	
+	@Column(order = 150, name = "c_rainfall", length = 10, nullable = true, comment = "云量,范围0~100,天空被云覆盖的百分比")
+	@JsonProperty("rainfall")
+	private String rainfall;
+	
+	@Column(order = 160, name = "c_humidity", length = 10, nullable = true, comment = "云量,范围0~100,天空被云覆盖的百分比")
+	@JsonProperty("humidity")
+	private String humidity;
+	
+	@Column(order=170, name="c_last_update", length=0, nullable=true, comment="数据最新更新时间")
+	@JsonProperty("lastUpdate")
+	private Date lastUpdate;
+
+	public String getCityId() {
+		return cityId;
+	}
+
+	public void setCityId(String cityId) {
+		this.cityId = cityId;
+	}
+
+	public Date getDayTime() {
+		return dayTime;
+	}
+
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public String getText_day() {
+		return text_day;
+	}
+
+	public void setText_day(String text_day) {
+		this.text_day = text_day;
+	}
+
+	public String getCode_day() {
+		return code_day;
+	}
+
+	public void setCode_day(String code_day) {
+		this.code_day = code_day;
+	}
+
+	public String getText_night() {
+		return text_night;
+	}
+
+	public void setText_night(String text_night) {
+		this.text_night = text_night;
+	}
+
+	public String getCode_night() {
+		return code_night;
+	}
+
+	public void setCode_night(String code_night) {
+		this.code_night = code_night;
+	}
+
+	public String getHigh() {
+		return high;
+	}
+
+	public void setHigh(String high) {
+		this.high = high;
+	}
+
+	public String getLow() {
+		return low;
+	}
+
+	public void setLow(String low) {
+		this.low = low;
+	}
+
+	public String getPrecip() {
+		return precip;
+	}
+
+	public void setPrecip(String precip) {
+		this.precip = precip;
+	}
+
+	public String getWind_direction() {
+		return wind_direction;
+	}
+
+	public void setWind_direction(String wind_direction) {
+		this.wind_direction = wind_direction;
+	}
+
+	public String getWind_direction_degree() {
+		return wind_direction_degree;
+	}
+
+	public void setWind_direction_degree(String wind_direction_degree) {
+		this.wind_direction_degree = wind_direction_degree;
+	}
+
+	public String getWind_speed() {
+		return wind_speed;
+	}
+
+	public void setWind_speed(String wind_speed) {
+		this.wind_speed = wind_speed;
+	}
+
+	public String getWind_scale() {
+		return wind_scale;
+	}
+
+	public void setWind_scale(String wind_scale) {
+		this.wind_scale = wind_scale;
+	}
+
+	public String getRainfall() {
+		return rainfall;
+	}
+
+	public void setRainfall(String rainfall) {
+		this.rainfall = rainfall;
+	}
+
+	public String getHumidity() {
+		return humidity;
+	}
+
+	public void setHumidity(String humidity) {
+		this.humidity = humidity;
+	}
+
+	public Date getLastUpdate() {
+		return lastUpdate;
+	}
+
+	public void setLastUpdate(Date lastUpdate) {
+		this.lastUpdate = lastUpdate;
+	}
+}

+ 105 - 0
src/main/java/com/persagy/ems/pojo/wz/DayStaticMoreRecord.java

@@ -0,0 +1,105 @@
+package com.persagy.ems.pojo.wz;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.enumeration.EMSDimension;
+import com.persagy.core.mvc.pojo.BusinessObject;
+import java.util.Date;
+
+@Dimension(dimension = EMSDimension.Building)
+@Entity(name = "DayStaticMoreRecord")
+@Table(name = "t_day_static_more", comment = "天气数据统计", schema = Schema.EMS, indexes = {
+		@Index(columns = { "c_city_Id", "c_day_time" }, unique = true),
+		@Index(columns = { "c_day_time", "c_city_Id" }) })
+public class DayStaticMoreRecord extends BusinessObject {
+	private static final long serialVersionUID = 3236557856634985217L;
+	
+	@JsonProperty("cityId")
+	@Column(order = 2, name = "c_city_Id", length = 40, nullable = false, comment = "城市编码")
+	private String cityId;
+	@JsonProperty("dayTime")
+	@Column(order = 3, name = "c_day_time", length = 0, nullable = false, comment = "日开始时间")
+	private Date dayTime;
+	@JsonProperty("updateTime")
+	@Column(order = 3, name = "c_update_time", length = 0, nullable = false, comment = "数据保存时间")
+	private Date updateTime;
+	@Column(order = 4, name = "c_avg_temp", length = 40, scale = 1, nullable = true, comment = "日平均温度,单位c摄氏度")
+	@JsonProperty("avgTemp")
+	private Double avgTemp;
+	@Column(order = 5, name = "c_avg_wind_speed", length = 40, scale = 1, nullable = true, comment = "日平均风速,单位km/h")
+	@JsonProperty("avgWindSpeed")
+	private Double avgWindSpeed;
+	@Column(order = 6, name = "c_avg_humidity", length = 40, scale = 1, nullable = true, comment = "日平均相对湿度,0~100,单位百分比")
+	@JsonProperty("avgHumidity")
+	private Double avgHumidity;
+	@Column(order = 7, name = "c_avg_pressure", length = 40, scale = 1, nullable = true, comment = "日平均气压,单位mb百帕")
+	@JsonProperty("avgPressure")
+	private Double avgPressure;
+	@Column(order = 8, name = "c_avg_visibility", length = 40, scale = 1, nullable = true, comment = "日平均能见度,单位为km公里")
+	@JsonProperty("avgVisibility")
+	private Double avgVisibility;
+	@Column(order = 9, name = "c_info", length = 255, nullable = true, comment = "附加信息,存放json格式字符串")
+	@JsonProperty("info")
+	private String info;
+	
+	public String getCityId() {
+		return cityId;
+	}
+	public void setCityId(String cityId) {
+		this.cityId = cityId;
+	}
+	public Date getDayTime() {
+		return dayTime;
+	}
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+	public Double getAvgTemp() {
+		return avgTemp;
+	}
+	public void setAvgTemp(Double avgTemp) {
+		this.avgTemp = avgTemp;
+	}
+	public Double getAvgWindSpeed() {
+		return avgWindSpeed;
+	}
+	public void setAvgWindSpeed(Double avgWindSpeed) {
+		this.avgWindSpeed = avgWindSpeed;
+	}
+	public Double getAvgHumidity() {
+		return avgHumidity;
+	}
+	public void setAvgHumidity(Double avgHumidity) {
+		this.avgHumidity = avgHumidity;
+	}
+	public Double getAvgPressure() {
+		return avgPressure;
+	}
+	public void setAvgPressure(Double avgPressure) {
+		this.avgPressure = avgPressure;
+	}
+	public Double getAvgVisibility() {
+		return avgVisibility;
+	}
+	public void setAvgVisibility(Double avgVisibility) {
+		this.avgVisibility = avgVisibility;
+	}
+	public String getInfo() {
+		return info;
+	}
+	public void setInfo(String info) {
+		this.info = info;
+	}
+	
+}

+ 165 - 0
src/main/java/com/persagy/ems/pojo/wz/DayStaticRecord.java

@@ -0,0 +1,165 @@
+package com.persagy.ems.pojo.wz;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.enumeration.EMSDimension;
+import com.persagy.core.mvc.pojo.BusinessObject;
+import java.util.Date;
+
+@Dimension(dimension = EMSDimension.Building)
+@Entity(name = "DayStaticRecord")
+@Table(name = "t_day_static", comment = "天气数据统计", schema = Schema.EMS, indexes = {
+		@Index(columns = { "c_city_Id", "c_day_time" }, unique = true),
+		@Index(columns = { "c_day_time", "c_city_Id" }) })
+public class DayStaticRecord extends BusinessObject {
+	private static final long serialVersionUID = 8185957512341152181L;
+	
+	@JsonProperty("cityId")
+	@Column(order = 2, name = "c_city_Id", length = 40, nullable = false, comment = "城市编码")
+	private String cityId;
+	@JsonProperty("dayTime")
+	@Column(order = 3, name = "c_day_time", length = 0, nullable = false, comment = "日开始时间")
+	private Date dayTime;
+	@JsonProperty("updateTime")
+	@Column(order = 3, name = "c_update_time", length = 0, nullable = false, comment = "数据保存时间")
+	private Date updateTime;
+	@Column(order = 4, name = "c_max_temp", length = 40, nullable = true, comment = "最高温度,单位c摄氏度或f华氏度")
+	@JsonProperty("maxTemp")
+	private Double maxTemp;
+	@Column(order = 5, name = "c_min_temp", length = 40, nullable = true, comment = "最低温度,单位c摄氏度或f华氏度")
+	@JsonProperty("minTemp")
+	private Double minTemp;
+	@Column(order = 7, name = "c_max_wind_speed", length = 40, nullable = true, comment = "最大风速,单位km/h")
+	@JsonProperty("maxWindSpeed")
+	private Double maxWindSpeed;
+	@Column(order = 8, name = "c_min_wind_speed", length = 40, nullable = true, comment = "最小风速,单位km/h")
+	@JsonProperty("minWindSpeed")
+	private Double minWindSpeed;
+	@Column(order = 9, name = "c_max_humidity", length = 40, nullable = true, comment = "相对湿度,0~100,单位百分比")
+	@JsonProperty("maxHumidity")
+	private Double maxHumidity;
+	@Column(order = 10, name = "c_min_humidity", length = 40, nullable = true, comment = "相对湿度,0~100,单位百分比")
+	@JsonProperty("minHumidity")
+	private Double minHumidity;
+	@Column(order = 11, name = "c_max_pressure", length = 40, nullable = true, comment = "气压,单位mb百帕")
+	@JsonProperty("maxPressure")
+	private Double maxPressure;
+	@Column(order = 12, name = "c_min_pressure", length = 40, nullable = true, comment = "气压,单位mb百帕")
+	@JsonProperty("minPressure")
+	private Double minPressure;
+	@Column(order = 13, name = "c_max_visibility", length = 40, nullable = true, comment = "能见度,单位为km公里")
+	@JsonProperty("maxVisibility")
+	private Double maxVisibility;
+	@Column(order = 14, name = "c_min_visibility", length = 40, nullable = true, comment = "能见度,单位为km公里")
+	@JsonProperty("minVisibility")
+	private Double minVisibility;
+
+	public String getCityId() {
+		return cityId;
+	}
+
+	public void setCityId(String cityId) {
+		this.cityId = cityId;
+	}
+
+	public Date getDayTime() {
+		return dayTime;
+	}
+
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	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 getMaxWindSpeed() {
+		return maxWindSpeed;
+	}
+
+	public void setMaxWindSpeed(Double maxWindSpeed) {
+		this.maxWindSpeed = maxWindSpeed;
+	}
+
+	public Double getMinWindSpeed() {
+		return minWindSpeed;
+	}
+
+	public void setMinWindSpeed(Double minWindSpeed) {
+		this.minWindSpeed = minWindSpeed;
+	}
+
+	public Double getMaxHumidity() {
+		return maxHumidity;
+	}
+
+	public void setMaxHumidity(Double maxHumidity) {
+		this.maxHumidity = maxHumidity;
+	}
+
+	public Double getMinHumidity() {
+		return minHumidity;
+	}
+
+	public void setMinHumidity(Double minHumidity) {
+		this.minHumidity = minHumidity;
+	}
+
+	public Double getMaxPressure() {
+		return maxPressure;
+	}
+
+	public void setMaxPressure(Double maxPressure) {
+		this.maxPressure = maxPressure;
+	}
+
+	public Double getMinPressure() {
+		return minPressure;
+	}
+
+	public void setMinPressure(Double minPressure) {
+		this.minPressure = minPressure;
+	}
+
+	public Double getMaxVisibility() {
+		return maxVisibility;
+	}
+
+	public void setMaxVisibility(Double maxVisibility) {
+		this.maxVisibility = maxVisibility;
+	}
+
+	public Double getMinVisibility() {
+		return minVisibility;
+	}
+
+	public void setMinVisibility(Double minVisibility) {
+		this.minVisibility = minVisibility;
+	}
+}

+ 67 - 0
src/main/java/com/persagy/ems/pojo/wz/DependApiStatic.java

@@ -0,0 +1,67 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+@Dimension
+@Entity(name = "DependApiStatic")
+@Table(name = "t_apiouter_static", comment = "第三方接口访问统计", schema = Schema.EMS, indexes = {
+		@Index(columns = { "c_name", "c_type", "c_day_time" }, unique = true),
+		@Index(columns = { "c_day_time", "c_name", "c_type" }),
+		@Index(columns = { "c_day_time", "c_type" })})
+public class DependApiStatic extends BusinessObject {
+	private static final long serialVersionUID = 1162327033704027573L;
+	@JsonProperty("name")
+	@Column(order = 1, name = "c_name", length = 50, nullable = false, comment = "城市编码")
+	private String name;
+	@Column(order = 2, name = "c_num", length = 10, nullable = true, comment = "请求次数")
+	@JsonProperty("num")
+	private Integer num;
+	@JsonProperty("type")
+	@Column(order = 3, name = "c_type", length = 50, nullable = false, comment = "类型")
+	private String type;
+	@JsonProperty("dayTime")
+	@Column(order = 3, name = "c_day_time", length = 0, nullable = false, comment = "日开始时间")
+	private Date dayTime;
+	@JsonProperty("updateTime")
+	@Column(order = 3, name = "c_update_time", length = 0, nullable = false, comment = "数据保存时间")
+	private Date updateTime;
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Integer getNum() {
+		return num;
+	}
+	public void setNum(Integer num) {
+		this.num = num;
+	}
+	public String getType() {
+		return type;
+	}
+	public void setType(String type) {
+		this.type = type;
+	}
+	public Date getDayTime() {
+		return dayTime;
+	}
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+}

+ 145 - 0
src/main/java/com/persagy/ems/pojo/wz/DisasterWarning.java

@@ -0,0 +1,145 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.enumeration.EMSDimension;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ *	灾害预警
+ */
+@Dimension(dimension=EMSDimension.Building)
+@Entity(name = "DisasterWarning")
+@Table(name = "t_disaster", comment = "灾害预警信息", schema = Schema.EMS, indexes = {
+		@Index(columns={"c_city_Id", "c_pub_time", "c_type", "c_level"}), 
+		@Index(columns={"c_name", "c_pub_time", "c_type", "c_level"})})
+public class DisasterWarning extends BusinessObject{
+	private static final long serialVersionUID = -3666854586091234686L;
+
+	@JsonProperty("cityId")
+	@Column(order = 0, name = "c_city_Id", length = 40, nullable = false, comment = "城市ID")
+	private String cityId;
+
+	@Column(order = 1, name = "c_name", length = 40, nullable = false, comment = "城市名称")
+	@JsonProperty("name")
+	private String name;
+
+	@Column(order = 2, name = "c_path", length = 50, nullable = false, comment = "隶属层级,从小到大")
+	@JsonProperty("path")
+	private String path;
+	
+	@Column(order = 3, name = "c_pub_time", length = 0, nullable = false, comment = "官网发布时间")
+	@JsonProperty("pubTime")
+	private Date pubTime;
+	
+	@Column(order = 4, name = "c_insert_time", length = 0, nullable = false, comment = "数据插入时间")
+	@JsonProperty("insertTime")
+	private Date insertTime;
+
+	@Column(order = 30, name = "c_title", length = 100, nullable = false, comment = "预警标题")
+	@JsonProperty("title")
+	private String title;
+	
+	@Column(order = 40, name = "c_type", length = 50, nullable = false, comment = "灾害类型")
+	@JsonProperty("type")
+	private String type;
+	
+	@Column(order = 50, name = "c_level", length = 10, nullable = false, comment = "灾害等级")
+	@JsonProperty("level")
+	private String level;
+	
+	@Column(order = 60, name = "c_status", length = 10, nullable = true, comment = "灾害状态")
+	@JsonProperty("status")
+	private String status;
+	
+	@Column(order = 70, name = "c_description", length = 1000, nullable = true, comment = "灾害描述")
+	@JsonProperty("description")
+	private String description;
+
+	public String getCityId() {
+		return cityId;
+	}
+
+	public void setCityId(String cityId) {
+		this.cityId = cityId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getPath() {
+		return path;
+	}
+
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	public Date getPubTime() {
+		return pubTime;
+	}
+
+	public void setPubTime(Date pubTime) {
+		this.pubTime = pubTime;
+	}
+
+	public Date getInsertTime() {
+		return insertTime;
+	}
+
+	public void setInsertTime(Date insertTime) {
+		this.insertTime = insertTime;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getLevel() {
+		return level;
+	}
+
+	public void setLevel(String level) {
+		this.level = level;
+	}
+
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+}

+ 337 - 0
src/main/java/com/persagy/ems/pojo/wz/HourRecordData.java

@@ -0,0 +1,337 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.enumeration.EMSDimension;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ * 小时天气信息
+ */
+@Dimension(dimension = EMSDimension.Building)
+@Entity(name = "HourRecordData")
+@Table(name = "t_hour", schema = Schema.EMS, comment = "天气1小时的数据", indexes = {
+		@Index(columns = {"c_hour_time", "c_city_id"}, unique = true) })
+public class HourRecordData extends BusinessObject {
+	private static final long serialVersionUID = 546310440259754238L;
+	public boolean flag;
+	
+	@JsonProperty("cityId")
+	@Column(order = 0, name = "c_city_id", length = 50, nullable = false, comment = "城市id")
+	private String cityId;
+
+	@JsonProperty("hourTime")
+	@Column(order = 0, name = "c_hour_time", length = 0, nullable = false, comment = "数据时间")
+	private Date hourTime;
+	
+	@Column(order = 1, name = "now_last_update", length = 0, nullable = true, comment = "天气实况数据更新时间(该城市的本地时间)")
+	@JsonProperty("lastUpdateNow")
+	private Date lastUpdateNow;
+	
+	@Column(order = 2, name = "now_text", length = 20, nullable = true, comment = "天气现象文字")
+	@JsonProperty("text")
+	private String text;
+
+	@Column(order = 3, name = "now_code", length = 10, nullable = true, comment = "天气现象代码")
+	@JsonProperty("code")
+	private String code;
+
+	@Column(order = 4, name = "now_temperature", length = 10, nullable = true, comment = "温度,单位为c摄氏度或f华氏度")
+	@JsonProperty("temperature")
+	private String temperature;
+
+	@Column(order = 5, name = "now_feels_like", length = 10, nullable = true, comment = "体感温度,单位为c摄氏度或f华氏度")
+	@JsonProperty("feels_like")
+	private String feels_like;
+
+	@Column(order = 6, name = "now_pressure", length = 10, nullable = true, comment = "气压,单位为mb百帕或in英寸")
+	@JsonProperty("pressure")
+	private String pressure;
+
+	@Column(order = 7, name = "now_humidity", length = 10, nullable = true, comment = "相对湿度,0~100,单位为百分比")
+	@JsonProperty("humidity")
+	private String humidity;
+
+	@Column(order = 8, name = "now_visibility", length = 10, nullable = true, comment = "能见度,单位为km公里或mi英里")
+	@JsonProperty("visibility")
+	private String visibility;
+	
+	@Column(order = 9, name = "now_wind_direction", length = 40, nullable = true, comment = "风向文字")
+	@JsonProperty("wind_direction")
+	private String wind_direction;
+	
+	@Column(order = 10, name = "now_wind_direction_degree", length = 40, nullable = true, comment = "风向角度,范围0~360,0为正北,90为正东,180为正南,270为正西")
+	@JsonProperty("wind_direction_degree")
+	private String wind_direction_degree;
+	
+	@Column(order = 11, name = "now_wind_speed", length = 20, nullable = true, comment = "风速")
+	@JsonProperty("wind_speed")
+	private String wind_speed;
+	
+	@Column(order = 12, name = "now_wind_scale", length = 20, nullable = true, comment = "风力等级")
+	@JsonProperty("wind_scale")
+	private String wind_scale;
+	
+	@Column(order = 13, name = "now_clouds", length = 10, nullable = true, comment = "云量,范围0~100,天空被云覆盖的百分比")
+	@JsonProperty("clouds")
+	private String clouds;
+	
+	@Column(order = 14, name = "now_dew_point", length = 20, nullable = true, comment = "露点温度")
+	@JsonProperty("dew_point")
+	private String dew_point;
+
+	@Column(order = 15, name = "air_pm25", length = 10, nullable = true, comment = "PM2.5颗粒物(粒径小于等于2.5μm)1小时平均值。单位:μg/m³")
+	@JsonProperty("pm25")
+	private String pm25;
+
+	@Column(order = 16, name = "air_pm10", length = 10, nullable = true, comment = "PM10颗粒物(粒径小于等于10μm)1小时平均值。单位:μg/m³")
+	@JsonProperty("pm10")
+	private String pm10;
+
+	@Column(order = 17, name = "air_so2", length = 10, nullable = true, comment = "二氧化硫1小时平均值。单位:μg/m³")
+	@JsonProperty("so2")
+	private String so2;
+
+	@Column(order = 18, name = "air_no2", length = 10, nullable = true, comment = "二氧化氮1小时平均值。单位:μg/m³")
+	@JsonProperty("no2")
+	private String no2;
+
+	@Column(order = 19, name = "air_co", length = 10, nullable = true, comment = "一氧化碳1小时平均值。单位:mg/m³")
+	@JsonProperty("co")
+	private String co;
+
+	@Column(order = 20, name = "air_o3", length = 10, nullable = true, comment = "臭氧1小时平均值。单位:μg/m³")
+	@JsonProperty("o3")
+	private String o3;
+
+	@Column(order = 21, name = "air_quality", length = 20, nullable = true, comment = "空气质量类别,有“优、良、轻度污染、中度污染、重度污染、严重污染”6类")
+	@JsonProperty("quality")
+	private String quality;
+
+	@Column(order = 22, name = "air_aqi", length = 20, nullable = true, comment = "空气质量指数(AQI)是描述空气质量状况的定量指数")
+	@JsonProperty("aqi")
+	private String aqi;
+
+	@Column(order = 23, name = "air_primary_pollutant", length = 20, nullable = true, comment = "首要污染物")
+	@JsonProperty("primary_pollutant")
+	private String primary_pollutant;
+
+	@Column(order = 24, name = "air_last_update", length = 0, nullable = true, comment = "空气质量数据更新时间(该城市的本地时间)")
+	@JsonProperty("lastUpdateAir")
+	private Date lastUpdateAir;
+	
+	public String getCityId() {
+		return cityId;
+	}
+
+	public void setCityId(String cityId) {
+		this.cityId = cityId;
+	}
+
+	public Date getHourTime() {
+		return hourTime;
+	}
+
+	public void setHourTime(Date hourTime) {
+		this.hourTime = hourTime;
+	}
+
+	public Date getLastUpdateNow() {
+		return lastUpdateNow;
+	}
+
+	public void setLastUpdateNow(Date lastUpdateNow) {
+		this.lastUpdateNow = lastUpdateNow;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getTemperature() {
+		return temperature;
+	}
+
+	public void setTemperature(String temperature) {
+		this.temperature = temperature;
+	}
+
+	public String getFeels_like() {
+		return feels_like;
+	}
+
+	public void setFeels_like(String feels_like) {
+		this.feels_like = feels_like;
+	}
+
+	public String getPressure() {
+		return pressure;
+	}
+
+	public void setPressure(String pressure) {
+		this.pressure = pressure;
+	}
+
+	public String getHumidity() {
+		return humidity;
+	}
+
+	public void setHumidity(String humidity) {
+		this.humidity = humidity;
+	}
+
+	public String getVisibility() {
+		return visibility;
+	}
+
+	public void setVisibility(String visibility) {
+		this.visibility = visibility;
+	}
+
+	public String getWind_direction() {
+		return wind_direction;
+	}
+
+	public void setWind_direction(String wind_direction) {
+		this.wind_direction = wind_direction;
+	}
+
+	public String getWind_direction_degree() {
+		return wind_direction_degree;
+	}
+
+	public void setWind_direction_degree(String wind_direction_degree) {
+		this.wind_direction_degree = wind_direction_degree;
+	}
+
+	public String getWind_speed() {
+		return wind_speed;
+	}
+
+	public void setWind_speed(String wind_speed) {
+		this.wind_speed = wind_speed;
+	}
+
+	public String getWind_scale() {
+		return wind_scale;
+	}
+
+	public void setWind_scale(String wind_scale) {
+		this.wind_scale = wind_scale;
+	}
+
+	public String getClouds() {
+		return clouds;
+	}
+
+	public void setClouds(String clouds) {
+		this.clouds = clouds;
+	}
+
+	public String getDew_point() {
+		return dew_point;
+	}
+
+	public void setDew_point(String dew_point) {
+		this.dew_point = dew_point;
+	}
+
+	public String getPm25() {
+		return pm25;
+	}
+
+	public void setPm25(String pm25) {
+		this.pm25 = pm25;
+	}
+
+	public String getPm10() {
+		return pm10;
+	}
+
+	public void setPm10(String pm10) {
+		this.pm10 = pm10;
+	}
+
+	public String getSo2() {
+		return so2;
+	}
+
+	public void setSo2(String so2) {
+		this.so2 = so2;
+	}
+
+	public String getNo2() {
+		return no2;
+	}
+
+	public void setNo2(String no2) {
+		this.no2 = no2;
+	}
+
+	public String getCo() {
+		return co;
+	}
+
+	public void setCo(String co) {
+		this.co = co;
+	}
+
+	public String getO3() {
+		return o3;
+	}
+
+	public void setO3(String o3) {
+		this.o3 = o3;
+	}
+
+	public String getQuality() {
+		return quality;
+	}
+
+	public void setQuality(String quality) {
+		this.quality = quality;
+	}
+
+	public String getAqi() {
+		return aqi;
+	}
+
+	public void setAqi(String aqi) {
+		this.aqi = aqi;
+	}
+
+	public String getPrimary_pollutant() {
+		return primary_pollutant;
+	}
+
+	public void setPrimary_pollutant(String primary_pollutant) {
+		this.primary_pollutant = primary_pollutant;
+	}
+
+	public Date getLastUpdateAir() {
+		return lastUpdateAir;
+	}
+
+	public void setLastUpdateAir(Date lastUpdateAir) {
+		this.lastUpdateAir = lastUpdateAir;
+	}
+}

+ 72 - 0
src/main/java/com/persagy/ems/pojo/wz/MinuteRecordData.java

@@ -0,0 +1,72 @@
+package com.persagy.ems.pojo.wz;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.persagy.core.annotation.Column;
+import com.persagy.core.annotation.Dimension;
+import com.persagy.core.annotation.Entity;
+import com.persagy.core.annotation.Index;
+import com.persagy.core.annotation.Table;
+import com.persagy.core.enumeration.Schema;
+import com.persagy.core.enumeration.EMSDimension;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ * 龙湖定制5minute天气数据
+ */
+@Dimension(dimension = EMSDimension.Building)
+@Entity(name = "MinuteRecordData")
+@Table(name = "t_minute", schema = Schema.EMS, comment = "天气5分钟的数据", indexes = {
+		@Index(columns = { "c_city_id", "c_minute_time" }, unique = true) })
+public class MinuteRecordData extends BusinessObject {
+	private static final long serialVersionUID = -4532764045820431446L;
+
+	@JsonProperty("cityId")
+	@Column(order = 1, name = "c_city_id", length = 50, nullable = false, comment = "城市编码")
+	private String cityId;
+
+	@JsonProperty("minuteTime")
+	@Column(order = 2, name = "c_minute_time", length = 0, nullable = false, comment = "数据时间")
+	private Date minuteTime;
+
+	@JsonProperty("data")
+	@Column(order = 3, name = "c_data", length = 18, scale = 8, nullable = false, comment = "数值")
+	private Double data;
+
+	@JsonProperty("type")
+	@Column(order = 3, name = "c_type", length = 5, nullable = false, comment = "类型")
+	private Integer type;
+
+	public String getCityId() {
+		return cityId;
+	}
+
+	public void setCityId(String cityId) {
+		this.cityId = cityId;
+	}
+
+	public Date getMinuteTime() {
+		return minuteTime;
+	}
+
+	public void setMinuteTime(Date minuteTime) {
+		this.minuteTime = minuteTime;
+	}
+
+	public Double getData() {
+		return data;
+	}
+
+	public void setData(Double data) {
+		this.data = data;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+}

+ 14 - 0
src/main/java/com/persagy/framework/construct/RequestProcessor.java

@@ -0,0 +1,14 @@
+package com.persagy.framework.construct;
+
+/**
+ * 请求处理接口 
+ */
+public interface RequestProcessor {
+	/***
+	 * 请求处理执行逻辑
+	 * @param jsonString json字符串格式参数
+	 * @return 处理结果
+	 * @throws Exception
+	 */
+	public Object handle(String jsonString) throws Exception;
+}

+ 68 - 0
src/main/java/com/persagy/framework/dto/ApiResult.java

@@ -0,0 +1,68 @@
+package com.persagy.framework.dto;
+
+public class ApiResult {
+	public static final String result_success = "success";
+	public static final String result_fail = "fail";
+	
+	private ApiResult() {
+	}
+	
+	public static ApiResult instance(boolean success) {
+		ApiResult ins = new ApiResult();
+		if(success) {
+			ins.setResult(result_success);
+		}else {
+			ins.setResult(result_fail);
+		}
+		return ins;
+	}
+	
+	public static ApiResult instanceError(String message) {
+		ApiResult ins = new ApiResult();
+		ins.setResult(result_fail);
+		ins.setMessage(message);
+		return ins;
+	}
+	
+	public static ApiResult instanceSuccess() {
+		ApiResult ins = new ApiResult();
+		ins.setResult(result_success);
+		return ins;
+	}
+	
+	public static ApiResult instanceSuccess(Object data) {
+		ApiResult ins = new ApiResult();
+		ins.setResult(result_success);
+		ins.setData(data);
+		return ins;
+	}
+	
+	public static ApiResult getInstance() {
+		ApiResult ins = new ApiResult();
+		ins.setResult(result_fail);
+		return ins;
+	}
+	
+	private String result;
+	private String message;
+	private Object data;
+	public String getResult() {
+		return result;
+	}
+	public void setResult(String result) {
+		this.result = result;
+	}
+	public String getMessage() {
+		return message;
+	}
+	public void setMessage(String message) {
+		this.message = message;
+	}
+	public Object getData() {
+		return data;
+	}
+	public void setData(Object data) {
+		this.data = data;
+	}
+	
+}

+ 5 - 0
src/main/java/com/persagy/framework/dto/BaseDTO.java

@@ -0,0 +1,5 @@
+package com.persagy.framework.dto;
+
+public abstract class BaseDTO {
+
+}

+ 24 - 0
src/main/java/com/persagy/framework/dto/BusinessResultDTO.java

@@ -0,0 +1,24 @@
+package com.persagy.framework.dto;
+
+public class BusinessResultDTO {
+	private boolean arrayData;
+	private Object data;
+	
+	public BusinessResultDTO(boolean arrayData, Object data) {
+		this.arrayData = arrayData;
+		this.data = data;
+	}
+	
+	public boolean isArrayData() {
+		return arrayData;
+	}
+	public void setArrayData(boolean arrayData) {
+		this.arrayData = arrayData;
+	}
+	public Object getData() {
+		return data;
+	}
+	public void setData(Object data) {
+		this.data = data;
+	}
+}

+ 41 - 0
src/main/java/com/persagy/framework/dto/FileConfigDTO.java

@@ -0,0 +1,41 @@
+package com.persagy.framework.dto;
+
+public class FileConfigDTO {
+	
+	private String fileName;
+	
+	private String fileSuffix;
+	
+	private String subdirectory;
+
+	public String getFileName() {
+		return fileName;
+	}
+
+	public void setFileName(String fileName) {
+		this.fileName = fileName;
+	}
+
+	public String getFileSuffix() {
+		return fileSuffix;
+	}
+
+	public void setFileSuffix(String fileSuffix) {
+		this.fileSuffix = fileSuffix;
+	}
+
+	public String getSubdirectory() {
+		return subdirectory;
+	}
+
+	public void setSubdirectory(String subdirectory) {
+		this.subdirectory = subdirectory;
+	}
+
+	@Override
+	public String toString() {
+		return "FileConfigDTO [fileName=" + fileName + ", fileSuffix="
+				+ fileSuffix + ", subdirectory=" + subdirectory + "]";
+	}
+	
+}

+ 19 - 0
src/main/java/com/persagy/framework/dto/FileResourceExtension.java

@@ -0,0 +1,19 @@
+package com.persagy.framework.dto;
+
+import com.persagy.ems.pojo.system.FileResource;
+
+public class FileResourceExtension extends FileResource {
+
+	private static final long serialVersionUID = -5157820498264781157L;
+	
+	private String baseDictionary;
+
+	public String getBaseDictionary() {
+		return baseDictionary;
+	}
+
+	public void setBaseDictionary(String baseDictionary) {
+		this.baseDictionary = baseDictionary;
+	}
+	
+}

+ 40 - 0
src/main/java/com/persagy/framework/filter/CorsFilter.java

@@ -0,0 +1,40 @@
+package com.persagy.framework.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;
+import javax.servlet.http.HttpServletResponse;
+
+public class CorsFilter implements Filter {
+
+	@Override
+	public void destroy() {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+			throws IOException, ServletException {
+		HttpServletResponse httpServletResponse = (HttpServletResponse) response;
+        httpServletResponse.setHeader("Access-Control-Allow-Origin", "*");
+        httpServletResponse.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+        httpServletResponse.setHeader("Access-Control-Max-Age", "3600");
+        httpServletResponse.setHeader("Access-Control-Allow-Headers",
+                "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
+        httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true");// 允许cookie
+        chain.doFilter(request, response);
+	}
+
+	@Override
+	public void init(FilterConfig arg0) throws ServletException {
+		// TODO Auto-generated method stub
+
+	}
+
+}

+ 77 - 0
src/main/java/com/persagy/framework/servlet/SystemInitServlet.java

@@ -0,0 +1,77 @@
+package com.persagy.framework.servlet;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+
+import org.apache.log4j.Logger;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import com.persagy.core.mvc.service.CoreService;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.PropertyUtil;
+import com.persagy.functions.weather.service.DayHisRecordService;
+import com.persagy.functions.weather.service.DayStaticService;
+import com.persagy.functions.weather.service.DependApiStaticService;
+import com.persagy.functions.weather.service.DisasterWarningService;
+import com.persagy.functions.weather.service.HourRecordService;
+import com.persagy.functions.weather.thread.DayDataRecordThread;
+import com.persagy.functions.weather.thread.DayStaticThread;
+import com.persagy.functions.weather.thread.DependAPIStaticThread;
+import com.persagy.functions.weather.thread.DisasterWarningThread;
+import com.persagy.functions.weather.thread.HourDataRecordThread;
+import com.persagy.functions.weather.thread.Min5LongHuThread;
+import com.persagy.functions.weather.thread.RequestIpStatisticThread;
+
+public class SystemInitServlet extends HttpServlet {
+	private static final long serialVersionUID = 8077103762776343464L;
+	private static final Logger log = Logger.getLogger(SystemInitServlet.class);
+
+	@Override
+	public void init() throws ServletException {
+		log.info("system init start......");
+		
+		ServletContext sc = this.getServletContext();
+		WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(sc);
+
+		CoreService coreService = (CoreService) context.getBean("coreService");
+		DisasterWarningService disasterService = (DisasterWarningService) context.getBean("disasterWarningService");
+		HourRecordService hourRecordService = (HourRecordService) context.getBean("hourRecordService");
+		DayHisRecordService dayHisRecordService = (DayHisRecordService) context.getBean("dayHisRecordService");
+		DayStaticService dayStaticService = (DayStaticService) context.getBean("dayStaticService");
+		DependApiStaticService dependApiStaticService = (DependApiStaticService) context.getBean("dependApiStaticService");
+		
+		log.info("config info init start...");
+		try {
+			ConfigUtil.cache_refresh_all();
+		} catch (Exception e) {
+			log.error("load config info error");
+			System.exit(1);
+		}
+		
+		String threadRun = PropertyUtil.getSystemProperty("thread.model");
+		if("true".equals(threadRun)) {
+			log.info("business thread objects start...");
+			new Thread(new Min5LongHuThread(coreService)).start();
+			
+			new Thread(new HourDataRecordThread(hourRecordService)).start();
+			
+			new Thread(new DisasterWarningThread(disasterService)).start();
+			
+			new Thread(new DayDataRecordThread(dayHisRecordService)).start();
+			
+			new Thread(new DayStaticThread(dayStaticService)).start();
+			
+			new Thread(new DependAPIStaticThread(dependApiStaticService, "Thread")).start();
+		}else {
+//			RequestIpStatisticThread rist = new RequestIpStatisticThread(coreService);
+//			rist.init();
+//			new Thread(rist).start();
+//			
+//			new Thread(new DependAPIStaticThread(dependApiStaticService, "Business")).start();
+		}
+		
+		log.info("system init end.");
+	}
+}

+ 340 - 0
src/main/java/com/persagy/framework/util/BeanUtils.java

@@ -0,0 +1,340 @@
+package com.persagy.framework.util;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.beanutils.converters.BigDecimalConverter;
+import org.apache.commons.beanutils.converters.DoubleConverter;
+import org.apache.commons.beanutils.converters.FloatConverter;
+import org.apache.commons.beanutils.converters.IntegerConverter;
+import org.apache.commons.beanutils.converters.LongConverter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.util.Assert;
+
+@SuppressWarnings({"rawtypes", "unchecked"})
+public class BeanUtils {
+
+	protected static final Log logger = LogFactory.getLog(BeanUtils.class);
+
+
+	/**
+	 * 通过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));
+				}
+			}
+		}
+	}
+	
+	/**
+	 * 按Filed的类型取得Field列表.
+	 */
+	public static List<Field> getFieldsByType(Object object, Class<?> type) {
+		List<Field> list = new ArrayList<Field>();
+		Field[] fields = object.getClass().getDeclaredFields();
+		for (Field field : fields) {
+			if (field.getType().isAssignableFrom(type)) {
+				list.add(field);
+			}
+		}
+		return list;
+	}
+
+	/**
+	 * 获得field的getter函数名称.
+	 */
+	public static String getGetterName(Class<?> type, String fieldName) {
+		Assert.notNull(type, "Type required");
+		Assert.hasText(fieldName, "FieldName required");
+
+		if (type.getName().equals("boolean")) {
+			return "is" + StringUtils.capitalize(fieldName);
+		} else {
+			return "get" + StringUtils.capitalize(fieldName);
+		}
+	}
+
+	/**
+	 * 获得field的getter函数,如果找不到该方法,返回null.
+	 */
+	public static Method getGetterMethod(Class<?> type, String fieldName) {
+		try {
+			return type.getMethod(getGetterName(type, fieldName));
+		} catch (NoSuchMethodException e) {
+			logger.error(e.getMessage(), e);
+		}
+		return null;
+	}
+
+	/**
+	 * bean属性复制
+	 * @param dest 目的
+	 * @param orig 源
+	 * @return
+	 */
+	public static final Object copyProperties(Object dest, Object orig) {
+		ConvertUtils.register(new DoubleConverter(null), Double.class);
+		ConvertUtils.register(new FloatConverter(null), Float.class);
+		ConvertUtils.register(new IntegerConverter(null), Integer.class);
+		ConvertUtils.register(new LongConverter(null), Long.class);
+		ConvertUtils.register(new BigDecimalConverter(null), BigDecimal.class);
+		if (orig != null) {
+			try {
+				org.apache.commons.beanutils.BeanUtils.copyProperties(dest, orig);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		} else {
+			dest = null;
+		}
+		return dest;
+	}
+
+	/**
+	 * Bean属性复制,如果源对象的属性值为空,此方法会将空值复制到目标对象的相应属性上。
+	 *
+	 * @param dest 目标对象
+	 * @param origi 源对象
+	 */
+	public static void copyPropertysWithNull(Object dest,Object origi){
+		ConvertUtils.register(new DoubleConverter(null), Double.class);
+		ConvertUtils.register(new FloatConverter(null), Float.class);
+		ConvertUtils.register(new IntegerConverter(null), Integer.class);
+		ConvertUtils.register(new LongConverter(null), Long.class);
+		PropertyDescriptor[] destDescriptors=PropertyUtils.getPropertyDescriptors(dest);
+	    PropertyDescriptor[] origiDescriptors=PropertyUtils.getPropertyDescriptors(origi);
+	    List<String> origiPropertyNames=new ArrayList<String>();
+	    for (int i=0; i<origiDescriptors.length; i++) {
+	      origiPropertyNames.add(origiDescriptors[i].getName());
+	    }
+	    for (int i=0; i<destDescriptors.length; i++) {
+	        PropertyDescriptor destProperty=destDescriptors[i];
+	        String name=destProperty.getName();
+
+	        try {
+	            if (origiPropertyNames.contains(name)) {
+	                Object value=PropertyUtils.getSimpleProperty(origi,name);
+	                PropertyUtils.setSimpleProperty(dest,name,value);
+	            }
+	        }
+	        catch (Exception ex) {
+//	        	ex.printStackTrace();
+	        }
+	    }
+	}
+	/**
+	 * Bean属性复制,如果源对象的属性值为" 非空",此方法会将空值复制到目标对象的相应属性上
+	 * @param dest
+	 * @param origi
+	 */
+	public static void copyPropertysWithoutNull(Object dest,Object origi)
+	{
+		ConvertUtils.register(new DoubleConverter(null), Double.class);
+		ConvertUtils.register(new FloatConverter(null), Float.class);
+		ConvertUtils.register(new IntegerConverter(null), Integer.class);
+		ConvertUtils.register(new LongConverter(null), Long.class);
+		PropertyDescriptor[] destDescriptors=PropertyUtils.getPropertyDescriptors(dest);
+	    PropertyDescriptor[] origiDescriptors=PropertyUtils.getPropertyDescriptors(origi);
+	    List<String> origiPropertyNames=new ArrayList<String>();
+	    for (int i=0; i<origiDescriptors.length; i++) {
+	      origiPropertyNames.add(origiDescriptors[i].getName());
+	    }
+	    for (int i=0; i<destDescriptors.length; i++) {
+	        PropertyDescriptor destProperty=destDescriptors[i];
+	        String name=destProperty.getName();
+
+	        try {
+	            if (origiPropertyNames.contains(name)) {
+	                Object value=PropertyUtils.getSimpleProperty(origi,name);
+	                if(value!=null)//只复制非空值
+	                	PropertyUtils.setSimpleProperty(dest,name,value);
+	            }
+	        }
+	        catch (Exception ex) {
+//	        	ex.printStackTrace();
+	        }
+	    }
+	}
+	/**
+	 * 根据属性名和值在beanList中查找bean的位置,未找到时返回-1
+	 * @param beanList list of bean
+	 * @param propertyName 属性
+	 * @param value 值
+	 * @return
+	 * @throws NoSuchMethodException
+	 * @throws InvocationTargetException
+	 * @throws IllegalAccessException
+	 */
+	public static int findInList(List<?> beanList,String propertyName,Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException{
+	  for(int i=0;i<beanList.size();i++){
+	    Object bean = beanList.get(i);
+	    Object tmpValue = PropertyUtils.getProperty(bean,propertyName);
+	    if (tmpValue == null){
+	      if(value==null){
+	        return i;
+	      }
+	    }else if(tmpValue.equals(value)){
+	      return i;
+	    }
+	  }
+	  return -1;
+	}
+  /**
+   * 根据属性名和值在beanList中查找bean,未找到时返回null
+   * @param beanList list of bean
+   * @param propertyName 属性
+   * @param value 值
+   * @return
+   * @throws NoSuchMethodException
+   * @throws InvocationTargetException
+   * @throws IllegalAccessException
+   */
+  public static Object findBean(List<?> beanList,String propertyName,Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException{
+    for(int i=0;i<beanList.size();i++){
+      Object bean = beanList.get(i);
+      Object tmpValue = PropertyUtils.getProperty(bean,propertyName);
+      if (tmpValue == null){
+        if(value==null){
+          return bean;
+        }
+      }else if(tmpValue.equals(value)){
+        return bean;
+      }
+    }
+    return null;
+  }
+  /**
+   * 根据属性名和值在Collection中查找bean,未找到时返回null
+   * @param collection Collection of bean
+   * @param propertyName 属性
+   * @param value 值
+   * @return Object
+   * @throws NoSuchMethodException
+   * @throws InvocationTargetException
+   * @throws IllegalAccessException
+   */
+  public static Object findBean(Collection<?> collection,String propertyName,Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException{
+    for(Object bean : collection){
+      Object tmpValue = PropertyUtils.getProperty(bean,propertyName);
+      if (tmpValue == null){
+        if(value==null){
+          return bean;
+        }
+      }else if(tmpValue.equals(value)){
+        return bean;
+      }
+    }
+    return null;
+  }
+
+//  /**
+//   * 判断string是否在集合中,只对Set<String>有效
+//   * @return
+//   */
+//  public static boolean isStringInSet(Set<String> set, String string) {
+//    boolean isIn=false;
+//    for (String tmp : set) {
+//      if (com.syswin.crm.framework.common.util.StringUtils.equalsWithNull(tmp,string)) {
+//        isIn=true;
+//        return isIn;
+//      }
+//    }
+//    return isIn;
+//  }
+  /**
+   * 判断Object是否在集合中,只对实现了equals方法的类有效
+   * @return
+   */
+  public static boolean isObjectInSet(Set<Object> set, Object object) {
+    boolean isIn=false;
+    for (Object tmp : set) {
+      if (object==null) {
+        if (tmp==null) {
+          return true;
+        }
+      }
+      else if (tmp.equals(object)) {
+        isIn=true;
+        return isIn;
+      }
+    }
+    return isIn;
+  }
+
+  /**
+   * 根据属性名和值在Collection中查找bean,未找到时返回null
+   * @param collection Collection of bean
+   * @param propertyName 属性
+   * @param value 值
+   * @return Object
+   * @throws NoSuchMethodException
+   * @throws InvocationTargetException
+   * @throws IllegalAccessException
+   */
+  public static Object findBean(Collection<?> collection,String[] propertyNameArray,Object[] valueArray) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException{
+	  for(Object bean : collection){
+		  boolean isEqual=true;
+		  for(int i=0;i<propertyNameArray.length;i++){
+			  String propertyName = propertyNameArray[i];
+			  Object value = valueArray[i];
+
+		      Object tmpValue = PropertyUtils.getProperty(bean,propertyName);
+		      if (tmpValue == null){
+		        if(value==null){
+		          continue;
+		        }else{
+		          isEqual=false;
+		          break;
+		        }
+		      }else if(tmpValue.equals(value)){
+		        continue;
+		      }else{
+		    	  isEqual=false;
+		    	  break;
+		      }
+		  }
+		  if (isEqual){
+			  return bean;
+		  }
+	}
+	return null;
+  }
+
+}

+ 292 - 0
src/main/java/com/persagy/framework/util/CommonToolUtils.java

@@ -0,0 +1,292 @@
+package com.persagy.framework.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.text.Collator;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import com.persagy.core.constant.SystemConstant;
+import com.persagy.core.mvc.pojo.BusinessObject;
+
+/**
+ * 通用工具类
+ */
+@SuppressWarnings({"unchecked","rawtypes"})
+public class CommonToolUtils {
+	private static final Logger log = Logger.getLogger(CommonToolUtils.class);
+	
+	private final static Collator CHINA_COLLATOR = Collator.getInstance(Locale.CHINA);
+
+	/**
+	 * 
+	 *<p>Description:  获取初始配置文件信息.</p> 
+	 *<p>@param objet
+	 *<p>@return List<Map>
+	 *@since 2018年4月16日: 下午2:39:05
+	 *@author gezhanbin
+	 *@version 1.0
+	 */
+	public static <T extends BusinessObject> List<Map> getInitFileInfo(T objet) {
+		InputStream in = null;
+		List<Map> list = null;
+		try {
+			in = CommonToolUtils.class.getResourceAsStream("/init/" + objet.getClass().getSimpleName() + ".json");
+			list = SystemConstant.jsonMapper.readValue(in, List.class);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			log.error(e.getMessage());
+			e.printStackTrace();
+		} finally {
+			if (in != null) {
+				try {
+					in.close();
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}
+		return list;
+	}
+
+	/**
+	 * 
+	 *<p>Description: 获取文件存储根节点路径 .</p> 
+	 *<p>@return   返回文件存储根节点路径
+	 *<p>@throws Exception String
+	 *@since 2018年3月30日: 下午5:10:16
+	 *@author gezhanbin
+	 *@version 1.0
+	 */
+	public static String getFileStorageDictionary() throws Exception {
+		String fileStorageDirectory = getProperty("file.storage.directory");
+		return fileStorageDirectory;
+	}
+	
+	/**
+	 * Description: 获取配置文件/config/system.properties配置的信息
+	 * @param key 配置属性key
+	 * @return
+	 * @throws Exception String
+	 * @author cuixubin
+	 * @since 2018年8月18日: 下午3:08:42
+	 * Update By cuixubin 2018年8月18日: 下午3:08:42
+	 */
+	public static String getProperty(String key) throws Exception {
+		Properties properties = new Properties();
+		properties.load(CommonToolUtils.class.getResourceAsStream("/config/system.properties"));
+		
+		String value = properties.getProperty(key);
+		return value;
+	}
+	
+	/**
+	 * 获取.properties配置文件配置的信息
+	 * @param key 配置属性key 
+	 * @param confFilePath 配置文件路径,如/config/system.properties
+	 * @return
+	 * @throws Exception String
+	 */
+	public static String getProperty(String key, String confFilePath) {
+		Properties properties = new Properties();
+		try {
+			properties.load(CommonToolUtils.class.getResourceAsStream(confFilePath));
+		} catch (Exception e) {
+			log.error("读取配置文件:" + confFilePath + "出错!");
+		}
+		
+		String value = properties.getProperty(key);
+		return value;
+	}
+	
+	/**
+	 * 获取登录ip地址
+	 * @return String
+	 */
+	public static String getIpAddr() {
+		HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+		String ip = request.getHeader("x-forwarded-for");
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getHeader("Proxy-Client-IP");
+		}
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getHeader("WL-Proxy-Client-IP");
+		}
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getRemoteAddr();
+			if (ip.equals("127.0.0.1")) {
+				// 根据网卡取本机配置的IP
+				InetAddress inet = null;
+				try {
+					inet = InetAddress.getLocalHost();
+				} catch (UnknownHostException e) {
+					e.printStackTrace();
+				}
+				ip = inet.getHostAddress();
+			}
+		}
+		// 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
+		if (ip != null && ip.length() > 15) {
+			if (ip.indexOf(",") > 0) {
+				ip = ip.substring(0, ip.indexOf(","));
+			}
+		}
+		return ip;
+	}
+
+	/**
+	 * 获取登录ip地址
+	 * @return String
+	 */
+	public static String getIpAddr(HttpServletRequest request) {
+		String ip = request.getHeader("x-forwarded-for");
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getHeader("Proxy-Client-IP");
+		}
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getHeader("WL-Proxy-Client-IP");
+		}
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getRemoteAddr();
+			if (ip.equals("127.0.0.1")) {
+				// 根据网卡取本机配置的IP
+				InetAddress inet = null;
+				try {
+					inet = InetAddress.getLocalHost();
+				} catch (UnknownHostException e) {
+					e.printStackTrace();
+				}
+				ip = inet.getHostAddress();
+			}
+		}
+		// 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
+		if (ip != null && ip.length() > 15) {
+			if (ip.indexOf(",") > 0) {
+				ip = ip.substring(0, ip.indexOf(","));
+			}
+		}
+		return ip;
+	}
+
+
+	/**
+	 * 按名称进行中文升序排序
+	 * @param srcList
+	 * @param sortField
+	 */
+	public static void sortChineseList(List<Map<String, Object>> srcList, String sortField) {
+		Collections.sort(srcList, new Comparator<Map>() {
+			@Override
+			public int compare(Map o1, Map o2) {
+				String name1 = (String) o1.get(sortField);
+				name1=name1==null?"":name1;
+				String name2 = (String) o2.get(sortField);
+				name2=name2==null?"":name2;
+				return CHINA_COLLATOR.compare(name1, name2);
+			}
+		});
+	}
+	
+	/**
+	 * 按名称进行中文排序 
+	 * @param srcList
+	 * @param sortField
+	 * @param isAsc true升序,false降序
+	 */
+	public static void sortChineseList(List srcList, String sortField, boolean isAsc) {
+		Collections.sort(srcList, new Comparator<Map>() {
+			@Override
+			public int compare(Map o1, Map o2) {
+				String name1 = (String) o1.get(sortField);
+				name1=name1==null?"":name1;
+				String name2 = (String) o2.get(sortField);
+				name2=name2==null?"":name2;
+				if(isAsc) {
+					return CHINA_COLLATOR.compare(name1, name2);
+				}else {
+					return CHINA_COLLATOR.compare(name2, name1);
+				}
+			}
+		});
+	}
+	
+	/**
+	 * 给list中的map对象进行升序排序
+	 * @param srcList
+	 * @param sortField
+	 */
+	public static void sortList(List srcList, String sortField) {
+		Collections.sort(srcList, new Comparator<Map>() {
+			@Override
+			public int compare(Map o1, Map o2) {
+				String name1 = (String) o1.get(sortField);
+				name1=name1==null?"":name1;
+				String name2 = (String) o2.get(sortField);
+				name2=name2==null?"":name2;
+				return name1.compareTo(name2);
+			}
+		});
+	}
+	
+	/**
+	 * 给list中的map对象进行升序排序
+	 * @param srcList
+	 * @param sortField
+	 * @param isAsc true升序,false降序
+	 */
+	public static void sortList(List srcList, String sortField,boolean isAsc) {
+		Collections.sort(srcList, new Comparator<Map>() {
+			@Override
+			public int compare(Map o1, Map o2) {
+				String name1 = (String) o1.get(sortField);
+				name1=name1==null?"":name1;
+				String name2 = (String) o2.get(sortField);
+				name2=name2==null?"":name2;
+				if(isAsc) {
+					return name1.compareTo(name2);
+				}else {
+					return name2.compareTo(name1);
+				}
+			}
+		});
+	}
+	
+	/**
+	 * 获得32位的UUID
+	 * @return
+	 */
+	public static String getUuid() {
+    	String uuid = UUID.randomUUID().toString().replace("-","");
+    	return uuid;
+    }
+
+	/**
+	 * 根据传入的前缀生成主键
+	 * @param prefix
+	 * @return prefix+32位UUID
+	 */
+	public static String getRecordId(String prefix) {
+		String recordId = "";
+		if (StringUtils.isNotBlank(prefix)) {
+			recordId = prefix;
+		}
+		recordId = recordId + getUuid();
+		return recordId;
+	}
+	
+}

+ 838 - 0
src/main/java/com/persagy/framework/util/ConfigUtil.java

@@ -0,0 +1,838 @@
+package com.persagy.framework.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import com.persagy.core.constant.SystemConstant;
+import com.persagy.functions.weather.dto.CityDTO;
+
+@SuppressWarnings("unchecked")
+public class ConfigUtil {
+	private static final Logger LOGGER = Logger.getLogger(ConfigUtil.class);
+
+	private static String specialCity = "北京市,天津市,上海市,重庆市";
+
+	/** 龙湖定制所需要的进行5min天气数据记录的城市名称集合 */
+	private static Map<String, String> longHuCity = new HashMap<String, String>();
+	/** {城市数据字典编码:城市DTO} */
+	private static Map<String, CityDTO> dicCode2City = new HashMap<String, CityDTO>();
+	/** {城市区县数据字典名称:唯一城市数据字典编码} */
+	private static Map<String, String> dicName2DicCode = new HashMap<String, String>();
+	/** {城市区县数据字典名称:城市数据字典编码1,城市数据字典编码2...} */
+	private static Map<String, String> dicName2MoreDicCode = new HashMap<String, String>();
+	/** {城市区县数据字典名称:城市ID} */
+	private static Map<String, String> dicName2CityId = new HashMap<String, String>();
+	/** {第三方城市名称:城市ID} */
+	private static Map<String, String> cityName2CityId = new HashMap<String, String>();
+	/** {城市区县数据字典编码:城市ID} */
+	private static Map<String, String> dicCode2CityId = new HashMap<String, String>();
+	/** 需要进行小时天气记录的城市ID */
+	private static Set<String> hourCitySet = new HashSet<>();
+	/** 第三方天气服务支持城市信息{城市ID码:城市信息} */
+	private static Map<String, CityDTO> id2City = new HashMap<String, CityDTO>();
+	/** 万达用到的城市{数据字典城市编码:城市名称} */
+	private static Map<String, String> wandaCity = new HashMap<String, String>();
+
+	public static List<Map<String, String>> getAllThread() {
+		List<Map<String, String>> tList = new ArrayList<>();
+		try {
+			Set<Thread> threads = Thread.getAllStackTraces().keySet();
+			if(null != threads) {
+				for(Thread t : threads) {
+					Map<String, String> map = new HashMap<>();
+					map.put("id", t.getId()+"");
+					map.put("name", t.getName()+"");
+					map.put("priority", t.getPriority()+"");
+					map.put("state", t.getState()+"");
+					tList.add(map);
+				}
+			}
+		} catch (Exception e) {
+		}
+		return tList;
+	}
+
+	public static Map<String, String> getCityName2CityId() {
+		return cityName2CityId;
+	}
+
+	/**
+	 * 根据数据字典城市名称获取第三方天气服务城市id
+	 * @param name
+	 * @return
+	 */
+	public static String getCityIdByDicName(String name) {
+		String dicCode = dicName2DicCode.get(name);
+		return dicCode2CityId.get(dicCode);
+	}
+
+	/**
+	 * 根据数据字典城市编码获取第三方天气服务城市id
+	 * @param dicCode
+	 * @return
+	 */
+	public static String getCityIdByDicCode(String dicCode) {
+		return dicCode2CityId.get(dicCode);
+	}
+
+	/**
+	 * 获取 {城市区县数据字典名称:城市ID}
+	 * @return
+	 */
+	public static Map<String, String> getDicName2CityId() {
+		return dicName2CityId;
+	}
+	/**
+	 * 获取 {城市区县数据字典编码:城市ID}
+	 * @return
+	 */
+	public static Map<String, String> getDicCode2CityId() {
+		return dicCode2CityId;
+	}
+	/**
+	 * 获取需要进行小时天气记录的城市ID集合
+	 * @return
+	 */
+	public static Set<String> getHourCitySet() {
+		return hourCitySet;
+	}
+	/**
+	 * 第三方天气服务支持城市信息{城市ID码:城市信息}
+	 * @return
+	 */
+	public static Map<String, CityDTO> getId2City() {
+		return id2City;
+	}
+
+
+	private static Map<String, String> getCityNamesOf5Min() {
+		try {
+			Map<String, String> cities = getConfigMap("/config/business/longhuConfig.json", Map.class);
+			LOGGER.info("读取longhuConfig.json配置成功,加载数据记录数:"+cities.size());
+			return cities;
+		}catch (Exception e) {
+			LOGGER.error("读取longhuConfig.json配置失败!!!");
+			e.printStackTrace();
+		}
+		return new HashMap<String, String>();
+	}
+
+	/**
+	 * 获取龙湖定制配置信息:需要进行5min天气记录的城市
+	 * @return {城市名称:城市id}集合, 可能为空集合
+	 */
+	public static Map<String, String> longHu5MinCitiesGet() {
+		if(longHuCity.isEmpty()) {
+			longHuCity = getCityNamesOf5Min();
+		}
+		return longHuCity;
+	}
+
+	public static Map<String, String> wandaCitiesGet() {
+		if(wandaCity.isEmpty()) {
+			try {
+				initWandaCities();
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+
+		return wandaCity;
+	}
+
+	/**
+	 * 刷新龙湖定制配置信息,从新读取配置文件信息加载到缓存
+	 */
+	public static void cache_refresh_longhu() {
+		LOGGER.info("refresh longhu config start....");
+		Map<String, String> longHuCityNew = getCityNamesOf5Min();
+		if(!longHuCityNew.isEmpty()) {
+			synchronized (longHuCity) {
+				longHuCity.clear();
+				longHuCity.putAll(longHuCityNew);
+			}
+		}
+		LOGGER.info("refresh longhu config end. load record : " + longHuCity.size());
+	}
+
+	/**
+	 * 解析数据字典Geography.json文件
+	 * @return {城市数据字典区域码:城市对象DTO}
+	 */
+	private static Map<String, CityDTO> analysisGeography() throws Exception {
+		Map<String, CityDTO> result = new HashMap<String, CityDTO>();
+		Map<String, Object> mapObj = getConfigMap("/config/business/Geography.json", Map.class);
+
+		if(null != mapObj) {
+			// 1解析直辖市
+			List<Map<String, Object>> specialCities = mapObj.containsKey("specialCities")
+					? (List<Map<String, Object>>) mapObj.get("specialCities")
+					: null;
+			if(null != specialCities) {
+				for(Map<String, Object> spCity : specialCities) {
+					if(spCity.containsKey("cityInfo")) {
+						// 市信息
+
+						List<Map<String, Object>> cityInfo = (List<Map<String, Object>>) spCity.get("cityInfo");
+
+						for(Map<String, Object> cityItem : cityInfo) {
+							if(cityItem.size() > 2) {
+								String dicCode = cityItem.get("code")+"";
+								if(!"null".equals(dicCode)) {
+									CityDTO cityDto = new CityDTO();
+									cityDto.setDicCode(dicCode);
+									cityDto.setDicName(cityItem.get("name")+"");
+									cityDto.setLatitude(cityItem.get("latitude")+"");
+									cityDto.setLongitude(cityItem.get("longitude")+"");
+									cityDto.setAltitude(cityItem.get("altitude")+"");
+									result.put(dicCode, cityDto);
+								}
+							}
+						}
+					}
+
+					if(spCity.containsKey("district")) {
+						// 区县信息
+
+						List<Map<String, Object>> district = (List<Map<String, Object>>) spCity.get("district");
+						String dicCode = "null";
+						for(Map<String, Object> cityItem : district) {
+							dicCode = cityItem.get("code")+"";
+							if(!dicCode.equals("null")) {
+								CityDTO cityDto = new CityDTO();
+								cityDto.setDicCode(dicCode);
+								cityDto.setDicName(cityItem.get("districtName")+"");
+								cityDto.setLatitude(cityItem.get("latitude")+"");
+								cityDto.setLongitude(cityItem.get("longitude")+"");
+								cityDto.setAltitude(cityItem.get("altitude")+"");
+								result.put(dicCode, cityDto);
+							}
+						}
+					}
+				}
+			}
+
+			// 2解析普通省市
+			List<Map<String, Object>> normalCities = mapObj.containsKey("normal")
+					? (List<Map<String, Object>>) mapObj.get("normal")
+					: null;
+			if(null != normalCities) {
+				for(Map<String, Object> nmCity : normalCities) {
+					if(nmCity.containsKey("cities")) {
+						List<Map<String, Object>> cities = (List<Map<String, Object>>) nmCity.get("cities");
+						for(Map<String, Object> cityMap : cities) {
+							// 市信息
+							List<Map<String, Object>> cityInfoList = (List<Map<String, Object>>) cityMap.get("cityInfo");
+							Map<String, Object> cityInfo = cityInfoList.get(0);
+
+							String dicCode = cityInfo.get("code")+"";
+							String cityName = cityInfo.get("name")+"";
+							if(!dicCode.equals("null")) {
+								CityDTO cityDto = new CityDTO();
+								cityDto.setDicCode(dicCode);
+								cityDto.setDicName(cityName);
+								cityDto.setLatitude(cityInfo.get("latitude")+"");
+								cityDto.setLongitude(cityInfo.get("longitude")+"");
+								cityDto.setAltitude(cityInfo.get("altitude")+"");
+								result.put(dicCode, cityDto);
+							}
+
+							List<Map<String, Object>> districtList = (List<Map<String, Object>>) cityMap.get("district");
+							for(Map<String, Object> district : districtList) {
+								dicCode = district.get("code") + "";
+								if(dicCode.equals("null") || "市辖区".equals(district.get("districtName")+"")) {
+									continue;
+								}
+
+								CityDTO districtCityDto = new CityDTO();
+								districtCityDto.setDicCode(dicCode);
+								districtCityDto.setDicName(district.get("districtName")+"");
+								districtCityDto.setLatitude(district.get("latitude")+"");
+								districtCityDto.setLongitude(district.get("longitude")+"");
+								districtCityDto.setAltitude(district.get("altitude")+"");
+								result.put(dicCode, districtCityDto);
+							}
+						}
+					}
+				}
+			}
+			LOGGER.info("读取Geography.json配置成功,加载数据记录数:"+result.size());
+		}
+
+		return result;
+	}
+
+	/**
+	 * 获取 {城市数据字典编码:城市DTO}
+	 * @return
+	 * @throws Exception
+	 */
+	public static Map<String, CityDTO> dicCityObjMap() throws Exception {
+		if(dicCode2City.isEmpty()) {
+			initDicCode2City();
+		}
+
+		return dicCode2City;
+	}
+
+	/**
+	 * 读取Geography.json配置文件,刷新数据字典编码与数据字典城市信息映射关系
+	 * @throws Exception
+	 */
+	private static void initDicCode2City() throws Exception{
+		dicCode2City.clear();
+		dicCode2City.putAll(analysisGeography());
+	}
+
+	/**
+	 * 获取 {城市数据字典名称:唯一城市数据字典编码}
+	 * @return
+	 * @throws Exception
+	 */
+	public static Map<String, String> dicName2DicCodeMap() throws Exception {
+		if(dicName2DicCode.isEmpty()) {
+			initDicNameCodeRelationFromGeography();
+		}
+		return dicName2DicCode;
+	}
+
+	/**
+	 * 获取 {城市数据字典名称:城市数据字典编码1,城市数据字典编码2...}
+	 * @return
+	 * @throws Exception
+	 */
+	public static Map<String, String> dicName2MoreDicCodeMap() throws Exception {
+		if(dicName2MoreDicCode.isEmpty()) {
+			initDicNameCodeRelationFromGeography();
+		}
+		return dicName2MoreDicCode;
+	}
+
+	/**
+	 * 刷新Geography.json配置相关缓存
+	 * @throws Exception
+	 */
+	public static void cache_refresh_geography() throws Exception {
+		LOGGER.info("refresh geography config start....");
+		initDicCode2City();
+		initDicNameCodeRelationFromGeography();
+		LOGGER.info("refresh geography config end. load record :" + dicCode2City.size());
+	}
+
+	/**
+	 * 刷新cityListData.xlsx配置相关缓存
+	 * @throws Exception
+	 */
+	public static void cache_refresh_cityexl() throws Exception {
+		LOGGER.info("refresh cityDataList config start....");
+		analysisCityListDataExl();
+		LOGGER.info("refresh cityDataList config end. totalCity:" + id2City.size() + ", hourCity:"+hourCitySet.size());
+	}
+
+	public static void cache_refresh_wandact() throws Exception {
+		LOGGER.info("refresh wandaCities config start...");
+		initWandaCities();
+		LOGGER.info("refresh wandaCities config end. cityNum: " + wandaCity.size());
+	}
+
+	/**
+	 * 从Geography.json配置文件获取数据,刷新数据字典城市名称与城市编码对应关系
+	 * @throws Exception
+	 */
+	private static void initDicNameCodeRelationFromGeography() throws Exception {
+		Map<String, CityDTO> dicCityDtoMap = dicCityObjMap();
+
+		Map<String, String> tempMap = new HashMap<>();
+		String dicName= null;
+
+		for(String dicCode : dicCityDtoMap.keySet()) {
+			dicName = dicCityDtoMap.get(dicCode).getDicName();
+			if(tempMap.containsKey(dicName)) {
+				tempMap.put(dicName, dicCode+","+tempMap.get(dicName));
+			}else {
+				tempMap.put(dicName, dicCode);
+			}
+		}
+
+		Map<String, String> forDicName2DicCode = new HashMap<>();
+		Map<String, String> forDicName2MoreDicCode = new HashMap<>();
+		for(String name : tempMap.keySet()) {
+			if(tempMap.get(name).contains(",")) {
+				forDicName2MoreDicCode.put(name, tempMap.get(name));
+			}else {
+				forDicName2DicCode.put(name, tempMap.get(name));
+			}
+		}
+
+		dicName2DicCode.clear();
+		dicName2DicCode.putAll(forDicName2DicCode);
+		if(dicName2DicCode.isEmpty()) {
+			dicName2DicCode.put("999999", null);
+		}
+
+		dicName2MoreDicCode.clear();
+		dicName2MoreDicCode.putAll(forDicName2MoreDicCode);
+		if(dicName2MoreDicCode.isEmpty()) {
+			dicName2MoreDicCode.put("999999", null);
+		}
+	}
+
+	/**
+	 * 根据城市数据字典名称获取数据字典编码
+	 * @param dicCityName 城市数据字典名称
+	 * @return 数据字典城市区域码(若对应多个区域码则区域码用英文,隔开) 或 null
+	 */
+	public static String dicCodeGet(String dicCityName) {
+		String dicCode = null;
+		try {
+			dicCode = dicName2DicCodeMap().get(dicCityName);
+			if(null == dicCode) {
+				dicCode = dicName2MoreDicCodeMap().get(dicCityName);
+			}
+		}catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		return dicCode;
+	}
+
+	/**
+	 * 读取json配置文件
+	 * @param <T>
+	 * @param filePath json文件路径,例如:/config/hello.json
+	 * @param cls 反射Java类类型
+	 * @return
+	 * @throws Exception
+	 */
+	public static <T> T getConfigMap(String filePath, Class<T> cls) {
+		try {
+			URL url = ConfigUtil.class.getResource(filePath);
+			T t = SystemConstant.jsonMapper.readValue(url, cls);
+			return t;
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	/**
+	 * 读取exl数据为字符集合
+	 * @param filePath exl文件路径,例如:/config/hello.xlsx  /config/business/cityList.xlsx
+	 * @param sheetIndex sheet也索引,从0开始
+	 * @param rowStart 数据读取开始行,从0开始
+	 * @param columnNum 每行读取数据的列数
+	 * @return 二维字符集合[[]] 或 空数据集合 []
+	 */
+	public static List<String[]> getDataFromExl(String filePath, int sheetIndex, int rowStart, int columnNum) {
+		List<String[]> resultList = new ArrayList<>();
+
+		URL url = ConfigUtil.class.getResource(filePath);
+		File file = new File(url.getFile());
+		if(file.exists() && file.isFile()) {
+			Workbook wb = null;
+			FileInputStream fileInputStream = null;
+			try {
+				fileInputStream = new FileInputStream(file);
+				wb = new XSSFWorkbook(fileInputStream);
+				Sheet sheet = wb.getSheetAt(sheetIndex);
+				int rowNum = sheet.getLastRowNum();
+				if(rowStart < rowNum) {
+					for(int rowIndex=rowStart; rowIndex<rowNum; rowIndex++) {
+						Row rowNow = sheet.getRow(rowIndex);
+						if (rowNow == null) {
+							break;
+						}
+
+						String[] rowData = new String[columnNum];
+						for(int columnIndex=0; columnIndex<columnNum; columnIndex++) {
+							String cvalue = null;
+							Cell cell = rowNow.getCell(columnIndex);
+							if(null == cell) {
+								continue;
+							}
+							try {
+								cvalue = cell.getStringCellValue();
+							}catch (IllegalStateException e) {
+								cvalue = cell.getNumericCellValue()+"";
+							}
+							rowData[columnIndex] = cvalue;
+						}
+						resultList.add(rowData);
+					}
+				}
+			}catch (Exception e) {
+				resultList.clear();
+				e.printStackTrace();
+			}finally {
+				if(null != fileInputStream) {
+					try {
+						fileInputStream.close();
+					} catch (IOException e) {
+						e.printStackTrace();
+					}
+				}
+			}
+			if(wb != null) {
+				try {
+					wb.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+
+		return resultList;
+	}
+
+	/**
+	 * 字符串二位集合数据写入exl
+	 * @param filePath exl路径
+	 * @param sheetIndex sheet页索引
+	 * @param rowStart 写入数据开始行
+	 * @param dataList 数据
+	 * @return
+	 */
+	public static boolean writeDataToExl(String filePath, int sheetIndex, int rowStart, List<String[]> dataList) {
+		boolean result = false;
+
+		URL url = ConfigUtil.class.getResource(filePath);
+		File file = new File(url.getFile());
+
+		FileOutputStream fileOutputStream = null;
+		Workbook workbook = null;
+		try {
+			fileOutputStream = new FileOutputStream(file);
+			workbook = new SXSSFWorkbook();
+
+			Sheet sheet = workbook.createSheet("data");
+
+			int rowNum = rowStart;
+			for(String[] dataAry : dataList) {
+				Row row = sheet.createRow(rowNum++);
+
+				int cellNum = 0;
+				for(String data : dataAry) {
+					row.createCell(cellNum++).setCellValue(data == null ? "" : data);
+				}
+			}
+
+			workbook.write(fileOutputStream);
+			fileOutputStream.flush();
+			result = true;
+		}catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			if(fileOutputStream != null) {
+				try {
+					fileOutputStream.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+			if(workbook != null) {
+				try {
+					workbook.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+
+		return result;
+	}
+
+	public static void cityListDataGet() throws Exception {
+		List<String[]> dataList = getDataFromExl("/config/business/cityList.xlsx", 0, 1, 5);
+
+		Map<String, String> dicNameCode = dicName2DicCodeMap();
+
+		List<String[]> dataListCompare = new ArrayList<>();
+		for(String[] cityInfo : dataList) {
+			String[] cityInfoSuper = Arrays.copyOf(cityInfo, 9);
+			dataListCompare.add(cityInfoSuper);
+
+			if("yes".equals(cityInfo[4])) {
+				String belong = cityInfo[1];
+				belong = belong.contains("/") ? belong.substring(belong.lastIndexOf("/")+1) : belong;
+
+				String shorName = cityInfo[2];
+				shorName = shorName.contains("/") ? shorName.substring(shorName.lastIndexOf("/")+1) : shorName;
+
+				if(dicNameCode.containsKey(belong)) {
+					cityInfoSuper[5] = dicNameCode.get(belong);
+					cityInfoSuper[6] = belong;
+				}
+
+				if(dicNameCode.containsKey(shorName)) {
+					cityInfoSuper[7] = dicNameCode.get(shorName);
+					cityInfoSuper[8] = shorName;
+				}
+			}
+		}
+
+		System.out.println(writeDataToExl("/config/business/cityList.xlsx", 2, 0, dataListCompare));
+	}
+
+	private static void initWandaCities() throws Exception {
+		List<String[]> dataList = getDataFromExl("/config/business/WandaCityCodeName.xlsx", 0, 1, 2);
+		if(!dataList.isEmpty()) {
+			wandaCity.clear();
+			String cityCode = null, cityName = null;
+			for(String[] rowData : dataList) {
+				cityCode = rowData[0];
+				cityName = rowData[1];
+				if(null != cityCode && cityCode.trim().length() > 5 && cityName != null) {
+					cityCode = cityCode.trim();
+					cityCode = cityCode.length() > 6 ? cityCode.substring(0, 6) : cityCode;
+					wandaCity.put(cityCode, rowData[1]);
+				}
+			}
+		}
+	}
+
+	/**
+	 * 解析配置文件cityListData.xlsx中的数据,清理数据字典城市名称,数据字典城市编码与城市ID码的关系
+	 * @throws Exception
+	 */
+	private static void analysisCityListDataExl() throws Exception {
+		List<String[]> dataList = getDataFromExl("/config/business/cityListData.xlsx", 0, 1, 7);
+
+		String cityId = null;
+		String dicCode = null;
+		String dicName = null;
+		String belong = null;
+		String name = null;
+		String pinyin = null;
+
+		Map<String, CityDTO> forId2City = new HashMap<>();
+		Set<String> forHourCitySet = new HashSet<>();
+		Map<String, String> forDicName2CityId = new HashMap<String, String>();
+		Map<String, String> forDicCode2CityId = new HashMap<String, String>();
+		Map<String, String> forCityName2CityId = new HashMap<String, String>();
+		Set<String> repeatNameSet = new HashSet<String>();
+
+		for(String[] record : dataList) {
+			cityId = record[0];
+			belong = record[1];
+			name = record[2];
+			pinyin = record[3];
+			dicCode = record[5];
+			dicName = record[6];
+
+			if ((cityId != null) && (cityId.trim().length() != 0)) {
+				String cityName = name;
+				if (cityName != null) {
+					if (cityName.contains("/")) {
+						cityName = cityName.substring(cityName.lastIndexOf("/") + 1);
+					}
+					if (forCityName2CityId.containsKey(cityName)) {
+						repeatNameSet.add(cityName);
+					}
+					forCityName2CityId.put(cityName, cityId);
+				}
+
+				CityDTO dto = new CityDTO(cityId, name, belong, pinyin, dicCode, dicName);
+				forId2City.put(cityId, dto);
+
+				if("yes".equals(record[4])) {
+					forHourCitySet.add(cityId);
+				}
+
+				if(dicName != null) {
+					forDicName2CityId.put(dicName, cityId);
+				}
+
+				if(dicCode != null) {
+					if(dicCode.contains(",")) {
+						for(String dicCodeItem : dicCode.split(",")) {
+							forDicCode2CityId.put(dicCodeItem, cityId);
+						}
+					}else {
+						forDicCode2CityId.put(dicCode, cityId);
+						if(dicName != null && (dicName.endsWith("市") || dicName.endsWith("自治州")) && !specialCity.contains(dicName)) {
+							if(dicCode.endsWith("00")) {
+								forDicCode2CityId.put(dicCode.substring(0, dicCode.length()-2)+"01", cityId);
+							}else if(dicCode.endsWith("01")) {
+								forDicCode2CityId.put(dicCode.substring(0, dicCode.length()-2)+"00", cityId);
+							}
+						}
+					}
+				}
+			}
+
+		}
+
+		id2City.clear();
+		id2City.putAll(forId2City);
+
+		hourCitySet.clear();
+		hourCitySet.addAll(forHourCitySet);
+
+		dicName2CityId.clear();
+		dicName2CityId.putAll(forDicName2CityId);
+
+		if (!repeatNameSet.isEmpty()) {
+			for (String cityName : repeatNameSet) {
+				forCityName2CityId.remove(cityName);
+			}
+		}
+		cityName2CityId.clear();
+		cityName2CityId.putAll(forCityName2CityId);
+
+		String newKey = null;
+		Map<String, String> forDicCode2CityIdSuper = new HashMap<>(forDicCode2CityId);
+		for(String key : forDicCode2CityId.keySet()) {
+			if(key != null && key.length()==6 && (key.endsWith("02") || key.endsWith("03"))) {
+				if(key.endsWith("00") || key.endsWith("01")) {
+					forDicCode2CityIdSuper.put(key.substring(0, 4) + "01", forDicCode2CityId.get(key));
+					forDicCode2CityIdSuper.put(key.substring(0, 4) + "00", forDicCode2CityId.get(key));
+				}else if(key.endsWith("02") || key.endsWith("03")) {
+					newKey = key.substring(0, 4) + "00";
+					if(!forDicCode2CityIdSuper.containsKey(newKey)) {
+						forDicCode2CityIdSuper.put(newKey, forDicCode2CityId.get(key));
+					}
+					newKey = key.substring(0, 4) + "01";
+					if(!forDicCode2CityIdSuper.containsKey(newKey)) {
+						forDicCode2CityIdSuper.put(newKey, forDicCode2CityId.get(key));
+					}
+				}
+			}
+		}
+		dicCode2CityId.clear();
+		dicCode2CityId.putAll(forDicCode2CityIdSuper);
+	}
+
+	public static String getComputeStr(String str) {
+		str = str == null ? "" : str;
+
+		str = str + "www.persagy.com";
+
+		int hashInt = Math.abs(str.hashCode());
+
+		hashInt = 100000 + hashInt % 103;
+		String hashStr = ("" + hashInt).substring(3);
+
+		return hashStr;
+	}
+
+	public static String getDayHisSuffix(String str) {
+		str = str == null ? "" : str;
+
+		str = str + "www.persagy.com";
+
+		int hashInt = Math.abs(str.hashCode());
+
+		hashInt = 1000 + hashInt % 10;
+		String hashStr = ("" + hashInt).substring(2);
+
+		return hashStr;
+	}
+
+	public static String getLocation(String name, String dicCode, String projectId) {
+		String location = getLocationStrict(name, dicCode, projectId);
+
+		if(location == null) {
+			location = name;
+		}
+
+		return location;
+	}
+
+	/**
+	 * 匹配顺序1.使用城市编码(项目id解析出城市编码)做精确匹配;2.按名称精确匹配;3.按数据字典名称模糊匹配;4.按第三方城市名称模糊匹配
+	 * @param name
+	 * @param dicCode
+	 * @param projectId
+	 * @return null或城市编码
+	 */
+	public static String getLocationStrict(String name, String dicCode, String projectId) {
+		if(dicCode == null && projectId != null && projectId.length() > 8) {
+			dicCode = projectId.substring(2, 8);
+		}
+
+		String location = null;
+
+		if(null != dicCode) {
+			location = dicCode2CityId.get(dicCode);
+		}
+
+		if(location == null && dicName2CityId.containsKey(name)) {
+			return dicName2CityId.get(name);
+		}
+
+		if (location == null && cityName2CityId.containsKey(name)) {
+			return  cityName2CityId.get(name);
+		}
+
+		if(location == null && name != null) {
+			for(String dicName : dicName2CityId.keySet()) {
+				if(dicName.startsWith(name)) {
+					return dicName2CityId.get(dicName);
+				}
+			}
+
+			for(String cityName : cityName2CityId.keySet()) {
+				if(name.startsWith(cityName)) {
+					return cityName2CityId.get(cityName);
+				}
+			}
+		}
+
+		return location;
+	}
+
+	public static String getHourCity(String name, String dicCode, String projectId) {
+		String location = getLocationStrict(name, dicCode, projectId);
+		if (hourCitySet.contains(location)) {
+			return location;
+		}
+		return null;
+	}
+
+	public static String getHourLocation(String name, String dicCode, String projectId) {
+		String location = getLocationStrict(name, dicCode, projectId);
+		return hourCitySet.contains(location) ? location : null;
+	}
+
+	public static void cache_refresh_all() throws Exception {
+		cache_refresh_longhu();
+		cache_refresh_geography();
+		cache_refresh_cityexl();
+		cache_refresh_wandact();
+	}
+
+	public static void main(String[] args) throws Exception {
+		cache_refresh_wandact();
+		System.out.println(wandaCity);
+		
+		/*
+		List<String> list = FileTools.readFileToList(new File("D:/wz/wanda.txt"));
+		for(String city : list) {
+			String cityCode = getHourCity(null, city, null);
+			if(null == cityCode) {
+				cityCode = getHourCity(null, city.substring(0, 4) + "00", null);
+			}
+			System.out.println(city + "=" + cityCode);
+		}
+		*/
+	}
+}

+ 35 - 0
src/main/java/com/persagy/framework/util/CsvUtil.java

@@ -0,0 +1,35 @@
+package com.persagy.framework.util;
+
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.csvreader.CsvReader;
+
+public class CsvUtil {
+	public static List<String[]> readToStrList(String filePath, boolean skipHeader) {
+		List<String[]> csvList = new ArrayList<String[]>();
+		
+		try {
+			CsvReader reader = new CsvReader(filePath,',',Charset.forName("UTF-8"));
+			
+			if(skipHeader) {
+				reader.readHeaders();
+			}
+			
+			while(reader.readRecord()){
+				//按行读取,并把每一行的数据添加到list集合
+                csvList.add(reader.getValues());
+            }
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return csvList;
+	}
+	
+	public static void main(String[] args) {
+		List<String[]> csvList = readToStrList("D:/varTest/cma_20170101.csv", true);
+		System.out.println(csvList.size());
+	}
+}

File diff suppressed because it is too large
+ 1088 - 0
src/main/java/com/persagy/framework/util/DateUtils.java


+ 508 - 0
src/main/java/com/persagy/framework/util/ExcelUtils.java

@@ -0,0 +1,508 @@
+package com.persagy.framework.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+
+/**
+ * @Description excel上传下载
+ * @Author feng
+ * @Date 2018/7/11 15:45
+ * @Version 1.0
+ */
+public class ExcelUtils {
+    /**
+     * Description: 根据List集合数据生成.xlsx表格文件
+     * @param dirPath 需要生成表格文件所在文件夹
+     * @param fileName 需要生成表格文件的名称(不包含.后缀名)
+     * @param sheetName 生成表格sheet页的名称
+     * @param columnDataList 集合数据,一维数据为列数据 [["1行1列", "2行1列", "3行1列"], ["2行1列", "2行2列", "3行2列"]]
+     * @throws Exception void
+     * @author cuixubin
+     * @since 2018年10月9日: 上午10:17:54
+     */
+	public static void createExcelUseListData(String dirPath, String fileName, List<List<Object>> columnDataList,
+			String sheetName) throws Exception {
+
+		if (StringUtils.isBlank(sheetName)) {
+			throw new Exception("sheetName不能为空");
+		}
+		// 创建excel对象
+		HSSFWorkbook workbook = new HSSFWorkbook();
+		HSSFSheet sheet = workbook.createSheet(sheetName);
+		// 输出流
+		OutputStream out = null;
+		try {
+			File dir = new File(dirPath);
+			// 如果目录不存在
+			if (!dir.exists()) {
+				if (!dir.mkdirs()) {
+					throw new Exception("创建目录异常");
+				}
+			}
+			if (columnDataList != null && !columnDataList.isEmpty()) {
+				// 表格列数
+				int columnNum = columnDataList.size();
+				// 将数据设置到sheet对应的单元格中
+				for (int i = 0; i < columnNum; i++) {
+					List<Object> obj = columnDataList.get(i);
+					// 遍历每一列
+					for (int j = 0; j < obj.size(); j++) {
+						HSSFRow row = sheet.getRow(j);
+						// 如果该行有数据,则表示已经创建过,否则重新创建
+						if (row == null) {
+							row = sheet.createRow(j);
+						}
+						// 设置单元格的值
+						HSSFCell cell = row.createCell(i, HSSFCell.CELL_TYPE_STRING);
+						if (!"".equals(obj.get(j)) && obj.get(j) != null) {
+							cell.setCellValue(obj.get(j).toString());
+						}
+					}
+				}
+			}
+			String filePath = dirPath + File.separator + fileName + ".xlsx";
+			// 输出流
+			out = new FileOutputStream(new File(filePath));
+			// 写入工作簿
+			workbook.write(out);
+		} finally {
+			if (out != null) {
+				out.flush();
+				out.close();
+			}
+			if (workbook != null) {
+				workbook.close();
+			}
+		}
+	}
+
+    /**
+     * description 读取excel模版 将数据写入excel
+     *
+     * @param excelTemplateStream excel标签模版输入流
+     * @param sheetName           标签名称
+     * @param skipRows            跳过的行数 (从多少行之后开始写入)
+     * @param skipColumns         跳过的列数 (从多少列之后开始写入)
+     * @param filePath            生成的excel文件的path
+     * @param rowInfoList         行数据的集合
+     * @return void
+     * @author feng
+     * @since 17:35 2018/7/11
+     */
+    public static void writeInfoToExcel(InputStream excelTemplateStream, String sheetName, int skipRows, int skipColumns,
+                                        String filePath, List<List<String>> rowInfoList) throws Exception {
+        // 根据模板,创建工作簿
+        Workbook workBook = null;
+        // 输出流
+        OutputStream out = null;
+        try {
+            workBook = WorkbookFactory.create(excelTemplateStream);
+            Sheet sheet = workBook.getSheet(sheetName);
+            // 输出流
+            out = new FileOutputStream(new File(filePath));
+            for (int rowNumber = 0; rowNumber < rowInfoList.size(); rowNumber++) {
+                for (int columnNumber = 0; columnNumber < rowInfoList.get(rowNumber).size(); columnNumber++) {
+                    createCell(workBook, sheet, rowNumber + skipRows, columnNumber + skipColumns, rowInfoList.get(rowNumber).get(columnNumber));
+                }
+            }
+            workBook.write(out);
+        } finally {
+            if (out != null) {
+                out.flush();
+                out.close();
+            }
+            if (workBook != null) {
+                workBook.close();
+            }
+        }
+    }
+    
+    /**
+     * Description: 将excel的sheet页数据转换成list
+     * @param sheet
+     * @param lastColumnNum 指定读取的最大列号,为null则获取sheet页行数据最长的列
+     * @return [[第一行第一元素,第一行第二元素],[第二行第一元素,第二行第二元素]]
+     * @throws Exception List<List<String>>
+     * @author cuixubin
+     * @since 2018年9月25日: 下午2:07:36
+     * Update By cuixubin 2018年9月25日: 下午2:07:36
+     */
+    public static List<List<String>> sheetToList(Sheet sheet, Integer lastColumnNum) throws Exception {
+    	List<List<String>> resultInfo = new ArrayList<>();
+    	
+		if (sheet == null) {
+			return null;
+		}
+		
+		if(null == lastColumnNum) {
+			for (int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++) {
+				Row row = sheet.getRow(rowNum);
+				if (row == null) {
+					continue;
+				}
+				if (lastColumnNum < row.getLastCellNum()) {
+					lastColumnNum = row.getLastCellNum() + 0;
+				}
+			}
+		}
+		
+		for (int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++) {
+			Row row = sheet.getRow(rowNum);
+			ArrayList<String> curarr = new ArrayList<>();
+			if (row == null) {
+				for (int columnNum = 0; columnNum < lastColumnNum; columnNum++) {
+					curarr.add(null);
+				}
+			} else {
+				for (int columnNum = 0; columnNum < lastColumnNum; columnNum++) {
+					Cell cell = row.getCell(columnNum);
+					curarr.add(getCellStringValue(cell));
+				}
+			}
+			resultInfo.add(curarr);
+		}
+
+		return resultInfo;
+
+    }
+    
+    /**
+     * description 读取excel信息
+     *
+     * @param in        文件输入流
+     * @param sheetName sheet名称
+     * @return java.util.List<java.util.List<java.lang.String>> 行信息的集合
+     * @author feng
+     * @since 16:16 2018/7/11
+     */
+    public static List<List<String>> getExcelSheetInfo(File exlFile, String sheetName) throws Exception {
+    	List<List<String>> resultInfo = new ArrayList<>();
+    	
+    	try (Workbook workBook = WorkbookFactory.create(exlFile);){
+    		// 遍历excel中的sheet
+    		Sheet sheet = workBook.getSheet(sheetName);
+    		if (sheet == null) {
+    			return null;
+    		}
+    		
+    		int lastColumnNum = 0;
+    		for (int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++) {
+    			Row row = sheet.getRow(rowNum);
+    			if (row == null) {
+    				continue;
+    			}
+    			if (lastColumnNum < row.getLastCellNum()) {
+    				lastColumnNum = row.getLastCellNum();
+    			}
+    		}
+    		
+    		for (int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++) {
+    			Row row = sheet.getRow(rowNum);
+    			ArrayList<String> curarr = new ArrayList<>();
+    			if (row == null) {
+    				for (int columnNum = 0; columnNum < lastColumnNum; columnNum++) {
+    					curarr.add("");
+    				}
+    			} else {
+    				for (int columnNum = 0; columnNum < lastColumnNum; columnNum++) {
+    					Cell cell = row.getCell(columnNum);
+    					curarr.add(getCellStringValue(cell));
+    				}
+    			}
+    			resultInfo.add(curarr);
+    		}
+    	}
+        return resultInfo;
+
+    }
+
+    /**
+     * description 读取excel信息
+     *
+     * @param in        文件输入流
+     * @param sheetName sheet名称
+     * @return java.util.List<java.util.List<java.lang.String>> 行信息的集合
+     * @author feng
+     * @since 16:16 2018/7/11
+     */
+    public static List<List<String>> getExcelSheetInfo(InputStream in, String sheetName) throws Exception {
+        Workbook workBook = WorkbookFactory.create(in);
+        // 遍历excel中的sheet
+        List<List<String>> resultInfo = new ArrayList<>();
+        Sheet sheet = workBook.getSheet(sheetName);
+        if (sheet == null) {
+            return null;
+        }
+
+        int lastColumnNum = 0;
+        for (int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++) {
+            Row row = sheet.getRow(rowNum);
+            if (row == null) {
+                continue;
+            }
+            if (lastColumnNum < row.getLastCellNum()) {
+                lastColumnNum = row.getLastCellNum();
+            }
+        }
+
+        for (int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++) {
+            Row row = sheet.getRow(rowNum);
+            ArrayList<String> curarr = new ArrayList<>();
+            if (row == null) {
+                for (int columnNum = 0; columnNum < lastColumnNum; columnNum++) {
+                    curarr.add("");
+                }
+            } else {
+                for (int columnNum = 0; columnNum < lastColumnNum; columnNum++) {
+                    Cell cell = row.getCell(columnNum);
+                    curarr.add(getCellStringValue(cell));
+                }
+            }
+            resultInfo.add(curarr);
+        }
+        return resultInfo;
+
+    }
+
+    public static void createCell(Workbook workbook, Sheet sheet, int rowNumber, int cellNumber, String content) {
+
+        Row row = sheet.getRow(rowNumber);
+        if (row == null) {
+            row = sheet.createRow(rowNumber);
+        }
+
+        Cell cell = row.getCell(cellNumber);
+        if (cell == null) {
+            cell = row.createCell(cellNumber);
+        }
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
+        cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
+
+        cell.setCellStyle(cellStyle);
+        if (content == null) {
+            content = "";
+        }
+        cell.setCellValue(content);
+    }
+
+    /**
+     * 
+     * Description: 创建单元格并写入单元格内容(不设置单元格的格式,比createCell方法耗时短,速度快)
+     * @param workbook
+     * @param sheet
+     * @param rowNumber 行数
+     * @param cellNumber 列数
+     * @param content 
+     * @author JiShaoJun
+     * @since 2019年3月6日: 上午10:29:08
+     */
+    public static void createCellNoStyle(Workbook workbook, Sheet sheet, int rowNumber, int cellNumber, String content) {
+    	Row row = sheet.getRow(rowNumber);
+    	if (row == null) {
+            row = sheet.createRow(rowNumber);
+        }
+    	 Cell cell = row.getCell(cellNumber);
+         if (cell == null) {
+             cell = row.createCell(cellNumber);
+         }
+        if (content == null) {
+            content = "";
+        }
+        cell.setCellValue(content);
+    }
+    
+    public static String getCellStringValue(Cell cell) throws Exception {
+        if (cell == null) {
+            return "";
+        }
+        String value;
+        switch (cell.getCellType()) {
+            case Cell.CELL_TYPE_STRING:
+                value = cell.getStringCellValue();
+                break;
+            case Cell.CELL_TYPE_NUMERIC:
+                if (DateUtil.isCellDateFormatted(cell)) {
+                    value = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cell.getDateCellValue());
+                } else {
+                    value = new BigDecimal(Double.toString(cell.getNumericCellValue())).longValue() + "";
+                }
+                break;
+            case Cell.CELL_TYPE_BOOLEAN:
+                value = String.valueOf(cell.getBooleanCellValue());
+                break;
+            case Cell.CELL_TYPE_BLANK:
+                value = "";
+                break;
+            case Cell.CELL_TYPE_ERROR:
+                throw new Exception("can not resolve this cell! CELL_TYPE_ERROR! ");
+            case Cell.CELL_TYPE_FORMULA:
+                value = cell.getCellFormula();
+                break;
+            default:
+                value = cell.getStringCellValue();
+                break;
+        } 
+
+        return value;
+    }
+    
+    /**
+     * Description: 将样式为config/bifunction/Item.xls文件转为config/bifunction/energyModelTemplate.xls格式
+     * @param fromExl 文件物理路径地址
+     * @param sheetNameOfFromExl sheet页名称
+     * @throws Exception void
+     * @author cuixubin
+     * @since 2019年1月23日: 下午3:06:19
+     */
+    public static void GetBIItemTemplateFromStandardItemExl(String fromExl, String sheetNameOfFromExl) throws Exception {
+    	File fromFile = new File(fromExl);
+    	if(fromFile.exists() && fromFile.isFile() && (fromExl.endsWith("xls") || fromExl.endsWith("xlsx"))) {
+    		List<List<String>> dataList = getExcelSheetInfo(fromFile, sheetNameOfFromExl);
+    		
+    		if(dataList !=null && !dataList.isEmpty()) {
+    			List<EItemDTO> itemList = new ArrayList<>();
+    			
+    			int maxRow = 0;
+    			
+    			for(int rowIndex=0; rowIndex<dataList.size(); rowIndex++) {
+    				for(int i=0; i<dataList.get(rowIndex).size(); i++) {
+    					// 分项名
+    					String nameStr = dataList.get(rowIndex).get(i);
+    					if(nameStr != null && !"".equals(nameStr)) {
+    						// 分项属性编码
+    						String codeStr = dataList.get(rowIndex).get(i+1);
+    						
+    						EItemDTO eitem = new EItemDTO();
+    						eitem.name = nameStr;
+    						eitem.code = codeStr;
+    						eitem.level = i / 2;
+    						
+    						itemList.add(eitem);
+    						
+    						maxRow = maxRow < (eitem.level + 1) ? (eitem.level + 1) : maxRow;
+    						
+    						break;
+    					}
+    				}
+    			}
+    			
+    			List<List<Object>> dataList2 = new ArrayList<>();
+    			for(int i=0; i<maxRow+2; i++) {
+    				List<Object> iList = new ArrayList<>();
+    				dataList2.add(iList);
+    			}
+    			
+    			for(int rowIndex=0; rowIndex<itemList.size(); rowIndex++) {
+    				EItemDTO eitem = itemList.get(rowIndex);
+    				for(int column=0; column<dataList2.size(); column++) {
+    					if(column == 0) {
+    						dataList2.get(column).add("EI" + eitem.code + "001");
+    					}else if(column == 1) {
+    						dataList2.get(column).add("" + eitem.code);
+    					}else {
+    						String names = "";
+    						if(column == eitem.level + 2) {
+    							names = eitem.name;
+    						}
+    						dataList2.get(column).add(names);
+    					}
+    				}
+    			}
+    			
+    			createExcelUseListData2("D:\\TEST", "item", dataList2, "Sheet1");
+    			System.out.println("success. file:D:/TEST/item.xlsx");
+    		}
+    	}else {
+    		System.out.println("文件[" + fromExl + "]找不到或格式错误或已损坏。");
+    	}
+    }
+    
+    private static void createExcelUseListData2(String dirPath, String fileName, List<List<Object>> columnDataList,
+			String sheetName) throws Exception {
+
+		if (StringUtils.isBlank(sheetName)) {
+			throw new Exception("sheetName不能为空");
+		}
+		// 创建excel对象
+		HSSFWorkbook workbook = new HSSFWorkbook();
+		HSSFSheet sheet = workbook.createSheet(sheetName);
+		// 输出流
+		OutputStream out = null;
+		try {
+			File dir = new File(dirPath);
+			// 如果目录不存在
+			if (!dir.exists()) {
+				if (!dir.mkdirs()) {
+					throw new Exception("创建目录异常");
+				}
+			}
+			if (columnDataList != null && !columnDataList.isEmpty()) {
+				// 表格列数
+				int columnNum = columnDataList.size();
+				// 将数据设置到sheet对应的单元格中
+				for (int i = 0; i < columnNum; i++) {
+					List<Object> obj = columnDataList.get(i);
+					// 遍历每一列
+					for (int j = 0; j < obj.size(); j++) {
+						HSSFRow row = sheet.getRow(j);
+						// 如果该行有数据,则表示已经创建过,否则重新创建
+						if (row == null) {
+							row = sheet.createRow(j);
+						}
+						// 设置单元格的值
+						HSSFCell cell = row.createCell(i, HSSFCell.CELL_TYPE_STRING);
+						if (obj.get(j) != null) {
+							cell.setCellValue(obj.get(j).toString());
+						}
+					}
+				}
+			}
+			String filePath = dirPath + File.separator + fileName + ".xlsx";
+			// 输出流
+			out = new FileOutputStream(new File(filePath));
+			// 写入工作簿
+			workbook.write(out);
+		} finally {
+			if (out != null) {
+				out.flush();
+				out.close();
+			}
+			if (workbook != null) {
+				workbook.close();
+			}
+		}
+	}
+}
+
+
+
+class EItemDTO {
+	public String name;
+	public String code;
+	public int level;
+	@Override
+	public String toString() {
+		return "[level=" + level + ", code=" + code + ", name=" + name + "]";
+	}
+	
+}

+ 467 - 0
src/main/java/com/persagy/framework/util/FileUtil.java

@@ -0,0 +1,467 @@
+package com.persagy.framework.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.channels.FileChannel;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Description: 文件操作工具类   
+ * Company: Persagy 
+ * @author cuixubin 
+ * @version 1.0
+ * @since: 2018年7月11日: 下午4:56:38
+ * Update By cuixubin 2018年7月11日: 下午4:56:38
+ */
+public class FileUtil {
+	public static void main(String[] args) throws Exception {
+		System.out.println(createFile("d:/test1.json"));
+	}
+	
+	/**
+	 * Description: 将字节数组写入到文件
+	 * @param fileName 文件名.后缀名
+	 * @param data 数据
+	 * @return
+	 * @throws Exception File
+	 * @author cuixubin
+	 * @since 2018年9月25日: 上午10:35:41
+	 * Update By cuixubin 2018年9月25日: 上午10:35:41
+	 */
+	public static File writeByteToFile(String fileName, byte[] data) throws Exception {
+		String basePath = CommonToolUtils.getFileStorageDictionary();
+		basePath += File.separator + "imageServiceSource" + File.separator + fileName;
+		File file = createAndGetFile(basePath);
+		return writeByteToFile(file, data);
+	}
+	
+	/**
+	 * Description: 将字节数据写入到文件 
+	 * @param file 目标文件
+	 * @param data 数据
+	 * @return
+	 * @throws Exception File
+	 * @author cuixubin
+	 * @since 2018年9月25日: 上午10:32:57
+	 * Update By cuixubin 2018年9月25日: 上午10:32:57
+	 */
+	public static File writeByteToFile(File file, byte[] data) throws Exception {
+		if(null == file || !file.exists() || file.isDirectory() || data == null) {
+			return null;
+		}
+		
+		try(FileOutputStream out = new FileOutputStream(file)) {
+			out.write(data);
+		}
+		
+		return file;
+	}
+	
+	/**
+	 * Description: 删除目录下的文件及子目录
+	 * @param path 目录的绝对路径
+	 * @param delFailedFiles 删除失败的文件或文件夹路径信息集合
+	 * @return List<String>
+	 * @author cuixubin
+	 * @since 2018年7月11日: 下午5:20:53
+	 * Update By cuixubin 2018年7月11日: 下午5:20:53
+	 */
+	public static List<String> delDirectory(String path, List<String> delFailedFiles) {
+		if(null == delFailedFiles) {
+			delFailedFiles = new ArrayList<>();
+		}
+		
+		if(null == path) {
+			return delFailedFiles;
+		}
+		
+		File file = new File(path);
+		if(file.exists()) {
+			if(file.isFile()) {
+				file.delete();
+			}
+			
+			if(file.isDirectory()) {
+				String[] files = file.list();
+				for(String fpath : files) {
+					path = path.endsWith(File.separator) ? path : path + File.separator;
+					fpath = path + fpath;
+					delDirectory(fpath, delFailedFiles);
+				}
+				file.delete();
+			}
+			
+			delFailedFiles.add(path);
+		}
+		
+		return delFailedFiles;
+	}
+	
+	/**
+	 * Description: 读取文件夹下的文件
+	 * @param filepath 文件夹绝对路径
+	 * @param fileList 存放文件的集合
+	 * @return List<File>
+	 */
+	public static void getFilesInDir(String filepath, List<File> fileList){
+		fileList = fileList == null ? new ArrayList<>() : fileList;
+		File file = new File(filepath);
+		if (!file.isDirectory()) {
+			// 是文件
+			fileList.add(file);
+		} else if (file.isDirectory()) {
+			// 是文件夹
+			String[] filelist = file.list();
+			for (int i = 0; i < filelist.length; i++) {
+				File readfile = new File(filepath + File.separator + filelist[i]);
+				if (!readfile.isDirectory()) {
+					fileList.add(readfile);
+				} else if (readfile.isDirectory()) {
+					getFilesInDir(filepath + File.separator + filelist[i], fileList);
+				}
+			}
+		}
+	}
+	
+	/**
+	 * Description: 根据文件路径创建文件(如果文件所在文件夹不存在则自动创建),如果所要创建的文件已存在则不创建
+	 * @param filePath 路径+文件名+后缀
+	 * @return boolean true-创建成功或文件已存在;false-创建失败
+	 */
+	public static boolean createFile(String filePath) {
+		boolean createOK = false;
+		
+		if(null != filePath) {
+			if(filePath.lastIndexOf(File.separator) > 0) {
+				String dirPath = filePath.substring(0, filePath.lastIndexOf(File.separator));
+				if (dirPath != null && !dirPath.endsWith(":")) {
+					createDir(dirPath);
+				}
+			}
+			
+			File file = new File(filePath);
+			
+			if(!file.exists()) {
+				try {
+					return file.createNewFile();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			} else {
+				createOK = true;
+			}
+		}
+		
+		return createOK;
+	}
+	
+	/**
+	 * Description: 根据文件路径创建文件(如果文件所在文件夹不存在则自动创建),如果所要创建的文件已存在则不创建
+	 * @param filePath 路径+文件名+后缀
+	 * @return File 创建成功返回文件对象,否则返回null
+	 */
+	public static File createAndGetFile(String filePath) {
+		if(createFile(filePath)) {
+			return new File(filePath);
+		}
+		
+		return null;
+	}
+	
+	/**
+	 * Description: 根据文件目录和文件名创建文件
+	 * @param dirPath 文件目录路径
+	 * @param fileName 文件名+后缀
+	 * @return boolean 
+	 */
+	public static boolean createFile(String dirPath, String fileName) {
+		boolean createOK = false;
+		
+		if(createDir(dirPath)) {
+			dirPath = dirPath.endsWith(File.separator) ? dirPath : dirPath + File.separator;
+			return createFile(dirPath + fileName);
+		}
+		
+		return createOK;
+	}
+	
+	/**
+	 * Description: 创建文件夹
+	 * @param dirPath 文件夹路径
+	 * @return boolean true-创建成功;false-创建失败
+	 */
+	public static boolean createDir(String dirPath) {
+		boolean createOK = false;
+		
+		if(null != dirPath) {
+			File file = new File(dirPath);
+			
+			if(!file.exists()) {
+				return file.mkdirs();
+			} else {
+				createOK = true;
+			}
+		}
+		
+		return createOK;
+	}
+	
+	/**
+	 * Description: 删除文件
+	 * @param file
+	 * @return boolean
+	 */
+	public static boolean delFile(File file) {
+		if(null != file && file.exists() && file.isFile()) {
+			return file.delete();
+		}
+		
+		return false;
+	}
+	
+	/**
+	 * Description: 删除文件
+	 * @param filePath 文件绝对路径
+	 * @return boolean true-文件存在且删除成功;false-删除失败
+	 */
+	public static boolean delFile(String filePath) {
+		if(null != filePath) {
+			File file = new File(filePath);
+			return delFile(file);
+		}
+		
+		return false;
+	}
+	
+	/**
+     * 
+     * Description: 删除文件夹,及文件夹下的所有子文件夹和文件 
+     * @param folderPath void
+     */
+	public static boolean delFolder(String folderPath) {
+		// 删除完里面所有内容 
+		if(!delAllFile(folderPath)) {
+			return false;
+		}
+		
+        try {  
+            String filePath = folderPath.toString();
+            File myFilePath = new File(filePath); 
+            // 删除空文件夹 
+            if(null != myFilePath && myFilePath.exists()) {
+            	return myFilePath.delete(); 
+            }
+        } catch (Exception e) {  
+            e.printStackTrace();  
+        }
+        
+        return false;
+    }
+	
+	/**
+	 * Description: 删除目录下的所有文件和文件夹
+	 * @param path 目录绝对路径
+	 * @return boolean true-删除成功;false-删除失败
+	 */
+	public static  boolean delAllFile(String path) {  
+        boolean flag = true; 
+        File file = new File(path);  
+        if (!file.exists()) {  
+            return false;  
+        }  
+        if (!file.isDirectory()) {  
+            return false;  
+        }  
+        String[] tempList = file.list();  
+        File temp = null;  
+        for (int i = 0; i < tempList.length; i++) {  
+            if (path.endsWith(File.separator)) {  
+                temp = new File(path + tempList[i]);  
+            } else {  
+                temp = new File(path + File.separator + tempList[i]);  
+            }  
+            if (temp.isFile()) {  
+                temp.delete();  
+            }  
+            if (temp.isDirectory()) {
+            	// 先删除文件夹里面的文件
+                delAllFile(path + File.separator + tempList[i]);
+                // 再删除空文件夹
+                delFolder(path + File.separator + tempList[i]);  
+            }
+        } 
+        return flag;  
+    }
+	
+	/**
+	 * 使用流拷贝文件,速度慢
+	 * @param source 源文件
+	 * @param dest 目标文件
+	 * @throws IOException
+	 */
+	public static void copyFile1(File source, File dest) throws IOException {
+		InputStream input = null;
+		OutputStream output = null;
+		try {
+			input = new FileInputStream(source);
+			output = new FileOutputStream(dest);
+			byte[] buf = new byte[1024];
+			int bytesRead;
+			while ((bytesRead = input.read(buf)) > 0) {
+				output.write(buf, 0, bytesRead);
+			}
+		} finally {
+			input.close();
+			output.close();
+		}
+	}
+
+	/**
+	 * 使用FileChannel拷贝文件,速度快
+	 * @param source 源文件
+	 * @param dest 目标文件
+	 * @throws IOException
+	 */
+	public static void copyFile2(File source, File dest) throws IOException {
+		try (FileChannel inputChannel = new FileInputStream(source).getChannel();
+				FileChannel outputChannel = new FileOutputStream(dest).getChannel();) {
+			outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
+		}catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 使用Java7的Files类复制文件
+	 * @param source 源文件
+	 * @param dest 目标文件
+	 * @throws IOException
+	 */
+	public static void copyFile3(File source, File dest) throws IOException {
+		Files.copy(source.toPath(), dest.toPath());
+	}
+	
+	/**
+	 * Description: 获取文件中内容的总行数 
+	 * @param file
+	 * @return Integer 文件中内容总行数,默认0行
+	 */
+	public static Integer getLineNumber(File file) {
+		Integer lineNumber = 0;
+		
+		if(file != null && file.exists() && file.isFile()) {
+			try(LineNumberReader lnr = new LineNumberReader(new FileReader(file));) {
+				lnr.skip(Long.MAX_VALUE);
+				lineNumber = lnr.getLineNumber() + 1;
+			}catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		
+		return lineNumber;
+	}
+	
+	/**
+	 * Description: 按行读取文件中的信息存入到List集合中
+	 * @param file
+	 * @return List<String> 文件中的内容,按行存入集合,默认返回空集合
+	 */
+	public static List<String> readFileToList(File file) {
+		List<String> contentList = new ArrayList<>();
+		
+		if(null == file || !file.exists() || !file.isFile()) {
+			return contentList;
+		}
+		
+		try (InputStreamReader isr = new InputStreamReader(new FileInputStream(file));
+				BufferedReader br = new BufferedReader(isr);) {
+			String temp = null;
+			while ((temp = br.readLine()) != null) {
+				contentList.add(temp);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return contentList;
+	}
+	
+	
+	/**
+	 * Description: 按行读取文件中的信息,将所读到信息写入到一个字符串当中 
+	 * @param file 文件
+	 * @return String 文件中的信息
+	 * @author cuixubin
+	 * @since 2018年7月11日: 下午5:26:35
+	 * Update By cuixubin 2018年7月11日: 下午5:26:35
+	 */
+	public static String readFileToString(File file) {
+		StringBuffer sbStr = new StringBuffer();
+		List<String> dataStringList = readFileToList(file);
+		if(null != dataStringList) {
+			for(String str : dataStringList) {
+				sbStr.append(str);
+			}
+		}
+		
+		return sbStr.toString();
+	}
+	
+	/**
+	 * Description: 将字符串写入到指定文件
+	 * @param file 已存在的文件绝对路径
+	 * @param str 要写入的字符串
+	 * @param append true-在文件中追加字符串;false先清空文件中原有内容再写入字符串
+	 * @throws Exception void
+	 * @author cuixubin
+	 * @since 2018年8月19日: 下午8:01:41
+	 * Update By cuixubin 2018年8月19日: 下午8:01:41
+	 */
+	public static void writeInFile(File file, String str, boolean append) throws Exception{
+		if(null == file || !file.exists() || !file.isFile()) {
+			throw new Exception("文件不存在!");
+		}
+		
+		if(str == null) {
+			return;
+		}
+		
+		/*
+         try(PrintStream ps = new PrintStream(new FileOutputStream(file));){
+        	 if(append) {
+        		 ps.append(str);
+        	 }else {
+        		 ps.println(str);
+        	 }
+         }
+         */
+
+		BufferedWriter out = null;
+		try {
+			out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, append)));
+			out.write(str + "\r\n");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				out.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+
+	}
+	
+}

+ 90 - 0
src/main/java/com/persagy/framework/util/HolidaySearchUtil.java

@@ -0,0 +1,90 @@
+package com.persagy.framework.util;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import com.persagy.core.component.JsonObjectMapper;
+import com.persagy.core.utils.HttpUtils;
+import com.persagy.functions.weather.dto.DayHolidayDTO;
+
+
+/**
+ * Description: 法定休息日,工作日信息服务   
+ * Company: Persagy 
+ * @author cuixubin 
+ * @since: 2019年1月14日: 上午9:25:59
+ */
+public class HolidaySearchUtil {
+	public static final int START_YEAR = 2017;
+	private static final String URL_GOSEEK_GET = "http://api.goseek.cn/Tools/holiday?date=";
+	private static final Logger logger = Logger.getLogger(HolidaySearchUtil.class);
+	
+	private static JsonObjectMapper objectMapper = new JsonObjectMapper();
+	
+	@SuppressWarnings("unchecked")
+	public static List<DayHolidayDTO> queryHolidayCodeForOneYear(int year) {
+		
+		List<DayHolidayDTO> resultList = new ArrayList<DayHolidayDTO>();
+		
+		int nowYear = DateUtils.getYear(new Date());
+		
+		int errorNum = 0;
+		
+		if(year >= START_YEAR && year <= nowYear) {
+			
+			Date yearStart = null;
+			Date yearEnd = null;
+			try {
+				yearStart = DateUtils.str2Date(year+"-01-01", DateUtils.SDF_DAY);
+				yearEnd = DateUtils.getYearOff(yearStart, 1);
+			} catch (Exception e1) {
+				e1.printStackTrace();
+			}
+			
+			if(yearStart != null && yearEnd != null) {
+				Map<String, String> params = new HashMap<String, String>();
+				
+				Date dayOfYear = yearStart;
+				
+				while(dayOfYear.before(yearEnd)) {
+					// 10次请求出错则停止
+					if(errorNum == 10) {
+						break;
+					}
+					
+					try {
+						// 结果数据结构{"code":10000,"data":0}
+						String result = HttpUtils.get(URL_GOSEEK_GET + Integer.parseInt(DateUtils.date2Str(dayOfYear, DateUtils.SDFDAY)), params);
+						Map<String, Object> paramObj = objectMapper.readValue(result, Map.class);
+						
+						if(paramObj.containsKey("code") && paramObj.containsKey("data")) {
+							resultList.add(new DayHolidayDTO(dayOfYear, (Integer) paramObj.get("data")));
+						}else {
+							errorNum ++;
+						}
+					}catch (Exception e) {
+						errorNum ++;
+						e.printStackTrace();
+					}
+					
+					dayOfYear = DateUtils.getDayOff(dayOfYear, 1);
+				}
+				
+				if(errorNum >= 10) {
+					logger.error("查询法定日信息请求失败,接口:" + URL_GOSEEK_GET + ",年份:" + year);
+					resultList.clear();
+				}
+			}
+		}else {
+			logger.error("查询法定日年份[" + year + "]不支持,仅支持[" + START_YEAR + "," + nowYear + "]");
+		}
+		
+		return resultList;
+	}
+	
+}

+ 143 - 0
src/main/java/com/persagy/framework/util/HttpUtil.java

@@ -0,0 +1,143 @@
+package com.persagy.framework.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import org.apache.http.client.config.RequestConfig;
+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.client.methods.HttpUriRequest;
+import org.apache.http.entity.FileEntity;
+import org.apache.http.entity.InputStreamEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.util.EntityUtils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.core.constant.SystemConstant;
+
+/**
+ * Http请求工具类
+ */
+public class HttpUtil {
+	private final static PoolingHttpClientConnectionManager CONNECTION_MANAGER = new PoolingHttpClientConnectionManager();
+	private final static CloseableHttpClient HTTP_CLIENT;
+	private static final String UTF8 = "utf-8";
+
+	static {
+		// 设置整个连接池最大连接数 根据自己的场景决定
+		CONNECTION_MANAGER.setMaxTotal(200);
+		// 每个路由(网站)的最大连接数
+		CONNECTION_MANAGER.setDefaultMaxPerRoute(100);
+		RequestConfig requestConfig = RequestConfig.custom()
+				// 连接建立时间,三次握手完成时间
+				.setConnectTimeout(5000)
+				// 数据传输过程中数据包之间间隔的最大时间
+				.setSocketTimeout(8000)
+				// httpClient使用连接池来管理连接,这个时间就是从连接池获取连接的超时时间
+				.setConnectionRequestTimeout(6000).build();
+		HTTP_CLIENT = HttpClients.custom().setConnectionManager(CONNECTION_MANAGER)
+				.setDefaultRequestConfig(requestConfig).build();
+	}
+
+	/**
+	 * get请求
+	 * @param url
+	 * @return 结果字符串
+	 * @throws Exception
+	 */
+	public static String get(String url) throws Exception {
+		HttpGet httpGet = new HttpGet(url);
+		return sendRequest(httpGet);
+	}
+
+	/**
+	 * post请求
+	 * @param url
+	 * @return 结果字符串
+	 * @throws Exception
+	 */
+	public static String post(String url) throws Exception {
+		HttpPost httpPost = new HttpPost(url);
+		return sendRequest(httpPost);
+	}
+
+	/**
+	 * post请求
+	 * @param url
+	 * @param params 请求参数
+	 * @return
+	 * @throws IOException
+	 */
+	public static String post(String url, Map<String, String> params) throws IOException {
+		HttpPost httpPost = new HttpPost(url);
+		httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
+		httpPost.setEntity(new StringEntity(SystemConstant.jsonMapper.writeValueAsString(params), UTF8));
+		String respContent = sendRequest(httpPost);
+		return respContent;
+	}
+	
+	/**
+	 * post请求
+	 * @param url
+	 * @param params 请求参数
+	 * @return
+	 * @throws IOException
+	 */
+	public static String post(String url, JSONObject params) throws IOException {
+		HttpPost httpPost = new HttpPost(url);
+		httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
+		httpPost.setEntity(new StringEntity(SystemConstant.jsonMapper.writeValueAsString(params), UTF8));
+		String respContent = sendRequest(httpPost);
+		return respContent;
+	}
+	
+	private static String sendRequest(HttpUriRequest request) throws IOException {
+		CloseableHttpResponse response = HTTP_CLIENT.execute(request);
+		return EntityUtils.toString(response.getEntity(), UTF8);
+	}
+
+	/**
+	 * post请求
+	 * @param url
+	 * @param is 输入数据流,body体数据
+	 * @return
+	 * @throws Exception
+	 */
+	public static String post(String url, InputStream is) throws Exception {
+		HttpPost httpPost = new HttpPost(url);
+		httpPost.setEntity(new InputStreamEntity(is));
+		return sendRequest(httpPost);
+	}
+
+	/**
+	 * post请求
+	 * @param url
+	 * @param file 文件实例
+	 * @return
+	 * @throws Exception
+	 */
+	public static String post(String url, File file) throws Exception {
+		HttpPost httpPost = new HttpPost(url);
+		httpPost.setEntity(new FileEntity(file));
+		return sendRequest(httpPost);
+	}
+
+	/**
+	 * get请求
+	 * @param url
+	 * @return 字节数组
+	 * @throws Exception
+	 */
+	public static byte[] getData(String url) throws Exception {
+		HttpGet httpGet = new HttpGet(url);
+		CloseableHttpResponse response = HTTP_CLIENT.execute(httpGet);
+		return EntityUtils.toByteArray(response.getEntity());
+	}
+
+}

+ 143 - 0
src/main/java/com/persagy/framework/util/JsonUtils.java

@@ -0,0 +1,143 @@
+package com.persagy.framework.util;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
+import com.alibaba.fastjson.util.TypeUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Type;
+import java.util.List;
+
+/**
+ * @Description json工具类
+ * @Author feng
+ * @Date 2018/7/19 12:17
+ * @Version 1.0
+ */
+public class JsonUtils {
+
+    static {
+        TypeUtils.compatibleWithJavaBean = true;
+    }
+
+    /**
+     * 将json字符串转换成java对象
+     *
+     * @param json 需要转化json字符
+     * @param cls  cls  返回实例对象类型
+     * @return T
+     */
+    public static <T> T jsonToBean(String json, Class<T> cls) {
+        return JSON.parseObject(json, cls);
+    }
+
+    public static <T> T getJsonFromInputStream(InputStream inputStream, Class<T> cls) throws IOException {
+
+        return JSON.parseObject(inputStream, cls);
+    }
+
+    /**
+     * 将json字符串转换成java对象
+     *
+     * @param json 需要转化json字符
+     * @param cls  cls  返回实例对象类型
+     * @return T
+     */
+    public static <T> T jsonToBean(String json, Type cls) {
+        return JSON.parseObject(json, cls);
+    }
+
+    /**
+     * 将json字符串转换成java对象
+     *
+     * @param json 需要转化json字符
+     * @return T
+     */
+    public static <T> T jsonToBean(String json) {
+        TypeReference<T> typeReference = new TypeReference<T>() {
+        };
+        return JSON.parseObject(json, typeReference.getType());
+    }
+
+    /**
+     * 将json字符串转换成java对象
+     *
+     * @param json 需要转化json字符
+     * @param cls  cls  返回实例对象类型
+     * @return T
+     */
+    public static <T> T jsonToBean(byte[] json, Class<T> cls) {
+        return JSON.parseObject(json, cls);
+    }
+
+
+    /**
+     * 将json字符串转换成java对象
+     *
+     * @param json 需要转化json字符
+     * @param cls  cls  返回实例对象类型
+     * @return T     TypeReference typeReference = new TypeReference<JsonBean>() {};
+     */
+    public static <T> T jsonToBean(byte[] json, Type cls) {
+        return JSON.parseObject(json, cls);
+    }
+
+
+    /**
+     * 将json字符串转换成java List对象
+     *
+     * @param json 需要转化json字符
+     * @param cls  cls  返回实例对象类型
+     * @return List<T>
+     */
+    public static <T> List<T> jsonToList(String json, Class<T> cls) {
+        return JSON.parseArray(json, cls);
+    }
+
+    /**
+     * 将bean对象转化成json字符串
+     *
+     * @param obj 转化的对象实例
+     * @return String  JSON 字符
+     */
+    public static String beanToJson(Object obj) {
+        String result = JSON.toJSONString(obj);
+        return result;
+    }
+
+    /**
+     * 将bean对象转化成json字符串
+     *
+     * @param obj    转化的对象实例
+     * @param filter 序列化处理
+     * @return String  JSON 字符
+     */
+    public static String beanToJson(Object obj, SimplePropertyPreFilter filter) {
+        return JSON.toJSONString(obj, filter);
+    }
+
+
+    /**
+     * 价格json字符转换JSONObject
+     *
+     * @param jsonString 需要转换的字符
+     * @return JSONObject
+     */
+    public static JSONObject parseJsonObject(String jsonString) {
+        return JSONObject.parseObject(jsonString);
+    }
+
+    /**
+     * 价格json字符转换JSONObject
+     *
+     * @param jsonString 需要转换的字符
+     * @return JSONObject
+     */
+    public static JSONArray parseJsonArray(String jsonString) {
+        return JSONArray.parseArray(jsonString);
+    }
+}

+ 137 - 0
src/main/java/com/persagy/framework/util/NumberUtils.java

@@ -0,0 +1,137 @@
+package com.persagy.framework.util;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.commons.collections.CollectionUtils;
+
+/**
+ * Description: 数字工具类   
+ * Company: Persagy 
+ * @author cuixubin 
+ * @version 1.0
+ * @since: 2018年9月18日: 上午10:39:16
+ * Update By cuixubin 2018年9月18日: 上午10:39:16
+ */
+public class NumberUtils {
+	
+	/**
+	 * Description: 对浮点数四舍五入
+	 * @param number 浮点数
+	 * @param scale 小数保留位, 0-四舍五入到个位,1-四舍五入到到0.1,2-四舍五入到到0.01,-1四舍五入到到十位
+	 * @return double
+	 * @author cuixubin
+	 * @since 2019年1月5日: 下午2:09:09
+	 */
+	public static double roundUp(double number, int scale) {
+		BigDecimal bg = new BigDecimal(number).setScale(scale, RoundingMode.HALF_UP);
+		return bg.doubleValue();
+	}
+	
+	/**
+	 * Description: 对浮点数四舍五入
+	 * @param number 浮点数
+	 * @param scale 小数保留位, 0-四舍五入到个位,1-四舍五入到到0.1,2-四舍五入到到0.01,-1四舍五入到到十位
+	 * @return Double 若参数number值为null,则返回null
+	 * @author cuixubin
+	 * @since 2019年1月7日: 上午9:26:31
+	 */
+	public static Double roundUp(Double number, int scale) {
+		if(null == number) {
+			return null;
+		}
+		
+		BigDecimal bg = new BigDecimal(number).setScale(scale, RoundingMode.HALF_UP);
+		return bg.doubleValue();
+	}
+	
+	public static void main(String[] args) {
+		System.out.println(roundUp(12.123, 0));
+	}
+	
+	/**
+	 * Description: 字符串类型数字转Double,转换异常返回null 
+	 * @param str
+	 * @return Double
+	 * @author cuixubin
+	 * @since 2018年9月18日: 上午10:41:59
+	 * Update By cuixubin 2018年9月18日: 上午10:41:59
+	 */
+	public static Double str2double(String str) {
+		Double num = null;
+		
+		if(null == str || str.trim().equals("")) {
+			return num;
+		}
+		
+		try {
+			num = Double.valueOf(str);
+		}catch (Exception e) {
+		}
+			
+		return num;
+	}
+	
+	/**
+	 * 
+	 * Description: 对象转Double类型
+	 * @param object
+	 * @return Double
+	 * @author JiShaoJun
+	 * @since 2018年12月15日: 下午8:14:10
+	 */
+	public static Double Object2Double(Object object) {
+		if (object == null) {
+			return null;
+		}
+		if (object instanceof String) {
+			return Double.valueOf(object.toString());
+		}
+		if (object instanceof Integer) {
+			return ((Integer) object).doubleValue();
+		}
+		if (object instanceof Long) {
+			return ((Long) object).doubleValue();
+		}
+		if (object instanceof Double) {
+			return (Double) object;
+		}
+		return (Double) object;
+	}
+
+	/**
+	 * description 求和 
+	 * @param dataList
+	 * @return java.lang.Double
+	 * @author feng
+	 * @since 16:08 2018/12/20
+	 */
+    public static Double getDoubleSum(Collection<Double> dataList) {
+        if (CollectionUtils.isEmpty(dataList)) {
+            return null;
+        }
+        Double sum = null;
+        for (Double data : dataList) {
+            if (data != null) {
+                sum = sum == null ? data : sum + data;
+            }
+        }
+        return sum;
+    }
+
+	public static Integer getIntegerSum(List<Integer> dataList) {
+		if (CollectionUtils.isEmpty(dataList)) {
+			return null;
+		}
+		Integer sum = null;
+		for (Integer data : dataList) {
+			if (data != null) {
+				sum = sum == null ? data : sum + data;
+			}
+		}
+		return sum;
+	}
+    
+}

+ 22 - 0
src/main/java/com/persagy/framework/util/PropertyUtil.java

@@ -0,0 +1,22 @@
+package com.persagy.framework.util;
+
+import java.io.IOException;
+import java.util.Properties;
+
+public class PropertyUtil {
+	public static String getProperty(String key, String propertyFilePath) {
+		Properties properties = new Properties();
+		try {
+			properties.load(PropertyUtil.class.getResourceAsStream(propertyFilePath));
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		String value = properties.getProperty(key);
+		
+		return value;
+	}
+	
+	public static String getSystemProperty(String key) {
+		return getProperty(key, "/config/system.properties");
+	}
+}

+ 155 - 0
src/main/java/com/persagy/framework/util/RandomUtil.java

@@ -0,0 +1,155 @@
+package com.persagy.framework.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+public class RandomUtil
+{
+	private final static char[] chars = {'a' ,'b', 'c', 'd', 'e', 'f', 'g', 'h',
+		'i','j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+		'x','y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
+		'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0',
+		'1', '2', '3', '4', '5', '6', '7', '8', '9'};
+
+	// 随机数生成器
+	private Random r = new Random();
+	
+	// 唯一实例
+	private static RandomUtil random = new RandomUtil();
+	
+	protected RandomUtil() {}
+	
+	/**
+	 * 获取唯一实例.
+	 * @return
+	 */
+	public static RandomUtil getInstance()
+	{
+		return random;
+	}
+
+	/**
+	 * 随机数字字符串.
+	 * @param len
+	 * @return
+	 */
+	public String randNumber(int len)
+	{
+		return randomString(len, 52, 61);
+	}
+
+	/**
+	 * 随机数字和大小写字母的字符串.
+	 * @param len
+	 * @return
+	 */
+	public String randNumberAndAlpha(int len)
+	{
+		return randomString(len, 0, 62);
+	}
+
+	/**
+	 * 随机小写字母形式的字符串.
+	 * @param len
+	 * @return
+	 */
+	public String randLowerAlpha(int len)
+	{
+		return randomString(len, 0, 26);
+	}
+
+	/**
+	 * 随机大写字母形式的字符串.
+	 * @param len
+	 * @return
+	 */
+	public String randUpperAlpha(int len)
+	{
+		return randomString(len, 26, 52);
+	}
+
+	/**
+	 * 随机大小写混合的字母形式的字符串.
+	 * @param len
+	 * @return
+	 */
+	public String randAlpha(int len)
+	{
+		return randomString(len, 0, 52);
+	}
+	
+	/**
+	 * 随机字符生成方法.
+	 * @param len
+	 * @param start
+	 * @param end
+	 * @return
+	 */
+	protected String randomString(int len, int start, int end)
+	{
+		StringBuilder charValue = new StringBuilder();
+		for (int i = 0; i < len; i++) {
+			charValue.append(chars[randomInt(start, end)]);
+		}
+		return charValue.toString();
+	}
+	
+	/**
+	 * 集合元素随机排序
+	 * @param list
+	 * @return
+	 */
+	public List<Integer> randomListInt(List<Integer> list) {
+		if(null == list || list.isEmpty() || list.size() == 1) {
+			return list;
+		}
+		
+		List<Integer> returnList = new ArrayList<>();
+		while(list.size() > 1) {
+			int index = randomInt(0, list.size());
+			returnList.add(list.get(index));
+			list.remove(index);
+		}
+		returnList.add(list.get(0));
+		
+		return returnList;
+	}
+	
+	/**
+	 * 集合元素随机排序
+	 * @param list
+	 * @return
+	 */
+	public List<Object> randomListObj(List<Object> list) {
+		if(null == list || list.isEmpty() || list.size() == 1) {
+			return list;
+		}
+		
+		List<Integer> indexList = new ArrayList<>();
+		
+		for(int i=0; i<list.size(); i++) {
+			indexList.add(i);
+		}
+		indexList = randomListInt(indexList);
+		
+		List<Object> returnList = new ArrayList<>();
+		for(Integer index : indexList) {
+			returnList.add(list.get(index));
+		}
+		
+		return returnList;
+	}
+	
+	/**
+	 * 返回[from,to)之间的一个随机整数
+	 * 
+	 * @param from  起始值
+	 * @param to 结束值
+	 * @return [from,to)之间的一个随机整数
+	 */
+	public int randomInt(int from, int to)
+	{
+		return from + r.nextInt(to - from);
+	}
+}

+ 479 - 0
src/main/java/com/persagy/framework/util/StringUtils.java

@@ -0,0 +1,479 @@
+package com.persagy.framework.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.collections.CollectionUtils;
+
+import com.thoughtworks.xstream.core.util.Base64Encoder;
+
+/**
+ * 
+ * <p> StringUtils.java.</p>
+ * <p>Description: 字符串的方法 .</p>
+ * <p>Company: .</p>
+ * <p> @author <a href="mail to:xubin_1009@sina.com">xubin</a></p>
+ * <p> @since 2018年3月29日: 下午3:31:57 </p>
+ * <p> @version .</p>
+ */
+/**
+ * <p> StringUtils.java.</p>
+ * <p>Description:  .</p>
+ * <p>Company: .</p>
+ * <p> @author <a href="mail to:xubin_1009@sina.com">xubin</a></p>
+ * <p> @since 2018年3月29日: 下午3:35:12 </p>
+ * <p> @version .</p>
+ */
+@SuppressWarnings("rawtypes")
+public final class StringUtils {
+	
+	/**  <p> 提供空字符串.</p> */
+	public static final java.lang.String EMPTY = "";
+	
+	/**
+	 * Description: 可切割字符串转List<Double>集合
+	 * @param str 可切割字符串,如"1,2,3,4"或"1.5;2.5;0.5",允许含空格,如"1, 2, 3 , 4"
+	 * @param regex 切割符号如","或";", 默认值为","
+	 * @return List<Double> 参数字符串str为null,返回null;str为空格字符串或空字符串返回空集合
+	 * @throws Exception 
+	 * @author cuixubin
+	 * @since 2018年11月29日: 上午10:36:08
+	 */
+	public static List<Double> getDoubleListFromStr(String str, String regex) throws Exception{
+		regex = regex == null ? "," : regex;
+		
+		List<Double> result = null;
+		
+		if(null == str) {
+			return result;
+		}
+		
+		result = new ArrayList<>();
+		
+		if(!isBlank(str)) {
+			
+			for(String numStr : str.replace(" ", "").split(regex)) {
+				try {
+					result.add(Double.valueOf(numStr));
+				}catch (Exception e) {
+					result.add(null);
+				}
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	 * Description: 将数值集合转为字符串,元素按英文逗号,分割
+	 * @param list 元素为数值格式集合
+	 * @return 参数list为null返回null,为空集合返回空字符串""
+	 * @throws Exception String
+	 * @author cuixubin
+	 * @since 2018年11月29日: 上午10:44:50
+	 */
+	public static <T extends Number>  String getStrFromNumberList(List<T> list) throws Exception {
+		return list == null ? null : list.toString().replace("[", "").replace("]", "").replace(" ", "");
+	}
+	
+	/**
+	 * Description: 判断字符串是否为null,或者是空串"", 或者是空格串"  "
+	 * @param str
+	 * @return boolean
+	 * @author cuixubin
+	 * @since 2018年8月20日: 下午1:26:25
+	 * Update By cuixubin 2018年8月20日: 下午1:26:25
+	 */
+	public static final boolean isBlank(String str) {
+		if(isEmpty(str)) {
+			return true;
+		}
+		
+		return str.trim().length() == 0;
+	}
+	
+	/**
+	 * Description: 如果源字符串str为null,空串或空格串则返回默认字符串
+	 * @param str 源字符串
+	 * @param defStr 默认字符串
+	 * @return String
+	 * @author cuixubin
+	 * @since 2018年8月20日: 下午1:28:52
+	 * Update By cuixubin 2018年8月20日: 下午1:28:52
+	 */
+	public static String getDefault(String str, String defStr) {
+		return isBlank(str) ? defStr : str;
+	}
+
+	/**
+	 *<p>Description:判断字符串是否为null,或者是空串""  .</p> 
+	 *<p> @param s
+	 *<p> @return boolean
+	 * @since 2018年3月29日: 下午3:34:03
+	 * @author <a href="mail to:xubin_1009@sina.com">xubin</a>
+	 * @version 1.0
+	 */
+	public static final boolean isEmpty(String s) {
+		return (s == null || s.length() == 0);
+	}
+	/**
+	 *<p>Description: 判断字符串是否不为null,且不是空串"" .</p> 
+	 *<p> @param s
+	 *<p> @return boolean
+	 * @since 2018年3月29日: 下午3:34:14
+	 * @author <a href="mail to:xubin_1009@sina.com">xubin</a>
+	 * @version 1.0
+	 */
+	public static final boolean isNotEmpty(String s) {
+		return !isEmpty(s);
+	}
+	public static final String toString(Object o) {
+		return o != null ? o.toString() : null;
+	}
+
+	 /**
+	 *<p>Description:判断是否为空串  .</p> 
+	 *<p>@param cs
+	 *<p>@return boolean
+	 *@since 2017年5月3日: 上午10:39:23
+	 *@author xubin
+	 *@version 1.0
+	 */
+	public static boolean isBlank(CharSequence cs) {
+		if (null == cs)
+			return true;
+		int length = cs.length();
+		for (int i = 0; i < length; i++) {
+			if (!Character.isWhitespace(cs.charAt(i)))
+				return false;
+		}
+		return true;
+	}
+	
+	/**
+	 *<p>Description: 比较字符串是否相等,都为null时,返回true .</p> 
+	 *<p> @param string1
+	 *<p> @param string2
+	 *<p> @return boolean
+	 * @since 2018年3月29日: 下午3:34:37
+	 * @author <a href="mail to:xubin_1009@sina.com">xubin</a>
+	 * @version 1.0
+	 */
+	public static boolean equalsWithNull(String string1, String string2) {
+		if (string1 == null) {
+			if (string2 == null) {
+				return true;
+			} else {
+				return false;
+			}
+		} else {
+			return string1.equals(string2);
+		}
+	}
+	
+	public static boolean checkIsPhone(String phonenumber) {
+		String phone = "(^(d{3,4}-)?d{7,8})$|(1[0-9]{10})";
+		String tregEx = "[0-9]{7,8}"; // 表示a或f 0832-80691990
+		Pattern p = Pattern.compile(phone);
+		Matcher m = p.matcher(phonenumber);
+		Pattern p2 = Pattern.compile(tregEx);
+		Matcher m2 = p2.matcher(phonenumber);
+		// String regEx="[1]{1}[3,5,8,6]{1}[0-9]{9}"; //手机
+		// String tregEx="[0]{1}[0-9]{2,3}-[0-9]{7,8}"; //表示a或f 0832-80691990
+		return m.matches() || m2.matches();
+	}
+	
+	/**
+	 *<p>Description: 判断字符串中是否包含汉字,如字符串为空,返回false .</p> 
+	 *<p> @param str
+	 *<p> @return boolean
+	 * @since 2018年3月29日: 下午3:35:01
+	 * @author <a href="mail to:xubin_1009@sina.com">xubin</a>
+	 * @version 1.0
+	 */
+	public static boolean hasHanZi(String str) {
+		if (StringUtils.isEmpty(str)) {
+			return false;
+		}
+		String regEx = "[\\u4e00-\\u9fa5]";
+
+		Pattern pat = Pattern.compile(regEx);
+		Matcher mat = pat.matcher(str);
+		return mat.find();
+
+	}
+	
+	/**
+	 *<p>Description:  .</p> 
+	 *<p> @param str
+	 *<p> @return String
+	 * @since 2018年3月29日: 下午3:35:17
+	 * @author <a href="mail to:xubin_1009@sina.com">xubin</a>
+	 * @version 1.0
+	 */
+	public static String spriceNumberic(String str) {
+		StringBuffer sb = new StringBuffer();
+		if (str != null) {
+			for (int i = 0; i < str.length(); i++) {
+				if (Character.isDigit(str.charAt(i))) {
+					sb.append("*");
+				} else {
+					sb.append(str.charAt(i));
+				}
+			}
+		}
+		return sb.toString();
+
+	}
+	  
+	/**
+	 *<p>Description:  根据id的集合拼接成用于SQL中in条件的串 .</p> 
+	 *<p> @param ids
+	 *<p> @return String
+	 * @since 2018年3月29日: 下午3:35:32
+	 * @author <a href="mail to:xubin_1009@sina.com">xubin</a>
+	 * @version 1.0
+	 */
+	public static String createIdsForSQL(Collection<String> ids) {
+		  String[] idsArr = null;
+		  if (ids != null){
+			  idsArr = ids.toArray(new String[0]);
+		  }
+		  return createIdsForSQL(idsArr);
+	  }
+	  
+	/**
+	 *<p>Description: 根据String[]拼接成用于SQL中in条件的串 .</p> 
+	 *<p> @param ids
+	 *<p> @return String
+	 * @since 2018年3月29日: 下午3:36:13
+	 * @author <a href="mail to:xubin_1009@sina.com">xubin</a>
+	 * @version 1.0
+	 */
+	public static String createIdsForSQL(String[] ids) {
+		if (ids == null || ids.length == 0) {
+			return "'-9999'";
+		}
+		StringBuffer buffer = new StringBuffer();
+		for (String tmp : ids) {
+			if (buffer.length() > 0) {
+				buffer.append(",");
+			}
+			buffer.append("'" + tmp + "'");
+		}
+		return buffer.toString();
+	}
+	
+	 /**
+	 *<p>Description: 去除字符里包含的回车(\n)、水平制表符(\t)、空格(\s)、换行(\r) .</p> 
+	 *<p>@param str
+	 *<p>@return String 
+	 */
+	public static String replaceSpecilSign(String str) {
+		String dest = "";
+		if (isNotEmpty(str)) {
+			Pattern p = Pattern.compile("\\s*|\t|\r|\n");
+
+			Matcher m = p.matcher(str);
+
+			dest = m.replaceAll("");
+		}
+		return dest;
+	}
+
+	/**
+	 *<p>Description: 判断一个字符串是否为数字型字符串 .</p> 
+	 *<p>@param str
+	 *<p>@return boolean 
+	 */
+	public static boolean isNumberic(String str) {
+		if (isEmpty(str)) {
+			return false;
+		}
+		Pattern pattern = Pattern.compile("[0-9]*");
+		return pattern.matcher(str).matches();
+	}
+	/**
+	 *<p>Description: 目标字符是否包含正则表达式所给字符 .</p> 
+	 *<p>@param destStr 目标字符
+	 *<p>@param regEx 正则表达式
+	 *<p>@return boolean 
+	 */
+	public static boolean containString(String destStr,String regEx){
+		if(isEmpty(destStr)){
+			return false;
+		}
+		if(isEmpty(regEx)){
+			return false;
+		}
+		Pattern p = Pattern.compile(regEx);
+		Matcher m = p.matcher(destStr);
+		return m.find();
+	}
+	
+	/**
+	 *<p>Description:  .</p> 
+	 *<p> @param fileName
+	 *<p> @return boolean
+	 * @since 2018年3月29日: 下午3:36:36
+	 * @author <a href="mail to:xubin_1009@sina.com">xubin</a>
+	 * @version 1.0
+	 */
+	public static boolean isFileName(String fileName) {
+		boolean flag =false;
+		if(isEmpty(fileName)){
+			return false;
+		}
+		if(fileName.indexOf("*")>=0){
+			return true;
+		}
+		if(fileName.indexOf("\\")>=0){
+			return true;
+		}
+		if(fileName.indexOf("/")>=0){
+			return true;
+		}
+		if(fileName.indexOf("?")>=0){
+			return true;
+		}
+		if(fileName.indexOf(":")>=0){
+			return true;
+		}
+		if(fileName.indexOf("<")>=0){
+			return true;
+		}
+		if(fileName.indexOf(">")>=0){
+			return true;
+		}
+		if(fileName.indexOf("\"")>=0){
+			return true;
+		}
+		if(fileName.indexOf("|")>=0){
+			return true;
+		}
+		return flag;
+		
+	}
+	/**
+     * 
+     *<p>Description:将字符串首字母大写  .</p> 
+     *<p>@param s
+     *<p>@return String
+     *@since 2014 10:13:02 AM
+     *@author xubin
+     *@version 1.0
+     */
+	public static String capitalize(CharSequence s) {
+		if (null == s)
+			return null;
+		int len = s.length();
+		if (len == 0)
+			return "";
+		char char0 = s.charAt(0);
+		if (Character.isUpperCase(char0))
+			return s.toString();
+		return new StringBuilder(len).append(Character.toUpperCase(char0))
+				.append(s.subSequence(1, len)).toString();
+	}
+
+	/**
+     * 判断String是否为null或空
+     * @param params
+     * @return
+     */
+    public static boolean isNull(String... params){
+        for(String param : params){
+            if(param == null || "".equals(param)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 判断dto是否包含parmas中的字段
+     * @param dto
+     * @param params
+     * @return
+     */
+    public static boolean isNull(Map dto, String... params){
+        for(String param : params){
+            if(isNull((String)dto.get(param))){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 判断dto中时候包含parmas中字段的为空数组
+     * @param dto
+     * @param params
+     * @return
+     */
+	public static boolean isEmptyList(Map dto, String... params){
+        List destList;
+        for(String param : params){
+        	destList = (List)dto.get(param);
+            if(destList == null || destList.isEmpty()){
+                return true;
+            }
+        }
+        return false;
+    }
+	/**
+	 * 判断dto中时候包含parmas中字段的为空Map
+	 * @param dto
+	 * @param params
+	 * @return
+	 */
+	public static boolean isEmptyMap(Map dto, String... params){
+		Map destMap;
+		for(String param : params){
+			destMap = (Map)dto.get(param);
+			if(null == destMap || CollectionUtils.isEmpty(destMap.keySet())){
+				return true;
+			}
+		}
+		return false;
+	}
+	/**
+	  * 序列化对象为String字符串
+	  * @param o Object
+	  * @return String
+	  * @throws Exception
+	  */
+	 public static String writeObject(Object o) throws Exception {
+	  ByteArrayOutputStream bos = new ByteArrayOutputStream();
+	  ObjectOutputStream oos = new ObjectOutputStream(bos);
+	  oos.writeObject(o);
+	  oos.flush();
+	  oos.close();
+	  bos.close();
+	  return new Base64Encoder().encode(bos.toByteArray());
+	 }
+
+	 /**
+	  * 反序列化字符串为对象
+	  * @param object String
+	  * @return
+	  * @throws Exception
+	  */
+	 public static Object readObject(String object) throws Exception{
+	 Base64Encoder base64Encoder = new Base64Encoder();
+	  ByteArrayInputStream bis = new ByteArrayInputStream(base64Encoder.decode(object));
+	     ObjectInputStream ois = new ObjectInputStream(bis);
+	     Object o = ois.readObject();
+	     bis.close();
+	     ois.close();
+	     return o;
+	 }
+}

+ 239 - 0
src/main/java/com/persagy/framework/util/SunComputeUtil.java

@@ -0,0 +1,239 @@
+package com.persagy.framework.util;
+
+import java.util.Calendar;
+import java.util.Date;
+
+
+
+public class SunComputeUtil {
+
+	private static int[] days_of_month_1 = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+	private static int[] days_of_month_2 = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+	private final static double h = -0.833;// 日出日落时太阳的位置
+	private final static double UTo = 180.0;// 上次计算的日落日出时间,初始迭代值180.0
+
+	private static boolean leap_year(int year) {
+		if (((year % 400 == 0) || (year % 100 != 0) && (year % 4 == 0)))
+			return true;
+		else
+			return false;
+	}
+
+	// 求从格林威治时间公元2000年1月1日到计算日天数days
+	private static int days(int year, int month, int date) {
+		int i, a = 0;
+		for (i = 2000; i < year; i++) {
+			if (leap_year(i))
+				a = a + 366;
+			else
+				a = a + 365;
+		}
+
+		if (leap_year(year)) {
+			for (i = 0; i < month - 1; i++) {
+				a = a + days_of_month_2[i];
+			}
+		} else {
+			for (i = 0; i < month - 1; i++) {
+				a = a + days_of_month_1[i];
+			}
+		}
+
+		a = a + date;
+		return a;
+	}
+
+	// 求格林威治时间公元2000年1月1日到计算日的世纪数t
+	private static double t_century(int days, double UTo) {
+		return ((double) days + UTo / 360) / 36525;
+	}
+
+	// 求太阳的平黄径
+	private static double L_sun(double t_century) {
+		return (280.460 + 36000.770 * t_century);
+	}
+
+	// 求太阳的平近点角
+	private static double G_sun(double t_century) {
+		return (357.528 + 35999.050 * t_century);
+	}
+
+	// 求黄道经度
+	private static double ecliptic_longitude(double L_sun, double G_sun) {
+		return (L_sun + 1.915 * Math.sin(G_sun * Math.PI / 180) + 0.02 * Math.sin(2 * G_sun * Math.PI / 180));
+	}
+
+	// 求地球倾角
+	private static double earth_tilt(double t_century) {
+		return (23.4393 - 0.0130 * t_century);
+	}
+
+	// 求太阳偏差
+	private static double sun_deviation(double earth_tilt, double ecliptic_longitude) {
+		return (180 / Math.PI
+				* Math.asin(Math.sin(Math.PI / 180 * earth_tilt) * Math.sin(Math.PI / 180 * ecliptic_longitude)));
+	}
+
+	// 求格林威治时间的太阳时间角GHA
+	private static double GHA(double UTo, double G_sun, double ecliptic_longitude) {
+		return (UTo - 180 - 1.915 * Math.sin(G_sun * Math.PI / 180) - 0.02 * Math.sin(2 * G_sun * Math.PI / 180)
+				+ 2.466 * Math.sin(2 * ecliptic_longitude * Math.PI / 180)
+				- 0.053 * Math.sin(4 * ecliptic_longitude * Math.PI / 180));
+	}
+
+	// 求修正值e
+	private static double e(double h, double glat, double sun_deviation) {
+		return 180 / Math.PI * Math.acos(
+				(Math.sin(h * Math.PI / 180) - Math.sin(glat * Math.PI / 180) * Math.sin(sun_deviation * Math.PI / 180))
+						/ (Math.cos(glat * Math.PI / 180) * Math.cos(sun_deviation * Math.PI / 180)));
+	}
+
+	// 求日出时间
+	private static double UT_rise(double UTo, double GHA, double glong, double e) {
+		return (UTo - (GHA + glong + e));
+	}
+
+	// 求日落时间
+	private static double UT_set(double UTo, double GHA, double glong, double e) {
+		return (UTo - (GHA + glong - e));
+	}
+
+	// 判断并返回结果(日出)
+	private static double result_rise(double UT, double UTo, double glong, double glat, int year, int month, int date) {
+		double d;
+		if (UT >= UTo)
+			d = UT - UTo;
+		else
+			d = UTo - UT;
+		
+		if (d >= 0.1) {
+			UTo = UT;
+			UT = UT_rise(UTo,
+					GHA(UTo, G_sun(t_century(days(year, month, date), UTo)),
+							ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+									G_sun(t_century(days(year, month, date), UTo)))),
+
+					glong,
+					e(h, glat, sun_deviation(earth_tilt(t_century(days(year, month, date), UTo)),
+							ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+									G_sun(t_century(days(year, month, date), UTo))))));
+
+			result_rise(UT, UTo, glong, glat, year, month, date);
+		}
+		return UT;
+	}
+
+	// 判断并返回结果(日落)
+	private static double result_set(double UT, double UTo, double glong, double glat, int year, int month, int date) {
+		double d;
+
+		if (UT >= UTo)
+			d = UT - UTo;
+		else
+			d = UTo - UT;
+		if (d >= 0.1) {
+			UTo = UT;
+			UT = UT_set(UTo,
+					GHA(UTo, G_sun(t_century(days(year, month, date), UTo)),
+							ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+									G_sun(t_century(days(year, month, date), UTo)))),
+					glong,
+
+					e(h, glat, sun_deviation(earth_tilt(t_century(days(year, month, date), UTo)),
+							ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+									G_sun(t_century(days(year, month, date), UTo))))));
+			result_set(UT, UTo, glong, glat, year, month, date);
+		}
+		return UT;
+	}
+
+	// 求时区
+	public static int Zone(double glong) {
+		if (glong >= 0)
+			return (int) ((int) (glong / 15.0) + 1);
+		else
+			return (int) ((int) (glong / 15.0) - 1);
+	}
+
+	/**
+	 * Description: 获取日出时间
+	 * @param glong 经度
+	 * @param glat 纬度
+	 * @param time 日期
+	 * @return Date
+	 */
+	public static Date getSunrise(double glong, double glat, Date time) {
+		double sunrise;
+
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(time);
+		
+		int year = cal.get(Calendar.YEAR);
+		int month = cal.get(Calendar.MONTH) + 1;
+		int date = cal.get(Calendar.DAY_OF_MONTH);
+
+		sunrise = result_rise(UT_rise(UTo,
+				GHA(UTo, G_sun(t_century(days(year, month, date), UTo)),
+						ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+								G_sun(t_century(days(year, month, date), UTo)))),
+
+				glong,
+
+				e(h, glat, sun_deviation(earth_tilt(t_century(days(year, month, date), UTo)),
+						ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+								G_sun(t_century(days(year, month, date), UTo)))))),
+				UTo, glong, glat, year, month, date);
+
+		int hour = (int) (sunrise / 15 + 8);
+		int minute = (int) (60 * (sunrise / 15 + 8 - (int) (sunrise / 15 + 8)));
+		
+		cal.set(year, month - 1, date, hour, minute, 0);
+		
+		return cal.getTime();
+	}
+
+	/**
+	 * Description: 获取日落时间
+	 * @param glong 经度
+	 * @param glat 纬度
+	 * @param time 日期
+	 * @return Date
+	 * @author cuixubin
+	 * @since 2018年9月18日: 下午4:22:46
+	 * Update By cuixubin 2018年9月18日: 下午4:22:46
+	 */
+	public static Date getSunset(double glong, double glat, Date time) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(time);
+		
+		int year = cal.get(Calendar.YEAR);
+		int month = cal.get(Calendar.MONTH)+1;
+		int date = cal.get(Calendar.DAY_OF_MONTH);
+		
+		double sunset;
+		
+		sunset = result_set(UT_set(UTo,
+				GHA(UTo, G_sun(t_century(days(year, month, date), UTo)),
+						ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+								G_sun(t_century(days(year, month, date), UTo)))),
+				glong,
+				e(h, glat, sun_deviation(earth_tilt(t_century(days(year, month, date), UTo)),
+
+						ecliptic_longitude(L_sun(t_century(days(year, month, date), UTo)),
+
+								G_sun(t_century(days(year, month, date), UTo)))))),
+				UTo, glong, glat, year, month, date);
+		
+		int hour = (int) (sunset / 15 + 8);
+		int minute = (int) (60 * (sunset / 15 + 8 - (int) (sunset / 15 + 8)));
+		
+		cal.set(year, month-1, date, hour, minute, 0);
+		
+		return cal.getTime();
+	}
+
+	public static void main(String[] args) throws Exception {
+		Date date = DateUtils.str2Date("2020-09-17", "yyyy-MM-dd");
+		System.out.println(getSunset(116.4039, 39.9132, date));
+	}
+}

+ 364 - 0
src/main/java/com/persagy/framework/util/WServiceUtil.java

@@ -0,0 +1,364 @@
+package com.persagy.framework.util;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import com.persagy.core.constant.SystemConstant;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.dto.AlarmDTO;
+import com.persagy.functions.weather.dto.DayPredictDTO;
+import com.persagy.functions.weather.dto.Hour24PredictDTO;
+import com.persagy.functions.weather.dto.NowAirDTO;
+import com.persagy.functions.weather.dto.NowWeatherDTO;
+import com.persagy.functions.weather.dto.WeatherResponseDTO;
+
+@SuppressWarnings("unchecked")
+public class WServiceUtil {
+	private static final Logger log = Logger.getLogger(WServiceUtil.class);
+	
+	public static Map<String, Object> getLocation(String location) {
+		Map<String, Object> nowObj = new HashMap<>();
+
+		String url = Const.ServiceURL.nowWeather;
+		url = url.replace("LOCATION", location);
+
+		try {
+			String result = HttpUtil.get(url);
+			Const.requestAdd(Const.API.nowWeather);
+			Map<String, Object> resultMap = (Map<String, Object>) SystemConstant.jsonMapper.readValue(result,
+					Map.class);
+			List<Map<String, Object>> resultArray = (List<Map<String, Object>>) resultMap.get("results");
+			Map<String, Object> dataItem = (Map<String, Object>) resultArray.get(0);
+			nowObj = (Map<String, Object>) dataItem.get("location");
+		} catch (Exception e) {
+			log.error("请求实时天气数据失败!location=" + location + e.getMessage());
+		}
+		return nowObj;
+	}
+	
+	/**
+	 * 查询天气实况
+	 * @param location 城市标识
+	 * @return
+	 */
+	public static Map<String, Object> getNowWeather(String location) {
+		Map<String, Object> nowObj = new HashMap<String, Object>();
+		
+		String url = Const.ServiceURL.nowWeather;
+		url = url.replace(Const.LOCATION, location);
+		
+		try {
+			String result = HttpUtil.get(url);
+			Const.requestAdd(Const.API.nowWeather);
+			Map<String, Object> resultMap = SystemConstant.jsonMapper.readValue(result, Map.class);
+			List<Map<String, Object>> resultArray = (List<Map<String, Object>>) resultMap.get("results");
+			Map<String, Object> dataItem = resultArray.get(0);
+			nowObj = (Map<String, Object>) dataItem.get("now");
+			nowObj.put("last_update", dataItem.get("last_update"));
+		}catch (Exception e) {
+			log.error("请求实时天气数据失败!location="+location + e.getMessage());
+		}
+		
+		return nowObj;
+	}
+	
+	/**
+	 * 查询天气实况
+	 * @param location 城市标识
+	 * @return null
+	 */
+	public static NowWeatherDTO getNowWeatherObj(String location) {
+		Map<String, Object> nowObj = getNowWeather(location);
+		if(!nowObj.isEmpty()) {
+			try {
+				return map2Obj(nowObj, NowWeatherDTO.class);
+			} catch (Exception e) {
+				log.error("map转对象失败!", e);
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * 查询空气质量实况数据
+	 * @param location 城市标识
+	 * @return
+	 */
+	public static Map<String, Object> getNowAir(String location) {
+		Map<String, Object> nowObj = new HashMap<String, Object>();
+		
+		String url = Const.ServiceURL.nowAir;
+		url = url.replace(Const.LOCATION, location);
+		
+		try {
+			String result = HttpUtil.get(url);
+			Const.requestAdd(Const.API.nowAir);
+			Map<String, Object> resultMap = SystemConstant.jsonMapper.readValue(result, Map.class);
+			List<Map<String, Object>> resultArray = (List<Map<String, Object>>) resultMap.get("results");
+			Map<String, Object> dataItem = resultArray.get(0);
+			Map<String, Object> cityMap = (Map<String, Object>) dataItem.get("air");
+			nowObj = (Map<String, Object>) cityMap.get("city");
+		}catch (Exception e) {
+			log.error("请求空气质量实况数据失败!location="+location, e);
+		}
+		
+		return nowObj;
+	}
+	
+	/**
+	 * 查询空气质量实况数据
+	 * @param location 城市标识
+	 * @return null
+	 */
+	public static NowAirDTO getNowAirObj(String location) {
+		Map<String, Object> nowObj = getNowAir(location);
+		if(!nowObj.isEmpty()) {
+			try {
+				return map2Obj(nowObj, NowAirDTO.class);
+			}catch (Exception e) {
+				log.error("map转对象失败!", e);
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * 查询逐日天气预报和昨日天气数据
+	 * @param location 城市标识
+	 * @param start >=-2, <15
+	 * @param end >-2, <=15
+	 * @return
+	 */
+	public static List<Map<String, Object>> getDayPredict(String location, int start, int end) {
+		List<Map<String, Object>> dailyArray = new ArrayList<Map<String, Object>>();
+		
+		String url = Const.ServiceURL.dayPredict;
+		url = url.replace(Const.LOCATION, location).replace(Const.DAYSTART, start+"").replace(Const.DAYEND, end+"");
+		try {
+			String result = HttpUtil.get(url);
+			Const.requestAdd(Const.API.dayPredict);
+			Map<String, Object> resultMap = SystemConstant.jsonMapper.readValue(result, Map.class);
+			List<Map<String, Object>> resultArray = (List<Map<String, Object>>) resultMap.get("results");
+			Map<String, Object> dataItem = resultArray.get(0);
+			dailyArray = (List<Map<String, Object>>) dataItem.get("daily");
+			String last_update = (String) dataItem.get("last_update");
+			if (dailyArray != null) {
+				for (Map<String, Object> item : dailyArray) {
+					item.put("last_update", last_update);
+				}
+			}
+		}catch (Exception e) {
+			log.error("查询逐日天气预报和昨日天气数据失败!location="+location+",start="+start+",end"+end, e);
+		}
+		return dailyArray;
+	}
+	
+	/**
+	 * 查询逐日天气预报和昨日天气数据
+	 * @param location 城市标识
+	 * @param start >=-2, <15
+	 * @param end >-2, <=15
+	 * @return
+	 */
+	public static List<DayPredictDTO> getDayPredictObj(String location, int start, int end) {
+		List<DayPredictDTO> dataList = new ArrayList<>();
+		List<Map<String, Object>> dailyArray = getDayPredict(location, start, end);
+		if(!dailyArray.isEmpty()) {
+			try {
+				for(Map<String, Object> map : dailyArray) {
+					dataList.add(map2Obj(map, DayPredictDTO.class));
+				}
+			}catch (Exception e) {
+				dataList.clear();
+				log.error("map转对象失败!", e);
+			}
+		}
+		return dataList;
+	}
+	
+	/**
+	 * 获取24小时逐小时天气预报
+	 * @param location 城市标识
+	 * @return
+	 */
+	public static List<Map<String, Object>> getHour24Predict(String location) {
+		List<Map<String, Object>> hourDataArray = new ArrayList<Map<String, Object>>();
+		
+		Map<String, Object> dataMap = getHour24PredictWithLocation(location);
+		if(!dataMap.containsKey("hourly")) {
+			hourDataArray = (List<Map<String, Object>>) dataMap.get("hourly");
+		}
+		
+		return hourDataArray;
+	}
+	
+	/**
+	 * 获取24小时逐小时天气预报
+	 * @param location
+	 * @return {"location":{}, "hourly":[]}
+	 */
+	public static Map<String, Object> getHour24PredictWithLocation(String location) {
+		Map<String, Object> dataItem = new HashMap<>();
+		
+		String url = Const.ServiceURL.hour24Predict;
+		url = url.replace(Const.LOCATION, location);
+		try {
+			String result = HttpUtil.get(url);
+			Const.requestAdd(Const.API.hour24Predict);
+			Map<String, Object> resultMap = SystemConstant.jsonMapper.readValue(result, Map.class);
+			List<Map<String, Object>> resultArray = (List<Map<String, Object>>) resultMap.get("results");
+			dataItem = resultArray.get(0);
+		}catch (Exception e) {
+			log.error("查询逐日天气预报和昨日天气数据失败!location="+location, e);
+		}
+		
+		return dataItem;
+	}
+	
+	/**
+	 * 获取24小时逐小时天气预报
+	 * @param location 城市标识
+	 * @return
+	 */
+	public static List<Hour24PredictDTO> getHour24PredictObj(String location) {
+		List<Hour24PredictDTO> hourDataList = new ArrayList<>();
+		
+		List<Map<String, Object>> hourDataMapList = getHour24Predict(location);
+		if(!hourDataMapList.isEmpty()) {
+			try {
+				for(Map<String, Object> map : hourDataMapList) {
+					hourDataList.add(map2Obj(map, Hour24PredictDTO.class));
+				}
+			}catch (Exception e) {
+				hourDataList.clear();
+				log.error("map转对象失败!", e);
+			}
+		}
+		
+		return hourDataList;
+	}
+	
+	/**
+	 * 获取过去24小时历史天气
+	 * @param location
+	 * @return
+	 */
+	public static List<Map<String, Object>> getHour24History(String location) {
+		List<Map<String, Object>> hourDataArray = new ArrayList<Map<String, Object>>();
+		
+		String url = Const.ServiceURL.hour24History;
+		url = url.replace(Const.LOCATION, location);
+		try {
+			String result = HttpUtil.get(url);
+			Const.requestAdd(Const.API.hour24History);
+			Map<String, Object> resultMap = SystemConstant.jsonMapper.readValue(result, Map.class);
+			List<Map<String, Object>> resultArray = (List<Map<String, Object>>) resultMap.get("results");
+			Map<String, Object> dataItem = resultArray.get(0);
+			hourDataArray = (List<Map<String, Object>>) dataItem.get("hourly_history");
+		}catch (Exception e) {
+			log.error("获取过去24小时历史天气数据失败!location="+location, e);
+		}
+		
+		return hourDataArray;
+	}
+	
+	/**
+	 * 获取过去24小时历史天气
+	 * @param location
+	 * @return
+	 */
+	public static List<NowWeatherDTO> getHour24HistoryObj(String location) {
+		List<NowWeatherDTO> dataList = new ArrayList<>();
+		
+		List<Map<String, Object>> dataMapList = getHour24History(location);
+		if(!dataMapList.isEmpty()) {
+			try {
+				for(Map<String, Object> map : dataMapList) {
+					dataList.add(map2Obj(map, NowWeatherDTO.class));
+				}
+			}catch (Exception e) {
+				dataList.clear();
+				log.error("map转对象失败!", e);
+			}
+		}
+		
+		return dataList;
+	}
+	
+	/**
+	 * 获取气象灾害预警信息
+	 * @return
+	 */
+	public static List<Map<String, Object>> getAlarms() {
+		List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
+		try {
+			String result = HttpUtil.get(Const.ServiceURL.alarm);
+			Const.requestAdd(Const.API.alarm);
+			Map<String, Object> resultMap = SystemConstant.jsonMapper.readValue(result, Map.class);
+			List<Map<String, Object>> resultArray = (List<Map<String, Object>>) resultMap.get("results");
+			for(Map<String, Object> dataItem : resultArray) {
+				Map<String, Object> location = (Map<String, Object>) dataItem.get("location");
+				List<Map<String, Object>> alarmArray = (List<Map<String, Object>>) dataItem.get("alarms");
+				for(Map<String, Object> alarmItem : alarmArray) {
+					alarmItem.putAll(location);
+					dataList.add(alarmItem);
+				}
+			}
+			
+		}catch (Exception e) {
+			log.error("获取气象灾害预警数据失败!", e);
+		}
+		
+		return dataList;
+	}
+	
+	/**
+	 * 获取气象灾害预警信息
+	 * @return [预警信息对象] 或 空集合
+	 */
+	public static List<AlarmDTO> getAlarmObjs() {
+		List<AlarmDTO> resultList = new ArrayList<>();
+		
+		List<Map<String, Object>> alarmListMap = getAlarms();
+		if(!alarmListMap.isEmpty()) {
+			try {
+				for(Map<String, Object> map : alarmListMap) {
+					resultList.add(map2Obj(map, AlarmDTO.class));
+				}
+			}catch (Exception e) {
+				resultList.clear();
+				log.error("map转对象失败!", e);
+			}
+		}
+		
+		return resultList;
+	}
+	
+	@SuppressWarnings("unused")
+	private static <T extends WeatherResponseDTO> T map2Obj(Map<String, Object> map, Class<T> clz) throws Exception {
+		T t = clz.newInstance();
+		
+		for(String key : map.keySet()) {
+			Method m = null;
+			try {
+				m = clz.getMethod("set"+key.substring(0,1).toUpperCase()+key.substring(1), String.class);
+			}catch (Exception e) {
+			}
+			if(m != null) {
+				m.invoke(t, map.get(key));
+			}
+		}
+		
+		return t;
+	}
+	
+	public static void main(String[] args) {
+		getHour24HistoryObj("WW8P3NH2TPDT");
+		System.out.println();
+	}
+}

+ 170 - 0
src/main/java/com/persagy/framework/web/controller/entrance/EntranceController.java

@@ -0,0 +1,170 @@
+package com.persagy.framework.web.controller.entrance;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URLDecoder;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.persagy.core.component.JsonObjectMapper;
+import com.persagy.core.constant.EMSConstant.Result;
+import com.persagy.core.dto.interpreter.InterfaceResult;
+import com.persagy.core.service.BusinessService;
+import com.persagy.core.utils.CommonUtils;
+import com.persagy.framework.util.CommonToolUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.constant.ConstBusinessStatic;
+import com.persagy.functions.weather.constant.WeatherConstant;
+import com.persagy.functions.weather.thread.RequestIpStatisticThread;
+
+@Scope("prototype")
+@Controller("entranceController")
+@RequestMapping("/entrance")
+public class EntranceController {
+	@Resource(name = "objectMapper")
+	protected JsonObjectMapper objectMapper;
+
+	private static final Logger log = Logger.getLogger(EntranceController.class);
+
+	public static final String HANDLE_TYPE = "handleType";
+	public static final String JSON_STRING = "jsonString";
+
+	@Resource
+	protected ApplicationContext context;
+
+	@RequestMapping(value = "/unifier/{" + HANDLE_TYPE + "}")
+	@ResponseBody
+	public InterfaceResult unifier(@PathVariable(HANDLE_TYPE) String handleType,
+			@RequestParam(value = JSON_STRING) String jsonString, HttpServletRequest request) throws Exception {
+
+		String ip = CommonToolUtils.getIpAddr(request);
+		ConstBusinessStatic.add(ip, handleType);
+		RequestIpStatisticThread.addupdateIpApiEndDateMap(ip, handleType);
+		
+		Long start = System.currentTimeMillis();
+
+		BusinessService businessService = (BusinessService) context.getBean(handleType);
+		InterfaceResult interfaceResult = CommonUtils.createInterfaceResult();
+		try {
+			jsonString = URLDecoder.decode(jsonString, "UTF-8");
+			businessService.handle(jsonString, interfaceResult.getContent());
+			interfaceResult.setResult(Result.SUCCESS);
+		} catch (Exception e) {
+			interfaceResult.setResult(Result.FAILURE);
+			interfaceResult.setReason(e.getMessage());
+		    interfaceResult.getContent().clear();
+		    log.error("Request Error! requesterIp="+ip+" API=" + handleType + ", Param=" + jsonString + ", Msg=" + e.getMessage(), e);
+		}
+
+		long end = System.currentTimeMillis();
+	    long timeInterval = (end - start.longValue()) / 1000L;
+	    if (timeInterval > 3L) {
+	    	log.warn("TimeCost Warning! requesterIp=" +ip+ timeInterval + "s, API=" + handleType + ", Param=" + jsonString);
+	    }
+	    return interfaceResult;
+	}
+	
+	@RequestMapping(value = "/unifierJson/{" + HANDLE_TYPE + "}")
+	@ResponseBody
+	public InterfaceResult unifierJson(@PathVariable(HANDLE_TYPE) String handleType,
+			@RequestBody Map<String, Object> param, HttpServletRequest request) throws Exception {
+		String ip = CommonToolUtils.getIpAddr(request);
+		ConstBusinessStatic.add(ip, handleType);
+		RequestIpStatisticThread.addupdateIpApiEndDateMap(ip, handleType);
+		
+		Long start = System.currentTimeMillis();
+
+		BusinessService businessService = (BusinessService) context.getBean(handleType);
+		InterfaceResult interfaceResult = CommonUtils.createInterfaceResult();
+		
+		String jsonString = objectMapper.writeValueAsString(param);
+		try {
+			jsonString = URLDecoder.decode(jsonString, "UTF-8");
+			businessService.handle(jsonString, interfaceResult.getContent());
+			interfaceResult.setResult(Result.SUCCESS);
+		} catch (Exception e) {
+			interfaceResult.setResult(Result.FAILURE);
+			interfaceResult.setReason(e.getMessage());
+		    interfaceResult.getContent().clear();
+		    log.error("Request Error! requesterIp="+ip+" API=" + handleType + ", Param=" + jsonString + ", Msg=" + e.getMessage(), e);
+		}
+
+		long end = System.currentTimeMillis();
+	    long timeInterval = (end - start.longValue()) / 1000L;
+	    if (timeInterval > 3L) {
+	    	log.warn("TimeCost Warning! requesterIp=" +ip+ timeInterval + "s, API=" + handleType + ", Param=" + jsonString);
+	    }
+	    return interfaceResult;
+	}
+	
+	@RequestMapping(value = "/download/icon/{param}")
+	public void iconDownload(@PathVariable("param") String param, HttpServletRequest request, HttpServletResponse response) throws Exception {
+		String ip = CommonToolUtils.getIpAddr(request);
+		ConstBusinessStatic.add(ip, "download-icon");
+		RequestIpStatisticThread.addupdateIpApiEndDateMap(ip, "download-icon");
+		
+		String weatherCode = "", theme = "", size = "";
+		if(param != null) {
+			if(param.contains("-")) {
+				String[] paramArray = param.split("-");
+				weatherCode = paramArray[0];
+				if(paramArray.length>1) {
+					theme = paramArray[1];
+				}
+				if(paramArray.length>2) {
+					size = paramArray[2];
+				}
+			}else {
+				weatherCode = param;
+			}
+		}
+		
+		if(WeatherConstant.getStandCodeDesc().keySet().contains(weatherCode)) {
+			if(null == theme || !Const.iconTheme.contains(theme)) {
+				theme = Const.iconTheme.get(0);
+			}
+			size = size == null ? "" : size;
+			if(!Const.iconSize.keySet().contains(size)) {
+				size = Const.iconSize.lastEntry().getValue();
+			}else {
+				size = Const.iconSize.get(size);
+			}
+			
+			String fileName = weatherCode + "@" + size + "x.png";
+			String filePath = "/static/icon/" + theme + "/" + fileName;
+			
+			InputStream in = this.getClass().getResourceAsStream(filePath);
+			
+			byte[] body = null;
+			ByteArrayOutputStream output = new ByteArrayOutputStream();
+			if(null != in) {
+			    byte[] buffer = new byte[4096];
+			    int n = 0;
+			    while (-1 != (n = in.read(buffer))) {
+			        output.write(buffer, 0, n);
+			    }
+			    body = output.toByteArray();
+			    in.close();
+			    output.close();
+			}
+
+			response.setContentType("image/png");
+			response.getOutputStream().write(body);
+			// 设置浏览器访问下载
+//			response.addHeader("Content-Disposition", "attachment;filename="+fileName);
+		}
+	}
+}

+ 501 - 0
src/main/java/com/persagy/framework/web/controller/entrance/UnifierController.java

@@ -0,0 +1,501 @@
+package com.persagy.framework.web.controller.entrance;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Scope;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.persagy.core.component.JsonObjectMapper;
+import com.persagy.core.constant.EMSConstant.Result;
+import com.persagy.core.constant.SystemConstant;
+import com.persagy.core.dto.interpreter.InterfaceResult;
+import com.persagy.core.mvc.service.CoreService;
+import com.persagy.core.utils.CommonUtils;
+import com.persagy.core.utils.HttpUtils;
+import com.persagy.ems.pojo.system.FileResource;
+import com.persagy.framework.construct.RequestProcessor;
+import com.persagy.framework.dto.ApiResult;
+import com.persagy.framework.dto.FileConfigDTO;
+import com.persagy.framework.dto.FileResourceExtension;
+import com.persagy.framework.util.CommonToolUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.constant.ConstBusinessStatic;
+import com.persagy.functions.weather.constant.WeatherConstant;
+import com.persagy.functions.weather.thread.RequestIpStatisticThread;
+
+/**
+ * 统一对外接口
+ */
+@CrossOrigin
+@Scope("prototype")
+@Controller("unifierController")
+@RequestMapping("/unifier")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class UnifierController {
+
+	private static final Logger log = Logger.getLogger(UnifierController.class);
+
+	public static final String HANDLE_TYPE = "handleType";
+	public static final String JSON_STRING = "jsonString";
+
+	@Resource(name="coreService")
+	private CoreService coreService;
+	
+	@Resource(name = "objectMapper")
+	protected JsonObjectMapper objectMapper;
+	
+	@Resource
+	protected ApplicationContext context;
+	
+	@RequestMapping(value = "/common/{" + HANDLE_TYPE + "}")
+	@ResponseBody
+	public ApiResult businessHandle(@PathVariable(HANDLE_TYPE) String handleType, 
+			@RequestBody Map<String, Object> param, HttpServletRequest request) throws Exception {
+		String ip = CommonToolUtils.getIpAddr(request);
+		ConstBusinessStatic.add(ip, handleType);
+		RequestIpStatisticThread.addupdateIpApiEndDateMap(ip, handleType);
+		
+		Long start = System.currentTimeMillis();
+		
+		Object serviceBean = null;
+		try {
+			serviceBean = context.getBean(handleType);
+		}catch (Exception e) {
+			// TODO: handle exception
+		}
+		
+		ApiResult apiResult = ApiResult.instanceError(null);
+		RequestProcessor businessService = null;
+		
+		if(null == serviceBean || !(serviceBean instanceof RequestProcessor)) {
+			// 请求统计接口具体服务应1存在于spring容器;2实现了RequestProcessor接口
+			apiResult.setMessage("request service unsupport!");
+			return apiResult;
+		}else {
+			businessService = (RequestProcessor) serviceBean;
+		}
+		
+		String jsonString = param.toString();
+		try {
+			jsonString = objectMapper.writeValueAsString(param);
+			jsonString = URLDecoder.decode(jsonString, "UTF-8");
+			
+			apiResult.setData(businessService.handle(jsonString));
+			
+			apiResult.setResult(ApiResult.result_success);
+		} catch (Exception e) {
+			apiResult.setResult(ApiResult.result_fail);
+			apiResult.setMessage(e.getMessage());
+		    log.error("Request Error! requesterIp="+ip+" API=" + handleType + ", Param=" + jsonString + ", Msg=" + e.getMessage(), e);
+		}
+
+		long end = System.currentTimeMillis();
+	    long timeInterval = (end - start.longValue()) / 1000;
+	    if (timeInterval > 5) {
+	    	log.warn("TimeCost Warning! requesterIp=" +ip+ "timeCost=" +timeInterval + "s, API=" + handleType + ", Param=" + jsonString);
+	    }
+	    
+	    return apiResult;
+	}
+	
+	@RequestMapping(value = "/download/icon/{param}")
+	public void iconDownload(@PathVariable("param") String param, HttpServletRequest request, HttpServletResponse response) throws Exception {
+		String ip = CommonToolUtils.getIpAddr(request);
+		ConstBusinessStatic.add(ip, "download-icon");
+		RequestIpStatisticThread.addupdateIpApiEndDateMap(ip, "download-icon");
+		
+		String weatherCode = "", theme = "", size = "";
+		if(param != null) {
+			if(param.contains("-")) {
+				String[] paramArray = param.split("-");
+				weatherCode = paramArray[0];
+				if(paramArray.length>1) {
+					theme = paramArray[1];
+				}
+				if(paramArray.length>2) {
+					size = paramArray[2];
+				}
+			}else {
+				weatherCode = param;
+			}
+		}
+		
+		if(WeatherConstant.getStandCodeDesc().keySet().contains(weatherCode)) {
+			if(null == theme || !Const.iconTheme.contains(theme)) {
+				theme = Const.iconTheme.get(0);
+			}
+			size = size == null ? "" : size;
+			if(!Const.iconSize.keySet().contains(size)) {
+				size = Const.iconSize.lastEntry().getValue();
+			}else {
+				size = Const.iconSize.get(size);
+			}
+			
+			String fileName = weatherCode + "@" + size + "x.png";
+			String filePath = "/static/icon/" + theme + "/" + fileName;
+			
+			InputStream in = this.getClass().getResourceAsStream(filePath);
+			
+			byte[] body = null;
+			ByteArrayOutputStream output = new ByteArrayOutputStream();
+			if(null != in) {
+			    byte[] buffer = new byte[4096];
+			    int n = 0;
+			    while (-1 != (n = in.read(buffer))) {
+			        output.write(buffer, 0, n);
+			    }
+			    body = output.toByteArray();
+			    in.close();
+			    output.close();
+			}
+
+			response.setContentType("image/png");
+			response.getOutputStream().write(body);
+			// 设置浏览器访问下载
+//			response.addHeader("Content-Disposition", "attachment;filename="+fileName);
+		}
+	}
+	
+	
+	@RequestMapping(value = "/download/common")
+	public ResponseEntity<byte[]> unifierDownload(@RequestParam(value = "resource") String resource) throws Exception {
+		if (StringUtils.isBlank(resource)) {
+			throw new Exception("resource 不能为空!");
+		}
+
+		Properties properties = new Properties();
+		properties.load(UnifierController.class.getResourceAsStream("/config/system.properties"));
+		String fileStorageDirectory = properties.getProperty("file.storage.directory");
+
+		FileResource fileResource = new FileResource();
+		fileResource.setId(resource);
+		List<FileResource> list = coreService.query(fileResource);
+		if (list.size() == 0) {
+			throw new Exception("未找到resource对应的配置!");
+		}
+
+		fileResource = list.get(0);
+
+		String filePath = fileStorageDirectory + fileResource.getSubdirectory() + "/" + resource;
+		File f = new File(filePath);
+
+		// 避免中文及URL特殊字符无法正常显示
+		String fileName = fileResource.getName() + "." + fileResource.getSuffix();
+		fileName = URLEncoder.encode(fileName, "UTF-8");
+		// fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
+
+		HttpHeaders headers = new HttpHeaders();
+		headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
+		headers.setContentDispositionFormData("attachment", fileName);
+
+		byte[] body = FileUtils.readFileToByteArray(f);
+
+		ResponseEntity<byte[]> responseEntity = new ResponseEntity<byte[]>(body, headers, HttpStatus.CREATED);
+
+		return responseEntity;
+	}
+
+	@RequestMapping(value = "/upload/common")
+	@ResponseBody
+	public InterfaceResult unifierUpload(@RequestParam(value = JSON_STRING, required = true) String jsonString,
+			@RequestParam(value = "file", required = true) MultipartFile[] files) throws Exception {
+		InterfaceResult interfaceResult = CommonUtils.createInterfaceResult();
+		try {
+			jsonString = URLDecoder.decode(jsonString, "UTF-8");
+			System.out.println(jsonString);
+			List<FileConfigDTO> configList = SystemConstant.jsonMapper.readValue(jsonString,
+					new TypeReference<List<FileConfigDTO>>() {
+					});
+			if (files.length != configList.size()) {
+				throw new Exception("配置文件数:" + configList.size() + ",接收文件数:" + files.length + " 不一致!");
+			}
+			List<FileResourceExtension> resourceList = new ArrayList<FileResourceExtension>();
+			List<FileResource> resourceList1 = new ArrayList<FileResource>();
+			for (int i = 0; i < files.length; i++) {
+				MultipartFile file = files[i];
+				String originalFilename = file.getOriginalFilename();
+
+				FileConfigDTO fileConfig = configList.get(i);
+				String suffix = fileConfig.getFileSuffix();
+				String name = fileConfig.getFileName();
+				String subdirectory = fileConfig.getSubdirectory();
+
+				if ((suffix == null || "".equals(suffix)) && originalFilename.indexOf(".") != -1) {
+					int index = originalFilename.lastIndexOf(".");
+					suffix = originalFilename.substring(index + 1);
+				}
+				if ((name == null || "".equals(name)) && originalFilename.indexOf(".") != -1) {
+					int index = originalFilename.lastIndexOf(".");
+					name = originalFilename.substring(0, index);
+				} else if (name != null && !"".equals(name) && name.indexOf(".") != -1) {
+					int index = name.lastIndexOf(".");
+					suffix = name.substring(index + 1);
+					name = name.substring(0, index);
+				}
+
+				if (subdirectory == null || "".equals(subdirectory)) {
+					throw new Exception("subdirectory 不能为空!");
+				}
+				if (!subdirectory.startsWith("/")) {
+					throw new Exception("subdirectory 必须以/开头!");
+				}
+
+				FileResource resource = new FileResource();
+				resource.setId(UUID.randomUUID().toString());
+				resource.setName(name);
+				resource.setSuffix(suffix);
+				resource.setSubdirectory(subdirectory);
+				resourceList1.add(resource);
+
+				Properties properties = new Properties();
+				properties.load(UnifierController.class.getResourceAsStream("/config/system.properties"));
+				String fileStorageDirectory = properties.getProperty("file.storage.directory");
+
+				FileResourceExtension fileResourceExtension = new FileResourceExtension();
+				fileResourceExtension.setBaseDictionary(fileStorageDirectory);
+				BeanUtils.copyProperties(resource, fileResourceExtension);
+				resourceList.add(fileResourceExtension);
+
+				String directory = fileStorageDirectory + subdirectory;
+				String filePath = directory + "/" + resource.getId();
+				File f = new File(filePath);
+				FileUtils.writeByteArrayToFile(f, file.getBytes());
+			}
+
+			for (FileResource item : resourceList1) {
+				coreService.save(item);
+			}
+			interfaceResult.getContent().addAll(resourceList);
+			interfaceResult.setResult(Result.SUCCESS);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			interfaceResult.setResult(Result.FAILURE);
+			interfaceResult.setReason(CommonUtils.getExceptionStackTrace(e));
+			interfaceResult.getContent().clear();
+			e.printStackTrace();
+		}
+
+		return interfaceResult;
+	}
+
+	@RequestMapping(value = "/upload")
+	@ResponseBody
+	public InterfaceResult upload(@RequestParam(value = JSON_STRING, required = true) String jsonString,
+			@RequestParam(value = "file", required = true) MultipartFile[] files) throws Exception {
+		InterfaceResult interfaceResult = CommonUtils.createInterfaceResult();
+		try {
+			jsonString = URLDecoder.decode(jsonString, "UTF-8");
+			
+			List<FileConfigDTO> configList = SystemConstant.jsonMapper.readValue(jsonString,
+					new TypeReference<List<FileConfigDTO>>() {
+					});
+			if (files.length != configList.size()) {
+				throw new Exception("配置文件数:" + configList.size() + ",接收文件数:" + files.length + " 不一致!");
+			}
+			List<FileResourceExtension> resourceList = new ArrayList<FileResourceExtension>();
+			List<FileResource> resourceList1 = new ArrayList<FileResource>();
+			for (int i = 0; i < files.length; i++) {
+				MultipartFile file = files[i];
+				String originalFilename = file.getOriginalFilename();
+
+				FileConfigDTO fileConfig = configList.get(i);
+				String suffix = fileConfig.getFileSuffix();
+				String name = fileConfig.getFileName();
+				String subdirectory = fileConfig.getSubdirectory();
+
+				if ((suffix == null || "".equals(suffix)) && originalFilename.indexOf(".") != -1) {
+					int index = originalFilename.lastIndexOf(".");
+					suffix = originalFilename.substring(index + 1);
+				}
+				if ((name == null || "".equals(name)) && originalFilename.indexOf(".") != -1) {
+					int index = originalFilename.lastIndexOf(".");
+					name = originalFilename.substring(0, index);
+				} else if (name != null && !"".equals(name) && name.indexOf(".") != -1) {
+					int index = name.lastIndexOf(".");
+					suffix = name.substring(index + 1);
+					name = name.substring(0, index);
+				}
+
+				if (subdirectory == null || "".equals(subdirectory)) {
+					throw new Exception("subdirectory 不能为空!");
+				}
+				if (!subdirectory.startsWith("/")) {
+					throw new Exception("subdirectory 必须以/开头!");
+				}
+
+				FileResource resource = new FileResource();
+				resource.setId(UUID.randomUUID().toString());
+				resource.setName(name);
+				resource.setSuffix(suffix);
+				resource.setSubdirectory(subdirectory);
+				resourceList1.add(resource);
+
+				Properties properties = new Properties();
+				properties.load(UnifierController.class.getResourceAsStream("/config/system.properties"));
+				String fileStorageDirectory = properties.getProperty("file.storage.directory");
+
+				FileResourceExtension fileResourceExtension = new FileResourceExtension();
+				fileResourceExtension.setBaseDictionary(fileStorageDirectory);
+				BeanUtils.copyProperties(resource, fileResourceExtension);
+				resourceList.add(fileResourceExtension);
+
+				String directory = fileStorageDirectory + subdirectory;
+				String filePath = directory + "/" + resource.getId();
+				File f = new File(filePath);
+				FileUtils.writeByteArrayToFile(f, file.getBytes());
+			}
+
+			coreService.save(resourceList1);
+			interfaceResult.getContent().addAll(resourceList);
+			interfaceResult.setResult(Result.SUCCESS);
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			interfaceResult.setResult(Result.FAILURE);
+			interfaceResult.setReason(CommonUtils.getExceptionStackTrace(e));
+			interfaceResult.getContent().clear();
+			e.printStackTrace();
+		}
+
+		return interfaceResult;
+	}
+
+	@RequestMapping(value = "/download")
+	public ResponseEntity<byte[]> download(@RequestParam(value = "resource", required = true) String resource)
+			throws Exception {
+
+		if (resource == null || "".equals(resource)) {
+			throw new Exception("resource 不能为空!");
+		}
+
+		Properties properties = new Properties();
+		properties.load(UnifierController.class.getResourceAsStream("/config/system.properties"));
+		String fileStorageDirectory = properties.getProperty("file.storage.directory");
+
+		FileResource fileResource = new FileResource();
+		fileResource.setId(resource);
+		List<FileResource> list = coreService.query(fileResource);
+		if (list.size() == 0) {
+
+			Map params = new LinkedHashMap<>();
+			params.put("resource", resource);
+			List<Map> remoteList = new ArrayList<>();
+			if (remoteList == null || remoteList.size() == 0) {
+				throw new Exception("未找到resource对应的配置!");
+			} else {
+				String realDomain = "";
+				String context = "";
+
+				if ((realDomain == null) || ("".equals(realDomain))) {
+					throw new Exception("根据域名未找到真实地址和端口!");
+				}
+
+				String name = (String) remoteList.get(0).get("name");
+				String suffix = (String) remoteList.get(0).get("suffix");
+				String subdirectory = (String) remoteList.get(0).get("subdirectory");
+				fileResource.setName(name);
+				fileResource.setSuffix(suffix);
+				fileResource.setSubdirectory(subdirectory);
+				coreService.save(fileResource);
+
+				String filePath = fileStorageDirectory + fileResource.getSubdirectory() + "/" + resource;
+				String url = "http://" + realDomain + "/" + context + "/Spring/MVC/entrance/download";
+				HttpUtils.postFile(url, params, filePath);
+			}
+		} else {
+			fileResource = list.get(0);
+		}
+
+		String filePath = fileStorageDirectory + fileResource.getSubdirectory() + "/" + resource;
+		File f = new File(filePath);
+
+		// 避免中文及URL特殊字符无法正常显示
+		String fileName = fileResource.getName() + "." + fileResource.getSuffix();
+		// fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
+		fileName = URLEncoder.encode(fileName, "UTF-8");
+		fileName = fileName.replace("+", "%20");
+
+		HttpHeaders headers = new HttpHeaders();
+		headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
+		headers.setContentDispositionFormData("attachment", fileName);
+
+		byte[] body = FileUtils.readFileToByteArray(f);
+
+		ResponseEntity<byte[]> responseEntity = new ResponseEntity<byte[]>(body, headers, HttpStatus.CREATED);
+
+		return responseEntity;
+	}
+
+	@RequestMapping(value = "/fileSynchronization")
+	@ResponseBody
+	public InterfaceResult fileSynchronization(@RequestParam(value = JSON_STRING, required = true) String jsonString,
+			@RequestParam(value = "file", required = true) MultipartFile[] files) throws Exception {
+
+		InterfaceResult interfaceResult = CommonUtils.createInterfaceResult();
+
+		try {
+			jsonString = URLDecoder.decode(jsonString, "UTF-8");
+			List<FileResource> configList = SystemConstant.jsonMapper.readValue(jsonString,
+					new TypeReference<List<FileResource>>() {
+					});
+			if (files.length != configList.size()) {
+				throw new Exception("配置文件数:" + configList.size() + ",接收文件数:" + files.length + " 不一致!");
+			}
+
+			Properties properties = new Properties();
+			properties.load(UnifierController.class.getResourceAsStream("/config/system.properties"));
+			String fileStorageDirectory = properties.getProperty("file.storage.directory");
+
+			for (int i = 0; i < files.length; i++) {
+				MultipartFile file = files[i];
+				FileResource fileResource = configList.get(i);
+				coreService.save(fileResource);
+				String directory = fileStorageDirectory + fileResource.getSubdirectory();
+				String filePath = directory + "/" + fileResource.getId();
+				File f = new File(filePath);
+				FileUtils.writeByteArrayToFile(f, file.getBytes());
+			}
+
+			interfaceResult.setResult(Result.SUCCESS);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			interfaceResult.setResult(Result.FAILURE);
+			interfaceResult.setReason(CommonUtils.getExceptionStackTrace(e));
+			interfaceResult.getContent().clear();
+			e.printStackTrace();
+		}
+		return interfaceResult;
+	}
+
+}

+ 15 - 0
src/main/java/com/persagy/functions/common/business/HelloWorld.java

@@ -0,0 +1,15 @@
+package com.persagy.functions.common.business;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.framework.construct.RequestProcessor;
+
+@Service("helloworld")
+public class HelloWorld implements RequestProcessor {
+
+	@Override
+	public Object handle(String jsonString) throws Exception {
+		return "helloworld!";
+	}
+
+}

+ 21 - 0
src/main/java/com/persagy/functions/common/business/HelloWorld2.java

@@ -0,0 +1,21 @@
+package com.persagy.functions.common.business;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.framework.construct.RequestProcessor;
+
+@Service("helloworld2")
+public class HelloWorld2 implements RequestProcessor {
+
+	@Override
+	public Object handle(String jsonString) throws Exception {
+		Map<String, String> data = new HashMap<>();
+		data.put("hello", "world");
+		
+		return data;
+	}
+
+}

+ 26 - 0
src/main/java/com/persagy/functions/common/business/HelloWorld3.java

@@ -0,0 +1,26 @@
+package com.persagy.functions.common.business;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.framework.construct.RequestProcessor;
+
+@Service("helloworld3")
+public class HelloWorld3 implements RequestProcessor {
+
+	@Override
+	public Object handle(String jsonString) throws Exception {
+		List<Map<String, String>> list = new ArrayList<>();
+		for(int i=0; i<5; i++) {
+			Map<String, String> item = new HashMap<>();
+			item.put("key"+i, "value"+i);
+			list.add(item);
+		}
+		return list;
+	}
+
+}

+ 144 - 0
src/main/java/com/persagy/functions/weather/business/v2020/DayStaticData.java

@@ -0,0 +1,144 @@
+package com.persagy.functions.weather.business.v2020;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DayStaticMoreRecord;
+import com.persagy.ems.pojo.wz.DayStaticRecord;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.constant.ConstTime;
+import com.persagy.functions.weather.service.DayStaticService;
+
+@Service("DayStaticData")
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class DayStaticData extends BaseBusinessService<Map> implements BusinessService {
+	private static final Logger log = Logger.getLogger(DayStaticData.class);
+	@Resource
+	private DayStaticService dayStaticService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String cityName = (String) dto.get("cityName");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+		String dataType = (String) dto.get("dataType");
+
+		if (StringUtils.isEmpty(projectId) && StringUtils.isEmpty(cityCode) && StringUtils.isEmpty(cityName)) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		ConstStaticType dtype = null;
+		if(null == dataType) {
+			dtype = ConstStaticType.Max;
+		}else {
+			dtype = ConstStaticType.getItem(dataType);
+		}
+		if(null == dtype) {
+			throw new Exception(Const.ErrorTag.paramUnrecognized);
+		}
+		
+		String startTime = (String) dto.get("startTime");
+		String endTime = (String) dto.get("endTime");
+		Date timeFrom = null, timeTo = null;
+		try {
+			timeFrom = DateUtils.str2Date(startTime, DateUtils.SDF_SECOND);
+			timeTo = DateUtils.str2Date(endTime, DateUtils.SDF_SECOND);
+		}catch (Exception e) {
+		}
+		
+		long tspan = timeTo.getTime() - timeFrom.getTime();
+		if(null == timeFrom || null == timeTo) {
+			throw new Exception(Const.ErrorTag.paramFormat);
+		}else if(tspan > (5 * ConstTime.ms_year)) {
+			throw new Exception(Const.ErrorTag.timeToLong);
+		}
+		
+		String location = ConfigUtil.getHourCity(cityName, cityCode, projectId);
+		if(null == location) {
+			throw new Exception(Const.ErrorTag.cityUnsupport);
+		}
+		
+		Long t1 = System.currentTimeMillis();
+		
+		Map<Date, DayStaticRecord> maxMap = new HashMap<>();
+		if(dtype == ConstStaticType.Max || dtype == ConstStaticType.All) {
+			List<DayStaticRecord> listMax = dayStaticService.query(location, timeFrom, timeTo);
+			if(null != listMax) {
+				for(DayStaticRecord obj : listMax) {
+					maxMap.put(obj.getDayTime(), obj);
+				}
+			}
+		}
+		
+		Long t2 = System.currentTimeMillis();
+		
+		Map<Date, DayStaticMoreRecord> avgMap = new HashMap<>();
+		if(dtype == ConstStaticType.Avg || dtype == ConstStaticType.All) {
+			List<DayStaticMoreRecord> listAvg = dayStaticService.queryMore(location, timeFrom, timeTo);
+			if(null != listAvg) {
+				for(DayStaticMoreRecord obj : listAvg) {
+					avgMap.put(obj.getDayTime(), obj);
+				}
+			}
+		}
+		
+		Long t3 = System.currentTimeMillis();
+		
+		Date timeKey = timeFrom;
+		while(timeKey.before(timeTo)) {
+			DayStaticRecord maxObj = maxMap.get(timeKey);
+			DayStaticMoreRecord avgObj = avgMap.get(timeKey);
+			
+			if(null == maxObj && avgObj == null) {
+			}else {
+				Map<String, Object> item = new HashMap<>();
+				content.add(item);
+				item.put("dayTime", timeKey);
+				if(null != maxObj) {
+					item.put("maxHumidity", maxObj.getMaxHumidity());
+					item.put("maxPressure", maxObj.getMaxPressure());
+					item.put("maxTemp", maxObj.getMaxTemp());
+					item.put("maxVisibility", maxObj.getMaxVisibility());
+					item.put("maxWindSpeed", maxObj.getMaxWindSpeed());
+					item.put("minHumidity", maxObj.getMinHumidity());
+					item.put("minPressure", maxObj.getMinPressure());
+					item.put("minTemp", maxObj.getMinTemp());
+					item.put("minVisibility", maxObj.getMinVisibility());
+					item.put("minWindSpeed", maxObj.getMinWindSpeed());
+				}
+				if(avgObj != null) {
+					item.put("avgHumidity", avgObj.getAvgHumidity());
+					item.put("avgPressure", avgObj.getAvgPressure());
+					item.put("avgTemp", avgObj.getAvgTemp());
+					item.put("avgVisibility", avgObj.getAvgVisibility());
+					item.put("avgWindSpeed", avgObj.getAvgWindSpeed());
+				}
+			}
+			
+			timeKey = DateUtils.getDayOff(timeKey, 1);
+		}
+		
+		Long t4 = System.currentTimeMillis();
+		if((t4-t1)/1000.0 > 5.0) {
+			JSONObject jobj = new JSONObject();
+			jobj.put("queryMax", (t2-t1)/1000.0);
+			jobj.put("queryAvg", (t3-t2)/1000.0);
+			jobj.put("buildResult", (t4-t3)/1000.0);
+			log.info("DayStaticData TimeCost=" + jobj.toString());
+		}
+	}
+}

+ 79 - 0
src/main/java/com/persagy/functions/weather/business/v2020/DisasterWarningQuery.java

@@ -0,0 +1,79 @@
+package com.persagy.functions.weather.business.v2020;
+
+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 org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DisasterWarning;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.DisasterWarningService;
+
+@Service("DisasterWarningQuery")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class DisasterWarningQuery extends BaseBusinessService<Map> implements BusinessService {
+
+	@Resource
+	private DisasterWarningService service;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+
+		String cityName = (String) dto.get("cityName");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+		if ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode)) && (StringUtils.isEmpty(cityName))) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+
+		String startTime = (String) dto.get("startTime");
+		String endTime = (String) dto.get("endTime");
+		String type = (String) dto.get("type");
+		String level = (String) dto.get("level");
+
+		String cityId = ConfigUtil.getLocationStrict(cityName, cityCode, projectId);
+		if (StringUtils.isEmpty(cityName)) {
+			throw new Exception(Const.ErrorTag.cityNotFound);
+		}
+		Date dateStart = startTime == null ? DateUtils.getHourOff(new Date(), -24)
+				: DateUtils.str2Date(startTime, "yyyy-MM-dd HH:mm:ss");
+		Date dateEnd = endTime == null ? new Date() : DateUtils.str2Date(endTime, "yyyy-MM-dd HH:mm:ss");
+		if (DateUtils.getYear(dateStart) != DateUtils.getYear(dateEnd)) {
+			throw new Exception(Const.ErrorTag.timeToLong);
+		}
+		DisasterWarning disasterQuery = new DisasterWarning();
+		disasterQuery.setCityId(cityId);
+		if (type != null) {
+			disasterQuery.setType(type);
+		}
+		if (level != null) {
+			disasterQuery.setLevel(level);
+		}
+		List<DisasterWarning> disasterList = this.service.query(cityId, type, level, dateStart, dateEnd);
+		if (!CollectionUtils.isEmpty(disasterList)) {
+			for (DisasterWarning obj : disasterList) {
+				Map<String, String> item = new HashMap<>();
+				item.put("cityId", obj.getCityId());
+				item.put("name", obj.getName());
+				item.put("path", obj.getPath());
+				item.put("title", obj.getTitle());
+				item.put("type", obj.getType());
+				item.put("level", obj.getLevel());
+				item.put("description", obj.getDescription());
+				item.put("pubTime", DateUtils.date2Str(obj.getPubTime(), "yyyy-MM-dd HH:mm:ss"));
+				item.put("insertTime", DateUtils.date2Str(obj.getInsertTime(), "yyyy-MM-dd HH:mm:ss"));
+				content.add(item);
+			}
+		}
+	}
+}

+ 18 - 0
src/main/java/com/persagy/functions/weather/business/v2020/HelloWorld.java

@@ -0,0 +1,18 @@
+package com.persagy.functions.weather.business.v2020;
+
+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;
+
+@Service("HelloWorld2020")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class HelloWorld extends BaseBusinessService<Map> implements BusinessService {
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		content.add("helloworld");
+	}
+}

+ 114 - 0
src/main/java/com/persagy/functions/weather/business/v2020/NowWeatherQuery.java

@@ -0,0 +1,114 @@
+package com.persagy.functions.weather.business.v2020;
+
+import java.util.Arrays;
+import java.util.HashMap;
+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 org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.HourRecordData;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.WServiceUtil;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.HourRecordService;
+
+@Service("NowWeatherQuery")
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class NowWeatherQuery extends BaseBusinessService<Map> implements BusinessService {
+	private static Set<String> typeSet = new HashSet<>(Arrays.asList("all", "weather", "air"));
+	@Resource
+	private HourRecordService hourDataService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+
+		String cityName = (String) dto.get("cityName");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+		String dataType = (String) dto.get("dataType");
+
+		if (StringUtils.isEmpty(projectId) && StringUtils.isEmpty(cityCode) && StringUtils.isEmpty(cityName)) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		if(StringUtils.isEmpty(dataType)) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		if(!typeSet.contains(dataType)) {
+			throw new Exception(Const.ErrorTag.paramUnrecognized + ":dataType=" + dataType);
+		}
+
+		Map<String, Object> resultMap = new HashMap<>();
+		String location = ConfigUtil.getHourCity(cityName, cityCode, projectId);
+		
+		if(null != location) {
+			HourRecordData obj = hourDataService.getPresent(location);
+			if(null != obj) {
+				if("all".equals(dataType) || "air".equals(dataType)) {
+					resultMap.put("no2", obj.getNo2());
+					resultMap.put("pm25", obj.getPm25());
+					resultMap.put("o3", obj.getO3());
+					resultMap.put("so2", obj.getSo2());
+					resultMap.put("last_update", obj.getLastUpdateAir());
+					resultMap.put("aqi", obj.getAqi());
+					resultMap.put("pm10", obj.getPm10());
+					resultMap.put("primary_pollutant", obj.getPrimary_pollutant());
+					resultMap.put("co", obj.getCo());
+					resultMap.put("quality", obj.getQuality());
+				}
+				
+				if("all".equals(dataType) || "weather".equals(dataType)) {
+					resultMap.put("code", obj.getCode());
+					resultMap.put("visibility", obj.getVisibility());
+					resultMap.put("wind_direction", obj.getWind_direction());
+					resultMap.put("pressure", obj.getPressure());
+					resultMap.put("clouds", obj.getClouds());
+					resultMap.put("feels_like", obj.getFeels_like());
+					resultMap.put("dew_point", obj.getDew_point());
+					resultMap.put("wind_scale", obj.getWind_scale());
+					resultMap.put("last_update", obj.getLastUpdateNow());
+					resultMap.put("temperature", obj.getTemperature());
+					resultMap.put("humidity", obj.getHumidity());
+					resultMap.put("wind_direction_degree", obj.getWind_direction_degree());
+					resultMap.put("wind_speed", obj.getWind_speed());
+					resultMap.put("text", obj.getText());
+				}
+			}
+		}
+		
+		if(resultMap.isEmpty()) {
+			location = ConfigUtil.getLocation(cityName, cityCode, projectId);
+			if("all".equals(dataType) || "air".equals(dataType)) {
+				try {
+					Map<String, Object> dataMap = WServiceUtil.getNowAir(location);
+					if (!dataMap.isEmpty()) {
+						resultMap.putAll(dataMap);
+					}
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+			}
+			if("all".equals(dataType) || "weather".equals(dataType)) {
+				try {
+					Map<String, Object> dataMap = WServiceUtil.getNowWeather(location);
+					if (!dataMap.isEmpty()) {
+						resultMap.putAll(dataMap);
+					}
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+			}
+		}
+		
+		content.add(resultMap);
+	}
+}

+ 120 - 0
src/main/java/com/persagy/functions/weather/business/v2020/SunRiseAndSet.java

@@ -0,0 +1,120 @@
+package com.persagy.functions.weather.business.v2020;
+
+import java.util.Date;
+import java.util.HashMap;
+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.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.framework.util.SunComputeUtil;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.constant.ConstTime;
+import com.persagy.functions.weather.dto.CityDTO;
+
+@Service("SunRiseAndSet")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class SunRiseAndSet extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		
+		Map<String, Object> paramMap = analysisParam(dto);
+		Date dayStart = (Date) paramMap.get("dayStart");
+		Date dayEnd = (Date) paramMap.get("dayEnd");
+		Double longitude = (Double) paramMap.get("longitude");
+		Double latitude = (Double) paramMap.get("latitude");
+		
+		Date dayIndex = dayStart;
+		do {
+			Map<String, Object> item = new HashMap<>();
+			item.put("sunRise", SunComputeUtil.getSunrise(longitude, latitude, dayIndex));
+			item.put("sunSet", SunComputeUtil.getSunset(longitude, latitude, dayIndex));
+			content.add(item);
+			dayIndex = DateUtils.getDayOff(dayIndex, 1);
+		}while(dayIndex.before(dayEnd));
+	}
+
+	private Map<String, Object> analysisParam(Map dto) throws Exception {
+		Map<String, Object> result = new HashMap<>();
+		
+		String cityName = (String) dto.get("cityName");
+		String cityCode = (String) dto.get("cityCode");
+		String projectId = (String) dto.get("projectId");
+		Double longitude = (Double) dto.get("longitude");
+		Double latitude = (Double) dto.get("latitude");
+		String startDay = (String) dto.get("startDay");
+		String endDay = (String) dto.get("endDay");
+		
+		if(null == cityName && cityCode == null && projectId == null && longitude == null && latitude == null) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		if(null != cityCode && cityCode.length() != 6) {
+			throw new Exception(Const.ErrorTag.paramUnrecognized + " : cityCode="+cityCode);
+		}
+		
+		if(null != projectId && projectId.length() != 12) {
+			throw new Exception(Const.ErrorTag.paramUnrecognized + " : projectId="+projectId);
+		}
+		
+		if((longitude != null) ^ (latitude != null)) {
+			throw new Exception(Const.ErrorTag.paramMis + " longitude or latitude");
+		}
+		
+		if(null == startDay || endDay == null || startDay.length() != 10 || endDay.length() != 10) {
+			throw new Exception(Const.ErrorTag.paramUnrecognized + " startDay or endDay");
+		}
+		
+		Date dayStart = DateUtils.str2Date(startDay, DateUtils.SDF_DAY);
+		Date dayEnd = DateUtils.str2Date(endDay, DateUtils.SDF_DAY);
+		
+		if(dayStart.after(dayEnd)) {
+			throw new Exception(Const.ErrorTag.paramValueError + " : startDay, endDay");
+		}
+		
+		long tspan = dayEnd.getTime() - dayStart.getTime();
+		if(tspan > ConstTime.ms_year) {
+			throw new Exception(Const.ErrorTag.timeToLong);
+		}
+		
+		result.put("dayStart", dayStart);
+		result.put("dayEnd", dayEnd);
+		
+		if(longitude != null) {
+			result.put("longitude", longitude);
+			result.put("latitude", latitude);
+		}else {
+			CityDTO cityInfo = ConfigUtil.dicCityObjMap().get(cityCode);
+			if(null == cityInfo && projectId != null) {
+				cityInfo = ConfigUtil.dicCityObjMap().get(projectId.substring(2, 8));
+			}
+			
+			if(null == cityInfo && cityName != null) {
+				cityInfo = ConfigUtil.dicCityObjMap().get(ConfigUtil.dicName2DicCodeMap().get(cityName));
+				
+				if(null == cityInfo) {
+					for(String name : ConfigUtil.dicName2DicCodeMap().keySet()) {
+						if(name.startsWith(cityName) || cityName.startsWith(name)) {
+							cityInfo = ConfigUtil.dicCityObjMap().get(ConfigUtil.dicName2DicCodeMap().get(name));
+							break;
+						}
+					}
+				}
+			}
+			
+			if(null == cityInfo || cityInfo.getLongitude() == null || cityInfo.getLatitude() == null) {
+				throw new Exception(Const.ErrorTag.cityUnsupport);
+			}
+			
+			result.put("longitude", Double.parseDouble(cityInfo.getLongitude()));
+			result.put("latitude", Double.parseDouble(cityInfo.getLatitude()));
+		}
+		
+		return result;
+	}
+}

+ 104 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/CommonTempratureDataService.java

@@ -0,0 +1,104 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.enumeration.EMSOrder;
+import com.persagy.core.enumeration.SpecialOperator;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.MinuteRecordData;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+
+/**
+ * 根据城市名称及开始时间,结束时间获取城市某时间段某种时间粒度下的温度信息
+ */
+@Service("CommonTempratureDataService")
+@Scope("prototype")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class CommonTempratureDataService extends BaseBusinessService<Map> implements BusinessService {
+	public static final String sdf_sec = "yyyy-MM-dd HH:mm:ss";
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		Integer type = (Integer) dto.get("type");
+		String startDate = (String) dto.get("startDate");
+		String endDate = (String) dto.get("endDate");
+		String cityName = (String) dto.get("cityName");
+		// 0-分钟;1-小时;2-天
+		Integer timeType = (Integer) dto.get("timeType");
+		if (type == null) {
+			type = 1;
+		}
+		if(timeType == null) {
+			timeType = 0;
+		}else if(timeType > 2) {
+			throw new Exception("无法识别timeType:"+timeType);
+		}
+		
+		String cityId = ConfigUtil.longHu5MinCitiesGet().get(cityName);
+		if(cityId == null) {
+			throw new Exception("无法识别cityName:"+cityName);
+		}
+		
+		Date dateStart = null, dateEnd = null;
+		try {
+			dateStart = DateUtils.str2Date(startDate, sdf_sec);
+			dateEnd = DateUtils.str2Date(endDate, sdf_sec);
+		}catch (Exception e) {
+		}
+		
+		if(null == dateStart || dateEnd == null) {
+			throw new Exception("时间参数有误!");
+		}
+		
+		MinuteRecordData queryObj = new MinuteRecordData();
+		queryObj.setBuildingForContainer(cityId);
+		queryObj.setType(type);
+		queryObj.setSort("minuteTime", EMSOrder.Asc);
+		queryObj.setSpecialOperation("minuteTime", SpecialOperator.$gte, dateStart);
+		queryObj.setSpecialOperation("minuteTime", SpecialOperator.$lt, dateEnd);
+		
+		int totalNum = coreService.count(queryObj);
+		if(totalNum > 12 * 24 * 365) {
+			throw new Exception("请求参数时间跨度太大!");
+		}
+		
+		if(totalNum == 0) {
+			return;
+		}
+		
+		List<MinuteRecordData> rList = coreService.query(queryObj);
+		TreeMap<String, Double> time_value = new TreeMap<String, Double>();
+		String timeStr = null;
+		if(timeType == 1) {
+			for(MinuteRecordData item : rList) {
+				timeStr = new SimpleDateFormat(sdf_sec).format(item.getMinuteTime());
+				if(timeStr.endsWith("00:00")) {
+					time_value.put(timeStr, item.getData());
+				}
+			}
+		}else if(timeType == 2) {
+			for(MinuteRecordData item : rList) {
+				timeStr = new SimpleDateFormat(sdf_sec).format(item.getMinuteTime());
+				if(timeStr.endsWith("00:00:00")) {
+					time_value.put(timeStr, item.getData());
+				}
+			}
+		} else {
+			for(MinuteRecordData item : rList) {
+				timeStr = new SimpleDateFormat(sdf_sec).format(item.getMinuteTime());
+				time_value.put(timeStr, item.getData());
+			}
+		}
+		//{"时间点":温度值}
+		content.add(time_value);
+	}
+}

+ 51 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/GetCityInfoByProjectId.java

@@ -0,0 +1,51 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.dto.CityDTO;
+
+@Service("GetCityInfoByProjectId")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class GetCityInfoByProjectId extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+
+	
+		String projectId = (String) dto.get("projectId");
+
+		if(StringUtils.isEmpty(projectId) || projectId.length() < 8) {
+			throw new Exception(Const.ErrorTag.paramFormat);
+		}
+		
+		String dicCode = projectId.substring(2, 8);
+		
+		String name = null;
+		CityDTO cityDTO = ConfigUtil.dicCityObjMap().get(dicCode);
+		if(null != cityDTO) {
+			name = cityDTO.getDicName();
+		}
+		
+		if(name == null) {
+			throw new Exception(Const.ErrorTag.cityNotFound);
+		}
+		
+		String cityId = ConfigUtil.getDicCode2CityId().get(dicCode);
+		
+		Map<String,String> resultMap = new HashMap<>();
+		if(cityId != null) {
+			resultMap.put("name", name);
+			resultMap.put("cityId", cityId);
+			content.add(resultMap);
+		}
+	}
+}

+ 54 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/GetTempMonthStatistics.java

@@ -0,0 +1,54 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+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 org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.dto.TempStatisticsDTO;
+import com.persagy.functions.weather.service.WeatherStatisticsService;
+
+/**
+ * Description: 查询历史天气统计信息
+ */
+@Service("GetTempMonthStatistics")
+@SuppressWarnings({ "rawtypes","unchecked" })
+public class GetTempMonthStatistics extends BaseBusinessService<Map> implements BusinessService {
+	
+	@Resource
+	private WeatherStatisticsService weatherStatisticsService;
+
+	@Override
+    public void handle(Map dto, List content) throws Exception {
+    	String cityCode = (String) dto.get("cityCode");
+    	String startDateStr = (String) dto.get("startDate");
+    	String endDateStr = (String)dto.get("endDate");
+    	if(StringUtils.isEmpty(cityCode) || StringUtils.isEmpty(startDateStr) || StringUtils.isEmpty(endDateStr)) {
+    		throw new Exception(Const.ErrorTag.paramMis);
+    	}
+    	String location = ConfigUtil.getHourCity(null, cityCode, null);
+		if(null == location) {
+			throw new Exception(Const.ErrorTag.cityUnsupport);
+		}
+    	Date startDate = DateUtils.str2Date(startDateStr, DateUtils.SDF_SECOND);
+    	Date endDate = DateUtils.str2Date(endDateStr, DateUtils.SDF_SECOND);
+    	TempStatisticsDTO statistics = weatherStatisticsService.getTempMonthStatisticsDTO(location, startDate, endDate);
+    	Map<String,Object> resultMap = new HashMap<>();
+    	resultMap.put("maxTemp", statistics.getMaxTemp());
+    	resultMap.put("minTemp", statistics.getMinTemp());
+    	resultMap.put("avgTemp", statistics.getAvgTemp());
+    	resultMap.put("monthTempMap", statistics.getMonthTempMap());
+    	content.add(resultMap);
+    }
+}
+

+ 69 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/LongHuDataService.java

@@ -0,0 +1,69 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.enumeration.EMSOrder;
+import com.persagy.core.enumeration.SpecialOperator;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.MinuteRecordData;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+
+/**
+ * 获取北京朝阳龙湖某时间段的天气信息
+ */
+@Service("LongHuDataService")
+@Scope("prototype")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class LongHuDataService extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String startDate = (String) dto.get("startDate");
+		String endDate = (String) dto.get("endDate");
+		
+		Date dateStart = null, dateEnd = null;
+		try {
+			dateStart = DateUtils.str2Date(startDate, DateUtils.SDF_SECOND);
+			dateEnd = DateUtils.str2Date(endDate, DateUtils.SDF_SECOND);
+		}catch (Exception e) {
+		}
+		
+		if(null == dateStart || dateEnd == null) {
+			throw new Exception("时间参数有误!");
+		}
+
+		String cityId = ConfigUtil.longHu5MinCitiesGet().get("北京朝阳");
+		if(null == cityId) {
+			return;
+		}
+		
+		if((dateEnd.getTime() - dateStart.getTime()) > (1000 * 60 * 60 * 24 * 366)) {
+			throw new Exception("请求参数时间跨度太大!");
+		}
+		
+		MinuteRecordData queryObj = new MinuteRecordData();
+		queryObj.setBuildingForContainer(cityId);
+		queryObj.setType(1);
+		queryObj.setSort("minuteTime", EMSOrder.Asc);
+		queryObj.setSpecialOperation("minuteTime", SpecialOperator.$gte, dateStart);
+		queryObj.setSpecialOperation("minuteTime", SpecialOperator.$lt, dateEnd);
+		List<MinuteRecordData> rList = coreService.query(queryObj);
+		if(null != rList) {
+			for(MinuteRecordData item : rList) {
+				Map<String, Object> itemMap = new HashMap();
+				itemMap.put("receivetime", DateUtils.date2Str(item.getMinuteTime(), DateUtils.SDF_SECOND));
+				itemMap.put("data", item.getData());
+				itemMap.put("type", 1);
+				content.add(itemMap);
+			}
+		}
+	}
+}

+ 117 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/QueryHolidayOfYear.java

@@ -0,0 +1,117 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.enumeration.EMSOrder;
+import com.persagy.core.mvc.service.CoreService;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.holiday.HolidayGoseek;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.framework.util.HolidaySearchUtil;
+import com.persagy.functions.weather.constant.EnumHolidayDayType;
+import com.persagy.functions.weather.dto.DayHolidayDTO;
+
+@Service("QueryHolidayOfYear")
+@Scope("prototype")
+@SuppressWarnings({"unchecked", "rawtypes" })
+public class QueryHolidayOfYear extends BaseBusinessService<Map> implements BusinessService {
+	
+	@Resource(name = "coreService")
+	private CoreService coreService;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		final Integer year = (Integer) dto.get("year");
+		if(year < HolidaySearchUtil.START_YEAR || year > DateUtils.getYear(new Date())) {
+			throw new Exception("不支持年份" + year);
+		}
+		
+		Integer dayType = (Integer) dto.get("dayType");
+		if(dayType != null && EnumHolidayDayType.getEnum(dayType) == null) {
+			dayType = null;
+		}
+		
+		HolidayGoseek queryObj = new HolidayGoseek();
+		queryObj.setYear(year);
+		queryObj.setSort("dateTime", EMSOrder.Asc);
+		queryObj.setCode(dayType);
+		
+		List<HolidayGoseek> resultList = coreService.query(queryObj);
+		if(resultList == null || resultList.size() == 0) {
+			final String threadName = "RequestHolidayInfo";
+			
+			boolean threadRunning = false;
+			Map<Thread, StackTraceElement[]> allThreadMap = Thread.getAllStackTraces();
+			for(Thread threadObj : allThreadMap.keySet()) {
+				if(threadName.equals(threadObj.getName())) {
+					threadRunning = true;
+				}
+			}
+			
+			if(!threadRunning) {
+				new Thread(threadName) {
+					@Override
+					public void run() {
+						List<DayHolidayDTO> dataList = HolidaySearchUtil.queryHolidayCodeForOneYear(year);
+						if(null != dataList && !dataList.isEmpty()) {
+							List<HolidayGoseek> saveList = new ArrayList<HolidayGoseek>();
+							for(DayHolidayDTO obj : dataList) {
+								HolidayGoseek addObj = new HolidayGoseek(year, obj.getDayTime(), obj.getCode());
+								addObj.setId(UUID.randomUUID().toString().replaceAll("-", ""));
+								saveList.add(addObj);
+							}
+							
+							HolidayGoseek delObj = new HolidayGoseek();
+							delObj.setYear(year);
+							try {
+								coreService.remove(delObj);
+								coreService.save(saveList);
+							} catch (Exception e) {
+								e.printStackTrace();
+							}
+						}
+					}
+				}.start();
+			}
+			
+			throw new Exception("服务繁忙,请1分钟后再试!");
+		}else {
+			for(HolidayGoseek obj : resultList) {
+				content.add(new DayHolidayInfo(DateUtils.date2Str(obj.getDateTime(), DateUtils.SDFDAY), obj.getCode()));
+			}
+		}
+	}
+}
+
+class DayHolidayInfo {
+	private String dayTime;
+	private Integer code;
+	
+	public DayHolidayInfo(String dayTime, Integer code) {
+		super();
+		this.dayTime = dayTime;
+		this.code = code;
+	}
+	public String getDayTime() {
+		return dayTime;
+	}
+	public void setDayTime(String dayTime) {
+		this.dayTime = dayTime;
+	}
+	public Integer getCode() {
+		return code;
+	}
+	public void setCode(Integer code) {
+		this.code = code;
+	}
+}

+ 67 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/QueryTypicalWeather.java

@@ -0,0 +1,67 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+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 org.springframework.util.StringUtils;
+
+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.TypicalWeather;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+
+@Service("GetTypicalWeather")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class QueryTypicalWeather extends BaseBusinessService<Map> implements BusinessService {
+	@Resource(name = "coreService")
+	private CoreService coreService;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String cityCode = (String) dto.get("cityCode");
+		String time = (String) dto.get("time");
+		if ((StringUtils.isEmpty(cityCode)) || (StringUtils.isEmpty(time))) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		Date startDate = DateUtils.str2Date(time, "yyyy-MM");
+		Date endDate = DateUtils.getMonthOff(startDate, 1);
+
+		TypicalWeather queryObj = new TypicalWeather();
+		queryObj.setCityCode(cityCode);
+		queryObj.setSpecialOperation("date", SpecialOperator.$gte, startDate);
+		queryObj.setSpecialOperation("date", SpecialOperator.$lt, endDate);
+		List<TypicalWeather> list = this.coreService.query(queryObj);
+		if (list != null) {
+			for (TypicalWeather obj : list) {
+				Map<String, Object> item = new HashMap<>();
+				item.put("date", obj.getDate());
+				item.put("hdd", obj.getHdd());
+				item.put("cdd", obj.getCdd());
+				item.put("maxTemp", obj.getMaxTemp());
+				item.put("minTemp", obj.getMinTemp());
+				item.put("avgTemp", obj.getAvgTemp());
+				item.put("maxWindSpeed", obj.getMaxWindSpeed());
+				item.put("minWindSpeed", obj.getMinWindSpeed());
+				item.put("avgWindSpeed", obj.getAvgWindSpeed());
+				item.put("maxHumidity", obj.getMaxHumidity());
+				item.put("minHumidity", obj.getMinHumidity());
+				item.put("avgHumidity", obj.getAvgHumidity());
+				item.put("maxPressure", obj.getMaxPressure());
+				item.put("minPressure", obj.getMinPressure());
+				item.put("avgPressure", obj.getAvgPressure());
+				item.put("maxVisibility", obj.getMaxVidibility());
+				item.put("minVisibility", obj.getMinVidibility());
+				item.put("avgVisibility", obj.getAvgVidibility());
+				content.add(item);
+			}
+		}
+	}
+}

+ 33 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/QueryTypicalWeatherCity.java

@@ -0,0 +1,33 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.ConfigUtil;
+
+@Service("QueryTypicalWeatherCity")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class QueryTypicalWeatherCity extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		Map<String, String> dicCode2CityId = ConfigUtil.getDicCode2CityId();
+		Set<String> hourCitySet = ConfigUtil.getHourCitySet();
+
+		Set<String> cityCodeSet = new HashSet();
+		if ((!dicCode2CityId.isEmpty()) && (!hourCitySet.isEmpty())) {
+			for (String code : dicCode2CityId.keySet()) {
+				if (hourCitySet.contains(dicCode2CityId.get(code))) {
+					cityCodeSet.add(code);
+				}
+			}
+		}
+		content.add(cityCodeSet);
+	}
+}

+ 80 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/QueryTypicalWeatherTimeSpan.java

@@ -0,0 +1,80 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+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 org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+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.TypicalWeather;
+import com.persagy.framework.util.DateUtils;
+
+@Service("GetTypicalWeatherTimeSpan")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class QueryTypicalWeatherTimeSpan extends BaseBusinessService<Map> implements BusinessService {
+	@Resource(name = "coreService")
+	private CoreService coreService;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		List<String> cityCodes = (List<String>) dto.get("cityCodes");
+		String beginTime = (String) dto.get("beginTime");
+		
+		String endTime = (String) dto.get("endTime");
+		
+		if(CollectionUtils.isEmpty(cityCodes)) {
+			throw new Exception("cityCodes不能为空!");
+		}
+
+		if(StringUtils.isEmpty(beginTime)) {
+			throw new Exception("beginTime不能为空!");
+		}
+		
+		if(StringUtils.isEmpty(endTime)) {
+			throw new Exception("endTime不能为空!");
+		}
+		
+		Date startDate = DateUtils.str2Date(beginTime, "yyyy-MM-dd");
+		Date endDate = DateUtils.str2Date(endTime, "yyyy-MM-dd");
+	
+		TypicalWeather queryObj = new TypicalWeather();
+		queryObj.setSpecialOperation("cityCode", SpecialOperator.$in, cityCodes);
+		queryObj.setSpecialOperation("date", SpecialOperator.$gte, startDate);
+		queryObj.setSpecialOperation("date", SpecialOperator.$lt, endDate);
+		List<TypicalWeather> list = this.coreService.query(queryObj);
+		if (list != null) {
+			for (TypicalWeather obj : list) {
+				Map<String, Object> item = new HashMap<>();
+				item.put("date", obj.getDate());
+				item.put("cityCode", obj.getCityCode());
+				item.put("hdd", obj.getHdd());
+				item.put("cdd", obj.getCdd());
+				item.put("maxTemp", obj.getMaxTemp());
+				item.put("minTemp", obj.getMinTemp());
+				item.put("avgTemp", obj.getAvgTemp());
+				item.put("maxWindSpeed", obj.getMaxWindSpeed());
+				item.put("minWindSpeed", obj.getMinWindSpeed());
+				item.put("avgWindSpeed", obj.getAvgWindSpeed());
+				item.put("maxHumidity", obj.getMaxHumidity());
+				item.put("minHumidity", obj.getMinHumidity());
+				item.put("avgHumidity", obj.getAvgHumidity());
+				item.put("maxPressure", obj.getMaxPressure());
+				item.put("minPressure", obj.getMinPressure());
+				item.put("avgPressure", obj.getAvgPressure());
+				item.put("maxVisibility", obj.getMaxVidibility());
+				item.put("minVisibility", obj.getMinVidibility());
+				item.put("avgVisibility", obj.getAvgVidibility());
+				content.add(item);
+			}
+		}
+	}
+}

+ 124 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/SaveTypicalWeather.java

@@ -0,0 +1,124 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+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.TypicalWeather;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+
+@Service("SaveTypicalWeather")
+@Scope("prototype")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class SaveTypicalWeather extends BaseBusinessService<Map> implements BusinessService {
+	@Resource(name = "coreService")
+	private CoreService coreService;
+
+	@Transactional
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+
+		List<Map<String,Object>> dataList = (List<Map<String,Object>>) dto.get("dataList");
+	
+		String cityCode = (String) dto.get("cityCode");
+
+		
+		Map<String,String> fillterDate = (Map<String,String>)dto.get("fillterDate");
+		Date fillterStart = null;
+		Date fillterEnd = null;
+		if(fillterDate != null && !fillterDate.isEmpty()) {
+			fillterStart = DateUtils.str2Date((String)fillterDate.get("fillterStart") , DateUtils.SDF_SECOND);
+			fillterEnd = DateUtils.str2Date((String)fillterDate.get("fillterEnd") , DateUtils.SDF_SECOND);
+		}
+		
+		if(CollectionUtils.isEmpty(dataList)) {
+			throw new Exception("dataList不能为空!");
+		}
+		
+		List<Date> timeList = new ArrayList<>();
+		for(Map<String,Object> item : dataList) {
+			String time = (String) item.get("date");
+			Date date = DateUtils.str2Date(time, DateUtils.SDF_DAY);
+			timeList.add(date);
+		}
+		TypicalWeather deleteObj = new TypicalWeather();
+		deleteObj.setCityCode(cityCode);
+		deleteObj.setSpecialOperation("date", SpecialOperator.$in, timeList);
+		coreService.remove(deleteObj);
+		List<TypicalWeather> saveList = new ArrayList<>();
+		Date updateDate = new Date();
+		for(Map<String,Object> item : dataList) {
+			TypicalWeather saveObj = new TypicalWeather();
+			String time = (String) item.get("date");
+			saveObj.setFillterStart(fillterStart);
+			saveObj.setFillterEnd(fillterEnd);
+			Date date = DateUtils.str2Date(time, DateUtils.SDF_DAY);
+			Double hdd = getValue("hdd", item);
+			Double cdd = getValue("cdd", item);
+			Double maxTemp = getValue("maxTemp", item);
+			Double minTemp = getValue("minTemp", item);
+			Double avgTemp = getValue("avgTemp", item);
+			Double maxWindSpeed = getValue("maxWindSpeed", item);
+			Double minWindSpeed = getValue("minWindSpeed", item);
+			Double avgWindSpeed = getValue("avgWindSpeed", item);
+			Double maxHumidity = getValue("maxHumidity", item);
+			Double minHumidity = getValue("minHumidity", item);
+			Double avgHumidity = getValue("avgHumidity", item);
+			Double maxPressure = getValue("maxPressure", item);
+			Double minPressure = getValue("minPressure", item);
+			Double avgPressure = getValue("avgPressure", item);
+			Double maxVidibility = getValue("maxVisibility", item);
+			Double minVidibility = getValue("minVisibility", item);
+			Double avgVidibility = getValue("avgVisibility", item);
+			saveObj.setCityCode(cityCode);
+			saveObj.setDate(date);
+			saveObj.setHdd(hdd);
+			saveObj.setCdd(cdd);
+			saveObj.setMaxTemp(maxTemp);
+			saveObj.setMinTemp(minTemp);
+			saveObj.setAvgTemp(avgTemp);
+			saveObj.setMaxWindSpeed(maxWindSpeed);
+			saveObj.setMinWindSpeed(minWindSpeed);
+			saveObj.setAvgWindSpeed(avgWindSpeed);
+			saveObj.setMaxHumidity(maxHumidity);
+			saveObj.setMinHumidity(minHumidity);
+			saveObj.setAvgHumidity(avgHumidity);
+			saveObj.setMaxPressure(maxPressure);
+			saveObj.setMinPressure(minPressure);
+			saveObj.setAvgPressure(avgPressure);
+			saveObj.setMaxVidibility(maxVidibility);
+			saveObj.setMinVidibility(minVidibility);
+			saveObj.setAvgVidibility(avgVidibility);
+			saveObj.setUpdateDate(updateDate);
+			saveList.add(saveObj);
+		}
+		coreService.save(saveList);
+	}
+	
+	private Double getValue(String key, Map<String,Object> item) throws Exception{
+		Object value = item.get(key);
+		if(null == value) {
+			return null;
+		}
+		
+		String strValue = value.toString();
+		try {
+			return Double.valueOf(strValue);
+		}catch (Exception e) {
+			throw new Exception(Const.ErrorTag.paramUnrecognized);
+		}
+	}
+}

+ 59 - 0
src/main/java/com/persagy/functions/weather/business/v2020/customapi/WeatherCheckService.java

@@ -0,0 +1,59 @@
+package com.persagy.functions.weather.business.v2020.customapi;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.core.mvc.service.CoreService;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.CityLocation;
+import com.persagy.framework.util.WServiceUtil;
+import com.persagy.functions.weather.constant.Const;
+
+@Service("WeatherCheckService")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class WeatherCheckService extends BaseBusinessService<Map> implements BusinessService {
+	@Resource(name = "coreService")
+	private CoreService coreService;
+	
+	public static Map<String, JSONObject> cityCache = new HashMap<>();
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String name = (String) dto.get("name");
+		if (name == null) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		if(cityCache.isEmpty()) {
+			List<CityLocation> list = coreService.query(new CityLocation());
+			if(null != list) {
+				for(CityLocation obj : list) {
+					cityCache.put(obj.getName(), JSONObject.parseObject(obj.getInfo()));
+				}
+			}
+		}
+		
+		if(cityCache.containsKey(name)) {
+			content.add(cityCache.get(name));
+		}else {
+			Map<String, Object> result = WServiceUtil.getLocation(name);
+			if(!result.isEmpty() && result.containsKey("name")) {
+				content.add(result);
+				JSONObject jsonObj = new JSONObject(result);
+				cityCache.put(name, jsonObj);
+				
+				CityLocation saveItem = new CityLocation();
+				saveItem.setName(name);
+				saveItem.setInfo(jsonObj.toString());
+				coreService.save(saveItem);
+			}
+		}
+	}
+}

+ 22 - 0
src/main/java/com/persagy/functions/weather/business/v2020/dict/DicDisasterLevel.java

@@ -0,0 +1,22 @@
+package com.persagy.functions.weather.business.v2020.dict;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+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.functions.weather.constant.DisasterConstant;
+
+@Service("DicDisasterLevel")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class DicDisasterLevel extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		content.addAll(new ArrayList<>(Arrays.asList(DisasterConstant.levelArray)));
+	}
+}

+ 22 - 0
src/main/java/com/persagy/functions/weather/business/v2020/dict/DicDisasterType.java

@@ -0,0 +1,22 @@
+package com.persagy.functions.weather.business.v2020.dict;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+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.functions.weather.constant.DisasterConstant;
+
+@Service("DicDisasterType")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class DicDisasterType extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		content.addAll(new ArrayList<>(Arrays.asList(DisasterConstant.typeArray)));
+	}
+}

+ 20 - 0
src/main/java/com/persagy/functions/weather/business/v2020/dict/DicWeatherCodeName.java

@@ -0,0 +1,20 @@
+package com.persagy.functions.weather.business.v2020.dict;
+
+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.functions.weather.constant.WeatherConstant;
+
+@Service("DicWeatherCodeName")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class DicWeatherCodeName extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		content.add(WeatherConstant.getStandCodeDesc());
+	}
+}

+ 103 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/CommonCityHourWeatherService.java

@@ -0,0 +1,103 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+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 org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.HourRecordData;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.HourRecordService;
+
+@Service("CommonCityHourWeatherService")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class CommonCityHourWeatherService extends BaseBusinessService<Map> implements BusinessService {
+	public static final String sdf_sec = "yyyy-MM-dd HH:mm:ss";
+	
+	@Resource
+	private HourRecordService hourDataService;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String startDate = (String) dto.get("startDate");
+		String endDate = (String) dto.get("endDate");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+		String cityName = (String) dto.get("cityName");
+		Boolean minRespone = (Boolean) dto.get("minRespone");
+		minRespone = Boolean.valueOf(minRespone == null ? false : minRespone.booleanValue());
+		if ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode)) && (StringUtils.isEmpty(cityName))) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		String location = ConfigUtil.getHourCity(cityName, cityCode, projectId);
+		if (location == null) {
+			throw new Exception(Const.ErrorTag.cityUnsupport);
+		}
+		Date dateStart = null;
+		Date dateEnd = null;
+		if(startDate.contains("-") && startDate.length() == 19) {
+			try {
+				dateStart = DateUtils.str2Date(startDate, "yyyy-MM-dd HH:mm:ss");
+				dateEnd = DateUtils.str2Date(endDate, "yyyy-MM-dd HH:mm:ss");
+			} catch (Exception localException) {
+			}
+		}else if(startDate.length() == 14){
+			try {
+				dateStart = DateUtils.str2Date(startDate, "yyyyMMddHHmmss");
+				dateEnd = DateUtils.str2Date(endDate, "yyyyMMddHHmmss");
+			} catch (Exception localException) {
+			}
+		}
+		if ((dateStart == null) || (dateEnd == null)) {
+			throw new Exception(Const.ErrorTag.paramFormat);
+		}
+		List<HourRecordData> rList = this.hourDataService.query(location, dateStart, dateEnd);
+		if (rList != null) {
+			for (HourRecordData record : rList) {
+				Map<String, String> item = getResultItem(record, minRespone);
+				content.add(item);
+			}
+		}
+	}
+
+	private Map<String, String> getResultItem(HourRecordData record, Boolean minRespone) throws Exception {
+		Map<String, String> item = new HashMap();
+		item.put("receivetime", DateUtils.date2Str(record.getHourTime(), "yyyy-MM-dd HH:mm:ss"));
+		item.put("temperature", record.getTemperature());
+		item.put("humidity", record.getHumidity());
+		item.put("windSpeed", record.getWind_speed());
+		item.put("text", record.getText());
+		item.put("quality", record.getQuality());
+		if (!minRespone) {
+			item.put("feelsLike", record.getFeels_like());
+			item.put("locationId", record.getCityId());
+			item.put("code", record.getCode());
+
+			item.put("windDirection", record.getWind_direction());
+			item.put("windDirectionDegree", record.getWind_direction_degree());
+			item.put("windScale", record.getWind_scale());
+			item.put("pressure", record.getPressure());
+			item.put("visibility", record.getVisibility());
+			item.put("clouds", record.getClouds());
+			item.put("dewPoint", record.getDew_point());
+
+			item.put("pm25", record.getPm25());
+			item.put("pm10", record.getPm10());
+			item.put("so2", record.getSo2());
+			item.put("no2", record.getNo2());
+			item.put("co", record.getCo());
+			item.put("o3", record.getO3());
+			item.put("aqi", record.getAqi());
+		}
+		return item;
+	}
+}

+ 117 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/GetCityWeather.java

@@ -0,0 +1,117 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+import java.lang.reflect.Field;
+import java.text.SimpleDateFormat;
+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 org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DayStaticRecord;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.framework.util.WServiceUtil;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.DayStaticService;
+
+/**
+ * Description: 查询城市某一时间段的日天气统计信息
+ */
+@Service("GetCityWeather")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class GetCityWeather extends BaseBusinessService<Map> implements BusinessService {
+	
+	private static final String SDF_SECOND = "yyyy-MM-dd HH:mm:ss";
+	
+	@Resource
+	private DayStaticService dayStaticService;
+
+    @Override
+    public void handle(Map dto, List content) throws Exception {
+        SimpleDateFormat dateFormat = new SimpleDateFormat(SDF_SECOND);
+
+		String cityCode = (String) dto.get("cityCode");
+		String cityName = (String) dto.get("cityName");
+		
+		if (StringUtils.isEmpty(cityCode) && StringUtils.isEmpty(cityName)) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		String location = ConfigUtil.getHourCity(cityName, cityCode, null);
+		if(null == location) {
+			throw new Exception(Const.ErrorTag.cityUnsupport);
+		}
+		
+		String timeFrom = (String)dto.get("timeFrom");
+	    String timeTo = (String)dto.get("timeTo");
+	    Date startDate = null;
+	    if (StringUtils.isEmpty(timeFrom)) {
+	      startDate = dateFormat.parse("2011-01-01 00:00:00");
+	    } else {
+	      startDate = dateFormat.parse(timeFrom);
+	    }
+        
+        // 默认查询未来一个月的日期
+        Date endDate;
+        if (StringUtils.isEmpty(timeTo)) {
+            endDate = DateUtils.getDayOff(DateUtils.getStartTimeOfDay(new Date()), 30);
+        } else {
+            endDate = dateFormat.parse(timeTo);
+        }
+        List<String> weatherTypeList = (List<String>) dto.get("weatherType");
+        if(CollectionUtils.isEmpty(weatherTypeList)) {
+        	weatherTypeList = new ArrayList<>();
+        	weatherTypeList.add("maxTemp");
+        	weatherTypeList.add("minTemp");
+        }
+        
+        List<DayStaticRecord> resultList = new ArrayList<>();
+        List<DayStaticRecord> histList = dayStaticService.query(location, startDate, endDate);
+        if(null != histList) {
+        	resultList.addAll(histList);
+        }
+        
+        Date today = DateUtils.getShortDate(new Date(), 3);
+        if(today.before(endDate)) {
+        	Long daySpan = (endDate.getTime() - today.getTime()) / (24 * 60 * 60 * 1000) + 1;
+        	if(daySpan > 15) {
+        		daySpan = 15L;
+        	}
+        	List<Map<String, Object>> preDataList = WServiceUtil.getDayPredict(location, 0, daySpan.intValue());
+        	for(Map<String, Object> map : preDataList) {
+        		DayStaticRecord preDayStatic = new DayStaticRecord();
+        		Date dateTime = DateUtils.str2Date(map.get("date")+"", DateUtils.SDF_DAY);
+        		if(dateTime.before(endDate)) {
+        			preDayStatic.setDayTime(DateUtils.str2Date(map.get("date")+"", DateUtils.SDF_DAY));
+        			preDayStatic.setMaxTemp(Double.parseDouble(map.get("high")+""));
+        			preDayStatic.setMinTemp(Double.parseDouble(map.get("low")+""));
+        			resultList.add(preDayStatic);
+        		}
+        	}
+        }
+        
+        if(null != histList) {
+        	for (DayStaticRecord dayStatic : resultList) {
+        		Map<String, Object> resultMap = new HashMap<>();
+        		resultMap.put("weatherDate", dayStatic.getDayTime());
+        		for (String weatherType : weatherTypeList) {
+        			Field field = dayStatic.getClass().getDeclaredField(weatherType);
+        			// 设置对象的访问权限,保证对private的属性的访问
+        			field.setAccessible(true);
+        			resultMap.put(weatherType, field.get(dayStatic));
+        		}
+        		content.add(resultMap);
+        	}
+        }
+    }
+}
+

+ 72 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/GetTempBuildingStatistics.java

@@ -0,0 +1,72 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+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 org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.dto.TempStatisticsDTO;
+import com.persagy.functions.weather.service.WeatherStatisticsService;
+
+/**
+ * Description: 查询历史天气统计信息
+ */
+@Service("GetTempBuildingStatistics")
+@SuppressWarnings({ "rawtypes","unchecked" })
+public class GetTempBuildingStatistics extends BaseBusinessService<Map> implements BusinessService {
+	
+	@Resource
+	private WeatherStatisticsService weatherStatisticsService;
+
+	@Override
+    public void handle(Map dto, List content) throws Exception {
+    	List<String> cityCodeList = (List<String>) dto.get("cityCodeList");
+    	String startDateStr = (String) dto.get("startDate");
+    	String endDateStr = (String)dto.get("endDate");
+    	if(CollectionUtils.isEmpty(cityCodeList) || StringUtils.isEmpty(startDateStr) || StringUtils.isEmpty(endDateStr)) {
+    		throw new Exception(Const.ErrorTag.paramMis);
+    	}
+    	
+    	Map<String, String> cityId2code = new HashMap<>();
+    	for(String cityCode : cityCodeList) {
+    		String location = ConfigUtil.getHourCity(null, cityCode, null);
+    		if(null != location) {
+    			cityId2code.put(location, cityCode);
+    		}
+    	}
+    	if(cityId2code.isEmpty()) {
+    		throw new Exception(Const.ErrorTag.cityUnsupport);
+    	}
+    	
+    	Date startDate = DateUtils.str2Date(startDateStr, DateUtils.SDF_SECOND);
+    	Date endDate = DateUtils.str2Date(endDateStr, DateUtils.SDF_SECOND);
+    	TempStatisticsDTO statistics = weatherStatisticsService.getTempBuildingStatisticsDTO(new ArrayList<>(cityId2code.keySet()), startDate, endDate);
+    	Map<String,Object> resultMap = new HashMap<>();
+    	resultMap.put("maxTemp", statistics.getMaxTemp());
+    	resultMap.put("minTemp", statistics.getMinTemp());
+    	resultMap.put("avgTemp", statistics.getAvgTemp());
+    	Map<String, Double> buildingMap = new HashMap<>();
+    	Map<String, Double> tempBuildingMap = statistics.getBuildingTempMap();
+    	if(null != tempBuildingMap) {
+    		for(String cityId : tempBuildingMap.keySet()) {
+    			buildingMap.put(cityId2code.get(cityId), tempBuildingMap.get(cityId));
+    		}
+    	}
+    	resultMap.put("buildingTempMap", buildingMap);
+    	content.add(resultMap);
+    	
+    }
+}
+

+ 42 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/HourWeatherForecastService.java

@@ -0,0 +1,42 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.WServiceUtil;
+import com.persagy.functions.weather.constant.Const;
+
+@Service("HourWeatherForecast")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class HourWeatherForecastService extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String name = (String) dto.get("name");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+		if ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode)) && (StringUtils.isEmpty(name))) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		String location = ConfigUtil.getLocation(name, cityCode, projectId);
+		
+		if(null == location) {
+			throw new Exception(Const.ErrorTag.cityNotFound);
+		}
+		
+		try {
+			Map<String, Object> dataMap = WServiceUtil.getHour24PredictWithLocation(location);
+			if (!dataMap.isEmpty()) {
+				content.add(dataMap);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 42 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/QueryCityInfoByProjectId.java

@@ -0,0 +1,42 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.dto.CityDTO;
+
+@Service("QueryCityInfoByProjectId")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class QueryCityInfoByProjectId extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String projectId = (String) dto.get("projectId");
+		if (StringUtils.isEmpty(projectId)) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		if (projectId.length() < 8) {
+			throw new Exception(Const.ErrorTag.paramUnrecognized);
+		}
+		String dicCode = projectId.substring(2, 8);
+		CityDTO cityDTO = (CityDTO) ConfigUtil.dicCityObjMap().get(dicCode);
+
+		String cityName = cityDTO != null ? cityDTO.getDicName() : null;
+		String cityId = (String) ConfigUtil.getDicCode2CityId().get(dicCode);
+		if ((cityName == null) || (cityId == null)) {
+			throw new Exception(Const.ErrorTag.cityNotFound);
+		}
+		Map<String, String> resultMap = new HashMap();
+		resultMap.put("name", cityName);
+		resultMap.put("cityId", cityId);
+		content.add(resultMap);
+	}
+}

+ 90 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/QueryDisasterService.java

@@ -0,0 +1,90 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+import java.util.ArrayList;
+import java.util.Collection;
+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 org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DisasterWarning;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.constant.DisasterConstant;
+import com.persagy.functions.weather.service.DisasterWarningService;
+
+@Service("QueryDisasterService")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class QueryDisasterService extends BaseBusinessService<Map> implements BusinessService {
+
+	@Resource
+	private DisasterWarningService service;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+
+		String name = (String)dto.get("name");
+	    String projectId = (String)dto.get("projectId");
+	    String cityCode = (String)dto.get("cityCode");
+	    
+	    String type = (String)dto.get("type");
+	    String level = (String)dto.get("level");
+	    if ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode)) && (StringUtils.isEmpty(name))) {
+	      throw new Exception(Const.ErrorTag.paramMis);
+	    }
+	    String cityId = ConfigUtil.getLocationStrict(name, cityCode, projectId);
+	    if (StringUtils.isEmpty(name)) {
+	      throw new Exception(Const.ErrorTag.cityNotFound);
+	    }
+	    Date dateEnd = new Date();
+	    Date dateStart = DateUtils.getDayOff(dateEnd, -7);
+	    
+	    List<DisasterWarning> disasterList = this.service.query(cityId, type, level, dateStart, dateEnd);
+	    if (!CollectionUtils.isEmpty(disasterList)) {
+	      content.addAll(filterDisaster(disasterList));
+	    }
+	}
+
+	private Collection filterDisaster(List<DisasterWarning> disasterList) {
+		List<Map<String, Object>> resultList = new ArrayList();
+		if (!CollectionUtils.isEmpty(disasterList)) {
+			for (DisasterWarning item : disasterList) {
+				String diasterType = item.getType();
+				String diasterLevel = item.getLevel();
+				Date pubTime = item.getPubTime();
+				Date nowTime = new Date();
+
+				Integer continuedTime = DisasterConstant.getType2TimeMap()
+						.get(diasterType + "-" + diasterLevel);
+				continuedTime = continuedTime == null ? 8 : continuedTime;
+				if (nowTime.before(DateUtils.getHourOff(pubTime, continuedTime.intValue()))) {
+					resultList.add(getResultItem(item));
+				}
+			}
+		}
+		return resultList;
+	}
+	
+	private Map<String, Object> getResultItem(DisasterWarning obj) {
+		Map<String, Object> resultItem = new HashMap<>();
+		resultItem.put("cityId", obj.getCityId());
+		resultItem.put("name", obj.getName());
+		resultItem.put("path", obj.getPath());
+		resultItem.put("pubTime", obj.getPubTime());
+		resultItem.put("insertTime", obj.getInsertTime());
+		resultItem.put("title", obj.getTitle());
+		resultItem.put("type", obj.getType());
+		resultItem.put("level", obj.getLevel());
+		resultItem.put("description", obj.getDescription());
+		return resultItem;
+	}
+}

+ 74 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/QueryHistoryDisasterService.java

@@ -0,0 +1,74 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+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 org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DisasterWarning;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.DisasterWarningService;
+
+@Service("QueryHistoryDisasterService")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class QueryHistoryDisasterService extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	private DisasterWarningService service;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String name = (String) dto.get("name");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+		String type = (String) dto.get("type");
+		String level = (String) dto.get("level");
+		String time = (String) dto.get("time");
+		
+		if ((time == null) || ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode))
+				&& (StringUtils.isEmpty(name)))) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		Date dayStart = null;
+		try {
+			dayStart = DateUtils.str2Date(time, "yyyy-MM-dd");
+		} catch (Exception localException) {
+		}
+		if (dayStart == null) {
+			throw new Exception(Const.ErrorTag.paramFormat);
+		}
+		
+		Date dayEnd = DateUtils.getDayOff(dayStart, 1);
+
+		String cityId = ConfigUtil.getLocationStrict(name, cityCode, projectId);
+		if (cityId == null) {
+			throw new Exception(Const.ErrorTag.cityNotFound);
+		}
+		List<DisasterWarning> list = this.service.query(cityId, type, level, dayStart, dayEnd);
+		if (list != null) {
+			for (DisasterWarning obj : list) {
+				Map<String, String> item = new HashMap();
+				item.put("cityId", obj.getCityId());
+				item.put("name", obj.getName());
+				item.put("path", obj.getPath());
+				item.put("title", obj.getTitle());
+				item.put("type", obj.getType());
+				item.put("level", obj.getLevel());
+				item.put("status", obj.getStatus());
+				item.put("description", obj.getDescription());
+				item.put("pubTime", DateUtils.date2Str(obj.getPubTime(), "yyyy-MM-dd HH:mm:ss"));
+				item.put("insertTime", DateUtils.date2Str(obj.getInsertTime(), "yyyy-MM-dd HH:mm:ss"));
+				content.add(item);
+			}
+		}
+	}
+}

+ 227 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/QueryWeatherService.java

@@ -0,0 +1,227 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+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.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DayHisRecord;
+import com.persagy.ems.pojo.wz.DayPredictRecord;
+import com.persagy.ems.pojo.wz.HourRecordData;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.framework.util.WServiceUtil;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.dto.DayPredictDTO;
+import com.persagy.functions.weather.service.DayHisRecordService;
+import com.persagy.functions.weather.service.HourRecordService;
+
+@Service("QueryWeatherService")
+@Scope("prototype")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class QueryWeatherService extends BaseBusinessService<Map> implements BusinessService {
+
+	@Resource
+	private DayHisRecordService dayHisRecordService;
+	@Resource
+	private HourRecordService hourDataService;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String name = (String) dto.get("name");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+		
+		if ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode)) && (StringUtils.isEmpty(name))) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		String date = (String) dto.get("date");
+		Integer limit = (Integer) dto.get("limit");
+
+		Date startDay = null;
+		try {
+			startDay = DateUtils.str2Date(date, "yyyy-MM-dd");
+		} catch (Exception localException) {
+		}
+		if (startDay == null) {
+			throw new Exception(Const.ErrorTag.paramFormat);
+		}
+		
+		String location = ConfigUtil.getLocationStrict(name, cityCode, projectId);
+		
+		if (location == null) {
+			throw new Exception(Const.ErrorTag.cityNotFound);
+		}
+		limit = Integer.valueOf(limit == null ? 5 : limit.intValue());
+		if (limit.intValue() < 1) {
+			return;
+		}
+		if(limit > 366) {
+			throw new Exception(Const.ErrorTag.timeToLong);
+		}
+		
+		Date today = DateUtils.getShortDate(new Date(), 3);
+
+		Date endDay = DateUtils.getDayOff(startDay, limit.intValue());
+
+		Date hisDayStart = null;
+		Date hisDayEnd = null;
+		Date foreDayStart = null;
+		
+		if (startDay.before(today)) {
+			hisDayStart = startDay;
+			if (endDay.compareTo(today) <= 0) {
+				hisDayEnd = endDay;
+			} else {
+				hisDayEnd = today;
+				foreDayStart = today;
+			}
+		}else {
+			foreDayStart = today;
+		}
+		
+		Map<String, HourRecordData> hDataMap = new HashMap<>();
+		if(!today.before(startDay) && today.before(endDay)) {
+			List<HourRecordData> hHisList = hourDataService.query(location, startDay, endDay);
+			if(null != hHisList) {
+				String dayStr = "";
+				for(HourRecordData obj : hHisList) {
+					dayStr = DateUtils.date2Str(obj.getHourTime(), "yyyy-MM-dd");
+					hDataMap.put(dayStr, obj);
+				}
+			}
+		}
+		
+		List<Map<String, String>> resultList = new ArrayList();
+		if (hisDayStart != null) {
+			List<DayHisRecord> histList = this.dayHisRecordService.query(location, hisDayStart, hisDayEnd);
+			if (histList != null) {
+				for (DayHisRecord obj : histList) {
+					Map<String, String> item = new HashMap();
+					resultList.add(item);
+					item.put("date", DateUtils.date2Str(obj.getDayTime(), "yyyy-MM-dd"));
+					item.put("codeDay", obj.getCode_day());
+					item.put("code", obj.getCode_day());
+					item.put("codeNight", obj.getCode_night());
+					item.put("high", obj.getHigh());
+					item.put("humidity", obj.getHumidity());
+					item.put("low", obj.getLow());
+					item.put("textDay", obj.getText_day());
+					item.put("text", obj.getText_day());
+					item.put("textNight", obj.getText_night());
+					item.put("windDirection", obj.getWind_direction());
+					item.put("windDirectionDegree", obj.getWind_direction_degree());
+					item.put("windScale", obj.getWind_scale());
+					item.put("windSpeed", obj.getWind_speed());
+					
+					HourRecordData hdata = hDataMap.get(item.get("date"));
+					if(null != hdata) {
+						item.put("text", hdata.getText());
+						item.put("code", hdata.getCode());
+						item.put("aqi", hdata.getAqi());
+						item.put("pm25", hdata.getPm25());
+						item.put("pm10", hdata.getPm10());
+						item.put("so2", hdata.getSo2());
+						item.put("no2", hdata.getNo2());
+						item.put("co", hdata.getCo());
+						item.put("o3", hdata.getO3());
+						item.put("quality", hdata.getQuality());
+						item.put("feelsLike", hdata.getFeels_like());
+						item.put("temperature", hdata.getTemperature());
+						item.put("pressure", hdata.getPressure());
+						item.put("visibility", hdata.getVisibility());
+					}
+					
+					if(resultList.size() == limit) {
+						break;
+					}
+				}
+			}
+		}
+		if (foreDayStart != null && resultList.size() < limit) {
+			List<DayPredictDTO> preList = new ArrayList<>();
+			List<DayPredictRecord> list = dayHisRecordService.queryPredictData(location, 15);
+			
+			if(null != list) {
+				for(DayPredictRecord item : list) {
+					DayPredictDTO obj = new DayPredictDTO();
+					obj.setDate(DateUtils.date2Str(item.getDayTime(), "yyyy-MM-dd"));
+					obj.setCode_day(item.getCode_day());
+					obj.setCode_night(item.getCode_night());
+					obj.setHigh(item.getHigh());
+					obj.setHumidity(item.getHumidity());
+					obj.setLow(item.getLow());
+					obj.setText_day(item.getText_day());
+					obj.setText_night(item.getText_night());
+					obj.setWind_direction(item.getWind_direction());
+					obj.setWind_direction_degree(item.getWind_direction_degree());
+					obj.setWind_scale(item.getWind_scale());
+					obj.setWind_speed(item.getWind_speed());
+					preList.add(obj);
+				}
+			}
+			
+			if(preList.isEmpty()) {
+				preList = WServiceUtil.getDayPredictObj(location, 0, 15);
+			}
+			
+			if (preList != null) {
+//				Map<String, Object> nowDataMap = new HashMap<>();
+//				if(foreDayStart.equals(today)) {
+//					nowDataMap.putAll(WServiceUtil.getNowAir(location));
+//					nowDataMap.putAll(WServiceUtil.getNowWeather(location));
+//				}
+//				boolean first = true;
+				for (DayPredictDTO obj : preList) {
+					Map<String, String> item = new HashMap();
+					resultList.add(item);
+					item.put("date", obj.getDate());
+					item.put("codeDay", obj.getCode_day());
+					item.put("codeNight", obj.getCode_night());
+					item.put("high", obj.getHigh());
+					item.put("humidity", obj.getHumidity());
+					item.put("low", obj.getLow());
+					item.put("textDay", obj.getText_day());
+					item.put("textNight", obj.getText_night());
+					item.put("windDirection", obj.getWind_direction());
+					item.put("windDirectionDegree", obj.getWind_direction_degree());
+					item.put("windScale", obj.getWind_scale());
+					item.put("windSpeed", obj.getWind_speed());
+
+					HourRecordData hdata = hDataMap.get(item.get("date"));
+					if(null != hdata) {
+						item.put("text", hdata.getText());
+						item.put("code", hdata.getCode());
+						item.put("aqi", hdata.getAqi());
+						item.put("pm25", hdata.getPm25());
+						item.put("pm10", hdata.getPm10());
+						item.put("so2", hdata.getSo2());
+						item.put("no2", hdata.getNo2());
+						item.put("co", hdata.getCo());
+						item.put("o3", hdata.getO3());
+						item.put("quality", hdata.getQuality());
+						item.put("feelsLike", hdata.getFeels_like());
+						item.put("temperature", hdata.getTemperature());
+						item.put("pressure", hdata.getPressure());
+						item.put("visibility", hdata.getVisibility());
+					}
+					
+					if(resultList.size() == limit) {
+						break;
+					}
+				}
+			}
+		}
+		content.addAll(resultList);
+	}
+}

+ 84 - 0
src/main/java/com/persagy/functions/weather/business/v2020/discard/WeatherForecastService.java

@@ -0,0 +1,84 @@
+package com.persagy.functions.weather.business.v2020.discard;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DayPredictRecord;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.framework.util.WServiceUtil;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.dto.DayPredictDTO;
+import com.persagy.functions.weather.service.DayHisRecordService;
+
+@Service("WeatherForecast")
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class WeatherForecastService extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	private DayHisRecordService dayHisRecordService;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String name = (String)dto.get("name");
+	    String projectId = (String)dto.get("projectId");
+	    String cityCode = (String)dto.get("cityCode");
+	    if ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode)) && (StringUtils.isEmpty(name))) {
+	      throw new Exception(Const.ErrorTag.paramMis);
+	    }
+	    String location = ConfigUtil.getLocation(name, cityCode, projectId);
+	    
+	    List<DayPredictRecord> list = dayHisRecordService.queryPredictData(location, 15);
+	    if(null != list && !list.isEmpty()) {
+	    	for(DayPredictRecord item : list) {
+	    		Map<String, Object> resultMap = new HashMap<>();
+    			resultMap.put("date", DateUtils.date2Str(item.getDayTime(), "yyyy-MM-dd"));
+    			resultMap.put("textDay", item.getText_day());
+    			resultMap.put("codeDay", item.getCode_day());
+    			resultMap.put("textNight", item.getText_night());
+    			resultMap.put("codeNight", item.getCode_night());
+    			resultMap.put("precip", item.getPrecip());
+    			resultMap.put("windDirection", item.getWind_direction());
+    			resultMap.put("windDirectionDegree", item.getWind_direction_degree());
+    			resultMap.put("windScale", item.getWind_scale());
+    			resultMap.put("windMaxSpeed", item.getWind_speed());
+    			resultMap.put("windMinSpeed", item.getWind_speed());
+    			resultMap.put("minTemperature", item.getLow());
+    			resultMap.put("maxTemperature", item.getHigh());
+    			content.add(resultMap);
+	    	}
+	    }else {
+	    	List<DayPredictDTO> predicDataList = WServiceUtil.getDayPredictObj(location, 0, 15);
+	    	
+	    	if (!CollectionUtils.isEmpty(predicDataList)) {
+	    		for (DayPredictDTO item : predicDataList) {
+	    			Map<String, Object> resultMap = new HashMap<>();
+	    			resultMap.put("date", item.getDate());
+	    			resultMap.put("textDay", item.getText_day());
+	    			resultMap.put("codeDay", item.getCode_day());
+	    			resultMap.put("textNight", item.getText_night());
+	    			resultMap.put("codeNight", item.getCode_night());
+	    			resultMap.put("precip", item.getPrecip());
+	    			resultMap.put("windDirection", item.getWind_direction());
+	    			resultMap.put("windDirectionDegree", item.getWind_direction_degree());
+	    			resultMap.put("windScale", item.getWind_scale());
+	    			resultMap.put("windMaxSpeed", item.getWind_speed());
+	    			resultMap.put("windMinSpeed", item.getWind_speed());
+	    			resultMap.put("minTemperature", item.getLow());
+	    			resultMap.put("maxTemperature", item.getHigh());
+	    			content.add(resultMap);
+	    		}
+	    		
+	    		dayHisRecordService.coverPredictRecordUseDTO(location, predicDataList);
+	    	}
+	    }
+	}
+}

+ 118 - 0
src/main/java/com/persagy/functions/weather/business/v2020/forecast/DayForecast.java

@@ -0,0 +1,118 @@
+package com.persagy.functions.weather.business.v2020.forecast;
+
+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 org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DayPredictRecord;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.framework.util.WServiceUtil;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.dto.DayPredictDTO;
+import com.persagy.functions.weather.service.DayHisRecordService;
+
+@Service("DayForecast")
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class DayForecast extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	private DayHisRecordService dayHisRecordService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+
+		String cityName = (String)dto.get("cityName");
+	    String projectId = (String)dto.get("projectId");
+	    String cityCode = (String)dto.get("cityCode");
+	    String startDay = (String)dto.get("startDay");
+	    String endDay =  (String)dto.get("endDay");
+	    if ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode)) && (StringUtils.isEmpty(cityName))) {
+	      throw new Exception(Const.ErrorTag.paramMis);
+	    }
+	    
+	    String location = ConfigUtil.getLocationStrict(cityName, cityCode, projectId);
+	    if(null == location) {
+	    	throw new Exception(Const.ErrorTag.cityNotFound);
+	    }
+	    
+	    Date today = DateUtils.getShortDate(new Date(), 3);
+	    Date day15 = DateUtils.getDayOff(today, 15);
+	    
+	    Date dateStart = today, dateEnd = day15;
+	    if(null != startDay) {
+	    	dateStart = DateUtils.str2Date(startDay, DateUtils.SDF_DAY);
+	    }else {
+	    	startDay = DateUtils.date2Str(today, DateUtils.SDF_DAY);
+	    }
+	    
+	    if(null != endDay) {
+	    	dateEnd = DateUtils.str2Date(endDay, DateUtils.SDF_DAY);
+	    }else {
+	    	endDay = DateUtils.date2Str(day15, DateUtils.SDF_DAY);
+	    }
+	    
+	    List<DayPredictRecord> list = dayHisRecordService.queryPredictData(location, today, day15);
+	    if(null != list && list.size() == 15) {
+	    	Date temp = null;
+	    	for(DayPredictRecord item : list) {
+	    		temp = item.getDayTime();
+	    		if(temp == null || temp.before(dateStart) || !temp.before(dateEnd)) {
+	    			continue;
+	    		}
+	    		Map<String, Object> resultMap = new HashMap<>();
+    			resultMap.put("date", DateUtils.date2Str(temp, DateUtils.SDF_DAY));
+    			resultMap.put("textDay", item.getText_day());
+    			resultMap.put("codeDay", item.getCode_day());
+    			resultMap.put("textNight", item.getText_night());
+    			resultMap.put("codeNight", item.getCode_night());
+    			resultMap.put("humidity", item.getHumidity());
+    			resultMap.put("rainfall", item.getRainfall());
+    			resultMap.put("windDirection", item.getWind_direction());
+    			resultMap.put("windDirectionDegree", item.getWind_direction_degree());
+    			resultMap.put("windScale", item.getWind_scale());
+    			resultMap.put("windSpeed", item.getWind_speed());
+    			resultMap.put("minTemperature", item.getLow());
+    			resultMap.put("maxTemperature", item.getHigh());
+    			content.add(resultMap);
+	    	}
+	    }else {
+	    	List<DayPredictDTO> predicDataList = WServiceUtil.getDayPredictObj(location, 0, 15);
+	    	
+	    	if (!CollectionUtils.isEmpty(predicDataList)) {
+	    		String dayTmp = null;
+	    		for (DayPredictDTO item : predicDataList) {
+	    			dayTmp = item.getDate();
+	    			if(dayTmp == null || dayTmp.compareTo(startDay) < 0 || dayTmp.compareTo(endDay) >=0) {
+	    				continue;
+	    			}
+	    			Map<String, Object> resultMap = new HashMap<>();
+	    			resultMap.put("date", item.getDate());
+	    			resultMap.put("textDay", item.getText_day());
+	    			resultMap.put("codeDay", item.getCode_day());
+	    			resultMap.put("textNight", item.getText_night());
+	    			resultMap.put("codeNight", item.getCode_night());
+	    			resultMap.put("humidity", item.getHumidity());
+	    			resultMap.put("rainfall", item.getRainfall());
+	    			resultMap.put("windDirection", item.getWind_direction());
+	    			resultMap.put("windDirectionDegree", item.getWind_direction_degree());
+	    			resultMap.put("windScale", item.getWind_scale());
+	    			resultMap.put("windSpeed", item.getWind_speed());
+	    			resultMap.put("minTemperature", item.getLow());
+	    			resultMap.put("maxTemperature", item.getHigh());
+	    			content.add(resultMap);
+	    		}
+	    		
+	    		dayHisRecordService.coverPredictRecordUseDTO(location, predicDataList);
+	    	}
+	    }
+	}
+}

+ 49 - 0
src/main/java/com/persagy/functions/weather/business/v2020/forecast/Hour24Forecast.java

@@ -0,0 +1,49 @@
+package com.persagy.functions.weather.business.v2020.forecast;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.framework.util.WServiceUtil;
+import com.persagy.functions.weather.constant.Const;
+
+@Service("Hour24Forecast")
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class Hour24Forecast extends BaseBusinessService<Map> implements BusinessService {
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+
+		String cityName = (String) dto.get("cityName");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+
+		if (StringUtils.isEmpty(projectId) && StringUtils.isEmpty(cityCode) && StringUtils.isEmpty(cityName)) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+
+		String location = ConfigUtil.getLocation(cityName, cityCode, projectId);
+		if(null == location) {
+			throw new Exception(Const.ErrorTag.cityNotFound);
+		}
+		
+		try {
+			Map<String, Object> dataMap = WServiceUtil.getHour24PredictWithLocation(location);
+			if (!dataMap.isEmpty()) {
+				List<Map<String, Object>> hourly = (List<Map<String, Object>>) dataMap.get("hourly");
+				for(Map<String, Object> item : hourly) {
+					item.put("time", DateUtils.date2Str(DateUtils.t8DateStr2Date(item.get("time")+""), DateUtils.SDF_SECOND));
+				}
+				content.add(dataMap);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 79 - 0
src/main/java/com/persagy/functions/weather/business/v2020/history/DayHistoryData.java

@@ -0,0 +1,79 @@
+package com.persagy.functions.weather.business.v2020.history;
+
+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 org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.DayHisRecord;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.constant.ConstTime;
+import com.persagy.functions.weather.service.DayHisRecordService;
+
+@Service("DayHistoryData")
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class DayHistoryData extends BaseBusinessService<Map> implements BusinessService {
+	@Resource
+	private DayHisRecordService dayHisRecordService;
+	
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+
+		String cityName = (String) dto.get("cityName");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+
+		if (StringUtils.isEmpty(projectId) && StringUtils.isEmpty(cityCode) && StringUtils.isEmpty(cityName)) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		String startTime = (String) dto.get("startTime");
+		String endTime = (String) dto.get("endTime");
+		Date timeFrom = null, timeTo = null;
+		try {
+			timeFrom = DateUtils.str2Date(startTime, DateUtils.SDF_SECOND);
+			timeTo = DateUtils.str2Date(endTime, DateUtils.SDF_SECOND);
+		}catch (Exception e) {
+		}
+
+		long tspan = timeTo.getTime() - timeFrom.getTime();
+		if(null == timeFrom || null == timeTo) {
+			throw new Exception(Const.ErrorTag.paramFormat);
+		}else if(tspan > (5 * ConstTime.ms_year)) {
+			throw new Exception(Const.ErrorTag.timeToLong);
+		}
+		
+		String location = ConfigUtil.getLocation(cityName, cityCode, projectId);
+		
+		List<DayHisRecord> list = dayHisRecordService.query(location, timeFrom, timeTo);
+		if(null != list) {
+			for(DayHisRecord obj : list) {
+				Map<String, Object> item = new HashMap<>();
+				item.put("codeDay", obj.getCode_day());
+				item.put("codeNight", obj.getCode_night());
+				item.put("dayTime", obj.getDayTime());
+				item.put("high", obj.getHigh());
+				item.put("humidity", obj.getHumidity());
+				item.put("low", obj.getLow());
+				item.put("textDay", obj.getText_day());
+				item.put("textNight", obj.getText_night());
+				item.put("windDirection", obj.getWind_direction());
+				item.put("windDirectionDegree", obj.getWind_direction_degree());
+				item.put("windScale", obj.getWind_scale());
+				item.put("windSpeed", obj.getWind_speed());
+				item.put("rainfall", obj.getRainfall());
+				item.put("precip", obj.getPrecip());
+				content.add(item);
+			}
+		}
+	}
+}

+ 102 - 0
src/main/java/com/persagy/functions/weather/business/v2020/history/HourHistoryData.java

@@ -0,0 +1,102 @@
+package com.persagy.functions.weather.business.v2020.history;
+
+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 org.springframework.util.StringUtils;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.ems.pojo.wz.HourRecordData;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.HourRecordService;
+
+@Service("HourHistoryData")
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class HourHistoryData extends BaseBusinessService<Map> implements BusinessService {
+	public static final String sdf_sec = "yyyy-MM-dd HH:mm:ss";
+
+	@Resource
+	private HourRecordService hourDataService;
+
+	@Override
+	public void handle(Map dto, List content) throws Exception {
+		String startDate = (String) dto.get("startTime");
+		String endDate = (String) dto.get("endTime");
+		String projectId = (String) dto.get("projectId");
+		String cityCode = (String) dto.get("cityCode");
+		String cityName = (String) dto.get("cityName");
+		Boolean minResponse = (Boolean) dto.get("minResponse");
+
+		minResponse = minResponse == null ? true : minResponse;
+		if ((StringUtils.isEmpty(projectId)) && (StringUtils.isEmpty(cityCode)) && (StringUtils.isEmpty(cityName))) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+
+		Date dateStart = null;
+		Date dateEnd = null;
+		try {
+			dateStart = DateUtils.str2Date(startDate, sdf_sec);
+			dateEnd = DateUtils.str2Date(endDate, sdf_sec);
+		} catch (Exception Exception) {
+		}
+		if ((dateStart == null) || (dateEnd == null)) {
+			throw new Exception(Const.ErrorTag.paramMis);
+		}
+		
+		if (DateUtils.getDayOff(dateStart, 31).before(dateEnd)) {
+			throw new Exception(Const.ErrorTag.timeToLong);
+		}
+		
+		String location = ConfigUtil.getHourCity(cityName, cityCode, projectId);
+		if (location == null) {
+			throw new Exception(Const.ErrorTag.cityUnsupport);
+		}
+		
+		List<HourRecordData> rList = this.hourDataService.query(location, dateStart, dateEnd);
+		
+		if (rList != null) {
+			for (HourRecordData record : rList) {
+				Map<String, String> item = getResultItem(record, minResponse.booleanValue());
+				content.add(item);
+			}
+		}
+	}
+
+	private Map<String, String> getResultItem(HourRecordData record, boolean minResponse) throws Exception {
+		Map<String, String> item = new HashMap();
+		item.put("hourTime", DateUtils.date2Str(record.getHourTime(), "yyyy-MM-dd HH:mm:ss"));
+		item.put("temperature", record.getTemperature());
+		item.put("text", record.getText());
+		item.put("windSpeed", record.getWind_speed());
+		item.put("humidity", record.getHumidity());
+		item.put("quality", record.getQuality());
+		if (!minResponse) {
+			item.put("feelsLike", record.getFeels_like());
+			item.put("code", record.getCode());
+			item.put("windDirection", record.getWind_direction());
+			item.put("windDirectionDegree", record.getWind_direction_degree());
+			item.put("windScale", record.getWind_scale());
+			item.put("pressure", record.getPressure());
+			item.put("visibility", record.getVisibility());
+			item.put("clouds", record.getClouds());
+			item.put("dewPoint", record.getDew_point());
+			item.put("pm25", record.getPm25());
+			item.put("pm10", record.getPm10());
+			item.put("so2", record.getSo2());
+			item.put("no2", record.getNo2());
+			item.put("co", record.getCo());
+			item.put("o3", record.getO3());
+			item.put("aqi", record.getAqi());
+			item.put("primaryPollutant", record.getPrimary_pollutant());
+		}
+		return item;
+	}
+}

+ 50 - 0
src/main/java/com/persagy/functions/weather/business/v2020/maintain/ConfigShow.java

@@ -0,0 +1,50 @@
+package com.persagy.functions.weather.business.v2020.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.framework.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);
+	}
+}

+ 62 - 0
src/main/java/com/persagy/functions/weather/business/v2020/maintain/FileData2DB.java

@@ -0,0 +1,62 @@
+package com.persagy.functions.weather.business.v2020.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.functions.weather.service.HourRecordService;
+import com.persagy.functions.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");
+		String timeFrom = (String) dto.get("timeFrom");
+		String timeTo = (String) dto.get("timeTo");
+		
+		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(timeFrom == null || timeFrom.length() != 19 || !timeFrom.contains("-")) {
+			timeFrom = "2000-01-01 00:00:00";
+		}
+		
+		if(timeTo == null || timeTo.length() != 19 || !timeTo.contains("-")) {
+			timeTo = "2030-01-01 00:00:00";
+		}
+		
+		if(FileDataTransThread.runningLogic.contains(dirPath)) {
+			content.add("Task is Running");
+		}else {
+			new Thread(new FileDataTransThread(dirPath, hourRecordService, cityIds, timeFrom, timeTo)).start();
+			content.add("Task start Running");
+		}
+		
+	}
+}

+ 110 - 0
src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourData2VersionTrans.java

@@ -0,0 +1,110 @@
+package com.persagy.functions.weather.business.v2020.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.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.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.service.HourRecordService;
+
+/**
+ * 将老系统中的小时数据传到新系统
+ */
+@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/main/java/com/persagy/functions/weather/business/v2020/maintain/HourDataDelete.java

@@ -0,0 +1,51 @@
+package com.persagy.functions.weather.business.v2020.maintain;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.ConfigUtil;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.HourRecordService;
+
+/**
+ * 删除城市某一日的小时数据
+ */
+@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/main/java/com/persagy/functions/weather/business/v2020/maintain/HourDataRepair.java

@@ -0,0 +1,48 @@
+package com.persagy.functions.weather.business.v2020.maintain;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.mvc.service.CoreService;
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.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/main/java/com/persagy/functions/weather/business/v2020/maintain/HourToDayAvgData.java

@@ -0,0 +1,53 @@
+package com.persagy.functions.weather.business.v2020.maintain;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.DayStaticService;
+import com.persagy.functions.weather.service.HourRecordService;
+import com.persagy.functions.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/main/java/com/persagy/functions/weather/business/v2020/maintain/HourToDayData.java

@@ -0,0 +1,66 @@
+package com.persagy.functions.weather.business.v2020.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.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.service.DayHisRecordService;
+import com.persagy.functions.weather.service.DayStaticService;
+import com.persagy.functions.weather.service.HourRecordService;
+import com.persagy.functions.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/main/java/com/persagy/functions/weather/business/v2020/maintain/HourToDayMaxData.java

@@ -0,0 +1,53 @@
+package com.persagy.functions.weather.business.v2020.maintain;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.core.service.BaseBusinessService;
+import com.persagy.core.service.BusinessService;
+import com.persagy.framework.util.DateUtils;
+import com.persagy.functions.weather.constant.Const;
+import com.persagy.functions.weather.service.DayStaticService;
+import com.persagy.functions.weather.service.HourRecordService;
+import com.persagy.functions.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...");
+	}
+	
+}

+ 149 - 0
src/main/java/com/persagy/functions/weather/business/v2020/maintain/WRecord.java

@@ -0,0 +1,149 @@
+package com.persagy.functions.weather.business.v2020.maintain;
+
+import java.util.Date;
+
+import com.persagy.ems.pojo.wz.HourRecordData;
+import com.persagy.framework.util.DateUtils;
+
+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;
+	}
+	
+}

+ 80 - 0
src/main/java/com/persagy/functions/weather/constant/Const.java

@@ -0,0 +1,80 @@
+package com.persagy.functions.weather.constant;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+public class Const {
+	public static final String LOCATION = "LOCATION";
+	public static final String DAYSTART = "DAYSTART";
+	public static final String DAYEND = "DAYEND";
+	private static final String persagyKey = "VV8BHVPBY8";
+	private static final String persagyKey2 = "S-hcBcOfI-tj-gvwh";
+	private static final String sagaKey = "ebaahic4gjtb17fk";
+	
+	public static class AboutTime {
+		/** 1 * 60 * 1000L */
+		public static final long minMinlliseconds = 1 * 60 * 1000L;
+		/** 5 * 60 * 1000L */
+		public static final long min5Minlliseconds = 5 * minMinlliseconds;
+		/** 15 * 60 * 1000L */
+		public static final long min15Minlliseconds = 15 * minMinlliseconds;
+		/** 30 * 60 * 1000L */
+		public static final long min30Minlliseconds = 30 * minMinlliseconds;
+		/** 60 * 60 * 1000L */
+		public static final long hourMilliseconds = 60 * minMinlliseconds;
+	}
+	
+	public enum API {
+		nowWeather, nowAir, dayPredict, alarm, hour24Predict, hour24History
+	}
+	
+	public static final List<String> iconTheme = new ArrayList<>(Arrays.asList("light","dark","classic"));
+	public static final TreeMap<String, String> iconSize = new TreeMap<>();
+	static {
+		iconSize.put("small", "1");
+		iconSize.put("big", "2");
+	}
+	
+	public static class ServiceURL {
+		public static String nowWeather = "https://api.seniverse.com/v3/weather/now.json?key="+persagyKey+"&language=zh-Hans&unit=c&location=LOCATION";
+		public static String nowAir = "https://api.seniverse.com/v3/air/now.json?key="+persagyKey+"&language=zh-Hans&scope=city&location=LOCATION";
+		public static String dayPredict = "https://api.seniverse.com/v3/weather/daily.json?key="+persagyKey+"&language=zh-Hans&unit=c&start=DAYSTART&days=DAYEND&location=LOCATION";
+		public static String alarm = "https://api.seniverse.com/v3/weather/alarm.json?key="+persagyKey2;
+		public static String hour24Predict = "https://api.seniverse.com/v3/weather/hourly.json?key="+sagaKey+"&language=zh-Hans&unit=c&start=0&hours=24&location=LOCATION";
+		public static String hour24History = "https://api.seniverse.com/v3/weather/hourly_history.json?key="+persagyKey2+"&language=zh-Hans&unit=c&location=LOCATION";
+	}
+	
+	private static Map<String, Integer> requestStatic = new HashMap<>();
+	public static void requestAdd(API api) {
+		synchronized (requestStatic) {
+			Integer num = requestStatic.get(api.name());
+			if(num == null) {
+				requestStatic.put(api.name(), 1);
+			}else {
+				requestStatic.put(api.name(), num + 1);
+			}
+		}
+	}
+	public static Map<String, Integer> popAll() {
+		Map<String, Integer> result = new HashMap<>();
+		synchronized (requestStatic) {
+			result.putAll(requestStatic);
+			requestStatic.clear();
+		}
+		return result;
+	}
+	
+	public static class ErrorTag {
+		public static String paramMis = "required parameters missing";
+		public static String paramFormat = "parameter format error";
+		public static String paramUnrecognized = "unrecognized parameter value";
+		public static String paramValueError = "parameter value error";
+		public static String timeToLong = "time between start and end is too long";
+		public static String cityNotFound = "can not find the right city";
+		public static String cityUnsupport = "city unsupported";
+	}
+}

+ 38 - 0
src/main/java/com/persagy/functions/weather/constant/ConstBusinessStatic.java

@@ -0,0 +1,38 @@
+package com.persagy.functions.weather.constant;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ConstBusinessStatic {
+	private static Map<String, Integer> ip_api2num = new HashMap<>();
+	/**
+	 * ip访问接口增1
+	 * @param ip ip地址
+	 * @param api 业务接口名
+	 */
+	public static void add(String ip, String api) {
+		synchronized (ip_api2num) {
+			String key = ip+"_"+api;
+			Integer oldNum = ip_api2num.get(key);
+			if(oldNum == null) {
+				oldNum = 1;
+			}else {
+				oldNum += 1;
+			}
+			ip_api2num.put(key, oldNum);
+		}
+	}
+	
+	/**
+	 * 获取接口统计信息,并清空缓存
+	 * @return {ip_api:访问次数}
+	 */
+	public static Map<String, Integer> getAndFlush() {
+		Map<String, Integer> resultMap = new HashMap<>();
+		synchronized (ip_api2num) {
+			resultMap.putAll(ip_api2num);
+			ip_api2num.clear();
+		}
+		return resultMap;
+	}
+}

+ 13 - 0
src/main/java/com/persagy/functions/weather/constant/ConstStaticType.java

@@ -0,0 +1,13 @@
+package com.persagy.functions.weather.constant;
+
+public enum ConstStaticType {
+	Max,Avg,All;
+	public static ConstStaticType getItem(String str) {
+		for(ConstStaticType e : ConstStaticType.values()) {
+			if(e.name().equals(str)) {
+				return e;
+			}
+		}
+		return null;
+	}
+}

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

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

+ 80 - 0
src/main/java/com/persagy/functions/weather/constant/DisasterConstant.java

@@ -0,0 +1,80 @@
+package com.persagy.functions.weather.constant;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DisasterConstant {
+	public static final String spt = "-";
+	  public static final String[] typeArray = {"台风", "暴雨", "暴雪", "寒潮", "大风", "沙尘暴", "高温", "干旱", "雷电", "冰雹", "霜冻", "大雾", "道路结冰", "雷雨大风"};
+	  public static final String[] levelArray = {"白色", "蓝色", "黄色", "橙色", "红色"};
+	  private static final Map<String, Integer> typeLevel2TimeMap = new HashMap<String, Integer>();
+	  
+	  public static Map<String, Integer> getType2TimeMap()
+	  {
+	    return typeLevel2TimeMap;
+	  }
+	  
+	  static
+	  {
+	    typeLevel2TimeMap.put(typeArray[0] + "-" + levelArray[0], Integer.valueOf(48));
+	    typeLevel2TimeMap.put(typeArray[0] + "-" + levelArray[1], Integer.valueOf(24));
+	    typeLevel2TimeMap.put(typeArray[0] + "-" + levelArray[2], Integer.valueOf(24));
+	    typeLevel2TimeMap.put(typeArray[0] + "-" + levelArray[3], Integer.valueOf(12));
+	    typeLevel2TimeMap.put(typeArray[0] + "-" + levelArray[4], Integer.valueOf(6));
+	    
+	    typeLevel2TimeMap.put(typeArray[1] + "-" + levelArray[1], Integer.valueOf(12));
+	    typeLevel2TimeMap.put(typeArray[1] + "-" + levelArray[2], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[1] + "-" + levelArray[3], Integer.valueOf(3));
+	    typeLevel2TimeMap.put(typeArray[1] + "-" + levelArray[4], Integer.valueOf(3));
+	    
+	    typeLevel2TimeMap.put(typeArray[2] + "-" + levelArray[1], Integer.valueOf(12));
+	    typeLevel2TimeMap.put(typeArray[2] + "-" + levelArray[2], Integer.valueOf(12));
+	    typeLevel2TimeMap.put(typeArray[2] + "-" + levelArray[3], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[2] + "-" + levelArray[4], Integer.valueOf(6));
+	    
+	    typeLevel2TimeMap.put(typeArray[3] + "-" + levelArray[1], Integer.valueOf(48));
+	    typeLevel2TimeMap.put(typeArray[3] + "-" + levelArray[2], Integer.valueOf(24));
+	    typeLevel2TimeMap.put(typeArray[3] + "-" + levelArray[3], Integer.valueOf(24));
+	    typeLevel2TimeMap.put(typeArray[3] + "-" + levelArray[4], Integer.valueOf(24));
+	    
+	    typeLevel2TimeMap.put(typeArray[4] + "-" + levelArray[1], Integer.valueOf(24));
+	    typeLevel2TimeMap.put(typeArray[4] + "-" + levelArray[2], Integer.valueOf(12));
+	    typeLevel2TimeMap.put(typeArray[4] + "-" + levelArray[3], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[4] + "-" + levelArray[4], Integer.valueOf(6));
+	    
+	    typeLevel2TimeMap.put(typeArray[5] + "-" + levelArray[2], Integer.valueOf(12));
+	    typeLevel2TimeMap.put(typeArray[5] + "-" + levelArray[3], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[5] + "-" + levelArray[4], Integer.valueOf(6));
+	    
+	    typeLevel2TimeMap.put(typeArray[6] + "-" + levelArray[2], Integer.valueOf(72));
+	    typeLevel2TimeMap.put(typeArray[6] + "-" + levelArray[3], Integer.valueOf(24));
+	    typeLevel2TimeMap.put(typeArray[6] + "-" + levelArray[4], Integer.valueOf(24));
+	    
+	    typeLevel2TimeMap.put(typeArray[7] + "-" + levelArray[3], Integer.valueOf(168));
+	    typeLevel2TimeMap.put(typeArray[7] + "-" + levelArray[4], Integer.valueOf(168));
+	    
+	    typeLevel2TimeMap.put(typeArray[8] + "-" + levelArray[2], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[8] + "-" + levelArray[3], Integer.valueOf(2));
+	    typeLevel2TimeMap.put(typeArray[8] + "-" + levelArray[4], Integer.valueOf(2));
+	    
+	    typeLevel2TimeMap.put(typeArray[9] + "-" + levelArray[3], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[9] + "-" + levelArray[4], Integer.valueOf(2));
+	    
+	    typeLevel2TimeMap.put(typeArray[10] + "-" + levelArray[1], Integer.valueOf(24));
+	    typeLevel2TimeMap.put(typeArray[10] + "-" + levelArray[2], Integer.valueOf(24));
+	    typeLevel2TimeMap.put(typeArray[10] + "-" + levelArray[3], Integer.valueOf(24));
+	    
+	    typeLevel2TimeMap.put(typeArray[11] + "-" + levelArray[2], Integer.valueOf(12));
+	    typeLevel2TimeMap.put(typeArray[11] + "-" + levelArray[3], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[11] + "-" + levelArray[4], Integer.valueOf(2));
+	    
+	    typeLevel2TimeMap.put(typeArray[12] + "-" + levelArray[2], Integer.valueOf(12));
+	    typeLevel2TimeMap.put(typeArray[12] + "-" + levelArray[3], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[12] + "-" + levelArray[4], Integer.valueOf(2));
+	    
+	    typeLevel2TimeMap.put(typeArray[13] + "-" + levelArray[1], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[13] + "-" + levelArray[2], Integer.valueOf(6));
+	    typeLevel2TimeMap.put(typeArray[13] + "-" + levelArray[3], Integer.valueOf(2));
+	    typeLevel2TimeMap.put(typeArray[13] + "-" + levelArray[4], Integer.valueOf(2));
+	  }
+}

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

@@ -0,0 +1,34 @@
+package com.persagy.functions.weather.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;
+	}
+}

+ 94 - 0
src/main/java/com/persagy/functions/weather/constant/WeatherConstant.java

@@ -0,0 +1,94 @@
+package com.persagy.functions.weather.constant;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * 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");
+	}
+}

+ 0 - 0
src/main/java/com/persagy/functions/weather/dto/AlarmDTO.java


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