Commit 1385fdee by Wyh

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	base-module/src/main/java/com/gingersoft/gsa/cloud/function/FunctionManager.java
#	base-module/src/main/res/values/ids.xml
#	login-module/src/main/java/com/gingersoft/gsa/cloud/login/mvp/presenter/BaseLoginPresenter.java
parents eb12ef4f 649170bf
......@@ -15,6 +15,7 @@
*/
package com.jess.arms.base;
import android.app.Application;
import android.content.Context;
import com.jess.arms.base.delegate.AppDelegate;
......@@ -37,7 +38,7 @@ import androidx.multidex.MultiDexApplication;
* <a href="https://github.com/JessYanCoding">Follow me</a>
* ================================================
*/
public class BaseApplication extends MultiDexApplication implements App {
public class BaseApplication extends Application implements App {
private AppLifecycles mAppDelegate;
/**
......
......@@ -63,7 +63,17 @@ dependencies {
implementation files('libs/javabase64-1.2.jar')
implementation files('libs/sun.misc.BASE64Decoder.jar')
api files('libs/nexgon5lib.jar')
if (project.ext.runAsApp) {
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
debugImplementation rootProject.ext.dependencies["canary-debug"]
releaseImplementation rootProject.ext.dependencies["canary-release"]
testImplementation rootProject.ext.dependencies["canary-release"]
} else {
compileOnly rootProject.ext.dependencies["dagger2-compiler"]
compileOnly rootProject.ext.dependencies["canary-debug"]
compileOnly rootProject.ext.dependencies["canary-release"]
compileOnly rootProject.ext.dependencies["canary-release"]
}
api 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
testImplementation rootProject.ext.dependencies["junit"]
debugImplementation rootProject.ext.dependencies["canary-debug"]
......@@ -72,7 +82,7 @@ dependencies {
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
api rootProject.ext.dependencies["BaseRecyclerViewAdapter"]
implementation rootProject.ext.dependencies["fastjson"]
api rootProject.ext.dependencies["zxing"]
// api rootProject.ext.dependencies["zxing"]
implementation rootProject.ext.dependencies["progressmanager"]
implementation rootProject.ext.dependencies["autosize"]
// test
......@@ -88,7 +98,6 @@ dependencies {
api 'com.github.lihangleo2:ShadowLayout:2.1.6'
//時間選擇控件
api 'com.contrarywind:Android-PickerView:3.2.4'
implementation 'org.aspectj:aspectjrt:1.8.9'
//商米打印庫
api 'com.sunmi:printerlibrary:1.0.7'
......@@ -96,17 +105,13 @@ dependencies {
api 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
//多功能輸入框
api 'com.rengwuxian.materialedittext:library:2.1.4'
//二维码扫描
api 'cn.yipianfengye.android:zxing-library:2.2'
// // 斜角标签
// api 'com.github.poqiao:BeveLabelView:1.0.3'
api "androidx.core:core-ktx:+"
//扫码
implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3'
api 'androidx.core:core-ktx:+'
implementation 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api "com.github.huangyanbin:SmartTable:2.2.0"
api 'com.github.huangyanbin:SmartTable:2.2.0'
}
repositories {
mavenCentral()
......
......@@ -2,5 +2,32 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_android"
android:theme="@style/AppTheme">
<activity android:name="com.gingersoft.gsa.cloud.ui.activity.WebActivity"/>
<activity android:name="com.gingersoft.gsa.cloud.zxing.MipcaCaptureActivity" />
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<meta-data
android:name="design_width_in_dp"
android:value="360"/>
<meta-data
android:name="design_height_in_dp"
android:value="640"/>
</application>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.table">
<application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_android"
android:theme="@style/AppTheme">
<activity android:name="com.gingersoft.gsa.cloud.ui.activity.WebActivity"/>
<activity android:name="com.gingersoft.gsa.cloud.zxing.MipcaCaptureActivity" />
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<meta-data
android:name="design_width_in_dp"
android:value="360"/>
<meta-data
android:name="design_height_in_dp"
android:value="640"/>
</application>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
\ No newline at end of file
package debug;
import com.billy.cc.core.component.CC;
import com.jess.arms.base.BaseApplication;
/**
* @author billy.qi
* @since 17/11/20 20:02
*/
public class MyApp extends BaseApplication {
@Override
public void onCreate() {
super.onCreate();
CC.enableVerboseLog(true);
CC.enableDebug(true);
CC.enableRemoteCC(true);
}
}
<resources>
<!-- &lt;!&ndash; Base application theme. &ndash;&gt;-->
<!-- <style name="table_AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
<!-- &lt;!&ndash; Customize your theme here. &ndash;&gt;-->
<!-- <item name="colorPrimary">@color/table_colorPrimary</item>-->
<!-- <item name="colorPrimaryDark">@color/table_colorPrimaryDark</item>-->
<!-- <item name="colorAccent">@color/table_colorAccent</item>-->
<!-- </style>-->
</resources>
......@@ -126,7 +126,7 @@ public class MemberInfo {
private String memberNo;
private int MemberPoint;
private String memberName;
private int phone;
private String phone;
private int birthdaybonusratio;
private int creditPoints;
private int birthdayperiod;
......
......@@ -10,6 +10,7 @@ import lombok.Data;
* 创建日期:2019-12-28
* 修订历史:2019-12-28
* 描述:
*
*/
public class TableBean {
......@@ -90,11 +91,11 @@ public class TableBean {
/**
* 最大就餐人數
*/
private Integer maxSeatCount;
private int maxSeatCount;
/**
* 最小就餐人數
*/
private Integer minSeatCount;
private int minSeatCount;
private String createTime;
private String createBy;
private String qrCodeImg;
......
......@@ -5,6 +5,7 @@ import android.text.TextUtils;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BillOrderMoney;
import com.gingersoft.gsa.cloud.base.common.bean.MemberInfo;
import com.gingersoft.gsa.cloud.base.common.bean.OrderBean;
import com.gingersoft.gsa.cloud.base.common.bean.OrderDetail;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
......@@ -56,6 +57,11 @@ public class MyOrderManage {
private int mseq = 0;//三级序
private OrderBean orderBean;
/**
* 會員信息
*/
private MemberInfo memberInfo;
/**
* 食品列表
*/
......@@ -131,6 +137,14 @@ public class MyOrderManage {
return orderBean;
}
public MemberInfo getMemberInfo() {
return memberInfo;
}
public void setMemberInfo(MemberInfo memberInfo) {
this.memberInfo = memberInfo;
}
public void changeNumber(int number) {
if (orderFoodList.size() <= 0) {
......@@ -1055,6 +1069,9 @@ public class MyOrderManage {
}
public void clear() {
if (memberInfo != null) {
memberInfo = null;
}
if (orderFoodList != null) {
orderFoodList.clear();
}
......
package com.gingersoft.gsa.cloud.base.utils.view;
import android.content.ContentResolver;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.util.Log;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
......@@ -9,6 +14,8 @@ import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
......@@ -88,4 +95,103 @@ public class BitmapUtil {
}
return null;
}
/**
* 读取一个缩放后的图片,限定图片大小,避免OOM
*
* @param uri 图片uri,支持“file://”、“content://”
* @param maxWidth 最大允许宽度
* @param maxHeight 最大允许高度
* @return 返回一个缩放后的Bitmap,失败则返回null
*/
public static Bitmap decodeUri(Context context, Uri uri, int maxWidth, int maxHeight) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true; //只读取图片尺寸
readBitmapScale(context, uri, options);
//计算实际缩放比例
int scale = 1;
for (int i = 0; i < Integer.MAX_VALUE; i++) {
if ((options.outWidth / scale > maxWidth &&
options.outWidth / scale > maxWidth * 1.4) ||
(options.outHeight / scale > maxHeight &&
options.outHeight / scale > maxHeight * 1.4)) {
scale++;
} else {
break;
}
}
options.inSampleSize = scale;
options.inJustDecodeBounds = false;//读取图片内容
options.inPreferredConfig = Bitmap.Config.RGB_565; //根据情况进行修改
Bitmap bitmap = null;
try {
bitmap = readBitmapData(context, uri, options);
} catch (Throwable e) {
e.printStackTrace();
}
return bitmap;
}
private static void readBitmapScale(Context context, Uri uri, BitmapFactory.Options options) {
if (uri == null) {
return;
}
String scheme = uri.getScheme();
if (ContentResolver.SCHEME_CONTENT.equals(scheme) ||
ContentResolver.SCHEME_FILE.equals(scheme)) {
InputStream stream = null;
try {
stream = context.getContentResolver().openInputStream(uri);
BitmapFactory.decodeStream(stream, null, options);
} catch (Exception e) {
Log.w("readBitmapScale", "Unable to open content: " + uri, e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
Log.e("readBitmapScale", "Unable to close content: " + uri, e);
}
}
}
} else if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(scheme)) {
Log.e("readBitmapScale", "Unable to close content: " + uri);
} else {
Log.e("readBitmapScale", "Unable to close content: " + uri);
}
}
private static Bitmap readBitmapData(Context context, Uri uri, BitmapFactory.Options options) {
if (uri == null) {
return null;
}
Bitmap bitmap = null;
String scheme = uri.getScheme();
if (ContentResolver.SCHEME_CONTENT.equals(scheme) ||
ContentResolver.SCHEME_FILE.equals(scheme)) {
InputStream stream = null;
try {
stream = context.getContentResolver().openInputStream(uri);
bitmap = BitmapFactory.decodeStream(stream, null, options);
} catch (Exception e) {
Log.e("readBitmapData", "Unable to open content: " + uri, e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
Log.e("readBitmapData", "Unable to close content: " + uri, e);
}
}
}
} else if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(scheme)) {
Log.e("readBitmapData", "Unable to close content: " + uri);
} else {
Log.e("readBitmapData", "Unable to close content: " + uri);
}
return bitmap;
}
}
......@@ -41,7 +41,7 @@ public class HttpsConstans {
private static String PATH = "/ricepon-cloud-gsa/api/";//路徑
public static String ROOT_SERVER_YOU_CHANG_HK = "http://192.168.1.142:9012/api/"; //友常本地
public static String ROOT_SERVER_SHI_WEI_HK = "http://192.168.1.169:9012/api/"; //世維本地
public static String ROOT_SERVER_ZHI_WANG_HK = "http://192.168.1.169:9012/api/"; //世維本地
public static String ROOT_SERVER_SHI_SHU_HK = "http://192.168.1.154:9012/api/"; //石书本地
//------------------------------------------外賣接單---------------------------------------------------------------------------
......@@ -126,22 +126,22 @@ public class HttpsConstans {
SYSTEM_URL = ROOT_HK_TEST_URL + SYSTEM_PATH;
break;
case 2:
_SERVER_ADDRESS = ROOT_SERVER_YOU_CHANG_HK + "/member-web/api/";
_SERVER_ADDRESS = ROOT_SERVER_ZHI_WANG_HK + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_YOU_CHANG_HK;
ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_ZHI_WANG_HK;
ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
SYSTEM_URL = ROOT_SERVER_YOU_CHANG_HK + SYSTEM_PATH;
SYSTEM_URL = ROOT_SERVER_ZHI_WANG_HK + SYSTEM_PATH;
break;
case 3:
_SERVER_ADDRESS = ROOT_SERVER_SHI_WEI_HK + "/member-web/api/";
_SERVER_ADDRESS = ROOT_SERVER_YOU_CHANG_HK + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_SHI_WEI_HK;
ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_YOU_CHANG_HK;
ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
SYSTEM_URL = ROOT_SERVER_SHI_WEI_HK + SYSTEM_PATH;
SYSTEM_URL = ROOT_SERVER_YOU_CHANG_HK + SYSTEM_PATH;
break;
case 4:
_SERVER_ADDRESS = ROOT_SERVER_SHI_SHU_HK + "/member-web/api/";
......
package com.gingersoft.gsa.cloud.constans;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-08-14
* 修订历史:2020-08-14
* 描述:
*/
public interface ResultConstans {
int DOWNLOAD_PAGE_BACK = 100;
}
......@@ -8,6 +8,9 @@ import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Transient;
import lombok.Data;
import lombok.extern.java.Log;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
......
......@@ -46,26 +46,25 @@ public class FunctionManager {
for (int j = 0; j < fModules.length; j++) {
FModule module = fModules[j];
if (function.getResUrl().equals(module.getKeyRes())) {
switch (function.getStatus()) {
case Function.STATUS_NONAL:
// switch (function.getStatus()) {
// case Function.STATUS_NONAL:
function.setIcRes(module.getOpenIconRes());
break;
case Function.STATUS_TIME_LIMIT:
long currentTime = System.currentTimeMillis();
long effectiveTime = function.getEffectiveTime();
if (effectiveTime > currentTime) {
//在有效期内
function.setStatus(Function.STATUS_NONAL);
function.setIcRes(module.getOpenIconRes());
} else {
function.setIcRes(module.getDisableIconRes());
}
break;
default:
function.setIcRes(module.getDisableIconRes());
break;
}
break;
// break;
// case Function.STATUS_TIME_LIMIT:
// long currentTime = System.currentTimeMillis();
// long effectiveTime = function.getEffectiveTime();
// if (effectiveTime > currentTime) {
// //在有效期内
// function.setStatus(Function.STATUS_NONAL);
// function.setIcRes(module.getOpenIconRes());
// } else {
// function.setIcRes(module.getDisableIconRes());
// }
// break;
// default:
// function.setIcRes(module.getDisableIconRes());
// break;
// }
}
}
functions.add(function);
......
......@@ -55,7 +55,7 @@ public class MyResponseErrorListener implements ResponseErrorListener {
// ArmsUtils.snackbarText(msg);
// LogUtil.d("handleResponseError: " + t.getMessage());
LogUtil.d(TAG, t.getMessage());
if(!TextUtils.isEmpty(msg)){
if (!TextUtils.isEmpty(msg)) {
ToastUtils.show(context, msg);
}
}
......@@ -74,19 +74,34 @@ public class MyResponseErrorListener implements ResponseErrorListener {
Activity activity = GsaCloudApplication.getAppContext().getCurrentActivity();
if (!showloggedDialog && activity != null) {
showloggedDialog = true;
showloggedDialog(activity,ArmsUtils.getString(context, R.string.response_error_request_logged));
showloggedDialog(activity, ArmsUtils.getString(context, R.string.response_error_request_logged));
}
} else {
if (httpException.code() == 400) {
//Bad Request
Activity activity = GsaCloudApplication.getAppContext().getCurrentActivity();
toLoginActivity(activity);
}
msg = httpException.message();
}
return msg;
}
private void showloggedDialog(Activity context,String msg) {
private void showloggedDialog(Activity context, String msg) {
QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context);
dialogBuilder.setMessage(msg);
dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_warn);
dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
toLoginActivity(context);
dialog.dismiss();
});
dialogBuilder.setCancelable(false);
dialogBuilder.setCanceledOnTouchOutside(false);
dialogBuilder.create(R.style.MyDialogTheme2).show();
}
private void toLoginActivity(Activity context) {
ArmsUtils.killAll();
//清空用戶信息
GsaCloudApplication.clearMemberInfo();
//清空賬單數據
......@@ -101,12 +116,6 @@ public class MyResponseErrorListener implements ResponseErrorListener {
.call();
showloggedDialog = false;
context.finish();
dialog.dismiss();
});
dialogBuilder.setCancelable(false);
dialogBuilder.setCanceledOnTouchOutside(false);
dialogBuilder.create(R.style.MyDialogTheme2).show();
}
}
......@@ -9,11 +9,9 @@ import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.LinearInterpolator;
import com.gingersoft.gsa.cloud.base.R;
import com.hyweb.n5.lib.util.DeviceUtil;
import com.jess.arms.utils.ArmsUtils;
import com.uuzuche.lib_zxing.DisplayUtil;
public class WebViewProgressBar extends View {
......
package com.gingersoft.gsa.cloud.zxing;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PointF;
import android.util.AttributeSet;
import android.view.View;
public class PointsOverlayView extends View {
PointF[] points;
private Paint paint;
public PointsOverlayView(Context context) {
super(context);
init();
}
public PointsOverlayView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public PointsOverlayView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
paint = new Paint();
paint.setColor(Color.YELLOW);
paint.setStyle(Paint.Style.FILL);
}
/**
* @param points
*/
public void setPoints(PointF[] points) {
this.points = points;
invalidate();
}
@Override public void draw(Canvas canvas) {
super.draw(canvas);
if (points != null) {
for (PointF pointF : points) {
canvas.drawCircle(pointF.x, pointF.y, 10, paint);
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- <SurfaceView-->
<!-- android:id="@+id/preview_view"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_gravity="center"/>-->
<!-- <com.gingersoft.gsa.cloud.zxing.view.ViewfinderView-->
<!-- android:id="@+id/viewfinder_view"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content" />-->
<!-- <LinearLayout-->
<!-- android:id="@+id/title_layout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentTop="true"-->
<!-- android:orientation="vertical">-->
<!-- <com.zxing.view.ViewfinderView-->
<!-- android:id="@+id/viewfinder_view"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content" />-->
<!-- <include layout="@layout/title_bar_" />-->
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
app:qmui_topbar_title_color="@color/theme_white_color" />
<TextView
android:id="@+id/btn_album"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:text="相冊"
android:paddingLeft="@dimen/normal_space12"
android:paddingRight="@dimen/normal_space12"
android:paddingTop="@dimen/normal_space5"
android:paddingBottom="@dimen/normal_space5"
android:textColor="@color/white"
android:layout_below="@+id/topbar"
android:layout_marginTop="@dimen/head_height"
android:background="@drawable/shape_delivery_item_btn_normal"
android:textSize="@dimen/font_normal2"
android:layout_gravity="right"/>
<com.dlazaro66.qrcodereaderview.QRCodeReaderView
android:id="@+id/qrdecoderview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/head_height"/>
<com.gingersoft.gsa.cloud.zxing.PointsOverlayView
android:id="@+id/points_overlay_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- </LinearLayout>-->
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
......@@ -25,5 +25,22 @@
<item name="layout_for_test" type="id"/>
<item name="topbar_heart_disconnect" type="id"/>
<!-- Messages IDs -->
<item name="auto_focus" type="id" />
<item name="decode" type="id" />
<item name="decode_failed" type="id" />
<item name="decode_succeeded" type="id" />
<item name="encode_failed" type="id" />
<item name="encode_succeeded" type="id" />
<item name="launch_product_query" type="id" />
<item name="quit" type="id" />
<item name="restart_preview" type="id" />
<item name="return_scan_result" type="id" />
<item name="search_book_contents_failed" type="id" />
<item name="search_book_contents_succeeded" type="id" />
<item name="gridview" type="id" />
<item name="webview" type="id" />
<item name="about_version_code" type="id"/>
<item name="split" type="id"/>
<item name="layout_replace" type="id"/>
</resources>
\ No newline at end of file
package com.gingersoft.gsa.cloud.download;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.constans.ResultConstans;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.utils.FoodDaoUtils;
import com.gingersoft.gsa.cloud.download.mvp.ui.activity.DownloadActivity;
......@@ -116,6 +120,11 @@ public class ComponentDownload implements IComponent {
private void openActivity(CC cc) {
CCUtil.navigateTo(cc, DownloadActivity.class);
// int fromPage = cc.getParamItem("fromPage");
// Intent intent = CCUtil.createNavigateIntent(cc, DownloadActivity.class);
// intent.putExtra("fromPage", fromPage);
// Activity currentActivity = GsaCloudApplication.getAppContext().getCurrentActivity();
// currentActivity.startActivityForResult(intent, 1);
CC.sendCCResult(cc.getCallId(), CCResult.success());
}
......
......@@ -16,6 +16,7 @@ import android.widget.TextView;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCUtil;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.constans.ResultConstans;
import com.gingersoft.gsa.cloud.download.R;
import com.gingersoft.gsa.cloud.download.R2;
import com.gingersoft.gsa.cloud.download.di.component.DaggerDownloadComponent;
......@@ -76,6 +77,7 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
*/
private int fromPage = 1;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerDownloadComponent //如找不到该类,请编译一下项目
......@@ -138,8 +140,10 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
.setActionName("showMainActivity")
.build()
.call();
}else {
setResult(ResultConstans.DOWNLOAD_PAGE_BACK);
}
killMyself();
finish();
}
@Override
......@@ -151,14 +155,7 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
public void initTopBar() {
tv_title.setText("數據下載");
btn_back.setOnClickListener(v -> {
if (fromPage == 1) {
CC.obtainBuilder("Component.Main")
.setActionName("showMainActivity")
.build()
.call();
}
killMyself();
onBackPressed();
});
btn_refresh.setOnClickListener(v -> mPresenter.downAllList());
}
......@@ -207,7 +204,7 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
@Override
public void killMyself() {
mPresenter.stopDownDisposable();
finish();
onBackPressed();
}
@Override
......
......@@ -94,8 +94,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/frame_top"
app:layout_constraintVertical_weight="1" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
......@@ -51,8 +51,8 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
int restaurantId = GsaCloudApplication.getRestaurantId(this);
if (restaurantId != 0) {
//上一次進入app有選擇餐廳,通過餐廳ID獲取允許的最大登陸數
// mPresenter.getLoginLimit(restaurantId, false);
jumpMainActivity();
mPresenter.getLoginLimit(restaurantId, false);
// jumpMainActivity();
return;
}
}
......@@ -64,9 +64,9 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
if (brandsBean != null) {
saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), restaurantsBean);
//通過餐廳ID獲取允許的最大登陸數
// mPresenter.getLoginLimit(restaurantsBean.getRestaurantId(), true);
mPresenter.getLoginLimit(restaurantsBean.getRestaurantId(), true);
}
jumpDownloadActivity();
// jumpDownloadActivity();
} else {
// showChooseRestaurantDialog(brandsBeans, brands);
......@@ -109,10 +109,10 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
BrandsBean.BrandsData brandsBean = RestaurantInfoUtils.getBrandByRestaurantId(brands, item.getRestaurantId());
if (brandsBean != null) {
saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), item);
// mPresenter.getLoginLimit(item.getRestaurantId(), true);
mPresenter.getLoginLimit(item.getRestaurantId(), true);
}
dialog.dismiss();
jumpDownloadActivity();
// jumpDownloadActivity();
}
protected void saveBrandAndRestaurantInfo(int brandId, String brandName, BrandsBean.BrandsData.RestaurantsBean restaurantsBean) {
......
......@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.login.mvp.presenter;
import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.util.Log;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
......@@ -27,6 +28,7 @@ import java.util.List;
import javax.inject.Inject;
import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
......@@ -140,8 +142,11 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas
@Override
public void onError(Throwable t) {
super.onError(t);
if (IAcitivity instanceof LoginActivity) {
} else {
mRootView.launchActivity(new Intent(IAcitivity, LoginActivity.class));
}
}
});
}
......
......@@ -81,6 +81,27 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
private boolean passwrodVisibility = false;
/**
* 轉台操作后需要重算的點:
* 合計(食品總金額)
* 服務費
* 折扣
* 賬單小數
*/
/**
* 服務費:
* 1、A 轉 B,服務費不用轉過去 用目標檯的即可
*/
/**
* 折扣:
* A 轉 B
* 1、A B都有折扣不用轉過去
* 2、A有折扣B沒有 需要轉過去
* 3、B有折扣A沒有 不用管
*/
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerLoginComponent //如找不到该类,请编译一下项目
......
......@@ -202,7 +202,6 @@ public class SettlementReportPresenter extends BasePresenter<SettlementReportCon
showMergeSettlementDialog(IActivity,"今天已清機過,是否合併清機");
} else {
if (!TextUtils.isEmpty(info.getErrMsg())) {
// mRootView.showMessage(info.getErrMsg() + ",清機失敗");
showSettlementErrorDialog(info.getErrMsg() + ",清機失敗");
} else {
mRootView.showMessage("清機失敗");
......
......@@ -14,6 +14,7 @@ import androidx.annotation.Nullable;
* 首頁點餐
*/
public class MainOrderingAdapter extends BaseQuickAdapter<Function, BaseViewHolder> {
public MainOrderingAdapter(int layoutResId, @Nullable List<Function> data) {
super(layoutResId, data);
}
......
......@@ -186,6 +186,12 @@
android:orientation="vertical"
android:paddingTop="@dimen/dp_16">
<LinearLayout
android:id="@+id/ll_management"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_function_name2"
android:layout_width="wrap_content"
......@@ -207,6 +213,14 @@
android:layout_height="@dimen/dp_1"
android:background="#F0F0F0"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_staff_management"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_function_name3"
......@@ -214,7 +228,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_20"
android:visibility="gone"
android:visibility="visible"
android:textColor="#181818"
android:textSize="@dimen/dp_14" />
......@@ -222,11 +236,12 @@
android:id="@+id/rv_staff_management"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:visibility="visible"
android:layout_marginLeft="@dimen/main_recyclerview_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/main_recyclerview_marginRight" />
</LinearLayout>
</LinearLayout>
</com.lihang.ShadowLayout>
<!-- 點餐模塊-->
<com.lihang.ShadowLayout
......
......@@ -127,12 +127,12 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter<
viewHolder.ll_container.setBackgroundColor(Color.parseColor("#FFFFFFFF"));
setBackGroundWork(viewHolder, Color.parseColor("#FFFFFFFF"), R.color.black, R.color.theme_black);
viewHolder.cb_checked.setChecked(false);
// viewHolder.cb_checked.setChecked(false);
viewHolder.cb_checked.setOnCheckedChangeListener(null);
viewHolder.cb_checked.setVisibility(View.GONE);
} else {
viewHolder.cb_checked.setChecked(false);
// viewHolder.cb_checked.setChecked(false);
viewHolder.rl_table.setVisibility(View.VISIBLE);
viewHolder.fl_add_table.setVisibility(View.GONE);
......@@ -147,7 +147,6 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter<
viewHolder.tv_service_fee.setVisibility(View.GONE);
}
if (isRadioEdit && tableItem.getUseStatus() == 0 && tableItem.getStatus() == 0) {
viewHolder.cb_checked.setChecked(tableItem.isChecked());
viewHolder.cb_checked.setVisibility(View.VISIBLE);
viewHolder.cb_checked.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
......@@ -161,6 +160,7 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter<
viewHolder.cb_checked.setVisibility(View.GONE);
}
}
viewHolder.cb_checked.setChecked(tableItem.isChecked());
viewHolder.ll_container.setRadiusAndShadow(mRadius, QMUIDisplayHelper.dp2px(context, mShadowElevationDp), mShadowAlpha);
}
......
......@@ -58,7 +58,11 @@ import org.json.JSONException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
......@@ -168,7 +172,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
initRecycleScrollListener();
mActivity.queryAreas(null);
mActivity.queryTables(null);
// mActivity.initGetTableTimer();
mActivity.initGetTableTimer();
cb_all_select.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
......@@ -188,14 +192,14 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
super.onResume();
hideSoftInput();
//開始刷新餐檯數據
// mActivity.onStartRefreshTableData();
mActivity.onStartRefreshTableData();
}
@Override
public void onPause() {
super.onPause();
//停止刷新餐檯數據
// mActivity.onPauseRefreshTableData();
mActivity.onPauseRefreshTableData();
}
@Override
......@@ -271,7 +275,6 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
if (isRadioEdit) {
item.setChecked(!item.isChecked());
mAdapter.notifyItemChanged(position);
// mAdapter.notifyDataSetChanged();
} else {
if (item.getStatus() == 0) {
start(AddTableFragment.newInstance(item));
......@@ -344,7 +347,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
return layoutManager;
}
public void setAreaData(List<TableArea> tableAreaList){
public void setAreaData(List<TableArea> tableAreaList) {
initParms();
......@@ -437,7 +440,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
showMessage("請選擇餐檯");
return;
}
showEditTextDialog(mActivity, "批量修改服務費", "請輸入服務費",InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
showEditTextDialog(mActivity, "批量修改服務費", "請輸入服務費", InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
}
@OnClick(R2.id.btn_delete)
......@@ -484,7 +487,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
return updateServiceCharges;
}
public void showEditTextDialog(Activity context, String title, String placeholder,int inputType) {
public void showEditTextDialog(Activity context, String title, String placeholder, int inputType) {
final QMUIDialog.EditTextDialogBuilder dialogBuilder = new QMUIDialog.EditTextDialogBuilder(context);
dialogBuilder.setTitle(title);
dialogBuilder.setPlaceholder(placeholder);
......@@ -634,7 +637,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
ll_bottom_operat.setVisibility(View.VISIBLE);
RelativeLayout.LayoutParams layoutParam = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParam.setMargins(0, 0, 0, ArmsUtils.getDimens(mActivity,R.dimen.dp_48));
layoutParam.setMargins(0, 0, 0, ArmsUtils.getDimens(mActivity, R.dimen.dp_48));
fl_section_layout.setLayoutParams(layoutParam);
} else {
......
......@@ -82,7 +82,7 @@ class CoolWeatherNetwork {
suspend fun noticePersonnel(requestBody: RequestBody) = appService.noticePersonnel(requestBody).await()
suspend fun getTransportationConfig(restaurantId: String) = systemService.getTransportationConfig(restaurantId).await()
// suspend fun getTransportationConfig(restaurantId: String) = systemService.getTransportationConfig(restaurantId).await()
private suspend fun <T> Call<T>.await(): T {
return suspendCoroutine { continuation ->
......
......@@ -69,6 +69,6 @@ interface WeatherService {
@POST("printerRecording/add")
fun addPrj(@Body requestBody: RequestBody): Call<String>
@GET("restaurantTransportationConfig/list")
fun getTransportationConfig(@Query("restaurantId") restaurantId: String):Call<TransportationBean>
// @GET("restaurantTransportationConfig/list")
// fun getTransportationConfig(@Query("restaurantId") restaurantId: String):Call<TransportationBean>
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView.Adapter
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import com.gingersoft.gsa.other_order_mode.databinding.LayoutDeliveryOrderItemBinding
import com.gingersoft.gsa.other_order_mode.databinding.LayoutOtherOrderItemBinding
import com.scwang.smartrefresh.layout.util.SmartUtil.dp2px
class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.ViewHolder>() {
......
......@@ -92,14 +92,17 @@ public class PrintBill extends PrinterRoot {
layout.addView(getHalfLine(mContext));
BigDecimal totalAmount = new BigDecimal(0);
for (OrderDetail OrderDetail : MyOrderManage.getInstance().getOrderFoodList()) {
totalAmount = MoneyUtil.sum(totalAmount, OrderDetail.getPrice());
}
layout.addView(getAmountText(mContext, "總金額:" + totalAmount));
// BigDecimal totalAmount = new BigDecimal(0);
// for (OrderDetail OrderDetail : MyOrderManage.getInstance().getOrderFoodList()) {
// totalAmount = MoneyUtil.sum(totalAmount, OrderDetail.getPrice());
// }
layout.addView(getAmountText(mContext, "總金額:" + MyOrderManage.getInstance().getTotalAmount()));
layout.addView(getLine(mContext));
layout.addView(getDiningBillPayMethod(mContext, MyOrderManage.getInstance().getBillMoney()));
layout.addView(getLine(mContext));
// layout.addView(getTableMealMemberIntegerView(mContext,));
return zoomBitmap(deviceBean, viewToBitmap(mContext, layout));
}
......
......@@ -563,6 +563,29 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
return view;
}
protected View getTableMealMemberIntegerView(Context mContext, OrderDetails.DataBean data) {
View view = View.inflate(mContext, R.layout.print_model_takeaway_member_integer_info, null);
TextView tvMemberNum = view.findViewById(R.id.tv_print_model_member_number);//會員號碼
TextView tvMemberName = view.findViewById(R.id.tv_print_model_member_name);//會員名稱
TextView tvMemberPhone = view.findViewById(R.id.tv_print_model_member_phone);//會員電話
TextView tvNowPoint = view.findViewById(R.id.tv_print_model_nowPoints);//現在的積分
TextView tvAddPoints = view.findViewById(R.id.tv_print_model_addPoints);//本次添加積分
TextView tvOldPoints = view.findViewById(R.id.tv_print_model_oldPoints);//之前的積分
if (data.getAddPoints() != 0 || data.getOldPoints() != 0 || data.getAddPoints() != 0) {
tvAddPoints.setText("本次積分:" + data.getAddPoints());
tvNowPoint.setText("結餘積分:" + data.getNowPoints());
tvOldPoints.setText("上次積分:" + data.getOldPoints());
//名稱中間替換為*號
if (data.getMEMBER_NAME() != null && data.getMEMBER_NAME().length() > 0) {
tvMemberName.setText("會員名稱:" + getReplaceAfter(data.getMEMBER_NAME()));
}
if (data.getPHONE() != null && data.getPHONE().length() > 0) {
tvMemberPhone.setText("會員電話:" + getReplaceAfter(data.getPHONE()));
}
}
return view;
}
protected View getTakeawayMemberIntegerView(Context mContext, OrderDetails.DataBean data) {
View view = View.inflate(mContext, R.layout.print_model_takeaway_member_integer_info, null);
TextView tvMemberNum = view.findViewById(R.id.tv_print_model_member_number);//會員號碼
......
......@@ -2,13 +2,6 @@ package com.joe.print.mvp.print.utils;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import java.util.Hashtable;
public class BytesUtil {
......@@ -151,56 +144,56 @@ public class BytesUtil {
* @param size
* @return
*/
public static byte[] getZXingQRCode(String data, int size) {
try {
Hashtable<EncodeHintType, String> hints = new Hashtable<>();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
//图像数据转换,使用了矩阵转换
BitMatrix bitMatrix = new QRCodeWriter().encode(data, BarcodeFormat.QR_CODE, size, size, hints);
//System.out.println("bitmatrix height:" + bitMatrix.getHeight() + " width:" + bitMatrix.getWidth());
return getBytesFromBitMatrix(bitMatrix);
} catch (WriterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static byte[] getBytesFromBitMatrix(BitMatrix bits) {
if (bits == null) return null;
int h = bits.getHeight();
int w = (bits.getWidth() + 7) / 8;
byte[] rv = new byte[h * w + 4];
rv[0] = (byte) w;//xL
rv[1] = (byte) (w >> 8);//xH
rv[2] = (byte) h;
rv[3] = (byte) (h >> 8);
int k = 4;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
for (int n = 0; n < 8; n++) {
byte b = getBitMatrixColor(bits, j * 8 + n, i);
rv[k] += rv[k] + b;
}
k++;
}
}
return rv;
}
private static byte getBitMatrixColor(BitMatrix bits, int x, int y) {
int width = bits.getWidth();
int height = bits.getHeight();
if (x >= width || y >= height || x < 0 || y < 0) return 0;
if (bits.get(x, y)) {
return 1;
} else {
return 0;
}
}
// public static byte[] getZXingQRCode(String data, int size) {
// try {
// Hashtable<EncodeHintType, String> hints = new Hashtable<>();
// hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
// //图像数据转换,使用了矩阵转换
// BitMatrix bitMatrix = new QRCodeWriter().encode(data, BarcodeFormat.QR_CODE, size, size, hints);
// //System.out.println("bitmatrix height:" + bitMatrix.getHeight() + " width:" + bitMatrix.getWidth());
// return getBytesFromBitMatrix(bitMatrix);
// } catch (WriterException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// return null;
// }
// public static byte[] getBytesFromBitMatrix(BitMatrix bits) {
// if (bits == null) return null;
//
// int h = bits.getHeight();
// int w = (bits.getWidth() + 7) / 8;
// byte[] rv = new byte[h * w + 4];
//
// rv[0] = (byte) w;//xL
// rv[1] = (byte) (w >> 8);//xH
// rv[2] = (byte) h;
// rv[3] = (byte) (h >> 8);
//
// int k = 4;
// for (int i = 0; i < h; i++) {
// for (int j = 0; j < w; j++) {
// for (int n = 0; n < 8; n++) {
// byte b = getBitMatrixColor(bits, j * 8 + n, i);
// rv[k] += rv[k] + b;
// }
// k++;
// }
// }
// return rv;
// }
// private static byte getBitMatrixColor(BitMatrix bits, int x, int y) {
// int width = bits.getWidth();
// int height = bits.getHeight();
// if (x >= width || y >= height || x < 0 || y < 0) return 0;
// if (bits.get(x, y)) {
// return 1;
// } else {
// return 0;
// }
// }
/**
* 将bitmap图转换为头四位有宽高的光栅位图
......
......@@ -98,16 +98,16 @@ public class ESCUtil {
/**
* 光栅打印二维码
*/
public static byte[] getPrintQRCode2(String data, int size){
byte[] bytes1 = new byte[4];
bytes1[0] = GS;
bytes1[1] = 0x76;
bytes1[2] = 0x30;
bytes1[3] = 0x00;
byte[] bytes2 = BytesUtil.getZXingQRCode(data, size);
return BytesUtil.byteMerger(bytes1, bytes2);
}
// public static byte[] getPrintQRCode2(String data, int size){
// byte[] bytes1 = new byte[4];
// bytes1[0] = GS;
// bytes1[1] = 0x76;
// bytes1[2] = 0x30;
// bytes1[3] = 0x00;
//
// byte[] bytes2 = BytesUtil.getZXingQRCode(data, size);
// return BytesUtil.byteMerger(bytes1, bytes2);
// }
/**
* 打印一维条形码
......
......@@ -49,10 +49,8 @@ import com.joe.print.mvp.print.utils.MyPrintUtils;
import com.joe.print.mvp.ui.adapter.DialogPrinterListAdapter;
import com.joe.print.mvp.ui.adapter.PrintProgressAdapter;
import com.yanzhenjie.recyclerview.widget.DefaultItemDecoration;
import java.util.List;
import java.util.Map;
import static com.gingersoft.gsa.cloud.constans.PrintConstans.PRINT_TYPE;
import static com.jess.arms.utils.Preconditions.checkNotNull;
......
......@@ -2,6 +2,15 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.table">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:networkSecurityConfig="@xml/network_android">
<activity android:name=".mvp.ui.activity.TableActivity"/>
......
......@@ -32,6 +32,7 @@
android:name="design_height_in_dp"
android:value="640"/>
</application>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
......
......@@ -61,6 +61,7 @@ public interface TableContract {
void startMealStandActivity();
void setBottomFunctionVisibility(boolean show);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
......@@ -50,6 +50,15 @@ public class OrderDetailItem implements Serializable {
private String tableName;
private int tableId;
private int person;
/**
* 订单类型
* 1:堂食
* 2:外賣
* 3:掃碼點餐
* 5:預點餐
* 7:自取
*/
private int orderType;
/**總金額*/
private double totalAmount;
private int totalPoints;
......@@ -59,10 +68,15 @@ public class OrderDetailItem implements Serializable {
private Double rounding;
/**服務費*/
private Double serviceAmount;
/**訂單碼*/
private String billNo;
/**取餐碼*/
private String takeFoodCode;
// private String payName;
// private String orderPayType;
// private double tipsPrice;
// private byte linePayType;
/**折扣ID*/
private Long discountId;
/**折扣金額*/
......
......@@ -20,6 +20,7 @@ public class AddOrderRequest {
private long orderId;
private long tableId;
private String tableNumber;
private Integer memberId;
/**賬單小數*/
private Double rounding;
/**整單折扣ID*/
......
......@@ -22,6 +22,7 @@ public class CreateOrderRequest {
private String tableNumber;
private String tableName;
private int restaurantId;
private Integer memberId;
/**賬單小數*/
private Double rounding;
/**整單折扣ID*/
......
......@@ -119,7 +119,6 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
this.mOrderFoodList = myOrderManage.getOrderFoodList();
this.mOrderMoneyList = myOrderManage.getOrderMoneyList();
if (IActivity instanceof OrderContentActivity) {
mOrderContentActivity = (OrderContentActivity) IActivity;
}
......@@ -300,6 +299,7 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
updateTableServiceAmount();
updateOrderDiscount();
updateOrderRounding();
myOrderManage.setTotalAmount(getTotalAmount());
}
/**
......@@ -758,6 +758,9 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
request.setTableName(OpenTableManage.getDefault().getTableBean().getTableName());
request.setRounding(getRounding());
request.setRestaurantId(restaurantId);
if (MyOrderManage.getInstance().getMemberInfo() != null) {
request.setMemberId(MyOrderManage.getInstance().getMemberInfo().getId());
}
Discount orderDiscount = getNesOrderDiscount();
if (orderDiscount != null) {
request.setDiscountId(orderDiscount.getId());
......@@ -784,6 +787,9 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
if (orderDiscount != null) {
request.setDiscountId(orderDiscount.getId());
}
if (MyOrderManage.getInstance().getMemberInfo() != null) {
request.setMemberId(MyOrderManage.getInstance().getMemberInfo().getId());
}
return request;
}
......
......@@ -47,6 +47,7 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ModifierAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.SelectMealAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.CancelFoodDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog;
import com.gingersoft.gsa.cloud.zxing.MipcaCaptureActivity;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
......@@ -58,11 +59,9 @@ import com.jess.arms.utils.RxLifecycleUtils;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.uuzuche.lib_zxing.activity.CaptureActivity;
import org.simple.eventbus.EventBus;
import org.simple.eventbus.Subscriber;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -164,7 +163,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
@Override
public void onRequestPermissionSuccess() {
Intent intent = new Intent(IActivity, CaptureActivity.class);
Intent intent = new Intent(IActivity, MipcaCaptureActivity.class);
IActivity.startActivityForResult(intent, MealStandActivity.SCAN_REQUEST_CODE);
}
......@@ -374,7 +373,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
// if (!discountConditionFilter(datasBean)) {
// return;
// }
cutOutDiscount();
addDiscountItem(datasBean);
}
});
......@@ -500,6 +499,23 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
}
/**
* 暂时食品折扣只能有一个
*
* @return
*/
private void cutOutDiscount() {
OrderDetail mainOrderDetail = mSelectMealAdapter.getCurrentMainOrderDetail();
if (mainOrderDetail.getItemType() == 1) {
for (OrderDetail orderDetail : mOrderFoodList) {
if (orderDetail.getParentIndex() == mainOrderDetail.getMyIndex() && orderDetail.getType() == OrderDetail.DISCOUNT_TYPE) {
mOrderFoodList.remove(orderDetail);
break;
}
}
}
}
/**
* 裁減掉已超出的細項
*
* @param datasBean
......@@ -866,8 +882,10 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
public void queryMember(int type, String parm, String shopName) {
mModel.queryMember(type, parm, shopName)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult2>(mErrorHandler) {
......@@ -1615,7 +1633,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
if (def == mid) {
modifier.setDefmodifier("1");
} else {
if(TextUtils.isEmpty(modifier.getDefmodifier()) || "0".equals(modifier.getDefmodifier())){
if (!modifier.getDefmodifier().equals("1")) {
modifier.setDefmodifier("0");
}
}
......@@ -1657,7 +1675,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
if (def == fid) {
comboItem.setDefmodifier("1");
} else {
if(TextUtils.isEmpty(comboItem.getDefmodifier()) || "0".equals(comboItem.getDefmodifier())){
if (!comboItem.getDefmodifier().equals("1")) {
comboItem.setDefmodifier("0");
}
}
......@@ -1783,12 +1801,12 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
// //添加到主食品細項最後面
// return i;
// }
boolean samePackage = item.getParentProductId() == orderDetail.getProductId() || item.getProductId() == orderDetail.getProductId();
boolean samePackage = (item.getParentProductId() == orderDetail.getProductId() || item.getProductId() == orderDetail.getProductId());
if (newOrderList.size() == nextIndex && samePackage) {
//最後一個
return nextIndex;
}
if (newOrderList.get(nextIndex).getItemType() != 3 && samePackage) {
if (newOrderList.get(nextIndex).getItemType() != 3) {
//添加到主食品細項最後面
return i;
}
......
......@@ -25,7 +25,9 @@ import com.gingersoft.gsa.cloud.constans.GoldConstants;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.function.FunctionManager;
import com.gingersoft.gsa.cloud.print.PrinterUtils;
import com.gingersoft.gsa.cloud.table.ComponentTable;
import com.gingersoft.gsa.cloud.table.mvp.contract.OrderContentContract;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.BaseRespose;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableDetail;
......@@ -237,22 +239,28 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
}
public void initTopFunctionData() {
if (mFunctionList.size() > 0) {
mFunctionList.clear();
}
if (MyOrderManage.getInstance().isModifyOrder()) {
//修改訂單隱藏送單,印單功能
mFunctionList.add(new Function("結賬", Color.parseColor("#FFFFFF"), Color.parseColor("#DC0000"), 24));
} else {
List<Function> functions = FunctionManager.getDefault().getFunctionByResModule(IActivity, ComponentTable.table.class, ComponentTable.table.order, "order");
for (int i = 0; i < functions.size(); i++) {
if (functions.get(i).getParentId() == 0) {
functions.remove(i);
}
}
// if (functions.size() > 0) {
// mFunctionList.addAll(functions);
// } else {
mFunctionList.add(new Function("送單", Color.parseColor("#FFFFFF"), Color.parseColor("#008131"), 24));
mFunctionList.add(new Function("印單", Color.parseColor("#FFFFFF"), Color.parseColor("#FF8E04"), 24));
mFunctionList.add(new Function("結賬", Color.parseColor("#FFFFFF"), Color.parseColor("#DC0000"), 24));
mFunctionList.add(new Function("轉移", Color.parseColor("#FFFFFF"), Color.parseColor("#FF4B9DFA"), 24));
mFunctionList.add(new Function("折扣", Color.parseColor("#FFFFFF"), Color.parseColor("#008577"), 24));
// List<Function> functions = FunctionManager.getDefault().getFunctionByResModule(IActivity, ComponentTable.table.class, ComponentTable.table.order, "order");
// for (int i = 0; i < functions.size(); i++) {
// if (functions.get(i).getParentId() == 0) {
// functions.remove(i);
// }
// }
// mFunctionList.addAll(functions);
}
}
......@@ -365,7 +373,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
//// //打印成功
////
//// }
// mRootView.sendSuccess();
mRootView.sendSuccess();
// });
}
......@@ -516,7 +524,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
}
public void getTable(TableBean.DataBean dataBean) {
mModel.getTable(dataBean.getId(),dataBean.getTableNumber())
mModel.getTable(dataBean.getId(), dataBean.getTableNumber())
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
......@@ -529,7 +537,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
public void onNext(@NonNull TableDetail result) {
if (result.isSuccess()) {
TableBean.DataBean tableBean = result.getData();
if(tableBean != null) {
if (tableBean != null) {
if (tableBean.getUseStatus() == 0) {
String msg = "轉移到" + tableBean.getTableName() + "號檯?";
Class[] parameterTypes = {TableBean.DataBean.class};
......
......@@ -151,11 +151,11 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
}
public void initBottomFunction() {
initBottomFunctionItem();
if (mBottomFunctionAdapter == null) {
mBottomFunctionAdapter = new BottomFunctionAdapter(IActivity, mBottomFunctionList);
mRootView.setBottomFunctionAdapter(mBottomFunctionAdapter);
}
initBottomFunctionItem();
initBottomFunctionListener();
}
......@@ -207,18 +207,30 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
public void initBottomFunctionItem() {
// List<Function> functions = FunctionManager.getDefault().getFunctionByResModule(IActivity, ComponentTable.table.class, ComponentTable.table.bottom, "bottom");
// for (int i = 0; i < functions.size(); i++) {
// if (functions.get(i).getParentId() == 0) {
// functions.remove(i);
// }
// }
// mBottomFunctionList.addAll(functions);
mBottomFunctionList.add(new Function((long) 1, "重置檯號", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_init));
mBottomFunctionList.add(new Function((long) 2, "轉檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_move));
mBottomFunctionList.add(new Function((long) 3, "分檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_splite));
boolean addFuctions = false;
List<Function> functions = FunctionManager.getDefault().getFunctionByResModule(IActivity, ComponentTable.table.class, ComponentTable.table.bottom, "bottom");
for (int i = 0; i < functions.size(); i++) {
if (functions.get(i).getParentId() == 0) {
//有配置餐檯操作模块
functions.remove(i);
addFuctions = true;
}
}
if (mBottomFunctionList.size() > 0) {
mBottomFunctionList.clear();
}
if (addFuctions) {
mBottomFunctionList.addAll(functions);
mRootView.setBottomFunctionVisibility(true);
mBottomFunctionAdapter.notifyDataSetChanged();
} else {
mRootView.setBottomFunctionVisibility(false);
}
// mBottomFunctionList.add(new Function((long) 1, "重置檯號", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_init));
// mBottomFunctionList.add(new Function((long) 2, "轉檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_move));
// mBottomFunctionList.add(new Function((long) 3, "分檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_splite));
// mBottomFunctionList.add(new Function((long) 4, "skyorder", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_skyorder));
mBottomFunctionList.add(new Function((long) 5, "上菜紙", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_paper));
// mBottomFunctionList.add(new Function((long) 5, "上菜紙", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_paper));
}
......@@ -735,7 +747,7 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
/**
* 刷新分檯数据
*/
private void refreshSplitTablesDialog(){
private void refreshSplitTablesDialog() {
SplitTableDialog splitTableDialog = IActivity.getSplitTableDialog();
if (splitTableDialog != null) {
//刷新餐檯
......
package com.gingersoft.gsa.cloud.table.mvp.ui.activity;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
......@@ -75,6 +76,7 @@ import com.gingersoft.gsa.cloud.ui.view.PagerSlidingTabStrip;
import com.gingersoft.gsa.cloud.ui.view.RecyclerViewNoBugLinearLayoutManager;
import com.gingersoft.gsa.cloud.ui.view.SearchKeyBoardView;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.gingersoft.gsa.cloud.zxing.MipcaCaptureActivity;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.base.DefaultAdapter;
......@@ -87,10 +89,7 @@ import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.util.QMUIDrawableHelper;
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.uuzuche.lib_zxing.activity.CaptureActivity;
import org.simple.eventbus.EventBus;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
......@@ -246,10 +245,12 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
private ChooseNumberDialog mChooseNumberDialog;
private UseMemberDialog mUseMemberDialog;
private UseMemberDialog.BottomLayoutBuilder mUseMemberLayoutBuilder;
private MemberInfoAdapter mMemberInfoAdapter;
private List<SectionTextItem> mMemberInfoList;
private RecyclerView recycler_member_info;
private MemberInfo mMemberInfo;
/**
* 是否初始化细项布局
*/
......@@ -289,10 +290,6 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
protected void onCreate(@Nullable Bundle savedInstanceState) {
EventBus.getDefault().registerSticky(this);
super.onCreate(savedInstanceState);
OrderBean order = MyOrderManage.getInstance().getOrderBean();
if (order != null) {
// ArmsUtils.snackbarText("訂單ID:" + order.getId());
}
}
@Override
......@@ -572,6 +569,7 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
void onClickTable() {
//type取值:1qrCdoetype,2:手機號,3:memberId
// mUseMemberDialog = new UseMemberDialog(this);
if(mUseMemberDialog == null) {
mUseMemberDialog = new UseMemberDialog.BottomLayoutBuilder(this)
.setOnLayoutClickListener(new UseMemberDialog.BottomLayoutBuilder.OnLayoutClickListener() {
......@@ -586,7 +584,8 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
}
@Override
public void setAdapter(RecyclerView recycler_member_info) {
public void setAdapter(RecyclerView recycler_member_info, UseMemberDialog.BottomLayoutBuilder layoutBuilder) {
mUseMemberLayoutBuilder = layoutBuilder;
if (mMemberInfoList == null) {
mMemberInfoList = new ArrayList<>();
}
......@@ -597,19 +596,36 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
}
@Override
public void onUseMember(UseMemberDialog dialog) {
MyOrderManage.getInstance().setMemberInfo(mMemberInfo);
btn_table.setBackgroundResource(R.color.pink_300);
}
@Override
public void clearMemberInfo() {
btn_table.setBackgroundColor(Color.parseColor("#336699"));
MyOrderManage.getInstance().setMemberInfo(null);
if (mMemberInfoList.size() > 0) {
mMemberInfoList.clear();
}
mMemberInfoAdapter.notifyDataSetChanged();
if (mUseMemberLayoutBuilder != null) {
mUseMemberLayoutBuilder.showBottomLayoutVisibility(false);
}
}
}).setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
}
})
.build();
}
mUseMemberDialog.show();
}
@Override
public void updateMemberInfo(MemberInfo memberInfo) {
this.mMemberInfo = memberInfo;
if (mUseMemberDialog != null) {
List<SectionTextItem> data = getMemberInfoItem(memberInfo);
if (mMemberInfoList.size() > 0) {
......@@ -618,15 +634,24 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
mMemberInfoList.addAll(data);
mMemberInfoAdapter.notifyDataSetChanged();
if (mUseMemberLayoutBuilder != null) {
mUseMemberLayoutBuilder.showBottomLayoutVisibility(true);
}
}
}
private List<SectionTextItem> getMemberInfoItem(MemberInfo memberInfo) {
List<SectionTextItem> textItems = new ArrayList<>();
// textItems.add(new SectionTextItem("會員號碼: " + memberInfo.getMemberNo()));
// textItems.add(new SectionTextItem("會員電話: " + memberInfo.getPhone()));
// textItems.add(new SectionTextItem("會員名稱: " + memberInfo.getMemberName()));
// textItems.add(new SectionTextItem("積分: " + memberInfo.getMemberPoint()));
String memberName;
if (TextUtils.isEmpty(memberInfo.getMemberName())) {
memberName = memberInfo.getLevelName1();
} else {
memberName = memberInfo.getMemberName();
}
textItems.add(new SectionTextItem("會員號碼: " + memberInfo.getMemberNo()));
textItems.add(new SectionTextItem("會員電話: " + memberInfo.getPhone()));
textItems.add(new SectionTextItem("會員名稱: " + memberName));
textItems.add(new SectionTextItem("積分: " + memberInfo.getMemberPoint()));
return textItems;
}
......@@ -846,9 +871,12 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
@Override
public void onComfirmClick(String number) {
recordOperat(true);
Integer maxSeatCount = OpenTableManage.getDefault().getTableBean().getMaxSeatCount();
if (maxSeatCount != null && maxSeatCount.intValue() < Integer.parseInt(number)) {
showMessage("最大就餐人數不能超過" + maxSeatCount.intValue() + "人!");
int maxSeatCount = 0;
if (OpenTableManage.getDefault().getTableBean() != null) {
maxSeatCount = OpenTableManage.getDefault().getTableBean().getMaxSeatCount();
}
if (maxSeatCount != 0 && maxSeatCount < Integer.parseInt(number)) {
showMessage("最大就餐人數不能超過" + maxSeatCount + "人!");
return;
}
mPresenter.updateOrderPerson(number, btn_numberman);
......@@ -1212,6 +1240,10 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
return mFoodGroupAdapter;
}
public MemberInfo getMemberInfo() {
return mMemberInfo;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
......@@ -1223,6 +1255,8 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
//,關閉當前頁面
killMyself();
}
} else if (requestCode == MipcaCaptureActivity.CALL_BACK_QR_RESULT) {
String qrCodeResult = data.getStringExtra("qrCodeResult");
}
}
......
......@@ -160,7 +160,6 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
tv_show_popup.setWidth(ArmsUtils.getScreenWidth(this) / 3);
initTabAndPager();
mPresenter.initBottomFunction();
getTables(true, null);
}
......@@ -173,6 +172,7 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
@Override
protected void onResume() {
super.onResume();
mPresenter.initBottomFunction();
//開始刷新餐檯數據
onStartRefreshTableData();
}
......@@ -489,6 +489,11 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
rv_bottom_function.setItemAnimator(new DefaultItemAnimator());
}
@Override
public void setBottomFunctionVisibility(boolean show) {
rv_bottom_function.setVisibility(show == true ? View.VISIBLE : View.GONE);
}
private void initTabAndPager() {
QMUIFragmentPagerAdapter pagerAdapter = new QMUIFragmentPagerAdapter(getSupportFragmentManager()) {
@Override
......@@ -675,10 +680,6 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
mPresenter.getTables(show, refreshLayout);
}
private void setBottomFunctionVisibility(boolean show) {
rv_bottom_function.setVisibility(show == true ? View.VISIBLE : View.GONE);
}
public int getCurrentSelectTableStatus() {
return mCurrentSelectTableStatus;
}
......
......@@ -164,20 +164,18 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
private void initOrderDetail(OrderDetailItem orderDetailItem) {
if (orderDetailItem != null) {
String payBill = LanguageUtils.get_language_system(this, "opentable.paybill", "結賬") + ":";
String tableName = LanguageUtils.get_language_system(this, "table.number", "檯號") + ":";
String pax = LanguageUtils.get_language_system(this, "Meal.Mannumber", "人數") + ":";
String orderNumber = LanguageUtils.get_language_system(this, "order.number", "訂單號") + ":";
String openTable = LanguageUtils.get_language_system(this, "open.table", "開台") + ":";
tv_table_name.setText(tableName + orderDetailItem.getTableName());
tv_people_num.setText(pax + orderDetailItem.getPerson());
tv_order_num.setText(orderNumber + orderDetailItem.getId());
tv_open_time.setText(openTable + TimeUtil.getStringByFormat(new Date(orderDetailItem.getCreateTime()), TimeUtil.dateFormatYMDHM));
if (!TextUtils.isEmpty(orderDetailItem.getEndTime())) {
tv_pay_time.setText(payBill + TimeUtil.getStringByFormat(new Date(orderDetailItem.getEndTime()), TimeUtil.dateFormatYMDHM));
}
tv_total_money.setText("$" + orderDetailItem.getTotalAmount());
setTitleByOrderType(orderDetailItem);
setOrderStatus(orderDetailItem);
setBtnVisibilityByOrderType(orderDetailItem);
mOrderDetailList = OrderAssemblyUtil.assemblyOrder(OrderDetail.orderTransOrderDetails(orderDetailItem.getOrderDetails()));
setOrderDetailAdapter(mOrderDetailList);
......@@ -336,6 +334,22 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
return otherMoney;
}
private void setTitleByOrderType(OrderDetailItem item) {
String mealCode = LanguageUtils.get_language_system(mContext, "meal.code", "訂單碼") + ": ";
if (item.getOrderType() == 2) {
tv_table_name.setText("外賣");
tv_order_num.setText(mealCode + item.getBillNo());
} else if (item.getOrderType() == 7) {
tv_table_name.setText("自取");
tv_order_num.setText(mealCode + item.getBillNo());
} else {
String tableName = LanguageUtils.get_language_system(this, "table.number", "檯號") + ": ";
String orderNumber = LanguageUtils.get_language_system(this, "order.number", "訂單號") + ": ";
tv_table_name.setText(tableName + item.getTableName());
tv_order_num.setText(orderNumber + item.getId());
}
}
/**
* 設置訂單狀態
*
......@@ -355,6 +369,14 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
}
}
private void setBtnVisibilityByOrderType(OrderDetailItem item) {
if (item.getOrderType() == 2 || item.getOrderType() == 7) {
//外賣自取 不可以修改訂單 取消訂單
btn_modify_order.setVisibility(View.GONE);
btn_cancel_order.setVisibility(View.GONE);
}
}
@OnClick({R2.id.btn_print_order, R2.id.btn_cancel_order, R2.id.btn_modify_order})
public void onClick(View v) {
int id = v.getId();
......@@ -435,8 +457,8 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
private List<BillOrderMoney> getOrderMoneyList() {
List<BillOrderMoney> billOrderMoneyList = new ArrayList<>();
if(mOrderCenterMoneyList != null){
for (SectionTextItem3 item: mOrderCenterMoneyList) {
if (mOrderCenterMoneyList != null) {
for (SectionTextItem3 item : mOrderCenterMoneyList) {
BillOrderMoney billOrderMoney = new BillOrderMoney();
billOrderMoney.setTitle(item.getLeftText());
billOrderMoney.setMoney(Double.parseDouble(item.getRightText()));
......
......@@ -69,7 +69,7 @@ public class BottomFunctionAdapter extends DefaultAdapter<Function> {
private void initItemData(Function item) {
tv_name.setText(item.getResName());
iv_icon.setImageResource(item.getIconRes());
iv_icon.setImageResource(item.getIcRes());
}
}
......
......@@ -90,15 +90,11 @@ public class OrderCenterAdapter extends DefaultAdapter<OrderDetailItem> {
@Override
public void setData(OrderDetailItem item, int position) {
String tableName = LanguageUtils.get_language_system(mContext, "table.number", "檯號") + ":";
String pax = LanguageUtils.get_language_system(mContext, "Meal.Mannumber", "人數") + ":";
String orderNumber = LanguageUtils.get_language_system(mContext, "order.number", "訂單號") + ":";
String openTable = LanguageUtils.get_language_system(mContext, "open.table", "開台") + ":";
String payTable = LanguageUtils.get_language_system(mContext, "open.table", "結賬") + ":";
String amount = LanguageUtils.get_language_system(mContext, "amount", "金額") + ":$";
tv_table_name.setText(tableName + item.getTableName());
tv_order_num.setText(orderNumber + item.getId());
tv_people_num.setText(pax + item.getPerson());
tv_open_time.setText(openTable + TimeUtil.getStringByFormat(new Date(item.getCreateTime()), TimeUtil.dateFormatYMDHM));
if (!TextUtils.isEmpty(item.getEndTime())) {
......@@ -106,7 +102,9 @@ public class OrderCenterAdapter extends DefaultAdapter<OrderDetailItem> {
}
tv_pay_money.setText(amount + item.getTotalAmount());
setOrderStatus(item,position);
setTitleByOrderType(item);
setOrderStatus(item, position);
setBtnVisibilityByOrderType(item);
ll_root_container.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -118,13 +116,29 @@ public class OrderCenterAdapter extends DefaultAdapter<OrderDetailItem> {
});
}
private void setOrderStatus(OrderDetailItem item,int position) {
if(item.getStatus() == 6){
private void setTitleByOrderType(OrderDetailItem item) {
String mealCode = LanguageUtils.get_language_system(mContext, "meal.code", "訂單碼") + ": ";
if (item.getOrderType() == 2) {
tv_table_name.setText("外賣");
tv_order_num.setText(mealCode + item.getBillNo());
} else if (item.getOrderType() == 7) {
tv_table_name.setText("自取");
tv_order_num.setText(mealCode + item.getBillNo());
} else {
String tableName = LanguageUtils.get_language_system(mContext, "table.number", "檯號") + ": ";
String orderNumber = LanguageUtils.get_language_system(mContext, "order.number", "訂單號") + ": ";
tv_table_name.setText(tableName + item.getTableName());
tv_order_num.setText(orderNumber + item.getId());
}
}
private void setOrderStatus(OrderDetailItem item, int position) {
if (item.getStatus() == 6) {
btn_print_order.setVisibility(View.GONE);
btn_modify_order.setVisibility(View.GONE);
btn_cancel_order.setVisibility(View.GONE);
btn_order_status.setVisibility(View.VISIBLE);
}else {
} else {
btn_print_order.setText(LanguageUtils.get_language_system(mContext, "print.order", "打印賬單"));
btn_tips.setText(LanguageUtils.get_language_system(mContext, "public.tips", "貼士"));
btn_modify_order.setText(LanguageUtils.get_language_system(mContext, "modify.order", "修改訂單"));
......@@ -159,6 +173,14 @@ public class OrderCenterAdapter extends DefaultAdapter<OrderDetailItem> {
});
}
}
private void setBtnVisibilityByOrderType(OrderDetailItem item) {
if (item.getOrderType() == 2 || item.getOrderType() == 7) {
//外賣自取 不可以修改訂單 取消訂單
btn_modify_order.setVisibility(View.GONE);
btn_cancel_order.setVisibility(View.GONE);
}
}
}
private OnItemClickListener mOnItemClickListener;
......
......@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.table.mvp.ui.widget;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
......@@ -15,6 +16,7 @@ import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -63,7 +65,6 @@ public class UseMemberDialog extends Dialog {
private View mContentView;
private boolean mIsAnimating = false;
private OnBottomSheetShowListener mOnBottomSheetShowListener;
public UseMemberDialog(Context context) {
......@@ -115,6 +116,7 @@ public class UseMemberDialog extends Dialog {
super.setContentView(view);
}
/**
* BottomSheet升起动画
*/
......@@ -267,8 +269,9 @@ public class UseMemberDialog extends Dialog {
iv_no_data = view.findViewById(R.id.iv_no_data);
btn_query_memeber = view.findViewById(R.id.btn_query_memeber);
btn_scan = view.findViewById(R.id.btn_scan);
ll_bottom = view.findViewById(R.id.ll_bottom);
btn_use_member = view.findViewById(R.id.btn_use_member);
btn_clear_member = view.findViewById(R.id.btn_use_member);
btn_clear_member = view.findViewById(R.id.btn_clear_member);
initTopbar();
initRecyclerLayout();
......@@ -295,7 +298,9 @@ public class UseMemberDialog extends Dialog {
btn_use_member.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onLayoutClickListener != null) {
onLayoutClickListener.onUseMember(mDialog);
}
}
});
btn_clear_member.setOnClickListener(new View.OnClickListener() {
......@@ -307,20 +312,22 @@ public class UseMemberDialog extends Dialog {
}
});
if (onLayoutClickListener != null) {
onLayoutClickListener.setAdapter(recycler_member_info);
onLayoutClickListener.setAdapter(recycler_member_info,this);
}
return view;
}
private void initTopbar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(mContext, R.color.theme_color));
mTopBar.addRightTextButton("清除",R.id.btn_right)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
// Button rightBtn = mTopBar.addRightTextButton("清除", R.id.btn_right);
// rightBtn.setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color));
// rightBtn.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
//
// }
// });
mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
@Override
......@@ -351,6 +358,11 @@ public class UseMemberDialog extends Dialog {
};
}
public void showBottomLayoutVisibility(boolean show){
ll_bottom.setVisibility(show?View.VISIBLE:View.GONE);
btn_scan.setVisibility(!show?View.VISIBLE:View.GONE);
}
private String getTvPhone() {
return ed_phone.getText().toString();
}
......@@ -378,7 +390,9 @@ public class UseMemberDialog extends Dialog {
void onScanAction(UseMemberDialog dialog);
void setAdapter(RecyclerView recycler_member_info);
void setAdapter(RecyclerView recycler_member_info,BottomLayoutBuilder layoutBuilder);
void onUseMember(UseMemberDialog dialog);
void clearMemberInfo();
}
......
......@@ -72,7 +72,6 @@
android:visibility="gone"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
</LinearLayout>
<TextView
......@@ -248,7 +247,6 @@
android:text=""
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
</RelativeLayout>
<View
......
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