|
@ -24,6 +24,7 @@ import com.ouxuan.oxface.orderOX.adapter.OrderSelectionAdapter; |
|
|
import com.ouxuan.oxface.orderOX.model.OrderVerificationData; |
|
|
import com.ouxuan.oxface.orderOX.model.OrderVerificationData; |
|
|
import com.ouxuan.oxface.utils.LogManager; |
|
|
import com.ouxuan.oxface.utils.LogManager; |
|
|
import com.ouxuan.oxface.data.LoginDataManager; |
|
|
import com.ouxuan.oxface.data.LoginDataManager; |
|
|
|
|
|
import com.ouxuan.oxface.data.DeviceSelectDataManager; // 添加设备数据管理器导入 |
|
|
import com.bumptech.glide.Glide; |
|
|
import com.bumptech.glide.Glide; |
|
|
import com.bumptech.glide.load.resource.bitmap.CircleCrop; |
|
|
import com.bumptech.glide.load.resource.bitmap.CircleCrop; |
|
|
import com.bumptech.glide.request.RequestOptions; |
|
|
import com.bumptech.glide.request.RequestOptions; |
|
@ -61,6 +62,8 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
|
|
|
|
|
|
// 登录数据管理器 |
|
|
// 登录数据管理器 |
|
|
private LoginDataManager loginDataManager; |
|
|
private LoginDataManager loginDataManager; |
|
|
|
|
|
// 设备数据管理器 |
|
|
|
|
|
private DeviceSelectDataManager deviceDataManager; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
@ -81,6 +84,8 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
|
|
|
|
|
|
// 初始化登录数据管理器(必须在initViews之前) |
|
|
// 初始化登录数据管理器(必须在initViews之前) |
|
|
loginDataManager = LoginDataManager.getInstance(this); |
|
|
loginDataManager = LoginDataManager.getInstance(this); |
|
|
|
|
|
// 初始化设备数据管理器 |
|
|
|
|
|
deviceDataManager = DeviceSelectDataManager.getInstance(this); |
|
|
|
|
|
|
|
|
initViews(); |
|
|
initViews(); |
|
|
initData(); |
|
|
initData(); |
|
@ -263,6 +268,14 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取设备ID |
|
|
|
|
|
int hardwareId = deviceDataManager.getSelectedHardwareId(); |
|
|
|
|
|
if (hardwareId <= 0) { |
|
|
|
|
|
LogManager.logError(TAG, "获取设备ID失败"); |
|
|
|
|
|
showToast("获取设备ID失败,无法核销订单"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 获取订单ID和核销码 |
|
|
// 获取订单ID和核销码 |
|
|
String orderId = order.getOrder_no(); |
|
|
String orderId = order.getOrder_no(); |
|
|
// 将verifyCode声明为final,避免lambda表达式中的问题 |
|
|
// 将verifyCode声明为final,避免lambda表达式中的问题 |
|
@ -274,17 +287,23 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
LogManager.logInfo(TAG, "调用核销接口: orderId=" + orderId + ", verifyCode=" + verifyCode + ", type=" + verificationType); |
|
|
|
|
|
|
|
|
// 获取订单类型 |
|
|
|
|
|
int orderType = order.getOrder_type(); |
|
|
|
|
|
|
|
|
|
|
|
LogManager.logInfo(TAG, "调用核销接口: orderId=" + orderId + ", verifyCode=" + verifyCode + |
|
|
|
|
|
", hardwareId=" + hardwareId + ", orderType=" + orderType); |
|
|
|
|
|
|
|
|
// 显示加载状态 |
|
|
// 显示加载状态 |
|
|
showToast("正在核销订单,请稍候..."); |
|
|
showToast("正在核销订单,请稍候..."); |
|
|
|
|
|
|
|
|
// 调用NetworkUtils.verifyOrder接口进行实际核销,传递verificationType参数 |
|
|
|
|
|
|
|
|
// 调用NetworkUtils.verifyOrder接口进行实际核销,传递设备ID和订单类型 |
|
|
com.ouxuan.oxface.network.utils.NetworkUtils.verifyOrder( |
|
|
com.ouxuan.oxface.network.utils.NetworkUtils.verifyOrder( |
|
|
token, |
|
|
token, |
|
|
orderId, |
|
|
orderId, |
|
|
verifyCode, |
|
|
verifyCode, |
|
|
verificationType, // 传递验证类型参数 |
|
|
|
|
|
|
|
|
verificationType, // 使用verificationType作为type参数 |
|
|
|
|
|
orderType, // 添加orderType参数 |
|
|
|
|
|
hardwareId, // 添加hardwareId参数 |
|
|
new com.ouxuan.oxface.network.callback.NetworkCallback<com.ouxuan.oxface.network.api.PadApiService.VerifyOrderResponse>() { |
|
|
new com.ouxuan.oxface.network.callback.NetworkCallback<com.ouxuan.oxface.network.api.PadApiService.VerifyOrderResponse>() { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -325,6 +344,9 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
intent.putExtra("project", order.getProject()); |
|
|
intent.putExtra("project", order.getProject()); |
|
|
intent.putExtra("status", status); |
|
|
intent.putExtra("status", status); |
|
|
intent.putExtra("message", message); |
|
|
intent.putExtra("message", message); |
|
|
|
|
|
// 添加设备ID和订单类型参数 |
|
|
|
|
|
intent.putExtra("hardware_id", hardwareId); |
|
|
|
|
|
intent.putExtra("order_type_param", orderType); |
|
|
|
|
|
|
|
|
// 传递完整的订单数据和核销结果数据 |
|
|
// 传递完整的订单数据和核销结果数据 |
|
|
intent.putExtra("order_data", new Gson().toJson(order)); |
|
|
intent.putExtra("order_data", new Gson().toJson(order)); |
|
@ -345,6 +367,9 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
resultIntent.putExtra("verification_type", verificationType); |
|
|
resultIntent.putExtra("verification_type", verificationType); |
|
|
resultIntent.putExtra("verify_status", status); |
|
|
resultIntent.putExtra("verify_status", status); |
|
|
resultIntent.putExtra("verify_message", message); |
|
|
resultIntent.putExtra("verify_message", message); |
|
|
|
|
|
// 添加设备ID和订单类型参数 |
|
|
|
|
|
resultIntent.putExtra("hardware_id", hardwareId); |
|
|
|
|
|
resultIntent.putExtra("order_type_param", orderType); |
|
|
|
|
|
|
|
|
setResult(RESULT_OK, resultIntent); |
|
|
setResult(RESULT_OK, resultIntent); |
|
|
finish(); |
|
|
finish(); |
|
@ -372,6 +397,9 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
intent.putExtra("status", "核销失败"); |
|
|
intent.putExtra("status", "核销失败"); |
|
|
intent.putExtra("message", displayMessage); |
|
|
intent.putExtra("message", displayMessage); |
|
|
intent.putExtra("order_data", new Gson().toJson(order)); |
|
|
intent.putExtra("order_data", new Gson().toJson(order)); |
|
|
|
|
|
// 添加设备ID和订单类型参数 |
|
|
|
|
|
intent.putExtra("hardware_id", hardwareId); |
|
|
|
|
|
intent.putExtra("order_type_param", orderType); |
|
|
|
|
|
|
|
|
startActivity(intent); |
|
|
startActivity(intent); |
|
|
|
|
|
|
|
@ -383,6 +411,9 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
resultIntent.putExtra("verification_type", verificationType); |
|
|
resultIntent.putExtra("verification_type", verificationType); |
|
|
resultIntent.putExtra("verify_status", "核销失败"); |
|
|
resultIntent.putExtra("verify_status", "核销失败"); |
|
|
resultIntent.putExtra("verify_message", displayMessage); |
|
|
resultIntent.putExtra("verify_message", displayMessage); |
|
|
|
|
|
// 添加设备ID和订单类型参数 |
|
|
|
|
|
resultIntent.putExtra("hardware_id", hardwareId); |
|
|
|
|
|
resultIntent.putExtra("order_type_param", orderType); |
|
|
|
|
|
|
|
|
setResult(RESULT_OK, resultIntent); |
|
|
setResult(RESULT_OK, resultIntent); |
|
|
finish(); |
|
|
finish(); |
|
@ -408,6 +439,9 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
intent.putExtra("status", "核销异常"); |
|
|
intent.putExtra("status", "核销异常"); |
|
|
intent.putExtra("message", displayMessage); |
|
|
intent.putExtra("message", displayMessage); |
|
|
intent.putExtra("order_data", new Gson().toJson(order)); |
|
|
intent.putExtra("order_data", new Gson().toJson(order)); |
|
|
|
|
|
// 添加设备ID和订单类型参数 |
|
|
|
|
|
intent.putExtra("hardware_id", hardwareId); |
|
|
|
|
|
intent.putExtra("order_type_param", orderType); |
|
|
|
|
|
|
|
|
startActivity(intent); |
|
|
startActivity(intent); |
|
|
|
|
|
|
|
@ -419,6 +453,9 @@ public class OrderSelectionActivity extends AppCompatActivity { |
|
|
resultIntent.putExtra("verification_type", verificationType); |
|
|
resultIntent.putExtra("verification_type", verificationType); |
|
|
resultIntent.putExtra("verify_status", "核销异常"); |
|
|
resultIntent.putExtra("verify_status", "核销异常"); |
|
|
resultIntent.putExtra("verify_message", displayMessage); |
|
|
resultIntent.putExtra("verify_message", displayMessage); |
|
|
|
|
|
// 添加设备ID和订单类型参数 |
|
|
|
|
|
resultIntent.putExtra("hardware_id", hardwareId); |
|
|
|
|
|
resultIntent.putExtra("order_type_param", orderType); |
|
|
|
|
|
|
|
|
setResult(RESULT_OK, resultIntent); |
|
|
setResult(RESULT_OK, resultIntent); |
|
|
finish(); |
|
|
finish(); |
|
|