Commit d7c21e36 by 宁斌

Compontent統一到base模塊下,xfunction相關處理

parent 02ccf7de
......@@ -114,6 +114,7 @@ public abstract class BaseActivity<P extends IPresenter> extends AppCompatActivi
} catch (Exception e) {
e.printStackTrace();
}
initIntent();
initTopBar();
initLanguage();
......
......@@ -58,7 +58,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
*/
@Module
public abstract class ClientModule {
public static int TIME_OUT = 15;
public static int TIME_OUT = 20;
/**
* 提供 {@link Retrofit}
......
......@@ -173,7 +173,7 @@ public class DefaultFormatPrinter implements FormatPrinter {
int end = (i + 1) * MAX_LONG_SIZE;
end = end > line.length() ? line.length() : end;
Timber.tag(tag).i(DEFAULT_LINE + line.substring(start, end));
Log.e("aaa", "" + DEFAULT_LINE + line.substring(start, end));
Log.e(tag, DEFAULT_LINE + line.substring(start, end));
}
}
}
......
......@@ -870,8 +870,6 @@ public class DeviceUtils {
return false;
}
/**
* 获得设备硬件标识
*
......
......@@ -12,4 +12,9 @@ import lombok.Data;
public class BrandInfo {
private int brandId;
private String brandName;
public BrandInfo(int brandId, String brandName) {
this.brandId = brandId;
this.brandName = brandName;
}
}
......@@ -15,4 +15,9 @@ public class RestaurantInfo {
private String restaurantName;
private String gsPosShopId;
public RestaurantInfo(int restaurantId, String restaurantName, String gsPosShopId) {
this.restaurantId = restaurantId;
this.restaurantName = restaurantName;
this.gsPosShopId = gsPosShopId;
}
}
package com.gingersoft.gsa.cloud.account.restaurant;
import android.text.TextUtils;
import com.gingersoft.gsa.cloud.account.user.UserConstans;
import com.gingersoft.gsa.cloud.account.user.info.UserInfo;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import lombok.Data;
/**
* @author : bin
* @create date: 2020-11-21
* @update date: 2020-11-21
* @description:
* @description:品牌餐廳信息管理lei
*/
@Data
public class ResturantInfoManager {
private static ResturantInfoManager sResturantInfoManager = null;
......@@ -27,41 +23,96 @@ public class ResturantInfoManager {
*/
private RestaurantInfo restaurantInfo;
private ResturantInfoManager() {
}
public static ResturantInfoManager newInstance() {
if (sResturantInfoManager == null) {
synchronized (ResturantInfoManager.class) {
if (sResturantInfoManager == null) {
sResturantInfoManager = new ResturantInfoManager();
}
}
sResturantInfoManager = new ResturantInfoManager();
}
return sResturantInfoManager;
}
public void putResturantInfo(RestaurantInfo info) {
public int getRestaurantId() {
if (restaurantInfo != null) {
return restaurantInfo.getRestaurantId();
}
return 0;
}
public String getGsPosShopId() {
if (restaurantInfo != null) {
return restaurantInfo.getGsPosShopId();
}
return "-1";
}
public String getRestaurantName() {
if (restaurantInfo != null) {
return restaurantInfo.getRestaurantName();
}
return "";
}
public int getBrandId() {
if (brandInfo != null) {
return brandInfo.getBrandId();
}
return 0;
}
public String getBrandName() {
if (brandInfo != null) {
return brandInfo.getBrandName();
}
return "";
}
public void setResturantInfo(RestaurantInfo info) {
if (info == null) {
return;
}
this.restaurantInfo = info;
SPUtils.put(UserConstans.gsPosShopId, info.getGsPosShopId());
SPUtils.put(UserConstans.restaurantId, info.getRestaurantId());
SPUtils.put(UserConstans.restaurantName, info.getRestaurantName());
}
public void putBrandInfo(BrandInfo info) {
public void setBrandInfo(BrandInfo info) {
if (info == null) {
return;
}
this.brandInfo = info;
SPUtils.put(UserConstans.brandId, info.getBrandId());
SPUtils.put(UserConstans.brandName, info.getBrandName());
}
public void removeResturantInfo() {
this.restaurantInfo = null;
SPUtils.remove(UserConstans.gsPosShopId);
SPUtils.remove(UserConstans.restaurantId);
SPUtils.remove(UserConstans.restaurantName);
}
public void removeBrandInfo() {
this.brandInfo = null;
SPUtils.remove(UserConstans.gsPosShopId);
SPUtils.remove(UserConstans.restaurantId);
SPUtils.remove(UserConstans.restaurantName);
SPUtils.remove(UserConstans.brandRestaurantInfos);
}
public static String getBrandRestaurantInfos() {
return (String) SPUtils.get(UserConstans.brandRestaurantInfos, "");
}
public static void putBrandRestaurantInfos(String brandRestaurantIds) {
if (TextUtils.isEmpty(brandRestaurantIds)) {
return;
}
SPUtils.put(UserConstans.brandRestaurantInfos, brandRestaurantIds);
}
}
......@@ -5,7 +5,7 @@ package com.gingersoft.gsa.cloud.account.user;
*/
public class UserConstans {
public final static String IS_LOGIN = "is_login";
// public final static String IS_LOGIN = "is_login";
public final static String LOGIN_USERNAME = "login_account";
public final static String LOGIN_PASSWORD = "login_password";
......
......@@ -38,46 +38,63 @@ public class UserContext {
public static UserContext newInstance() {
if (sUserContextManger == null) {
synchronized (UserContext.class) {
if (sUserContextManger == null) {
sUserContextManger = new UserContext();
}
}
sUserContextManger = new UserContext();
}
return sUserContextManger;
}
public void logined(){
public void logined() {
state.logined();
}
public void logOut(){
public void logOut() {
state.logOut();
}
public void toTargetPage(String componentName,String actionName){
state.toTargetPage(componentName,actionName);
}
/**
* 用戶是否登錄
*
* @return
*/
public boolean isLogin(){
if(state instanceof LoginedState){
public boolean isLogin() {
if (state instanceof LoginedState) {
return true;
}
return false;
}
public String getLoginToken() {
if (info != null) {
return info.getToken();
}
return "";
}
public int getMemberId() {
if (info != null) {
return info.getUserId();
}
return 0;
}
public String getMemberName() {
if (info != null) {
return info.getUserName();
}
return "";
}
public void putUserInfo(UserInfo info) {
SPUtils.put(UserConstans.token, info.getUserName());
SPUtils.put(UserConstans.memberId, info.getUserName());
public void setUserInfo(UserInfo info) {
if (info == null) {
return;
}
this.info = info;
SPUtils.put(UserConstans.token, info.getToken());
SPUtils.put(UserConstans.memberId, info.getUserId());
SPUtils.put(UserConstans.memberName, info.getUserName());
}
public void removeUserInfo(){
public void removeUserInfo() {
SPUtils.remove(UserConstans.token);
SPUtils.remove(UserConstans.memberId);
SPUtils.remove(UserConstans.memberName);
......@@ -86,15 +103,4 @@ public class UserContext {
ResturantInfoManager.newInstance().removeResturantInfo();
}
public static String getLoginToken() {
return (String) SPUtils.get(UserConstans.token, "");
}
public static int getMemberId() {
return (int) SPUtils.get(UserConstans.memberId, 0);
}
public static String getMemberName() {
return (String) SPUtils.get(UserConstans.memberName, "");
}
}
......@@ -27,4 +27,20 @@ public class UserInfo {
private String updateBy;
private String token;
// public UserInfo(String token,Integer userId, String userName, Integer groupId, Integer parentId, Integer merchantsId, String mobile, String email, byte status, Date createTime, String createBy, Date updateTime, String updateBy) {
// this.token = token;
// this.userId = userId;
// this.userName = userName;
// this.groupId = groupId;
// this.parentId = parentId;
// this.merchantsId = merchantsId;
// this.mobile = mobile;
// this.email = email;
// this.status = status;
// this.createTime = createTime;
// this.createBy = createBy;
// this.updateTime = updateTime;
// this.updateBy = updateBy;
// }
}
......@@ -2,9 +2,6 @@ package com.gingersoft.gsa.cloud.account.user.state;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.account.user.UserConstans;
/**
* @author : bin
......@@ -17,11 +14,6 @@ public class LoginedState implements UserState{
@Override
public void logined() {
//跳轉登錄頁面
CC.obtainBuilder("User.Component.Login")
.setActionName("showActivityA")
.build()
.call();
}
@Override
......@@ -31,12 +23,4 @@ public class LoginedState implements UserState{
UserContext.newInstance().logOut();
}
@Override
public void toTargetPage(String componentName, String actionName) {
CC.obtainBuilder(componentName)
.setActionName(actionName)
.build()
.call();
}
}
package com.gingersoft.gsa.cloud.account.user.state;
import android.app.Activity;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserConstans;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.component.ComponentName;
/**
* @author : bin
......@@ -13,41 +13,41 @@ import com.gingersoft.gsa.cloud.constans.PrintConstans;
* @update date: 2020-11-21
* @description:未登錄狀態
*/
public class LogoutState implements UserState{
public class LogoutState implements UserState {
@Override
public void logined() {
//設置用戶狀態為登錄狀態
UserContext.newInstance().setState(new LoginedState());
UserContext.newInstance().logined();
//跳轉登錄頁面
CC.obtainBuilder(ComponentName.COMPONENT_LOGIN)
.setActionName("showActivityA")
.build()
.call();
}
@Override
public void logOut() {
SPUtils.put(UserConstans.IS_LOGIN, false);
UserContext.newInstance().removeUserInfo();
//关闭Prj打印服務
CC.obtainBuilder("Component.Print")
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.setActionName("stopPrintService")
.build()
.call();
//跳轉登陸頁面
CC.obtainBuilder("User.Component.Login")
.setActionName("showActivityA")
.build()
.call();
}
@Override
public void toTargetPage(String componentName, String actionName) {
CC.obtainBuilder(componentName)
.setActionName(actionName)
.build()
.call();
Activity activity = GsaCloudApplication.getAppContext().getCurrentActivity();
if (activity != null) {
String name = activity.getClass().getSimpleName();
if (!name.equals("LoginActivity")) {
//跳轉登陸頁面
CC.obtainBuilder(ComponentName.COMPONENT_LOGIN)
.setActionName("showActivityA")
.build()
.call();
}
}
}
}
......@@ -17,11 +17,4 @@ public interface UserState {
* 登出
*/
void logOut();
/**
* 跳轉到目標頁
* @param componentName 目標組件名
* @param actionName 目標activity名
*/
void toTargetPage(String componentName,String actionName);
}
......@@ -7,9 +7,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Build;
import android.os.RemoteException;
import androidx.annotation.NonNull;
import com.billy.cc.core.component.CC;
import com.dianping.logan.Logan;
import com.dianping.logan.OnLoganProtocolStatus;
......@@ -24,7 +22,6 @@ import com.elvishew.xlog.printer.Printer;
import com.elvishew.xlog.printer.file.FilePrinter;
import com.elvishew.xlog.printer.file.clean.FileLastModifiedCleanStrategy;
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;
import com.gingersoft.gsa.cloud.account.user.UserConstans;
import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.utils.AidlUtil;
......@@ -54,10 +51,8 @@ import com.kingja.loadsir.core.LoadSir;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import java.io.File;
import java.util.Locale;
import me.jessyan.autosize.AutoSize;
import me.jessyan.autosize.AutoSizeConfig;
import me.jessyan.autosize.onAdaptListener;
......@@ -68,7 +63,7 @@ import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
*/
public class GsaCloudApplication extends BaseApplication {
private static final String TAG = GsaCloudApplication.class.getSimpleName();
private final String TAG = this.getClass().getSimpleName();
/**
* 系统上下文
*/
......@@ -82,9 +77,6 @@ public class GsaCloudApplication extends BaseApplication {
*/
public static boolean openSkinMake = false;
public static boolean isLogin = false;
public static String userName = "";
/**
* 全局設置上下拉刷新框架Header 和 Footer
*/
......@@ -107,7 +99,7 @@ public class GsaCloudApplication extends BaseApplication {
mAppContext = this;
isLogin = (boolean) SPUtils.get(UserConstans.IS_LOGIN, false);
// isLogin = (boolean) SPUtils.get(UserConstans.IS_LOGIN, false);
CC.enableVerboseLog(true);
CC.enableDebug(true);
......@@ -144,7 +136,7 @@ public class GsaCloudApplication extends BaseApplication {
//上傳餐廳擴展信息
ExpandInfoSetting.initUpdateExtendedConfiguration(uiStyleConfiguration, functionConfiguration);
LoganManager.w_action(TAG, TAG + ": onCreate end.....");
LoganManager.w_action(TAG, TAG + ": onCreate end.....");
}
/**
......@@ -162,7 +154,7 @@ public class GsaCloudApplication extends BaseApplication {
Logan.setOnLoganProtocolStatus(new OnLoganProtocolStatus() {
@Override
public void loganProtocolStatus(String cmd, int code) {
LoganManager.w_code(TAG,"loganProtocolStatus: "+cmd);
LoganManager.w_code(TAG, "loganProtocolStatus: " + cmd);
}
});
}
......@@ -422,68 +414,6 @@ public class GsaCloudApplication extends BaseApplication {
return mAppContext;
}
//获取登陆token
public static String getLoginToken() {
return (String) SPUtils.get(UserConstans.token, "");
}
public static int getMemberId() {
return (int) SPUtils.get(UserConstans.memberId, 0);
}
public static int getBrandId() {
return (int) SPUtils.get(UserConstans.brandId, 0);
}
public static String getBrandName() {
return (String) SPUtils.get(UserConstans.brandName, "");
}
public static int getRestaurantId() {
return (int) SPUtils.get(UserConstans.restaurantId, 0);
}
public static String getRestaurantName() {
return (String) SPUtils.get(UserConstans.restaurantName, "");
}
public static String getMemberName() {
return (String) SPUtils.get(UserConstans.memberName, "");
}
public static String getBrandRestaurantInfo() {
return (String) SPUtils.get(UserConstans.brandRestaurantInfos, "");
}
public static String getGsPosShopId() {
return (String) SPUtils.get(UserConstans.gsPosShopId, "-1");
}
public static void logOut() {
SPUtils.remove(UserConstans.token);
SPUtils.remove(UserConstans.memberId);
SPUtils.remove(UserConstans.brandId);
SPUtils.remove(UserConstans.brandName);
SPUtils.remove(UserConstans.restaurantId);
SPUtils.remove(UserConstans.restaurantName);
SPUtils.remove(UserConstans.memberName);
SPUtils.remove(UserConstans.brandRestaurantInfos);
SPUtils.remove(UserConstans.gsPosShopId);
SPUtils.put(UserConstans.IS_LOGIN, false);
//关闭Prj打印服務
CC.obtainBuilder("Component.Print")
.setActionName("stopPrintService")
.build()
.call();
//跳轉登陸頁面
CC.obtainBuilder("User.Component.Login")
.setActionName("showActivityA")
.build()
.call();
GsaCloudApplication.isLogin = false;
}
public static String getAppName() {
try {
PackageManager packageManager = mAppContext.getPackageManager();
......@@ -496,51 +426,4 @@ public class GsaCloudApplication extends BaseApplication {
}
return null;
}
public static void setLoginToken(Context context, String token) {
SPUtils.put(UserConstans.token, token);
}
public static void setMemberId(Context context, int memberId) {
SPUtils.put(UserConstans.memberId, memberId);
}
public static void setMemberName(Context context, String memberName) {
SPUtils.put(UserConstans.memberName, memberName);
}
public static void setBrandId(Context context, int restaurantId) {
SPUtils.put(UserConstans.brandId, restaurantId);
}
public static void setBrandName(Context context, String restaurantName) {
SPUtils.put(UserConstans.brandName, restaurantName);
}
public static void setRestaurantId(Context context, int restaurantId) {
SPUtils.put(UserConstans.restaurantId, restaurantId);
}
public static void setRestaurantName(Context context, String restaurantName) {
SPUtils.put(UserConstans.restaurantName, restaurantName);
}
public static void setBrandRestaurantInfos(Context context, String brandRestaurantIds) {
SPUtils.put(UserConstans.brandRestaurantInfos, brandRestaurantIds);
}
public static void setGsPosShopId(Context context, String gsPosShopId) {
SPUtils.put(UserConstans.gsPosShopId, gsPosShopId);
}
public static void clearMemberInfo() {
setLoginToken(mAppContext, "");
setMemberId(mAppContext, 0);
setMemberName(mAppContext, "");
setBrandId(mAppContext, 0);
setBrandName(mAppContext, "");
setRestaurantId(mAppContext, 0);
setRestaurantName(mAppContext, "");
setBrandRestaurantInfos(mAppContext, "");
}
}
......@@ -319,7 +319,6 @@ public class ReflectionUtils {
List<String> list = new ArrayList<String>();
for (int i = 0; i < len; i++) {
Annotation annotation = annotations[i];
String annotationName = annotation.annotationType().getSimpleName();
list.add(annotationName);
}
......
......@@ -3,7 +3,7 @@ package com.gingersoft.gsa.cloud.base.utils;
import android.content.Context;
import android.text.TextUtils;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import java.util.ArrayList;
......@@ -19,7 +19,7 @@ import java.util.List;
public class RestaurantInfoUtils {
public static List<BrandsBean.BrandsData> getBrandList() {
String brandRestaurantInfos = GsaCloudApplication.getBrandRestaurantInfo();
String brandRestaurantInfos = ResturantInfoManager.getBrandRestaurantInfos();
if (!TextUtils.isEmpty(brandRestaurantInfos)) {
List<BrandsBean.BrandsData> brandsBeans = JsonUtils.parseArray(brandRestaurantInfos, BrandsBean.BrandsData.class);
return brandsBeans;
......
......@@ -10,9 +10,9 @@ import android.util.Log;
import android.widget.Toast;
import com.elvishew.xlog.XLog;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.Api;
import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.utils.FileUtils;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
......@@ -233,7 +233,7 @@ public class AppCrashHandler implements UncaughtExceptionHandler {
List<File> fileList = Arrays.asList(files);
HashMap<String, String> params = new HashMap<>();
params.put("type", "1");
params.put("uid", String.valueOf(GsaCloudApplication.getMemberId()));
params.put("uid", String.valueOf(UserContext.newInstance().getMemberId()));
String url = HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + Api.upload_app_log;
OkHttp3Utils.sendFileMultipart(url, "files", fileList, params)
.subscribeOn(Schedulers.io())
......@@ -295,7 +295,7 @@ public class AppCrashHandler implements UncaughtExceptionHandler {
// 保存文件
long timetamp = System.currentTimeMillis();
String time = format.format(new Date());
String MemberName = GsaCloudApplication.getMemberName();
String MemberName = UserContext.newInstance().getMemberName();
String fileName = "crash-" + MemberName + "-" + time + "-" + timetamp + "-" + DeviceUtils.getVersionName(mContext) + CRASH_REPORTER_EXTENSION;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {//外部存储卡
try {
......
package com.gingersoft.gsa.cloud.base.utils.okhttpUtils;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.config.OkHttpConfig;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept.HeadersInterceptor;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept.LoggingInterceptor;
import com.gingersoft.gsa.cloud.constans.HttpsConstans;
import com.jess.arms.http.log.RequestInterceptor;
import com.jess.arms.utils.DeviceUtils;
import java.io.File;
......@@ -46,7 +48,7 @@ public class OkHttp3Utils {
.connectTimeout(OkHttpConfig.REQUEST_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(OkHttpConfig.REQUEST_TIMEOUT, TimeUnit.SECONDS)
.addInterceptor(new HeadersInterceptor())
.addInterceptor(new LoggingInterceptor())
.addInterceptor(new RequestInterceptor())
.build();
}
......@@ -222,14 +224,14 @@ public class OkHttp3Utils {
"版本號:" + DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()) + "|" + DeviceUtils.getVersionCode(GsaCloudApplication.getAppContext()) +
"時間:" + TimeUtils.getCurrentDate(TimeUtils.DEFAULT_DATE_FORMAT) +
"報錯CODE:" + errCode +
"品牌名:" + GsaCloudApplication.getBrandName() +
"餐廳名:" + GsaCloudApplication.getRestaurantName() +
"餐廳ID:" + GsaCloudApplication.getRestaurantId() +
"登陸人員:" + GsaCloudApplication.getMemberName() + "|" + GsaCloudApplication.getMemberId() +
"品牌名:" + ResturantInfoManager.newInstance().getBrandName() +
"餐廳名:" + ResturantInfoManager.newInstance().getRestaurantName() +
"餐廳ID:" + ResturantInfoManager.newInstance().getRestaurantId() +
"登陸人員:" + UserContext.newInstance().getMemberName() + "|" + UserContext.newInstance().getMemberId() +
"報錯原因:" + pushContent;
RequestBody requestBody = new FormBody.Builder()
.add("code", errCode)//錯誤碼
.add("shopId", GsaCloudApplication.getGsPosShopId())
.add("shopId", ResturantInfoManager.newInstance().getGsPosShopId())
.add("source", GsaCloudApplication.getAppName() + "")//錯誤來源
.add("pushContent", restaurantInfo)//推送內容
.add("version", DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()))//系統版本
......
package com.gingersoft.gsa.cloud.component;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:
*/
public class ComponentAction {
public static class Login{
}
public static class Download{
}
public static class Main{
}
public static class Table{
}
public static class Print{
}
public static class Manager{
}
public static class DeliveryPick{
}
public static class ColdChain{
}
public static class SupplyChain{
}
}
package com.gingersoft.gsa.cloud.component;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:項目所有組件名
*/
public class ComponentName {
/** 登錄組件*/
public static final String COMPONENT_LOGIN = "Component.Login";
/** 數據下載組件*/
public static final String COMPONENT_DOWNLOAD = "Component.Download";
/** 首頁組件*/
public static final String COMPONENT_MAIN = "Component.Main";
/** 餐檯模式組件*/
public static final String COMPONENT_TABLE = "Component.Table";
/** 打印組件*/
public static final String COMPONENT_PRINT = "Component.Print";
/** 餐牌 餐檯相關數據管理組件*/
public static final String COMPONENT_MANAGER = "Component.Manager";
/** 外送接單組件*/
public static final String COMPONENT_DELIVERYPICK = "Component.DeliveryPick";
/** 冷鏈組件*/
public static final String COMPONENT_COLDCHAIN = "Component.ColdChain";
/** 供應鏈組件*/
public static final String COMPONENT_SUPPLYCHAIN = "Component.SupplyChain";
}
......@@ -115,7 +115,7 @@ public class ExpandInfoSetting {
/**
* 掃獲取擴展類信息
* 掃獲取擴展類信息
* @param obj
* @return
*/
......
......@@ -127,6 +127,9 @@ public class FunctionExtendedConfiguration {
.remark("qrcode底部文字")
.build();
public <T> T getRoundingVaule() {
return Rounding.getValue();
}
......
......@@ -2,24 +2,29 @@ package com.gingersoft.gsa.cloud.config.globalconfig;
import android.app.Application;
import android.content.Context;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.MyGlobalHttpHandler;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.MyGsonConfiguration;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.MyOkhttpConfiguration;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.MyResponseErrorListener;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.MyRetrofitConfiguration;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.MyRxCacheConfiguration;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept.HeadersInterceptor;
import com.gingersoft.gsa.cloud.config.globalconfig.lifecyclesOptioins.MyActivityLifecycle;
import com.gingersoft.gsa.cloud.config.globalconfig.lifecyclesOptioins.MyAppLifecycles;
import com.gingersoft.gsa.cloud.config.globalconfig.lifecyclesOptioins.MyFragmentLifecycle;
import com.gingersoft.gsa.cloud.constans.HttpsConstans;
import com.jess.arms.base.delegate.AppLifecycles;
import com.jess.arms.di.module.GlobalConfigModule;
import com.jess.arms.http.log.RequestInterceptor;
import com.jess.arms.integration.ConfigModule;
import com.jess.arms.integration.cache.Cache;
import com.jess.arms.integration.cache.CacheType;
import com.jess.arms.utils.DataHelper;
import java.io.File;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;
......@@ -30,13 +35,16 @@ public class GlobalConfiguration implements ConfigModule {
//使用builder可以为框架配置一些配置信息
builder
.baseurl(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL)
.printHttpLogLevel(RequestInterceptor.Level.ALL)
.okhttpConfiguration(new MyOkhttpConfiguration())
.retrofitConfiguration(new MyRetrofitConfiguration())
.globalHttpHandler(new MyGlobalHttpHandler())
.responseErrorListener(new MyResponseErrorListener())
.rxCacheConfiguration(new MyRxCacheConfiguration())
.cacheFile(new File(DataHelper.getCacheFile(context), "rxCache"))
.gsonConfiguration(new MyGsonConfiguration());
.gsonConfiguration(new MyGsonConfiguration())
.addInterceptor(new RequestInterceptor())
.addInterceptor(new HeadersInterceptor());
}
@Override
......
......@@ -3,9 +3,9 @@ package com.gingersoft.gsa.cloud.config.globalconfig.applyOptions;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.encryption.Aes;
import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.logan.LoganManager;
import com.jess.arms.http.GlobalHttpHandler;
import com.jess.arms.utils.DeviceUtils;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.Request;
......@@ -14,16 +14,18 @@ import okhttp3.Response;
public class MyGlobalHttpHandler implements GlobalHttpHandler {
@Override
public Response onHttpResultResponse(String httpResult, Interceptor.Chain chain, Response response) {
// 统一处理http响应。eg:状态码不是200时,根据状态码做相应的处理。
LoganManager.w_network(httpResult);
return response;
}
@Override
public Request onHttpRequestBefore(Interceptor.Chain chain, Request request) {
// 统一处理http请求。eg:给request统一添加token或者header以及参数加密等操作
String requestReult = request.toString();
LoganManager.w_network(requestReult);
return chain.request().newBuilder()
.build();
}
......
......@@ -5,7 +5,7 @@ import android.content.Context;
import android.net.ParseException;
import android.text.TextUtils;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
......@@ -51,7 +51,7 @@ public class MyResponseErrorListener implements ResponseErrorListener {
// ArmsUtils.snackbarText(msg);
// LogUtil.d("handleResponseError: " + t.getMessage());
LoganManager.w_network("請求錯誤: "+t.getMessage());
LoganManager.w_code(TAG,"請求錯誤: "+t.getMessage());
if (!TextUtils.isEmpty(msg)) {
ToastUtils.show(context, msg);
......@@ -105,20 +105,22 @@ public class MyResponseErrorListener implements ResponseErrorListener {
private void toLoginActivity(Activity context) {
ArmsUtils.killAll();
//清空用戶信息
GsaCloudApplication.clearMemberInfo();
//修改登錄狀態
GsaCloudApplication.isLogin = false;
//清空堂食訂單信息
CC.obtainBuilder("Component.Base.Order")
.setActionName("clearDoshokuOrder")
.build()
.call();
//跳轉登錄頁面
CC.obtainBuilder("User.Component.Login")
.setActionName("showActivityA")
.build()
.call();
UserContext.newInstance().logOut();
// //清空用戶信息
// GsaCloudApplication.clearMemberInfo();
// //修改登錄狀態
// GsaCloudApplication.isLogin = false;
// //清空堂食訂單信息
// CC.obtainBuilder("Component.Base.Order")
// .setActionName("clearDoshokuOrder")
// .build()
// .call();
// //跳轉登錄頁面
// CC.obtainBuilder(ComponentName.COMPONENT_LOGIN)
// .setActionName("showActivityA")
// .build()
// .call();
showloggedDialog = false;
context.finish();
}
......
......@@ -2,10 +2,10 @@ package com.gingersoft.gsa.cloud.config.globalconfig.applyOptions;
import android.content.Context;
import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept.LoggingInterceptor;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept.HeadersInterceptor;
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept.LoggingInterceptor;
import com.jess.arms.di.module.ClientModule;
import com.jess.arms.http.log.RequestInterceptor;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
......@@ -17,9 +17,10 @@ public class MyRetrofitConfiguration implements ClientModule.RetrofitConfigurati
// 配置多BaseUrl支持
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
if (BuildConfig.DEBUG) {
clientBuilder.addInterceptor(new LoggingInterceptor());//使用自定义的Log拦截器
// clientBuilder.addInterceptor(new LoggingInterceptor());//使用自定义的Log拦截器
}
clientBuilder.addInterceptor(new HeadersInterceptor());//使用自定义User-Agent
builder.client(RetrofitUrlManager.getInstance().with(clientBuilder).build());
// clientBuilder.addInterceptor(new RequestInterceptor());
// clientBuilder.addInterceptor(new HeadersInterceptor());//使用自定义User-Agent
// builder.client(RetrofitUrlManager.getInstance().with(clientBuilder).build());
}
}
package com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.base.utils.encryption.Aes;
......@@ -28,12 +29,12 @@ public class HeadersInterceptor implements Interceptor {
builder.set("apptype", AppConstans.APP_TYPE);
builder.set("appinfo", DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()));
builder.set("mobileId", "1");
builder.set("uid", GsaCloudApplication.getMemberId() + "");
builder.set("uid", UserContext.newInstance().getMemberId() + "");
Headers headers = originalRequest.headers();
for (int i = 0; i < headers.size(); i++) {
builder.set(headers.name(i), headers.value(i));
}
if (GsaCloudApplication.isLogin) {
if (UserContext.newInstance().isLogin()) {
builder.set("token", getToken());
} else if (BuildConfig.DEBUG) {
builder.set("uuid", "999");
......@@ -48,9 +49,9 @@ public class HeadersInterceptor implements Interceptor {
private String getToken() {
String token = "";
if (GsaCloudApplication.isLogin) {
int memberId = GsaCloudApplication.getMemberId();
String loginToken = GsaCloudApplication.getLoginToken();
if (UserContext.newInstance().isLogin()) {
int memberId = UserContext.newInstance().getMemberId();
String loginToken = UserContext.newInstance().getLoginToken();
token = Aes.aesEncrypt("9_" + memberId + "_" + System.currentTimeMillis() + "_" + loginToken);
token = token.replaceAll("\r|\n", "");
}
......
......@@ -25,7 +25,7 @@ public class MyActivityLifecycle implements Application.ActivityLifecycleCallbac
@Override
public void onActivityCreated(Activity activity, Bundle bundle) {
LoganManager.w_action(TAG, TAG + ": onActivityCreated");
LoganManager.w_action(TAG, activity.getClass().getSimpleName() + ": onActivityCreated");
// EventBus.getDefault().register(activity);
if (!activity.getIntent().getBooleanExtra("isInitToolbar", false)) {
//由于加强框架的兼容性,故将 setContentView 放到 onActivityCreated 之后,onActivityStarted 之前执行
......@@ -38,13 +38,13 @@ public class MyActivityLifecycle implements Application.ActivityLifecycleCallbac
@Override
public void onActivityStarted(Activity activity) {
LoganManager.w_action(TAG, TAG + ": onActivityStarted");
LoganManager.w_action(TAG, activity.getClass().getSimpleName() + ": onActivityStarted");
}
@Override
public void onActivityResumed(Activity activity) {
String name = activity.getClass().getSimpleName();
LoganManager.w_action(TAG, TAG + ": onActivityResumed");
LoganManager.w_action(TAG, activity.getClass().getSimpleName() + ": onActivityResumed");
if (name.equals("NewMainActivity")) {
Observable.create(new ObservableOnSubscribe<Void>() {
......@@ -77,22 +77,22 @@ public class MyActivityLifecycle implements Application.ActivityLifecycleCallbac
@Override
public void onActivityPaused(Activity activity) {
LoganManager.w_action(TAG, TAG + ": onActivityPaused");
LoganManager.w_action(TAG, activity.getClass().getSimpleName() + ": onActivityPaused");
}
@Override
public void onActivityStopped(Activity activity) {
LoganManager.w_action(TAG, TAG + ": onActivityStopped");
LoganManager.w_action(TAG, activity.getClass().getSimpleName() + ": onActivityStopped");
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
LoganManager.w_action(TAG, TAG + ": onActivitySaveInstanceState");
LoganManager.w_action(TAG, activity.getClass().getSimpleName() + ": onActivitySaveInstanceState");
}
@Override
public void onActivityDestroyed(Activity activity) {
LoganManager.w_action(TAG, TAG + ": onActivityDestroyed");
LoganManager.w_action(TAG, activity.getClass().getSimpleName() + ": onActivityDestroyed");
// EventBus.getDefault().unregister(activity);
//横竖屏切换或配置改变时, Activity 会被重新创建实例, 但 Bundle 中的基础数据会被保存下来,移除该数据是为了保证重新创建的实例可以正常工作
activity.getIntent().removeExtra("isInitToolbar");
......
......@@ -20,64 +20,64 @@ public class MyFragmentLifecycle extends FragmentManager.FragmentLifecycleCallba
@Override
public void onFragmentAttached(@NonNull FragmentManager fm, @NonNull Fragment f, @NonNull Context context) {
LoganManager.w_action(TAG, TAG + ": onFragmentAttached");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentAttached");
}
@Override
public void onFragmentCreated(@NonNull FragmentManager fm, @NonNull Fragment f, @Nullable Bundle savedInstanceState) {
LoganManager.w_action(TAG, TAG + ": onFragmentCreated");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentCreated");
}
@Override
public void onFragmentActivityCreated(@NonNull FragmentManager fm, @NonNull Fragment f,
@Nullable Bundle savedInstanceState) {
LoganManager.w_action(TAG, TAG + ": onFragmentActivityCreated");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentActivityCreated");
}
@Override
public void onFragmentViewCreated(@NonNull FragmentManager fm, @NonNull Fragment f,
@NonNull View v, @Nullable Bundle savedInstanceState) {
LoganManager.w_action(TAG, TAG + ": onFragmentViewCreated");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentViewCreated");
}
@Override
public void onFragmentStarted(@NonNull FragmentManager fm, @NonNull Fragment f) {
LoganManager.w_action(TAG, TAG + ": onFragmentStarted");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentStarted");
}
@Override
public void onFragmentResumed(@NonNull FragmentManager fm, @NonNull Fragment f) {
LoganManager.w_action(TAG, TAG + ": onFragmentResumed");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentResumed");
}
@Override
public void onFragmentPaused(@NonNull FragmentManager fm, @NonNull Fragment f) {
LoganManager.w_action(TAG, TAG + ": onFragmentPaused");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentPaused");
}
@Override
public void onFragmentStopped(@NonNull FragmentManager fm, @NonNull Fragment f) {
LoganManager.w_action(TAG, TAG + ": onFragmentStopped");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentStopped");
}
@Override
public void onFragmentSaveInstanceState(@NonNull FragmentManager fm, @NonNull Fragment f,
@NonNull Bundle outState) {
LoganManager.w_action(TAG, TAG + ": onFragmentSaveInstanceState");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentSaveInstanceState");
}
@Override
public void onFragmentViewDestroyed(@NonNull FragmentManager fm, @NonNull Fragment f) {
LoganManager.w_action(TAG, TAG + ": onFragmentViewDestroyed");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentViewDestroyed");
}
@Override
public void onFragmentDestroyed(@NonNull FragmentManager fm, @NonNull Fragment f) {
LoganManager.w_action(TAG, TAG + ": onFragmentDestroyed");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentDestroyed");
}
@Override
public void onFragmentDetached(@NonNull FragmentManager fm, @NonNull Fragment f) {
LoganManager.w_action(TAG, TAG + ": onFragmentDetached");
LoganManager.w_action(TAG, f.getClass().getSimpleName() + ": onFragmentDetached");
}
}
......@@ -8,11 +8,6 @@ public class AppConstans {
* 供應鏈首頁action
*/
public static final String SUPPLY_CHAIN_MAIN_ACTION = "supply_chain_main_action";
/**
* 供應鏈模塊名
*/
public static final String SUPPLY_CHAIN_COMPONENT_NAME = "Component.SupplyChain";
public static final String RP_HEART_ERROR = "RP_HD001";//心跳斷開錯誤碼
public static final String RP_ORDER_LIST_ERROR = "RP_OL002";//訂單列表錯誤碼
......
package com.gingersoft.gsa.cloud.function;
import com.gingersoft.gsa.cloud.function.jump.ActivityJumpBean;
import lombok.Data;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
......@@ -7,12 +11,13 @@ package com.gingersoft.gsa.cloud.function;
* 修订历史:2020-04-11
* 描述:
*/
@Data
public class FModule {
private String keyRes;
private int openIconRes;
private int disableIconRes;
private ActivityJumpBean jumpBean;
public FModule(String keyRes, int openIconRes, int disableIconRes) {
this.keyRes = keyRes;
......@@ -20,15 +25,11 @@ public class FModule {
this.disableIconRes = disableIconRes;
}
public String getKeyRes() {
return keyRes;
}
public int getOpenIconRes() {
return openIconRes;
public FModule(String keyRes, int openIconRes, int disableIconRes, ActivityJumpBean jumpBean) {
this.keyRes = keyRes;
this.openIconRes = openIconRes;
this.disableIconRes = disableIconRes;
this.jumpBean = jumpBean;
}
public int getDisableIconRes() {
return disableIconRes;
}
}
package com.gingersoft.gsa.cloud.function;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-04-11
* 修订历史:2020-04-11
* 描述:
*/
public interface StyleConstans {
String width = "w";
String height = "h";
String front_size = "fs";
String front_color = "fc";
String backgroup_color = "bc";
}
package com.gingersoft.gsa.cloud.function;
import android.app.Activity;
import android.content.Context;
import com.gingersoft.gsa.cloud.database.bean.Function;
import java.util.List;
......@@ -12,9 +15,13 @@ import java.util.List;
*/
public interface XFunctionAction {
List<Function> getFunctionItems(String targetResKey);
void inJectFunctionAnnoations(Object view,Class<?> functionModules);
List<Function> getFunctionItems(String targetResKey,FModule[] fModules);
Function getFunctionItem(String targetResKey,FModule fModules);
Function getFunctionItem(String targetResKey);
List<Function> getFunctionsByResModule(List<Function> functionList);
void updateFunctions(List<Function> functions);
}
package com.gingersoft.gsa.cloud.function;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.function.jump.ActivityJumpBean;
import lombok.Getter;
import lombok.Setter;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:
*/
@Getter
@Setter
public class XFunctionBean extends Function {
private ActivityJumpBean jumpBean;
}
......@@ -9,15 +9,12 @@ import java.lang.annotation.Target;
* @author : bin
* @create date: 2020-11-21
* @update date: 2020-11-21
* @description:標識單個功能是否顯示,如:
*
* @BindView(R2.id.btn_send_order)
* Button btn_send_order;
* @description:標識定義的單個功能
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface XFunctionItem {
String [] value();
String value();
}
package com.gingersoft.gsa.cloud.function;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
......@@ -9,12 +10,11 @@ import java.lang.annotation.Target;
* @author : bin
* @create date: 2020-11-21
* @update date: 2020-11-21
* @description: 標識所在的頁面RecycleView,GridView等功能組數據源,如NewMainActivity頁面下有多個RecycleView
* * 每個RecycleView就是一個{@link XFunctionItems}}
* @description: 標識定義的一組功能
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface XFunctionItems {
String [] value();
String value();
}
package com.gingersoft.gsa.cloud.function;
import com.gingersoft.gsa.cloud.account.user.info.UserInfo;
import com.gingersoft.gsa.cloud.account.user.state.LogoutState;
import com.gingersoft.gsa.cloud.account.user.state.UserState;
import android.app.Activity;
import android.text.TextUtils;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.gingersoft.gsa.cloud.base.utils.ReflectionUtils;
import com.gingersoft.gsa.cloud.database.bean.Function;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import butterknife.BindView;
/**
* @author : bin
......@@ -37,11 +44,111 @@ public class XFunctionManager implements XFunctionAction {
return sXFunctionManager;
}
@Override
public void inJectFunctionAnnoations(Object rootView, Class<?> functionModules) {
Map<String, FModule[]> FModuleValues = new HashMap<>();
Map<String, FModule> FModuleValue = new HashMap<>();
Field[] functionFields = functionModules.getDeclaredFields();
for (int i = 0; i < functionFields.length; i++) {
Field field = functionFields[i];
field.setAccessible(true);
Annotation[] annotations = field.getAnnotations();
if (annotations == null) {
continue;
}
for (Annotation annotation : annotations) {
String value = null;
if (annotation instanceof XFunctionItems) {
XFunctionItems functionItems = (XFunctionItems) annotation;
value = functionItems.value();
try {
String name = field.getName();
FModule[] fModule = (FModule[]) field.get(name);
if (!FModuleValues.containsValue(fModule)) {
FModuleValues.put(value, fModule);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} else if (annotation instanceof XFunctionItem) {
XFunctionItem functionItem = (XFunctionItem) annotation;
value = functionItem.value();
try {
String name = field.getName();
FModule fModule = (FModule) field.get(name);
if (!FModuleValue.containsValue(fModule)) {
FModuleValue.put(value, fModule);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
Field[] viewFields = rootView.getClass().getDeclaredFields();
for (int i = 0; i < viewFields.length; i++) {
Field field = viewFields[i];
field.setAccessible(true);
Annotation[] annotations = field.getAnnotations();
if (annotations == null) {
continue;
}
for (Annotation annotation : annotations) {
if (annotation instanceof XFunctionViews) {
XFunctionViews functionViews = (XFunctionViews) annotation;
String value = functionViews.value();
if (FModuleValues.containsKey(value)) {
//功能組 拿到對應的key去匹配
List<Function> functions = getFunctionItems(value, FModuleValues.get(value));
try {
String name = field.getName();
//設置功能組數據源
ReflectionUtils.setField(rootView.getClass(), name, field.get(name), functions);
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
} else if (annotation instanceof XFunctionView) {
XFunctionView functionView = (XFunctionView) annotation;
String value = functionView.value();
int viewResId = functionView.viewId();
if (viewResId == 0) {
//控制單個功能 顯示隱藏需要viewId配合
continue;
}
View view;
if (rootView instanceof Fragment) {
view = ((Fragment) rootView).getActivity().findViewById(viewResId);
} else {
view = ((Activity) rootView).findViewById(viewResId);
}
if (view == null) {
continue;
}
if (FModuleValue.containsKey(value)) {
//已配置此功能 顯示view
// Function function = getFunctionItem(value, FModuleValue.get(value));
view.setVisibility(View.VISIBLE);
} else {
//未配置此功能,隱藏當前view
view.setVisibility(View.GONE);
}
}
}
}
}
@Override
public List<Function> getFunctionItems(String targetResKey) {
List<Function> functions = new ArrayList<>();
public List<Function> getFunctionItems(String targetResKey, FModule[] fModules) {
List<Function> functionList = new ArrayList<>();
if (mFunctionMap.size() == 0) {
return functions;
return functionList;
}
Iterator entries = mFunctionMap.entrySet().iterator();
while (entries.hasNext()) {
......@@ -51,20 +158,29 @@ public class XFunctionManager implements XFunctionAction {
String[] keyRes = resUrl.split("/");
if (keyRes.length > 1) {
resUrl = resUrl.substring(0, keyRes[keyRes.length - 1].length());
if(resUrl.equals(targetResKey)){
if (resUrl.startsWith(targetResKey)) {
/**
* 匹配功能組成功{@link XFunctionItems}
*/
Function item = (Function) entry.getValue();
functions.add(item) ;
functionList.add(item);
}
}
}
return functions;
for (int i = 0; i < functionList.size(); i++) {
Function function = functionList.get(i);
for (int j = 0; j < fModules.length; j++) {
FModule module = fModules[j];
if (function.getResUrl().equals(module.getKeyRes())) {
function.setIcRes(module.getOpenIconRes());
}
}
}
return functionList;
}
@Override
public Function getFunctionItem(String targetResKey) {
public Function getFunctionItem(String targetResKey, FModule fModules) {
if (mFunctionMap.size() == 0) {
return null;
}
......@@ -76,14 +192,22 @@ public class XFunctionManager implements XFunctionAction {
/**
* 匹配單個功能成功{@link XFunctionItem}
*/
Function item = (Function) entry.getValue();
return item;
Function function = (Function) entry.getValue();
if (function.getResUrl().equals(fModules.getKeyRes())) {
function.setIcRes(fModules.getOpenIconRes());
}
return function;
}
}
return null;
}
@Override
public List<Function> getFunctionsByResModule(List<Function> functionList) {
return null;
}
@Override
public void updateFunctions(List<Function> functions) {
if (functions == null) {
return;
......
package com.gingersoft.gsa.cloud.function;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeSpec;
import org.openjdk.javax.annotation.processing.AbstractProcessor;
import org.openjdk.javax.annotation.processing.ProcessingEnvironment;
import org.openjdk.javax.annotation.processing.Processor;
import org.openjdk.javax.annotation.processing.RoundEnvironment;
import org.openjdk.javax.lang.model.SourceVersion;
import org.openjdk.javax.lang.model.element.Element;
import org.openjdk.javax.lang.model.element.ElementKind;
import org.openjdk.javax.lang.model.element.Modifier;
import org.openjdk.javax.lang.model.element.TypeElement;
import java.util.Set;
/**
* @author : bin
* @create date: 2020-11-22
* @update date: 2020-11-22
* @description:
*/
//@AutoService(Processor.class)
public class XFunctionProcessor extends AbstractProcessor {
// 2
@Override
public synchronized void init(ProcessingEnvironment env) {
}
// 3
@Override
public boolean process(Set<? extends TypeElement> annoations, RoundEnvironment roundEnv) {
// for (Element element : roundEnv.getElementsAnnotatedWith(XFunctionComponent.class)) {
// if (element.getKind() != ElementKind.CLASS) {
// continue;
//// }
/**
* 遍歷所有組件註解
*/
// for (Element element2 : roundEnv.getElementsAnnotatedWith(XFunctionPage.class)) {
// if (element2.getKind() != ElementKind.CLASS) {
// continue;
// }
/**
* 遍歷所有Activity、Fragment、Dialog等頁面註解
*/
// for (Element element3 : roundEnv.getElementsAnnotatedWith(XFunctionItems.class)) {
// if (element3.getKind() != ElementKind.METHOD) {
// continue;
// }
// /**
// * 遍歷所有RecycleView,GridView等功能組註解
// */
//
// }
// for (Element element4 : roundEnv.getElementsAnnotatedWith(XFunctionItem.class)) {
// if (element4.getKind() != ElementKind.METHOD) {
// continue;
// }
// /**
// * 遍歷所有button,textview等單個功能註解
// */
//
// }
// }
// }
return true;
}
// 4
@Override
public Set<String> getSupportedAnnotationTypes() {
return null;
}
// 5
@Override
public SourceVersion getSupportedSourceVersion() {
return null;
}
}
package com.gingersoft.gsa.cloud.function;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author : bin
* @create date: 2020-11-21
* @update date: 2020-11-21
* @description:標識單個功能是否顯示,如:
*
* @XFunctionView()
* @BindView(R2.id.btn_send_order)
* Button btn_send_order;
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface XFunctionView {
String value();
//viewId
int viewId();
}
package com.gingersoft.gsa.cloud.function;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author : bin
* @create date: 2020-11-21
* @update date: 2020-11-21
* @description:標識所在頁面的RecycleView,GridView等功能組數據源,如NewMainActivity頁面下有多個RecycleView * * 每個RecycleView就是一個{@link XFunctionItems}}
* 如:
* @XFunctionViews(FunctionMain.ORDER_GROUP) private List<Function> mOrderingMeals;
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface XFunctionViews {
String value();
}
package com.gingersoft.gsa.cloud.function.jump;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import com.gingersoft.gsa.cloud.database.bean.Function;
import lombok.Getter;
import lombok.Setter;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:
*/
@Getter
@Setter
public class ActivityJumpBean {
private Class<? extends Activity> tagertAcitivty;
private String componentName;
private String actionName;
public ActivityJumpBean(Class<? extends Activity> tagertAcitivty, String componentName, String actionName) {
this.tagertAcitivty = tagertAcitivty;
this.componentName = componentName;
this.actionName = actionName;
}
}
package com.gingersoft.gsa.cloud.function.jump;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.database.bean.Function;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:頁面跳轉管理類
*/
public class ActivityJumpManager{
private static ActivityJumpManager sActivityJumpManager;
private List<ActivityJumpStrategy> mJumpStrategies = new ArrayList<>();
public static ActivityJumpManager getDefault() {
if (sActivityJumpManager == null) {
sActivityJumpManager = new ActivityJumpManager();
}
return sActivityJumpManager;
}
}
package com.gingersoft.gsa.cloud.function.jump;
import android.content.Context;
import android.content.Intent;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:統一頁面跳轉接口 , 避免一堆if else,switch
*/
public interface ActivityJumpStrategy {
void actionToJumpPage(Context context,ActivityJumpBean jumpBean);
}
package com.gingersoft.gsa.cloud.function.jump;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.billy.cc.core.component.CC;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:
*/
public class CCToJumpStrategy implements ActivityJumpStrategy{
@Override
public void actionToJumpPage(Context context, ActivityJumpBean jumpBean) {
if (!TextUtils.isEmpty(jumpBean.getComponentName()) && !TextUtils.isEmpty(jumpBean.getActionName())) {
CC.obtainBuilder(jumpBean.getComponentName())
.setActionName(jumpBean.getActionName())
.build()
.call();
}
}
}
package com.gingersoft.gsa.cloud.function.jump;
import android.content.Context;
import android.content.Intent;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:
*/
public class IntentJumpStrategy implements ActivityJumpStrategy {
@Override
public void actionToJumpPage(Context context, ActivityJumpBean jumpBean) {
if (jumpBean.getTagertAcitivty() != null) {
Intent intent = new Intent(context, jumpBean.getTagertAcitivty());
context.startActivity(intent);
}
}
}
......@@ -7,6 +7,7 @@ import android.util.Log;
import com.dianping.logan.Logan;
import com.dianping.logan.SendLogCallback;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
......@@ -40,7 +41,7 @@ public class LoganManager {
Logan.w(log, LoganConfig.NETWORK_LEVLE);
//網絡日誌比較重要立即寫入本地
// Logan.f();
// printLog("Network", log);
printLog("Network", log);
}
public static void w_crash(String log) {
......@@ -68,7 +69,7 @@ public class LoganManager {
* 上傳日誌到服務器
*/
public static void uploadLog(Context context, boolean showToast) {
String memberId = GsaCloudApplication.getMemberName() + "_" + GsaCloudApplication.getMemberId();
String memberId = UserContext.newInstance().getMemberName() + "_" + UserContext.newInstance().getMemberId();
String deviceId = DeviceUtils.getDeviceId(GsaCloudApplication.getAppContext());
String AppVersion = DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()) + "_" + DeviceUtils.getVersionCode(GsaCloudApplication.getAppContext());
String BuildVersion = android.os.Build.VERSION.RELEASE + "";
......
......@@ -13,5 +13,4 @@ public interface Strategy<T> {
* 具體行為實現方法
*/
void action(T t);
}
......@@ -63,6 +63,13 @@ public class PrjBean {
private int actualPrinterDeviceId;
private String takeFoodCode; //取餐碼
private String billNo;//訂單碼
/**
* 訂單類型
* 1:堂食
* 2:
* 3:skyorder
* 7:自取
*/
private int orderType;//訂單類型
private String userName;
/***
......
......@@ -18,8 +18,9 @@ import android.util.Log
import android.widget.RemoteViews
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.account.user.UserContext
import com.gingersoft.gsa.cloud.base.R
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.SoundPoolUtils
import com.gingersoft.gsa.cloud.base.utils.okhttpUtils.OkHttp3Utils
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
......@@ -64,7 +65,7 @@ class GetInfoUpdateService : Service() {
}
val restaurantId by lazy {
GsaCloudApplication.getRestaurantId()
ResturantInfoManager.newInstance().getRestaurantId()
}
override fun onBind(intent: Intent?): IBinder? {
......@@ -101,7 +102,7 @@ class GetInfoUpdateService : Service() {
*/
@RequiresApi(Build.VERSION_CODES.O)
fun createNotificationChannel() {
if(!GsaCloudApplication.isLogin){
if(!UserContext.newInstance().isLogin){
stopSelf()
return
}
......
......@@ -86,17 +86,17 @@ public class LoginBean {
* brands : [{"brandId":242,"brandName":"莫拉塔","restaurants":[]},{"brandId":243,"brandName":"蕭蕭","restaurants":[{"restaurantId":337,"restaurantName":"小張"}]}]
*/
private Integer id;
private String userName;
private Integer groupId;
private Integer parentId;
private Integer merchantsId;
private String mobile;
private String email;
private int status;
private byte status;
private Date createTime;
private String createBy;
private Date updateTime;
private String updateBy;
private String userName;
public String getUserName() {
return userName;
......@@ -154,11 +154,11 @@ public class LoginBean {
this.email = email;
}
public int getStatus() {
public byte getStatus() {
return status;
}
public void setStatus(int status) {
public void setStatus(byte status) {
this.status = status;
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/red_400" />
<size
android:width="2dp"
android:height="2dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/theme_grey_color" />
<size
android:width="2dp"
android:height="2dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_5" />
<solid android:color="@color/red_500" />
<size
android:width="@dimen/dp_10"
android:height="@dimen/dp_4" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/theme_grey_color" />
<corners android:radius="@dimen/dp_5" />
<size
android:width="@dimen/dp_10"
android:height="@dimen/dp_3" />
</shape>
\ No newline at end of file
......@@ -215,8 +215,5 @@
android:layout_marginTop="@dimen/dp_20"
android:textSize="@dimen/dp_28"
tools:text="1/2" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.coldchain_module.mvp.ui.activity.ColdChainMainActivity;
import com.gingersoft.gsa.cloud.component.ComponentName;
public class ComponentColdChain implements IComponent {
......@@ -13,7 +14,7 @@ public class ComponentColdChain implements IComponent {
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "Component.ColdChain";
return ComponentName.COMPONENT_COLDCHAIN;
}
/**
......
......@@ -12,7 +12,8 @@ import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateRestaurantStateBean;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.utils.RestaurantExpandInfoUtils;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
......@@ -87,7 +88,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
if (info != null && info.isSuccess()) {
// mRootView.loadNumber(info);
// try {
method.setAccessible(true);
method.setAccessible(true);
try {
method.invoke(object, info);
} catch (IllegalAccessException | InvocationTargetException e) {
......@@ -131,7 +132,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
}
public void getBalance() {
mModel.getBalance(GsaCloudApplication.getBrandId() + "")
mModel.getBalance(ResturantInfoManager.newInstance().getBrandId() + "")
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
})
......@@ -181,7 +182,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
public void updateExpandInfo(String settingName, String[] valueType, String[] value) {
FormBody.Builder builder = new FormBody.Builder()
.add("id", RestaurantExpandInfoUtils.getId(settingName) + "")
.add("restaurantId", GsaCloudApplication.getRestaurantId() + "")
.add("restaurantId", ResturantInfoManager.newInstance().getRestaurantId() + "")
.add("settingName", settingName);
for (int i = 0; i < valueType.length; i++) {
builder.add(valueType[i], value[i]);
......@@ -306,7 +307,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
thirdDelivery(info.getData().get(0));
} else {
if (errorCount < 5) {
startToBeConfirmedOrderList(GsaCloudApplication.getRestaurantId());
startToBeConfirmedOrderList(ResturantInfoManager.newInstance().getRestaurantId());
errorCount++;
}
}
......@@ -376,10 +377,10 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
//添加PRJ
addPrj(dataBean);
RequestBody requestBody = new FormBody.Builder()
.add("memberId", GsaCloudApplication.getMemberId() + "")
.add("memberId", UserContext.newInstance().getMemberId() + "")
.add("orderId", dataBean.getID() + "")
.add("status", status + "")
.add("", GsaCloudApplication.getMemberName() + "")
.add("", UserContext.newInstance().getMemberName())
.build();
mModel.updateOrderStatus(requestBody)
.subscribeOn(Schedulers.io())
......@@ -403,7 +404,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
findOrderDetails(ids.get(0));
ids.remove(0);
} else {
startToBeConfirmedOrderList(GsaCloudApplication.getRestaurantId());
startToBeConfirmedOrderList(ResturantInfoManager.newInstance().getRestaurantId());
}
}
});
......@@ -430,7 +431,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
}
RequestBody requestBody = new FormBody.Builder()
.add("orderId", dataBean.getID() + "")
.add("restaurantId", GsaCloudApplication.getRestaurantId() + "")
.add("restaurantId", ResturantInfoManager.newInstance().getRestaurantId() + "")
.add("orderDetailsIds", ids.toString())
.build();
mModel.addPrj(requestBody);
......
......@@ -9,7 +9,8 @@ import com.gingersoft.coldchain_module.mvp.model.bean.ReadBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.utils.FileUtils;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
......@@ -201,10 +202,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
//添加PRJ
addPrj(dataBean);
RequestBody requestBody = new FormBody.Builder()
.add("memberId", GsaCloudApplication.getMemberId() + "")
.add("memberId", UserContext.newInstance().getMemberId() + "")
.add("orderId", dataBean.getID() + "")
.add("status", status + "")
.add("", GsaCloudApplication.getMemberName() + "")
.add("", UserContext.newInstance().getMemberName() + "")
.build();
mModel.updateOrderStatus(requestBody)
.subscribeOn(Schedulers.io())
......@@ -267,7 +268,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
}
RequestBody requestBody = new FormBody.Builder()
.add("orderId", dataBean.getID() + "")
.add("restaurantId", GsaCloudApplication.getRestaurantId() + "")
.add("restaurantId", ResturantInfoManager.newInstance().getRestaurantId() + "")
.add("orderDetailsIds", ids.toString())
.build();
mModel.addPrj(requestBody);
......@@ -350,10 +351,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
public void cancelOrder(int orderId) {
RequestBody requestBody = new FormBody.Builder()
.add("memberId", GsaCloudApplication.getMemberId() + "")
.add("memberId", UserContext.newInstance().getMemberId() + "")
.add("orderId", orderId + "")
.add("status", "6")
.add("", GsaCloudApplication.getMemberName())
.add("", UserContext.newInstance().getMemberName())
.build();
mModel.updateOrderStatus(requestBody)
.subscribeOn(Schedulers.io())
......@@ -389,7 +390,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
public void cancelLogistics(int orderId, boolean isCancelOrder) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", GsaCloudApplication.getRestaurantId() + "")
.add("restaurantId", ResturantInfoManager.newInstance().getRestaurantId() + "")
.add("orderId", orderId + "")
.add("reasonId", "")
.add("reasonDesc", "")
......
......@@ -9,7 +9,8 @@ import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
......@@ -269,10 +270,10 @@ public class OrderListPresenter extends BasePresenter<OrderListContract.Model, O
//添加PRJ
addPrj(dataBean);
RequestBody requestBody = new FormBody.Builder()
.add("memberId", GsaCloudApplication.getMemberId() + "")
.add("memberId", UserContext.newInstance().getMemberId() + "")
.add("orderId", dataBean.getID() + "")
.add("status", status + "")
.add("", GsaCloudApplication.getMemberName() + "")
.add("", UserContext.newInstance().getMemberName() + "")
.build();
mModel.updateOrderStatus(requestBody)
.subscribeOn(Schedulers.io())
......@@ -317,7 +318,7 @@ public class OrderListPresenter extends BasePresenter<OrderListContract.Model, O
}
RequestBody requestBody = new FormBody.Builder()
.add("orderId", dataBean.getID() + "")
.add("restaurantId", GsaCloudApplication.getRestaurantId() + "")
.add("restaurantId", ResturantInfoManager.newInstance().getRestaurantId() + "")
.add("orderDetailsIds", ids.toString())
.build();
mModel.addPrj(requestBody);
......
......@@ -6,7 +6,8 @@ import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstants;
import com.gingersoft.coldchain_module.mvp.contract.SupplementOrderContract;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementResultBean;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
......@@ -125,11 +126,11 @@ public class SupplementOrderPresenter extends BasePresenter<SupplementOrderContr
JSONObject json;
json = new JSONObject();
try {
json.put("shopId", GsaCloudApplication.getRestaurantId());
json.put("shopId", ResturantInfoManager.newInstance().getRestaurantId());
json.put("phone", phone);
json.put("replenishmentType", "1");
json.put("transportationType", "3");
json.put("memberId", GsaCloudApplication.getMemberId());
json.put("memberId", UserContext.newInstance().getMemberId());
// json.put("addressId", );
json.put("addressDetail", address);
// json.put("sendTime", );
......
......@@ -35,7 +35,7 @@ import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.presenter.ColdChainMainPresenter;
import com.gingersoft.coldchain_module.mvp.ui.fragment.OrderListFragment;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.base.utils.RestaurantExpandInfoUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
......@@ -144,7 +144,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
public void initData(@Nullable Bundle savedInstanceState) {
mPresenter.getBalance();
restaurantId = GsaCloudApplication.getRestaurantId();
restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
fragments = new ArrayList<>();
List<String> titles = Arrays.asList("全部", "待確認", "待提交", "派送中");
for (int i = 0; i < titles.size(); i++) {
......@@ -395,7 +395,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
.animStyle(QMUIPopup.ANIM_AUTO)
.show(v);
view.findViewById(R.id.layout_history_order).setOnClickListener(v1 -> {
CC.obtainBuilder("ComponentDeliveryPick")
CC.obtainBuilder(com.gingersoft.gsa.cloud.component.ComponentName.COMPONENT_DELIVERYPICK)
.setActionName("historyActivity")
.addParam(DeliveryPickConstans.ORDER_TYPE, 8)
.build()
......
......@@ -17,7 +17,7 @@ import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstants;
import com.gingersoft.coldchain_module.mvp.contract.SupplementOrderContract;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.presenter.SupplementOrderPresenter;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseActivity;
......@@ -72,7 +72,7 @@ public class SupplementOrderActivity extends BaseActivity<SupplementOrderPresent
@Override
public void initData(@Nullable Bundle savedInstanceState) {
restaurantId = GsaCloudApplication.getRestaurantId();
restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mPresenter.getNumByOrderType(restaurantId);
......
......@@ -24,7 +24,7 @@ import com.gingersoft.coldchain_module.mvp.presenter.OrderListPresenter;
import com.gingersoft.coldchain_module.mvp.ui.activity.ColdChainMainActivity;
import com.gingersoft.coldchain_module.mvp.ui.activity.OrderDetailsActivity;
import com.gingersoft.coldchain_module.mvp.ui.adapter.OrderListAdapter;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
......@@ -83,7 +83,7 @@ public class OrderListFragment extends BaseFragment<OrderListPresenter> implemen
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mRefreshLayout.setPrimaryColorsId(android.R.color.transparent, android.R.color.black);
restaurantId = GsaCloudApplication.getRestaurantId();
restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
Bundle arguments = getArguments();
if (arguments != null) {
......
......@@ -6,6 +6,7 @@ import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.service.GetInfoUpdateService;
import com.gingersoft.gsa.delivery_pick_mode.data.network.ServiceCreator;
import com.gingersoft.gsa.delivery_pick_mode.mvp.ui.activity.PrjQueryActivity;
......@@ -20,7 +21,7 @@ public class DeliveryPickComponent implements IComponent {
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "ComponentDeliveryPick";
return ComponentName.COMPONENT_DELIVERYPICK;
}
/**
......
package com.gingersoft.gsa.delivery_pick_mode.data.network
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept.HeadersInterceptor
import com.gingersoft.gsa.cloud.config.globalconfig.applyOptions.intercept.LoggingInterceptor
import com.gingersoft.gsa.cloud.constans.HttpsConstans
import com.gingersoft.gsa.cloud.constans.HttpsConstans.ROOT_SERVER
import com.gingersoft.gsa.cloud.constans.HttpsConstans.URK_RICEPON_GSA
import com.jess.arms.http.log.RequestInterceptor
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
......@@ -18,7 +18,7 @@ object ServiceCreator {
.callTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.addInterceptor(LoggingInterceptor())
.addInterceptor(RequestInterceptor())
.addInterceptor(HeadersInterceptor())
private lateinit var builder: Retrofit.Builder
......
......@@ -6,10 +6,11 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.billy.cc.core.component.CC
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.base.order.order.TakeawayOrder
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.component.ComponentName
import com.gingersoft.gsa.cloud.constans.PrintConstans
import com.gingersoft.gsa.cloud.print.bean.OrderDetails
import com.gingersoft.gsa.delivery_pick_mode.data.HistoryOrderRepository
......@@ -34,7 +35,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
} else {
orderNumber = orderNum
}
historyOrderRepository.getHistoryOrderList(GsaCloudApplication.getRestaurantId().toString(), status, startDate, endDate, pageIndex, "10", orderType, orderNumber, phone).apply {
historyOrderRepository.getHistoryOrderList(ResturantInfoManager.newInstance().getRestaurantId().toString(), status, startDate, endDate, pageIndex, "10", orderType, orderNumber, phone).apply {
this.data?.let {
if (it.size > 0) {
it.removeAt(it.size - 1)//移除最後一個,最後一個是顯示總條數的
......@@ -88,7 +89,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
orderDetails.data!![0].order_type = data.order_type
orderDetails.data!![0].orderPayType = data.orderPayType
TakeawayOrder.getInstance().shoppingCart.dataBean = orderDetails.data!![0]
CC.obtainBuilder("Component.Print")
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_ORDER)
.setActionName("printActivity")
.build()
......
......@@ -12,6 +12,8 @@ import androidx.lifecycle.viewModelScope
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.billy.cc.core.component.CC
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.account.user.UserContext
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod
import com.gingersoft.gsa.cloud.base.order.order.TakeawayOrder
......@@ -21,6 +23,7 @@ import com.gingersoft.gsa.cloud.base.utils.other.TextUtil
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.base.widget.DialogUtils
import com.gingersoft.gsa.cloud.component.ComponentName
import com.gingersoft.gsa.cloud.constans.AppConstans
import com.gingersoft.gsa.cloud.constans.FoodSummaryConstans
import com.gingersoft.gsa.cloud.constans.PrintConstans
......@@ -53,7 +56,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val Transportation = 1009//修改運輸工具成功
}
val restaurantId by lazy { GsaCloudApplication.getRestaurantId() }
val restaurantId by lazy { ResturantInfoManager.newInstance().getRestaurantId() }
var mOrderNum = arrayListOf<MutableLiveData<Int>>()
var mOrderList = arrayListOf<MutableLiveData<ArrayList<OrderList.DataBeanX.DataBean>>>()
......@@ -616,7 +619,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
fun printOrder(code: Int, dataBean: OrderDetails.DataBean, listener: (MessageBean) -> Unit) {
//訂單信息和廚房單,打印前需要修改dataBean的order_type和orderPayType
TakeawayOrder.getInstance().shoppingCart.dataBean = dataBean
CC.obtainBuilder("Component.Print")
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_ORDER)
.setActionName("printActivity")
.build()
......@@ -631,7 +634,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/
private fun printOrderClosing(dataBean: OrderDetails.DataBean, listener: (Int, Boolean) -> Unit) {
TakeawayOrder.getInstance().shoppingCart.dataBean = dataBean
CC.obtainBuilder("Component.Print")
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_CLOSING)
.setActionName("printActivity")
.build()
......@@ -651,7 +654,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
// }, {
// it.printStackTrace()
// })
CC.obtainBuilder("Component.Print")
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_INSTRUCTION)
.addParam(PrintConstans.PRINT_LOADING, false)
.setActionName("printActivity")
......@@ -728,7 +731,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/
fun selectorDelivery(context: Context, dataBean: OrderDetails.DataBean, status: Int, listener: (Int, Boolean) -> Unit) {
launch({
repository.getDeliveryInfo(GsaCloudApplication.getRestaurantId().toString(), GsaCloudApplication.getMemberId().toString()).apply {
repository.getDeliveryInfo(ResturantInfoManager.newInstance().getRestaurantId().toString(), UserContext.newInstance().getMemberId().toString()).apply {
deliveryBean = this
if (this.data.isEmpty()) {
ToastUtils.show(context, "沒有配置配送員信息")
......
......@@ -2,7 +2,7 @@ package com.gingersoft.gsa.delivery_pick_mode.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.delivery_pick_mode.mvp.bean.PrjQueryBean;
import com.gingersoft.gsa.delivery_pick_mode.mvp.contract.PrjQueryContract;
......@@ -52,7 +52,7 @@ public class PrjQueryModel extends BaseModel implements PrjQueryContract.Model {
@Override
public Observable<PrjQueryBean> getKitchenPrint(String orderId) {
return mRepositoryManager.obtainRetrofitService(PrjQueryServer.class).
getKitchenPrint(orderId, GsaCloudApplication.getRestaurantId() + "");
getKitchenPrint(orderId, ResturantInfoManager.newInstance().getRestaurantId() + "");
}
@Override
......
......@@ -2,9 +2,10 @@ package com.gingersoft.gsa.delivery_pick_mode.mvp.presenter;
import android.app.Activity;
import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.order.order.TakeawayOrder;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
......@@ -184,7 +185,7 @@ public class SendOrderPresenter extends BasePresenter<SendOrderContract.Model, S
}
RequestBody requestBody = new FormBody.Builder()
.add("orderId", orderId)
.add("restaurantId", GsaCloudApplication.getRestaurantId() + "")
.add("restaurantId", ResturantInfoManager.newInstance().getRestaurantId() + "")
.add("orderDetailsIds", ids.toString())
.build();
mModel.addPrj(requestBody)
......@@ -222,11 +223,11 @@ public class SendOrderPresenter extends BasePresenter<SendOrderContract.Model, S
JSONObject json;
json = new JSONObject();
try {
json.put("shopId", GsaCloudApplication.getRestaurantId());
json.put("shopId", ResturantInfoManager.newInstance().getRestaurantId());
json.put("phone", phone);
json.put("appointmentType", 0);
json.put("transportationType", "0");//0 本店配送 ,是,1,Zeek,2,Lalamove
json.put("memberId", GsaCloudApplication.getMemberId());
json.put("memberId", UserContext.newInstance().getMemberId());
json.put("addressDetail", address);
json.put("orderRemark", "");
json.put("payType", 1);
......
......@@ -19,6 +19,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.base.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.print.bean.PrjBean;
......@@ -254,7 +255,7 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements
//添加重印的報警推送
OkHttp3Utils.noticePersonnel(AppConstans.RP_REPRINT_CODE, "重印,訂單號:" + printDatas.get(0).getOrderNo());
String finalIds = ids.toString();
CC.obtainBuilder("Component.Print")
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_KITCHEN)
.addParam("prjBeans", printDatas)
.setActionName("printActivity")
......
......@@ -60,7 +60,7 @@
// }
//
// val restaurantId by lazy {
// GsaCloudApplication.getRestaurantId()
// ResturantInfoManager.newInstance().getRestaurantId()
// }
//
// override fun onBind(intent: Intent?): IBinder? {
......
......@@ -21,7 +21,8 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.viewpager.widget.ViewPager
import com.billy.cc.core.component.CC
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.account.user.UserContext
import com.gingersoft.gsa.cloud.base.order.order.BaseOrder
import com.gingersoft.gsa.cloud.base.utils.RestaurantExpandInfoUtils
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils
......@@ -58,8 +59,8 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
private val pageViewModel by lazy { ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] }
private val instance by lazy { this }
private val restaurantId by lazy { GsaCloudApplication.getRestaurantId() }
private val memberId by lazy { GsaCloudApplication.getMemberId() }
private val restaurantId by lazy { ResturantInfoManager.newInstance().getRestaurantId() }
private val memberId by lazy { UserContext.newInstance().getMemberId() }
private val ints = arrayOf(
R.string.tab_text_1,
......@@ -207,7 +208,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
override fun onStart() {
super.onStart()
pageViewModel.getBanlance(GsaCloudApplication.getBrandId())
pageViewModel.getBanlance(ResturantInfoManager.newInstance().getBrandId())
}
override fun onResume() {
......@@ -461,7 +462,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
}
}
//刷新餘額
pageViewModel.getBanlance(GsaCloudApplication.getBrandId())
pageViewModel.getBanlance(ResturantInfoManager.newInstance().getBrandId())
}
})
it.execute {
......@@ -540,7 +541,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
val openCashBoxFunction = FunctionManager.getFunctionByKey(functionByResModule, FunctionManagerConstants.takeaway.TAKEAWAY_OPEN_CASH_BOX)
qm_other_order_bar.setTitle(GsaCloudApplication.getRestaurantName())
qm_other_order_bar.setTitle(ResturantInfoManager.newInstance().getRestaurantName())
qm_other_order_bar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
if (newOrderFunction != null || historyOrderFunction != null || openCashBoxFunction != null) {
......@@ -628,7 +629,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
R.id.tv_new_order -> {
//新訂單
BaseOrder.orderType = TAKEAWAY_TYPE
CC.obtainBuilder("Component.Table")
CC.obtainBuilder(com.gingersoft.gsa.cloud.component.ComponentName.COMPONENT_TABLE)
.setActionName("showMealStandActivity")
.build()
.call()
......
......@@ -17,7 +17,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ethanhua.skeleton.Skeleton
import com.ethanhua.skeleton.ViewSkeletonScreen
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.account.user.UserContext
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.base.widget.DialogUtils
......@@ -92,7 +93,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
.color(R.color.white)
.show()
restaurantId = GsaCloudApplication.getRestaurantId()
restaurantId = ResturantInfoManager.newInstance().getRestaurantId()
orderId = intent.getStringExtra("orderId")//訂單id
orderType = intent.getIntExtra("orderType", 0)//訂單類型
orderPayType = intent.getIntExtra("orderPayType", 0)//訂單支付方式
......@@ -113,7 +114,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
}
private fun initTopBar(topbar: QMUITopBar) {
topbar.setTitle(GsaCloudApplication.getRestaurantName())
topbar.setTitle(ResturantInfoManager.newInstance().getRestaurantName())
topbar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
topbar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color))
......@@ -471,7 +472,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
private fun additionalServiceCharge(amount: Int) {
showLoading()
pageViewModel.additionalServiceCharge(GsaCloudApplication.getMemberId().toString(), orderId, amount)
pageViewModel.additionalServiceCharge(UserContext.newInstance().getMemberId().toString(), orderId, amount)
}
private fun PageViewModel.selectLalaMove(orderDetails: OrderDetails.DataBean, isPrint: Boolean, black: (it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean) -> Unit) {
......@@ -519,7 +520,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
private fun PageViewModel.showSelectTransportation(transportationBeans: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean, isPrint: Boolean) {
//獲取實際金額
showLoading()
getActualAmount(orderId, GsaCloudApplication.getMemberId(), restaurantId) { it ->
getActualAmount(orderId, UserContext.newInstance().getMemberId(), restaurantId) { it ->
cancelDialogForLoading()
it?.let { transportAmountBean ->
transportAmountBean.data.let { transportData ->
......@@ -605,7 +606,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
private fun PageViewModel.cancelOrder(orderDetails: OrderDetails.DataBean) {
//獲取取消原因讓用戶選擇
showLoading()
getCancelReason(GsaCloudApplication.getBrandId(), restaurantId, 3) { cancelReson ->
getCancelReason(ResturantInfoManager.newInstance().getBrandId(), restaurantId, 3) { cancelReson ->
cancelDialogForLoading()
if (cancelReson != null && cancelReson.data.isNotEmpty()) {
//如果有配置取消原因
......@@ -630,7 +631,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
if (orderDetails.isDelete == 0) {
//是第三方物流單,先取消物流,再取消訂單
cancelLogistics(restaurantId, orderId, reasonId, reasonDesc) {
cancelOrder(GsaCloudApplication.getMemberId().toString(), GsaCloudApplication.getMemberName(), orderId, reasonId, reasonDesc) {
cancelOrder(UserContext.newInstance().getMemberId().toString(), UserContext.newInstance().getMemberName(), orderId, reasonId, reasonDesc) {
cancelDialogForLoading()
if (it) {
finish()
......@@ -642,7 +643,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
}
} else {
//取消訂單
cancelOrder(GsaCloudApplication.getMemberId().toString(), GsaCloudApplication.getMemberName(), orderId, reasonId, reasonDesc) {
cancelOrder(UserContext.newInstance().getMemberId().toString(), UserContext.newInstance().getMemberName(), orderId, reasonId, reasonDesc) {
cancelDialogForLoading()
if (it) {
finish()
......@@ -663,7 +664,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
private fun PageViewModel.cancelLogistics(orderDetails: OrderDetails.DataBean) {
//獲取取消原因讓用戶選擇
showLoading()
getCancelReason(GsaCloudApplication.getBrandId(), restaurantId, 2) { cancelReson ->
getCancelReason(ResturantInfoManager.newInstance().getBrandId(), restaurantId, 2) { cancelReson ->
cancelDialogForLoading()
if (cancelReson != null && cancelReson.data.isNotEmpty()) {
//如果有配置取消原因
......
......@@ -7,7 +7,7 @@ import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
......@@ -59,7 +59,7 @@ class PayActivity : BaseActivity<IPresenter>() {
}
other_pay_view.loadInfo(this, ArrayList<PayMethod>(), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount)
pageViewModel.getPayMethod(GsaCloudApplication.getBrandId(), GsaCloudApplication.getRestaurantId())
pageViewModel.getPayMethod(ResturantInfoManager.newInstance().getBrandId(), ResturantInfoManager.newInstance().getRestaurantId())
pageViewModel.payTypeBean.observe(this, Observer {
//獲取支付方式
// other_pay_view.loadInfo(this, PayTypeInfo.getPayMethodByPayType(it), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount)
......
......@@ -8,7 +8,8 @@ import android.widget.Button
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.account.user.UserContext
import com.gingersoft.gsa.cloud.ui.utils.AppDialog
import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.DeliveryViewModel
......@@ -57,7 +58,7 @@ class DeliveryFragment : BaseFragment() {
AppDialog().showWaringDialog(context, "是否確認刪除") { _, dialog ->
showLoading()
it.data.list[position].apply {
viewModel.updateDeliveryConfig(distributionFeeMin.toString(), distributionFeeMax.toString(), distributionFee.toString(), deliveryCost.toString(), distributionType, type, desc, id, GsaCloudApplication.getRestaurantId(), GsaCloudApplication.getMemberId(), lackPrice.toString(), 1) {
viewModel.updateDeliveryConfig(distributionFeeMin.toString(), distributionFeeMax.toString(), distributionFee.toString(), deliveryCost.toString(), distributionType, type, desc, id, ResturantInfoManager.newInstance().getRestaurantId(), UserContext.newInstance().getMemberId(), lackPrice.toString(), 1) {
dialog.dismiss()
cancelDialogForLoading()
}
......@@ -75,7 +76,7 @@ class DeliveryFragment : BaseFragment() {
}
})
viewModel.queryDeliveryList(GsaCloudApplication.getRestaurantId().toString())
viewModel.queryDeliveryList(ResturantInfoManager.newInstance().getRestaurantId().toString())
}
}
......@@ -2,12 +2,12 @@ package com.gingersoft.gsa.delivery_pick_mode.ui.fragment
import android.content.Intent
import android.os.Bundle
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.account.user.UserContext
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.delivery_pick_mode.R
......@@ -27,8 +27,8 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
private val pageViewModel by lazy { ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] }
private var page = 1
private val restaurantId by lazy { GsaCloudApplication.getRestaurantId() }
private val memberId by lazy { GsaCloudApplication.getMemberId() }
private val restaurantId by lazy { ResturantInfoManager.newInstance().getRestaurantId() }
private val memberId by lazy { UserContext.newInstance().getMemberId() }
private lateinit var adapter: OtherOrdersAdapter
private var position = 0
......
......@@ -6,7 +6,8 @@ import android.view.View
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.account.user.UserContext
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.DeliveryConfig
......@@ -111,7 +112,7 @@ class UpdateDeliveryFragment : BaseFragment(R.layout.update_delivery_fragment) {
if (deliveryConfig == null) {
//新增
viewModel.addDeliveryConfig(et_min_delivery_fee.text.toString(), et_max_delivery_fee.text.toString(), ed_delivery_fee.text.toString(), ed_start_delivery_fee.text.toString(), selectDeliveryType, selectDeliveryMethodPosition,
ed_desc.text.toString(), GsaCloudApplication.getRestaurantId(), GsaCloudApplication.getMemberId(), ed_difference_fee.text.toString()) {
ed_desc.text.toString(), ResturantInfoManager.newInstance().getRestaurantId(), UserContext.newInstance().getMemberId(), ed_difference_fee.text.toString()) {
cancelDialogForLoading()
if (it != null && it.success) {
ToastUtils.show(context, "保存成功")
......@@ -123,7 +124,7 @@ class UpdateDeliveryFragment : BaseFragment(R.layout.update_delivery_fragment) {
} else {
//編輯
viewModel.updateDeliveryConfig(et_min_delivery_fee.text.toString(), et_max_delivery_fee.text.toString(), ed_delivery_fee.text.toString(), ed_start_delivery_fee.text.toString(), selectDeliveryType, selectDeliveryMethodPosition,
ed_desc.text.toString(), deliveryConfig!!.id, GsaCloudApplication.getRestaurantId(), GsaCloudApplication.getMemberId(), ed_difference_fee.text.toString(), 0) {
ed_desc.text.toString(), deliveryConfig!!.id, ResturantInfoManager.newInstance().getRestaurantId(), UserContext.newInstance().getMemberId(), ed_difference_fee.text.toString(), 0) {
cancelDialogForLoading()
if (it != null && it.success) {
ToastUtils.show(context, "修改成功")
......
......@@ -6,6 +6,7 @@ import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.download.mvp.ui.activity.DownloadActivity;
import com.jess.arms.integration.AppManager;
......@@ -21,7 +22,7 @@ public class ComponentDownload implements IComponent {
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "Component.Download";
return ComponentName.COMPONENT_DOWNLOAD;
}
/**
......
......@@ -2,14 +2,16 @@ package com.gingersoft.gsa.cloud.download.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.Api;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.common.bean.FoodBean;
import com.gingersoft.gsa.cloud.base.utils.CommonConfiguration;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.base.utils.RestaurantExpandInfoUtils;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.Discount;
......@@ -36,6 +38,7 @@ import com.gingersoft.gsa.cloud.download.mvp.model.downmanager.DownloadManager;
import com.gingersoft.gsa.cloud.download.mvp.model.downmanager.DownloadRequest;
import com.gingersoft.gsa.cloud.download.mvp.ui.activity.DownloadActivity;
import com.gingersoft.gsa.cloud.download.mvp.ui.adapter.DataDownLoadAdapter;
import com.gingersoft.gsa.cloud.function.XFunctionManager;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
......@@ -149,7 +152,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
setDownAverageRatio();
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
List<DownloadRequest> requests = getDownloadRequests(getDownloadUrls(restaurantId), restaurantId);
......@@ -206,7 +209,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
public void downFun(int downTag) {
long userId = GsaCloudApplication.getMemberId();
long userId = UserContext.newInstance().getMemberId();
mModel.downFunctionList(userId)
.observeOn(AndroidSchedulers.mainThread())
......@@ -233,6 +236,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
functionDao.insertMultFunction(functionBean.getData());
}
});
XFunctionManager.newInstance().updateFunctions(functionBean.getData());
}
DataDownLoadState loadState = mList.get(downTag);
......@@ -259,7 +263,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
public void downFoodList(int downTag) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.downFoodList(restaurantId)
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -311,7 +315,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
public void downModifier(int downTag) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.downModifier(restaurantId)
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -364,7 +368,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
public void downFoodCombo(int downTag) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.downFoodCombo(restaurantId)
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -418,7 +422,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
public void downComboItem(int downTag) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.downComboItem(restaurantId)
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -470,7 +474,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
public void downFoodModifier(int downTag) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.downFoodModifier(restaurantId)
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -521,7 +525,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
public void downDiscount(int downTag) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.downDiscount(restaurantId)
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -575,7 +579,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
public void downExpandInfo(int downTag) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.downExpandInfo(restaurantId)
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -630,7 +634,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
public void downPrinterList(int downTag) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.downPrinterList(restaurantId)
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -770,7 +774,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
private void endDownReturn() {
if (IActivity.getFromPage() == 1) {
CC.obtainBuilder("Component.Main")
CC.obtainBuilder(ComponentName.COMPONENT_MAIN)
.setActionName("showMainActivity")
.build()
.call();
......
......@@ -20,6 +20,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCUtil;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.constans.ResultConstans;
import com.gingersoft.gsa.cloud.download.R;
import com.gingersoft.gsa.cloud.download.R2;
......@@ -121,7 +122,7 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
// @Override
// protected void doOnBackPressed() {
// if (fromPage == 1) {
// CC.obtainBuilder("Component.Main")
// CC.obtainBuilder(ComponentName.COMPONENT_MAIN)
// .setActionName("showMainActivity")
// .build()
// .call();
......@@ -133,7 +134,7 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
@Override
public void onBackPressed() {
if (fromPage == 1) {
CC.obtainBuilder("Component.Main")
CC.obtainBuilder(ComponentName.COMPONENT_MAIN)
.setActionName("showMainActivity")
.build()
.call();
......
......@@ -4,6 +4,7 @@ import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.ChooseRestaurantActivity;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
......@@ -15,7 +16,7 @@ public class ComponentLogin implements IComponent {
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "User.Component.Login";
return ComponentName.COMPONENT_LOGIN ;
}
/**
......@@ -32,7 +33,7 @@ public class ComponentLogin implements IComponent {
String actionName = cc.getActionName();
switch (actionName) {
case "showActivityA":
case "User.Component.Login":
case ComponentName.COMPONENT_LOGIN:
openActivity(cc);
break;
case "getLifecycleFragment":
......
......@@ -9,12 +9,17 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.BrandInfo;
import com.gingersoft.gsa.cloud.account.restaurant.RestaurantInfo;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.account.user.info.UserInfo;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.widget.DialogUtils;
import com.gingersoft.gsa.cloud.account.user.UserConstans;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.login.R;
import com.gingersoft.gsa.cloud.login.mvp.bean.LoginLimitBean;
import com.gingersoft.gsa.cloud.login.mvp.presenter.BaseLoginPresenter;
......@@ -37,19 +42,19 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
saveLoginInfo(info);
}
@Override
public void saveRestaurantListInfo(List<BrandsBean.BrandsData> brands) {
int restaurantSize = 0;
List<BrandsBean.BrandsData> brandsBeans = new ArrayList<>();
if (brands != null) {
String brandRestaurantInfos = JsonUtils.toJson(brands);
GsaCloudApplication.setBrandRestaurantInfos(mContext, brandRestaurantInfos);
ResturantInfoManager.putBrandRestaurantInfos(JsonUtils.toJson(brands));
restaurantSize = RestaurantInfoUtils.getRestaurantSize(brands);
brandsBeans.addAll(brands);
}
boolean autoLogin = (boolean) SPUtils.get(UserConstans.AUTO_LOGIN, false);
if (autoLogin && GsaCloudApplication.isLogin) {
int restaurantId = GsaCloudApplication.getRestaurantId();
if (autoLogin && UserContext.newInstance().isLogin()) {
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
if (restaurantId != 0) {
//上一次進入app有選擇餐廳,通過餐廳ID獲取允許的最大登陸數
mPresenter.getLoginLimit(restaurantId, false);
......@@ -80,17 +85,30 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
}
private void saveLoginInfo(LoginBean loginBean) {
// GsaCloudApplication.setBrandRestaurantInfos(mContext, "");
if (loginBean.getData() != null) {
GsaCloudApplication.setLoginToken(mContext, loginBean.getData().getToken());
// GsaCloudApplication.setLoginToken(mContext, loginBean.getData().getToken());
if (loginBean.getData().getUser() != null) {
GsaCloudApplication.setMemberId(mContext, loginBean.getData().getUser().getId());
GsaCloudApplication.setMemberName(mContext, loginBean.getData().getUser().getUserName());
// GsaCloudApplication.setMemberId(mContext, loginBean.getData().getUser().getId());
// GsaCloudApplication.setMemberName(mContext, loginBean.getData().getUser().getUserName());
LoginBean.DataBean.UserBean info = loginBean.getData().getUser();
UserInfo userInfo = new UserInfo();
userInfo.setToken(loginBean.getData().getToken());
userInfo.setUserId(info.getId());
userInfo.setUserName(info.getUserName());
userInfo.setMobile(info.getMobile());
userInfo.setStatus(info.getStatus());
userInfo.setEmail(info.getEmail());
userInfo.setMerchantsId(info.getMerchantsId());
userInfo.setParentId(info.getParentId());
UserContext.newInstance().setUserInfo(userInfo);
//獲取餐廳
// mPresenter.getRestaurantList();
boolean autoLogin = (boolean) SPUtils.get(UserConstans.AUTO_LOGIN, false);
if (autoLogin) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
if (restaurantId != 0) {
//上一次進入app有選擇餐廳,通過餐廳ID獲取允許的最大登陸數
// mPresenter.getLoginLimit(restaurantId, false);
......@@ -118,17 +136,23 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
}
protected void saveBrandAndRestaurantInfo(int brandId, String brandName, BrandsBean.BrandsData.RestaurantsBean restaurantsBean) {
GsaCloudApplication.setBrandId(mContext, brandId);
GsaCloudApplication.setBrandName(mContext, brandName);
ResturantInfoManager.newInstance().setBrandInfo(new BrandInfo(brandId, brandName));
// GsaCloudApplication.setBrandId(mContext, brandId);
// GsaCloudApplication.setBrandName(mContext, brandName);
if (restaurantsBean != null) {
GsaCloudApplication.setRestaurantId(mContext, restaurantsBean.getRestaurantId());
GsaCloudApplication.setRestaurantName(mContext, restaurantsBean.getRestaurantName());
GsaCloudApplication.setGsPosShopId(mContext, restaurantsBean.getGsPosShopId());
ResturantInfoManager.newInstance().setResturantInfo(new RestaurantInfo(restaurantsBean.getRestaurantId(),restaurantsBean.getRestaurantName()
,restaurantsBean.getGsPosShopId()));
// GsaCloudApplication.setRestaurantId(mContext, restaurantsBean.getRestaurantId());
// GsaCloudApplication.setRestaurantName(mContext, restaurantsBean.getRestaurantName());
// GsaCloudApplication.setGsPosShopId(mContext, restaurantsBean.getGsPosShopId());
}
}
@Override
public void jumpDownloadActivity() {
CC.obtainBuilder("Component.Download")
CC.obtainBuilder(ComponentName.COMPONENT_DOWNLOAD)
.setActionName("showDownloadActivity")
.addParam("fromPage", 1)
.build()
......@@ -136,8 +160,9 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
killMyself();
}
@Override
public void jumpMainActivity() {
CC.obtainBuilder("Component.Main")
CC.obtainBuilder(ComponentName.COMPONENT_MAIN)
.setActionName("showMainActivity")
.build()
.call();
......@@ -147,6 +172,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
private DialogUtils dialogUtils;
private int loginNum = 0;
@Override
public void showLoginLimit(List<LoginLimitBean> loginLimitBeans) {
if (loginLimitBeans != null) {
dialogUtils = new DialogUtils(mContext, R.layout.login_limit_dialog_layout) {
......@@ -186,6 +212,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
}
}
@Override
public void kickOut() {
if (loginNum == 0) {
if (dialogUtils != null) {
......
......@@ -4,19 +4,16 @@ import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import com.gingersoft.gsa.cloud.account.user.UserConstans;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.account.user.state.LoginedState;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.bean.PublicBean;
import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.login.mvp.bean.LoginLimitBean;
import com.gingersoft.gsa.cloud.login.mvp.contract.BaseLoginContract;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
......@@ -97,19 +94,26 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas
@Override
public void onNext(@NonNull LoginBean info) {
if (info.isSuccess()) {
GsaCloudApplication.isLogin = true;
SPUtils.put(UserConstans.IS_LOGIN, true);
GsaCloudApplication.userName = info.getData().getUser().getUserName();
// GsaCloudApplication.isLogin = true;
// SPUtils.put(UserConstans.IS_LOGIN, true);
UserContext.newInstance().setState(new LoginedState());
// GsaCloudApplication.userName = info.getData().getUser().getUserName();
mRootView.showMessage("登陸成功");
mRootView.loginSuccess(info);
} else {
GsaCloudApplication.isLogin = false;
// GsaCloudApplication.isLogin = false;
mRootView.showMessage(info.getErrMsg());
if (IAcitivity instanceof LoginActivity) {
} else {
mRootView.launchActivity(new Intent(IAcitivity, LoginActivity.class));
}
UserContext.newInstance().logOut();
// if (IAcitivity instanceof LoginActivity) {
//
// } else {
// mRootView.launchActivity(new Intent(IAcitivity, LoginActivity.class));
// }
}
}
......@@ -126,39 +130,6 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas
}
public void getRestaurantList() {
mModel.getRestaurantList()
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取餐廳信息中..."))
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BrandsBean>(mErrorHandler) {
@Override
public void onNext(@NonNull BrandsBean info) {
if (info != null) {
if (TextUtil.isNotEmptyOrNullOrUndefined(info.getMessage())) {
mRootView.showMessage(info.getMessage());
}
mRootView.saveRestaurantListInfo(info.getData());
} else {
mRootView.saveRestaurantListInfo(null);
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
if (IAcitivity instanceof LoginActivity) {
} else {
mRootView.launchActivity(new Intent(IAcitivity, LoginActivity.class));
}
}
});
}
/**
* @param restaurantId 餐廳ID
* @param isDownload 是否去下載頁面
......
......@@ -15,12 +15,16 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.BrandInfo;
import com.gingersoft.gsa.cloud.account.restaurant.RestaurantInfo;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.base.widget.DialogUtils;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.login.R;
import com.gingersoft.gsa.cloud.login.R2;
......@@ -169,14 +173,17 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
// int restaurantSize = 0;
List<BrandsBean.BrandsData> brandsBeans = new ArrayList<>();
if (brands != null) {
String brandRestaurantInfos = JsonUtils.toJson(brands);
GsaCloudApplication.setBrandRestaurantInfos(mContext, brandRestaurantInfos);
// restaurantSize = RestaurantInfoUtils.getRestaurantSize(brands);
// String brandRestaurantInfos = JsonUtils.toJson(brands);
// GsaCloudApplication.setBrandRestaurantInfos(mContext, brandRestaurantInfos);
ResturantInfoManager.putBrandRestaurantInfos(JsonUtils.toJson(brands));
brandsBeans.addAll(brands);
// restaurantSize = RestaurantInfoUtils.getRestaurantSize(brands);
}
// boolean autoLogin = (boolean) SPUtils.get(mContext, UserConstans.AUTO_LOGIN, false);
// if (autoLogin) {
// int restaurantId = GsaCloudApplication.getRestaurantId();
// int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
// if (restaurantId != 0) {
// //上一次進入app有選擇餐廳,通過餐廳ID獲取允許的最大登陸數
//// mPresenter.getLoginLimit(restaurantId, false);
......@@ -201,12 +208,10 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
}
protected void saveBrandAndRestaurantInfo(int brandId, String brandName, BrandsBean.BrandsData.RestaurantsBean restaurantsBean) {
GsaCloudApplication.setBrandId(mContext, brandId);
GsaCloudApplication.setBrandName(mContext, brandName);
ResturantInfoManager.newInstance().setBrandInfo(new BrandInfo(brandId, brandName));
if (restaurantsBean != null) {
GsaCloudApplication.setRestaurantId(mContext, restaurantsBean.getRestaurantId());
GsaCloudApplication.setRestaurantName(mContext, restaurantsBean.getRestaurantName());
GsaCloudApplication.setGsPosShopId(mContext, restaurantsBean.getGsPosShopId());
ResturantInfoManager.newInstance().setResturantInfo(new RestaurantInfo(restaurantsBean.getRestaurantId(),restaurantsBean.getRestaurantName()
,restaurantsBean.getGsPosShopId()));
}
}
......@@ -255,7 +260,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
//切換餐廳,發送關閉接單的廣播,並清除心跳
sendBroadcast(new Intent(AppConstans.CLEAR_ORDER_RECEIVING_HEART));
//关闭Prj打印服務
CC.obtainBuilder("Component.Print")
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.setActionName("stopPrintService")
.build()
.call();
......@@ -276,7 +281,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override
public void jumpDownloadActivity() {
killBeforeActivity();
CC.obtainBuilder("Component.Download")
CC.obtainBuilder(ComponentName.COMPONENT_DOWNLOAD)
.setActionName("showDownloadActivity")
.addParam("fromPage", 1)
.build()
......@@ -303,7 +308,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override
public void jumpMainActivity() {
CC.obtainBuilder("Component.Main")
CC.obtainBuilder(ComponentName.COMPONENT_MAIN)
.setActionName("showMainActivity")
.build()
.call();
......@@ -317,6 +322,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
private DialogUtils dialogUtils;
private int loginNum = 0;
@Override
public void showLoginLimit(List<LoginLimitBean> loginLimitBeans) {
if (loginLimitBeans != null) {
dialogUtils = new DialogUtils(mContext, R.layout.login_limit_dialog_layout) {
......@@ -338,13 +344,19 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
}
}.setWidth(LinearLayout.LayoutParams.MATCH_PARENT).setOnDismissListener(dialog -> {
//不管有沒有踢出人,彈窗消失回到登陸頁面
startActivity(new Intent(mContext, LoginActivity.class));
GsaCloudApplication.logOut();
// startActivity(new Intent(mContext, LoginActivity.class));
// GsaCloudApplication.logOut();
UserContext.newInstance().logOut();
}).setGravity(Gravity.BOTTOM).show();
} else {
showMessage("獲取登陸人數失敗");
GsaCloudApplication.logOut();
launchActivity(new Intent(mContext, LoginActivity.class));
// GsaCloudApplication.logOut();
// UserContext.newInstance().logOut();
// launchActivity(new Intent(mContext, LoginActivity.class));
UserContext.newInstance().logOut();
}
}
......@@ -356,6 +368,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
}
}
@Override
public void kickOut() {
if (loginNum == 0) {
if (dialogUtils != null) {
......
......@@ -10,6 +10,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
......@@ -86,7 +87,9 @@ public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> im
radioGroup.setOnCheckedChangeListener((group, checkedId) -> selectIndex = group.indexOfChild(findViewById(checkedId)));
switchServer.setOnClickListener(v -> {
SPUtils.put("isFormal", selectIndex);
GsaCloudApplication.logOut();
UserContext.newInstance().logOut();
// GsaCloudApplication.logOut();
ToastUtils.show(mContext, "已切換環境,重啟生效" + selectIndex);
GsaCloudApplication.initDomainUrl();
finish();
......
......@@ -17,7 +17,8 @@ import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.account.user.UserContext;
import com.gingersoft.gsa.cloud.base.utils.encryption.Aes;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.account.user.UserConstans;
......@@ -98,8 +99,8 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
//是第一次進入,顯示引導頁
showGuide();
} else {
if ((boolean) SPUtils.get(UserConstans.AUTO_LOGIN, false) && GsaCloudApplication.isLogin
&& GsaCloudApplication.getRestaurantId() != 0) {
if ((boolean) SPUtils.get(UserConstans.AUTO_LOGIN, false) && UserContext.newInstance().isLogin()
&& ResturantInfoManager.newInstance().getRestaurantId() != 0) {
//自動登陸
String pwd = Aes.aesDecrypt((String) SPUtils.get(UserConstans.LOGIN_PASSWORD, ""));
mPresenter.login(SPUtils.get(UserConstans.LOGIN_USERNAME, "") + "", pwd);
......
......@@ -5,6 +5,7 @@ import android.content.Intent;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.function.FModule;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.NewMainActivity;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.menu.FoodMenuManageActivity;
......@@ -52,7 +53,7 @@ public class ComponentMain implements IComponent {
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "Component.Main";
return ComponentName.COMPONENT_MAIN ;
}
/**
......
package com.gingersoft.gsa.cloud.main;
import com.gingersoft.gsa.cloud.function.FModule;
import com.gingersoft.gsa.cloud.function.XFunctionItem;
import com.gingersoft.gsa.cloud.function.XFunctionItems;
/**
* @author : bin
* @create date: 2020-11-26
* @update date: 2020-11-26
* @description:
*/
public class FunctionMain {
public static final String ORDER_GROUP = "main/order/";
public static final String MANAGER_GROUP = "main/manager/";
public static final String EMPLOYEE_GROUP = "main/employee/";
/**
* 首頁- 點餐
*/
@XFunctionItems(ORDER_GROUP)
public static final FModule[] order_groups = {
new FModule(ORDER_GROUP, 0, 0),
new FModule(ORDER_GROUP + "table", R.drawable.ic_dining_table_mode, R.drawable.ic_dining_table_mode_close),
new FModule(ORDER_GROUP + "delivery", R.drawable.ic_delivery_mode, R.drawable.ic_delivery_mode_close),
new FModule(ORDER_GROUP + "takeaway", R.drawable.ic_outsourcing_model, R.drawable.ic_outsourcing_model_close),
new FModule(ORDER_GROUP + "preorder", R.drawable.ic_pre_order_mode, R.drawable.ic_pre_order_mode_close),
new FModule(ORDER_GROUP + "coldChain", R.drawable.ic_cold_chain, R.drawable.ic_pre_order_mode_close),
};
/**
* 首頁- 管理
*/
@XFunctionItems(MANAGER_GROUP)
public static final FModule[] manager_groups = {
new FModule(MANAGER_GROUP, 0, 0),
new FModule(MANAGER_GROUP + "takeaway", R.drawable.ic_meals_menu_management, R.drawable.ic_meals_menu_management_close),
new FModule(MANAGER_GROUP + "bill", R.drawable.ic_meals_menu_management, R.drawable.ic_meals_menu_management_close),
new FModule(MANAGER_GROUP + "table", R.drawable.ic_dining_table_management, R.drawable.ic_dining_table_management_close),
new FModule(MANAGER_GROUP + "printer", R.drawable.ic_print_management, R.drawable.ic_print_management_close),
new FModule(MANAGER_GROUP + "pay", R.drawable.ic_pay_management, R.drawable.ic_pay_management_close),
new FModule(MANAGER_GROUP + "discout", R.drawable.ic_discount_management, R.drawable.ic_discount_management_close),
new FModule(MANAGER_GROUP + "soldoutCtr", R.drawable.ic_sell_off_manger, R.drawable.ic_sell_off_manger),
new FModule(MANAGER_GROUP + "qrCode", R.drawable.ic_discount_management, R.drawable.ic_discount_management_close)
};
/**
* 首頁- 員工管理
*/
@XFunctionItems(EMPLOYEE_GROUP)
public static final FModule[] employee_groups = {
new FModule(EMPLOYEE_GROUP, 0, 0),
new FModule(EMPLOYEE_GROUP + "management", R.drawable.ic_staff_management, R.drawable.ic_staff_management_close),
new FModule(EMPLOYEE_GROUP + "delivery", R.drawable.ic_authority_management, R.drawable.ic_authority_management_close),
new FModule(EMPLOYEE_GROUP + "operationRecord", R.drawable.ic_operation_record, R.drawable.ic_operation_record_close)
};
}
......@@ -2,7 +2,7 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.main.mvp.contract.EditFoodContract;
......@@ -118,7 +118,7 @@ public class EditFoodPresenter extends BasePresenter<EditFoodContract.Model, Edi
* 獲取時段列表
*/
private void getPeriodList() {
mModel.getPeriodList(GsaCloudApplication.getBrandId())
mModel.getPeriodList(ResturantInfoManager.newInstance().getBrandId())
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取時段信息中..."))
.subscribeOn(AndroidSchedulers.mainThread())
......@@ -152,7 +152,7 @@ public class EditFoodPresenter extends BasePresenter<EditFoodContract.Model, Edi
* 獲取餐種
*/
private void getSummaryList() {
mModel.getSummaryList(GsaCloudApplication.getRestaurantId())
mModel.getSummaryList(ResturantInfoManager.newInstance().getRestaurantId())
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取餐種信息中..."))
.subscribeOn(AndroidSchedulers.mainThread())
......
......@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.utils.CollectionUtils;
......@@ -60,7 +61,7 @@ public class ExpandListPresenter extends BasePresenter<ExpandListContract.Model,
}
public void getExpandInfoList() {
mModel.getExpandList(GsaCloudApplication.getRestaurantId())
mModel.getExpandList(ResturantInfoManager.newInstance().getRestaurantId())
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
......
......@@ -6,8 +6,9 @@ import android.net.Uri;
import android.text.TextUtils;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.main.mvp.contract.NewMainContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.CheckVersionRequest;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.NewMainActivity;
......@@ -74,7 +75,7 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
}
public void syncRestaurantExtendedConfiguration() {
mModel.syncRestaurantExtendedConfiguration(GsaCloudApplication.getRestaurantId())
mModel.syncRestaurantExtendedConfiguration(ResturantInfoManager.newInstance().getRestaurantId())
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
......@@ -148,16 +149,12 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
@Override
public void onNext(@NonNull Object info) {
mRootView.loginOut();
//清空用戶信息
GsaCloudApplication.clearMemberInfo();
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.loginOut();
//清空用戶信息
GsaCloudApplication.clearMemberInfo();
}
});
}
......@@ -165,11 +162,11 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
public void clearHeartbeat(){
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", GsaCloudApplication.getRestaurantId() + "")
.add("restaurantId", ResturantInfoManager.newInstance().getRestaurantId() + "")
.build();
//關閉心跳
CC.obtainBuilder("ComponentDeliveryPick")
CC.obtainBuilder(ComponentName.COMPONENT_DELIVERYPICK)
.setActionName("closeHeart")
.build()
.call();
......
......@@ -2,7 +2,7 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
......@@ -121,8 +121,8 @@ public class NewlyAddedPresenter extends BasePresenter<NewlyAddedContract.Model,
return;
}
Observable<BaseResult> baseResultObservable;
timePeriodBean.setBrandId(GsaCloudApplication.getBrandId());
timePeriodBean.setRestaurantId(GsaCloudApplication.getRestaurantId());
timePeriodBean.setBrandId(ResturantInfoManager.newInstance().getBrandId());
timePeriodBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId());
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(timePeriodBean));
if (isUpdate) {
baseResultObservable = mModel.updatePeriod(requestBody);
......
......@@ -2,7 +2,7 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.main.mvp.contract.QrCodeContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.RestaurantQrBean;
import com.jess.arms.di.scope.ActivityScope;
......@@ -46,7 +46,7 @@ public class QrCodePresenter extends BasePresenter<QrCodeContract.Model, QrCodeC
}
public void getRestaurantQrCode() {
mModel.getRestaurantQrCode(GsaCloudApplication.getRestaurantId() + "")
mModel.getRestaurantQrCode(ResturantInfoManager.newInstance().getRestaurantId() + "")
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("加載中..."))
.subscribeOn(AndroidSchedulers.mainThread())
......
......@@ -2,7 +2,7 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.main.mvp.contract.SettlementContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SettlementReport;
import com.jess.arms.di.scope.ActivityScope;
......@@ -59,7 +59,7 @@ public class SettlementPresenter extends BasePresenter<SettlementContract.Model,
}
public void getSettlementReport() {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.getSettlementReport(restaurantId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
......
......@@ -4,7 +4,7 @@ import android.app.Activity;
import android.app.Application;
import android.text.TextUtils;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.contract.SettlementReportContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SendSettlement;
......@@ -112,7 +112,7 @@ public class SettlementReportPresenter extends BasePresenter<SettlementReportCon
}
public void sendSettlement(int type) {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
RequestBody requestBody;
if (type != 0) {
requestBody = new FormBody.Builder()
......@@ -209,7 +209,7 @@ public class SettlementReportPresenter extends BasePresenter<SettlementReportCon
}
public void getSettlementReport() {
int restaurantId = GsaCloudApplication.getRestaurantId();
int restaurantId = ResturantInfoManager.newInstance().getRestaurantId();
mModel.getSettlementReport(restaurantId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
......
......@@ -10,7 +10,7 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.base.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.R2;
......@@ -86,7 +86,7 @@ public class LanguageActivity extends BaseActivity<LanguagePresenter> implements
initAdapter();
initItemListener();
mPresenter.getLanguageByBrandId(GsaCloudApplication.getBrandId());
mPresenter.getLanguageByBrandId(ResturantInfoManager.newInstance().getBrandId());
}
private void initAdapter() {
......
......@@ -7,7 +7,7 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.account.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.base.utils.FileUtils
import com.gingersoft.gsa.cloud.main.R
import kotlinx.android.synthetic.main.activity_look_log.*
......@@ -21,7 +21,7 @@ class LookLogActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_look_log)
log_top_bar.setTitle(GsaCloudApplication.getRestaurantName())
log_top_bar.setTitle(ResturantInfoManager.newInstance().getRestaurantName())
log_top_bar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { onBackPressed() }
log_top_bar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color))
......
......@@ -148,7 +148,7 @@ public class MainActivity extends BaseFragmentActivity<MainPresenter> implements
// mTopBar.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// CC.obtainBuilder("Component.Table")
// CC.obtainBuilder(ComponentName.COMPONENT_TABLE)
// .setActionName("showTableActivity")
// .build()
// .call();
......
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