diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
new file mode 100644
index 0000000..21cfcc4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
@@ -0,0 +1,9 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IOptionWellModel {
+ Subscription sendRetrofitRequest(String wellId, String bfzt);
+
+ Subscription sendRetrofitRequest(String bfzt);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
new file mode 100644
index 0000000..21cfcc4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
@@ -0,0 +1,9 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IOptionWellModel {
+ Subscription sendRetrofitRequest(String wellId, String bfzt);
+
+ Subscription sendRetrofitRequest(String bfzt);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
new file mode 100644
index 0000000..0c94b69
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IWellListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
new file mode 100644
index 0000000..21cfcc4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
@@ -0,0 +1,9 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IOptionWellModel {
+ Subscription sendRetrofitRequest(String wellId, String bfzt);
+
+ Subscription sendRetrofitRequest(String bfzt);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
new file mode 100644
index 0000000..0c94b69
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IWellListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
new file mode 100644
index 0000000..5e636f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
@@ -0,0 +1,75 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class OptionWellModelImpl implements IOptionWellModel {
+
+ private OnGetOptionResultListener listener;
+
+ public OptionWellModelImpl(OnGetOptionResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetOptionResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String wellId, String bfzt) {
+ Observable observable = RetrofitServiceManager.getSingleOptionWellResult(wellId, bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String bfzt) {
+ Observable observable = RetrofitServiceManager.getBatchOptionWellResult(bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
new file mode 100644
index 0000000..21cfcc4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
@@ -0,0 +1,9 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IOptionWellModel {
+ Subscription sendRetrofitRequest(String wellId, String bfzt);
+
+ Subscription sendRetrofitRequest(String bfzt);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
new file mode 100644
index 0000000..0c94b69
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IWellListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
new file mode 100644
index 0000000..5e636f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
@@ -0,0 +1,75 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class OptionWellModelImpl implements IOptionWellModel {
+
+ private OnGetOptionResultListener listener;
+
+ public OptionWellModelImpl(OnGetOptionResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetOptionResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String wellId, String bfzt) {
+ Observable observable = RetrofitServiceManager.getSingleOptionWellResult(wellId, bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String bfzt) {
+ Observable observable = RetrofitServiceManager.getBatchOptionWellResult(bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
new file mode 100644
index 0000000..189d124
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.WellListBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class WellListModelImpl implements IWellListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public WellListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(WellListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getWellListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(WellListBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
new file mode 100644
index 0000000..21cfcc4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
@@ -0,0 +1,9 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IOptionWellModel {
+ Subscription sendRetrofitRequest(String wellId, String bfzt);
+
+ Subscription sendRetrofitRequest(String bfzt);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
new file mode 100644
index 0000000..0c94b69
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IWellListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
new file mode 100644
index 0000000..5e636f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
@@ -0,0 +1,75 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class OptionWellModelImpl implements IOptionWellModel {
+
+ private OnGetOptionResultListener listener;
+
+ public OptionWellModelImpl(OnGetOptionResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetOptionResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String wellId, String bfzt) {
+ Observable observable = RetrofitServiceManager.getSingleOptionWellResult(wellId, bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String bfzt) {
+ Observable observable = RetrofitServiceManager.getBatchOptionWellResult(bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
new file mode 100644
index 0000000..189d124
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.WellListBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class WellListModelImpl implements IWellListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public WellListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(WellListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getWellListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(WellListBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java
new file mode 100644
index 0000000..624715b
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.AlarmListModelImpl;
+import com.casic.dcms.mvp.view.IAlarmListView;
+
+public class AlarmListPresenterImpl extends BasePresenter implements IAlarmListPresenter, AlarmListModelImpl.OnGetListListener {
+
+ private IAlarmListView view;
+ private AlarmListModelImpl model;
+
+ public AlarmListPresenterImpl(IAlarmListView alarmListView) {
+ this.view = alarmListView;
+ model = new AlarmListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int offset) {
+ addSubscription(model.sendRetrofitRequest(offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(AlarmDataBean resultBean) {
+ view.obtainAlarmResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
new file mode 100644
index 0000000..21cfcc4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
@@ -0,0 +1,9 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IOptionWellModel {
+ Subscription sendRetrofitRequest(String wellId, String bfzt);
+
+ Subscription sendRetrofitRequest(String bfzt);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
new file mode 100644
index 0000000..0c94b69
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IWellListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
new file mode 100644
index 0000000..5e636f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
@@ -0,0 +1,75 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class OptionWellModelImpl implements IOptionWellModel {
+
+ private OnGetOptionResultListener listener;
+
+ public OptionWellModelImpl(OnGetOptionResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetOptionResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String wellId, String bfzt) {
+ Observable observable = RetrofitServiceManager.getSingleOptionWellResult(wellId, bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String bfzt) {
+ Observable observable = RetrofitServiceManager.getBatchOptionWellResult(bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
new file mode 100644
index 0000000..189d124
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.WellListBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class WellListModelImpl implements IWellListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public WellListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(WellListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getWellListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(WellListBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java
new file mode 100644
index 0000000..624715b
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.AlarmListModelImpl;
+import com.casic.dcms.mvp.view.IAlarmListView;
+
+public class AlarmListPresenterImpl extends BasePresenter implements IAlarmListPresenter, AlarmListModelImpl.OnGetListListener {
+
+ private IAlarmListView view;
+ private AlarmListModelImpl model;
+
+ public AlarmListPresenterImpl(IAlarmListView alarmListView) {
+ this.view = alarmListView;
+ model = new AlarmListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int offset) {
+ addSubscription(model.sendRetrofitRequest(offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(AlarmDataBean resultBean) {
+ view.obtainAlarmResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
index 150d279..0cba932 100644
--- a/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
@@ -35,5 +35,6 @@
@Override
public void onFailure(Throwable throwable) {
view.hideProgress();
+ view.obtainDataFail();
}
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
new file mode 100644
index 0000000..21cfcc4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
@@ -0,0 +1,9 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IOptionWellModel {
+ Subscription sendRetrofitRequest(String wellId, String bfzt);
+
+ Subscription sendRetrofitRequest(String bfzt);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
new file mode 100644
index 0000000..0c94b69
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IWellListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
new file mode 100644
index 0000000..5e636f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
@@ -0,0 +1,75 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class OptionWellModelImpl implements IOptionWellModel {
+
+ private OnGetOptionResultListener listener;
+
+ public OptionWellModelImpl(OnGetOptionResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetOptionResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String wellId, String bfzt) {
+ Observable observable = RetrofitServiceManager.getSingleOptionWellResult(wellId, bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String bfzt) {
+ Observable observable = RetrofitServiceManager.getBatchOptionWellResult(bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
new file mode 100644
index 0000000..189d124
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.WellListBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class WellListModelImpl implements IWellListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public WellListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(WellListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getWellListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(WellListBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java
new file mode 100644
index 0000000..624715b
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.AlarmListModelImpl;
+import com.casic.dcms.mvp.view.IAlarmListView;
+
+public class AlarmListPresenterImpl extends BasePresenter implements IAlarmListPresenter, AlarmListModelImpl.OnGetListListener {
+
+ private IAlarmListView view;
+ private AlarmListModelImpl model;
+
+ public AlarmListPresenterImpl(IAlarmListView alarmListView) {
+ this.view = alarmListView;
+ model = new AlarmListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int offset) {
+ addSubscription(model.sendRetrofitRequest(offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(AlarmDataBean resultBean) {
+ view.obtainAlarmResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
index 150d279..0cba932 100644
--- a/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
@@ -35,5 +35,6 @@
@Override
public void onFailure(Throwable throwable) {
view.hideProgress();
+ view.obtainDataFail();
}
}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/CancelAlarmPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/CancelAlarmPresenterImpl.java
new file mode 100644
index 0000000..0d29061
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/CancelAlarmPresenterImpl.java
@@ -0,0 +1,40 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.CancelAlarmModelImpl;
+import com.casic.dcms.mvp.view.ICancelAlarmView;
+
+public class CancelAlarmPresenterImpl extends BasePresenter implements ICancelAlarmPresenter,
+ CancelAlarmModelImpl.OnGetCancelResultListener {
+
+ private ICancelAlarmView view;
+ private CancelAlarmModelImpl actionModel;
+
+ public CancelAlarmPresenterImpl(ICancelAlarmView cancelAlarmView) {
+ this.view = cancelAlarmView;
+ actionModel = new CancelAlarmModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ view.showProgress();
+ addSubscription(actionModel.sendRetrofitRequest(id, jobStatus, handleMessage));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(ActionResultBean resultBean) {
+ view.hideProgress();
+ view.obtainCancelResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+ view.hideProgress();
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@
-
+
{
+
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public AlarmListAdapter(Context context, List dataRows) {
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (cancelClickListener != null) {
+ holder.cancelAlarmButton.setChangeAlphaWhenPress(true);
+ holder.cancelAlarmButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ cancelClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ private OnCancelClickListener cancelClickListener;
+
+ public interface OnCancelClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnCancelClickListener(OnCancelClickListener onCancelClickListener) {
+ this.cancelClickListener = onCancelClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView alarmMessageView;
+ private TextView wellCodeView;
+ private TextView alarmPositionView;
+ private TextView alarmTimeView;
+ private QMUIRoundButton cancelAlarmButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ alarmMessageView = itemView.findViewById(R.id.alarmMessageView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ alarmPositionView = itemView.findViewById(R.id.alarmPositionView);
+ alarmTimeView = itemView.findViewById(R.id.alarmTimeView);
+ cancelAlarmButton = itemView.findViewById(R.id.cancelAlarmButton);
+ }
+
+ void bindView(AlarmDataBean.DataBean.RowsBean rowsBean) {
+ alarmMessageView.setText(rowsBean.getAlarmMessage());
+ wellCodeView.setText(rowsBean.getWellCode());
+ alarmPositionView.setText(rowsBean.getPosition());
+ alarmTimeView.setText(rowsBean.getAlarmTime());
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
new file mode 100644
index 0000000..e5c2883
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/adapter/WellListAdapter.java
@@ -0,0 +1,139 @@
+package com.casic.dcms.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.casic.dcms.R;
+import com.casic.dcms.bean.WellListBean;
+import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
+
+import java.util.List;
+
+public class WellListAdapter extends RecyclerView.Adapter {
+
+ private Context context;
+ private List dataRows;
+ private LayoutInflater layoutInflater;
+
+ public WellListAdapter(Context context, List dataRows) {
+ this.context = context;
+ this.dataRows = dataRows;
+ layoutInflater = LayoutInflater.from(context);
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = layoutInflater.inflate(R.layout.item_well_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
+ holder.bindView(dataRows.get(position));
+ if (buttonOptionListener != null) {
+ holder.wellOptionButton.setChangeAlphaWhenPress(true);
+ holder.wellOptionButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonOptionListener.onClick(position);
+ }
+ });
+ }
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ private OnOptionClickListener buttonOptionListener;
+
+ public interface OnOptionClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnOptionClickListener(OnOptionClickListener optionClickListener) {
+ this.buttonOptionListener = optionClickListener;
+ }
+
+ private OnItemClickListener clickListener;
+
+ public interface OnItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+ this.clickListener = onItemClickListener;
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataRows.size();
+ }
+
+ class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView wellTypeView;
+ private TextView wellNameView;
+ private TextView wellCodeView;
+ private TextView wellPositionView;
+ private TextView wellStatusView;
+ private QMUIRoundButton wellOptionButton;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ wellTypeView = itemView.findViewById(R.id.wellTypeView);
+ wellNameView = itemView.findViewById(R.id.wellNameView);
+ wellCodeView = itemView.findViewById(R.id.wellCodeView);
+ wellPositionView = itemView.findViewById(R.id.wellPositionView);
+ wellStatusView = itemView.findViewById(R.id.wellStatusView);
+ wellOptionButton = itemView.findViewById(R.id.wellOptionButton);
+ }
+
+ @SuppressLint("SetTextI18n")
+ void bindView(WellListBean.DataBean.RowsBean rowsBean) {
+ wellTypeView.setText(rowsBean.getWellTypeName());
+ wellNameView.setText(rowsBean.getWellName());
+ wellNameView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
+ .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
+ .setTipWord("井深" + rowsBean.getDeep() + "m")
+ .create();
+ tipDialog.show();
+ wellNameView.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ tipDialog.dismiss();
+ }
+ }, 2000);
+ }
+ });
+ wellCodeView.setText(rowsBean.getWellCode());
+ wellPositionView.setText(rowsBean.getPosition());
+ wellStatusView.setText("已" + rowsBean.getBfztName());
+ String bfzt = rowsBean.getBfzt();
+ if (bfzt.equals("0")) {
+ wellOptionButton.setText("布防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.onLineColor));
+ } else {
+ wellOptionButton.setText("撤防");
+ wellOptionButton.setBackgroundColor(ContextCompat.getColor(context, R.color.qmui_config_color_red));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
new file mode 100644
index 0000000..eca89ea
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/AlarmDataBean.java
@@ -0,0 +1,301 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class AlarmDataBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * alarmContent : 1
+ * deptName : 崇仁县城管局
+ * jobStatus : 0
+ * alarmContentName : 井盖开盖报警
+ * wellCode : GX_WSD_4107_HLDD037
+ * alarmTime : 2019-06-24 11:47:10
+ * deptid : 24
+ * alarmTypeName : 一次报警
+ * alarmMessage : 井盖开盖报警
+ * staff : 超级管理员
+ * deviceId : 1356438698347016196
+ * jobId : 1232266
+ * jobStatusName : 待处理
+ * alarmType : 1
+ * alarmValue : --
+ * devcode : 412020110003
+ * statusName : 正在报警
+ * alarmLevel :
+ * tel : 18200000000
+ * id : 11409
+ * wellId : 36962
+ * position : 活力大道
+ * status : 1
+ */
+
+ private int alarmContent;
+ private String deptName;
+ private String jobStatus;
+ private String alarmContentName;
+ private String wellCode;
+ private String alarmTime;
+ private String deptid;
+ private String alarmTypeName;
+ private String alarmMessage;
+ private String staff;
+ private String deviceId;
+ private String jobId;
+ private String jobStatusName;
+ private String alarmType;
+ private String alarmValue;
+ private String devcode;
+ private String statusName;
+ private String alarmLevel;
+ private String tel;
+ private String id;
+ private String wellId;
+ private String position;
+ private String status;
+
+ public int getAlarmContent() {
+ return alarmContent;
+ }
+
+ public void setAlarmContent(int alarmContent) {
+ this.alarmContent = alarmContent;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(String jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public String getAlarmContentName() {
+ return alarmContentName;
+ }
+
+ public void setAlarmContentName(String alarmContentName) {
+ this.alarmContentName = alarmContentName;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getAlarmTime() {
+ return alarmTime;
+ }
+
+ public void setAlarmTime(String alarmTime) {
+ this.alarmTime = alarmTime;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public String getAlarmTypeName() {
+ return alarmTypeName;
+ }
+
+ public void setAlarmTypeName(String alarmTypeName) {
+ this.alarmTypeName = alarmTypeName;
+ }
+
+ public String getAlarmMessage() {
+ return alarmMessage;
+ }
+
+ public void setAlarmMessage(String alarmMessage) {
+ this.alarmMessage = alarmMessage;
+ }
+
+ public String getStaff() {
+ return staff;
+ }
+
+ public void setStaff(String staff) {
+ this.staff = staff;
+ }
+
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ public void setDeviceId(String deviceId) {
+ this.deviceId = deviceId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobStatusName() {
+ return jobStatusName;
+ }
+
+ public void setJobStatusName(String jobStatusName) {
+ this.jobStatusName = jobStatusName;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmValue() {
+ return alarmValue;
+ }
+
+ public void setAlarmValue(String alarmValue) {
+ this.alarmValue = alarmValue;
+ }
+
+ public String getDevcode() {
+ return devcode;
+ }
+
+ public void setDevcode(String devcode) {
+ this.devcode = devcode;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getAlarmLevel() {
+ return alarmLevel;
+ }
+
+ public void setAlarmLevel(String alarmLevel) {
+ this.alarmLevel = alarmLevel;
+ }
+
+ public String getTel() {
+ return tel;
+ }
+
+ public void setTel(String tel) {
+ this.tel = tel;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getWellId() {
+ return wellId;
+ }
+
+ public void setWellId(String wellId) {
+ this.wellId = wellId;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/WellListBean.java b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
new file mode 100644
index 0000000..d8a3c74
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/WellListBean.java
@@ -0,0 +1,361 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class WellListBean {
+
+ private int code;
+ private DataBean data;
+ private String message;
+ private boolean success;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public DataBean getData() {
+ return data;
+ }
+
+ public void setData(DataBean data) {
+ this.data = data;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public static class DataBean {
+
+ private int total;
+ private List rows;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getRows() {
+ return rows;
+ }
+
+ public void setRows(List rows) {
+ this.rows = rows;
+ }
+
+ public static class RowsBean {
+ /**
+ * area : 361024100
+ * bfzt : 1
+ * bfztName : 布防
+ * coordinateX : 116.076
+ * coordinateY : 27.755
+ * deep : 2.96
+ * deptName : 崇仁县城管局
+ * deptid : 24
+ * deviceCount : 1
+ * id : 36925
+ * latBaidu :
+ * latGaode : 27.751926269532
+ * lngBaidu :
+ * lngGaode : 116.081106499566
+ * notes :
+ * photos :
+ * position : 巴山二路
+ * qu : 361024
+ * responsibleDept : 1344110695992258561
+ * responsibleDeptName : 市政工程管理所
+ * ts :
+ * valid : 1
+ * wellCode : GX_WSD_4107_BSEL001
+ * wellFlag1 :
+ * wellFlag2 :
+ * wellFlag3 :
+ * wellName : YS092
+ * wellType : 2
+ * wellTypeName : 污水井
+ */
+
+ private String area;
+ private String bfzt;
+ private String bfztName;
+ private String coordinateX;
+ private String coordinateY;
+ private double deep;
+ private String deptName;
+ private String deptid;
+ private int deviceCount;
+ private String id;
+ private String latBaidu;
+ private String latGaode;
+ private String lngBaidu;
+ private String lngGaode;
+ private String notes;
+ private String photos;
+ private String position;
+ private String qu;
+ private String responsibleDept;
+ private String responsibleDeptName;
+ private String ts;
+ private String valid;
+ private String wellCode;
+ private String wellFlag1;
+ private String wellFlag2;
+ private String wellFlag3;
+ private String wellName;
+ private String wellType;
+ private String wellTypeName;
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getBfzt() {
+ return bfzt;
+ }
+
+ public void setBfzt(String bfzt) {
+ this.bfzt = bfzt;
+ }
+
+ public String getBfztName() {
+ return bfztName;
+ }
+
+ public void setBfztName(String bfztName) {
+ this.bfztName = bfztName;
+ }
+
+ public String getCoordinateX() {
+ return coordinateX;
+ }
+
+ public void setCoordinateX(String coordinateX) {
+ this.coordinateX = coordinateX;
+ }
+
+ public String getCoordinateY() {
+ return coordinateY;
+ }
+
+ public void setCoordinateY(String coordinateY) {
+ this.coordinateY = coordinateY;
+ }
+
+ public double getDeep() {
+ return deep;
+ }
+
+ public void setDeep(double deep) {
+ this.deep = deep;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getDeptid() {
+ return deptid;
+ }
+
+ public void setDeptid(String deptid) {
+ this.deptid = deptid;
+ }
+
+ public int getDeviceCount() {
+ return deviceCount;
+ }
+
+ public void setDeviceCount(int deviceCount) {
+ this.deviceCount = deviceCount;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLatBaidu() {
+ return latBaidu;
+ }
+
+ public void setLatBaidu(String latBaidu) {
+ this.latBaidu = latBaidu;
+ }
+
+ public String getLatGaode() {
+ return latGaode;
+ }
+
+ public void setLatGaode(String latGaode) {
+ this.latGaode = latGaode;
+ }
+
+ public String getLngBaidu() {
+ return lngBaidu;
+ }
+
+ public void setLngBaidu(String lngBaidu) {
+ this.lngBaidu = lngBaidu;
+ }
+
+ public String getLngGaode() {
+ return lngGaode;
+ }
+
+ public void setLngGaode(String lngGaode) {
+ this.lngGaode = lngGaode;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public String getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(String photos) {
+ this.photos = photos;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getQu() {
+ return qu;
+ }
+
+ public void setQu(String qu) {
+ this.qu = qu;
+ }
+
+ public String getResponsibleDept() {
+ return responsibleDept;
+ }
+
+ public void setResponsibleDept(String responsibleDept) {
+ this.responsibleDept = responsibleDept;
+ }
+
+ public String getResponsibleDeptName() {
+ return responsibleDeptName;
+ }
+
+ public void setResponsibleDeptName(String responsibleDeptName) {
+ this.responsibleDeptName = responsibleDeptName;
+ }
+
+ public String getTs() {
+ return ts;
+ }
+
+ public void setTs(String ts) {
+ this.ts = ts;
+ }
+
+ public String getValid() {
+ return valid;
+ }
+
+ public void setValid(String valid) {
+ this.valid = valid;
+ }
+
+ public String getWellCode() {
+ return wellCode;
+ }
+
+ public void setWellCode(String wellCode) {
+ this.wellCode = wellCode;
+ }
+
+ public String getWellFlag1() {
+ return wellFlag1;
+ }
+
+ public void setWellFlag1(String wellFlag1) {
+ this.wellFlag1 = wellFlag1;
+ }
+
+ public String getWellFlag2() {
+ return wellFlag2;
+ }
+
+ public void setWellFlag2(String wellFlag2) {
+ this.wellFlag2 = wellFlag2;
+ }
+
+ public String getWellFlag3() {
+ return wellFlag3;
+ }
+
+ public void setWellFlag3(String wellFlag3) {
+ this.wellFlag3 = wellFlag3;
+ }
+
+ public String getWellName() {
+ return wellName;
+ }
+
+ public void setWellName(String wellName) {
+ this.wellName = wellName;
+ }
+
+ public String getWellType() {
+ return wellType;
+ }
+
+ public void setWellType(String wellType) {
+ this.wellType = wellType;
+ }
+
+ public String getWellTypeName() {
+ return wellTypeName;
+ }
+
+ public void setWellTypeName(String wellTypeName) {
+ this.wellTypeName = wellTypeName;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
new file mode 100644
index 0000000..5f5b8a9
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/AlarmListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class AlarmListModelImpl implements IAlarmListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public AlarmListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(AlarmDataBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getAlarmListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(AlarmDataBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
new file mode 100644
index 0000000..dc31347
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/CancelAlarmModelImpl.java
@@ -0,0 +1,51 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class CancelAlarmModelImpl implements ICancelAlarmModel {
+
+ private OnGetCancelResultListener listener;
+
+ public CancelAlarmModelImpl(OnGetCancelResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetCancelResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ Observable observable = RetrofitServiceManager.getCancelAlarmResult(id,
+ jobStatus, handleMessage);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
new file mode 100644
index 0000000..fc8b4ce
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IAlarmListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IAlarmListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
new file mode 100644
index 0000000..ebf5c2d
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ICancelAlarmModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ICancelAlarmModel {
+ Subscription sendRetrofitRequest(String id, String jobStatus, String handleMessage);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
new file mode 100644
index 0000000..21cfcc4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IOptionWellModel.java
@@ -0,0 +1,9 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IOptionWellModel {
+ Subscription sendRetrofitRequest(String wellId, String bfzt);
+
+ Subscription sendRetrofitRequest(String bfzt);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
new file mode 100644
index 0000000..0c94b69
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/IWellListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface IWellListModel {
+ Subscription sendRetrofitRequest(int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
new file mode 100644
index 0000000..5e636f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/OptionWellModelImpl.java
@@ -0,0 +1,75 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class OptionWellModelImpl implements IOptionWellModel {
+
+ private OnGetOptionResultListener listener;
+
+ public OptionWellModelImpl(OnGetOptionResultListener resultListener) {
+ this.listener = resultListener;
+ }
+
+ public interface OnGetOptionResultListener {
+ void onSuccess(ActionResultBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String wellId, String bfzt) {
+ Observable observable = RetrofitServiceManager.getSingleOptionWellResult(wellId, bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String bfzt) {
+ Observable observable = RetrofitServiceManager.getBatchOptionWellResult(bfzt);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(ActionResultBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
new file mode 100644
index 0000000..189d124
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/WellListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.WellListBean;
+import com.casic.dcms.utils.retrofit.RetrofitServiceManager;
+
+import rx.Observable;
+import rx.Observer;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+public class WellListModelImpl implements IWellListModel {
+
+ private OnGetListListener onGetListListener;
+
+ public WellListModelImpl(OnGetListListener listener) {
+ this.onGetListListener = listener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(WellListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int offset) {
+ Observable observable = RetrofitServiceManager.getWellListResult(offset);
+ return observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer() {
+ @Override
+ public void onCompleted() {
+
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ if (e.getCause() != null) {
+ onGetListListener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(WellListBean resultBean) {
+ if (resultBean != null) {
+ onGetListListener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java
new file mode 100644
index 0000000..624715b
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/AlarmListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.AlarmDataBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.AlarmListModelImpl;
+import com.casic.dcms.mvp.view.IAlarmListView;
+
+public class AlarmListPresenterImpl extends BasePresenter implements IAlarmListPresenter, AlarmListModelImpl.OnGetListListener {
+
+ private IAlarmListView view;
+ private AlarmListModelImpl model;
+
+ public AlarmListPresenterImpl(IAlarmListView alarmListView) {
+ this.view = alarmListView;
+ model = new AlarmListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int offset) {
+ addSubscription(model.sendRetrofitRequest(offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(AlarmDataBean resultBean) {
+ view.obtainAlarmResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
index 150d279..0cba932 100644
--- a/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/AuthenticatePresenterImpl.java
@@ -35,5 +35,6 @@
@Override
public void onFailure(Throwable throwable) {
view.hideProgress();
+ view.obtainDataFail();
}
}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/CancelAlarmPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/CancelAlarmPresenterImpl.java
new file mode 100644
index 0000000..0d29061
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/CancelAlarmPresenterImpl.java
@@ -0,0 +1,40 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.ActionResultBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.CancelAlarmModelImpl;
+import com.casic.dcms.mvp.view.ICancelAlarmView;
+
+public class CancelAlarmPresenterImpl extends BasePresenter implements ICancelAlarmPresenter,
+ CancelAlarmModelImpl.OnGetCancelResultListener {
+
+ private ICancelAlarmView view;
+ private CancelAlarmModelImpl actionModel;
+
+ public CancelAlarmPresenterImpl(ICancelAlarmView cancelAlarmView) {
+ this.view = cancelAlarmView;
+ actionModel = new CancelAlarmModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String id, String jobStatus, String handleMessage) {
+ view.showProgress();
+ addSubscription(actionModel.sendRetrofitRequest(id, jobStatus, handleMessage));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(ActionResultBean resultBean) {
+ view.hideProgress();
+ view.obtainCancelResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+ view.hideProgress();
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/IAlarmListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/IAlarmListPresenter.java
new file mode 100644
index 0000000..550deec
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/IAlarmListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface IAlarmListPresenter {
+ void onReadyRetrofitRequest(int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a09973d..febcd02 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -93,8 +93,8 @@