暂定版本
This commit is contained in:
parent
f3ab05ba47
commit
50701ca33d
|
|
@ -78,7 +78,6 @@ import com.bonus.canteen.entity.OrderPayAndroidDTO;
|
|||
import com.bonus.canteen.presentation.SecondPresentation;
|
||||
import com.bonus.canteen.service.data.HeartbeatService;
|
||||
import com.bonus.canteen.service.upload.UpLoadDataService;
|
||||
import com.bonus.canteen.upgrade.UpdateDown;
|
||||
import com.bonus.canteen.utils.DateTimeHelper;
|
||||
import com.bonus.canteen.utils.MyLog;
|
||||
import com.bonus.canteen.utils.OkHttpService;
|
||||
|
|
@ -96,9 +95,13 @@ import com.ccb.facedevice.sdk.utils.NetworkUtils;
|
|||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.gson.Gson;
|
||||
import com.xuexiang.xui.XUI;
|
||||
import com.xuexiang.xui.adapter.simple.XUISimpleAdapter;
|
||||
import com.xuexiang.xui.utils.DensityUtils;
|
||||
import com.xuexiang.xui.utils.WidgetUtils;
|
||||
import com.xuexiang.xui.utils.XToastUtils;
|
||||
import com.xuexiang.xui.widget.dialog.DialogLoader;
|
||||
import com.xuexiang.xui.widget.popupwindow.popup.XUIListPopup;
|
||||
import com.xuexiang.xui.widget.popupwindow.popup.XUIPopup;
|
||||
import com.xuexiang.xutil.XUtil;
|
||||
import com.xuexiang.xutil.common.ClickUtils;
|
||||
|
||||
|
|
@ -904,6 +907,7 @@ public class OperationActivity extends BaseActivity<ActivityCanteenOperationBind
|
|||
dishEntityList.clear();
|
||||
typeSet = new Set[]{new LinkedHashSet<>()};
|
||||
binding.menuCategory.removeAllViews();
|
||||
setViewData(salesMenuEntityList, true);
|
||||
mDishListAdapter.notifyDataSetChanged();
|
||||
mSalesMenuAdapter.notifyDataSetChanged();
|
||||
initMenuData(-1L);
|
||||
|
|
@ -948,8 +952,35 @@ public class OperationActivity extends BaseActivity<ActivityCanteenOperationBind
|
|||
openLoginDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
binding.operationMore.setOnClickListener(v -> {
|
||||
XToastUtils.toast("功能开发中...");
|
||||
initListPopupIfNeed();
|
||||
mListPopup.setAnimStyle(XUIPopup.ANIM_GROW_FROM_CENTER);
|
||||
mListPopup.setPreferredDirection(XUIPopup.DIRECTION_TOP);
|
||||
mListPopup.show(v);
|
||||
});
|
||||
}
|
||||
private XUIListPopup mListPopup;
|
||||
private void initListPopupIfNeed() {
|
||||
if (mListPopup == null) {
|
||||
List<String> listItems = new ArrayList<>();
|
||||
listItems.add("设置");
|
||||
listItems.add("查询余额");
|
||||
XUISimpleAdapter adapter = XUISimpleAdapter.create(this, listItems);
|
||||
mListPopup = new XUIListPopup(this, adapter);
|
||||
mListPopup.create(200, DensityUtils.dp2px(150), (adapterView, view, i, l) -> {
|
||||
XToastUtils.toast(listItems.get(i));
|
||||
switch (i) {
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
mListPopup.dismiss();
|
||||
});
|
||||
mListPopup.setOnDismissListener(() -> {
|
||||
});
|
||||
}
|
||||
}
|
||||
public void openLoginDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(OperationActivity.this);
|
||||
View view = LayoutInflater.from(OperationActivity.this).inflate(R.layout.dialog_login, null);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.bonus.canteen.activity.order.MachineSaleActivity;
|
||||
import com.bonus.canteen.db.AppDatabase;
|
||||
import com.bonus.canteen.db.entity.base.CookMeetTimesInfo;
|
||||
import com.bonus.canteen.db.entity.base.LoginInfo;
|
||||
import com.bonus.canteen.db.entity.base.OfflineOrderInfo;
|
||||
import com.bonus.canteen.db.entity.base.OrderDetailsInfo;
|
||||
import com.bonus.canteen.utils.DateTimeHelper;
|
||||
|
|
@ -36,8 +37,9 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class OrderAdapter extends BaseAdapter {
|
||||
|
||||
|
|
@ -50,6 +52,7 @@ public class OrderAdapter extends BaseAdapter {
|
|||
private OrderDetailsAdapter orderDetailsAdapter;
|
||||
|
||||
public OkHttpService service = new OkHttpService();
|
||||
|
||||
public OrderAdapter(Context ctx, List<OfflineOrderInfo> lst, OrderDetailsAdapter orderDetailsAdapter, List<OrderDetailsInfo> lstDetails) {
|
||||
super();
|
||||
this.contextRef = new WeakReference<>(ctx);
|
||||
|
|
@ -113,78 +116,99 @@ public class OrderAdapter extends BaseAdapter {
|
|||
holder.machineOrState.setText("已退单");
|
||||
holder.machineRefund.setVisibility(View.GONE);
|
||||
}
|
||||
holder.machineRefund.setOnClickListener(v ->
|
||||
ThreadPoolManager.getExecutor().execute(() -> {
|
||||
OfflineOrderInfo offlineOrderInfo = AppDatabase.getDatabase(context).offlineOrderDao().getOfflineOrderById(bean.getOrderId());
|
||||
String money = new BigDecimal(offlineOrderInfo.getAmountDue()).divide(new BigDecimal(100)) + "";
|
||||
if ("0".equals(offlineOrderInfo.getIsOnline())){
|
||||
AppDatabase.getDatabase(context).offlineOrderDao().updatePayStatus("4", bean.getOrderId());
|
||||
Date orderDate = new Date(offlineOrderInfo.getOrderTime());
|
||||
if (DateTimeHelper.format(orderDate, "yyyy-MM-dd").equals(DateTimeHelper.getNowDate())){
|
||||
AppDatabase.getDatabase(context).businessDataDao().updateOffLine(money,"1",DateTimeHelper.getNowDate());
|
||||
}
|
||||
runOnUiThread(() ->{
|
||||
MachineSaleActivity activity = (MachineSaleActivity) context;
|
||||
activity.refreshData();
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_success));
|
||||
}) ;
|
||||
}else{
|
||||
//调用后台退单接口
|
||||
try {
|
||||
FormBody body = new FormBody.Builder().build();
|
||||
String url = WorkConfig.getBaseUrl() + UrlConfig.ORDER_REFUND + "/" + bean.getOrderId();
|
||||
Request request = new Request.Builder().url(url)
|
||||
.post(body).build();
|
||||
String result = service.httpPost(url, body, context, request);
|
||||
Log.d("退单 result",result);
|
||||
if (ObjectUtil.isEmpty(result)){
|
||||
holder.machineRefund.setOnClickListener(v -> {
|
||||
v.setVisibility(View.GONE);
|
||||
ThreadPoolManager.getExecutor().execute(() -> {
|
||||
LoginInfo loginInfo = AppDatabase.getDatabase(context).loginInfoDao().getLoginInfoOne();
|
||||
if (ObjectUtil.isNull(loginInfo)) {
|
||||
runOnUiThread(() -> {
|
||||
XToastUtils.error("退单失败");
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_fail));
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.please_login));
|
||||
XToastUtils.error("请先登录");
|
||||
});
|
||||
}else{
|
||||
JSONObject firstJson = JSONObject.parseObject(result);
|
||||
Log.d("退单 firstJson",firstJson.toJSONString());
|
||||
if (firstJson.getIntValue("code") == 200){
|
||||
AppDatabase.getDatabase(context).offlineOrderDao().updatePayStatus("4", bean.getOrderId());
|
||||
String orderDate = offlineOrderInfo.getOrderTime().substring(0, 10);
|
||||
Log.d("退单",orderDate + "");
|
||||
if (orderDate.equals(DateTimeHelper.getNowDate())){
|
||||
Log.d("退单","在当天");
|
||||
//判断是否在当餐
|
||||
CookMeetTimesInfo cookMeetTimesInfo = AppDatabase.getDatabase(context).cookMeetTimesDao().getDefaultCookMeetTime();
|
||||
if (cookMeetTimesInfo.getIntervalId().equals(cookMeetTimesInfo.getIntervalId())){
|
||||
Log.d("退单","在当餐");
|
||||
//修改当餐数据
|
||||
AppDatabase.getDatabase(context).businessDataDao().updateCurrent(money,"1",DateTimeHelper.getNowDate());
|
||||
return;
|
||||
}
|
||||
OfflineOrderInfo offlineOrderInfo = AppDatabase.getDatabase(context).offlineOrderDao().getOfflineOrderById(bean.getOrderId());
|
||||
String money = new BigDecimal(offlineOrderInfo.getAmountDue()).divide(new BigDecimal(100)) + "";
|
||||
if ("0".equals(offlineOrderInfo.getIsOnline())) {
|
||||
Log.d("getOrderTime", offlineOrderInfo.getOrderTime() + "");
|
||||
Date orderDate = new Date(offlineOrderInfo.getOrderTime());
|
||||
Log.d("getOrderTime", orderDate + "");
|
||||
if (DateTimeHelper.format(orderDate, "yyyy-MM-dd").equals(DateTimeHelper.getNowDate())) {
|
||||
AppDatabase.getDatabase(context).businessDataDao().updateOffLine(money, "1", DateTimeHelper.getNowDate());
|
||||
}
|
||||
AppDatabase.getDatabase(context).offlineOrderDao().updatePayStatus("4", bean.getOrderId());
|
||||
runOnUiThread(() -> {
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_success));
|
||||
MachineSaleActivity activity = (MachineSaleActivity) context;
|
||||
activity.refreshData();
|
||||
});
|
||||
} else {
|
||||
//调用后台退单接口
|
||||
try {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("deviceOrderId", bean.getOrderId());
|
||||
json.put("operationUser", loginInfo.getUserName());
|
||||
String jsonString = json.toString();
|
||||
Log.i("getPersonMessage jsonString", jsonString);
|
||||
// 定义 JSON 的 MediaType
|
||||
MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
||||
// 创建 RequestBody
|
||||
RequestBody body = RequestBody.create(JSON, jsonString);
|
||||
String url = WorkConfig.getBaseUrl() + UrlConfig.ORDER_REFUND;
|
||||
Request request = new Request.Builder().url(url)
|
||||
.post(body).build();
|
||||
String result = service.httpPost(url, body, context, request);
|
||||
Log.d("退单 result", result);
|
||||
if (ObjectUtil.isEmpty(result)) {
|
||||
runOnUiThread(() -> {
|
||||
XToastUtils.error("退单失败");
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_fail));
|
||||
});
|
||||
} else {
|
||||
JSONObject firstJson = JSONObject.parseObject(result);
|
||||
Log.d("退单 firstJson", firstJson.toJSONString());
|
||||
if (firstJson.getIntValue("code") == 200) {
|
||||
AppDatabase.getDatabase(context).offlineOrderDao().updatePayStatus("4", bean.getOrderId());
|
||||
String orderDate = offlineOrderInfo.getOrderTime().substring(0, 10);
|
||||
Log.d("退单", orderDate + "");
|
||||
if (orderDate.equals(DateTimeHelper.getNowDate())) {
|
||||
Log.d("退单", "在当天");
|
||||
//判断是否在当餐
|
||||
CookMeetTimesInfo cookMeetTimesInfo = AppDatabase.getDatabase(context).cookMeetTimesDao().getDefaultCookMeetTime();
|
||||
if (cookMeetTimesInfo.getIntervalId().equals(cookMeetTimesInfo.getIntervalId())) {
|
||||
Log.d("退单", "在当餐");
|
||||
//修改当餐数据
|
||||
AppDatabase.getDatabase(context).businessDataDao().updateCurrent(money, "1", DateTimeHelper.getNowDate());
|
||||
}
|
||||
AppDatabase.getDatabase(context).businessDataDao().updateToday(money, "1", DateTimeHelper.getNowDate());
|
||||
}
|
||||
runOnUiThread(() -> {
|
||||
Log.d("退单", "更新UI");
|
||||
MachineSaleActivity activity = (MachineSaleActivity) context;
|
||||
activity.refreshData();
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_success));
|
||||
});
|
||||
} else if (firstJson.getIntValue("code") == 500) {
|
||||
runOnUiThread(() -> {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
XToastUtils.error(firstJson.getString("msg"));
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_fail));
|
||||
});
|
||||
}
|
||||
AppDatabase.getDatabase(context).businessDataDao().updateToday(money,"1",DateTimeHelper.getNowDate());
|
||||
}
|
||||
runOnUiThread(() ->{
|
||||
Log.d("退单","更新UI");
|
||||
MachineSaleActivity activity = (MachineSaleActivity) context;
|
||||
activity.refreshData();
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_success));
|
||||
}) ;
|
||||
}else if (firstJson.getIntValue("code") == 500){
|
||||
} catch (Exception e) {
|
||||
runOnUiThread(() -> {
|
||||
XToastUtils.error(firstJson.getString("msg"));
|
||||
v.setVisibility(View.VISIBLE);
|
||||
Log.d("退单", "出现错误进入catch");
|
||||
XToastUtils.error("退单失败");
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_fail));
|
||||
});
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
runOnUiThread(() -> {
|
||||
Log.d("退单","出现错误进入catch");
|
||||
XToastUtils.error("退单失败");
|
||||
SoundManager.getInstance().play(Sound.createSimpleSound(R.raw.refund_fail));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
holder.linearLayout.setOnClickListener(v -> {
|
||||
lstDetails = new ArrayList<>();
|
||||
ThreadPoolManager.getExecutor().execute(() -> {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ public class UserInfo {
|
|||
@SerializedName("userName")
|
||||
private String userName;
|
||||
@ColumnInfo
|
||||
@SerializedName("nickName")
|
||||
private String nickName;
|
||||
@ColumnInfo
|
||||
@SerializedName("accId")
|
||||
private String accId;
|
||||
@ColumnInfo
|
||||
|
|
@ -130,7 +133,7 @@ public class UserInfo {
|
|||
}
|
||||
|
||||
public String getPersonalWalletBalance() {
|
||||
return personalWalletBalance;
|
||||
return personalWalletBalance == null ? "0" : personalWalletBalance;
|
||||
}
|
||||
|
||||
public void setPersonalWalletBalance(String personalWalletBalance) {
|
||||
|
|
@ -138,7 +141,7 @@ public class UserInfo {
|
|||
}
|
||||
|
||||
public String getSubsidiesBalance() {
|
||||
return subsidiesBalance;
|
||||
return subsidiesBalance == null ? "0" : subsidiesBalance;
|
||||
}
|
||||
|
||||
public void setSubsidiesBalance(String subsidiesBalance) {
|
||||
|
|
@ -177,11 +180,20 @@ public class UserInfo {
|
|||
this.loginType = loginType;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInfo{" +
|
||||
"userId=" + userId +
|
||||
", userName='" + userName + '\'' +
|
||||
", nickName='" + nickName + '\'' +
|
||||
", accId='" + accId + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", loginType='" + loginType + '\'' +
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public class FaceServer {
|
|||
UserInfo userInfo = AppDatabase.getDatabase(context).userDao().getUserInfoById(String.valueOf(bean.getUserId()));
|
||||
String name = "";
|
||||
if (userInfo != null) {
|
||||
name = userInfo.getUserName();
|
||||
name = userInfo.getNickName();
|
||||
}
|
||||
Log.d(TAG, "initFaceList: " + name + " " + bean.getUserId() + " " + bean.getFeatures() + " " + Arrays.toString(feature));
|
||||
faceRegisterInfoList.add(new FaceRegisterInfo(feature,name , bean.getUserId() + "",
|
||||
|
|
|
|||
|
|
@ -9,11 +9,14 @@ import android.util.Log;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.canteen.db.AppDatabase;
|
||||
import com.bonus.canteen.db.entity.base.BusinessDataInfo;
|
||||
import com.bonus.canteen.db.entity.base.CookMeetTimesInfo;
|
||||
import com.bonus.canteen.db.entity.base.CustPhotoFulInfo;
|
||||
import com.bonus.canteen.db.entity.base.UserInfo;
|
||||
import com.bonus.canteen.face.util.FaceServer;
|
||||
import com.bonus.canteen.service.data.GetBasicDataService;
|
||||
import com.bonus.canteen.service.data.impl.GetBasicDataServiceImp;
|
||||
import com.bonus.canteen.utils.DateTimeHelper;
|
||||
import com.bonus.canteen.utils.ThreadPoolManager;
|
||||
import com.bonus.canteen.utils.WorkConfig;
|
||||
import com.ccb.facedevice.sdk.utils.AppUtil;
|
||||
|
|
@ -205,6 +208,14 @@ public class RabbitMqMqttHelper {
|
|||
GetBasicDataService service = new GetBasicDataServiceImp();
|
||||
service.getDeviceBase();
|
||||
service.getRecipeInformation();
|
||||
BusinessDataInfo businessDataInfo = AppDatabase.getDatabase(context).businessDataDao().getBusinessDataInfoByDate(DateTimeHelper.getNowDate());
|
||||
if (businessDataInfo == null) {
|
||||
//获取当前餐次
|
||||
CookMeetTimesInfo cookMeetTimesInfo = AppDatabase.getDatabase(context).cookMeetTimesDao().getDefaultCookMeetTime();
|
||||
if (cookMeetTimesInfo != null) {
|
||||
AppDatabase.getDatabase(context).businessDataDao().insert(new BusinessDataInfo(DateTimeHelper.getNowDate(), "0", "0", "0", "0", "0", "0", cookMeetTimesInfo.getIntervalId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent("ACTION_UPDATE_MENU");
|
||||
context.sendBroadcast(intent);
|
||||
|
|
|
|||
|
|
@ -24,14 +24,33 @@
|
|||
android:layout_marginStart="15dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="35sp"/>
|
||||
<TextView
|
||||
android:id="@+id/time_show"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/white"
|
||||
android:gravity="center"
|
||||
android:textFontWeight="800"
|
||||
android:textSize="30sp"/>
|
||||
android:elevation="999dp"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/time_show"
|
||||
android:layout_width="320dp"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/white"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textFontWeight="800"
|
||||
android:textSize="30sp"/>
|
||||
<TextView
|
||||
android:id="@+id/operation_more"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/white"
|
||||
android:text="更多"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="end"
|
||||
android:elevation="999dp"
|
||||
android:textFontWeight="800"
|
||||
android:textSize="30sp"/>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
android:background="?attr/xui_config_color_background"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="50dp"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingBottom="50dp">
|
||||
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
android:background="@drawable/btn_login_border_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="20dp"
|
||||
android:padding="20dp">
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
<TextView
|
||||
android:id="@+id/btn_close"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/btn_border_organge_bg_2"
|
||||
android:gravity="center"
|
||||
android:text="取消"
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
<TextView
|
||||
android:id="@+id/btn_ok"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/btn_border_orange_bg"
|
||||
android:gravity="center"
|
||||
android:text="确定"
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue