Commit 88c9d5e2 by zhengnw@sobot.com

common 只是gson、net、utils、sobot_pictureframe的集合,所有的ui相关的都放到widget里

parent c4d4b0ac
package com.sobot.moduletest;
import static com.sobot.common.ui.SobotBaseConstant.REQUEST_CODE_PICTURE;
import static com.sobot.widget.ui.SobotBaseConstant.REQUEST_CODE_PICTURE;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.widget.ImageView;
import com.sobot.common.ui.SobotMarkConfig;
import com.sobot.common.ui.base.SobotBaseActivity;
import com.sobot.common.ui.toast.SobotToastUtil;
import com.sobot.common.utils.SobotCommonApi;
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.utils.SobotLogUtils;
import com.sobot.utils.SobotSDCardUtils;
import com.sobot.widget.SobotWidgetApi;
import com.sobot.widget.image.photoview.SobotPhotoView;
import com.sobot.widget.loading.SobotLoadingLayout;
import com.sobot.widget.refresh.layout.api.RefreshLayout;
import com.sobot.widget.refresh.layout.footer.ClassicsFooter;
import com.sobot.widget.refresh.layout.header.ClassicsHeader;
import com.sobot.widget.ui.SobotMarkConfig;
import com.sobot.widget.ui.base.SobotBaseActivity;
import com.sobot.widget.ui.toast.SobotToastUtil;
import java.io.File;
import java.util.HashMap;
......@@ -44,7 +44,7 @@ public class MainActivity extends SobotBaseActivity {
protected void initView() {
SobotToastUtil.showCustomToast(getSobotBaseActivity(), "sdafdsafsadfasdfsdaf");
SobotCommonApi.setSwitchMarkStatus(SobotMarkConfig.SHOW_PERMISSION_TIPS_POP, true);
SobotWidgetApi.setSwitchMarkStatus(SobotMarkConfig.SHOW_PERMISSION_TIPS_POP, true);
setTitle("ddddd");
SobotBitmapUtil.display(getSobotBaseActivity(), "https://img.sobot.com/console/common/face/admin.png", getAvatarImageView(true));
img = findViewById(R.id.img);
......
......@@ -2,8 +2,9 @@ package com.sobot.moduletest;
import android.support.multidex.MultiDexApplication;
import com.sobot.common.ui.SobotMarkConfig;
import com.sobot.common.utils.SobotCommonApi;
import com.sobot.widget.SobotWidgetApi;
import com.sobot.widget.ui.SobotMarkConfig;
/**
* @Description: java类作用描述
......@@ -18,11 +19,10 @@ public class MyApp extends MultiDexApplication {
// Fresco.initialize(this);
// 主要是添加下面这句代码
// MultiDex.install(this);
SobotCommonApi.init(this,"https://sobot.com");
SobotCommonApi.init(this, "https://sobot.com");
SobotCommonApi.setShowLogDebug(true);
SobotCommonApi.setSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN,false);
SobotCommonApi.setSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH,false);
SobotWidgetApi.setSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN, false);
SobotWidgetApi.setSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH, false);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
......@@ -14,8 +14,8 @@ buildscript {
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
......
......@@ -8,12 +8,25 @@ android {
defaultConfig {
minSdkVersion 14
}
//这里就是打jar包
task makeJar(type: Copy) {
//删除旧的jar包
delete 'build/libs/sobot_common_1.2.6.jar'
//原地址
from('build/intermediates/packaged-classes/release/')
//导出jar包的地址
into('build/libs/')
//包含的jar包
include('classes.jar')
//重命名jar包为mysdk
rename ('classes.jar', 'sobot_common_1.2.6.jar')
}
makeJar.dependsOn(build)
}
dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')
compileOnly 'com.squareup.okhttp3:okhttp:3.12.0'
compileOnly 'com.android.support:appcompat-v7:28.0.0'
// api project(':sobot_utils')
// api project(':sobot_pictureframe')
// api project(':sobot_network')
......
......@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'sobotcommon' //项目名
// PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名
PUBLISH_VERSION = '1.2.4' //版本号
PUBLISH_VERSION = '1.2.6' //版本号
}
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sobot.common">
<!-- 访问权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.apps.photos.permission.GOOGLE_PHOTOS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<application>
<provider
android:name=".ui.provider.SobotFileProvider"
android:authorities="${applicationId}.sobot_fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/sobot_provider_paths" />
</provider>
</application>
</manifest>
\ No newline at end of file
package com.sobot.common.login;
public interface SobotLoginConstant {
String SOBOT_LOGIN_USER_INFO = "sobot_login_user_info";//登录客服信息
}
package com.sobot.common.login;
import android.content.Context;
import android.text.TextUtils;
import com.sobot.common.login.callback.SobotResultBlock;
import com.sobot.common.login.callback.SobotResultCode;
import com.sobot.common.login.db.HostManager;
import com.sobot.common.login.db.LoginUserInfoUtils;
import com.sobot.common.login.db.ServiceInfoManager;
import com.sobot.common.login.model.HostModel;
import com.sobot.common.login.model.LoginUserEntity;
import com.sobot.common.login.model.ServiceFunctionVoModel;
import com.sobot.common.login.model.SobotServiceInfoModel;
import com.sobot.gson.SobotGsonUtil;
import com.sobot.network.apiUtils.SobotBaseCode;
import com.sobot.network.apiUtils.SobotHttpUtils;
import com.sobot.network.http.HttpBaseUtils;
import com.sobot.utils.SobotSharedPreferencesUtil;
import org.json.JSONArray;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* app 登录合并类
*/
public class SobotLoginTools {
/**
* 获取登录信息
*/
public static LoginUserEntity getLoginInfo() {
return LoginUserInfoUtils.getUser();
}
/**
* 获取坐席信息
*/
public static SobotServiceInfoModel getServiceInfoModel() {
return ServiceInfoManager.getInstance().getInfo();
}
/**
* 获取域名信息
*/
public static HostModel getHostModel() {
return HostManager.getInstance().getHost();
}
// 执行APP登录接口
public static void doAppLogin(final Object cancelTag, final Context mContext, final String host, Map<String, Object> params, final SobotResultBlock resultBlock) {
SobotHttpUtils.doPost(cancelTag, host + "/chat-sdk/sdk/admin/v1/login.action", params, new HttpBaseUtils.StringCallBack() {
@Override
public void onResponse(String result) {
if (!TextUtils.isEmpty(result)) {
SobotBaseCode<LoginUserEntity> baseModel = SobotGsonUtil.jsonToBeans(result, new com.sobot.gson.reflect.TypeToken<SobotBaseCode<LoginUserEntity>>() {
}.getType());
if (baseModel != null) {
//登录接口和获取坐席信息权限接口都成功才算真正登录成功
if ("1".equals(baseModel.getCode()) && baseModel.getData() != null) {
LoginUserInfoUtils.setUser(baseModel.getData());
getLoginUserInfo(cancelTag, mContext, baseModel.getData(), host, baseModel.getData().getToken(), resultBlock);
} else {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, baseModel.getMsg(), baseModel.getCode());
}
} 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) {
}
});
}
/**
* 调用座席接口
*
* @param cancelTag
* @param mContext
* @param host
* @param token
* @param resultBlock 返回坐席信息
*/
public static void getLoginUserInfo(final Object cancelTag, final Context mContext, String host, final String token, final SobotResultBlock resultBlock) {
getLoginUserInfo(cancelTag, mContext, null, host, token, resultBlock);
}
/**
* 调用座席接口
*
* @param cancelTag
* @param mContext
* @param loginUser 如果不为空 resultBlock返回就是这个;如果为空,返回坐席信息
* @param host
* @param token
* @param resultBlock
*/
public static void getLoginUserInfo(final Object cancelTag, final Context mContext, final LoginUserEntity loginUser, String host, final String token, final SobotResultBlock resultBlock) {
final String url = host + "/basic-config-service/consoleAuth/queryAppAgentMenus";
Map<String, String> headerMap = new HashMap<>();
headerMap.put("temp-id", token);
SobotHttpUtils.doGet(cancelTag, url, null, headerMap, new HttpBaseUtils.StringCallBack() {
@Override
public void onResponse(String result) {
if (!TextUtils.isEmpty(result)) {
try {
org.json.JSONObject resonseObj = new org.json.JSONObject(result);
String retCode = resonseObj.optString("retCode");
String retMsg = resonseObj.optString("retMsg");
if ("000000".equals(retCode)) {
SobotServiceInfoModel serviceInfoModel = SobotGsonUtil.jsonToBean(resonseObj.optString("item"), SobotServiceInfoModel.class);
List<ServiceFunctionVoModel> functions = new ArrayList<>();
JSONArray items = resonseObj.optJSONArray("items");
getListByObj(functions, items);
serviceInfoModel.setFunctionStr(functions);
//保存在数据库
ServiceInfoManager.getInstance().saveInfo(serviceInfoModel);
SobotSharedPreferencesUtil.getInstance(mContext).put(SobotLoginConstant.SOBOT_LOGIN_USER_INFO, serviceInfoModel);
if (loginUser != null) {
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", loginUser);
} else {
resultBlock.resultBolok(SobotResultCode.CODE_SUCCEEDED, "登录成功", serviceInfoModel);
}
} else {
resultBlock.resultBolok(SobotResultCode.CODE_FAILED, retMsg == null ? "" : retMsg, null);
}
} catch (Exception e) {
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) {
}
});
}
private static void getListByObj(List<ServiceFunctionVoModel> list, JSONArray items) {
try {
if (null != items) {
for (int i = 0; i < items.length(); i++) {
org.json.JSONObject o = items.getJSONObject(i);
ServiceFunctionVoModel functionVoModel = SobotGsonUtil.jsonToBean(o.toString(), ServiceFunctionVoModel.class);
if (functionVoModel != null) {
list.add(functionVoModel);
}
boolean hasChildren = o.optBoolean("hasChildren", false);
if (hasChildren) {
if (null != o.optJSONArray("children")) {
JSONArray childrens = o.getJSONArray("children");
getListByObj(list, childrens);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.sobot.common.login.callback;
/**
* 回调接口
*/
public interface SobotResultBlock {
/**
*
* @param code 成功 失败 失败后处理继续处理业务
* @param msg 描述
* @param obj 返回值
*/
void resultBolok(SobotResultCode code, String msg, Object obj);
}
package com.sobot.common.login.callback;
/**
* 回调结果
*/
public enum SobotResultCode {
CODE_FAILED,//失败
CODE_SUCCEEDED;//成功
}
package com.sobot.common.login.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.sobot.common.login.model.HostModel;
import com.sobot.common.utils.SobotGlobalContext;
import java.util.List;
/**
* 域名 操作类
*/
public class HostManager extends SobotCommonDao<HostModel> {
private HostManager(Context context) {
super(new SobotCommonDBHelper(context));
}
//volatile关键字确保多线程下正确处理
private volatile static HostManager mInstance;
public static HostManager getInstance() {
//第一次判空
if (mInstance == null) {
//进入同步区域
synchronized (HostManager.class) {
//第二次判空
if (mInstance == null) {
mInstance = new HostManager(SobotGlobalContext.getAppContext());
}
}
}
return mInstance;
}
@Override
public String getTableName() {
return SobotCommonDBHelper.TABLE_SOBOT_HOST;
}
@Override
public void unInit() {
}
@Override
public HostModel parseCursorToBean(Cursor cursor) {
HostModel model = new HostModel();
model.setDesc(cursor.getString(cursor.getColumnIndex("hostDesc")));
model.setHost(cursor.getString(cursor.getColumnIndex("host")));
model.setJanussipProxy(cursor.getString(cursor.getColumnIndex("janussipProxy")));
model.setJanusSocket(cursor.getString(cursor.getColumnIndex("janusSocket")));
model.setOpenApiHost(cursor.getString(cursor.getColumnIndex("openApiHost")));
model.setStompSocket(cursor.getString(cursor.getColumnIndex("stompSocket")));
return model;
}
@Override
public ContentValues getContentValues(HostModel hostModel) {
ContentValues contentValues = new ContentValues();
contentValues.put("hostDesc", hostModel.getDesc());
contentValues.put("host", hostModel.getHost());
contentValues.put("janussipProxy", hostModel.getJanussipProxy());
contentValues.put("janusSocket", hostModel.getJanusSocket());
contentValues.put("openApiHost", hostModel.getOpenApiHost());
contentValues.put("stompSocket", hostModel.getStompSocket());
return contentValues;
}
public void saveHost(HostModel host) {
insert(host);
}
/**
* 获取最近用户记录 按日期倒序
*/
public HostModel getHost() {
List<HostModel> list = query(null, null, null, null, null, null, null);
return list.size() > 0 ? list.get(0) : null;
}
}
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();
}
}
}
package com.sobot.common.login.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.sobot.common.login.model.LoginUserEntity;
import com.sobot.common.utils.SobotGlobalContext;
import com.sobot.gson.SobotGsonUtil;
import java.util.List;
import java.util.Map;
/**
* 登录用户信息 操作类
*/
public class LoginUserManager extends SobotCommonDao<LoginUserEntity> {
private LoginUserManager(Context context) {
super(new SobotCommonDBHelper(context));
}
//volatile关键字确保多线程下正确处理
private volatile static LoginUserManager mInstance;
public static LoginUserManager getInstance() {
//第一次判空
if (mInstance == null) {
//进入同步区域
synchronized (LoginUserManager.class) {
//第二次判空
if (mInstance == null) {
mInstance = new LoginUserManager(SobotGlobalContext.getAppContext());
}
}
}
return mInstance;
}
@Override
public String getTableName() {
return SobotCommonDBHelper.TABLE_LOGIN_USER;
}
@Override
public void unInit() {
}
@Override
public LoginUserEntity parseCursorToBean(Cursor cursor) {
LoginUserEntity model = new LoginUserEntity();
model.setTempId(cursor.getString(cursor.getColumnIndex("tempId")));
model.setNickName(cursor.getString(cursor.getColumnIndex("nickName")));
model.setStaffName(cursor.getString(cursor.getColumnIndex("staffName")));
model.setMaxServiceCount(cursor.getInt(cursor.getColumnIndex("maxServiceCount")));
model.setBlackFunction(cursor.getInt(cursor.getColumnIndex("blackFunction")));
String transferFunction = cursor.getString(cursor.getColumnIndex("transferFunction"));
Map<String, Boolean> map = SobotGsonUtil.jsonToMaps(transferFunction);
model.setTicketFunction(map);
model.setFace(cursor.getString(cursor.getColumnIndex("face")));
model.setCompanyName(cursor.getString(cursor.getColumnIndex("companyName")));
model.setAppKey(cursor.getString(cursor.getColumnIndex("appKey")));
model.setSid(cursor.getString(cursor.getColumnIndex("sid")));
model.setPu(cursor.getString(cursor.getColumnIndex("pu")));
model.setPuid(cursor.getString(cursor.getColumnIndex("puid")));
model.setToken(cursor.getString(cursor.getColumnIndex("token")));
model.setCusRoleName(cursor.getString(cursor.getColumnIndex("cusRoleName")));
model.setAid(cursor.getString(cursor.getColumnIndex("aid")));
model.setCenterNumber(cursor.getString(cursor.getColumnIndex("centerNumber")));
model.setAccountStatus(cursor.getString(cursor.getColumnIndex("accountStatus")));
model.setImFlag(cursor.getInt(cursor.getColumnIndex("imFlag")));
model.setCusRoleId(cursor.getInt(cursor.getColumnIndex("cusRoleId")));
model.setStatus(cursor.getInt(cursor.getColumnIndex("status")));
model.setTopFlag(cursor.getInt(cursor.getColumnIndex("topFlag")));
model.setSortFlag(cursor.getInt(cursor.getColumnIndex("sortFlag")));
model.setFuseWork(cursor.getInt(cursor.getColumnIndex("fuseWork")));
model.setCallV6Flag(cursor.getInt(cursor.getColumnIndex("callV6Flag")));
model.setCallV1Flag(cursor.getInt(cursor.getColumnIndex("callV1Flag")));
model.setTransferAuditFlag(cursor.getInt(cursor.getColumnIndex("transferAuditFlag")));
model.setKbVersion(cursor.getInt(cursor.getColumnIndex("kbVersion")) + "");
model.setCompanyId(cursor.getString(cursor.getColumnIndex("companyId")));
model.setLanguage(cursor.getString(cursor.getColumnIndex("local_language")));
return model;
}
@Override
public ContentValues getContentValues(LoginUserEntity userAccount) {
ContentValues contentValues = new ContentValues();
contentValues.put("_id", 8888);
contentValues.put("tempId", userAccount.getTempId());
contentValues.put("nickName", userAccount.getNickName());
contentValues.put("staffName", userAccount.getStaffName());
contentValues.put("maxServiceCount", userAccount.getMaxServiceCount());
contentValues.put("blackFunction", userAccount.getBlackFunction());
contentValues.put("transferFunction", userAccount.getTransferFunction());
contentValues.put("ticketFunction", SobotGsonUtil.beanToJson(userAccount.getTicketFunction()));
contentValues.put("face", userAccount.getFace());
contentValues.put("companyName", userAccount.getCompanyName());
contentValues.put("appKey", userAccount.getAppKey());
contentValues.put("sid", userAccount.getSid());
contentValues.put("pu", userAccount.getPu());
contentValues.put("puid", userAccount.getPuid());
contentValues.put("token", userAccount.getToken());
contentValues.put("cusRoleName", userAccount.getCusRoleName());
contentValues.put("aid", userAccount.getAid());
contentValues.put("centerNumber", userAccount.getCenterNumber());
contentValues.put("accountStatus", userAccount.getAccountStatus());
contentValues.put("imFlag", userAccount.isImFlag());
contentValues.put("cusRoleId", userAccount.getCusRoleId());
contentValues.put("status", userAccount.getStatus());
contentValues.put("topFlag", userAccount.getTopFlag());
contentValues.put("sortFlag", userAccount.getSortFlag());
contentValues.put("fuseWork", userAccount.getFuseWork());
contentValues.put("callV6Flag", userAccount.getCallV6Flag());
contentValues.put("callV1Flag", userAccount.getCallV1Flag());
contentValues.put("transferAuditFlag", userAccount.getTransferAuditFlag());
int kbVersion = 1;
if ("6".contains(userAccount.getKbVersion())) {
kbVersion = 6;
}
contentValues.put("kbVersion", kbVersion);
contentValues.put("companyId", userAccount.getCompanyId());
contentValues.put("local_language", userAccount.getLanguage());
return contentValues;
}
public void saveUser(LoginUserEntity user) {
insert(user);
}
/**
* 获取最近用户记录 按日期倒序
*/
public LoginUserEntity getCurUser() {
List<LoginUserEntity> list = query(null, null, null, null, null, null, null);
return list.size() > 0 ? list.get(0) : null;
}
}
package com.sobot.common.login.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.sobot.common.login.model.ServiceFunctionVoModel;
import com.sobot.common.login.model.SobotServiceInfoModel;
import com.sobot.common.utils.SobotGlobalContext;
import com.sobot.gson.SobotGsonUtil;
import com.sobot.gson.reflect.TypeToken;
import java.util.List;
/**
* 坐席信息 操作类
*/
public class ServiceInfoManager extends SobotCommonDao<SobotServiceInfoModel> {
private ServiceInfoManager(Context context) {
super(new SobotCommonDBHelper(context));
}
//volatile关键字确保多线程下正确处理
private volatile static ServiceInfoManager mInstance;
public static ServiceInfoManager getInstance() {
//第一次判空
if (mInstance == null) {
//进入同步区域
synchronized (LoginUserManager.class) {
//第二次判空
if (mInstance == null) {
mInstance = new ServiceInfoManager(SobotGlobalContext.getAppContext());
}
}
}
return mInstance;
}
@Override
public String getTableName() {
return SobotCommonDBHelper.TABLE_SERVICE_INFO;
}
@Override
public void unInit() {
}
@Override
public SobotServiceInfoModel parseCursorToBean(Cursor cursor) {
SobotServiceInfoModel model = new SobotServiceInfoModel();
model.setServiceId(cursor.getString(cursor.getColumnIndex("serviceId")));
model.setServiceName(cursor.getString(cursor.getColumnIndex("serviceName")));
model.setCusRoleId(cursor.getString(cursor.getColumnIndex("cusRoleId")));
model.setCusRoleName(cursor.getString(cursor.getColumnIndex("cusRoleName")));
model.setServiceLanguage(cursor.getString(cursor.getColumnIndex("language")));
model.setNewBossSwitch(cursor.getInt(cursor.getColumnIndex("newBossSwitch")));
model.setRegion(cursor.getInt(cursor.getColumnIndex("region")));
String functionStr = cursor.getString(cursor.getColumnIndex("functionStr"));
List<ServiceFunctionVoModel> list = SobotGsonUtil.jsonToBeans(functionStr, new TypeToken<List<ServiceFunctionVoModel>>() {
}.getType());
model.setFunctionStr(list);
return model;
}
@Override
public ContentValues getContentValues(SobotServiceInfoModel infoModel) {
ContentValues contentValues = new ContentValues();
contentValues.put("serviceId", infoModel.getServiceId());
contentValues.put("serviceName", infoModel.getServiceName());
contentValues.put("cusRoleId", infoModel.getCusRoleId());
contentValues.put("cusRoleName", infoModel.getCusRoleName());
contentValues.put("language", infoModel.getServiceLanguage());
contentValues.put("newBossSwitch", infoModel.getNewBossSwitch());
contentValues.put("region", infoModel.getRegion());
contentValues.put("functionStr", SobotGsonUtil.beanToJson(infoModel.getFunctionStr()));
return contentValues;
}
public void saveInfo(SobotServiceInfoModel host) {
insert(host);
}
/**
* 获取最近用户记录 按日期倒序
*/
public SobotServiceInfoModel getInfo() {
List<SobotServiceInfoModel> list = query(null, null, null, null, null, null, null);
return list.size() > 0 ? list.get(0) : null;
}
}
package com.sobot.common.login.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* DB辅助类
*/
class SobotCommonDBHelper extends SQLiteOpenHelper {
private static final String DB_CACHE_NAME = "sobot_common.db";
private static final int DB_CACHE_VERSION = 1;
static final String TABLE_LOGIN_USER = "login_user";
static final String TABLE_SOBOT_HOST = "sobot_host";
static final String TABLE_SERVICE_INFO = "sobot_service";
static final Lock lock = new ReentrantLock();
SobotCommonDBHelper(Context context) {
super(context, DB_CACHE_NAME, null, DB_CACHE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
onFirstCreate(db);
// 若不是第一个版本安装,直接执行数据库升级
// 请不要修改FIRST_DATABASE_VERSION的值,其为第一个数据库版本大小
final int FIRST_DATABASE_VERSION = 1;
onUpgrade(db, FIRST_DATABASE_VERSION, DB_CACHE_VERSION);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.beginTransaction();
try {
while (oldVersion < newVersion) {
upgradeDB(db, oldVersion, newVersion);
oldVersion++;
}
db.setTransactionSuccessful();
} catch (Exception e) {
e.printStackTrace();
} finally {
db.endTransaction();
}
}
/**
* 初始版本创建数据库需要执行的操作
*
* @param db
*/
private void onFirstCreate(SQLiteDatabase db) {
String sql = "create table " + TABLE_LOGIN_USER + "(_id INTEGER PRIMARY KEY," +
"tempId varchar(80)," +
"nickName varchar(300)," +
"staffName varchar(600), " +
"maxServiceCount INTEGER," +
"blackFunction INTEGER DEFAULT 1," +
"ticketFunction varchar(1000), " +
"transferFunction INTEGER DEFAULT 1, " +
"face varchar(300), " +
"companyName varchar(300), " +
"appKey varchar(40), " +
"sid varchar(40), " +
"pu varchar(40), " +
"puid varchar(40), " +
"token varchar(300), " +
"cusRoleName varchar(200), " +
"aid varchar(40), " +
"centerNumber varchar(40), " +
"accountStatus varchar(2), " +
"imFlag INTEGER, " +
"cusRoleId INTEGER, " +
"status INTEGER DEFAULT 1, " +
"topFlag INTEGER, " +
"sortFlag INTEGER , " +
"fuseWork INTEGER , " +
"callV6Flag INTEGER , " +
"callV1Flag INTEGER , " +
"transferAuditFlag INTEGER , " +
"kbVersion INTEGER , " +
"local_language varchar(10) , " +
"companyId varchar(40))";
db.execSQL(sql);
//添加客服信息表
String sql_service = "create table " + TABLE_SERVICE_INFO + "(" +
"serviceId varchar(40)," +
"serviceName varchar(600)," +
"cusRoleId varchar(10)," +
"cusRoleName varchar(200)," +
"functionStr varchar(1000)," +
"newBossSwitch INTEGER," +
"region INTEGER," +
"language varchar(10))";
db.execSQL(sql_service);
String sql_host = "create table " + TABLE_SOBOT_HOST + "(" +
"host varchar(80)," +
"hostDesc varchar(80)," +
"janussipProxy varchar(80)," +
"openApiHost varchar(80)," +
"stompSocket varchar(80)," +
"janusSocket varchar(80))";
db.execSQL(sql_host);
}
/**
* 升级数据需要执行的操作,初始版本以后所有版本的升级都会执行这个方法
*
* @param db
* @param oldVersion
* @param newVersion
*/
private void upgradeDB(SQLiteDatabase db, int oldVersion, int newVersion) {
switch (oldVersion) {
default:
break;
}
}
}
package com.sobot.common.login.db;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import android.util.Pair;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
/**
* dao类base
*/
public abstract class SobotCommonDao<T> {
private static final boolean isDebug = false;
protected static String TAG;
protected Lock lock;
protected SQLiteOpenHelper helper;
protected SQLiteDatabase database;
public SobotCommonDao(SQLiteOpenHelper helper) {
TAG = getClass().getSimpleName();
lock = SobotCommonDBHelper.lock;
this.helper = helper;
this.database = openWriter();
}
public SQLiteDatabase openWriter() {
try {
return helper.getWritableDatabase();
} catch (Exception e) {
//ignore
}
return null;
}
protected final void closeDatabase(SQLiteDatabase database, Cursor cursor) {
if (cursor != null && !cursor.isClosed()) cursor.close();
if (database != null && database.isOpen()) database.close();
}
/** 插入一条记录 */
public boolean insert(T t) {
if (t == null) return false;
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
long id = database.insert(getTableName(), null, getContentValues(t));
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " insertT");
}
}
return false;
}
/** 插入一条记录 */
public long insert(SQLiteDatabase database, T t) {
return database.insert(getTableName(), null, getContentValues(t));
}
/** 插入多条记录 */
public boolean insert(List<T> ts) {
if (ts == null) return false;
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
for (T t : ts) {
database.insert(getTableName(), null, getContentValues(t));
}
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " insertList");
}
}
return false;
}
public boolean insert(SQLiteDatabase database, List<T> ts) {
try {
for (T t : ts) {
database.insert(getTableName(), null, getContentValues(t));
}
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
return false;
}
}
/** 删除所有数据 */
public boolean deleteAll() {
return delete(null, null);
}
/** 删除所有数据 */
public long deleteAll(SQLiteDatabase database) {
return delete(database, null, null);
}
/** 根据条件删除数据库中的数据 */
public boolean delete(String whereClause, String[] whereArgs) {
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
database.delete(getTableName(), whereClause, whereArgs);
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " delete");
}
}
return false;
}
/** 根据条件删除数据库中的数据 */
public long delete(SQLiteDatabase database, String whereClause, String[] whereArgs) {
return database.delete(getTableName(), whereClause, whereArgs);
}
public boolean deleteList(List<Pair<String, String[]>> where) {
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
for (Pair<String, String[]> pair : where) {
database.delete(getTableName(), pair.first, pair.second);
}
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " deleteList");
}
}
return false;
}
/**
* replace 语句有如下行为特点
* 1. replace语句会删除原有的一条记录, 并且插入一条新的记录来替换原记录。
* 2. 一般用replace语句替换一条记录的所有列, 如果在replace语句中没有指定某列, 在replace之后这列的值被置空 。
* 3. replace语句根据主键的值确定被替换的是哪一条记录
* 4. 如果执行replace语句时, 不存在要替换的记录, 那么就会插入一条新的记录。
* 5. replace语句不能根据where子句来定位要被替换的记录
* 6. 如果新插入的或替换的记录中, 有字段和表中的其他记录冲突, 那么会删除那条其他记录。
*/
public boolean replace(T t) {
if (t == null) return false;
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
database.replace(getTableName(), null, getContentValues(t));
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " replaceT");
}
}
return false;
}
public long replace(SQLiteDatabase database, T t) {
return database.replace(getTableName(), null, getContentValues(t));
}
public boolean replace(ContentValues contentValues) {
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
database.replace(getTableName(), null, contentValues);
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " replaceContentValues");
}
}
return false;
}
public long replace(SQLiteDatabase database, ContentValues contentValues) {
return database.replace(getTableName(), null, contentValues);
}
public boolean replace(List<T> ts) {
if (ts == null) return false;
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
for (T t : ts) {
database.replace(getTableName(), null, getContentValues(t));
}
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " replaceList");
}
}
return false;
}
public boolean replace(SQLiteDatabase database, List<T> ts) {
try {
for (T t : ts) {
database.replace(getTableName(), null, getContentValues(t));
}
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
return false;
}
}
/** 更新一条记录 */
public boolean update(T t, String whereClause, String[] whereArgs) {
if (t == null) return false;
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
database.update(getTableName(), getContentValues(t), whereClause, whereArgs);
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " updateT");
}
}
return false;
}
/** 更新一条记录 */
public long update(SQLiteDatabase database, T t, String whereClause, String[] whereArgs) {
return database.update(getTableName(), getContentValues(t), whereClause, whereArgs);
}
/** 更新一条记录 */
public boolean update(ContentValues contentValues, String whereClause, String[] whereArgs) {
if (database == null) return false;
long start = System.currentTimeMillis();
lock.lock();
try {
database.beginTransaction();
database.update(getTableName(), contentValues, whereClause, whereArgs);
database.setTransactionSuccessful();
return true;
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " updateContentValues");
}
}
return false;
}
/** 更新一条记录 */
public long update(SQLiteDatabase database, ContentValues contentValues, String whereClause, String[] whereArgs) {
return database.update(getTableName(), contentValues, whereClause, whereArgs);
}
/** 查询并返回所有对象的集合 */
public List<T> queryAll(SQLiteDatabase database) {
return query(database, null, null);
}
/** 按条件查询对象并返回集合 */
public List<T> query(SQLiteDatabase database, String selection, String[] selectionArgs) {
return query(database, null, selection, selectionArgs, null, null, null, null);
}
/** 查询满足条件的一个结果 */
public T queryOne(SQLiteDatabase database, String selection, String[] selectionArgs) {
List<T> query = query(database, null, selection, selectionArgs, null, null, null, "1");
if (query.size() > 0) return query.get(0);
return null;
}
/** 按条件查询对象并返回集合 */
public List<T> query(SQLiteDatabase database, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) {
List<T> list = new ArrayList<>();
Cursor cursor = null;
try {
cursor = database.query(getTableName(), columns, selection, selectionArgs, groupBy, having, orderBy, limit);
while (!cursor.isClosed() && cursor.moveToNext()) {
list.add(parseCursorToBean(cursor));
}
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
closeDatabase(null, cursor);
}
return list;
}
/** 查询并返回所有对象的集合 */
public List<T> queryAll() {
return query(null, null);
}
/** 按条件查询对象并返回集合 */
public List<T> query(String selection, String[] selectionArgs) {
return query(null, selection, selectionArgs, null, null, null, null);
}
/** 查询满足条件的一个结果 */
public T queryOne(String selection, String[] selectionArgs) {
long start = System.currentTimeMillis();
List<T> query = query(null, selection, selectionArgs, null, null, null, "1");
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " queryOne");
}
return query.size() > 0 ? query.get(0) : null;
}
/** 按条件查询对象并返回集合 */
public List<T> query(String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) {
if (database == null) {
return new ArrayList<>();
}
long start = System.currentTimeMillis();
lock.lock();
List<T> list = new ArrayList<>();
Cursor cursor = null;
try {
database.beginTransaction();
cursor = database.query(getTableName(), columns, selection, selectionArgs, groupBy, having, orderBy, limit);
while (!cursor.isClosed() && cursor.moveToNext()) {
list.add(parseCursorToBean(cursor));
}
database.setTransactionSuccessful();
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
closeDatabase(null, cursor);
database.endTransaction();
lock.unlock();
if (isDebug) {
Log.v(TAG, System.currentTimeMillis() - start + " query");
}
}
return list;
}
public interface Action {
void call(SQLiteDatabase database);
}
/** 用于给外界提供事物开启的模板 */
public void startTransaction(Action action) {
if (database == null) return;
lock.lock();
try {
database.beginTransaction();
action.call(database);
database.setTransactionSuccessful();
} catch (Exception e) {
if (isDebug) {
Log.e(TAG,"",e);
}
} finally {
database.endTransaction();
lock.unlock();
}
}
/** 获取对应的表名 */
public abstract String getTableName();
public abstract void unInit();
/** 将Cursor解析成对应的JavaBean */
public abstract T parseCursorToBean(Cursor cursor);
/** 需要替换的列 */
public abstract ContentValues getContentValues(T t);
}
package com.sobot.common.login.model;
import java.io.Serializable;
/**
* 所有域名
*/
public class HostModel implements Serializable {
private String desc;// "香港",
private String host;// "http://hk.sobot.com/",
private String janusSocket;// "wss://rtc.sobot.com.cn/janus",
private String janussipProxy;// "sip:192.168.30.68:5060",
private String openApiHost;// "https://openapi.sobot.com",
private String stompSocket;// "wss://openapi.sobot.com/v6.0.0/webmsg/cc-webmsg"
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getJanusSocket() {
return janusSocket;
}
public void setJanusSocket(String janusSocket) {
this.janusSocket = janusSocket;
}
public String getJanussipProxy() {
return janussipProxy;
}
public void setJanussipProxy(String janussipProxy) {
this.janussipProxy = janussipProxy;
}
public String getOpenApiHost() {
return openApiHost;
}
public void setOpenApiHost(String openApiHost) {
this.openApiHost = openApiHost;
}
public String getStompSocket() {
return stompSocket;
}
public void setStompSocket(String stompSocket) {
this.stompSocket = stompSocket;
}
}
package com.sobot.common.login.model;
import com.sobot.gson.annotations.Expose;
import com.sobot.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
public class LoginUserEntity implements Serializable {
private static final long serialVersionUID = 1L;
private String tempId; //客服temp-id
private String nickName; //客服昵称
private String staffName; //客服名称
private int maxServiceCount; //最大接待量
private int blackFunction = 1; //是否有拉黑权限 0 没有 1 有
private int transferFunction = 1; //是否有转接权限 0 没有 1 有
private String face; //头像url
private int status; //账号状态 1正常0登录邮箱或密码不正确 2用户已在pc端登录
private String companyId;//sysNum
private String appKey;
private String sid;
private String pu;
private String puid;
private String token;
private int imFlag;//0是工单客服 1是在线客服
private int cusRoleId;//身份id 3333:超级管理员;1111:在线客服;2222:管理员
private String cusRoleName;//身份名称 客服身份
private String aid;//userid
private int topFlag;//星标置顶 0不置顶 1置顶
private int sortFlag;//会话排序 0 按接入顺序 1 按新消息时间
private String centerNumber;//如果不为空,说明开通了呼叫功能
private int fuseWork;//1-存在融合工作台,使用新版服务总计 0-没有融合工作台
/**
* 1 账号开通v6;其它是v1
*/
private int callV6Flag;
private int callV1Flag;//是否是V1,方便做那个呼叫v1/v6切换的功能
private Map<String, Boolean> ticketFunction;//1222 可删除工单 ;1223 可删除工单回复;1224 可关闭工单; 1225 可激活工单 1230 工单操作历史权限
// 1231-工单状态 ; 1611-查看App客户中心
private int transferAuditFlag;//转接审核开关 0关闭 1开启
private String companyName;//公司名称
private String accountStatus;//企业账号版本:旗舰版
private String kbVersion;//智能回复,查询版本v6/v1
private String language;//国际化指定语言 3.1.3新增 为空时,默认中文
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getAccountStatus() {
return accountStatus;
}
public void setAccountStatus(String accountStatus) {
this.accountStatus = accountStatus;
}
@Expose
@SerializedName("wslink.bak")
private List<String> wslinkBak;//通道地址
@Expose
@SerializedName("wslink.default")
private String wslinkDefault;//通道默认地址
public String getAid() {
return aid;
}
public void setAid(String aid) {
this.aid = aid;
}
public int getBlackFunction() {
return blackFunction;
}
public void setBlackFunction(int blackFunction) {
this.blackFunction = blackFunction;
}
public int getTransferFunction() {
return transferFunction;
}
public void setTransferFunction(int transferFunction) {
this.transferFunction = transferFunction;
}
public List<String> getWslinkBak() {
return wslinkBak;
}
public void setWslinkBak(List<String> wslinkBak) {
this.wslinkBak = wslinkBak;
}
public String getWslinkDefault() {
return wslinkDefault;
}
public void setWslinkDefault(String wslinkDefault) {
this.wslinkDefault = wslinkDefault;
}
public int getCusRoleId() {
return cusRoleId;
}
public void setCusRoleId(int cusRoleId) {
this.cusRoleId = cusRoleId;
}
public String getCusRoleName() {
return cusRoleName;
}
public void setCusRoleName(String cusRoleName) {
this.cusRoleName = cusRoleName;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public int isImFlag() {
return imFlag;
}
public void setImFlag(int imFlag) {
this.imFlag = imFlag;
}
public String getPu() {
return pu;
}
public void setPu(String pu) {
this.pu = pu;
}
public String getPuid() {
return puid;
}
public void setPuid(String puid) {
this.puid = puid;
}
public String getTempId() {
return tempId;
}
public void setTempId(String tempId) {
this.tempId = tempId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public int getMaxServiceCount() {
return maxServiceCount;
}
public void setMaxServiceCount(int maxServiceCount) {
this.maxServiceCount = maxServiceCount;
}
public String getFace() {
return face;
}
public void setFace(String face) {
this.face = face;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public int getTopFlag() {
return topFlag;
}
public void setTopFlag(int topFlag) {
this.topFlag = topFlag;
}
public int getSortFlag() {
return sortFlag;
}
public void setSortFlag(int sortFlag) {
this.sortFlag = sortFlag;
}
public String getCenterNumber() {
return centerNumber;
}
public void setCenterNumber(String centerNumber) {
this.centerNumber = centerNumber;
}
public Map<String, Boolean> getTicketFunction() {
return ticketFunction;
}
public void setTicketFunction(Map<String, Boolean> ticketFunction) {
this.ticketFunction = ticketFunction;
}
public boolean getTransferAuditFlag() {
return transferAuditFlag == 1 ? true : false;
}
public void setTransferAuditFlag(int transferAuditFlag) {
this.transferAuditFlag = transferAuditFlag;
}
public int getFuseWork() {
return fuseWork;
}
public void setFuseWork(int fuseWork) {
this.fuseWork = fuseWork;
}
public int getCallV6Flag() {
return callV6Flag;
}
public void setCallV6Flag(int callV6Flag) {
this.callV6Flag = callV6Flag;
}
public int getCallV1Flag() {
return callV1Flag;
}
public void setCallV1Flag(int callV1Flag) {
this.callV1Flag = callV1Flag;
}
public String getKbVersion() {
return kbVersion;
}
public void setKbVersion(String kbVersion) {
this.kbVersion = kbVersion;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
}
package com.sobot.common.login.model;
import java.io.Serializable;
//权限信息
public class ServiceFunctionVoModel implements Serializable {
//旧版console权限标识
private String id;
//新版console权限标识
private String code;
//是否有子类权限
private boolean hasChildren;
public ServiceFunctionVoModel() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public boolean isHasChildren() {
return hasChildren;
}
public void setHasChildren(boolean hasChildren) {
this.hasChildren = hasChildren;
}
@Override
public String toString() {
return "SobotCusFunctionVoModel{" +
"id='" + id + '\'' +
"code='" + code + '\'' +
"cohasChildrende='" + hasChildren + '\'' +
'}';
}
}
package com.sobot.common.login.model;
import java.io.Serializable;
public class SobotBaseCodeThird<T> implements Serializable {
public T item;
public String retMsg;
public String retCode;
public int totalCount;
public T getItem() {
return item;
}
public void setItem(T item) {
this.item = item;
}
public String getRetMsg() {
return retMsg;
}
public void setRetMsg(String retMsg) {
this.retMsg = retMsg;
}
public String getRetCode() {
return retCode;
}
public void setRetCode(String retCode) {
this.retCode = retCode;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
}
\ No newline at end of file
package com.sobot.common.login.model;
import java.io.Serializable;
import java.util.List;
/**
* 登录后的客服信息
*/
public class SobotServiceInfoModel implements Serializable {
/**
* 客服id
*/
private String serviceId;
/**
* 客服名字
*/
private String serviceName;
/**
* 角色id
*/
private String cusRoleId;
/**
* 角色名称
*/
private String cusRoleName;
/**
* 0 只用旧console 其他都是新console;
*/
private int newBossSwitch;
/**
* 权限信息
*/
private List<ServiceFunctionVoModel> functionStr;
private String serviceLanguage;
//区域环境(0国内 1国外)
private int region;
/**
* 公司id
*/
private String companyId;
/**
* 1 账号开通v6;其它是v1
*/
private int callV6Flag;
private String language;
/**
* 手机号
*/
private String phoneNo;
/**
* 权限 "globalPermissions": ["calldetails-newcustomers", "sw-ccc-thxq-xzkh", "calldetails-editcustomer", "DepartmentalAppealReview", "sw-ccc-thxq-bjkh",
* "A00008", "calldetails-relatedcustomers", "ChatQualityScore", "237283747", "sw-ccc-thxq-glkh", "calldetails-savesersummary", "CallQualityScore", "allTicket",
* "sw-ccc-thxq-bcfwzj", "calldetails-newworkorder", "ChatRecheck", "sw-ccc-thxq-xjgd", "mw-ccc-thxq-gdcd", "sw-ccc-thxq-gdcd", "calldetails-recordingandplay",
* "sw-ccc-thxq-fsdx", "calldetails-recorddownload", "sw-ccc-thxq-lybf", "calldetails-messageplay", "sw-ccc-thxq-lyxz", "mw-ccc-thxq-liuyxz", "sw-ccc-thxq-dhhb",
* "sw-ccc-thxq-liuybf", "sw-ccc-thxq-liuyxz", "9999"]
*/
private List<String> globalPermissions;
//是否是号码脱敏,true 脱敏,false 明文
private boolean hideFlag;
public List<String> getGlobalPermissions() {
return globalPermissions;
}
public void setGlobalPermissions(List<String> globalPermissions) {
this.globalPermissions = globalPermissions;
}
public boolean isHideFlag() {
if (null != globalPermissions && globalPermissions.contains("9999")) {
return true;
}
return false;
}
public void setHideFlag(boolean hideFlag) {
this.hideFlag = hideFlag;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public int getCallV6Flag() {
return callV6Flag;
}
public void setCallV6Flag(int callV6Flag) {
this.callV6Flag = callV6Flag;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
public String getServiceId() {
return serviceId;
}
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
public String getCusRoleId() {
return cusRoleId;
}
public void setCusRoleId(String cusRoleId) {
this.cusRoleId = cusRoleId;
}
public String getCusRoleName() {
return cusRoleName;
}
public void setCusRoleName(String cusRoleName) {
this.cusRoleName = cusRoleName;
}
public List<ServiceFunctionVoModel> getFunctionStr() {
return functionStr;
}
public void setFunctionStr(List<ServiceFunctionVoModel> functionStr) {
this.functionStr = functionStr;
}
public String getServiceName() {
return serviceName;
}
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
public int getNewBossSwitch() {
return newBossSwitch;
}
public void setNewBossSwitch(int newBossSwitch) {
this.newBossSwitch = newBossSwitch;
}
public String getServiceLanguage() {
return serviceLanguage;
}
public void setServiceLanguage(String serviceLanguage) {
this.serviceLanguage = serviceLanguage;
}
public int getRegion() {
return region;
}
public void setRegion(int region) {
this.region = region;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
}
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 全功能管理员
*/
public class PermissionAllFunctionAdministrator implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionAllFunctionAdministrator(){
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_TALK, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_STATISTIC, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_ONLINE, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_CALL, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_ONLINE, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_CALL, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE__STATISTIC_ROBOT, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_PERSON_STATUS, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_SESSION_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_OTHER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_EDIT_WORK_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_DEL_WORK_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_CALL, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
\ No newline at end of file
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 全功能客服
*/
public class PermissionAllFunctionCustomerService implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionAllFunctionCustomerService(){
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_TALK, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_PERSON_STATUS, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_SESSION_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_OTHER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_CALL, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
\ No newline at end of file
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 呼叫管理员
*/
public class PermissionCallAdministrators implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionCallAdministrators(){
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_STATISTIC, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_CALL, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_CALL, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_EDIT_WORK_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_DEL_WORK_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_CALL, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
\ No newline at end of file
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 呼叫客服
*/
public class PermissionCallCustomerService implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionCallCustomerService(){
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_OTHER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_CALL, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 在线管理员
*/
public class PermissionOnLineAdministrators implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionOnLineAdministrators(){
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_TALK, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_STATISTIC, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_ONLINE, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_ONLINE, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE__STATISTIC_ROBOT, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_PERSON_STATUS, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_SESSION_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_OTHER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_EDIT_WORK_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_DEL_WORK_ORDER, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
\ No newline at end of file
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 在线客服
*/
public class PermissionOnLineCustomerService implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionOnLineCustomerService(){
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_TALK, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_PERSON_STATUS, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_SESSION_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_OTHER, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 超级管理员
*/
public class PermissionSuper implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionSuper() {
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_TALK, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_STATISTIC, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_ONLINE, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_CALL, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_ONLINE, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_CALL, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE__STATISTIC_ROBOT, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_PERSON_STATUS, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_SET_SESSION_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_OTHER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_EDIT_WORK_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_DEL_WORK_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_CALL, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
\ No newline at end of file
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 工单管理员
*/
public class PermissionWorkOrderAdministrators implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionWorkOrderAdministrators(){
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_STATISTIC, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_OTHER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_EDIT_WORK_ORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_DEL_WORK_ORDER, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
\ No newline at end of file
package com.sobot.common.login.permission;
import android.util.SparseBooleanArray;
/**
* 工单客服
*/
public class PermissionWorkOrderCustomerService implements SobotPermissionApi {
private SparseBooleanArray sparseArray;
public PermissionWorkOrderCustomerService(){
sparseArray = new SparseBooleanArray();
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER, true);
sparseArray.put(SobotPermissionApi.USER_PERMISSION_TYPE_OTHER, true);
}
@Override
public boolean checkPermission(int type) {
return sparseArray.get(type);
}
}
package com.sobot.common.login.permission;
/**
* 权限常量类
*/
public interface SobotPermissionApi {
//对话权限
int USER_PERMISSION_TYPE_TALK = 0;
//工单权限
int USER_PERMISSION_TYPE_WORKORDER = 1;
//呼叫权限
int USER_PERMISSION_TYPE_CALL = 15;
//客户中心
String USER_PERMISSION_TYPE_USER_CENTEER = "1611";
//监控统计权限
int USER_PERMISSION_TYPE_MONITOR_STATISTIC = 2;
//监控-在线权限
int USER_PERMISSION_TYPE_MONITOR_ONLINE = 3;
//监控-呼叫权限
int USER_PERMISSION_TYPE_MONITOR_CALL = 4;
//统计-在线权限
int USER_PERMISSION_TYPE_STATISTIC_ONLINE = 5;
//统计-呼叫权限
int USER_PERMISSION_TYPE_STATISTIC_CALL = 6;
//统计-工单权限
int USER_PERMISSION_TYPE_STATISTIC_WORKORDER = 7;
//统计-机器人权限
int USER_PERMISSION_TYPE__STATISTIC_ROBOT = 8;
//设置-个人状态权限
int USER_PERMISSION_TYPE_SET_PERSON_STATUS = 9;
//设置-会话顺序权限
int USER_PERMISSION_TYPE_SET_SESSION_ORDER = 10;
//设置权限
int USER_PERMISSION_TYPE_OTHER = 11;
//工单详情页是否有右上角的编辑工单权限
int USER_PERMISSION_TYPE_EDIT_WORK_ORDER = 12;
//工单详情页是否有右上角的删除工单权限
int USER_PERMISSION_TYPE_DEL_WORK_ORDER = 13;
boolean checkPermission(int type);
}
\ No newline at end of file
package com.sobot.common.login.permission;
import android.text.TextUtils;
import com.sobot.common.login.db.LoginUserInfoUtils;
import com.sobot.common.login.db.ServiceInfoManager;
import com.sobot.common.login.model.LoginUserEntity;
import com.sobot.common.login.model.ServiceFunctionVoModel;
import com.sobot.common.login.model.SobotServiceInfoModel;
/**
* 权限管理类
*/
public class SobotPermissionManager {
public static final int ONLINE_CUSTOMER_SERVICE = 1111;//在线客服
public static final int ONLINE_ADMINISTRATORS = 2222;//在线管理员
public static final int SUPER_ADMINISTRATORS = 3333;//超级管理员
public static final int ALL_FUNCTION_ADMINISTRATORS = 4444;//全功能管理员
public static final int WORK_ORDER_CUSTOMER_SERVICE = 5555;//工单客服
public static final int CALL_CUSTOMER_SERVICE = 6669;//呼叫客服
private static final int ALL_FUNCTION_CUSTOMER_SERVICE = 7777;//全功能客服
public static final int WORK_ORDER_ADMINISTRATORS = 8888;//工单管理员
public static final int CALL_ADMINISTRATORS = 9999;//呼叫管理员
private static SobotPermissionApi instance;
private static SobotPermissionApi getInstance() {
if (instance == null) {
if (LoginUserInfoUtils.getUser() != null) {
switch (LoginUserInfoUtils.getUser().getCusRoleId()) {
case ONLINE_CUSTOMER_SERVICE://在线客服
instance = new PermissionOnLineCustomerService();
break;
case ONLINE_ADMINISTRATORS://在线管理员
instance = new PermissionOnLineAdministrators();
break;
case SUPER_ADMINISTRATORS://超级管理员
instance = new PermissionSuper();
break;
case ALL_FUNCTION_ADMINISTRATORS://全功能管理员
instance = new PermissionAllFunctionAdministrator();
break;
case WORK_ORDER_CUSTOMER_SERVICE://工单客服
instance = new PermissionWorkOrderCustomerService();
break;
case CALL_CUSTOMER_SERVICE://呼叫客服
instance = new PermissionCallCustomerService();
break;
case ALL_FUNCTION_CUSTOMER_SERVICE://全功能客服
instance = new PermissionAllFunctionCustomerService();
break;
case WORK_ORDER_ADMINISTRATORS://工单管理员
instance = new PermissionWorkOrderAdministrators();
break;
case CALL_ADMINISTRATORS://呼叫管理员
instance = new PermissionCallAdministrators();
break;
}
}
}
return instance;
}
public static boolean checkPermission(int type) {
SobotServiceInfoModel serviceInfoModel = ServiceInfoManager.getInstance().getInfo();
if (serviceInfoModel != null) {
if (serviceInfoModel.getNewBossSwitch() > 0) {
return isHasPermission(type + "");
} else {
SobotPermissionApi instance = getInstance();
if (instance != null) {
return instance.checkPermission(type);
}
}
} else {
SobotPermissionApi instance = getInstance();
if (instance != null) {
return instance.checkPermission(type);
}
}
return false;
}
public static void clearInstance() {
instance = null;
}
//-------2.8.6添加----------------
public static final String USER_PERMISSION_TYPE_DEL_WORK_ORDER = "1222";// 可删除工单
public static final String USER_PERMISSION_TYPE_DEL_WORK_ORDER_REPLY = "1223";// 可删除工单回复
public static final String USER_PERMISSION_TYPE_COLSE_WORK_ORDER = "1224";// 可关闭工单
public static final String USER_PERMISSION_TYPE_ACTIVATION_WORK_ORDER = "1225";// 可激活工单
public static final String USER_PERMISSION_TYPE_WORK_SEARCH = "1227";// 工单全局搜索
public static final String USER_PERMISSION_TYPE_WORK_HISTORY = "1230";// 工单操作历史权限
public static final String USER_PERMISSION_TYPE_WORK_STATUS = "1231";// 工单状态 可见/不可见
//会话
public static final String MODULE_CHAT = "module_chat";
//工单中心
public static final String MODULE_ORDER = "module_order";
//工单编辑
public static final String MODULE_ORDER_EDIT = "module_order_edit";
//删除工单
public static final String MODULE_ORDER_DELETE = "module_order_delete";
//删除回复
public static final String MODULE_ORDER_REPLYDELETE = "module_order_replydelete";
//关闭工单
public static final String MODULE_ORDER_CLOSE = "module_order_close";
//激活工单
public static final String MODULE_ORDER_ACTIVATION = "module_order_activation";
//工单全局搜索
public static final String MODULE_ORDER_SEARCH = "module_order_search";
//工单操作记录
public static final String MODULE_ORDER_OPERATE = "module_order_operate";
//工单状态
public static final String MODULE_ORDER_STATUS = "module_order_status";
//客户
public static final String MODULE_USERS = "module_users";
//呼叫
public static final String MODULE_CALL = "module_call";
//监控统计
public static final String MODULE_MONITORINGSTATISTICS = "module_monitoringstatistics";
//在线统计
public static final String MODULE_STATISTICS_ONLINE = "module_statistics_online";
//呼叫统计
public static final String MODULE_STATISTICS_CALL = "module_statistics_call";
//呼叫监控
public static final String MODULE_MONITORING_CALL = "module_monitoring_call";
//在线监控
public static final String MODULE_MONITORING_ONLINE = "module_monitoring_online";
//工单统计
public static final String MODULE_STATISTICS_ORDER = "module_statistics_order";
//机器人统计
public static final String MODULE_STATISTICS_ROBOT = "module_statistics_robot";
//个人状态
public static final String MODULE_SETTING_STATUS = "module_setting_status";
//会话顺序
public static final String MODULE_SETTING_PLAIN = "module_setting_plain";
public static String getCodeByType(String type) {
if (!TextUtils.isEmpty(type)) {
switch (type) {
case USER_PERMISSION_TYPE_DEL_WORK_ORDER:
return MODULE_ORDER_DELETE;
case USER_PERMISSION_TYPE_DEL_WORK_ORDER_REPLY:
return MODULE_ORDER_REPLYDELETE;
case USER_PERMISSION_TYPE_COLSE_WORK_ORDER:
return MODULE_ORDER_CLOSE;
case USER_PERMISSION_TYPE_ACTIVATION_WORK_ORDER:
return MODULE_ORDER_ACTIVATION;
case USER_PERMISSION_TYPE_WORK_SEARCH:
return MODULE_ORDER_SEARCH;
case USER_PERMISSION_TYPE_WORK_STATUS:
return MODULE_ORDER_STATUS;
case USER_PERMISSION_TYPE_WORK_HISTORY:
return MODULE_ORDER_OPERATE;
//对话权限
case SobotPermissionApi.USER_PERMISSION_TYPE_TALK + "":
return MODULE_CHAT;
//工单权限
case SobotPermissionApi.USER_PERMISSION_TYPE_WORKORDER + "":
return MODULE_ORDER;
//呼叫权限
case SobotPermissionApi.USER_PERMISSION_TYPE_CALL + "":
return MODULE_CALL;
//客户中心权限
case SobotPermissionApi.USER_PERMISSION_TYPE_USER_CENTEER + "":
return MODULE_USERS;
//监控统计权限
case SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_STATISTIC + "":
return MODULE_MONITORINGSTATISTICS;
//监控-在线权限
case SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_ONLINE + "":
return MODULE_MONITORING_ONLINE;
//监控-呼叫权限
case SobotPermissionApi.USER_PERMISSION_TYPE_MONITOR_CALL + "":
return MODULE_MONITORING_CALL;
//统计-在线权限
case SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_ONLINE + "":
return MODULE_STATISTICS_ONLINE;
//统计-呼叫权限
case SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_CALL + "":
return MODULE_STATISTICS_CALL;
//统计-工单权限
case SobotPermissionApi.USER_PERMISSION_TYPE_STATISTIC_WORKORDER + "":
return MODULE_STATISTICS_ORDER;
//统计-机器人权限
case SobotPermissionApi.USER_PERMISSION_TYPE__STATISTIC_ROBOT + "":
return MODULE_STATISTICS_ROBOT;
//设置-个人状态权限
case SobotPermissionApi.USER_PERMISSION_TYPE_SET_PERSON_STATUS + "":
return MODULE_SETTING_STATUS;
//设置-会话顺序权限
case SobotPermissionApi.USER_PERMISSION_TYPE_SET_SESSION_ORDER + "":
return MODULE_SETTING_PLAIN;
//工单详情页是否有右上角的编辑工单权限
case SobotPermissionApi.USER_PERMISSION_TYPE_EDIT_WORK_ORDER + "":
return MODULE_ORDER_EDIT;
//工单详情页是否有右上角的删除工单权限
case SobotPermissionApi.USER_PERMISSION_TYPE_DEL_WORK_ORDER + "":
return MODULE_ORDER_DELETE;
}
return type;
} else {
return type;
}
}
public static boolean isHasPermission(String type) {
SobotServiceInfoModel serviceInfoModel = ServiceInfoManager.getInstance().getInfo();
if (serviceInfoModel != null) {
if (serviceInfoModel.getNewBossSwitch() > 0) {
if (!TextUtils.isEmpty(type) && serviceInfoModel != null && serviceInfoModel.getFunctionStr() != null) {
for (int i = 0; i < serviceInfoModel.getFunctionStr().size(); i++) {
ServiceFunctionVoModel cusFunctionVoModel = serviceInfoModel.getFunctionStr().get(i);
if (getCodeByType(type).equals(cusFunctionVoModel.getCode())) {
return true;
}
}
}
} else {
LoginUserEntity customerServiceInfoModel = LoginUserInfoUtils.getUser();
if (!TextUtils.isEmpty(type) && customerServiceInfoModel != null && customerServiceInfoModel.getTicketFunction() != null && customerServiceInfoModel.getTicketFunction().containsKey(type)) {
return customerServiceInfoModel.getTicketFunction().get(type);
}
}
}
return false;
}
public static boolean isHasNewPermission(String type) {
SobotServiceInfoModel serviceInfoModel = ServiceInfoManager.getInstance().getInfo();
if (serviceInfoModel != null) {
if (serviceInfoModel.getNewBossSwitch() > 0) {
if (!TextUtils.isEmpty(type) && serviceInfoModel != null && serviceInfoModel.getFunctionStr() != null) {
for (int i = 0; i < serviceInfoModel.getFunctionStr().size(); i++) {
ServiceFunctionVoModel cusFunctionVoModel = serviceInfoModel.getFunctionStr().get(i);
if (type.equals(cusFunctionVoModel.getCode())) {
return true;
}
}
}
}
}
return false;
}
}
\ No newline at end of file
package com.sobot.common.utils;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.Arrays;
/**
* This class consists exclusively of static methods for obtaining
* encoders and decoders for the SobotBase64Util encoding scheme. The
* implementation of this class supports the following types of SobotBase64Util
* as specified in
* <a href="http://www.ietf.org/rfc/rfc4648.txt">RFC 4648</a> and
* <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>.
*
* <ul>
* <li><a name="basic"><b>Basic</b></a>
* <p> Uses "The SobotBase64Util Alphabet" as specified in Table 1 of
* RFC 4648 and RFC 2045 for encoding and decoding operation.
* The encoder does not add any line feed (line separator)
* character. The decoder rejects data that contains characters
* outside the SobotBase64Util alphabet.</p></li>
*
* <li><a name="url"><b>URL and Filename safe</b></a>
* <p> Uses the "URL and Filename safe SobotBase64Util Alphabet" as specified
* in Table 2 of RFC 4648 for encoding and decoding. The
* encoder does not add any line feed (line separator) character.
* The decoder rejects data that contains characters outside the
* SobotBase64Util alphabet.</p></li>
*
* <li><a name="mime"><b>MIME</b></a>
* <p> Uses the "The SobotBase64Util Alphabet" as specified in Table 1 of
* RFC 2045 for encoding and decoding operation. The encoded output
* must be represented in lines of no more than 76 characters each
* and uses a carriage return {@code '\r'} followed immediately by
* a linefeed {@code '\n'} as the line separator. No line separator
* is added to the end of the encoded output. All line separators
* or other characters not found in the SobotBase64Util alphabet table are
* ignored in decoding operation.</p></li>
* </ul>
*
* <p> Unless otherwise noted, passing a {@code null} argument to a
* method of this class will cause a {@link NullPointerException
* NullPointerException} to be thrown.
*
* @author Xueming Shen
* @since 1.8
*/
public class SobotBase64 {
private SobotBase64() {
}
/**
* Returns a {@link Encoder} that encodes using the
* <a href="#basic">Basic</a> type SobotBase64Util encoding scheme.
*
* @return A SobotBase64Util encoder.
*/
public static Encoder getEncoder() {
return Encoder.RFC4648;
}
/**
* Returns a {@link Encoder} that encodes using the
* <a href="#url">URL and Filename safe</a> type SobotBase64Util
* encoding scheme.
*
* @return A SobotBase64Util encoder.
*/
public static Encoder getUrlEncoder() {
return Encoder.RFC4648_URLSAFE;
}
/**
* Returns a {@link Encoder} that encodes using the
* <a href="#mime">MIME</a> type SobotBase64Util encoding scheme.
*
* @return A SobotBase64Util encoder.
*/
public static Encoder getMimeEncoder() {
return Encoder.RFC2045;
}
/**
* Returns a {@link Decoder} that decodes using the
* <a href="#basic">Basic</a> type SobotBase64Util encoding scheme.
*
* @return A SobotBase64Util decoder.
*/
public static Decoder getDecoder() {
return Decoder.RFC4648;
}
/**
* Returns a {@link Decoder} that decodes using the
* <a href="#url">URL and Filename safe</a> type SobotBase64Util
* encoding scheme.
*
* @return A SobotBase64Util decoder.
*/
public static Decoder getUrlDecoder() {
return Decoder.RFC4648_URLSAFE;
}
/**
* Returns a {@link Decoder} that decodes using the
* <a href="#mime">MIME</a> type SobotBase64Util decoding scheme.
*
* @return A SobotBase64Util decoder.
*/
public static Decoder getMimeDecoder() {
return Decoder.RFC2045;
}
/**
* This class implements an encoder for encoding byte data using
* the SobotBase64Util encoding scheme as specified in RFC 4648 and RFC 2045.
*
* <p> Instances of {@link Encoder} class are safe for use by
* multiple concurrent threads.
*
* <p> Unless otherwise noted, passing a {@code null} argument to
* a method of this class will cause a
* {@link NullPointerException NullPointerException} to
* be thrown.
*
* @see Decoder
* @since 1.8
*/
public static class Encoder {
private final byte[] newline;
private final int linemax;
private final boolean isURL;
private final boolean doPadding;
private Encoder(boolean isURL, byte[] newline, int linemax, boolean doPadding) {
this.isURL = isURL;
this.newline = newline;
this.linemax = linemax;
this.doPadding = doPadding;
}
/**
* This array is a lookup table that translates 6-bit positive integer
* index values into their "SobotBase64Util Alphabet" equivalents as specified
* in "Table 1: The SobotBase64Util Alphabet" of RFC 2045 (and RFC 4648).
*/
private static final char[] toBase64 = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
};
/**
* It's the lookup table for "URL and Filename safe SobotBase64Util" as specified
* in Table 2 of the RFC 4648, with the '+' and '/' changed to '-' and
* '_'. This table is used when BASE64_URL is specified.
*/
private static final char[] toBase64URL = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'
};
private static final int MIMELINEMAX = 76;
private static final byte[] CRLF = new byte[]{'\r', '\n'};
static final Encoder RFC4648 = new Encoder(false, null, -1, true);
static final Encoder RFC4648_URLSAFE = new Encoder(true, null, -1, true);
static final Encoder RFC2045 = new Encoder(false, CRLF, MIMELINEMAX, true);
private final int outLength(int srclen) {
int len = 0;
if (doPadding) {
len = 4 * ((srclen + 2) / 3);
} else {
int n = srclen % 3;
len = 4 * (srclen / 3) + (n == 0 ? 0 : n + 1);
}
if (linemax > 0) // line separators
len += (len - 1) / linemax * newline.length;
return len;
}
/**
* Encodes all bytes from the specified byte array into a newly-allocated
* byte array using the {@link SobotBase64} encoding scheme. The returned byte
* array is of the length of the resulting bytes.
*
* @param src the byte array to encode
* @return A newly-allocated byte array containing the resulting
* encoded bytes.
*/
public byte[] encode(byte[] src) {
int len = outLength(src.length); // dst array size
byte[] dst = new byte[len];
int ret = encode0(src, 0, src.length, dst);
if (ret != dst.length)
return Arrays.copyOf(dst, ret);
return dst;
}
/**
* Encodes all bytes from the specified byte array using the
* {@link SobotBase64} encoding scheme, writing the resulting bytes to the
* given output byte array, starting at offset 0.
*
* <p> It is the responsibility of the invoker of this method to make
* sure the output byte array {@code dst} has enough space for encoding
* all bytes from the input byte array. No bytes will be written to the
* output byte array if the output byte array is not big enough.
*
* @param src the byte array to encode
* @param dst the output byte array
* @return The number of bytes written to the output byte array
* @throws IllegalArgumentException if {@code dst} does not have enough
* space for encoding all input bytes.
*/
public int encode(byte[] src, byte[] dst) {
int len = outLength(src.length); // dst array size
if (dst.length < len)
throw new IllegalArgumentException(
"Output byte array is too small for encoding all input bytes");
return encode0(src, 0, src.length, dst);
}
/**
* Encodes the specified byte array into a String using the {@link SobotBase64}
* encoding scheme.
*
* <p> This method first encodes all input bytes into a SobotBase64Util encoded
* byte array and then constructs a new String by using the encoded byte
* array and the {@link java.nio.charset.StandardCharsets#ISO_8859_1
* ISO-8859-1} charset.
*
* <p> In other words, an invocation of this method has exactly the same
* effect as invoking
* {@code new String(encode(src), StandardCharsets.ISO_8859_1)}.
*
* @param src the byte array to encode
* @return A String containing the resulting SobotBase64Util encoded characters
*/
@SuppressWarnings("deprecation")
public String encodeToString(byte[] src) {
byte[] encoded = encode(src);
return new String(encoded, 0, 0, encoded.length);
}
/**
* Encodes all remaining bytes from the specified byte buffer into
* a newly-allocated ByteBuffer using the {@link SobotBase64} encoding
* scheme.
* <p>
* Upon return, the source buffer's position will be updated to
* its limit; its limit will not have been changed. The returned
* output buffer's position will be zero and its limit will be the
* number of resulting encoded bytes.
*
* @param buffer the source ByteBuffer to encode
* @return A newly-allocated byte buffer containing the encoded bytes.
*/
public ByteBuffer encode(ByteBuffer buffer) {
int len = outLength(buffer.remaining());
byte[] dst = new byte[len];
int ret = 0;
if (buffer.hasArray()) {
ret = encode0(buffer.array(),
buffer.arrayOffset() + buffer.position(),
buffer.arrayOffset() + buffer.limit(),
dst);
buffer.position(buffer.limit());
} else {
byte[] src = new byte[buffer.remaining()];
buffer.get(src);
ret = encode0(src, 0, src.length, dst);
}
if (ret != dst.length)
dst = Arrays.copyOf(dst, ret);
return ByteBuffer.wrap(dst);
}
/**
* Returns an encoder instance that encodes equivalently to this one,
* but without adding any padding character at the end of the encoded
* byte data.
*
* <p> The encoding scheme of this encoder instance is unaffected by
* this invocation. The returned encoder instance should be used for
* non-padding encoding operation.
*
* @return an equivalent encoder that encodes without adding any
* padding character at the end
*/
public Encoder withoutPadding() {
if (!doPadding)
return this;
return new Encoder(isURL, newline, linemax, false);
}
private int encode0(byte[] src, int off, int end, byte[] dst) {
char[] SobotBase64Util = isURL ? toBase64URL : toBase64;
int sp = off;
int slen = (end - off) / 3 * 3;
int sl = off + slen;
if (linemax > 0 && slen > linemax / 4 * 3)
slen = linemax / 4 * 3;
int dp = 0;
while (sp < sl) {
int sl0 = Math.min(sp + slen, sl);
for (int sp0 = sp, dp0 = dp; sp0 < sl0; ) {
int bits = (src[sp0++] & 0xff) << 16 |
(src[sp0++] & 0xff) << 8 |
(src[sp0++] & 0xff);
dst[dp0++] = (byte) SobotBase64Util[(bits >>> 18) & 0x3f];
dst[dp0++] = (byte) SobotBase64Util[(bits >>> 12) & 0x3f];
dst[dp0++] = (byte) SobotBase64Util[(bits >>> 6) & 0x3f];
dst[dp0++] = (byte) SobotBase64Util[bits & 0x3f];
}
int dlen = (sl0 - sp) / 3 * 4;
dp += dlen;
sp = sl0;
if (dlen == linemax && sp < end) {
for (byte b : newline) {
dst[dp++] = b;
}
}
}
if (sp < end) { // 1 or 2 leftover bytes
int b0 = src[sp++] & 0xff;
dst[dp++] = (byte) SobotBase64Util[b0 >> 2];
if (sp == end) {
dst[dp++] = (byte) SobotBase64Util[(b0 << 4) & 0x3f];
if (doPadding) {
dst[dp++] = '=';
dst[dp++] = '=';
}
} else {
int b1 = src[sp++] & 0xff;
dst[dp++] = (byte) SobotBase64Util[(b0 << 4) & 0x3f | (b1 >> 4)];
dst[dp++] = (byte) SobotBase64Util[(b1 << 2) & 0x3f];
if (doPadding) {
dst[dp++] = '=';
}
}
}
return dp;
}
}
/**
* This class implements a decoder for decoding byte data using the
* SobotBase64Util encoding scheme as specified in RFC 4648 and RFC 2045.
*
* <p> The SobotBase64Util padding character {@code '='} is accepted and
* interpreted as the end of the encoded byte data, but is not
* required. So if the final unit of the encoded byte data only has
* two or three SobotBase64Util characters (without the corresponding padding
* character(s) padded), they are decoded as if followed by padding
* character(s). If there is a padding character present in the
* final unit, the correct number of padding character(s) must be
* present, otherwise {@code IllegalArgumentException} (
* {@code IOException} when reading from a SobotBase64Util stream) is thrown
* during decoding.
*
* <p> Instances of {@link Decoder} class are safe for use by
* multiple concurrent threads.
*
* <p> Unless otherwise noted, passing a {@code null} argument to
* a method of this class will cause a
* {@link NullPointerException NullPointerException} to
* be thrown.
*
* @see Encoder
* @since 1.8
*/
public static class Decoder {
private final boolean isURL;
private final boolean isMIME;
private Decoder(boolean isURL, boolean isMIME) {
this.isURL = isURL;
this.isMIME = isMIME;
}
/**
* Lookup table for decoding unicode characters drawn from the
* "SobotBase64Util Alphabet" (as specified in Table 1 of RFC 2045) into
* their 6-bit positive integer equivalents. Characters that
* are not in the SobotBase64Util alphabet but fall within the bounds of
* the array are encoded to -1.
*/
private static final int[] fromBase64 = new int[256];
static {
Arrays.fill(fromBase64, -1);
for (int i = 0; i < Encoder.toBase64.length; i++)
fromBase64[Encoder.toBase64[i]] = i;
fromBase64['='] = -2;
}
/**
* Lookup table for decoding "URL and Filename safe SobotBase64Util Alphabet"
* as specified in Table2 of the RFC 4648.
*/
private static final int[] fromBase64URL = new int[256];
static {
Arrays.fill(fromBase64URL, -1);
for (int i = 0; i < Encoder.toBase64URL.length; i++)
fromBase64URL[Encoder.toBase64URL[i]] = i;
fromBase64URL['='] = -2;
}
static final Decoder RFC4648 = new Decoder(false, false);
static final Decoder RFC4648_URLSAFE = new Decoder(true, false);
static final Decoder RFC2045 = new Decoder(false, true);
/**
* Decodes all bytes from the input byte array using the {@link SobotBase64}
* encoding scheme, writing the results into a newly-allocated output
* byte array. The returned byte array is of the length of the resulting
* bytes.
*
* @param src the byte array to decode
* @return A newly-allocated byte array containing the decoded bytes.
* @throws IllegalArgumentException if {@code src} is not in valid SobotBase64Util scheme
*/
public byte[] decode(byte[] src) {
byte[] dst = new byte[outLength(src, 0, src.length)];
int ret = decode0(src, 0, src.length, dst);
if (ret != dst.length) {
dst = Arrays.copyOf(dst, ret);
}
return dst;
}
/**
* Decodes all bytes from the input byte array using the {@link SobotBase64}
* encoding scheme, writing the results into the given output byte array,
* starting at offset 0.
*
* <p> It is the responsibility of the invoker of this method to make
* sure the output byte array {@code dst} has enough space for decoding
* all bytes from the input byte array. No bytes will be be written to
* the output byte array if the output byte array is not big enough.
*
* <p> If the input byte array is not in valid SobotBase64Util encoding scheme
* then some bytes may have been written to the output byte array before
* IllegalargumentException is thrown.
*
* @param src the byte array to decode
* @param dst the output byte array
* @return The number of bytes written to the output byte array
* @throws IllegalArgumentException if {@code src} is not in valid SobotBase64Util scheme, or {@code dst}
* does not have enough space for decoding all input bytes.
*/
public int decode(byte[] src, byte[] dst) {
int len = outLength(src, 0, src.length);
if (dst.length < len)
throw new IllegalArgumentException(
"Output byte array is too small for decoding all input bytes");
return decode0(src, 0, src.length, dst);
}
/**
* Decodes all bytes from the input byte buffer using the {@link SobotBase64}
* encoding scheme, writing the results into a newly-allocated ByteBuffer.
*
* <p> Upon return, the source buffer's position will be updated to
* its limit; its limit will not have been changed. The returned
* output buffer's position will be zero and its limit will be the
* number of resulting decoded bytes
*
* <p> {@code IllegalArgumentException} is thrown if the input buffer
* is not in valid SobotBase64Util encoding scheme. The position of the input
* buffer will not be advanced in this case.
*
* @param buffer the ByteBuffer to decode
* @return A newly-allocated byte buffer containing the decoded bytes
* @throws IllegalArgumentException if {@code src} is not in valid SobotBase64Util scheme.
*/
public ByteBuffer decode(ByteBuffer buffer) {
int pos0 = buffer.position();
try {
byte[] src;
int sp, sl;
if (buffer.hasArray()) {
src = buffer.array();
sp = buffer.arrayOffset() + buffer.position();
sl = buffer.arrayOffset() + buffer.limit();
buffer.position(buffer.limit());
} else {
src = new byte[buffer.remaining()];
buffer.get(src);
sp = 0;
sl = src.length;
}
byte[] dst = new byte[outLength(src, sp, sl)];
return ByteBuffer.wrap(dst, 0, decode0(src, sp, sl, dst));
} catch (IllegalArgumentException iae) {
buffer.position(pos0);
throw iae;
}
}
private int outLength(byte[] src, int sp, int sl) {
int[] SobotBase64Util = isURL ? fromBase64URL : fromBase64;
int paddings = 0;
int len = sl - sp;
if (len == 0)
return 0;
if (len < 2) {
if (isMIME && SobotBase64Util[0] == -1)
return 0;
throw new IllegalArgumentException(
"Input byte[] should at least have 2 bytes for SobotBase64Util bytes");
}
if (isMIME) {
// scan all bytes to fill out all non-alphabet. a performance
// trade-off of pre-scan or Arrays.copyOf
int n = 0;
while (sp < sl) {
int b = src[sp++] & 0xff;
if (b == '=') {
len -= (sl - sp + 1);
break;
}
if ((b = SobotBase64Util[b]) == -1)
n++;
}
len -= n;
} else {
if (src[sl - 1] == '=') {
paddings++;
if (src[sl - 2] == '=')
paddings++;
}
}
if (paddings == 0 && (len & 0x3) != 0)
paddings = 4 - (len & 0x3);
return 3 * ((len + 3) / 4) - paddings;
}
private int decode0(byte[] src, int sp, int sl, byte[] dst) {
int[] SobotBase64Util = isURL ? fromBase64URL : fromBase64;
int dp = 0;
int bits = 0;
int shiftto = 18; // pos of first byte of 4-byte atom
while (sp < sl) {
int b = src[sp++] & 0xff;
if ((b = SobotBase64Util[b]) < 0) {
if (b == -2) { // padding byte '='
// = shiftto==18 unnecessary padding
// x= shiftto==12 a dangling single x
// x to be handled together with non-padding case
// xx= shiftto==6&&sp==sl missing last =
// xx=y shiftto==6 last is not =
if (shiftto == 6 && (sp == sl || src[sp++] != '=') ||
shiftto == 18) {
throw new IllegalArgumentException(
"Input byte array has wrong 4-byte ending unit");
}
break;
}
if (isMIME) // skip if for rfc2045
continue;
else
throw new IllegalArgumentException(
"Illegal SobotBase64Util character " +
Integer.toString(src[sp - 1], 16));
}
bits |= (b << shiftto);
shiftto -= 6;
if (shiftto < 0) {
dst[dp++] = (byte) (bits >> 16);
dst[dp++] = (byte) (bits >> 8);
dst[dp++] = (byte) (bits);
shiftto = 18;
bits = 0;
}
}
// reached end of byte array or hit padding '=' characters.
if (shiftto == 6) {
dst[dp++] = (byte) (bits >> 16);
} else if (shiftto == 0) {
dst[dp++] = (byte) (bits >> 16);
dst[dp++] = (byte) (bits >> 8);
} else if (shiftto == 12) {
// dangling single "x", incorrectly encoded.
throw new IllegalArgumentException(
"Last unit does not have enough valid bits");
}
// anything left is invalid, if is not MIME.
// if MIME, ignore all non-SobotBase64Util character
while (sp < sl) {
if (isMIME && SobotBase64Util[src[sp++]] < 0)
continue;
throw new IllegalArgumentException(
"Input byte array has incorrect ending byte at " + sp);
}
return dp;
}
}
/*
* An output stream for encoding bytes into the SobotBase64Util.
*/
private static class EncOutputStream extends FilterOutputStream {
private int leftover = 0;
private int b0, b1, b2;
private boolean closed = false;
private final char[] SobotBase64Util; // byte->SobotBase64Util mapping
private final byte[] newline; // line separator, if needed
private final int linemax;
private final boolean doPadding;// whether or not to pad
private int linepos = 0;
EncOutputStream(OutputStream os, char[] SobotBase64Util,
byte[] newline, int linemax, boolean doPadding) {
super(os);
this.SobotBase64Util = SobotBase64Util;
this.newline = newline;
this.linemax = linemax;
this.doPadding = doPadding;
}
@Override
public void write(int b) throws IOException {
byte[] buf = new byte[1];
buf[0] = (byte) (b & 0xff);
write(buf, 0, 1);
}
private void checkNewline() throws IOException {
if (linepos == linemax) {
out.write(newline);
linepos = 0;
}
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
if (closed)
throw new IOException("Stream is closed");
// Android-changed: Upstream fix to avoid overflow.
// This upstream fix is from beyond OpenJDK8u121-b13. http://b/62368386
// if (off < 0 || len < 0 || off + len > b.length)
if (off < 0 || len < 0 || len > b.length - off)
throw new ArrayIndexOutOfBoundsException();
if (len == 0)
return;
if (leftover != 0) {
if (leftover == 1) {
b1 = b[off++] & 0xff;
len--;
if (len == 0) {
leftover++;
return;
}
}
b2 = b[off++] & 0xff;
len--;
checkNewline();
out.write(SobotBase64Util[b0 >> 2]);
out.write(SobotBase64Util[(b0 << 4) & 0x3f | (b1 >> 4)]);
out.write(SobotBase64Util[(b1 << 2) & 0x3f | (b2 >> 6)]);
out.write(SobotBase64Util[b2 & 0x3f]);
linepos += 4;
}
int nBits24 = len / 3;
leftover = len - (nBits24 * 3);
while (nBits24-- > 0) {
checkNewline();
int bits = (b[off++] & 0xff) << 16 |
(b[off++] & 0xff) << 8 |
(b[off++] & 0xff);
out.write(SobotBase64Util[(bits >>> 18) & 0x3f]);
out.write(SobotBase64Util[(bits >>> 12) & 0x3f]);
out.write(SobotBase64Util[(bits >>> 6) & 0x3f]);
out.write(SobotBase64Util[bits & 0x3f]);
linepos += 4;
}
if (leftover == 1) {
b0 = b[off++] & 0xff;
} else if (leftover == 2) {
b0 = b[off++] & 0xff;
b1 = b[off++] & 0xff;
}
}
@Override
public void close() throws IOException {
if (!closed) {
closed = true;
if (leftover == 1) {
checkNewline();
out.write(SobotBase64Util[b0 >> 2]);
out.write(SobotBase64Util[(b0 << 4) & 0x3f]);
if (doPadding) {
out.write('=');
out.write('=');
}
} else if (leftover == 2) {
checkNewline();
out.write(SobotBase64Util[b0 >> 2]);
out.write(SobotBase64Util[(b0 << 4) & 0x3f | (b1 >> 4)]);
out.write(SobotBase64Util[(b1 << 2) & 0x3f]);
if (doPadding) {
out.write('=');
}
}
leftover = 0;
out.close();
}
}
}
/*
* An input stream for decoding SobotBase64Util bytes
*/
private static class DecInputStream extends InputStream {
private final InputStream is;
private final boolean isMIME;
private final int[] SobotBase64Util; // SobotBase64Util -> byte mapping
private int bits = 0; // 24-bit buffer for decoding
private int nextin = 18; // next available "off" in "bits" for input;
// -> 18, 12, 6, 0
private int nextout = -8; // next available "off" in "bits" for output;
// -> 8, 0, -8 (no byte for output)
private boolean eof = false;
private boolean closed = false;
DecInputStream(InputStream is, int[] SobotBase64Util, boolean isMIME) {
this.is = is;
this.SobotBase64Util = SobotBase64Util;
this.isMIME = isMIME;
}
private byte[] sbBuf = new byte[1];
@Override
public int read() throws IOException {
return read(sbBuf, 0, 1) == -1 ? -1 : sbBuf[0] & 0xff;
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
if (closed)
throw new IOException("Stream is closed");
if (eof && nextout < 0) // eof and no leftover
return -1;
if (off < 0 || len < 0 || len > b.length - off)
throw new IndexOutOfBoundsException();
int oldOff = off;
if (nextout >= 0) { // leftover output byte(s) in bits buf
do {
if (len == 0)
return off - oldOff;
b[off++] = (byte) (bits >> nextout);
len--;
nextout -= 8;
} while (nextout >= 0);
bits = 0;
}
while (len > 0) {
int v = is.read();
if (v == -1) {
eof = true;
if (nextin != 18) {
if (nextin == 12)
throw new IOException("SobotBase64Util stream has one un-decoded dangling byte.");
// treat ending xx/xxx without padding character legal.
// same logic as v == '=' below
b[off++] = (byte) (bits >> (16));
len--;
if (nextin == 0) { // only one padding byte
if (len == 0) { // no enough output space
bits >>= 8; // shift to lowest byte
nextout = 0;
} else {
b[off++] = (byte) (bits >> 8);
}
}
}
if (off == oldOff)
return -1;
else
return off - oldOff;
}
if (v == '=') { // padding byte(s)
// = shiftto==18 unnecessary padding
// x= shiftto==12 dangling x, invalid unit
// xx= shiftto==6 && missing last '='
// xx=y or last is not '='
if (nextin == 18 || nextin == 12 ||
nextin == 6 && is.read() != '=') {
throw new IOException("Illegal SobotBase64Util ending sequence:" + nextin);
}
b[off++] = (byte) (bits >> (16));
len--;
if (nextin == 0) { // only one padding byte
if (len == 0) { // no enough output space
bits >>= 8; // shift to lowest byte
nextout = 0;
} else {
b[off++] = (byte) (bits >> 8);
}
}
eof = true;
break;
}
if ((v = SobotBase64Util[v]) == -1) {
if (isMIME) // skip if for rfc2045
continue;
else
throw new IOException("Illegal SobotBase64Util character " +
Integer.toString(v, 16));
}
bits |= (v << nextin);
if (nextin == 0) {
nextin = 18; // clear for next
nextout = 16;
while (nextout >= 0) {
b[off++] = (byte) (bits >> nextout);
len--;
nextout -= 8;
if (len == 0 && nextout >= 0) { // don't clean "bits"
return off - oldOff;
}
}
bits = 0;
} else {
nextin -= 6;
}
}
return off - oldOff;
}
@Override
public int available() throws IOException {
if (closed)
throw new IOException("Stream is closed");
return is.available(); // TBD:
}
@Override
public void close() throws IOException {
if (!closed) {
closed = true;
is.close();
}
}
}
}
package com.sobot.common.utils;
import android.app.Application;
import android.content.res.Resources;
import com.sobot.common.ui.SobotMarkConfig;
import com.sobot.network.apiUtils.SobotHttpUtils;
import com.sobot.network.http.log.SobotNetLogUtils;
import com.sobot.utils.SobotLogUtils;
......@@ -44,34 +42,4 @@ public class SobotCommonApi {
SobotLogUtils.setShowDebug(isDebug);
SobotNetLogUtils.setShowDebug(true);
}
/**
* 获取开关状态
*
* @param markConfig 开关名
* @return
* @see SobotMarkConfig 取值
*/
public static boolean getSwitchMarkStatus(int markConfig) {
if ((markConfig & (markConfig - 1)) == 0)
return SobotMarkConfig.getON_OFF(markConfig);
else {
throw new Resources.NotFoundException("markConfig 必须为2的指数次幂");
}
}
/**
* 设置开关状态
*
* @param markConfig 开关名 必须为 2 的非负数整数次幂
* @param isOn
* @see SobotMarkConfig 取值
*/
public static void setSwitchMarkStatus(int markConfig, boolean isOn) {
if ((markConfig & (markConfig - 1)) == 0)
SobotMarkConfig.setON_OFF(markConfig, isOn);
else {
throw new Resources.NotFoundException("markConfig 必须为2的指数次幂");
}
}
}
package com.sobot.common.utils;
import com.sobot.utils.SobotStringUtils;
//加密工具类
public class SobotEncryptionUtil {
// Base64加密
public static String encode(String str) {
if (SobotStringUtils.isEmpty(str)) {
return "";
}
byte[] encodeBytes = SobotBase64.getMimeEncoder().encode(str.getBytes());
return new String(encodeBytes);
}
// Base64解密
public static String decode(String str) {
if (SobotStringUtils.isEmpty(str)) {
return "";
}
byte[] decodeBytes = SobotBase64.getMimeDecoder().decode(str.getBytes());
return new String(decodeBytes);
}
}
\ No newline at end of file
......@@ -12,9 +12,6 @@ import java.util.Stack;
/**
* @Description: 全局上下文
* @Author: znw
* @Date: 2021/7/19 下午2:17
* @Version: 1.0
*/
public class SobotGlobalContext {
private Context mApplicationContext;
......
......@@ -3,7 +3,6 @@ package com.sobot.common.utils;
import android.content.Context;
import android.graphics.Color;
import android.os.Environment;
import android.support.v4.content.ContextCompat;
import java.io.BufferedReader;
import java.io.FileInputStream;
......@@ -33,10 +32,6 @@ public class SobotResourceUtils {
return getIdByName(context, "color", name);
}
public static int getResColorValue(Context context, String name) {
return ContextCompat.getColor(context, getResColorId(context, name));
}
public static int getDrawableId(Context context, String name) {
return SobotResourceUtils.getIdByName(context, "drawable", name);
}
......@@ -86,7 +81,7 @@ public class SobotResourceUtils {
FileInputStream fis = null;
try {
fis = new FileInputStream(filePathName);
InputStreamReader reader = new InputStreamReader(fis,"UTF-8");
InputStreamReader reader = new InputStreamReader(fis, "UTF-8");
BufferedReader br = new BufferedReader(reader);
String line;
while ((line = br.readLine()) != null) {
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sobot_no_permission_text">You are not authorized to do so</string>
<string name="sobot_go_setting">To set up</string>
<string name="sobot_btn_submit">Submit</string>
<string name="sobot_btn_cancle">Cancel</string>
<string name="sobot_no_write_external_storage_permission">No write external storage permission</string>
<string name="sobot_no_record_audio_permission">Unable to record</string>
<string name="sobot_no_camera_permission">No camera permission</string>
<string name="sobot_want_use_your"> want to visit yours </string>
<string name="sobot_memory_card">File</string>
<string name="sobot_memory_card_yongtu">You can send pictures, videos and files to describe the problem when you consult customer service and leave a message</string>
<string name="sobot_camera">Camera</string>
<string name="sobot_camera_yongtu">You can send photos and videos for help when consulting customer service and leaving a message</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--通用 颜色-->
<!--白色-->
<color name="sobot_white">#FFFFFF</color>
<!--绿色-->
<color name="sobot_common_green">#0DAEAF</color>
<!--主要文本色 大部分界面里的黑色文字-->
<color name="sobot_common_gray1">#D1D1D6</color>
<!--次要文本色-->
<color name="sobot_common_gray2">#7C7C80</color>
<!--占位文本色-->
<color name="sobot_common_gray3">#7C7C80</color>
<!--一级背景色-->
<color name="sobot_common_gray6">#1B1B1C</color>
<!--二级背景色-->
<color name="sobot_common_gray7">#262628</color>
<!-- 主题色 默认绿色 -->
<color name="sobot_color">@color/sobot_common_green</color>
<!--文字颜色 绿色变白色-->
<color name="sobot_common_wenzi_green_white">@color/sobot_color</color>
<!--线条分割线颜色-->
<color name="sobot_common_line_gray">#272729</color>
<!-- 头部开始 -->
<!-- 头部背景 -->
<color name="sobot_color_title_bar_bg">@color/sobot_white</color>
<!-- 状态栏的颜色设置 -->
<color name="sobot_status_bar_color">@color/sobot_color_title_bar_bg</color>
<!-- 头部中间昵称颜色 -->
<color name="sobot_color_title_bar_title">@color/sobot_common_gray1</color>
<!-- 头部两侧菜单字体颜色 -->
<color name="sobot_color_title_bar_menu_text">@color/sobot_common_gray1</color>
<!--头部头像边框颜色-->
<color name="sobot_color_title_bar_avatar_line">#EDEEF0</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--圆形-->
<attr name="sobot_round_as_circle" format="boolean" />
<!--全部圆角半径-->
<attr name="sobot_round_corner" format="integer|dimension" />
<!--针对各个角的半径-->
<attr name="sobot_round_corner_top_left" format="integer|dimension" />
<attr name="sobot_round_corner_top_right" format="integer|dimension" />
<attr name="sobot_round_corner_bottom_left" format="integer|dimension" />
<attr name="sobot_round_corner_bottom_right" format="integer|dimension" />
<!--描边颜色/半径-->
<attr name="sobot_stroke_color" format="color|reference" />
<attr name="sobot_stroke_width" format="integer|dimension" />
<!-- 是否剪裁 RCLayout 的背景 -->
<attr name="sobot_clip_background" format="boolean" />
<!--真正用于解析的属性-->
<declare-styleable name="SobotRCAttrs">
<attr name="sobot_round_as_circle" />
<attr name="sobot_round_corner" />
<attr name="sobot_round_corner_top_left" />
<attr name="sobot_round_corner_top_right" />
<attr name="sobot_round_corner_bottom_left" />
<attr name="sobot_round_corner_bottom_right" />
<attr name="sobot_stroke_color" />
<attr name="sobot_stroke_width" />
<attr name="sobot_clip_background" />
</declare-styleable>
<!--假体:用于提示-->
<declare-styleable name="sobot_RCRelativeLayout">
<attr name="sobot_round_as_circle" />
<attr name="sobot_round_corner" />
<attr name="sobot_round_corner_top_left" />
<attr name="sobot_round_corner_top_right" />
<attr name="sobot_round_corner_bottom_left" />
<attr name="sobot_round_corner_bottom_right" />
<attr name="sobot_stroke_color" />
<attr name="sobot_stroke_width" />
<attr name="sobot_clip_background" />
</declare-styleable>
<declare-styleable name="sobot_RCImageView">
<attr name="sobot_round_as_circle" />
<attr name="sobot_round_corner" />
<attr name="sobot_round_corner_top_left" />
<attr name="sobot_round_corner_top_right" />
<attr name="sobot_round_corner_bottom_left" />
<attr name="sobot_round_corner_bottom_right" />
<attr name="sobot_stroke_color" />
<attr name="sobot_stroke_width" />
<attr name="sobot_clip_background" />
</declare-styleable>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--通用 颜色-->
<!--白色-->
<color name="sobot_white">#FFFFFF</color>
<!--绿色-->
<color name="sobot_common_green">#0DAEAF</color>
<!--主要文本色 大部分界面里的黑色文字-->
<color name="sobot_common_gray1">#515A7C</color>
<!--次要文本色-->
<color name="sobot_common_gray2">#ACB5C4</color>
<!--占位文本色-->
<color name="sobot_common_gray3">#DDE0E6</color>
<!--一级背景色-->
<color name="sobot_common_gray6">#FFFFFF</color>
<!--二级背景色-->
<color name="sobot_common_gray7">#FFF2F5F7</color>
<!-- 主题色 默认绿色 -->
<color name="sobot_color">@color/sobot_common_green</color>
<!--文字颜色 绿色变白色-->
<color name="sobot_common_wenzi_green_white">@color/sobot_color</color>
<!--线条分割线颜色-->
<color name="sobot_common_line_gray">#EDEEF0</color>
<!-- 头部开始 -->
<!-- 头部背景 -->
<color name="sobot_color_title_bar_bg">@color/sobot_white</color>
<!-- 状态栏的颜色设置 -->
<color name="sobot_status_bar_color">@color/sobot_color_title_bar_bg</color>
<!-- 头部中间昵称颜色 -->
<color name="sobot_color_title_bar_title">@color/sobot_common_gray1</color>
<!-- 头部两侧菜单字体颜色 -->
<color name="sobot_color_title_bar_menu_text">@color/sobot_common_gray1</color>
<!--头部头像边框颜色-->
<color name="sobot_color_title_bar_avatar_line">#EDEEF0</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sobot_no_permission_text">您还没有授权相关权限</string>
<string name="sobot_go_setting">去设置</string>
<string name="sobot_btn_cancle">取消</string>
<string name="sobot_btn_submit">确定</string>
<string name="sobot_no_write_external_storage_permission">没有存储权限</string>
<string name="sobot_no_record_audio_permission">没有麦克风权限</string>
<string name="sobot_no_camera_permission">没有相机权限</string>
<string name="sobot_want_use_your">想访问您的</string>
<string name="sobot_memory_card">文件</string>
<string name="sobot_memory_card_yongtu">您可以在咨询客服和留言时,发送图片、视频、文件描述问题</string>
<string name="sobot_camera">相机</string>
<string name="sobot_camera_yongtu">您可以在咨询客服和留言时,发送拍摄的照片和视频获取帮助</string>
</resources>
\ No newline at end of file
......@@ -45,6 +45,7 @@ public class HttpBaseUtils {
final StringCallBack callback) {
SobotNetLogUtils.i("请求URL: --> " + url_str);
SobotNetLogUtils.i("请求参数: --> " + paramMap);
SobotNetLogUtils.i("请求头参数: --> " + headerMap);
if (headerMap == null) {
headerMap = new HashMap<>();
}
......@@ -104,6 +105,7 @@ public class HttpBaseUtils {
SobotNetLogUtils.i("请求URL: --> " + url_str);
SobotNetLogUtils.i("请求参数: --> " + paramMap);
SobotNetLogUtils.i("请求头参数: --> " + headerMap);
if (headerMap == null) {
headerMap = new HashMap<>();
}
......@@ -162,6 +164,7 @@ public class HttpBaseUtils {
final StringCallBack callback) {
SobotNetLogUtils.i("请求URL: --> " + url_str);
SobotNetLogUtils.i("请求参数: --> " + paramMap);
SobotNetLogUtils.i("请求头参数: --> " + headerMap);
if (headerMap == null) {
headerMap = new HashMap<>();
}
......@@ -230,6 +233,7 @@ public class HttpBaseUtils {
final StringCallBack callback) {
SobotNetLogUtils.i("请求URL: --> " + url_str);
SobotNetLogUtils.i("请求参数: --> " + paramMap);
SobotNetLogUtils.i("请求头参数: --> " + headerMap);
if (headerMap == null) {
headerMap = new HashMap<>();
}
......@@ -323,6 +327,7 @@ public class HttpBaseUtils {
String path, final StringCallBack callback) {
SobotNetLogUtils.i("请求URL: --> " + url_str);
SobotNetLogUtils.i("请求参数: --> " + paramMap);
SobotNetLogUtils.i("请求头参数: --> " + headerMap);
SobotNetLogUtils.i("上传文件地址: --> " + path);
if (headerMap == null) {
headerMap = new HashMap<>();
......@@ -415,6 +420,7 @@ public class HttpBaseUtils {
String path, String imageFile) {
SobotNetLogUtils.i("上传文件 请求URL: --> " + url_str);
SobotNetLogUtils.i("上传文件 请求参数: --> " + paramMap);
SobotNetLogUtils.i("请求头参数: --> " + headerMap);
if (headerMap == null) {
headerMap = new HashMap<>();
}
......@@ -473,6 +479,7 @@ public class HttpBaseUtils {
url_str, Map<String, Object> paramMap, Map<String, String> headerMap) {
SobotNetLogUtils.i("请求URL: --> " + url_str);
SobotNetLogUtils.i("请求参数: --> " + paramMap);
SobotNetLogUtils.i("请求头参数: --> " + headerMap);
if (headerMap == null) {
headerMap = new HashMap<>();
}
......@@ -491,6 +498,7 @@ public class HttpBaseUtils {
IOException {
SobotNetLogUtils.i("请求URL: --> " + url_str);
SobotNetLogUtils.i("请求参数: --> " + paramMap);
SobotNetLogUtils.i("请求头参数: --> " + headerMap);
if (headerMap == null) {
headerMap = new HashMap<>();
}
......
......@@ -14,6 +14,7 @@ dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')
compileOnly 'com.android.support:appcompat-v7:28.0.0'
compileOnly 'com.android.support:recyclerview-v7:28.0.0'
api 'com.sobot.library:utils:1.1.1'
}
......
......@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'widget' //项目名
// PUBLISH_ARTIFACT_ID = 'widget_x' //项目名
PUBLISH_VERSION = '1.0' //版本号
PUBLISH_VERSION = '1.0.2' //版本号
}
......
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.sobot.widget">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sobot.widget">
<!-- 访问权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.apps.photos.permission.GOOGLE_PHOTOS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<application>
<provider
android:name=".ui.provider.SobotFileProvider"
android:authorities="${applicationId}.sobot_fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/sobot_provider_paths" />
</provider>
</application>
</manifest>
\ No newline at end of file
package com.sobot.widget;
import android.content.res.Resources;
import com.sobot.widget.ui.SobotMarkConfig;
public class SobotWidgetApi {
/**
* 获取开关状态
*
* @param markConfig 开关名
* @return
* @see SobotMarkConfig 取值
*/
public static boolean getSwitchMarkStatus(int markConfig) {
if ((markConfig & (markConfig - 1)) == 0)
return SobotMarkConfig.getON_OFF(markConfig);
else {
throw new Resources.NotFoundException("markConfig 必须为2的指数次幂");
}
}
/**
* 设置开关状态
*
* @param markConfig 开关名 必须为 2 的非负数整数次幂
* @param isOn
* @see SobotMarkConfig 取值
*/
public static void setSwitchMarkStatus(int markConfig, boolean isOn) {
if ((markConfig & (markConfig - 1)) == 0)
SobotMarkConfig.setON_OFF(markConfig, isOn);
else {
throw new Resources.NotFoundException("markConfig 必须为2的指数次幂");
}
}
}
package com.sobot.common.ui;
package com.sobot.widget.ui;
public class SobotBaseConstant {
//申请权限的code
......
package com.sobot.common.ui.base;
package com.sobot.widget.ui.base;
import android.Manifest;
import android.content.Context;
......@@ -24,22 +24,22 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.sobot.common.ui.SobotBaseConstant;
import com.sobot.common.ui.SobotMarkConfig;
import com.sobot.common.ui.image.SobotRCImageView;
import com.sobot.common.ui.notchlib.SobotINotchScreen;
import com.sobot.common.ui.notchlib.SobotNotchScreenManager;
import com.sobot.common.ui.permission.SobotPermissionListener;
import com.sobot.common.ui.permission.SobotPermissionListenerImpl;
import com.sobot.common.ui.permission.SobotPermissionTipDialog;
import com.sobot.common.ui.statusbar.SobotStatusBarUtils;
import com.sobot.common.utils.SobotCommonApi;
import com.sobot.common.utils.SobotCommonUtils;
import com.sobot.common.utils.SobotGlobalContext;
import com.sobot.common.utils.SobotResourceUtils;
import com.sobot.utils.SobotLogUtils;
import com.sobot.utils.SobotSharedPreferencesUtil;
import com.sobot.utils.SobotSystemUtils;
import com.sobot.widget.R;
import com.sobot.widget.SobotWidgetApi;
import com.sobot.widget.ui.SobotBaseConstant;
import com.sobot.widget.ui.SobotMarkConfig;
import com.sobot.widget.ui.image.SobotRCImageView;
import com.sobot.widget.ui.notchlib.SobotINotchScreen;
import com.sobot.widget.ui.notchlib.SobotNotchScreenManager;
import com.sobot.widget.ui.permission.SobotPermissionListener;
import com.sobot.widget.ui.permission.SobotPermissionListenerImpl;
import com.sobot.widget.ui.permission.SobotPermissionTipDialog;
import com.sobot.widget.ui.statusbar.SobotStatusBarUtils;
import com.sobot.widget.ui.utils.SobotResourceUtils;
import com.sobot.widget.ui.utils.SobotWidgetUtils;
import java.io.File;
import java.util.Locale;
......@@ -59,14 +59,14 @@ public abstract class SobotBaseActivity extends FragmentActivity {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O) {
if (!SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN)) {
if (!SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);//竖屏
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);//横屏
}
}
if (SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN) && SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH)) {
if (SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN) && SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH)) {
// 支持显示到刘海区域
SobotNotchScreenManager.getInstance().setDisplayInNotch(this);
// 设置Activity全屏
......@@ -84,7 +84,6 @@ public abstract class SobotBaseActivity extends FragmentActivity {
}
setUpToolBar();
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
SobotGlobalContext.getInstance(getSobotBaseActivity()).addActivity(this);
View toolBar = findViewById(getResId("sobot_layout_titlebar"));
if (toolBar != null) {
setUpToolBarLeftMenu();
......@@ -109,7 +108,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
}
public void displayInNotch(final View view) {
if (SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN) && SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH) && view != null) {
if (SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN) && SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH) && view != null) {
// 获取刘海屏信息
SobotNotchScreenManager.getInstance().getNotchInfo(this, new SobotINotchScreen.NotchScreenCallback() {
@Override
......@@ -286,7 +285,6 @@ public abstract class SobotBaseActivity extends FragmentActivity {
@Override
protected void onDestroy() {
SobotGlobalContext.getInstance(getSobotBaseActivity()).removeActivity(this);
super.onDestroy();
}
......@@ -333,7 +331,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
if (isShowAvatar) {
tmpAvatart.setVisibility(View.VISIBLE);
tmpAvatart.setRoundAsCircle(true);
tmpAvatart.setStrokeColor(SobotResourceUtils.getResColorValue(getSobotBaseActivity(), "sobot_color_title_bar_avatar_line"));
tmpAvatart.setStrokeColor(getResources().getColor(R.color.sobot_color_title_bar_avatar_line));
} else {
tmpAvatart.setVisibility(View.GONE);
}
......@@ -451,6 +449,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
return (getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN;
}
/**
* 检测是否需要弹出权限用途提示框pop,如果弹出,则拦截接下来的处理逻辑,自己处理
*
......@@ -460,7 +459,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
* @return
*/
public boolean checkIsShowPermissionPop(String title, String content, final int type) {
if (SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.SHOW_PERMISSION_TIPS_POP)) {
if (SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.SHOW_PERMISSION_TIPS_POP)) {
if (!isHasPermission(type)) {
SobotPermissionTipDialog dialog = new SobotPermissionTipDialog(getSobotBaseActivity(), title, content, new SobotPermissionTipDialog.ClickViewListener() {
@Override
......@@ -720,7 +719,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
sobotPermissionListener = new SobotPermissionListenerImpl() {
@Override
public void onPermissionSuccessListener() {
SobotCommonUtils.openSelectPic(getSobotBaseActivity());
SobotWidgetUtils.openSelectPic(getSobotBaseActivity());
}
};
if (checkIsShowPermissionPop(getResString("sobot_memory_card"), getResString("sobot_memory_card_yongtu"), 1)) {
......@@ -729,7 +728,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
if (!checkStoragePermission()) {
return;
}
SobotCommonUtils.openSelectPic(this);
SobotWidgetUtils.openSelectPic(this);
}
/**
......@@ -750,7 +749,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
sobotPermissionListener = new SobotPermissionListenerImpl() {
@Override
public void onPermissionSuccessListener() {
SobotCommonUtils.openSelectVedio(getSobotBaseActivity());
SobotWidgetUtils.openSelectVedio(getSobotBaseActivity());
}
};
if (checkIsShowPermissionPop(getResString("sobot_memory_card"), getResString("sobot_memory_card_yongtu"), 1)) {
......@@ -759,7 +758,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
if (!checkStoragePermission()) {
return;
}
SobotCommonUtils.openSelectVedio(getSobotBaseActivity());
SobotWidgetUtils.openSelectVedio(getSobotBaseActivity());
}
/**
......@@ -782,7 +781,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
@Override
public void onPermissionSuccessListener() {
if (isCameraCanUse()) {
cameraFile = SobotCommonUtils.openCamera(getSobotBaseActivity());
cameraFile = SobotWidgetUtils.openCamera(getSobotBaseActivity());
}
}
};
......@@ -793,7 +792,7 @@ public abstract class SobotBaseActivity extends FragmentActivity {
return;
}
if (isCameraCanUse()) {
cameraFile = SobotCommonUtils.openCamera(getSobotBaseActivity());
cameraFile = SobotWidgetUtils.openCamera(getSobotBaseActivity());
}
}
}
\ No newline at end of file
package com.sobot.common.ui.image;
package com.sobot.widget.ui.image;
public interface RCAttrs {
void setClipBackground(boolean clipBackground);
......
package com.sobot.common.ui.image;
package com.sobot.widget.ui.image;
import android.content.Context;
......@@ -19,7 +19,7 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import com.sobot.common.R;
import com.sobot.widget.R;
import java.util.ArrayList;
......
package com.sobot.common.ui.image;
package com.sobot.widget.ui.image;
import android.annotation.SuppressLint;
import android.content.Context;
......
package com.sobot.common.ui.image;
package com.sobot.widget.ui.image;
import android.content.Context;
import android.graphics.Canvas;
......
package com.sobot.common.ui.image.helper;
package com.sobot.widget.ui.image.helper;
public interface RCAttrs {
void setClipBackground(boolean clipBackground);
......
......@@ -20,7 +20,7 @@
* WebSite: http://www.gcssloop.com
*/
package com.sobot.common.ui.image.helper;
package com.sobot.widget.ui.image.helper;
import android.content.Context;
......@@ -40,7 +40,7 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import com.sobot.common.R;
import com.sobot.widget.R;
import java.util.ArrayList;
......
package com.sobot.common.ui.notchlib;
package com.sobot.widget.ui.notchlib;
import android.app.Activity;
import android.graphics.Rect;
......
package com.sobot.common.ui.notchlib;
package com.sobot.widget.ui.notchlib;
import android.app.Activity;
import android.graphics.Rect;
import android.os.Build;
import com.sobot.common.ui.notchlib.impl.AndroidPNotchScreen;
import com.sobot.common.ui.notchlib.impl.HuaweiNotchScreen;
import com.sobot.common.ui.notchlib.impl.MiNotchScreen;
import com.sobot.common.ui.notchlib.impl.OppoNotchScreen;
import com.sobot.common.ui.notchlib.impl.VivoNotchScreen;
import com.sobot.common.ui.notchlib.utils.RomUtils;
import com.sobot.widget.ui.notchlib.impl.AndroidPNotchScreen;
import com.sobot.widget.ui.notchlib.impl.HuaweiNotchScreen;
import com.sobot.widget.ui.notchlib.impl.MiNotchScreen;
import com.sobot.widget.ui.notchlib.impl.OppoNotchScreen;
import com.sobot.widget.ui.notchlib.impl.VivoNotchScreen;
import com.sobot.widget.ui.notchlib.utils.RomUtils;
import java.util.List;
......@@ -68,9 +68,8 @@ public class SobotNotchScreenManager {
private SobotINotchScreen getNotchScreen() {
SobotINotchScreen notchScreen = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
notchScreen = new AndroidPNotchScreen();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) notchScreen = new AndroidPNotchScreen();
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (RomUtils.isHuawei()) {
notchScreen = new HuaweiNotchScreen();
} else if (RomUtils.isOppo()) {
......
package com.sobot.common.ui.notchlib.impl;
package com.sobot.widget.ui.notchlib.impl;
import android.annotation.TargetApi;
import android.app.Activity;
......@@ -10,7 +10,7 @@ import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowManager;
import com.sobot.common.ui.notchlib.SobotINotchScreen;
import com.sobot.widget.ui.notchlib.SobotINotchScreen;
import java.util.List;
......
package com.sobot.common.ui.notchlib.impl;
package com.sobot.widget.ui.notchlib.impl;
import android.annotation.TargetApi;
import android.app.Activity;
......@@ -7,8 +7,8 @@ import android.os.Build;
import android.view.Window;
import android.view.WindowManager;
import com.sobot.common.ui.notchlib.SobotINotchScreen;
import com.sobot.common.ui.notchlib.utils.ScreenUtil;
import com.sobot.widget.ui.notchlib.SobotINotchScreen;
import com.sobot.widget.ui.notchlib.utils.ScreenUtil;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
......
package com.sobot.common.ui.notchlib.impl;
package com.sobot.widget.ui.notchlib.impl;
import android.annotation.TargetApi;
import android.app.Activity;
......@@ -7,8 +7,8 @@ import android.graphics.Rect;
import android.os.Build;
import android.view.Window;
import com.sobot.common.ui.notchlib.SobotINotchScreen;
import com.sobot.common.ui.notchlib.utils.ScreenUtil;
import com.sobot.widget.ui.notchlib.SobotINotchScreen;
import com.sobot.widget.ui.notchlib.utils.ScreenUtil;
import java.lang.reflect.Method;
import java.util.ArrayList;
......
package com.sobot.common.ui.notchlib.impl;
package com.sobot.widget.ui.notchlib.impl;
import android.annotation.TargetApi;
import android.app.Activity;
......@@ -6,8 +6,8 @@ import android.graphics.Rect;
import android.os.Build;
import android.text.TextUtils;
import com.sobot.common.ui.notchlib.SobotINotchScreen;
import com.sobot.common.ui.notchlib.utils.ScreenUtil;
import com.sobot.widget.ui.notchlib.SobotINotchScreen;
import com.sobot.widget.ui.notchlib.utils.ScreenUtil;
import java.lang.reflect.Method;
import java.util.ArrayList;
......
package com.sobot.common.ui.notchlib.impl;
package com.sobot.widget.ui.notchlib.impl;
import android.annotation.TargetApi;
import android.app.Activity;
......@@ -7,8 +7,8 @@ import android.graphics.Rect;
import android.os.Build;
import android.util.Log;
import com.sobot.common.ui.notchlib.SobotINotchScreen;
import com.sobot.common.ui.notchlib.utils.ScreenUtil;
import com.sobot.widget.ui.notchlib.SobotINotchScreen;
import com.sobot.widget.ui.notchlib.utils.ScreenUtil;
import java.lang.reflect.Method;
import java.util.ArrayList;
......
package com.sobot.common.ui.notchlib.utils;
package com.sobot.widget.ui.notchlib.utils;
import android.annotation.SuppressLint;
import android.os.Build;
......
package com.sobot.common.ui.notchlib.utils;
package com.sobot.widget.ui.notchlib.utils;
import android.app.Activity;
import android.content.Context;
......
package com.sobot.common.ui.permission;
package com.sobot.widget.ui.permission;
import android.app.Activity;
import android.app.Dialog;
......@@ -16,10 +16,11 @@ import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.sobot.common.ui.SobotMarkConfig;
import com.sobot.common.utils.SobotCommonApi;
import com.sobot.common.utils.SobotResourceUtils;
import com.sobot.utils.SobotDensityUtil;
import com.sobot.widget.R;
import com.sobot.widget.SobotWidgetApi;
import com.sobot.widget.ui.SobotMarkConfig;
import com.sobot.widget.ui.utils.SobotResourceUtils;
/**
* 权限提示框提示
......@@ -35,7 +36,7 @@ public class SobotPermissionDialog extends Dialog implements View.OnClickListene
private String title;
public SobotPermissionDialog(Activity context, ClickViewListener itemsOnClick) {
super(context, SobotResourceUtils.getIdByName(context, "style", "sobot_noAnimDialogStyle"));
super(context, R.style.sobot_noAnimDialogStyle);
this.viewListenern = itemsOnClick;
screenHeight = SobotDensityUtil.getScreenHeight(context);
......@@ -45,7 +46,7 @@ public class SobotPermissionDialog extends Dialog implements View.OnClickListene
WindowManager.LayoutParams layoutParams = window.getAttributes();
layoutParams.gravity = Gravity.CENTER;
//横屏设置dialog全屏
if (SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH) && SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN)) {
if (SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH) && SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN)) {
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
}
setParams(context, layoutParams);
......@@ -61,7 +62,7 @@ public class SobotPermissionDialog extends Dialog implements View.OnClickListene
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(SobotResourceUtils.getIdByName(getContext(), "layout", "sobot_common_permission_popup"));
setContentView(R.layout.sobot_common_permission_popup);
initView();
}
......
package com.sobot.common.ui.permission;
package com.sobot.widget.ui.permission;
import android.app.Activity;
import android.content.Context;
......
package com.sobot.common.ui.permission;
package com.sobot.widget.ui.permission;
import android.app.Activity;
import android.app.Dialog;
......@@ -16,11 +16,12 @@ import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.sobot.common.ui.SobotMarkConfig;
import com.sobot.common.utils.SobotCommonApi;
import com.sobot.common.utils.SobotCommonUtils;
import com.sobot.common.utils.SobotResourceUtils;
import com.sobot.utils.SobotDensityUtil;
import com.sobot.utils.SobotSystemUtils;
import com.sobot.widget.R;
import com.sobot.widget.SobotWidgetApi;
import com.sobot.widget.ui.SobotMarkConfig;
import com.sobot.widget.ui.utils.SobotResourceUtils;
/**
* 权限用途提示弹窗
......@@ -39,7 +40,7 @@ public class SobotPermissionTipDialog extends Dialog implements View.OnClickList
private String mContent;
public SobotPermissionTipDialog(Activity context, ClickViewListener itemsOnClick) {
super(context, SobotResourceUtils.getIdByName(context, "style", "sobot_noAnimDialogStyle"));
super(context, R.style.sobot_noAnimDialogStyle);
this.viewListenern = itemsOnClick;
screenHeight = SobotDensityUtil.getScreenHeight(context);
......@@ -49,7 +50,7 @@ public class SobotPermissionTipDialog extends Dialog implements View.OnClickList
WindowManager.LayoutParams layoutParams = window.getAttributes();
layoutParams.gravity = Gravity.CENTER;
//横屏设置dialog全屏
if (SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH) && SobotCommonApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN)) {
if (SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.DISPLAY_INNOTCH) && SobotWidgetApi.getSwitchMarkStatus(SobotMarkConfig.LANDSCAPE_SCREEN)) {
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
}
setParams(context, layoutParams);
......@@ -66,7 +67,7 @@ public class SobotPermissionTipDialog extends Dialog implements View.OnClickList
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(SobotResourceUtils.getIdByName(getContext(), "layout", "sobot_common_permission_purpose_tip_popup"));
setContentView(R.layout.sobot_common_permission_purpose_tip_popup);
initView();
}
......@@ -83,7 +84,7 @@ public class SobotPermissionTipDialog extends Dialog implements View.OnClickList
private void initView() {
titleView = (TextView) findViewById(SobotResourceUtils.getIdByName(getContext(), "id", "sobot_dialog_title"));
if (!TextUtils.isEmpty(title)) {
titleView.setText("\"" + SobotCommonUtils.getAppName(getContext()) + "\" " + SobotResourceUtils.getResString(getContext(), "sobot_want_use_your") + title);
titleView.setText("\"" + SobotSystemUtils.getAppName(getContext()) + "\" " + SobotResourceUtils.getResString(getContext(), "sobot_want_use_your") + title);
}
contentTV = (TextView) findViewById(SobotResourceUtils.getIdByName(getContext(), "id", "sobot_dialog_content"));
if (!TextUtils.isEmpty(mContent)) {
......
package com.sobot.common.ui.provider;
package com.sobot.widget.ui.provider;
import android.support.v4.content.FileProvider;
......
package com.sobot.common.ui.statusbar;
package com.sobot.widget.ui.statusbar;
import android.annotation.TargetApi;
import android.os.Build;
......
package com.sobot.common.ui.statusbar;
package com.sobot.widget.ui.statusbar;
import android.annotation.TargetApi;
import android.app.Activity;
......
package com.sobot.common.ui.statusbar;
package com.sobot.widget.ui.statusbar;
import android.annotation.TargetApi;
import android.os.Build;
......
package com.sobot.common.ui.statusbar;
package com.sobot.widget.ui.statusbar;
import android.annotation.TargetApi;
import android.os.Build;
......
package com.sobot.common.ui.statusbar;
package com.sobot.widget.ui.statusbar;
import android.annotation.TargetApi;
import android.os.Build;
......
package com.sobot.common.ui.statusbar;
package com.sobot.widget.ui.statusbar;
import android.content.Context;
import android.content.res.Resources;
......
package com.sobot.common.ui.statusbar;
package com.sobot.widget.ui.statusbar;
import android.content.Context;
import android.os.Build;
......
package com.sobot.common.ui.toast;
package com.sobot.widget.ui.toast;
import android.content.Context;
import android.view.Gravity;
......@@ -7,7 +7,8 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.sobot.common.utils.SobotResourceUtils;
import com.sobot.widget.ui.utils.SobotResourceUtils;
/**
* 自定义时长的Toast
......
package com.sobot.common.ui.toast;
package com.sobot.widget.ui.toast;
import android.content.Context;
import android.os.Handler;
......
package com.sobot.widget.ui.utils;
import android.content.Context;
import android.graphics.Color;
import android.os.Environment;
import android.support.v4.content.ContextCompat;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class SobotResourceUtils {
public static int getIdByName(Context context, String className,
String resName) {
context = context.getApplicationContext();
String packageName = context.getPackageName();
int indentify = context.getResources().getIdentifier(resName,
className, packageName);
return indentify;
}
public static int getResLayoutId(Context context, String name) {
return getIdByName(context, "layout", name);
}
public static int getResStrId(Context context, String name) {
return getIdByName(context, "string", name);
}
public static int getResColorId(Context context, String name) {
return getIdByName(context, "color", name);
}
public static int getResColorValue(Context context, String name) {
return ContextCompat.getColor(context, getResColorId(context, name));
}
public static int getDrawableId(Context context, String name) {
return SobotResourceUtils.getIdByName(context, "drawable", name);
}
public static String getResString(Context context, String name) {
return context.getResources().getString(getResStrId(context, name));
}
public static int getResId(Context context, String name) {
return SobotResourceUtils.getIdByName(context, "id", name);
}
//颜色id 转16进制颜色码
public static String getColorById(Context context, String name) {
if (context == null) {
return "";
}
StringBuffer stringBuffer = new StringBuffer();
int color = context.getResources().getColor(getResColorId(context, name));
stringBuffer.append("#");
stringBuffer.append(Integer.toHexString(Color.alpha(color)));
stringBuffer.append(Integer.toHexString(Color.red(color)));
stringBuffer.append(Integer.toHexString(Color.green(color)));
stringBuffer.append(Integer.toHexString(Color.blue(color)));
return stringBuffer.toString();
}
/**
* 从External文件目录下读取文件
*
* @param filePathName 要读取的文件的路径+文件名
* @return
* @throws IOException
*/
public static String readExternal(String filePathName) throws IOException {
StringBuffer stringBuffer = new StringBuffer();
// 获取External的可用状态
String storageState = Environment.getExternalStorageState();
if (storageState.equals(Environment.MEDIA_MOUNTED)) {
// 当External的可用状态为可用时
// 打开文件输入流
FileInputStream fis = null;
try {
fis = new FileInputStream(filePathName);
InputStreamReader reader = new InputStreamReader(fis,"UTF-8");
BufferedReader br = new BufferedReader(reader);
String line;
while ((line = br.readLine()) != null) {
stringBuffer.append(line);
}
br.close();
reader.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return stringBuffer.toString();
}
}
\ No newline at end of file
package com.sobot.common.utils;
package com.sobot.widget.ui.utils;
import android.app.Activity;
import android.content.ContentValues;
......@@ -8,17 +8,19 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.support.v4.content.FileProvider;
import com.sobot.common.ui.SobotBaseConstant;
import com.sobot.common.ui.toast.SobotToastUtil;
import com.sobot.utils.SobotIOUtils;
import com.sobot.widget.ui.SobotBaseConstant;
import com.sobot.widget.ui.toast.SobotToastUtil;
import java.io.File;
import java.security.MessageDigest;
public class SobotCommonUtils {
public class SobotWidgetUtils {
/**
* activity打开选择图片界面
......@@ -114,7 +116,7 @@ public class SobotCommonUtils {
* @return
*/
public static File openCamera(Activity act, Fragment childFragment) {
String path = SobotPathManager.getInstance().getPicDir() + System.currentTimeMillis() + ".jpg";
String path = getPicDir(act) + System.currentTimeMillis() + ".jpg";
// 创建图片文件存放的位置
File cameraFile = new File(path);
SobotIOUtils.createFolder(cameraFile.getParentFile());
......@@ -169,4 +171,48 @@ public class SobotCommonUtils {
}
return "";
}
private static final String PIC_DIR = "pic";
private static String mRootPath;
private static final String ROOT_DIR = "download";
//sdcard/download/xxxx/pic
public static String getPicDir(Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
return getRootDir(context) + File.separator + PIC_DIR + File.separator;
} else {
return context.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getPath() + File.separator;
}
}
public static String getRootDir(Context context) {
if (mRootPath == null) {
String packageName = context != null ? context.getPackageName() : "";
mRootPath = Environment.getExternalStorageDirectory().getPath() + File.separator + ROOT_DIR + File.separator + encode(packageName + "cache_sobot");
}
return mRootPath;
}
private static String encode(String str) {
StringBuilder sb = new StringBuilder();
try {
MessageDigest instance = MessageDigest.getInstance("MD5");
byte[] digest = instance.digest(str.getBytes());
for (byte b : digest) {
int num = b & 0xff;
String hex = Integer.toHexString(num);
if (hex.length() < 2) {
sb.append("0");
}
sb.append(hex);
}
} catch (Exception e) {
e.printStackTrace();
}
return sb.toString();
}
}
\ No newline at end of file
......@@ -36,7 +36,7 @@
android:gravity="center"
android:orientation="horizontal">
<com.sobot.common.ui.image.SobotRCImageView
<com.sobot.widget.ui.image.SobotRCImageView
android:id="@+id/sobot_avatar_iv"
android:layout_width="38dp"
android:layout_height="38dp"
......
......@@ -19,27 +19,27 @@
android:id="@+id/sobot_dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="14dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:gravity="center"
android:textColor="@color/sobot_common_gray1"
android:textSize="17sp"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp" />
android:textSize="17sp" />
<TextView
android:id="@+id/sobot_dialog_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="10dp"
android:padding="10dp"
android:textColor="@color/sobot_common_gray1"
android:textSize="14sp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp" />
android:textSize="14sp" />
<View
android:layout_width="match_parent"
......
......@@ -23,4 +23,158 @@
<string name="sobot_no_net_string">No network connection, please check your network</string>
<string name="sobot_error_click_reload_string">Loading failed, click Retry</string>
<string name="sobot_loading_string">Loading...</string>
<string name="sobot_no_permission_text">You are not authorized to do so</string>
<string name="sobot_go_setting">To set up</string>
<string name="sobot_btn_submit">Submit</string>
<string name="sobot_btn_cancle">Cancel</string>
<string name="sobot_no_write_external_storage_permission">No write external storage permission</string>
<string name="sobot_no_record_audio_permission">Unable to record</string>
<string name="sobot_no_camera_permission">No camera permission</string>
<string name="sobot_want_use_your"> want to visit yours </string>
<string name="sobot_memory_card">File</string>
<string name="sobot_memory_card_yongtu">You can send pictures, videos and files to describe the problem when you consult customer service and leave a message</string>
<string name="sobot_camera">Camera</string>
<string name="sobot_camera_yongtu">You can send photos and videos for help when consulting customer service and leaving a message</string>
<string name="app_request_code_500001">Customer already exists</string>
<string name="app_request_code_500002">Lead already exists</string>
<string name="app_request_code_500003">Enter correct phone no.!</string>
<string name="app_request_code_500004">Enter correct e-mail address! </string>
<string name="app_request_code_500005">Real name is too long, 32 chars max!</string>
<string name="app_request_code_500006">Customer nickname cannot be blank!</string>
<string name="app_request_code_500007">Tag group reached the limit of 30 </string>
<string name="app_request_code_500008">Tag group not found</string>
<string name="app_request_code_500009">Tag group name already exists </string>
<string name="app_request_code_500010">Tag name cannot be blank</string>
<string name="app_request_code_500011">The name cannot exceed 30 chars </string>
<string name="app_request_code_500012">Param name cannot exceed 30 chars </string>
<string name="app_request_code_500013">Selection method cannot be blank</string>
<string name="app_request_code_500014">Tag cannot be blank</string>
<string name="app_request_code_500015">userid, unionid and external_userid cannot be blank simultaneously</string>
<string name="app_request_code_500016">add_tag and remove_tag cannot be blank simultaneously </string>
<string name="app_request_code_500017">Customer info not found!</string>
<string name="app_request_code_500018">Transfer param </string>
<string name="app_request_code_500019">Upload agent id</string>
<string name="app_request_code_500020">Query assignment start time </string>
<string name="app_request_code_500021">Upload time query param in yyyy-MM-dd format</string>
<string name="app_request_code_500022">The max query span is 31 days </string>
<string name="app_request_code_500023">Wrong time query interval. Start time is greater than end time</string>
<string name="app_request_code_500024">Wrong time query interval. Start time is greater than current time</string>
<string name="app_request_code_500025">Param verification error</string>
<string name="app_request_code_500026">Enter correct assignment business type</string>
<string name="app_request_code_500027">Select relevant agent</string>
<string name="app_request_code_500028">Select customer! </string>
<string name="app_request_code_500029">Failed to assign %s customers. They are in recycle protection period</string>
<string name="app_request_code_500030">Failed to receive %s customers. They are in recycle protection period </string>
<string name="app_request_code_500031">Customer info not found</string>
<string name="app_request_code_500032">Customer nickname cannot be blank!</string>
<string name="app_request_code_500033">Customer status cannot be blank!</string>
<string name="app_request_code_500034">Agent cannot be blank! </string>
<string name="app_request_code_500035">Customer nickname is too long, 50 chars max!</string>
<string name="app_request_code_500036">Real name is too long, 50 chars max!</string>
<string name="app_request_code_500037">Enter correct phone no.!</string>
<string name="app_request_code_500038">Enter correct e-mail address! </string>
<string name="app_request_code_500039">Enter correct QQ no.!</string>
<string name="app_request_code_500040">Enter correct Wechat ID!</string>
<string name="app_request_code_500041">Enter correct gender!</string>
<string name="app_request_code_500042">%s, unable to be blank!</string>
<string name="app_request_code_500043">Company info not found!</string>
<string name="app_request_code_500044">Company name cannot be blank! </string>
<string name="app_request_code_500045">Company name is too long, 50 chars max! </string>
<string name="app_request_code_500046">Enterprise name cannot be blank!</string>
<string name="app_request_code_500047">Enterprise with name as %s already exists!</string>
<string name="app_request_code_500048">Enterprise not existed.</string>
<string name="app_request_code_500049">Enterprise name cannot be blank </string>
<string name="app_request_code_500050">%s, unable to enter blank space!</string>
<string name="app_request_code_500051">%s, unable to enter decimal point!</string>
<string name="app_request_code_500052">%s, only 2 digits allowed after decimal point!</string>
<string name="app_request_code_500053">%s, unable to enter special chars!</string>
<string name="app_request_code_500054">%s, only numbers allowed! </string>
<string name="app_request_code_500055">%s, enter %s chars max </string>
<string name="app_request_code_500056">%s, wrong email format </string>
<string name="app_request_code_500057">%s, wrong phone no. format</string>
<string name="app_request_code_500058">Customer info not found or customer creating. Try again later </string>
<string name="app_request_code_500059">Customer id cannot be blank!</string>
<string name="app_request_code_500060">Customer id is 100 max!</string>
<string name="app_request_code_500061">Phase name is 20 chars max</string>
<string name="app_request_code_500062">Designate business type</string>
<string name="app_request_code_500063">Tag group name cannot be blank</string>
<string name="app_request_code_500064">Tag cannot be blank</string>
<string name="app_request_code_500065">Tag group id cannot be blank</string>
<string name="app_request_code_500066">Each enterprise can have 3000 WeCom tags max</string>
<string name="app_request_code_500067">Tag names in tag group cannot be repeated </string>
<string name="app_request_code_500068">Tag name cannot be blank</string>
<string name="app_request_code_500069">Tag name "%s" already exists in tag group </string>
<string name="app_request_code_500070">Tag info cannot be blank</string>
<string name="app_request_code_500071">Tag name already exists</string>
<string name="app_request_code_500072">Tag not found</string>
<string name="app_request_code_500073">Tag id array cannot be blank</string>
<string name="app_request_code_500074">Tag group id cannot be blank</string>
<string name="app_request_code_500075">Tag names in tag group cannot be repeated!</string>
<string name="app_request_code_500076">Tag id cannot be blank!</string>
<string name="app_request_code_500077">Tag group addition failed </string>
<string name="app_request_code_500078">fenign API call failed!</string>
<string name="app_request_code_500079">Tag deletion failed! </string>
<string name="app_request_code_500080">Each enterprise can have 100 WeCom tags max </string>
<string name="app_request_code_500081">Tag creation failed, unable to synchronize WeCom tag library</string>
<string name="app_request_code_500082">Tag creation failed, unable to synchronize WeCom tag library, %s</string>
<string name="app_request_code_500083">Tag deletion failed, unable to synchronize WeCom tag library</string>
<string name="app_request_code_500084">Tag name cannot be blank! </string>
<string name="app_request_code_500085">Tag info modification failed, unable to synchronize WeCom tag library </string>
<string name="app_request_code_500086">Tag sorting failed, unable to synchronize WeCom tag library </string>
<string name="app_request_code_500087">Blank uploaded file</string>
<string name="app_request_code_500088">Null param </string>
<string name="app_request_code_500089">Customer not found in ES</string>
<string name="app_request_code_500090">No tag </string>
<string name="app_request_code_500091">Saved</string>
<string name="app_request_code_500092">Customer not found, customer id=%s</string>
<string name="app_request_code_500093">Company id cannot be blank</string>
<string name="app_request_code_500094">Blank customer status data inserted in bulk </string>
<string name="app_request_code_500095">externalUserId cannot be blank</string>
<string name="app_request_code_500096">partnerId cannot be blank </string>
<string name="app_request_code_500097">Upload at least one param of partnerId, tel, wx, email, and qq</string>
<string name="app_request_code_500098">Initializing... Try again later </string>
<string name="app_request_code_500099">Do not operate twice. Try again later!</string>
<string name="app_request_code_500100">Enter correct assignment business type</string>
<string name="app_request_code_500101">Select relevant agent</string>
<string name="app_request_code_500102">Param request body cannot be blank</string>
<string name="app_request_code_500103">Blank request batch no. id</string>
<string name="app_request_code_500104">【AssignUserServiceImpl】, 【getLiableList】, unable to acquire agent list</string>
<string name="app_request_code_500105">No data available! </string>
<string name="app_request_code_500106">Customer id cannot be blank.</string>
<string name="app_request_code_500107">Customer not found.</string>
<string name="app_request_code_500108">Blacklist type cannot be blank</string>
<string name="app_request_code_500109">Blacklist reason can be 200 chars max </string>
<string name="app_request_code_500110">Blacklist reason cannot be blank</string>
<string name="app_request_code_500111">choiceFlag cannot be blank! </string>
<string name="app_request_code_500112">Enterprise has not enabled organization structure, pls contact admin. </string>
<string name="app_request_code_500113">Operation not found</string>
<string name="app_request_code_500114">Customer not found </string>
<string name="app_request_code_500115">Customer info not found</string>
<string name="app_request_code_500116">There are two WeCom customers, unable to combine! </string>
<string name="app_request_code_500117">Enter phone no. ciphertext! </string>
<string name="app_request_code_500118">Select agent </string>
<string name="app_request_code_500119">Blank param id </string>
<string name="app_request_code_500120">Null param </string>
<string name="app_request_code_500121">Follow-up reminder time expired, pls reset</string>
<string name="app_request_code_500122">Follow-up record can be 500 chars max </string>
<string name="app_request_code_500123">Follow-up record and image cannot be blank concurrently </string>
<string name="app_request_code_500124">Select file to upload</string>
<string name="app_request_code_500125">Upload 9 images max</string>
<string name="app_request_code_500126">Failed to upload </string>
<string name="app_request_code_500127">File name is too long. Modify and try again </string>
<string name="app_request_code_500128">File type not supported</string>
<string name="app_request_code_500129">File too large </string>
<string name="app_request_code_500130">Failed to upload Alibaba Cloud file </string>
<string name="app_request_code_500131">Lack required param -- company no. pid! </string>
<string name="app_request_code_900001">Blank token! </string>
<string name="app_request_code_900002">Token invalid or not found. Get a new one!</string>
<string name="app_request_code_900003">Incorrect signature! </string>
<string name="app_request_code_900004">Company api configuration info not found! </string>
<string name="app_request_code_900005">Restricted access! </string>
<string name="app_request_code_900006">Company info not found!</string>
<string name="app_request_code_900007">Blank token info. Get a new one!</string>
</resources>
......@@ -22,4 +22,42 @@
<!--下拉刷新 尾部 加载中 旋转控件颜色-->
<color name="sobot_refresh_footer_progress_color">@color/sobot_refresh_progress_color</color>
<!--通用 颜色-->
<!--白色-->
<color name="sobot_white">#FFFFFF</color>
<!--绿色-->
<color name="sobot_common_green">#0DAEAF</color>
<!--主要文本色 大部分界面里的黑色文字-->
<color name="sobot_common_gray1">#D1D1D6</color>
<!--次要文本色-->
<color name="sobot_common_gray2">#7C7C80</color>
<!--占位文本色-->
<color name="sobot_common_gray3">#7C7C80</color>
<!--一级背景色-->
<color name="sobot_common_gray6">#1B1B1C</color>
<!--二级背景色-->
<color name="sobot_common_gray7">#262628</color>
<!-- 主题色 默认绿色 -->
<color name="sobot_color">@color/sobot_common_green</color>
<!--文字颜色 绿色变白色-->
<color name="sobot_common_wenzi_green_white">@color/sobot_color</color>
<!--线条分割线颜色-->
<color name="sobot_common_line_gray">#272729</color>
<!-- 头部开始 -->
<!-- 头部背景 -->
<color name="sobot_color_title_bar_bg">@color/sobot_white</color>
<!-- 状态栏的颜色设置 -->
<color name="sobot_status_bar_color">@color/sobot_color_title_bar_bg</color>
<!-- 头部中间昵称颜色 -->
<color name="sobot_color_title_bar_title">@color/sobot_common_gray1</color>
<!-- 头部两侧菜单字体颜色 -->
<color name="sobot_color_title_bar_menu_text">@color/sobot_common_gray1</color>
<!--头部头像边框颜色-->
<color name="sobot_color_title_bar_avatar_line">#EDEEF0</color>
</resources>
......@@ -188,4 +188,61 @@
<attr name="sobot_tileBackgroundColor" format="color"/>
</declare-styleable>
<!--圆形-->
<attr name="sobot_round_as_circle" format="boolean" />
<!--全部圆角半径-->
<attr name="sobot_round_corner" format="integer|dimension" />
<!--针对各个角的半径-->
<attr name="sobot_round_corner_top_left" format="integer|dimension" />
<attr name="sobot_round_corner_top_right" format="integer|dimension" />
<attr name="sobot_round_corner_bottom_left" format="integer|dimension" />
<attr name="sobot_round_corner_bottom_right" format="integer|dimension" />
<!--描边颜色/半径-->
<attr name="sobot_stroke_color" format="color|reference" />
<attr name="sobot_stroke_width" format="integer|dimension" />
<!-- 是否剪裁 RCLayout 的背景 -->
<attr name="sobot_clip_background" format="boolean" />
<!--真正用于解析的属性-->
<declare-styleable name="SobotRCAttrs">
<attr name="sobot_round_as_circle" />
<attr name="sobot_round_corner" />
<attr name="sobot_round_corner_top_left" />
<attr name="sobot_round_corner_top_right" />
<attr name="sobot_round_corner_bottom_left" />
<attr name="sobot_round_corner_bottom_right" />
<attr name="sobot_stroke_color" />
<attr name="sobot_stroke_width" />
<attr name="sobot_clip_background" />
</declare-styleable>
<!--假体:用于提示-->
<declare-styleable name="sobot_RCRelativeLayout">
<attr name="sobot_round_as_circle" />
<attr name="sobot_round_corner" />
<attr name="sobot_round_corner_top_left" />
<attr name="sobot_round_corner_top_right" />
<attr name="sobot_round_corner_bottom_left" />
<attr name="sobot_round_corner_bottom_right" />
<attr name="sobot_stroke_color" />
<attr name="sobot_stroke_width" />
<attr name="sobot_clip_background" />
</declare-styleable>
<declare-styleable name="sobot_RCImageView">
<attr name="sobot_round_as_circle" />
<attr name="sobot_round_corner" />
<attr name="sobot_round_corner_top_left" />
<attr name="sobot_round_corner_top_right" />
<attr name="sobot_round_corner_bottom_left" />
<attr name="sobot_round_corner_bottom_right" />
<attr name="sobot_stroke_color" />
<attr name="sobot_stroke_width" />
<attr name="sobot_clip_background" />
</declare-styleable>
</resources>
\ No newline at end of file
......@@ -27,4 +27,43 @@
<!--加载布局控件文字颜色-->
<color name="sobot_loading_layout_text_color">#8B98AD</color>
<!--通用 颜色-->
<!--白色-->
<color name="sobot_white">#FFFFFF</color>
<!--绿色-->
<color name="sobot_common_green">#0DAEAF</color>
<!--主要文本色 大部分界面里的黑色文字-->
<color name="sobot_common_gray1">#515A7C</color>
<!--次要文本色-->
<color name="sobot_common_gray2">#ACB5C4</color>
<!--占位文本色-->
<color name="sobot_common_gray3">#DDE0E6</color>
<!--一级背景色-->
<color name="sobot_common_gray6">#FFFFFF</color>
<!--二级背景色-->
<color name="sobot_common_gray7">#FFF2F5F7</color>
<!-- 主题色 默认绿色 -->
<color name="sobot_color">@color/sobot_common_green</color>
<!--文字颜色 绿色变白色-->
<color name="sobot_common_wenzi_green_white">@color/sobot_color</color>
<!--线条分割线颜色-->
<color name="sobot_common_line_gray">#EDEEF0</color>
<!-- 头部开始 -->
<!-- 头部背景 -->
<color name="sobot_color_title_bar_bg">@color/sobot_white</color>
<!-- 状态栏的颜色设置 -->
<color name="sobot_status_bar_color">@color/sobot_color_title_bar_bg</color>
<!-- 头部中间昵称颜色 -->
<color name="sobot_color_title_bar_title">@color/sobot_common_gray1</color>
<!-- 头部两侧菜单字体颜色 -->
<color name="sobot_color_title_bar_menu_text">@color/sobot_common_gray1</color>
<!--头部头像边框颜色-->
<color name="sobot_color_title_bar_avatar_line">#EDEEF0</color>
</resources>
......@@ -24,5 +24,161 @@
<string name="sobot_error_click_reload_string">加载失败,点击重试~~</string>
<string name="sobot_loading_string">加载中...</string>
<string name="sobot_no_permission_text">您还没有授权相关权限</string>
<string name="sobot_go_setting">去设置</string>
<string name="sobot_btn_cancle">取消</string>
<string name="sobot_btn_submit">确定</string>
<string name="sobot_no_write_external_storage_permission">没有存储权限</string>
<string name="sobot_no_record_audio_permission">没有麦克风权限</string>
<string name="sobot_no_camera_permission">没有相机权限</string>
<string name="sobot_want_use_your">想访问您的</string>
<string name="sobot_memory_card">文件</string>
<string name="sobot_memory_card_yongtu">您可以在咨询客服和留言时,发送图片、视频、文件描述问题</string>
<string name="sobot_camera">相机</string>
<string name="sobot_camera_yongtu">您可以在咨询客服和留言时,发送拍摄的照片和视频获取帮助</string>
<!-- 状态码-->
<string name="app_request_code_500001">客户已存在</string>
<string name="app_request_code_500002">线索已存在</string>
<string name="app_request_code_500003">请您输入正确的手机号码!</string>
<string name="app_request_code_500004">请您输入正确的邮箱!</string>
<string name="app_request_code_500005">真实姓名超长,不能超过32个字符!</string>
<string name="app_request_code_500006">客户昵称不能为空!</string>
<string name="app_request_code_500007">标签组超过最大30个限制</string>
<string name="app_request_code_500008">标签组不存在</string>
<string name="app_request_code_500009">标签组名称已存在</string>
<string name="app_request_code_500010">标签名称不能为空</string>
<string name="app_request_code_500011">名称不能超过30个字</string>
<string name="app_request_code_500012">参数名称不能超过30个字</string>
<string name="app_request_code_500013">选择方式不能为空</string>
<string name="app_request_code_500014">标签不允许为空 </string>
<string name="app_request_code_500015">userid、unionid、external_userid三个不可同时为空</string>
<string name="app_request_code_500016">add_tag和remove_tag不可同时为空</string>
<string name="app_request_code_500017">客户信息不存在!</string>
<string name="app_request_code_500018">请传递参数</string>
<string name="app_request_code_500019">请传入客服id </string>
<string name="app_request_code_500020">请查询分配起始时间</string>
<string name="app_request_code_500021">请传入yyyy-MM-dd格式的时间查询参数</string>
<string name="app_request_code_500022">查询最大跨度为31天</string>
<string name="app_request_code_500023">错误的时间查询区间,起始时间大于截止时间</string>
<string name="app_request_code_500024">错误的时间查询区间,起始时间大于当前时间</string>
<string name="app_request_code_500025">参数校验错误</string>
<string name="app_request_code_500026">请输入正确的分配业务类型</string>
<string name="app_request_code_500027">请选择相关负责人</string>
<string name="app_request_code_500028">请选择客户!</string>
<string name="app_request_code_500029">%s名客户分配失败,该客户正处于回收保护期内</string>
<string name="app_request_code_500030">%s名客户领取失败,该客户正处于回收保护期内</string>
<string name="app_request_code_500031">没有查找到客户信息</string>
<string name="app_request_code_500032">客户昵称不允许为空!</string>
<string name="app_request_code_500033">客户状态不能为空!</string>
<string name="app_request_code_500034">负责人不能为空!</string>
<string name="app_request_code_500035">客户昵称超长,不能超过50个字符!</string>
<string name="app_request_code_500036">真实姓名超长,不能超过50个字符!</string>
<string name="app_request_code_500037">请您输入正确的电话号码!</string>
<string name="app_request_code_500038">请您输入正确的邮箱!</string>
<string name="app_request_code_500039">请您输入正确的QQ号! </string>
<string name="app_request_code_500040">请您输入正确的微信号! </string>
<string name="app_request_code_500041">请您输入正确性别!</string>
<string name="app_request_code_500042">%s,不允许为空!</string>
<string name="app_request_code_500043">企业信息不存在!</string>
<string name="app_request_code_500044">公司名称不允许为空!</string>
<string name="app_request_code_500045">公司名称超长,不能超过200个字符!</string>
<string name="app_request_code_500046">企业名称不允许为空!</string>
<string name="app_request_code_500047">已存在名称为%s的企业!</string>
<string name="app_request_code_500048">企业不存在.</string>
<string name="app_request_code_500049">企业名称不能为空</string>
<string name="app_request_code_500050">%s,不允许输入空格! </string>
<string name="app_request_code_500051">%s,不允许输入小数点!</string>
<string name="app_request_code_500052">%s,小数点后只允许2位!</string>
<string name="app_request_code_500053">%s,不允许输入特殊字符!</string>
<string name="app_request_code_500054">%s,只允许输入数字! </string>
<string name="app_request_code_500055">%s,最多允许输入%s字符</string>
<string name="app_request_code_500056">%s,邮箱格式不正确</string>
<string name="app_request_code_500057">%s,手机号码格式不正确</string>
<string name="app_request_code_500058">客户信息不存在或客户创建中,请稍后再试</string>
<string name="app_request_code_500059">客户id不能为空!</string>
<string name="app_request_code_500060">客户id不能超过100个!</string>
<string name="app_request_code_500061">阶段名称不能超过20个字符</string>
<string name="app_request_code_500062">请指定业务类型 </string>
<string name="app_request_code_500063">标签组名称不允许为空</string>
<string name="app_request_code_500064">标签不允许为空 </string>
<string name="app_request_code_500065">标签组id不允许为空</string>
<string name="app_request_code_500066">每个企业最多可配置3000个企微标签</string>
<string name="app_request_code_500067">标签组内标签名不允许重复</string>
<string name="app_request_code_500068">标签名称不允许为空</string>
<string name="app_request_code_500069">标签组内标签名“%s”已存在</string>
<string name="app_request_code_500070">标签信息不能为空</string>
<string name="app_request_code_500071">标签名称已存在 </string>
<string name="app_request_code_500072">标签已不存在</string>
<string name="app_request_code_500073">标签id数组不允许为空 </string>
<string name="app_request_code_500074">标签组id不允许为空</string>
<string name="app_request_code_500075">标签组内标签名称不能重复!</string>
<string name="app_request_code_500076">标签id不允许为空!</string>
<string name="app_request_code_500077">标签组新增失败 </string>
<string name="app_request_code_500078">调fenign接口失败!</string>
<string name="app_request_code_500079">删除标签失败! </string>
<string name="app_request_code_500080">每个企业最多可配置100个企微标签</string>
<string name="app_request_code_500081">标签创建失败,无法同步企业微信标签库</string>
<string name="app_request_code_500082">标签创建失败,无法同步企业微信标签库,%s </string>
<string name="app_request_code_500083">标签删除失败,无法同步企业微信标签库</string>
<string name="app_request_code_500084">标签名称不能为空!</string>
<string name="app_request_code_500085">标签信息修改失败,无法同步企业微信标签库</string>
<string name="app_request_code_500086">标签排序失败,无法同步企业微信标签库</string>
<string name="app_request_code_500087">上传文件文件为空</string>
<string name="app_request_code_500088">参数为空 </string>
<string name="app_request_code_500089">ES中没有查找到客户</string>
<string name="app_request_code_500090">没有标签 </string>
<string name="app_request_code_500091">保存成功 </string>
<string name="app_request_code_500092">客户不存在,客户id=%s</string>
<string name="app_request_code_500093">公司id不予许为空</string>
<string name="app_request_code_500094">批量插入客户动态数据为空</string>
<string name="app_request_code_500095">externalUserId不予许为空</string>
<string name="app_request_code_500096">partnerId不予许为空</string>
<string name="app_request_code_500097">请传入partnerId,tel,wx,email,qq至少一个参数</string>
<string name="app_request_code_500098">初始化中,请稍后重试</string>
<string name="app_request_code_500099">请勿重复操作,请稍后再试!</string>
<string name="app_request_code_500100">请输入正确的分配业务类型</string>
<string name="app_request_code_500101">请选择相关负责人</string>
<string name="app_request_code_500102">参数请求体不可为空</string>
<string name="app_request_code_500103">请求批次id为空</string>
<string name="app_request_code_500104">【AssignUserServiceImpl】,【getLiableList】,未获取负责人列表错误</string>
<string name="app_request_code_500105">暂无数据!</string>
<string name="app_request_code_500106">客户id不允许为空.</string>
<string name="app_request_code_500107">客户不存在.</string>
<string name="app_request_code_500108">拉黑类型不允许为空</string>
<string name="app_request_code_500109">拉黑原因最多200个字符</string>
<string name="app_request_code_500110">拉黑原因不允许为空</string>
<string name="app_request_code_500111">choiceFlag不能为空!</string>
<string name="app_request_code_500112">企业未开通组织架构,请联系管理员开通。</string>
<string name="app_request_code_500113">该操作没有找到 </string>
<string name="app_request_code_500114">客户不存在</string>
<string name="app_request_code_500115">没有查找到客户信息</string>
<string name="app_request_code_500116">两个企业微信客户,无法合并!</string>
<string name="app_request_code_500117">请输入手机号密文!</string>
<string name="app_request_code_500118">请选择负责人</string>
<string name="app_request_code_500119">参数id为空</string>
<string name="app_request_code_500120">参数为空 </string>
<string name="app_request_code_500121">跟进提醒时间已过,请重新设置</string>
<string name="app_request_code_500122">跟进记录最多500个字符</string>
<string name="app_request_code_500123">跟进记录和图片不允许同时为空</string>
<string name="app_request_code_500124">请选择上传的文件</string>
<string name="app_request_code_500125">最多上传9张图片</string>
<string name="app_request_code_500126">上传失败 </string>
<string name="app_request_code_500127">文件名称太长,请修改后重试</string>
<string name="app_request_code_500128">文件类型不支持 </string>
<string name="app_request_code_500129">文件过大 </string>
<string name="app_request_code_500130">上传阿里云文件失败</string>
<string name="app_request_code_500131">缺少必要参数--公司编号pid! </string>
<string name="app_request_code_900001">token为空!</string>
<string name="app_request_code_900002">token已失效或不存在,请重新获取!</string>
<string name="app_request_code_900003">signature错误!</string>
<string name="app_request_code_900004">没有找到公司的api配置信息!</string>
<string name="app_request_code_900005">被限制访问!</string>
<string name="app_request_code_900006">没有找到公司信息!</string>
<string name="app_request_code_900007">token信息为空,请重新获取! </string>
<!-- 状态码-->
</resources>
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