diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java index 790e7ff..f4e033b 100644 --- a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java +++ b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java @@ -26,4 +26,4 @@ return AppMessageConstants.CMD_TYPE_READCH4STATUS; } -} +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java index 790e7ff..f4e033b 100644 --- a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java +++ b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java @@ -26,4 +26,4 @@ return AppMessageConstants.CMD_TYPE_READCH4STATUS; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/server/ACUClient.java b/src/com/szpg/plc/server/ACUClient.java index 970d73e..5464023 100644 --- a/src/com/szpg/plc/server/ACUClient.java +++ b/src/com/szpg/plc/server/ACUClient.java @@ -1,18 +1,13 @@ package com.szpg.plc.server; -import java.net.InetSocketAddress; - -import org.apache.log4j.Logger; - import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; +import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.log4j.Logger; + +import java.net.InetSocketAddress; public class ACUClient { @@ -23,7 +18,7 @@ private Channel channel; - private String acucode; // ACU编码 + private String acucode; //ACU编码 private String net; //网络号 private String node; //节点号 private String unit; //单元号 diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java index 790e7ff..f4e033b 100644 --- a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java +++ b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java @@ -26,4 +26,4 @@ return AppMessageConstants.CMD_TYPE_READCH4STATUS; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/server/ACUClient.java b/src/com/szpg/plc/server/ACUClient.java index 970d73e..5464023 100644 --- a/src/com/szpg/plc/server/ACUClient.java +++ b/src/com/szpg/plc/server/ACUClient.java @@ -1,18 +1,13 @@ package com.szpg.plc.server; -import java.net.InetSocketAddress; - -import org.apache.log4j.Logger; - import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; +import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.log4j.Logger; + +import java.net.InetSocketAddress; public class ACUClient { @@ -23,7 +18,7 @@ private Channel channel; - private String acucode; // ACU编码 + private String acucode; //ACU编码 private String net; //网络号 private String node; //节点号 private String unit; //单元号 diff --git a/src/com/szpg/plc/server/ACUClientUtil.java b/src/com/szpg/plc/server/ACUClientUtil.java index c8545de..40ab958 100644 --- a/src/com/szpg/plc/server/ACUClientUtil.java +++ b/src/com/szpg/plc/server/ACUClientUtil.java @@ -1,13 +1,11 @@ package com.szpg.plc.server; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - +import com.szpg.plc.util.ByteUtil; +import io.netty.buffer.Unpooled; import org.apache.log4j.Logger; -import com.szpg.plc.util.ByteUtil; - -import io.netty.buffer.Unpooled; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ACUClientUtil { @@ -92,4 +90,4 @@ } } -} +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java index 790e7ff..f4e033b 100644 --- a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java +++ b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java @@ -26,4 +26,4 @@ return AppMessageConstants.CMD_TYPE_READCH4STATUS; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/server/ACUClient.java b/src/com/szpg/plc/server/ACUClient.java index 970d73e..5464023 100644 --- a/src/com/szpg/plc/server/ACUClient.java +++ b/src/com/szpg/plc/server/ACUClient.java @@ -1,18 +1,13 @@ package com.szpg.plc.server; -import java.net.InetSocketAddress; - -import org.apache.log4j.Logger; - import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; +import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.log4j.Logger; + +import java.net.InetSocketAddress; public class ACUClient { @@ -23,7 +18,7 @@ private Channel channel; - private String acucode; // ACU编码 + private String acucode; //ACU编码 private String net; //网络号 private String node; //节点号 private String unit; //单元号 diff --git a/src/com/szpg/plc/server/ACUClientUtil.java b/src/com/szpg/plc/server/ACUClientUtil.java index c8545de..40ab958 100644 --- a/src/com/szpg/plc/server/ACUClientUtil.java +++ b/src/com/szpg/plc/server/ACUClientUtil.java @@ -1,13 +1,11 @@ package com.szpg.plc.server; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - +import com.szpg.plc.util.ByteUtil; +import io.netty.buffer.Unpooled; import org.apache.log4j.Logger; -import com.szpg.plc.util.ByteUtil; - -import io.netty.buffer.Unpooled; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ACUClientUtil { @@ -92,4 +90,4 @@ } } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ACULinkTask.java b/src/com/szpg/task/ACULinkTask.java index 3fd77c9..8bae9bc 100644 --- a/src/com/szpg/task/ACULinkTask.java +++ b/src/com/szpg/task/ACULinkTask.java @@ -18,4 +18,4 @@ // 推送握手消息 ACUClientUtil.getInstance().sendACUCommand(client, content); } -} +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java index 790e7ff..f4e033b 100644 --- a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java +++ b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java @@ -26,4 +26,4 @@ return AppMessageConstants.CMD_TYPE_READCH4STATUS; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/server/ACUClient.java b/src/com/szpg/plc/server/ACUClient.java index 970d73e..5464023 100644 --- a/src/com/szpg/plc/server/ACUClient.java +++ b/src/com/szpg/plc/server/ACUClient.java @@ -1,18 +1,13 @@ package com.szpg.plc.server; -import java.net.InetSocketAddress; - -import org.apache.log4j.Logger; - import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; +import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.log4j.Logger; + +import java.net.InetSocketAddress; public class ACUClient { @@ -23,7 +18,7 @@ private Channel channel; - private String acucode; // ACU编码 + private String acucode; //ACU编码 private String net; //网络号 private String node; //节点号 private String unit; //单元号 diff --git a/src/com/szpg/plc/server/ACUClientUtil.java b/src/com/szpg/plc/server/ACUClientUtil.java index c8545de..40ab958 100644 --- a/src/com/szpg/plc/server/ACUClientUtil.java +++ b/src/com/szpg/plc/server/ACUClientUtil.java @@ -1,13 +1,11 @@ package com.szpg.plc.server; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - +import com.szpg.plc.util.ByteUtil; +import io.netty.buffer.Unpooled; import org.apache.log4j.Logger; -import com.szpg.plc.util.ByteUtil; - -import io.netty.buffer.Unpooled; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ACUClientUtil { @@ -92,4 +90,4 @@ } } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ACULinkTask.java b/src/com/szpg/task/ACULinkTask.java index 3fd77c9..8bae9bc 100644 --- a/src/com/szpg/task/ACULinkTask.java +++ b/src/com/szpg/task/ACULinkTask.java @@ -18,4 +18,4 @@ // 推送握手消息 ACUClientUtil.getInstance().sendACUCommand(client, content); } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadAssetInSpectionTask.java b/src/com/szpg/task/ReadAssetInSpectionTask.java new file mode 100644 index 0000000..9d40755 --- /dev/null +++ b/src/com/szpg/task/ReadAssetInSpectionTask.java @@ -0,0 +1,49 @@ +package com.szpg.task; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.dao.impl.PgAssetInSpectionImpl; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.data.PgAssetJson; +import com.szpg.util.HttpRequest; +import net.sf.json.JSONObject; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class ReadAssetInSpectionTask implements Runnable{ + + final String tableName="V_ASSET_INSPECTION_RECORD"; + final String url="http://10.10.2.31:9056/GLYW/api/Common/LoadIndexData"; + + @Override + public void run(){ + PgAssetInSpectionDao pgAssetInSpectionDao=new PgAssetInSpectionImpl(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + String startTime=pgAssetInSpectionDao.findLastRecordTime();//上次同步数据最后记录时间 + String endTime= dateFormat.format(new Date());//当前时间 + + StringBuilder sb = new StringBuilder(); + sb.append("tableName = ").append(tableName); + sb.append("&page=-1"); + sb.append("&strWhere=采集时间"); + sb.append("&between '").append(startTime); + sb.append("' and '").append(endTime); + sb.append("' order by 采集时间"); + + String jsonStr = HttpRequest.sendPostByHttp(url, sb.toString()); + + PgAssetJson pgAssetJson=getAssetJsonByJsonString(jsonStr); + List pgAssetInSpectionList=pgAssetJson.getRows(); + pgAssetInSpectionDao.addAssetInSpectionRecord(pgAssetInSpectionList); + } + + private PgAssetJson getAssetJsonByJsonString(String jsonStr){ + JSONObject jsonObject=JSONObject.fromObject(jsonStr); + PgAssetJson pgAssetJson=(PgAssetJson)JSONObject.toBean(jsonObject, PgAssetJson.class); + + return pgAssetJson; + } + +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java index 790e7ff..f4e033b 100644 --- a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java +++ b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java @@ -26,4 +26,4 @@ return AppMessageConstants.CMD_TYPE_READCH4STATUS; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/server/ACUClient.java b/src/com/szpg/plc/server/ACUClient.java index 970d73e..5464023 100644 --- a/src/com/szpg/plc/server/ACUClient.java +++ b/src/com/szpg/plc/server/ACUClient.java @@ -1,18 +1,13 @@ package com.szpg.plc.server; -import java.net.InetSocketAddress; - -import org.apache.log4j.Logger; - import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; +import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.log4j.Logger; + +import java.net.InetSocketAddress; public class ACUClient { @@ -23,7 +18,7 @@ private Channel channel; - private String acucode; // ACU编码 + private String acucode; //ACU编码 private String net; //网络号 private String node; //节点号 private String unit; //单元号 diff --git a/src/com/szpg/plc/server/ACUClientUtil.java b/src/com/szpg/plc/server/ACUClientUtil.java index c8545de..40ab958 100644 --- a/src/com/szpg/plc/server/ACUClientUtil.java +++ b/src/com/szpg/plc/server/ACUClientUtil.java @@ -1,13 +1,11 @@ package com.szpg.plc.server; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - +import com.szpg.plc.util.ByteUtil; +import io.netty.buffer.Unpooled; import org.apache.log4j.Logger; -import com.szpg.plc.util.ByteUtil; - -import io.netty.buffer.Unpooled; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ACUClientUtil { @@ -92,4 +90,4 @@ } } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ACULinkTask.java b/src/com/szpg/task/ACULinkTask.java index 3fd77c9..8bae9bc 100644 --- a/src/com/szpg/task/ACULinkTask.java +++ b/src/com/szpg/task/ACULinkTask.java @@ -18,4 +18,4 @@ // 推送握手消息 ACUClientUtil.getInstance().sendACUCommand(client, content); } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadAssetInSpectionTask.java b/src/com/szpg/task/ReadAssetInSpectionTask.java new file mode 100644 index 0000000..9d40755 --- /dev/null +++ b/src/com/szpg/task/ReadAssetInSpectionTask.java @@ -0,0 +1,49 @@ +package com.szpg.task; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.dao.impl.PgAssetInSpectionImpl; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.data.PgAssetJson; +import com.szpg.util.HttpRequest; +import net.sf.json.JSONObject; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class ReadAssetInSpectionTask implements Runnable{ + + final String tableName="V_ASSET_INSPECTION_RECORD"; + final String url="http://10.10.2.31:9056/GLYW/api/Common/LoadIndexData"; + + @Override + public void run(){ + PgAssetInSpectionDao pgAssetInSpectionDao=new PgAssetInSpectionImpl(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + String startTime=pgAssetInSpectionDao.findLastRecordTime();//上次同步数据最后记录时间 + String endTime= dateFormat.format(new Date());//当前时间 + + StringBuilder sb = new StringBuilder(); + sb.append("tableName = ").append(tableName); + sb.append("&page=-1"); + sb.append("&strWhere=采集时间"); + sb.append("&between '").append(startTime); + sb.append("' and '").append(endTime); + sb.append("' order by 采集时间"); + + String jsonStr = HttpRequest.sendPostByHttp(url, sb.toString()); + + PgAssetJson pgAssetJson=getAssetJsonByJsonString(jsonStr); + List pgAssetInSpectionList=pgAssetJson.getRows(); + pgAssetInSpectionDao.addAssetInSpectionRecord(pgAssetInSpectionList); + } + + private PgAssetJson getAssetJsonByJsonString(String jsonStr){ + JSONObject jsonObject=JSONObject.fromObject(jsonStr); + PgAssetJson pgAssetJson=(PgAssetJson)JSONObject.toBean(jsonObject, PgAssetJson.class); + + return pgAssetJson; + } + +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadMaintanceTask.java b/src/com/szpg/task/ReadMaintanceTask.java new file mode 100644 index 0000000..7c4ddb1 --- /dev/null +++ b/src/com/szpg/task/ReadMaintanceTask.java @@ -0,0 +1,49 @@ +package com.szpg.task; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.dao.impl.PgMaintanceDaoImpl; +import com.szpg.db.data.PgMainJson; +import com.szpg.db.data.PgMaintance; +import com.szpg.util.HttpRequest; +import net.sf.json.JSONObject; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class ReadMaintanceTask implements Runnable{ + + final String tableName="V_MaintanceRecord_Head"; + final String url="http://10.10.2.31:9056/GLYW/api/Common/LoadIndexData"; + + @Override + public void run(){ + PgMaintanceDao pgMaintanceDao=new PgMaintanceDaoImpl(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + String startTime=pgMaintanceDao.findLastRecordTime();//上次同步数据最后记录时间 + String endTime= dateFormat.format(new Date());//当前时间 + + StringBuilder sb = new StringBuilder(); + sb.append("tableName = ").append(tableName); + sb.append("&page=-1"); + sb.append("&strWhere=采集时间"); + sb.append("&between '").append(startTime); + sb.append("' and '").append(endTime); + sb.append("' order by 采集时间"); + + String jsonStr = HttpRequest.sendPostByHttp(url, sb.toString()); + + PgMainJson pgMainJson=getMintanceJsonByJsonString(jsonStr); + List pgMaintanceList=pgMainJson.getRows(); + pgMaintanceDao.addMaintanceRecord(pgMaintanceList); + } + + private PgMainJson getMintanceJsonByJsonString(String jsonStr){ + JSONObject jsonObject=JSONObject.fromObject(jsonStr); + PgMainJson pgMainJson=(PgMainJson)JSONObject.toBean(jsonObject, PgMainJson.class); + + return pgMainJson; + } + +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java index 790e7ff..f4e033b 100644 --- a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java +++ b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java @@ -26,4 +26,4 @@ return AppMessageConstants.CMD_TYPE_READCH4STATUS; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/server/ACUClient.java b/src/com/szpg/plc/server/ACUClient.java index 970d73e..5464023 100644 --- a/src/com/szpg/plc/server/ACUClient.java +++ b/src/com/szpg/plc/server/ACUClient.java @@ -1,18 +1,13 @@ package com.szpg.plc.server; -import java.net.InetSocketAddress; - -import org.apache.log4j.Logger; - import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; +import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.log4j.Logger; + +import java.net.InetSocketAddress; public class ACUClient { @@ -23,7 +18,7 @@ private Channel channel; - private String acucode; // ACU编码 + private String acucode; //ACU编码 private String net; //网络号 private String node; //节点号 private String unit; //单元号 diff --git a/src/com/szpg/plc/server/ACUClientUtil.java b/src/com/szpg/plc/server/ACUClientUtil.java index c8545de..40ab958 100644 --- a/src/com/szpg/plc/server/ACUClientUtil.java +++ b/src/com/szpg/plc/server/ACUClientUtil.java @@ -1,13 +1,11 @@ package com.szpg.plc.server; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - +import com.szpg.plc.util.ByteUtil; +import io.netty.buffer.Unpooled; import org.apache.log4j.Logger; -import com.szpg.plc.util.ByteUtil; - -import io.netty.buffer.Unpooled; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ACUClientUtil { @@ -92,4 +90,4 @@ } } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ACULinkTask.java b/src/com/szpg/task/ACULinkTask.java index 3fd77c9..8bae9bc 100644 --- a/src/com/szpg/task/ACULinkTask.java +++ b/src/com/szpg/task/ACULinkTask.java @@ -18,4 +18,4 @@ // 推送握手消息 ACUClientUtil.getInstance().sendACUCommand(client, content); } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadAssetInSpectionTask.java b/src/com/szpg/task/ReadAssetInSpectionTask.java new file mode 100644 index 0000000..9d40755 --- /dev/null +++ b/src/com/szpg/task/ReadAssetInSpectionTask.java @@ -0,0 +1,49 @@ +package com.szpg.task; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.dao.impl.PgAssetInSpectionImpl; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.data.PgAssetJson; +import com.szpg.util.HttpRequest; +import net.sf.json.JSONObject; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class ReadAssetInSpectionTask implements Runnable{ + + final String tableName="V_ASSET_INSPECTION_RECORD"; + final String url="http://10.10.2.31:9056/GLYW/api/Common/LoadIndexData"; + + @Override + public void run(){ + PgAssetInSpectionDao pgAssetInSpectionDao=new PgAssetInSpectionImpl(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + String startTime=pgAssetInSpectionDao.findLastRecordTime();//上次同步数据最后记录时间 + String endTime= dateFormat.format(new Date());//当前时间 + + StringBuilder sb = new StringBuilder(); + sb.append("tableName = ").append(tableName); + sb.append("&page=-1"); + sb.append("&strWhere=采集时间"); + sb.append("&between '").append(startTime); + sb.append("' and '").append(endTime); + sb.append("' order by 采集时间"); + + String jsonStr = HttpRequest.sendPostByHttp(url, sb.toString()); + + PgAssetJson pgAssetJson=getAssetJsonByJsonString(jsonStr); + List pgAssetInSpectionList=pgAssetJson.getRows(); + pgAssetInSpectionDao.addAssetInSpectionRecord(pgAssetInSpectionList); + } + + private PgAssetJson getAssetJsonByJsonString(String jsonStr){ + JSONObject jsonObject=JSONObject.fromObject(jsonStr); + PgAssetJson pgAssetJson=(PgAssetJson)JSONObject.toBean(jsonObject, PgAssetJson.class); + + return pgAssetJson; + } + +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadMaintanceTask.java b/src/com/szpg/task/ReadMaintanceTask.java new file mode 100644 index 0000000..7c4ddb1 --- /dev/null +++ b/src/com/szpg/task/ReadMaintanceTask.java @@ -0,0 +1,49 @@ +package com.szpg.task; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.dao.impl.PgMaintanceDaoImpl; +import com.szpg.db.data.PgMainJson; +import com.szpg.db.data.PgMaintance; +import com.szpg.util.HttpRequest; +import net.sf.json.JSONObject; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class ReadMaintanceTask implements Runnable{ + + final String tableName="V_MaintanceRecord_Head"; + final String url="http://10.10.2.31:9056/GLYW/api/Common/LoadIndexData"; + + @Override + public void run(){ + PgMaintanceDao pgMaintanceDao=new PgMaintanceDaoImpl(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + String startTime=pgMaintanceDao.findLastRecordTime();//上次同步数据最后记录时间 + String endTime= dateFormat.format(new Date());//当前时间 + + StringBuilder sb = new StringBuilder(); + sb.append("tableName = ").append(tableName); + sb.append("&page=-1"); + sb.append("&strWhere=采集时间"); + sb.append("&between '").append(startTime); + sb.append("' and '").append(endTime); + sb.append("' order by 采集时间"); + + String jsonStr = HttpRequest.sendPostByHttp(url, sb.toString()); + + PgMainJson pgMainJson=getMintanceJsonByJsonString(jsonStr); + List pgMaintanceList=pgMainJson.getRows(); + pgMaintanceDao.addMaintanceRecord(pgMaintanceList); + } + + private PgMainJson getMintanceJsonByJsonString(String jsonStr){ + JSONObject jsonObject=JSONObject.fromObject(jsonStr); + PgMainJson pgMainJson=(PgMainJson)JSONObject.toBean(jsonObject, PgMainJson.class); + + return pgMainJson; + } + +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadYWStatusTask.java b/src/com/szpg/task/ReadYWStatusTask.java index 6df45a8..e142f51 100644 --- a/src/com/szpg/task/ReadYWStatusTask.java +++ b/src/com/szpg/task/ReadYWStatusTask.java @@ -1,7 +1,5 @@ package com.szpg.task; -import java.util.Map; - import com.szpg.plc.message.AppMessageConstants; import com.szpg.plc.message.command.ReadMemoryCommand; import com.szpg.plc.protocol.fins.FINSConstants; @@ -11,10 +9,12 @@ import com.szpg.service.ReadControllerStatusService; import com.szpg.util.Configure; +import java.util.Map; + public class ReadYWStatusTask implements Runnable { private ReadControllerStatusService service; - + public ReadYWStatusTask() { service = new ReadControllerStatusService(); } @@ -23,27 +23,27 @@ public void run() { // 查找所有的client Map clients = ACUClientUtil.getInstance().getClients(); - + for (String key : clients.keySet()) { ACUClient client = clients.get(key); - + // 构造命令对象 ReadMemoryCommand command = ReadMemoryCommand.getInstance(AppMessageConstants.CMD_TYPE_READYWSTATUS); - String sour = Configure.getProperty("sys", "LOCALHOST.NET") + - Configure.getProperty("sys", "LOCALHOST.NODE") + - Configure.getProperty("sys", "LOCALHOST.UNIT"); + String sour = Configure.getProperty("sys", "LOCALHOST.NET") + + Configure.getProperty("sys", "LOCALHOST.NODE") + + Configure.getProperty("sys", "LOCALHOST.UNIT"); command.setMessageProducerId(sour); - + String dest = client.getNet() + client.getNode() + client.getUnit(); command.setDestinationId(dest); - + command.setMemoryArea(FINSConstants.MEMORY_WORK_AREA_WORD); - + command.setStartAddress(ByteUtil.binToHexString(ByteUtil.intToBins(Integer.parseInt(Configure.getProperty("acubl", client.getAcucode() + ".YWALM.START")), 2)) + "00"); command.setCountWord(Integer.parseInt(Configure.getProperty("acubl", client.getAcucode() + ".YWALM.WORDCOUNT"))); - + service.executeService(client, command); } } -} +} \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..40ed937 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..691ca64 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/fastjson_1_2_53.xml b/.idea/libraries/fastjson_1_2_53.xml new file mode 100644 index 0000000..c385419 --- /dev/null +++ b/.idea/libraries/fastjson_1_2_53.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/javax_servlet_api_3_1_0.xml b/.idea/libraries/javax_servlet_api_3_1_0.xml new file mode 100644 index 0000000..9a06f95 --- /dev/null +++ b/.idea/libraries/javax_servlet_api_3_1_0.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/json_lib_2_1_rev2.xml b/.idea/libraries/json_lib_2_1_rev2.xml new file mode 100644 index 0000000..0b2d49d --- /dev/null +++ b/.idea/libraries/json_lib_2_1_rev2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml new file mode 100644 index 0000000..b57715d --- /dev/null +++ b/.idea/libraries/lib.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ed21f8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3f3a21 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pgdsc.iml b/.idea/pgdsc.iml new file mode 100644 index 0000000..9aa6047 --- /dev/null +++ b/.idea/pgdsc.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar new file mode 100644 index 0000000..caf7ae3 --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-beanutils-1.8.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar new file mode 100644 index 0000000..c35fa1f --- /dev/null +++ b/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar new file mode 100644 index 0000000..1a8cd08 --- /dev/null +++ b/WebRoot/WEB-INF/lib/fastjson-1.2.53.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d --- /dev/null +++ b/WebRoot/WEB-INF/lib/javax.servlet-api-3.1.0.jar Binary files differ diff --git a/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar new file mode 100644 index 0000000..3aa6b2a --- /dev/null +++ b/WebRoot/WEB-INF/lib/json-lib-2.1-rev2.jar Binary files differ diff --git a/src/com/szpg/db/dao/PgAcuCmdDao.java b/src/com/szpg/db/dao/PgAcuCmdDao.java index 73070a5..f47ba30 100644 --- a/src/com/szpg/db/dao/PgAcuCmdDao.java +++ b/src/com/szpg/db/dao/PgAcuCmdDao.java @@ -1,9 +1,9 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgAcuCmd; +import java.util.List; + public interface PgAcuCmdDao { public List findAll(); @@ -16,4 +16,4 @@ public int deleteCmdRecord(String cmdId); public int deleteTimeoutCmd(); -} +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/PgAssetInSpectionDao.java b/src/com/szpg/db/dao/PgAssetInSpectionDao.java new file mode 100644 index 0000000..444a551 --- /dev/null +++ b/src/com/szpg/db/dao/PgAssetInSpectionDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgAssetInSpection; + +import java.util.List; + +public interface PgAssetInSpectionDao { + + public void addAssetInSpectionRecord(List pgAssetInSpectionList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/PgCODao.java b/src/com/szpg/db/dao/PgCODao.java index 5b3c06c..09805ed 100644 --- a/src/com/szpg/db/dao/PgCODao.java +++ b/src/com/szpg/db/dao/PgCODao.java @@ -1,10 +1,10 @@ package com.szpg.db.dao; -import java.util.List; - import com.szpg.db.data.PgCO; import com.szpg.db.data.PgCOAlm; +import java.util.List; + /** * 一氧化碳相关参数读写的数据库接口 * @author admin @@ -22,8 +22,7 @@ public int addPblzRecord(PgCO ch4); public int addPblzRecord(float value, String tm, int deviceid); - - + /******** 一氧化碳浓度报警状态 ********/ public List findAllSbjz(); public PgCOAlm findSbjzById(Integer id); diff --git a/src/com/szpg/db/dao/PgMaintanceDao.java b/src/com/szpg/db/dao/PgMaintanceDao.java new file mode 100644 index 0000000..040888e --- /dev/null +++ b/src/com/szpg/db/dao/PgMaintanceDao.java @@ -0,0 +1,13 @@ +package com.szpg.db.dao; + +import com.szpg.db.data.PgMaintance; + +import java.util.List; + +public interface PgMaintanceDao { + + public void addMaintanceRecord(List pgMaintanceList); + + public String findLastRecordTime(); + +} diff --git a/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java new file mode 100644 index 0000000..b49c688 --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgAssetInSpectionImpl.java @@ -0,0 +1,111 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgAssetInSpectionImpl implements PgAssetInSpectionDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addAssetInSpectionRecord(List pgAssetInSpectionList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_ASSET_INSPECTION_RECORD " + + "(KEY_ID, PLAN_ID, CREATE_DATE, STATE,CREATOR,PLAN_NAME,RECORD_NO,PLAN_NO,RESPONSIBIE_DEPT," + + "INSPECTION_PERSON,PATROL_MAN,OPERATE_DATE,REMARK,BUILD_CABIN,PROJECT,START_PILE_NO,END_PILE_NO," + + "INSPECTION_PRACE,OTHER_PATROL_MAN) " + + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgAssetInSpection pgAssetInSpection:pgAssetInSpectionList){ + Object[] params = new Object[19]; + params[0] = pgAssetInSpection.getKEY_ID(); + params[1] = pgAssetInSpection.getPLAN_ID(); + params[2] = pgAssetInSpection.getCREATE_DATE(); + params[3] = pgAssetInSpection.getSTATE(); + params[4]=pgAssetInSpection.getCREATOR(); + params[5]=pgAssetInSpection.getPLAN_NAME(); + params[6]=pgAssetInSpection.getRECORD_NO(); + params[7]=pgAssetInSpection.getPLAN_NO(); + params[8]=pgAssetInSpection.getRESPONSIBLE_DEPT(); + params[9]=pgAssetInSpection.getINSPECTION_PERSON(); + params[10]=pgAssetInSpection.getPATROL_MAN(); + params[11]=pgAssetInSpection.getOPERATE_DATE(); + params[12]=pgAssetInSpection.getREMARK(); + params[13]=pgAssetInSpection.getBUILD_CABIN(); + params[14]=pgAssetInSpection.getPROJECT(); + params[15]=pgAssetInSpection.getSTART_PILE_NO(); + params[16]=pgAssetInSpection.getEND_PILE_NO(); + params[17]=pgAssetInSpection.getINSPECTION_PRACE(); + params[18]=pgAssetInSpection.getOTHER_PATROL_MAN(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("巡检数据同步成功" + pgAssetInSpectionList.toString()); + else + logger.error("巡检数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("巡检数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_ASSET_INSPECTION_RECORD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgAssetInSpectionList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgAssetInSpection.class)); + + if (null != pgAssetInSpectionList && pgAssetInSpectionList.isEmpty() == false) { + logger.debug("获取最新巡检记录成功[" + pgAssetInSpectionList.size() + "]"); + return pgAssetInSpectionList.get(0).getCREATE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新巡检记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + +} \ No newline at end of file diff --git a/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java new file mode 100644 index 0000000..227587c --- /dev/null +++ b/src/com/szpg/db/dao/impl/PgMaintanceDaoImpl.java @@ -0,0 +1,101 @@ +package com.szpg.db.dao.impl; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.data.PgMaintance; +import com.szpg.db.util.ConnectionManager; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class PgMaintanceDaoImpl implements PgMaintanceDao { + + private final Logger logger = Logger.getLogger(this.getClass().getName()); + + @Override + public void addMaintanceRecord(List pgMaintanceList){ + Connection conn = null; + + String insertStr = "INSERT INTO PG_MAINTANCERECORD_HEAD " + + "(KEY_ID, PLAN_KEY_ID, PLAN_NAME, RECORD_NO,REOAIRMAN,MAINTENANCE_DATE,BUILD_CABIN,PROJECT,CREATEDATE," + + "CREATOR) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + + List paramObjectList=new ArrayList(); + for(PgMaintance pgMaintance:pgMaintanceList){ + Object[] params = new Object[19]; + params[0] = pgMaintance.getKEY_ID(); + params[1] = pgMaintance.getPLAN_KEY_ID(); + params[2] = pgMaintance.getPLAN_NAME(); + params[3] = pgMaintance.getRECORD_NO(); + params[4]=pgMaintance.getREOAIRMAN(); + params[5]=pgMaintance.getMAINTENANCE_DATE(); + params[6]=pgMaintance.getBUILD_CABIN(); + params[7]=pgMaintance.getPROJECT(); + params[8]=pgMaintance.getCREATEDATE(); + params[9]=pgMaintance.getCREATOR(); + + paramObjectList.add(params); + } + + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + for (Object[] params:paramObjectList) { + int count = runner.update(conn, insertStr, params); + if (count > 0) + logger.debug("维护数据同步成功" + pgMaintanceList.toString()); + else + logger.error("维护数据同步失败!"); + } + + } catch (Exception ex) { + logger.error("维护数据同步异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + public String findLastRecordTime(){ + Connection conn = null; + + String queryStr = "SELECT * FROM PG_MAINTANCERECORD_HEAD ORDER BY ID DESC"; + try { + conn = ConnectionManager.getConnectionFromC3P0(); + conn.setAutoCommit(false); + + QueryRunner runner = new QueryRunner(); + List pgMaintanceList = (List) runner.query(conn, + queryStr, new BeanListHandler(PgMaintance.class)); + + if (null != pgMaintanceList && pgMaintanceList.isEmpty() == false) { + logger.debug("获取最新维护记录成功[" + pgMaintanceList.size() + "]"); + return pgMaintanceList.get(0).getMAINTENANCE_DATE(); + } + else + return null; + } catch (Exception ex) { + logger.error("获取最新维护记录异常", ex); + } finally { + try { + DbUtils.commitAndClose(conn); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return null; + } + + +} diff --git a/src/com/szpg/db/data/PgAcu.java b/src/com/szpg/db/data/PgAcu.java index 0abd8e9..2b7c84d 100644 --- a/src/com/szpg/db/data/PgAcu.java +++ b/src/com/szpg/db/data/PgAcu.java @@ -84,4 +84,4 @@ public String toString() { return "PgAcu[" + acu_host + ":" + acu_port + "," + acu_net + acu_node + acu_unit + "]"; } -} +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetInSpection.java b/src/com/szpg/db/data/PgAssetInSpection.java new file mode 100644 index 0000000..e37da0a --- /dev/null +++ b/src/com/szpg/db/data/PgAssetInSpection.java @@ -0,0 +1,206 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgAssetInSpection implements Serializable { + + //private Long id; + private String problems; + private String finish; + private String KEY_ID;//巡检记录单id + private String PLAN_ID;//巡检计划ID + private String CREATE_DATE;//创建时间 + private String STATE;//巡检记录状态 + private String CREATOR;//创建人 + private String PLAN_NAME;//计划名称 + private String RECORD_NO;//记录单号 + private String PLAN_NO;//巡检计划编号 + private String RESPONSIBLE_DEPT;//负责单位部门小组 + private String INSPECTION_PERSON;//计划巡检人 + private String PATROL_MAN;//巡检人 + private String OPERATE_DATE;//计划巡检日期 + private String REMARK;//巡检记录 + private String BUILD_CABIN;//舱室 + private String PROJECT;//所属项目 + private String START_PILE_NO;//开始桩号 + private String END_PILE_NO;//结束桩号 + private String INSPECTION_PRACE;//巡检地点 + private String OTHER_PATROL_MAN;//其他巡检人 + private String rowNum; + + public String getProblems() { + return problems; + } + + public void setProblems(String problems) { + this.problems = problems; + } + + public String getFinish() { + return finish; + } + + public void setFinish(String finish) { + this.finish = finish; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_ID() { + return PLAN_ID; + } + + public void setPLAN_ID(String PLAN_ID) { + this.PLAN_ID = PLAN_ID; + } + + public String getCREATE_DATE() { + return CREATE_DATE; + } + + public void setCREATE_DATE(String CREATE_DATE) { + this.CREATE_DATE = CREATE_DATE; + } + + public String getSTATE() { + return STATE; + } + + public void setSTATE(String STATE) { + this.STATE = STATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getPLAN_NO() { + return PLAN_NO; + } + + public void setPLAN_NO(String PLAN_NO) { + this.PLAN_NO = PLAN_NO; + } + + public String getRESPONSIBLE_DEPT() { + return RESPONSIBLE_DEPT; + } + + public void setRESPONSIBLE_DEPT(String RESPONSIBLE_DEPT) { + this.RESPONSIBLE_DEPT = RESPONSIBLE_DEPT; + } + + public String getINSPECTION_PERSON() { + return INSPECTION_PERSON; + } + + public void setINSPECTION_PERSON(String INSPECTION_PERSON) { + this.INSPECTION_PERSON = INSPECTION_PERSON; + } + + public String getPATROL_MAN() { + return PATROL_MAN; + } + + public void setPATROL_MAN(String PATROL_MAN) { + this.PATROL_MAN = PATROL_MAN; + } + + public String getOPERATE_DATE() { + return OPERATE_DATE; + } + + public void setOPERATE_DATE(String OPERATE_DATE) { + this.OPERATE_DATE = OPERATE_DATE; + } + + public String getREMARK() { + return REMARK; + } + + public void setREMARK(String REMARK) { + this.REMARK = REMARK; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getSTART_PILE_NO() { + return START_PILE_NO; + } + + public void setSTART_PILE_NO(String START_PILE_NO) { + this.START_PILE_NO = START_PILE_NO; + } + + public String getEND_PILE_NO() { + return END_PILE_NO; + } + + public void setEND_PILE_NO(String END_PILE_NO) { + this.END_PILE_NO = END_PILE_NO; + } + + public String getINSPECTION_PRACE() { + return INSPECTION_PRACE; + } + + public void setINSPECTION_PRACE(String INSPECTION_PRACE) { + this.INSPECTION_PRACE = INSPECTION_PRACE; + } + + public String getOTHER_PATROL_MAN() { + return OTHER_PATROL_MAN; + } + + public void setOTHER_PATROL_MAN(String OTHER_PATROL_MAN) { + this.OTHER_PATROL_MAN = OTHER_PATROL_MAN; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} \ No newline at end of file diff --git a/src/com/szpg/db/data/PgAssetJson.java b/src/com/szpg/db/data/PgAssetJson.java new file mode 100644 index 0000000..2c801ae --- /dev/null +++ b/src/com/szpg/db/data/PgAssetJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgAssetJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgAssetInSpectionList = fromObject.toList(fromObject,PgAssetInSpection.class); + + return pgAssetInSpectionList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMainJson.java b/src/com/szpg/db/data/PgMainJson.java new file mode 100644 index 0000000..467b663 --- /dev/null +++ b/src/com/szpg/db/data/PgMainJson.java @@ -0,0 +1,58 @@ +package com.szpg.db.data; + +import net.sf.json.JSONArray; + +import java.util.List; + +public class PgMainJson { + + private String total; + private String totalRecords; + private String page; + private String records; + private List rows; + + public String getTotal() { + return total; + } + + public void setTotal(String total) { + this.total = total; + } + + public String getTotalRecords() { + return totalRecords; + } + + public void setTotalRecords(String totalRecords) { + this.totalRecords = totalRecords; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public String getRecords() { + return records; + } + + public void setRecords(String records) { + this.records = records; + } + + public List getRows() { + JSONArray fromObject = JSONArray.fromObject(rows); + List pgMaintanceList = fromObject.toList(fromObject,PgMaintance.class); + + return pgMaintanceList; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/src/com/szpg/db/data/PgMaintance.java b/src/com/szpg/db/data/PgMaintance.java new file mode 100644 index 0000000..fad025d --- /dev/null +++ b/src/com/szpg/db/data/PgMaintance.java @@ -0,0 +1,115 @@ +package com.szpg.db.data; + +import java.io.Serializable; + +public class PgMaintance implements Serializable { + + private String FINISH; + private String KEY_ID; + private String PLAN_KEY_ID; + private String PLAN_NAME; + private String RECORD_NO; + private String REOAIRMAN; + private String MAINTENANCE_DATE; + private String BUILD_CABIN; + private String PROJECT; + private String CREATEDATE; + private String CREATOR; + private String rowNum; + + public String getFINISH() { + return FINISH; + } + + public void setFINISH(String FINISH) { + this.FINISH = FINISH; + } + + public String getKEY_ID() { + return KEY_ID; + } + + public void setKEY_ID(String KEY_ID) { + this.KEY_ID = KEY_ID; + } + + public String getPLAN_KEY_ID() { + return PLAN_KEY_ID; + } + + public void setPLAN_KEY_ID(String PLAN_KEY_ID) { + this.PLAN_KEY_ID = PLAN_KEY_ID; + } + + public String getPLAN_NAME() { + return PLAN_NAME; + } + + public void setPLAN_NAME(String PLAN_NAME) { + this.PLAN_NAME = PLAN_NAME; + } + + public String getRECORD_NO() { + return RECORD_NO; + } + + public void setRECORD_NO(String RECORD_NO) { + this.RECORD_NO = RECORD_NO; + } + + public String getREOAIRMAN() { + return REOAIRMAN; + } + + public void setREOAIRMAN(String REOAIRMAN) { + this.REOAIRMAN = REOAIRMAN; + } + + public String getMAINTENANCE_DATE() { + return MAINTENANCE_DATE; + } + + public void setMAINTENANCE_DATE(String MAINTENANCE_DATE) { + this.MAINTENANCE_DATE = MAINTENANCE_DATE; + } + + public String getBUILD_CABIN() { + return BUILD_CABIN; + } + + public void setBUILD_CABIN(String BUILD_CABIN) { + this.BUILD_CABIN = BUILD_CABIN; + } + + public String getPROJECT() { + return PROJECT; + } + + public void setPROJECT(String PROJECT) { + this.PROJECT = PROJECT; + } + + public String getCREATEDATE() { + return CREATEDATE; + } + + public void setCREATEDATE(String CREATEDATE) { + this.CREATEDATE = CREATEDATE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getRowNum() { + return rowNum; + } + + public void setRowNum(String rowNum) { + this.rowNum = rowNum; + } +} diff --git a/src/com/szpg/db/data/PgO2.java b/src/com/szpg/db/data/PgO2.java index 3fd4182..22a0279 100644 --- a/src/com/szpg/db/data/PgO2.java +++ b/src/com/szpg/db/data/PgO2.java @@ -62,12 +62,12 @@ public void setPgdeviceid(Integer pgdeviceid) { this.pgdeviceid = pgdeviceid; } - + public void setTm(Date tm) { this.logtime = tm; this.uptime = tm; } - + public String getTmStr() { if (null != this.logtime) { return TimeFormat.formatTimestamp(logtime); diff --git a/src/com/szpg/db/test/PgAcuDaoTest.java b/src/com/szpg/db/test/PgAcuDaoTest.java index 07c8fbd..4355707 100644 --- a/src/com/szpg/db/test/PgAcuDaoTest.java +++ b/src/com/szpg/db/test/PgAcuDaoTest.java @@ -1,12 +1,11 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgAcuDao; import com.szpg.db.dao.impl.PgAcuDaoImpl; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class PgAcuDaoTest { diff --git a/src/com/szpg/db/test/PgCH4DaoTest.java b/src/com/szpg/db/test/PgCH4DaoTest.java index 8377965..944616c 100644 --- a/src/com/szpg/db/test/PgCH4DaoTest.java +++ b/src/com/szpg/db/test/PgCH4DaoTest.java @@ -1,16 +1,15 @@ package com.szpg.db.test; -import static org.junit.Assert.assertEquals; - -import java.util.Calendar; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - +import com.opensymphony.xwork2.interceptor.annotations.Before; import com.szpg.db.dao.PgCh4Dao; import com.szpg.db.dao.impl.PgCh4DaoImpl; import com.szpg.util.TimeFormat; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Calendar; + +import static org.junit.Assert.assertEquals; public class PgCH4DaoTest { diff --git a/src/com/szpg/plc/PGDSCServlet.java b/src/com/szpg/plc/PGDSCServlet.java index f4d1659..91f1816 100644 --- a/src/com/szpg/plc/PGDSCServlet.java +++ b/src/com/szpg/plc/PGDSCServlet.java @@ -13,19 +13,7 @@ import com.szpg.db.data.PgAcu; import com.szpg.plc.server.ACUClient; import com.szpg.plc.server.ACUClientUtil; -import com.szpg.task.ACUSocketCheckTask; -import com.szpg.task.ReadCH4StatusTask; -import com.szpg.task.ReadCH4ValueTask; -import com.szpg.task.ReadCOStatusTask; -import com.szpg.task.ReadCOValueTask; -import com.szpg.task.ReadDSStatusTask; -import com.szpg.task.ReadHSStatusTask; -import com.szpg.task.ReadHSValueTask; -import com.szpg.task.ReadO2StatusTask; -import com.szpg.task.ReadO2ValueTask; -import com.szpg.task.ReadWSStatusTask; -import com.szpg.task.ReadWSValueTask; -import com.szpg.task.ReadYWStatusTask; +import com.szpg.task.*; public class PGDSCServlet extends HttpServlet { @@ -81,6 +69,12 @@ // 9液位报警 sendYWStatusCommand(); + + //10巡检数据同步 + synchAssetInSpection(); + + //运维数据同步 + synchMaintanceRecord(); } /** @@ -195,4 +189,23 @@ ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); sche.scheduleWithFixedDelay(new ReadYWStatusTask(), 70, 600, TimeUnit.SECONDS); } -} + + /** + * 调用巡检接口同步数据 + * @param + */ + private void synchAssetInSpection() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadAssetInSpectionTask(), 60, 600, TimeUnit.SECONDS); + } + + /** + * 调用维护接口同步数据 + * @param + */ + private void synchMaintanceRecord() { + ScheduledExecutorService sche = new ScheduledThreadPoolExecutor(1); + sche.scheduleWithFixedDelay(new ReadMaintanceTask(), 60, 600, TimeUnit.SECONDS); + } + +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/AppMessageConstants.java b/src/com/szpg/plc/message/AppMessageConstants.java index 01cbef7..b9dd3ac 100644 --- a/src/com/szpg/plc/message/AppMessageConstants.java +++ b/src/com/szpg/plc/message/AppMessageConstants.java @@ -13,7 +13,7 @@ public final static String CMD_TYPE_READO2STATUS = "17"; //读取氧气报警状态命令 public final static String CMD_TYPE_READHSVALUE = "18"; //读取硫化氢监测值命令 public final static String CMD_TYPE_READHSSTATUS = "19"; //读取硫化氢报警状态命令 - + public final static String CMD_TYPE_READYWSTATUS = "21"; //读取爆管液位报警状态命令 public final static String CMD_TYPE_READDSSTATUS = "22"; //读取对射报警状态命令 public final static String CMD_TYPE_READFJSTAT = "23"; //读取风机运行状态命令 @@ -23,15 +23,15 @@ public final static String CMD_TYPE_READZMSTAT = "27"; //读取照明运行状态命令 public final static String CMD_TYPE_READZMRUNTIME = "28"; //读取照明运行时长命令 public final static String CMD_TYPE_READJGSTATUS = "29"; //读取井盖状态命令 - - + + public final static String CMD_TYPE_SETZMON = "50"; // 设置照明启动位命令 public final static String CMD_TYPE_SETZMOFF = "51"; // 设置照明停止位命令 public final static String CMD_TYPE_SETFJON = "52"; // 设置风机启动位命令 public final static String CMD_TYPE_SETFJOFF = "53"; // 设置风机停止位命令 public final static String CMD_TYPE_SETJGUNLOCK = "54"; // 设置井盖锁定位 public final static String CMD_TYPE_SETDSRESET = "55"; // 清除对射报警 - + public final static String CMD_TYPE_SETCH4THRESHOLD = "60"; // 设置甲烷浓度报警阈值 public final static String CMD_TYPE_SETHSTHRESHOLD = "61"; // 设置硫化氢浓度报警阈值 public final static String CMD_TYPE_SETWDTHRESHOLD = "62"; // 设置温度报警阈值 diff --git a/src/com/szpg/plc/message/UnKnownMessage.java b/src/com/szpg/plc/message/UnKnownMessage.java index d0418f4..89356fe 100644 --- a/src/com/szpg/plc/message/UnKnownMessage.java +++ b/src/com/szpg/plc/message/UnKnownMessage.java @@ -46,7 +46,6 @@ } } - public void afterAction() { // 记录日志 logger.info("未知消息:" + getHexContentShort()); @@ -62,4 +61,4 @@ return str; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java index 790e7ff..f4e033b 100644 --- a/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java +++ b/src/com/szpg/plc/message/command/read/ReadCH4StatusCommand.java @@ -26,4 +26,4 @@ return AppMessageConstants.CMD_TYPE_READCH4STATUS; } -} +} \ No newline at end of file diff --git a/src/com/szpg/plc/server/ACUClient.java b/src/com/szpg/plc/server/ACUClient.java index 970d73e..5464023 100644 --- a/src/com/szpg/plc/server/ACUClient.java +++ b/src/com/szpg/plc/server/ACUClient.java @@ -1,18 +1,13 @@ package com.szpg.plc.server; -import java.net.InetSocketAddress; - -import org.apache.log4j.Logger; - import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; +import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.log4j.Logger; + +import java.net.InetSocketAddress; public class ACUClient { @@ -23,7 +18,7 @@ private Channel channel; - private String acucode; // ACU编码 + private String acucode; //ACU编码 private String net; //网络号 private String node; //节点号 private String unit; //单元号 diff --git a/src/com/szpg/plc/server/ACUClientUtil.java b/src/com/szpg/plc/server/ACUClientUtil.java index c8545de..40ab958 100644 --- a/src/com/szpg/plc/server/ACUClientUtil.java +++ b/src/com/szpg/plc/server/ACUClientUtil.java @@ -1,13 +1,11 @@ package com.szpg.plc.server; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - +import com.szpg.plc.util.ByteUtil; +import io.netty.buffer.Unpooled; import org.apache.log4j.Logger; -import com.szpg.plc.util.ByteUtil; - -import io.netty.buffer.Unpooled; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ACUClientUtil { @@ -92,4 +90,4 @@ } } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ACULinkTask.java b/src/com/szpg/task/ACULinkTask.java index 3fd77c9..8bae9bc 100644 --- a/src/com/szpg/task/ACULinkTask.java +++ b/src/com/szpg/task/ACULinkTask.java @@ -18,4 +18,4 @@ // 推送握手消息 ACUClientUtil.getInstance().sendACUCommand(client, content); } -} +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadAssetInSpectionTask.java b/src/com/szpg/task/ReadAssetInSpectionTask.java new file mode 100644 index 0000000..9d40755 --- /dev/null +++ b/src/com/szpg/task/ReadAssetInSpectionTask.java @@ -0,0 +1,49 @@ +package com.szpg.task; + +import com.szpg.db.dao.PgAssetInSpectionDao; +import com.szpg.db.dao.impl.PgAssetInSpectionImpl; +import com.szpg.db.data.PgAssetInSpection; +import com.szpg.db.data.PgAssetJson; +import com.szpg.util.HttpRequest; +import net.sf.json.JSONObject; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class ReadAssetInSpectionTask implements Runnable{ + + final String tableName="V_ASSET_INSPECTION_RECORD"; + final String url="http://10.10.2.31:9056/GLYW/api/Common/LoadIndexData"; + + @Override + public void run(){ + PgAssetInSpectionDao pgAssetInSpectionDao=new PgAssetInSpectionImpl(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + String startTime=pgAssetInSpectionDao.findLastRecordTime();//上次同步数据最后记录时间 + String endTime= dateFormat.format(new Date());//当前时间 + + StringBuilder sb = new StringBuilder(); + sb.append("tableName = ").append(tableName); + sb.append("&page=-1"); + sb.append("&strWhere=采集时间"); + sb.append("&between '").append(startTime); + sb.append("' and '").append(endTime); + sb.append("' order by 采集时间"); + + String jsonStr = HttpRequest.sendPostByHttp(url, sb.toString()); + + PgAssetJson pgAssetJson=getAssetJsonByJsonString(jsonStr); + List pgAssetInSpectionList=pgAssetJson.getRows(); + pgAssetInSpectionDao.addAssetInSpectionRecord(pgAssetInSpectionList); + } + + private PgAssetJson getAssetJsonByJsonString(String jsonStr){ + JSONObject jsonObject=JSONObject.fromObject(jsonStr); + PgAssetJson pgAssetJson=(PgAssetJson)JSONObject.toBean(jsonObject, PgAssetJson.class); + + return pgAssetJson; + } + +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadMaintanceTask.java b/src/com/szpg/task/ReadMaintanceTask.java new file mode 100644 index 0000000..7c4ddb1 --- /dev/null +++ b/src/com/szpg/task/ReadMaintanceTask.java @@ -0,0 +1,49 @@ +package com.szpg.task; + +import com.szpg.db.dao.PgMaintanceDao; +import com.szpg.db.dao.impl.PgMaintanceDaoImpl; +import com.szpg.db.data.PgMainJson; +import com.szpg.db.data.PgMaintance; +import com.szpg.util.HttpRequest; +import net.sf.json.JSONObject; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class ReadMaintanceTask implements Runnable{ + + final String tableName="V_MaintanceRecord_Head"; + final String url="http://10.10.2.31:9056/GLYW/api/Common/LoadIndexData"; + + @Override + public void run(){ + PgMaintanceDao pgMaintanceDao=new PgMaintanceDaoImpl(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + String startTime=pgMaintanceDao.findLastRecordTime();//上次同步数据最后记录时间 + String endTime= dateFormat.format(new Date());//当前时间 + + StringBuilder sb = new StringBuilder(); + sb.append("tableName = ").append(tableName); + sb.append("&page=-1"); + sb.append("&strWhere=采集时间"); + sb.append("&between '").append(startTime); + sb.append("' and '").append(endTime); + sb.append("' order by 采集时间"); + + String jsonStr = HttpRequest.sendPostByHttp(url, sb.toString()); + + PgMainJson pgMainJson=getMintanceJsonByJsonString(jsonStr); + List pgMaintanceList=pgMainJson.getRows(); + pgMaintanceDao.addMaintanceRecord(pgMaintanceList); + } + + private PgMainJson getMintanceJsonByJsonString(String jsonStr){ + JSONObject jsonObject=JSONObject.fromObject(jsonStr); + PgMainJson pgMainJson=(PgMainJson)JSONObject.toBean(jsonObject, PgMainJson.class); + + return pgMainJson; + } + +} \ No newline at end of file diff --git a/src/com/szpg/task/ReadYWStatusTask.java b/src/com/szpg/task/ReadYWStatusTask.java index 6df45a8..e142f51 100644 --- a/src/com/szpg/task/ReadYWStatusTask.java +++ b/src/com/szpg/task/ReadYWStatusTask.java @@ -1,7 +1,5 @@ package com.szpg.task; -import java.util.Map; - import com.szpg.plc.message.AppMessageConstants; import com.szpg.plc.message.command.ReadMemoryCommand; import com.szpg.plc.protocol.fins.FINSConstants; @@ -11,10 +9,12 @@ import com.szpg.service.ReadControllerStatusService; import com.szpg.util.Configure; +import java.util.Map; + public class ReadYWStatusTask implements Runnable { private ReadControllerStatusService service; - + public ReadYWStatusTask() { service = new ReadControllerStatusService(); } @@ -23,27 +23,27 @@ public void run() { // 查找所有的client Map clients = ACUClientUtil.getInstance().getClients(); - + for (String key : clients.keySet()) { ACUClient client = clients.get(key); - + // 构造命令对象 ReadMemoryCommand command = ReadMemoryCommand.getInstance(AppMessageConstants.CMD_TYPE_READYWSTATUS); - String sour = Configure.getProperty("sys", "LOCALHOST.NET") + - Configure.getProperty("sys", "LOCALHOST.NODE") + - Configure.getProperty("sys", "LOCALHOST.UNIT"); + String sour = Configure.getProperty("sys", "LOCALHOST.NET") + + Configure.getProperty("sys", "LOCALHOST.NODE") + + Configure.getProperty("sys", "LOCALHOST.UNIT"); command.setMessageProducerId(sour); - + String dest = client.getNet() + client.getNode() + client.getUnit(); command.setDestinationId(dest); - + command.setMemoryArea(FINSConstants.MEMORY_WORK_AREA_WORD); - + command.setStartAddress(ByteUtil.binToHexString(ByteUtil.intToBins(Integer.parseInt(Configure.getProperty("acubl", client.getAcucode() + ".YWALM.START")), 2)) + "00"); command.setCountWord(Integer.parseInt(Configure.getProperty("acubl", client.getAcucode() + ".YWALM.WORDCOUNT"))); - + service.executeService(client, command); } } -} +} \ No newline at end of file diff --git a/src/com/szpg/util/TimeFormat.java b/src/com/szpg/util/TimeFormat.java index fd78b00..00175e4 100644 --- a/src/com/szpg/util/TimeFormat.java +++ b/src/com/szpg/util/TimeFormat.java @@ -75,7 +75,6 @@ return formatter.format(date); } - /** * 解析日期字符�? *