Compare commits
67 Commits
6579c08e5f
...
develop
Author | SHA1 | Date | |
---|---|---|---|
3b1844c994 | |||
db8f9e9c05 | |||
4c0cb3c76e | |||
65431a0f0e | |||
cd8bcb8ba0 | |||
e800558a32 | |||
b993638e5b | |||
6671cb69c9 | |||
7abeffb61a | |||
54d73db62f | |||
8149e21e2f | |||
2847747f53 | |||
1231fe3132 | |||
fbe9f8e532 | |||
53849e4f74 | |||
d1bcb3b956 | |||
c0443d3a8b | |||
eb7f53ad4b | |||
91c99ba8f9 | |||
0fb8b90509 | |||
cd743c645f | |||
2d1d4dea66 | |||
24cdc66b7d | |||
5da53f02ea | |||
0587001de0 | |||
64170d2e67 | |||
51a2829433 | |||
59977ec9b6 | |||
9d57987f0c | |||
a78fad18ea | |||
07ae9f88a3 | |||
2dbe40b7a8 | |||
5496c06eea | |||
70884ab305 | |||
69434b3b58 | |||
1e8e58d3de | |||
9c1f141a00 | |||
f1c1d5a4a5 | |||
116b4a0f12 | |||
021b20876f | |||
2237690139 | |||
16c54998de | |||
9857451f05 | |||
ae7b2127bc | |||
17b8d4dde6 | |||
130f237af2 | |||
216c6926ac | |||
cb8563ce5c | |||
d23826e056 | |||
3dda8252f6 | |||
2202972510 | |||
7a9c55930e | |||
bc3b9b044f | |||
95b3ad8f1b | |||
4e1ca52d2f | |||
050edac28a | |||
83e73cfe60 | |||
f95d8ed08b | |||
b184846ea4 | |||
74a69767a2 | |||
4fae3cbd8e | |||
9f593e6787 | |||
94f5262402 | |||
3d302919de | |||
566809868a | |||
e5be1e0b66 | |||
5672c83a71 |
99
.gitignore
vendored
99
.gitignore
vendored
@@ -1,3 +1,102 @@
|
||||
|
||||
target/*
|
||||
*.jar
|
||||
|
||||
# ---> C++
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# ---> CMake
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
|
||||
# ---> Java
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
# ---> Maven
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
# Eclipse m2e generated files
|
||||
# Eclipse Core
|
||||
.project
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
code/java/天气灾害预警/target/
|
||||
code/java/天气灾害预警/out/
|
||||
*.jar
|
||||
*.iws
|
||||
*.log
|
||||
*.lck
|
||||
|
92
README.md
92
README.md
@@ -1,92 +1,8 @@
|
||||
# 大灾预警
|
||||
|
||||
大灾预警数据抓取。
|
||||
|
||||
## Getting started
|
||||
<h1 style="text-align:center;font-size:4rem;" title>气象灾害预警推送应用</h1>
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
**功能:**
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
|
||||
## Add your files
|
||||
|
||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin http://cppdisciple.f3322.org:65310/cpicxm/disaster-warning.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
|
||||
- [ ] [Set up project integrations](http://cppdisciple.f3322.org:65310/cpicxm/disaster-warning/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
## Project status
|
||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||
- 从和风天气查询配置文件中列出地区的气象灾害预警;
|
||||
- 如果预警则推送厦门太保公众。
|
||||
|
8
code/java/.idea/.gitignore
generated
vendored
8
code/java/.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
16
code/java/.idea/compiler.xml
generated
16
code/java/.idea/compiler.xml
generated
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<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="天气灾害预警" target="17" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
25
code/java/.idea/disaster_warning.iml
generated
25
code/java/.idea/disaster_warning.iml
generated
@@ -1,25 +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" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<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" />
|
||||
</component>
|
||||
</module>
|
7
code/java/.idea/encodings.xml
generated
7
code/java/.idea/encodings.xml
generated
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
25
code/java/.idea/jarRepositories.xml
generated
25
code/java/.idea/jarRepositories.xml
generated
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<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>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
14
code/java/.idea/misc.xml
generated
14
code/java/.idea/misc.xml
generated
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
29
code/java/.idea/runConfigurations/compile.xml
generated
29
code/java/.idea/runConfigurations/compile.xml
generated
@@ -1,29 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="compile" type="MavenRunConfiguration" factoryName="Maven">
|
||||
<MavenSettings>
|
||||
<option name="myGeneralSettings" />
|
||||
<option name="myRunnerSettings" />
|
||||
<option name="myRunnerParameters">
|
||||
<MavenRunnerParameters>
|
||||
<option name="profiles">
|
||||
<set />
|
||||
</option>
|
||||
<option name="goals">
|
||||
<list>
|
||||
<option value="compile" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="pomFileName" />
|
||||
<option name="profilesMap">
|
||||
<map>
|
||||
<entry key="dev" value="true" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="resolveToWorkspace" value="false" />
|
||||
<option name="workingDirPath" value="$PROJECT_DIR$" />
|
||||
</MavenRunnerParameters>
|
||||
</option>
|
||||
</MavenSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
124
code/java/.idea/uiDesigner.xml
generated
124
code/java/.idea/uiDesigner.xml
generated
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<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>
|
||||
</project>
|
6
code/java/.idea/vcs.xml
generated
6
code/java/.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
147
code/java/.idea/天气灾害预警.xml
generated
147
code/java/.idea/天气灾害预警.xml
generated
@@ -1,147 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e81b1d7b-ad5e-432e-bbb6-6fbbb75430af" 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 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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</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>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="localRepository" value="$PROJECT_DIR$/../../../../../../DevTools/maven/Repository" />
|
||||
<option name="mavenHome" value="$PROJECT_DIR$/../../../../../../DevTools/maven/apache-maven-3.8.5" />
|
||||
<option name="useMavenConfig" value="true" />
|
||||
<option name="userSettingsFile" value="D:\DevTools\maven\apache-maven-3.8.5\conf\settings.xml" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="MavenRunner">
|
||||
<option name="delegateBuildToMaven" value="true" />
|
||||
<option name="jreName" value="1.8" />
|
||||
</component>
|
||||
<component name="ProblemsViewState">
|
||||
<option name="selectedTabId" value="ProjectErrors" />
|
||||
</component>
|
||||
<component name="ProjectId" id="26PXzlujlRW5evopBaaKpyGjycC" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||
<ConfirmationsSetting value="1" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<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" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.2" />
|
||||
<property name="settings.editor.selected.configurable" value="MavenSettings" />
|
||||
</component>
|
||||
<component name="RunAnythingCache">
|
||||
<option name="myCommands">
|
||||
<command value="idea:idea -U" />
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Maven.compile">
|
||||
<configuration name="AppMain" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="AppMain" />
|
||||
<module name="disaster_warning" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="JetRunConfigurationType">
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType">
|
||||
<option name="filePath" />
|
||||
<method v="2">
|
||||
<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="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="e81b1d7b-ad5e-432e-bbb6-6fbbb75430af" name="Changes" comment="" />
|
||||
<created>1647326463353</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1647326463353</updated>
|
||||
<workItem from="1647326471822" duration="6934000" />
|
||||
<workItem from="1647334567225" duration="1649000" />
|
||||
<workItem from="1647338154313" duration="98000" />
|
||||
<workItem from="1647398025447" duration="1714000" />
|
||||
<workItem from="1647399779588" duration="4127000" />
|
||||
<workItem from="1647408946144" duration="1177000" />
|
||||
<workItem from="1647410156413" duration="10520000" />
|
||||
<workItem from="1647479250349" duration="12253000" />
|
||||
<workItem from="1647531294555" duration="2501000" />
|
||||
<workItem from="1647534118478" duration="613000" />
|
||||
<workItem from="1647535499626" duration="591000" />
|
||||
<workItem from="1647536147299" duration="30000" />
|
||||
<workItem from="1647536420955" duration="167000" />
|
||||
<workItem from="1647536652740" duration="1720000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<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="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
</project>
|
139
code/java/DisasterWarning/.gitignore
vendored
Normal file
139
code/java/DisasterWarning/.gitignore
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
### Java template
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
### VisualStudioCode template
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### Windows template
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
target/*
|
||||
|
||||
logs/*
|
||||
logs
|
15
code/java/DisasterWarning/.vscode/launch.json
vendored
Normal file
15
code/java/DisasterWarning/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
// 使用 IntelliSense 了解相关属性。
|
||||
// 悬停以查看现有属性的描述。
|
||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch AppMain",
|
||||
"request": "launch",
|
||||
"mainClass": "AppMain",
|
||||
"projectName": "disaster_warning"
|
||||
}
|
||||
]
|
||||
}
|
7
code/java/DisasterWarning/.vscode/settings.json
vendored
Normal file
7
code/java/DisasterWarning/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.format.settings.url": "D:\\工作文档\\配置备份\\vscode\\eclipse-java-google-style.xml",
|
||||
"[java]": {
|
||||
"editor.detectIndentation": true
|
||||
}
|
||||
}
|
@@ -2,6 +2,8 @@
|
||||
"title": "天气灾害预警配置文件",
|
||||
"key": "fe9fa8eeeb6f4301a92541eed565dd15",
|
||||
"query_url": "https://devapi.qweather.com/v7/warning/now?",
|
||||
"wechat_officalaccount_url": "https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage",
|
||||
"query_interval": 10,
|
||||
"cities": [
|
||||
{
|
||||
"city_name": "厦门",
|
||||
@@ -11,22 +13,6 @@
|
||||
"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"
|
14
code/java/DisasterWarning/db.json
Normal file
14
code/java/DisasterWarning/db.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"tns_name": "xmcx1",
|
||||
"ip_addr": "10.39.0.86",
|
||||
"jdbc_url": "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1",
|
||||
"table_space": "wechat",
|
||||
"user_name": "wechat",
|
||||
"password": "@rn7Q+t5zeyKIZ~s",
|
||||
"tables": [
|
||||
{
|
||||
"table_name": "weather_disaster_notify",
|
||||
"table_description": "天气预警消息表"
|
||||
}
|
||||
]
|
||||
}
|
@@ -11,26 +11,25 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<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 name="Maven: com.oracle:ojdbc8:12.2.0.1">
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="JUnit4">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/ojdbc8.jar!/" />
|
||||
<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>
|
@@ -20,6 +20,11 @@
|
||||
<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" />
|
||||
@@ -37,6 +42,15 @@
|
||||
</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>
|
||||
@@ -211,6 +225,11 @@
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
<component name="SwUserDefinedSpecifications">
|
||||
<option name="specTypeByUrl">
|
||||
<map />
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
@@ -248,103 +267,81 @@
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: commons-beanutils:commons-beanutils:1.9.3">
|
||||
<library name="Maven: com.oracle:ojdbc8:19.3.0.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar!/" />
|
||||
<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$/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3-javadoc.jar!/" />
|
||||
<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$/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3-sources.jar!/" />
|
||||
<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.9">
|
||||
<library name="Maven: commons-codec:commons-codec:1.11">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.9/commons-codec-1.9.jar!/" />
|
||||
<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.9/commons-codec-1.9-javadoc.jar!/" />
|
||||
<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.9/commons-codec-1.9-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.11/commons-codec-1.11-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: commons-collections:commons-collections:3.2.1">
|
||||
<library name="Maven: commons-logging:commons-logging:1.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-javadoc.jar!/" />
|
||||
<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-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: commons-lang:commons-lang:2.6">
|
||||
<library name="Maven: junit:junit:4.13.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.2/junit-4.13.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.2/junit-4.13.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.2/junit-4.13.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: commons-logging:commons-logging:1.1.1">
|
||||
<library name="Maven: org.apache.httpcomponents:httpclient:4.5.13">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-javadoc.jar!/" />
|
||||
<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$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: net.sf.ezmorph:ezmorph:1.0.6">
|
||||
<library name="Maven: org.apache.httpcomponents:httpcore:4.4.13">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6-javadoc.jar!/" />
|
||||
<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$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: net.sf.json-lib:json-lib:jdk15:2.4">
|
||||
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: org.apache.httpcomponents:httpclient:4.5.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<library name="Maven: org.apache.httpcomponents:httpcore:4.4.4">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
10
code/java/DisasterWarning/logging.properties
Normal file
10
code/java/DisasterWarning/logging.properties
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
|
||||
|
||||
.level = INFO
|
||||
|
||||
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
|
@@ -5,41 +5,23 @@
|
||||
<artifactId>disaster_warning</artifactId>
|
||||
<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> -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.2</version>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2.1</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>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@@ -56,20 +38,50 @@
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.9.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>12.2.0.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/ojdbc8.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
</properties>
|
||||
<build>
|
||||
<defaultGoal>compile</defaultGoal>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M6</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>AppMain</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assmenbly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
143
code/java/DisasterWarning/src/main/java/AppMain.java
Normal file
143
code/java/DisasterWarning/src/main/java/AppMain.java
Normal file
@@ -0,0 +1,143 @@
|
||||
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 10:53:49
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-06-07 13:16:35
|
||||
* @FilePath: \DisasterWarning\src\main\java\AppMain.java
|
||||
* @Description: 和风天气预警推送厦门太保公众号主程序!
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
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;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
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";
|
||||
|
||||
public static void main(String[] args) {
|
||||
String json;
|
||||
WeatherDisasterNotifyConfig config = null;
|
||||
QWeatherDisasterWarning warning = null;
|
||||
Logger logger = null;
|
||||
|
||||
// 配置logger
|
||||
try {
|
||||
setRootLogger();
|
||||
|
||||
logger = Logger.getLogger("com.cpicxim");
|
||||
} catch (IOException error) {
|
||||
System.out.println("配置logger失败,原因:" + error.getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 读取配置
|
||||
try {
|
||||
config = AppConfigManager.getConfig();
|
||||
} catch (IOException error) {
|
||||
System.out.println("读取配置文件失败!");
|
||||
System.out.println(error.getMessage());
|
||||
|
||||
logger.log(Level.SEVERE, "读取配置文件失败:{0}", error.getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Vector<City> cities = config.getCities();
|
||||
String queryURL = config.getQueryUrl();
|
||||
String userKey = config.getKey();
|
||||
|
||||
// 遍历所有城市,查询是否有警报,有则推送。
|
||||
while (true) {
|
||||
for (City city : cities) {
|
||||
try {
|
||||
json = WeatherDisasterWarningGrabber.getWeatherDisasterWarningJSON(queryURL,
|
||||
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) {
|
||||
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);
|
||||
|
||||
logger.log(Level.INFO, "{0}天气预警,日志发送成功。", new Object[] { city.getCityName() });
|
||||
|
||||
// 将发送的警报,保存起来
|
||||
sendMessage.saveWeatherDisasterWarning(city.getCityName(), item);
|
||||
}
|
||||
} catch (IOException error) {
|
||||
System.out.println("查询" + city.getCityName() + "出现异常!");
|
||||
System.out.println(error.getMessage());
|
||||
|
||||
logger.log(Level.SEVERE, "查询 {0} 出现异常:{1}。",
|
||||
new Object[] { city.getCityName(), error.getMessage() });
|
||||
} catch (SQLException error) {
|
||||
logger.log(Level.SEVERE, "查询 {0} 写入数据库失败:{1}。",
|
||||
new Object[] { city.getCityName(), error.getMessage() });
|
||||
} catch (ClassNotFoundException error) {
|
||||
logger.log(Level.SEVERE, "查询 {0} 加载oracle驱动失败:{1}。",
|
||||
new Object[] { city.getCityName(), error.getMessage() });
|
||||
|
||||
} catch (Exception error) {
|
||||
logger.log(Level.SEVERE, "查询 {0} 出现未知错误:{1}。",
|
||||
new Object[] { city.getCityName(), error.getMessage() });
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
logger.log(Level.INFO, "查询结束,休眠{0}分钟。", config.getQueryInterval());
|
||||
Thread.sleep(config.getQueryInterval() * 1000 * 60);
|
||||
} catch (InterruptedException error) {
|
||||
logger.log(Level.SEVERE, "线程休眠异常,错误信息:{0}", new Object[] { error.getMessage() });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置JUL的logger。
|
||||
*/
|
||||
private static void setRootLogger() throws IOException {
|
||||
LogManager logManager = LogManager.getLogManager();
|
||||
// 使用外部的配置文件。
|
||||
FileInputStream configFile = new FileInputStream("./logging.properties");
|
||||
// 使用jar中的配置文件。
|
||||
// InputStream configFile =
|
||||
// AppMain.class.getClassLoader().getResourceAsStream( "logging.properties" );
|
||||
|
||||
logManager.readConfiguration(configFile);
|
||||
|
||||
Logger.getLogger("com.cpicxim");
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-05-10 16:06:14
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-05-10 16:09:07
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\AppConfigManager.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.cpic.xim.config;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
|
||||
public class AppConfigManager
|
||||
{
|
||||
private static final int BUFFER_SIZE = 1024;
|
||||
private static final String CONFIG_FILE_CHARSET = "UTF-8";
|
||||
private static final String CONFIG_FILE_PATH = "./config.json";
|
||||
private static WeatherDisasterNotifyConfig appConfig = null;
|
||||
|
||||
public static WeatherDisasterNotifyConfig getConfig() throws IOException
|
||||
|
||||
{
|
||||
if ( appConfig != null)
|
||||
{
|
||||
return appConfig;
|
||||
}
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
FileInputStream configFile = null;
|
||||
InputStreamReader in = null;
|
||||
StringBuffer json = null;
|
||||
char[] buffer = new char[BUFFER_SIZE];
|
||||
|
||||
// 设置json属性
|
||||
mapper.setPropertyNamingStrategy( PropertyNamingStrategy.SNAKE_CASE );
|
||||
|
||||
try
|
||||
{
|
||||
configFile = new FileInputStream( CONFIG_FILE_PATH );
|
||||
in = new InputStreamReader( configFile, CONFIG_FILE_CHARSET );
|
||||
json = new StringBuffer();
|
||||
|
||||
int length = in.read( buffer );
|
||||
|
||||
while (length != -1)
|
||||
{
|
||||
json.append( buffer );
|
||||
|
||||
length = in.read( buffer );
|
||||
}
|
||||
|
||||
appConfig = mapper.readValue( json.toString(), WeatherDisasterNotifyConfig.class );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( configFile != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
configFile.close();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return appConfig;
|
||||
}
|
||||
}
|
@@ -1,10 +1,22 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 17:33:30
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-04-23 23:50:45
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\CpicxmStuff.java
|
||||
* @Description: 产险厦门分公司人员信息
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.cpic.xim.config;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class CpicxmStuff
|
||||
{
|
||||
public CpicxmStuff() {};
|
||||
public CpicxmStuff()
|
||||
{};
|
||||
|
||||
public String getStuffName()
|
||||
{
|
||||
@@ -29,11 +41,11 @@ public class CpicxmStuff
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( this == o )
|
||||
if ( this == o)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( !( o instanceof CpicxmStuff ) )
|
||||
if ( !(o instanceof CpicxmStuff))
|
||||
{
|
||||
return false;
|
||||
}
|
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-24 10:21:46
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-05-10 16:16:28
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\WeatherDisasterNotifyConfig.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.config;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
public class WeatherDisasterNotifyConfig
|
||||
{
|
||||
|
||||
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 int getQueryInterval()
|
||||
{
|
||||
return queryInterval;
|
||||
}
|
||||
|
||||
public void setQueryInterval( int queryInterval )
|
||||
{
|
||||
this.queryInterval = queryInterval;
|
||||
}
|
||||
|
||||
|
||||
public void setCities( Vector<City> cities )
|
||||
{
|
||||
this.cities = cities;
|
||||
}
|
||||
|
||||
public Vector<CpicxmStuff> getNotifyStuffs()
|
||||
{
|
||||
return notifyStuffs;
|
||||
}
|
||||
|
||||
public void setNotifyStuffs( Vector<CpicxmStuff> notifyStuffs )
|
||||
{
|
||||
this.notifyStuffs = notifyStuffs;
|
||||
}
|
||||
|
||||
public String getWechatOfficalAccountURL()
|
||||
{
|
||||
return wechatOfficalAccountURL;
|
||||
}
|
||||
|
||||
public void setWechatOfficalAccountURL( String wechatOfficalAccountURL )
|
||||
{
|
||||
this.wechatOfficalAccountURL = wechatOfficalAccountURL;
|
||||
}
|
||||
|
||||
@JsonProperty( "title")
|
||||
private String title;
|
||||
|
||||
@JsonProperty( "key")
|
||||
private String key;
|
||||
|
||||
@JsonProperty( "query_url")
|
||||
private String queryUrl;
|
||||
|
||||
@JsonProperty( "query_interval")
|
||||
private int queryInterval;
|
||||
|
||||
@JsonProperty( "wechat_officalaccount_url")
|
||||
private String wechatOfficalAccountURL;
|
||||
|
||||
@JsonProperty( "cities")
|
||||
private Vector<City> cities;
|
||||
|
||||
@JsonProperty( "notify_stuffs")
|
||||
private Vector<CpicxmStuff> notifyStuffs;
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 17:33:30
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-04-27 16:53:13
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\db\DBTable.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.config.db;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class DBTable
|
||||
{
|
||||
public DBTable()
|
||||
{}
|
||||
|
||||
public String getTableName()
|
||||
{
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName( String tableName )
|
||||
{
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public String getTableDescription()
|
||||
{
|
||||
return tableDescription;
|
||||
}
|
||||
|
||||
public void setTableDescription( String tableDescription )
|
||||
{
|
||||
this.tableDescription = tableDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( this == o)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( !(o instanceof DBTable))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
DBTable dbTable = (DBTable) o;
|
||||
return tableName.equals( dbTable.tableName )
|
||||
&& tableDescription.equals( dbTable.tableDescription );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash( tableName, tableDescription );
|
||||
}
|
||||
|
||||
@JsonProperty( "table_name")
|
||||
private String tableName;
|
||||
|
||||
@JsonProperty( "table_description")
|
||||
private String tableDescription;
|
||||
}
|
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 17:33:30
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-04-25 21:33:07
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\db\OracleConfig.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.config.db;
|
||||
|
||||
import java.util.Vector;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* @Description oracle数据库相关参数对象。
|
||||
*/
|
||||
public class OracleConfig
|
||||
{
|
||||
|
||||
public String getTnsName()
|
||||
{
|
||||
return tnsName;
|
||||
}
|
||||
|
||||
public void setTnsName( String tnsName )
|
||||
{
|
||||
this.tnsName = tnsName;
|
||||
}
|
||||
|
||||
public String getIpAddr()
|
||||
{
|
||||
return ipAddr;
|
||||
}
|
||||
|
||||
public void setIpAddr( String ipAddr )
|
||||
{
|
||||
this.ipAddr = ipAddr;
|
||||
}
|
||||
|
||||
public String getJdbcURL()
|
||||
{
|
||||
return jdbcURL;
|
||||
}
|
||||
|
||||
public void setJdbcURL( String jdbcURL )
|
||||
{
|
||||
this.jdbcURL = jdbcURL;
|
||||
}
|
||||
|
||||
|
||||
public String getTableSpace()
|
||||
{
|
||||
return tableSpace;
|
||||
}
|
||||
|
||||
public void setTableSpace( String tableSpace )
|
||||
{
|
||||
this.tableSpace = tableSpace;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName( String userName )
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword( String password )
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Vector<DBTable> getTables()
|
||||
{
|
||||
return tables;
|
||||
}
|
||||
|
||||
public void setTables( Vector<DBTable> tables )
|
||||
{
|
||||
this.tables = tables;
|
||||
}
|
||||
|
||||
@JsonProperty( "tns_name")
|
||||
private String tnsName;
|
||||
|
||||
@JsonProperty( "ip_addr")
|
||||
private String ipAddr;
|
||||
|
||||
@JsonProperty( "jdbc_url")
|
||||
private String jdbcURL;
|
||||
|
||||
@JsonProperty( "table_space")
|
||||
private String tableSpace;
|
||||
|
||||
@JsonProperty( "user_name")
|
||||
private String userName;
|
||||
|
||||
@JsonProperty( "password")
|
||||
private String password;
|
||||
|
||||
@JsonProperty( "tables")
|
||||
private Vector<DBTable> tables;
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-25 21:45:12
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-05-03 22:34:37
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\config\db\OracleConfigManager.java
|
||||
* @Description: oracle数据库配置文件加载类
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.config.db;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
|
||||
public class OracleConfigManager
|
||||
{
|
||||
private static final String CONFIG_FILE_PATH = "./db.json";
|
||||
private static final String CONFIG_FILE_CHARSET = "UTF-8";
|
||||
private static final int BUFFER_SIZE = 1024;
|
||||
private static OracleConfig dbConfig = null;
|
||||
|
||||
private OracleConfigManager()
|
||||
{}
|
||||
|
||||
public static OracleConfig getOracleConfig() throws IOException
|
||||
{
|
||||
FileInputStream file = null;
|
||||
InputStreamReader in = null;
|
||||
StringBuffer json = null;
|
||||
char[] buffer = new char[BUFFER_SIZE];
|
||||
|
||||
if ( dbConfig != null)
|
||||
{
|
||||
return dbConfig;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
file = new FileInputStream( CONFIG_FILE_PATH );
|
||||
in = new InputStreamReader( file, CONFIG_FILE_CHARSET );
|
||||
json = new StringBuffer();
|
||||
|
||||
int count = in.read( buffer );
|
||||
|
||||
while (count != -1)
|
||||
{
|
||||
json.append( buffer );
|
||||
|
||||
count = in.read( buffer );
|
||||
}
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
dbConfig = mapper.readValue( json.toString(), OracleConfig.class );
|
||||
}
|
||||
catch ( IOException error )
|
||||
{
|
||||
throw error;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
file.close();
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return dbConfig;
|
||||
}
|
||||
}
|
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 09:54:05
|
||||
* @LastEditors: Kane
|
||||
* @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.
|
||||
*/
|
||||
package com.cpic.xim.httpUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.net.URL;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Http相关的工具类。
|
||||
*/
|
||||
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
|
||||
{
|
||||
URL httpURL = null;
|
||||
HttpURLConnection conn = null;
|
||||
OutputStreamWriter out = null;
|
||||
BufferedReader in = null;
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
try
|
||||
{
|
||||
// 获取connection
|
||||
httpURL = new URL( url );
|
||||
conn = (HttpURLConnection) httpURL.openConnection();
|
||||
|
||||
// 设置请求方式
|
||||
conn.setRequestMethod( "POST" );
|
||||
|
||||
// 设置请求头参数
|
||||
for ( HashMap.Entry<String, String> head : headers.entrySet())
|
||||
{
|
||||
conn.setRequestProperty( head.getKey(), head.getValue() );
|
||||
}
|
||||
|
||||
// 连接
|
||||
conn.setDoInput( true );
|
||||
conn.setDoOutput( true );
|
||||
conn.connect();
|
||||
|
||||
// 输出请求
|
||||
out = new OutputStreamWriter( conn.getOutputStream(), StandardCharsets.UTF_8 );
|
||||
out.write( param );
|
||||
out.flush();
|
||||
|
||||
// 读取返回值。
|
||||
in = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
|
||||
|
||||
String line = in.readLine();
|
||||
|
||||
while (line != null)
|
||||
{
|
||||
result.append( line );
|
||||
|
||||
line = in.readLine();
|
||||
}
|
||||
}
|
||||
catch (IOException error)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( out != null)
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
|
||||
if ( in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
|
||||
if ( conn != null)
|
||||
{
|
||||
conn.disconnect();
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
@@ -1,23 +1,24 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-24 10:21:46
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-04-24 11:28:58
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\notify\disaster\QWeatherDisasterWarning.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.notify.disaster;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class QWeatherDisasterWarning
|
||||
{
|
||||
public QWeatherDisasterWarning( String code,
|
||||
String updateTime,
|
||||
String fxLink,
|
||||
Vector<QWeatherDisasterWarningItem> warning,
|
||||
QWeatherDisasterWarningRefer refer )
|
||||
{
|
||||
this.code = code;
|
||||
this.updateTime = updateTime;
|
||||
this.fxLink = fxLink;
|
||||
this.warning = warning;
|
||||
this.refer = refer;
|
||||
}
|
||||
|
||||
public QWeatherDisasterWarning() {}
|
||||
public QWeatherDisasterWarning()
|
||||
{}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
@@ -29,12 +30,12 @@ public class QWeatherDisasterWarning
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getUpdateTime()
|
||||
public Date getUpdateTime()
|
||||
{
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime( String updateTime )
|
||||
public void setUpdateTime( Date updateTime )
|
||||
{
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
@@ -69,9 +70,19 @@ public class QWeatherDisasterWarning
|
||||
this.refer = refer;
|
||||
}
|
||||
|
||||
@JsonProperty( "code")
|
||||
private String code;
|
||||
private String updateTime;
|
||||
|
||||
@JsonProperty( "updateTime")
|
||||
@JsonFormat( pattern = "yyyy-MM-dd'T'HH:mmXXX")
|
||||
private Date updateTime;
|
||||
|
||||
@JsonProperty( "fxLink")
|
||||
private String fxLink;
|
||||
|
||||
@JsonProperty( "warning")
|
||||
private Vector<QWeatherDisasterWarningItem> warning;
|
||||
|
||||
@JsonProperty( "refer")
|
||||
private QWeatherDisasterWarningRefer refer;
|
||||
}
|
@@ -0,0 +1,267 @@
|
||||
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;
|
||||
//import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
public class QWeatherDisasterWarningItem {
|
||||
public QWeatherDisasterWarningItem() {
|
||||
}
|
||||
|
||||
public QWeatherDisasterWarningItem(String id, String sender, Date pubTime, String title, String status,
|
||||
String level, String severity, String severityColor, 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.severity = severity;
|
||||
this.severityColor = severityColor;
|
||||
this.type = type;
|
||||
this.typeName = typeName;
|
||||
this.text = text;
|
||||
this.related = related;
|
||||
this.urgency = urgency;
|
||||
this.certainty = certainty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((certainty == null) ? 0 : certainty.hashCode());
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
result = prime * result + ((level == null) ? 0 : level.hashCode());
|
||||
result = prime * result + ((pubTime == null) ? 0 : pubTime.hashCode());
|
||||
result = prime * result + ((related == null) ? 0 : related.hashCode());
|
||||
result = prime * result + ((sender == null) ? 0 : sender.hashCode());
|
||||
result = prime * result + ((severity == null) ? 0 : severity.hashCode());
|
||||
result = prime * result + ((severityColor == null) ? 0 : severityColor.hashCode());
|
||||
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||
result = prime * result + ((text == null) ? 0 : text.hashCode());
|
||||
result = prime * result + ((title == null) ? 0 : title.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
|
||||
result = prime * result + ((urgency == null) ? 0 : urgency.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 (certainty == null) {
|
||||
if (other.certainty != null)
|
||||
return false;
|
||||
} else if (!certainty.equals(other.certainty))
|
||||
return false;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
if (level == null) {
|
||||
if (other.level != null)
|
||||
return false;
|
||||
} else if (!level.equals(other.level))
|
||||
return false;
|
||||
if (pubTime == null) {
|
||||
if (other.pubTime != null)
|
||||
return false;
|
||||
} else if (!pubTime.equals(other.pubTime))
|
||||
return false;
|
||||
if (related == null) {
|
||||
if (other.related != null)
|
||||
return false;
|
||||
} else if (!related.equals(other.related))
|
||||
return false;
|
||||
if (sender == null) {
|
||||
if (other.sender != null)
|
||||
return false;
|
||||
} else if (!sender.equals(other.sender))
|
||||
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 (status == null) {
|
||||
if (other.status != null)
|
||||
return false;
|
||||
} else if (!status.equals(other.status))
|
||||
return false;
|
||||
if (text == null) {
|
||||
if (other.text != null)
|
||||
return false;
|
||||
} else if (!text.equals(other.text))
|
||||
return false;
|
||||
if (title == null) {
|
||||
if (other.title != null)
|
||||
return false;
|
||||
} else if (!title.equals(other.title))
|
||||
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 (urgency == null) {
|
||||
if (other.urgency != null)
|
||||
return false;
|
||||
} else if (!urgency.equals(other.urgency))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public Date getPubTime() {
|
||||
return pubTime;
|
||||
}
|
||||
|
||||
public void setPubTime(Date pubTime) {
|
||||
this.pubTime = pubTime;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String 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;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getRelated() {
|
||||
return related;
|
||||
}
|
||||
|
||||
public void setRelated(String related) {
|
||||
this.related = related;
|
||||
}
|
||||
|
||||
public String getUrgency() {
|
||||
return urgency;
|
||||
}
|
||||
|
||||
public void setUrgency(String urgency) {
|
||||
this.urgency = urgency;
|
||||
}
|
||||
|
||||
public String getCertainty() {
|
||||
return certainty;
|
||||
}
|
||||
|
||||
public void setCertainty(String certainty) {
|
||||
this.certainty = certainty;
|
||||
}
|
||||
|
||||
private String id;
|
||||
private String sender;
|
||||
|
||||
@JsonProperty("pubTime")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd\'T\'HH:mmXXX")
|
||||
private Date pubTime;
|
||||
|
||||
private String title;
|
||||
private String status;
|
||||
private String level;
|
||||
private String severity;
|
||||
private String severityColor;
|
||||
|
||||
private String type;
|
||||
private String typeName;
|
||||
private String text;
|
||||
private String related;
|
||||
private String urgency;
|
||||
private String certainty;
|
||||
}
|
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* @author 王炜
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.cpic.xim.notify.disaster;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -12,11 +16,11 @@ import java.net.URL;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class WeatherDisasterWarningGrabber
|
||||
{
|
||||
private final static String QUERY_URL = "https://devapi.qweather.com/v7/warning/now?";
|
||||
private final static String USER_KEY = "fe9fa8eeeb6f4301a92541eed565dd15";
|
||||
|
||||
/***
|
||||
* 从和风天气获取天气警报json字符串
|
||||
* @param cityCode 城市或区域代码
|
||||
@@ -110,6 +114,12 @@ public class WeatherDisasterWarningGrabber
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将天气警告的json字符串转换成java对象。
|
||||
* @param json json字符串
|
||||
* @return 返回 QWeatherDisasterWarning 对象。
|
||||
* @throws IOException
|
||||
*/
|
||||
public static QWeatherDisasterWarning convertWeatherDisasterWarning( String json )
|
||||
throws IOException
|
||||
{
|
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 10:53:49
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-05-12 09:51:13
|
||||
* @FilePath: \DisasterWarning\src\main\java\com\cpic\xim\wechat\officalAccount\sendMessage.java
|
||||
* @Description: 用来推送公众号消息的程序库。
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.wechat.officalAccount;
|
||||
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* 推送微信公众号消息。
|
||||
*
|
||||
* @author Kane
|
||||
*/
|
||||
public class sendMessage
|
||||
{
|
||||
private static HashMap<String, String> warningLevel;
|
||||
|
||||
/**
|
||||
* 推送天气灾害预警!接口文档参考 彭奕洁 编写《消息发送接口调用文档》
|
||||
* 使用 post 方式,请求体内容以最基础的 post 格式。
|
||||
*
|
||||
* @param officalAccountURL 产险厦门分公司公众号接口网址
|
||||
* @param warningItem 灾害预警对象
|
||||
*/
|
||||
public static void sendWeatherDisasterWarning( String officalAccountURL,
|
||||
QWeatherDisasterWarningItem warningItem )
|
||||
{
|
||||
// Vector<QWeatherDisasterWarningItem> warningItems = warningItem.getWarning();
|
||||
StringBuilder requestBody = null;
|
||||
|
||||
// 设置请求头参数
|
||||
HashMap<String, String> headers = new HashMap<String, String>();
|
||||
|
||||
headers.put( "accept", "*/*" );
|
||||
headers.put( "Connection", "Keep-Alive" );
|
||||
headers.put( "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8" );
|
||||
|
||||
// 遍历消息,将消息推送出去。
|
||||
|
||||
// 拼接消息内容
|
||||
String title = warningItem.getTitle();
|
||||
String text = warningItem.getText();
|
||||
String color = warningLevel.containsKey( warningItem.getLevel() )
|
||||
? warningLevel.get( warningItem.getLevel() )
|
||||
: "#000000";
|
||||
requestBody = new StringBuilder();
|
||||
|
||||
requestBody.append( "tplid=57&groupid=1&first=尊敬的#realname#,您好!&" );
|
||||
requestBody.append( "keyword1=" ).append( title ).append( "&" );
|
||||
requestBody.append( "keyword1color=" ).append( color ).append( "&" );
|
||||
requestBody.append( "keyword2=" ).append( text );
|
||||
|
||||
try
|
||||
{
|
||||
HttpUtils.postHttpRequest( officalAccountURL, headers, requestBody.toString() );
|
||||
}
|
||||
catch ( MalformedURLException error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查预警是否已经推送过,通过 QWeatherDisasterWarningItem 对象的 id 属性。
|
||||
* 查询 oracle xmcx1 数据库 wechat 表空间下 weather_disaster_notify 表,
|
||||
* 统计 warningID 的数量,如果不为0,说明该预警已经保存过,视为已经推送过。
|
||||
*
|
||||
* @param warningID 预警的id
|
||||
* @return 如果推送过,返回false,否则返回 true。
|
||||
*/
|
||||
public static boolean checkWarningHasSended( String warningID )
|
||||
throws ClassNotFoundException, SQLException, IOException
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
|
||||
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
String jdbcURL = dbConfig.getJdbcURL();
|
||||
String userName = dbConfig.getUserName();
|
||||
String password = dbConfig.getPassword();
|
||||
String sql = "select count(*) from weather_disaster_notify where notify_id = ?";
|
||||
|
||||
// Logger logger = Logger.getLogger( "com.cpicxim.wechat.officalAccount.sendMessage" );
|
||||
|
||||
try
|
||||
{
|
||||
Class.forName( "oracle.jdbc.driver.OracleDriver" );
|
||||
|
||||
conn = DriverManager.getConnection( jdbcURL, userName, password );
|
||||
stmt = conn.prepareStatement( sql );
|
||||
stmt.setString( 1, warningID );
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
if ( rs.next() && rs.getInt( 1 ) == 0 )
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( rs != null )
|
||||
{
|
||||
rs.close();
|
||||
}
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( stmt != null )
|
||||
{
|
||||
stmt.close();
|
||||
}
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( conn != null )
|
||||
{
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存天气预警警报数据。
|
||||
* 保存至 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 )
|
||||
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();
|
||||
|
||||
OracleConfig dbConfig = OracleConfigManager.getOracleConfig();
|
||||
|
||||
String jdbcURL = dbConfig.getJdbcURL();
|
||||
String userName = dbConfig.getUserName();
|
||||
String password = dbConfig.getPassword();
|
||||
|
||||
try
|
||||
{
|
||||
Class.forName( "oracle.jdbc.driver.OracleDriver" );
|
||||
|
||||
conn = DriverManager.getConnection( jdbcURL, userName, password );
|
||||
stmt = conn.prepareStatement( sql );
|
||||
|
||||
conn.setAutoCommit( false );
|
||||
|
||||
java.sql.Timestamp pubTime = new java.sql.Timestamp( warning.getPubTime().getTime() );
|
||||
|
||||
stmt.setString( 1, warning.getId() );
|
||||
stmt.setString( 2, warning.getSender() );
|
||||
stmt.setString( 3, city );
|
||||
stmt.setString( 4, warning.getLevel() );
|
||||
stmt.setString( 5, warning.getType() );
|
||||
stmt.setString( 6, warning.getTypeName() );
|
||||
stmt.setString( 7, warning.getTitle() );
|
||||
stmt.setString( 8, warning.getText() );
|
||||
stmt.setTimestamp( 9, pubTime );
|
||||
|
||||
stmt.execute();
|
||||
|
||||
// 没有问题就提交
|
||||
conn.commit();
|
||||
}
|
||||
catch ( SQLException error )
|
||||
{
|
||||
// 出现sql错误,就回滚!
|
||||
if ( conn != null )
|
||||
{
|
||||
conn.rollback();
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( stmt != null )
|
||||
{
|
||||
stmt.close();
|
||||
}
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( conn != null )
|
||||
{
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
// 预警级别色彩
|
||||
warningLevel = new HashMap<>();
|
||||
|
||||
warningLevel.put( "蓝色", "#0000FF" );
|
||||
warningLevel.put( "黄色", "#FFFF00" );
|
||||
warningLevel.put( "橙色", "#FFA500" );
|
||||
warningLevel.put( "红色", "#FF0000" );
|
||||
}
|
||||
}
|
||||
|
||||
class WechatOfficalAccountMessageParameter
|
||||
{
|
||||
|
||||
WechatOfficalAccountMessageParameter()
|
||||
{
|
||||
tplID = 57;
|
||||
groupID = 1;
|
||||
}
|
||||
|
||||
@JsonProperty("tplid")
|
||||
private int tplID;
|
||||
|
||||
@JsonProperty("groupid")
|
||||
private int groupID;
|
||||
|
||||
@JsonProperty("first")
|
||||
private String first;
|
||||
|
||||
@JsonProperty("keyword1")
|
||||
private String keyword1;
|
||||
|
||||
@JsonProperty("keyword1color")
|
||||
private String keyword1Color;
|
||||
|
||||
@JsonProperty("keyword2")
|
||||
private String keyword2;
|
||||
|
||||
@JsonProperty("keyword2color")
|
||||
private String keyword2Color;
|
||||
|
||||
@JsonProperty("remark")
|
||||
private String remark;
|
||||
|
||||
@JsonProperty("remarkcolor")
|
||||
private String remarkColor;
|
||||
|
||||
@JsonProperty("url")
|
||||
private String url;
|
||||
|
||||
@JsonProperty("appid")
|
||||
private String appid;
|
||||
|
||||
@JsonProperty("pagepath")
|
||||
private String pagePath;
|
||||
|
||||
public int getTplID()
|
||||
{
|
||||
return tplID;
|
||||
}
|
||||
|
||||
public void setTplID( int tplID )
|
||||
{
|
||||
this.tplID = tplID;
|
||||
}
|
||||
|
||||
public int getGroupID()
|
||||
{
|
||||
return groupID;
|
||||
}
|
||||
|
||||
public void setGroupID( int groupID )
|
||||
{
|
||||
this.groupID = groupID;
|
||||
}
|
||||
|
||||
public String getFirst()
|
||||
{
|
||||
return first;
|
||||
}
|
||||
|
||||
public void setFirst( String first )
|
||||
{
|
||||
this.first = first;
|
||||
}
|
||||
|
||||
public String getKeyword1()
|
||||
{
|
||||
return keyword1;
|
||||
}
|
||||
|
||||
public void setKeyword1( String keyword1 )
|
||||
{
|
||||
this.keyword1 = keyword1;
|
||||
}
|
||||
|
||||
public String getKeyword1Color()
|
||||
{
|
||||
return keyword1Color;
|
||||
}
|
||||
|
||||
public void setKeyword1Color( String keyword1Color )
|
||||
{
|
||||
this.keyword1Color = keyword1Color;
|
||||
}
|
||||
|
||||
public String getKeyword2()
|
||||
{
|
||||
return keyword2;
|
||||
}
|
||||
|
||||
public void setKeyword2( String keyword2 )
|
||||
{
|
||||
this.keyword2 = keyword2;
|
||||
}
|
||||
|
||||
public String getKeyword2Color()
|
||||
{
|
||||
return keyword2Color;
|
||||
}
|
||||
|
||||
public void setKeyword2Color( String keyword2Color )
|
||||
{
|
||||
this.keyword2Color = keyword2Color;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark( String remark )
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getRemarkColor()
|
||||
{
|
||||
return remarkColor;
|
||||
}
|
||||
|
||||
public void setRemarkColor( String remarkColor )
|
||||
{
|
||||
this.remarkColor = remarkColor;
|
||||
}
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl( String url )
|
||||
{
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getAppid()
|
||||
{
|
||||
return appid;
|
||||
}
|
||||
|
||||
public void setAppid( String appid )
|
||||
{
|
||||
this.appid = appid;
|
||||
}
|
||||
|
||||
public String getPagePath()
|
||||
{
|
||||
return pagePath;
|
||||
}
|
||||
|
||||
public void setPagePath( String pagePath )
|
||||
{
|
||||
this.pagePath = pagePath;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
|
||||
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
|
||||
|
||||
.level = INFO
|
||||
|
||||
java.util.logging.FileHandler.pattern = ./logs/log_%u.log
|
||||
java.util.logging.FileHandler.limit = 50000
|
||||
java.util.logging.FileHandler.count = 10
|
||||
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
|
||||
java.util.logging.FileHandler.append = true;
|
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-22 10:53:49
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-05-12 09:54:36
|
||||
* @FilePath: \DisasterWarning\src\test\java\com\cpic\xim\wechat\officalAccount\sendMessageTest.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.wechat.officalAccount;
|
||||
|
||||
import com.cpic.xim.notify.disaster.QWeatherDisasterWarning;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import com.cpic.xim.httpUtil.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class sendMessageTest
|
||||
{
|
||||
private static String url =
|
||||
"https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage";
|
||||
|
||||
// @Test
|
||||
public void postNotifyMessageJson()
|
||||
{
|
||||
try
|
||||
{
|
||||
// sendMessage.postNotifyMessageJSON( url, "警报", "警报标题", "警报内容!" );
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
fail( "测试失败!" );
|
||||
}
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void postNotifyMessage()
|
||||
{
|
||||
HashMap<String, String> headers = new HashMap<String, String>();
|
||||
String param = "tplid=57&groupid=1&first=亲爱的#realname#,您好!&"
|
||||
+ "keyword1=东山县气象台发布大雾黄色预警[Ⅲ级/较重]&" + "keyword1color=#ffff00&"
|
||||
+ "keyword2=东山县气象台2022年04月22日06时12分发布大雾黄色预警信号:预计未来12小时内,我县、闽南渔场和台湾浅滩渔场将出现能见度小于500米的雾。请注意防范!";
|
||||
|
||||
headers.put( "accept", "*/*" );
|
||||
headers.put( "Connection", "Keep-Alive" );
|
||||
headers.put( "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8" );
|
||||
|
||||
try
|
||||
{
|
||||
HttpUtils.postHttpRequest( url, headers, param );
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testSendWeatherDisasterWarning() throws IOException
|
||||
{
|
||||
String warningJSON =
|
||||
"{\"code\":\"200\",\"updateTime\":\"2022-04-23T23:25+08:00\",\"fxLink\":\"http://hfx.link/3645\",\"warning\":[{\"id\":\"10123060820220423203500874007118\",\"sender\":\"东山县气象台\",\"pubTime\":\"2022-04-23T20:35+08:00\",\"title\":\"东山县气象台发布大雾黄色预警[Ⅲ级/较重]\",\"status\":\"active\",\"level\":\"黄色\",\"type\":\"1017\",\"typeName\":\"大雾\",\"text\":\"东山县气象台2022年04月23日20时35分发布大雾黄色预警信号:预计未来12小时内,我县、闽南渔场和台湾浅滩渔场将出现能见度小于500米的雾。请注意防范!\",\"related\":\"\",\"urgency\":\"\",\"certainty\":\"\"}],\"refer\":{\"sources\":[\"12379\"],\"license\":[\"no commercial use\"]}}";
|
||||
|
||||
try
|
||||
{
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
QWeatherDisasterWarning warning =
|
||||
mapper.readValue( warningJSON, QWeatherDisasterWarning.class );
|
||||
|
||||
String city = "东山县";
|
||||
|
||||
|
||||
// sendMessage.saveWeatherDisasterWarning( city, warning );
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
fail( error.getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testCheckWarningHasSended()
|
||||
{
|
||||
String warningID = "10123060820220422061200476313081";
|
||||
|
||||
try
|
||||
{
|
||||
sendMessage.checkWarningHasSended( warningID );
|
||||
}
|
||||
catch ( Exception error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"tns_name": "xmcx1",
|
||||
"ip_addr": "10.39.0.86",
|
||||
"user_name": "",
|
||||
"password": ""
|
||||
}
|
@@ -1,460 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="59c1e2ec-34de-447f-b370-673ce36f3f54" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/cpic/xim/config/db/OracleConfig.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/db.json" beforeDir="false" afterPath="$PROJECT_DIR$/db.json" 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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Commander">
|
||||
<leftPanel view="Project" />
|
||||
<rightPanel view="Project" />
|
||||
<splitter proportion="0.5" />
|
||||
</component>
|
||||
<component name="Cvs2Configuration">
|
||||
<option name="ON_FILE_ADDING" value="0" />
|
||||
<option name="ON_FILE_REMOVING" value="0" />
|
||||
<option name="PRUNE_EMPTY_DIRECTORIES" value="true" />
|
||||
<option name="SHOW_UPDATE_OPTIONS" value="true" />
|
||||
<option name="SHOW_ADD_OPTIONS" value="true" />
|
||||
<option name="SHOW_REMOVE_OPTIONS" value="true" />
|
||||
<option name="MERGING_MODE" value="0" />
|
||||
<option name="MERGE_WITH_BRANCH1_NAME" value="HEAD" />
|
||||
<option name="MERGE_WITH_BRANCH2_NAME" value="HEAD" />
|
||||
<option name="RESET_STICKY" value="false" />
|
||||
<option name="CREATE_NEW_DIRECTORIES" value="true" />
|
||||
<option name="DEFAULT_TEXT_FILE_SUBSTITUTION" value="kv" />
|
||||
<option name="PROCESS_UNKNOWN_FILES" value="false" />
|
||||
<option name="PROCESS_DELETED_FILES" value="false" />
|
||||
<option name="SHOW_EDIT_DIALOG" value="true" />
|
||||
<option name="RESERVED_EDIT" value="false" />
|
||||
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
||||
<option name="SHOW_CHECKOUT_OPTIONS" value="true" />
|
||||
<option name="CHECKOUT_DATE_OR_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value="" />
|
||||
<option name="DATE" value="" />
|
||||
<option name="USE_BRANCH" value="false" />
|
||||
<option name="USE_DATE" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="UPDATE_DATE_OR_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value="" />
|
||||
<option name="DATE" value="" />
|
||||
<option name="USE_BRANCH" value="false" />
|
||||
<option name="USE_DATE" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="SHOW_CHANGES_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value="" />
|
||||
<option name="DATE" value="" />
|
||||
<option name="USE_BRANCH" value="false" />
|
||||
<option name="USE_DATE" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="SHOW_OUTPUT" value="false" />
|
||||
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
||||
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
|
||||
<option name="ADD_WATCH_INDEX" value="0" />
|
||||
<option name="REMOVE_WATCH_INDEX" value="0" />
|
||||
<option name="UPDATE_KEYWORD_SUBSTITUTION" />
|
||||
<option name="MAKE_NEW_FILES_READONLY" value="false" />
|
||||
<option name="SHOW_CORRUPTED_PROJECT_FILES" value="0" />
|
||||
<option name="TAG_AFTER_FILE_COMMIT" value="false" />
|
||||
<option name="TAG_AFTER_FILE_COMMIT_NAME" value="" />
|
||||
<option name="TAG_AFTER_PROJECT_COMMIT" value="false" />
|
||||
<option name="TAG_AFTER_PROJECT_COMMIT_NAME" value="" />
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
|
||||
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="" />
|
||||
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_FILE_COMMIT" value="false" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
|
||||
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
|
||||
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
|
||||
</component>
|
||||
<component name="DebuggerManager">
|
||||
<line_breakpoints converted="true" />
|
||||
<exception_breakpoints converted="true">
|
||||
<breakpoint_any>
|
||||
<option name="NOTIFY_CAUGHT" value="true" />
|
||||
<option name="NOTIFY_UNCAUGHT" value="true" />
|
||||
<option name="ENABLED" value="false" />
|
||||
<option name="SUSPEND_VM" value="true" />
|
||||
<option name="COUNT_FILTER_ENABLED" value="false" />
|
||||
<option name="COUNT_FILTER" value="0" />
|
||||
<option name="CONDITION_ENABLED" value="false" />
|
||||
<option name="CONDITION" />
|
||||
<option name="LOG_ENABLED" value="false" />
|
||||
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||
<option name="LOG_MESSAGE" />
|
||||
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
||||
<option name="INVERSE_CLASS_FILLTERS" value="false" />
|
||||
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
||||
</breakpoint_any>
|
||||
</exception_breakpoints>
|
||||
<field_breakpoints converted="true" />
|
||||
<method_breakpoints converted="true" />
|
||||
</component>
|
||||
<component name="DebuggerSettings">
|
||||
<option name="TRACING_FILTERS_ENABLED" value="true" />
|
||||
<option name="TOSTRING_CLASSES_ENABLED" value="false" />
|
||||
<option name="VALUE_LOOKUP_DELAY" value="700" />
|
||||
<option name="DEBUGGER_TRANSPORT" value="0" />
|
||||
<option name="FORCE_CLASSIC_VM" value="true" />
|
||||
<option name="HIDE_DEBUGGER_ON_PROCESS_TERMINATION" value="false" />
|
||||
<option name="SKIP_SYNTHETIC_METHODS" value="true" />
|
||||
<option name="SKIP_CONSTRUCTORS" value="false" />
|
||||
<option name="STEP_THREAD_SUSPEND_POLICY" value="SuspendThread" />
|
||||
<default_breakpoint_settings>
|
||||
<option name="NOTIFY_CAUGHT" value="true" />
|
||||
<option name="NOTIFY_UNCAUGHT" value="true" />
|
||||
<option name="WATCH_MODIFICATION" value="true" />
|
||||
<option name="WATCH_ACCESS" value="true" />
|
||||
<option name="WATCH_ENTRY" value="true" />
|
||||
<option name="WATCH_EXIT" value="true" />
|
||||
<option name="ENABLED" value="true" />
|
||||
<option name="SUSPEND_VM" value="true" />
|
||||
<option name="COUNT_FILTER_ENABLED" value="false" />
|
||||
<option name="COUNT_FILTER" value="0" />
|
||||
<option name="CONDITION_ENABLED" value="false" />
|
||||
<option name="CONDITION" />
|
||||
<option name="LOG_ENABLED" value="false" />
|
||||
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||
<option name="LOG_MESSAGE" />
|
||||
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
||||
<option name="INVERSE_CLASS_FILLTERS" value="false" />
|
||||
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
||||
</default_breakpoint_settings>
|
||||
<filter>
|
||||
<option name="PATTERN" value="com.sun.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="java.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="javax.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="org.omg.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="sun.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</filter>
|
||||
<filter>
|
||||
<option name="PATTERN" value="junit.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</filter>
|
||||
</component>
|
||||
<component name="EjbViewSettings">
|
||||
<EjbView showMembers="false" autoscrollToSource="false" />
|
||||
</component>
|
||||
<component name="ErrorTreeViewConfiguration">
|
||||
<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>
|
||||
<component name="HierarchyBrowserManager">
|
||||
<option name="SHOW_PACKAGES" value="false" />
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="SORT_ALPHABETICALLY" value="false" />
|
||||
</component>
|
||||
<component name="InspectionManager">
|
||||
<option name="AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="SPLITTER_PROPORTION" value="0.5" />
|
||||
<profile name="Default" />
|
||||
</component>
|
||||
<component name="LvcsProjectConfiguration">
|
||||
<option name="ADD_LABEL_ON_PROJECT_OPEN" value="true" />
|
||||
<option name="ADD_LABEL_ON_PROJECT_COMPILATION" value="true" />
|
||||
<option name="ADD_LABEL_ON_FILE_PACKAGE_COMPILATION" value="true" />
|
||||
<option name="ADD_LABEL_ON_PROJECT_MAKE" value="true" />
|
||||
<option name="ADD_LABEL_ON_RUNNING" value="true" />
|
||||
<option name="ADD_LABEL_ON_DEBUGGING" value="true" />
|
||||
<option name="ADD_LABEL_ON_UNIT_TEST_PASSED" value="true" />
|
||||
<option name="ADD_LABEL_ON_UNIT_TEST_FAILED" value="true" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="useMavenConfig" value="true" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="PerforceConfiguration">
|
||||
<option name="PORT" value="magic:1666" />
|
||||
<option name="USER" value="" />
|
||||
<option name="PASSWORD" value="" />
|
||||
<option name="CLIENT" value="" />
|
||||
<option name="TRACE" value="false" />
|
||||
<option name="PERFORCE_STATUS" value="true" />
|
||||
<option name="CHANGELIST_OPTION" value="false" />
|
||||
<option name="SYSTEMROOT" value="" />
|
||||
<option name="P4_EXECUTABLE" value="p4" />
|
||||
<option name="SHOW_BRANCH_HISTORY" value="false" />
|
||||
<option name="GENERATE_COMMENT" value="false" />
|
||||
<option name="SYNC_OPTION" value="Sync" />
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
|
||||
<option name="FORCE_NON_EMPTY_COMMENT" value="true" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="" />
|
||||
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_FILE_COMMIT" value="false" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
|
||||
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
|
||||
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
|
||||
</component>
|
||||
<component name="ProjectId" id="26WTbYpsKBJXnhCCsfiX1ogpS2j" />
|
||||
<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">
|
||||
<expanded_node type="directory" url="file://$PROJECT_DIR$" />
|
||||
</view>
|
||||
<view id="SourcepathPane" />
|
||||
<view id="ClasspathPane" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="GoToClass.includeLibraries" value="false" />
|
||||
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
|
||||
<property name="GoToFile.includeJavaFiles" value="false" />
|
||||
<property name="MemberChooser.copyJavadoc" value="false" />
|
||||
<property name="MemberChooser.showClasses" value="true" />
|
||||
<property name="MemberChooser.sorted" value="false" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" 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">
|
||||
<module name="" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="HTML_FILE_NAME" />
|
||||
<option name="HTML_USED" value="false" />
|
||||
<option name="WIDTH" value="400" />
|
||||
<option name="HEIGHT" value="300" />
|
||||
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
</configuration>
|
||||
<configuration name="AppMain" type="Application" factoryName="Application" 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">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="wholeProject" />
|
||||
</option>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="StarteamConfiguration">
|
||||
<option name="SERVER" value="" />
|
||||
<option name="PORT" value="49201" />
|
||||
<option name="USER" value="" />
|
||||
<option name="PASSWORD" value="" />
|
||||
<option name="PROJECT" value="" />
|
||||
<option name="VIEW" value="" />
|
||||
<option name="ALTERNATIVE_WORKING_PATH" value="" />
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="" />
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
|
||||
</component>
|
||||
<component name="StructureViewFactory">
|
||||
<option name="SORT_MODE" value="0" />
|
||||
<option name="GROUP_INHERITED" value="true" />
|
||||
<option name="AUTOSCROLL_MODE" value="true" />
|
||||
<option name="SHOW_FIELDS" value="true" />
|
||||
<option name="AUTOSCROLL_FROM_SOURCE" value="false" />
|
||||
<option name="GROUP_GETTERS_AND_SETTERS" value="true" />
|
||||
<option name="SHOW_INHERITED" value="false" />
|
||||
<option name="HIDE_NOT_PUBLIC" value="false" />
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<option name="USER" value="" />
|
||||
<option name="PASSWORD" value="" />
|
||||
<option name="AUTO_ADD_FILES" value="0" />
|
||||
<option name="AUTO_DEL_FILES" value="0" />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="59c1e2ec-34de-447f-b370-673ce36f3f54" name="Changes" comment="" />
|
||||
<created>1647538422605</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1647538422605</updated>
|
||||
<workItem from="1647538428126" duration="120000" />
|
||||
<workItem from="1647574227207" duration="347000" />
|
||||
<workItem from="1647575274400" duration="11594000" />
|
||||
<workItem from="1647593338220" duration="603000" />
|
||||
<workItem from="1647833533865" duration="634000" />
|
||||
<workItem from="1647850946832" duration="870000" />
|
||||
<workItem from="1647913554783" duration="4765000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TodoView" selected-index="0">
|
||||
<todo-panel id="selected-file">
|
||||
<are-packages-shown value="false" />
|
||||
<flatten-packages value="false" />
|
||||
<is-autoscroll-to-source value="true" />
|
||||
</todo-panel>
|
||||
<todo-panel id="all">
|
||||
<are-packages-shown value="true" />
|
||||
<flatten-packages value="false" />
|
||||
<is-autoscroll-to-source value="true" />
|
||||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-4" y="-4" width="1032" height="746" extended-state="6" />
|
||||
<editor active="false" />
|
||||
<layout>
|
||||
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="0" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="1" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="6" />
|
||||
<window_info id="Aspects" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="2" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="4" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0" />
|
||||
<window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="0" />
|
||||
<window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="3" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="5" />
|
||||
</layout>
|
||||
</component>
|
||||
<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="" />
|
||||
<option name="DO_NOT_GET_LATEST_VERSION" value="false" />
|
||||
<option name="REPLACE_WRITABLE" value="false" />
|
||||
<option name="RECURSIVE" value="false" />
|
||||
</CheckoutOptions>
|
||||
<CheckinOptions>
|
||||
<option name="COMMENT" value="" />
|
||||
<option name="KEEP_CHECKED_OUT" value="false" />
|
||||
<option name="RECURSIVE" value="false" />
|
||||
</CheckinOptions>
|
||||
<AddOptions>
|
||||
<option name="COMMENT" value="" />
|
||||
<option name="STORE_ONLY_LATEST_VERSION" value="false" />
|
||||
<option name="CHECK_OUT_IMMEDIATELY" value="false" />
|
||||
<option name="FILE_TYPE" value="0" />
|
||||
</AddOptions>
|
||||
<UndocheckoutOptions>
|
||||
<option name="MAKE_WRITABLE" value="false" />
|
||||
<option name="REPLACE_LOCAL_COPY" value="0" />
|
||||
<option name="RECURSIVE" value="false" />
|
||||
</UndocheckoutOptions>
|
||||
<DiffOptions>
|
||||
<option name="IGNORE_WHITE_SPACE" value="false" />
|
||||
<option name="IGNORE_CASE" value="false" />
|
||||
</DiffOptions>
|
||||
<GetOptions>
|
||||
<option name="REPLACE_WRITABLE" value="0" />
|
||||
<option name="MAKE_WRITABLE" value="false" />
|
||||
<option name="RECURSIVE" value="false" />
|
||||
</GetOptions>
|
||||
<option name="CLIENT_PATH" value="" />
|
||||
<option name="SRCSAFEINI_PATH" value="" />
|
||||
<option name="USER_NAME" value="" />
|
||||
<option name="PWD" value="" />
|
||||
<option name="SHOW_CHECKOUT_OPTIONS" value="true" />
|
||||
<option name="SHOW_ADD_OPTIONS" value="true" />
|
||||
<option name="SHOW_UNDOCHECKOUT_OPTIONS" value="true" />
|
||||
<option name="SHOW_DIFF_OPTIONS" value="true" />
|
||||
<option name="SHOW_GET_OPTIONS" value="true" />
|
||||
<option name="USE_EXTERNAL_DIFF" value="false" />
|
||||
<option name="EXTERNAL_DIFF_PATH" value="" />
|
||||
<option name="REUSE_LAST_COMMENT" value="false" />
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
|
||||
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="" />
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
|
||||
</component>
|
||||
<component name="WebViewSettings">
|
||||
<webview flattenPackages="false" showMembers="false" autoscrollToSource="false" />
|
||||
</component>
|
||||
</project>
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-03-16 18:10:58
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-03-18 00:37:56
|
||||
* @FilePath: \天气灾害预警\src\main\java\AppMain.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
|
||||
import com.cpic.xim.config.City;
|
||||
import com.cpic.xim.notify.disaster.QWeatherDisasterWarning;
|
||||
import com.cpic.xim.notify.disaster.WeatherDisasterWarningGrabber;
|
||||
import com.cpic.xim.config.WeatherDisasterNotifyConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
public class AppMain
|
||||
{
|
||||
private static final String CONFIG_FILE_PATH = "./config.json";
|
||||
|
||||
public static void main( String[] args )
|
||||
{
|
||||
String cityCode = "101230201";
|
||||
String json;
|
||||
QWeatherDisasterWarning warning = null;
|
||||
WeatherDisasterNotifyConfig config = null;
|
||||
|
||||
//读取配置
|
||||
try
|
||||
{
|
||||
config = WeatherDisasterNotifyConfig.load( CONFIG_FILE_PATH );
|
||||
}
|
||||
catch ( IOException error )
|
||||
{
|
||||
System.out.println( "读取配置文件失败!" );
|
||||
System.out.println( error.getMessage() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Vector<City> cities = config.getCities();
|
||||
String queryURL = config.getQueryUrl();
|
||||
String userKey = config.getKey();
|
||||
|
||||
//遍历所有城市,查询是否有警报,有则推送。
|
||||
for ( City city : cities )
|
||||
{
|
||||
try
|
||||
{
|
||||
json = WeatherDisasterWarningGrabber.getWeatherDisasterWarningJSON( queryURL,
|
||||
userKey,
|
||||
city.getCityCode() );
|
||||
warning = WeatherDisasterWarningGrabber.convertWeatherDisasterWarning( json );
|
||||
|
||||
}
|
||||
catch ( IOException error )
|
||||
{
|
||||
System.out.println( "查询" + city.getCityName() + "出现异常!");
|
||||
System.out.println( error.getMessage() );
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,118 +0,0 @@
|
||||
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;
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
package com.cpic.xim.config.db;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class OracleConfig
|
||||
{
|
||||
private String tnsName;
|
||||
private String ipAddr;
|
||||
private String userName;
|
||||
private String password;
|
||||
private Map<String, String> tables;
|
||||
}
|
@@ -1,212 +0,0 @@
|
||||
package com.cpic.xim.notify.disaster;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
//import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
public class QWeatherDisasterWarningItem
|
||||
{
|
||||
public QWeatherDisasterWarningItem() {}
|
||||
public QWeatherDisasterWarningItem( String id,
|
||||
String sender,
|
||||
String pubTime,
|
||||
String title,
|
||||
String status,
|
||||
String level,
|
||||
String type,
|
||||
String typeName,
|
||||
String text,
|
||||
String related,
|
||||
String urgency, String certainty )
|
||||
{
|
||||
this.id = id;
|
||||
this.sender = sender;
|
||||
this.pubTime = pubTime;
|
||||
this.title = title;
|
||||
this.status = status;
|
||||
this.level = level;
|
||||
this.type = type;
|
||||
this.typeName = typeName;
|
||||
this.text = text;
|
||||
this.related = related;
|
||||
this.urgency = urgency;
|
||||
this.certainty = certainty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( this == o )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( o == null || getClass() != o.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
QWeatherDisasterWarningItem that = (QWeatherDisasterWarningItem) o;
|
||||
return id.equals( that.id ) && Objects.equals( sender, that.sender ) && Objects.equals( pubTime,
|
||||
that.pubTime ) && Objects.equals(
|
||||
title,
|
||||
that.title ) && Objects.equals( status, that.status ) && Objects.equals( level,
|
||||
that.level ) && Objects.equals(
|
||||
type,
|
||||
that.type ) && Objects.equals( typeName, that.typeName ) && Objects.equals( text,
|
||||
that.text ) && Objects.equals(
|
||||
related,
|
||||
that.related ) && Objects.equals( urgency, that.urgency ) && Objects.equals( certainty,
|
||||
that.certainty );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash( id,
|
||||
sender,
|
||||
pubTime,
|
||||
title,
|
||||
status,
|
||||
level,
|
||||
type,
|
||||
typeName,
|
||||
text,
|
||||
related,
|
||||
urgency,
|
||||
certainty );
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId( String id )
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender( String sender )
|
||||
{
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public String getPubTime()
|
||||
{
|
||||
return pubTime;
|
||||
}
|
||||
|
||||
public void setPubTime( String pubTime )
|
||||
{
|
||||
this.pubTime = pubTime;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle( String title )
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus( String status )
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getLevel()
|
||||
{
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel( String level )
|
||||
{
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType( String type )
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTypeName()
|
||||
{
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void setTypeName( String typeName )
|
||||
{
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText( String text )
|
||||
{
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getRelated()
|
||||
{
|
||||
return related;
|
||||
}
|
||||
|
||||
public void setRelated( String related )
|
||||
{
|
||||
this.related = related;
|
||||
}
|
||||
|
||||
public String getUrgency()
|
||||
{
|
||||
return urgency;
|
||||
}
|
||||
|
||||
public void setUrgency( String urgency )
|
||||
{
|
||||
this.urgency = urgency;
|
||||
}
|
||||
|
||||
public String getCertainty()
|
||||
{
|
||||
return certainty;
|
||||
}
|
||||
|
||||
public void setCertainty( String certainty )
|
||||
{
|
||||
this.certainty = certainty;
|
||||
}
|
||||
|
||||
private String id;
|
||||
private String sender;
|
||||
@JsonFormat(pattern="yyyy-MM-dd'T'HH:mm")
|
||||
private String pubTime;
|
||||
private String title;
|
||||
private String status;
|
||||
private String level;
|
||||
private String type;
|
||||
private String typeName;
|
||||
private String text;
|
||||
private String related;
|
||||
private String urgency;
|
||||
private String certainty;
|
||||
}
|
27
应用/1.0/config.json
Normal file
27
应用/1.0/config.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"title": "天气灾害预警配置文件",
|
||||
"key": "fe9fa8eeeb6f4301a92541eed565dd15",
|
||||
"query_url": "https://devapi.qweather.com/v7/warning/now?",
|
||||
"wechat_officalaccount_url": "https://cxxmwx.cpic.com.cn/app/index.php?i=2&c=entry&do=send_group_tpl_api&m=ok_tplmessage",
|
||||
"query_interval": 10,
|
||||
"cities": [
|
||||
{
|
||||
"city_name": "厦门",
|
||||
"city_code": "101230201"
|
||||
},
|
||||
{
|
||||
"city_name": "同安",
|
||||
"city_code": "101230202"
|
||||
},
|
||||
{
|
||||
"city_name": "翔安",
|
||||
"city_code": "101230207"
|
||||
}
|
||||
],
|
||||
"notify_stuffs": [
|
||||
{
|
||||
"stuff_name": "王炜",
|
||||
"mobile_phone": "15959215339"
|
||||
}
|
||||
]
|
||||
}
|
14
应用/1.0/db.json
Normal file
14
应用/1.0/db.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"tns_name": "xmcx1",
|
||||
"ip_addr": "10.39.0.86",
|
||||
"jdbc_url": "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1",
|
||||
"table_space": "wechat",
|
||||
"user_name": "wechat",
|
||||
"password": "@rn7Q+t5zeyKIZ~s",
|
||||
"tables": [
|
||||
{
|
||||
"table_name": "weather_disaster_notify",
|
||||
"table_description": "天气预警消息表"
|
||||
}
|
||||
]
|
||||
}
|
10
应用/1.0/logging.properties
Normal file
10
应用/1.0/logging.properties
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
|
||||
|
||||
.level = INFO
|
||||
|
||||
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;
|
2
应用/1.0/run.bat
Normal file
2
应用/1.0/run.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
java -jar disaster_warning-1.0-SNAPSHOT-jar-with-dependencies.jar
|
||||
pause
|
BIN
数据/和风天气/和风天气-城市代码.xlsx
Normal file
BIN
数据/和风天气/和风天气-城市代码.xlsx
Normal file
Binary file not shown.
23
数据/和风天气/实例-东山.json
Normal file
23
数据/和风天气/实例-东山.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"code": "200",
|
||||
"updateTime": "2022-04-22T15:54+08:00",
|
||||
"fxLink": "http://hfx.link/3645",
|
||||
"warning": [
|
||||
{
|
||||
"id": "10123060820220422061200476313081",
|
||||
"sender": "东山县气象台",
|
||||
"pubTime": "2022-04-22T06:12+08:00",
|
||||
"title": "东山县气象台发布大雾黄色预警[Ⅲ级/较重]",
|
||||
"status": "active",
|
||||
"level": "黄色",
|
||||
"type": "1017",
|
||||
"typeName": "大雾",
|
||||
"text": "东山县气象台2022年04月22日06时12分发布大雾黄色预警信号:预计未来12小时内,我县、闽南渔场和台湾浅滩渔场将出现能见度小于500米的雾。请注意防范!",
|
||||
"related": "",
|
||||
"urgency": "",
|
||||
"certainty": ""
|
||||
}
|
||||
],
|
||||
"refer": { "sources": ["12379"], "license": ["no commercial use"] },
|
||||
"testURL": "https://devapi.qweather.com/v7/warning/now?key=fe9fa8eeeb6f4301a92541eed565dd15&location=101230201"
|
||||
}
|
211
文档/example.java
Normal file
211
文档/example.java
Normal file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2022-04-18 11:37:33
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-04-18 15:58:34
|
||||
* @FilePath: \undefinedd:\develop\产险厦门分公司项目\天气灾害预警\文档\example.java
|
||||
|
||||
import org.apache.httpcomponents.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
|
||||
public class HttpUtils {
|
||||
public static String sendPostWithJson(String url, String jsonStr, HashMap<String, String> headers) {
|
||||
// 返回的结果
|
||||
String jsonResult = "";
|
||||
|
||||
try {
|
||||
HttpClient client = new HttpClient();
|
||||
|
||||
// 连接超时
|
||||
client.getHttpConnectionManager().getParams().setConnectionTimeout(3 * 1000);
|
||||
// 读取数据超时
|
||||
client.getHttpConnectionManager().getParams().setSoTimeout(3 * 60 * 1000);
|
||||
client.getParams().setContentCharset("UTF-8");
|
||||
|
||||
PostMethod postMethod = new PostMethod(url);
|
||||
|
||||
postMethod.setRequestHeader("content-type", headers.get("content-type"));
|
||||
|
||||
// 非空
|
||||
if (null != jsonStr && !"".equals(jsonStr)) {
|
||||
StringRequestEntity requestEntity = new StringRequestEntity(jsonStr, headers.get("content-type"),
|
||||
"UTF-8");
|
||||
postMethod.setRequestEntity(requestEntity);
|
||||
}
|
||||
|
||||
int status = client.executeMethod(postMethod);
|
||||
|
||||
if (status == HttpStatus.SC_OK) {
|
||||
jsonResult = postMethod.getResponseBodyAsString();
|
||||
} else {
|
||||
throw new RuntimeException("接口连接失败!");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("接口连接失败!");
|
||||
}
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String requestUrl = "http://localhost:8070/test/rz/server/rzxx/at_VaildToken.do";
|
||||
String jsonStr = "{\"name\":\"张三\"}";
|
||||
|
||||
HashMap<String, String> headers = new HashMap<>(3);
|
||||
headers.put("content-type", "application/json");
|
||||
|
||||
// 发送post请求
|
||||
String resultData = HttpUtils.sendPostWithJson(requestUrl, jsonStr, headers);
|
||||
|
||||
// 并接收返回结果
|
||||
System.out.println(resultData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author : cjd
|
||||
*
|
||||
* @description : post接口 返回结果字符串
|
||||
*
|
||||
* @params : [url, param]
|
||||
*
|
||||
* @param url 请求接口
|
||||
*
|
||||
* @param param 需要的json字符串
|
||||
*
|
||||
* @return :java.lang.String
|
||||
*
|
||||
* @date : 17:31 2018/8/1
|
||||
*
|
||||
*/
|
||||
|
||||
public static String sendPost(String url, String param)
|
||||
{
|
||||
OutputStreamWriter out = null;
|
||||
BufferedReader in = null;
|
||||
|
||||
String result = "";
|
||||
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
HttpURLConnection conn = null; // 打开和URL之间的连接
|
||||
|
||||
conn = (HttpURLConnection) realUrl.openConnection(); // 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
conn.setRequestMethod("POST"); // POST方法
|
||||
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
|
||||
conn.connect(); // 获取URLConnection对象对应的输出流
|
||||
|
||||
out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8"); // 发送请求参数
|
||||
out.write(param); // flush输出流的缓冲
|
||||
out.flush(); // 定义BufferedReader输入流来读取URL的响应
|
||||
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
|
||||
String line;
|
||||
while ((line = in.readLine()) != null)
|
||||
{
|
||||
result += line;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("发送 POST 请求出现异常!" + e);
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
} // 使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
try {
|
||||
if (out != null)
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
|
||||
if (in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String postMethod(String url,String param){
|
||||
// 结果值
|
||||
StringBuffer rest=new StringBuffer();
|
||||
|
||||
HttpURLConnection conn=null;
|
||||
OutputStream out=null;
|
||||
BufferedReader br=null;
|
||||
|
||||
try {
|
||||
// 创建 URL
|
||||
URL restUrl = new URL(url);
|
||||
// 打开连接
|
||||
conn= (HttpURLConnection) restUrl.openConnection();
|
||||
// 设置请求方式为 POST
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Connection","keep-Alive");
|
||||
// 设置接收文件类型
|
||||
// conn.setRequestProperty("Accept","application/json");
|
||||
//设置发送文件类型
|
||||
/**
|
||||
这里注意 传递JSON数据的话 就要设置
|
||||
普通参数的话 就要注释掉
|
||||
*/
|
||||
conn.setRequestProperty("Content-Type","application/json");
|
||||
// 输入 输出 都打开
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
//开始连接
|
||||
conn.connect();
|
||||
|
||||
// 传递参数 流的方式
|
||||
out=conn.getOutputStream();
|
||||
out.write(param.getBytes());
|
||||
out.flush();
|
||||
|
||||
// 读取数据
|
||||
br=new BufferedReader(new InputStreamReader(conn.getInputStream(),"utf-8"));
|
||||
String line=null;
|
||||
while (null != (line=br.readLine())){
|
||||
rest.append(line);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
// 关闭所有通道
|
||||
try {
|
||||
if (br!=null) {
|
||||
br.close();
|
||||
}
|
||||
if (out!=null) {
|
||||
out.close();
|
||||
}
|
||||
if (conn!=null) {
|
||||
conn.disconnect();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
return rest.toString();
|
||||
}
|
BIN
文档/公众号接口/~$发送接口调用文档.docx
Normal file
BIN
文档/公众号接口/~$发送接口调用文档.docx
Normal file
Binary file not shown.
BIN
文档/公众号接口/消息发送接口调用文档.docx
Normal file
BIN
文档/公众号接口/消息发送接口调用文档.docx
Normal file
Binary file not shown.
Reference in New Issue
Block a user