尝试用vscode开发!
This commit is contained in:
		
							
								
								
									
										136
									
								
								code/java/DisasterWarning/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								code/java/DisasterWarning/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,136 @@
 | 
				
			|||||||
 | 
					### Java template
 | 
				
			||||||
 | 
					# Compiled class file
 | 
				
			||||||
 | 
					*.class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Log file
 | 
				
			||||||
 | 
					*.log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# BlueJ files
 | 
				
			||||||
 | 
					*.ctxt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Mobile Tools for Java (J2ME)
 | 
				
			||||||
 | 
					.mtj.tmp/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Package Files #
 | 
				
			||||||
 | 
					*.jar
 | 
				
			||||||
 | 
					*.war
 | 
				
			||||||
 | 
					*.nar
 | 
				
			||||||
 | 
					*.ear
 | 
				
			||||||
 | 
					*.zip
 | 
				
			||||||
 | 
					*.tar.gz
 | 
				
			||||||
 | 
					*.rar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 | 
				
			||||||
 | 
					hs_err_pid*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### VisualStudioCode template
 | 
				
			||||||
 | 
					.vscode/*
 | 
				
			||||||
 | 
					!.vscode/settings.json
 | 
				
			||||||
 | 
					!.vscode/tasks.json
 | 
				
			||||||
 | 
					!.vscode/launch.json
 | 
				
			||||||
 | 
					!.vscode/extensions.json
 | 
				
			||||||
 | 
					*.code-workspace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Local History for Visual Studio Code
 | 
				
			||||||
 | 
					.history/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### JetBrains template
 | 
				
			||||||
 | 
					# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
 | 
				
			||||||
 | 
					# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# User-specific stuff
 | 
				
			||||||
 | 
					.idea/**/workspace.xml
 | 
				
			||||||
 | 
					.idea/**/tasks.xml
 | 
				
			||||||
 | 
					.idea/**/usage.statistics.xml
 | 
				
			||||||
 | 
					.idea/**/dictionaries
 | 
				
			||||||
 | 
					.idea/**/shelf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Generated files
 | 
				
			||||||
 | 
					.idea/**/contentModel.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Sensitive or high-churn files
 | 
				
			||||||
 | 
					.idea/**/dataSources/
 | 
				
			||||||
 | 
					.idea/**/dataSources.ids
 | 
				
			||||||
 | 
					.idea/**/dataSources.local.xml
 | 
				
			||||||
 | 
					.idea/**/sqlDataSources.xml
 | 
				
			||||||
 | 
					.idea/**/dynamic.xml
 | 
				
			||||||
 | 
					.idea/**/uiDesigner.xml
 | 
				
			||||||
 | 
					.idea/**/dbnavigator.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Gradle
 | 
				
			||||||
 | 
					.idea/**/gradle.xml
 | 
				
			||||||
 | 
					.idea/**/libraries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Gradle and Maven with auto-import
 | 
				
			||||||
 | 
					# When using Gradle or Maven with auto-import, you should exclude module files,
 | 
				
			||||||
 | 
					# since they will be recreated, and may cause churn.  Uncomment if using
 | 
				
			||||||
 | 
					# auto-import.
 | 
				
			||||||
 | 
					# .idea/artifacts
 | 
				
			||||||
 | 
					# .idea/compiler.xml
 | 
				
			||||||
 | 
					# .idea/jarRepositories.xml
 | 
				
			||||||
 | 
					# .idea/modules.xml
 | 
				
			||||||
 | 
					# .idea/*.iml
 | 
				
			||||||
 | 
					# .idea/modules
 | 
				
			||||||
 | 
					# *.iml
 | 
				
			||||||
 | 
					# *.ipr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# CMake
 | 
				
			||||||
 | 
					cmake-build-*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Mongo Explorer plugin
 | 
				
			||||||
 | 
					.idea/**/mongoSettings.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# File-based project format
 | 
				
			||||||
 | 
					*.iws
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# IntelliJ
 | 
				
			||||||
 | 
					out/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# mpeltonen/sbt-idea plugin
 | 
				
			||||||
 | 
					.idea_modules/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# JIRA plugin
 | 
				
			||||||
 | 
					atlassian-ide-plugin.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Cursive Clojure plugin
 | 
				
			||||||
 | 
					.idea/replstate.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Crashlytics plugin (for Android Studio and IntelliJ)
 | 
				
			||||||
 | 
					com_crashlytics_export_strings.xml
 | 
				
			||||||
 | 
					crashlytics.properties
 | 
				
			||||||
 | 
					crashlytics-build.properties
 | 
				
			||||||
 | 
					fabric.properties
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Editor-based Rest Client
 | 
				
			||||||
 | 
					.idea/httpRequests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Android studio 3.1+ serialized cache file
 | 
				
			||||||
 | 
					.idea/caches/build_file_checksums.ser
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Windows template
 | 
				
			||||||
 | 
					# Windows thumbnail cache files
 | 
				
			||||||
 | 
					Thumbs.db
 | 
				
			||||||
 | 
					Thumbs.db:encryptable
 | 
				
			||||||
 | 
					ehthumbs.db
 | 
				
			||||||
 | 
					ehthumbs_vista.db
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Dump file
 | 
				
			||||||
 | 
					*.stackdump
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Folder config file
 | 
				
			||||||
 | 
					[Dd]esktop.ini
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Recycle Bin used on file shares
 | 
				
			||||||
 | 
					$RECYCLE.BIN/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Windows Installer files
 | 
				
			||||||
 | 
					*.cab
 | 
				
			||||||
 | 
					*.msi
 | 
				
			||||||
 | 
					*.msix
 | 
				
			||||||
 | 
					*.msm
 | 
				
			||||||
 | 
					*.msp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Windows shortcuts
 | 
				
			||||||
 | 
					*.lnk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					target/*
 | 
				
			||||||
							
								
								
									
										15
									
								
								code/java/DisasterWarning/.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								code/java/DisasterWarning/.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    // 使用 IntelliSense 了解相关属性。 
 | 
				
			||||||
 | 
					    // 悬停以查看现有属性的描述。
 | 
				
			||||||
 | 
					    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
 | 
				
			||||||
 | 
					    "version": "0.2.0",
 | 
				
			||||||
 | 
					    "configurations": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "type": "java",
 | 
				
			||||||
 | 
					            "name": "Launch AppMain",
 | 
				
			||||||
 | 
					            "request": "launch",
 | 
				
			||||||
 | 
					            "mainClass": "AppMain",
 | 
				
			||||||
 | 
					            "projectName": "disaster_warning"
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										4
									
								
								code/java/DisasterWarning/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								code/java/DisasterWarning/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "java.configuration.updateBuildConfiguration": "automatic",
 | 
				
			||||||
 | 
					    "java.format.settings.url": "D:\\工作文档\\配置备份\\vscode\\eclipse-java-google-style.xml"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										18
									
								
								code/java/DisasterWarning/config.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								code/java/DisasterWarning/config.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "title": "天气灾害预警配置文件",
 | 
				
			||||||
 | 
					    "key": "fe9fa8eeeb6f4301a92541eed565dd15",
 | 
				
			||||||
 | 
					    "query_url": "https://devapi.qweather.com/v7/warning/now?",
 | 
				
			||||||
 | 
					    "wechat_officalaccount_url": "https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage",
 | 
				
			||||||
 | 
					    "cities": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "city_name": "厦门",
 | 
				
			||||||
 | 
					            "city_code": "101230201"
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    "notify_stuffs": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "stuff_name": "王炜",
 | 
				
			||||||
 | 
					            "mobile_phone": "15959215339"
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										12
									
								
								code/java/DisasterWarning/db.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								code/java/DisasterWarning/db.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "tns_name": "xmcx1",
 | 
				
			||||||
 | 
					    "ip_addr": "10.39.0.86",
 | 
				
			||||||
 | 
					    "user_name": "",
 | 
				
			||||||
 | 
					    "password": "",
 | 
				
			||||||
 | 
					    "tables": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "table_name": "",
 | 
				
			||||||
 | 
					            "table_description": ""
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										47
									
								
								code/java/DisasterWarning/disaster_warning.iml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								code/java/DisasterWarning/disaster_warning.iml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
 | 
				
			||||||
 | 
					  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
 | 
				
			||||||
 | 
					    <output url="file://$MODULE_DIR$/target/classes" />
 | 
				
			||||||
 | 
					    <output-test url="file://$MODULE_DIR$/target/test-classes" />
 | 
				
			||||||
 | 
					    <content url="file://$MODULE_DIR$">
 | 
				
			||||||
 | 
					      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
 | 
				
			||||||
 | 
					      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
 | 
				
			||||||
 | 
					      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
 | 
				
			||||||
 | 
					      <excludeFolder url="file://$MODULE_DIR$/target" />
 | 
				
			||||||
 | 
					    </content>
 | 
				
			||||||
 | 
					    <orderEntry type="inheritedJdk" />
 | 
				
			||||||
 | 
					    <orderEntry type="sourceFolder" forTests="false" />
 | 
				
			||||||
 | 
					    <orderEntry type="module-library" scope="TEST">
 | 
				
			||||||
 | 
					      <library name="JUnit4">
 | 
				
			||||||
 | 
					        <CLASSES>
 | 
				
			||||||
 | 
					          <root url="jar://$MODULE_DIR$/lib/junit-4.13.1.jar!/" />
 | 
				
			||||||
 | 
					          <root url="jar://$MODULE_DIR$/lib/hamcrest-core-1.3.jar!/" />
 | 
				
			||||||
 | 
					        </CLASSES>
 | 
				
			||||||
 | 
					        <JAVADOC />
 | 
				
			||||||
 | 
					        <SOURCES />
 | 
				
			||||||
 | 
					      </library>
 | 
				
			||||||
 | 
					    </orderEntry>
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.4" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: net.sf.ezmorph:ezmorph:1.0.6" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: net.sf.json-lib:json-lib:jdk15:2.4" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.8" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="module-library">
 | 
				
			||||||
 | 
					      <library name="Maven: com.oracle:ojdbc8:12.2.0.1">
 | 
				
			||||||
 | 
					        <CLASSES>
 | 
				
			||||||
 | 
					          <root url="jar://$MODULE_DIR$/lib/ojdbc8.jar!/" />
 | 
				
			||||||
 | 
					        </CLASSES>
 | 
				
			||||||
 | 
					        <JAVADOC />
 | 
				
			||||||
 | 
					        <SOURCES />
 | 
				
			||||||
 | 
					      </library>
 | 
				
			||||||
 | 
					    </orderEntry>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					</module>
 | 
				
			||||||
							
								
								
									
										379
									
								
								code/java/DisasterWarning/disaster_warning.ipr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										379
									
								
								code/java/DisasterWarning/disaster_warning.ipr
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,379 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<project version="4">
 | 
				
			||||||
 | 
					  <component name="CodeStyleManager">
 | 
				
			||||||
 | 
					    <option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" />
 | 
				
			||||||
 | 
					    <option name="CODE_STYLE_SCHEME" value="" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="CompilerConfiguration">
 | 
				
			||||||
 | 
					    <wildcardResourcePatterns>
 | 
				
			||||||
 | 
					      <entry name="!?*.java" />
 | 
				
			||||||
 | 
					    </wildcardResourcePatterns>
 | 
				
			||||||
 | 
					    <annotationProcessing>
 | 
				
			||||||
 | 
					      <profile name="Maven default annotation processors profile" enabled="true">
 | 
				
			||||||
 | 
					        <sourceOutputDir name="target/generated-sources/annotations" />
 | 
				
			||||||
 | 
					        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
 | 
				
			||||||
 | 
					        <outputRelativeToContentRoot value="true" />
 | 
				
			||||||
 | 
					        <module name="disaster_warning" />
 | 
				
			||||||
 | 
					      </profile>
 | 
				
			||||||
 | 
					    </annotationProcessing>
 | 
				
			||||||
 | 
					    <bytecodeTargetLevel>
 | 
				
			||||||
 | 
					      <module name="disaster_warning" target="1.8" />
 | 
				
			||||||
 | 
					    </bytecodeTargetLevel>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8">
 | 
				
			||||||
 | 
					    <file url="PROJECT" charset="UTF-8" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="ExportToHTMLSettings">
 | 
				
			||||||
 | 
					    <option name="PRINT_LINE_NUMBERS" value="false" />
 | 
				
			||||||
 | 
					    <option name="OPEN_IN_BROWSER" value="false" />
 | 
				
			||||||
 | 
					    <option name="OUTPUT_DIRECTORY" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="ImportConfiguration">
 | 
				
			||||||
 | 
					    <option name="VENDOR" />
 | 
				
			||||||
 | 
					    <option name="RELEASE_TAG" />
 | 
				
			||||||
 | 
					    <option name="LOG_MESSAGE" />
 | 
				
			||||||
 | 
					    <option name="CHECKOUT_AFTER_IMPORT" value="true" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="InspectionProjectProfileManager">
 | 
				
			||||||
 | 
					    <profile version="1.0">
 | 
				
			||||||
 | 
					      <option name="myName" value="Project Default" />
 | 
				
			||||||
 | 
					    </profile>
 | 
				
			||||||
 | 
					    <version value="1.0" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="JUnitGeneratorProjectSettings">
 | 
				
			||||||
 | 
					    <option name="selectedTemplateKey" value="JUnit 4" />
 | 
				
			||||||
 | 
					    <option name="vmTemplates">
 | 
				
			||||||
 | 
					      <map>
 | 
				
			||||||
 | 
					        <entry key="JUnit 3" value="######################################################################################## 
## 
## Available variables: 
##         $entryList.methodList - List of method composites 
##         $entryList.privateMethodList - List of private method composites 
##         $entryList.fieldList - ArrayList of class scope field names 
##         $entryList.className - class name 
##         $entryList.packageName - package name 
##         $today - Todays date in MM/dd/yyyy format 
## 
##            MethodComposite variables: 
##                $method.name - Method Name 
##                $method.signature - Full method signature in String form 
##                $method.reflectionCode - list of strings representing commented out reflection code to access method (Private Methods) 
##                $method.paramNames - List of Strings representing the method's parameters' names 
##                $method.paramClasses - List of Strings representing the method's parameters' classes 
## 
## You can configure the output class name using "testClass" variable below. 
## Here are some examples: 
## Test${entry.ClassName} - will produce TestSomeClass 
## ${entry.className}Test - will produce SomeClassTest 
## 
######################################################################################## 
## 
#macro (cap $strIn)$strIn.valueOf($strIn.charAt(0)).toUpperCase()$strIn.substring(1)#end 
## Iterate through the list and generate testcase for every entry. 
#foreach ($entry in $entryList) 
#set( $testClass="${entry.className}Test") 
## 
package test.$entry.packageName; 

import junit.framework.Test; 
import junit.framework.TestSuite; 
import junit.framework.TestCase; 

/** 
* ${entry.className} Tester. 
* 
* @author <Authors name> 
* @since <pre>$today</pre> 
* @version 1.0 
*/ 
public class $testClass extends TestCase { 
public $testClass(String name) { 
super(name); 
} 

public void setUp() throws Exception { 
super.setUp(); 
} 

public void tearDown() throws Exception { 
super.tearDown(); 
} 

#foreach($method in $entry.methodList) 
/** 
* 
* Method: $method.signature 
* 
*/ 
public void test#cap(${method.name})() throws Exception { 
//TODO: Test goes here... 
} 

#end 

#foreach($method in $entry.privateMethodList) 
/** 
* 
* Method: $method.signature 
* 
*/ 
public void test#cap(${method.name})() throws Exception { 
//TODO: Test goes here... 
#foreach($string in $method.reflectionCode) 
$string 
#end 
} 

#end 

public static Test suite() { 
return new TestSuite(${testClass}.class); 
} 
} 
#end" />
 | 
				
			||||||
 | 
					        <entry key="JUnit 4" value="######################################################################################## 
## 
## Available variables: 
##         $entryList.methodList - List of method composites 
##         $entryList.privateMethodList - List of private method composites 
##         $entryList.fieldList - ArrayList of class scope field names 
##         $entryList.className - class name 
##         $entryList.packageName - package name 
##         $today - Todays date in MM/dd/yyyy format 
## 
##            MethodComposite variables: 
##                $method.name - Method Name 
##                $method.signature - Full method signature in String form 
##                $method.reflectionCode - list of strings representing commented out reflection code to access method (Private Methods) 
##                $method.paramNames - List of Strings representing the method's parameters' names 
##                $method.paramClasses - List of Strings representing the method's parameters' classes 
## 
## You can configure the output class name using "testClass" variable below. 
## Here are some examples: 
## Test${entry.ClassName} - will produce TestSomeClass 
## ${entry.className}Test - will produce SomeClassTest 
## 
######################################################################################## 
## 
#macro (cap $strIn)$strIn.valueOf($strIn.charAt(0)).toUpperCase()$strIn.substring(1)#end 
## Iterate through the list and generate testcase for every entry. 
#foreach ($entry in $entryList) 
#set( $testClass="${entry.className}Test") 
## 
package $entry.packageName; 

import org.junit.Test; 
import org.junit.Before; 
import org.junit.After; 

/** 
* ${entry.className} Tester. 
* 
* @author <Authors name> 
* @since <pre>$date</pre> 
* @version 1.0 
*/ 
public class $testClass { 

@Before
public void before() throws Exception { 
} 

@After
public void after() throws Exception { 
} 

#foreach($method in $entry.methodList) 
/** 
* 
* Method: $method.signature 
* 
*/ 
@Test
public void test#cap(${method.name})() throws Exception { 
//TODO: Test goes here... 
} 

#end 

#foreach($method in $entry.privateMethodList) 
/** 
* 
* Method: $method.signature 
* 
*/ 
@Test
public void test#cap(${method.name})() throws Exception { 
//TODO: Test goes here... 
#foreach($string in $method.reflectionCode) 
$string 
#end 
} 

#end 
} 
#end" />
 | 
				
			||||||
 | 
					      </map>
 | 
				
			||||||
 | 
					    </option>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="JUnitProjectSettings">
 | 
				
			||||||
 | 
					    <option name="TEST_RUNNER" value="UI" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="JavadocGenerationManager">
 | 
				
			||||||
 | 
					    <option name="OPTION_HIERARCHY" value="false" />
 | 
				
			||||||
 | 
					    <option name="OPTION_NAVIGATOR" value="false" />
 | 
				
			||||||
 | 
					    <option name="OPTION_INDEX" value="false" />
 | 
				
			||||||
 | 
					    <option name="OPTION_SEPARATE_INDEX" value="false" />
 | 
				
			||||||
 | 
					    <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="false" />
 | 
				
			||||||
 | 
					    <option name="OPTION_DEPRECATED_LIST" value="false" />
 | 
				
			||||||
 | 
					    <option name="OPEN_IN_BROWSER" value="false" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="JikesSettings">
 | 
				
			||||||
 | 
					    <option name="DEBUGGING_INFO" value="true" />
 | 
				
			||||||
 | 
					    <option name="DEPRECATION" value="true" />
 | 
				
			||||||
 | 
					    <option name="GENERATE_NO_WARNINGS" value="false" />
 | 
				
			||||||
 | 
					    <option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" />
 | 
				
			||||||
 | 
					    <option name="DO_FULL_DEPENDENCE_CHECK" value="false" />
 | 
				
			||||||
 | 
					    <option name="IS_INCREMENTAL_MODE" value="false" />
 | 
				
			||||||
 | 
					    <option name="IS_EMACS_ERRORS_MODE" value="true" />
 | 
				
			||||||
 | 
					    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
 | 
				
			||||||
 | 
					    <option name="MAXIMUM_HEAP_SIZE" value="128" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="MavenProjectsManager">
 | 
				
			||||||
 | 
					    <option name="originalFiles">
 | 
				
			||||||
 | 
					      <list>
 | 
				
			||||||
 | 
					        <option value="$PROJECT_DIR$/pom.xml" />
 | 
				
			||||||
 | 
					      </list>
 | 
				
			||||||
 | 
					    </option>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="Palette2">
 | 
				
			||||||
 | 
					    <group name="Swing">
 | 
				
			||||||
 | 
					      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
 | 
				
			||||||
 | 
					        <initial-values>
 | 
				
			||||||
 | 
					          <property name="text" value="Button" />
 | 
				
			||||||
 | 
					        </initial-values>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
 | 
				
			||||||
 | 
					        <initial-values>
 | 
				
			||||||
 | 
					          <property name="text" value="RadioButton" />
 | 
				
			||||||
 | 
					        </initial-values>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
 | 
				
			||||||
 | 
					        <initial-values>
 | 
				
			||||||
 | 
					          <property name="text" value="CheckBox" />
 | 
				
			||||||
 | 
					        </initial-values>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
 | 
				
			||||||
 | 
					        <initial-values>
 | 
				
			||||||
 | 
					          <property name="text" value="Label" />
 | 
				
			||||||
 | 
					        </initial-values>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="-1" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="-1" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="-1" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="50" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="50" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="50" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="50" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="50" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
 | 
				
			||||||
 | 
					          <preferred-size width="150" height="50" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
 | 
				
			||||||
 | 
					          <preferred-size width="200" height="200" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
 | 
				
			||||||
 | 
					          <preferred-size width="200" height="200" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
 | 
				
			||||||
 | 
					          <preferred-size width="-1" height="20" />
 | 
				
			||||||
 | 
					        </default-constraints>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
 | 
				
			||||||
 | 
					        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					    </group>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="ProjectModuleManager">
 | 
				
			||||||
 | 
					    <modules>
 | 
				
			||||||
 | 
					      <module fileurl="file://$PROJECT_DIR$/disaster_warning.iml" filepath="$PROJECT_DIR$/disaster_warning.iml" />
 | 
				
			||||||
 | 
					    </modules>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="ProjectRootManager" version="2" project-jdk-name="1.8" />
 | 
				
			||||||
 | 
					  <component name="RemoteRepositoriesConfiguration">
 | 
				
			||||||
 | 
					    <remote-repository>
 | 
				
			||||||
 | 
					      <option name="id" value="central" />
 | 
				
			||||||
 | 
					      <option name="name" value="Central Repository" />
 | 
				
			||||||
 | 
					      <option name="url" value="https://repo.maven.apache.org/maven2" />
 | 
				
			||||||
 | 
					    </remote-repository>
 | 
				
			||||||
 | 
					    <remote-repository>
 | 
				
			||||||
 | 
					      <option name="id" value="central" />
 | 
				
			||||||
 | 
					      <option name="name" value="Maven Central repository" />
 | 
				
			||||||
 | 
					      <option name="url" value="https://repo1.maven.org/maven2" />
 | 
				
			||||||
 | 
					    </remote-repository>
 | 
				
			||||||
 | 
					    <remote-repository>
 | 
				
			||||||
 | 
					      <option name="id" value="jboss.community" />
 | 
				
			||||||
 | 
					      <option name="name" value="JBoss Community repository" />
 | 
				
			||||||
 | 
					      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
 | 
				
			||||||
 | 
					    </remote-repository>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="SwUserDefinedSpecifications">
 | 
				
			||||||
 | 
					    <option name="specTypeByUrl">
 | 
				
			||||||
 | 
					      <map />
 | 
				
			||||||
 | 
					    </option>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="VcsDirectoryMappings">
 | 
				
			||||||
 | 
					    <mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					  <component name="libraryTable">
 | 
				
			||||||
 | 
					    <library name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.8">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.9.8/jackson-annotations-2.9.8.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.9.8/jackson-annotations-2.9.8-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.9.8/jackson-annotations-2.9.8-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: commons-beanutils:commons-beanutils:1.9.3">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: commons-codec:commons-codec:1.9">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: commons-collections:commons-collections:3.2.1">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: commons-lang:commons-lang:2.6">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: commons-logging:commons-logging:1.1.1">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: junit:junit:4.4">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.4/junit-4.4.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.4/junit-4.4-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.4/junit-4.4-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: net.sf.ezmorph:ezmorph:1.0.6">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: net.sf.json-lib:json-lib:jdk15:2.4">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: org.apache.httpcomponents:httpclient:4.5.2">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					    <library name="Maven: org.apache.httpcomponents:httpcore:4.4.4">
 | 
				
			||||||
 | 
					      <CLASSES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar!/" />
 | 
				
			||||||
 | 
					      </CLASSES>
 | 
				
			||||||
 | 
					      <JAVADOC>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4-javadoc.jar!/" />
 | 
				
			||||||
 | 
					      </JAVADOC>
 | 
				
			||||||
 | 
					      <SOURCES>
 | 
				
			||||||
 | 
					        <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4-sources.jar!/" />
 | 
				
			||||||
 | 
					      </SOURCES>
 | 
				
			||||||
 | 
					    </library>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					</project>
 | 
				
			||||||
							
								
								
									
										92
									
								
								code/java/DisasterWarning/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								code/java/DisasterWarning/pom.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,92 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<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/xsd/maven-4.0.0.xsd">
 | 
				
			||||||
 | 
					    <modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
 | 
					    <groupId>com.cpic.xim</groupId>
 | 
				
			||||||
 | 
					    <artifactId>disaster_warning</artifactId>
 | 
				
			||||||
 | 
					    <version>1.0-SNAPSHOT</version>
 | 
				
			||||||
 | 
					    <dependencies>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>org.apache.httpcomponents</groupId>
 | 
				
			||||||
 | 
					            <artifactId>httpclient</artifactId>
 | 
				
			||||||
 | 
					            <version>4.5.13</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>junit</groupId>
 | 
				
			||||||
 | 
					            <artifactId>junit</artifactId>
 | 
				
			||||||
 | 
					            <version>4.13.2</version>
 | 
				
			||||||
 | 
					            <scope>test</scope>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>commons-beanutils</groupId>
 | 
				
			||||||
 | 
					            <artifactId>commons-beanutils</artifactId>
 | 
				
			||||||
 | 
					            <version>1.9.4</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>commons-collections</groupId>
 | 
				
			||||||
 | 
					            <artifactId>commons-collections</artifactId>
 | 
				
			||||||
 | 
					            <version>20040616</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>commons-lang</groupId>
 | 
				
			||||||
 | 
					            <artifactId>commons-lang</artifactId>
 | 
				
			||||||
 | 
					            <version>2.6</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>commons-logging</groupId>
 | 
				
			||||||
 | 
					            <artifactId>commons-logging</artifactId>
 | 
				
			||||||
 | 
					            <version>1.1.1</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>net.sf.ezmorph</groupId>
 | 
				
			||||||
 | 
					            <artifactId>ezmorph</artifactId>
 | 
				
			||||||
 | 
					            <version>1.0.6</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>net.sf.json-lib</groupId>
 | 
				
			||||||
 | 
					            <artifactId>json-lib</artifactId>
 | 
				
			||||||
 | 
					            <version>2.4</version>
 | 
				
			||||||
 | 
					            <classifier>jdk15</classifier>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>com.fasterxml.jackson.core</groupId>
 | 
				
			||||||
 | 
					            <artifactId>jackson-core</artifactId>
 | 
				
			||||||
 | 
					            <version>2.9.8</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>com.fasterxml.jackson.core</groupId>
 | 
				
			||||||
 | 
					            <artifactId>jackson-databind</artifactId>
 | 
				
			||||||
 | 
					            <version>2.9.8</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>com.fasterxml.jackson.core</groupId>
 | 
				
			||||||
 | 
					            <artifactId>jackson-annotations</artifactId>
 | 
				
			||||||
 | 
					            <version>2.9.8</version>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					    </dependencies>
 | 
				
			||||||
 | 
					    <properties>
 | 
				
			||||||
 | 
					        <maven.compiler.source>1.8</maven.compiler.source>
 | 
				
			||||||
 | 
					        <maven.compiler.target>1.8</maven.compiler.target>
 | 
				
			||||||
 | 
					        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
				
			||||||
 | 
					        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 | 
				
			||||||
 | 
					        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
 | 
				
			||||||
 | 
					    </properties>
 | 
				
			||||||
 | 
					    <build>
 | 
				
			||||||
 | 
					        <defaultGoal>compile</defaultGoal>
 | 
				
			||||||
 | 
					    </build>
 | 
				
			||||||
 | 
					    <profiles>
 | 
				
			||||||
 | 
					        <profile>
 | 
				
			||||||
 | 
					            <id>dev</id>
 | 
				
			||||||
 | 
					            <properties></properties>
 | 
				
			||||||
 | 
					            <activation>
 | 
				
			||||||
 | 
					                <activeByDefault>true</activeByDefault>
 | 
				
			||||||
 | 
					            </activation>
 | 
				
			||||||
 | 
					        </profile>
 | 
				
			||||||
 | 
					        <profile>
 | 
				
			||||||
 | 
					            <id>test</id>
 | 
				
			||||||
 | 
					            <properties></properties>
 | 
				
			||||||
 | 
					            <activation>
 | 
				
			||||||
 | 
					                <activeByDefault>false</activeByDefault>
 | 
				
			||||||
 | 
					            </activation>
 | 
				
			||||||
 | 
					        </profile>
 | 
				
			||||||
 | 
					    </profiles>
 | 
				
			||||||
 | 
					</project>
 | 
				
			||||||
							
								
								
									
										62
									
								
								code/java/DisasterWarning/src/main/java/AppMain.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								code/java/DisasterWarning/src/main/java/AppMain.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.cpic.xim.config.City;
 | 
				
			||||||
 | 
					import com.cpic.xim.notify.disaster.QWeatherDisasterWarning;
 | 
				
			||||||
 | 
					import com.cpic.xim.notify.disaster.WeatherDisasterWarningGrabber;
 | 
				
			||||||
 | 
					import com.cpic.xim.config.WeatherDisasterNotifyConfig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.util.Vector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class AppMain
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private static final String CONFIG_FILE_PATH = "./config.json";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void main( String[] args )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        String json;
 | 
				
			||||||
 | 
					        WeatherDisasterNotifyConfig config = null;
 | 
				
			||||||
 | 
					        QWeatherDisasterWarning warning = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 读取配置
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            config = WeatherDisasterNotifyConfig.load( CONFIG_FILE_PATH );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (IOException error)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            System.out.println( "读取配置文件失败!" );
 | 
				
			||||||
 | 
					            System.out.println( error.getMessage() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Vector<City> cities = config.getCities();
 | 
				
			||||||
 | 
					        String queryURL = config.getQueryUrl();
 | 
				
			||||||
 | 
					        String userKey = config.getKey();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 遍历所有城市,查询是否有警报,有则推送。
 | 
				
			||||||
 | 
					        for ( City city : cities)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                json = WeatherDisasterWarningGrabber.getWeatherDisasterWarningJSON( queryURL,
 | 
				
			||||||
 | 
					                        userKey, city.getCityCode() );
 | 
				
			||||||
 | 
					                warning = WeatherDisasterWarningGrabber.convertWeatherDisasterWarning( json );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                // 判断是否有警报
 | 
				
			||||||
 | 
					                if ( warning.getWarning().isEmpty() == true)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (IOException error)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                System.out.println( "查询" + city.getCityName() + "出现异常!" );
 | 
				
			||||||
 | 
					                System.out.println( error.getMessage() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,52 @@
 | 
				
			|||||||
 | 
					package com.cpic.xim.config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class City
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public City() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getCityName()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return cityName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setCityName( String cityName )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.cityName = cityName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getCityCode()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return cityCode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setCityCode( String cityCode )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.cityCode = cityCode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean equals( Object o )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( this == o )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if ( o == null || getClass() != o.getClass() )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        City city = (City) o;
 | 
				
			||||||
 | 
					        return cityName.equals( city.cityName ) && cityCode.equals( city.cityCode );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int hashCode()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return Objects.hash( cityName, cityCode );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String cityName;
 | 
				
			||||||
 | 
					    private String cityCode;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,52 @@
 | 
				
			|||||||
 | 
					package com.cpic.xim.config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class CpicxmStuff
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public CpicxmStuff() {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getStuffName()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return stuffName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setStuffName( String stuffName )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.stuffName = stuffName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getMobilePhone()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return mobilePhone;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setMobilePhone( String mobilePhone )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.mobilePhone = mobilePhone;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean equals( Object o )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( this == o )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if ( !( o instanceof CpicxmStuff ) )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        CpicxmStuff that = (CpicxmStuff) o;
 | 
				
			||||||
 | 
					        return stuffName.equals( that.stuffName ) && mobilePhone.equals( that.mobilePhone );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int hashCode()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return Objects.hash( stuffName, mobilePhone );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String stuffName;
 | 
				
			||||||
 | 
					    private String mobilePhone;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,134 @@
 | 
				
			|||||||
 | 
					package com.cpic.xim.config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.FileReader;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.util.Vector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonProperty;
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.databind.ObjectMapper;
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.databind.PropertyNamingStrategy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class WeatherDisasterNotifyConfig
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private static final int BUFFER_SIZE = 1024;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static WeatherDisasterNotifyConfig load( String filePath ) throws IOException
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        WeatherDisasterNotifyConfig config = null;
 | 
				
			||||||
 | 
					        ObjectMapper mapper = new ObjectMapper();
 | 
				
			||||||
 | 
					        FileReader configFile = null;
 | 
				
			||||||
 | 
					        StringBuffer json = null;
 | 
				
			||||||
 | 
					        char[] buffer = new char[BUFFER_SIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 设置json属性
 | 
				
			||||||
 | 
					        mapper.setPropertyNamingStrategy( PropertyNamingStrategy.SNAKE_CASE );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            configFile = new FileReader( filePath );
 | 
				
			||||||
 | 
					            json = new StringBuffer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            int length = configFile.read( buffer );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            while (length != -1)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                json.append( buffer );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                length = configFile.read( buffer );
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            config = mapper.readValue( json.toString(), WeatherDisasterNotifyConfig.class );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        finally
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if ( configFile != null)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                try
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    configFile.close();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                catch (IOException e)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    e.printStackTrace();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return config;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public WeatherDisasterNotifyConfig()
 | 
				
			||||||
 | 
					    {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getTitle()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTitle( String title )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.title = title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getKey()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return key;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setKey( String key )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.key = key;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getQueryUrl()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return queryUrl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setQueryUrl( String queryUrl )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.queryUrl = queryUrl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Vector<City> getCities()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return cities;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setCities( Vector<City> cities )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.cities = cities;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Vector<CpicxmStuff> getNotifyStuffs()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return notifyStuffs;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setNotifyStuffs( Vector<CpicxmStuff> notifyStuffs )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.notifyStuffs = notifyStuffs;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getWechatOfficalAccountURL()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return wechatOfficalAccountURL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setWechatOfficalAccountURL( String wechatOfficalAccountURL )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.wechatOfficalAccountURL = wechatOfficalAccountURL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String title;
 | 
				
			||||||
 | 
					    private String key;
 | 
				
			||||||
 | 
					    private String queryUrl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "wechat_officalaccount_url")
 | 
				
			||||||
 | 
					    private String wechatOfficalAccountURL;
 | 
				
			||||||
 | 
					    private Vector<City> cities;
 | 
				
			||||||
 | 
					    private Vector<CpicxmStuff> notifyStuffs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,52 @@
 | 
				
			|||||||
 | 
					package com.cpic.xim.config.db;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class DBTable
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public DBTable() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getTableName()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return tableName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTableName( String tableName )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.tableName = tableName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getTableDescription()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return tableDescription;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTableDescription( String tableDescription )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.tableDescription = tableDescription;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean equals( Object o )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( this == o )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if ( !( o instanceof DBTable ) )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        DBTable dbTable = (DBTable) o;
 | 
				
			||||||
 | 
					        return tableName.equals( dbTable.tableName ) && tableDescription.equals( dbTable.tableDescription );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int hashCode()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return Objects.hash( tableName, tableDescription );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String tableName;
 | 
				
			||||||
 | 
					    private String tableDescription;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					package com.cpic.xim.config.db;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Vector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class OracleConfig
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private String          tnsName;
 | 
				
			||||||
 | 
					    private String          ipAddr;
 | 
				
			||||||
 | 
					    private String          jdbcURL;
 | 
				
			||||||
 | 
					    private String          userName;
 | 
				
			||||||
 | 
					    private String          password;
 | 
				
			||||||
 | 
					    private Vector<DBTable> tables;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * @Author: Kane
 | 
				
			||||||
 | 
					 * @Date: 2022-04-22 09:54:05
 | 
				
			||||||
 | 
					 * @LastEditors: Kane
 | 
				
			||||||
 | 
					 * @LastEditTime: 2022-04-22 10:32:28
 | 
				
			||||||
 | 
					 * @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\httpUtil\HttpUtils.java
 | 
				
			||||||
 | 
					 * @Description: 
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package com.cpic.xim.httpUtil;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class HttpUtils
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public void postHttpRequest( String url, Map<String, String> headers,
 | 
				
			||||||
 | 
					            Map<String, String> params )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,77 @@
 | 
				
			|||||||
 | 
					package com.cpic.xim.notify.disaster;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Vector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class QWeatherDisasterWarning
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public QWeatherDisasterWarning( String code,
 | 
				
			||||||
 | 
					                                    String updateTime,
 | 
				
			||||||
 | 
					                                    String fxLink,
 | 
				
			||||||
 | 
					                                    Vector<QWeatherDisasterWarningItem> warning,
 | 
				
			||||||
 | 
					                                    QWeatherDisasterWarningRefer refer )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.code       = code;
 | 
				
			||||||
 | 
					        this.updateTime = updateTime;
 | 
				
			||||||
 | 
					        this.fxLink     = fxLink;
 | 
				
			||||||
 | 
					        this.warning    = warning;
 | 
				
			||||||
 | 
					        this.refer      = refer;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public QWeatherDisasterWarning() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getCode()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return code;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setCode( String code )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.code = code;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getUpdateTime()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return updateTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setUpdateTime( String updateTime )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.updateTime = updateTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getFxLink()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return fxLink;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setFxLink( String fxLink )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.fxLink = fxLink;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Vector<QWeatherDisasterWarningItem> getWarning()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return warning;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setWarning( Vector<QWeatherDisasterWarningItem> warning )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.warning = warning;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public QWeatherDisasterWarningRefer getRefer()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return refer;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setRefer( QWeatherDisasterWarningRefer refer )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.refer = refer;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String                              code;
 | 
				
			||||||
 | 
					    private String                              updateTime;
 | 
				
			||||||
 | 
					    private String                              fxLink;
 | 
				
			||||||
 | 
					    private Vector<QWeatherDisasterWarningItem> warning;
 | 
				
			||||||
 | 
					    private QWeatherDisasterWarningRefer        refer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,212 @@
 | 
				
			|||||||
 | 
					package com.cpic.xim.notify.disaster;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonFormat;
 | 
				
			||||||
 | 
					//import com.fasterxml.jackson.annotation.JsonIgnore;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class QWeatherDisasterWarningItem
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public QWeatherDisasterWarningItem() {}
 | 
				
			||||||
 | 
					    public QWeatherDisasterWarningItem( String id,
 | 
				
			||||||
 | 
					                                        String sender,
 | 
				
			||||||
 | 
					                                        String pubTime,
 | 
				
			||||||
 | 
					                                        String title,
 | 
				
			||||||
 | 
					                                        String status,
 | 
				
			||||||
 | 
					                                        String level,
 | 
				
			||||||
 | 
					                                        String type,
 | 
				
			||||||
 | 
					                                        String typeName,
 | 
				
			||||||
 | 
					                                        String text,
 | 
				
			||||||
 | 
					                                        String related,
 | 
				
			||||||
 | 
					                                        String urgency, String certainty )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.id       = id;
 | 
				
			||||||
 | 
					        this.sender   = sender;
 | 
				
			||||||
 | 
					        this.pubTime  = pubTime;
 | 
				
			||||||
 | 
					        this.title    = title;
 | 
				
			||||||
 | 
					        this.status   = status;
 | 
				
			||||||
 | 
					        this.level    = level;
 | 
				
			||||||
 | 
					        this.type     = type;
 | 
				
			||||||
 | 
					        this.typeName = typeName;
 | 
				
			||||||
 | 
					        this.text     = text;
 | 
				
			||||||
 | 
					        this.related  = related;
 | 
				
			||||||
 | 
					        this.urgency   = urgency;
 | 
				
			||||||
 | 
					        this.certainty = certainty;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean equals( Object o )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( this == o )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if ( o == null || getClass() != o.getClass() )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        QWeatherDisasterWarningItem that = (QWeatherDisasterWarningItem) o;
 | 
				
			||||||
 | 
					        return id.equals( that.id ) && Objects.equals( sender, that.sender ) && Objects.equals( pubTime,
 | 
				
			||||||
 | 
					                                                                                                that.pubTime ) && Objects.equals(
 | 
				
			||||||
 | 
					                title,
 | 
				
			||||||
 | 
					                that.title ) && Objects.equals( status, that.status ) && Objects.equals( level,
 | 
				
			||||||
 | 
					                                                                                         that.level ) && Objects.equals(
 | 
				
			||||||
 | 
					                type,
 | 
				
			||||||
 | 
					                that.type ) && Objects.equals( typeName, that.typeName ) && Objects.equals( text,
 | 
				
			||||||
 | 
					                                                                                            that.text ) && Objects.equals(
 | 
				
			||||||
 | 
					                related,
 | 
				
			||||||
 | 
					                that.related ) && Objects.equals( urgency, that.urgency ) && Objects.equals( certainty,
 | 
				
			||||||
 | 
					                                                                                             that.certainty );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int hashCode()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return Objects.hash( id,
 | 
				
			||||||
 | 
					                             sender,
 | 
				
			||||||
 | 
					                             pubTime,
 | 
				
			||||||
 | 
					                             title,
 | 
				
			||||||
 | 
					                             status,
 | 
				
			||||||
 | 
					                             level,
 | 
				
			||||||
 | 
					                             type,
 | 
				
			||||||
 | 
					                             typeName,
 | 
				
			||||||
 | 
					                             text,
 | 
				
			||||||
 | 
					                             related,
 | 
				
			||||||
 | 
					                             urgency,
 | 
				
			||||||
 | 
					                             certainty );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getId()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setId( String id )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.id = id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getSender()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return sender;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setSender( String sender )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.sender = sender;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getPubTime()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return pubTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setPubTime( String pubTime )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.pubTime = pubTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getTitle()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTitle( String title )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.title = title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getStatus()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setStatus( String status )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.status = status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getLevel()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return level;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setLevel( String level )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.level = level;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getType()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return type;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setType( String type )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.type = type;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getTypeName()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return typeName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTypeName( String typeName )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.typeName = typeName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getText()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return text;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setText( String text )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.text = text;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getRelated()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return related;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setRelated( String related )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.related = related;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getUrgency()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return urgency;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setUrgency( String urgency )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.urgency = urgency;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getCertainty()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return certainty;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setCertainty( String certainty )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.certainty = certainty;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String id;
 | 
				
			||||||
 | 
					    private String sender;
 | 
				
			||||||
 | 
					    @JsonFormat(pattern="yyyy-MM-dd'T'HH:mm")
 | 
				
			||||||
 | 
					    private String pubTime;
 | 
				
			||||||
 | 
					    private String title;
 | 
				
			||||||
 | 
					    private String status;
 | 
				
			||||||
 | 
					    private String level;
 | 
				
			||||||
 | 
					    private String type;
 | 
				
			||||||
 | 
					    private String typeName;
 | 
				
			||||||
 | 
					    private String text;
 | 
				
			||||||
 | 
					    private String related;
 | 
				
			||||||
 | 
					    private String urgency;
 | 
				
			||||||
 | 
					    private String certainty;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * @Author: Kane
 | 
				
			||||||
 | 
					 * @Date: 2022-03-17 21:08:09
 | 
				
			||||||
 | 
					 * @LastEditors: Kane
 | 
				
			||||||
 | 
					 * @LastEditTime: 2022-03-18 00:30:53
 | 
				
			||||||
 | 
					 * @FilePath: \天气灾害预警\src\main\java\com\cpic\xim\disaster_warning\QWeatherDisasterWarningRefer.java
 | 
				
			||||||
 | 
					 * @Description: 
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					package com.cpic.xim.notify.disaster;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//import java.util.Objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class QWeatherDisasterWarningRefer
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public QWeatherDisasterWarningRefer() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String[] getSources()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return sources;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setSources( String[] sources )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.sources = sources;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String[] getLicense()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return license;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setLicense( String[] license )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.license = license;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String[] sources;
 | 
				
			||||||
 | 
					    private String[] license;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,131 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author 王炜
 | 
				
			||||||
 | 
					 * @version 1.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					package com.cpic.xim.notify.disaster;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.databind.ObjectMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.io.InputStream;
 | 
				
			||||||
 | 
					import java.io.InputStreamReader;
 | 
				
			||||||
 | 
					import java.io.BufferedReader;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.net.MalformedURLException;
 | 
				
			||||||
 | 
					import java.net.URL;
 | 
				
			||||||
 | 
					import java.net.HttpURLConnection;
 | 
				
			||||||
 | 
					import java.util.zip.GZIPInputStream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class WeatherDisasterWarningGrabber
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /***
 | 
				
			||||||
 | 
					     * 从和风天气获取天气警报json字符串
 | 
				
			||||||
 | 
					     * @param cityCode 城市或区域代码
 | 
				
			||||||
 | 
					     * @return 返回警报的json字符串
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static String getWeatherDisasterWarningJSON( String queryURL,
 | 
				
			||||||
 | 
					                                                        String userKey,
 | 
				
			||||||
 | 
					                                                        String cityCode )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        //拼接url字符串
 | 
				
			||||||
 | 
					        String json       = "";
 | 
				
			||||||
 | 
					        String requestURL = queryURL + "key=" + userKey + "&location=" + cityCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //链接用
 | 
				
			||||||
 | 
					        HttpURLConnection connection     = null;
 | 
				
			||||||
 | 
					        URL               url            = null;
 | 
				
			||||||
 | 
					        InputStream       inputStream    = null;
 | 
				
			||||||
 | 
					        BufferedReader    bufferedReader = null;
 | 
				
			||||||
 | 
					        StringBuilder     buffer         = new StringBuilder();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            url        = new URL( requestURL );
 | 
				
			||||||
 | 
					            connection = (HttpURLConnection) url.openConnection();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            connection.setRequestMethod( "GET" );
 | 
				
			||||||
 | 
					            connection.setConnectTimeout( 15000 );
 | 
				
			||||||
 | 
					            connection.setReadTimeout( 60000 );
 | 
				
			||||||
 | 
					            connection.connect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //如果responseCode为200,说明访问成功!
 | 
				
			||||||
 | 
					            if ( connection.getResponseCode() == 200 )
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //注意,和风使用了gzip压缩响应体
 | 
				
			||||||
 | 
					                inputStream    = new GZIPInputStream( connection.getInputStream() );
 | 
				
			||||||
 | 
					                bufferedReader = new BufferedReader( new InputStreamReader( inputStream, "UTF-8" ) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //读出数据
 | 
				
			||||||
 | 
					                String temp = bufferedReader.readLine();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                while ( temp != null )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    buffer.append( temp );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    temp = bufferedReader.readLine();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                json = buffer.toString();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch ( MalformedURLException error )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            error.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch ( IOException error )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            System.out.println( "读取失败!" );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        finally
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if ( bufferedReader != null )
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                try
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    bufferedReader.close();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                catch ( IOException error )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    error.printStackTrace();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if ( inputStream != null )
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                try
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    inputStream.close();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                catch ( IOException error )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    error.printStackTrace();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if ( connection != null )
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                connection.disconnect();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return json;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 将天气警告的json字符串转换成java对象。
 | 
				
			||||||
 | 
					     * @param json json字符串
 | 
				
			||||||
 | 
					     * @return  返回 QWeatherDisasterWarning 对象。
 | 
				
			||||||
 | 
					     * @throws IOException
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static QWeatherDisasterWarning convertWeatherDisasterWarning( String json )
 | 
				
			||||||
 | 
					            throws IOException
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        ObjectMapper mapper = new ObjectMapper();
 | 
				
			||||||
 | 
					        QWeatherDisasterWarning warning = mapper.readValue( json, QWeatherDisasterWarning.class );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return warning;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,311 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					package com.cpic.xim.wechat.officalAccount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonInclude;
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonProperty;
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.core.JsonProcessingException;
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.databind.ObjectMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.net.URL;
 | 
				
			||||||
 | 
					import java.net.HttpURLConnection;
 | 
				
			||||||
 | 
					import java.nio.charset.StandardCharsets;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 推送微信公众号消息。
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author Kane
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class sendMessage
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 向公众号推送通知消息。接口文档参考 彭奕洁 编写《消息发送接口调用文档》
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param wechatOfficalAccountURL 公众号接口网址。
 | 
				
			||||||
 | 
					     * @param title 通知的标题。
 | 
				
			||||||
 | 
					     * @param notifyType 通知类型。
 | 
				
			||||||
 | 
					     * @param notifyMessage 通知文本内容。
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static void postNotifyMessageJSON( String wechatOfficalAccountURL, String title,
 | 
				
			||||||
 | 
					            String notifyType, String notifyMessage )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        // 设置推送内容
 | 
				
			||||||
 | 
					        WechatOfficalAccountMessageParameter param = new WechatOfficalAccountMessageParameter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        param.setFirst( title );
 | 
				
			||||||
 | 
					        param.setKeyword1( notifyType );
 | 
				
			||||||
 | 
					        param.setKeyword1Color( "#ff0000" );
 | 
				
			||||||
 | 
					        param.setKeyword2( notifyMessage );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 转换成json
 | 
				
			||||||
 | 
					        ObjectMapper mapper;
 | 
				
			||||||
 | 
					        String json = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            mapper = new ObjectMapper();
 | 
				
			||||||
 | 
					            mapper.setSerializationInclusion( JsonInclude.Include.NON_NULL );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            json = mapper.writeValueAsString( param );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if ( json.isEmpty())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            System.out.println( json );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (JsonProcessingException error)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            error.printStackTrace();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 推送数据
 | 
				
			||||||
 | 
					        URL url;
 | 
				
			||||||
 | 
					        HttpURLConnection connection = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        StringBuilder result = new StringBuilder();
 | 
				
			||||||
 | 
					        OutputStreamWriter out = null;
 | 
				
			||||||
 | 
					        BufferedReader in = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            url = new URL( wechatOfficalAccountURL );
 | 
				
			||||||
 | 
					            connection = (HttpURLConnection) url.openConnection();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            connection.setRequestMethod( "POST" );
 | 
				
			||||||
 | 
					            connection.setRequestProperty( "accept", "*/*" );
 | 
				
			||||||
 | 
					            connection.setRequestProperty( "Connection", "Keep-Alive" );
 | 
				
			||||||
 | 
					            connection.setRequestProperty( "Content-Type", "application/json" );
 | 
				
			||||||
 | 
					            connection.setDoInput( true );
 | 
				
			||||||
 | 
					            connection.setDoOutput( true );
 | 
				
			||||||
 | 
					            connection.connect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            out = new OutputStreamWriter( connection.getOutputStream(), StandardCharsets.UTF_8 );
 | 
				
			||||||
 | 
					            out.write( json );
 | 
				
			||||||
 | 
					            out.flush();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            in = new BufferedReader( new InputStreamReader( connection.getInputStream() ) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            String line = in.readLine();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            while (line != null)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                result.append( line );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                line = in.readLine();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (Exception error)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            error.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        finally
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if ( in != null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    in.close();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if ( out != null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    out.close();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if ( connection != null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    connection.disconnect();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception error)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                error.printStackTrace();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static void postNotifyMessage( String URL, Map<String, String> header, String param )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class WechatOfficalAccountMessageParameter
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    WechatOfficalAccountMessageParameter()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        tplID = 57;
 | 
				
			||||||
 | 
					        groupID = 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "tplid")
 | 
				
			||||||
 | 
					    private int tplID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "groupid")
 | 
				
			||||||
 | 
					    private int groupID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "first")
 | 
				
			||||||
 | 
					    private String first;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "keyword1")
 | 
				
			||||||
 | 
					    private String keyword1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "keyword1color")
 | 
				
			||||||
 | 
					    private String keyword1Color;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "keyword2")
 | 
				
			||||||
 | 
					    private String keyword2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "keyword2color")
 | 
				
			||||||
 | 
					    private String keyword2Color;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "remark")
 | 
				
			||||||
 | 
					    private String remark;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "remarkcolor")
 | 
				
			||||||
 | 
					    private String remarkColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "url")
 | 
				
			||||||
 | 
					    private String url;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "appid")
 | 
				
			||||||
 | 
					    private String appid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty( "pagepath")
 | 
				
			||||||
 | 
					    private String pagePath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getTplID()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return tplID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTplID( int tplID )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.tplID = tplID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getGroupID()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return groupID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setGroupID( int groupID )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.groupID = groupID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getFirst()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return first;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setFirst( String first )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.first = first;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getKeyword1()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return keyword1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setKeyword1( String keyword1 )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.keyword1 = keyword1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getKeyword1Color()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return keyword1Color;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setKeyword1Color( String keyword1Color )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.keyword1Color = keyword1Color;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getKeyword2()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return keyword2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setKeyword2( String keyword2 )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.keyword2 = keyword2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getKeyword2Color()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return keyword2Color;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setKeyword2Color( String keyword2Color )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.keyword2Color = keyword2Color;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getRemark()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return remark;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setRemark( String remark )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.remark = remark;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getRemarkColor()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return remarkColor;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setRemarkColor( String remarkColor )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.remarkColor = remarkColor;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getUrl()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return url;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setUrl( String url )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.url = url;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getAppid()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return appid;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setAppid( String appid )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.appid = appid;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getPagePath()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return pagePath;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setPagePath( String pagePath )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.pagePath = pagePath;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					package com.cpic.xim.wechat.officalAccount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.junit.Test;
 | 
				
			||||||
 | 
					import static org.junit.Assert.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class sendMessageTest
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private static String url =
 | 
				
			||||||
 | 
					            "https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    public void postNotifyMessageJson()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            sendMessage.postNotifyMessageJSON( url, "警报", "警报标题", "警报内容!" );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (Exception error)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            fail( "测试失败!" );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    public void postNotifyMessage()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (Exception error)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user