Commit 7dc96a6d by 宁斌

1、餐牌頁面結構調整

parent 37b96f64
...@@ -8,11 +8,10 @@ import android.view.View ...@@ -8,11 +8,10 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.annotation.Nullable
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.pay.contract.PayTypeContract import com.gingersoft.gsa.cloud.pay.contract.PayMethodContract
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.HistoryOrderBean.Data.OrderItem import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.HistoryOrderBean.Data.OrderItem
import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutHistoryOrderItemBinding import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutHistoryOrderItemBinding
...@@ -150,7 +149,7 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var ...@@ -150,7 +149,7 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var
} }
else -> { else -> {
when (payType) { when (payType) {
PayTypeContract.PAY_METHOD_ID_1021 -> { //Google pay需要5-7天 PayMethodContract.PAY_METHOD_ID_1021 -> { //Google pay需要5-7天
return "退款中(預計5-7個工作日退回原賬戶)" return "退款中(預計5-7個工作日退回原賬戶)"
} }
else -> { else -> {
......
...@@ -20,7 +20,7 @@ import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils ...@@ -20,7 +20,7 @@ import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil import com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil import com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.pay.contract.PayTypeContract import com.gingersoft.gsa.cloud.pay.contract.PayMethodContract
import com.gingersoft.gsa.cloud.ui.utils.DialogUtils import com.gingersoft.gsa.cloud.ui.utils.DialogUtils
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean
...@@ -265,7 +265,7 @@ object OtherOrderUtils { ...@@ -265,7 +265,7 @@ object OtherOrderUtils {
} }
else -> { else -> {
when (payType) { when (payType) {
PayTypeContract.PAY_METHOD_ID_1021 -> { //Google pay需要5-7天 PayMethodContract.PAY_METHOD_ID_1021 -> { //Google pay需要5-7天
return "退款中(預計5-7個工作日退回原賬戶)" return "退款中(預計5-7個工作日退回原賬戶)"
} }
else -> { else -> {
......
...@@ -39,6 +39,7 @@ import com.gingersoft.gsa.cloud.main.mvp.contract.SettlementReportContract; ...@@ -39,6 +39,7 @@ import com.gingersoft.gsa.cloud.main.mvp.contract.SettlementReportContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SendSettlement; import com.gingersoft.gsa.cloud.main.mvp.model.bean.SendSettlement;
import com.gingersoft.gsa.cloud.main.mvp.presenter.SettlementReportPresenter; import com.gingersoft.gsa.cloud.main.mvp.presenter.SettlementReportPresenter;
import com.gingersoft.gsa.cloud.pay.bean.PayMethod; import com.gingersoft.gsa.cloud.pay.bean.PayMethod;
import com.gingersoft.gsa.cloud.pay.contract.PayMethodContract;
import com.gingersoft.gsa.cloud.print.bean.PrintContent; import com.gingersoft.gsa.cloud.print.bean.PrintContent;
import com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter; import com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem5; import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem5;
...@@ -377,7 +378,7 @@ public class SettlementReportActivity extends BaseActivity<SettlementReportPrese ...@@ -377,7 +378,7 @@ public class SettlementReportActivity extends BaseActivity<SettlementReportPrese
if (cashList != null && cashList.size() > 0) { if (cashList != null && cashList.size() > 0) {
for (int i = 0; i < cashList.size(); i++) { for (int i = 0; i < cashList.size(); i++) {
SettlementReport.CashBean cashBean = cashList.get(i); SettlementReport.CashBean cashBean = cashList.get(i);
if (cashBean.getPayType() == PayMethod.PAY_TYPE_CASH) { if (cashBean.getPayType() == PayMethodContract.PAY_METHOD_ID_1001) {
/**現金詳情*/ /**現金詳情*/
String cashDetailText = LanguageUtils.get_language_system(this, "credit.cash.detail", "現金詳情"); String cashDetailText = LanguageUtils.get_language_system(this, "credit.cash.detail", "現金詳情");
String cashText = LanguageUtils.get_language_system(this, "credit.cash", "現金"); String cashText = LanguageUtils.get_language_system(this, "credit.cash", "現金");
......
...@@ -173,7 +173,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon ...@@ -173,7 +173,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
@Override @Override
public void initImmersionBar() { public void initImmersionBar() {
ImmersionBar.setTitleBar(this, slideMenu); // ImmersionBar.setTitleBar(this, slideMenu);
} }
@Override @Override
......
...@@ -15,6 +15,7 @@ import androidx.annotation.Nullable; ...@@ -15,6 +15,7 @@ import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
......
...@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.common.utils.PrintTransitUtils; ...@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.common.utils.PrintTransitUtils;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean; import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.pay.bean.PayMethod; import com.gingersoft.gsa.cloud.pay.bean.PayMethod;
import com.gingersoft.gsa.cloud.pay.contract.PayMethodContract;
import com.gingersoft.gsa.cloud.print.bean.PrintCleanMachineContent; import com.gingersoft.gsa.cloud.print.bean.PrintCleanMachineContent;
import com.joe.print.mvp.model.bean.HtmlLable; import com.joe.print.mvp.model.bean.HtmlLable;
import com.joe.print.mvp.print.common.HtmlContract; import com.joe.print.mvp.print.common.HtmlContract;
...@@ -182,7 +183,7 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> { ...@@ -182,7 +183,7 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center, HtmlContract.value_type_string))); new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center, HtmlContract.value_type_string)));
for (SettlementReport.CashBean cashBean : cashs) { for (SettlementReport.CashBean cashBean : cashs) {
if (cashBean.getPayType() == PayMethod.PAY_TYPE_CASH) { if (cashBean.getPayType() == PayMethodContract.PAY_METHOD_ID_1001) {
htmlLables.addAll(getRowInformation(new HtmlLable[]{ htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, cashBean.getPayName()), new HtmlLable(LABLE_COLUMN, cashBean.getPayName()),
new HtmlLable(LABLE_COLUMN, String.valueOf(cashBean.getPayNum()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)), new HtmlLable(LABLE_COLUMN, String.valueOf(cashBean.getPayNum()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)),
......
...@@ -5,18 +5,18 @@ import dagger.Component; ...@@ -5,18 +5,18 @@ import dagger.Component;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.table.di.module.BillDiscountModule; import com.gingersoft.gsa.cloud.table.di.module.MealDiscountModule;
import com.gingersoft.gsa.cloud.table.mvp.contract.BillDiscountContract; import com.gingersoft.gsa.cloud.table.mvp.contract.MealDiscountContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.discount.BillDiscountFragment; import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.mealstand.MealDiscountFragment;
/** /**
* ================================================ * ================================================
* Description: * Description:
* <p> * <p>
* Created by MVPArmsTemplate on 04/02/2021 17:26 * Created by MVPArmsTemplate on 04/17/2021 10:46
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a> * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a> * <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
...@@ -25,17 +25,17 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.discount.BillDiscountFragm ...@@ -25,17 +25,17 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.discount.BillDiscountFragm
* ================================================ * ================================================
*/ */
@FragmentScope @FragmentScope
@Component(modules = BillDiscountModule.class, dependencies = AppComponent.class) @Component(modules = MealDiscountModule.class, dependencies = AppComponent.class)
public interface BillDiscountComponent { public interface MealDiscountComponent {
void inject(BillDiscountFragment fragment); void inject(MealDiscountFragment fragment);
@Component.Builder @Component.Builder
interface Builder { interface Builder {
@BindsInstance @BindsInstance
BillDiscountComponent.Builder view(BillDiscountContract.View view); MealDiscountComponent.Builder view(MealDiscountContract.View view);
BillDiscountComponent.Builder appComponent(AppComponent appComponent); MealDiscountComponent.Builder appComponent(AppComponent appComponent);
BillDiscountComponent build(); MealDiscountComponent build();
} }
} }
\ No newline at end of file
package com.gingersoft.gsa.cloud.table.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.discount.NomalDiscountFragment;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.table.di.module.NomalDiscountModule;
import com.gingersoft.gsa.cloud.table.mvp.contract.NomalDiscountContract;
import com.jess.arms.di.scope.FragmentScope;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/02/2021 17:26
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = NomalDiscountModule.class, dependencies = AppComponent.class)
public interface NomalDiscountComponent {
void inject(NomalDiscountFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
NomalDiscountComponent.Builder view(NomalDiscountContract.View view);
NomalDiscountComponent.Builder appComponent(AppComponent appComponent);
NomalDiscountComponent build();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.table.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.table.di.module.SetMealModule;
import com.gingersoft.gsa.cloud.table.mvp.contract.SetMealContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.mealstand.SetMealFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:40
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = SetMealModule.class, dependencies = AppComponent.class)
public interface SetMealComponent {
void inject(SetMealFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
SetMealComponent.Builder view(SetMealContract.View view);
SetMealComponent.Builder appComponent(AppComponent appComponent);
SetMealComponent build();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.table.di.module;
import com.gingersoft.gsa.cloud.ui.bean.TagViewItem;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.gsa.cloud.table.mvp.contract.MealDiscountContract;
import com.gingersoft.gsa.cloud.table.mvp.model.MealDiscountModel;
import java.util.ArrayList;
import java.util.List;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:46
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class MealDiscountModule {
@Binds
abstract MealDiscountContract.Model bindMealDiscountModel(MealDiscountModel model);
@FragmentScope
@Provides
static List<String> provideTabTitleList(){
return new ArrayList<>();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.table.di.module; package com.gingersoft.gsa.cloud.table.di.module;
import com.gingersoft.gsa.cloud.table.mvp.model.NomalDiscountModel;
import com.gingersoft.gsa.cloud.ui.adapter.TagViewAdapter; import com.gingersoft.gsa.cloud.ui.adapter.TagViewAdapter;
import com.gingersoft.gsa.cloud.ui.bean.TagViewItem; import com.gingersoft.gsa.cloud.ui.bean.TagViewItem;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds; import dagger.Binds;
import dagger.Module; import dagger.Module;
import dagger.Provides; import dagger.Provides;
import com.gingersoft.gsa.cloud.table.mvp.contract.BillDiscountContract; import com.gingersoft.gsa.cloud.table.mvp.contract.NomalDiscountContract;
import com.gingersoft.gsa.cloud.table.mvp.model.BillDiscountModel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -29,10 +28,10 @@ import java.util.List; ...@@ -29,10 +28,10 @@ import java.util.List;
* ================================================ * ================================================
*/ */
@Module @Module
public abstract class BillDiscountModule { public abstract class NomalDiscountModule {
@Binds @Binds
abstract BillDiscountContract.Model bindBillDiscountModel(BillDiscountModel model); abstract NomalDiscountContract.Model bindBillDiscountModel(NomalDiscountModel model);
@FragmentScope @FragmentScope
@Provides @Provides
......
package com.gingersoft.gsa.cloud.table.di.module;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.gingersoft.gsa.cloud.database.bean.ComboItem;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.table.mvp.contract.MealStandContract;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ComboAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodGroupAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ModifierAdapter;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.gsa.cloud.table.mvp.contract.SetMealContract;
import com.gingersoft.gsa.cloud.table.mvp.model.SetMealModel;
import com.jess.arms.mvp.IView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Named;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:40
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class SetMealModule {
@Binds
abstract SetMealContract.Model bindSetMealModel(SetMealModel model);
@ActivityScope
@Provides
@Named("foodGroupList")
static List<Food> provideFoodGroupList() {
return new ArrayList<>();
}
@ActivityScope
@Provides
@Named("foodList")
static List<Food> provideFoodList() {
return new ArrayList<>();
}
@ActivityScope
@Provides
static List<ComboItem> provideFoodCombo() {
return new ArrayList<>();
}
@ActivityScope
@Provides
static List<Modifier> provideModifierList() {
return new ArrayList<>();
}
@ActivityScope
@Provides
@Named("fineTabTitles")
static List<String> provideFineTabTitleList() {
return new ArrayList<>();
}
@ActivityScope
@Provides
static FoodGroupAdapter provideFoodGroupAdapter(MealStandContract.View IView, @Named("foodGroupList") List<Food> foodGroupList) {
return new FoodGroupAdapter(IView.getActivity(), foodGroupList, IView.getFromType());
}
@ActivityScope
@Provides
static FoodAdapter provideFoodAdapter(MealStandContract.View IView, @Named("foodList") List<Food> foodList) {
return new FoodAdapter(IView.getActivity(), foodList, IView.getFromType());
}
@ActivityScope
@Provides
static ComboAdapter provideComboAdapter(MealStandContract.View IView, List<ComboItem> comboItemList) {
return new ComboAdapter(IView.getActivity(), comboItemList);
}
@ActivityScope
@Provides
static ModifierAdapter provideModifierAdapter(MealStandContract.View IView, List<Modifier> modifierList) {
return new ModifierAdapter(IView.getActivity(), modifierList);
}
@ActivityScope
@Provides
static GridLayoutManager provideFoodRecycleLayoutManager(SetMealContract.View IView) {
return new GridLayoutManager(IView.getActivity2(), 1, LinearLayoutManager.HORIZONTAL, false);
}
@ActivityScope
@Provides
static GridLayoutManager provideComboRecycleLayoutManager(SetMealContract.View IView) {
return new GridLayoutManager(IView.getActivity2(), 1, LinearLayoutManager.HORIZONTAL, false);
}
@ActivityScope
@Provides
static GridLayoutManager provideModifierRecycleLayoutManager(SetMealContract.View IView) {
return new GridLayoutManager(IView.getActivity2(), 1, LinearLayoutManager.HORIZONTAL, false);
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.table.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:46
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface MealDiscountContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
...@@ -127,7 +127,6 @@ public interface MealStandContract { ...@@ -127,7 +127,6 @@ public interface MealStandContract {
Observable<BaseOrderResponse> loadOrder(long orderId); Observable<BaseOrderResponse> loadOrder(long orderId);
// Observable<BaseOrderResponse> deleteFood(List<Map<Byte, DeleteOrderRequest>> mapsDelete, long orderId, byte type, int reasonId);
Observable<BaseOrderResponse> deleteFood(RequestBody requestBody); Observable<BaseOrderResponse> deleteFood(RequestBody requestBody);
Observable<BaseOrderResponse> printOrder(RequestBody requestBody); Observable<BaseOrderResponse> printOrder(RequestBody requestBody);
......
...@@ -22,7 +22,7 @@ import java.util.List; ...@@ -22,7 +22,7 @@ import java.util.List;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================ * ================================================
*/ */
public interface BillDiscountContract { public interface NomalDiscountContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void returnBillCoupon(List<Discount> discounts); void returnBillCoupon(List<Discount> discounts);
......
package com.gingersoft.gsa.cloud.table.mvp.contract;
import android.app.Activity;
import com.gingersoft.gsa.cloud.database.bean.ComboItem;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.FoodCombo;
import com.gingersoft.gsa.cloud.database.bean.FoodModifier;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import io.reactivex.Single;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:40
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface SetMealContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends BaseOrderContract.View {
void setFoodGroupRecycleSpanCount(int size);
void setFoodRecycleSpanCount(int size);
void setComboRecycleSpanCount(int size);
void setModifierRecycleSpanCount(int size);
void showViewModeVisibility(int... viewMode);
void showModifyLayoutVisibility(boolean show);
void showBtnMealModifyRestoreVisibility(boolean show);
void setOrderFoodCount(String number);
int getCurrentViewMode();
void setPluMode();
void resetPluMode();
void setMealRvScrollToPosition(int position);
void returnFoodGroupList(List<Food> foodGroupList);
void returnFoodList(List<Food> foodList);
void returnFoodComboList(List<ComboItem> comboList);
void returnModifierList(List<Modifier> modifierList);
MealStandActivity getActivity2();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends BaseOrderContract.Model {
Single<List<Food>> queryDB_FoodGroupList(int foodSummary);
Single<List<Food>> queryDB_FoodList(long parentId, int foodSummary);
Single<List<Modifier>> queryDB_ModifierList(long fid, int mode);
Single<List<ComboItem>> queryDB_ComboList(long fid, int foodSummary);
Single<List<FoodCombo>> isComboFood(long fid);
Single<List<FoodModifier>> queryDB_FoodModifierList(long fid);
}
interface
}
package com.gingersoft.gsa.cloud.table.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.table.mvp.contract.MealDiscountContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:46
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class MealDiscountModel extends BaseModel implements MealDiscountContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public MealDiscountModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
...@@ -13,7 +13,7 @@ import com.jess.arms.di.scope.FragmentScope; ...@@ -13,7 +13,7 @@ import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.gsa.cloud.table.mvp.contract.BillDiscountContract; import com.gingersoft.gsa.cloud.table.mvp.contract.NomalDiscountContract;
import java.util.List; import java.util.List;
...@@ -31,14 +31,14 @@ import java.util.List; ...@@ -31,14 +31,14 @@ import java.util.List;
* ================================================ * ================================================
*/ */
@FragmentScope @FragmentScope
public class BillDiscountModel extends BaseModel implements BillDiscountContract.Model { public class NomalDiscountModel extends BaseModel implements NomalDiscountContract.Model {
@Inject @Inject
Gson mGson; Gson mGson;
@Inject @Inject
Application mApplication; Application mApplication;
@Inject @Inject
public BillDiscountModel(IRepositoryManager repositoryManager) { public NomalDiscountModel(IRepositoryManager repositoryManager) {
super(repositoryManager); super(repositoryManager);
} }
......
package com.gingersoft.gsa.cloud.table.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.database.bean.ComboItem;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.FoodCombo;
import com.gingersoft.gsa.cloud.database.bean.FoodModifier;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.table.mvp.contract.SetMealContract;
import java.util.List;
import io.reactivex.Single;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:40
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class SetMealModel extends BaseModel implements SetMealContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public SetMealModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Single<List<Food>> queryDB_FoodGroupList(int foodSummary) {
return null;
}
@Override
public Single<List<Food>> queryDB_FoodList(long parentId, int foodSummary) {
return null;
}
@Override
public Single<List<Modifier>> queryDB_ModifierList(long fid, int mode) {
return null;
}
@Override
public Single<List<ComboItem>> queryDB_ComboList(long fid, int foodSummary) {
return null;
}
@Override
public Single<List<FoodCombo>> isComboFood(long fid) {
return null;
}
@Override
public Single<List<FoodModifier>> queryDB_FoodModifierList(long fid) {
return null;
}
}
\ No newline at end of file
...@@ -8,9 +8,9 @@ import com.gingersoft.gsa.cloud.common.oaId.DeviceID; ...@@ -8,9 +8,9 @@ import com.gingersoft.gsa.cloud.common.oaId.DeviceID;
import com.gingersoft.gsa.cloud.common.utils.AppDevices; import com.gingersoft.gsa.cloud.common.utils.AppDevices;
import com.gingersoft.gsa.cloud.order.bean.response.OrderDiscountResponse; import com.gingersoft.gsa.cloud.order.bean.response.OrderDiscountResponse;
import com.gingersoft.gsa.cloud.order.bean.response.OrderResponse; import com.gingersoft.gsa.cloud.order.bean.response.OrderResponse;
import com.gingersoft.gsa.cloud.pay.bean.PayMethod; import com.gingersoft.gsa.cloud.pay.contract.PayMethodContract;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.constant.PayMethodConstant; import com.gingersoft.gsa.cloud.pay.pos.hyweb.constant.HywebMethodConstant;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
...@@ -209,18 +209,18 @@ public class OrderManagerResponse implements Serializable { ...@@ -209,18 +209,18 @@ public class OrderManagerResponse implements Serializable {
private String payName; private String payName;
public boolean withHywebPay() { public boolean withHywebPay() {
if (payType == PayMethod.HYWEB_POS_TYPE_CC || payType == PayMethod.HYWEB_POS_TYPE_QRC) { if (payType == PayMethodContract.PAY_METHOD_ID_1030 || payType == PayMethodContract.PAY_METHOD_ID_1030) {
return true; return true;
} }
return false; return false;
} }
public String getHywebPayMethodByType() { public String getHywebPayMethodByType() {
if (payType == PayMethod.HYWEB_POS_TYPE_CC) { if (payType == PayMethodContract.PAY_METHOD_ID_1030) {
return PayMethodConstant.PAY_TYPE_CC; return HywebMethodConstant.PAY_TYPE_CC;
} }
if (payType == PayMethod.HYWEB_POS_TYPE_QRC) { if (payType == PayMethodContract.PAY_METHOD_ID_1031) {
return PayMethodConstant.PAY_TYPE_QRC; return HywebMethodConstant.PAY_TYPE_QRC;
} }
return ""; return "";
} }
...@@ -275,13 +275,13 @@ public class OrderManagerResponse implements Serializable { ...@@ -275,13 +275,13 @@ public class OrderManagerResponse implements Serializable {
return ""; return "";
} }
public PosAction getPosActionByMatterId() { public PayAction getPosActionByMatterId() {
if (!TextUtils.isEmpty(tipTxnId)) { if (!TextUtils.isEmpty(tipTxnId)) {
return PosAction.TIP; return PayAction.TIP;
} else if (!TextUtils.isEmpty(cancelTxnId)) { } else if (!TextUtils.isEmpty(cancelTxnId)) {
return PosAction.VOID; return PayAction.VOID;
} else if (!TextUtils.isEmpty(refundTxnId)) { } else if (!TextUtils.isEmpty(refundTxnId)) {
return PosAction.REFUND; return PayAction.REFUND;
} }
return null; return null;
} }
......
...@@ -38,6 +38,7 @@ import com.gingersoft.gsa.cloud.order.order.TakeawayOrder; ...@@ -38,6 +38,7 @@ import com.gingersoft.gsa.cloud.order.order.TakeawayOrder;
import com.gingersoft.gsa.cloud.table.mvp.contract.BaseOrderContract; import com.gingersoft.gsa.cloud.table.mvp.contract.BaseOrderContract;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.AddOrderRequest; import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.AddOrderRequest;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.CreateOrderRequest; import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.CreateOrderRequest;
import com.gingersoft.gsa.cloud.table.mvp.presenter.mealstand.MealStandPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderContentActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderContentActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.BillItemAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.BillItemAdapter;
...@@ -150,7 +151,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex ...@@ -150,7 +151,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
public abstract void addOrderFood(boolean isPrint, Class<?> afterToActivity); public abstract void addOrderFood(boolean isPrint, Class<?> afterToActivity);
void saveCreateTime(long createTime) { public void saveCreateTime(long createTime) {
if (mDoshokuOrder == null) { if (mDoshokuOrder == null) {
mDoshokuOrder.setOpenTableInfo(new TableBean.DataBean()); mDoshokuOrder.setOpenTableInfo(new TableBean.DataBean());
} }
......
...@@ -15,6 +15,7 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; ...@@ -15,6 +15,7 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest; import com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest;
import com.gingersoft.gsa.cloud.order.commodity.OrderDetail; import com.gingersoft.gsa.cloud.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.pay.bean.PayMethod; import com.gingersoft.gsa.cloud.pay.bean.PayMethod;
import com.gingersoft.gsa.cloud.pay.contract.PayMethodContract;
import com.gingersoft.gsa.cloud.table.mvp.contract.OrderPayContract; import com.gingersoft.gsa.cloud.table.mvp.contract.OrderPayContract;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.response.OrderPayResponse; import com.gingersoft.gsa.cloud.table.mvp.model.bean.response.OrderPayResponse;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderPayActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderPayActivity;
...@@ -231,7 +232,7 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model ...@@ -231,7 +232,7 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
} else { } else {
orderPay.setTipsPrice(orderPayView.getTipsPrice()); orderPay.setTipsPrice(orderPayView.getTipsPrice());
} }
if (orderPay.getPayType() == PayMethod.PAY_TYPE_INTEGRAL) { if (orderPay.getPayType() == PayMethodContract.PAY_METHOD_INTEGRAL) {
double consumptionPoints = orderPayView.getPayForConsumptionPoints(null, memberInfo.getPointRedeemCash()); double consumptionPoints = orderPayView.getPayForConsumptionPoints(null, memberInfo.getPointRedeemCash());
orderPay.setConsumptionPoints(consumptionPoints); orderPay.setConsumptionPoints(consumptionPoints);
// //減去積分支付所用的積分 // //減去積分支付所用的積分
......
...@@ -2,14 +2,9 @@ package com.gingersoft.gsa.cloud.table.mvp.presenter; ...@@ -2,14 +2,9 @@ package com.gingersoft.gsa.cloud.table.mvp.presenter;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
import android.content.Intent;
import android.graphics.Region;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.OnLifecycleEvent;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication; import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.constans.FoodSummaryConstans; import com.gingersoft.gsa.cloud.common.constans.FoodSummaryConstans;
...@@ -33,7 +28,7 @@ import com.gingersoft.gsa.cloud.order.commodity.OrderDetail; ...@@ -33,7 +28,7 @@ import com.gingersoft.gsa.cloud.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.order.order.BaseOrder; import com.gingersoft.gsa.cloud.order.order.BaseOrder;
import com.gingersoft.gsa.cloud.order.order.DoshokuOrder; import com.gingersoft.gsa.cloud.order.order.DoshokuOrder;
import com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam; import com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment; import com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment;
import com.gingersoft.gsa.cloud.table.FunctionTable; import com.gingersoft.gsa.cloud.table.FunctionTable;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
...@@ -50,13 +45,11 @@ import com.gingersoft.gsa.cloud.table.mvp.action.table.ResetTableAction; ...@@ -50,13 +45,11 @@ import com.gingersoft.gsa.cloud.table.mvp.action.table.ResetTableAction;
import com.gingersoft.gsa.cloud.table.mvp.action.table.SplitTableAction; import com.gingersoft.gsa.cloud.table.mvp.action.table.SplitTableAction;
import com.gingersoft.gsa.cloud.table.mvp.action.table.TableAction; import com.gingersoft.gsa.cloud.table.mvp.action.table.TableAction;
import com.gingersoft.gsa.cloud.table.mvp.model.utils.OrderAssemblyUtil; import com.gingersoft.gsa.cloud.table.mvp.model.utils.OrderAssemblyUtil;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.CoordinatorlayoutActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.BottomFunctionAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.BottomFunctionAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.SplitTableDialog; import com.gingersoft.gsa.cloud.table.mvp.ui.widget.SplitTableDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.BaseRetryDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.BaseRetryDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog;
import com.google.android.material.internal.NavigationMenuItemView;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.scope.ActivityScope; import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -82,12 +75,10 @@ import io.reactivex.android.schedulers.AndroidSchedulers; ...@@ -82,12 +75,10 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull; import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer; import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import lombok.Data; import lombok.Data;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import me.jessyan.rxerrorhandler.handler.RetryWithDelay;
import okhttp3.FormBody; import okhttp3.FormBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -513,7 +504,7 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont ...@@ -513,7 +504,7 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
statusExceptionParam.setOrderId(orderBean.getId()); statusExceptionParam.setOrderId(orderBean.getId());
statusExceptionParam.setOrderNo(orderBean.getOrderNo()); statusExceptionParam.setOrderNo(orderBean.getOrderNo());
statusExceptionParam.setPayMethodName(orderBean.getPayName()); statusExceptionParam.setPayMethodName(orderBean.getPayName());
statusExceptionParam.setPosAction(PosAction.RETRIEVAL); statusExceptionParam.setPosAction(PayAction.RETRIEVAL);
IActivity.loadRootFragment(R.id.fl_container, PosActionStatusExceptionFragment.newInstance(statusExceptionParam)); IActivity.loadRootFragment(R.id.fl_container, PosActionStatusExceptionFragment.newInstance(statusExceptionParam));
} else { } else {
IActivity.start(statusExceptionFragment); IActivity.start(statusExceptionFragment);
......
package com.gingersoft.gsa.cloud.table.mvp.presenter; package com.gingersoft.gsa.cloud.table.mvp.presenter.discount;
import android.app.Application; import android.app.Application;
......
package com.gingersoft.gsa.cloud.table.mvp.presenter; package com.gingersoft.gsa.cloud.table.mvp.presenter.discount;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.constans.FoodSummaryConstans; import com.gingersoft.gsa.cloud.common.constans.FoodSummaryConstans;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.database.bean.Discount; import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.order.order.BaseOrder; import com.gingersoft.gsa.cloud.order.order.BaseOrder;
import com.gingersoft.gsa.cloud.table.mvp.contract.NomalDiscountContract;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
...@@ -15,8 +15,6 @@ import me.jessyan.rxerrorhandler.core.RxErrorHandler; ...@@ -15,8 +15,6 @@ import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.gsa.cloud.table.mvp.contract.BillDiscountContract;
import java.util.List; import java.util.List;
...@@ -33,7 +31,7 @@ import java.util.List; ...@@ -33,7 +31,7 @@ import java.util.List;
* ================================================ * ================================================
*/ */
@FragmentScope @FragmentScope
public class BillDiscountPresenter extends BasePresenter<BillDiscountContract.Model, BillDiscountContract.View> { public class NomalDiscountPresenter extends BasePresenter<NomalDiscountContract.Model, NomalDiscountContract.View> {
@Inject @Inject
RxErrorHandler mErrorHandler; RxErrorHandler mErrorHandler;
@Inject @Inject
...@@ -44,7 +42,7 @@ public class BillDiscountPresenter extends BasePresenter<BillDiscountContract.Mo ...@@ -44,7 +42,7 @@ public class BillDiscountPresenter extends BasePresenter<BillDiscountContract.Mo
AppManager mAppManager; AppManager mAppManager;
@Inject @Inject
public BillDiscountPresenter(BillDiscountContract.Model model, BillDiscountContract.View rootView) { public NomalDiscountPresenter(NomalDiscountContract.Model model, NomalDiscountContract.View rootView) {
super(model, rootView); super(model, rootView);
} }
......
package com.gingersoft.gsa.cloud.table.mvp.presenter.mealstand;
import android.app.Application;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.table.mvp.contract.MealDiscountContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:46
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class MealDiscountPresenter extends BasePresenter<MealDiscountContract.Model, MealDiscountContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public MealDiscountPresenter(MealDiscountContract.Model model, MealDiscountContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.gsa.cloud.table.mvp.presenter; package com.gingersoft.gsa.cloud.table.mvp.presenter.mealstand;
import android.app.Application; import android.app.Application;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -40,6 +40,7 @@ import com.gingersoft.gsa.cloud.table.mvp.model.bean.SoldoutCtrFood; ...@@ -40,6 +40,7 @@ import com.gingersoft.gsa.cloud.table.mvp.model.bean.SoldoutCtrFood;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.AddOrderRequest; import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.AddOrderRequest;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.CreateOrderRequest; import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.CreateOrderRequest;
import com.gingersoft.gsa.cloud.table.mvp.action.discount.MealDiscountAction; import com.gingersoft.gsa.cloud.table.mvp.action.discount.MealDiscountAction;
import com.gingersoft.gsa.cloud.table.mvp.presenter.BaseOrderPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ComboAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ComboAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.DiscountAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.DiscountAdapter;
......
...@@ -8,6 +8,7 @@ import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; ...@@ -8,6 +8,7 @@ import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.order.bean.response.OrderDiscountResponse; import com.gingersoft.gsa.cloud.order.bean.response.OrderDiscountResponse;
import com.gingersoft.gsa.cloud.order.commodity.OrderDetail; import com.gingersoft.gsa.cloud.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.pay.bean.PayMethod; import com.gingersoft.gsa.cloud.pay.bean.PayMethod;
import com.gingersoft.gsa.cloud.pay.contract.PayMethodContract;
import com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment; import com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment;
import com.gingersoft.gsa.cloud.pay.util.PayMethodUtils; import com.gingersoft.gsa.cloud.pay.util.PayMethodUtils;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
...@@ -17,7 +18,6 @@ import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem3; ...@@ -17,7 +18,6 @@ import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem3;
import com.jess.arms.di.scope.ActivityScope; import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import org.simple.eventbus.EventBus; import org.simple.eventbus.EventBus;
...@@ -138,7 +138,7 @@ public class OrderDetailPresenter extends BaseOrderConterPresenter<OrderDetailCo ...@@ -138,7 +138,7 @@ public class OrderDetailPresenter extends BaseOrderConterPresenter<OrderDetailCo
payMethod.setTipsPrice(orderPayBean.getTipsPrice()); payMethod.setTipsPrice(orderPayBean.getTipsPrice());
payMethods.add(payMethod); payMethods.add(payMethod);
} }
PayMethod payMethod = PayMethodUtils.filterPaymentMethodById(payMethods, PayMethod.HYWEB_POS_TYPE_CC); PayMethod payMethod = PayMethodUtils.filterPaymentMethodById(payMethods, PayMethodContract.PAY_METHOD_ID_1030);
if (payMethod != null) { if (payMethod != null) {
//只有卡片支付才支持補小費 //只有卡片支付才支持補小費
return true; return true;
......
...@@ -31,7 +31,6 @@ import com.gingersoft.gsa.cloud.table.mvp.presenter.orderManager.OrderCenterPres ...@@ -31,7 +31,6 @@ import com.gingersoft.gsa.cloud.table.mvp.presenter.orderManager.OrderCenterPres
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllOrderFragment; import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllOrderFragment;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseFragmentActivity; import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.base.delegate.IActivity;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
......
...@@ -5,6 +5,7 @@ import android.os.Build; ...@@ -5,6 +5,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.Window;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
...@@ -23,8 +24,12 @@ import com.gingersoft.gsa.cloud.common.utils.LanguageUtils; ...@@ -23,8 +24,12 @@ import com.gingersoft.gsa.cloud.common.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.order.commodity.OrderDetail; import com.gingersoft.gsa.cloud.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.order.contract.OrderStatusContract; import com.gingersoft.gsa.cloud.order.contract.OrderStatusContract;
import com.gingersoft.gsa.cloud.order.order.DoshokuOrder;
import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.RequestParms;
import com.gingersoft.gsa.cloud.pay.bean.PayMethod; import com.gingersoft.gsa.cloud.pay.bean.PayMethod;
import com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam; import com.gingersoft.gsa.cloud.pay.bean.PosActionStatusExceptionParam;
import com.gingersoft.gsa.cloud.pay.lifecycle.fragment.PayFlowFragment;
import com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment; import com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2; import com.gingersoft.gsa.cloud.table.R2;
...@@ -171,6 +176,9 @@ public class OrderDetailActivity extends BaseFragmentActivity<OrderDetailPresent ...@@ -171,6 +176,9 @@ public class OrderDetailActivity extends BaseFragmentActivity<OrderDetailPresent
initOrderDetail(mOrderDetailItem); initOrderDetail(mOrderDetailItem);
setBtnVisible(); setBtnVisible();
btn_refund.setVisibility(View.GONE); btn_refund.setVisibility(View.GONE);
if (AppDevices.isYedpay()) {
btn_refund.setVisibility(View.VISIBLE);
}
} }
@Subscriber(tag = PosActionStatusExceptionFragment.REFREAFSH_ORDER_EVENT) @Subscriber(tag = PosActionStatusExceptionFragment.REFREAFSH_ORDER_EVENT)
...@@ -308,6 +316,7 @@ public class OrderDetailActivity extends BaseFragmentActivity<OrderDetailPresent ...@@ -308,6 +316,7 @@ public class OrderDetailActivity extends BaseFragmentActivity<OrderDetailPresent
private void setBtnVisible() { private void setBtnVisible() {
if (mOrderDetailItem.getRestaurantOperationId() != null) { if (mOrderDetailItem.getRestaurantOperationId() != null) {
//已清机
setWithSettlementLayoutVisible(); setWithSettlementLayoutVisible();
} else { } else {
if (mOrderDetailItem.withHywebPay() && AppDevices.isHywebPos()) { if (mOrderDetailItem.withHywebPay() && AppDevices.isHywebPos()) {
...@@ -489,21 +498,6 @@ public class OrderDetailActivity extends BaseFragmentActivity<OrderDetailPresent ...@@ -489,21 +498,6 @@ public class OrderDetailActivity extends BaseFragmentActivity<OrderDetailPresent
} }
} }
private void setOrderBtnVisbilityByTxnId(String cancelTxnId, String refundTxnId) {
if (!TextUtils.isEmpty(cancelTxnId)) {
tv_order_status.setText("已取消");
tv_order_status.setVisibility(View.VISIBLE);
ll_bottom.setVisibility(View.GONE);
return;
}
if (!TextUtils.isEmpty(refundTxnId)) {
tv_order_status.setVisibility(View.VISIBLE);
tv_order_status.setText("已退款");
ll_bottom.setVisibility(View.GONE);
return;
}
}
@Override @Override
public void returnOrderDetail(OrderManagerResponse orderDetailItem) { public void returnOrderDetail(OrderManagerResponse orderDetailItem) {
this.mOrderDetailItem = orderDetailItem; this.mOrderDetailItem = orderDetailItem;
......
...@@ -14,7 +14,7 @@ import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; ...@@ -14,7 +14,7 @@ import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.order.commodity.OrderDetail; import com.gingersoft.gsa.cloud.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2; import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.table.mvp.presenter.MealStandPresenter; import com.gingersoft.gsa.cloud.table.mvp.presenter.mealstand.MealStandPresenter;
import com.gingersoft.gsa.cloud.table.mvp.presenter.OrderContentPresenter; import com.gingersoft.gsa.cloud.table.mvp.presenter.OrderContentPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity;
import com.jess.arms.base.BaseHolder; import com.jess.arms.base.BaseHolder;
......
...@@ -13,12 +13,11 @@ import androidx.recyclerview.widget.LinearLayoutManager; ...@@ -13,12 +13,11 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.core.discount.MemberCoupon; import com.gingersoft.gsa.cloud.common.core.discount.MemberCoupon;
import com.gingersoft.gsa.cloud.common.loadsir.LoadsirUtil;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2; import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.table.di.component.DaggerCouponComponent; import com.gingersoft.gsa.cloud.table.di.component.DaggerCouponComponent;
import com.gingersoft.gsa.cloud.table.mvp.contract.CouponContract; import com.gingersoft.gsa.cloud.table.mvp.contract.CouponContract;
import com.gingersoft.gsa.cloud.table.mvp.presenter.CouponPresenter; import com.gingersoft.gsa.cloud.table.mvp.presenter.discount.CouponPresenter;
import com.gingersoft.gsa.cloud.ui.adapter.TagViewAdapter; import com.gingersoft.gsa.cloud.ui.adapter.TagViewAdapter;
import com.gingersoft.gsa.cloud.ui.bean.TagViewItem; import com.gingersoft.gsa.cloud.ui.bean.TagViewItem;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
......
...@@ -56,7 +56,7 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> { ...@@ -56,7 +56,7 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> {
QMUILinearLayout llContainer; QMUILinearLayout llContainer;
private CouponFragment couponFragment; private CouponFragment couponFragment;
private BillDiscountFragment billDiscountFragment; private NomalDiscountFragment billDiscountFragment;
private List<String> mTabTitles = new ArrayList<>(); private List<String> mTabTitles = new ArrayList<>();
private int mCurrentPageIndex = 0; private int mCurrentPageIndex = 0;
...@@ -73,6 +73,7 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> { ...@@ -73,6 +73,7 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> {
@Override @Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
this.getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); this.getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getDialog().setCanceledOnTouchOutside(false);
return inflater.inflate(R.layout.table_dialog_discout, container, false); return inflater.inflate(R.layout.table_dialog_discout, container, false);
} }
...@@ -95,7 +96,6 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> { ...@@ -95,7 +96,6 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> {
int mShadowElevationDp = 14; int mShadowElevationDp = 14;
llContainer.setRadiusAndShadow(15, QMUIDisplayHelper.dp2px(mContext, mShadowElevationDp), mShadowAlpha); llContainer.setRadiusAndShadow(15, QMUIDisplayHelper.dp2px(mContext, mShadowElevationDp), mShadowAlpha);
initTopbar();
initTabAndPager(); initTabAndPager();
} }
...@@ -128,8 +128,8 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> { ...@@ -128,8 +128,8 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> {
if (billDiscountFragment != null) { if (billDiscountFragment != null) {
return billDiscountFragment; return billDiscountFragment;
} }
billDiscountFragment = BillDiscountFragment.newInstance(); billDiscountFragment = NomalDiscountFragment.newInstance();
billDiscountFragment.setOnDiscountItemClickListener(new BillDiscountFragment.OnBillDiscountItemClickListener() { billDiscountFragment.setOnDiscountItemClickListener(new NomalDiscountFragment.OnBillDiscountItemClickListener() {
@Override @Override
public void onItemClick(Discount item, int position) { public void onItemClick(Discount item, int position) {
if (onDiscountItemClickListener != null) { if (onDiscountItemClickListener != null) {
...@@ -195,17 +195,6 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> { ...@@ -195,17 +195,6 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> {
}); });
} }
private void initTopbar() {
// topbar.setBackgroundColor(ContextCompat.getColor(_mActivity, R.color.theme_color));
// if (canScan) {
// topbar.addRightImageButton(R.mipmap.table_white_scan, R.id.topbar_right_change_button)
// .setOnClickListener(v -> {
// _mActivity.onBackPressedSupport();
// });
// }
// topbar.setTitle("折扣");
}
@Override @Override
public boolean onBackPressedSupport() { public boolean onBackPressedSupport() {
return super.onBackPressedSupport(); return super.onBackPressedSupport();
......
...@@ -12,23 +12,19 @@ import androidx.recyclerview.widget.GridLayoutManager; ...@@ -12,23 +12,19 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.database.bean.Discount; import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2; import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.table.di.component.DaggerBillDiscountComponent; import com.gingersoft.gsa.cloud.table.di.component.DaggerBillDiscountComponent;
import com.gingersoft.gsa.cloud.table.mvp.contract.BillDiscountContract; import com.gingersoft.gsa.cloud.table.mvp.contract.NomalDiscountContract;
import com.gingersoft.gsa.cloud.table.mvp.presenter.BillDiscountPresenter; import com.gingersoft.gsa.cloud.table.mvp.presenter.discount.NomalDiscountPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity;
import com.gingersoft.gsa.cloud.ui.adapter.TagViewAdapter; import com.gingersoft.gsa.cloud.ui.adapter.TagViewAdapter;
import com.gingersoft.gsa.cloud.ui.bean.TagViewItem; import com.gingersoft.gsa.cloud.ui.bean.TagViewItem;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseFragment; import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadService; import com.kingja.loadsir.core.LoadService;
import com.kingja.loadsir.core.LoadSir; import com.kingja.loadsir.core.LoadSir;
...@@ -53,7 +49,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull; ...@@ -53,7 +49,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================ * ================================================
*/ */
public class BillDiscountFragment extends BaseFragment<BillDiscountPresenter> implements BillDiscountContract.View { public class NomalDiscountFragment extends BaseFragment<NomalDiscountPresenter> implements NomalDiscountContract.View {
@BindView(R2.id.rv_bill_discount) @BindView(R2.id.rv_bill_discount)
RecyclerView rvBillDiscount; RecyclerView rvBillDiscount;
...@@ -65,8 +61,8 @@ public class BillDiscountFragment extends BaseFragment<BillDiscountPresenter> im ...@@ -65,8 +61,8 @@ public class BillDiscountFragment extends BaseFragment<BillDiscountPresenter> im
private LoadService loadService; private LoadService loadService;
public static BillDiscountFragment newInstance() { public static NomalDiscountFragment newInstance() {
BillDiscountFragment fragment = new BillDiscountFragment(); NomalDiscountFragment fragment = new NomalDiscountFragment();
return fragment; return fragment;
} }
......
package com.gingersoft.gsa.cloud.table.mvp.ui.fragment.mealstand;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.gsa.cloud.common.core.member.MemberInfo;
import com.gingersoft.gsa.cloud.order.order.DoshokuOrder;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.mvp.contract.MealDiscountContract;
import com.gingersoft.gsa.cloud.table.mvp.presenter.mealstand.MealDiscountPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.discount.CouponFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.discount.NomalDiscountFragment;
import com.gingersoft.gsa.cloud.ui.adapter.TabFragmentAdapter;
import com.gingersoft.gsa.cloud.ui.view.MyTableView;
import com.google.android.material.tabs.TabLayout;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.widget.tab.QMUITab;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/17/2021 10:46
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class MealDiscountFragment extends BaseFragment<MealDiscountPresenter> implements MealDiscountContract.View {
@BindView(R.id.tab_segment)
MyTableView tabSegment;
@BindView(R.id.viewPager)
ViewPager viewPager;
@Inject
List<String> mTabTitles;
public static MealDiscountFragment newInstance() {
MealDiscountFragment fragment = new MealDiscountFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerMealDiscountComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_meal_discount, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTabTitles();
initViewPager();
}
private void initTabTitles() {
mTabTitles.add("折扣");
MemberInfo memberInfo = DoshokuOrder.getInstance().getMemberInfo();
if (memberInfo != null) {
mTabTitles.add("優惠券");
}
tabSegment.setTitles(mTabTitles);
}
private void initViewPager() {
List<Fragment> mFragments = new ArrayList<>();
mFragments.add(NomalDiscountFragment.newInstance());
mFragments.add(CouponFragment.newInstance());
//实例化适配器
TabFragmentAdapter mTabFragmentAdapter = new TabFragmentAdapter(getParentFragmentManager(), 1);
//设置加载的Fragment集合
mTabFragmentAdapter.setFragments(mFragments);
//设置Viewpager的适配器
viewPager.setAdapter(mTabFragmentAdapter);
//TabLayout绑定ViewPager
tabSegment.setTitles(mTabTitles).setupWithViewPager(viewPager);
}
@Override
public void setData(@Nullable Object data) {
}
@Override
public void showLoading(String message) {
}
@Override
public void hideLoading() {
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
ArmsUtils.snackbarText(message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.gingersoft.gsa.cloud.ui.view.MyTableView
android:id="@+id/tab_segment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fl_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/meal_layout_food_plate"/>
<include layout="@layout/meal_layout_food_menu"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/scroll_combo"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.gingersoft.gsa.cloud.ui.view.base.NoScrollRecyclerView
android:id="@+id/rv_combo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
android:visibility="visible" />
<com.gingersoft.gsa.cloud.ui.view.base.NoScrollRecyclerView
android:id="@+id/rv_modifier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
android:visibility="visible" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_food_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical" />
<LinearLayout
android:id="@+id/ll_food_group_point"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:visibility="visible" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical" />
</LinearLayout>
<ViewStub
android:id="@+id/vb_combo_modifier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout="@layout/meal_layout_combo_modifier" />
<ViewStub
android:id="@+id/vb_fine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout="@layout/meal_layout_meal_fine" />
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_meals"
android:layout_width="match_parent"
android:layout_height="266dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_meals_main"
android:layout_width="match_parent"
android:layout_height="221dp"
android:layout_weight="1">
<LinearLayout
android:id="@+id/ll_mm"
android:layout_width="55dp"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/btn_table"
android:layout_width="match_parent"
android:layout_height="36dp"
android:background="#336699"
android:text="Button"
android:textColor="@drawable/ui_selector_black_press"
android:textSize="20sp"
android:textStyle="bold" />
<Button
android:id="@+id/btn_numberman"
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="#FF51A933"
android:text="人數:0"
android:textColor="@drawable/ui_selector_white_press" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/theme_white_color"
android:orientation="vertical">
<TextView
android:id="@+id/btn_fid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:background="@drawable/ui_selector_item_background"
android:drawableTop="@drawable/meal_info"
android:drawablePadding="@dimen/dp_1"
android:gravity="center"
android:text="PLU"
android:textAllCaps="false"
android:textColor="@color/theme_black"
android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/btn_meal_delete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:background="@drawable/ui_selector_item_background"
android:drawableTop="@drawable/meal_delete"
android:drawablePadding="@dimen/dp_1"
android:gravity="center"
android:text="刪除"
android:textAllCaps="false"
android:textColor="@color/theme_black"
android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/btn_meal_modify_restore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:background="@drawable/ui_selector_item_background"
android:drawableTop="@drawable/meal_modify_restore"
android:drawablePadding="@dimen/dp_1"
android:gravity="center"
android:text="恢復"
android:textAllCaps="false"
android:textColor="@color/theme_black"
android:textSize="@dimen/sp_12"
android:visibility="gone" />
<TextView
android:id="@+id/btn_meal_discount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:background="@drawable/ui_selector_item_background"
android:drawableTop="@drawable/meal_discount"
android:drawablePadding="@dimen/dp_1"
android:gravity="center"
android:text="折扣"
android:textAllCaps="false"
android:textColor="@color/theme_black"
android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/btn_multiple_selection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:background="@drawable/ui_selector_item_background"
android:drawableTop="@drawable/meal_muleiple_selection"
android:drawablePadding="@dimen/dp_1"
android:gravity="center"
android:text="@string/meal_multiple_selection"
android:textAllCaps="false"
android:textColor="@color/theme_black"
android:textSize="@dimen/sp_12" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_select_meal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_Keys"
android:layout_width="match_parent"
android:layout_height="42dp">
<Button
android:id="@+id/btn_key1"
style="@style/ButtonBorderless"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_1"
android:layout_weight="0.01"
android:background="@drawable/meal_selector_number_keys"
android:tag="1"
android:text="@string/Key_1" />
<Button
android:id="@+id/btn_key2"
style="@style/ButtonBorderless"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_1"
android:layout_weight="0.01"
android:background="@drawable/meal_selector_number_keys"
android:tag="2"
android:text="@string/Key_2" />
<Button
android:id="@+id/btn_key3"
style="@style/ButtonBorderless"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_1"
android:layout_weight="0.01"
android:background="@drawable/meal_selector_number_keys"
android:tag="3"
android:text="@string/Key_3" />
<Button
android:id="@+id/btn_key4"
style="@style/ButtonBorderless"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_1"
android:layout_weight="0.01"
android:background="@drawable/meal_selector_number_keys"
android:tag="4"
android:text="@string/Key_4" />
<Button
android:id="@+id/btn_key5"
style="@style/ButtonBorderless"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_1"
android:layout_weight="0.01"
android:background="@drawable/meal_selector_number_keys"
android:tag="5"
android:text="@string/Key_5" />
<ImageButton
android:id="@+id/btn_keys"
style="@style/ButtonBorderless"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_1"
android:layout_weight="0.00"
android:background="@drawable/meal_selector_number_keys"
android:src="@mipmap/meal_number_key"
android:tag="99" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.gingersoft.gsa.cloud.ui.view.MyTableView
android:id="@+id/tab_fine"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager_fine"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/theme_white_color">
<Chronometer
android:id="@+id/ctime"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="Chronometer" />
<fragment
android:name="com.gingersoft.gsa.cloud.table.mvp.ui.fragment.mealstand.SetMealFragment"
android:id="@+id/fl_food_plate"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<FrameLayout
android:id="@+id/fl_food_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/fl_food_plate"/>
<!-- <include layout="@layout/meal_layout_food_plate"/>-->
<!-- <include layout="@layout/meal_layout_food_menu"/>-->
<!--鍵盤-->
<com.gingersoft.gsa.cloud.ui.view.SearchKeyBoardView
android:id="@+id/meal_stand_search_keyboard_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/ll_stand_oper"
android:layout_below="@+id/ll_meals"
android:visibility="gone" />
<LinearLayout
android:id="@+id/ll_modify"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_45"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:visibility="invisible">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_select_all"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/all_selection"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_anti_selection"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/anti_selection"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_taste"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/taste"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_msg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#7D8888"
android:gravity="center"
android:text="@string/msg"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_delete"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#FF5024"
android:gravity="center"
android:text="@string/remove"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_end"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="@color/Grass_green"
android:gravity="center"
android:text="@string/end"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_stand_oper"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_45"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_no_save_return"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#A0AAB4"
android:gravity="center"
android:text="@string/nosaveexit"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@drawable/ui_selector_white_press"
android:textSize="@dimen/sp_17" />
<FrameLayout
android:id="@+id/fl_order_content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/orange_500">
<Button
android:id="@+id/btn_order_count"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_margin="@dimen/dp_2"
android:background="@drawable/ui_shape_red_oval"
android:singleLine="true"
android:textColor="@color/theme_white_color"
android:visibility="invisible" />
<TextView
android:id="@+id/tv_order_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/meal_btn_order"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@drawable/ui_selector_black_press"
android:textSize="@dimen/sp_17" />
</FrameLayout>
<FrameLayout
android:id="@+id/fl_send_order"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/Grass_green">
<Button
android:id="@+id/btn_send_order"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:gravity="center"
android:text="送單"
android:textColor="@drawable/ui_selector_black_press"
android:textSize="@dimen/sp_17" />
</FrameLayout>
<FrameLayout
android:id="@+id/fl_printer_order"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/blue_500"
android:visibility="gone">
<Button
android:id="@+id/btn_order_printer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:gravity="center"
android:text="@string/meal_print"
android:textColor="@drawable/ui_selector_black_press"
android:textSize="@dimen/sp_17" />
<Button
android:id="@+id/btn_printer_machine_name"
android:layout_width="40dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="@drawable/ui_shape_red_oval"
android:gravity="center"
android:singleLine="true"
android:textColor="@color/theme_white_color"
android:visibility="gone" />
</FrameLayout>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
package com.jess.arms.mvp;
/**
* @作者: bin
* @創建時間: 2021-04-17 12:05
* @更新時間: 2021-04-17 12:05
* @描述:本地模型(与设计图一一对应)
*
*
*/
public class BaseLocalModel {
}
/*
* Copyright 2017 JessYan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jess.arms.mvp;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.OnLifecycleEvent;
import com.jess.arms.integration.IRepositoryManager;
/**
* 基类 Case
*/
public class BaseUseCase implements LifecycleObserver {
public BaseUseCase() {
}
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
void onDestroy(LifecycleOwner owner) {
owner.getLifecycle().removeObserver(this);
}
}
...@@ -72,7 +72,7 @@ public class ArmsUtils { ...@@ -72,7 +72,7 @@ public class ArmsUtils {
* @param res * @param res
*/ */
public static void setViewHintSize(Context context, int size, TextView v, int res) { public static void setViewHintSize(Context context, int size, TextView v, int res) {
SpannableString ss = new SpannableString(getResources(context).getString( SpannableString ss = new SpannableString(getResources().getString(
res)); res));
// 新建一个属性对象,设置文字的大小 // 新建一个属性对象,设置文字的大小
AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true); AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
...@@ -91,29 +91,29 @@ public class ArmsUtils { ...@@ -91,29 +91,29 @@ public class ArmsUtils {
* @return * @return
*/ */
public static int dip2px(Context context, float dpValue) { public static int dip2px(Context context, float dpValue) {
final float scale = getResources(context).getDisplayMetrics().density; final float scale = getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f); return (int) (dpValue * scale + 0.5f);
} }
/** /**
* 获得资源 * 获得资源
*/ */
public static Resources getResources(Context context) { public static Resources getResources() {
return context.getResources(); return Resources.getSystem();
} }
/** /**
* 得到字符数组 * 得到字符数组
*/ */
public static String[] getStringArray(Context context, int id) { public static String[] getStringArray(Context context, int id) {
return getResources(context).getStringArray(id); return getResources().getStringArray(id);
} }
/** /**
* pix转dip * pix转dip
*/ */
public static int pix2dip(Context context, int pix) { public static int pix2dip(Context context, int pix) {
final float densityDpi = getResources(context).getDisplayMetrics().density; final float densityDpi = getResources().getDisplayMetrics().density;
return (int) (pix / densityDpi + 0.5f); return (int) (pix / densityDpi + 0.5f);
} }
...@@ -126,7 +126,7 @@ public class ArmsUtils { ...@@ -126,7 +126,7 @@ public class ArmsUtils {
* @return * @return
*/ */
public static int getDimens(Context context, int id) { public static int getDimens(Context context, int id) {
return (int) getResources(context).getDimension(id); return (int) getResources().getDimension(id);
} }
/** /**
...@@ -137,7 +137,7 @@ public class ArmsUtils { ...@@ -137,7 +137,7 @@ public class ArmsUtils {
* @return * @return
*/ */
public static float getDimens(Context context, String dimenName) { public static float getDimens(Context context, String dimenName) {
return getResources(context).getDimension(getResources(context).getIdentifier(dimenName, "dimen", context.getPackageName())); return getResources().getDimension(getResources().getIdentifier(dimenName, "dimen", context.getPackageName()));
} }
/** /**
...@@ -147,7 +147,7 @@ public class ArmsUtils { ...@@ -147,7 +147,7 @@ public class ArmsUtils {
*/ */
public static String getString(Context context, int stringID) { public static String getString(Context context, int stringID) {
return getResources(context).getString(stringID); return getResources().getString(stringID);
} }
/** /**
...@@ -157,7 +157,7 @@ public class ArmsUtils { ...@@ -157,7 +157,7 @@ public class ArmsUtils {
*/ */
public static String getString(Context context, String strName) { public static String getString(Context context, String strName) {
return getString(context, getResources(context).getIdentifier(strName, "string", context.getPackageName())); return getString(context, getResources().getIdentifier(strName, "string", context.getPackageName()));
} }
/** /**
...@@ -169,7 +169,7 @@ public class ArmsUtils { ...@@ -169,7 +169,7 @@ public class ArmsUtils {
* @return * @return
*/ */
public static <T extends View> T findViewByName(Context context, View view, String viewName) { public static <T extends View> T findViewByName(Context context, View view, String viewName) {
int id = getResources(context).getIdentifier(viewName, "id", context.getPackageName()); int id = getResources().getIdentifier(viewName, "id", context.getPackageName());
T v = (T) view.findViewById(id); T v = (T) view.findViewById(id);
return v; return v;
} }
...@@ -183,7 +183,7 @@ public class ArmsUtils { ...@@ -183,7 +183,7 @@ public class ArmsUtils {
* @return * @return
*/ */
public static <T extends View> T findViewByName(Context context, Activity activity, String viewName) { public static <T extends View> T findViewByName(Context context, Activity activity, String viewName) {
int id = getResources(context).getIdentifier(viewName, "id", context.getPackageName()); int id = getResources().getIdentifier(viewName, "id", context.getPackageName());
T v = (T) activity.findViewById(id); T v = (T) activity.findViewById(id);
return v; return v;
} }
...@@ -195,7 +195,7 @@ public class ArmsUtils { ...@@ -195,7 +195,7 @@ public class ArmsUtils {
* @return * @return
*/ */
public static int findLayout(Context context, String layoutName) { public static int findLayout(Context context, String layoutName) {
int id = getResources(context).getIdentifier(layoutName, "layout", context.getPackageName()); int id = getResources().getIdentifier(layoutName, "layout", context.getPackageName());
return id; return id;
} }
...@@ -258,9 +258,11 @@ public class ArmsUtils { ...@@ -258,9 +258,11 @@ public class ArmsUtils {
* @return * @return
*/ */
public static Drawable getDrawablebyResource(Context context, int rID) { public static Drawable getDrawablebyResource(Context context, int rID) {
return getResources(context).getDrawable(rID); return getResources().getDrawable(rID);
}
public static Drawable getDrawablebyResource(int rID) {
return getResources().getDrawable(rID);
} }
/** /**
* 跳转界面 1 ,通过 {@link AppManager#startActivity(Class)} * 跳转界面 1 ,通过 {@link AppManager#startActivity(Class)}
...@@ -313,7 +315,7 @@ public class ArmsUtils { ...@@ -313,7 +315,7 @@ public class ArmsUtils {
* @return * @return
*/ */
public static int getScreenWidth(Context context) { public static int getScreenWidth(Context context) {
return getResources(context).getDisplayMetrics().widthPixels; return getResources().getDisplayMetrics().widthPixels;
} }
/** /**
...@@ -322,7 +324,7 @@ public class ArmsUtils { ...@@ -322,7 +324,7 @@ public class ArmsUtils {
* @return * @return
*/ */
public static int getScreenHeidth(Context context) { public static int getScreenHeidth(Context context) {
return getResources(context).getDisplayMetrics().heightPixels; return getResources().getDisplayMetrics().heightPixels;
} }
...@@ -330,14 +332,21 @@ public class ArmsUtils { ...@@ -330,14 +332,21 @@ public class ArmsUtils {
* 获得颜色 * 获得颜色
*/ */
public static int getColor(Context context, int rid) { public static int getColor(Context context, int rid) {
return getResources(context).getColor(rid); return getResources().getColor(rid);
}
/**
* 获得颜色
*/
public static int getColor( int rid) {
return getResources().getColor(rid);
} }
/** /**
* 获得颜色 * 获得颜色
*/ */
public static int getColor(Context context, String colorName) { public static int getColor(Context context, String colorName) {
return getColor(context, getResources(context).getIdentifier(colorName, "color", context.getPackageName())); return getColor(context, getResources().getIdentifier(colorName, "color", context.getPackageName()));
} }
/** /**
......
...@@ -292,8 +292,11 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -292,8 +292,11 @@ public class GsaCloudApplication extends BaseApplication {
//System請求地址 //System請求地址
RetrofitUrlManager.getInstance().putDomain("system_url", HttpsConstans.SYSTEM_URL); RetrofitUrlManager.getInstance().putDomain("system_url", HttpsConstans.SYSTEM_URL);
//後台遷移新地址 //後台遷移新地址
RetrofitUrlManager.getInstance().putDomain("new_base_url", HttpsConstans.ricepon_member); RetrofitUrlManager.getInstance().putDomain("new_base_url", HttpsConstans.ricepon_member);
//ricepon_pay請求地址
RetrofitUrlManager.getInstance().putDomain("ricepon_pay", HttpsConstans.ricepon_pay);
//ricepon_wechat請求地址 //ricepon_wechat請求地址
RetrofitUrlManager.getInstance().putDomain("ricepon_wechat", HttpsConstans.ricepon_wechat); RetrofitUrlManager.getInstance().putDomain("ricepon_wechat", HttpsConstans.ricepon_wechat);
//ricepon_order請求地址 //ricepon_order請求地址
......
...@@ -2,16 +2,32 @@ package com.gingersoft.gsa.cloud.common.config.globalconfig.applyOptions; ...@@ -2,16 +2,32 @@ package com.gingersoft.gsa.cloud.common.config.globalconfig.applyOptions;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.common.config.OkHttpConfig; import com.gingersoft.gsa.cloud.common.config.OkHttpConfig;
import com.jess.arms.di.module.ClientModule; import com.jess.arms.di.module.ClientModule;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import me.jessyan.progressmanager.ProgressManager; import me.jessyan.progressmanager.ProgressManager;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager; import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.Cache; import okhttp3.Cache;
import okhttp3.Call;
import okhttp3.Connection;
import okhttp3.Handshake;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
/** /**
* autour: 宁斌 * autour: 宁斌
...@@ -33,5 +49,6 @@ public class MyOkhttpConfiguration implements ClientModule.OkhttpConfiguration { ...@@ -33,5 +49,6 @@ public class MyOkhttpConfiguration implements ClientModule.OkhttpConfiguration {
ProgressManager.getInstance().with(builder); ProgressManager.getInstance().with(builder);
//让 Retrofit 同时支持多个 BaseUrl 以及动态改变 BaseUrl. 详细使用请方法查看 https://github.com/JessYanCoding/RetrofitUrlManager //让 Retrofit 同时支持多个 BaseUrl 以及动态改变 BaseUrl. 详细使用请方法查看 https://github.com/JessYanCoding/RetrofitUrlManager
RetrofitUrlManager.getInstance().with(builder).build(); RetrofitUrlManager.getInstance().with(builder).build();
} }
} }
...@@ -119,22 +119,7 @@ public class MyResponseErrorListener implements ResponseErrorListener { ...@@ -119,22 +119,7 @@ public class MyResponseErrorListener implements ResponseErrorListener {
private void toLoginActivity(Activity context) { private void toLoginActivity(Activity context) {
ArmsUtils.killAll(); ArmsUtils.killAll();
UserContext.newInstance().logOut(); UserContext.newInstance().logOut();
// //清空用戶信息
// GsaCloudApplication.clearMemberInfo();
// //修改登錄狀態
// GsaCloudApplication.isLogin = false;
// //清空堂食訂單信息
// CC.obtainBuilder("Component.Base.Order")
// .setActionName("clearDoshokuOrder")
// .build()
// .call();
// //跳轉登錄頁面
// CC.obtainBuilder(ComponentName.COMPONENT_LOGIN)
// .setActionName(ComponentAction.Login.OPEN_LOGIN)
// .build()
// .call();
showloggedDialog = false; showloggedDialog = false;
context.finish(); context.finish();
} }
......
...@@ -78,6 +78,9 @@ public class HttpsConstans { ...@@ -78,6 +78,9 @@ public class HttpsConstans {
public static String SYSTEM_PATH = "/ricepon-system/api/"; public static String SYSTEM_PATH = "/ricepon-system/api/";
public static String API_RICEPON_MEMBER = "/ricepon-member/api/"; public static String API_RICEPON_MEMBER = "/ricepon-member/api/";
//-------------------------------------------支付-------------------------------------------------------------------------------
public static String PAY_PATH = "/ricepon-pay/api/";
/** /**
* QRCode相關 * QRCode相關
*/ */
...@@ -238,6 +241,7 @@ public class HttpsConstans { ...@@ -238,6 +241,7 @@ public class HttpsConstans {
PRINT_QRCODE_ADDRESS = PRINT_QRCODE_ADDRESS_URL_HK + PRINT_QRCODE_SUFFIX; PRINT_QRCODE_ADDRESS = PRINT_QRCODE_ADDRESS_URL_HK + PRINT_QRCODE_SUFFIX;
break; break;
} }
ricepon_pay = HttpsConstans.ROOT_URL + HttpsConstans.PAY_PATH;
ricepon_wechat = HttpsConstans.ROOT_URL + HttpsConstans.URL_RICEPON_WECHAT; ricepon_wechat = HttpsConstans.ROOT_URL + HttpsConstans.URL_RICEPON_WECHAT;
ricepon_order = HttpsConstans.ROOT_URL + HttpsConstans.URL_RICEPON_ORDER; ricepon_order = HttpsConstans.ROOT_URL + HttpsConstans.URL_RICEPON_ORDER;
member_web_ricepon_gsa = HttpsConstans.ROOT_URL + HttpsConstans.URL_MEMBER_WEB_RICEPON_GSA; member_web_ricepon_gsa = HttpsConstans.ROOT_URL + HttpsConstans.URL_MEMBER_WEB_RICEPON_GSA;
...@@ -250,6 +254,7 @@ public class HttpsConstans { ...@@ -250,6 +254,7 @@ public class HttpsConstans {
// PRINT_QRCODE_ADDRESS = PRINT_QRCODE_ADDRESS_URL_FORMAL + PRINT_QRCODE_SUFFIX; // PRINT_QRCODE_ADDRESS = PRINT_QRCODE_ADDRESS_URL_FORMAL + PRINT_QRCODE_SUFFIX;
} }
public static String ricepon_pay;
public static String ricepon_wechat; public static String ricepon_wechat;
public static String ricepon_order; public static String ricepon_order;
public static String member_web_ricepon_gsa; public static String member_web_ricepon_gsa;
......
package com.gingersoft.gsa.cloud.common.pay;
/**
* @作者: bin
* @創建時間: 2021-04-15 9:58
* @更新時間: 2021-04-15 9:58
* @描述:
*/
public class PayConstans {
public static final int YEDPAY_START_RESULT_CODE = 100;
}
...@@ -20,6 +20,10 @@ public abstract class ErrorHandleSingleSubscriber<T> implements SingleObserver<T ...@@ -20,6 +20,10 @@ public abstract class ErrorHandleSingleSubscriber<T> implements SingleObserver<T
private ErrorHandlerFactory mHandlerFactory; private ErrorHandlerFactory mHandlerFactory;
private LoadService mLoadService; private LoadService mLoadService;
public ErrorHandleSingleSubscriber(RxErrorHandler rxErrorHandler) {
this.mHandlerFactory = rxErrorHandler.getHandlerFactory();
}
public ErrorHandleSingleSubscriber(RxErrorHandler rxErrorHandler, LoadService loadService) { public ErrorHandleSingleSubscriber(RxErrorHandler rxErrorHandler, LoadService loadService) {
this.mHandlerFactory = rxErrorHandler.getHandlerFactory(); this.mHandlerFactory = rxErrorHandler.getHandlerFactory();
this.mLoadService = loadService; this.mLoadService = loadService;
......
package com.gingersoft.gsa.cloud.common.rxjava;
import com.xuexiang.rxutil2.rxjava.RxSchedulerUtils;
import com.xuexiang.rxutil2.rxjava.SchedulerTransformer;
import com.xuexiang.rxutil2.rxjava.scheduler.SchedulerType;
import java.util.concurrent.Executor;
import io.reactivex.Single;
import io.reactivex.SingleTransformer;
import io.reactivex.Scheduler;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* @作者: bin
* @創建時間: 2021-04-17 15:10
* @更新時間: 2021-04-17 15:10
* @描述:自定义Single线程调度器
*/
public class MyRxSchedulerUtils {
public static Scheduler io() {
return io(RxSchedulerUtils.getIOExecutor());
}
public static Scheduler io(Executor executor) {
return executor != null ? Schedulers.from(executor) : Schedulers.io();
}
//==========================Single===========================//
private MyRxSchedulerUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* 回到主线程
*
* @param single 被观察者
*/
public static <T> Single<T> toMain(Single<T> single) {
return single.observeOn(AndroidSchedulers.mainThread());
}
/**
* 回到io线程
*
* @param single 被观察者
*/
public static <T> Single<T> toIo(Single<T> single) {
return single.observeOn(Schedulers.io());
}
/**
* 订阅发生在主线程 ( -> -> main)
* 使用compose操作符
*
* @param <T>
* @return
*/
public static <T> SingleTransformer<T, T> _main_f() {
return new SchedulerTransformer<>(SchedulerType._main);
}
/**
* 订阅发生在io线程 ( -> -> io)
* 使用compose操作符
*
* @param <T>
* @return
*/
public static <T> SingleTransformer<T, T> _io_f() {
return new SchedulerTransformer<>(SchedulerType._io);
}
/**
* 处理在io线程,订阅发生在主线程( -> io -> main)
*
* @param <T>
* @return
*/
public static <T> SingleTransformer<T, T> _io_main_f() {
return new SchedulerTransformer<>(SchedulerType._io_main);
}
/**
* 处理在io线程,订阅也发生在io线程( -> io -> io)
*
* @param <T>
* @return
*/
public static <T> SingleTransformer<T, T> _io_io_f() {
return new SchedulerTransformer<>(SchedulerType._io_io);
}
}
...@@ -10,8 +10,28 @@ import android.os.Build; ...@@ -10,8 +10,28 @@ import android.os.Build;
*/ */
public class AppDevices { public class AppDevices {
/**
* 是不是支付POS設備
*
* @return
*/
public static final boolean isPosPay() {
if (isYedpay()) {
return true;
}
if (isHywebPos()) {
return true;
}
if (isBBPos()) {
return true;
}
return false;
}
/** /**
* 是不是N5設備 * 是不是N5設備
*
* @return * @return
*/ */
public static final boolean isHywebPos() { public static final boolean isHywebPos() {
...@@ -24,6 +44,7 @@ public class AppDevices { ...@@ -24,6 +44,7 @@ public class AppDevices {
/** /**
* 是不是BBPOS設備 * 是不是BBPOS設備
*
* @return * @return
*/ */
public static final boolean isBBPos() { public static final boolean isBBPos() {
...@@ -36,7 +57,21 @@ public class AppDevices { ...@@ -36,7 +57,21 @@ public class AppDevices {
/** /**
* 是不是Yedpay設備
*
* @return
*/
public static final boolean isYedpay() {
String model = Build.MODEL;
if ("Yedpay".contains(model)) {
return true;
}
return false;
}
/**
* 是不是商米設備 * 是不是商米設備
*
* @return * @return
*/ */
public static final boolean isSunmi() { public static final boolean isSunmi() {
......
package com.gingersoft.gsa.cloud.common.utils.okhttpUtils; package com.gingersoft.gsa.cloud.common.utils.okhttpUtils;
import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.core.user.UserContext; import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication; import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
...@@ -12,19 +14,28 @@ import com.jess.arms.utils.DeviceUtils; ...@@ -12,19 +14,28 @@ import com.jess.arms.utils.DeviceUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import okhttp3.Cache; import okhttp3.Cache;
import okhttp3.Call; import okhttp3.Call;
import okhttp3.Callback; import okhttp3.Callback;
import okhttp3.Connection;
import okhttp3.ConnectionPool;
import okhttp3.FormBody; import okhttp3.FormBody;
import okhttp3.Handshake;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.MultipartBody; import okhttp3.MultipartBody;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Tencent is pleased to support the open source community by making QMUI_Android available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/theme_color" android:state_enabled="false"/>
<item android:color="@color/theme_color" android:state_pressed="true"/>
<item android:color="@color/theme_text_color"/>
</selector>
\ No newline at end of file
...@@ -154,7 +154,8 @@ public class SupportActivityDelegate { ...@@ -154,7 +154,8 @@ public class SupportActivityDelegate {
// 获取activeFragment:即从栈顶开始 状态为show的那个Fragment // 获取activeFragment:即从栈顶开始 状态为show的那个Fragment
ISupportFragment activeFragment = SupportHelper.getActiveFragment(getSupportFragmentManager()); ISupportFragment activeFragment = SupportHelper.getActiveFragment(getSupportFragmentManager());
if (mTransactionDelegate.dispatchBackPressedEvent(activeFragment)) return; if (mTransactionDelegate.dispatchBackPressedEvent(activeFragment))
return;
mSupport.onBackPressedSupport(); mSupport.onBackPressedSupport();
} }
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.order" /> package="com.gingersoft.gsa.cloud.order">
<application>
<activity android:name="com.gingersoft.gsa.cloud.pay.lifecycle.activity.PayFlowActivity" />
</application>
</manifest>
package com.gingersoft.gsa.cloud.pay.pos; package com.gingersoft.gsa.cloud.pay;
/** /**
* @作者: bin * @作者: bin
* @創建時間: 2021-04-13 17:44 * @創建時間: 2021-04-14 15:05
* @更新時間: 2021-04-13 17:44 * @更新時間: 2021-04-14 15:05
* @描述: * @描述:
*/ */
public class RealPayPos { public interface Callback<T> {
} }
package com.gingersoft.gsa.cloud.pay;
/**
* @作者: bin
* @創建時間: 2021-04-14 12:28
* @更新時間: 2021-04-14 12:28
* @描述:
*/
public class EventListener {
}
package com.gingersoft.gsa.cloud.pay;
import com.gingersoft.gsa.cloud.common.utils.AppDevices;
import com.gingersoft.gsa.cloud.pay.pos.PosPayAction;
import com.gingersoft.gsa.cloud.pay.pos.bbpos.BBPosManager;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.HywebManager;
import com.gingersoft.gsa.cloud.pay.pos.yedpay.YedpayManager;
/**
* @作者: bin
* @創建時間: 2021-04-14 12:28
* @更新時間: 2021-04-14 12:28
* @描述:
*/
public class OriginFactory {
public static PosPayAction createPayOrigin(RequestParms requestParms) {
if (AppDevices.isHywebPos()) {
return HywebManager.newInstance();
} else if (AppDevices.isBBPos()) {
return BBPosManager.newInstance();
} else if (AppDevices.isYedpay()) {
return YedpayManager.newInstance(requestParms);
}
return YedpayManager.newInstance(requestParms);
}
}
package com.gingersoft.gsa.cloud.pay.pos; package com.gingersoft.gsa.cloud.pay;
import lombok.Getter;
/** /**
* @作者: bin * @作者: bin
...@@ -6,7 +8,8 @@ package com.gingersoft.gsa.cloud.pay.pos; ...@@ -6,7 +8,8 @@ package com.gingersoft.gsa.cloud.pay.pos;
* @更新時間: 2020-12-26 11:24 * @更新時間: 2020-12-26 11:24
* @描述: * @描述:
*/ */
public enum PosAction { @Getter
public enum PayAction {
/** /**
* 支付、退款、取消、補小費、清機、打印 * 支付、退款、取消、補小費、清機、打印
*/ */
...@@ -15,17 +18,29 @@ public enum PosAction { ...@@ -15,17 +18,29 @@ public enum PosAction {
private String actionName; private String actionName;
PosAction(String actionName) { PayAction(String actionName) {
this.actionName = actionName; this.actionName = actionName;
} }
public String getActionName() { public String getLoadingStepText(PayStep status) {
return actionName; switch (status) {
case LOADING:
return actionName + "中...";
case SUCCESS:
return actionName + "成功";
case FAILURE:
return actionName + "失敗";
default:
return "";
}
}
public String getLoadingStepText(String errMsg) {
return actionName+" "+errMsg;
} }
public String getCallbackExceptionText() { public String getCallbackExceptionText() {
return actionName + "回調異常"; return actionName + "回調異常";
} }
} }
package com.gingersoft.gsa.cloud.pay;
import lombok.Getter;
/**
* @作者: bin
* @創建時間: 2021-04-16 10:17
* @更新時間: 2021-04-16 10:17
* @描述:
*/
@Getter
public enum PayStep {
LOADING, SUCCESS, FAILURE
}
package com.gingersoft.gsa.cloud.pay;
import com.gingersoft.gsa.cloud.pay.pos.PosPayAction;
import com.jess.arms.utils.Preconditions;
import lombok.Getter;
/**
* @作者: bin
* @創建時間: 2021-04-15 16:38
* @更新時間: 2021-04-15 16:38
* @描述:
*/
@Getter
public class PaymentControl {
private static PaymentControl sPaymentControl;
public static PaymentControl newInstance() {
if (sPaymentControl == null) {
sPaymentControl = new PaymentControl();
}
return sPaymentControl;
}
private PaymentControl() {
}
public void pay(RequestParms requestParms) {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(requestParms);
Preconditions.checkNotNull(payOrigin);
payOrigin.pay(requestParms);
}
public void tip(RequestParms requestParms) {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(requestParms);
Preconditions.checkNotNull(payOrigin);
payOrigin.tip(requestParms);
}
public void refund(RequestParms requestParms) {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(requestParms);
Preconditions.checkNotNull(payOrigin);
payOrigin.refund(requestParms);
}
public void voidO(RequestParms requestParms) {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(requestParms);
Preconditions.checkNotNull(payOrigin);
payOrigin.void0(this);
}
public void retrieval(RequestParms requestParms) {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(requestParms);
Preconditions.checkNotNull(payOrigin);
payOrigin.retrieval(this);
}
public void printStub(RequestParms requestParms) {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(requestParms);
Preconditions.checkNotNull(payOrigin);
payOrigin.printStub(this);
}
public void settlement(RequestParms requestParms) {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(requestParms);
Preconditions.checkNotNull(payOrigin);
payOrigin.settlement(this);
}
}
package com.gingersoft.gsa.cloud.pay;
import android.content.Context;
import com.gingersoft.gsa.cloud.pay.pos.PosPayAction;
import com.gingersoft.gsa.cloud.pay.pos.bean.BaseBgRequest;
import com.gingersoft.gsa.cloud.pay.pos.bean.BasePosRequest;
import com.gingersoft.gsa.cloud.pay.pos.yedpay.YedpayCallback;
import com.jess.arms.mvp.IView;
import com.jess.arms.utils.Preconditions;
import lombok.Builder;
import lombok.Getter;
/**
* @作者: bin
* @創建時間: 2020-12-26 10:32
* @更新時間: 2020-12-26 10:32
* @描述:
*/
@Builder
@Getter
public final class PosPay {
final Context context;
final IView lifecycleView;
final int payType;
final BasePosRequest posRequest;
final BaseBgRequest bgRequest;
final PayAction retrievalAction;
final Callback callback;
final boolean showLoading;
final long orderId;
final String txnId;
//yedpay所需
final double payMoney;
final YedpayCallback yedpayCallback;
public void pay() {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(null);
Preconditions.checkNotNull(payOrigin);
payOrigin.pay(this);
}
public void tip() {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(null);
Preconditions.checkNotNull(payOrigin);
payOrigin.tip(this);
}
public void refund() {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(null);
Preconditions.checkNotNull(payOrigin);
payOrigin.refund(this);
}
public void voidO() {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(null);
Preconditions.checkNotNull(payOrigin);
payOrigin.void0(this);
}
public void retrieval() {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(null);
Preconditions.checkNotNull(payOrigin);
payOrigin.retrieval(this);
}
public void printStub() {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(null);
Preconditions.checkNotNull(payOrigin);
payOrigin.printStub(this);
}
public void settlement() {
final PosPayAction payOrigin = OriginFactory.createPayOrigin(null);
Preconditions.checkNotNull(payOrigin);
payOrigin.settlement(this);
}
}
package com.gingersoft.gsa.cloud.pay;
import android.os.Parcel;
import android.os.Parcelable;
import com.gingersoft.gsa.cloud.pay.Callback;
import com.gingersoft.gsa.cloud.pay.PayAction;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
/**
* @作者: bin
* @創建時間: 2021-04-15 16:46
* @更新時間: 2021-04-15 16:46
* @描述:
*/
@Data
@Builder
public class RequestParms implements Serializable {
private PayAction action;
private Callback callback;
private ResultCallback resultCallback;
private final int resturantId;
private final int payType;
private final long orderId;
private final double payMoney;
/**
* 退款相关
*/
private final String refundReason;
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel dest, int flags) {
// dest.writeInt(this.payType);
// dest.writeLong(this.orderId);
// dest.writeDouble(this.payMoney);
// }
//
// protected RequestParms(Parcel in) {
// this.payType = in.readInt();
// this.orderId = in.readLong();
// this.payMoney = in.readDouble();
// }
//
// public static final Creator<RequestParms> CREATOR = new Creator<RequestParms>() {
// @Override
// public RequestParms createFromParcel(Parcel source) {
// return new RequestParms(source);
// }
//
// @Override
// public RequestParms[] newArray(int size) {
// return new RequestParms[size];
// }
// };
}
package com.gingersoft.gsa.cloud.pay;
/**
* @作者: bin
* @創建時間: 2021-04-14 15:05
* @更新時間: 2021-04-14 15:05
* @描述:
*/
public interface ResultCallback {
void onSuccess();
void onFailure(Throwable t);
}
package com.gingersoft.gsa.cloud.pay.base;
/**
* @作者: bin
* @創建時間: 2021-04-14 12:02
* @更新時間: 2021-04-14 12:02
* @描述:
*/
public interface BasePayAction<T> {
void pay(T params);
void refund(T params);
}
...@@ -3,7 +3,7 @@ package com.gingersoft.gsa.cloud.pay.bean; ...@@ -3,7 +3,7 @@ package com.gingersoft.gsa.cloud.pay.bean;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import lombok.Data; import lombok.Data;
...@@ -17,7 +17,7 @@ import lombok.Data; ...@@ -17,7 +17,7 @@ import lombok.Data;
public class PosActionStatusExceptionParam implements Parcelable { public class PosActionStatusExceptionParam implements Parcelable {
private String txnId; private String txnId;
private PosAction posAction; private PayAction posAction;
private long orderId; private long orderId;
private String orderNo; private String orderNo;
private double amount; private double amount;
...@@ -45,7 +45,7 @@ public class PosActionStatusExceptionParam implements Parcelable { ...@@ -45,7 +45,7 @@ public class PosActionStatusExceptionParam implements Parcelable {
protected PosActionStatusExceptionParam(Parcel in) { protected PosActionStatusExceptionParam(Parcel in) {
this.txnId = in.readString(); this.txnId = in.readString();
int tmpPosAction = in.readInt(); int tmpPosAction = in.readInt();
this.posAction = tmpPosAction == -1 ? null : PosAction.values()[tmpPosAction]; this.posAction = tmpPosAction == -1 ? null : PayAction.values()[tmpPosAction];
this.orderId = in.readLong(); this.orderId = in.readLong();
this.orderNo = in.readString(); this.orderNo = in.readString();
this.amount = in.readDouble(); this.amount = in.readDouble();
......
package com.gingersoft.gsa.cloud.pay.lifecycle.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.pay.RequestParms;
import com.gingersoft.gsa.cloud.pay.lifecycle.fragment.PayFlowFragment;
import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.mvp.IView;
import com.jess.arms.utils.ArmsUtils;
import me.yokeyword.fragmentation.anim.DefaultHorizontalAnimator;
import me.yokeyword.fragmentation.anim.FragmentAnimator;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/13/2020 14:47
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class PayFlowActivity extends BaseFragmentActivity<BasePresenter> implements IView {
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
// DaggerPayFlowComponent //如找不到该类,请编译一下项目
// .builder()
// .appComponent(appComponent)
// .view(this)
// .build()
// .inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return 0; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
if (findFragment(PayFlowFragment.class) == null) {
RequestParms requestParms = (RequestParms) getIntent().getSerializableExtra("requestParms");
// loadRootFragment(Window.ID_ANDROID_CONTENT, PayFlowFragment.newInstance(requestParms));
PayFlowFragment statusExceptionFragment = PayFlowFragment.newInstance(requestParms);
statusExceptionFragment.show(getSupportFragmentManager(), "PayFlowDialogFragment");
}
}
@Override
public void onBackPressedSupport() {
// 对于 4个类别的主Fragment内的回退back逻辑,已经在其onBackPressedSupport里各自处理了
super.onBackPressedSupport();
}
@Override
public FragmentAnimator onCreateFragmentAnimator() {
// 设置横向(和安卓4.x动画相同)
return new DefaultHorizontalAnimator();
}
@Override
public void initIntent() {
}
@Override
public void initTopBar() {
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
}
@Override
public void hideLoading() {
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
ArmsUtils.makeText(this, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
}
package com.gingersoft.gsa.cloud.pay.lifecycle.case
/**
* @作者: bin
* @創建時間: 2021-04-16 10:05
* @更新時間: 2021-04-16 10:05
* @描述:
*/
class PayFlowCase {
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.pay.lifecycle.contract;
import android.content.Intent;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.pay.PayStep;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import io.reactivex.Single;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/15/2021 14:44
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface PayFlowContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void showStatusLoadingDialog(PayStep status);
void startActivityForResult(Intent intent);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Single<BaseResult> yedPayFindSaleStatus(RequestBody body);
Single<BaseResult> yedPayRefundOrder(RequestBody body);
}
}
package com.gingersoft.gsa.cloud.pay.lifecycle.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.pay.lifecycle.di.module.PayFlowModule;
import com.gingersoft.gsa.cloud.pay.lifecycle.contract.PayFlowContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.gsa.cloud.pay.lifecycle.fragment.PayFlowFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/15/2021 14:44
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = PayFlowModule.class, dependencies = AppComponent.class)
public interface PayFlowComponent {
void inject(PayFlowFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
PayFlowComponent.Builder view(PayFlowContract.View view);
PayFlowComponent.Builder appComponent(AppComponent appComponent);
PayFlowComponent build();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.pay.lifecycle.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.gsa.cloud.pay.lifecycle.contract.PayFlowContract;
import com.gingersoft.gsa.cloud.pay.lifecycle.model.PayFlowModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/15/2021 14:44
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class PayFlowModule {
@Binds
abstract PayFlowContract.Model bindPayFlowModel(PayFlowModel model);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.pay.lifecycle.fragment;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.order.R;
import com.gingersoft.gsa.cloud.order.R2;
import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.PayStep;
import com.gingersoft.gsa.cloud.pay.lifecycle.di.component.DaggerPayFlowComponent;
import com.gingersoft.gsa.cloud.pay.RequestParms;
import com.gingersoft.gsa.cloud.pay.view.customstatus.CustomStatusView;
import com.gingersoft.gsa.cloud.pay.widget.StatusLoadingDialog;
import com.jess.arms.base.BaseDialogFragment;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.gingersoft.gsa.cloud.pay.lifecycle.contract.PayFlowContract;
import com.gingersoft.gsa.cloud.pay.lifecycle.presenter.PayFlowPresenter;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/15/2021 14:44
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class PayFlowFragment extends BaseDialogFragment<PayFlowPresenter> implements PayFlowContract.View {
@BindView(R2.id.ll_container)
LinearLayout ll_container;
@BindView(R2.id.as_status)
CustomStatusView as_status;
@BindView(R2.id.tv_status)
TextView tv_status;
private RequestParms requestParms;
private PayAction action;
private final long mCancelDelayMillis = 2000;
private String mLoadingText = "支付中...";
public static PayFlowFragment newInstance(RequestParms parms) {
PayFlowFragment fragment = new PayFlowFragment();
Bundle bundle = new Bundle();
bundle.putSerializable("requestParms", parms);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerPayFlowComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
getDialog().setCancelable(false);
return inflater.inflate(R.layout.dialog_pay_loading, container, false);
}
@Override
public void onStart() {
super.onStart();
mWindow.setBackgroundDrawable(new ColorDrawable(ArmsUtils.getColor(mContext, R.color.trans)));
// WindowManager.LayoutParams lp = mWindow.getAttributes();
// lp.width = QMUIDisplayHelper.dp2px(mContext,100);
// lp.height = QMUIDisplayHelper.dp2px(mContext,200);
// lp.gravity = Gravity.CENTER;
// lp.windowAnimations = android.R.style.Animation_InputMethod;
// mWindow.setAttributes(lp);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
Bundle arguments = getArguments();
requestParms = (RequestParms) arguments.getSerializable("requestParms");
action = requestParms.getAction();
tv_status.setText(mLoadingText);
ll_container.setLayoutParams(new FrameLayout.LayoutParams((int) (ArmsUtils.getScreenWidth(mContext) * 0.4), (int) (ArmsUtils.getScreenWidth(mContext) * 0.4)));
showStatusLoadingDialog(PayStep.LOADING);
mPresenter.excutePayFlow(requestParms);
}
@Override
public void showStatusLoadingDialog(PayStep status) {
String loadingText = action.getLoadingStepText(status);
setStatusText(loadingText);
switch (status) {
case LOADING:
loadLoading();
break;
case SUCCESS:
loadSuccess();
break;
case FAILURE:
loadFailure();
break;
}
}
public void setStatusText(String text) {
tv_status.setText(text);
}
public void loadLoading() {
as_status.loadLoading();
}
public void loadSuccess() {
as_status.loadSuccess();
}
public void loadFailure() {
as_status.loadFailure();
}
public void clearLoadingAnim() {
if (as_status != null && as_status.getAnimation() != null) {
as_status.clearAnimation();
}
}
@Override
public void setData(@Nullable Object data) {
}
@Override
public void showLoading(String message) {
}
@Override
public void hideLoading() {
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
ArmsUtils.makeText(mContext, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
clearLoadingAnim();
as_status.postDelayed(new Runnable() {
@Override
public void run() {
getDialog().cancel();
}
}, mCancelDelayMillis);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
LoganManager.w_code(TAG, "onActivityResult-》" + "resultCode=" + resultCode + " requestCode=" + requestCode);
if (resultCode == android.app.Activity.RESULT_OK) {
switch (requestCode) {
case 555: {
if (intent.getExtras() != null) {
String status = (String) intent.getExtras().get("status");
String transaction_id = (String) intent.getExtras().get("transaction_id");
LoganManager.w_code(TAG, "onActivityResult-》" + "status=" + status + " transaction_id=" + transaction_id);
mPresenter.yedPayUpdateStatus(transaction_id, requestParms.getOrderId(), requestParms.getPayType(), requestParms.getResturantId());
}
break;
}
}
}
}
@Override
public void startActivityForResult(Intent intent) {
startActivityForResult(intent, 555);
}
}
package com.gingersoft.gsa.cloud.pay.lifecycle.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.pay.lifecycle.model.service.PayFlowService;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.pay.lifecycle.contract.PayFlowContract;
import io.reactivex.Single;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/15/2021 14:44
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class PayFlowModel extends BaseModel implements PayFlowContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public PayFlowModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Single<BaseResult> yedPayFindSaleStatus(RequestBody body) {
return mRepositoryManager.obtainRetrofitService(PayFlowService.class)
.yedPayFindSaleStatus(body);
}
@Override
public Single<BaseResult> yedPayRefundOrder(RequestBody body) {
return mRepositoryManager.obtainRetrofitService(PayFlowService.class)
.yedPayRefundOrder(body);
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.pay.lifecycle.model.bean;
/**
* @作者: bin
* @創建時間: 2021-04-15 18:46
* @更新時間: 2021-04-15 18:46
* @描述:
*/
public class YedPayRefundBean {
}
package com.gingersoft.gsa.cloud.pay.lifecycle.model.bean;
import lombok.Data;
/**
* @作者: bin
* @創建時間: 2021-04-15 18:46
* @更新時間: 2021-04-15 18:46
* @描述:
*/
@Data
public class YedpayFindSaleStatusBean {
/**
* 訂單id
*/
private long orderId = -1L;
/**
* 支付状态:0 未支付 1 支付失败 2 支持成功 3 已支付未到账 4.支付中 5.已退款 6.廢棄(第二次結賬)
*/
private Integer status;
/**
* 交易id
*/
private String transactionId;
/**
* 退款id
*/
private String refundId;
}
package com.gingersoft.gsa.cloud.pay.lifecycle.model.service;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import io.reactivex.Single;
import io.reactivex.Single;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
/**
* Created by Wyh on 2020/1/17.
*/
public interface PayFlowService {
@Headers({"Domain-Name: ricepon_pay"})
@POST("posPay/getTxnId" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> getTxnId(@Query("type") int type, @Query("parm") String parm, @Query("gsposShopId") String shopName, @Query("tableId") int tableId, @Query("tableNumber") String tableNumber);
@Headers({"Domain-Name: ricepon_pay"})
@POST("posPay/getRefundTxnId" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> getRefundTxnId(@Query("tableId") int tableId, @Query("tableNumber") String tableNumber, @Query("memberId") long memberId);
@Headers({"Domain-Name: ricepon_pay"})
@POST("posPay/getCancelTxnId" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> getCancelTxnId(@Query("tableId") int tableId, @Query("tableNumber") String tableNumber, @Query("memberId") long memberId);
@Headers({"Domain-Name: ricepon_pay"})
@POST("orderPay/updatePosRefund" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> updatePosRefund(@Query("tableId") int tableId, @Query("memberId") Long memberId, @Query("couponMemberId") long couponMemberId, @Query("couponNo") String couponNo, @Query("restaurantId") int restaurantId);
@Headers({"Domain-Name: ricepon_pay"})
@POST("member/getMemberWalletList" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> getMemberWalletList(@Query("brandId") int brandId, @Query("memberId") long memberId, @Query("limitType") long limitType, @Query("pageIndex") long pageIndex, @Query("pageSize") long pageSize);
@Headers({"Domain-Name: ricepon_pay"})
@POST("orderPay/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> add(@Query("tableId") int tableId, @Query("tableNumber") String tableNumber, @Query("memberId") long memberId);
@Headers({"Domain-Name: ricepon_pay"})
@POST("posPay/updatePosCancel" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> updatePosCancel(@Query("tableId") int tableId, @Query("tableNumber") String tableNumber, @Query("memberId") long memberId);
@Headers({"Domain-Name: ricepon_pay"})
@POST("gsaYedPay/updatePayStatus" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> yedPayFindSaleStatus(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_pay"})
@POST("gsaYedPay/refund" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Single<BaseResult> yedPayRefundOrder(@Body RequestBody requestBody);
}
package com.gingersoft.gsa.cloud.pay.lifecycle.presenter;
import android.app.Application;
import android.content.Intent;
import android.net.Uri;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.rxjava.ErrorHandleSingleSubscriber;
import com.gingersoft.gsa.cloud.common.utils.AppDevices;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.pay.PayStep;
import com.gingersoft.gsa.cloud.pay.PaymentControl;
import com.gingersoft.gsa.cloud.pay.RequestParms;
import com.gingersoft.gsa.cloud.pay.ResultCallback;
import com.gingersoft.gsa.cloud.pay.lifecycle.model.bean.YedpayFindSaleStatusBean;
import com.gingersoft.gsa.cloud.pay.phone.PhoneCallbackListener;
import com.gingersoft.gsa.cloud.pay.pos.PosPayAction;
import com.gingersoft.gsa.cloud.pay.pos.bbpos.BBposCallback;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.HywebCallback;
import com.gingersoft.gsa.cloud.pay.pos.yedpay.YedpayCallback;
import com.gingersoft.gsa.cloud.pay.pos.yedpay.constant.YedpayConstant;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import okhttp3.FormBody;
import okhttp3.RequestBody;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.pay.lifecycle.contract.PayFlowContract;
import com.jess.arms.utils.RxLifecycleUtils;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/15/2021 14:44
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class PayFlowPresenter extends BasePresenter<PayFlowContract.Model, PayFlowContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
private PosPayAction mPosPayAction;
private RequestParms mRequestParms;
private ResultCallback mResultCallback;
@Inject
public PayFlowPresenter(PayFlowContract.Model model, PayFlowContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void yedPayActivityForResult() {
}
public void yedPayUpdateStatus(String transactionId, long orderId, int payType, int restaurantId) {
RequestBody requestBody = new FormBody.Builder()
.add("transactionId", transactionId)
.add("orderId", orderId + "")
.add("payType", payType + "")
.add("restaurantId", restaurantId + "")
.build();
mModel.yedPayFindSaleStatus(requestBody)
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSingleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onSuccess(BaseResult result) {
if (result.isSuccess()) {
YedpayFindSaleStatusBean saleStatusBean = GsonUtils.GsonToBean(result.getData(), YedpayFindSaleStatusBean.class);
if (saleStatusBean != null) {
if (saleStatusBean.getStatus() == YedpayConstant.Status.PAY_STATUS_0) {
mRootView.showStatusLoadingDialog(PayStep.SUCCESS);
if (mResultCallback != null) {
mResultCallback.onSuccess();
}
} else {
mRootView.showStatusLoadingDialog(PayStep.FAILURE);
if (mResultCallback != null) {
mResultCallback.onFailure(null);
}
}
} else {
mRootView.showStatusLoadingDialog(PayStep.FAILURE);
if (mResultCallback != null) {
mResultCallback.onFailure(null);
}
}
} else {
mRootView.showStatusLoadingDialog(PayStep.FAILURE);
mRootView.showMessage(result.getErrMsg());
if (mResultCallback != null) {
mResultCallback.onFailure(null);
}
}
mRootView.killMyself();
}
@Override
public void onError(Throwable t) {
super.onError(t);
if (mResultCallback != null) {
mResultCallback.onFailure(t);
}
mRootView.killMyself();
}
});
}
public void yedPayRefundOrder(String refundReason, long orderId, int payType, int restaurantId) {
RequestBody requestBody = new FormBody.Builder()
.add("refundReason", refundReason)
.add("orderId", String.valueOf(orderId))
.add("payType", String.valueOf(payType))
.add("restaurantId", String.valueOf(restaurantId))
.build();
mModel.yedPayRefundOrder(requestBody)
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSingleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onSuccess(BaseResult result) {
if (result.isSuccess()) {
mRootView.showStatusLoadingDialog(PayStep.SUCCESS);
if (mResultCallback != null) {
mResultCallback.onSuccess();
}
} else {
mRootView.showStatusLoadingDialog(PayStep.FAILURE);
if (mResultCallback != null) {
mResultCallback.onFailure(null);
}
}
}
});
}
public void excutePayFlow(RequestParms requestParms) {
this.mRequestParms = requestParms;
this.mResultCallback = mRequestParms.getResultCallback();
setCallbackBy(requestParms);
switch (requestParms.getAction()) {
case SALE:
PaymentControl.newInstance().pay(requestParms);
break;
case REFUND:
PaymentControl.newInstance().refund(requestParms);
break;
}
}
private void setCallbackBy(RequestParms requestParms) {
if (AppDevices.isHywebPos()) {
requestParms.setCallback(hywebCallback);
} else if (AppDevices.isBBPos()) {
requestParms.setCallback(bBposCallback);
} else if (AppDevices.isYedpay()) {
requestParms.setCallback(yedpayCallback);
} else {
requestParms.setCallback(yedpayCallback);
}
}
private HywebCallback hywebCallback = new HywebCallback() {
};
private YedpayCallback yedpayCallback = new YedpayCallback() {
@Override
public void callSaleUri(String uri) {
if (mRootView != null) {
Uri uri2 = Uri.parse(uri);
Intent intent = new Intent(Intent.ACTION_VIEW, uri2);
mRootView.startActivityForResult(intent);
}
}
@Override
public void refundResult(boolean result) {
yedPayRefundOrder(mRequestParms.getRefundReason(), mRequestParms.getOrderId(), mRequestParms.getPayType(), mRequestParms.getResturantId());
}
};
private BBposCallback bBposCallback = new BBposCallback() {
};
private PhoneCallbackListener phoneCallbackListener = new PhoneCallbackListener() {
@Override
public void onSuccess(Object response) {
}
@Override
public void onException(Object response, Exception e) {
}
};
}
package com.gingersoft.gsa.cloud.pay.phone;
import com.gingersoft.gsa.cloud.pay.Callback;
import com.gingersoft.gsa.cloud.pay.pos.bean.BasePosResponse;
/**
* @作者: bin
* @創建時間: 2021-04-15 17:18
* @更新時間: 2021-04-15 17:18
* @描述:
*/
public interface PhoneCallbackListener <T> extends Callback<T> {
/**
* 支付
* @param response
*/
void onSuccess(T response);
/**
* 支付失败
* @param response
* @param e
*/
void onException(T response,Exception e);
}
package com.gingersoft.gsa.cloud.pay.phone;
import com.gingersoft.gsa.cloud.pay.base.BasePayAction;
/**
* @作者: bin
* @創建時間: 2021-04-14 12:10
* @更新時間: 2021-04-14 12:10
* @描述:
*/
public interface PhonePayAction<T> extends BasePayAction<T> {
void printStub(T params);
}
package com.gingersoft.gsa.cloud.pay.phone;
/**
* @作者: bin
* @創建時間: 2021-04-14 12:10
* @更新時間: 2021-04-14 12:10
* @描述:
*/
public class PhonePayActionImp implements PhonePayAction {
@Override
public void pay(Object params) {
}
@Override
public void refund(Object params) {
}
@Override
public void printStub(Object params) {
}
}
package com.gingersoft.gsa.cloud.pay.pos;
import android.content.Context;
import com.etps.aca.lib.activity.CommandActivity;
import com.gingersoft.gsa.cloud.pay.pos.bean.BaseBgRequest;
import com.gingersoft.gsa.cloud.pay.pos.bean.BasePosRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.bg.GetTxnIdRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.RetrievalRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.SaleRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.command.CommandImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.IHywebAction;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.PrintPaymentStubImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.RefundActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.RetrievalActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.SaleActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.SettlementActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.TipsActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.VoidActionImpl;
import com.jess.arms.mvp.IView;
import lombok.Builder;
import okhttp3.internal.ws.RealWebSocket;
/**
* @作者: bin
* @創建時間: 2020-12-26 10:32
* @更新時間: 2020-12-26 10:32
* @描述:
*/
@Builder
public final class PosPay {
final Context context;
final IView lifecycleView;
final BasePosRequest posRequest;
final BaseBgRequest bgRequest;
final PosAction retrievalAction;
final OnPosActionListener onPosActionListener;
final boolean showLoading;
public static void sendRequest(IHywebAction action) {
CommandActivity.setCommand(new CommandImpl(action));
// if (AppDevice.isHywebPos()) {
if (action != null) {
action.onPosActionBefore();
}
// } else if (AppDevice.isBBPos()) {
// } else {
// }
}
public void pay() {
PosPay.sendRequest(new SaleActionImpl(context, lifecycleView, PosAction.SALE, (SaleRequest) posRequest, (GetTxnIdRequest) bgRequest, onPosActionListener, true));
}
public void tip() {
PosPay.sendRequest(new TipsActionImpl(context, lifecycleView, PosAction.TIP, txnIdRequest, tipRequest, onPosActionListener, true));
}
public void refund() {
PosPay.sendRequest(new RefundActionImpl(context, lifecycleView, PosAction.REFUND, request, getTxnIdRequest, onPosActionListener, true));
}
public void voidO() {
PosPay.sendRequest(new VoidActionImpl(context, lifecycleView, PosAction.VOID, request, getTxnIdRequest, onPosActionListener, true));
}
public static void retrieval(Context context, IView lifecycleView, Long orderId, PosAction retrievalAction, RetrievalRequest request, OnPosActionListener onPosActionListener) {
PosPay.sendRequest(new RetrievalActionImpl(context, lifecycleView, PosAction.RETRIEVAL, retrievalAction, orderId, request, onPosActionListener, false));
}
public void printStub() {
PosPay.sendRequest(new PrintPaymentStubImpl(context, lifecycleView, PosAction.PRINT, txnId, onPosActionListener, true));
}
public void settlement() {
PosPay.sendRequest(new SettlementActionImpl(context, lifecycleView, PosAction.SETTLEMENT, onPosActionListener, true));
}
}
package com.gingersoft.gsa.cloud.pay.pos;
import com.gingersoft.gsa.cloud.pay.base.BasePayAction;
/**
* @作者: bin
* @創建時間: 2021-04-14 12:06
* @更新時間: 2021-04-14 12:06
* @描述:
*/
public interface PosPayAction<T> extends BasePayAction<T> {
void void0(T params);
void tip(T params);
void retrieval(T params);
void printStub(T params);
void settlement(T params);
}
package com.gingersoft.gsa.cloud.pay.pos.bbpos;
import com.gingersoft.gsa.cloud.pay.pos.PosPayAction;
/**
* @作者: bin
* @創建時間: 2021-04-14 12:08
* @更新時間: 2021-04-14 12:08
* @描述:
*/
public class BBPosManager implements PosPayAction {
private static BBPosManager sBBPosManager;
public static BBPosManager newInstance() {
if (sBBPosManager == null) {
sBBPosManager = new BBPosManager();
}
return sBBPosManager;
}
private BBPosManager() {
}
@Override
public void void0(Object params) {
}
@Override
public void tip(Object params) {
}
@Override
public void retrieval(Object params) {
}
@Override
public void printStub(Object params) {
}
@Override
public void settlement(Object params) {
}
@Override
public void pay(Object params) {
}
@Override
public void refund(Object params) {
}
}
package com.gingersoft.gsa.cloud.pay.pos.bbpos;
import com.gingersoft.gsa.cloud.pay.Callback;
/**
* @作者: bin
* @創建時間: 2021-04-15 9:50
* @更新時間: 2021-04-15 9:50
* @描述:
*/
public interface BBposCallback extends Callback {
}
package com.gingersoft.gsa.cloud.pay.pos.hyweb;
import android.content.Intent;
import com.gingersoft.gsa.cloud.pay.Callback;
/**
* @作者: bin
* @創建時間: 2021-04-15 9:50
* @更新時間: 2021-04-15 9:50
* @描述:
*/
public interface HywebCallback extends Callback {
}
package com.gingersoft.gsa.cloud.pay.pos.hyweb;
import com.gingersoft.gsa.cloud.pay.PosPay;
import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.PosPayAction;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.bg.GetTxnIdRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.AdjustTipRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.RefundRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.RetrievalRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.SaleRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.VoidRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.PrintPaymentStubImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.RefundActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.RetrievalActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.SaleActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.SettlementActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.TipsActionImpl;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.VoidActionImpl;
/**
* @作者: bin
* @創建時間: 2021-04-14 12:08
* @更新時間: 2021-04-14 12:08
* @描述:
*/
public class HywebManager implements PosPayAction<PosPay> {
private static HywebManager sHywebManager;
public static HywebManager newInstance() {
if (sHywebManager == null) {
sHywebManager = new HywebManager();
}
return sHywebManager;
}
private HywebManager() {
}
@Override
public void void0(PosPay posPay) {
new VoidActionImpl(posPay.getContext(), posPay.getLifecycleView(), PayAction.VOID,
(VoidRequest) posPay.getPosRequest(),
(GetTxnIdRequest) posPay.getBgRequest(), (PosCallbackListener) (PosCallbackListener) posPay.getCallback(), true)
.onPosActionBefore();
}
@Override
public void tip(PosPay posPay) {
new TipsActionImpl(posPay.getContext(), posPay.getLifecycleView(), PayAction.TIP, (GetTxnIdRequest) posPay.getBgRequest(),
(AdjustTipRequest) posPay.getPosRequest(), (PosCallbackListener) posPay.getCallback(), true)
.onPosActionBefore();
}
@Override
public void retrieval(PosPay posPay) {
new RetrievalActionImpl(posPay.getContext(), posPay.getLifecycleView(), PayAction.RETRIEVAL, posPay.getRetrievalAction(), posPay.getOrderId(),
(RetrievalRequest) posPay.getPosRequest(), (PosCallbackListener) posPay.getCallback(), false);
}
@Override
public void printStub(PosPay posPay) {
new PrintPaymentStubImpl(posPay.getContext(), posPay.getLifecycleView(), PayAction.PRINT, posPay.getTxnId(),
(PosCallbackListener) posPay.getCallback(), true)
.onPosActionBefore();
}
@Override
public void settlement(PosPay posPay) {
new SettlementActionImpl(posPay.getContext(), posPay.getLifecycleView(), PayAction.SETTLEMENT, (PosCallbackListener) posPay.getCallback(), true)
.onPosActionBefore();
}
@Override
public void pay(PosPay posPay) {
new SaleActionImpl(posPay.getContext(), posPay.getLifecycleView(), PayAction.SALE, (SaleRequest) posPay.getPosRequest(),
(GetTxnIdRequest) posPay.getBgRequest(), (PosCallbackListener) posPay.getCallback(), true)
.onPosActionBefore();
}
@Override
public void refund(PosPay posPay) {
new RefundActionImpl(posPay.getContext(), posPay.getLifecycleView(), PayAction.REFUND, (RefundRequest) posPay.getPosRequest(),
(GetTxnIdRequest) posPay.getBgRequest(), (PosCallbackListener) posPay.getCallback(), true)
.onPosActionBefore();
}
}
package com.gingersoft.gsa.cloud.pay.pos; package com.gingersoft.gsa.cloud.pay.pos.hyweb;
import com.gingersoft.gsa.cloud.pay.Callback;
import com.gingersoft.gsa.cloud.pay.pos.bean.BasePosResponse; import com.gingersoft.gsa.cloud.pay.pos.bean.BasePosResponse;
/** /**
...@@ -8,7 +10,7 @@ import com.gingersoft.gsa.cloud.pay.pos.bean.BasePosResponse; ...@@ -8,7 +10,7 @@ import com.gingersoft.gsa.cloud.pay.pos.bean.BasePosResponse;
* @更新時間: 2020-12-29 20:15 * @更新時間: 2020-12-29 20:15
* @描述:POS事件回調 * @描述:POS事件回調
*/ */
public interface OnPosActionListener<T extends BasePosResponse> { public interface PosCallbackListener<T extends BasePosResponse> extends Callback<BasePosResponse> {
/** /**
* 回調成功 * 回調成功
...@@ -40,4 +42,8 @@ public interface OnPosActionListener<T extends BasePosResponse> { ...@@ -40,4 +42,8 @@ public interface OnPosActionListener<T extends BasePosResponse> {
* @param e * @param e
*/ */
void onUpdateStatusError(Throwable e); void onUpdateStatusError(Throwable e);
} }
...@@ -16,7 +16,7 @@ import com.gingersoft.gsa.cloud.component.ComponentAction; ...@@ -16,7 +16,7 @@ import com.gingersoft.gsa.cloud.component.ComponentAction;
import com.gingersoft.gsa.cloud.component.ComponentName; import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode; import com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.IHywebAction; import com.gingersoft.gsa.cloud.pay.pos.hyweb.imp.IHywebAction;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.AdjustTipRespose; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.AdjustTipRespose;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.HywebPosResponse; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.HywebPosResponse;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.PrintPaymentStubResponse; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.PrintPaymentStubResponse;
...@@ -170,21 +170,21 @@ public class CommandImpl implements ICommand { ...@@ -170,21 +170,21 @@ public class CommandImpl implements ICommand {
return null; return null;
} }
private HywebPosResponse returnErrorPosActionResponse(PosAction posAction,String errorStatus){ private HywebPosResponse returnErrorPosActionResponse(PayAction posAction, String errorStatus){
HywebPosResponse posResponse; HywebPosResponse posResponse;
if(posAction == PosAction.SALE){ if(posAction == PayAction.SALE){
posResponse = new SaleRespose(); posResponse = new SaleRespose();
}else if(posAction == PosAction.VOID){ }else if(posAction == PayAction.VOID){
posResponse = new VoidRespose(); posResponse = new VoidRespose();
}else if(posAction == PosAction.REFUND){ }else if(posAction == PayAction.REFUND){
posResponse = new RefundRespose(); posResponse = new RefundRespose();
}else if(posAction == PosAction.PRINT){ }else if(posAction == PayAction.PRINT){
posResponse = new PrintPaymentStubResponse(); posResponse = new PrintPaymentStubResponse();
}else if(posAction == PosAction.TIP){ }else if(posAction == PayAction.TIP){
posResponse = new AdjustTipRespose(); posResponse = new AdjustTipRespose();
}else if(posAction == PosAction.RETRIEVAL){ }else if(posAction == PayAction.RETRIEVAL){
posResponse = new RetrievalRespose(); posResponse = new RetrievalRespose();
}else if(posAction == PosAction.SETTLEMENT){ }else if(posAction == PayAction.SETTLEMENT){
posResponse = new SettlementRespose(); posResponse = new SettlementRespose();
}else{ }else{
posResponse = new HywebPosResponse(); posResponse = new HywebPosResponse();
......
...@@ -6,7 +6,7 @@ package com.gingersoft.gsa.cloud.pay.pos.hyweb.constant; ...@@ -6,7 +6,7 @@ package com.gingersoft.gsa.cloud.pay.pos.hyweb.constant;
* @更新時間: 2020-12-24 9:42 * @更新時間: 2020-12-24 9:42
* @描述: * @描述:
*/ */
public interface PayMethodConstant { public interface HywebMethodConstant {
/** /**
* 支付申请清单 * 支付申请清单
......
...@@ -4,8 +4,8 @@ import android.app.Activity; ...@@ -4,8 +4,8 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import com.etps.aca.lib.util.CommandUtil; import com.etps.aca.lib.util.CommandUtil;
import com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener; import com.gingersoft.gsa.cloud.pay.pos.hyweb.PosCallbackListener;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter; import com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.HywebPosResponse; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.HywebPosResponse;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.constant.HywebActionStatusCode; import com.gingersoft.gsa.cloud.pay.pos.hyweb.constant.HywebActionStatusCode;
...@@ -25,8 +25,8 @@ public abstract class IHywebAction<T extends HywebPosResponse> { ...@@ -25,8 +25,8 @@ public abstract class IHywebAction<T extends HywebPosResponse> {
protected final String TAG = this.getClass().getSimpleName(); protected final String TAG = this.getClass().getSimpleName();
protected Context mContext; protected Context mContext;
protected IView mView; protected IView mView;
protected PosAction mPosAction; protected PayAction mPosAction;
protected OnPosActionListener mOnPosActionListener; protected PosCallbackListener mOnPosActionListener;
protected StatusLoadingDialog mStatusLoadingDialog; protected StatusLoadingDialog mStatusLoadingDialog;
...@@ -35,7 +35,7 @@ public abstract class IHywebAction<T extends HywebPosResponse> { ...@@ -35,7 +35,7 @@ public abstract class IHywebAction<T extends HywebPosResponse> {
private final long mCancelDelayMillis = 2000; private final long mCancelDelayMillis = 2000;
public IHywebAction(Context context, IView iView, PosAction action, boolean showLoading) { public IHywebAction(Context context, IView iView, PayAction action, boolean showLoading) {
this.mContext = context; this.mContext = context;
this.mView = iView; this.mView = iView;
this.mPosAction = action; this.mPosAction = action;
...@@ -45,14 +45,14 @@ public abstract class IHywebAction<T extends HywebPosResponse> { ...@@ -45,14 +45,14 @@ public abstract class IHywebAction<T extends HywebPosResponse> {
} }
} }
public PosAction getPosAction() { public PayAction getPosAction() {
return mPosAction; return mPosAction;
} }
/** /**
* 對POS幾發起操作前的業務處理,如將操作記錄添加到後台日誌表,事項表 * 對POS幾發起操作前的業務處理,如將操作記錄添加到後台日誌表,事項表
*/ */
protected abstract void onPosActionBefore(); public abstract void onPosActionBefore();
/** /**
......
...@@ -4,8 +4,8 @@ import android.app.Activity; ...@@ -4,8 +4,8 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener; import com.gingersoft.gsa.cloud.pay.pos.hyweb.PosCallbackListener;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.PrintPaymentStubRequest; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.PrintPaymentStubRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.HywebPosResponse; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.HywebPosResponse;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
...@@ -20,14 +20,14 @@ public class PrintPaymentStubImpl extends IHywebAction { ...@@ -20,14 +20,14 @@ public class PrintPaymentStubImpl extends IHywebAction {
private String mTxnId; private String mTxnId;
public PrintPaymentStubImpl(Context context, IView iView, PosAction action, String txnId, OnPosActionListener onPosActionListener, boolean showLoading) { public PrintPaymentStubImpl(Context context, IView iView, PayAction action, String txnId, PosCallbackListener onPosActionListener, boolean showLoading) {
super(context, iView, action, showLoading); super(context, iView, action, showLoading);
this.mTxnId = txnId; this.mTxnId = txnId;
this.mOnPosActionListener = onPosActionListener; this.mOnPosActionListener = onPosActionListener;
} }
@Override @Override
protected void onPosActionBefore() { public void onPosActionBefore() {
//打印存根 //打印存根
PrintPaymentStubRequest stub = new PrintPaymentStubRequest(); PrintPaymentStubRequest stub = new PrintPaymentStubRequest();
stub.setTXN_ID(mTxnId); stub.setTXN_ID(mTxnId);
......
...@@ -10,8 +10,8 @@ import com.gingersoft.gsa.cloud.common.logan.LoganManager; ...@@ -10,8 +10,8 @@ import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils; import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode; import com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode;
import com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener; import com.gingersoft.gsa.cloud.pay.pos.hyweb.PosCallbackListener;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter; import com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.bg.GetTxnIdRequest; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.bg.GetTxnIdRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.RefundRequest; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.RefundRequest;
...@@ -40,7 +40,7 @@ public class RefundActionImpl extends IHywebAction<RefundRespose> { ...@@ -40,7 +40,7 @@ public class RefundActionImpl extends IHywebAction<RefundRespose> {
private RefundRequest mRefundRequest; private RefundRequest mRefundRequest;
public RefundActionImpl(Context context, IView iView, PosAction action, RefundRequest refundRequest, GetTxnIdRequest getTxnIdRequest, OnPosActionListener onPosActionListener, boolean showLoading) { public RefundActionImpl(Context context, IView iView, PayAction action, RefundRequest refundRequest, GetTxnIdRequest getTxnIdRequest, PosCallbackListener onPosActionListener, boolean showLoading) {
super(context, iView, action, showLoading); super(context, iView, action, showLoading);
this.mRefundRequest = refundRequest; this.mRefundRequest = refundRequest;
this.mGetTxnIdRequest = getTxnIdRequest; this.mGetTxnIdRequest = getTxnIdRequest;
...@@ -48,7 +48,7 @@ public class RefundActionImpl extends IHywebAction<RefundRespose> { ...@@ -48,7 +48,7 @@ public class RefundActionImpl extends IHywebAction<RefundRespose> {
} }
@Override @Override
protected void onPosActionBefore() { public void onPosActionBefore() {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(mGetTxnIdRequest)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(mGetTxnIdRequest));
String json = GsonUtils.GsonString(mGetTxnIdRequest); String json = GsonUtils.GsonString(mGetTxnIdRequest);
......
...@@ -12,8 +12,8 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; ...@@ -12,8 +12,8 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils; import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest; import com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest;
import com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode; import com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode;
import com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener; import com.gingersoft.gsa.cloud.pay.pos.hyweb.PosCallbackListener;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter; import com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.RetrievalRequest; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.RetrievalRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.RetrievalRespose; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.response.pos.RetrievalRespose;
...@@ -38,9 +38,9 @@ public class RetrievalActionImpl extends IHywebAction<RetrievalRespose> { ...@@ -38,9 +38,9 @@ public class RetrievalActionImpl extends IHywebAction<RetrievalRespose> {
private RetrievalRequest mRetrievalRequest; private RetrievalRequest mRetrievalRequest;
private Long mOrderId; private Long mOrderId;
private PosAction mRetrievalAction; private PayAction mRetrievalAction;
public RetrievalActionImpl(Context context, IView iView, PosAction action, PosAction retrievalAction, Long orderId, RetrievalRequest request, OnPosActionListener onPosActionListener, boolean showLoading) { public RetrievalActionImpl(Context context, IView iView, PayAction action, PayAction retrievalAction, Long orderId, RetrievalRequest request, PosCallbackListener onPosActionListener, boolean showLoading) {
super(context, iView, action, showLoading); super(context, iView, action, showLoading);
this.mOrderId = orderId; this.mOrderId = orderId;
this.mRetrievalRequest = request; this.mRetrievalRequest = request;
...@@ -49,7 +49,7 @@ public class RetrievalActionImpl extends IHywebAction<RetrievalRespose> { ...@@ -49,7 +49,7 @@ public class RetrievalActionImpl extends IHywebAction<RetrievalRespose> {
} }
@Override @Override
protected void onPosActionBefore() { public void onPosActionBefore() {
//調起N5狀態查詢 //調起N5狀態查詢
onPosToAction(GsonUtils.GsonString(mRetrievalRequest)); onPosToAction(GsonUtils.GsonString(mRetrievalRequest));
} }
...@@ -84,11 +84,11 @@ public class RetrievalActionImpl extends IHywebAction<RetrievalRespose> { ...@@ -84,11 +84,11 @@ public class RetrievalActionImpl extends IHywebAction<RetrievalRespose> {
RequestBody requestBody; RequestBody requestBody;
switch (response.getTXN_TYPE()) { switch (response.getTXN_TYPE()) {
case Constant.EVENT.NAME.SALE: case Constant.EVENT.NAME.SALE:
if (mRetrievalAction == PosAction.TIP) { if (mRetrievalAction == PayAction.TIP) {
//更新贴士狀態 //更新贴士狀態
url = "posPay/updatePosTip"; url = "posPay/updatePosTip";
requestBody = getPosMatterTipsRequest(response); requestBody = getPosMatterTipsRequest(response);
} else if (mRetrievalAction == PosAction.VOID) { } else if (mRetrievalAction == PayAction.VOID) {
//更新取消狀態 //更新取消狀態
url = "posPay/updatePosCancel"; url = "posPay/updatePosCancel";
requestBody = getPosMatterVoidRequest(response); requestBody = getPosMatterVoidRequest(response);
......
...@@ -15,8 +15,8 @@ import com.gingersoft.gsa.cloud.component.ComponentName; ...@@ -15,8 +15,8 @@ import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.order.bean.event.MealPayResultParam; import com.gingersoft.gsa.cloud.order.bean.event.MealPayResultParam;
import com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest; import com.gingersoft.gsa.cloud.order.bean.request.MealOrderPayRequest;
import com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode; import com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode;
import com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener; import com.gingersoft.gsa.cloud.pay.pos.hyweb.PosCallbackListener;
import com.gingersoft.gsa.cloud.pay.pos.PosAction; import com.gingersoft.gsa.cloud.pay.PayAction;
import com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter; import com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.bg.GetTxnIdRequest; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.bg.GetTxnIdRequest;
import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.SaleRequest; import com.gingersoft.gsa.cloud.pay.pos.hyweb.bean.request.pos.SaleRequest;
...@@ -50,7 +50,7 @@ public class SaleActionImpl extends IHywebAction<SaleRespose> { ...@@ -50,7 +50,7 @@ public class SaleActionImpl extends IHywebAction<SaleRespose> {
private GetTxnIdRequest mTxnIdRequest; private GetTxnIdRequest mTxnIdRequest;
private GetTxnIdResponse mTxnIdResponse; private GetTxnIdResponse mTxnIdResponse;
public SaleActionImpl(Context context, IView iView, PosAction action, SaleRequest saleRequest, GetTxnIdRequest getTxnIdRequest, OnPosActionListener onPosActionListener, boolean showLoading) { public SaleActionImpl(Context context, IView iView, PayAction action, SaleRequest saleRequest, GetTxnIdRequest getTxnIdRequest, PosCallbackListener onPosActionListener, boolean showLoading) {
super(context, iView, action, showLoading); super(context, iView, action, showLoading);
this.mSaleRequest = saleRequest; this.mSaleRequest = saleRequest;
this.mTxnIdRequest = getTxnIdRequest; this.mTxnIdRequest = getTxnIdRequest;
...@@ -72,7 +72,7 @@ public class SaleActionImpl extends IHywebAction<SaleRespose> { ...@@ -72,7 +72,7 @@ public class SaleActionImpl extends IHywebAction<SaleRespose> {
} }
@Override @Override
protected void onPosActionBefore() { public void onPosActionBefore() {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(mTxnIdRequest)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(mTxnIdRequest));
String json = GsonUtils.GsonString(mTxnIdRequest); String json = GsonUtils.GsonString(mTxnIdRequest);
......
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