Commit 141632db authored by 王海's avatar 王海

提交发券

parent 7061a8a5
......@@ -255,6 +255,8 @@ public class C {
private static final String ROOT_URL = PKG + "ticket/";
public static final String query = ROOT_URL + "query";
public static final String ticketBatchSend = ROOT_URL + "batchSend";
}
public final class SSSKU {
......
......@@ -557,7 +557,8 @@ public final class ApiFactory {
.retryWhen(new RetryHelper(3));
}
public static Observable<com.xingdata.zzdpos.model.Saleorder> addOrderPayMis(com.xingdata.zzdpos.model.Saleorder.Pay saleorderPay) {
public static Observable<com.xingdata.zzdpos.model.Saleorder> addOrderPayMis(com.xingdata
.zzdpos.model.Saleorder.Pay saleorderPay) {
return Api.getInstance().service.addOrderPayMis(saleorderPay)
.onErrorReturn(new ErrorFilter<>())
.map(new ResultFilter<>())
......@@ -577,6 +578,16 @@ public final class ApiFactory {
.observeOn(AndroidSchedulers.mainThread())
.retryWhen(new RetryHelper(3));
}
public static Observable<String> batchSend(String birthdayType, String vipLevel, Long
vipId, Long truleId) {
return Api.getInstance().service.ticketBatchSend(birthdayType, vipLevel, vipId, truleId)
.onErrorReturn(new ErrorFilter<>())
.map(new ResultFilter<>())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.retryWhen(new RetryHelper(3));
}
}
public static class Sssku {
......@@ -700,7 +711,8 @@ public final class ApiFactory {
* @param pageSize
* @return
*/
public static Observable<Pager<com.xingdata.zzdpos.model.Cs>> querCsList(int pageNulmber, int
public static Observable<Pager<com.xingdata.zzdpos.model.Cs>> querCsList(int pageNulmber,
int
pageSize, long startDate, long endDate) {
return Api.getInstance().service.querCsList(pageNulmber, pageSize, startDate,
endDate).onErrorReturn(new
......@@ -933,7 +945,8 @@ public final class ApiFactory {
}
public static Observable<com.xingdata.zzdpos.model.Ms> add(com.xingdata.zzdpos.model.Ms ms) {
public static Observable<com.xingdata.zzdpos.model.Ms> add(com.xingdata.zzdpos.model.Ms
ms) {
return Api.getInstance().service.addMs(ms)
.onErrorReturn(new ErrorFilter<>())
.map(new ResultFilter<>())
......
......@@ -136,7 +136,8 @@ interface ApiService {
@POST(C.URL.ORDER.queryOrderList)
Observable<HttpMessage<Pager<Saleorder>>> getSaleOrder(@Query("pageNumber") int pageNum, @Query
("pageSize") int pageSize, @Query("startDate") long startDate, @Query("endDate") long endDate);
("pageSize") int pageSize, @Query("startDate") long startDate, @Query("endDate") long
endDate);
@POST(C.URL.ORDER.getOrderDetail)
Observable<HttpMessage<Saleorder>> getOrderDetail(@Query("id") String orderId);
......@@ -197,6 +198,12 @@ interface ApiService {
@POST(C.URL.TICKET.query)
Observable<HttpMessage<Pager<Ticket>>> queryTicket(@Query("vipId") Long vipId);
@POST(C.URL.TICKET.ticketBatchSend)
Observable<HttpMessage<String>> ticketBatchSend(@Query("birthdayType") String birthdayType,
@Query("vipLevel") String vipLevel,
@Query("vipId") Long vipId,
@Query("truleId") Long truleId);
@POST(C.URL.SALEORDER.addOrderMis)
Observable<HttpMessage<String>> addOrderMis(@Body Saleorder.Param saleorderParam);
......
......@@ -32,7 +32,8 @@ import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBinding> extends DialogFragment {
public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBinding> extends
DialogFragment {
private DialogBaseBinding mBaseBinding;
private Disposable mDisp;
......@@ -161,7 +162,8 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
if (!isShowing) {
super.show(activity.getSupportFragmentManager(), this.getTag());
isShowing = true;
Observable.interval(0, 1, TimeUnit.SECONDS).take(recLen + 1).map(new Function<Long, Long>() {
Observable.interval(0, 1, TimeUnit.SECONDS).take(recLen + 1).map(new Function<Long,
Long>() {
@Override
public Long apply(@io.reactivex.annotations.NonNull Long aLong) throws Exception {
return recLen - aLong;
......
......@@ -40,5 +40,15 @@ public class SendTickerC {
return vipTypeList;
}
public static Long getServerId(long id) {
if (id == 10001l) {
return 1l;
} else if (id == 10002l) {
return 2l;
} else if (id == 10003l) {
return 3l;
}
return -1l;
}
}
......@@ -50,6 +50,11 @@ public class SendTicketActivity extends BaseActivity<SendTicketPresenter,
mPresenter.sendTickerFragment.truleQuerySucc(trulePager, loadingDialog);
}
@Override
public void sendTickerSucc(LoadingDialog loadingDialog) {
}
@Override
protected void onResume() {
super.onResume();
......
......@@ -33,6 +33,8 @@ public interface SendTicketContract {
void loadVip(Vip vip);
void truleQuerySucc(Pager<Trule> trulePager, LoadingDialog loadingDialog);
void sendTickerSucc( LoadingDialog loadingDialog);
}
abstract class Presenter extends BasePresenter<View> {
......@@ -52,5 +54,7 @@ public interface SendTicketContract {
abstract void truleQuery(LoadingDialog loadingDialog);
abstract void sendTicker(String birthdayType, String vipLevel, Long
vipId, Long truleId, LoadingDialog loadingDialog);
}
}
......@@ -54,4 +54,14 @@ public class SendTicketPresenter extends SendTicketContract.Presenter {
mView.error(throwable.getMessage(), loadingDialog);
});
}
@Override
public void sendTicker(String birthdayType, String vipLevel, Long vipId, Long truleId,
LoadingDialog loadingDialog) {
ApiFactory.Ticket.batchSend(birthdayType, vipLevel, vipId, truleId).subscribe(s -> {
mView.sendTickerSucc(loadingDialog);
}, throwable -> {
mView.error(throwable.getMessage(), loadingDialog);
});
}
}
......@@ -87,15 +87,44 @@ public class SendTickerFragment extends BaseFragment<SendTicketPresenter,
break;
case R.id.btn_send: {
if (isNull()) {
ToastUtils.showLong("发券");
long tickerId = truleList
.get(nowTickerItemId).getTruleMapId();
loadingDialog.show((BaseActivity) getActivity());
if (nowtype == 0) {
//单独会员发券
mPresenter.sendTicker(null, null, nowVip.getVipId(), tickerId,
loadingDialog);
} else if (nowtype == 1) {
Long tempLevelId = levelList.get(nowVipGroupId).getId();
if (tempLevelId == SendTickerC.getVipType().get(0).getId()) {
//选择全部会员
mPresenter.sendTicker(null, null, null, tickerId,
loadingDialog);
return;
}
for (int i = 1; i < SendTickerC.getVipType().size(); i++) {
long tempServerId = SendTickerC.getServerId(tempLevelId);
//选择 当月下月以及流失会员
if (tempLevelId == SendTickerC.getVipType().get(i).getId() &&
tempServerId != -1) {
mPresenter.sendTicker(tempServerId + "", null,
null, tickerId,
loadingDialog);
return;
}
}
//选择金牌银牌等会员类别
mPresenter.sendTicker(null, levelList.get(nowVipGroupId)
.getVipLevel() + "",
null, tickerId,
loadingDialog);
}
}
break;
default: {
ToastUtils.showLong("发券");
}
break;
}
}
});
......
......@@ -38,6 +38,7 @@
<LinearLayout
android:id="@+id/ll_top"
android:layout_above="@+id/ll_bottom"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
......@@ -186,6 +187,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_bottom"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentBottom="true"
......
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