Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sobot_android
Sobot_module_Dev
Commits
057b0bfd
Commit
057b0bfd
authored
Sep 06, 2023
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common 1.4.0 登录信息使用单例
parent
c07bc985
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
316 additions
and
90 deletions
+316
-90
MainActivity.java
app/src/main/java/com/sobot/moduletest/MainActivity.java
+39
-17
MyApp.java
app/src/main/java/com/sobot/moduletest/MyApp.java
+1
-1
build.gradle
sobot_common/build.gradle
+2
-2
sobot-common-publish-mavencentral.gradle
sobot_common/sobot-common-publish-mavencentral.gradle
+1
-1
SobotLoginTools.java
...src/main/java/com/sobot/common/login/SobotLoginTools.java
+191
-24
LoginUserInfoUtils.java
...in/java/com/sobot/common/login/db/LoginUserInfoUtils.java
+0
-30
LoginUserManager.java
...main/java/com/sobot/common/login/db/LoginUserManager.java
+10
-1
ServiceInfoManager.java
...in/java/com/sobot/common/login/db/ServiceInfoManager.java
+10
-2
SobotCommonDBHelper.java
...n/java/com/sobot/common/login/db/SobotCommonDBHelper.java
+13
-2
LoginUserEntity.java
...in/java/com/sobot/common/login/model/LoginUserEntity.java
+23
-0
SobotPermissionManager.java
...sobot/common/login/permission/SobotPermissionManager.java
+7
-8
build.gradle
sobot_pictureframe/build.gradle
+2
-2
build.gradle
sobot_utils/build.gradle
+17
-0
No files found.
app/src/main/java/com/sobot/moduletest/MainActivity.java
View file @
057b0bfd
...
@@ -9,8 +9,6 @@ import android.net.Uri;
...
@@ -9,8 +9,6 @@ import android.net.Uri;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
com.sobot.common.utils.SobotImageUtils
;
import
com.sobot.common.utils.SobotImageUtils
;
import
com.sobot.network.apiUtils.SobotHttpUtils
;
import
com.sobot.network.http.HttpBaseUtils
;
import
com.sobot.pictureframe.SobotBitmapUtil
;
import
com.sobot.pictureframe.SobotBitmapUtil
;
import
com.sobot.utils.SobotLogUtils
;
import
com.sobot.utils.SobotLogUtils
;
import
com.sobot.utils.SobotSDCardUtils
;
import
com.sobot.utils.SobotSDCardUtils
;
...
@@ -133,21 +131,21 @@ public class MainActivity extends SobotBaseActivity {
...
@@ -133,21 +131,21 @@ public class MainActivity extends SobotBaseActivity {
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"version"
,
"2.9.7"
);
headers
.
put
(
"version"
,
"2.9.7"
);
headers
.
put
(
"from"
,
"2"
);
headers
.
put
(
"from"
,
"2"
);
SobotHttpUtils
.
doPost
(
MainActivity
.
this
,
"https://api.sobot.com/chat-sdk/sdk/user/v2/robotGuide.action"
,
5000
,
map
,
headers
,
new
HttpBaseUtils
.
StringCallBack
()
{
//
SobotHttpUtils.doPost(MainActivity.this, "https://api.sobot.com/chat-sdk/sdk/user/v2/robotGuide.action", 5000,map, headers, new HttpBaseUtils.StringCallBack() {
@Override
//
@Override
public
void
onResponse
(
String
result
)
{
//
public void onResponse(String result) {
}
//
}
//
@Override
//
@Override
public
void
onError
(
Exception
e
,
String
msg
,
int
responseCode
)
{
//
public void onError(Exception e, String msg, int responseCode) {
//
}
//
}
//
@Override
//
@Override
public
void
inProgress
(
int
progress
)
{
//
public void inProgress(int progress) {
//
}
//
}
});
//
});
String
languageFileName
=
"sobot_android_strings_en.json"
;
String
languageFileName
=
"sobot_android_strings_en.json"
;
String
languagePath
=
SobotSDCardUtils
.
getPrivatePath
(
MainActivity
.
this
)
+
File
.
separator
+
"sobot_language"
+
File
.
separator
+
languageFileName
;
String
languagePath
=
SobotSDCardUtils
.
getPrivatePath
(
MainActivity
.
this
)
+
File
.
separator
+
"sobot_language"
+
File
.
separator
+
languageFileName
;
File
file
=
new
File
(
languagePath
);
File
file
=
new
File
(
languagePath
);
...
@@ -198,6 +196,30 @@ public class MainActivity extends SobotBaseActivity {
...
@@ -198,6 +196,30 @@ public class MainActivity extends SobotBaseActivity {
// });
// });
// }
// }
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
map1
.
put
(
"email"
,
"zhengnawei@sobot.com"
);
map1
.
put
(
"passwd"
,
"znw123456"
);
map1
.
put
(
"loginStatus"
,
"1"
);
map1
.
put
(
"from"
,
2
+
""
);
map1
.
put
(
"way"
,
"10"
);
map1
.
put
(
"ack"
,
"1"
);
Map
<
String
,
String
>
headers1
=
new
HashMap
<>();
headers1
.
put
(
"language"
,
"zh"
);
// SobotLoginTools.getInstance().doAppLogin(MainActivity.this, MainActivity.this, "https://api-c.soboten.com/text", 8000, map1, headers1, new SobotResultBlock() {
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// SobotLoginTools.getInstance().checkExpiresToken();
// SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken()+"");
// SobotLogUtils.i(SobotLoginTools.getInstance().getTempId());
// SobotLogUtils.i(SobotLoginTools.getInstance().getToken()+"");
// }
// });
// LoginUserEntity sa=new LoginUserEntity();
// sa.setLogin_time(System.currentTimeMillis());
// SobotLoginTools.getInstance().setLoginUser(sa);
// SobotServiceInfoModel ccc=new SobotServiceInfoModel();
// SobotLoginTools.getInstance().setServiceInfo(ccc);
}
}
@Override
@Override
...
...
app/src/main/java/com/sobot/moduletest/MyApp.java
View file @
057b0bfd
...
@@ -19,7 +19,7 @@ public class MyApp extends MultiDexApplication {
...
@@ -19,7 +19,7 @@ public class MyApp extends MultiDexApplication {
// Fresco.initialize(this);
// Fresco.initialize(this);
// 主要是添加下面这句代码
// 主要是添加下面这句代码
// MultiDex.install(this);
// MultiDex.install(this);
SobotCommonApi
.
init
(
this
,
"https://sobot.com"
);
SobotCommonApi
.
init
(
this
,
"https://
api-c.
sobot.com"
);
SobotCommonApi
.
setShowLogDebug
(
true
);
SobotCommonApi
.
setShowLogDebug
(
true
);
SobotWidgetApi
.
setSwitchMarkStatus
(
SobotMarkConfig
.
LANDSCAPE_SCREEN
,
false
);
SobotWidgetApi
.
setSwitchMarkStatus
(
SobotMarkConfig
.
LANDSCAPE_SCREEN
,
false
);
SobotWidgetApi
.
setSwitchMarkStatus
(
SobotMarkConfig
.
DISPLAY_INNOTCH
,
false
);
SobotWidgetApi
.
setSwitchMarkStatus
(
SobotMarkConfig
.
DISPLAY_INNOTCH
,
false
);
...
...
sobot_common/build.gradle
View file @
057b0bfd
...
@@ -11,7 +11,7 @@ android {
...
@@ -11,7 +11,7 @@ android {
//这里就是打jar包
//这里就是打jar包
task
makeJar
(
type:
Copy
)
{
task
makeJar
(
type:
Copy
)
{
//删除旧的jar包
//删除旧的jar包
delete
'build/libs/sobot_common_1.
3.4
.jar'
delete
'build/libs/sobot_common_1.
4.0
.jar'
//原地址
//原地址
from
(
'build/intermediates/packaged-classes/release/'
)
from
(
'build/intermediates/packaged-classes/release/'
)
//导出jar包的地址
//导出jar包的地址
...
@@ -19,7 +19,7 @@ android {
...
@@ -19,7 +19,7 @@ android {
//包含的jar包
//包含的jar包
include
(
'classes.jar'
)
include
(
'classes.jar'
)
//重命名jar包为mysdk
//重命名jar包为mysdk
rename
(
'classes.jar'
,
'sobot_common_1.
3.4
.jar'
)
rename
(
'classes.jar'
,
'sobot_common_1.
4.0
.jar'
)
}
}
makeJar
.
dependsOn
(
build
)
makeJar
.
dependsOn
(
build
)
}
}
...
...
sobot_common/sobot-common-publish-mavencentral.gradle
View file @
057b0bfd
...
@@ -13,7 +13,7 @@ ext {
...
@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'sobotcommon'
//项目名
PUBLISH_ARTIFACT_ID
=
'sobotcommon'
//项目名
// PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名
// PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名
PUBLISH_VERSION
=
'1.3.9'
//版本号
PUBLISH_VERSION
=
'1.3.9
.5
'
//版本号
}
}
...
...
sobot_common/src/main/java/com/sobot/common/login/SobotLoginTools.java
View file @
057b0bfd
...
@@ -6,7 +6,7 @@ import android.text.TextUtils;
...
@@ -6,7 +6,7 @@ import android.text.TextUtils;
import
com.sobot.common.login.callback.SobotResultBlock
;
import
com.sobot.common.login.callback.SobotResultBlock
;
import
com.sobot.common.login.callback.SobotResultCode
;
import
com.sobot.common.login.callback.SobotResultCode
;
import
com.sobot.common.login.db.HostManager
;
import
com.sobot.common.login.db.HostManager
;
import
com.sobot.common.login.db.LoginUser
InfoUtils
;
import
com.sobot.common.login.db.LoginUser
Manager
;
import
com.sobot.common.login.db.ServiceInfoManager
;
import
com.sobot.common.login.db.ServiceInfoManager
;
import
com.sobot.common.login.model.HostModel
;
import
com.sobot.common.login.model.HostModel
;
import
com.sobot.common.login.model.LoginUserEntity
;
import
com.sobot.common.login.model.LoginUserEntity
;
...
@@ -16,6 +16,7 @@ import com.sobot.gson.SobotGsonUtil;
...
@@ -16,6 +16,7 @@ import com.sobot.gson.SobotGsonUtil;
import
com.sobot.network.apiUtils.SobotBaseCode
;
import
com.sobot.network.apiUtils.SobotBaseCode
;
import
com.sobot.network.apiUtils.SobotHttpUtils
;
import
com.sobot.network.apiUtils.SobotHttpUtils
;
import
com.sobot.network.http.HttpBaseUtils
;
import
com.sobot.network.http.HttpBaseUtils
;
import
com.sobot.utils.SobotLogUtils
;
import
com.sobot.utils.SobotSharedPreferencesUtil
;
import
com.sobot.utils.SobotSharedPreferencesUtil
;
import
com.sobot.utils.SobotStringUtils
;
import
com.sobot.utils.SobotStringUtils
;
...
@@ -31,40 +32,169 @@ import java.util.Map;
...
@@ -31,40 +32,169 @@ import java.util.Map;
*/
*/
public
class
SobotLoginTools
{
public
class
SobotLoginTools
{
/**
* 获取登录信息
//内部类单例
*/
private
SobotLoginTools
()
{
public
static
LoginUserEntity
getLoginInfo
()
{
return
LoginUserInfoUtils
.
getUser
();
}
}
/**
public
static
SobotLoginTools
getInstance
()
{
* 获取坐席信息
return
SobotLoginTools
.
SobotLoginToolsHolder
.
instance
;
*/
}
public
static
SobotServiceInfoModel
getServiceInfoModel
()
{
return
ServiceInfoManager
.
getInstance
().
getInfo
();
private
static
class
SobotLoginToolsHolder
{
private
static
final
SobotLoginTools
instance
=
new
SobotLoginTools
();
}
private
LoginUserEntity
user
;
public
LoginUserEntity
getLoginUser
()
{
if
(
user
==
null
||
user
.
getAid
()
==
null
)
{
user
=
LoginUserManager
.
getInstance
().
getCurUser
();
}
return
user
;
}
public
void
setLoginUser
(
LoginUserEntity
newUser
)
{
LoginUserManager
.
getInstance
().
deleteAll
();
user
=
newUser
;
if
(
user
!=
null
)
{
user
.
setLogin_time
(
System
.
currentTimeMillis
());
LoginUserManager
.
getInstance
().
insert
(
user
);
}
else
{
HostManager
.
getInstance
().
deleteAll
();
ServiceInfoManager
.
getInstance
().
deleteAll
();
}
}
private
SobotServiceInfoModel
mServiceInfoModel
;
public
SobotServiceInfoModel
getServiceInfo
()
{
if
(
mServiceInfoModel
==
null
)
{
mServiceInfoModel
=
ServiceInfoManager
.
getInstance
().
getInfo
();
}
return
mServiceInfoModel
;
}
public
void
setServiceInfo
(
SobotServiceInfoModel
newServiceInfo
)
{
ServiceInfoManager
.
getInstance
().
deleteAll
();
mServiceInfoModel
=
newServiceInfo
;
if
(
mServiceInfoModel
!=
null
)
{
ServiceInfoManager
.
getInstance
().
insert
(
mServiceInfoModel
);
}
else
{
ServiceInfoManager
.
getInstance
().
deleteAll
();
}
}
//呼叫 v6 获取 accessToken
public
String
getAccessToken
()
{
if
(
getLoginUser
()
!=
null
)
{
return
SobotStringUtils
.
checkStringIsNull
(
getLoginUser
().
getAccess_token
());
}
return
""
;
}
//呼叫 v6 获取 accessToken
public
String
getTempId
()
{
if
(
getLoginUser
()
!=
null
)
{
return
SobotStringUtils
.
checkStringIsNull
(
getLoginUser
().
getTempId
());
}
return
""
;
}
//呼叫 v6 获取 accessToken
public
String
getToken
()
{
if
(
getLoginUser
()
!=
null
)
{
return
SobotStringUtils
.
checkStringIsNull
(
getLoginUser
().
getToken
());
}
return
""
;
}
}
// 检查token是否过期 12个小时 返回true 有效; false 过期
public
boolean
checkExpiresToken
()
{
if
(
getLoginUser
()
!=
null
)
{
long
difference
=
System
.
currentTimeMillis
()
-
getLoginUser
().
getLogin_time
();
SobotLogUtils
.
d
(
"检查token是否过期:上次登录距离当前的时间"
+
difference
);
if
(
getLoginUser
().
getLogin_time
()
>
0
&&
(
difference
>
12
*
60
*
60
*
1000
))
{
return
false
;
}
}
return
true
;
}
public
boolean
isLogin
()
{
if
(
getLoginUser
()
!=
null
&&
!
SobotStringUtils
.
isEmpty
(
getLoginUser
().
getToken
())
&&
checkExpiresToken
())
{
return
true
;
}
else
{
return
false
;
}
}
/**
/**
* 获取域名信息
* 获取域名信息
*/
*/
public
static
HostModel
getHostModel
()
{
public
HostModel
getHostModel
()
{
return
HostManager
.
getInstance
().
getHost
();
return
HostManager
.
getInstance
().
getHost
();
}
}
// 执行APP登录接口
// 执行APP登录接口
public
static
void
doAppLogin
(
final
Object
cancelTag
,
final
Context
mContext
,
final
String
host
,
long
timeout
,
Map
<
String
,
Object
>
params
,
Map
<
String
,
String
>
headers
,
final
SobotResultBlock
resultBlock
)
{
public
void
doAppLogin
(
final
Object
cancelTag
,
final
Context
mContext
,
final
String
host
,
long
timeout
,
Map
<
String
,
Object
>
params
,
Map
<
String
,
String
>
headers
,
final
SobotResultBlock
resultBlock
)
{
SobotHttpUtils
.
doPost
(
cancelTag
,
host
+
"/chat-sdk/sdk/admin/v1/login.action"
,
timeout
,
params
,
headers
,
new
HttpBaseUtils
.
StringCallBack
()
{
SobotHttpUtils
.
doPost
(
cancelTag
,
host
+
"/chat-sdk/sdk/admin/v1/login.action"
,
timeout
,
params
,
headers
,
new
HttpBaseUtils
.
StringCallBack
()
{
@Override
@Override
public
void
onResponse
(
String
result
)
{
public
void
onResponse
(
String
result
)
{
if
(!
TextUtils
.
isEmpty
(
result
))
{
if
(!
TextUtils
.
isEmpty
(
result
))
{
SobotBaseCode
<
LoginUserEntity
>
baseModel
=
SobotGsonUtil
.
jsonToBeans
(
result
,
new
com
.
sobot
.
gson
.
reflect
.
TypeToken
<
SobotBaseCode
<
LoginUserEntity
>>()
{
final
SobotBaseCode
<
LoginUserEntity
>
baseModel
=
SobotGsonUtil
.
jsonToBeans
(
result
,
new
com
.
sobot
.
gson
.
reflect
.
TypeToken
<
SobotBaseCode
<
LoginUserEntity
>>()
{
}.
getType
());
}.
getType
());
if
(
baseModel
!=
null
)
{
if
(
baseModel
!=
null
)
{
//登录接口和获取坐席信息权限接口都成功才算真正登录成功
//登录接口和获取坐席信息权限接口都成功才算真正登录成功
if
(
"1"
.
equals
(
baseModel
.
getCode
())
&&
baseModel
.
getData
()
!=
null
)
{
if
(
"1"
.
equals
(
baseModel
.
getCode
())
&&
baseModel
.
getData
()
!=
null
)
{
LoginUserInfoUtils
.
setUser
(
baseModel
.
getData
());
final
LoginUserEntity
userEntity
=
baseModel
.
getData
();
getLoginUserInfo
(
cancelTag
,
mContext
,
baseModel
.
getData
(),
host
,
baseModel
.
getData
().
getToken
(),
baseModel
.
getData
().
getLanguage
(),
resultBlock
);
getLoginUserInfo
(
cancelTag
,
mContext
,
baseModel
.
getData
(),
host
,
baseModel
.
getData
().
getToken
(),
baseModel
.
getData
().
getLanguage
(),
new
SobotResultBlock
()
{
@Override
public
void
resultBolok
(
SobotResultCode
code
,
String
msg
,
Object
obj
)
{
if
(
code
==
SobotResultCode
.
CODE_SUCCEEDED
)
{
SobotServiceInfoModel
serviceInfoModel
=
(
SobotServiceInfoModel
)
obj
;
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
.
getCallV6Flag
()
==
1
)
{
if
(
userEntity
!=
null
&&
!
SobotStringUtils
.
isEmpty
(
userEntity
.
getToken
()))
{
//如果是v6呼叫
String
tempHost
=
host
;
if
(
tempHost
.
contains
(
"/text"
))
{
tempHost
=
tempHost
.
replace
(
"/text"
,
""
);
}
doAccessToken
(
cancelTag
,
tempHost
,
userEntity
.
getToken
(),
new
SobotResultBlock
()
{
@Override
public
void
resultBolok
(
SobotResultCode
code
,
String
msg
,
Object
obj
)
{
if
(
code
==
SobotResultCode
.
CODE_SUCCEEDED
)
{
LoginUserEntity
tempUserEntity
=
userEntity
;
String
accessToken
=
(
String
)
obj
;
tempUserEntity
.
setLogin_time
(
System
.
currentTimeMillis
());
tempUserEntity
.
setAccess_token
(
accessToken
);
tempUserEntity
.
setLogin_time
(
System
.
currentTimeMillis
());
setLoginUser
(
tempUserEntity
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"登录成功"
,
tempUserEntity
);
}
else
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"登录失败"
,
null
);
}
}
});
}
else
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"登录失败"
,
null
);
}
}
else
{
userEntity
.
setLogin_time
(
System
.
currentTimeMillis
());
setLoginUser
(
userEntity
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"登录成功"
,
userEntity
);
}
}
else
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"登录失败"
,
null
);
}
}
}
});
}
else
{
}
else
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
baseModel
.
getMsg
(),
baseModel
.
getCode
());
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
baseModel
.
getMsg
(),
baseModel
.
getCode
());
}
}
...
@@ -95,7 +225,7 @@ public class SobotLoginTools {
...
@@ -95,7 +225,7 @@ public class SobotLoginTools {
* @param token
* @param token
* @param resultBlock 返回坐席信息
* @param resultBlock 返回坐席信息
*/
*/
public
static
void
getLoginUserInfo
(
Object
cancelTag
,
Context
mContext
,
String
host
,
String
token
,
String
language
,
SobotResultBlock
resultBlock
)
{
public
void
getLoginUserInfo
(
Object
cancelTag
,
Context
mContext
,
String
host
,
String
token
,
String
language
,
SobotResultBlock
resultBlock
)
{
getLoginUserInfo
(
cancelTag
,
mContext
,
null
,
host
,
token
,
language
,
resultBlock
);
getLoginUserInfo
(
cancelTag
,
mContext
,
null
,
host
,
token
,
language
,
resultBlock
);
}
}
...
@@ -109,7 +239,7 @@ public class SobotLoginTools {
...
@@ -109,7 +239,7 @@ public class SobotLoginTools {
* @param token
* @param token
* @param resultBlock
* @param resultBlock
*/
*/
public
static
void
getLoginUserInfo
(
Object
cancelTag
,
final
Context
mContext
,
final
LoginUserEntity
loginUser
,
String
host
,
String
token
,
String
language
,
final
SobotResultBlock
resultBlock
)
{
public
void
getLoginUserInfo
(
final
Object
cancelTag
,
final
Context
mContext
,
final
LoginUserEntity
loginUser
,
final
String
host
,
String
token
,
String
language
,
final
SobotResultBlock
resultBlock
)
{
final
String
url
=
host
+
"/basic-config-service/consoleAuth/queryAppAgentMenus"
;
final
String
url
=
host
+
"/basic-config-service/consoleAuth/queryAppAgentMenus"
;
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
if
(!
TextUtils
.
isEmpty
(
token
))
{
if
(!
TextUtils
.
isEmpty
(
token
))
{
...
@@ -131,6 +261,7 @@ public class SobotLoginTools {
...
@@ -131,6 +261,7 @@ public class SobotLoginTools {
List
<
ServiceFunctionVoModel
>
functions
=
new
ArrayList
<>();
List
<
ServiceFunctionVoModel
>
functions
=
new
ArrayList
<>();
JSONArray
items
=
resonseObj
.
optJSONArray
(
"items"
);
JSONArray
items
=
resonseObj
.
optJSONArray
(
"items"
);
getListByObj
(
functions
,
items
);
getListByObj
(
functions
,
items
);
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
.
getGlobalPermissions
()
!=
null
)
{
if
(
serviceInfoModel
.
getGlobalPermissions
()
!=
null
)
{
//全局权限
//全局权限
for
(
int
i
=
0
;
i
<
serviceInfoModel
.
getGlobalPermissions
().
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
serviceInfoModel
.
getGlobalPermissions
().
size
();
i
++)
{
...
@@ -144,12 +275,9 @@ public class SobotLoginTools {
...
@@ -144,12 +275,9 @@ public class SobotLoginTools {
}
}
serviceInfoModel
.
setFunctionStr
(
functions
);
serviceInfoModel
.
setFunctionStr
(
functions
);
//保存在数据库
//保存在数据库
ServiceInfoManager
.
getInstance
().
sav
eInfo
(
serviceInfoModel
);
setServic
eInfo
(
serviceInfoModel
);
SobotSharedPreferencesUtil
.
getInstance
(
mContext
).
put
(
SobotLoginConstant
.
SOBOT_LOGIN_USER_INFO
,
serviceInfoModel
);
SobotSharedPreferencesUtil
.
getInstance
(
mContext
).
put
(
SobotLoginConstant
.
SOBOT_LOGIN_USER_INFO
,
serviceInfoModel
);
if
(
loginUser
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"获取成功"
,
serviceInfoModel
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"登录成功"
,
loginUser
);
}
else
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"登录成功"
,
serviceInfoModel
);
}
}
}
else
{
}
else
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
retMsg
==
null
?
""
:
retMsg
,
null
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
retMsg
==
null
?
""
:
retMsg
,
null
);
...
@@ -173,7 +301,7 @@ public class SobotLoginTools {
...
@@ -173,7 +301,7 @@ public class SobotLoginTools {
}
}
private
static
void
getListByObj
(
List
<
ServiceFunctionVoModel
>
list
,
JSONArray
items
)
{
private
void
getListByObj
(
List
<
ServiceFunctionVoModel
>
list
,
JSONArray
items
)
{
try
{
try
{
if
(
null
!=
items
)
{
if
(
null
!=
items
)
{
for
(
int
i
=
0
;
i
<
items
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
items
.
length
();
i
++)
{
...
@@ -195,4 +323,43 @@ public class SobotLoginTools {
...
@@ -195,4 +323,43 @@ public class SobotLoginTools {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
/**
* 获取accessToken
*/
public
void
doAccessToken
(
Object
cancelTag
,
String
host
,
String
token
,
final
SobotResultBlock
resultBlock
)
{
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
if
(!
TextUtils
.
isEmpty
(
token
))
{
headerMap
.
put
(
"temp-id"
,
token
);
}
SobotHttpUtils
.
doPost
(
cancelTag
,
host
+
"/tokens/getToken"
,
null
,
headerMap
,
new
HttpBaseUtils
.
StringCallBack
()
{
@Override
public
void
onResponse
(
String
result
)
{
if
(!
TextUtils
.
isEmpty
(
result
))
{
Map
map
=
SobotGsonUtil
.
jsonToMaps
((
String
)
result
);
if
(
map
!=
null
&&
map
.
containsKey
(
"accessToken"
))
{
String
accessToken
=
(
String
)
map
.
get
(
"accessToken"
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
""
,
accessToken
);
}
else
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
""
,
null
);
}
}
else
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
""
,
null
);
}
}
@Override
public
void
onError
(
Exception
e
,
String
msg
,
int
responseCode
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
msg
,
null
);
}
@Override
public
void
inProgress
(
int
progress
)
{
}
});
}
}
}
sobot_common/src/main/java/com/sobot/common/login/db/LoginUserInfoUtils.java
deleted
100644 → 0
View file @
c07bc985
package
com
.
sobot
.
common
.
login
.
db
;
import
com.sobot.common.login.model.LoginUserEntity
;
/**
* 获取当前登录用户信息
*/
public
class
LoginUserInfoUtils
{
private
static
LoginUserEntity
user
;
public
synchronized
static
LoginUserEntity
getUser
()
{
if
(
user
==
null
||
user
.
getAid
()
==
null
)
{
user
=
LoginUserManager
.
getInstance
().
getCurUser
();
}
return
user
;
}
public
static
void
setUser
(
LoginUserEntity
newUser
)
{
LoginUserManager
.
getInstance
().
deleteAll
();
user
=
newUser
;
if
(
user
!=
null
)
{
LoginUserManager
.
getInstance
().
insert
(
user
);
}
else
{
HostManager
.
getInstance
().
deleteAll
();
ServiceInfoManager
.
getInstance
().
deleteAll
();
}
}
}
sobot_common/src/main/java/com/sobot/common/login/db/LoginUserManager.java
View file @
057b0bfd
...
@@ -7,6 +7,7 @@ import android.database.Cursor;
...
@@ -7,6 +7,7 @@ import android.database.Cursor;
import
com.sobot.common.login.model.LoginUserEntity
;
import
com.sobot.common.login.model.LoginUserEntity
;
import
com.sobot.common.utils.SobotGlobalContext
;
import
com.sobot.common.utils.SobotGlobalContext
;
import
com.sobot.gson.SobotGsonUtil
;
import
com.sobot.gson.SobotGsonUtil
;
import
com.sobot.utils.SobotStringUtils
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -55,8 +56,10 @@ public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
...
@@ -55,8 +56,10 @@ public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
model
.
setMaxServiceCount
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"maxServiceCount"
)));
model
.
setMaxServiceCount
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"maxServiceCount"
)));
model
.
setBlackFunction
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"blackFunction"
)));
model
.
setBlackFunction
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"blackFunction"
)));
String
transferFunction
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
"transferFunction"
));
String
transferFunction
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
"transferFunction"
));
if
(!
SobotStringUtils
.
isEmpty
(
transferFunction
)){
Map
<
String
,
Boolean
>
map
=
SobotGsonUtil
.
jsonToMaps
(
transferFunction
);
Map
<
String
,
Boolean
>
map
=
SobotGsonUtil
.
jsonToMaps
(
transferFunction
);
model
.
setTicketFunction
(
map
);
model
.
setTicketFunction
(
map
);
}
model
.
setFace
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"face"
)));
model
.
setFace
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"face"
)));
model
.
setCompanyName
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"companyName"
)));
model
.
setCompanyName
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"companyName"
)));
model
.
setAppKey
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"appKey"
)));
model
.
setAppKey
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"appKey"
)));
...
@@ -80,6 +83,8 @@ public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
...
@@ -80,6 +83,8 @@ public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
model
.
setKbVersion
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"kbVersion"
))
+
""
);
model
.
setKbVersion
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"kbVersion"
))
+
""
);
model
.
setCompanyId
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"companyId"
)));
model
.
setCompanyId
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"companyId"
)));
model
.
setLanguage
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"local_language"
)));
model
.
setLanguage
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"local_language"
)));
model
.
setAccess_token
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
LoginUserEntity
.
ACCESS_TOKEN
)));
model
.
setLogin_time
(
cursor
.
getLong
(
cursor
.
getColumnIndex
(
LoginUserEntity
.
LOGIN_TIME
)));
return
model
;
return
model
;
}
}
...
@@ -93,7 +98,9 @@ public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
...
@@ -93,7 +98,9 @@ public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
contentValues
.
put
(
"maxServiceCount"
,
userAccount
.
getMaxServiceCount
());
contentValues
.
put
(
"maxServiceCount"
,
userAccount
.
getMaxServiceCount
());
contentValues
.
put
(
"blackFunction"
,
userAccount
.
getBlackFunction
());
contentValues
.
put
(
"blackFunction"
,
userAccount
.
getBlackFunction
());
contentValues
.
put
(
"transferFunction"
,
userAccount
.
getTransferFunction
());
contentValues
.
put
(
"transferFunction"
,
userAccount
.
getTransferFunction
());
if
(
userAccount
.
getTicketFunction
()
!=
null
)
{
contentValues
.
put
(
"ticketFunction"
,
SobotGsonUtil
.
beanToJson
(
userAccount
.
getTicketFunction
()));
contentValues
.
put
(
"ticketFunction"
,
SobotGsonUtil
.
beanToJson
(
userAccount
.
getTicketFunction
()));
}
contentValues
.
put
(
"face"
,
userAccount
.
getFace
());
contentValues
.
put
(
"face"
,
userAccount
.
getFace
());
contentValues
.
put
(
"companyName"
,
userAccount
.
getCompanyName
());
contentValues
.
put
(
"companyName"
,
userAccount
.
getCompanyName
());
contentValues
.
put
(
"appKey"
,
userAccount
.
getAppKey
());
contentValues
.
put
(
"appKey"
,
userAccount
.
getAppKey
());
...
@@ -115,12 +122,14 @@ public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
...
@@ -115,12 +122,14 @@ public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
contentValues
.
put
(
"callV1Flag"
,
userAccount
.
getCallV1Flag
());
contentValues
.
put
(
"callV1Flag"
,
userAccount
.
getCallV1Flag
());
contentValues
.
put
(
"transferAuditFlag"
,
userAccount
.
getTransferAuditFlag
());
contentValues
.
put
(
"transferAuditFlag"
,
userAccount
.
getTransferAuditFlag
());
int
kbVersion
=
1
;
int
kbVersion
=
1
;
if
(
"6"
.
contains
(
userAccount
.
getKbVersion
(
)))
{
if
(
"6"
.
contains
(
SobotStringUtils
.
checkStringIsNull
(
userAccount
.
getKbVersion
()
)))
{
kbVersion
=
6
;
kbVersion
=
6
;
}
}
contentValues
.
put
(
"kbVersion"
,
kbVersion
);
contentValues
.
put
(
"kbVersion"
,
kbVersion
);
contentValues
.
put
(
"companyId"
,
userAccount
.
getCompanyId
());
contentValues
.
put
(
"companyId"
,
userAccount
.
getCompanyId
());
contentValues
.
put
(
"local_language"
,
userAccount
.
getLanguage
());
contentValues
.
put
(
"local_language"
,
userAccount
.
getLanguage
());
contentValues
.
put
(
LoginUserEntity
.
ACCESS_TOKEN
,
userAccount
.
getAccess_token
());
contentValues
.
put
(
LoginUserEntity
.
LOGIN_TIME
,
userAccount
.
getLogin_time
());
return
contentValues
;
return
contentValues
;
}
}
...
...
sobot_common/src/main/java/com/sobot/common/login/db/ServiceInfoManager.java
View file @
057b0bfd
...
@@ -9,6 +9,7 @@ import com.sobot.common.login.model.SobotServiceInfoModel;
...
@@ -9,6 +9,7 @@ import com.sobot.common.login.model.SobotServiceInfoModel;
import
com.sobot.common.utils.SobotGlobalContext
;
import
com.sobot.common.utils.SobotGlobalContext
;
import
com.sobot.gson.SobotGsonUtil
;
import
com.sobot.gson.SobotGsonUtil
;
import
com.sobot.gson.reflect.TypeToken
;
import
com.sobot.gson.reflect.TypeToken
;
import
com.sobot.utils.SobotStringUtils
;
import
java.util.List
;
import
java.util.List
;
...
@@ -58,18 +59,21 @@ public class ServiceInfoManager extends SobotCommonDao<SobotServiceInfoModel> {
...
@@ -58,18 +59,21 @@ public class ServiceInfoManager extends SobotCommonDao<SobotServiceInfoModel> {
model
.
setNewBossSwitch
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"newBossSwitch"
)));
model
.
setNewBossSwitch
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"newBossSwitch"
)));
model
.
setRegion
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"region"
)));
model
.
setRegion
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"region"
)));
String
functionStr
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
"functionStr"
));
String
functionStr
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
"functionStr"
));
if
(!
SobotStringUtils
.
isEmpty
(
functionStr
))
{
List
<
ServiceFunctionVoModel
>
list
=
SobotGsonUtil
.
jsonToBeans
(
functionStr
,
new
TypeToken
<
List
<
ServiceFunctionVoModel
>>()
{
List
<
ServiceFunctionVoModel
>
list
=
SobotGsonUtil
.
jsonToBeans
(
functionStr
,
new
TypeToken
<
List
<
ServiceFunctionVoModel
>>()
{
}.
getType
());
}.
getType
());
model
.
setFunctionStr
(
list
);
model
.
setFunctionStr
(
list
);
}
model
.
setCompanyId
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"companyId"
)));
model
.
setCompanyId
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"companyId"
)));
model
.
setCallV6Flag
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"callV6Flag"
)));
model
.
setCallV6Flag
(
cursor
.
getInt
(
cursor
.
getColumnIndex
(
"callV6Flag"
)));
model
.
setLanguage
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"language"
)));
model
.
setLanguage
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"language"
)));
model
.
setPhoneNo
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"phoneNo"
)));
model
.
setPhoneNo
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
"phoneNo"
)));
String
globalPermissions
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
"globalPermissions"
));
String
globalPermissions
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
"globalPermissions"
));
if
(!
SobotStringUtils
.
isEmpty
(
globalPermissions
))
{
List
<
String
>
globalPermissionslist
=
SobotGsonUtil
.
jsonToBeans
(
globalPermissions
,
new
TypeToken
<
List
<
String
>>()
{
List
<
String
>
globalPermissionslist
=
SobotGsonUtil
.
jsonToBeans
(
globalPermissions
,
new
TypeToken
<
List
<
String
>>()
{
}.
getType
());
}.
getType
());
model
.
setGlobalPermissions
(
globalPermissionslist
);
model
.
setGlobalPermissions
(
globalPermissionslist
);
}
return
model
;
return
model
;
}
}
...
@@ -83,12 +87,16 @@ public class ServiceInfoManager extends SobotCommonDao<SobotServiceInfoModel> {
...
@@ -83,12 +87,16 @@ public class ServiceInfoManager extends SobotCommonDao<SobotServiceInfoModel> {
contentValues
.
put
(
"serviceLanguage"
,
infoModel
.
getServiceLanguage
());
contentValues
.
put
(
"serviceLanguage"
,
infoModel
.
getServiceLanguage
());
contentValues
.
put
(
"newBossSwitch"
,
infoModel
.
getNewBossSwitch
());
contentValues
.
put
(
"newBossSwitch"
,
infoModel
.
getNewBossSwitch
());
contentValues
.
put
(
"region"
,
infoModel
.
getRegion
());
contentValues
.
put
(
"region"
,
infoModel
.
getRegion
());
if
(!
SobotStringUtils
.
isEmpty
(
infoModel
.
getFunctionStr
()))
{
contentValues
.
put
(
"functionStr"
,
SobotGsonUtil
.
beanToJson
(
infoModel
.
getFunctionStr
()));
contentValues
.
put
(
"functionStr"
,
SobotGsonUtil
.
beanToJson
(
infoModel
.
getFunctionStr
()));
}
contentValues
.
put
(
"companyId"
,
infoModel
.
getCompanyId
());
contentValues
.
put
(
"companyId"
,
infoModel
.
getCompanyId
());
contentValues
.
put
(
"callV6Flag"
,
infoModel
.
getCallV6Flag
());
contentValues
.
put
(
"callV6Flag"
,
infoModel
.
getCallV6Flag
());
contentValues
.
put
(
"language"
,
infoModel
.
getLanguage
());
contentValues
.
put
(
"language"
,
infoModel
.
getLanguage
());
contentValues
.
put
(
"phoneNo"
,
infoModel
.
getPhoneNo
());
contentValues
.
put
(
"phoneNo"
,
infoModel
.
getPhoneNo
());
if
(!
SobotStringUtils
.
isEmpty
(
infoModel
.
getGlobalPermissions
()))
{
contentValues
.
put
(
"globalPermissions"
,
SobotGsonUtil
.
beanToJson
(
infoModel
.
getGlobalPermissions
()));
contentValues
.
put
(
"globalPermissions"
,
SobotGsonUtil
.
beanToJson
(
infoModel
.
getGlobalPermissions
()));
}
return
contentValues
;
return
contentValues
;
}
}
...
...
sobot_common/src/main/java/com/sobot/common/login/db/SobotCommonDBHelper.java
View file @
057b0bfd
...
@@ -4,6 +4,8 @@ import android.content.Context;
...
@@ -4,6 +4,8 @@ import android.content.Context;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteOpenHelper
;
import
android.database.sqlite.SQLiteOpenHelper
;
import
com.sobot.common.login.model.LoginUserEntity
;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.ReentrantLock
;
import
java.util.concurrent.locks.ReentrantLock
;
...
@@ -13,7 +15,8 @@ import java.util.concurrent.locks.ReentrantLock;
...
@@ -13,7 +15,8 @@ import java.util.concurrent.locks.ReentrantLock;
class
SobotCommonDBHelper
extends
SQLiteOpenHelper
{
class
SobotCommonDBHelper
extends
SQLiteOpenHelper
{
private
static
final
String
DB_CACHE_NAME
=
"sobot_common.db"
;
private
static
final
String
DB_CACHE_NAME
=
"sobot_common.db"
;
private
static
final
int
DB_CACHE_VERSION
=
1
;
// private static final int DB_CACHE_VERSION = 1;
private
static
final
int
DB_CACHE_VERSION
=
2
;
static
final
String
TABLE_LOGIN_USER
=
"login_user"
;
static
final
String
TABLE_LOGIN_USER
=
"login_user"
;
static
final
String
TABLE_SOBOT_HOST
=
"sobot_host"
;
static
final
String
TABLE_SOBOT_HOST
=
"sobot_host"
;
static
final
String
TABLE_SERVICE_INFO
=
"sobot_service"
;
static
final
String
TABLE_SERVICE_INFO
=
"sobot_service"
;
...
@@ -69,7 +72,7 @@ class SobotCommonDBHelper extends SQLiteOpenHelper {
...
@@ -69,7 +72,7 @@ class SobotCommonDBHelper extends SQLiteOpenHelper {
"sid varchar(40), "
+
"sid varchar(40), "
+
"pu varchar(40), "
+
"pu varchar(40), "
+
"puid varchar(40), "
+
"puid varchar(40), "
+
"token varchar(
3
00), "
+
"token varchar(
5
00), "
+
"cusRoleName varchar(200), "
+
"cusRoleName varchar(200), "
+
"aid varchar(40), "
+
"aid varchar(40), "
+
"centerNumber varchar(40), "
+
"centerNumber varchar(40), "
+
...
@@ -124,6 +127,14 @@ class SobotCommonDBHelper extends SQLiteOpenHelper {
...
@@ -124,6 +127,14 @@ class SobotCommonDBHelper extends SQLiteOpenHelper {
*/
*/
private
void
upgradeDB
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
)
{
private
void
upgradeDB
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
)
{
switch
(
oldVersion
)
{
switch
(
oldVersion
)
{
case
1
:
String
sql
=
"ALTER TABLE "
+
TABLE_LOGIN_USER
+
" ADD COLUMN "
+
LoginUserEntity
.
ACCESS_TOKEN
+
" VARCHAR(700)"
;
db
.
execSQL
(
sql
);
// 执行修改表,添加字段的逻辑。
String
sql1
=
"ALTER TABLE "
+
TABLE_LOGIN_USER
+
" ADD COLUMN "
+
LoginUserEntity
.
LOGIN_TIME
+
" INTEGER"
;
db
.
execSQL
(
sql1
);
// 执行修改表,添加字段的逻辑。
break
;
default
:
default
:
break
;
break
;
}
}
...
...
sobot_common/src/main/java/com/sobot/common/login/model/LoginUserEntity.java
View file @
057b0bfd
...
@@ -48,6 +48,14 @@ public class LoginUserEntity implements Serializable {
...
@@ -48,6 +48,14 @@ public class LoginUserEntity implements Serializable {
private
String
language
;
//国际化指定语言 3.1.3新增 为空时,默认中文
private
String
language
;
//国际化指定语言 3.1.3新增 为空时,默认中文
private
String
access_token
;
//呼叫v6
public
static
final
String
ACCESS_TOKEN
=
"access_token"
;
//呼叫v6 accessToken
private
long
login_time
;
//登录时间戳
public
static
final
String
LOGIN_TIME
=
"login_time"
;
public
String
getCompanyName
()
{
public
String
getCompanyName
()
{
return
companyName
;
return
companyName
;
}
}
...
@@ -312,4 +320,19 @@ public class LoginUserEntity implements Serializable {
...
@@ -312,4 +320,19 @@ public class LoginUserEntity implements Serializable {
this
.
language
=
language
;
this
.
language
=
language
;
}
}
public
String
getAccess_token
()
{
return
access_token
;
}
public
void
setAccess_token
(
String
access_token
)
{
this
.
access_token
=
access_token
;
}
public
long
getLogin_time
()
{
return
login_time
;
}
public
void
setLogin_time
(
long
login_time
)
{
this
.
login_time
=
login_time
;
}
}
}
sobot_common/src/main/java/com/sobot/common/login/permission/SobotPermissionManager.java
View file @
057b0bfd
...
@@ -2,8 +2,7 @@ package com.sobot.common.login.permission;
...
@@ -2,8 +2,7 @@ package com.sobot.common.login.permission;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
com.sobot.common.login.db.LoginUserInfoUtils
;
import
com.sobot.common.login.SobotLoginTools
;
import
com.sobot.common.login.db.ServiceInfoManager
;
import
com.sobot.common.login.model.LoginUserEntity
;
import
com.sobot.common.login.model.LoginUserEntity
;
import
com.sobot.common.login.model.ServiceFunctionVoModel
;
import
com.sobot.common.login.model.ServiceFunctionVoModel
;
import
com.sobot.common.login.model.SobotServiceInfoModel
;
import
com.sobot.common.login.model.SobotServiceInfoModel
;
...
@@ -27,8 +26,8 @@ public class SobotPermissionManager {
...
@@ -27,8 +26,8 @@ public class SobotPermissionManager {
private
static
SobotPermissionApi
getInstance
()
{
private
static
SobotPermissionApi
getInstance
()
{
if
(
instance
==
null
)
{
if
(
instance
==
null
)
{
if
(
LoginUserInfoUtils
.
get
User
()
!=
null
)
{
if
(
SobotLoginTools
.
getInstance
().
getLogin
User
()
!=
null
)
{
switch
(
LoginUserInfoUtils
.
get
User
().
getCusRoleId
())
{
switch
(
SobotLoginTools
.
getInstance
().
getLogin
User
().
getCusRoleId
())
{
case
ONLINE_CUSTOMER_SERVICE:
//在线客服
case
ONLINE_CUSTOMER_SERVICE:
//在线客服
instance
=
new
PermissionOnLineCustomerService
();
instance
=
new
PermissionOnLineCustomerService
();
break
;
break
;
...
@@ -63,7 +62,7 @@ public class SobotPermissionManager {
...
@@ -63,7 +62,7 @@ public class SobotPermissionManager {
}
}
public
static
boolean
checkPermission
(
int
type
)
{
public
static
boolean
checkPermission
(
int
type
)
{
SobotServiceInfoModel
serviceInfoModel
=
S
erviceInfoManager
.
getInstance
().
get
Info
();
SobotServiceInfoModel
serviceInfoModel
=
S
obotLoginTools
.
getInstance
().
getService
Info
();
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
.
getNewBossSwitch
()
>
0
)
{
if
(
serviceInfoModel
.
getNewBossSwitch
()
>
0
)
{
return
isHasPermission
(
type
+
""
);
return
isHasPermission
(
type
+
""
);
...
@@ -265,7 +264,7 @@ public class SobotPermissionManager {
...
@@ -265,7 +264,7 @@ public class SobotPermissionManager {
}
}
public
static
boolean
isHasPermission
(
String
type
)
{
public
static
boolean
isHasPermission
(
String
type
)
{
SobotServiceInfoModel
serviceInfoModel
=
S
erviceInfoManager
.
getInstance
().
get
Info
();
SobotServiceInfoModel
serviceInfoModel
=
S
obotLoginTools
.
getInstance
().
getService
Info
();
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
.
getNewBossSwitch
()
>
0
)
{
if
(
serviceInfoModel
.
getNewBossSwitch
()
>
0
)
{
if
(!
TextUtils
.
isEmpty
(
type
)
&&
serviceInfoModel
!=
null
&&
serviceInfoModel
.
getFunctionStr
()
!=
null
)
{
if
(!
TextUtils
.
isEmpty
(
type
)
&&
serviceInfoModel
!=
null
&&
serviceInfoModel
.
getFunctionStr
()
!=
null
)
{
...
@@ -277,7 +276,7 @@ public class SobotPermissionManager {
...
@@ -277,7 +276,7 @@ public class SobotPermissionManager {
}
}
}
}
}
else
{
}
else
{
LoginUserEntity
customerServiceInfoModel
=
LoginUserInfoUtils
.
get
User
();
LoginUserEntity
customerServiceInfoModel
=
SobotLoginTools
.
getInstance
().
getLogin
User
();
if
(!
TextUtils
.
isEmpty
(
type
)
&&
customerServiceInfoModel
!=
null
&&
customerServiceInfoModel
.
getTicketFunction
()
!=
null
&&
customerServiceInfoModel
.
getTicketFunction
().
containsKey
(
type
))
{
if
(!
TextUtils
.
isEmpty
(
type
)
&&
customerServiceInfoModel
!=
null
&&
customerServiceInfoModel
.
getTicketFunction
()
!=
null
&&
customerServiceInfoModel
.
getTicketFunction
().
containsKey
(
type
))
{
return
customerServiceInfoModel
.
getTicketFunction
().
get
(
type
);
return
customerServiceInfoModel
.
getTicketFunction
().
get
(
type
);
}
}
...
@@ -287,7 +286,7 @@ public class SobotPermissionManager {
...
@@ -287,7 +286,7 @@ public class SobotPermissionManager {
}
}
public
static
boolean
isHasNewPermission
(
String
type
)
{
public
static
boolean
isHasNewPermission
(
String
type
)
{
SobotServiceInfoModel
serviceInfoModel
=
S
erviceInfoManager
.
getInstance
().
get
Info
();
SobotServiceInfoModel
serviceInfoModel
=
S
obotLoginTools
.
getInstance
().
getService
Info
();
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
.
getNewBossSwitch
()
>
0
)
{
if
(
serviceInfoModel
.
getNewBossSwitch
()
>
0
)
{
if
(!
TextUtils
.
isEmpty
(
type
)
&&
serviceInfoModel
!=
null
&&
serviceInfoModel
.
getFunctionStr
()
!=
null
)
{
if
(!
TextUtils
.
isEmpty
(
type
)
&&
serviceInfoModel
!=
null
&&
serviceInfoModel
.
getFunctionStr
()
!=
null
)
{
...
...
sobot_pictureframe/build.gradle
View file @
057b0bfd
...
@@ -11,7 +11,7 @@ android {
...
@@ -11,7 +11,7 @@ android {
//这里就是打jar包
//这里就是打jar包
task
makeJar
(
type:
Copy
)
{
task
makeJar
(
type:
Copy
)
{
//删除旧的jar包
//删除旧的jar包
delete
'build/libs/
picture_1.1
.jar'
delete
'build/libs/
sobot_picture_1.1.4
.jar'
//原地址
//原地址
from
(
'build/intermediates/packaged-classes/release/'
)
from
(
'build/intermediates/packaged-classes/release/'
)
//导出jar包的地址
//导出jar包的地址
...
@@ -19,7 +19,7 @@ android {
...
@@ -19,7 +19,7 @@ android {
//包含的jar包
//包含的jar包
include
(
'classes.jar'
)
include
(
'classes.jar'
)
//重命名jar包为mysdk
//重命名jar包为mysdk
rename
(
'classes.jar'
,
'
picture_1.1
.jar'
)
rename
(
'classes.jar'
,
'
sobot_picture_1.1.4
.jar'
)
}
}
makeJar
.
dependsOn
(
build
)
makeJar
.
dependsOn
(
build
)
...
...
sobot_utils/build.gradle
View file @
057b0bfd
...
@@ -8,6 +8,23 @@ android {
...
@@ -8,6 +8,23 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
14
minSdkVersion
14
}
}
//这里就是打jar包
task
makeJar
(
type:
Copy
)
{
//删除旧的jar包
delete
'build/libs/sobot_utils_1.1.2.jar'
//原地址
from
(
'build/intermediates/packaged-classes/release/'
)
//导出jar包的地址
into
(
'build/libs/'
)
//包含的jar包
include
(
'classes.jar'
)
//重命名jar包为mysdk
rename
(
'classes.jar'
,
'sobot_utils_1.1.2.jar'
)
}
makeJar
.
dependsOn
(
build
)
lintOptions
{
abortOnError
false
}
}
}
dependencies
{
dependencies
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment