Commit fe4b325f by zhangxiaoyan

conflict

parents 0add82f8 5a47a71c
......@@ -2,13 +2,43 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e2e217e2-2dd6-4c6f-ad19-b1cba46bc7ad" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/libraries/Maven__org_hibernate_hibernate_core_4_2_1_Final.xml" afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_hibernate_hibernate_core_4_2_1_Final.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_1_1_GA.xml" afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_1_1_GA.xml" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/common/model/BackVisit.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/common/model/KeyValue.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/common/model/Payment.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/common/model/Reminder.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/common/repository/BackVisitRepository.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/common/repository/PaymentRepository.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/common/repository/ReminderRepository.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/security/AbstractTokenManager.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/security/RedisLoginStatusManager.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/security/RedisLoginStatusManagerImpl.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/security/RedisTokenManager.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/security/TokenManager.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/security/cors/CorsFilter.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/security/exception/MethodNotSupportException.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/tkio/controller/TkioAccountController.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/tkio/model/Campaign.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/tkio/model/Channel.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/tkio/repository/CampaignRepository.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/tkio/repository/ChannelRepository.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/tkio/service/TkioAccountService.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/tkio/service/impl/TkioAccountServiceImpl.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/java/util/RedisUtilNew.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/main/resources/redis.properties" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/common/controller/LoginController.java" afterPath="$PROJECT_DIR$/src/main/java/common/controller/LoginController.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/common/model/Account4Web.java" afterPath="$PROJECT_DIR$/src/main/java/common/model/Account4Web.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/common/repository/Account4WebRepository.java" afterPath="$PROJECT_DIR$/src/main/java/common/repository/Account4WebRepository.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java" afterPath="$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/tkio/repository/AccountRepository.java" afterPath="$PROJECT_DIR$/src/main/java/tkio/repository/AccountRepository.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/tkio/repository/AppRepository.java" afterPath="$PROJECT_DIR$/src/main/java/tkio/repository/AppRepository.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/tkio/repository/SalesManLeaderRepository.java" afterPath="$PROJECT_DIR$/src/main/java/tkio/repository/SalesManLeaderRepository.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/tkio/task/AccountTask.java" afterPath="$PROJECT_DIR$/src/main/java/tkio/task/AccountTask.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/util/Constant.java" afterPath="$PROJECT_DIR$/src/main/java/util/Constant.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/resources/applicationContext-schedule.xml" afterPath="$PROJECT_DIR$/src/main/resources/applicationContext-schedule.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/resources/applicationContext.xml" afterPath="$PROJECT_DIR$/src/main/resources/applicationContext.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/resources/persistence.properties" afterPath="$PROJECT_DIR$/src/main/resources/persistence.properties" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" />
</list>
<ignored path="$PROJECT_DIR$/target/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
......@@ -24,11 +54,11 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="SyncAppDataTask.java" pinned="false" current-in-tab="true">
<file leaf-file-name="SyncAppDataTask.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/tkio/task/SyncAppDataTask.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1320">
<caret line="111" column="49" lean-forward="true" selection-start-line="111" selection-start-column="49" selection-end-line="111" selection-end-column="49" />
<caret line="111" column="49" lean-forward="false" selection-start-line="111" selection-start-column="49" selection-end-line="111" selection-end-column="49" />
<folding />
</state>
</provider>
......@@ -54,7 +84,7 @@
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/CityRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="220">
<caret line="14" column="29" lean-forward="true" selection-start-line="14" selection-start-column="29" selection-end-line="14" selection-end-column="29" />
<caret line="14" column="29" lean-forward="false" selection-start-line="14" selection-start-column="29" selection-end-line="14" selection-end-column="29" />
<folding />
</state>
</provider>
......@@ -64,17 +94,7 @@
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/AppCategoryRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="198">
<caret line="13" column="5" lean-forward="true" selection-start-line="13" selection-start-column="5" selection-end-line="14" selection-end-column="48" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="AppInfoRepository.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/AppInfoRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="198">
<caret line="11" column="1" lean-forward="true" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
<caret line="13" column="5" lean-forward="false" selection-start-line="13" selection-start-column="5" selection-end-line="14" selection-end-column="48" />
<folding />
</state>
</provider>
......@@ -83,10 +103,10 @@
<file leaf-file-name="Account4WebRepository.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/Account4WebRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="8" column="17" lean-forward="false" selection-start-line="8" selection-start-column="17" selection-end-line="8" selection-end-column="17" />
<state relative-caret-position="198">
<caret line="12" column="17" lean-forward="false" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
<folding>
<element signature="imports" expanded="false" />
<marker date="1514361442488" expanded="false" signature="35:176" ph="..." />
</folding>
</state>
</provider>
......@@ -102,6 +122,29 @@
</provider>
</entry>
</file>
<file leaf-file-name="applicationContext.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/resources/applicationContext.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="202" column="35" lean-forward="false" selection-start-line="202" selection-start-column="34" selection-end-line="202" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="AuthorizationInterceptor.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="529">
<caret line="63" column="23" lean-forward="true" selection-start-line="63" selection-start-column="23" selection-end-line="63" selection-end-column="23" />
<folding>
<element signature="e#1229#1230#0" expanded="true" />
<element signature="e#1285#1286#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="AppServiceImpl.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/common/service/impl/AppServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
......@@ -119,21 +162,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="AppInfo.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/common/model/AppInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="103" column="32" lean-forward="false" selection-start-line="103" selection-start-column="32" selection-end-line="103" selection-end-column="32" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="applicationContext-schedule.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/resources/applicationContext-schedule.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="236">
<caret line="24" column="7" lean-forward="true" selection-start-line="24" selection-start-column="7" selection-end-line="24" selection-end-column="7" />
<caret line="24" column="7" lean-forward="false" selection-start-line="24" selection-start-column="7" selection-end-line="24" selection-end-column="7" />
<folding />
</state>
</provider>
......@@ -174,11 +207,9 @@
<option value="$PROJECT_DIR$/src/main/java/common/model/AppCategory.java" />
<option value="$PROJECT_DIR$/src/main/java/dmp/model/TagCrawlerAppsWandoujia.java" />
<option value="$PROJECT_DIR$/src/main/java/common/context/AppUtils.java" />
<option value="$PROJECT_DIR$/src/main/resources/applicationContext.xml" />
<option value="$PROJECT_DIR$/src/main/java/common/model/City.java" />
<option value="$PROJECT_DIR$/src/main/java/common/repository/CityRepository.java" />
<option value="$PROJECT_DIR$/src/main/java/common/repository/AppInfoRepository.java" />
<option value="$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java" />
<option value="$PROJECT_DIR$/web/WEB-INF/web.xml" />
<option value="$PROJECT_DIR$/src/main/java/tkio/task/SyncAppDataTask.java" />
<option value="$PROJECT_DIR$/src/main/java/common/model/AppInfo.java" />
......@@ -187,6 +218,8 @@
<option value="$PROJECT_DIR$/src/main/java/common/service/impl/AppServiceImpl.java" />
<option value="$PROJECT_DIR$/src/main/java/common/controller/AppController.java" />
<option value="$PROJECT_DIR$/src/main/resources/applicationContext-schedule.xml" />
<option value="$PROJECT_DIR$/src/main/resources/applicationContext.xml" />
<option value="$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java" />
</list>
</option>
</component>
......@@ -309,6 +342,38 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="security" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="manager" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="manage" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="security" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="interceptor" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="manager" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="manage" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="dmp" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
</PATH_ELEMENT>
......@@ -388,10 +453,6 @@
<option name="myItemId" value="common" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="repository" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
......@@ -1060,12 +1121,12 @@
<option name="presentableId" value="Default" />
<updated>1514260912987</updated>
<workItem from="1514260914510" duration="14315000" />
<workItem from="1514344618155" duration="12232000" />
<workItem from="1514344618155" duration="12743000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="26547000" />
<option name="totallyTimeSpent" value="27058000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
......@@ -1089,11 +1150,11 @@
<window_info id="Java Enterprise" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2536825" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2536825" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Spring" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="CheckStyle" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25340393" sideWeight="0.5" order="7" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25340393" sideWeight="0.5" order="7" side_tool="false" content_ui="combo" />
<window_info id="Bean Validation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
......@@ -1106,6 +1167,42 @@
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
</layout>
<layout-to-restore>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980332" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="10" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="13" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3289689" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Java Enterprise" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2536825" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Spring" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="CheckStyle" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25340393" sideWeight="0.5" order="7" side_tool="false" content_ui="combo" />
<window_info id="Bean Validation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="true" content_ui="tabs" />
</layout-to-restore>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="processedProjectFiles" value="true" />
......@@ -1235,6 +1332,7 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="13" column="34" lean-forward="false" selection-start-line="13" selection-start-column="17" selection-end-line="13" selection-end-column="34" />
<folding />
</state>
</provider>
</entry>
......@@ -1315,9 +1413,7 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="815">
<caret line="87" column="34" lean-forward="false" selection-start-line="87" selection-start-column="30" selection-end-line="87" selection-end-column="34" />
<folding>
<element signature="imports" expanded="false" />
</folding>
<folding />
</state>
</provider>
</entry>
......@@ -1395,14 +1491,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="35" column="7" lean-forward="true" selection-start-line="35" selection-start-column="7" selection-end-line="35" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-792">
......@@ -1419,14 +1507,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/applicationContext.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="92">
<caret line="274" column="15" lean-forward="false" selection-start-line="274" selection-start-column="14" selection-end-line="274" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/util/ResultModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1034">
......@@ -1449,17 +1529,17 @@
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/AppInfoRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="198">
<caret line="11" column="1" lean-forward="true" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
<caret line="11" column="1" lean-forward="false" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/Account4WebRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="8" column="17" lean-forward="false" selection-start-line="8" selection-start-column="17" selection-end-line="8" selection-end-column="17" />
<state relative-caret-position="198">
<caret line="12" column="17" lean-forward="false" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
<folding>
<element signature="imports" expanded="false" />
<marker date="1514361442488" expanded="false" signature="35:176" ph="..." />
</folding>
</state>
</provider>
......@@ -1475,7 +1555,7 @@
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/AppCategoryRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="198">
<caret line="13" column="5" lean-forward="true" selection-start-line="13" selection-start-column="5" selection-end-line="14" selection-end-column="48" />
<caret line="13" column="5" lean-forward="false" selection-start-line="13" selection-start-column="5" selection-end-line="14" selection-end-column="48" />
<folding />
</state>
</provider>
......@@ -1483,7 +1563,7 @@
<entry file="file://$PROJECT_DIR$/src/main/java/common/repository/CityRepository.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="220">
<caret line="14" column="29" lean-forward="true" selection-start-line="14" selection-start-column="29" selection-end-line="14" selection-end-column="29" />
<caret line="14" column="29" lean-forward="false" selection-start-line="14" selection-start-column="29" selection-end-line="14" selection-end-column="29" />
<folding />
</state>
</provider>
......@@ -1506,7 +1586,7 @@
<entry file="file://$PROJECT_DIR$/src/main/resources/applicationContext-schedule.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="236">
<caret line="24" column="7" lean-forward="true" selection-start-line="24" selection-start-column="7" selection-end-line="24" selection-end-column="7" />
<caret line="24" column="7" lean-forward="false" selection-start-line="24" selection-start-column="7" selection-end-line="24" selection-end-column="7" />
<folding />
</state>
</provider>
......@@ -1528,10 +1608,29 @@
<entry file="file://$PROJECT_DIR$/src/main/java/tkio/task/SyncAppDataTask.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1320">
<caret line="111" column="49" lean-forward="true" selection-start-line="111" selection-start-column="49" selection-end-line="111" selection-end-column="49" />
<caret line="111" column="49" lean-forward="false" selection-start-line="111" selection-start-column="49" selection-end-line="111" selection-end-column="49" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/applicationContext.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="202" column="35" lean-forward="false" selection-start-line="202" selection-start-column="34" selection-end-line="202" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/security/interceptor/AuthorizationInterceptor.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="529">
<caret line="63" column="23" lean-forward="true" selection-start-line="63" selection-start-column="23" selection-end-line="63" selection-end-column="23" />
<folding>
<element signature="e#1229#1230#0" expanded="true" />
<element signature="e#1285#1286#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
......@@ -66,7 +66,18 @@
<mail.valid_time>3</mail.valid_time>
<report.url>http://ec2-54-222-233-230.cn-north-1.compute.amazonaws.com.cn:9010</report.url>
<!--Redis setting-->
<redis.key.validtime>120</redis.key.validtime>
<redis.ip.requesttimes>5</redis.ip.requesttimes>
<redis.ip.unknown.requesttimes>5</redis.ip.unknown.requesttimes>
<redis.surl.host>192.168.2.57</redis.surl.host>
<redis.surl.port>6379</redis.surl.port>
<redis.event.host>192.168.2.57</redis.event.host>
<redis.event.port>6379</redis.event.port>
<redis.event.database>0</redis.event.database>
<!--Redis setting//end-->
</properties>
</profile>
......
package common.controller;
import common.model.Menu;
import com.sun.corba.se.spi.ior.ObjectKey;
import common.model.User;
import common.repository.MenuRepository;
import common.repository.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import util.CipherUtil;
import util.ResultModel;
import security.RedisLoginStatusManager;
import security.TokenManager;
import security.annotation.CurrentAccount;
import security.interceptor.AuthorizationInterceptor;
import util.*;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
@Controller
......@@ -25,19 +33,35 @@ public class LoginController {
@Autowired
private UserRepository userRepository;
@Autowired
RedisLoginStatusManager redisLoginStatusManager;
@Autowired
TokenManager tokenManager;
@RequestMapping(value = "login", method = RequestMethod.GET)
@ResponseBody
public ResultModel login(HttpServletResponse response, @RequestParam String email, @RequestParam String password) {
User user = userRepository.login(email, CipherUtil.generatePassword(password));
if(null != user){
Cookie cookie = new Cookie("TOKEN", user.getId().toString());
//存储token
String token = tokenManager.createToken(String.valueOf(user.getId()));
//存储登陆密码
redisLoginStatusManager.createLoginStatus(token, user.getPassword());
Cookie cookie = new Cookie("TOKEN", token);
cookie.setPath("/");
cookie.setMaxAge(60 * 60 * 24 * 7);
response.addCookie(cookie);
return ResultModel.OK(true);
Map<String, Object> map = new HashMap();
map.put("TOKEN", token);
map.put("user", user);
map.put("code",200);
return ResultModel.OK(map);
}
return ResultModel.OK(false);
Map<String, Object> map = new HashMap();;
map.put("code",300);
return ResultModel.OK(map);
}
@RequestMapping(value = "login/check", method = RequestMethod.GET)
@ResponseBody
......@@ -48,6 +72,32 @@ public class LoginController {
}
return ResultModel.OK(false);
}
@RequestMapping(value = "logout", method = RequestMethod.GET)
@ResponseBody
public ResultModel logout(HttpServletRequest request, HttpServletResponse response, @CurrentAccount User user ) {
if (user != null) {
String token = request.getHeader("Authorization");
if(!ValidateUtil.isValid(token)){
Cookie[] cookies = request.getCookies();
if (null != cookies) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals("TOKEN")) {
token = cookie.getValue();
}
}
}
}
//删除session,token
request.getSession().removeAttribute(Constant.CURRENT_ACCOUNT);
tokenManager.delRelationshipByToken(token);
redisLoginStatusManager.deleteLoginStatus(token);
Cookie cookie = new Cookie("TOKEN", null);
cookie.setPath("/");
cookie.setMaxAge(0);
response.addCookie(cookie);
}
return ResultModel.OK(true);
}
}
......@@ -19,7 +19,7 @@ public class Account4Web {
private Integer backTime;
private String user;
private String tell;
private Integer money;
private Long money;
private Boolean ioStatus;
private Boolean trackStatus;
......@@ -121,11 +121,11 @@ public class Account4Web {
this.tell = tell;
}
public Integer getMoney() {
public Long getMoney() {
return money;
}
public void setMoney(Integer money) {
public void setMoney(Long money) {
this.money = money;
}
......
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
/**
* Created by mxq on 2017/12/26.
*/
@Entity
public class BackVisit {
private Long id;
private Long accountId;
private String email;
private String platform;
private Long visitTime;
private String visitDesc;
private Long user;
private Date visitDate;
private String ds;
private String userName;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public Long getVisitTime() {
return visitTime;
}
public void setVisitTime(Long visitTime) {
this.visitTime = visitTime;
}
public Long getUser() {
return user;
}
public void setUser(Long user) {
this.user = user;
}
public Date getVisitDate() {
return visitDate;
}
public void setVisitDate(Date visitDate) {
this.visitDate = visitDate;
}
public String getDs() {
return ds;
}
public void setDs(String ds) {
this.ds = ds;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getVisitDesc() {
return visitDesc;
}
public void setVisitDesc(String visitDesc) {
this.visitDesc = visitDesc;
}
@Override
public String toString() {
return "BackVisit{" +
"id=" + id +
", accountId=" + accountId +
", email='" + email + '\'' +
", platform='" + platform + '\'' +
", visitTime=" + visitTime +
", user=" + user +
", visitDate=" + visitDate +
'}';
}
}
package common.model;
/**
* Created by mxq on 2017/12/26.
*/
public class KeyValue {
private String email;
private Integer timenum;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getTimenum() {
return timenum;
}
public void setTimenum(Integer timenum) {
this.timenum = timenum;
}
public KeyValue(String email, Integer timenum) {
this.email = email;
this.timenum = timenum;
}
public KeyValue() {
}
@Override
public String toString() {
return "KeyValue{" +
"email='" + email + '\'' +
", timenum=" + timenum +
'}';
}
}
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
/**
* Created by mxq on 2017/12/26.
*/
@Entity
public class Payment {
private Long id;
private Long accountId;
private String email;
private String platform;
private String type;
private Long money;
private Long user;
private Date payDate;
private String ds;
private String userName;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getMoney() {
return money;
}
public void setMoney(Long money) {
this.money = money;
}
public Long getUser() {
return user;
}
public void setUser(Long user) {
this.user = user;
}
public Date getPayDate() {
return payDate;
}
public void setPayDate(Date payDate) {
this.payDate = payDate;
}
public String getDs() {
return ds;
}
public void setDs(String ds) {
this.ds = ds;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
/**
* Created by mxq on 2017/12/26.
*/
@Entity
public class Reminder {
private Long id;
private Long accountId;
private String email;
private String platform;
private Boolean remindStatus;
private Long user;
private String userName;
private Date modifyTime;
private String ds;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public Boolean getRemindStatus() {
return remindStatus;
}
public void setRemindStatus(Boolean remindStatus) {
this.remindStatus = remindStatus;
}
public Long getUser() {
return user;
}
public void setUser(Long user) {
this.user = user;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getDs() {
return ds;
}
public void setDs(String ds) {
this.ds = ds;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
......@@ -3,9 +3,16 @@ package common.repository;
import common.model.Account4Web;
import common.model.Auth;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import tkio.model.Account;
import java.util.List;
@Transactional
public interface Account4WebRepository extends JpaRepository<Account4Web, Long> {
@Query(value = "SELECT * from account4web where email in ?1", nativeQuery = true)
List<Account4Web> findByEmails(List<String> emails);
}
package common.repository;
import common.model.Auth;
import common.model.BackVisit;
import common.model.KeyValue;
import common.model.Reminder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import tkio.model.Account;
import java.util.List;
@Transactional
public interface BackVisitRepository extends JpaRepository<BackVisit, Long> {
@Query(value = "SELECT * from back_visit", nativeQuery = true)
List<BackVisit> findAllCount();
@Query(value = "select * from back_visit where account_id = ?1 and ds > ?2 and ds < ?3 and platform = ?4", nativeQuery = true)
List<BackVisit> findAll(Long accountId, String startDate, String endDate, String platform);
}
package common.repository;
import common.model.Auth;
import common.model.BackVisit;
import common.model.Payment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Transactional
public interface PaymentRepository extends JpaRepository<Payment, Long> {
@Query(value = "select * from payment where account_id = ?1 and ds > ?2 and ds < ?3 and platform = ?4", nativeQuery = true)
List<Payment> findAll(Long accountId, String startDate, String endDate, String platform);
}
package common.repository;
import common.model.Auth;
import common.model.Reminder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigInteger;
import java.util.List;
@Transactional
public interface ReminderRepository extends JpaRepository<Reminder, Long> {
@Query(value = "select * from reminder where account_id = ?1 and ds > ?2 and ds < ?3 and platform = ?4", nativeQuery = true)
List<Reminder> findAll(Long accountId, String startDate, String endDate, String platform);
}
package security;
import security.exception.MethodNotSupportException;
import java.util.UUID;
public abstract class AbstractTokenManager implements TokenManager {
protected int tokenExpireSeconds = 7 * 24 * 3600;
protected boolean singleTokenWithUser = false;
protected boolean flushExpireAfterOperation = true;
public void setTokenExpireSeconds(int tokenExpireSeconds) {
this.tokenExpireSeconds = tokenExpireSeconds;
}
public void setSingleTokenWithUser(boolean singleTokenWithUser) {
this.singleTokenWithUser = singleTokenWithUser;
}
public void setFlushExpireAfterOperation(boolean flushExpireAfterOperation) {
this.flushExpireAfterOperation = flushExpireAfterOperation;
}
@Override
public void delRelationshipByKey(String key) {
//如果是多个Token关联同一个Key,不允许直接通过Key删除所有Token,防止误操作
if (!singleTokenWithUser) {
throw new MethodNotSupportException("非单点登录时无法调用该方法");
}
delSingleRelationshipByKey(key);
}
/**
* 一个用户只能绑定一个Token时通过Key删除关联关系
* @param key
*/
protected abstract void delSingleRelationshipByKey(String key);
private void createRelationship(String key, String token) {
//根据设置的每个用户是否只允许绑定一个Token,调用不同的方法
if (singleTokenWithUser) {
createSingleRelationship(key, token);
} else {
createMultipleRelationship(key, token);
}
}
/**
* 一个用户可以绑定多个Token时创建关联关系
* @param key
* @param token
*/
protected abstract void createMultipleRelationship(String key, String token);
/**
* 一个用户只能绑定一个Token时创建关联关系
* @param key
* @param token
*/
protected abstract void createSingleRelationship(String key, String token);
@Override
public String getKeyFromToken(String token) {
String key = getKeyByToken(token);
//根据设置,在每次有效操作后刷新过期时间
if (key != null && flushExpireAfterOperation) {
flushExpireAfterOperation(key, token);
}
return key;
}
@Override
public String getTokenFromKey(String key) {
return getTokenByKey(key);
}
@Override
public String createToken(String key) {
final String token = generateToken();
createRelationship(key, token);
return token;
}
protected String generateToken(){
return UUID.randomUUID().toString();
}
/**
* 通过Token获得Key
* @param token
* @return
*/
protected abstract String getKeyByToken(String token);
/**
* 通过key获取token
* @param key
* @return
*/
protected abstract String getTokenByKey(String key);
/**
* 在操作后刷新Token的过期时间
* @param key
* @param token
*/
protected abstract void flushExpireAfterOperation(String key, String token);
}
\ No newline at end of file
package security;
/**
* Created by sunhao on 17/3/3.
*/
public interface RedisLoginStatusManager {
/**
* 根据token和状态在redis中创建登陆状态
*/
void createLoginStatus(String token, String status);
/**
* 根据token删除登陆状态
*/
void deleteLoginStatus(String token);
/**
* 根据token获取登陆密码
*/
String getLoginPassword(String token);
/**
* 根据token获取登陆状态
*/
boolean getLoginStatusByKey(String token);
}
package security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import util.StringUtil;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
/**
* Created by sunhao on 17/3/3.
*/
@Service
public class RedisLoginStatusManagerImpl implements RedisLoginStatusManager {
protected int tokenExpireSeconds = 7 * 24 * 3600;
@Autowired
private RedisTemplate redisTemplate;
/**
* Redis中记录login密码的Token的前缀
*/
private static final String REDIS_LOGIN_PREFIX = "LOGIN_STATUS_TOKEN_";
@Override
public void createLoginStatus(String token, String pwd) {
String formatToken = formatKey(token);
String loginStatus = getLoginPassword(formatToken);
if(!StringUtil.isEmpty(loginStatus)) {
delete(formatToken);
}
set(formatToken,pwd,tokenExpireSeconds);
}
@Override
public void deleteLoginStatus(String token) {
delete(formatKey(token));
}
@Override
public boolean getLoginStatusByKey(String token) {
String pwd = getLoginPassword(token);
return !StringUtil.isEmpty(pwd);
}
@Override
public String getLoginPassword(String token) {
String pwd = get(formatKey(token));
//每次取的时候重置失效时间
if(!StringUtil.isEmpty(pwd)) {
expire(formatKey(token), tokenExpireSeconds);
}
return pwd;
}
private String formatKey(String token) {
return REDIS_LOGIN_PREFIX.concat(token);
}
/**
* 取redis
*/
private String get(String key) {
return (String) redisTemplate.opsForValue().get(key);
}
/**
* 存redis
*/
private String set(String key, String value, int expireSeconds) {
redisTemplate.opsForValue().set(key, value);
redisTemplate.expire(key, expireSeconds, TimeUnit.SECONDS);
return value;
}
/**
* 设置过期时间
*/
private void expire(String key, int seconds) {
redisTemplate.expire(key, seconds, TimeUnit.SECONDS);
}
/**
* 删除redis记录
*/
private void delete(String... keys) {
redisTemplate.delete(Arrays.asList(keys));
}
}
package security;
import com.google.common.base.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* Created by nolan on 11/11/2016.
* description:
*/
@Service
public class RedisTokenManager extends AbstractTokenManager {
private final String GLOBAL_TOKEN = "GLOBAL_TOKEN";
/**
* Redis中Key的前缀
*/
private static final String REDIS_KEY_PREFIX = "MANAGER_AUTHORIZATION_KEY_";
/**
* Redis中Token的前缀
*/
private static final String REDIS_TOKEN_PREFIX = "MANAGER_AUTHORIZATION_TOKEN_";
/**
* Redis中账户的前缀
*/
private static final String REDIS_ACCOUNT_PREFIX = "MANAGER_AUTHORIZATION_ACCOUNT_";
@Autowired
private RedisTemplate<String, String> redisTemplate;
/**
* 踢出此账号下的所有登陆
*/
@Override
public void delMultiRelationshipByKey(String key) {
if(Strings.isNullOrEmpty(key))
return;
//获取所有登陆TOKEN
Set<String> tokenSet = this.smembers(formatAccountKey(key));
if(!CollectionUtils.isEmpty(tokenSet)){
//删除这些TOKEN
delete(tokenSet);
//删除对应关系
delete(formatAccountKey(key));
}
}
@Override
protected void delSingleRelationshipByKey(String key) {
String token = getToken(key);
if (token != null) {
delete(formatKey(key), formatToken(token));
}
}
/**
* 根据token删掉关系
* @param token
*/
@Override
public void delRelationshipByToken(String token) {
final String formatToken = formatToken(token);
if (singleTokenWithUser) {
String key = getKeyFromToken(token);
delete(formatKey(key), formatToken);
} else {
//删除对应关系中的token
srem(formatAccountKey(get(formatToken)),formatToken);
//删除token
delete(formatToken);
}
}
/**
* 创建单点登陆的登陆关系
* @param key
* @param token
*/
@Override
protected void createSingleRelationship(String key, String token) {
String oldToken = get(formatKey(key));
if (oldToken != null) {
delete(formatToken(oldToken));
}
set(formatToken(token), key, tokenExpireSeconds);
set(formatKey(key), token, tokenExpireSeconds);
}
/**
* 创建多点登陆的登陆关系
* @param key
* @param token
*/
@Override
protected void createMultipleRelationship(String key, String token) {
set(formatToken(token), key, tokenExpireSeconds);
//添加到账户KEY对应的SET中
sadd(formatAccountKey(key), formatToken(token), tokenExpireSeconds);
}
@Override
protected String getKeyByToken(String token) {
return get(formatToken(token));
}
@Override
protected String getTokenByKey(String key) {
return get(formatKey(key));
}
/**
* 操作后刷新登陆关系时长
* @param key
* @param token
*/
@Override
protected void flushExpireAfterOperation(String key, String token) {
if (singleTokenWithUser) {
expire(formatKey(key), tokenExpireSeconds);
}
expire(formatToken(token), tokenExpireSeconds);
//刷新对应关系时长
expire(formatAccountKey(get(formatToken(token))), tokenExpireSeconds);
}
private String get(String key) {
return redisTemplate.opsForValue().get(key);
}
private String set(String key, String value, int expireSeconds) {
redisTemplate.opsForValue().set(key, value);
redisTemplate.expire(key, expireSeconds, TimeUnit.SECONDS);
return value;
}
/**
* 添加value 对于的KEY set
*/
private Long sadd(String key, String value, int expireSeconds){
Long num = redisTemplate.opsForSet().add(key, value);
if(0 != num){
redisTemplate.expire(key, expireSeconds, TimeUnit.SECONDS);
}
return num;
}
/**
* 删除set中的某个
*/
private Long srem(String key, String value){
return redisTemplate.opsForSet().remove(key,value);
}
/**
* 获取set中所有元素
*/
private Set<String> smembers(String key){
return redisTemplate.opsForSet().members(key);
}
private void expire(String key, int seconds) {
redisTemplate.expire(key, seconds, TimeUnit.SECONDS);
}
private void delete(String... keys) {
redisTemplate.delete(Arrays.asList(keys));
}
private void delete(Collection<String> collection){
redisTemplate.delete(collection);
}
private String getToken(String key) {
return get(formatKey(key));
}
private String formatKey(String key) {
return REDIS_KEY_PREFIX.concat(key);
}
private String formatToken(String token) {
return REDIS_TOKEN_PREFIX.concat(token);
}
private String formatAccountKey(String key){
return REDIS_ACCOUNT_PREFIX.concat(key);
}
}
package security;
/**
* Created by nolan on 11/11/2016.
* description:
*/
public interface TokenManager {
void delMultiRelationshipByKey(String key);
/**
* 通过key删除关联关系
*
* @param key
*/
void delRelationshipByKey(String key);
/**
* 通过token删除关联关系
*
* @param token
*/
void delRelationshipByToken(String token);
/**
* 通过token获得对应的key
*
* @param token
* @return
*/
String getKeyFromToken(String token);
/**
* 通过key获得对应token
* @param key
* @return
*/
String getTokenFromKey(String key);
/**
* 根据key生成对应token
* @param key
* @return
*/
String createToken(String key);
}
package security.cors;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by sunhao on 17/3/13.
* dec: 设置跨域
*/
public class CorsFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
httpServletResponse.addHeader("Access-Control-Allow-Origin", "*");
if (httpServletRequest.getHeader("Access-Control-Request-Method") != null && "OPTIONS".equals(httpServletRequest.getMethod())) {
httpServletResponse.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
httpServletResponse.addHeader("Access-Control-Allow-Headers", "Authorization, Origin, X-Requested-With, Content-Type, Accept");
httpServletResponse.addHeader("Access-Control-Max-Age", "3600");
}
filterChain.doFilter(httpServletRequest, httpServletResponse);
}
}
package security.exception;
public class MethodNotSupportException extends RuntimeException {
public MethodNotSupportException(String message) {
super(message);
}
}
\ No newline at end of file
......@@ -6,6 +6,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import security.RedisLoginStatusManager;
import security.TokenManager;
import util.Constant;
import util.StringUtil;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
......@@ -18,21 +22,42 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
@Autowired
private UserRepository userRepository;
@Autowired
private TokenManager manager;
@Autowired
private RedisLoginStatusManager redisLoginStatusManager;
//鉴权信息的无用前缀,默认为空
private String httpHeaderPrefix = "";
public void setHttpHeaderName(String httpHeaderName) {
this.httpHeaderName = httpHeaderName;
}
public void setHttpHeaderPrefix(String httpHeaderPrefix) {
this.httpHeaderPrefix = httpHeaderPrefix;
}
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
//放开登录
/*if (request.getRequestURL().indexOf("login/login") != -1){
return true;
}
//从header中得到token
String token = request.getHeader(httpHeaderName);
System.out.println(token);
token = StringUtil.isEmpty(token) ? getCookieToken(request.getCookies(), "TOKEN") : token;
token = token.substring(httpHeaderPrefix.length());
//验证token
String key = manager.getKeyFromToken(token);
//登陆状态
boolean loginStatus = redisLoginStatusManager.getLoginStatusByKey(token);
if (!StringUtil.isEmpty(key)) {
String id = getCookieToken(request.getCookies(), "TOKEN");
if(null != id){
User account = userRepository.findOne(Long.parseLong(id));
User sessionAct = (User) request.getSession().getAttribute("$CURRENT_ACCOUNT$");
if (sessionAct == null || !account.getId().equals(sessionAct.getId())) {
request.getSession().setAttribute("$CURRENT_ACCOUNT$", account);
User one = userRepository.findOne(Long.parseLong(key));
User sessionAct = (User) request.getSession().getAttribute(Constant.CURRENT_ACCOUNT);
if (sessionAct == null) {
request.getSession().setAttribute(Constant.CURRENT_ACCOUNT,one);
}
return true;
}
......
package tkio.controller;
import common.model.BackVisit;
import common.model.Payment;
import common.model.Reminder;
import common.model.User;
import common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import security.annotation.CurrentAccount;
import tkio.service.TkioAccountService;
import util.ResultModel;
/**
* Created by mxq on 2017/12/21.
*/
@Controller
@RequestMapping("marketing/accountmng/tkio")
public class TkioAccountController {
@Autowired
TkioAccountService tkioAccountService;
//客户列表
@RequestMapping(value = "/findAll", method = RequestMethod.GET)
@ResponseBody
public ResultModel find(@CurrentAccount User loginAccount) {
return ResultModel.OK(tkioAccountService.findAll(loginAccount));
}
//关闭到期提醒
@RequestMapping(value = "/forbiden", method = RequestMethod.PUT)
@ResponseBody
public ResultModel forbiden(@CurrentAccount User loginAccount, @RequestBody Reminder resource) {
return ResultModel.OK(tkioAccountService.forbiden(loginAccount, resource));
}
//开启到期提醒
@RequestMapping(value = "/enable", method = RequestMethod.PUT)
@ResponseBody
public ResultModel enable(@CurrentAccount User loginAccount, @RequestBody Reminder resource) {
return ResultModel.OK(tkioAccountService.enable(loginAccount, resource));
}
//缴费
@RequestMapping(value = "/pay", method = RequestMethod.PUT)
@ResponseBody
public ResultModel pay(@CurrentAccount User loginAccount, @RequestBody Payment resource) {
return ResultModel.OK(tkioAccountService.pay(loginAccount, resource));
}
//回访
@RequestMapping(value = "/visit", method = RequestMethod.PUT)
@ResponseBody
public ResultModel visit(@CurrentAccount User loginAccount, @RequestBody BackVisit resource) {
return ResultModel.OK( tkioAccountService.visit(loginAccount, resource));
}
//功能使用查询
@RequestMapping(value = "/find/function/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel updateName(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findFunTimes(accountId,startDate,endDate));
}
//功能使用查询
@RequestMapping(value = "/find/pv/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel pv(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findPv(accountId,startDate,endDate));
}
//到期提醒查询
@RequestMapping(value = "/find/reminder/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findRed(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findRed(accountId,startDate,endDate));
}
//回访查询
@RequestMapping(value = "/find/visit/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findVisit(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findVisit(accountId,startDate,endDate));
}
//缴费查询
@RequestMapping(value = "/find/pay/{accountId}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findPay(@CurrentAccount User loginAccount, @RequestParam String startDate,
@RequestParam String endDate, @PathVariable Long accountId) {
return ResultModel.OK(tkioAccountService.findPay(accountId,startDate,endDate));
}
}
package tkio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
@Entity
public class Campaign
{
private Long id;
private Long app;
private String os;
private String type;
private Long channel;
private String channelCategory;
private String channelType;
private String campaignid;
private String name;
private String callback;
private String url;
private String surl;
private Integer addParam;
private String campaignpackid;
private String specialKeys;
private String advertiserid;
private String bundleid;
private Boolean awssuccess = false;
private Date createTime;
private Long createAccount;
private Date modifyTime;
private Long modifyAccount;
private Boolean delFlag = false;
private Long account;
private String holderids;
private String pack_channelid;
private int batchNumber;
private int startNumber;
private String campaignName;
@Transient
public int getStartNumber() {
return startNumber;
}
public void setStartNumber(int startNumber) {
this.startNumber = startNumber;
}
@Transient
public String getCampaignName() {
return campaignName;
}
public void setCampaignName(String campaignName) {
this.campaignName = campaignName;
}
@Transient
public int getBatchNumber()
{
return batchNumber;
}
public void setBatchNumber(int batchNumber)
{
this.batchNumber = batchNumber;
}
@Transient
public String getHolderids()
{
return holderids;
}
public void setHolderids(String holderids)
{
this.holderids = holderids;
}
public Long getAccount()
{
return account;
}
public void setAccount(Long account)
{
this.account = account;
}
public Campaign()
{
super();
}
public Campaign(String campaignid, String name)
{
this.campaignid = campaignid;
this.name = name;
}
public Long getApp()
{
return app;
}
public String getCallback()
{
return callback;
}
/* public Long getCampaignGroup() {
return campaignGroup;
}*/
public Long getChannel()
{
return channel;
}
@Id
@GeneratedValue
public Long getId()
{
return id;
}
public String getName()
{
return name;
}
public String getSurl()
{
return surl;
}
public String getType()
{
return type;
}
public String getUrl()
{
return url;
}
public void setApp(Long app)
{
this.app = app;
}
public void setCallback(String callback)
{
this.callback = callback;
}
/* public void setCampaignGroup(Long campaignGroup) {
this.campaignGroup = campaignGroup;
}*/
public void setChannel(Long channel)
{
this.channel = channel;
}
public String getChannelCategory()
{
return channelCategory;
}
public void setChannelCategory(String channelCategory)
{
this.channelCategory = channelCategory;
}
public String getChannelType()
{
return channelType;
}
public void setChannelType(String channelType)
{
this.channelType = channelType;
}
public void setId(Long id)
{
this.id = id;
}
public void setName(String name)
{
this.name = name;
}
public void setSurl(String surl)
{
this.surl = surl;
}
public void setType(String type)
{
this.type = type;
}
public void setUrl(String url)
{
this.url = url;
}
public String getSpecialKeys()
{
return specialKeys;
}
public void setSpecialKeys(String specialKeys)
{
this.specialKeys = specialKeys;
}
public Integer getAddParam()
{
return addParam;
}
public void setAddParam(Integer addParam)
{
this.addParam = addParam;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public boolean isAwssuccess()
{
return awssuccess;
}
public void setAwssuccess(boolean awssuccess)
{
this.awssuccess = awssuccess;
}
public String getCampaignpackid()
{
return campaignpackid;
}
public void setCampaignpackid(String campaignpackid)
{
this.campaignpackid = campaignpackid;
}
public String getAdvertiserid()
{
return advertiserid;
}
public void setAdvertiserid(String advertiserid)
{
this.advertiserid = advertiserid;
}
public String getBundleid()
{
return bundleid;
}
public void setBundleid(String bundleid)
{
this.bundleid = bundleid;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public Date getModifyTime()
{
return modifyTime;
}
public void setModifyTime(Date modifyTime)
{
this.modifyTime = modifyTime;
}
public Boolean getDelFlag()
{
return delFlag;
}
public void setDelFlag(Boolean delFlag)
{
this.delFlag = delFlag;
}
public String getCampaignid()
{
return campaignid;
}
public void setCampaignid(String campaignid)
{
this.campaignid = campaignid;
}
public Long getCreateAccount()
{
return createAccount;
}
public void setCreateAccount(Long createAccount)
{
this.createAccount = createAccount;
}
public Long getModifyAccount()
{
return modifyAccount;
}
public void setModifyAccount(Long modifyAccount)
{
this.modifyAccount = modifyAccount;
}
public String getPack_channelid()
{
return pack_channelid;
}
public void setPack_channelid(String pack_channelid)
{
this.pack_channelid = pack_channelid;
}
public Boolean getAwssuccess()
{
return awssuccess;
}
public void setAwssuccess(Boolean awssuccess)
{
this.awssuccess = awssuccess;
}
@Override
public String toString()
{
return "Campaign{" +
"id=" + id +
", app=" + app +
", os='" + os + '\'' +
", type='" + type + '\'' +
", channel=" + channel +
", channelCategory='" + channelCategory + '\'' +
", channelType='" + channelType + '\'' +
", campaignid='" + campaignid + '\'' +
", name='" + name + '\'' +
", callback='" + callback + '\'' +
", url='" + url + '\'' +
", surl='" + surl + '\'' +
", addParam=" + addParam +
", campaignpackid='" + campaignpackid + '\'' +
", specialKeys='" + specialKeys + '\'' +
", advertiserid='" + advertiserid + '\'' +
", bundleid='" + bundleid + '\'' +
", awssuccess=" + awssuccess +
", createTime=" + createTime +
", createAccount=" + createAccount +
", modifyTime=" + modifyTime +
", modifyAccount=" + modifyAccount +
", delFlag=" + delFlag +
", account=" + account +
", holderids='" + holderids + '\'' +
", pack_channelid='" + pack_channelid + '\'' +
", batchNumber=" + batchNumber +
'}';
}
}
package tkio.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
@Entity
public class Channel {
private Long id;
private String name;
private String category;
private Long account;
private String url;
private String type;
private String uniqueName;
private String firstchar;
private boolean ishttps=false;
private Boolean osAndroid;
private Boolean osIos;
private Boolean osWeb;
private String trackurl;
private String androidparam;
private String iosparam;
private boolean istrackurlspecial=false;
private Date createTime;
private Long createAccount;
private Date modifyTime;
private Long modifyAccount;
private Boolean delFlag;
private String specialParams;
private String nodeUrl;
public String getNodeUrl() {
return nodeUrl;
}
public void setNodeUrl(String nodeUrl) {
this.nodeUrl = nodeUrl;
}
private boolean isintegrate = false;
private Integer iscostrecovery; //0:没对接,1:API,2:爬虫。
private Integer orderindex;
//0 正常渠道 1 被合并渠道,不再显示
private Boolean isNotShow;
//0 正常渠道 1 未覆盖中国,不再显示 例如:Search Ads
private Boolean isNotCover;
public Channel() {
super();
}
public Channel(String name, String category, String url) {
super();
this.name = name;
this.category = category;
this.url = url;
}
public Channel(Long channelId, String name){
super();
this.id = channelId;
this.name = name;
}
public String getCategory() {
return category;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public String getName() {
return name;
}
public String getUrl() {
return url;
}
public void setCategory(String category) {
this.category = category;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setUrl(String url) {
this.url = url;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUniqueName() {
return uniqueName;
}
public void setUniqueName(String uniqueName) {
this.uniqueName = uniqueName;
}
public String getFirstchar() {
return firstchar;
}
public void setFirstchar(String firstchar) {
this.firstchar = firstchar;
}
public boolean isIshttps() {
return ishttps;
}
public void setIshttps(boolean ishttps) {
this.ishttps = ishttps;
}
public Boolean getOsAndroid() {
return osAndroid;
}
public void setOsAndroid(Boolean osAndroid) {
this.osAndroid = osAndroid;
}
public Boolean getOsIos() {
return osIos;
}
public void setOsIos(Boolean osIos) {
this.osIos = osIos;
}
public Boolean getOsWeb() {
return osWeb;
}
public void setOsWeb(Boolean osWeb) {
this.osWeb = osWeb;
}
public String getTrackurl() {
return trackurl;
}
public void setTrackurl(String trackurl) {
this.trackurl = trackurl;
}
public String getAndroidparam() {
return androidparam;
}
public void setAndroidparam(String androidparam) {
this.androidparam = androidparam;
}
public String getIosparam() {
return iosparam;
}
public void setIosparam(String iosparam) {
this.iosparam = iosparam;
}
public boolean isIstrackurlspecial() {
return istrackurlspecial;
}
public void setIstrackurlspecial(boolean istrackurlspecial) {
this.istrackurlspecial = istrackurlspecial;
}
public boolean isIsintegrate() {
return isintegrate;
}
public void setIsintegrate(boolean isintegrate) {
this.isintegrate = isintegrate;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Boolean getDelFlag() {
return delFlag;
}
public void setDelFlag(Boolean delFlag) {
this.delFlag = delFlag;
}
public Long getCreateAccount() {
return createAccount;
}
public void setCreateAccount(Long createAccount) {
this.createAccount = createAccount;
}
public Long getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(Long modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Long getAccount() {
return account;
}
public void setAccount(Long account) {
this.account = account;
}
public String getSpecialParams() {
return specialParams;
}
public void setSpecialParams(String specialParams) {
this.specialParams = specialParams;
}
public Integer getIscostrecovery() {
return iscostrecovery;
}
public void setIscostrecovery(Integer iscostrecovery) {
this.iscostrecovery = iscostrecovery;
}
public Integer getOrderindex()
{
return orderindex;
}
public void setOrderindex(Integer orderindex)
{
this.orderindex = orderindex;
}
public Boolean getNotShow() {
return isNotShow;
}
public void setNotShow(Boolean notShow) {
isNotShow = notShow;
}
public Boolean getNotCover() {
return isNotCover;
}
public void setNotCover(Boolean notCover) {
isNotCover = notCover;
}
}
......@@ -22,4 +22,12 @@ public interface AccountRepository extends JpaRepository<Account, Long> {
@Query(value = "SELECT * from account where is_super_user is true and `status` = 1 and past_date < ?1", nativeQuery = true)
List<Account> findRootParentsPast(String today);
@Query(value = "SELECT * from account where is_super_user is true and bussinessman = ?1", nativeQuery = true)
List<Account> findBussnissMan(List<Integer> bussinussIds);
@Query(value = "select * from account where root_parent = ?1", nativeQuery = true)
List<Account> findByRootParent(Long accountId);
@Query(value = "select count(*) from account where root_parent = ?1 and create_time > ?2 and create_time < ?3", nativeQuery = true)
BigInteger countByRootParent(Long accountId, String startDate, String endDate);
}
......@@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import tkio.model.App;
import java.math.BigInteger;
import java.util.List;
public interface AppRepository extends JpaRepository<App, Long> {
......@@ -12,56 +13,9 @@ public interface AppRepository extends JpaRepository<App, Long> {
@Query(value = "select * from app where account in (select id from account where parent = ?1 or id = ?1) and del_flag is not true", nativeQuery = true)
List<App> listAppByRootAccount(Long account);
@Query(value="select appkey from app where id = ?1",nativeQuery=true)
String findAppkeyById(Long id);
@Query(value = "select count(*) from app where account in ?1 and create_time > ?2 and create_time < ?3", nativeQuery = true)
BigInteger countByAccount(List<Long> accountId, String startDate, String endDate);
List<App> findByAccount(Long account);
@Query(value = "select * from app where account =?1 and bundleid = ?2 and del_flag is not true", nativeQuery = true)
App findByBundleidInNotDel(Long account, String bundleid);
@Query(value = "select * from app where account =?1 and name = ?2 and del_flag is not true", nativeQuery = true)
App findByNameNotDel(Long account, String name);
@Query(value = "select * from app where sync_ddb is false and del_flag is not true", nativeQuery = true)
List<App> findNotSyncAppDebug();
@Query(value = "select * from app where token = ?1 limit 1", nativeQuery = true)
App findOneByAppToken(String token);
@Query(value = "select * from app where id in ?1", nativeQuery = true)
List<App> findByIds(List<Long> ids);
@Query(value = "SELECT DISTINCT t2.* FROM campaign t0 JOIN channel t1 ON t0.channel = t1.id JOIN app t2 ON t0.app = t2.id WHERE t0.del_flag is not true and (t1.type!='ry_coop' or t1.type is NULL) and t1.category = 'ADVERTISING' and t2.id in ?1 and t2.platform = ?2 and t2.del_flag is not TRUE" , nativeQuery = true)
List<App> findAppsFromOnelink(List<Long> appids, String platform);
@Query(value = "SELECT DISTINCT t2.* FROM campaign t0 JOIN channel t1 ON t0.channel = t1.id JOIN app t2 ON t0.app = t2.id WHERE t0.del_flag is not true and (t1.type!='ry_coop' or t1.type is NULL) and t1.category = 'ADVERTISING' and t2.id = ?1" , nativeQuery = true)
App findAppFromOnelink(Long appid);
@Query(value = "select * from app where appkey in ?1", nativeQuery = true)
List<App> findByAppkeys(List<String> appkeys);
@Query(value = "select * from app a join auth b on a.id = b.app where b.account = ?1 and b.create_account in (select id from account where root_parent = ?2) ", nativeQuery = true)
List<App> findAuthAppByRootParent(Long subAccountId, Long rootParent);
@Query(value = "select * from app a join auth b on a.id = b.app where b.account = ?1 ", nativeQuery = true)
List<App> findAuthApp(Long subAccountId);
@Query(value="select platform from app where id = ?1",nativeQuery=true)
String findPlatformByAppId(Long appId);
@Query(value="select categoryname from category where categoryid=(select game_genre from app where id=?1);",nativeQuery=true)
String findGameCategoryByAppID(Long appId);
@Query(value="select categoryname from category where categoryid=(select app_genre from app where id=?1);",nativeQuery=true)
String findAppGenreNameByAppID(Long id);
@Query(value = "select DISTINCT a.* from app a right join data_auth d on a.id = d.app where d.account = ?1 and d.app in ?2 and d.channel = ?3 and (d.all_campaign is true or d.channel_permit is true)", nativeQuery = true)
List<App> listTotalAuthorizedApp(Long accountId, List<Long> appIdList, Long channelId);
@Query(value = "select create_account from app where appkey=?1", nativeQuery = true)
String findCreateAccountByAppkey(String appKey);
@Query(value = "select DISTINCT a.* from app a right join data_auth d on a.id = d.app where d.account = ?1 and d.channel = ?2 and (d.all_campaign is true or d.channel_permit is true)", nativeQuery = true)
List<App> listApps(Long accountId, Long channelId);
@Query(value = "select appkey from app where account in ?1", nativeQuery = true)
List<String> findAppkeys(List<Long> accountId);
}
package tkio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import tkio.model.Campaign;
import java.math.BigInteger;
import java.util.List;
@Transactional
public interface CampaignRepository extends JpaRepository<Campaign, Long> {
Iterable<Campaign> findByApp(Long id);
@Query(value = "select count(*) from campaign where account in ?1 and create_time > ?2 and create_time < ?3", nativeQuery = true)
BigInteger countByAccount(List<Long> accountId, String startDate, String endDate);
}
package tkio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import tkio.model.Channel;
import java.math.BigInteger;
import java.util.List;
@Transactional
public interface ChannelRepository extends JpaRepository<Channel, Long> {
@Query(value = "select count(*) from channel where account in ?1 and create_time > ?2 and create_time < ?3", nativeQuery = true)
BigInteger countByAccount(List<Long> accountId, String startDate, String endDate);
}
......@@ -5,8 +5,16 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import tkio.model.SalesManLeader;
import java.util.List;
@Transactional
public interface SalesManLeaderRepository extends JpaRepository<SalesManLeader, Long> {
@Query(value = "select email from sales_man_leader where id=(select leader from sales_man_leader where id=?1)", nativeQuery = true)
String findLeaderByBussinessMan(Long bussinessMan);
@Query(value = "select * from sales_man_leader where leader = (select id from sales_man_leader where email = ?1)", nativeQuery = true)
List<SalesManLeader> findByEmail(String email);
@Query(value = "select * from sales_man_leader where email = ?1", nativeQuery = true)
SalesManLeader findOneByEmail(String email);
}
package tkio.service;
import common.model.*;
import java.util.List;
import java.util.Map;
/**
* Created by mxq on 2017/12/26.
*/
public interface TkioAccountService {
List<Account4Web> findAll(User user);
//到期提醒关闭
Reminder forbiden(User user, Reminder resource);
//到期提醒开启
Reminder enable(User user, Reminder resource);
//缴费
Payment pay(User user, Payment resource);
//回访
BackVisit visit(User user, BackVisit resource);
//查询功能使用情况
Map<String, Integer> findFunTimes(Long account, String startDate, String endDate);
//查询功能使用情况
List<Map<String, Object>> findPv(Long account, String startDate, String endDate);
List<Reminder> findRed(Long account, String startDate, String endDate);
List<BackVisit> findVisit(Long account, String startDate, String endDate);
List<Payment> findPay(Long account, String startDate, String endDate);
}
package tkio.service.impl;
import com.amazonaws.services.dynamodbv2.xspec.B;
import common.model.*;
import common.repository.*;
import dic.RoleEnum;
import dic.RoleTypeEnum;
import org.apache.commons.collections.map.AbstractMapDecorator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import tkio.model.Account;
import tkio.model.SalesManLeader;
import tkio.repository.*;
import tkio.service.AccountFlowRestrictService;
import tkio.service.TkioAccountService;
import util.Constant;
import util.DateUtil;
import util.HttpClientUtil;
import util.ValidateUtil;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
/**
* Created by mxq on 2017/12/26.
*/
@Service
public class TkioAccountServiceImpl implements TkioAccountService {
//查询URI
private final static String URI_REPORT_BY_SQL = "/api/trackingio/bysql";
@Autowired
Account4WebRepository account4WebRepository;
@Autowired
SalesManLeaderRepository salesManLeaderRepository;
@Autowired
AccountRepository accountRepository;
@Autowired
BackVisitRepository backVisitRepository;
@Autowired
PaymentRepository paymentRepository;
@Autowired
ReminderRepository reminderRepository;
@Autowired
CampaignRepository campaignRepository;
@Autowired
ChannelRepository channelRepository;
@Autowired
AppRepository appRepository;
@Autowired
AccountFlowRestrictService accountFlowRestrictService;
@Autowired
UserRepository userRepository;
@Override
public List<Account4Web> findAll(User user) {
List<Account4Web> result = new ArrayList<>();
List<Account4Web> account4WebList = null;
if(user.getRole().equals(RoleEnum.MANAGER.getKey())){
account4WebList = account4WebRepository.findAll();
} else{
List<Integer> idList = new ArrayList<>();
if(user.getRoleType().equals(RoleTypeEnum.MANAGER.getKey())){
List<SalesManLeader> salesManLeaderList = salesManLeaderRepository.findByEmail(user.getEmail());
if (ValidateUtil.isValid(salesManLeaderList)){
for(SalesManLeader sml : salesManLeaderList){
idList.add(sml.getId());
}
}
}else{
SalesManLeader salesManLeader = salesManLeaderRepository.findOneByEmail(user.getEmail());
idList.add(salesManLeader.getId());
}
if(ValidateUtil.isValid(idList)){
List<Account> accountList = accountRepository.findBussnissMan(idList);
List<String> emails = new ArrayList<>();
if(ValidateUtil.isValid(accountList)){
for(Account ac : accountList){
emails.add(ac.getEmail());
}
account4WebList = account4WebRepository.findByEmails(emails);
}
}
}
if(ValidateUtil.isValid(account4WebList)){
Map<String, Integer> backTimeMap = getBackTime();
Map<String, Long> payMap = getPayment();
for(Account4Web aw : account4WebList){
if(backTimeMap.containsKey(aw.getEmail())){
aw.setBackTime(backTimeMap.get(aw.getEmail()));
} else{
aw.setBackTime(0);
}
if(payMap.containsKey(aw.getEmail())){
aw.setMoney(payMap.get(aw.getEmail()));
} else{
aw.setMoney(0L);
}
result.add(aw);
}
}
return result;
}
@Override
public Reminder forbiden(User user, Reminder resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("tkio");
resource.setRemindStatus(false);
resource.setDs(DateUtil.getBeforeDays(0));
return reminderRepository.save(resource);
}
@Override
public Reminder enable(User user, Reminder resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("tkio");
resource.setRemindStatus(true);
resource.setDs(DateUtil.getBeforeDays(0));
return reminderRepository.save(resource);
}
@Override
public Payment pay(User user, Payment resource) {
resource.setUser(user.getId());
resource.setPayDate(new Date());
resource.setDs(DateUtil.getBeforeDays(0));
return paymentRepository.save(resource);
}
@Override
public BackVisit visit(User user, BackVisit resource) {
resource.setUser(user.getId());
resource.setVisitDate(new Date());
resource.setDs(DateUtil.getBeforeDays(0));
return backVisitRepository.save(resource);
}
@Override
public Map<String, Integer> findFunTimes(Long account, String startDate, String endDate) {
Map<String, Integer> result = new HashMap<>();
List<Account> accountList = accountRepository.findByRootParent(account);
List<Long> idList = new ArrayList<>();
for(Account ac : accountList){
idList.add(ac.getId());
}
List<String> appkeys = appRepository.findAppkeys(idList);
String appkeyStr = String.join("','", appkeys);
BigInteger numAccount = accountRepository.countByRootParent(account, startDate, endDate);
BigInteger numApp = appRepository.countByAccount(idList, startDate, endDate);
BigInteger numCampaign = campaignRepository.countByAccount(idList, startDate, endDate);
BigInteger numChannel = channelRepository.countByAccount(idList, startDate, endDate);
BigInteger event_sum = accountFlowRestrictService.getTotalNum(startDate, endDate, "'" + appkeyStr + "'", "account_io_flow_restrict", "event_sum");
BigInteger click_sum =accountFlowRestrictService.getTotalNum(startDate, endDate, "'" + appkeyStr + "'","account_track_flow_restrict","click_sum");
result.put("numAccount", numAccount.intValue());
result.put("numApp", numApp.intValue());
result.put("numCampaign", numCampaign.intValue());
result.put("numChannel", numChannel.intValue());
result.put("event_sum", event_sum.intValue());
result.put("click_sum", click_sum.intValue());
return result;
}
@Override
public List<Map<String, Object>> findPv(Long account, String startDate, String endDate) {
List<Map<String, Object>> result = new ArrayList<>();
List<Account> accountList = accountRepository.findByRootParent(account);
List<Long> idList = new ArrayList<>();
for(Account ac : accountList){
idList.add(ac.getId());
}
List<String> appkeys = appRepository.findAppkeys(idList);
String appkeyStr = String.join("','", appkeys);
String querySql = "select menu, count(*) as pv, count(distinct(xwho)) as uv, count(*)/count(distinct(xwho)) as puv " +
"from tkio_bigtable_view.event_f0f251af10e66a0c94d2e923d8863105 where user_appkey in ('" + appkeyStr + "') " +
"AND ds >= '" + startDate + "' AND ds <= '" + endDate + "' group by menu;";
String url = Constant.reportUrl + URI_REPORT_BY_SQL;
Map<String, String> conditions = new HashMap<>();
conditions.put("sql", querySql);
conditions.put("dbtype", "presto");
conditions.put("datatype", "list");
conditions.put("iscache", "0");
String responseJson = HttpClientUtil.doHttpPostRequest(url, "trackingio", conditions);
if(responseJson.contains("val")){
try {
JSONObject jsonObject = new JSONObject(responseJson);
JSONArray valArr = jsonObject.getJSONArray("val");
if(null != valArr && valArr.length() > 0){
for(int i = 0; i < valArr.length(); i++){
JSONObject val = valArr.getJSONObject(i);
Map<String, Object> map = new HashMap<>();
map.put("menu", val.getString("menu"));
map.put("pv", val.getInt("pv"));
map.put("uv", val.getInt("uv"));
map.put("puv", val.getInt("puv"));
result.add(map);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return result;
}
@Override
public List<Reminder> findRed(Long account, String startDate, String endDate) {
List<Reminder> result = new ArrayList<>();
List<User> userList = userRepository.findAll();
Map<Long, String> userMap = new HashMap<>();
for(User u : userList){
userMap.put(u.getId(), u.getName());
}
List<Reminder> list = reminderRepository.findAll(account, startDate, endDate, "tkio");
if (ValidateUtil.isValid(list)) {
for(Reminder re : list){
re.setUserName(userMap.get(re.getUser()));
result.add(re);
}
}
return result;
}
@Override
public List<BackVisit> findVisit(Long account, String startDate, String endDate) {
List<BackVisit> result = new ArrayList<>();
List<User> userList = userRepository.findAll();
Map<Long, String> userMap = new HashMap<>();
for(User u : userList){
userMap.put(u.getId(), u.getName());
}
List<BackVisit> list = backVisitRepository.findAll(account, startDate, endDate, "tkio");
if (ValidateUtil.isValid(list)) {
for(BackVisit re : list){
re.setUserName(userMap.get(re.getUser()));
result.add(re);
}
}
return result;
}
@Override
public List<Payment> findPay(Long account, String startDate, String endDate) {
List<Payment> result = new ArrayList<>();
List<User> userList = userRepository.findAll();
Map<Long, String> userMap = new HashMap<>();
for(User u : userList){
userMap.put(u.getId(), u.getName());
}
List<Payment> list = paymentRepository.findAll(account, startDate, endDate, "tkio");
if (ValidateUtil.isValid(list)) {
for(Payment re : list){
re.setUserName(userMap.get(re.getUser()));
result.add(re);
}
}
return result;
}
public Map<String, Integer> getBackTime(){
Map<String, Integer> map = new HashMap<>();
List<BackVisit> all = backVisitRepository.findAll();
if (ValidateUtil.isValid(all)){
for(BackVisit bv : all){
if(map.containsKey(bv.getEmail())){
map.put(bv.getEmail(), map.get(bv.getEmail()) + 1);
} else{
map.put(bv.getEmail(), 1);
}
}
}
return map;
}
public Map<String, Long> getPayment(){
Map<String, Long> map = new HashMap<>();
List<Payment> all = paymentRepository.findAll();
if (ValidateUtil.isValid(all)){
for(Payment pa : all){
if(map.containsKey(pa.getEmail())){
map.put(pa.getEmail(), map.get(pa.getEmail()) + pa.getMoney());
} else{
map.put(pa.getEmail(), pa.getMoney());
}
}
}
return map;
}
}
......@@ -6,8 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import tkio.model.Account;
import tkio.model.AccountRestrict4Web;
import tkio.model.PackageType;
import tkio.model.SalesManLeader;
import tkio.repository.AccountRepository;
import tkio.repository.PackageTypeRepository;
import tkio.repository.SalesManLeaderRepository;
import tkio.service.AccountFlowRestrictService;
import util.DateUtil;
import util.ValidateUtil;
......@@ -34,7 +36,12 @@ public class AccountTask {
@Autowired
private PackageTypeRepository packageTypeRepository;
@Autowired
SalesManLeaderRepository salesManLeaderRepository;
public void task(){
//清空前一天数据
account4WebRepository.deleteAll();
List<Account4Web> list = new ArrayList<>();
//未过期的查询是否流量到期
List<Account> accountValidList = accountRepository.findRootParentsUnPast(DateUtil.getBeforeDays(1));
......@@ -57,7 +64,8 @@ public class AccountTask {
}
account4Web.setIoStatus(restrict4Web.getAllowBehavior());
account4Web.setTrackStatus(restrict4Web.getTrackFlowNotified());
account4Web.setUser(ac.getBussinessman().toString());
account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone());
list.add(account4Web);
}
}
......@@ -81,7 +89,8 @@ public class AccountTask {
account4Web.setTrack("----");
account4Web.setIoStatus(false);
account4Web.setTrackStatus(false);
account4Web.setUser(ac.getBussinessman().toString());
account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone());
list.add(account4Web);
}
}
......
......@@ -22,6 +22,12 @@ public class Constant {
public static ResourceBundle commonBundle = ResourceBundle.getBundle("common");
public static String reportUrl = commonBundle.getString("report.url");
public static ResourceBundle redis = ResourceBundle.getBundle("redis");
public static String REDIS_KEY_VALID_TIME = redis.getString("redis.key.validtime");
public static String REDIS_IP_REQUEST_TIMES = redis.getString("redis.ip.requesttimes");
public static String REDIS_IP_UNKNOWN_REQUEST_TIMES = redis.getString("redis.ip.unknown.requesttimes");
......
package util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;
/**
* 单节点Jedis.
* @author Administrator
*
*/
public class RedisUtilNew {
protected static Logger logger = LoggerFactory.getLogger(RedisUtilNew.class);
private static RedisUtilNew redisUtil = new RedisUtilNew();
private JedisPool pool;
//
// private ResourceBundle resourceBundle;
private RedisUtilNew() {
ResourceBundle resourceBundle = ResourceBundle.getBundle("redis");
pool = new JedisPool(resourceBundle.getString("redis.surl.host"),
Integer.valueOf(resourceBundle.getString("redis.surl.port")));
}
public static RedisUtilNew getInstance() {
return redisUtil;
}
public Map<String, String> hgetAll(String key) {
Map<String, String> result = new HashMap<String, String>();
Jedis jedis = pool.getResource();
result = jedis.hgetAll(key);
pool.returnResource(jedis);
return result;
}
public void hsetAll(String key, Map<String, String> map) {
Jedis jedis = pool.getResource();
jedis.hmset(key, map);
pool.returnResource(jedis);
}
public void delete(String key) {
Jedis jedis = pool.getResource();
jedis.del(key);
pool.returnResource(jedis);
}
/**
* 取值
*
* @param key
* @return
*/
public String get(String key) {
Jedis jedis = pool.getResource();
try {
String result = jedis.get(key);
if (result == null) {
return null;
}
return result;
} finally {
pool.returnResource(jedis);
}
}
/**
* 向redis中写入数据
* @param key
* @param value
*/
public void set(String key,String value)
{
Jedis jedis = pool.getResource();
jedis.set(key,value);
pool.returnResource(jedis);
}
public Long getExpireTime(String key)
{
Jedis jedis = pool.getResource();
Long m = jedis.ttl(key);
pool.returnResource(jedis);
return m;
}
/**
* 加锁.
*
* @param key
* @param expireTime
* 超时时间单位秒.
* @return 锁定的value,返回null值加锁失败,供释放锁时使用.
*/
public String tryLock(String key, int expireTime) {
Jedis jedis = pool.getResource();
try {
String value = Long.toString(System.currentTimeMillis() + (expireTime * 1000));
String result = jedis.set(key, value, "NX", "EX", expireTime);
if (result == null) {
return null;
}
return value;
} finally {
pool.returnResource(jedis);
}
}
public String expireValue(String key, String value, int expireTime)
{
Jedis jedis = pool.getResource();
try {
String result = jedis.set(key, value, "NX", "EX", expireTime);
if (result == null) {
return null;
}
return value;
} finally {
pool.returnResource(jedis);
}
}
public void releaseLock(String key) {
Jedis jedis = pool.getResource();
try {
Set<String> set = jedis.keys(key);
String[] kk = new String[set.size()];
jedis.del(set.toArray(kk));
} catch (Exception e) {
e.printStackTrace();
} finally {
pool.returnResource(jedis);
}
}
public static void main(String[] args) {
RedisUtilNew redisUtilNew = RedisUtilNew.getInstance();
//redisUtilNew.expireValue("test005","12",1000);
Long outtime = redisUtilNew.getExpireTime("test005");
redisUtilNew.delete("test005");
redisUtilNew.expireValue("test005","12",outtime.intValue());
System.out.println(outtime);
}
}
......@@ -14,7 +14,7 @@
<task:scheduled-tasks>
<!--//定时同步短链数据(每5分钟执行一次)-->
<task:scheduled ref="tkioAccountTask" method="task" cron="0 32 19 * * ?"/>
<task:scheduled ref="tkioAccountTask" method="task" cron="0 26 10 * * ?"/>
</task:scheduled-tasks>
<bean id="SyncAppDataTask" class="tkio.task.SyncAppDataTask"></bean>
......
......@@ -22,8 +22,25 @@
<context:component-scan base-package="track" />
<context:component-scan base-package="common" />
<context:component-scan base-package="dmp" />
<context:component-scan base-package="security" />
<context:property-placeholder location="classpath:persistence.properties"/>
<context:property-placeholder location="classpath:redis.properties" />
<!--Redis配置-->
<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxIdle" value="300" />
<property name="maxTotal" value="600" />
<property name="maxWaitMillis" value="1000"></property>
<property name="testOnBorrow" value="true" />
</bean>
<bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:hostName="${redis.surl.host}" p:port="${redis.surl.port}" p:poolConfig-ref="poolConfig"/>
<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
<property name="connectionFactory" ref="connectionFactory" />
</bean>
<!--//Redis配置 -->
<bean id="parentDataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
<property name="driverClassName" value="${dataSource.driverClassName}"/>
......
# Redis common settings
redis.key.validtime=${redis.key.validtime}
redis.ip.requesttimes=${redis.ip.requesttimes}
redis.ip.unknown.requesttimes=${redis.ip.unknown.requesttimes}
redis.maxIdle=300
redis.testOnBorrow=true
# token
redis.surl.host=${redis.surl.host}
redis.surl.port=${redis.surl.port}
# event
redis.event.host=${redis.event.host}
redis.event.port=${redis.event.port}
redis.event.database=${redis.event.database}
......@@ -51,6 +51,15 @@
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<!-- <filter>
<filter-name>cors</filter-name>
<filter-class>security.cors.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>cors</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>-->
<welcome-file-list>
<welcome-file>/home.html</welcome-file>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment