Commit 0acbf33c by 罗翻

去掉model

parent 58f6ac2e
Showing with 925 additions and 1623 deletions
......@@ -9,9 +9,9 @@
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/annotation_lib" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/apt" />
<option value="$PROJECT_DIR$/lib" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
......
......@@ -2,10 +2,11 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/annotation_lib/annotation_lib.iml" filepath="$PROJECT_DIR$/annotation_lib/annotation_lib.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/apt/apt.iml" filepath="$PROJECT_DIR$/apt/apt.iml" />
<module fileurl="file://$PROJECT_DIR$/dayu.iml" filepath="$PROJECT_DIR$/dayu.iml" />
<module fileurl="file://$PROJECT_DIR$/lib/lib.iml" filepath="$PROJECT_DIR$/lib/lib.iml" />
<module fileurl="file://$PROJECT_DIR$/annotation_lib/lib.iml" filepath="$PROJECT_DIR$/annotation_lib/lib.iml" />
</modules>
</component>
</project>
\ No newline at end of file
......@@ -38,7 +38,7 @@ android {
debug {
signingConfig android.signingConfigs.release
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
......@@ -65,6 +65,7 @@ greendao {
daoPackage 'com.dayu.bigfish.greendao'
targetGenDir 'src/main/java'
}
repositories {
mavenCentral()
maven { url 'https://maven.google.com' }
......@@ -89,7 +90,6 @@ dependencies {
compile 'org.greenrobot:greendao:3.2.0'
//日期选择器
compile 'com.contrarywind:Android-PickerView:3.2.4'
compile files('libs/xUtils-2.6.14.jar')
//adapter
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
......@@ -100,6 +100,8 @@ dependencies {
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
annotationProcessor project(':apt')
compile project(':lib')
compile project(':annotation_lib')
}
......@@ -109,13 +109,6 @@
-adaptclassstrings
-keepattributes InnerClasses, EnclosingMethod, Signature, *Annotation*
#-keepnames @org.aspectj.lang.annotation.Aspect class * {
# ajc* <methods>;
#}
#---------------------------------------------------------------------------------------------------
#retrofit
-dontwarn okio.**
......@@ -197,5 +190,8 @@ public static java.lang.String TABLENAME;
#高德地图
-keep class com.amap.api.location.**{*;}
-keep class com.amap.api.fence.**{*;}
-keep class com.autonavi.aps.amapapi.model.**{*;}
-keep class com.amap.api.fence.**{*;}
-keep class com.autonavi.aps.amapapi.model.**{*;}
#友盟
-keep class com.umeng.commonsdk.** {*;}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.dayu.bigfish">
//网络权限
<uses-permission android:name="android.permission.INTERNET"/>
......@@ -54,7 +55,8 @@
android:icon="@mipmap/wechatimg"
android:label="@string/tv_dayu"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:replace="android:label,icon,theme">
<provider
android:name="android.support.v4.content.FileProvider"
......@@ -74,13 +76,10 @@
</intent-filter>
</activity>
//友盟统计相关配置:
<uses-sdk android:minSdkVersion="8"></uses-sdk>
//配置应用Appkey
<!--友盟统计-->
<meta-data
android:name="UMENG_APPKEY"
android:value="599a41697f2c743210000990"/>
//推广渠道名称(待配置)
<meta-data
android:name="UMENG_CHANNEL"
android:value="Channel ID"/>
......@@ -115,7 +114,8 @@
</receiver>
<activity android:name=".ui.LoginActivity"/>
<activity android:name=".ui.ReceivingActivity"
<activity
android:name=".ui.ReceivingActivity"
android:theme="@style/Transparent"
/>
<activity android:name=".ui.SettingActivity"/>
......@@ -130,6 +130,10 @@
<activity android:name=".ui.WithdrawalsActivity"/>
<activity android:name=".ui.AgreementActivity"/>
<activity android:name=".ui.MainActivity"/>
<activity android:name=".ui.SystemMesDetailActivity"/>
<activity android:name=".ui.SopWebViewActivity"/>
<service android:name=".api.DownloadService"/>
<receiver android:name=".utils.NetworkConnectChangedReceiver">
<intent-filter>
......
......@@ -22,64 +22,62 @@ public class Constants {
/***********************测试环境配置**********************************/
public static final int DEBUGLEVEL = LogUtils.LEVEL_ALL;
public static final String BASE_URL = "http://47.94.101.239:3112";
public final static String UP_PHOTO = "/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply";
/**************************正式环境*******************************/
// public static final int DEBUGLEVEL = LogUtils.LEVEL_OFF;
// public static final String BASE_URL = "https://mobile.dayu.ai";
public static final String LOGIN_URL = BASE_URL + "/check";
// public final static String UP_PHOTO = "/file/uploadMore?targetPath=online/sp/mobile/android/business/checkApply";
/*****************/
public static final String LOGIN_URL = "/check";
//登录时发送验证码的URL
public static final String REGISTER_URL = BASE_URL + "/api-user/" + "account/loginSms/";
//根据工单状态获取分页工单信息的路径
public static final String ORDER_URL = BASE_URL + "/api-order/" + "orders/findSimpleOrderVOByPage";
public static final String REGISTER_URL = "/api-user/" + "account/loginSms/{telephone}/type/{type}";
//异常单获取
public static final String ERROR_ORDER = BASE_URL + "/api-order/" + "orders/findExceptionSimpleOrderVO";
public static final String ERROR_ORDER = "/api-order/" + "orders/findExceptionSimpleOrderVO";
//工程师接单
public static final String ORDER_RECEIVING = BASE_URL + "/api-order/" + "orders/";
public static final String ORDER_RECEIVING = "/api-order/" + "orders/{orderId}/engineer/{engineerId}";
//再次上门、重新预约时间
public static final String ORDER_DOOR = BASE_URL + "/api-order/" + "orders/bespeakDoor";
public static final String SUBCRIBE_TIME = "/api-order/" + "orders/bespeakDoor";
//开始出发
public static final String START_ORDER = BASE_URL + "/api-order/" + "orders/onWay/";
public static final String START_ORDER = "/api-order/" + "orders/onWayUpgrade";
//开始服务
public static final String START_SERVE = BASE_URL + "/api-order/" + "orders/onWorking/";
public static final String START_SERVE = "/api-order/" + "orders/onWorkingUpgrade";
//工单详情信息,包含评价,投诉,服务记录
public static final String ORDER_DETAILS = BASE_URL + "/api-order/" + "orders/";
public static final String ORDER_DETAILS = "/api-order/" + "orders/{orderId}/detail";
//工单完成,提交验收报告
public static final String ORDER_FINISH = BASE_URL + "/api-order/" + "orders/waitCustomerCheck";
public static final String ORDER_FINISH = "/api-order/" + "orders/waitCustomerCheckUpgrade";
//个人中心
public static final String PERSONAL_CENTER = BASE_URL + "/api-user/" + "engineerInfo/accountId/";
public static final String PERSONAL_CENTER = "/api-user/" + "engineerInfo/accountId/{accountId}";
//个人中心,今日收益
public static final String PERSONAL_ACOUNT_BALANCE = BASE_URL + "/api-settlement/" + "payAccount/queryAccountBalanceAndtodayIncrease/accountId/";
public static final String PERSONAL_ACOUNT_BALANCE = "/api-settlement/" + "payAccount/queryAccountBalanceAndtodayIncrease/accountId/{accountId}";
//账户余额
public static final String PERSONAL_ACCOUT_LIST = BASE_URL + "/api-settlement/" + "/payStream/queryPayStream/";
public static final String PERSONAL_ACCOUT_LIST = "/api-settlement/" + "/payStream/queryPayStream/";
//绑定支付宝账号
public static final String PERSONAL_ALIPAY_BOUND = BASE_URL + "/api-settlement/" + "/alipay/save";
public static final String PERSONAL_ALIPAY_BOUND = "/api-settlement/" + "/alipay/save";
//查询支付宝账号
public static final String PERSONAL_ALIPAY_QUERY = BASE_URL + "/api-settlement/" + "alipay/queryAlipayByAccountId/accountId/";
public static final String PERSONAL_ALIPAY_QUERY = "/api-settlement/" + "/alipay/queryAlipayByAccountId/accountId/{accountId}";
//修改支付宝账号
public static final String PERSONAL_ALIPAY_MODIFY = BASE_URL + "/api-settlement/" + "/alipay/modifyAlipay";
public static final String PERSONAL_ALIPAY_MODIFY = "/api-settlement/" + "/alipay/modifyAlipay";
//单表查询工单记录
public final static String SELECT_ORDER = BASE_URL + "/api-order/" + "orders/";
public final static String SELECT_ORDER_LITTLE = "/api-order/" + "orders/{accountId}";
//根据工程师id和工程师id获取今日业绩(今日收益)
public final static String USER_ORDER_REVENUE = BASE_URL + "/api-count/" + "ordersStatistics/income/";
//根据站点id和工程师id获取工程师今日接单数量
public final static String USER_ORDER_RECEIVING = BASE_URL + "/api-count/" + "ordersStatistics/tasks/";
public final static String USER_ORDER_REVENUE = "/api-count/" + "ordersStatistics/income/siteId/{siteId}/engineerId/{engineerId}";
//服务记录、工程师评价
public final static String USER_REVENUE = BASE_URL + "/api-count/" + "ordersStatistics/total/";
public final static String USER_REVENUE = "/api-count/" + "ordersStatistics/total/siteId/{siteId}/engineerId/{engineerId}";
//反馈提交
public final static String SET_IDEA_COMMIT = BASE_URL + "/api-base/" + "suggest";
public final static String SET_IDEA_COMMIT = "/api-base/" + "suggest";
//版本更新检测
public final static String UPDATA_VERSION = BASE_URL + "/api-base/" + "appVersion/newestVersion/appId/";
public final static String UPDATA_VERSION = "/api-base/" + "appVersion/newestVersion/appId/{packageName}";
//版本更新、获取新版本信息
public final static String UPGRADE_VERSION = BASE_URL + "/api-base/" + "appVersion/versionInfo";
public final static String COMMIT_VERSION_INFO = BASE_URL + "/api-base/" + "versionUpgrade";
//工单记录/搜索工单
public final static String WORKSSHEET_RECORD = BASE_URL + "/api-order/" + "orders/findSimpleOrderVOByPage";
public final static String UPGRADE_VERSION = "/api-base/" + "appVersion/versionInfo";
public final static String COMMIT_VERSION_INFO = "/api-base/" + "versionUpgrade";
//分页获取工单
public final static String ORDERS = "/api-order/" + "orders/findSimpleOrderVOByPage";
//获取首页tab状态的数量
public final static String TAB_NUM = BASE_URL + "/api-order/" + "orders/";
public final static String TAB_NUM ="/api-order/" + "orders/{userId}/count";
//环信
public final static String MESSAGE_HX = BASE_URL + "/api-message/" + "hXMessage";
//处理工单上传照片
public final static String UP_PHOTO = "http://47.94.101.239:3111/file/uploadMore";
public final static String MESSAGE_HX = "/api-message/" + "hXMessage";
//获取支付宝信息
/***********************其他配置**********************************/
//相册选择照片删除时传递的key
......@@ -94,6 +92,8 @@ public class Constants {
public final static String ACCOUNT_BALANCE = "account_balance";
public final static String ACCOUNT_ID = "accountId";
public final static String ORDER_ID = "orderId";
public final static String TOKEN = "token";
//是否显示去设置alipay账户de对话框
public final static String IS_SHOW_ALIPAY_DILAOG = "is_show_alipay_dialog";
//上个版本号
......@@ -110,5 +110,4 @@ public class Constants {
public final static int FINISH_ORDER = 5;
}
......@@ -34,7 +34,7 @@ public class MyApplication extends Application {
//声明AMapLocationClient类对象
public AMapLocationClient mLocationClient = null;
//声明定位回调监听器
public AMapLocationListener mLocationListener ;
public AMapLocationListener mLocationListener;
/**
* 程序的入口方法
......@@ -49,12 +49,12 @@ public class MyApplication extends Application {
registerReceiver(new NetworkConnectChangedReceiver(), filter);
//上下文
mContext = getApplicationContext();
//初始化greendao
GreenDaoManager.getInstance();
// 主线程的Handler
mHandler = new Handler();
//当前线程(主线程)的线程id
mMainThreadId = android.os.Process.myTid();
//初始化greendao
GreenDaoManager.getInstance();
// 初始化环信SDK
EMOptions options = new EMOptions();
options.setAutoLogin(true);
......@@ -65,7 +65,6 @@ public class MyApplication extends Application {
initEasemob();
//初始化高德地图
LocationUtils.init(getApplicationContext());
}
......
......@@ -22,12 +22,12 @@ import android.widget.Toast;
import com.dayu.bigfish.bean.InformBean;
import com.dayu.bigfish.utils.managers.UserManager;
import com.dayu.bigfish.rxbus.RefreReceiveData;
import com.dayu.bigfish.rxbus.RefreshTabNum;
import com.dayu.bigfish.rxbus.RxBus;
import com.dayu.bigfish.bean.event.RefreReceiveData;
import com.dayu.bigfish.bean.event.RefreshTabNum;
import com.dayu.bigfish.bean.event.RxBus;
import com.dayu.bigfish.ui.LoginActivity;
import com.dayu.bigfish.ui.MainActivity;
import com.dayu.bigfish.views.CustomDialog;
import com.dayu.bigfish.ui.views.CustomDialog;
import com.google.gson.Gson;
import com.hyphenate.EMConnectionListener;
import com.hyphenate.EMError;
......@@ -105,7 +105,6 @@ public class SplashActivity extends AppCompatActivity {
strTwo = str.substring(0, str.length() - 1);
Gson gson = new Gson();
InformBean informBean = gson.fromJson(list.ext().toString(), InformBean.class);
//如果getFunctionType==2表示为待接单的消息,不需要通知,直接刷新待接单红点
Notification.Builder builder = new Notification.Builder(SplashActivity.this);
builder
......
......@@ -37,6 +37,7 @@ public class Api {
private static APIService service;
private static Retrofit retrofit;
private static final int DEFAULT_TIMEOUT = 20;
private static Retrofit downloadRetrofit;
public static APIService getService() {
service = getRetrofit().create(APIService.class);
......@@ -53,7 +54,7 @@ public class Api {
TokenInterceptord tokenInterceptord = new TokenInterceptord();
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.addInterceptor(httpLoggingInterceptor)
.addInterceptor(tokenInterceptord)
// .addInterceptor(tokenInterceptord)
.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.build();
......@@ -77,6 +78,39 @@ public class Api {
return retrofit;
}
public static APIService getDownloadRetrofit() {
if (downloadRetrofit == null) {
Gson gson = new GsonBuilder()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
.create();
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(m -> Log.i("request", m));
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.addInterceptor(httpLoggingInterceptor)
.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.addNetworkInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Response response = chain.proceed(chain.request());
return response
.newBuilder()
.body(new FileResponseBody(response.body()))//将自定义的ResposeBody设置给它
.build();
}
})
.build();
downloadRetrofit = new Retrofit.Builder()
.client(okHttpClient)
.baseUrl(Constants.BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();
}
return downloadRetrofit.create(APIService.class);
}
/**
* 对网络接口返回的Response进行分割操作
*
......@@ -111,18 +145,16 @@ public class Api {
* 统一加上token.
*/
public static class TokenInterceptord implements Interceptor {
private String mToken;
@Override
public Response intercept(Chain chain) throws IOException {
if (TextUtils.isEmpty(mToken)) {
mToken = GetUserInfo.getToken(MyApplication.getContext());
}
Request request = chain.request()
.newBuilder()
.header("token", mToken)
Request request = chain.request();
String token = GetUserInfo.getToken(MyApplication.getContext());
if (!TextUtils.isEmpty(token)) {
request = request.newBuilder()
.header("token", token)
.build();
// Log.e("request", request.headers().toString());
}
return chain.proceed(request);
}
......
......@@ -46,8 +46,8 @@ public class ApiWrapper extends Api {
}
//下载apk
// public Observable<ResponseBody> downloadApk(String url) {
// return getService().downloadApk(url)
// public Observable<ResponseBody> download(String url) {
// return getService().download(url)
// .subscribeOn(Schedulers.io());
// }
......@@ -63,11 +63,6 @@ public class ApiWrapper extends Api {
.compose(applySchedulers());
}
//获取订单列表state, pageId, pageSize, siteId, userId
public Observable<BasePageBean<Order>> getReceiveOrders(int state, int userId, int siteId, int page, int pageSize) {
return getService().getReceiveOrders(state, userId, siteId, page, pageSize)
.compose(applySchedulers());
}
//获取异常订单列表
public Observable<List<ErrorOrder>> getErrorOrders(int siteId, int userId) {
......@@ -191,8 +186,8 @@ public class ApiWrapper extends Api {
}
//上传图片
public Observable<List<String>> uploadPhoto(String path, int orderId, MultipartBody.Part[] file) {
return getService().uploadPhoto(path, orderId, file)
public Observable<List<String>> uploadPhoto(MultipartBody.Part[] file) {
return getService().uploadPhoto(file)
.compose(applySchedulers());
}
}
package com.dayu.bigfish.api;
import android.app.IntentService;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import com.dayu.bigfish.R;
import com.dayu.bigfish.bean.event.DownloadBean;
import com.dayu.bigfish.bean.event.RxBus;
import com.dayu.bigfish.ui.listener.onDownloadListener;
import com.dayu.bigfish.utils.managers.DownloadManager;
import io.reactivex.Observer;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
/**
* An {@link IntentService} subclass for handling asynchronous task requests in
* a service on a separate handler thread.
* <p>
*/
public class DownloadService extends IntentService {
private static final String ACTION_DOWNLOAD = "intentservice.action.download";
private static final String DOWNLOAD_URL = "downloadUrl";
private static final String APK_PATH = "apkPath";
private static onDownloadListener mListener;
private CompositeDisposable cd = new CompositeDisposable();
private NotificationCompat.Builder builder;
private NotificationManager notificationManager;
public DownloadService() {
super("DownloadService");
}
public static void startUpdateService(Context context, String url, String apkPath, onDownloadListener listener) {
Intent intent = new Intent(context, DownloadService.class);
intent.setAction(ACTION_DOWNLOAD);
intent.putExtra(DOWNLOAD_URL, url);
intent.putExtra(APK_PATH, apkPath);
context.startService(intent);
mListener = listener;
}
@Override
protected void onHandleIntent(Intent intent) {
if (intent != null) {
String action = intent.getAction();
if (ACTION_DOWNLOAD.equals(action)) {
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.wechatimg)
.setContentTitle("开始下载")
.setAutoCancel(true)
.setContentText("版本更新");
notificationManager.notify(0, builder.build());
String url = intent.getStringExtra(DOWNLOAD_URL);
String apkPath = intent.getStringExtra(APK_PATH);
handleUpdate(url, apkPath);
}
}
}
private void handleUpdate(String url, String apkPath) {
subscribeEvent();
DownloadManager.download(this, url, apkPath, cd,mListener);
}
private void subscribeEvent() {
RxBus.getDefault().toObservable(DownloadBean.class)
.subscribe(new Observer<DownloadBean>() {
@Override
public void onSubscribe(Disposable d) {
cd.add(d);
}
@Override
public void onNext(DownloadBean downloadBean) {
int progress = (int) Math.round(downloadBean.getBytesReaded() / (double) downloadBean.getTotal() * 100);
builder.setContentInfo(String.valueOf(progress) + "%").setProgress(100, progress, false);
notificationManager.notify(0, builder.build());
if (progress == 100)
notificationManager.cancel(0);
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
package com.dayu.bigfish.api;
import com.dayu.bigfish.bean.event.DownloadBean;
import com.dayu.bigfish.bean.event.RxBus;
import java.io.IOException;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSource;
import okio.ForwardingSource;
import okio.Okio;
import okio.Source;
/**
* 下载文件
* Created by luofan on 2017/11/27.
*/
public class FileResponseBody extends ResponseBody {
private ResponseBody responseBody;
private BufferedSource bufferedSource;
public FileResponseBody(ResponseBody responseBody) {
this.responseBody = responseBody;
}
@Override
public MediaType contentType() {
return responseBody.contentType();
}
@Override
public long contentLength() {
return responseBody.contentLength();
}
@Override
public BufferedSource source() {
if (bufferedSource == null) {
bufferedSource = Okio.buffer(source(responseBody.source()));
}
return bufferedSource;
}
private Source source(Source source) {
return new ForwardingSource(source) {
long totalBytesRead = 0L;
@Override
public long read(Buffer sink, long byteCount) throws IOException {
long bytesRead = super.read(sink, byteCount);
// read() returns the number of bytes read, or -1 if this source is exhausted.
totalBytesRead += bytesRead != -1 ? bytesRead : 0;
RxBus.getDefault().post(new DownloadBean(contentLength(), totalBytesRead));
return bytesRead;
}
};
}
}
package com.dayu.bigfish.base;
/**
* Created by luofan on 17/11/02.
*/
public interface BaseModel {
}
......@@ -6,10 +6,10 @@ import android.content.Intent;
import com.dayu.bigfish.R;
import com.dayu.bigfish.api.APIException;
import com.dayu.bigfish.utils.managers.UserManager;
import com.dayu.bigfish.ui.LoginActivity;
import com.dayu.bigfish.ui.views.CustomDialog;
import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.views.CustomDialog;
import com.dayu.bigfish.utils.managers.UserManager;
import com.hyphenate.chat.EMClient;
import io.reactivex.Observer;
......@@ -27,6 +27,7 @@ public abstract class BasePresenter<V> {
protected Activity mActivity;
protected V mView;
protected CompositeDisposable mComDisposable = new CompositeDisposable();
private CustomDialog mDialog;
public void setView(V v, Activity activity) {
mActivity = activity;
......@@ -139,7 +140,7 @@ public abstract class BasePresenter<V> {
* 重新登录的提示框.
*/
private void showLoginDialog() {
CustomDialog dialog = new CustomDialog(mActivity, R.style.custom_dialog2, getString(R.string.login_state_no)
mDialog = new CustomDialog(mActivity, R.style.custom_dialog2, getString(R.string.login_state_no)
, new CustomDialog.OnCloseListener() {
@Override
public void onClick(Dialog dialog, boolean confirm) {
......@@ -158,9 +159,9 @@ public abstract class BasePresenter<V> {
dialog.dismiss();
}
});
dialog.setTitle(getString(R.string.notice))
mDialog.setTitle(getString(R.string.notice))
.setNegativeButton(getString(R.string.cancle))
.setPositiveButton(getString(R.string.login_again));
dialog.show();
mDialog.show();
}
}
package com.dayu.bigfish.base.jsbridge;
public interface BridgeHandler {
void handler(String data, CallBackFunction function);
}
package com.dayu.bigfish.base.jsbridge;
import android.content.Context;
import android.webkit.WebView;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class BridgeUtil {
final static String YY_OVERRIDE_SCHEMA = "yy://";
final static String YY_RETURN_DATA = YY_OVERRIDE_SCHEMA + "return/";//格式为 yy://return/{function}/returncontent
final static String YY_FETCH_QUEUE = YY_RETURN_DATA + "_fetchQueue/";
final static String EMPTY_STR = "";
final static String UNDERLINE_STR = "_";
final static String SPLIT_MARK = "/";
final static String CALLBACK_ID_FORMAT = "JAVA_CB_%s";
final static String JS_HANDLE_MESSAGE_FROM_JAVA = "javascript:WebViewJavascriptBridge._handleMessageFromNative('%s');";
final static String JS_FETCH_QUEUE_FROM_JAVA = "javascript:WebViewJavascriptBridge._fetchQueue();";
public final static String JAVASCRIPT_STR = "javascript:";
public static String parseFunctionName(String jsUrl){
return jsUrl.replace("javascript:WebViewJavascriptBridge.", "").replaceAll("\\(.*\\);", "");
}
public static String getDataFromReturnUrl(String url) {
if(url.startsWith(YY_FETCH_QUEUE)) {
return url.replace(YY_FETCH_QUEUE, EMPTY_STR);
}
String temp = url.replace(YY_RETURN_DATA, EMPTY_STR);
String[] functionAndData = temp.split(SPLIT_MARK);
if(functionAndData.length >= 2) {
StringBuilder sb = new StringBuilder();
for (int i = 1; i < functionAndData.length; i++) {
sb.append(functionAndData[i]);
}
return sb.toString();
}
return null;
}
public static String getFunctionFromReturnUrl(String url) {
String temp = url.replace(YY_RETURN_DATA, EMPTY_STR);
String[] functionAndData = temp.split(SPLIT_MARK);
if(functionAndData.length >= 1){
return functionAndData[0];
}
return null;
}
/**
* js 文件将注入为第一个script引用
* @param view
* @param url
*/
public static void webViewLoadJs(WebView view, String url){
String js = "var newscript = document.createElement(\"script\");";
js += "newscript.src=\"" + url + "\";";
js += "document.scripts[0].parentNode.insertBefore(newscript,document.scripts[0]);";
view.loadUrl("javascript:" + js);
}
public static void webViewLoadLocalJs(WebView view, String path){
String jsContent = assetFile2Str(view.getContext(), path);
view.loadUrl("javascript:" + jsContent);
}
public static String assetFile2Str(Context c, String urlStr){
InputStream in = null;
try{
in = c.getAssets().open(urlStr);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in));
String line = null;
StringBuilder sb = new StringBuilder();
do {
line = bufferedReader.readLine();
if (line != null && !line.matches("^\\s*\\/\\/.*")) {
sb.append(line);
}
} while (line != null);
bufferedReader.close();
in.close();
return sb.toString();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(in != null) {
try {
in.close();
} catch (IOException e) {
}
}
}
return null;
}
}
package com.dayu.bigfish.base.jsbridge;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.webkit.WebView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@SuppressLint("SetJavaScriptEnabled")
public class BridgeWebView extends WebView implements WebViewJavascriptBridge {
private final String TAG = "BridgeWebView";
public static final String toLoadJs = "WebViewJavascriptBridge.js";
Map<String, CallBackFunction> responseCallbacks = new HashMap<String, CallBackFunction>();
Map<String, BridgeHandler> messageHandlers = new HashMap<String, BridgeHandler>();
BridgeHandler defaultHandler = new DefaultHandler();
private List<Message> startupMessage = new ArrayList<Message>();
public List<Message> getStartupMessage() {
return startupMessage;
}
public void setStartupMessage(List<Message> startupMessage) {
this.startupMessage = startupMessage;
}
private long uniqueId = 0;
public BridgeWebView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public BridgeWebView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public BridgeWebView(Context context) {
super(context);
init();
}
/**
*
* @param handler
* default handler,handle messages send by js without assigned handler name,
* if js message has handler name, it will be handled by named handlers registered by native
*/
public void setDefaultHandler(BridgeHandler handler) {
this.defaultHandler = handler;
}
private void init() {
this.setVerticalScrollBarEnabled(false);
this.setHorizontalScrollBarEnabled(false);
this.getSettings().setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
this.setWebViewClient(generateBridgeWebViewClient());
}
protected BridgeWebViewClient generateBridgeWebViewClient() {
return new BridgeWebViewClient(this);
}
void handlerReturnData(String url) {
String functionName = BridgeUtil.getFunctionFromReturnUrl(url);
CallBackFunction f = responseCallbacks.get(functionName);
String data = BridgeUtil.getDataFromReturnUrl(url);
if (f != null) {
f.onCallBack(data);
responseCallbacks.remove(functionName);
return;
}
}
@Override
public void send(String data) {
send(data, null);
}
@Override
public void send(String data, CallBackFunction responseCallback) {
doSend(null, data, responseCallback);
}
private void doSend(String handlerName, String data, CallBackFunction responseCallback) {
Message m = new Message();
if (!TextUtils.isEmpty(data)) {
m.setData(data);
}
if (responseCallback != null) {
String callbackStr = String.format(BridgeUtil.CALLBACK_ID_FORMAT, ++uniqueId + (BridgeUtil.UNDERLINE_STR + SystemClock.currentThreadTimeMillis()));
responseCallbacks.put(callbackStr, responseCallback);
m.setCallbackId(callbackStr);
}
if (!TextUtils.isEmpty(handlerName)) {
m.setHandlerName(handlerName);
}
queueMessage(m);
}
private void queueMessage(Message m) {
if (startupMessage != null) {
startupMessage.add(m);
} else {
dispatchMessage(m);
}
}
void dispatchMessage(Message m) {
String messageJson = m.toJson();
//escape special characters for json string
messageJson = messageJson.replaceAll("(\\\\)([^utrn])", "\\\\\\\\$1$2");
messageJson = messageJson.replaceAll("(?<=[^\\\\])(\")", "\\\\\"");
String javascriptCommand = String.format(BridgeUtil.JS_HANDLE_MESSAGE_FROM_JAVA, messageJson);
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
this.loadUrl(javascriptCommand);
}
}
void flushMessageQueue() {
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
loadUrl(BridgeUtil.JS_FETCH_QUEUE_FROM_JAVA, new CallBackFunction() {
@Override
public void onCallBack(String data) {
// deserializeMessage
List<Message> list = null;
try {
list = Message.toArrayList(data);
} catch (Exception e) {
e.printStackTrace();
return;
}
if (list == null || list.size() == 0) {
return;
}
for (int i = 0; i < list.size(); i++) {
Message m = list.get(i);
String responseId = m.getResponseId();
// 是否是response
if (!TextUtils.isEmpty(responseId)) {
CallBackFunction function = responseCallbacks.get(responseId);
String responseData = m.getResponseData();
function.onCallBack(responseData);
responseCallbacks.remove(responseId);
} else {
CallBackFunction responseFunction = null;
// if had callbackId
final String callbackId = m.getCallbackId();
if (!TextUtils.isEmpty(callbackId)) {
responseFunction = new CallBackFunction() {
@Override
public void onCallBack(String data) {
Message responseMsg = new Message();
responseMsg.setResponseId(callbackId);
responseMsg.setResponseData(data);
queueMessage(responseMsg);
}
};
} else {
responseFunction = new CallBackFunction() {
@Override
public void onCallBack(String data) {
// do nothing
}
};
}
BridgeHandler handler;
if (!TextUtils.isEmpty(m.getHandlerName())) {
handler = messageHandlers.get(m.getHandlerName());
} else {
handler = defaultHandler;
}
if (handler != null){
handler.handler(m.getData(), responseFunction);
}
}
}
}
});
}
}
public void loadUrl(String jsUrl, CallBackFunction returnCallback) {
this.loadUrl(jsUrl);
responseCallbacks.put(BridgeUtil.parseFunctionName(jsUrl), returnCallback);
}
/**
* register handler,so that javascript can call it
*
* @param handlerName
* @param handler
*/
public void registerHandler(String handlerName, BridgeHandler handler) {
if (handler != null) {
messageHandlers.put(handlerName, handler);
}
}
/**
* call javascript registered handler
*
* @param handlerName
* @param data
* @param callBack
*/
public void callHandler(String handlerName, String data, CallBackFunction callBack) {
doSend(handlerName, data, callBack);
}
}
package com.dayu.bigfish.base.jsbridge;
import android.graphics.Bitmap;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
/**
* Created by bruce on 10/28/15.
*/
public class BridgeWebViewClient extends WebViewClient {
private BridgeWebView webView;
public BridgeWebViewClient(BridgeWebView webView) {
this.webView = webView;
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
try {
url = URLDecoder.decode(url, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (url.startsWith(BridgeUtil.YY_RETURN_DATA)) { // 如果是返回数据
webView.handlerReturnData(url);
return true;
} else if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { //
webView.flushMessageQueue();
return true;
} else {
return super.shouldOverrideUrlLoading(view, url);
}
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
if (BridgeWebView.toLoadJs != null) {
BridgeUtil.webViewLoadLocalJs(view, BridgeWebView.toLoadJs);
}
//
if (webView.getStartupMessage() != null) {
for (Message m : webView.getStartupMessage()) {
webView.dispatchMessage(m);
}
webView.setStartupMessage(null);
}
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
}
}
\ No newline at end of file
package com.dayu.bigfish.base.jsbridge;
public interface CallBackFunction {
public void onCallBack(String data);
}
package com.dayu.bigfish.base.jsbridge;
public class DefaultHandler implements BridgeHandler {
String TAG = "DefaultHandler";
@Override
public void handler(String data, CallBackFunction function) {
if(function != null){
function.onCallBack("DefaultHandler response data");
}
}
}
package com.dayu.bigfish.base.jsbridge;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* data of bridge
* @author haoqing
*
*/
public class Message {
private String callbackId; //callbackId
private String responseId; //responseId
private String responseData; //responseData
private String data; //data of message
private String handlerName; //name of handler
private final static String CALLBACK_ID_STR = "callbackId";
private final static String RESPONSE_ID_STR = "responseId";
private final static String RESPONSE_DATA_STR = "responseData";
private final static String DATA_STR = "data";
private final static String HANDLER_NAME_STR = "handlerName";
public String getResponseId() {
return responseId;
}
public void setResponseId(String responseId) {
this.responseId = responseId;
}
public String getResponseData() {
return responseData;
}
public void setResponseData(String responseData) {
this.responseData = responseData;
}
public String getCallbackId() {
return callbackId;
}
public void setCallbackId(String callbackId) {
this.callbackId = callbackId;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getHandlerName() {
return handlerName;
}
public void setHandlerName(String handlerName) {
this.handlerName = handlerName;
}
public String toJson() {
JSONObject jsonObject= new JSONObject();
try {
jsonObject.put(CALLBACK_ID_STR, getCallbackId());
jsonObject.put(DATA_STR, getData());
jsonObject.put(HANDLER_NAME_STR, getHandlerName());
jsonObject.put(RESPONSE_DATA_STR, getResponseData());
jsonObject.put(RESPONSE_ID_STR, getResponseId());
return jsonObject.toString();
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
public static Message toObject(String jsonStr) {
Message m = new Message();
try {
JSONObject jsonObject = new JSONObject(jsonStr);
m.setHandlerName(jsonObject.has(HANDLER_NAME_STR) ? jsonObject.getString(HANDLER_NAME_STR):null);
m.setCallbackId(jsonObject.has(CALLBACK_ID_STR) ? jsonObject.getString(CALLBACK_ID_STR):null);
m.setResponseData(jsonObject.has(RESPONSE_DATA_STR) ? jsonObject.getString(RESPONSE_DATA_STR):null);
m.setResponseId(jsonObject.has(RESPONSE_ID_STR) ? jsonObject.getString(RESPONSE_ID_STR):null);
m.setData(jsonObject.has(DATA_STR) ? jsonObject.getString(DATA_STR):null);
return m;
} catch (JSONException e) {
e.printStackTrace();
}
return m;
}
public static List<Message> toArrayList(String jsonStr){
List<Message> list = new ArrayList<Message>();
try {
JSONArray jsonArray = new JSONArray(jsonStr);
for(int i = 0; i < jsonArray.length(); i++){
Message m = new Message();
JSONObject jsonObject = jsonArray.getJSONObject(i);
m.setHandlerName(jsonObject.has(HANDLER_NAME_STR) ? jsonObject.getString(HANDLER_NAME_STR):null);
m.setCallbackId(jsonObject.has(CALLBACK_ID_STR) ? jsonObject.getString(CALLBACK_ID_STR):null);
m.setResponseData(jsonObject.has(RESPONSE_DATA_STR) ? jsonObject.getString(RESPONSE_DATA_STR):null);
m.setResponseId(jsonObject.has(RESPONSE_ID_STR) ? jsonObject.getString(RESPONSE_ID_STR):null);
m.setData(jsonObject.has(DATA_STR) ? jsonObject.getString(DATA_STR):null);
list.add(m);
}
} catch (JSONException e) {
e.printStackTrace();
}
return list;
}
}
package com.dayu.bigfish.base.jsbridge;
public interface WebViewJavascriptBridge {
public void send(String data);
public void send(String data, CallBackFunction responseCallback);
}
package com.dayu.bigfish.bean;
import java.io.Serializable;
/**
* Created by yu on 2017/9/29.
*/
public class BaseStringBean implements Serializable {
/**
* code : 0
* data : 1.0.2
* msg : 成功
*/
private int code;
private String data;
private String msg;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
......@@ -22,6 +22,15 @@ public class ErrorOrder {
private String customerTelphome;
private int status;
private int excptionCode;
private String appointmentTime;
public String getAppointmentTime() {
return appointmentTime;
}
public void setAppointmentTime(String appointmentTime) {
this.appointmentTime = appointmentTime;
}
public int getId() {
return id;
......
package com.dayu.bigfish.bean;
import java.io.Serializable;
import java.util.List;
/**
* 消息的Bean
* on 2017/10/14.
*/
public class MessageBean implements Serializable {
/**
* code : 0
* data : {"pageNo":1,"pageSize":10,"totalRows":2,"data":[{"id":228,"title":"预约超时通知","content":"工单编号:20171013194811487890 您还没有预约,请及时与客户协调上门时间","sender":null,"hxAccount":"cfc68f0182484d1f9746a0f15248eafc","status":1,"type":1,"functionType":null,"category":1,"action":null,"reason":null,"batchId":null,"createTime":"2017-10-13 21:01:47","startTime":null,"endTime":null},{"id":229,"title":"预约超时通知","content":"工单编号:20171013194811487890 您还没有预约,请及时与客户协调上门时间","sender":null,"hxAccount":"f2b2a017d7154c75bf6d1f4b8076ab53","status":1,"type":1,"functionType":null,"category":1,"action":null,"reason":null,"batchId":null,"createTime":"2017-10-13 21:01:47","startTime":null,"endTime":null}],"totalPages":1,"previousPageNo":1,"nextPageNo":1}
* msg : 成功
*/
private int code;
private DataBeanX data;
private String msg;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public DataBeanX getData() {
return data;
}
public void setData(DataBeanX data) {
this.data = data;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public static class DataBeanX {
/**
* pageNo : 1
* pageSize : 10
* totalRows : 2
* data : [{"id":228,"title":"预约超时通知","content":"工单编号:20171013194811487890 您还没有预约,请及时与客户协调上门时间","sender":null,"hxAccount":"cfc68f0182484d1f9746a0f15248eafc","status":1,"type":1,"functionType":null,"category":1,"action":null,"reason":null,"batchId":null,"createTime":"2017-10-13 21:01:47","startTime":null,"endTime":null},{"id":229,"title":"预约超时通知","content":"工单编号:20171013194811487890 您还没有预约,请及时与客户协调上门时间","sender":null,"hxAccount":"f2b2a017d7154c75bf6d1f4b8076ab53","status":1,"type":1,"functionType":null,"category":1,"action":null,"reason":null,"batchId":null,"createTime":"2017-10-13 21:01:47","startTime":null,"endTime":null}]
* totalPages : 1
* previousPageNo : 1
* nextPageNo : 1
*/
private int pageNo;
private int pageSize;
private int totalRows;
private int totalPages;
private int previousPageNo;
private int nextPageNo;
private List<DataBean> data;
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalRows() {
return totalRows;
}
public void setTotalRows(int totalRows) {
this.totalRows = totalRows;
}
public int getTotalPages() {
return totalPages;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public int getPreviousPageNo() {
return previousPageNo;
}
public void setPreviousPageNo(int previousPageNo) {
this.previousPageNo = previousPageNo;
}
public int getNextPageNo() {
return nextPageNo;
}
public void setNextPageNo(int nextPageNo) {
this.nextPageNo = nextPageNo;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* id : 228
* title : 预约超时通知
* content : 工单编号:20171013194811487890 您还没有预约,请及时与客户协调上门时间
* sender : null
* hxAccount : cfc68f0182484d1f9746a0f15248eafc
* status : 1
* type : 1
* functionType : null
* category : 1
* action : null
* reason : null
* batchId : null
* createTime : 2017-10-13 21:01:47
* startTime : null
* endTime : null
*/
private int id;
private String title;
private String content;
private Object sender;
private String hxAccount;
private int status;
private int type;
private Object functionType;
private int category;
private Object action;
private Object reason;
private Object batchId;
private String createTime;
private Object startTime;
private Object endTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Object getSender() {
return sender;
}
public void setSender(Object sender) {
this.sender = sender;
}
public String getHxAccount() {
return hxAccount;
}
public void setHxAccount(String hxAccount) {
this.hxAccount = hxAccount;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public Object getFunctionType() {
return functionType;
}
public void setFunctionType(Object functionType) {
this.functionType = functionType;
}
public int getCategory() {
return category;
}
public void setCategory(int category) {
this.category = category;
}
public Object getAction() {
return action;
}
public void setAction(Object action) {
this.action = action;
}
public Object getReason() {
return reason;
}
public void setReason(Object reason) {
this.reason = reason;
}
public Object getBatchId() {
return batchId;
}
public void setBatchId(Object batchId) {
this.batchId = batchId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public Object getStartTime() {
return startTime;
}
public void setStartTime(Object startTime) {
this.startTime = startTime;
}
public Object getEndTime() {
return endTime;
}
public void setEndTime(Object endTime) {
this.endTime = endTime;
}
}
}
}
package com.dayu.bigfish.bean;
import java.io.Serializable;
/**
* Created by yu on 2017/10/15.
*/
public class MessageJsonBean implements Serializable {
/**
* orderId : 67
*/
private int orderId;
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
}
package com.dayu.bigfish.bean;
import java.io.Serializable;
/**
* Created by yu on 2017/10/10.
*/
public class TabBean implements Serializable {
/**
* code : 0
* data : {"canceled":0,"pendingservice":0,"reservation":1,"error":0}
* msg : 成功
*/
private int code;
private DataBean data;
private String msg;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public static class DataBean {
/**
* canceled : 0
* pendingservice : 0
* reservation : 1
* error : 0
*/
private int canceled;
private int pendingservice;
private int reservation;
private int error;
public int getCanceled() {
return canceled;
}
public void setCanceled(int canceled) {
this.canceled = canceled;
}
public int getPendingservice() {
return pendingservice;
}
public void setPendingservice(int pendingservice) {
this.pendingservice = pendingservice;
}
public int getReservation() {
return reservation;
}
public void setReservation(int reservation) {
this.reservation = reservation;
}
public int getError() {
return error;
}
public void setError(int error) {
this.error = error;
}
}
}
......@@ -25,7 +25,7 @@ public class VersionInfo {
private String appId;
private String versionCode;
private int versionCodeNum;
private int type;
private int type; //1:普通升级 2:强制升级
private String downloadUrl;
private String upgradePrompt;
private int platform;
......
package com.dayu.bigfish.bean.event;
/**
* Created by luofan on 2017/11/27.
*/
public class DownloadBean {
private long total;
private long bytesReaded;
public DownloadBean(long total, long bytesReaded) {
this.total = total;
this.bytesReaded = bytesReaded;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public long getBytesReaded() {
return bytesReaded;
}
public void setBytesReaded(long bytesReaded) {
this.bytesReaded = bytesReaded;
}
}
package com.dayu.bigfish.rxbus;
package com.dayu.bigfish.bean.event;
/**
* 修改预约时间
......
package com.dayu.bigfish.rxbus;
package com.dayu.bigfish.bean.event;
/**
* 刷新待接单列表,判断是否显示小红点
......
package com.dayu.bigfish.rxbus;
package com.dayu.bigfish.bean.event;
/**
* 刷新待接单数量和刷新待预约列表.
......
package com.dayu.bigfish.rxbus;
package com.dayu.bigfish.bean.event;
/**
* 刷新各tab状态的数量
......
package com.dayu.bigfish.rxbus;
package com.dayu.bigfish.bean.event;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
......
package com.dayu.bigfish.sqlbean;
package com.dayu.bigfish.bean.sqlbean;
import org.greenrobot.greendao.annotation.Convert;
import org.greenrobot.greendao.annotation.Entity;
......
package com.dayu.bigfish.sqlbean;
package com.dayu.bigfish.bean.sqlbean;
import org.greenrobot.greendao.converter.PropertyConverter;
......
......@@ -21,16 +21,12 @@ public class DaoMaster extends AbstractDaoMaster {
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
MessageSysDao.createTable(db, ifNotExists);
OrderInfoDao.createTable(db, ifNotExists);
MessageBigFishDao.createTable(db, ifNotExists);
}
/** Drops underlying database table using DAOs. */
public static void dropAllTables(Database db, boolean ifExists) {
MessageSysDao.dropTable(db, ifExists);
OrderInfoDao.dropTable(db, ifExists);
MessageBigFishDao.dropTable(db, ifExists);
}
/**
......@@ -49,9 +45,7 @@ public class DaoMaster extends AbstractDaoMaster {
public DaoMaster(Database db) {
super(db, SCHEMA_VERSION);
registerDaoClass(MessageSysDao.class);
registerDaoClass(OrderInfoDao.class);
registerDaoClass(MessageBigFishDao.class);
}
public DaoSession newSession() {
......
......@@ -8,13 +8,9 @@ import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;
import com.dayu.bigfish.sqlbean.MessageSys;
import com.dayu.bigfish.sqlbean.OrderInfo;
import com.dayu.bigfish.sqlbean.MessageBigFish;
import com.dayu.bigfish.bean.sqlbean.OrderInfo;
import com.dayu.bigfish.greendao.MessageSysDao;
import com.dayu.bigfish.greendao.OrderInfoDao;
import com.dayu.bigfish.greendao.MessageBigFishDao;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
......@@ -25,52 +21,28 @@ import com.dayu.bigfish.greendao.MessageBigFishDao;
*/
public class DaoSession extends AbstractDaoSession {
private final DaoConfig messageSysDaoConfig;
private final DaoConfig orderInfoDaoConfig;
private final DaoConfig messageBigFishDaoConfig;
private final MessageSysDao messageSysDao;
private final OrderInfoDao orderInfoDao;
private final MessageBigFishDao messageBigFishDao;
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
messageSysDaoConfig = daoConfigMap.get(MessageSysDao.class).clone();
messageSysDaoConfig.initIdentityScope(type);
orderInfoDaoConfig = daoConfigMap.get(OrderInfoDao.class).clone();
orderInfoDaoConfig.initIdentityScope(type);
messageBigFishDaoConfig = daoConfigMap.get(MessageBigFishDao.class).clone();
messageBigFishDaoConfig.initIdentityScope(type);
messageSysDao = new MessageSysDao(messageSysDaoConfig, this);
orderInfoDao = new OrderInfoDao(orderInfoDaoConfig, this);
messageBigFishDao = new MessageBigFishDao(messageBigFishDaoConfig, this);
registerDao(MessageSys.class, messageSysDao);
registerDao(OrderInfo.class, orderInfoDao);
registerDao(MessageBigFish.class, messageBigFishDao);
}
public void clear() {
messageSysDaoConfig.clearIdentityScope();
orderInfoDaoConfig.clearIdentityScope();
messageBigFishDaoConfig.clearIdentityScope();
}
public MessageSysDao getMessageSysDao() {
return messageSysDao;
}
public OrderInfoDao getOrderInfoDao() {
return orderInfoDao;
}
public MessageBigFishDao getMessageBigFishDao() {
return messageBigFishDao;
}
}
File mode changed from 100644 to 100755
package com.dayu.bigfish.greendao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.dayu.bigfish.sqlbean.MessageBigFish;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "MESSAGE_BIG_FISH".
*/
public class MessageBigFishDao extends AbstractDao<MessageBigFish, Long> {
public static final String TABLENAME = "MESSAGE_BIG_FISH";
/**
* Properties of entity MessageBigFish.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
public final static Property Ids = new Property(1, String.class, "ids", false, "IDS");
public final static Property Id1 = new Property(2, String.class, "id1", false, "ID1");
public final static Property Flag = new Property(3, String.class, "flag", false, "FLAG");
}
public MessageBigFishDao(DaoConfig config) {
super(config);
}
public MessageBigFishDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"MESSAGE_BIG_FISH\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"IDS\" TEXT," + // 1: ids
"\"ID1\" TEXT," + // 2: id1
"\"FLAG\" TEXT);"); // 3: flag
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MESSAGE_BIG_FISH\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, MessageBigFish entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String ids = entity.getIds();
if (ids != null) {
stmt.bindString(2, ids);
}
String id1 = entity.getId1();
if (id1 != null) {
stmt.bindString(3, id1);
}
String flag = entity.getFlag();
if (flag != null) {
stmt.bindString(4, flag);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, MessageBigFish entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String ids = entity.getIds();
if (ids != null) {
stmt.bindString(2, ids);
}
String id1 = entity.getId1();
if (id1 != null) {
stmt.bindString(3, id1);
}
String flag = entity.getFlag();
if (flag != null) {
stmt.bindString(4, flag);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public MessageBigFish readEntity(Cursor cursor, int offset) {
MessageBigFish entity = new MessageBigFish( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // ids
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // id1
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // flag
);
return entity;
}
@Override
public void readEntity(Cursor cursor, MessageBigFish entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setIds(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setId1(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setFlag(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
}
@Override
protected final Long updateKeyAfterInsert(MessageBigFish entity, long rowId) {
entity.setId(rowId);
return rowId;
}
@Override
public Long getKey(MessageBigFish entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
@Override
public boolean hasKey(MessageBigFish entity) {
return entity.getId() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
package com.dayu.bigfish.greendao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.dayu.bigfish.sqlbean.MessageSys;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "MESSAGE_SYS".
*/
public class MessageSysDao extends AbstractDao<MessageSys, Long> {
public static final String TABLENAME = "MESSAGE_SYS";
/**
* Properties of entity MessageSys.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
public final static Property Ids = new Property(1, String.class, "ids", false, "IDS");
public final static Property Id1 = new Property(2, String.class, "id1", false, "ID1");
public final static Property Flag = new Property(3, String.class, "flag", false, "FLAG");
}
public MessageSysDao(DaoConfig config) {
super(config);
}
public MessageSysDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"MESSAGE_SYS\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"IDS\" TEXT," + // 1: ids
"\"ID1\" TEXT," + // 2: id1
"\"FLAG\" TEXT);"); // 3: flag
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MESSAGE_SYS\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, MessageSys entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String ids = entity.getIds();
if (ids != null) {
stmt.bindString(2, ids);
}
String id1 = entity.getId1();
if (id1 != null) {
stmt.bindString(3, id1);
}
String flag = entity.getFlag();
if (flag != null) {
stmt.bindString(4, flag);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, MessageSys entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String ids = entity.getIds();
if (ids != null) {
stmt.bindString(2, ids);
}
String id1 = entity.getId1();
if (id1 != null) {
stmt.bindString(3, id1);
}
String flag = entity.getFlag();
if (flag != null) {
stmt.bindString(4, flag);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public MessageSys readEntity(Cursor cursor, int offset) {
MessageSys entity = new MessageSys( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // ids
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // id1
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // flag
);
return entity;
}
@Override
public void readEntity(Cursor cursor, MessageSys entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setIds(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setId1(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setFlag(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
}
@Override
protected final Long updateKeyAfterInsert(MessageSys entity, long rowId) {
entity.setId(rowId);
return rowId;
}
@Override
public Long getKey(MessageSys entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
@Override
public boolean hasKey(MessageSys entity) {
return entity.getId() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -9,10 +9,10 @@ import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.dayu.bigfish.sqlbean.StringConverter;
import com.dayu.bigfish.bean.sqlbean.StringConverter;
import java.util.List;
import com.dayu.bigfish.sqlbean.OrderInfo;
import com.dayu.bigfish.bean.sqlbean.OrderInfo;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
......
package com.dayu.bigfish.presenter.Withdrawals;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.AlipayInfo;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* Created by luo on 2016/8/4.
*/
public interface WithdrawalsContract {
interface Model extends BaseModel {
Observable<AlipayInfo> querAlipay(int userId);
Observable<Boolean> boundAlipay(RequestBody body);
Observable<Boolean> modifyAlipay(RequestBody body);
}
interface View extends BaseView {
void querSuccess(AlipayInfo info);
......
package com.dayu.bigfish.presenter.Withdrawals;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.bean.AlipayInfo;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* Created by luofan on 2017/11/14.
*/
public class WithdrawalsModel implements WithdrawalsContract.Model {
private ApiWrapper mWrapper = new ApiWrapper();
@Override
public Observable<AlipayInfo> querAlipay(int userId) {
return mWrapper.queryAlipay(userId);
}
@Override
public Observable<Boolean> boundAlipay(RequestBody body) {
return mWrapper.boundAlipay(body);
}
@Override
public Observable<Boolean> modifyAlipay(RequestBody body) {
return mWrapper.modifyAlipay(body);
}
}
package com.dayu.bigfish.presenter.accountbalance;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.AccountBalance;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface AccountBalanceContract {
interface Model extends BaseModel {
Observable<BasePageBean<AccountBalance>> getAccountBalanceList(int page, int pageSize, int accountId);
}
interface View extends BaseView {
void getBalanceSuccess(BasePageBean<AccountBalance> balance);
......
package com.dayu.bigfish.presenter.accountbalance;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.AccountBalance;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/14.
*/
public class AccountBalanceModel implements AccountBalanceContract.Model {
@Override
public Observable<BasePageBean<AccountBalance>> getAccountBalanceList(int page, int pageSize, int accountId) {
return new ApiWrapper().getAccountBalanceList(page, pageSize, accountId);
}
}
package com.dayu.bigfish.presenter.feedback;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* Created by luo on 2016/8/4.
*/
public interface FeedBackContract {
interface Model extends BaseModel {
Observable<Boolean> comfirmSuggist(RequestBody body);
}
interface View extends BaseView {
void comfirmSuccess();
......
package com.dayu.bigfish.presenter.feedback;
import com.dayu.bigfish.api.ApiWrapper;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* Created by luofan on 2017/11/8.
*/
public class FeedBackModel implements FeedBackContract.Model {
private ApiWrapper wrapper = new ApiWrapper();
@Override
public Observable<Boolean> comfirmSuggist(RequestBody body) {
return wrapper.postFeedBack(body);
}
}
package com.dayu.bigfish.presenter.homefirsttab;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
......@@ -9,8 +8,6 @@ import com.dayu.bigfish.base.BaseView;
* Created by luo on 2016/8/4.
*/
public interface HomeFirstContract {
interface Model extends BaseModel {
}
interface View extends BaseView {
}
......
package com.dayu.bigfish.presenter.homefirsttab;
/**
* Created by luofan on 2017/11/8.
*/
public class HomeFirstModel implements HomeFirstContract.Model {
}
package com.dayu.bigfish.presenter.homefourtab;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.AlipayInfo;
......@@ -10,25 +9,10 @@ import com.dayu.bigfish.bean.OrderRecord;
import com.dayu.bigfish.bean.TodayAchievement;
import com.dayu.bigfish.bean.TodayBalance;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface HomeFourContract {
interface Model extends BaseModel {
// Observable<EngineerInfo> getPersonalInfo(int userId);
//
// Observable<TodayAchievement> getAchievement(int siteId, int userId);
//
// Observable<OrderRecord> getOrderRecord(int siteId, int userId);
//
// Observable<TodayBalance> getAcountBalance(int accountId);
//
Observable<AlipayInfo> getAlipayAccount(int accountId);
Observable<Object> getAllData(int accountId, int siteId);
}
interface View extends BaseView {
void getPersonalInfoSuccess(EngineerInfo info);
......
package com.dayu.bigfish.presenter.homefourtab;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.bean.AlipayInfo;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class HomeFourModel implements HomeFourContract.Model {
ApiWrapper mWrapper = new ApiWrapper();
// @Override
// public Observable<EngineerInfo> getPersonalInfo(int userId) {
// return mWrapper.getEngineerInfo(userId);
// }
//
// @Override
// public Observable<TodayAchievement> getAchievement(int siteId, int userId) {
// return mWrapper.getAchievement(siteId, userId);
// }
//
// @Override
// public Observable<OrderRecord> getOrderRecord(int siteId, int userId) {
// return mWrapper.getOrderRecord(siteId, userId);
// }
//
// @Override
// public Observable<TodayBalance> getAcountBalance(int accountId) {
// return mWrapper.getTodayBalance(accountId);
// }
//
@Override
public Observable<AlipayInfo> getAlipayAccount(int accountId) {
return mWrapper.queryAlipay(accountId);
}
@Override
public Observable<Object> getAllData(int accountId, int siteId) {
// Observable[] observableArray = new Observable[]{mWrapper.getEngineerInfo(accountId), mWrapper.getAchievement(siteId, accountId),
// mWrapper.getOrderRecord(siteId, accountId), mWrapper.getTodayBalance(accountId)
// , mWrapper.getTodayBalance(accountId)};
return Observable.mergeDelayError(mWrapper.getEngineerInfo(accountId), mWrapper.getAchievement(siteId, accountId),
mWrapper.getOrderRecord(siteId, accountId), mWrapper.getTodayBalance(accountId));
}
}
package com.dayu.bigfish.presenter.homesecondtab;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.Tab;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface HomeSecondContract {
interface Model extends BaseModel {
Observable<Tab> getTabNum(int userId);
}
interface View extends BaseView {
......
package com.dayu.bigfish.presenter.homesecondtab;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.bean.Tab;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class HomeSecondModel implements HomeSecondContract.Model {
ApiWrapper mWrapper = new ApiWrapper();
@Override
public Observable<Tab> getTabNum(int userId) {
return mWrapper.getTabNum(userId);
}
}
package com.dayu.bigfish.presenter.homethiirdtab;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
......@@ -9,8 +8,6 @@ import com.dayu.bigfish.base.BaseView;
* Created by luo on 2016/8/4.
*/
public interface HomeThirdContract {
interface Model extends BaseModel {
}
interface View extends BaseView {
}
......
package com.dayu.bigfish.presenter.homethiirdtab;
/**
* Created by luofan on 2017/11/8.
*/
public class HomeThirdModel implements HomeThirdContract.Model {
}
package com.dayu.bigfish.presenter.login;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.UserInfo;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface LoginContract {
interface Model extends BaseModel {
Observable<UserInfo> login(String userPhone, String register);
Observable<Boolean> sendRegister(String userPhone, int type);
}
interface View extends BaseView {
//正式登录成功的回调
......
package com.dayu.bigfish.presenter.login;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.bean.UserInfo;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class LoginModel implements LoginContract.Model {
private ApiWrapper wrapper = new ApiWrapper();
/**
* 登录.
*/
@Override
public Observable<UserInfo> login(String userPhone, String register) {
wrapper = new ApiWrapper();
return wrapper.login(userPhone, register);
}
/**
* 获取验证码.
*/
@Override
public Observable<Boolean> sendRegister(String userPhone, int type) {
return wrapper.sendCode(userPhone,type);
}
}
package com.dayu.bigfish.presenter.main;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.bean.VersionInfo;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* Created by luo on 2016/8/4.
*/
public interface MainContract {
interface Model extends BaseModel {
Observable<String> getNewVersion();
Observable<VersionInfo> upgradeVersion(String appId, String versionCode);
Observable<Boolean> commitVersionInfo(RequestBody body);
Observable<BasePageBean<Order>> getReceiveOrder(int state, int userId, int siteId, int pagerId, int pagerSize);
}
interface View extends BaseView {
void needUpdate(String versionCode);
......
package com.dayu.bigfish.presenter.main;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.bean.VersionInfo;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* Created by luofan on 2017/11/8.
*/
public class MainModel implements MainContract.Model {
ApiWrapper mApiWrapper = new ApiWrapper();
@Override
public Observable<String> getNewVersion() {
return mApiWrapper.CheckVersion();
}
@Override
public Observable<VersionInfo> upgradeVersion(String appId, String versionCode) {
return mApiWrapper.getVersionInfo(appId, versionCode);
}
@Override
public Observable<Boolean> commitVersionInfo(RequestBody body) {
return mApiWrapper.commitVersionInfo(body);
}
@Override
public Observable<BasePageBean<Order>> getReceiveOrder(int state, int userId, int siteId, int pagerId, int pagerSize) {
return mApiWrapper.getReceiveOrders(state, userId, siteId, pagerId, pagerSize);
}
}
package com.dayu.bigfish.presenter.main;
import android.util.Log;
import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory;
import com.dayu.bigfish.Constants;
......@@ -48,6 +50,11 @@ public class MainPresenter extends MainContract.Presenter {
public void accept(VersionInfo info) throws Exception {
mView.getUpgradeVersionSuccess(info);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.d("aaf", "23");
}
}));
}
......
package com.dayu.bigfish.presenter.orderdetail;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.OrderDetail;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface OrderDetailContract {
interface Model extends BaseModel {
Observable<OrderDetail> getOrderDetailInfo(int orderId);
}
interface View extends BaseView {
void getDetailInfo(OrderDetail detail);
......
package com.dayu.bigfish.presenter.orderdetail;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.bean.OrderDetail;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class OrderDetailModel implements OrderDetailContract.Model {
@Override
public Observable<OrderDetail> getOrderDetailInfo(int orderId) {
return new ApiWrapper().getOrderInfo(orderId);
}
}
package com.dayu.bigfish.presenter.orderdetailserve;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.OrderDetail;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface OrderDetailServeContract {
interface Model extends BaseModel {
Observable<OrderDetail> getOrderServerInfo(int orderId);
}
interface View extends BaseView {
void getOrderServerInfo(OrderDetail detail);
......
package com.dayu.bigfish.presenter.orderdetailserve;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.bean.OrderDetail;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class OrderDetailServeModel implements OrderDetailServeContract.Model {
@Override
public Observable<OrderDetail> getOrderServerInfo(int orderId) {
return new ApiWrapper().getOrderInfo(orderId);
}
}
package com.dayu.bigfish.presenter.ordererrortab;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.ErrorOrder;
import java.util.List;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface OrderErrorTabContract {
interface Model extends BaseModel {
Observable<List<ErrorOrder>> getErrorOrder(int state, int userId);
}
interface View extends BaseView {
void getErrorOrderSuccess(List<ErrorOrder> data);
......
package com.dayu.bigfish.presenter.ordererrortab;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.bean.ErrorOrder;
import java.util.List;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class OrderErrorTabModel implements OrderErrorTabContract.Model {
@Override
public Observable<List<ErrorOrder>> getErrorOrder(int state, int userId) {
return new ApiWrapper().getErrorOrders(state,userId);
}
}
......@@ -21,8 +21,8 @@ public class OrderErrorTabPresenter extends OrderErrorTabContract.Presenter {
@Override
public void getErrorOrder(int state, int userId) {
ApiFactory.getErrorOrders(state, userId).subscribe(baseObserver(new Consumer<List<ErrorOrder>>() {
public void getErrorOrder( int userId,int siteId) {
ApiFactory.getErrorOrders(userId,siteId).subscribe(baseObserver(new Consumer<List<ErrorOrder>>() {
@Override
public void accept(List<ErrorOrder> errorOrder) throws Exception {
mView.getErrorOrderSuccess(errorOrder);
......
package com.dayu.bigfish.presenter.ordertab;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.Order;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface OrderTabContract {
interface Model extends BaseModel {
Observable<BasePageBean<Order>> getWatingOrder(int state, int userId, int siteId, int page, int pageSize);
}
interface View extends BaseView {
void getWatingOrderSuccess(BasePageBean<Order> data);
......
package com.dayu.bigfish.presenter.ordertab;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class OrderTabModel implements OrderTabContract.Model {
@Override
public Observable<BasePageBean<Order>> getWatingOrder(int state, int userId, int siteId, int page, int pageSize) {
return new ApiWrapper().getReceiveOrders(state, userId, siteId, page, pageSize);
}
}
package com.dayu.bigfish.presenter.ordertwotab;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.Order;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* Created by luo on 2016/8/4.
*/
public interface OrderTwoTabContract {
interface Model extends BaseModel {
Observable<BasePageBean<Order>> getWatingOrder(int state, int userId, int siteId, int page, int pageSize);
Observable<Integer> startOrder(RequestBody body);
Observable<Integer> startServer(RequestBody body);
}
interface View extends BaseView {
void getWatingOrderSuccess(BasePageBean<Order> data);
......
package com.dayu.bigfish.presenter.ordertwotab;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* Created by luofan on 2017/11/8.
*/
public class OrderTwoTabModel implements OrderTwoTabContract.Model {
private ApiWrapper mWrapper = new ApiWrapper();
@Override
public Observable<BasePageBean<Order>> getWatingOrder(int state, int userId, int siteId, int page, int pageSize) {
return mWrapper.getReceiveOrders(state, userId, siteId, page, pageSize);
}
@Override
public Observable<Integer> startOrder(RequestBody body) {
return mWrapper.startOrder(body);
}
@Override
public Observable<Integer> startServer(RequestBody body) {
return mWrapper.startServer(body);
}
}
package com.dayu.bigfish.presenter.processorder;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.OrderDetail;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
/**
* Created by luo on 2016/8/4.
*/
public interface ProcessOrderContract {
interface Model extends BaseModel {
Observable<OrderDetail> getOrderInfo(int orderId);
Observable<Integer> commitOrder(RequestBody body);
Observable<List<String>> commitPhoto(String path, int orderId, MultipartBody.Part[] file);
}
interface View extends BaseView {
void commitOrderSuccess();
......@@ -39,6 +27,6 @@ public interface ProcessOrderContract {
int isPay, String doorPrice, String doorPriceComment,
String servicePrice, String materialCost, String otherPrice);
public abstract void commitPhoto(List<String> imageUrl, int orderId, String path);
public abstract void commitPhoto(List<String> imageUrl);
}
}
package com.dayu.bigfish.presenter.processorder;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.bean.OrderDetail;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
/**
* Created by luofan on 2017/11/8.
*/
public class ProcessOrderModel implements ProcessOrderContract.Model {
private ApiWrapper wrapper = new ApiWrapper();
@Override
public Observable<OrderDetail> getOrderInfo(int orderId) {
return wrapper.queryOrderInfo(orderId);
}
@Override
public Observable<Integer> commitOrder(RequestBody body) {
return wrapper.commitOrder(body);
}
@Override
public Observable<List<String>> commitPhoto(String path, int orderId, MultipartBody.Part[] file) {
return wrapper.uploadPhoto(path,orderId,file);
}
}
......@@ -11,7 +11,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.reactivex.functions.Consumer;
import okhttp3.MediaType;
......@@ -80,9 +79,8 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
}
@Override
public void commitPhoto(List<String> imageUrl, int orderId, String path) {
public void commitPhoto(List<String> imageUrl) {
ArrayList<File> files = new ArrayList<>();
Map<String, MultipartBody.Part> map = new HashMap<>();
if (imageUrl != null && imageUrl.size() > 0) {
for (int i = 0; i < imageUrl.size(); i++) {
files.add(new File(imageUrl.get(i)));
......@@ -96,7 +94,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
MultipartBody.Part.createFormData("fileUpload", files.get(0).getName(), requestFile);
part[i] = body;
}
ApiFactory.uploadPhoto(path, orderId, part).subscribe(baseObserver(new Consumer<List<String>>() {
ApiFactory.uploadPhoto(part).subscribe(baseObserver(new Consumer<List<String>>() {
@Override
public void accept(List<String> list) throws Exception {
mView.commitPhotoSuccess(list);
......
package com.dayu.bigfish.presenter.receivingorder;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.Order;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface ReceivingContract {
interface Model extends BaseModel {
Observable<BasePageBean<Order>> getReceiveOrder(int state, int pagerId, int pagerSize, int siteId, int userId);
Observable<Boolean> receiveOrder(int orders, int engineer);
}
interface View extends BaseView {
void getReceiveOrderSuccess(BasePageBean<Order> orders);
......
package com.dayu.bigfish.presenter.receivingorder;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class ReceivingModel implements ReceivingContract.Model {
private ApiWrapper wrapper = new ApiWrapper();
@Override
public Observable<BasePageBean<Order>> getReceiveOrder(int state, int pageId, int pageSize, int siteId, int userId) {
return wrapper.getReceiveOrders(state, pageId, pageSize, siteId, userId);
}
@Override
public Observable<Boolean> receiveOrder(int orders, int engineer) {
return wrapper.receiveOrder(orders, engineer);
}
}
package com.dayu.bigfish.presenter.setting;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface SettingContract {
interface Model extends BaseModel {
Observable<String> getNewVersionCode();
}
interface View extends BaseView {
void getNewVersionSuccess(String code);
......
package com.dayu.bigfish.presenter.setting;
import com.dayu.bigfish.api.ApiWrapper;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class SettingModel implements SettingContract.Model {
@Override
public Observable<String> getNewVersionCode() {
return new ApiWrapper().CheckVersion();
}
}
package com.dayu.bigfish.presenter.subcribeTime;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface SubcribeContract {
interface Model extends BaseModel {
Observable<Boolean> subcribeTime(int orderId, String doorTime, String doorComment);
}
interface View extends BaseView {
void subcribeTimeSuccess();
......
package com.dayu.bigfish.presenter.subcribeTime;
import com.dayu.bigfish.api.ApiWrapper;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/16.
*/
public class SubcribeTimeModel implements SubcribeContract.Model{
@Override
public Observable<Boolean> subcribeTime(int orderId, String doorTime, String doorComment) {
return new ApiWrapper().subcriceTime(orderId,doorTime,doorComment);
}
}
package com.dayu.bigfish.presenter.worksRecord;
import com.dayu.bigfish.api.ApiWrapper;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.Order;
import io.reactivex.Observable;
/**
* Created by luofan on 2017/11/8.
*/
public class WorksRecordModel implements WroksRecordContract.Model {
private ApiWrapper wrapper = new ApiWrapper();
@Override
public Observable<BasePageBean<Order>> getWorksRecord( int state,int engineerId, int siteId, int page, int pageSize) {
wrapper = new ApiWrapper();
return wrapper.getReceiveOrders(state, engineerId,siteId,page,pageSize);
}
}
package com.dayu.bigfish.presenter.worksRecord;
import com.dayu.bigfish.base.BaseModel;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.Order;
import io.reactivex.Observable;
/**
* Created by luo on 2016/8/4.
*/
public interface WroksRecordContract {
interface Model extends BaseModel {
Observable<BasePageBean<Order>> getWorksRecord(int state, int engineerId, int siteId, int page, int pageSize);
}
interface View extends BaseView {
void getWorksRecord(BasePageBean<Order> orders);
......
package com.dayu.bigfish.sqlbean;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
/**
* Created by Administrator on 2017/10/15.
* 大鱼通知
*/
@Entity
public class MessageBigFish {
@Id
private Long id;
private String ids; //用户id
private String id1; //id
private String flag;
@Generated(hash = 1828839047)
public MessageBigFish(Long id, String ids, String id1, String flag) {
this.id = id;
this.ids = ids;
this.id1 = id1;
this.flag = flag;
}
@Generated(hash = 1245723608)
public MessageBigFish() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getIds() {
return this.ids;
}
public void setIds(String ids) {
this.ids = ids;
}
public String getId1() {
return this.id1;
}
public void setId1(String id1) {
this.id1 = id1;
}
public String getFlag() {
return this.flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
}
package com.dayu.bigfish.sqlbean;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
/**
* Created by Administrator on 2017/10/15.
* 系统消息
*/
@Entity
public class MessageSys {
@Id
private Long id;
private String ids; //消息唯一标识
private String id1; //登陆人
private String flag;
@Generated(hash = 1217263000)
public MessageSys(Long id, String ids, String id1, String flag) {
this.id = id;
this.ids = ids;
this.id1 = id1;
this.flag = flag;
}
@Generated(hash = 1396459834)
public MessageSys() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getIds() {
return this.ids;
}
public void setIds(String ids) {
this.ids = ids;
}
public String getId1() {
return this.id1;
}
public void setId1(String id1) {
this.id1 = id1;
}
public String getFlag() {
return this.flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
}
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 sign in to comment