珠海电厂珠电E办公APP 管理-安防-作业风险清单 列表数据点击入口调整,由之前的点击风险等级后跳转进入工作情况汇报页面改为点击工作票号进入
parent
fb9a36c562
commit
8049685769
@ -0,0 +1,307 @@
|
||||
package com.rehome.zhdcoa.ui.activity
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.Window
|
||||
import android.widget.CompoundButton
|
||||
import android.widget.RadioGroup
|
||||
import android.widget.Toast
|
||||
import com.rehome.zhdcoa.App
|
||||
import com.rehome.zhdcoa.Contans
|
||||
import com.rehome.zhdcoa.R
|
||||
import com.rehome.zhdcoa.bean.AIRiskListBaseBean
|
||||
import com.rehome.zhdcoa.databinding.ActivityCustomDialogChangeLevelBinding
|
||||
import com.rehome.zhdcoa.utils.AuthenticationLoginAIUtils
|
||||
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.utils.SPUtils
|
||||
import com.rehome.zhdcoa.weiget.BaCheckDialog
|
||||
import com.yolanda.nohttp.NoHttp
|
||||
import com.yolanda.nohttp.RequestMethod
|
||||
import com.yolanda.nohttp.rest.Response
|
||||
import javax.net.ssl.HostnameVerifier
|
||||
|
||||
class CustomDialogChangeLevelActivity : Activity() {
|
||||
protected lateinit var binding: ActivityCustomDialogChangeLevelBinding
|
||||
|
||||
private var id: Int?=null
|
||||
private var level: String?=null
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
//必须在调用setContentView()之前调用requestWindowFeature()
|
||||
//requestWindowFeature(Window.FEATURE_LEFT_ICON);//要标题栏显示图标
|
||||
//全屏操作,一定要放在加载根view之前
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
window.decorView.setBackgroundColor(Color.TRANSPARENT)
|
||||
binding=ActivityCustomDialogChangeLevelBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
//setContentView(R.layout.activity_custom_dialog_change_level)
|
||||
|
||||
id = intent.getIntExtra("id", 0)
|
||||
level = intent.getStringExtra("level")
|
||||
if(level!=null){
|
||||
if("A" == level){
|
||||
binding.rb1.isChecked = true
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
if("B" == level){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = true
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
if("C1" == level){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = true
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
if("C2" == level){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = true
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
if("C3" == level){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = true
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
if("低风险" == level){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = true
|
||||
}
|
||||
}
|
||||
binding.rb1.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
|
||||
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
||||
if(isChecked){
|
||||
binding.rb1.isChecked = true
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
}
|
||||
})
|
||||
binding.rb2.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
|
||||
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
||||
if(isChecked){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = true
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
}
|
||||
})
|
||||
binding.rb3.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
|
||||
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
||||
if(isChecked){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = true
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
}
|
||||
})
|
||||
binding.rb4.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
|
||||
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
||||
if(isChecked){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = true
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
}
|
||||
})
|
||||
binding.rb5.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
|
||||
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
||||
if(isChecked){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = true
|
||||
binding.rb6.isChecked = false
|
||||
}
|
||||
}
|
||||
})
|
||||
binding.rb6.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
|
||||
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
||||
if(isChecked){
|
||||
binding.rb1.isChecked = false
|
||||
binding.rb2.isChecked = false
|
||||
binding.rb3.isChecked = false
|
||||
binding.rb4.isChecked = false
|
||||
binding.rb5.isChecked = false
|
||||
binding.rb6.isChecked = true
|
||||
}
|
||||
}
|
||||
})
|
||||
binding.bottomView.dialogCancel.setOnClickListener(View.OnClickListener {
|
||||
finish()
|
||||
})
|
||||
binding.bottomView.dialogCommit.setOnClickListener(View.OnClickListener {
|
||||
authenticationLoginAI()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示toast
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
fun showToast(text: String) {
|
||||
Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
open fun showLog(logText: String?) {
|
||||
if (isApkInDebug(this)) {
|
||||
if (TextUtils.isEmpty(logText)) {
|
||||
Log.i("app", "logText is null")
|
||||
} else {
|
||||
Log.i("app", logText!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前应用是否是debug状态
|
||||
*/
|
||||
fun isApkInDebug(context: Context): Boolean {
|
||||
try {
|
||||
val info = context.applicationInfo
|
||||
return (info.flags and ApplicationInfo.FLAG_DEBUGGABLE) != 0
|
||||
} catch (e: Exception) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
private fun authenticationLoginAI() {
|
||||
try {
|
||||
//AI三维登录接口
|
||||
val userName = Contans.SP.AI_ACCOUNT
|
||||
//String strPrivateEncode=RSAAndroid.encryptByPrivateKeyForSpiltStr(Contans.SP.AI_PWD,RSAAndroid.privateRsaKeyLocal);
|
||||
val strPublicDecode = RSAAndroid.decryptByPublicKeyForSpiltStr(
|
||||
Contans.SP.AI_PWD_ENCODE,
|
||||
RSAAndroid.publicRsaKeyLocal
|
||||
)
|
||||
AuthenticationLoginAIUtils.authenticationAILoginShowProgress(
|
||||
this, userName, strPublicDecode
|
||||
) { _, token ->
|
||||
if (token != null && token == "") {
|
||||
showToast("AI三维平台登录失败")
|
||||
} else {
|
||||
getWorkRiskListData()
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSubmitJsonData(): String {
|
||||
val param = HashMap<String, Any>()
|
||||
|
||||
if(id!=null){
|
||||
param["ticketId"] = id!!
|
||||
}
|
||||
|
||||
param["jobNo"]= App.getInstance().userInfo.manid
|
||||
|
||||
if(binding.rb1.isChecked){
|
||||
param["level"] = "A"
|
||||
}else if(binding.rb2.isChecked){
|
||||
param["level"] = "B"
|
||||
}else if(binding.rb3.isChecked){
|
||||
param["level"] = "C1"
|
||||
}else if(binding.rb4.isChecked){
|
||||
param["level"] = "C2"
|
||||
}else if(binding.rb5.isChecked){
|
||||
param["level"] = "C3"
|
||||
}else if(binding.rb6.isChecked){
|
||||
param["level"] = "低风险"
|
||||
}
|
||||
val json = GsonUtils.GsonString(param)
|
||||
showLog(json)
|
||||
return json
|
||||
}
|
||||
|
||||
private fun getWorkRiskListData() {
|
||||
val request = NoHttp.createStringRequest(
|
||||
Contans.BASE_URL_AI_3D_SERVER + Contans.UPDATE_RISK_LEVEL,
|
||||
RequestMethod.POST
|
||||
)
|
||||
|
||||
val json: String = getSubmitJsonData()
|
||||
request.setDefineRequestBodyForJson(json)
|
||||
|
||||
if (Contans.BASE_URL_AI_3D_SERVER == Contans.BASE_URL_AI_3D_SERVER_EXTRANET) {
|
||||
val socketFactory = NohttpUtils.getSSLSocketFactory(this)
|
||||
if (socketFactory != null) {
|
||||
request.sslSocketFactory = socketFactory
|
||||
request.hostnameVerifier = HostnameVerifier { _, _ -> true }
|
||||
}
|
||||
}
|
||||
|
||||
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 aiRiskListBaseBean = GsonUtils.GsonToBean(
|
||||
result,
|
||||
AIRiskListBaseBean::class.java
|
||||
)
|
||||
if (aiRiskListBaseBean != null && aiRiskListBaseBean.isSuccess() && aiRiskListBaseBean.getCode() == 20000) {
|
||||
showToast("修改风险等级成功")
|
||||
val resultIntent = Intent()
|
||||
val bundle = Bundle()
|
||||
bundle.putString("code", "23823")
|
||||
resultIntent.putExtras(bundle)
|
||||
setResult(RESULT_OK, resultIntent)
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailed(what: Int, response: Response<String?>?) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true">
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#bd9668"/>
|
||||
<corners android:radius="8dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/white"/>
|
||||
<corners android:radius="8dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/radius"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:gravity="center"
|
||||
android:text="更改工作票等级"
|
||||
android:textColor="#000"
|
||||
android:textSize="21sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/gray" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb1"
|
||||
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"
|
||||
android:text="A"
|
||||
android:textColor="#666666"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb2"
|
||||
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="B"
|
||||
android:textColor="#666666"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb3"
|
||||
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="C1"
|
||||
android:textColor="#666666"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb4"
|
||||
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="C2"
|
||||
android:textColor="#666666"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb5"
|
||||
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="C3"
|
||||
android:textColor="#666666"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb6"
|
||||
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="低风险"
|
||||
android:textColor="#666666"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<include
|
||||
android:id="@+id/bottomView"
|
||||
layout="@layout/layout_dialog_bottom_custom" />
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="41dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/gray" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lay_dialog_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:background="@drawable/selector_list_item"
|
||||
android:id="@+id/dialog_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_weight="8"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="10px"
|
||||
android:text="取消"
|
||||
android:textColor="@color/bule"
|
||||
android:textSize="18sp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<View
|
||||
android:layout_width="1px"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/gray" />
|
||||
|
||||
<TextView
|
||||
android:background="@drawable/selector_list_item"
|
||||
android:id="@+id/dialog_commit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_weight="8"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="10px"
|
||||
android:text="确定"
|
||||
android:textColor="@color/bule"
|
||||
android:textSize="18sp"
|
||||
android:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
Loading…
Reference in New Issue