工作票风险报告提交完成。
parent
16950fdcf5
commit
11d4919201
@ -0,0 +1,35 @@
|
||||
package com.rehome.zhdcoa.bean;
|
||||
|
||||
public class AIRiskListBaseBean {
|
||||
|
||||
//登录是否成功
|
||||
private boolean success;
|
||||
//信息提示
|
||||
private String message;
|
||||
//状态码
|
||||
private int code;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@ -1,21 +1,160 @@
|
||||
package com.rehome.zhdcoa.ui.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.rehome.zhdcoa.Contans
|
||||
import com.rehome.zhdcoa.R
|
||||
import com.rehome.zhdcoa.adapter.WorkRiskLevelListAdapter
|
||||
import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
|
||||
import com.rehome.zhdcoa.bean.WorkRiskLevelListBean
|
||||
import com.rehome.zhdcoa.databinding.ActivityWorkRiskListReportBinding
|
||||
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.weiget.OAToolbar
|
||||
import com.yolanda.nohttp.NoHttp
|
||||
import com.yolanda.nohttp.RequestMethod
|
||||
import com.yolanda.nohttp.rest.Response
|
||||
import javax.net.ssl.HostnameVerifier
|
||||
|
||||
class WorkRiskListReportActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_work_risk_list_report)
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
||||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||
insets
|
||||
class WorkRiskListReportActivity : BaseActivityOaToolbarViewBinding<ActivityWorkRiskListReportBinding>() {
|
||||
|
||||
private lateinit var headView: View
|
||||
|
||||
private var datas: MutableList<WorkRiskLevelListBean.RowsBean> = mutableListOf()
|
||||
private lateinit var mAdapter: WorkRiskLevelListAdapter
|
||||
|
||||
|
||||
override fun getViewBinding() = ActivityWorkRiskListReportBinding.inflate(layoutInflater)
|
||||
|
||||
override fun getToolbar() = binding.toolbarView.toolbar
|
||||
|
||||
override fun initView() {
|
||||
|
||||
initToolbar("每日工作报告")
|
||||
setLeftOnClickListener {
|
||||
finish()
|
||||
}
|
||||
|
||||
binding.lv.emptyView = binding.tvNodata
|
||||
headView = View.inflate(this, R.layout.item_work_risk_list, null)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
authenticationLoginAI()
|
||||
}
|
||||
|
||||
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.authenticationAILogin(
|
||||
this, userName, strPublicDecode
|
||||
) { _, token ->
|
||||
if (token != null && token == "") {
|
||||
showToast("AI三维平台登录失败")
|
||||
} else {
|
||||
getWorkRiskListData()
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getWorkRiskListData() {
|
||||
val request = NoHttp.createStringRequest(
|
||||
Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_RISK_LIST_DAYLY,
|
||||
RequestMethod.GET
|
||||
)
|
||||
|
||||
if (Contans.BASE_URL_AI_3D_SERVER == Contans.BASE_URL_AI_3D_SERVER_EXTRANET) {
|
||||
val socketFactory = NohttpUtils.getSSLSocketFactory(context)
|
||||
if (socketFactory != null) {
|
||||
request.sslSocketFactory = socketFactory
|
||||
request.hostnameVerifier = HostnameVerifier { _, _ -> true }
|
||||
}
|
||||
}
|
||||
|
||||
NohttpUtils.getInstance()
|
||||
.addNoProgress<String>(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,
|
||||
// WorkRiskLevelListBean::class.java
|
||||
// )
|
||||
// if (bean != null && bean.data != null) {
|
||||
// val workRiskLevelLists = bean.data
|
||||
// if (workRiskLevelLists != null && workRiskLevelLists.size > 0) {
|
||||
// binding.tvNodata.visibility = View.GONE
|
||||
// headView.visibility = View.VISIBLE
|
||||
// datas.clear()
|
||||
// datas.addAll(workRiskLevelLists)
|
||||
// mAdapter.notifyDataSetChanged()
|
||||
//
|
||||
// dataA.clear()
|
||||
// dataB.clear()
|
||||
// dataC1.clear()
|
||||
// dataC2.clear()
|
||||
// dataC3.clear()
|
||||
// dataLowRisk.clear()
|
||||
//
|
||||
//
|
||||
// for(item in datas){
|
||||
// showLog(GsonUtils.GsonString(item))
|
||||
// if(item.level!=null&&item.level=="A"){
|
||||
// dataA.add(item)
|
||||
// }
|
||||
// if(item.level!=null&&item.level=="B"){
|
||||
// dataB.add(item)
|
||||
// }
|
||||
// if(item.level!=null&&item.level=="C1"){
|
||||
// dataC1.add(item)
|
||||
// }
|
||||
// if(item.level!=null&&item.level=="C2"){
|
||||
// dataC2.add(item)
|
||||
// }
|
||||
// if(item.level!=null&&item.level=="C3"){
|
||||
// dataC3.add(item)
|
||||
// }
|
||||
// if(item.level!=null&&item.level=="低风险"){
|
||||
// dataLowRisk.add(item)
|
||||
// }
|
||||
// }
|
||||
// binding.tvA.text = dataA.size.toString()
|
||||
// binding.tvB.text = dataB.size.toString()
|
||||
// binding.tvC1.text = dataC1.size.toString()
|
||||
// binding.tvC2.text = dataC2.size.toString()
|
||||
// binding.tvC3.text = dataC3.size.toString()
|
||||
// binding.tvLowLisk.text = dataLowRisk.size.toString()
|
||||
//
|
||||
// } else {
|
||||
// binding.tvNodata.visibility = View.VISIBLE
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onFailed(what: Int, response: Response<String?>?) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.rehome.zhdcoa.weiget;
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.rehome.zhdcoa.R;
|
||||
|
||||
/**
|
||||
* Created by Rehome-rjb1 on 2017/5/31.
|
||||
* 是否审核的对话框
|
||||
*/
|
||||
|
||||
public class BaCheckDialog extends Dialog {
|
||||
|
||||
TextView tvTitle;
|
||||
TextView tvMsg;
|
||||
TextView dialogCommit;
|
||||
LinearLayout layDialogCancel;
|
||||
LinearLayout lv_bottomClick;
|
||||
EditText et_notice;
|
||||
|
||||
private AuditDialogListener listener;
|
||||
|
||||
public BaCheckDialog(@NonNull Context context, String msg, AuditDialogListener listener) {
|
||||
super(context);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
setContentView(R.layout.layout_ba_check_dialog);
|
||||
findView();
|
||||
Window window = getWindow();
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.width = (getScreenWidth(context)) * 2 / 3;
|
||||
window.setGravity(Gravity.CENTER);
|
||||
this.listener = listener;
|
||||
setCancelable(false);
|
||||
setTvMsg(msg);
|
||||
}
|
||||
|
||||
private void findView() {
|
||||
tvTitle = findViewById(R.id.tv_title);
|
||||
tvMsg = findViewById(R.id.tv_msg);
|
||||
lv_bottomClick = findViewById(R.id.bottomClick);
|
||||
dialogCommit = findViewById(R.id.dialog_commit);
|
||||
layDialogCancel = findViewById(R.id.lay_dialog_cancel);
|
||||
et_notice = findViewById(R.id.et_notice);
|
||||
|
||||
dialogCommit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
if (listener != null) {
|
||||
listener.confirm(et_notice.getText().toString().trim());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setTvMsg(String msg) {
|
||||
if (!TextUtils.isEmpty(msg)) {
|
||||
tvMsg.setText(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTvTitle(String title) {
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
tvTitle.setText(title);
|
||||
}
|
||||
}
|
||||
|
||||
public void setNotice(String notice) {
|
||||
if (!TextUtils.isEmpty(notice)) {
|
||||
et_notice.setText(notice);
|
||||
}
|
||||
}
|
||||
|
||||
public void hideBottomClick() {
|
||||
lv_bottomClick.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void hideNotice(String notice) {
|
||||
if (!TextUtils.isEmpty(notice)) {
|
||||
et_notice.setText(notice);
|
||||
et_notice.setEnabled(false);
|
||||
} else {
|
||||
et_notice.setEnabled(false);
|
||||
et_notice.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
//获取屏幕宽度
|
||||
public static int getScreenWidth(Context context) {
|
||||
WindowManager manager = (WindowManager) context
|
||||
.getSystemService(Context.WINDOW_SERVICE);
|
||||
Display display = manager.getDefaultDisplay();
|
||||
return display.getWidth();
|
||||
}
|
||||
|
||||
public interface AuditDialogListener {
|
||||
void confirm(String notice);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFFFFF" />
|
||||
<corners
|
||||
android:bottomRightRadius="10dp"
|
||||
android:bottomLeftRadius="10dp"/>
|
||||
</shape>
|
||||
@ -1,10 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.activity.WorkRiskListReportActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<include
|
||||
android:id="@+id/toolbarView"
|
||||
layout="@layout/layout_base" />
|
||||
|
||||
<include
|
||||
android:id="@+id/item_head"
|
||||
layout="@layout/item_work_risk_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginStart="10px"
|
||||
android:layout_marginEnd="10px"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_height="wrap_content" />
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10px"
|
||||
android:layout_marginEnd="10px"
|
||||
android:layout_marginBottom="10px"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="#00000000"
|
||||
android:dividerHeight="0px"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/viewfinder_mask"
|
||||
android:gravity="center"
|
||||
android:text="暂无数据"/>
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,52 @@
|
||||
<?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="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:gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="提示"
|
||||
android:textColor="#000"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_msg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200px"
|
||||
android:gravity="center"
|
||||
android:text=""
|
||||
android:textColor="#000"
|
||||
android:textSize="40px"
|
||||
android:textStyle="bold" />
|
||||
<EditText
|
||||
android:id="@+id/et_notice"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="90dp"
|
||||
android:maxHeight="250dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:visibility="gone"
|
||||
android:inputType="textMultiLine"
|
||||
android:gravity="start|top"
|
||||
android:ems="10"
|
||||
android:hint="请输入备注内容"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<include layout="@layout/layout_ba_check_dialog_bottom" />
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/bottomClick"
|
||||
android:layout_height="71px"
|
||||
android:layout_marginTop="5px"
|
||||
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:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:background="@drawable/shape_bottom_corner"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:background="@drawable/selector_list_item"
|
||||
android:id="@+id/dialog_commit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="70px"
|
||||
android:layout_weight="8"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="10px"
|
||||
android:text="确定"
|
||||
android:textColor="@color/bule"
|
||||
android:textSize="35px"
|
||||
android:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
Loading…
Reference in New Issue