| | |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import com.dayu.pipirrapp.R; |
| | | import com.dayu.pipirrapp.bean.net.DealDetailResult; |
| | | import com.dayu.pipirrapp.bean.net.OrderDetailResult; |
| | | import com.dayu.pipirrapp.databinding.ActivityOrderDetailBinding; |
| | | import com.dayu.pipirrapp.net.ApiManager; |
| | |
| | | public class OrderDetailActivity extends BaseActivity { |
| | | ActivityOrderDetailBinding binding; |
| | | String workOrderId; |
| | | String proResultId; |
| | | |
| | | @Override |
| | | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| | |
| | | |
| | | void initView() { |
| | | workOrderId = this.getIntent().getStringExtra("workOrderId"); |
| | | if (this.getIntent().hasExtra("proResultId")) { |
| | | proResultId = this.getIntent().getStringExtra("proResultId"); |
| | | getHandleData(proResultId); |
| | | } |
| | | if (!TextUtils.isEmpty(workOrderId)) { |
| | | getMarkerData(workOrderId); |
| | | } else { |
| | | this.finish(); |
| | | ToastUtil.showToastLong(this, "当前workOrderId为空"); |
| | | } |
| | | |
| | | |
| | | binding.setItemclidk(OrderDetailActivity.this); |
| | | |
| | | } |
| | |
| | | private void getMarkerData(String workOrderId) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("workOrderId", workOrderId); |
| | | ApiManager.getInstance().requestGetHideLoading(this, Constants.BASE_URL + "/app/workOrder/getOneWorkOrder", OrderDetailResult.class, params, new SubscriberListener<BaseResponse<OrderDetailResult>>() { |
| | | ApiManager.getInstance().requestGet(this, Constants.BASE_URL + "/app/workOrder/getOneWorkOrder", OrderDetailResult.class, params, new SubscriberListener<BaseResponse<OrderDetailResult>>() { |
| | | @Override |
| | | public void onNext(BaseResponse<OrderDetailResult> t) { |
| | | if (t.isSuccess()) { |
| | | if (t.isSuccess()) { |
| | | if (t.getContent() != null) { |
| | | binding.setData(t.getContent()); |
| | | OrderDetailResult orderDetailResult = t.getContent(); |
| | | binding.setData(orderDetailResult); |
| | | if (!TextUtils.isEmpty(t.getContent().getProResultId()) && TextUtils.isEmpty(proResultId)) { |
| | | getHandleData(orderDetailResult.getProResultId()); |
| | | } |
| | | switch (orderDetailResult.getProResultStateId()) { |
| | | case 0://未上报 |
| | | binding.stateText.setTextColor(OrderDetailActivity.this.getResources().getColor(R.color.black)); |
| | | binding.stateText.setBackground(OrderDetailActivity.this.getResources().getDrawable(R.drawable.order_state_no_bg)); |
| | | break; |
| | | case 1://已上报 |
| | | binding.stateText.setTextColor(OrderDetailActivity.this.getResources().getColor(R.color.white)); |
| | | binding.stateText.setBackground(OrderDetailActivity.this.getResources().getDrawable(R.drawable.order_state_wait_bg)); |
| | | binding.dealButton.setVisibility(View.GONE); |
| | | break; |
| | | case 2://已完成 |
| | | binding.stateText.setTextColor(OrderDetailActivity.this.getResources().getColor(R.color.white)); |
| | | binding.stateText.setBackground(OrderDetailActivity.this.getResources().getDrawable(R.drawable.order_state_finish_bg)); |
| | | binding.dealButton.setVisibility(View.GONE); |
| | | break; |
| | | case 3://被驳回 |
| | | binding.stateText.setTextColor(OrderDetailActivity.this.getResources().getColor(R.color.white)); |
| | | binding.stateText.setBackground(OrderDetailActivity.this.getResources().getDrawable(R.drawable.order_state_reject_bg)); |
| | | break; |
| | | |
| | | } |
| | | } else { |
| | | ToastUtil.showToast(OrderDetailActivity.this, t.getMsg()); |
| | | } |
| | | } |
| | | } else { |
| | | ToastUtil.showToast(OrderDetailActivity.this, t.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCloose() { |
| | | super.onCloose(); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取处理详情 |
| | | */ |
| | | private void getHandleData(String proResultId) { |
| | | |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("proResultId", proResultId); |
| | | ApiManager.getInstance().requestGet(this, Constants.BASE_URL + "/app/workOrder/getProResult", DealDetailResult.class, params, new SubscriberListener<BaseResponse<DealDetailResult>>() { |
| | | @Override |
| | | public void onNext(BaseResponse<DealDetailResult> t) { |
| | | if (t.isSuccess()) { |
| | | if (t.isSuccess()) { |
| | | if (t.getContent() != null) { |
| | | binding.setDealData(t.getContent()); |
| | | } else { |
| | | ToastUtil.showToast(OrderDetailActivity.this, t.getMsg()); |
| | | } |
| | |
| | | public void startDealActivity() { |
| | | Intent intent = new Intent(this, OrderDealActivity.class); |
| | | intent.putExtra("workOrderId", workOrderId); |
| | | startActivity(intent); |
| | | startActivityForResult(intent, 1); |
| | | } |
| | | |
| | | } |