Commit 52997db5 authored by 王海's avatar 王海

pos419

parent 9d1c7413
......@@ -149,7 +149,7 @@ public abstract class BaseActivity<P extends BasePresenter, B extends ViewDataBi
@Override
protected void onStop() {
C.SYSTEM.mStateEnable = false;
// C.SYSTEM.mStateEnable = false;
super.onStop();
}
......
......@@ -16,7 +16,6 @@ import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentSignInBinding;
import com.xingdata.zzdpos.ui.dialog.LoadingDialog;
import com.xingdata.zzdpos.ui.dialog.PromptDialog;
import com.xingdata.zzdpos.ui.login.LoginPresenter;
import com.xingdata.zzdpos.util.OnClickListener;
......@@ -87,18 +86,13 @@ public class SignInFragment extends BaseFragment<LoginPresenter,
break;
case R.id.btn_login: {
if (mViewBinding.etPwd.getText().toString().isEmpty() ||
mViewBinding.etPhone
.getText().toString().isEmpty()) {
mViewBinding.etPhone.getText().toString().isEmpty()) {
ToastUtils.showLong("账号密码不能为空");
} else {
promptDialog = new PromptDialog().setDialogType(PromptDialog
.PROMPTDIALOG_ING, "正在登录");
promptDialog = new PromptDialog().setDialogType(PromptDialog.PROMPTDIALOG_ING, "正在登录");
mLoadingDialog.show((BaseActivity) getActivity());
mPresenter.signIn(mViewBinding.etPhone.getText().toString(),
mViewBinding
.etPwd.getText().toString(), promptDialog,
mLoadingDialog);
mViewBinding.etPwd.getText().toString(), promptDialog, mLoadingDialog);
}
}
......
......@@ -286,7 +286,7 @@ public class StatisticsDetailActivity extends BaseActivity<StatisticsDetailPrese
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
mPresenter.returnOrder(mSaleorder.getOrderNo() + "");
mPresenter.returnOrder(mSaleorder);
}
}).create().show();
......
......@@ -31,9 +31,9 @@ public interface StatisticsDetailContract {
/**
* 退货
*
* @param orderId 订单id
* @param saleorder 订单
*/
public abstract void returnOrder(String orderId);
public abstract void returnOrder(Saleorder saleorder);
}
}
package com.xingdata.zzdpos.ui.statistics;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.pay.neptune.NeptuneCenter;
import com.xingdata.zzdpos.App;
import com.xingdata.zzdpos.api.ApiFactory;
import com.xingdata.zzdpos.model.Saleorder;
/**
* Created by Administrator on 2017/12/27.
......@@ -28,12 +31,25 @@ public class StatisticsDetailPresenter extends StatisticsDetailContract.Presente
@Override
public void returnOrder(String orderId) {
ApiFactory.Test.returnOrder(orderId ).subscribe(s -> {
ToastUtils.showLong("成功");
mView.returnOrderSuss();
}, throwable -> {
ToastUtils.showLong(throwable.getMessage());
public void returnOrder(Saleorder saleorder) {
NeptuneCenter.getInstance().init(App.instance).refund(saleorder.getOrderNo(), saleorder.getPayType(), saleorder
.getOrderPayAmt()).subscribe(response -> {
switch (response.getCode()) {
case com.xingdata.zxpay.C.PAY_STATE.SUCCESS:
ApiFactory.Test.returnOrder(saleorder.getOrderNo()).subscribe(s -> {
ToastUtils.showLong("退货成功");
mView.returnOrderSuss();
}, throwable -> {
ToastUtils.showLong(throwable.getMessage());
});
break;
default: {
}
break;
}
});
}
}
......@@ -34,7 +34,8 @@ public class C {
/**
* 银联支付
*/
final static String UNIONPAY = "CHANPAY";
// final static String UNIONPAY = "CHANPAY";
final static String UNIONPAY = "BANKCARD";
/**
* 微信支付
*/
......
......@@ -162,35 +162,35 @@ public class Factory {
}
break;
}
new Thread(new Runnable() {
@Override
public void run() {
while (mPayService == null) {
LogUtils.e("PayService获取失败," + C.RETRY_DELAY_TIME + "ms后尝试重连");
if (mRetry < C.RETRY_COUNT) {
try {
Thread.sleep(C.RETRY_DELAY_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
IResponse iResponse;
String str = null;
try {
str = mPayService.doTrans(JSON.toJSONString(iRequest));
} catch (RemoteException e) {
e.printStackTrace();
}
try {
iResponse = JSON.parseObject(str, IResponse.class);
} catch (Exception e) {
iResponse = new IResponse();
}
}
}).start();
// new Thread(new Runnable() {
// @Override
// public void run() {
// while (mPayService == null) {
// LogUtils.e("PayService获取失败," + C.RETRY_DELAY_TIME + "ms后尝试重连");
// if (mRetry < C.RETRY_COUNT) {
// try {
// Thread.sleep(C.RETRY_DELAY_TIME);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
// }
// IResponse iResponse;
// String str = null;
// try {
// str = mPayService.doTrans(JSON.toJSONString(iRequest));
// } catch (RemoteException e) {
// e.printStackTrace();
// }
// try {
// iResponse = JSON.parseObject(str, IResponse.class);
// } catch (Exception e) {
// iResponse = new IResponse();
// }
//
//
// }
// }).start();
return run(Observable.just(iRequest).flatMap(iRequest1 -> {
while (mPayService == null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment