diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ 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 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
new file mode 100644
index 0000000..d03ed90
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightDetailBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightDetailModelImpl;
+import com.casic.dcms.mvp.view.ILightDetailView;
+
+public class LightDetailPresenterImpl extends BasePresenter implements ILightDetailPresenter, LightDetailModelImpl.OnGetDetailListener {
+
+ private ILightDetailView view;
+ private LightDetailModelImpl actionModel;
+
+ public LightDetailPresenterImpl(ILightDetailView detailView) {
+ this.view = detailView;
+ actionModel = new LightDetailModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String lampId) {
+ addSubscription(actionModel.sendRetrofitRequest(lampId));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightDetailBean resultBean) {
+ view.obtainLightDetailBeanResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
new file mode 100644
index 0000000..d03ed90
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightDetailBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightDetailModelImpl;
+import com.casic.dcms.mvp.view.ILightDetailView;
+
+public class LightDetailPresenterImpl extends BasePresenter implements ILightDetailPresenter, LightDetailModelImpl.OnGetDetailListener {
+
+ private ILightDetailView view;
+ private LightDetailModelImpl actionModel;
+
+ public LightDetailPresenterImpl(ILightDetailView detailView) {
+ this.view = detailView;
+ actionModel = new LightDetailModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String lampId) {
+ addSubscription(actionModel.sendRetrofitRequest(lampId));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightDetailBean resultBean) {
+ view.obtainLightDetailBeanResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
new file mode 100644
index 0000000..7baa33c
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightListBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightListModelImpl;
+import com.casic.dcms.mvp.view.ILightListView;
+
+public class LightListPresenterImpl extends BasePresenter implements ILightListPresenter, LightListModelImpl.OnGetListListener {
+
+ private ILightListView view;
+ private LightListModelImpl actionModel;
+
+ public LightListPresenterImpl(ILightListView caseListView) {
+ this.view = caseListView;
+ actionModel = new LightListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int limit, int offset) {
+ addSubscription(actionModel.sendRetrofitRequest(limit, offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightListBean resultBean) {
+ view.obtainLightResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
new file mode 100644
index 0000000..d03ed90
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightDetailBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightDetailModelImpl;
+import com.casic.dcms.mvp.view.ILightDetailView;
+
+public class LightDetailPresenterImpl extends BasePresenter implements ILightDetailPresenter, LightDetailModelImpl.OnGetDetailListener {
+
+ private ILightDetailView view;
+ private LightDetailModelImpl actionModel;
+
+ public LightDetailPresenterImpl(ILightDetailView detailView) {
+ this.view = detailView;
+ actionModel = new LightDetailModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String lampId) {
+ addSubscription(actionModel.sendRetrofitRequest(lampId));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightDetailBean resultBean) {
+ view.obtainLightDetailBeanResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
new file mode 100644
index 0000000..7baa33c
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightListBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightListModelImpl;
+import com.casic.dcms.mvp.view.ILightListView;
+
+public class LightListPresenterImpl extends BasePresenter implements ILightListPresenter, LightListModelImpl.OnGetListListener {
+
+ private ILightListView view;
+ private LightListModelImpl actionModel;
+
+ public LightListPresenterImpl(ILightListView caseListView) {
+ this.view = caseListView;
+ actionModel = new LightListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int limit, int offset) {
+ addSubscription(actionModel.sendRetrofitRequest(limit, offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightListBean resultBean) {
+ view.obtainLightResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
new file mode 100644
index 0000000..2e1bbb0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightDetailBean;
+
+public interface ILightDetailView {
+ void obtainLightDetailBeanResult(LightDetailBean resultBean);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
new file mode 100644
index 0000000..d03ed90
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightDetailBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightDetailModelImpl;
+import com.casic.dcms.mvp.view.ILightDetailView;
+
+public class LightDetailPresenterImpl extends BasePresenter implements ILightDetailPresenter, LightDetailModelImpl.OnGetDetailListener {
+
+ private ILightDetailView view;
+ private LightDetailModelImpl actionModel;
+
+ public LightDetailPresenterImpl(ILightDetailView detailView) {
+ this.view = detailView;
+ actionModel = new LightDetailModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String lampId) {
+ addSubscription(actionModel.sendRetrofitRequest(lampId));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightDetailBean resultBean) {
+ view.obtainLightDetailBeanResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
new file mode 100644
index 0000000..7baa33c
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightListBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightListModelImpl;
+import com.casic.dcms.mvp.view.ILightListView;
+
+public class LightListPresenterImpl extends BasePresenter implements ILightListPresenter, LightListModelImpl.OnGetListListener {
+
+ private ILightListView view;
+ private LightListModelImpl actionModel;
+
+ public LightListPresenterImpl(ILightListView caseListView) {
+ this.view = caseListView;
+ actionModel = new LightListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int limit, int offset) {
+ addSubscription(actionModel.sendRetrofitRequest(limit, offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightListBean resultBean) {
+ view.obtainLightResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
new file mode 100644
index 0000000..2e1bbb0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightDetailBean;
+
+public interface ILightDetailView {
+ void obtainLightDetailBeanResult(LightDetailBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
new file mode 100644
index 0000000..1e7cca0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightListBean;
+
+public interface ILightListView {
+ void obtainLightResult(LightListBean resultBean);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
new file mode 100644
index 0000000..d03ed90
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightDetailBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightDetailModelImpl;
+import com.casic.dcms.mvp.view.ILightDetailView;
+
+public class LightDetailPresenterImpl extends BasePresenter implements ILightDetailPresenter, LightDetailModelImpl.OnGetDetailListener {
+
+ private ILightDetailView view;
+ private LightDetailModelImpl actionModel;
+
+ public LightDetailPresenterImpl(ILightDetailView detailView) {
+ this.view = detailView;
+ actionModel = new LightDetailModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String lampId) {
+ addSubscription(actionModel.sendRetrofitRequest(lampId));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightDetailBean resultBean) {
+ view.obtainLightDetailBeanResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
new file mode 100644
index 0000000..7baa33c
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightListBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightListModelImpl;
+import com.casic.dcms.mvp.view.ILightListView;
+
+public class LightListPresenterImpl extends BasePresenter implements ILightListPresenter, LightListModelImpl.OnGetListListener {
+
+ private ILightListView view;
+ private LightListModelImpl actionModel;
+
+ public LightListPresenterImpl(ILightListView caseListView) {
+ this.view = caseListView;
+ actionModel = new LightListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int limit, int offset) {
+ addSubscription(actionModel.sendRetrofitRequest(limit, offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightListBean resultBean) {
+ view.obtainLightResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
new file mode 100644
index 0000000..2e1bbb0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightDetailBean;
+
+public interface ILightDetailView {
+ void obtainLightDetailBeanResult(LightDetailBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
new file mode 100644
index 0000000..1e7cca0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightListBean;
+
+public interface ILightListView {
+ void obtainLightResult(LightListBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java b/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
index 657ca78..dd3cc70 100644
--- a/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
+++ b/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
@@ -1,6 +1,5 @@
package com.casic.dcms.ui;
-import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
@@ -31,8 +30,6 @@
@BindView(R.id.personViewPager)
NoScrollViewPager personViewPager;
- private Context context = this;
-
@Override
public int initLayoutView() {
return R.layout.activity_online;
@@ -61,7 +58,7 @@
personTabLayout.setupWithViewPager(personViewPager);
LinearLayout linearLayout = (LinearLayout) personTabLayout.getChildAt(0);
linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
- linearLayout.setDividerDrawable(ContextCompat.getDrawable(context, R.drawable.layout_divider_vertical));
+ linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
}
@Override
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
new file mode 100644
index 0000000..d03ed90
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightDetailBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightDetailModelImpl;
+import com.casic.dcms.mvp.view.ILightDetailView;
+
+public class LightDetailPresenterImpl extends BasePresenter implements ILightDetailPresenter, LightDetailModelImpl.OnGetDetailListener {
+
+ private ILightDetailView view;
+ private LightDetailModelImpl actionModel;
+
+ public LightDetailPresenterImpl(ILightDetailView detailView) {
+ this.view = detailView;
+ actionModel = new LightDetailModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String lampId) {
+ addSubscription(actionModel.sendRetrofitRequest(lampId));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightDetailBean resultBean) {
+ view.obtainLightDetailBeanResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
new file mode 100644
index 0000000..7baa33c
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightListBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightListModelImpl;
+import com.casic.dcms.mvp.view.ILightListView;
+
+public class LightListPresenterImpl extends BasePresenter implements ILightListPresenter, LightListModelImpl.OnGetListListener {
+
+ private ILightListView view;
+ private LightListModelImpl actionModel;
+
+ public LightListPresenterImpl(ILightListView caseListView) {
+ this.view = caseListView;
+ actionModel = new LightListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int limit, int offset) {
+ addSubscription(actionModel.sendRetrofitRequest(limit, offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightListBean resultBean) {
+ view.obtainLightResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
new file mode 100644
index 0000000..2e1bbb0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightDetailBean;
+
+public interface ILightDetailView {
+ void obtainLightDetailBeanResult(LightDetailBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
new file mode 100644
index 0000000..1e7cca0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightListBean;
+
+public interface ILightListView {
+ void obtainLightResult(LightListBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java b/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
index 657ca78..dd3cc70 100644
--- a/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
+++ b/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
@@ -1,6 +1,5 @@
package com.casic.dcms.ui;
-import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
@@ -31,8 +30,6 @@
@BindView(R.id.personViewPager)
NoScrollViewPager personViewPager;
- private Context context = this;
-
@Override
public int initLayoutView() {
return R.layout.activity_online;
@@ -61,7 +58,7 @@
personTabLayout.setupWithViewPager(personViewPager);
LinearLayout linearLayout = (LinearLayout) personTabLayout.getChildAt(0);
linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
- linearLayout.setDividerDrawable(ContextCompat.getDrawable(context, R.drawable.layout_divider_vertical));
+ linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
}
@Override
diff --git a/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java b/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java
new file mode 100644
index 0000000..9fbd79e
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java
@@ -0,0 +1,68 @@
+package com.casic.dcms.ui;
+
+import android.view.View;
+import android.widget.LinearLayout;
+
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
+
+import com.casic.dcms.R;
+import com.casic.dcms.adapter.SubViewPagerAdapter;
+import com.casic.dcms.base.BaseActivity;
+import com.casic.dcms.ui.fragment.LightOnListFragment;
+import com.casic.dcms.ui.fragment.LightOnMapFragment;
+import com.casic.dcms.widgets.NoScrollViewPager;
+import com.google.android.material.tabs.TabLayout;
+import com.qmuiteam.qmui.widget.QMUITopBarLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+
+public class StreetlightManagerActivity extends BaseActivity {
+
+ private static final String[] pageTitles = {"路灯分布", "路灯列表"};
+ @BindView(R.id.topLayout)
+ QMUITopBarLayout topLayout;
+ @BindView(R.id.tabLayout)
+ TabLayout tabLayout;
+ @BindView(R.id.viewPager)
+ NoScrollViewPager viewPager;
+
+ @Override
+ public int initLayoutView() {
+ return R.layout.activity_street_light;
+ }
+
+ @Override
+ protected void setupTopBarLayout() {
+ topLayout.setTitle("路灯管理").setTextColor(ContextCompat.getColor(this, R.color.white));
+ topLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.mainThemeColor));
+ topLayout.addLeftImageButton(R.drawable.ic_left_white, 1).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+ }
+
+ @Override
+ public void initData() {
+ List fragmentList = new ArrayList<>();
+ fragmentList.add(new LightOnMapFragment());
+ fragmentList.add(new LightOnListFragment());
+ SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), pageTitles, fragmentList);
+ viewPager.setAdapter(adapter);
+ //绑定TabLayout
+ tabLayout.setupWithViewPager(viewPager);
+ LinearLayout linearLayout = (LinearLayout) tabLayout.getChildAt(0);
+ linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
+ linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
+ }
+
+ @Override
+ public void initEvent() {
+
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
new file mode 100644
index 0000000..d03ed90
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightDetailBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightDetailModelImpl;
+import com.casic.dcms.mvp.view.ILightDetailView;
+
+public class LightDetailPresenterImpl extends BasePresenter implements ILightDetailPresenter, LightDetailModelImpl.OnGetDetailListener {
+
+ private ILightDetailView view;
+ private LightDetailModelImpl actionModel;
+
+ public LightDetailPresenterImpl(ILightDetailView detailView) {
+ this.view = detailView;
+ actionModel = new LightDetailModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String lampId) {
+ addSubscription(actionModel.sendRetrofitRequest(lampId));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightDetailBean resultBean) {
+ view.obtainLightDetailBeanResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
new file mode 100644
index 0000000..7baa33c
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightListBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightListModelImpl;
+import com.casic.dcms.mvp.view.ILightListView;
+
+public class LightListPresenterImpl extends BasePresenter implements ILightListPresenter, LightListModelImpl.OnGetListListener {
+
+ private ILightListView view;
+ private LightListModelImpl actionModel;
+
+ public LightListPresenterImpl(ILightListView caseListView) {
+ this.view = caseListView;
+ actionModel = new LightListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int limit, int offset) {
+ addSubscription(actionModel.sendRetrofitRequest(limit, offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightListBean resultBean) {
+ view.obtainLightResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
new file mode 100644
index 0000000..2e1bbb0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightDetailBean;
+
+public interface ILightDetailView {
+ void obtainLightDetailBeanResult(LightDetailBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
new file mode 100644
index 0000000..1e7cca0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightListBean;
+
+public interface ILightListView {
+ void obtainLightResult(LightListBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java b/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
index 657ca78..dd3cc70 100644
--- a/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
+++ b/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
@@ -1,6 +1,5 @@
package com.casic.dcms.ui;
-import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
@@ -31,8 +30,6 @@
@BindView(R.id.personViewPager)
NoScrollViewPager personViewPager;
- private Context context = this;
-
@Override
public int initLayoutView() {
return R.layout.activity_online;
@@ -61,7 +58,7 @@
personTabLayout.setupWithViewPager(personViewPager);
LinearLayout linearLayout = (LinearLayout) personTabLayout.getChildAt(0);
linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
- linearLayout.setDividerDrawable(ContextCompat.getDrawable(context, R.drawable.layout_divider_vertical));
+ linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
}
@Override
diff --git a/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java b/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java
new file mode 100644
index 0000000..9fbd79e
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java
@@ -0,0 +1,68 @@
+package com.casic.dcms.ui;
+
+import android.view.View;
+import android.widget.LinearLayout;
+
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
+
+import com.casic.dcms.R;
+import com.casic.dcms.adapter.SubViewPagerAdapter;
+import com.casic.dcms.base.BaseActivity;
+import com.casic.dcms.ui.fragment.LightOnListFragment;
+import com.casic.dcms.ui.fragment.LightOnMapFragment;
+import com.casic.dcms.widgets.NoScrollViewPager;
+import com.google.android.material.tabs.TabLayout;
+import com.qmuiteam.qmui.widget.QMUITopBarLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+
+public class StreetlightManagerActivity extends BaseActivity {
+
+ private static final String[] pageTitles = {"路灯分布", "路灯列表"};
+ @BindView(R.id.topLayout)
+ QMUITopBarLayout topLayout;
+ @BindView(R.id.tabLayout)
+ TabLayout tabLayout;
+ @BindView(R.id.viewPager)
+ NoScrollViewPager viewPager;
+
+ @Override
+ public int initLayoutView() {
+ return R.layout.activity_street_light;
+ }
+
+ @Override
+ protected void setupTopBarLayout() {
+ topLayout.setTitle("路灯管理").setTextColor(ContextCompat.getColor(this, R.color.white));
+ topLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.mainThemeColor));
+ topLayout.addLeftImageButton(R.drawable.ic_left_white, 1).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+ }
+
+ @Override
+ public void initData() {
+ List fragmentList = new ArrayList<>();
+ fragmentList.add(new LightOnMapFragment());
+ fragmentList.add(new LightOnListFragment());
+ SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), pageTitles, fragmentList);
+ viewPager.setAdapter(adapter);
+ //绑定TabLayout
+ tabLayout.setupWithViewPager(viewPager);
+ LinearLayout linearLayout = (LinearLayout) tabLayout.getChildAt(0);
+ linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
+ linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
+ }
+
+ @Override
+ public void initEvent() {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/ui/fragment/HomePageFragment.java b/app/src/main/java/com/casic/dcms/ui/fragment/HomePageFragment.java
index 42d29a4..902e0af 100644
--- a/app/src/main/java/com/casic/dcms/ui/fragment/HomePageFragment.java
+++ b/app/src/main/java/com/casic/dcms/ui/fragment/HomePageFragment.java
@@ -35,6 +35,7 @@
import com.casic.dcms.ui.PersonOnlineActivity;
import com.casic.dcms.ui.PipelineManagerActivity;
import com.casic.dcms.ui.PublicToiletActivity;
+import com.casic.dcms.ui.StreetlightManagerActivity;
import com.casic.dcms.ui.UrgentCaseActivity;
import com.casic.dcms.utils.StringHelper;
import com.casic.dcms.utils.ToastHelper;
@@ -169,6 +170,9 @@
case "管网管理":
intent.setClass(context, PipelineManagerActivity.class);
break;
+ case "路灯管理":
+ intent.setClass(context, StreetlightManagerActivity.class);
+ break;
default:
break;
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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 {
+ /**
+ * controllerCode : 732020010001
+ * lampCode : ld-001-test
+ * lampId : 1354712301393547265
+ * latitude : 27.754315
+ * deptId : 1344118138553909250
+ * statusName : 离线
+ * lampName : 测试路灯001
+ * latestTime : 2021-05-28 01:59:10
+ * longitude : 116.0714497
+ * status : 4
+ */
+
+ private String controllerCode;
+ private String lampCode;
+ private String lampId;
+ private double latitude;
+ private String deptId;
+ private String statusName;
+ private String lampName;
+ private String latestTime;
+ private double longitude;
+ private String status;
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getLampName() {
+ return lampName;
+ }
+
+ public void setLampName(String lampName) {
+ this.lampName = lampName;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
new file mode 100644
index 0000000..84f1c03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightDetailModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightDetailModel {
+ Subscription sendRetrofitRequest(String lampId);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
new file mode 100644
index 0000000..d594bfa
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/ILightListModel.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.model;
+
+import rx.Subscription;
+
+public interface ILightListModel {
+ Subscription sendRetrofitRequest(int limit, int offset);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
new file mode 100644
index 0000000..d395650
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightDetailModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightDetailBean;
+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 LightDetailModelImpl implements ILightDetailModel {
+
+ private OnGetDetailListener listener;
+
+ public LightDetailModelImpl(OnGetDetailListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetDetailListener {
+ void onSuccess(LightDetailBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(String lampId) {
+ Observable observable = RetrofitServiceManager.getLightDetailResult(lampId);
+ 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(LightDetailBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
new file mode 100644
index 0000000..440fe03
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/model/LightListModelImpl.java
@@ -0,0 +1,50 @@
+package com.casic.dcms.mvp.model;
+
+import com.casic.dcms.bean.LightListBean;
+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 LightListModelImpl implements ILightListModel {
+
+ private OnGetListListener listener;
+
+ public LightListModelImpl(OnGetListListener listListener) {
+ this.listener = listListener;
+ }
+
+ public interface OnGetListListener {
+ void onSuccess(LightListBean resultBean);
+
+ void onFailure(Throwable throwable);
+ }
+
+ @Override
+ public Subscription sendRetrofitRequest(int limit, int offset) {
+ Observable observable = RetrofitServiceManager.getLightListResult(limit, 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) {
+ listener.onFailure(e);
+ }
+ }
+
+ @Override
+ public void onNext(LightListBean resultBean) {
+ if (resultBean != null) {
+ listener.onSuccess(resultBean);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
new file mode 100644
index 0000000..42bfa93
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightDetailPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightDetailPresenter {
+ void onReadyRetrofitRequest(String lampId);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
new file mode 100644
index 0000000..ee03050
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/ILightListPresenter.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.presenter;
+
+public interface ILightListPresenter {
+ void onReadyRetrofitRequest(int limit, int offset);
+
+ void disposeRetrofitRequest();
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
new file mode 100644
index 0000000..d03ed90
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightDetailPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightDetailBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightDetailModelImpl;
+import com.casic.dcms.mvp.view.ILightDetailView;
+
+public class LightDetailPresenterImpl extends BasePresenter implements ILightDetailPresenter, LightDetailModelImpl.OnGetDetailListener {
+
+ private ILightDetailView view;
+ private LightDetailModelImpl actionModel;
+
+ public LightDetailPresenterImpl(ILightDetailView detailView) {
+ this.view = detailView;
+ actionModel = new LightDetailModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(String lampId) {
+ addSubscription(actionModel.sendRetrofitRequest(lampId));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightDetailBean resultBean) {
+ view.obtainLightDetailBeanResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
new file mode 100644
index 0000000..7baa33c
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/presenter/LightListPresenterImpl.java
@@ -0,0 +1,37 @@
+package com.casic.dcms.mvp.presenter;
+
+import com.casic.dcms.bean.LightListBean;
+import com.casic.dcms.mvp.BasePresenter;
+import com.casic.dcms.mvp.model.LightListModelImpl;
+import com.casic.dcms.mvp.view.ILightListView;
+
+public class LightListPresenterImpl extends BasePresenter implements ILightListPresenter, LightListModelImpl.OnGetListListener {
+
+ private ILightListView view;
+ private LightListModelImpl actionModel;
+
+ public LightListPresenterImpl(ILightListView caseListView) {
+ this.view = caseListView;
+ actionModel = new LightListModelImpl(this);
+ }
+
+ @Override
+ public void onReadyRetrofitRequest(int limit, int offset) {
+ addSubscription(actionModel.sendRetrofitRequest(limit, offset));
+ }
+
+ @Override
+ public void disposeRetrofitRequest() {
+ unSubscription();
+ }
+
+ @Override
+ public void onSuccess(LightListBean resultBean) {
+ view.obtainLightResult(resultBean);
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
new file mode 100644
index 0000000..2e1bbb0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightDetailView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightDetailBean;
+
+public interface ILightDetailView {
+ void obtainLightDetailBeanResult(LightDetailBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
new file mode 100644
index 0000000..1e7cca0
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/mvp/view/ILightListView.java
@@ -0,0 +1,7 @@
+package com.casic.dcms.mvp.view;
+
+import com.casic.dcms.bean.LightListBean;
+
+public interface ILightListView {
+ void obtainLightResult(LightListBean resultBean);
+}
diff --git a/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java b/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
index 657ca78..dd3cc70 100644
--- a/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
+++ b/app/src/main/java/com/casic/dcms/ui/PersonOnlineActivity.java
@@ -1,6 +1,5 @@
package com.casic.dcms.ui;
-import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
@@ -31,8 +30,6 @@
@BindView(R.id.personViewPager)
NoScrollViewPager personViewPager;
- private Context context = this;
-
@Override
public int initLayoutView() {
return R.layout.activity_online;
@@ -61,7 +58,7 @@
personTabLayout.setupWithViewPager(personViewPager);
LinearLayout linearLayout = (LinearLayout) personTabLayout.getChildAt(0);
linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
- linearLayout.setDividerDrawable(ContextCompat.getDrawable(context, R.drawable.layout_divider_vertical));
+ linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
}
@Override
diff --git a/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java b/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java
new file mode 100644
index 0000000..9fbd79e
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/ui/StreetlightManagerActivity.java
@@ -0,0 +1,68 @@
+package com.casic.dcms.ui;
+
+import android.view.View;
+import android.widget.LinearLayout;
+
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
+
+import com.casic.dcms.R;
+import com.casic.dcms.adapter.SubViewPagerAdapter;
+import com.casic.dcms.base.BaseActivity;
+import com.casic.dcms.ui.fragment.LightOnListFragment;
+import com.casic.dcms.ui.fragment.LightOnMapFragment;
+import com.casic.dcms.widgets.NoScrollViewPager;
+import com.google.android.material.tabs.TabLayout;
+import com.qmuiteam.qmui.widget.QMUITopBarLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+
+public class StreetlightManagerActivity extends BaseActivity {
+
+ private static final String[] pageTitles = {"路灯分布", "路灯列表"};
+ @BindView(R.id.topLayout)
+ QMUITopBarLayout topLayout;
+ @BindView(R.id.tabLayout)
+ TabLayout tabLayout;
+ @BindView(R.id.viewPager)
+ NoScrollViewPager viewPager;
+
+ @Override
+ public int initLayoutView() {
+ return R.layout.activity_street_light;
+ }
+
+ @Override
+ protected void setupTopBarLayout() {
+ topLayout.setTitle("路灯管理").setTextColor(ContextCompat.getColor(this, R.color.white));
+ topLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.mainThemeColor));
+ topLayout.addLeftImageButton(R.drawable.ic_left_white, 1).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+ }
+
+ @Override
+ public void initData() {
+ List fragmentList = new ArrayList<>();
+ fragmentList.add(new LightOnMapFragment());
+ fragmentList.add(new LightOnListFragment());
+ SubViewPagerAdapter adapter = new SubViewPagerAdapter(getSupportFragmentManager(), pageTitles, fragmentList);
+ viewPager.setAdapter(adapter);
+ //绑定TabLayout
+ tabLayout.setupWithViewPager(viewPager);
+ LinearLayout linearLayout = (LinearLayout) tabLayout.getChildAt(0);
+ linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
+ linearLayout.setDividerDrawable(ContextCompat.getDrawable(this, R.drawable.layout_divider_vertical));
+ }
+
+ @Override
+ public void initEvent() {
+
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/ui/fragment/HomePageFragment.java b/app/src/main/java/com/casic/dcms/ui/fragment/HomePageFragment.java
index 42d29a4..902e0af 100644
--- a/app/src/main/java/com/casic/dcms/ui/fragment/HomePageFragment.java
+++ b/app/src/main/java/com/casic/dcms/ui/fragment/HomePageFragment.java
@@ -35,6 +35,7 @@
import com.casic.dcms.ui.PersonOnlineActivity;
import com.casic.dcms.ui.PipelineManagerActivity;
import com.casic.dcms.ui.PublicToiletActivity;
+import com.casic.dcms.ui.StreetlightManagerActivity;
import com.casic.dcms.ui.UrgentCaseActivity;
import com.casic.dcms.utils.StringHelper;
import com.casic.dcms.utils.ToastHelper;
@@ -169,6 +170,9 @@
case "管网管理":
intent.setClass(context, PipelineManagerActivity.class);
break;
+ case "路灯管理":
+ intent.setClass(context, StreetlightManagerActivity.class);
+ break;
default:
break;
}
diff --git a/app/src/main/java/com/casic/dcms/ui/fragment/LightOnListFragment.java b/app/src/main/java/com/casic/dcms/ui/fragment/LightOnListFragment.java
new file mode 100644
index 0000000..9f91f43
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/ui/fragment/LightOnListFragment.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.ui.fragment;
+
+import android.content.Context;
+import android.os.Handler;
+import android.os.Message;
+import android.text.TextUtils;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.StaggeredGridLayoutManager;
+
+import com.casic.dcms.R;
+import com.casic.dcms.adapter.LightResultAdapter;
+import com.casic.dcms.base.BaseFragment;
+import com.casic.dcms.bean.LightListBean;
+import com.casic.dcms.mvp.presenter.LightListPresenterImpl;
+import com.casic.dcms.mvp.view.ILightListView;
+import com.casic.dcms.utils.Constant;
+import com.casic.dcms.utils.ToastHelper;
+import com.casic.dcms.widgets.LightDetailDialog;
+import com.qmuiteam.qmui.widget.QMUIEmptyView;
+import com.scwang.smartrefresh.layout.SmartRefreshLayout;
+import com.scwang.smartrefresh.layout.api.RefreshLayout;
+import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
+import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+
+public class LightOnListFragment extends BaseFragment implements ILightListView {
+
+ @BindView(R.id.emptyView)
+ QMUIEmptyView emptyView;
+ @BindView(R.id.refreshLayout)
+ SmartRefreshLayout refreshLayout;
+ @BindView(R.id.lightRecyclerView)
+ RecyclerView lightRecyclerView;
+
+ private static final String TAG = "LightOnListFragment";
+ private Context context;
+ private LightListPresenterImpl lightListPresenter;
+ private int pageIndex = 1;
+ private LightResultAdapter adapter;
+ private List dataBeans = new ArrayList<>();
+ private boolean isRefresh, isLoadMore = false;
+ private static WeakReferenceHandler weakReferenceHandler;
+
+ @Override
+ protected int initLayoutView() {
+ return R.layout.fragment_light_list;
+ }
+
+ @Override
+ protected void setupTopBarLayout() {
+ context = getContext();
+ }
+
+ @Override
+ protected void initData() {
+ lightListPresenter = new LightListPresenterImpl(this);
+ lightListPresenter.onReadyRetrofitRequest(2 * Constant.PAGE_LIMIT, pageIndex);
+
+ weakReferenceHandler = new WeakReferenceHandler(this);
+ }
+
+ @Override
+ protected void initEvent() {
+ refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+ @Override
+ public void onRefresh(@NonNull final RefreshLayout refreshLayout) {
+ isRefresh = true;
+ //刷新之后页码重置
+ pageIndex = 1;
+ lightListPresenter.onReadyRetrofitRequest(Constant.PAGE_LIMIT, pageIndex);
+ }
+ });
+ refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
+ @Override
+ public void onLoadMore(@NonNull final RefreshLayout refreshLayout) {
+ isLoadMore = true;
+ pageIndex++;
+ lightListPresenter.onReadyRetrofitRequest(Constant.PAGE_LIMIT, pageIndex);
+ }
+ });
+ }
+
+ @Override
+ public void obtainLightResult(LightListBean resultBean) {
+ if (resultBean.isSuccess()) {
+ List dataRows = resultBean.getData().getRows();
+ if (isRefresh) {
+ dataBeans.clear();//下拉刷新必须先清空之前的List,不然会出现数据重复的问题
+ dataBeans = dataRows;
+ refreshLayout.finishRefresh();
+ isRefresh = false;
+ } else if (isLoadMore) {
+ if (dataRows.size() == 0) {
+ ToastHelper.showToast("到底了,别拉了", ToastHelper.INFO);
+ }
+ dataBeans.addAll(dataRows);
+ refreshLayout.finishLoadMore();
+ isLoadMore = false;
+ } else {
+ dataBeans = dataRows;
+ }
+ weakReferenceHandler.sendEmptyMessage(20210623);
+ }
+ }
+
+ private static class WeakReferenceHandler extends Handler {
+ private WeakReference reference;
+
+ private WeakReferenceHandler(LightOnListFragment fragment) {
+ reference = new WeakReference<>(fragment);
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ LightOnListFragment fragment = reference.get();
+ if (msg.what == 20210623) {
+ if (fragment.isRefresh || fragment.isLoadMore) {
+ fragment.adapter.notifyDataSetChanged();
+ } else {
+ //首次加载数据
+ if (fragment.dataBeans.size() == 0) {
+ fragment.emptyView.show("没有路灯数据", null);
+ } else {
+ fragment.emptyView.hide();
+ fragment.adapter = new LightResultAdapter(fragment.context, fragment.dataBeans);
+ fragment.lightRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
+ fragment.lightRecyclerView.setAdapter(fragment.adapter);
+ fragment.adapter.setOnGridItemClickListener(new LightResultAdapter.OnGridItemClickListener() {
+ @Override
+ public void onClick(int position) {
+ String lampId = fragment.dataBeans.get(position).getLampId();
+ if (TextUtils.isEmpty(lampId)) {
+ ToastHelper.showToast("错误,路灯编号为空", ToastHelper.ERROR);
+ return;
+ }
+ new LightDetailDialog.Builder()
+ .setContext(fragment.context)
+ .setStreetLightId(lampId)
+ .build()
+ .show();
+ }
+ });
+ fragment.adapter.setOnSwitchClickListener(new LightResultAdapter.OnSwitchClickListener() {
+ @Override
+ public void onClick(int position) {
+ String statusName = fragment.dataBeans.get(position).getStatusName();
+ Log.d(TAG, "onClick: " + statusName);
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ if (lightListPresenter != null) {
+ lightListPresenter.disposeRetrofitRequest();
+ }
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3090a91..a09973d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -91,8 +91,10 @@
-
+
+
+
{
+
+ private Context context;
+ private List dataBeans;
+
+ public LightResultAdapter(Context context, List beans) {
+ this.context = context;
+ this.dataBeans = beans;
+ }
+
+ @NonNull
+ @Override
+ public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(context).inflate(R.layout.item_light_recycleview, parent, false);
+ return new ItemViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull LightResultAdapter.ItemViewHolder holder, int position) {
+ holder.bindView(dataBeans.get(position));
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListener.onClick(position);
+ }
+ });
+ }
+ if (switchClickListener != null) {
+ holder.lightSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchClickListener.onClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return dataBeans.size();
+ }
+
+ private OnGridItemClickListener clickListener;
+
+ public interface OnGridItemClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnGridItemClickListener(OnGridItemClickListener onGridItemClickListener) {
+ this.clickListener = onGridItemClickListener;
+ }
+
+ private OnSwitchClickListener switchClickListener;
+
+ public interface OnSwitchClickListener {
+ void onClick(int position);
+ }
+
+ public void setOnSwitchClickListener(OnSwitchClickListener switchClickListener) {
+ this.switchClickListener = switchClickListener;
+ }
+
+ static class ItemViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView lightNameView;
+ private TextView lightStatusView;
+ // private ImageView lightStatusImageView;
+ private ImageView lightSwitch;
+
+ ItemViewHolder(@NonNull View itemView) {
+ super(itemView);
+ lightNameView = itemView.findViewById(R.id.lightNameView);
+ lightStatusView = itemView.findViewById(R.id.lightStatusView);
+// lightStatusImageView = itemView.findViewById(R.id.lightStatusImageView);
+ lightSwitch = itemView.findViewById(R.id.lightSwitch);
+ }
+
+ void bindView(LightListBean.DataBean.RowsBean dataBean) {
+ lightNameView.setText(dataBean.getLampName());
+ String status = dataBean.getStatus();
+ String statusName = dataBean.getStatusName();
+ lightStatusView.setText(statusName);
+ if (statusName.equals("离线")) {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_off);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_off);
+ } else {
+// lightStatusImageView.setBackgroundResource(R.drawable.ic_streetlight_icon_on);
+ lightSwitch.setBackgroundResource(R.drawable.ic_switch_on);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
new file mode 100644
index 0000000..f365679
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightDetailBean.java
@@ -0,0 +1,489 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightDetailBean {
+
+ 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 {
+ /**
+ * address : 东城路口
+ * areaId :
+ * areaName :
+ * circuitCode :
+ * circuitGroupId :
+ * circuitGroupName :
+ * circuitId :
+ * circuitName :
+ * controllerCode : 732020010013
+ * controllerGroupId : ["1354723273625702401","1355410925412814850","1356885044973264897"]
+ * controllerGroupName : ["全部设备","100台单灯","路灯组2"]
+ * controllerId : 1354708852077629441
+ * controllerLine :
+ * controllerType : 1
+ * controllerTypeName : 单灯控制器
+ * deptId : 1344118138553909250
+ * deptName : 路灯所
+ * groupId :
+ * groupName :
+ * height :
+ * lampCode : ld-013-test
+ * lampId : 1354712301527764999
+ * lampType : 1352138555168387073
+ * lampTypeName : 默认路灯类型(开启报警)
+ * lamppostCode : DCL-DG-013
+ * lamppostId : 1354365980753244162
+ * lamppostName : 东城路灯杆13
+ * lamppostType : 1
+ * lamppostTypeName : 单灯头
+ * latestActivePower : 345.654
+ * latestElec : 1.639
+ * latestPower : 345.654
+ * latestReactivePower : 15.347
+ * latestTime : 2021-05-28 01:59:12
+ * latestVol : 219.44
+ * latitude : 27.755515
+ * longitude : 116.051247
+ * postGroupId :
+ * postGroupName :
+ * power :
+ * status : 4
+ * statusName : 离线
+ * streetId : 1352827149776306178
+ * streetName : 东城路
+ */
+
+ private String address;
+ private String areaId;
+ private String areaName;
+ private String circuitCode;
+ private String circuitGroupId;
+ private String circuitGroupName;
+ private String circuitId;
+ private String circuitName;
+ private String controllerCode;
+ private String controllerId;
+ private String controllerLine;
+ private String controllerType;
+ private String controllerTypeName;
+ private String deptId;
+ private String deptName;
+ private String groupId;
+ private String groupName;
+ private String height;
+ private String lampCode;
+ private String lampId;
+ private String lampType;
+ private String lampTypeName;
+ private String lamppostCode;
+ private String lamppostId;
+ private String lamppostName;
+ private String lamppostType;
+ private String lamppostTypeName;
+ private double latestActivePower;
+ private double latestElec;
+ private double latestPower;
+ private double latestReactivePower;
+ private String latestTime;
+ private double latestVol;
+ private double latitude;
+ private double longitude;
+ private String postGroupId;
+ private String postGroupName;
+ private String power;
+ private String status;
+ private String statusName;
+ private String streetId;
+ private String streetName;
+ private List controllerGroupId;
+ private List controllerGroupName;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAreaId() {
+ return areaId;
+ }
+
+ public void setAreaId(String areaId) {
+ this.areaId = areaId;
+ }
+
+ public String getAreaName() {
+ return areaName;
+ }
+
+ public void setAreaName(String areaName) {
+ this.areaName = areaName;
+ }
+
+ public String getCircuitCode() {
+ return circuitCode;
+ }
+
+ public void setCircuitCode(String circuitCode) {
+ this.circuitCode = circuitCode;
+ }
+
+ public String getCircuitGroupId() {
+ return circuitGroupId;
+ }
+
+ public void setCircuitGroupId(String circuitGroupId) {
+ this.circuitGroupId = circuitGroupId;
+ }
+
+ public String getCircuitGroupName() {
+ return circuitGroupName;
+ }
+
+ public void setCircuitGroupName(String circuitGroupName) {
+ this.circuitGroupName = circuitGroupName;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
+ public String getCircuitName() {
+ return circuitName;
+ }
+
+ public void setCircuitName(String circuitName) {
+ this.circuitName = circuitName;
+ }
+
+ public String getControllerCode() {
+ return controllerCode;
+ }
+
+ public void setControllerCode(String controllerCode) {
+ this.controllerCode = controllerCode;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerLine() {
+ return controllerLine;
+ }
+
+ public void setControllerLine(String controllerLine) {
+ this.controllerLine = controllerLine;
+ }
+
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ public void setControllerType(String controllerType) {
+ this.controllerType = controllerType;
+ }
+
+ public String getControllerTypeName() {
+ return controllerTypeName;
+ }
+
+ public void setControllerTypeName(String controllerTypeName) {
+ this.controllerTypeName = controllerTypeName;
+ }
+
+ public String getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(String deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getDeptName() {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName) {
+ this.deptName = deptName;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+ public String getLampCode() {
+ return lampCode;
+ }
+
+ public void setLampCode(String lampCode) {
+ this.lampCode = lampCode;
+ }
+
+ public String getLampId() {
+ return lampId;
+ }
+
+ public void setLampId(String lampId) {
+ this.lampId = lampId;
+ }
+
+ public String getLampType() {
+ return lampType;
+ }
+
+ public void setLampType(String lampType) {
+ this.lampType = lampType;
+ }
+
+ public String getLampTypeName() {
+ return lampTypeName;
+ }
+
+ public void setLampTypeName(String lampTypeName) {
+ this.lampTypeName = lampTypeName;
+ }
+
+ public String getLamppostCode() {
+ return lamppostCode;
+ }
+
+ public void setLamppostCode(String lamppostCode) {
+ this.lamppostCode = lamppostCode;
+ }
+
+ public String getLamppostId() {
+ return lamppostId;
+ }
+
+ public void setLamppostId(String lamppostId) {
+ this.lamppostId = lamppostId;
+ }
+
+ public String getLamppostName() {
+ return lamppostName;
+ }
+
+ public void setLamppostName(String lamppostName) {
+ this.lamppostName = lamppostName;
+ }
+
+ public String getLamppostType() {
+ return lamppostType;
+ }
+
+ public void setLamppostType(String lamppostType) {
+ this.lamppostType = lamppostType;
+ }
+
+ public String getLamppostTypeName() {
+ return lamppostTypeName;
+ }
+
+ public void setLamppostTypeName(String lamppostTypeName) {
+ this.lamppostTypeName = lamppostTypeName;
+ }
+
+ public double getLatestActivePower() {
+ return latestActivePower;
+ }
+
+ public void setLatestActivePower(double latestActivePower) {
+ this.latestActivePower = latestActivePower;
+ }
+
+ public double getLatestElec() {
+ return latestElec;
+ }
+
+ public void setLatestElec(double latestElec) {
+ this.latestElec = latestElec;
+ }
+
+ public double getLatestPower() {
+ return latestPower;
+ }
+
+ public void setLatestPower(double latestPower) {
+ this.latestPower = latestPower;
+ }
+
+ public double getLatestReactivePower() {
+ return latestReactivePower;
+ }
+
+ public void setLatestReactivePower(double latestReactivePower) {
+ this.latestReactivePower = latestReactivePower;
+ }
+
+ public String getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(String latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public double getLatestVol() {
+ return latestVol;
+ }
+
+ public void setLatestVol(double latestVol) {
+ this.latestVol = latestVol;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getPostGroupId() {
+ return postGroupId;
+ }
+
+ public void setPostGroupId(String postGroupId) {
+ this.postGroupId = postGroupId;
+ }
+
+ public String getPostGroupName() {
+ return postGroupName;
+ }
+
+ public void setPostGroupName(String postGroupName) {
+ this.postGroupName = postGroupName;
+ }
+
+ public String getPower() {
+ return power;
+ }
+
+ public void setPower(String power) {
+ this.power = power;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusName() {
+ return statusName;
+ }
+
+ public void setStatusName(String statusName) {
+ this.statusName = statusName;
+ }
+
+ public String getStreetId() {
+ return streetId;
+ }
+
+ public void setStreetId(String streetId) {
+ this.streetId = streetId;
+ }
+
+ public String getStreetName() {
+ return streetName;
+ }
+
+ public void setStreetName(String streetName) {
+ this.streetName = streetName;
+ }
+
+ public List getControllerGroupId() {
+ return controllerGroupId;
+ }
+
+ public void setControllerGroupId(List controllerGroupId) {
+ this.controllerGroupId = controllerGroupId;
+ }
+
+ public List getControllerGroupName() {
+ return controllerGroupName;
+ }
+
+ public void setControllerGroupName(List controllerGroupName) {
+ this.controllerGroupName = controllerGroupName;
+ }
+ }
+}
diff --git a/app/src/main/java/com/casic/dcms/bean/LightListBean.java b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
new file mode 100644
index 0000000..baf53f4
--- /dev/null
+++ b/app/src/main/java/com/casic/dcms/bean/LightListBean.java
@@ -0,0 +1,171 @@
+package com.casic.dcms.bean;
+
+import java.util.List;
+
+public class LightListBean {
+
+ 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