Browse Source

提交类型 备份
提交内容 创建一个新的通用activity,将差旅的界面切换成依赖这个类前备份
冲突处理 版本文件,取网络

Bitliker 8 years ago
parent
commit
18d04049b7

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Tue Jan 09 11:42:58 CST 2018
-debugName=396
+#Wed Jan 10 11:03:45 CST 2018
+debugName=399
 versionName=624
-debugCode=396
+debugCode=399
 versionCode=163

+ 0 - 83
app_modular/apptasks/src/main/java/com/modular/apptasks/util/AutoTaskHttp.java

@@ -1,83 +0,0 @@
-package com.modular.apptasks.util;
-
-import com.alibaba.fastjson.JSONArray;
-import com.common.LogUtil;
-import com.core.api.wxapi.ApiConfig;
-import com.core.api.wxapi.ApiPlatform;
-import com.core.api.wxapi.ApiUtils;
-import com.core.net.http.http.OAHttpHelper;
-import com.core.net.http.http.Request;
-import com.core.utils.CommonUtil;
-import com.modular.apputils.listener.OnSmartHttpListener;
-import com.modular.apputils.network.Failure;
-import com.modular.apputils.network.Parameter;
-import com.modular.apputils.network.SmartHttpClient;
-import com.modular.apputils.network.Success;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Created by Bitliker on 2017/9/29
- */
-
-public class AutoTaskHttp implements OnSmartHttpListener {
-	private final int LOAD_PLAN = 21;//获取外勤计划
-	private final int SIGNIN_MISSION = 22;//外勤签到
-	private final int HAVE_OUT_PLAN = 23;//还有未拜访外勤计划
-
-	private final int LOAD_WORK_SET = 24;//获取打卡设置
-	private boolean isB2b;
-
-	public AutoTaskHttp() {
-		isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
-	}
-
-	/*获取打卡设置*/
-	public void loadWorkSet() {
-		String action = isB2b ? ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().get_plat_senior_setting_url :
-				"mobile/getconfigs.action";
-		Parameter.Builder builder = new Parameter.Builder().setAction(action).record(LOAD_WORK_SET);
-		if (!isB2b) {
-			builder.add("code", 1);
-		}
-		SmartHttpClient.api().get(builder.build(), this);
-	}
-
-	//获取外勤计划列表
-	public void loadMissionPlan() {
-		Parameter paramenter = new Parameter.Builder()
-				.setAction("mobile/mobileoutplan.action")
-				.add("emcode", CommonUtil.getEmcode())
-				.record(LOAD_PLAN)
-				.build();
-		SmartHttpClient.api().get(paramenter, this);
-	}
-
-	@Override
-	public void onSuccess(Success success) {
-		switch (success.getRecord()) {
-			case LOAD_PLAN:
-				handlerData(success.getJSONArray("data", "success"));
-				break;
-			case SIGNIN_MISSION:
-				break;
-			case HAVE_OUT_PLAN:
-				break;
-		}
-
-	}
-
-	@Override
-	public void onFailure(Failure failure) {
-		LogUtil.i(failure.getMessage());
-	}
-
-
-	private void handlerData(final JSONArray array) {
-
-
-	}
-
-}
-

+ 307 - 0
app_modular/apputils/src/main/java/com/modular/apputils/activity/BaseNetActivity.java

@@ -0,0 +1,307 @@
+package com.modular.apputils.activity;
+
+import android.app.Activity;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
+import android.util.DisplayMetrics;
+import android.util.SparseArray;
+import android.view.View;
+
+import com.common.LogUtil;
+import com.common.config.BaseConfig;
+import com.common.data.StringUtil;
+import com.common.preferences.PreferenceUtils;
+import com.core.app.ActionBackActivity;
+import com.core.app.Constants;
+import com.core.base.BaseActivity;
+import com.core.utils.CommonUtil;
+import com.core.widget.CustomProgressDialog;
+import com.me.network.app.http.HttpClient;
+import com.me.network.app.http.rx.Result2Listener;
+import com.me.network.app.http.rx.ResultListener;
+import com.me.network.app.http.rx.ResultSubscriber;
+import com.modular.apputils.listener.OnSmartHttpListener;
+import com.modular.apputils.network.Parameter;
+import com.modular.apputils.network.Success;
+import com.modular.apputils.network.Tags;
+import com.umeng.analytics.MobclickAgent;
+
+import java.util.Locale;
+
+
+/**
+ * Created by Bitlike on 2018/1/10.
+ */
+
+public abstract class BaseNetActivity extends ActionBackActivity {
+    protected Activity ct;
+    private CustomProgressDialog progressDialog;
+    private HttpClient httpClient;
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        MobclickAgent.onResume(ct);
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        MobclickAgent.onPause(ct);
+    }
+
+    @Override
+    protected final void onCreate(Bundle savedInstanceState) {
+        preOnCreacte();
+        super.onCreate(savedInstanceState);
+        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏
+        progressDialog = CustomProgressDialog.createDialog(this);
+        //重启之后恢复到之前的语言
+        switchLanguage(PreferenceUtils.getString(this, "language", "rCN"));
+        initHttpConfig();
+        View layout = getLayoutView();
+        if (layout == null) {
+            int layoutId = getLayoutId();
+            if (layoutId > 0) {
+                setContentView(layoutId);
+            }
+        } else {
+            setContentView(layout);
+        }
+        try {
+            init();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    protected void preOnCreacte() {
+    }
+
+    protected abstract int getLayoutId();
+
+    protected View getLayoutView() {
+        return null;
+    }
+
+    protected abstract void init() throws Exception;
+
+    protected abstract String getBaseUrl();
+
+
+    /**************网络请求**********************/
+
+    private void initHttpConfig() {
+        String baseUrl = getBaseUrl();
+        if (!StringUtil.isEmpty(baseUrl)) {
+            httpClient = new HttpClient.Builder(baseUrl).isDebug(true)
+                    .connectTimeout(5000)
+                    .readTimeout(5000).build();
+        }
+    }
+
+
+    protected void requestHttp(Parameter.Builder builder, final OnSmartHttpListener onHttpListener) {
+        if (httpClient != null && builder != null) {
+            HttpClient.Builder httpBuilder = new HttpClient.Builder();
+            final Parameter parameter = builder.builder();
+            httpBuilder.addParams(parameter.getParams())
+                    .addHeaders(parameter.getHeaders())
+                    .method(parameter.getMode())
+                    .url(parameter.getUrl());
+            if (parameter.autoProgress()) {
+                showProgress();
+            }
+            httpClient.Api().send(httpBuilder.build(), new ResultSubscriber<>(new Result2Listener<Object>() {
+                @Override
+                public void onResponse(Object o) {
+                    if (onHttpListener != null) try {
+                        Tags tags = parameter.getTag();
+                        int record = 0;
+                        if (tags != null) {
+                            record = tags.getRecord();
+                        }
+                        Success success = new Success(o.toString(), tags);
+                        onHttpListener.onSuccess(record, success);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    dismissProgress();
+                }
+
+                @Override
+                public void onFailure(Object t) {
+                    if (onHttpListener != null) try {
+                        Tags tags = parameter.getTag();
+                        int record = 0;
+                        if (tags != null) {
+                            record = tags.getRecord();
+                        }
+                        Success success = new Success(t.toString(), tags);
+                        onHttpListener.onSuccess(record, success);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    dismissProgress();
+                }
+            }));
+        }
+    }
+
+    protected void requestCompanyHttp(Parameter.Builder builder, final OnSmartHttpListener onHttpListener) {
+        if (builder != null) {
+            String sessionId = CommonUtil.getSharedPreferences(ct, "sessionId");
+            String emCode = CommonUtil.getEmcode();
+            builder.addSuperParams("sessionId", sessionId);
+            builder.addSuperParams("master", CommonUtil.getMaster());
+            builder.addSuperParams("sessionUser", emCode);
+            builder.addSuperHeaders("sessionUser", emCode);
+            builder.addSuperHeaders("Cookie", "JSESSIONID=" + sessionId);
+            requestHttp(builder, onHttpListener);
+        }
+    }
+
+
+    /*****************************显示进度框***************************************/
+    protected void showProgress() {
+        showProgress(true, "", "");
+    }
+
+    protected void showProgress(boolean cancelable) {
+        showProgress(cancelable, "", "");
+    }
+
+    protected void showProgress(boolean cancelable, String message) {
+        showProgress(cancelable, "", message);
+    }
+
+    protected void showProgress(boolean cancelable, String title, String message) {
+        if (progressDialog != null) {
+            progressDialog.setMessage(message);
+            progressDialog.setMessage(title);
+            progressDialog.setCanceledOnTouchOutside(cancelable);
+            progressDialog.setCancelable(cancelable);
+            progressDialog.show();
+        }
+    }
+
+    protected void dismissProgress() {
+        if (progressDialog != null && progressDialog.isShowing()) {
+            progressDialog.dismiss();
+        }
+    }
+
+    /*********************切换语言***************************/
+    protected void switchLanguage(String language) {
+        Resources resources = getResources();
+        Configuration config = resources.getConfiguration();
+        DisplayMetrics dm = resources.getDisplayMetrics();
+        if (language.equals("en")) {
+            config.locale = Locale.ENGLISH;
+        } else if (language.equals("rCN")) {
+            config.locale = Locale.SIMPLIFIED_CHINESE;
+        } else if (language.equals("rTW")) {
+            config.locale = Locale.TRADITIONAL_CHINESE;
+        } else if (language.equals("sys")) {
+            config.locale = Locale.getDefault();
+        }
+        resources.updateConfiguration(config, dm);
+        PreferenceUtils.putString("language", language);
+    }
+
+
+    /*********************处理权限问题*********************/
+    private SparseArray<Runnable> allowablePermissionRunnables;
+    private SparseArray<Runnable> disallowablePermissionRunnables;
+    private int permissionItem = 0;
+
+    /***********************判断是否缺少权限**********************/
+    protected boolean lacksPermission(String permission) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            return ContextCompat.checkSelfPermission(ct, permission) != PackageManager.PERMISSION_GRANTED;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 请求权限,先判断,如果没有权限就去请求
+     * 尽量不将权限请求放在onResume 中,会出现不断循环请求
+     *
+     * @param permission           权限
+     * @param allowableRunnable    当取得权限后执行操作,主线程
+     * @param disallowableRunnable 当用户拒绝权限后执行操作,主线程
+     */
+    public void requestPermission(String permission, Runnable allowableRunnable, Runnable disallowableRunnable) {
+        permissionItem++;
+        if (allowableRunnable != null) {
+            if (allowablePermissionRunnables == null) {
+                allowablePermissionRunnables = new SparseArray<>();
+            }
+            allowablePermissionRunnables.put(permissionItem, allowableRunnable);
+        }
+        if (disallowableRunnable != null) {
+            if (disallowablePermissionRunnables == null) {
+                disallowablePermissionRunnables = new SparseArray<>();
+            }
+            disallowablePermissionRunnables.put(permissionItem, disallowableRunnable);
+        }
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            //减少是否拥有权限
+            int checkCallPhonePermission = ContextCompat.checkSelfPermission(getApplicationContext(), permission);
+            if (checkCallPhonePermission != PackageManager.PERMISSION_GRANTED) {//没有获取到权限
+//				if (!shouldShowRequestPermissionRationale(permission)) {
+                //弹出对话框接收权限
+                ActivityCompat.requestPermissions(ct, new String[]{permission}, permissionItem);
+//				} else {
+//					ToastUtil.showToast(ct, R.string.not_camera_permission);
+//				}
+            } else {
+                if (allowableRunnable != null) {
+                    allowableRunnable.run();
+                }
+            }
+        } else {
+            if (allowableRunnable != null) {
+                allowableRunnable.run();
+            }
+        }
+    }
+
+    @Override
+    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+        if (permissions != null) {
+            for (String p : permissions) {
+                LogUtil.i("permission=" + p);
+            }
+        }
+        if (grantResults != null && grantResults.length > 0) {
+            if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+                if (allowablePermissionRunnables != null) {
+                    Runnable allowRun = allowablePermissionRunnables.get(requestCode);
+                    if (allowRun != null) {
+                        allowRun.run();
+                    }
+                }
+
+            } else {
+                if (disallowablePermissionRunnables != null) {
+                    Runnable disallowRun = disallowablePermissionRunnables.get(requestCode);
+                    if (disallowRun != null) {
+                        disallowRun.run();
+                    }
+                }
+
+            }
+        }
+    }
+
+}

+ 2 - 2
app_modular/apputils/src/main/java/com/modular/apputils/listener/OnSmartHttpListener.java

@@ -10,9 +10,9 @@ import com.modular.apputils.network.Success;
 
 public interface OnSmartHttpListener {
 
-	void onSuccess(Success success);
+	void onSuccess(int what,Success success) throws Exception;
 
-	void onFailure(Failure failure);
+	void onFailure(int what,Failure failure) throws Exception;
 
 
 }

+ 171 - 93
app_modular/apputils/src/main/java/com/modular/apputils/network/Parameter.java

@@ -1,6 +1,14 @@
 package com.modular.apputils.network;
 
-import com.me.network.app.http.HttpClient;
+
+import android.support.annotation.IntDef;
+
+import com.me.network.app.http.Method;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Created by Bitliker on 2017/9/29.
@@ -8,97 +16,167 @@ import com.me.network.app.http.HttpClient;
 
 public class Parameter {
 
-	private boolean neetCommon;
-	private String baseUrl;
-	private String action;
-	private Tags tags;
-	private HttpClient.Builder httpBuilder;
-
-	private Parameter() {
-	}
-
-	public boolean isNeetCommon() {
-		return neetCommon;
-	}
-
-	public String getBaseUrl() {
-		return baseUrl;
-	}
-
-	public String getAction() {
-		return action;
-	}
-
-	public HttpClient.Builder getHttpBuilder() {
-		return httpBuilder;
-	}
-
-	public Tags getTags() {
-		return tags;
-	}
-
-	public static class Builder {
-
-		private Parameter parameter;
-
-		public Builder(boolean neetCommon) {
-			parameter = new Parameter();
-			parameter.tags=new Tags();
-			parameter.neetCommon = neetCommon;
-			parameter.httpBuilder = new HttpClient.Builder();
-		}
-
-		public Builder() {
-			parameter.neetCommon = true;
-			parameter.tags=new Tags();
-			parameter.httpBuilder = new HttpClient.Builder();
-		}
-
-		public Builder setBaseUrl(String baseUrl) {
-			parameter.baseUrl = baseUrl;
-			return this;
-		}
-
-		public Builder setAction(String action) {
-			parameter.action = action;
-			return this;
-		}
-
-		public Builder add(String key, Object value) {
-			parameter.httpBuilder.add(key, value);
-			return this;
-		}
-
-		public Builder header(String key, Object value) {
-			parameter.httpBuilder.header(key, value);
-			return this;
-		}
-
-		public Builder tag(int key, Object value) {
-			parameter.tags.put(key, value);
-			return this;
-		}
-
-		public Builder tag(Object value) {
-			parameter.tags.put(Tags.DEF_TAG, value);
-			return this;
-		}
-
-		public Builder record(int value) {
-			parameter.tags.put(Tags.RECORD_TAG, value);
-			return this;
-		}
-
-		public Builder setTags(Tags tags) {
-			if (tags != null) {
-				parameter.tags = tags;
-			}
-			return this;
-		}
-
-		public Parameter build() {
-			return parameter;
-		}
-	}
+
+    public static final String MEDIA_TYPE_XWWW = "application/x-www-form-urlencoded;charset=utf-8";
+    public static final String MEDIA_TYPE_JSON = "application/json;charset=utf-8";
+    public static final String MEDIA_TYPE_PLAIN = "text/plain;charset=utf-8";
+    public static final String MEDIA_TYPE_STREAM = "application/octet-stream;charset=utf-8";
+    public static final String MEDIA_TYPE_MULTIPART = "multipart/form-data;charset=utf-8";
+
+
+    private int mode = Method.GET;//请求模式
+    private String url;//请求的url
+    private String mediaType = MEDIA_TYPE_JSON;
+    private Map<String, Object> params;
+    private Map<String, Object> headers;
+    private Tags tag;
+    boolean autoProgress = false;
+
+    private Parameter() {
+        tag = new Tags();
+        params = new HashMap<>();
+        headers = new HashMap<>();
+    }
+
+    public boolean autoProgress() {
+        return autoProgress;
+    }
+
+    public Map<String, Object> getHeaders() {
+        return headers == null ? new HashMap<String, Object>() : headers;
+    }
+
+    public Map<String, Object> getParams() {
+        return params == null ? new HashMap<String, Object>() : params;
+    }
+
+    public Tags getTag() {
+        return tag == null ? new Tags() : tag;
+    }
+
+    public int getMode() {
+        return mode == 0 ? Method.GET : mode;
+    }
+
+
+    public String getUrl() {
+        return url;
+    }
+
+    public String getMediaType() {
+        return mediaType;
+    }
+
+    public static class Builder {
+
+        private Parameter request;
+
+        public Builder(Parameter request) {
+            this.request = request;
+        }
+
+        public Builder() {
+            this.request = new Parameter();
+        }
+
+
+        public Builder mode(@Duration int mode) {
+            this.request.mode = mode;
+            return this;
+        }
+
+        public Builder url(String url) {
+            if (url != null) {
+                this.request.url = url;
+            }
+            return this;
+        }
+
+        public Builder mediaType(String mediaType) {
+            if (mediaType != null) {
+                this.request.mediaType = mediaType;
+            }
+            return this;
+        }
+
+        public Builder headers(Map<String, Object> header) {
+            if (header != null) {
+                this.request.headers = header;
+            }
+            return this;
+        }
+
+        public Builder addHeaders(String key, Object value) {
+            this.request.getHeaders().put(key, value);
+            return this;
+        }
+
+        public Builder params(Map<String, Object> params) {
+            if (params != null) {
+                this.request.params = params;
+            }
+            return this;
+        }
+
+        public Builder addParams(String key, Object value) {
+            this.request.getParams().put(key, value);
+            return this;
+        }
+
+        public Builder addSuperParams(String key, Object value) {
+            if (!this.request.getParams().containsKey(key)) {
+                return addParams(key, value);
+            }
+            return this;
+        }
+
+        public Builder addSuperHeaders(String key, Object value) {
+            if (!this.request.getHeaders().containsKey(key)) {
+                return addHeaders(key, value);
+            }
+            return this;
+        }
+
+        public Builder tag(Object tag) {
+            if (tag != null) {
+                this.request.getTag().tag(tag);
+            }
+            return this;
+        }
+
+        public Builder record(int code) {
+            this.request.getTag().record(code);
+            return this;
+        }
+
+        public Builder autoProgress(boolean autoProgress) {
+            this.request.autoProgress = autoProgress;
+            return this;
+        }
+
+
+        public Builder addTag(int key, Object values) {
+            if (values != null) {
+                this.request.getTag().put(key, values);
+            }
+            return this;
+        }
+
+        public Parameter builder() {
+            return request;
+        }
+
+
+        public Parameter bulid() {
+            return request;
+        }
+    }
+
+
+    @IntDef({Method.GET, Method.POST})
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface Duration {
+    }
+
 
 }

+ 0 - 138
app_modular/apputils/src/main/java/com/modular/apputils/network/SmartHttpClient.java

@@ -1,138 +0,0 @@
-package com.modular.apputils.network;
-
-import android.support.annotation.IntDef;
-
-import com.common.LogUtil;
-import com.common.config.BaseConfig;
-import com.core.utils.CommonUtil;
-import com.me.network.app.http.HttpClient;
-import com.me.network.app.http.Method;
-import com.me.network.app.http.rx.Result2Listener;
-import com.me.network.app.http.rx.ResultSubscriber;
-import com.modular.apputils.listener.OnSmartHttpListener;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Created by Bitliker on 2017/9/29.
- */
-
-public class SmartHttpClient {
-
-	private static SmartHttpClient api;
-	private static HttpClient httpClient;
-	private static HttpClient httpClientErp;
-	private boolean isB2b;
-
-	public static SmartHttpClient api() {
-		SmartHttpClient inst = api;
-		if (inst == null) {
-			synchronized (SmartHttpClient.class) {
-				inst = api;
-				if (inst == null) {
-					inst = new SmartHttpClient();
-					api = inst;
-				}
-			}
-		}
-		return inst;
-	}
-
-	private SmartHttpClient() {
-		isB2b = false;
-	}
-
-	public void get(Parameter parameter, OnSmartHttpListener onSmartHttpListener) {
-		send(Method.GET, parameter, onSmartHttpListener);
-	}
-
-	public void post(Parameter parameter, OnSmartHttpListener onSmartHttpListener) {
-		send(Method.POST, parameter, onSmartHttpListener);
-	}
-
-	private void send(@Duration int mothod, final Parameter parameter, final OnSmartHttpListener onSmartHttpListener) {
-		if (parameter == null) {
-			return;
-		}
-		HttpClient httpClient = null;
-		if (parameter.isNeetCommon()) {
-			httpClient = getHttpClientErp(parameter.getBaseUrl());
-		} else {
-			httpClient = getHttpClient(parameter.getBaseUrl());
-		}
-		HttpClient.Builder builder = parameter.getHttpBuilder();
-		builder.method(mothod);
-		httpClient.Api().post(builder.build(), new ResultSubscriber<>(new Result2Listener<Object>() {
-			@Override
-			public void onResponse(Object t) {
-				try {
-					Result result = new Result(200, t.toString());
-					onSmartHttpListener.onSuccess(new Success(result));
-				} catch (Exception e) {
-					if (e != null) {
-						LogUtil.d("httpError", e.getMessage());
-					}
-				}
-
-			}
-
-			@Override
-			public void onFailure(Object t) {
-				try {
-					Result result = new Result(500, t.toString());
-					onSmartHttpListener.onFailure(new Failure(result));
-				} catch (Exception e) {
-					if (e != null) {
-						LogUtil.d("httpError", e.getMessage());
-					}
-				}
-			}
-		}));
-	}
-
-	private HttpClient getHttpClient(String baseUrl) {
-		if (httpClient == null) {
-			if (baseUrl == null || baseUrl.length() <= 0 || !baseUrl.startsWith("http")) {
-				baseUrl = CommonUtil.getAppBaseUrl(BaseConfig.getContext());
-			}
-			httpClient = new HttpClient.Builder(baseUrl)
-					.isDebug(BaseConfig.isDebug())
-					.connectTimeout(5000)
-					.readTimeout(5000)
-					.build();
-		}
-		return httpClient;
-	}
-
-
-	public static HttpClient getHttpClientErp(String baseUrl) {
-		if (httpClientErp == null) {
-			if (baseUrl == null || baseUrl.length() <= 0 || !baseUrl.startsWith("http")) {
-				baseUrl = CommonUtil.getAppBaseUrl(BaseConfig.getContext());
-			}
-			String sessionId = CommonUtil.getSharedPreferences(BaseConfig.getContext(), "sessionId");
-			httpClientErp = new HttpClient.Builder(baseUrl)
-					.isDebug(BaseConfig.isDebug())
-					.header("Cookie", "JSESSIONID=" + sessionId)
-					.add("master", CommonUtil.getMaster())
-					.add("sessionUser", CommonUtil.getEmcode())
-					.add("sessionId", sessionId)
-					.connectTimeout(5000)
-					.readTimeout(5000)
-					.build();
-		}
-		return httpClientErp;
-	}
-
-	public void updateB2b(boolean isB2b) {
-		this.isB2b = isB2b;
-		//TODO 进行HttpClient的初始化
-	}
-
-
-	@IntDef({Method.GET, Method.POST})
-	@Retention(RetentionPolicy.SOURCE)
-	public @interface Duration {
-	}
-}

+ 10 - 42
app_modular/apputils/src/main/java/com/modular/apputils/network/Success.java

@@ -9,53 +9,21 @@ import com.common.data.JSONUtil;
  * Created by Bitliker on 2017/6/14.
  */
 
-public class Success extends Result {
+public class Success   {
 
+	private String message;
+	private Tags tag;
 
-	public Success(Result result) {
-		super(result);
+	public Success(String message, Tags tag) {
+		this.message = message;
+		this.tag = tag;
 	}
 
-
-	public JSONObject getJsonObject() {
-		if (isJSON())
-			return JSON.parseObject(message);
-		else return new JSONObject();
-	}
-
-	public JSONObject getJsonObject(String... keys) {
-		if (isJSON()) {
-			JSONObject object = JSON.parseObject(message);
-			if (object != null && keys != null && keys.length > 0) {
-				for (String key : keys) {
-					if (object.containsKey(key) && object.get(key) instanceof JSONObject) {
-						return object.getJSONObject(key);
-					}
-				}
-			}
-		}
-		return new JSONObject();
-	}
-
-	public JSONArray getJSONArray() {
-		if (isJSON())
-			return JSON.parseArray(message);
-		else return new JSONArray();
+	public String getMessage() {
+		return message;
 	}
 
-	public JSONArray getJSONArray(String... keys) {
-		try {
-			if (isJsonObject()) {
-				return JSONUtil.getJSONArray(message, keys);
-			} else if (isJsonArray()) {
-				//TODO  当返回的是数组的时候
-			}
-		} catch (Exception e) {
-			return new JSONArray();
-		}
-		return new JSONArray();
-
+	public Tags getTag() {
+		return tag;
 	}
-
-
 }

+ 1 - 1
app_modular/apputils/src/main/java/com/modular/apputils/utils/SwitchUtil.java

@@ -10,7 +10,7 @@ import com.common.config.BaseConfig;
 public class SwitchUtil {
 
     public static boolean showYiyuanjuan() {
-        return false;
+        return true;
     }
 
     public static boolean showShebeiguanli() {

+ 9 - 3
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/BusinessTravelActivity.java

@@ -19,6 +19,7 @@ import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.Result2Listener;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.modular.apputils.activity.BaseNetActivity;
 import com.modular.apputils.widget.SpaceItemDecoration;
 import com.module.recyclerlibrary.ui.refresh.BaseRefreshLayout;
 import com.uas.appworks.OA.platform.adapter.BusinessTravelAdapter;
@@ -50,6 +51,11 @@ public class BusinessTravelActivity extends BaseActivity {
         loadData(page = 1);
     }
 
+//    @Override
+//    protected String getBaseUrl() {
+//        return CommonUtil.getAppBaseUrl(BaseConfig.getContext());
+//    }
+
     private void initView() {
         mRefreshLayout = findViewById(R.id.mRefreshLayout);
         mRecyclerView = findViewById(R.id.mRecyclerView);
@@ -69,7 +75,7 @@ public class BusinessTravelActivity extends BaseActivity {
 
     public void loadData(int page) {
         if (!mRefreshLayout.isRefreshing()) {
-            progressDialog.show();
+            showProgress();
         }
         httpClient.Api().send(new HttpClient.Builder()
                 .url("mobile/getBussinessTrip.action")
@@ -91,13 +97,13 @@ public class BusinessTravelActivity extends BaseActivity {
                     }
                 }
                 mRefreshLayout.stopRefresh();
-                progressDialog.dismiss();
+                dismissProgress();
             }
 
             @Override
             public void onFailure(Object t) {
                 mRefreshLayout.stopRefresh();
-                progressDialog.dismiss();
+                dismissProgress();
                 LogUtil.d("businesstravelerror", t.toString());
             }
         }));