|
|
@@ -14,6 +14,7 @@ import android.widget.TextView;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.common.LogUtil;
|
|
|
import com.common.config.BaseConfig;
|
|
|
import com.common.data.JSONUtil;
|
|
|
import com.common.data.ListUtils;
|
|
|
@@ -72,12 +73,9 @@ public class WorkPlatFragment extends BaseMVPFragment<WorkPlatPresenter> impleme
|
|
|
setHasOptionsMenu(true);
|
|
|
isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
|
|
|
mWorkMenuListView = $(R.id.work_menu_lv);
|
|
|
-// mWorkMenuListView.setMode(PullToRefreshBase.Mode.DISABLED);
|
|
|
|
|
|
View setItem = LayoutInflater.from(mContext).inflate(R.layout.layout_work_plat_set, null);
|
|
|
mSetTextView = (TextView) setItem.findViewById(R.id.work_plat_set_tv);
|
|
|
-
|
|
|
-// ListView refreshableView = mWorkMenuListView.getRefreshableView();
|
|
|
mWorkMenuListView.addFooterView(setItem);
|
|
|
|
|
|
mCacheMenuTypeBeans = new ArrayList<>();
|
|
|
@@ -123,27 +121,46 @@ public class WorkPlatFragment extends BaseMVPFragment<WorkPlatPresenter> impleme
|
|
|
private void getLocalMenu() {
|
|
|
String role = com.core.utils.CommonUtil.getUserRole();
|
|
|
String userId = MyApplication.getInstance().mLoginUser.getUserId();
|
|
|
- if (role.equals("1")) {//个人用户
|
|
|
- if (userId != null && !userId.equals(mUserId)) {
|
|
|
+ if (role.equals("1")) {
|
|
|
+ //个人用户
|
|
|
+ if (userId != null) {
|
|
|
+ if (!userId.equals(mUserId)) {
|
|
|
+ LogUtil.d("工作台","loadMenu1");
|
|
|
+ mPresenter.uasRequest(mContext, new HttpParams.Builder().flag(Constants.LOAD_WORK_MENU_CACHE).build());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ LogUtil.d("工作台","loadMenu2");
|
|
|
mPresenter.uasRequest(mContext, new HttpParams.Builder().flag(Constants.LOAD_WORK_MENU_CACHE).build());
|
|
|
}
|
|
|
mUserId = userId;
|
|
|
mCompanyName = "";
|
|
|
mMaster = "";
|
|
|
- } else if (role.equals("3")) {//b2b用户
|
|
|
+ } else if (role.equals("3")) {
|
|
|
+ //b2b用户
|
|
|
String companyName = com.core.utils.CommonUtil.getSharedPreferences(mContext, "companyName");
|
|
|
- if (companyName != null && userId != null
|
|
|
- && (!userId.equals(mUserId) || !companyName.equals(mCompanyName))) {
|
|
|
+ if (companyName != null && userId != null) {
|
|
|
+ if ((!userId.equals(mUserId) || !companyName.equals(mCompanyName))) {
|
|
|
+ LogUtil.d("工作台","loadMenu1");
|
|
|
+ mPresenter.uasRequest(mContext, new HttpParams.Builder().flag(Constants.LOAD_WORK_MENU_CACHE).build());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ LogUtil.d("工作台","loadMenu2");
|
|
|
mPresenter.uasRequest(mContext, new HttpParams.Builder().flag(Constants.LOAD_WORK_MENU_CACHE).build());
|
|
|
}
|
|
|
mUserId = userId;
|
|
|
mCompanyName = companyName;
|
|
|
mMaster = "";
|
|
|
- } else if (role.equals("2")) {//ERP用户
|
|
|
+ } else if (role.equals("2")) {
|
|
|
+ //ERP用户
|
|
|
String erp_company = com.core.utils.CommonUtil.getSharedPreferences(mContext, "erp_commpany");
|
|
|
String erp_master = com.core.utils.CommonUtil.getSharedPreferences(mContext, "erp_master");
|
|
|
- if (erp_company != null && erp_master != null && userId != null
|
|
|
- && (!userId.equals(mUserId) || !erp_company.equals(mCompanyName) || !erp_master.equals(mMaster))) {
|
|
|
+ if (erp_company != null && erp_master != null && userId != null) {
|
|
|
+ if ((!userId.equals(mUserId) || !erp_company.equals(mCompanyName) || !erp_master.equals(mMaster))) {
|
|
|
+ LogUtil.d("工作台","loadMenu1");
|
|
|
+ mPresenter.uasRequest(mContext, new HttpParams.Builder().flag(Constants.LOAD_WORK_MENU_CACHE).build());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ LogUtil.d("工作台","loadMenu2");
|
|
|
mPresenter.uasRequest(mContext, new HttpParams.Builder().flag(Constants.LOAD_WORK_MENU_CACHE).build());
|
|
|
}
|
|
|
mUserId = userId;
|
|
|
@@ -219,8 +236,9 @@ public class WorkPlatFragment extends BaseMVPFragment<WorkPlatPresenter> impleme
|
|
|
|
|
|
@Override
|
|
|
public void requestSuccess(int what, Object object) {
|
|
|
- if (object != null)
|
|
|
+ if (object != null) {
|
|
|
Log.d("worksuccess", object.toString());
|
|
|
+ }
|
|
|
if (what == Constants.LOAD_WORK_MENU_CACHE) {
|
|
|
mCacheMenuTypeBeans = (List<WorkMenuBean>) object;
|
|
|
mWorkMenuBeans.clear();
|