离线订单、退单等内容
This commit is contained in:
parent
6d88a71514
commit
3d338c2628
|
|
@ -173,7 +173,8 @@ public class MachineSaleActivity extends BaseActivity<MachineSaleOrderMainBindi
|
|||
runOnUiThread(() -> {
|
||||
list.clear();
|
||||
list.addAll(filteredList);
|
||||
orderAdapter.notifyDataSetChanged();
|
||||
orderAdapter = new OrderAdapter(MachineSaleActivity.this,list,orderDetailsAdapter,lstDetails);
|
||||
listViewLeft.setAdapter(orderAdapter);
|
||||
});
|
||||
});
|
||||
// 关闭线程池
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import static com.xuexiang.xutil.XUtil.runOnUiThread;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
|
@ -111,9 +112,19 @@ public class OrderAdapter extends BaseAdapter {
|
|||
holder.machineTotalAmount.setText(new BigDecimal(bean.getAmountDue()).divide(new BigDecimal(100)) + "");
|
||||
holder.machineRealAmount.setText(new BigDecimal(bean.getAmountDue()).divide(new BigDecimal(100)) + "");
|
||||
if ("1".equals(bean.getPayStatus())) {
|
||||
holder.machineOrState.setText("成功");
|
||||
if ("1".equals(bean.getIsOnline())){
|
||||
holder.machineOrState.setText("【消费成功】");
|
||||
holder.machineOrState.setTextColor(Color.parseColor("#3CB371"));
|
||||
}else if ("0".equals(bean.getIsOnline())){
|
||||
holder.machineOrState.setText("【未支付】");
|
||||
holder.machineOrState.setTextColor(Color.RED);
|
||||
}else if ("2".equals(bean.getIsOnline())){
|
||||
holder.machineOrState.setText("【消费成功】");
|
||||
holder.machineOrState.setTextColor(Color.parseColor("#3CB371"));
|
||||
}
|
||||
} else if ("4".equals(bean.getPayStatus())) {
|
||||
holder.machineOrState.setText("已退单");
|
||||
holder.machineOrState.setText("【已退单】");
|
||||
holder.machineOrState.setTextColor(Color.GRAY);
|
||||
holder.machineRefund.setVisibility(View.GONE);
|
||||
}
|
||||
holder.machineRefund.setOnClickListener(v -> {
|
||||
|
|
@ -142,7 +153,7 @@ public class OrderAdapter extends BaseAdapter {
|
|||
MachineSaleActivity activity = (MachineSaleActivity) context;
|
||||
activity.refreshData();
|
||||
});
|
||||
} else {
|
||||
}else {
|
||||
//调用后台退单接口
|
||||
try {
|
||||
JSONObject json = new JSONObject();
|
||||
|
|
@ -181,6 +192,7 @@ public class OrderAdapter extends BaseAdapter {
|
|||
AppDatabase.getDatabase(context).businessDataDao().updateCurrent(money, "1", DateTimeHelper.getNowDate());
|
||||
}
|
||||
AppDatabase.getDatabase(context).businessDataDao().updateToday(money, "1", DateTimeHelper.getNowDate());
|
||||
AppDatabase.getDatabase(context).businessDataDao().updateOffLine(money, "1", DateTimeHelper.getNowDate());
|
||||
}
|
||||
runOnUiThread(() -> {
|
||||
Log.d("退单", "更新UI");
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public interface OfflineOrderInfoDao {
|
|||
@Query("select * from offline_order_info where orderId=:orderId")
|
||||
OfflineOrderInfo getOfflineOrderById(String orderId);
|
||||
|
||||
@Query("select * from offline_order_info where isOnline = 0 and strftime('%Y-%m-%d', orderTime) = :data")
|
||||
@Query("select * from offline_order_info where (isOnline = 0 or isOnline = 2) and strftime('%Y-%m-%d', orderTime) = :data")
|
||||
List<OfflineOrderInfo> getOfflineOrder(String data);
|
||||
@Query("select * from offline_order_info where isOnline = 0 and payStatus = 1")
|
||||
List<OfflineOrderInfo> getOfflineOrderAndToPush();
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class OfflineOrderInfo {
|
|||
@ColumnInfo
|
||||
private String payStatus;
|
||||
@ColumnInfo
|
||||
private String isOnline;
|
||||
private String isOnline; //0: 离线-已消费,未推送,1:在线消费成功 2:离线-推送成功
|
||||
@ColumnInfo
|
||||
private String intervalId;
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public class UpLoadDataService extends Service {
|
|||
JSONObject firstJson = JSONObject.parseObject(result);
|
||||
String code = firstJson.getString("code");
|
||||
if (code.equals("200")) {
|
||||
ThreadPoolManager.getExecutor().execute(() -> AppDatabase.getDatabase(this).offlineOrderDao().updateIsOnline("1", orderInfo.getOrderId()));
|
||||
ThreadPoolManager.getExecutor().execute(() -> AppDatabase.getDatabase(this).offlineOrderDao().updateIsOnline("2", orderInfo.getOrderId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +237,7 @@ public class UpLoadDataService extends Service {
|
|||
JSONObject firstJson = JSONObject.parseObject(result);
|
||||
String code = firstJson.getString("code");
|
||||
if (code.equals("200")) {
|
||||
ThreadPoolManager.getExecutor().execute(() -> AppDatabase.getDatabase(this).offlineOrderDao().updateIsOnline("1", orderInfo.getOrderId()));
|
||||
ThreadPoolManager.getExecutor().execute(() -> AppDatabase.getDatabase(this).offlineOrderDao().updateIsOnline("2", orderInfo.getOrderId()));
|
||||
} else {
|
||||
runOnUiThread(() -> XToastUtils.error(firstJson.getString("msg")));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue