From ddf0dc9d26e4e046431e9bdb1ce8b346270d3156 Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期日, 26 五月 2024 18:58:30 +0800 Subject: [PATCH] 完成布控模块 --- .idea/vcs.xml | 6 .idea/modules.xml | 8 go.sum | 126 +++++ .idea/workspace.xml | 696 +++++++++++++++++++++++++++++ .idea/encodings.xml | 4 db/database.go | 39 + ruleModelEngine.iml | 9 db/elastic.go | 381 +++++++++++++++ db/models.go | 156 ++++++ .idea/misc.xml | 6 10 files changed, 1,431 insertions(+), 0 deletions(-) diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding" addBOMForNewFiles="with NO BOM" /> +</project> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectRootManager"> + <output url="file://$PROJECT_DIR$/out" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e4a1151 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/ruleModelEngine.iml" filepath="$PROJECT_DIR$/ruleModelEngine.iml" /> + </modules> + </component> +</project> \ 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..5437d44 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,696 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ChangeListManager"> + <list default="true" id="919111b8-f2aa-4154-8db0-88e76c9af55d" name="Default Changelist" comment="" /> + <ignored path="$PROJECT_DIR$/out/" /> + <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> + <option name="SHOW_DIALOG" value="false" /> + <option name="HIGHLIGHT_CONFLICTS" value="true" /> + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> + <option name="LAST_RESOLUTION" value="IGNORE" /> + </component> + <component name="FavoritesManager"> + <favorites_list name="ruleModelEngine" /> + </component> + <component name="FileEditorManager"> + <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/db/elastic.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="308"> + <caret line="188" column="23" lean-forward="true" selection-start-line="188" selection-start-column="23" selection-end-line="188" selection-end-column="23" /> + <folding> + <element signature="e#12#114#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/rule/engine.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-129"> + <caret line="346" column="42" lean-forward="true" selection-start-line="346" selection-start-column="42" selection-end-line="346" selection-end-column="42" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/rule/service.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="521"> + <caret line="56" column="31" lean-forward="true" selection-start-line="56" selection-start-column="31" selection-end-line="56" selection-end-column="31" /> + <folding> + <element signature="e#14#107#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/task/engine.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="350"> + <caret line="31" column="118" lean-forward="true" selection-start-line="31" selection-start-column="118" selection-end-line="31" selection-end-column="118" /> + <folding> + <element signature="e#14#76#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/config/app.yaml"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="517"> + <caret line="32" lean-forward="true" selection-start-line="32" selection-end-line="32" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/db/models.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="254"> + <caret line="39" column="29" lean-forward="true" selection-start-line="39" selection-start-column="29" selection-end-line="39" selection-end-column="30" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/config/config.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="545"> + <caret line="45" column="4" selection-start-line="45" selection-start-column="4" selection-end-line="45" selection-end-column="4" /> + <folding> + <element signature="e#16#89#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/task/service.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="328"> + <caret line="81" column="5" lean-forward="true" selection-start-line="80" selection-start-column="48" selection-end-line="81" selection-end-column="5" /> + <folding> + <element signature="e#14#53#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/main.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-222"> + <caret line="50" column="28" lean-forward="true" selection-start-line="50" selection-start-column="28" selection-end-line="50" selection-end-column="28" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/api/analysisApi/server.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="216"> + <caret line="13" column="23" lean-forward="true" selection-start-line="13" selection-start-column="23" selection-end-line="13" selection-end-column="23" /> + </state> + </provider> + </entry> + </file> + </leaf> + </component> + <component name="FileTemplateManagerImpl"> + <option name="RECENT_TEMPLATES"> + <list> + <option value="Go File" /> + </list> + </option> + </component> + <component name="FindInProjectRecents"> + <findStrings> + <find>asdasfasfasf</find> + <find>s</find> + <find>1</find> + <find>15</find> + <find>moveout</find> + <find>daysSince</find> + <find>mip</find> + <find>info</find> + <find>now</find> + <find>status</find> + <find>resident</find> + <find>ruleModelEngine/config</find> + <find>Map</find> + <find>ce</find> + <find>append</find> + <find>person</find> + <find>PersonStatus</find> + <find>GetDocNumberFromPersonStatus</find> + <find>UpdatePersonInfo</find> + <find>labeManage</find> + <find>Table</find> + <find>16</find> + <find>newAlarmRules</find> + <find>map</find> + <find>make(map</find> + <find>inter</find> + <find>task</find> + <find>personInfo</find> + <find>buildingFloors</find> + <find>fmt</find> + </findStrings> + </component> + <component name="GOROOT" path="C:/Program Files/Go" /> + <component name="Git.Settings"> + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> + </component> + <component name="IdeDocumentHistory"> + <option name="CHANGED_PATHS"> + <list> + <option value="$PROJECT_DIR$/rule/identityEngine.go" /> + <option value="$PROJECT_DIR$/db/database.go" /> + <option value="$PROJECT_DIR$/api/analysis/server.go" /> + <option value="$PROJECT_DIR$/data/prepare.go" /> + <option value="$PROJECT_DIR$/db/cache.go" /> + <option value="$PROJECT_DIR$/cache/cache.go" /> + <option value="$PROJECT_DIR$/cache/device.go" /> + <option value="$PROJECT_DIR$/task/tool.go" /> + <option value="$PROJECT_DIR$/db/repository.go" /> + <option value="$PROJECT_DIR$/rule/engine.go" /> + <option value="$PROJECT_DIR$/api/analysisApi/server.go" /> + <option value="$PROJECT_DIR$/db/elasticScriptToId.go" /> + <option value="$PROJECT_DIR$/config/config.go" /> + <option value="$PROJECT_DIR$/rule/service.go" /> + <option value="$PROJECT_DIR$/db/models.go" /> + <option value="$PROJECT_DIR$/db/elastic.go" /> + <option value="$PROJECT_DIR$/config/app.yaml" /> + <option value="$PROJECT_DIR$/task/engine.go" /> + <option value="$PROJECT_DIR$/main.go" /> + <option value="$PROJECT_DIR$/task/service.go" /> + </list> + </option> + </component> + <component name="ProjectFrameBounds" extendedState="6"> + <option name="x" value="-8" /> + <option name="y" value="-8" /> + <option name="width" value="1936" /> + <option name="height" value="1176" /> + </component> + <component name="ProjectView"> + <navigator proportions="" version="1"> + <foldersAlwaysOnTop value="true" /> + </navigator> + <panes> + <pane id="Scope" /> + <pane id="ProjectPane"> + <subPane> + <expand> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="api" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="api" type="462c0819:PsiDirectoryNode" /> + <item name="analysisApi" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="cache" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="config" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="data" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="db" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="rule" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="task" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="ruleModelEngine" type="462c0819:PsiDirectoryNode" /> + <item name="util" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="ruleModelEngine" type="b2602c69:ProjectViewProjectNode" /> + <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" /> + </path> + </expand> + <select /> + </subPane> + </pane> + <pane id="PackagesPane" /> + </panes> + </component> + <component name="PropertiesComponent"> + <property name="DefaultGoTemplateProperty" value="Go File" /> + <property name="GO_FMT" value="true" /> + <property name="WebServerToolWindowFactoryState" value="false" /> + <property name="aspect.path.notification.shown" value="true" /> + <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1716721006565" /> + <property name="configurable.Global.GOPATH.is.expanded" value="true" /> + <property name="configurable.Module.GOPATH.is.expanded" value="false" /> + <property name="configurable.Project.GOPATH.is.expanded" value="true" /> + <property name="go.gopath.indexing.explicitly.defined" value="true" /> + <property name="last_opened_file_path" value="D:/" /> + <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> + <property name="nodejs_npm_path_reset_for_default_project" value="true" /> + <property name="restartRequiresConfirmation" value="false" /> + <property name="settings.editor.selected.configurable" value="go.vgo" /> + </component> + <component name="RecentsManager"> + <key name="MoveFile.RECENT_KEYS"> + <recent name="F:\workspace\golang\cloud_ai\ruleModelEngine\cache" /> + </key> + <key name="CopyFile.RECENT_KEYS"> + <recent name="F:\workspace\golang\cloud_ai\ruleModelEngine" /> + </key> + </component> + <component name="RunDashboard"> + <option name="ruleStates"> + <list> + <RuleState> + <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> + </RuleState> + <RuleState> + <option name="name" value="StatusDashboardGroupingRule" /> + </RuleState> + </list> + </option> + </component> + <component name="RunManager" selected="Go Build.go build main.go"> + <configuration name="go build elastic.go" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true"> + <module name="ruleModelEngine" /> + <working_directory value="$PROJECT_DIR$" /> + <kind value="FILE" /> + <filePath value="$PROJECT_DIR$/db/elastic.go" /> + <package value="ruleModelEngine" /> + <directory value="$PROJECT_DIR$" /> + <method v="2" /> + </configuration> + <configuration name="go build main.go" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true"> + <module name="ruleModelEngine" /> + <working_directory value="$PROJECT_DIR$" /> + <kind value="FILE" /> + <filePath value="$PROJECT_DIR$/main.go" /> + <package value="ruleModelEngine" /> + <directory value="$PROJECT_DIR$" /> + <method v="2" /> + </configuration> + <recent_temporary> + <list> + <item itemvalue="Go Build.go build main.go" /> + <item itemvalue="Go Build.go build elastic.go" /> + </list> + </recent_temporary> + </component> + <component name="SvnConfiguration"> + <configuration /> + </component> + <component name="TaskManager"> + <task active="true" id="Default" summary="Default task"> + <changelist id="919111b8-f2aa-4154-8db0-88e76c9af55d" name="Default Changelist" comment="" /> + <created>1713166065668</created> + <option name="number" value="Default" /> + <option name="presentableId" value="Default" /> + <updated>1713166065668</updated> + <workItem from="1713166068218" duration="121229000" /> + <workItem from="1714960004642" duration="105790000" /> + </task> + <task id="LOCAL-00001" summary="鏂板杩佸叆杩佸嚭锛屽睘鎬у垎鏋愶紝韬唤鍒嗘瀽绛�"> + <created>1714471841345</created> + <option name="number" value="00001" /> + <option name="presentableId" value="LOCAL-00001" /> + <option name="project" value="LOCAL" /> + <updated>1714471841345</updated> + </task> + <task id="LOCAL-00002" summary="娣诲姞甯冩帶妯″潡锛屽悎骞秔erson_status鍜宻napshot_count_summary鏁版嵁搴撶瓑"> + <created>1716555879404</created> + <option name="number" value="00002" /> + <option name="presentableId" value="LOCAL-00002" /> + <option name="project" value="LOCAL" /> + <updated>1716555879404</updated> + </task> + <task id="LOCAL-00003" summary="娣诲姞甯冩帶妯″潡锛屽悎骞秔erson_status鍜宻napshot_count_summary鏁版嵁搴撶瓑"> + <created>1716720676019</created> + <option name="number" value="00003" /> + <option name="presentableId" value="LOCAL-00003" /> + <option name="project" value="LOCAL" /> + <updated>1716720676019</updated> + </task> + <task id="LOCAL-00004" summary="瀹屾垚甯冩帶妯″潡"> + <created>1716720903870</created> + <option name="number" value="00004" /> + <option name="presentableId" value="LOCAL-00004" /> + <option name="project" value="LOCAL" /> + <updated>1716720903870</updated> + </task> + <option name="localTasksCounter" value="5" /> + <servers /> + </component> + <component name="TimeTrackingManager"> + <option name="totallyTimeSpent" value="227019000" /> + </component> + <component name="ToolWindowManager"> + <frame x="-8" y="-8" width="1936" height="1176" extended-state="6" /> + <layout> + <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.17643923" /> + <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> + <window_info id="Image Layers" order="2" /> + <window_info id="Designer" order="3" /> + <window_info id="UI Designer" order="4" /> + <window_info id="Capture Tool" order="5" /> + <window_info id="Favorites" order="6" side_tool="true" /> + <window_info anchor="bottom" id="Message" order="0" /> + <window_info anchor="bottom" id="Find" order="1" /> + <window_info anchor="bottom" id="Run" order="2" weight="0.42802304" /> + <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> + <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> + <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> + <window_info anchor="bottom" id="TODO" order="6" /> + <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> + <window_info active="true" anchor="bottom" id="Terminal" order="8" visible="true" weight="0.31765833" /> + <window_info anchor="bottom" id="Version Control" order="9" /> + <window_info anchor="bottom" id="Database Changes" order="10" /> + <window_info anchor="bottom" id="Event Log" order="11" side_tool="true" /> + <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> + <window_info anchor="right" id="Palette" order="3" /> + <window_info anchor="right" id="Theme Preview" order="4" /> + <window_info anchor="right" id="Maven" order="5" /> + <window_info anchor="right" id="Capture Analysis" order="6" /> + <window_info anchor="right" id="Palette	" order="7" /> + <window_info anchor="right" id="Database" order="8" /> + </layout> + <layout-to-restore> + <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.17643923" /> + <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> + <window_info id="Image Layers" order="2" /> + <window_info id="Designer" order="3" /> + <window_info id="UI Designer" order="4" /> + <window_info id="Capture Tool" order="5" /> + <window_info id="Favorites" order="6" side_tool="true" /> + <window_info anchor="bottom" id="Message" order="0" /> + <window_info anchor="bottom" id="Find" order="1" /> + <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.42802304" /> + <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> + <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> + <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> + <window_info anchor="bottom" id="TODO" order="6" /> + <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> + <window_info anchor="bottom" id="Terminal" order="8" weight="0.31765833" /> + <window_info anchor="bottom" id="Version Control" order="9" /> + <window_info anchor="bottom" id="Database Changes" order="10" /> + <window_info anchor="bottom" id="Event Log" order="11" side_tool="true" /> + <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> + <window_info anchor="right" id="Palette" order="3" /> + <window_info anchor="right" id="Theme Preview" order="4" /> + <window_info anchor="right" id="Maven" order="5" /> + <window_info anchor="right" id="Capture Analysis" order="6" /> + <window_info anchor="right" id="Palette	" order="7" /> + <window_info anchor="right" id="Database" order="8" /> + </layout-to-restore> + </component> + <component name="TypeScriptGeneratedFilesManager"> + <option name="version" value="1" /> + </component> + <component name="VcsManagerConfiguration"> + <MESSAGE value="鏂板杩佸叆杩佸嚭锛屽睘鎬у垎鏋愶紝韬唤鍒嗘瀽绛�" /> + <MESSAGE value="娣诲姞甯冩帶妯″潡锛屽悎骞秔erson_status鍜宻napshot_count_summary鏁版嵁搴撶瓑" /> + <MESSAGE value="瀹屾垚甯冩帶妯″潡" /> + <option name="LAST_COMMIT_MESSAGE" value="瀹屾垚甯冩帶妯″潡" /> + </component> + <component name="VgoProject"> + <integration-enabled>true</integration-enabled> + <proxy>https://goproxy.cn,direct</proxy> + </component> + <component name="editorHistoryManager"> + <entry file="file://$PROJECT_DIR$/go.mod"> + <provider selected="true" editor-type-id="text-editor"> + <state> + <caret column="13" selection-start-column="13" selection-end-column="13" /> + </state> + </provider> + </entry> + <entry file="file://C:/Program Files/Go/src/time/format.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="203"> + <caret line="619" column="14" selection-start-line="619" selection-start-column="14" selection-end-line="619" selection-end-column="14" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/util/util.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-6285"> + <caret line="3" column="32" lean-forward="true" selection-start-line="3" selection-start-column="4" selection-end-line="3" selection-end-column="32" /> + </state> + </provider> + </entry> + <entry file="file://C:/Program Files/Go/src/math/const.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="409"> + <caret line="49" column="4" selection-start-line="49" selection-start-column="4" selection-end-line="49" selection-end-column="4" /> + </state> + </provider> + </entry> + <entry file="file://C:/Program Files/Go/src/time/time.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="208"> + <caret line="1466" column="5" selection-start-line="1466" selection-start-column="5" selection-end-line="1466" selection-end-column="5" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/rule/identityEngine.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-844"> + <caret line="5" column="1" lean-forward="true" selection-start-line="5" selection-start-column="1" selection-end-line="5" selection-end-column="1" /> + <folding> + <element signature="e#14#39#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/go/pkg/mod/gorm.io/gorm@v1.25.9/gorm.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="322"> + <caret line="371" column="19" lean-forward="true" selection-start-line="371" selection-start-column="19" selection-end-line="371" selection-end-column="19" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/db/database.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="576"> + <caret line="24" selection-start-line="24" selection-end-line="24" /> + <folding> + <element signature="e#12#88#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/go/pkg/mod/basic.com/!cloud!a!i/protomsg.git@v0.0.0-20240523091240-77f661e9c66f/analysis/analysis_grpc.pb.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="195"> + <caret line="72" column="5" selection-start-line="72" selection-start-column="5" selection-end-line="72" selection-end-column="5" /> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/go/pkg/mod/basic.com/!cloud!a!i/protomsg.git@v0.0.0-20240523091240-77f661e9c66f/analysis/analysis.pb.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="178"> + <caret line="21" lean-forward="true" selection-start-line="21" selection-end-line="21" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/data/prepare.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="42"> + <caret line="103" column="8" lean-forward="true" selection-start-line="103" selection-start-column="8" selection-end-line="103" selection-end-column="8" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/cache/device.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="168"> + <caret line="7" column="35" lean-forward="true" selection-start-line="7" selection-start-column="35" selection-end-line="7" selection-end-column="35" /> + <folding> + <element signature="e#15#77#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/task/tool.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="504"> + <caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" /> + <folding> + <element signature="e#14#41#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/db/repository.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-2"> + <caret line="170" column="8" selection-start-line="170" selection-start-column="8" selection-end-line="170" selection-end-column="8" /> + <folding> + <element signature="e#12#78#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/go/pkg/mod/basic.com/pubsub/esutil.git@v0.0.0-20240401091908-7a10b30099c6/EsClient.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="98"> + <caret line="1003" column="20" selection-start-line="1003" selection-start-column="20" selection-end-line="1003" selection-end-column="20" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/db/elasticScriptToId.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="82"> + <caret line="8" column="5" selection-start-line="8" selection-start-column="5" selection-end-line="8" selection-end-column="5" /> + <folding> + <element signature="e#12#86#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/rule/engine.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-129"> + <caret line="346" column="42" lean-forward="true" selection-start-line="346" selection-start-column="42" selection-end-line="346" selection-end-column="42" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/config/config.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="545"> + <caret line="45" column="4" selection-start-line="45" selection-start-column="4" selection-end-line="45" selection-end-column="4" /> + <folding> + <element signature="e#16#89#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/rule/service.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="521"> + <caret line="56" column="31" lean-forward="true" selection-start-line="56" selection-start-column="31" selection-end-line="56" selection-end-column="31" /> + <folding> + <element signature="e#14#107#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/task/engine.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="350"> + <caret line="31" column="118" lean-forward="true" selection-start-line="31" selection-start-column="118" selection-end-line="31" selection-end-column="118" /> + <folding> + <element signature="e#14#76#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/db/models.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="254"> + <caret line="39" column="29" lean-forward="true" selection-start-line="39" selection-start-column="29" selection-end-line="39" selection-end-column="30" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/db/elastic.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="308"> + <caret line="188" column="23" lean-forward="true" selection-start-line="188" selection-start-column="23" selection-end-line="188" selection-end-column="23" /> + <folding> + <element signature="e#12#114#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/go/pkg/mod/basic.com/!cloud!a!i/protomsg.git@v0.0.0-20240524094225-61cfc0043e88/analysis/analysis_grpc.pb.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="338"> + <caret line="72" column="5" selection-start-line="72" selection-start-column="5" selection-end-line="72" selection-end-column="5" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/api/analysisApi/server.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="216"> + <caret line="13" column="23" lean-forward="true" selection-start-line="13" selection-start-column="23" selection-end-line="13" selection-end-column="23" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/task/service.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="328"> + <caret line="81" column="5" lean-forward="true" selection-start-line="80" selection-start-column="48" selection-end-line="81" selection-end-column="5" /> + <folding> + <element signature="e#14#53#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/main.go"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-222"> + <caret line="50" column="28" lean-forward="true" selection-start-line="50" selection-start-column="28" selection-end-line="50" selection-end-column="28" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/config/app.yaml"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="517"> + <caret line="32" lean-forward="true" selection-start-line="32" selection-end-line="32" /> + </state> + </provider> + </entry> + </component> + <component name="masterDetails"> + <states> + <state key="ProjectJDKs.UI"> + <settings> + <last-edited>1.8</last-edited> + <splitter-proportions> + <option name="proportions"> + <list> + <option value="0.2" /> + </list> + </option> + </splitter-proportions> + </settings> + </state> + </states> + </component> +</project> \ No newline at end of file diff --git a/db/database.go b/db/database.go new file mode 100644 index 0000000..f4afe69 --- /dev/null +++ b/db/database.go @@ -0,0 +1,39 @@ +package db + +import ( + "gorm.io/driver/mysql" + "gorm.io/gorm" + "ruleModelEngine/config" + "time" +) + +var DB *gorm.DB + +//// 鍒濆鍖栨暟鎹簱杩炴帴 +//func InitDB() error { +// dsn := "root:c++java123@tcp(" + config.DataBase.Host + ":" + config.DataBase.Port + ")/" + config.DataBase.Name + "?charset=utf8mb4&parseTime=True&loc=Local" +// var err error +// db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{}) +// if err != nil { +// return err +// } +// return nil +//} + +func ConnectDB() (error) { + dsn := "root:c++java123@tcp(" + config.DataBase.Host + ":" + config.DataBase.Port + ")/" + config.DataBase.Name + "?charset=utf8mb4&parseTime=True&loc=Local" + db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{}) + if err != nil { + return err + } + sqlDb,err := db.DB() + if err != nil{ + return err + } + sqlDb.SetMaxIdleConns(2) + sqlDb.SetMaxOpenConns(1) + sqlDb.SetConnMaxLifetime(time.Duration(120) * time.Second) + sqlDb.SetConnMaxIdleTime(time.Duration(1800) * time.Second) + DB = db + return nil +} diff --git a/db/elastic.go b/db/elastic.go new file mode 100644 index 0000000..eeb7253 --- /dev/null +++ b/db/elastic.go @@ -0,0 +1,381 @@ +package db + +import ( + "basic.com/pubsub/esutil.git" + "basic.com/valib/logger.git" + "encoding/json" + "fmt" + "ruleModelEngine/config" + "ruleModelEngine/util" + "strconv" +) + +func decodeDocumentInfos(docInfo []map[string]interface{}) ([]CaptureInfo, error) { + captureInfos := make([]CaptureInfo, 0) + for _, info := range docInfo { + var captureInfo = CaptureInfo{} + captureInfo.DocumentNumber = info["key"].(string) + buckets := info["top_hits"].(map[string]interface{})["hits"].(map[string]interface{})["hits"].([]interface{}) + orgId := buckets[0].(map[string]interface{})["_source"].(map[string]interface{})["orgId"].(string) + captureInfo.OrgId = orgId + for _, sourceInfo := range buckets { + rSourceInfo := sourceInfo.(map[string]interface{}) + source := rSourceInfo["_source"].(map[string]interface{}) + picDate := source["picDate"].(string) + cameraLocation := source["cameraLocation"].(map[string]interface{}) + unit := cameraLocation["unit"].(string) + floor := cameraLocation["floor"].(string) + building := cameraLocation["building"].(string) + direction := cameraLocation["direction"].(string) + captureAddress := building + unit + floor + captureInfo.CaptureDetail = append(captureInfo.CaptureDetail, CaptureDetail{CaptureAddress: captureAddress, CaptureDate: picDate, Direction: direction}) + } + captureInfos = append(captureInfos, captureInfo) + } + return captureInfos, nil +} + +func QueryTimesByDocNumberDays(days int, docNumber string) (int, error) { + esURL := "http://" + config.Elastic.Host + ":" + config.Elastic.Port + "/" + config.Elastic.Index + "/_search" + queryDSL := `{ + "query": { + "bool": { + "filter": [ + { + "range": { + "picDate": { + "gte": "now-` + strconv.Itoa(days) + `d/d" + } + } + }, + { + "term": { + "documentNumber": "` + docNumber + `" + } + } + ] + } + }, + "size": 0 +}` + buf, err := esutil.EsReq("POST", esURL, []byte(queryDSL)) + if err != nil { + return 0, err + } + total, err := esutil.SourceTotal(buf) + if err != nil { + return 0, err + } + return total, nil +} + +func QueryLastIdByDayRange(dayGte, dayLt int) (map[string]string, error) { + esURL := "http://" + config.Elastic.Host + ":" + config.Elastic.Port + "/" + config.Elastic.Index + "/_search" + queryDSL := `{ + "query": { + "bool": { + "filter": [ + { + "range": { + "picDate": { + "gte": "now-` + strconv.Itoa(dayGte) + `d/d", + "lt": "now-` + strconv.Itoa(dayLt) + `d/d" + } + } + } + ] + } + }, + "size": 0, + "aggs": { + "group_by_documentnumber": { + "terms": { + "field": "documentNumber", + "size": 100000 + }, + "aggs": { + "top_hits": { + "top_hits": { + "_source": [ + "documentNumber", + "id" + ], + "size": 1, + "sort": [ + { + "picDate": { + "order": "desc" + } + } + ] + } + } + } + } + } +}` + //fmt.Println(queryDSL) + //fmt.Println(esURL) + docNumberMap := make(map[string]string) + buf, err := esutil.EsReq("POST", esURL, []byte(queryDSL)) + if err != nil { + return nil, err + } + source, err := esutil.SourceAggregationList(buf) + if err != nil { + return nil, err + } + fmt.Println("source", source) + for _, info := range source { + buckets := info["top_hits"].(map[string]interface{})["hits"].(map[string]interface{})["hits"].([]interface{}) + for _, sourceInfo := range buckets { + rSourceInfo := sourceInfo.(map[string]interface{}) + source := rSourceInfo["_source"].(map[string]interface{}) + documentNumber := source["documentNumber"].(string) + id := source["id"].(string) + docNumberMap[documentNumber] = id + } + } + return docNumberMap, nil +} + +func QueryById(id string) (TaskPerson, error) { + esURL := "http://" + config.Elastic.Host + ":" + config.Elastic.Port + "/" + config.Elastic.Index + "/_search" + queryDSL := `{ + "query": { + "bool": { + "filter": [ + { + "term": { + "id": "` + id + `" + } + } + ] + } + }, + "_source": [ + "id", + "cameraId", + "picDate", + "communityId", + "documentNumber", + "cameraLocation.floor", + "targetInfo.targetType" + ] +}` + var taskPerson TaskPerson + buf, err := esutil.EsReq("POST", esURL, []byte(queryDSL)) + if err != nil { + return taskPerson, err + } + source, err := esutil.Sourcelist(buf) + if err != nil { + return taskPerson, err + } + if len(source) == 0 { + return taskPerson, nil + } + //fmt.Println(source[0]) + taskPerson.Id = source[0]["id"].(string) + taskPerson.PicDate = source[0]["picDate"].(string) + taskPerson.CameraId = source[0]["cameraId"].(string) + taskPerson.CommunityId = source[0]["communityId"].(string) + taskPerson.DocumentNumber = source[0]["documentNumber"].(string) + taskPerson.TargetType = source[0]["targetInfo"].(map[string]interface{})["targetType"].(string) + taskPerson.Floor = source[0]["cameraLocation"].(map[string]interface{})["floor"].(string) + return taskPerson, nil +} + +func QueryCheckDataByDocumentNumber(documentNumber string, startTime, endTime string) (int, error) { + esURL := "http://" + config.Elastic.Host + ":" + config.Elastic.Port + "/" + config.Elastic.Index + "/_search" + queryDSL := `{ + "query": { + "bool": { + "filter": [ + { + "term": { + "documentNumber": "` + documentNumber + `" + } + }, + { + "range": { + "picDate": { + "gte": "` + startTime + `", + "lt" : "` + endTime + `" + } + } + } + ], + "must_not": [ + { + "term": { + "floor": "" + } + } + ] + } + }, + "size": 100, + "_source": [ + "cameraLocation.floor", + "cameraLocation.building" + ] +}` + //fmt.Println("queryDSL: ", queryDSL) + //var floor = + buf, err := esutil.EsReq("POST", esURL, []byte(queryDSL)) + if err != nil { + return 0, err + } + source, err := esutil.Sourcelist(buf) + if err != nil { + return 0, err + } + if len(source) == 0 { + return 0, nil + } + buildingFloors := make(map[string]bool) + for _, info := range source { + building := info["cameraLocation"].(map[string]interface{})["building"].(string) + floor := info["cameraLocation"].(map[string]interface{})["floor"].(string) + if building != "" && floor != "" { + buildingFloors[building+floor] = true + } + } + //fmt.Println("buildingFloors: ", buildingFloors, len(buildingFloors)) + + return len(buildingFloors), nil +} + +func AddAlarmRules(alarmRules []AlarmRule, id string) (bool, error) { + if len(alarmRules) == 0 { + logger.Info("鏈湁棰勮 id: ", id) + return true, nil + } + fmt.Println("棰勮 id: ", id) + fmt.Println("棰勮 AlarmRule: ", alarmRules) + esURL := "http://" + config.Elastic.Host + ":" + config.Elastic.Port + "/" + config.Elastic.Index + "/_update_by_query" + newAlarmRulesJson, err := json.Marshal(alarmRules) + if err != nil { + logger.Error("json.Marshal alarmRules err: ", newAlarmRulesJson) + return false, err + } + queryDSL := `{ + "script": { + "source": "for (item in params.newAlarmRules) { ctx._source.alarmRules.add(item) } ctx._source.isAlarm = params.newStatus", + "lang": "painless", + "params": { + "newStatus":true, + "newAlarmRules": ` + string(newAlarmRulesJson) + ` + } + }, + "query": { + "bool": { + "filter": [ + { + "term": { + "id": "` + id + `" + } + } + ] + } + } +}` + //fmt.Println("AddAlarmRules: ", esURL) + //fmt.Println("AddAlarmRules: ", queryDSL) + //return true, nil + buf, err := esutil.EsReq("POST", esURL, []byte(queryDSL)) + if err != nil { + logger.Error("EsReq err: ", err) + return false, err + } + addFlag, err := esutil.SourceUpdated(buf) + if err != nil { + logger.Error("SourceUpdated err: ", err) + return false, err + } + if addFlag != 0 { + return true, nil + } + return false, nil +} + +func Query1MDataByCommunityId(communityId string) ([]CaptureInfo, error) { + //fmt.Println(config.Elastic.DocumentSize) + //fmt.Println(config.Elastic.TopHitsSize) + esURL := "http://" + config.Elastic.Host + ":" + config.Elastic.Port + "/" + config.Elastic.Index + "/_search" + queryDSL := ` + { + "query": { + "bool": { + "filter": [ + { + "range": { + "picDate": { + "gte": "now-30d/d", + "lt": "now/d" + } + } + }, + { + "term":{ + "communityId":"` + communityId + `" + } + } + ], + "must_not": [ + { + "term": { + "documentNumber": "" + } + } + ], + "should": [] + } + }, + "size": 0, + "aggs": { + "group_by_documentnumber": { + "terms": { + "field": "documentNumber", + "size": ` + strconv.Itoa(config.Elastic.DocumentSize) + ` + }, + "aggs": { + "top_hits": { + "top_hits": { + "_source": [ + "documentNumber", + "picDate", + "orgId", + "cameraLocation.building", + "cameraLocation.unit", + "cameraLocation.floor", + "cameraLocation.direction" + ], + "size": ` + strconv.Itoa(config.Elastic.TopHitsSize) + `, + "sort": [ + { + "picDate": { + "order": "asc" + } + } + ] + } + } + } + } + } + }` + //fmt.Println(esURL) + //fmt.Println(queryDSL) + buf, err := esutil.EsReq("POST", esURL, []byte(queryDSL)) + if err != nil { + return nil, err + } + source, err := util.SourceAggregationList(buf) + if err != nil { + return nil, err + } + result, _ := decodeDocumentInfos(source) + return result, nil +} diff --git a/db/models.go b/db/models.go new file mode 100644 index 0000000..6420353 --- /dev/null +++ b/db/models.go @@ -0,0 +1,156 @@ +package db + +import ( + "time" +) + +type PersonnelStatusRule struct { + ID int `gorm:"column:id"` + Name string `gorm:"column:name"` + DetectionCountStart int `gorm:"column:detectionCountStart"` + DetectionCountEnd int `gorm:"column:detectionCountEnd"` + DetectionDaysStart int `gorm:"column:detectionDaysStart"` + DetectionDaysEnd int `gorm:"column:detectionDaysEnd"` + Status string `gorm:"column:status"` +} + +type AlarmRule struct { + RuleId string `json:"ruleId"` + RuleText string `json:"ruleText"` + AlarmLevel string `json:"alarmLevel"` +} + +type TaskPerson struct { + Id string `json:"id"` + CameraId string `json:"cameraId"` + CommunityId string `json:"communityId"` + PicDate string `json:"picDate"` + DocumentNumber string `json:"documentNumber"` + TargetType string `json:"targetType"` + Floor string `json:"floor"` +} + +type BuildingType int + +const ( + BuildingTypeResidential BuildingType = 1 //浣忓畢妤� + BuildingTypeMixedUse BuildingType = 2 //鍟嗕綇妤� + BuildingTypePublicRental BuildingType = 3 //鍏鎴� + BuildingTypeLowIncome BuildingType = 4 //寤夌鎴� + BuildingTypeOldResidential BuildingType = 5 //鑰佹棫灏忓尯 + BuildingTypeOffice BuildingType = 6 //鍐欏瓧妤� +) + +type Device struct { + DeviceCode string `gorm:"column:deviceCode" json:"deviceCode" example:"J83762"` //璁惧缂栫爜 + BuildingType BuildingType `gorm:"column:building_type;type:tinyint(1);not null;default:0" json:"buildingType"` //妤煎畤绫诲瀷 + MaxBuildingFloor int `gorm:"column:max_building_floor;type:tinyint(1);not null;default:0" json:"maxBuildingFloor"` //鏈�楂樻ゼ灞傚彿 +} + +type Task struct { + Id int `gorm:"column:id"` + Name string `gorm:"name"` +} + +func (Task) TableName() string { + return "task" +} + +type MoveInout struct { + //RecordId int `gorm:"column:record_id"` + DocumentNumber string `gorm:"column:document_number"` + CommunityID string `gorm:"column:community_id"` + MoveInDate time.Time `gorm:"column:move_in_date"` + MoveOutDate *time.Time `gorm:"column:move_out_date"` + Status string `gorm:"column:status"` + MoveType string `gorm:"column:move_type"` +} + +func (MoveInout) TableName() string { + return "move_inout" +} + +type Resident struct { + CommunityId string `gorm:"column:community_id"` + DocumentNumber string `gorm:"column:document_number"` + LastAppearanceTime int64 `gorm:"column:last_appearance_time"` + CreateAt string `gorm:"column:create_at"` +} + +type PersonStatus struct { + Id uint `gorm:"column:id;primary_key;auto_increment;not null;"` + OrgId string `gorm:"column:org_id;type:varchar(299);not null;default:''"` // 娲惧嚭鎵�id + CommunityID string `gorm:"uniqueIndex:idx_document_number_community_id;index:community_id_last_appearance_time;column:community_id;type:varchar(299);not null;default:''"` // 灏忓尯id + DocumentNumber string `gorm:"uniqueIndex:idx_document_number_community_id;column:document_number;type:varchar(299);not null;default:''"` // 妗f缂栧彿 + DaysAppeared int `gorm:"column:days_appeared;type:int(11);not null;default:0" json:"daysAppeared"` // 鍑虹幇澶╂暟 + Count int `gorm:"column:count;type:int;not null;default:0"` // 鎶撴媿娆℃暟 + Status string `gorm:"column:status;type:varchar(255);not null;default:''"` //鏍囩 + LastAppearanceTime int64 `gorm:"index:community_id_last_appearance_time;column:last_appearance_time;type:int;not null;default:0" json:"lastAppearanceTime"` //鏈�鍚庡嚭鐜版椂闂� + LastLocation string `gorm:"column:last_location;type:varchar(255);not null;default:''" json:"lastLocation"` //鏈�鍚庡嚭鐜板湴鐐� + FrequentAddress string `gorm:"column:frequent_address;type:varchar(255);not null;default:''" json:"frequentAddress"` //甯稿嚭鐜板湴鐐� + CreatedAt time.Time + UpdatedAt time.Time + ////OrgId string `gorm:"column:org_id"` + //CommunityID string `gorm:"column:communityID"` + //DocumentNumber string `gorm:"column:documentNumber"` + //Status string `gorm:"column:status"` + //FrequentAddress string `gorm:"column:frequentAddress"` +} + +func (PersonStatus) TableName() string { + return "snapshot_count_summary" +} + +type LabelManage struct { + Id int `gorm:"id"` + Name string `gorm:"name"` + ValidDays int `gorm:"valid_days"` +} + +func (LabelManage) TableName() string { + return "label_manage" +} + +type Identity struct { + CreatedAt time.Time + UpdatedAt time.Time + CommunityID string `gorm:"column:community_id"` + DocumentNumber string `gorm:"column:dbtablepersons_id"` + LabelId int `gorm:"column:label_id"` + ExpireTime int64 `gorm:"column:expire_time"` +} + +func (Identity) TableName() string { + return "dbtablepersons_label" +} + +// +//type ModelMatix struct { +// CommunityID string +// DocumentNumber string +// CaptureDate string +// Status string +// FrequentAddress string +//} + +type StatusPersonMapping struct { + Status string + IDs []string +} + +type CaptureInfo struct { + OrgId string `json:"orgId"` //娲惧嚭鎵�Id + DocumentNumber string `json:"documentNumber"` + CaptureDays int `json:"captureDays"` //鎶撴媿澶╂暟 + OvernightStays int `json:"overnightStays"` //杩囧澶╂暟 + Status string `json:"status"` //鐘舵�� + FrequentAddress string `json:"frequentAddress"` //甯哥敤鍦板潃 + Age int `json:"age"` //骞撮緞 + CaptureDetail []CaptureDetail `json:"captureDetail"` +} + +type CaptureDetail struct { + CaptureDate string `json:"captureDate"` + CaptureAddress string `json:"captureAddress"` + Direction string `json:"direction"` +} diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..d5b098a --- /dev/null +++ b/go.sum @@ -0,0 +1,126 @@ +basic.com/CloudAI/protomsg.git v0.0.0-20240523091240-77f661e9c66f h1:1M7dj+pSxEZ5GDimvqcB9Vl8S747mb3FlODR3F8RCG8= +basic.com/CloudAI/protomsg.git v0.0.0-20240523091240-77f661e9c66f/go.mod h1:lZXQZPD7Nwo1ZIPWzlB3SHwK8BfbwumEQGHSE79lhOo= +basic.com/CloudAI/protomsg.git v0.0.0-20240524094225-61cfc0043e88 h1:xW9mYZt35TTXPVzayWQaF2XR7mO3Fq+mN48nBmho2cI= +basic.com/CloudAI/protomsg.git v0.0.0-20240524094225-61cfc0043e88/go.mod h1:lZXQZPD7Nwo1ZIPWzlB3SHwK8BfbwumEQGHSE79lhOo= +basic.com/pubsub/esutil.git v0.0.0-20240401091908-7a10b30099c6 h1:j8+vyFtnNZkwrfA9booFTZL7a0GOLrGf4+q7X5P52Bs= +basic.com/pubsub/esutil.git v0.0.0-20240401091908-7a10b30099c6/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw= +basic.com/pubsub/protomsg.git v0.0.0-20230210092337-5f1e6cdae7c3 h1:h6dF39g4oqEMY0wDcFG3W4wYpeTNFjwWMp8TmFKnrAg= +basic.com/pubsub/protomsg.git v0.0.0-20230210092337-5f1e6cdae7c3/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= +basic.com/valib/logger.git v0.0.0-20220225105132-5cf6309c132f h1:ByWle6XVKj9n4ILEyml622trRlC5TlWMLe0pyIaXoeA= +basic.com/valib/logger.git v0.0.0-20220225105132-5cf6309c132f/go.mod h1:SPlOGUUlxCscwF1dkqmLb0oJXVqg1uJ8hsPXLFxrw1M= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= +github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= +github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk= +github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg= +github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc= +golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8= +gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.9 h1:wct0gxZIELDk8+ZqF/MVnHLkA1rvYlBWUMv2EdsK1g8= +gorm.io/gorm v1.25.9/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= diff --git a/ruleModelEngine.iml b/ruleModelEngine.iml new file mode 100644 index 0000000..8021953 --- /dev/null +++ b/ruleModelEngine.iml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="WEB_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$" /> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file -- Gitblit v1.8.0