Commit 10655e8b by Wyh

7.04 登陸登出接口邏輯修改

parent 5e9da1c9
...@@ -164,6 +164,8 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -164,6 +164,8 @@ public class GsaCloudApplication extends BaseApplication {
RetrofitUrlManager.getInstance().putDomain("update_version", HttpsConstans.ROOT_URL+"/member-web/api/"); RetrofitUrlManager.getInstance().putDomain("update_version", HttpsConstans.ROOT_URL+"/member-web/api/");
//友常本地請求地址 //友常本地請求地址
RetrofitUrlManager.getInstance().putDomain("yc_location", HttpsConstans.ROOT_SERVER_YOU_CHANG_HK); RetrofitUrlManager.getInstance().putDomain("yc_location", HttpsConstans.ROOT_SERVER_YOU_CHANG_HK);
//System請求地址
RetrofitUrlManager.getInstance().putDomain("system_url", HttpsConstans.SYSTEM_URL);
} }
private void initPrint() { private void initPrint() {
......
...@@ -4,7 +4,7 @@ import android.content.Context; ...@@ -4,7 +4,7 @@ import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -18,10 +18,10 @@ import java.util.List; ...@@ -18,10 +18,10 @@ import java.util.List;
*/ */
public class RestaurantInfoUtils { public class RestaurantInfoUtils {
public static List<LoginBean.DataBean.UserBean.BrandsBean> getBrandList(Context context) { public static List<BrandsBean.BrandsData> getBrandList(Context context) {
String brandRestaurantInfos = GsaCloudApplication.getBrandRestaurantInfos(context); String brandRestaurantInfos = GsaCloudApplication.getBrandRestaurantInfos(context);
if (!TextUtils.isEmpty(brandRestaurantInfos)) { if (!TextUtils.isEmpty(brandRestaurantInfos)) {
List<LoginBean.DataBean.UserBean.BrandsBean> brandsBeans = JsonUtils.parseArray(brandRestaurantInfos, LoginBean.DataBean.UserBean.BrandsBean.class); List<BrandsBean.BrandsData> brandsBeans = JsonUtils.parseArray(brandRestaurantInfos, BrandsBean.BrandsData.class);
return brandsBeans; return brandsBeans;
} }
return new ArrayList<>(); return new ArrayList<>();
...@@ -29,15 +29,18 @@ public class RestaurantInfoUtils { ...@@ -29,15 +29,18 @@ public class RestaurantInfoUtils {
public static int getRestaurantSize(Context context) { public static int getRestaurantSize(Context context) {
int size = 0; int size = 0;
List<LoginBean.DataBean.UserBean.BrandsBean> brandsBeans = getBrandList(context); List<BrandsBean.BrandsData> brandsBeans = getBrandList(context);
for (int i = 0; i < getBrandList(context).size(); i++) { if(brandsBeans == null){
return 0;
}
for (int i = 0; i < brandsBeans.size(); i++) {
if (brandsBeans.get(i).getRestaurants() != null) if (brandsBeans.get(i).getRestaurants() != null)
size += brandsBeans.get(i).getRestaurants().size(); size += brandsBeans.get(i).getRestaurants().size();
} }
return size; return size;
} }
public static LoginBean.DataBean.UserBean.BrandsBean getOnlyBrand(List<LoginBean.DataBean.UserBean.BrandsBean> brands) { public static BrandsBean.BrandsData getOnlyBrand(List<BrandsBean.BrandsData> brands) {
for (int i = 0; i < brands.size(); i++) { for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) { if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) { for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
...@@ -48,7 +51,7 @@ public class RestaurantInfoUtils { ...@@ -48,7 +51,7 @@ public class RestaurantInfoUtils {
return null; return null;
} }
public static LoginBean.DataBean.UserBean.BrandsBean.RestaurantsBean getOnlyRestaurant(List<LoginBean.DataBean.UserBean.BrandsBean> brands) { public static BrandsBean.BrandsData.RestaurantsBean getOnlyRestaurant(List<BrandsBean.BrandsData> brands) {
for (int i = 0; i < brands.size(); i++) { for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) { if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) { for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
...@@ -59,7 +62,7 @@ public class RestaurantInfoUtils { ...@@ -59,7 +62,7 @@ public class RestaurantInfoUtils {
return null; return null;
} }
public static LoginBean.DataBean.UserBean.BrandsBean getBrandByRestaurantId(List<LoginBean.DataBean.UserBean.BrandsBean> brands, int restaurantId) { public static BrandsBean.BrandsData getBrandByRestaurantId(List<BrandsBean.BrandsData> brands, int restaurantId) {
for (int i = 0; i < brands.size(); i++) { for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) { if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) { for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
......
...@@ -61,6 +61,10 @@ public class HttpsConstans { ...@@ -61,6 +61,10 @@ public class HttpsConstans {
private static String WECHAR_REPORT_FORMAL_ADDRESS = HTTP_ADDRESS_URL_FORMAL;//微信公眾號報表正式地址 private static String WECHAR_REPORT_FORMAL_ADDRESS = HTTP_ADDRESS_URL_FORMAL;//微信公眾號報表正式地址
private static String WECHAR_REPORT_PATH = "/member-web/api/";//微信公眾號報表路徑 private static String WECHAR_REPORT_PATH = "/member-web/api/";//微信公眾號報表路徑
//---------------------------------------System請求地址----------------------------------------------------------------------------------
private static String SYSTEM_PATH = "/ricepon-system/api/";
//--------------------------------------配置----------------------------------------------------------------------------------- //--------------------------------------配置-----------------------------------------------------------------------------------
/** /**
...@@ -92,6 +96,8 @@ public class HttpsConstans { ...@@ -92,6 +96,8 @@ public class HttpsConstans {
//修改這個值,修改微信公眾號報表地址:首頁曲線圖數據,支付分析報表數據 //修改這個值,修改微信公眾號報表地址:首頁曲線圖數據,支付分析報表數據
public static String WECHAR_REPORT_SERVER_ADDRESS;// = (isFormal ? WECHAR_REPORT_FORMAL_ADDRESS : WECHAR_REPORT_TEST_ADDRESS) + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS public static String WECHAR_REPORT_SERVER_ADDRESS;// = (isFormal ? WECHAR_REPORT_FORMAL_ADDRESS : WECHAR_REPORT_TEST_ADDRESS) + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
public static String SYSTEM_URL;
public static void init(Context context) { public static void init(Context context) {
isFormal = (int) SPUtils.get(context, "isFormal", -1); isFormal = (int) SPUtils.get(context, "isFormal", -1);
if (isFormal == -1 && BuildConfig.DEBUG) { if (isFormal == -1 && BuildConfig.DEBUG) {
...@@ -108,6 +114,7 @@ public class HttpsConstans { ...@@ -108,6 +114,7 @@ public class HttpsConstans {
ROOT_URL = ROOT_FORMAL_URL; ROOT_URL = ROOT_FORMAL_URL;
REPORT_SERVER_ADDRESS = REPORT_FORMAL_ADDRESS + REPORT_PATH; REPORT_SERVER_ADDRESS = REPORT_FORMAL_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_FORMAL_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_FORMAL_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
SYSTEM_URL = HTTP_ADDRESS_URL_FORMAL + SYSTEM_PATH;
break; break;
case 1: case 1:
_SERVER_ADDRESS = "http://a.ricepon.com:61177" + "/member-web/api/"; _SERVER_ADDRESS = "http://a.ricepon.com:61177" + "/member-web/api/";
...@@ -116,6 +123,7 @@ public class HttpsConstans { ...@@ -116,6 +123,7 @@ public class HttpsConstans {
ROOT_URL = ROOT_HK_TEST_URL; ROOT_URL = ROOT_HK_TEST_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH; REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
SYSTEM_URL = ROOT_HK_TEST_URL + SYSTEM_PATH;
break; break;
case 2: case 2:
_SERVER_ADDRESS = ROOT_SERVER_YOU_CHANG_HK + "/member-web/api/"; _SERVER_ADDRESS = ROOT_SERVER_YOU_CHANG_HK + "/member-web/api/";
...@@ -124,6 +132,7 @@ public class HttpsConstans { ...@@ -124,6 +132,7 @@ public class HttpsConstans {
ROOT_URL = ROOT_SZ_URL; ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH; REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
SYSTEM_URL = ROOT_SERVER_YOU_CHANG_HK + SYSTEM_PATH;
break; break;
case 3: case 3:
_SERVER_ADDRESS = ROOT_SERVER_SHI_WEI_HK + "/member-web/api/"; _SERVER_ADDRESS = ROOT_SERVER_SHI_WEI_HK + "/member-web/api/";
...@@ -132,6 +141,7 @@ public class HttpsConstans { ...@@ -132,6 +141,7 @@ public class HttpsConstans {
ROOT_URL = ROOT_SZ_URL; ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH; REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
SYSTEM_URL = ROOT_SERVER_SHI_WEI_HK + SYSTEM_PATH;
break; break;
case 4: case 4:
_SERVER_ADDRESS = ROOT_SERVER_SHI_SHU_HK + "/member-web/api/"; _SERVER_ADDRESS = ROOT_SERVER_SHI_SHU_HK + "/member-web/api/";
...@@ -140,6 +150,7 @@ public class HttpsConstans { ...@@ -140,6 +150,7 @@ public class HttpsConstans {
ROOT_URL = ROOT_SZ_URL; ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH; REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
SYSTEM_URL = ROOT_SERVER_SHI_SHU_HK + SYSTEM_PATH;
break; break;
} }
......
package com.gingersoft.gsa.cloud.ui.bean.mode; package com.gingersoft.gsa.cloud.ui.bean.mode;
import java.util.List; import java.util.Date;
/** /**
* 作者:ELEGANT_BIN * 作者:ELEGANT_BIN
...@@ -86,18 +86,18 @@ public class LoginBean { ...@@ -86,18 +86,18 @@ public class LoginBean {
* userName : admin * userName : admin
* brands : [{"brandId":242,"brandName":"莫拉塔","restaurants":[]},{"brandId":243,"brandName":"蕭蕭","restaurants":[{"restaurantId":337,"restaurantName":"小張"}]}] * brands : [{"brandId":242,"brandName":"莫拉塔","restaurants":[]},{"brandId":243,"brandName":"蕭蕭","restaurants":[{"restaurantId":337,"restaurantName":"小張"}]}]
*/ */
private Integer id;
private int userId; private Integer groupId;
private Integer parentId;
private Integer merchantsId;
private String mobile;
private String email;
private int status;
private Date createTime;
private String createBy;
private Date updateTime;
private String updateBy;
private String userName; private String userName;
private List<BrandsBean> brands;
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUserName() { public String getUserName() {
return userName; return userName;
...@@ -107,87 +107,92 @@ public class LoginBean { ...@@ -107,87 +107,92 @@ public class LoginBean {
this.userName = userName; this.userName = userName;
} }
public List<BrandsBean> getBrands() { public Integer getId() {
return brands; return id;
} }
public void setBrands(List<BrandsBean> brands) { public void setId(Integer id) {
this.brands = brands; this.id = id;
} }
public static class BrandsBean { public Integer getGroupId() {
/** return groupId;
* brandId : 242 }
* brandName : 莫拉塔
* restaurants : []
*/
private int brandId; public void setGroupId(Integer groupId) {
private String brandName; this.groupId = groupId;
private List<RestaurantsBean> restaurants; }
public int getBrandId() { public Integer getParentId() {
return brandId; return parentId;
} }
public void setBrandId(int brandId) { public void setParentId(Integer parentId) {
this.brandId = brandId; this.parentId = parentId;
} }
public String getBrandName() { public Integer getMerchantsId() {
return brandName; return merchantsId;
} }
public void setBrandName(String brandName) { public void setMerchantsId(Integer merchantsId) {
this.brandName = brandName; this.merchantsId = merchantsId;
} }
public List<RestaurantsBean> getRestaurants() { public String getMobile() {
return restaurants; return mobile;
} }
public void setRestaurants(List<RestaurantsBean> restaurants) { public void setMobile(String mobile) {
this.restaurants = restaurants; this.mobile = mobile;
} }
public static class RestaurantsBean { public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getStatus() {
return status;
}
private int restaurantId; public void setStatus(int status) {
private String restaurantName; this.status = status;
}
public int getRestaurantId() { public Date getCreateTime() {
return restaurantId; return createTime;
} }
public void setRestaurantId(int restaurantId) { public void setCreateTime(Date createTime) {
this.restaurantId = restaurantId; this.createTime = createTime;
} }
public String getRestaurantName() { public String getCreateBy() {
return restaurantName; return createBy;
} }
public void setRestaurantName(String restaurantName) { public void setCreateBy(String createBy) {
this.restaurantName = restaurantName; this.createBy = createBy;
} }
@Override public Date getUpdateTime() {
public String toString() { return updateTime;
return "RestaurantsBean{" +
"restaurantId=" + restaurantId +
", restaurantName='" + restaurantName + '\'' +
'}';
} }
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
} }
@Override public String getUpdateBy() {
public String toString() { return updateBy;
return "BrandsBean{" +
"brandId=" + brandId +
", brandName='" + brandName + '\'' +
", restaurants=" + restaurants +
'}';
} }
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
} }
} }
} }
......
...@@ -24,7 +24,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -24,7 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.base.R; import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.ui.adapter.BasTextSectiontAdapter; import com.gingersoft.gsa.cloud.ui.adapter.BasTextSectiontAdapter;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader; import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem; import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem;
import com.jess.arms.utils.AndroidWorkaround; import com.jess.arms.utils.AndroidWorkaround;
...@@ -209,7 +209,7 @@ public class ChooseRestaurantDialog extends Dialog { ...@@ -209,7 +209,7 @@ public class ChooseRestaurantDialog extends Dialog {
private Context mContext; private Context mContext;
private ChooseRestaurantDialog mDialog; private ChooseRestaurantDialog mDialog;
private List<LoginBean.DataBean.UserBean.BrandsBean> mItems; private List<BrandsBean.BrandsData> mItems;
private List<QMUISection<SectionHeader, SectionTextItem>> mQmuiSections; private List<QMUISection<SectionHeader, SectionTextItem>> mQmuiSections;
private BasTextSectiontAdapter mAdapter; private BasTextSectiontAdapter mAdapter;
...@@ -222,12 +222,12 @@ public class ChooseRestaurantDialog extends Dialog { ...@@ -222,12 +222,12 @@ public class ChooseRestaurantDialog extends Dialog {
mItems = new ArrayList<>(); mItems = new ArrayList<>();
} }
public BottomListSheetBuilder addBrandItem(LoginBean.DataBean.UserBean.BrandsBean brandBean) { public BottomListSheetBuilder addBrandItem(BrandsBean.BrandsData brandBean) {
mItems.add(brandBean); mItems.add(brandBean);
return this; return this;
} }
public BottomListSheetBuilder addBrandItems(List<LoginBean.DataBean.UserBean.BrandsBean> brandsBean) { public BottomListSheetBuilder addBrandItems(List<BrandsBean.BrandsData> brandsBean) {
mItems.addAll(brandsBean); mItems.addAll(brandsBean);
return this; return this;
} }
...@@ -316,16 +316,16 @@ public class ChooseRestaurantDialog extends Dialog { ...@@ -316,16 +316,16 @@ public class ChooseRestaurantDialog extends Dialog {
mAdapter.setData(mQmuiSections); mAdapter.setData(mQmuiSections);
} }
private List<QMUISection<SectionHeader, SectionTextItem>> restaurantsTransformToSection(List<LoginBean.DataBean.UserBean.BrandsBean> mItems) { private List<QMUISection<SectionHeader, SectionTextItem>> restaurantsTransformToSection(List<BrandsBean.BrandsData> mItems) {
List<QMUISection<SectionHeader, SectionTextItem>> qmuiSections = new ArrayList<>(); List<QMUISection<SectionHeader, SectionTextItem>> qmuiSections = new ArrayList<>();
for (int i = 0; i < mItems.size(); i++) { for (int i = 0; i < mItems.size(); i++) {
LoginBean.DataBean.UserBean.BrandsBean brandsBean = mItems.get(i); BrandsBean.BrandsData brandsBean = mItems.get(i);
qmuiSections.add(createSection(brandsBean)); qmuiSections.add(createSection(brandsBean));
} }
return qmuiSections; return qmuiSections;
} }
private QMUISection<SectionHeader, SectionTextItem> createSection(LoginBean.DataBean.UserBean.BrandsBean brandsBean) { private QMUISection<SectionHeader, SectionTextItem> createSection(BrandsBean.BrandsData brandsBean) {
SectionHeader header = new SectionHeader(brandsBean.getBrandName()); SectionHeader header = new SectionHeader(brandsBean.getBrandName());
ArrayList<SectionTextItem> contents = new ArrayList<>(); ArrayList<SectionTextItem> contents = new ArrayList<>();
for (int i = 0; i < Objects.requireNonNull(brandsBean.getRestaurants().size()); i++) { for (int i = 0; i < Objects.requireNonNull(brandsBean.getRestaurants().size()); i++) {
......
...@@ -7,8 +7,8 @@ ext { ...@@ -7,8 +7,8 @@ ext {
targetSdkVersion : 28, targetSdkVersion : 28,
//正式版: 1.0.1 1 //正式版: 1.0.1 1
//內部測試版:1.1.1 11 //內部測試版:1.1.1 11
versionCode : 11, versionCode : 12,
versionName : "1.1.1" versionName : "1.1.2"
] ]
version = [ version = [
......
package com.gingersoft.gsa.cloud.login.mvp.contract; package com.gingersoft.gsa.cloud.login.mvp.contract;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
...@@ -29,11 +30,15 @@ public interface BaseLoginContract { ...@@ -29,11 +30,15 @@ public interface BaseLoginContract {
void startToSwitchServer(); void startToSwitchServer();
void showChooseRestaurantDialog(List<LoginBean.DataBean.UserBean.BrandsBean> brandsBean,List<LoginBean.DataBean.UserBean.BrandsBean> brands); void saveRestaurantListInfo(List<BrandsBean.BrandsData> brands);
void showChooseRestaurantDialog(List<BrandsBean.BrandsData> brandsBean, List<BrandsBean.BrandsData> brands);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel { interface Model extends IModel {
Observable<LoginBean> login(RequestBody requestBody); Observable<LoginBean> login(RequestBody requestBody);
Observable<BrandsBean> getRestaurantList();
} }
} }
...@@ -7,6 +7,7 @@ import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; ...@@ -7,6 +7,7 @@ import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils; import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.constans.UserConstans; import com.gingersoft.gsa.cloud.constans.UserConstans;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem; import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
...@@ -24,31 +25,15 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -24,31 +25,15 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
saveLoginInfo(info); saveLoginInfo(info);
} }
@Override public void saveRestaurantListInfo(List<BrandsBean.BrandsData> brands) {
public void startToSwitchServer() { int restaurantSize = 0;
startActivity(new Intent(mContext, SwitchServerActivity.class)); List<BrandsBean.BrandsData> brandsBeans = new ArrayList<>();
}
private void saveLoginInfo(LoginBean loginBean) {
GsaCloudApplication.setBrandRestaurantInfos(mContext, "");
if (loginBean.getData() != null) {
GsaCloudApplication.setLoginToken(mContext, loginBean.getData().getToken());
if (loginBean.getData().getUser() != null) {
GsaCloudApplication.setMemberId(mContext, loginBean.getData().getUser().getUserId());
GsaCloudApplication.setMemberName(mContext, loginBean.getData().getUser().getUserName());
List<LoginBean.DataBean.UserBean.BrandsBean> brands = loginBean.getData().getUser().getBrands();
if (brands != null) { if (brands != null) {
String brandRestaurantInfos = JsonUtils.toJson(brands); String brandRestaurantInfos = JsonUtils.toJson(brands);
GsaCloudApplication.setBrandRestaurantInfos(mContext, brandRestaurantInfos); GsaCloudApplication.setBrandRestaurantInfos(mContext, brandRestaurantInfos);
restaurantSize = getRestaurantSize(brands);
brandsBeans.addAll(brands);
} }
int restaurantSize = 0;
List<LoginBean.DataBean.UserBean.BrandsBean> brandsBeans = new ArrayList<>();
if (loginBean.getData().getUser().getBrands() != null) {
restaurantSize = getRestaurantSize(loginBean.getData().getUser().getBrands());
brandsBeans.addAll(loginBean.getData().getUser().getBrands());
}
boolean autoLogin = (boolean) SPUtils.get(mContext, UserConstans.AUTO_LOGIN, false); boolean autoLogin = (boolean) SPUtils.get(mContext, UserConstans.AUTO_LOGIN, false);
if (autoLogin) { if (autoLogin) {
int restaurantId = GsaCloudApplication.getRestaurantId(this); int restaurantId = GsaCloudApplication.getRestaurantId(this);
...@@ -61,8 +46,8 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -61,8 +46,8 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
if (restaurantSize == 1) { if (restaurantSize == 1) {
//只有一個品牌是直接進下載頁面 //只有一個品牌是直接進下載頁面
LoginBean.DataBean.UserBean.BrandsBean brandsBean = getOnlyBrand(loginBean.getData().getUser().getBrands()); BrandsBean.BrandsData brandsBean = getOnlyBrand(brands);
LoginBean.DataBean.UserBean.BrandsBean.RestaurantsBean restaurantsBean = getOnlyRestaurant(loginBean.getData().getUser().getBrands()); BrandsBean.BrandsData.RestaurantsBean restaurantsBean = getOnlyRestaurant(brands);
if (brandsBean != null) { if (brandsBean != null) {
saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), restaurantsBean.getRestaurantId(), restaurantsBean.getRestaurantName()); saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), restaurantsBean.getRestaurantId(), restaurantsBean.getRestaurantName());
} }
...@@ -71,11 +56,27 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -71,11 +56,27 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
showChooseRestaurantDialog(brandsBeans, brands); showChooseRestaurantDialog(brandsBeans, brands);
} }
} }
@Override
public void startToSwitchServer() {
startActivity(new Intent(mContext, SwitchServerActivity.class));
}
private void saveLoginInfo(LoginBean loginBean) {
GsaCloudApplication.setBrandRestaurantInfos(mContext, "");
if (loginBean.getData() != null) {
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());
//獲取餐廳
mPresenter.getRestaurantList();
}
} }
} }
protected void ChooseRestaurantItemClick(List<LoginBean.DataBean.UserBean.BrandsBean> brands, ChooseRestaurantDialog dialog, SectionTextItem item) { protected void ChooseRestaurantItemClick(List<BrandsBean.BrandsData> brands, ChooseRestaurantDialog dialog, SectionTextItem item) {
LoginBean.DataBean.UserBean.BrandsBean brandsBean = getBrandByRestaurantId(brands, item.getId()); BrandsBean.BrandsData brandsBean = getBrandByRestaurantId(brands, item.getId());
if (brandsBean != null) { if (brandsBean != null) {
saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), item.getId(), item.getText()); saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), item.getId(), item.getText());
} }
...@@ -90,7 +91,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -90,7 +91,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
GsaCloudApplication.setRestaurantName(mContext, restaurantName); GsaCloudApplication.setRestaurantName(mContext, restaurantName);
} }
private int getRestaurantSize(List<LoginBean.DataBean.UserBean.BrandsBean> brands) { private int getRestaurantSize(List<BrandsBean.BrandsData> brands) {
int size = 0; int size = 0;
for (int i = 0; i < brands.size(); i++) { for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) if (brands.get(i).getRestaurants() != null)
...@@ -99,7 +100,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -99,7 +100,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
return size; return size;
} }
private LoginBean.DataBean.UserBean.BrandsBean getOnlyBrand(List<LoginBean.DataBean.UserBean.BrandsBean> brands) { private BrandsBean.BrandsData getOnlyBrand(List<BrandsBean.BrandsData> brands) {
for (int i = 0; i < brands.size(); i++) { for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) { if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) { for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
...@@ -110,7 +111,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -110,7 +111,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
return null; return null;
} }
private LoginBean.DataBean.UserBean.BrandsBean.RestaurantsBean getOnlyRestaurant(List<LoginBean.DataBean.UserBean.BrandsBean> brands) { private BrandsBean.BrandsData.RestaurantsBean getOnlyRestaurant(List<BrandsBean.BrandsData> brands) {
for (int i = 0; i < brands.size(); i++) { for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) { if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) { for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
...@@ -121,7 +122,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -121,7 +122,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
return null; return null;
} }
private LoginBean.DataBean.UserBean.BrandsBean getBrandByRestaurantId(List<LoginBean.DataBean.UserBean.BrandsBean> brands, int restaurantId) { private BrandsBean.BrandsData getBrandByRestaurantId(List<BrandsBean.BrandsData> brands, int restaurantId) {
for (int i = 0; i < brands.size(); i++) { for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) { if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) { for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
...@@ -137,7 +138,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -137,7 +138,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
private void jumpDownloadActivity() { private void jumpDownloadActivity() {
CC.obtainBuilder("Component.Download") CC.obtainBuilder("Component.Download")
.setActionName("showDownloadActivity") .setActionName("showDownloadActivity")
.addParam("fromPage",1) .addParam("fromPage", 1)
.build() .build()
.call(); .call();
killMyself(); killMyself();
......
...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.login.mvp.model; ...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.login.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.login.mvp.contract.LoginContract; import com.gingersoft.gsa.cloud.login.mvp.contract.LoginContract;
import com.gingersoft.gsa.cloud.login.mvp.server.LoginService; import com.gingersoft.gsa.cloud.login.mvp.server.LoginService;
...@@ -53,4 +54,10 @@ public class LoginModel extends BaseModel implements LoginContract.Model{ ...@@ -53,4 +54,10 @@ public class LoginModel extends BaseModel implements LoginContract.Model{
return mRepositoryManager.obtainRetrofitService(LoginService.class) return mRepositoryManager.obtainRetrofitService(LoginService.class)
.login(requestBody); .login(requestBody);
} }
@Override
public Observable<BrandsBean> getRestaurantList() {
return mRepositoryManager.obtainRetrofitService(LoginService.class)
.getRestaurantList();
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.login.mvp.model; ...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.login.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract; import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract;
import com.gingersoft.gsa.cloud.login.mvp.server.LoginService; import com.gingersoft.gsa.cloud.login.mvp.server.LoginService;
...@@ -40,4 +41,10 @@ public class WelcomeModel extends BaseModel implements WelcomeContract.Model { ...@@ -40,4 +41,10 @@ public class WelcomeModel extends BaseModel implements WelcomeContract.Model {
return mRepositoryManager.obtainRetrofitService(LoginService.class) return mRepositoryManager.obtainRetrofitService(LoginService.class)
.login(requestBody); .login(requestBody);
} }
@Override
public Observable<BrandsBean> getRestaurantList() {
return mRepositoryManager.obtainRetrofitService(LoginService.class)
.getRestaurantList();
}
} }
\ No newline at end of file
...@@ -6,9 +6,10 @@ import android.content.Intent; ...@@ -6,9 +6,10 @@ import android.content.Intent;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.login.mvp.contract.BaseLoginContract; 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.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.jess.arms.di.scope.ActivityScope; import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
...@@ -106,4 +107,34 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas ...@@ -106,4 +107,34 @@ 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){
mRootView.saveRestaurantListInfo(info.getData());
} else {
mRootView.saveRestaurantListInfo(null);
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
}
});
}
} }
package com.gingersoft.gsa.cloud.login.mvp.server; package com.gingersoft.gsa.cloud.login.mvp.server;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import io.reactivex.Observable; import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager; import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST; import retrofit2.http.POST;
/** /**
...@@ -14,9 +17,20 @@ import retrofit2.http.POST; ...@@ -14,9 +17,20 @@ import retrofit2.http.POST;
*/ */
public interface LoginService { public interface LoginService {
@POST("gsa/login" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) // @POST("gsa/login" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
// Observable<LoginBean> login(@Body RequestBody requestBody);
@Headers({"Domain-Name: system_url"})
@POST("public/user/login" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<LoginBean> login(@Body RequestBody requestBody); Observable<LoginBean> login(@Body RequestBody requestBody);
@POST("gsa/logout" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @Headers({"Domain-Name: system_url"})
@POST("user/logout" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<Object> loginOut(@Body RequestBody requestBody); Observable<Object> loginOut(@Body RequestBody requestBody);
@GET("user/brand/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BrandsBean> getRestaurantList();
} }
...@@ -20,6 +20,7 @@ import com.gingersoft.gsa.cloud.base.utils.encryption.Aes; ...@@ -20,6 +20,7 @@ import com.gingersoft.gsa.cloud.base.utils.encryption.Aes;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil; import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil; import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
...@@ -312,7 +313,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -312,7 +313,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
} }
//158 - 189 //158 - 189
@Override @Override
public void showChooseRestaurantDialog(List<LoginBean.DataBean.UserBean.BrandsBean> brandsBeans, List<LoginBean.DataBean.UserBean.BrandsBean> brands) { public void showChooseRestaurantDialog(List<BrandsBean.BrandsData> brandsBeans, List<BrandsBean.BrandsData> brands) {
new ChooseRestaurantDialog.BottomListSheetBuilder(mContext) new ChooseRestaurantDialog.BottomListSheetBuilder(mContext)
.addBrandItems(brandsBeans) .addBrandItems(brandsBeans)
.setOnItemClickListener((dialog, item, position) -> ChooseRestaurantItemClick(brands, dialog, item)) .setOnItemClickListener((dialog, item, position) -> ChooseRestaurantItemClick(brands, dialog, item))
......
...@@ -4,7 +4,6 @@ import android.animation.AnimatorSet; ...@@ -4,7 +4,6 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
...@@ -18,13 +17,9 @@ import androidx.annotation.Nullable; ...@@ -18,13 +17,9 @@ import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.viewpager2.widget.ViewPager2; import androidx.viewpager2.widget.ViewPager2;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.constans.UserConstans;
import com.gingersoft.gsa.cloud.base.utils.encryption.Aes; import com.gingersoft.gsa.cloud.base.utils.encryption.Aes;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.constans.UserConstans;
import com.gingersoft.gsa.cloud.ui.widget.Indicator.UIndicator;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.gingersoft.gsa.cloud.login.R; import com.gingersoft.gsa.cloud.login.R;
import com.gingersoft.gsa.cloud.login.R2; import com.gingersoft.gsa.cloud.login.R2;
import com.gingersoft.gsa.cloud.login.di.component.DaggerWelcomeComponent; import com.gingersoft.gsa.cloud.login.di.component.DaggerWelcomeComponent;
...@@ -34,6 +29,10 @@ import com.gingersoft.gsa.cloud.login.mvp.contract.LoginInterfaceImpl; ...@@ -34,6 +29,10 @@ import com.gingersoft.gsa.cloud.login.mvp.contract.LoginInterfaceImpl;
import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract; import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract;
import com.gingersoft.gsa.cloud.login.mvp.presenter.WelcomePresenter; import com.gingersoft.gsa.cloud.login.mvp.presenter.WelcomePresenter;
import com.gingersoft.gsa.cloud.login.mvp.ui.adapter.GuideAdapter; import com.gingersoft.gsa.cloud.login.mvp.ui.adapter.GuideAdapter;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.widget.Indicator.UIndicator;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
...@@ -271,7 +270,7 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem ...@@ -271,7 +270,7 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
private boolean isChooseRestaurant = false; private boolean isChooseRestaurant = false;
@Override @Override
public void showChooseRestaurantDialog(List<LoginBean.DataBean.UserBean.BrandsBean> brandsBeans, List<LoginBean.DataBean.UserBean.BrandsBean> brands) { public void showChooseRestaurantDialog(List<BrandsBean.BrandsData> brandsBeans, List<BrandsBean.BrandsData> brands) {
new ChooseRestaurantDialog.BottomListSheetBuilder(mContext) new ChooseRestaurantDialog.BottomListSheetBuilder(mContext)
.addBrandItems(brandsBeans) .addBrandItems(brandsBeans)
.setOnItemClickListener((dialog, item, position) -> { .setOnItemClickListener((dialog, item, position) -> {
......
...@@ -115,6 +115,7 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa ...@@ -115,6 +115,7 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
public void loginOut() { public void loginOut() {
RequestBody requestBody = new FormBody.Builder() RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", GsaCloudApplication.getRestaurantId(mApplication) + "") .add("restaurantId", GsaCloudApplication.getRestaurantId(mApplication) + "")
.add("type", "2")
.build(); .build();
clearHeartbeat(); clearHeartbeat();
mModel.loginOut(requestBody) mModel.loginOut(requestBody)
......
...@@ -41,7 +41,7 @@ import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.MainOrderingAdapter; ...@@ -41,7 +41,7 @@ import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.MainOrderingAdapter;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.MainSideMenuAdapter; import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.MainSideMenuAdapter;
import com.gingersoft.gsa.cloud.main.mvp.ui.fragment.MainTopFragment; import com.gingersoft.gsa.cloud.main.mvp.ui.fragment.MainTopFragment;
import com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu; import com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog;
import com.jess.arms.base.BaseFragmentActivity; import com.jess.arms.base.BaseFragmentActivity;
...@@ -368,7 +368,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -368,7 +368,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
private void showChooseRestaurantDialog() { private void showChooseRestaurantDialog() {
String brandRestaurantInfos = GsaCloudApplication.getBrandRestaurantInfos(this); String brandRestaurantInfos = GsaCloudApplication.getBrandRestaurantInfos(this);
if (!TextUtils.isEmpty(brandRestaurantInfos)) { if (!TextUtils.isEmpty(brandRestaurantInfos)) {
List<LoginBean.DataBean.UserBean.BrandsBean> brandsBeans = JsonUtils.parseArray(brandRestaurantInfos, LoginBean.DataBean.UserBean.BrandsBean.class); List<BrandsBean.BrandsData> brandsBeans = JsonUtils.parseArray(brandRestaurantInfos, BrandsBean.BrandsData.class);
if (brandsBeans != null && brandsBeans.size() > 0) { if (brandsBeans != null && brandsBeans.size() > 0) {
new ChooseRestaurantDialog.BottomListSheetBuilder(this) new ChooseRestaurantDialog.BottomListSheetBuilder(this)
.addBrandItems(brandsBeans) .addBrandItems(brandsBeans)
...@@ -376,7 +376,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -376,7 +376,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
//切換餐廳,發送關閉接單的廣播,並清除心跳 //切換餐廳,發送關閉接單的廣播,並清除心跳
sendBroadcast(new Intent(AppConstans.CLEAR_ORDER_RECEIVING_HEART)); sendBroadcast(new Intent(AppConstans.CLEAR_ORDER_RECEIVING_HEART));
LoginBean.DataBean.UserBean.BrandsBean brandsBean = RestaurantInfoUtils.getBrandByRestaurantId(brandsBeans, item.getId()); BrandsBean.BrandsData brandsBean = RestaurantInfoUtils.getBrandByRestaurantId(brandsBeans, item.getId());
if (brandsBean != null) { if (brandsBean != null) {
saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), item.getId(), item.getText()); saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), item.getId(), item.getText());
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application> <application>
<activity <activity
android:name=".ui.activity.OtherOrderActivity" android:name=".ui.activity.OtherOrderActivity"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
package="com.gingersoft.gsa.other_order_mode"> package="com.gingersoft.gsa.other_order_mode">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application <application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication" android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
......
...@@ -56,6 +56,7 @@ class GetInfoUpdateService : Service() { ...@@ -56,6 +56,7 @@ class GetInfoUpdateService : Service() {
val restaurantId by lazy { val restaurantId by lazy {
GsaCloudApplication.getRestaurantId(this) GsaCloudApplication.getRestaurantId(this)
// 26
} }
override fun onBind(intent: Intent?): IBinder? { override fun onBind(intent: Intent?): IBinder? {
......
...@@ -132,6 +132,16 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -132,6 +132,16 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
finish(); finish();
} }
} else { } else {
// printerDeviceBeans = new ArrayList<>();
// PrinterDeviceBean printerDeviceBean = new PrinterDeviceBean();
// printerDeviceBean.setName("EPSON");
// printerDeviceBean.setIp("192.168.1.203");
// printerDeviceBean.setPort(9100);
// printerDeviceBean.setStatus(2);
// printerDeviceBean.setPaperSpecification("200");
// printerDeviceBean.setPrinterName("EPSON");
// printerDeviceBean.setModel("EPSON");
// printerDeviceBeans.add(printerDeviceBean);
if (printerDeviceBeans == null || printerDeviceBeans.size() <= 0) { if (printerDeviceBeans == null || printerDeviceBeans.size() <= 0) {
mPresenter.getPrinterList(GsaCloudApplication.getRestaurantId(mContext)); mPresenter.getPrinterList(GsaCloudApplication.getRestaurantId(mContext));
} else { } else {
......
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