Compare commits
2 Commits
添加使用代理服务器功
...
main
Author | SHA1 | Date | |
---|---|---|---|
e05e7fec32 | |||
91cdd9ad1d |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.format.settings.url": "E:\\工作文档\\4、配置备份\\vscode\\eclipse-java-google-style.xml",
|
||||
"java.format.settings.url": "D:\\工作文档\\配置备份\\vscode\\eclipse-java-google-style.xml",
|
||||
"[java]": {
|
||||
"editor.detectIndentation": true
|
||||
}
|
||||
|
@@ -4,24 +4,10 @@
|
||||
"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",
|
||||
"query_interval": 10,
|
||||
"proxy_setting": {
|
||||
"enable": true,
|
||||
"proxy_mode": "http",
|
||||
"proxy_address": "172.16.39.2",
|
||||
"proxy_port": 18080
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_name": "厦门",
|
||||
"city_code": "101230201"
|
||||
},
|
||||
{
|
||||
"city_name": "同安",
|
||||
"city_code": "101230202"
|
||||
},
|
||||
{
|
||||
"city_name": "翔安",
|
||||
"city_code": "101230207"
|
||||
}
|
||||
],
|
||||
"notify_stuffs": [
|
||||
|
@@ -1,35 +0,0 @@
|
||||
<?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: com.oracle:ojdbc8:19.3.0.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" 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" />
|
||||
</component>
|
||||
</module>
|
@@ -1,343 +0,0 @@
|
||||
<?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="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="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="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: com.oracle:ojdbc8:19.3.0.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/oracle/ojdbc8/19.3.0.0.0/ojdbc8-19.3.0.0.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/oracle/ojdbc8/19.3.0.0.0/ojdbc8-19.3.0.0.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/oracle/ojdbc8/19.3.0.0.0/ojdbc8-19.3.0.0.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: commons-codec:commons-codec:1.11">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.11/commons-codec-1.11.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.11/commons-codec-1.11-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.11/commons-codec-1.11-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: commons-logging:commons-logging:1.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: junit:junit:4.13.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.2/junit-4.13.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.2/junit-4.13.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.2/junit-4.13.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: org.apache.httpcomponents:httpclient:4.5.13">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: org.apache.httpcomponents:httpcore:4.4.13">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
</project>
|
@@ -7,4 +7,4 @@ java.util.logging.FileHandler.pattern = ./logs/log_%u.log
|
||||
java.util.logging.FileHandler.limit = 50000
|
||||
java.util.logging.FileHandler.count = 1
|
||||
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
|
||||
java.util.logging.FileHandler.append = true
|
||||
java.util.logging.FileHandler.append = true;
|
||||
|
@@ -5,43 +5,85 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.cpic.xim</groupId>
|
||||
<artifactId>disaster_warning</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>19.3.0.0.0</version>
|
||||
<!-- <scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/ojdbc8.jar</systemPath> -->
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/ojdbc8.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
<version>5.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--jackson-->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.14.2</version>
|
||||
<!-- <dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.4</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
|
||||
<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.13.4</version>
|
||||
<version>2.18.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
|
||||
<!-- <dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.9.8</version>
|
||||
</dependency> -->
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.18.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.13.4</version>
|
||||
<version>2.18.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
|
@@ -1,9 +1,8 @@
|
||||
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 10:53:49
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-11-04 11:50:17
|
||||
* @LastEditTime: 2022-05-10 16:28:07
|
||||
* @FilePath: \DisasterWarning\src\main\java\AppMain.java
|
||||
* @Description: 和风天气预警推送厦门太保公众号主程序!
|
||||
*
|
||||
@@ -12,7 +11,6 @@
|
||||
import com.cpic.xim.config.AppConfigManager;
|
||||
import com.cpic.xim.config.City;
|
||||
import com.cpic.xim.notify.disaster.QWeatherDisasterWarning;
|
||||
import com.cpic.xim.notify.disaster.QWeatherDisasterWarningItem;
|
||||
import com.cpic.xim.notify.disaster.WeatherDisasterWarningGrabber;
|
||||
import com.cpic.xim.wechat.officalAccount.sendMessage;
|
||||
import com.cpic.xim.config.WeatherDisasterNotifyConfig;
|
||||
@@ -22,6 +20,7 @@ import java.sql.SQLException;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.*;
|
||||
|
||||
|
||||
public class AppMain
|
||||
{
|
||||
// private final static String LOG_FILE_PATH = "./logs/app%u.log";
|
||||
@@ -74,47 +73,30 @@ public class AppMain
|
||||
try
|
||||
{
|
||||
json = WeatherDisasterWarningGrabber.getWeatherDisasterWarningJSON( queryURL,
|
||||
userKey, city.getCityCode(), config.getProxySetting() );
|
||||
userKey, city.getCityCode() );
|
||||
warning = WeatherDisasterWarningGrabber.convertWeatherDisasterWarning( json );
|
||||
|
||||
logger.log( Level.INFO, "查询{0}天气预警,结果:{1}。", new Object[]
|
||||
{ city.getCityName(), json} );
|
||||
|
||||
Vector<QWeatherDisasterWarningItem> warningItems = warning.getWarning();
|
||||
|
||||
// 判断是否有警报,没有警报就结束当前城市的处理
|
||||
if ( warningItems.isEmpty() == true)
|
||||
// 判断是否有警报
|
||||
if ( warning.getWarning().isEmpty() == true)
|
||||
{
|
||||
logger.log( Level.INFO, "查询{0}天气预警,无警报!。", new Object[]
|
||||
{ city.getCityName()} );
|
||||
continue;
|
||||
}
|
||||
|
||||
// 有警报,就遍历警报数组
|
||||
for ( QWeatherDisasterWarningItem item : warningItems )
|
||||
{
|
||||
// 先检查是否已经发送过
|
||||
if ( sendMessage.checkWarningHasSended( item.getId() ) == false)
|
||||
{
|
||||
logger.log( Level.INFO, "查询{0}天气预警,ID:{1},已有发送记录,跳过。", new Object[]
|
||||
{ city.getCityName(), item.getId()} );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// 没有发送过
|
||||
logger.log( Level.INFO, "查询{0}天气预警,发送日志。", new Object[]
|
||||
{ city.getCityName()} );
|
||||
|
||||
sendMessage.sendWeatherDisasterWarning( config.getWechatOfficalAccountURL(),
|
||||
item );
|
||||
warning );
|
||||
|
||||
logger.log( Level.INFO, "{0}天气预警,日志发送成功。", new Object[]
|
||||
{ city.getCityName()} );
|
||||
|
||||
// 将发送的警报,保存起来
|
||||
sendMessage.saveWeatherDisasterWarning( city.getCityName(), item );
|
||||
}
|
||||
sendMessage.saveWeatherDisasterWarning( city.getCityName(), warning );
|
||||
}
|
||||
catch ( IOException error )
|
||||
{
|
||||
|
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-11-04 14:18:19
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-11-04 15:01:58
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\db\ProxySetting.java
|
||||
* @Description: 用于存放代理服务器设置的类。
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;;
|
||||
|
||||
/*****************************************************
|
||||
* 用于存放代理服务器设置的类。
|
||||
*****************************************************/
|
||||
public class ProxySetting
|
||||
{
|
||||
public ProxySetting()
|
||||
{}
|
||||
|
||||
public boolean isEnable()
|
||||
{
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable( boolean enable )
|
||||
{
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public String getProxyMode()
|
||||
{
|
||||
return proxyMode;
|
||||
}
|
||||
|
||||
public void setProxyMode( String proxyMode )
|
||||
{
|
||||
this.proxyMode = proxyMode;
|
||||
}
|
||||
|
||||
public String getProxyAddress()
|
||||
{
|
||||
return proxyAddress;
|
||||
}
|
||||
|
||||
public void setProxyAddress( String proxy_address )
|
||||
{
|
||||
this.proxyAddress = proxy_address;
|
||||
}
|
||||
|
||||
public int getProxyPort()
|
||||
{
|
||||
return proxyPort;
|
||||
}
|
||||
|
||||
public void setProxyPort( int proxy_port )
|
||||
{
|
||||
this.proxyPort = proxy_port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (enable ? 1231 : 1237);
|
||||
result = prime * result + ((proxyMode == null) ? 0 : proxyMode.hashCode());
|
||||
result = prime * result + ((proxyAddress == null) ? 0 : proxyAddress.hashCode());
|
||||
result = prime * result + proxyPort;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
if ( this == obj)
|
||||
return true;
|
||||
if ( obj == null)
|
||||
return false;
|
||||
if ( getClass() != obj.getClass())
|
||||
return false;
|
||||
ProxySetting other = (ProxySetting) obj;
|
||||
if ( enable != other.enable)
|
||||
return false;
|
||||
if ( proxyMode == null)
|
||||
{
|
||||
if ( other.proxyMode != null)
|
||||
return false;
|
||||
} else if ( !proxyMode.equals( other.proxyMode ))
|
||||
return false;
|
||||
if ( proxyAddress == null)
|
||||
{
|
||||
if ( other.proxyAddress != null)
|
||||
return false;
|
||||
} else if ( !proxyAddress.equals( other.proxyAddress ))
|
||||
return false;
|
||||
if ( proxyPort != other.proxyPort)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@JsonProperty( "enable")
|
||||
private boolean enable = true;
|
||||
|
||||
@JsonProperty( "proxy_mode")
|
||||
private String proxyMode = "http";
|
||||
|
||||
@JsonProperty( "proxy_address")
|
||||
private String proxyAddress;
|
||||
|
||||
@JsonProperty( "proxy_port")
|
||||
private int proxyPort;
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-24 10:21:46
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-11-04 15:03:05
|
||||
* @LastEditTime: 2022-05-10 16:16:28
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\WeatherDisasterNotifyConfig.java
|
||||
* @Description:
|
||||
*
|
||||
@@ -11,6 +11,7 @@
|
||||
package com.cpic.xim.config;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@@ -66,15 +67,6 @@ public class WeatherDisasterNotifyConfig
|
||||
this.queryInterval = queryInterval;
|
||||
}
|
||||
|
||||
public ProxySetting getProxySetting()
|
||||
{
|
||||
return proxySetting;
|
||||
}
|
||||
|
||||
public void setProxySetting( ProxySetting proxySetting )
|
||||
{
|
||||
this.proxySetting = proxySetting;
|
||||
}
|
||||
|
||||
public void setCities( Vector<City> cities )
|
||||
{
|
||||
@@ -113,9 +105,6 @@ public class WeatherDisasterNotifyConfig
|
||||
@JsonProperty( "query_interval")
|
||||
private int queryInterval;
|
||||
|
||||
@JsonProperty( "proxy_setting")
|
||||
private ProxySetting proxySetting;
|
||||
|
||||
@JsonProperty( "wechat_officalaccount_url")
|
||||
private String wechatOfficalAccountURL;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-25 21:45:12
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-11-04 14:51:25
|
||||
* @LastEditTime: 2022-05-03 22:34:37
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\db\OracleConfigManager.java
|
||||
* @Description: oracle数据库配置文件加载类
|
||||
*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 09:54:05
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-11-04 11:48:28
|
||||
* @LastEditTime: 2022-04-22 16:18:17
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\httpUtil\HttpUtils.java
|
||||
* @Description: http相关的工具类。
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
@@ -22,71 +22,85 @@ import java.nio.charset.StandardCharsets;
|
||||
/**
|
||||
* Http相关的工具类。
|
||||
*/
|
||||
public class HttpUtils {
|
||||
public class HttpUtils
|
||||
{
|
||||
/**
|
||||
* 以POST方式发送http请求!
|
||||
*
|
||||
* @param url 访问的链接字符串
|
||||
* @param headers 请求头部参数集合
|
||||
* @param params 请求体字符串
|
||||
*/
|
||||
public static String postHttpRequest(String url, HashMap<String, String> headers,
|
||||
String param) throws MalformedURLException {
|
||||
public static String postHttpRequest( String url, HashMap<String, String> headers,
|
||||
String param ) throws MalformedURLException
|
||||
{
|
||||
URL httpURL = null;
|
||||
HttpURLConnection conn = null;
|
||||
OutputStreamWriter out = null;
|
||||
BufferedReader in = null;
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
// 获取connection
|
||||
httpURL = new URL(url);
|
||||
httpURL = new URL( url );
|
||||
conn = (HttpURLConnection) httpURL.openConnection();
|
||||
|
||||
// 设置请求方式
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestMethod( "POST" );
|
||||
|
||||
// 设置请求头参数
|
||||
for (HashMap.Entry<String, String> head : headers.entrySet()) {
|
||||
conn.setRequestProperty(head.getKey(), head.getValue());
|
||||
for ( HashMap.Entry<String, String> head : headers.entrySet())
|
||||
{
|
||||
conn.setRequestProperty( head.getKey(), head.getValue() );
|
||||
}
|
||||
|
||||
// 连接
|
||||
conn.setDoInput(true);
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput( true );
|
||||
conn.setDoOutput( true );
|
||||
conn.connect();
|
||||
|
||||
// 输出请求
|
||||
out = new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8);
|
||||
out.write(param);
|
||||
out = new OutputStreamWriter( conn.getOutputStream(), StandardCharsets.UTF_8 );
|
||||
out.write( param );
|
||||
out.flush();
|
||||
|
||||
// 读取返回值。
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
in = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
|
||||
|
||||
String line = in.readLine();
|
||||
|
||||
while (line != null) {
|
||||
result.append(line);
|
||||
while (line != null)
|
||||
{
|
||||
result.append( line );
|
||||
|
||||
line = in.readLine();
|
||||
}
|
||||
} catch (IOException error) {
|
||||
}
|
||||
catch (IOException error)
|
||||
{
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( out != null)
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
|
||||
if (in != null) {
|
||||
if ( in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
|
||||
if (conn != null) {
|
||||
if ( conn != null)
|
||||
{
|
||||
conn.disconnect();
|
||||
}
|
||||
} catch (Exception error) {
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ public class QWeatherDisasterWarning
|
||||
private String code;
|
||||
|
||||
@JsonProperty( "updateTime")
|
||||
@JsonFormat( pattern = "yyyy-MM-dd'T'HH:mmXXX")
|
||||
@JsonFormat( pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
||||
private Date updateTime;
|
||||
|
||||
@JsonProperty( "fxLink")
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.cpic.xim.notify.disaster;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@@ -11,6 +12,52 @@ public class QWeatherDisasterWarningItem
|
||||
public QWeatherDisasterWarningItem()
|
||||
{}
|
||||
|
||||
public QWeatherDisasterWarningItem( String id, String sender, Date 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;
|
||||
@@ -51,26 +98,6 @@ public class QWeatherDisasterWarningItem
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Date getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime( Date startTime )
|
||||
{
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime()
|
||||
{
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime( Date endTime )
|
||||
{
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
@@ -91,26 +118,6 @@ public class QWeatherDisasterWarningItem
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getSeverity()
|
||||
{
|
||||
return severity;
|
||||
}
|
||||
|
||||
public void setSeverity( String severity )
|
||||
{
|
||||
this.severity = severity;
|
||||
}
|
||||
|
||||
public String getSeverityColor()
|
||||
{
|
||||
return severityColor;
|
||||
}
|
||||
|
||||
public void setSeverityColor( String severityColor )
|
||||
{
|
||||
this.severityColor = severityColor;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
@@ -171,187 +178,20 @@ public class QWeatherDisasterWarningItem
|
||||
this.certainty = certainty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
result = prime * result + ((sender == null) ? 0 : sender.hashCode());
|
||||
result = prime * result + ((pubTime == null) ? 0 : pubTime.hashCode());
|
||||
result = prime * result + ((title == null) ? 0 : title.hashCode());
|
||||
result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
|
||||
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
|
||||
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||
result = prime * result + ((level == null) ? 0 : level.hashCode());
|
||||
result = prime * result + ((severity == null) ? 0 : severity.hashCode());
|
||||
result = prime * result + ((severityColor == null) ? 0 : severityColor.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
|
||||
result = prime * result + ((text == null) ? 0 : text.hashCode());
|
||||
result = prime * result + ((related == null) ? 0 : related.hashCode());
|
||||
result = prime * result + ((urgency == null) ? 0 : urgency.hashCode());
|
||||
result = prime * result + ((certainty == null) ? 0 : certainty.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
if ( this == obj)
|
||||
return true;
|
||||
if ( obj == null)
|
||||
return false;
|
||||
if ( getClass() != obj.getClass())
|
||||
return false;
|
||||
QWeatherDisasterWarningItem other = (QWeatherDisasterWarningItem) obj;
|
||||
if ( id == null)
|
||||
{
|
||||
if ( other.id != null)
|
||||
return false;
|
||||
} else if ( !id.equals( other.id ))
|
||||
return false;
|
||||
if ( sender == null)
|
||||
{
|
||||
if ( other.sender != null)
|
||||
return false;
|
||||
} else if ( !sender.equals( other.sender ))
|
||||
return false;
|
||||
if ( pubTime == null)
|
||||
{
|
||||
if ( other.pubTime != null)
|
||||
return false;
|
||||
} else if ( !pubTime.equals( other.pubTime ))
|
||||
return false;
|
||||
if ( title == null)
|
||||
{
|
||||
if ( other.title != null)
|
||||
return false;
|
||||
} else if ( !title.equals( other.title ))
|
||||
return false;
|
||||
if ( startTime == null)
|
||||
{
|
||||
if ( other.startTime != null)
|
||||
return false;
|
||||
} else if ( !startTime.equals( other.startTime ))
|
||||
return false;
|
||||
if ( endTime == null)
|
||||
{
|
||||
if ( other.endTime != null)
|
||||
return false;
|
||||
} else if ( !endTime.equals( other.endTime ))
|
||||
return false;
|
||||
if ( status == null)
|
||||
{
|
||||
if ( other.status != null)
|
||||
return false;
|
||||
} else if ( !status.equals( other.status ))
|
||||
return false;
|
||||
if ( level == null)
|
||||
{
|
||||
if ( other.level != null)
|
||||
return false;
|
||||
} else if ( !level.equals( other.level ))
|
||||
return false;
|
||||
if ( severity == null)
|
||||
{
|
||||
if ( other.severity != null)
|
||||
return false;
|
||||
} else if ( !severity.equals( other.severity ))
|
||||
return false;
|
||||
if ( severityColor == null)
|
||||
{
|
||||
if ( other.severityColor != null)
|
||||
return false;
|
||||
} else if ( !severityColor.equals( other.severityColor ))
|
||||
return false;
|
||||
if ( type == null)
|
||||
{
|
||||
if ( other.type != null)
|
||||
return false;
|
||||
} else if ( !type.equals( other.type ))
|
||||
return false;
|
||||
if ( typeName == null)
|
||||
{
|
||||
if ( other.typeName != null)
|
||||
return false;
|
||||
} else if ( !typeName.equals( other.typeName ))
|
||||
return false;
|
||||
if ( text == null)
|
||||
{
|
||||
if ( other.text != null)
|
||||
return false;
|
||||
} else if ( !text.equals( other.text ))
|
||||
return false;
|
||||
if ( related == null)
|
||||
{
|
||||
if ( other.related != null)
|
||||
return false;
|
||||
} else if ( !related.equals( other.related ))
|
||||
return false;
|
||||
if ( urgency == null)
|
||||
{
|
||||
if ( other.urgency != null)
|
||||
return false;
|
||||
} else if ( !urgency.equals( other.urgency ))
|
||||
return false;
|
||||
if ( certainty == null)
|
||||
{
|
||||
if ( other.certainty != null)
|
||||
return false;
|
||||
} else if ( !certainty.equals( other.certainty ))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@JsonProperty( "id")
|
||||
private String id;
|
||||
|
||||
@JsonProperty( "sender")
|
||||
private String sender;
|
||||
|
||||
@JsonProperty( "pubTime")
|
||||
@JsonFormat( shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
||||
private Date pubTime;
|
||||
|
||||
@JsonProperty( "title")
|
||||
private String title;
|
||||
|
||||
@JsonProperty( "startTime")
|
||||
@JsonFormat( shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
||||
private Date startTime;
|
||||
|
||||
@JsonProperty( "endTime")
|
||||
@JsonFormat( shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
||||
private Date endTime;
|
||||
|
||||
@JsonProperty( "status")
|
||||
private String status;
|
||||
|
||||
@JsonProperty( "level")
|
||||
private String level;
|
||||
|
||||
@JsonProperty( "severity")
|
||||
private String severity;
|
||||
|
||||
@JsonProperty( "severityColor")
|
||||
private String severityColor;
|
||||
|
||||
@JsonProperty( "type")
|
||||
private String type;
|
||||
|
||||
@JsonProperty( "typeName")
|
||||
private String typeName;
|
||||
|
||||
@JsonProperty( "text")
|
||||
private String text;
|
||||
|
||||
@JsonProperty( "related")
|
||||
private String related;
|
||||
|
||||
@JsonProperty( "urgency")
|
||||
private String urgency;
|
||||
|
||||
@JsonProperty( "certainty")
|
||||
private String certainty;
|
||||
}
|
||||
|
@@ -4,18 +4,17 @@
|
||||
*/
|
||||
package com.cpic.xim.notify.disaster;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.io.BufferedReader;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import com.cpic.xim.config.ProxySetting;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -24,18 +23,18 @@ public class WeatherDisasterWarningGrabber
|
||||
{
|
||||
/***
|
||||
* 从和风天气获取天气警报json字符串
|
||||
*
|
||||
* @param cityCode 城市或区域代码
|
||||
* @return 返回警报的json字符串
|
||||
*/
|
||||
public static String getWeatherDisasterWarningJSON( String queryURL, String userKey,
|
||||
String cityCode, ProxySetting proxySetting )
|
||||
public static String getWeatherDisasterWarningJSON( String queryURL,
|
||||
String userKey,
|
||||
String cityCode )
|
||||
{
|
||||
// 拼接url字符串
|
||||
//拼接url字符串
|
||||
String json = "";
|
||||
String requestURL = queryURL + "key=" + userKey + "&location=" + cityCode;
|
||||
|
||||
// 链接用
|
||||
//链接用
|
||||
HttpURLConnection connection = null;
|
||||
URL url = null;
|
||||
InputStream inputStream = null;
|
||||
@@ -45,37 +44,24 @@ public class WeatherDisasterWarningGrabber
|
||||
try
|
||||
{
|
||||
url = new URL( requestURL );
|
||||
|
||||
// 是否要用代理服务器
|
||||
if ( proxySetting.isEnable())
|
||||
{
|
||||
InetSocketAddress proxyAddress = new InetSocketAddress(
|
||||
proxySetting.getProxyAddress(), proxySetting.getProxyPort() );
|
||||
Proxy proxy = new Proxy( Proxy.Type.HTTP, proxyAddress );
|
||||
|
||||
connection = (HttpURLConnection) url.openConnection( proxy );
|
||||
} else
|
||||
{
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
}
|
||||
|
||||
connection.setRequestMethod( "GET" );
|
||||
connection.setConnectTimeout( 15000 );
|
||||
connection.setReadTimeout( 60000 );
|
||||
connection.connect();
|
||||
|
||||
// 如果responseCode为200,说明访问成功!
|
||||
if ( connection.getResponseCode() == 200)
|
||||
//如果responseCode为200,说明访问成功!
|
||||
if ( connection.getResponseCode() == 200 )
|
||||
{
|
||||
// 注意,和风使用了gzip压缩响应体
|
||||
//注意,和风使用了gzip压缩响应体
|
||||
inputStream = new GZIPInputStream( connection.getInputStream() );
|
||||
bufferedReader =
|
||||
new BufferedReader( new InputStreamReader( inputStream, "UTF-8" ) );
|
||||
bufferedReader = new BufferedReader( new InputStreamReader( inputStream, "UTF-8" ) );
|
||||
|
||||
// 读出数据
|
||||
//读出数据
|
||||
String temp = bufferedReader.readLine();
|
||||
|
||||
while (temp != null)
|
||||
while ( temp != null )
|
||||
{
|
||||
buffer.append( temp );
|
||||
|
||||
@@ -95,7 +81,7 @@ public class WeatherDisasterWarningGrabber
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( bufferedReader != null)
|
||||
if ( bufferedReader != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -107,7 +93,7 @@ public class WeatherDisasterWarningGrabber
|
||||
}
|
||||
}
|
||||
|
||||
if ( inputStream != null)
|
||||
if ( inputStream != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -119,7 +105,7 @@ public class WeatherDisasterWarningGrabber
|
||||
}
|
||||
}
|
||||
|
||||
if ( connection != null)
|
||||
if ( connection != null )
|
||||
{
|
||||
connection.disconnect();
|
||||
}
|
||||
@@ -130,7 +116,6 @@ public class WeatherDisasterWarningGrabber
|
||||
|
||||
/**
|
||||
* 将天气警告的json字符串转换成java对象。
|
||||
*
|
||||
* @param json json字符串
|
||||
* @return 返回 QWeatherDisasterWarning 对象。
|
||||
* @throws IOException
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 10:53:49
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-12-16 15:51:36
|
||||
* @LastEditTime: 2022-05-06 11:14:32
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\wechat\officalAccount\sendMessage.java
|
||||
* @Description: 用来推送公众号消息的程序库。
|
||||
*
|
||||
@@ -14,17 +14,16 @@ import com.cpic.xim.config.db.OracleConfigManager;
|
||||
import com.cpic.xim.config.db.OracleConfig;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.cpic.xim.notify.disaster.*;
|
||||
import com.cpic.xim.httpUtil.HttpUtils;
|
||||
|
||||
@@ -37,17 +36,16 @@ public class sendMessage
|
||||
{
|
||||
private static HashMap<String, String> warningLevel;
|
||||
|
||||
/*****************************************************
|
||||
/**
|
||||
* 推送天气灾害预警!接口文档参考 彭奕洁 编写《消息发送接口调用文档》
|
||||
* 使用 post 方式,请求体内容以最基础的 post 格式。
|
||||
*
|
||||
* @param officalAccountURL 产险厦门分公司公众号接口网址
|
||||
* @param warningItem 灾害预警对象
|
||||
*****************************************************/
|
||||
* @param warning 灾害预警对象
|
||||
*/
|
||||
public static void sendWeatherDisasterWarning( String officalAccountURL,
|
||||
QWeatherDisasterWarningItem warningItem )
|
||||
QWeatherDisasterWarning warning )
|
||||
{
|
||||
// Vector<QWeatherDisasterWarningItem> warningItems = warningItem.getWarning();
|
||||
Vector<QWeatherDisasterWarningItem> warningItems = warning.getWarning();
|
||||
StringBuilder requestBody = null;
|
||||
|
||||
// 设置请求头参数
|
||||
@@ -58,12 +56,13 @@ public class sendMessage
|
||||
headers.put( "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8" );
|
||||
|
||||
// 遍历消息,将消息推送出去。
|
||||
|
||||
for ( QWeatherDisasterWarningItem item : warningItems )
|
||||
{
|
||||
// 拼接消息内容
|
||||
String title = warningItem.getTitle();
|
||||
String text = warningItem.getText();
|
||||
String color = warningLevel.containsKey( warningItem.getLevel() )
|
||||
? warningLevel.get( warningItem.getLevel() )
|
||||
String title = item.getTitle();
|
||||
String text = item.getText();
|
||||
String color = warningLevel.keySet().contains( item.getLevel() )
|
||||
? warningLevel.get( item.getLevel() )
|
||||
: "#000000";
|
||||
requestBody = new StringBuilder();
|
||||
|
||||
@@ -80,14 +79,13 @@ public class sendMessage
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查预警是否已经推送过,通过 QWeatherDisasterWarningItem 对象的 id 属性。
|
||||
* 查询 oracle xmcx1 数据库 wechat 表空间下 weather_disaster_notify 表,
|
||||
* 统计 warningID 的数量,如果不为0,说明该预警已经保存过,视为已经推送过。
|
||||
*
|
||||
* @param warningID 预警的id
|
||||
* @return 如果推送过,返回false,否则返回 true。
|
||||
*/
|
||||
@@ -96,7 +94,7 @@ public class sendMessage
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
|
||||
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();;
|
||||
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
@@ -170,24 +168,21 @@ public class sendMessage
|
||||
* 保存天气预警警报数据。
|
||||
* 保存至 oracle xmcx1 数据库 wechat 表空间下 weather_disaster_notify 表。
|
||||
* 保存的数据用来判断预警是否已经推送过,以防止反复推送数据。
|
||||
*
|
||||
* @param city 城市名称
|
||||
* @param warning 预警数据,为 QWeatherDisasterWarningItem 对象。
|
||||
* @throws SQLException 执行sql时可能抛出的异常。出现sql异常,就回滚事务。
|
||||
* @throws IOException 读取数据库配置文件时可能抛出的异常。
|
||||
* @throws ClassNotFoundException 加载oracle jdbc驱动时可能抛出的异常。
|
||||
*/
|
||||
public static void saveWeatherDisasterWarning( String city,
|
||||
QWeatherDisasterWarningItem warning )
|
||||
public static void saveWeatherDisasterWarning( String city, QWeatherDisasterWarning warnings )
|
||||
throws SQLException, IOException, ClassNotFoundException
|
||||
{
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
|
||||
String sql = new StringBuilder()
|
||||
.append( "insert into weather_disaster_notify(notify_id, sender, city," )
|
||||
.append( "warning_level, warning_type_code, warning_type_name, title," )
|
||||
.append( "text, pub_time) values( ?,?,?,?,?,?,?,?,?)" ).toString();
|
||||
String sql = "insert into weather_disaster_notify(notify_id, sender, city,"
|
||||
+ "warning_level, warning_type_code, warning_type_name, title,"
|
||||
+ "text, pub_time) values( ?,?,?,?,?,?,?,?,?)";
|
||||
|
||||
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
|
||||
|
||||
@@ -202,9 +197,10 @@ public class sendMessage
|
||||
conn = DriverManager.getConnection( jdbcURL, userName, password );
|
||||
stmt = conn.prepareStatement( sql );
|
||||
|
||||
conn.setAutoCommit( false );
|
||||
|
||||
java.sql.Timestamp pubTime = new java.sql.Timestamp( warning.getPubTime().getTime() );
|
||||
for ( QWeatherDisasterWarningItem warning : warnings.getWarning() )
|
||||
{
|
||||
java.sql.Timestamp pubTime =
|
||||
new java.sql.Timestamp( warning.getPubTime().getTime() );
|
||||
|
||||
stmt.setString( 1, warning.getId() );
|
||||
stmt.setString( 2, warning.getSender() );
|
||||
@@ -217,6 +213,7 @@ public class sendMessage
|
||||
stmt.setTimestamp( 9, pubTime );
|
||||
|
||||
stmt.execute();
|
||||
}
|
||||
|
||||
// 没有问题就提交
|
||||
conn.commit();
|
||||
@@ -259,6 +256,7 @@ public class sendMessage
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
// 预警级别色彩
|
||||
|
@@ -2,8 +2,8 @@
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 10:53:49
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2023-05-15 21:03:21
|
||||
* @FilePath: /DisasterWarning/src/test/java/com/cpic/xim/wechat/officalAccount/sendMessageTest.java
|
||||
* @LastEditTime: 2022-05-10 11:33:41
|
||||
* @FilePath: \DisasterWarning\src\test\java\com\cpic\xim\wechat\officalAccount\sendMessageTest.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
@@ -17,7 +17,7 @@ import com.cpic.xim.httpUtil.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class sendMessageTest
|
||||
@@ -25,7 +25,7 @@ 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
|
||||
// @Test
|
||||
public void postNotifyMessageJson()
|
||||
{
|
||||
try
|
||||
@@ -75,7 +75,7 @@ public class sendMessageTest
|
||||
String city = "东山县";
|
||||
|
||||
|
||||
// sendMessage.saveWeatherDisasterWarning( city, warning );
|
||||
sendMessage.saveWeatherDisasterWarning( city, warning );
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
@@ -83,7 +83,7 @@ public class sendMessageTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
public void testCheckWarningHasSended()
|
||||
{
|
||||
String warningID = "10123060820220422061200476313081";
|
||||
|
@@ -8,14 +8,6 @@
|
||||
{
|
||||
"city_name": "厦门",
|
||||
"city_code": "101230201"
|
||||
},
|
||||
{
|
||||
"city_name": "同安",
|
||||
"city_code": "101230202"
|
||||
},
|
||||
{
|
||||
"city_name": "翔安",
|
||||
"city_code": "101230207"
|
||||
}
|
||||
],
|
||||
"notify_stuffs": [
|
||||
|
@@ -1,2 +0,0 @@
|
||||
java -jar disaster_warning-1.0-SNAPSHOT-jar-with-dependencies.jar
|
||||
pause
|
@@ -19,5 +19,5 @@
|
||||
}
|
||||
],
|
||||
"refer": { "sources": ["12379"], "license": ["no commercial use"] },
|
||||
"testURL": "https://devapi.qweather.com/v7/warning/now?key=fe9fa8eeeb6f4301a92541eed565dd15&location=101230201"
|
||||
"testURL": "https://devapi.qweather.com/v7/warning/now?key=fe9fa8eeeb6f4301a92541eed565dd15&location=101230608"
|
||||
}
|
||||
|
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"code": "200",
|
||||
"updateTime": "2022-11-04T15:18+08:00",
|
||||
"fxLink": "http://hfx.link/3565",
|
||||
"warning": [
|
||||
{
|
||||
"id": "10123020120221104060100024343791",
|
||||
"sender": "厦门市气象台",
|
||||
"pubTime": "2022-11-04T06:01+08:00",
|
||||
"title": "厦门市气象台发布大风黄色预警[Ⅲ级/较重]",
|
||||
"startTime": "2022-11-04T06:09+08:00",
|
||||
"endTime": "2022-11-05T06:09+08:00",
|
||||
"status": "active",
|
||||
"level": "黄色",
|
||||
"severity": "Moderate",
|
||||
"severityColor": "Yellow",
|
||||
"type": "1006",
|
||||
"typeName": "大风",
|
||||
"urgency": "",
|
||||
"certainty": "",
|
||||
"text": "厦门市气象台2022年11月04日06时01分发布大风黄色预警信号:受冷空气影响,未来12小时思明区、湖里区、集美区、海沧区及海上风力逐渐增强,预计厦门市区东北风最大可达5~6级、阵风7~8级;厦门内海及各大桥、高海拔山区最大可达6~7级、阵风8~9级;崇武到东山沿海最大可达7~8级、阵风9级;台湾海峡南部最大可达7~8级、阵风9~10级。请注意防范。同安区、翔安区请关注属地的预警信号发布情况。",
|
||||
"related": ""
|
||||
}
|
||||
],
|
||||
"refer": { "sources": ["12379"], "license": ["no commercial use"] }
|
||||
}
|
Reference in New Issue
Block a user