完成json配置文件加载。

This commit is contained in:
Kane Wang 2022-03-18 16:04:54 +08:00
parent 2378de88dc
commit d7c667cb40
24 changed files with 527 additions and 119 deletions

View File

@ -0,0 +1,41 @@
{
"title": "天气灾害预警配置文件",
"key": "fe9fa8eeeb6f4301a92541eed565dd15",
"query_url": "https://devapi.qweather.com/v7/warning/now?",
"cities": [
{
"city_name": "厦门",
"city_code": "101230201"
},
{
"city_name": "同安",
"city_code": "101230202"
},
{
"city_name": "思明",
"city_code": "101230203"
},
{
"city_name": "海沧",
"city_code": "101230204"
},
{
"city_name": "湖里",
"city_code": "101230205"
},
{
"city_name": "集美",
"city_code": "101230206"
},
{
"city_name": "翔安",
"city_code": "101230207"
}
],
"notify_stuffs": [
{
"stuff_name": "王炜",
"mobile_phone": "15959215339"
}
]
}

View File

@ -1,52 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<module version="4" relativePaths="false" type="JAVA_MODULE">
<component name="NewModuleRootManager">
<exclude-output/>
<orderEntry type="inheritedJdk"/>
<!-- output url="file://$$MODULE_DIR$$/${maven.build.dest}"/ -->
<!-- output-test url="file://$$MODULE_DIR$$/${maven.test.dest}"/ -->
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" relativePaths="false" 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$$/${pom.build.sourceDirectory}" isTestSource="false"/ -->
<!-- sourceFolder url="file://$$MODULE_DIR$$/${pom.build.testSourceDirectory}" isTestSource="true"/ -->
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false"/>
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true"/>
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false"/>
<excludeFolder url="file://$MODULE_DIR$/target"/>
</content>
<orderEntry type="inheritedJdk"/>
<orderEntry type="sourceFolder" forTests="false"/>
<!-- Next include each dependency:
<orderEntry type="module" module-name="${dep.artifactId}"/>
<orderEntry type="module-library">
<library name="${dep.artifactId}">
<CLASSES>
<root url="jar://${lib.path}!/"/>
</CLASSES>
<JAVADOC/>
<SOURCES/>
</library>
</orderEntry>
-->
<output url="file://$MODULE_DIR$/target/classes"/>
<output-test url="file://$MODULE_DIR$/target/test-classes"/>
<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" 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>
<CLASSES>
@ -131,22 +108,5 @@ under the License.
</CLASSES>
</library>
</orderEntry>
</component>
<component name="ModuleRootManager"/>
<!-- If it's a war project:
<component name="WebModuleProperties">
<containerElement type="module" name="${dep.artifactId}">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/classes" />
</containerElement>
<containerElement type="library" level="module" name="${dep.artifactId}">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/${dep.systemPath.name}" />
</containerElement>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/${pom.build.warSourceDirectory}/WEB-INF/web.xml" version="" />
<webroots>
<root url="file://$MODULE_DIR$/${pom.build.warSourceDirectory}" relative="/" />
</webroots>
</component>
-->
</component>
</module>

View File

@ -20,9 +20,6 @@
<module name="disaster_warning" target="1.8" />
</bytecodeTargetLevel>
</component>
<component name="EntryPointsManager">
<entry_points />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
@ -44,20 +41,12 @@
<option name="TEST_RUNNER" value="UI" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
<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_USE_1_1" value="false" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="false" />
<option name="OPTION_DEPRECATED_LIST" value="false" />
<option name="OTHER_OPTIONS" />
<option name="HEAP_SIZE" />
<option name="OPEN_IN_BROWSER" value="false" />
</component>
<component name="JikesSettings">
@ -78,6 +67,127 @@
</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" />

View File

@ -5,13 +5,30 @@
</component>
<component name="ChangeListManager">
<list default="true" id="59c1e2ec-34de-447f-b370-673ce36f3f54" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/runConfigurations/compile.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/runConfigurations/compile.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/config.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/config/City.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/config/CpicxmStuff.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/config/WeatherDisasterNotifyConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/disaster_warning.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/jarRepositories.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/runConfigurations/compile.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/uiDesigner.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/天气灾害预警.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/disaster_warning.iml" beforeDir="false" afterPath="$PROJECT_DIR$/disaster_warning.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/disaster_warning.ipr" beforeDir="false" afterPath="$PROJECT_DIR$/disaster_warning.ipr" afterDir="false" />
<change beforePath="$PROJECT_DIR$/disaster_warning.iws" beforeDir="false" afterPath="$PROJECT_DIR$/disaster_warning.iws" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/AppMain.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/AppMain.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/QWeatherDisasterWarningItem.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/QWeatherDisasterWarningItem.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/QWeatherDisasterWarningRefer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/QWeatherDisasterWarningRefer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/WeatherDisasterWarningGrabber.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/WeatherDisasterWarningGrabber.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/QWeatherDisasterWarning.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/notify/disaster/QWeatherDisasterWarning.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/QWeatherDisasterWarningItem.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/notify/disaster/QWeatherDisasterWarningItem.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/QWeatherDisasterWarningRefer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/notify/disaster/QWeatherDisasterWarningRefer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/cpic/xim/disaster_warning/WeatherDisasterWarningGrabber.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/notify/disaster/WeatherDisasterWarningGrabber.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/workspace.code-workspace" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -176,6 +193,13 @@
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="HIDE_WARNINGS" value="false" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
</component>
@ -236,7 +260,9 @@
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
</component>
<component name="ProjectId" id="26WTbYpsKBJXnhCCsfiX1ogpS2j" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewSettings">
<navigator currentView="ProjectPane" flattenPackages="false" showMembers="false" showStructure="false" autoscrollToSource="false" splitterProportion="0.5" />
<view id="ProjectPane">
@ -259,6 +285,11 @@
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="nodejs_package_manager_path" value="npm" />
</component>
<component name="RunManager">
<configuration selected="false" default="true" type="Applet" factoryName="Applet">
@ -271,6 +302,14 @@
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
</configuration>
<configuration name="AppMain" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="AppMain" />
<module name="disaster_warning" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<method v="2">
@ -288,6 +327,11 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.AppMain" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="StarteamConfiguration">
@ -327,6 +371,8 @@
<option name="presentableId" value="Default" />
<updated>1647538422605</updated>
<workItem from="1647538428126" duration="120000" />
<workItem from="1647574227207" duration="347000" />
<workItem from="1647575274400" duration="9208000" />
</task>
<servers />
</component>
@ -368,6 +414,17 @@
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VssConfiguration">
<CheckoutOptions>
<option name="COMMENT" value="" />
@ -420,4 +477,15 @@
<component name="WebViewSettings">
<webview flattenPackages="false" showMembers="false" autoscrollToSource="false" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/com/cpic/xim/config/WeatherDisasterNotifyConfig.java</url>
<line>40</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

View File

@ -4,7 +4,6 @@
<groupId>com.cpic.xim</groupId>
<artifactId>disaster_warning</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
@ -67,21 +66,15 @@
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<!--<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>GBK</project.reporting.outputEncoding>
<maven.compiler.encoding>GBK</maven.compiler.encoding>-->
</properties>
<properties></properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
</properties>
<properties></properties>
<activation>
<activeByDefault>false</activeByDefault>
</activation>

View File

@ -4,41 +4,63 @@
* @LastEditors: Kane
* @LastEditTime: 2022-03-18 00:37:56
* @FilePath: \天气灾害预警\src\main\java\AppMain.java
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import com.cpic.xim.disaster_warning.QWeatherDisasterWarning;
import com.cpic.xim.disaster_warning.WeatherDisasterWarningGrabber;
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.nio.file.FileSystems;
//import java.nio.file.Path;
import java.util.Vector;
public class AppMain
{
private static final String CONFIG_FILE_PATH = "./config.json";
public static void main( String[] args )
{
String cityCode = "101230201";
QWeatherDisasterWarning warning;
String json = WeatherDisasterWarningGrabber.getWeatherDisasterWarningJSON( cityCode );
if ( json.isEmpty() == true )
{
System.out.println( "获取天气信息失败!" );
}
String cityCode = "101230201";
String json;
QWeatherDisasterWarning warning = null;
WeatherDisasterNotifyConfig config = null;
//读取配置
try
{
warning = WeatherDisasterWarningGrabber.convertWeatherDisasterWarning( json );
config = WeatherDisasterNotifyConfig.load( CONFIG_FILE_PATH );
}
catch ( IOException error )
{
error.printStackTrace();
System.out.println( "读取配置文件失败!" );
System.out.println( error.getMessage() );
return;
}
// if ( warning.)
Vector<City> cities = config.getCities();
String queryURL = config.getQueryUrl();
String userKey = config.getKey();
System.out.println( "1111" );
for ( City city : cities )
{
try
{
json = WeatherDisasterWarningGrabber.getWeatherDisasterWarningJSON( queryURL,
userKey,
city.getCityCode() );
warning = WeatherDisasterWarningGrabber.convertWeatherDisasterWarning( json );
}
catch ( IOException error )
{
System.out.println( "查询" + city.getCityName() + "出现异常!");
System.out.println( error.getMessage() );
continue;
}
}
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,118 @@
package com.cpic.xim.config;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Vector;
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;
}
private String title;
private String key;
private String queryUrl;
private Vector<City> cities;
private Vector<CpicxmStuff> notifyStuffs;
}

View File

@ -8,7 +8,7 @@
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.disaster_warning;
package com.cpic.xim.notify.disaster;
//import java.util.Objects;

View File

@ -1,4 +1,4 @@
package com.cpic.xim.disaster_warning;
package com.cpic.xim.notify.disaster;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -22,11 +22,13 @@ public class WeatherDisasterWarningGrabber
* @param cityCode 城市或区域代码
* @return 返回警报的json字符串
*/
public static String getWeatherDisasterWarningJSON( String cityCode )
public static String getWeatherDisasterWarningJSON( String queryURL,
String userKey,
String cityCode )
{
//拼接url字符串
String json = "";
String requestURL = QUERY_URL + "key=" + USER_KEY + "&location=" + cityCode;
String requestURL = queryURL + "key=" + userKey + "&location=" + cityCode;
//链接用
HttpURLConnection connection = null;

View File

@ -1,10 +0,0 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"java.configuration.updateBuildConfiguration": "automatic"
}
}