新增 监测设备在线情况列表zigbee完成

master
wenfei 1 month ago
parent 2632362150
commit 33e6f35a8a

@ -1,6 +1,7 @@
package com.rehome.zhdcoa.adapter
import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import android.view.LayoutInflater
@ -31,6 +32,7 @@ class DeviceOnlineStatusListAdapter(var context: Context,var data: MutableList<A
override fun getBinding(inflater: LayoutInflater,parent: ViewGroup?) = AdapterDeviceOnlineStatusListBinding.inflate(inflater, parent, false)
@SuppressLint("SetTextI18n", "DefaultLocale")
override fun handleData(position: Int, binding: AdapterDeviceOnlineStatusListBinding) {
Log.i("app",type)
val item: Any = data[position]
@ -42,12 +44,13 @@ class DeviceOnlineStatusListAdapter(var context: Context,var data: MutableList<A
binding.llYzjc.visibility= View.GONE
binding.llLljc.visibility= View.GONE
binding.llRcx.visibility= View.GONE
binding.llZigbee.visibility= View.GONE
if(itemBean!=null){
binding.tvSbbh.text = itemBean.id
binding.tvIp.text = itemBean.ip
binding.tvPort.text = itemBean.port
binding.tvDl.text = itemBean.voltage
binding.tvDl.text = String.format("%.0f", itemBean.voltage) + "%"
binding.tvSbmc.text = itemBean.name
binding.tvSj.text = itemBean.lastOnlineTime
binding.tvPhotoManage.setOnClickListener {
@ -62,6 +65,7 @@ class DeviceOnlineStatusListAdapter(var context: Context,var data: MutableList<A
binding.llYzjc.visibility= View.VISIBLE
binding.llLljc.visibility= View.GONE
binding.llRcx.visibility= View.GONE
binding.llZigbee.visibility= View.GONE
if(itemBean!=null){
binding.tvSbbhYzjc.text = itemBean.id
@ -76,6 +80,7 @@ class DeviceOnlineStatusListAdapter(var context: Context,var data: MutableList<A
binding.llYzjc.visibility= View.GONE
binding.llLljc.visibility= View.VISIBLE
binding.llRcx.visibility= View.GONE
binding.llZigbee.visibility= View.GONE
if(itemBean!=null){
binding.tvSbbhLljc.text = itemBean.id
@ -92,6 +97,7 @@ class DeviceOnlineStatusListAdapter(var context: Context,var data: MutableList<A
binding.llYzjc.visibility= View.GONE
binding.llLljc.visibility= View.GONE
binding.llRcx.visibility= View.VISIBLE
binding.llZigbee.visibility= View.GONE
if(itemBean!=null){
binding.tvSbbhRcx.text = itemBean.id
@ -100,13 +106,25 @@ class DeviceOnlineStatusListAdapter(var context: Context,var data: MutableList<A
}
}
if(type=="zigBee 传感器"){
val itemBean:DeviceOnlineStatusListResultBean.DeviceItemZigBee? = GsonUtils.GsonToBean(GsonUtils.GsonString(item),
DeviceOnlineStatusListResultBean.DeviceItemZigBee::class.java)
binding.llCwcz.visibility= View.GONE
binding.llYzjc.visibility= View.GONE
binding.llLljc.visibility= View.GONE
binding.llRcx.visibility= View.GONE
binding.llZigbee.visibility= View.VISIBLE
if(itemBean!=null){
binding.tvSbbhZigbee.text = itemBean.deviceCode
binding.tvTypeZigbee.text = itemBean.category
binding.tvLongZigbee.text = String.format("%.0f", itemBean.sampleLength)
binding.tvPlZigbee.text = String.format("%.0f", itemBean.sampleFreq) + "Hz"
binding.tvSbmcZigbee.text = itemBean.name
binding.tvZcqhZigbee.text = itemBean.bearingNumber
binding.tvPhotoManageZigbee.setOnClickListener {
onItemClickListener.onItemClick(position,binding.tvPhotoManage)
}
}
}
// binding.tvSbwz.text = item.deviceName
// binding.tvSbid.text = item.deviceCode
// binding.tvZj.text = item.specialtyStr
// binding.tvBjqx.text = item.description
// binding.tvSj.text = item.warningTime
}
}

@ -3,6 +3,7 @@ package com.rehome.zhdcoa.bean;
import java.util.List;
import java.util.Objects;
public class DeviceOnlineStatusListResultBean extends DeviceAlarmBaseBean{
private Page data;
@ -91,7 +92,7 @@ public class DeviceOnlineStatusListResultBean extends DeviceAlarmBaseBean{
private String specialty;//专业
private String ip;//ip
private String port;//端口
private String voltage;//电量 测振测温设备
private Double voltage;//电量 测振测温设备
private String positionName;
@ -159,11 +160,11 @@ public class DeviceOnlineStatusListResultBean extends DeviceAlarmBaseBean{
this.port = port;
}
public String getVoltage() {
public Double getVoltage() {
return voltage;
}
public void setVoltage(String voltage) {
public void setVoltage(Double voltage) {
this.voltage = voltage;
}
@ -474,7 +475,7 @@ public class DeviceOnlineStatusListResultBean extends DeviceAlarmBaseBean{
private String alarmThresholdList;
private Boolean online;
private String healthValue;
private Double healthType;
private String healthType;
private String areaId;
private String area;
private String ruleId;
@ -619,11 +620,11 @@ public class DeviceOnlineStatusListResultBean extends DeviceAlarmBaseBean{
this.healthValue = healthValue;
}
public Double getHealthType() {
public String getHealthType() {
return healthType;
}
public void setHealthType(Double healthType) {
public void setHealthType(String healthType) {
this.healthType = healthType;
}

@ -282,10 +282,10 @@ class DeviceAlarmInfoActivity : BaseActivityOaToolbarViewBinding<ActivityDeviceA
if (bean != null && bean.code == 20000 && bean.isSuccess && bean.data != null && bean.data.dataList != null && bean.data.dataList.size>0) {
datas.addAll(bean.data.dataList)
deviceAlarmInfoAdapter.notifyDataSetChanged()
binding.tvNodata.visibility = View.GONE
pageNo++
binding.lv.loadComplete()
}else{
binding.lv.loadComplete()
showToast("没有更多数据啦")
}
}

@ -22,6 +22,7 @@ import com.rehome.zhdcoa.utils.GsonUtils
import com.rehome.zhdcoa.utils.HttpListener
import com.rehome.zhdcoa.utils.NohttpUtils
import com.rehome.zhdcoa.utils.RSAAndroid
import com.rehome.zhdcoa.weiget.LoadListView
import com.rehome.zhdcoa.weiget.OAToolbar
import com.yolanda.nohttp.NoHttp
import com.yolanda.nohttp.RequestMethod
@ -67,15 +68,19 @@ class DeviceOnlineStatusListActivity : BaseActivityOaToolbarViewBinding<Activity
showLog(typeTemp)
binding.lv.emptyView = binding.tvNodata
deviceOnlineStatusListAdapter = DeviceOnlineStatusListAdapter(context, dataList,typeTemp
) { position, _ -> {
) { position, _ ->
run {
val item = dataList[position]
showLog(GsonUtils.GsonString(item))
} }
}
}
binding.lv.adapter = deviceOnlineStatusListAdapter
binding.tvNodata.visibility= View.VISIBLE
binding.lv.visibility=View.GONE
binding.lv.setInterface(LoadListView.ILoadListener {
getAlarmListLoadMoreData()
})
}
override fun initData() {
@ -238,6 +243,9 @@ class DeviceOnlineStatusListActivity : BaseActivityOaToolbarViewBinding<Activity
binding.tvNodata.visibility = View.GONE
binding.lv.visibility=View.VISIBLE
pageNo++
for (item in dataList) {
showLog(GsonUtils.GsonString(item))
}
}else{
dataList.clear()
deviceOnlineStatusListAdapter.setTypeTemp(binding.spZy.selectedItem.toString())
@ -252,5 +260,74 @@ class DeviceOnlineStatusListActivity : BaseActivityOaToolbarViewBinding<Activity
}
})
}
//查区域列表。http://10.19.0.17:1700/dserver/map/area/list?v=1770171007208
private fun getAlarmListLoadMoreData() {
val request = NoHttp.createStringRequest(
Contans.IP + Contans.DeviceOnlineStatusListUrl,
RequestMethod.GET
)
request.add("pageNo",pageNo)
request.add("pageSize",pageSize)
val typeTemp:String = binding.spZy.selectedItem.toString()
//binding.spZy.getSelectedItemPosition()
// if(!TextUtils.isEmpty(zyTemp)){
// request.add("specialty",zyTemp)
// }
val typeIndex:Int = binding.spZy.selectedItemPosition
request.add("type",typeList[typeIndex])
if(binding.rb1.isChecked){
request.add("online",true)
}
if(binding.rb2.isChecked){
request.add("online",false)
}
showLog(typeTemp)
val keyword = binding.etKey.text.toString().trim()
if(!TextUtils.isEmpty(keyword)){
request.add("keyword",keyword)
}
NohttpUtils.getInstance().add(this, 0, request, object : HttpListener<String?> {
override fun onSucceed(what: Int, response: Response<String?>?) {
val result = response?.get()
showLog("----------------")
showLog(result)
val bean = GsonUtils.GsonToBean(
result,
DeviceOnlineStatusListResultBean::class.java
)
showLog(GsonUtils.GsonString(bean))
if (bean != null && bean.code == 20000 && bean.isSuccess && bean.data != null && bean.data.dataList != null && bean.data.dataList.size>0) {
dataList.addAll(bean.data.dataList)
deviceOnlineStatusListAdapter.setTypeTemp(binding.spZy.selectedItem.toString())
deviceOnlineStatusListAdapter.notifyDataSetChanged()
pageNo++
binding.lv.loadComplete()
}else{
showToast("没有更多数据啦")
binding.lv.loadComplete()
}
}
override fun onFailed(what: Int, response: Response<String?>?) {
showToast("加载数据失败")
binding.lv.loadComplete()
}
})
}
}
//加载图片
//http://10.19.0.17:1700/dserver/device/img/002c00bb?v=1770371290474
//区域接口
////查区域列表。http://10.19.0.17:1700/dserver/map/area/list?v=1770171007208

@ -589,4 +589,182 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_zigbee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="UselessParent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="UselessParent">
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设备编号:" />
<TextView
android:id="@+id/tv_sbbh_zigbee"
style="@style/dagerDetailRightStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="类型:" />
<TextView
android:id="@+id/tv_type_zigbee"
style="@style/dagerDetailRightStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="采样长度:" />
<TextView
android:id="@+id/tv_long_zigbee"
style="@style/dagerDetailRightStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="采样频率:" />
<TextView
android:id="@+id/tv_pl_zigbee"
style="@style/dagerDetailRightStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="设备名称:" />
<TextView
android:id="@+id/tv_sbmc_zigbee"
style="@style/dagerDetailRightStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="轴承型号:" />
<TextView
android:id="@+id/tv_zcqh_zigbee"
style="@style/dagerDetailRightStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/dagerListMarginTopStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_photo_manage_zigbee"
style="@style/dagerDetailLeftStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical|end"
android:textColor="#0080ff"
android:layout_marginEnd="10dp"
android:text="图片管理"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Loading…
Cancel
Save