|
|
|
@ -119,7 +119,7 @@ class DeviceManagerListActivity : BaseActivityOaToolbarViewBinding<ActivityDevic
|
|
|
|
|
|
|
|
|
|
|
|
override fun onRestart() {
|
|
|
|
override fun onRestart() {
|
|
|
|
super.onRestart()
|
|
|
|
super.onRestart()
|
|
|
|
authenticationLoginDeviceAlarmInfoRsa()
|
|
|
|
authenticationLoginDeviceAlarmInfoRsaNoProgress()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun filterChange(){
|
|
|
|
private fun filterChange(){
|
|
|
|
@ -191,6 +191,33 @@ class DeviceManagerListActivity : BaseActivityOaToolbarViewBinding<ActivityDevic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun authenticationLoginDeviceAlarmInfoRsaNoProgress() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//AI三维登录接口
|
|
|
|
|
|
|
|
val userName = Contans.SP.DeviceAlermInfoAccount
|
|
|
|
|
|
|
|
val strPrivateEncode = RSAAndroid.encryptByPrivateKeyForSpiltStr(
|
|
|
|
|
|
|
|
Contans.SP.DeviceAlermInfoPwd,
|
|
|
|
|
|
|
|
RSAAndroid.privateRsaKeyLocal)
|
|
|
|
|
|
|
|
val strPublicDecode = RSAAndroid.decryptByPublicKeyForSpiltStr(
|
|
|
|
|
|
|
|
Contans.SP.DeviceAlermInfoPwd,
|
|
|
|
|
|
|
|
RSAAndroid.publicRsaKeyLocal
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
AuthenticationLoginAIUtils.authenticationDeviceAlermInfoRsaNotShowProgress(
|
|
|
|
|
|
|
|
this, userName, strPublicDecode
|
|
|
|
|
|
|
|
) { _, token ->
|
|
|
|
|
|
|
|
if (token != null && token == "") {
|
|
|
|
|
|
|
|
showToast("设备状态智能监测及分析平台登录失败")
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//登录成功
|
|
|
|
|
|
|
|
//获取区域
|
|
|
|
|
|
|
|
getDeviceAreaListNoProgress()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
|
|
|
e.printStackTrace()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun getDeviceManagerListData() {
|
|
|
|
private fun getDeviceManagerListData() {
|
|
|
|
|
|
|
|
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
@ -288,6 +315,103 @@ class DeviceManagerListActivity : BaseActivityOaToolbarViewBinding<ActivityDevic
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun getDeviceManagerListDataNoProgress() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
|
|
|
|
Contans.IP + Contans.DeviceManagerListUrl,
|
|
|
|
|
|
|
|
RequestMethod.GET
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(binding.rb1.isChecked){
|
|
|
|
|
|
|
|
// request.add("online",true)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if(binding.rb2.isChecked){
|
|
|
|
|
|
|
|
// request.add("online",false)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// val keyword = binding.etKey.text.toString().trim()
|
|
|
|
|
|
|
|
// if(!TextUtils.isEmpty(keyword)){
|
|
|
|
|
|
|
|
// request.add("keyword",keyword)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NohttpUtils.getInstance().addNoProgress(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,
|
|
|
|
|
|
|
|
DeviceManagerListResultBean::class.java
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showLog(GsonUtils.GsonString(bean))
|
|
|
|
|
|
|
|
if (bean != null && bean.code == 20000 && bean.isSuccess && bean.data != null&& bean.data.size>0) {
|
|
|
|
|
|
|
|
deviceManagerList.clear()
|
|
|
|
|
|
|
|
deviceManagerListFilter.clear()
|
|
|
|
|
|
|
|
deviceManagerList.addAll(bean.data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(areaNodeList.size>0){
|
|
|
|
|
|
|
|
for (item in deviceManagerList) {
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(item.areaId)){
|
|
|
|
|
|
|
|
for (itemAreaNode in areaNodeList) {
|
|
|
|
|
|
|
|
if(item.areaId==itemAreaNode.nodeKey){
|
|
|
|
|
|
|
|
item.areaFullName=itemAreaNode.areaFullName
|
|
|
|
|
|
|
|
item.areaFullPath=itemAreaNode.areaFullPath
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
showLog(GsonUtils.GsonString(item))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(binding.rb1.isChecked){
|
|
|
|
|
|
|
|
for (item in deviceManagerList) {
|
|
|
|
|
|
|
|
if(item.online){
|
|
|
|
|
|
|
|
deviceManagerListFilter.add(item)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(binding.rb2.isChecked){
|
|
|
|
|
|
|
|
for (item in deviceManagerList) {
|
|
|
|
|
|
|
|
if(!item.online){
|
|
|
|
|
|
|
|
deviceManagerListFilter.add(item)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(binding.etKey.text.toString().trim())){
|
|
|
|
|
|
|
|
if(deviceManagerListFilter.size>0){
|
|
|
|
|
|
|
|
val deviceManagerListFilterKeyFilter: MutableList<DeviceManagerListResultBean.DeviceManagerItem> = mutableListOf()
|
|
|
|
|
|
|
|
for (item in deviceManagerListFilter) {
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(item.name)&&item.name.contains(binding.etKey.text.toString().trim())){
|
|
|
|
|
|
|
|
deviceManagerListFilterKeyFilter.add(item)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceManagerListFilter.clear()
|
|
|
|
|
|
|
|
deviceManagerListFilter.addAll(deviceManagerListFilterKeyFilter)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deviceManagerListAdapter.notifyDataSetChanged()
|
|
|
|
|
|
|
|
binding.tvNodata.visibility = View.GONE
|
|
|
|
|
|
|
|
binding.lv.visibility=View.VISIBLE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
deviceManagerList.clear()
|
|
|
|
|
|
|
|
deviceManagerListFilter.clear()
|
|
|
|
|
|
|
|
deviceManagerListAdapter.notifyDataSetChanged()
|
|
|
|
|
|
|
|
binding.tvNodata.visibility = View.VISIBLE
|
|
|
|
|
|
|
|
binding.lv.visibility=View.GONE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onFailed(what: Int, response: Response<String?>?) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun getDeviceAreaList() {
|
|
|
|
private fun getDeviceAreaList() {
|
|
|
|
|
|
|
|
|
|
|
|
//DeviceOnlineStatusAreaBean
|
|
|
|
//DeviceOnlineStatusAreaBean
|
|
|
|
@ -337,4 +461,55 @@ class DeviceManagerListActivity : BaseActivityOaToolbarViewBinding<ActivityDevic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun getDeviceAreaListNoProgress() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//DeviceOnlineStatusAreaBean
|
|
|
|
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
|
|
|
|
Contans.IP + Contans.DeviceOnlineStatusAreaBeanUrl,
|
|
|
|
|
|
|
|
RequestMethod.GET
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
NohttpUtils.getInstance().addNoProgress(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,
|
|
|
|
|
|
|
|
DeviceOnlineStatusAreaBean::class.java
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showLog(GsonUtils.GsonString(bean))
|
|
|
|
|
|
|
|
if (bean != null && bean.code == 20000 && bean.isSuccess && bean.data != null && bean.data.size>0) {
|
|
|
|
|
|
|
|
areaList.clear()
|
|
|
|
|
|
|
|
areaNodeList.clear()
|
|
|
|
|
|
|
|
areaList.addAll(bean.data)
|
|
|
|
|
|
|
|
//更新区域
|
|
|
|
|
|
|
|
for (itemArea in areaList) {
|
|
|
|
|
|
|
|
if (itemArea.nodeList != null && itemArea.nodeList.size > 0) {
|
|
|
|
|
|
|
|
for (itemNodeList in itemArea.nodeList) {
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(itemNodeList.cname)) {
|
|
|
|
|
|
|
|
itemNodeList.areaFullPath=itemArea.cname+"/"+itemNodeList.cname
|
|
|
|
|
|
|
|
itemNodeList.areaFullName=itemArea.cname+">"+itemNodeList.cname
|
|
|
|
|
|
|
|
areaNodeList.add(itemNodeList)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
showLog(GsonUtils.GsonString(areaList))
|
|
|
|
|
|
|
|
SPUtils.put(context, Contans.DeviceOnlineStatusAreaBean,result)
|
|
|
|
|
|
|
|
//获取设备管理列表
|
|
|
|
|
|
|
|
getDeviceManagerListDataNoProgress()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onFailed(what: Int, response: Response<String?>?) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|