| @@ -19,8 +19,8 @@ android { | |||||
| // minSdkVersion 26 | // minSdkVersion 26 | ||||
| minSdkVersion 21 | minSdkVersion 21 | ||||
| targetSdkVersion 25 | targetSdkVersion 25 | ||||
| versionCode 14 | |||||
| versionName "2.1.0" | |||||
| versionCode 16 | |||||
| versionName "2.1.1" | |||||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||||
| // ndk { | // ndk { | ||||
| @@ -71,6 +71,7 @@ android { | |||||
| buildConfigField "String", "M_URL", '"https://m.qbjjyyun.net"' | buildConfigField "String", "M_URL", '"https://m.qbjjyyun.net"' | ||||
| buildConfigField "String", "OA_URL", '"https://oa.qbjjyyun.net"' | buildConfigField "String", "OA_URL", '"https://oa.qbjjyyun.net"' | ||||
| buildConfigField "String", "APP_NAME", '"一体化平台"' | buildConfigField "String", "APP_NAME", '"一体化平台"' | ||||
| buildConfigField "String", "MP_APPID", '"wx358f1c471740cb95"' | |||||
| // buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"' | // buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"' | ||||
| // buildConfigField "String", "M_URL", '"http://192.168.69.99:8098"' | // buildConfigField "String", "M_URL", '"http://192.168.69.99:8098"' | ||||
| @@ -91,7 +92,8 @@ android { | |||||
| // buildConfigField "String", "OA_URL", '"http://192.168.69.114:3000"' | // buildConfigField "String", "OA_URL", '"http://192.168.69.114:3000"' | ||||
| buildConfigField "String", "M_URL", '"https://m.live.educlouddata.com/"' | buildConfigField "String", "M_URL", '"https://m.live.educlouddata.com/"' | ||||
| buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"' | buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"' | ||||
| buildConfigField "String", "APP_NAME", '"家校互通(开发)"' | |||||
| buildConfigField "String", "APP_NAME", '"一体化平台(开发)"' | |||||
| buildConfigField "String", "MP_APPID", '"wxbb397ddae71bb14c"' | |||||
| } | } | ||||
| yzx_test { | yzx_test { | ||||
| @@ -104,6 +106,7 @@ android { | |||||
| buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"' | buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"' | ||||
| buildConfigField "String", "M_URL", '"http://192.168.69.99:8098"' | buildConfigField "String", "M_URL", '"http://192.168.69.99:8098"' | ||||
| buildConfigField "String", "APP_NAME", '"家校互通(测试)"' | buildConfigField "String", "APP_NAME", '"家校互通(测试)"' | ||||
| buildConfigField "String", "MP_APPID", '"wxbb397ddae71bb14c"' | |||||
| } | } | ||||
| applicationVariants.all { variant -> | applicationVariants.all { variant -> | ||||
| @@ -239,7 +239,7 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||||
| dialogList.add(dialog) | dialogList.add(dialog) | ||||
| } | } | ||||
| //接收访客消息 | |||||
| //接收查看图片消息 | |||||
| @Subscribe(threadMode = ThreadMode.MAIN) | @Subscribe(threadMode = ThreadMode.MAIN) | ||||
| fun onMessageEvent(detail: ViewImage) { | fun onMessageEvent(detail: ViewImage) { | ||||
| removeOld(detail.id,3) | removeOld(detail.id,3) | ||||
| @@ -22,21 +22,49 @@ class VisitorListAdapter(list: MutableList<Visitor>) : | |||||
| @SuppressLint("SetTextI18n") | @SuppressLint("SetTextI18n") | ||||
| override fun convert(holder: BaseViewHolder, item: Visitor) { | override fun convert(holder: BaseViewHolder, item: Visitor) { | ||||
| holder.itemView.userName.text = item.user_name | holder.itemView.userName.text = item.user_name | ||||
| if (item.face_key.isNullOrBlank()) { | |||||
| holder.itemView.faceEmpty.visibility = View.VISIBLE | |||||
| holder.itemView.faceImg.visibility = View.GONE | |||||
| } else { | |||||
| if (item.face_key.isNotEmpty()) { | |||||
| holder.itemView.faceImg.visibility = View.VISIBLE | holder.itemView.faceImg.visibility = View.VISIBLE | ||||
| holder.itemView.faceEmpty.visibility = View.GONE | holder.itemView.faceEmpty.visibility = View.GONE | ||||
| holder.itemView.faceImg.setSrc(item.face_identity, item.face_key) | holder.itemView.faceImg.setSrc(item.face_identity, item.face_key) | ||||
| } | |||||
| if (item.health_code_key.isNullOrBlank()) { | |||||
| holder.itemView.healthCodeEmpty.visibility = View.VISIBLE | |||||
| holder.itemView.healthCodeImg.visibility = View.GONE | |||||
| } else { | } else { | ||||
| holder.itemView.healthCodeImg.visibility = View.VISIBLE | |||||
| holder.itemView.healthCodeEmpty.visibility = View.GONE | |||||
| holder.itemView.healthCodeImg.setSrc(item.health_code_identity, item.health_code_key) | |||||
| holder.itemView.faceEmpty.visibility = View.VISIBLE | |||||
| holder.itemView.faceImg.visibility = View.GONE | |||||
| } | |||||
| when { | |||||
| item.health_code_status >= 0 -> { | |||||
| holder.itemView.healthCodeStatusLayout.visibility = View.VISIBLE | |||||
| holder.itemView.healthCodeImg.visibility = View.GONE | |||||
| holder.itemView.healthCodeEmpty.visibility = View.GONE | |||||
| when (item.health_code_status) { | |||||
| 0 -> { | |||||
| holder.itemView.healthCodeStatus.text = "状态:绿码" | |||||
| holder.itemView.healthCodeStatus.textColor = Color.parseColor("#5DAD64") | |||||
| } | |||||
| 1 -> { | |||||
| holder.itemView.healthCodeStatus.text = "状态:黄码" | |||||
| holder.itemView.healthCodeStatus.textColor = Color.parseColor("#FCCF13") | |||||
| } | |||||
| 10 -> { | |||||
| holder.itemView.healthCodeStatus.text = "状态:红码" | |||||
| holder.itemView.healthCodeStatus.textColor = Color.parseColor("#FC0416") | |||||
| } | |||||
| } | |||||
| } | |||||
| item.health_code_key.isNotEmpty() -> { | |||||
| holder.itemView.healthCodeStatusLayout.visibility = View.GONE | |||||
| holder.itemView.healthCodeImg.visibility = View.VISIBLE | |||||
| holder.itemView.healthCodeEmpty.visibility = View.GONE | |||||
| holder.itemView.healthCodeImg.setSrc( | |||||
| item.health_code_identity, | |||||
| item.health_code_key | |||||
| ) | |||||
| } | |||||
| else -> { | |||||
| holder.itemView.healthCodeStatusLayout.visibility = View.GONE | |||||
| holder.itemView.healthCodeEmpty.visibility = View.VISIBLE | |||||
| holder.itemView.healthCodeImg.visibility = View.GONE | |||||
| } | |||||
| } | } | ||||
| if (item.trip_code_key.isNullOrBlank()) { | if (item.trip_code_key.isNullOrBlank()) { | ||||
| holder.itemView.tripCodeEmpty.visibility = View.VISIBLE | holder.itemView.tripCodeEmpty.visibility = View.VISIBLE | ||||
| @@ -8,6 +8,7 @@ object Config { | |||||
| var APP_NAME = BuildConfig.APP_NAME | var APP_NAME = BuildConfig.APP_NAME | ||||
| var M_URL = BuildConfig.M_URL | var M_URL = BuildConfig.M_URL | ||||
| var OA_URL = BuildConfig.OA_URL | var OA_URL = BuildConfig.OA_URL | ||||
| var MP_APPID = BuildConfig.MP_APPID | |||||
| val APP_ID = 602 | val APP_ID = 602 | ||||
| @@ -5,6 +5,8 @@ object YzxInterface { | |||||
| const val FILE_UPLOAD_URL = "https://fileupload.oa.qbjjyyun.net/edufile/fileUpload" | const val FILE_UPLOAD_URL = "https://fileupload.oa.qbjjyyun.net/edufile/fileUpload" | ||||
| const val INTERFACE_REFRESH_TOKEN = "/login/user2/refreshToken"// 刷新token | const val INTERFACE_REFRESH_TOKEN = "/login/user2/refreshToken"// 刷新token | ||||
| const val INTERFACE_GET_ACCESS_TOKEN= "/rights/weixin/getAccessTokenByAppId" // 通过app_id获取access_token | |||||
| const val INTERFACE_GET_MINI_CODE= "/parent/mini/getMiniCode" // 获取小程序二维码 | |||||
| /** | /** | ||||
| * 学生请假 | * 学生请假 | ||||
| @@ -16,9 +16,7 @@ import com.yzx.escreen.model.User | |||||
| import com.yzx.escreen.presenter.MyPresenter | import com.yzx.escreen.presenter.MyPresenter | ||||
| import com.yzx.escreen.presenter.MyView | import com.yzx.escreen.presenter.MyView | ||||
| import com.yzx.escreen.utils.hideNavigationBar | import com.yzx.escreen.utils.hideNavigationBar | ||||
| import kotlinx.android.synthetic.main.fragment_change.* | |||||
| import kotlinx.android.synthetic.main.fragment_my.* | import kotlinx.android.synthetic.main.fragment_my.* | ||||
| import kotlinx.android.synthetic.main.fragment_my.timeView | |||||
| import org.greenrobot.eventbus.EventBus | import org.greenrobot.eventbus.EventBus | ||||
| import org.greenrobot.eventbus.Subscribe | import org.greenrobot.eventbus.Subscribe | ||||
| import org.greenrobot.eventbus.ThreadMode | import org.greenrobot.eventbus.ThreadMode | ||||
| @@ -119,10 +117,10 @@ class MyFragment : BaseFragment<MyPresenter>(), MyView { | |||||
| override fun initPresenter(): MyPresenter = MyPresenter(this) | override fun initPresenter(): MyPresenter = MyPresenter(this) | ||||
| override fun onUserInfoSuccess(info: TeacherInfo) { | override fun onUserInfoSuccess(info: TeacherInfo) { | ||||
| userName.text = info.teacher_name | userName.text = info.teacher_name | ||||
| sex.text = if (info.sex == 1) { | |||||
| "男" | |||||
| } else { | |||||
| "女" | |||||
| sex.text = when (info.sex) { | |||||
| 1 -> "男" | |||||
| 2 -> "女" | |||||
| else -> "--" | |||||
| } | } | ||||
| phone.text = info.phone | phone.text = info.phone | ||||
| idCard.text = info.card_no | idCard.text = info.card_no | ||||
| @@ -56,6 +56,7 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView, | |||||
| private val mShowList = mutableListOf<Visitor>() | private val mShowList = mutableListOf<Visitor>() | ||||
| private val mShowDialogList = mutableListOf<BaseDialog>() | private val mShowDialogList = mutableListOf<BaseDialog>() | ||||
| private var isRefresh = false | private var isRefresh = false | ||||
| private var mQrCode: QrCode? = null | |||||
| private val refreshRun = Runnable { | private val refreshRun = Runnable { | ||||
| refreshData() | refreshData() | ||||
| @@ -72,11 +73,11 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView, | |||||
| preTxtBtn.setOnClickListener { pre() } | preTxtBtn.setOnClickListener { pre() } | ||||
| nextTxtBtn.setOnClickListener { next() } | nextTxtBtn.setOnClickListener { next() } | ||||
| allBtn.setOnClickListener { changeStatus(10,0) } | |||||
| status1Btn.setOnClickListener { changeStatus(0,1) } | |||||
| status2Btn.setOnClickListener { changeStatus(1,2) } | |||||
| status3Btn.setOnClickListener { changeStatus(2,3) } | |||||
| status4Btn.setOnClickListener { changeStatus(-1,4) } | |||||
| allBtn.setOnClickListener { changeStatus(10, 0) } | |||||
| status1Btn.setOnClickListener { changeStatus(0, 1) } | |||||
| status2Btn.setOnClickListener { changeStatus(1, 2) } | |||||
| status3Btn.setOnClickListener { changeStatus(2, 3) } | |||||
| status4Btn.setOnClickListener { changeStatus(-1, 4) } | |||||
| statusBtnList.add(allBtn) | statusBtnList.add(allBtn) | ||||
| statusBtnList.add(status1Btn) | statusBtnList.add(status1Btn) | ||||
| statusBtnList.add(status2Btn) | statusBtnList.add(status2Btn) | ||||
| @@ -101,7 +102,7 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView, | |||||
| var lastClickTime = TimeUtils.getNowMills() | var lastClickTime = TimeUtils.getNowMills() | ||||
| mAdapter.setOnItemClickListener { adapter, view, position -> | mAdapter.setOnItemClickListener { adapter, view, position -> | ||||
| val curr = TimeUtils.getNowMills() | val curr = TimeUtils.getNowMills() | ||||
| if(curr - lastClickTime > 500){ | |||||
| if (curr - lastClickTime > 500) { | |||||
| lastClickTime = curr | lastClickTime = curr | ||||
| mPresenter?.getDetail(mAdapter.getItem(position).id) | mPresenter?.getDetail(mAdapter.getItem(position).id) | ||||
| } | } | ||||
| @@ -155,6 +156,19 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView, | |||||
| filterLayout.setOnClickListener { | filterLayout.setOnClickListener { | ||||
| KeyboardUtils.hideSoftInput(keywordInput) | KeyboardUtils.hideSoftInput(keywordInput) | ||||
| } | } | ||||
| codeBtn.setOnClickListener { | |||||
| showVisitorQRCode() | |||||
| } | |||||
| } | |||||
| private fun showVisitorQRCode() { | |||||
| if (mQrCode != null) { | |||||
| mQrCode?.apply { | |||||
| EventBus.getDefault().post(ViewImage(1, identity, key)) | |||||
| } | |||||
| } else { | |||||
| mPresenter?.getQrcodeWithAccessToken() | |||||
| } | |||||
| } | } | ||||
| @@ -185,7 +199,7 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView, | |||||
| } | } | ||||
| } | } | ||||
| private fun changeStatus(status: Int,index:Int) { | |||||
| private fun changeStatus(status: Int, index: Int) { | |||||
| KeyboardUtils.hideSoftInput(keywordInput) | KeyboardUtils.hideSoftInput(keywordInput) | ||||
| if (isLoading) { | if (isLoading) { | ||||
| return | return | ||||
| @@ -272,7 +286,7 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView, | |||||
| @SuppressLint("SetTextI18n") | @SuppressLint("SetTextI18n") | ||||
| override fun onListSuccess(list: MutableList<Visitor>, pager: Pager) { | override fun onListSuccess(list: MutableList<Visitor>, pager: Pager) { | ||||
| pageTv?.apply { | pageTv?.apply { | ||||
| if(isRefresh){ | |||||
| if (isRefresh) { | |||||
| toast("刷新成功!") | toast("刷新成功!") | ||||
| isRefresh = false | isRefresh = false | ||||
| } | } | ||||
| @@ -316,7 +330,7 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView, | |||||
| override fun onListError(error: String) { | override fun onListError(error: String) { | ||||
| isLoading = false | isLoading = false | ||||
| if(isRefresh){ | |||||
| if (isRefresh) { | |||||
| toast("刷新失败,请重试!") | toast("刷新失败,请重试!") | ||||
| isRefresh = false | isRefresh = false | ||||
| } | } | ||||
| @@ -376,6 +390,16 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView, | |||||
| } | } | ||||
| override fun onQrCodeSuccess(qrCode: QrCode) { | |||||
| LogUtils.d(qrCode) | |||||
| mQrCode = qrCode | |||||
| EventBus.getDefault().post(ViewImage(1, qrCode.identity, qrCode.key)) | |||||
| } | |||||
| override fun onQrCodeError(error: String) { | |||||
| toast("二维码获取失败,请重试!") | |||||
| } | |||||
| //接收消息 | //接收消息 | ||||
| @Subscribe(threadMode = ThreadMode.MAIN) | @Subscribe(threadMode = ThreadMode.MAIN) | ||||
| fun onMessageEvent(event: MessageEventAuto) { | fun onMessageEvent(event: MessageEventAuto) { | ||||
| @@ -0,0 +1,8 @@ | |||||
| package com.yzx.escreen.model | |||||
| data class QrCode( | |||||
| val identity: String = "", | |||||
| val key: String = "" | |||||
| ) | |||||
| data class AccessToken( | |||||
| val access_token: String = "" | |||||
| ) | |||||
| @@ -12,6 +12,7 @@ data class Visitor( | |||||
| val face_key: String = "", | val face_key: String = "", | ||||
| val health_code_identity: String = "", | val health_code_identity: String = "", | ||||
| val health_code_key: String = "", | val health_code_key: String = "", | ||||
| val health_code_status: Int = -1, | |||||
| val history_num: Int = 0, | val history_num: Int = 0, | ||||
| val id: Int = 0, | val id: Int = 0, | ||||
| val in_out_num: Int = 0, | val in_out_num: Int = 0, | ||||
| @@ -5,9 +5,7 @@ import com.lzy.okgo.OkGo | |||||
| import com.lzy.okgo.model.Response | import com.lzy.okgo.model.Response | ||||
| import com.yzx.escreen.config.Config | import com.yzx.escreen.config.Config | ||||
| import com.yzx.escreen.config.YzxInterface | import com.yzx.escreen.config.YzxInterface | ||||
| import com.yzx.escreen.model.Pager | |||||
| import com.yzx.escreen.model.User | |||||
| import com.yzx.escreen.model.Visitor | |||||
| import com.yzx.escreen.model.* | |||||
| import com.yzx.escreen.presenter.base.BasePresenter | import com.yzx.escreen.presenter.base.BasePresenter | ||||
| import com.yzx.escreen.presenter.base.IView | import com.yzx.escreen.presenter.base.IView | ||||
| import com.yzx.escreen.presenter.base.JsonCallBack | import com.yzx.escreen.presenter.base.JsonCallBack | ||||
| @@ -72,6 +70,62 @@ class VisitorPresenter(view: VisitorView) : BasePresenter<VisitorView>(view) { | |||||
| }) | }) | ||||
| } | } | ||||
| fun getQrcodeWithAccessToken(){ | |||||
| if(User.getUser().token.isEmpty()){ | |||||
| return | |||||
| } | |||||
| val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_GET_ACCESS_TOKEN}" | |||||
| OkGo.post<YzxResponse<AccessToken>>(url) | |||||
| .tag(this) | |||||
| .params("app_id", Config.MP_APPID) | |||||
| .execute(object : JsonCallBack<YzxResponse<AccessToken>>() { | |||||
| override fun onSuccess(response: Response<YzxResponse<AccessToken>>?) { | |||||
| LogUtils.d(response) | |||||
| if (response?.isSuccessful == true) { | |||||
| getQrCode(response.body().data.access_token) | |||||
| } | |||||
| } | |||||
| override fun onError(response: Response<YzxResponse<AccessToken>>?) { | |||||
| super.onError(response) | |||||
| LogUtils.d(response) | |||||
| mView?.onQrCodeError(response?.body()?.msg ?: "") | |||||
| } | |||||
| }) | |||||
| } | |||||
| fun getQrCode(accessToken:String){ | |||||
| if(User.getUser().token.isEmpty()){ | |||||
| return | |||||
| } | |||||
| val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_GET_MINI_CODE}" | |||||
| val unitId = User.getUser().school_id | |||||
| OkGo.post<YzxResponse<QrCode>>(url) | |||||
| .tag(this) | |||||
| .params("page_url", "pages/accesscontrol/apply/index") | |||||
| .params("scene", "_${unitId}") | |||||
| .params("access_token", accessToken) | |||||
| .execute(object : JsonCallBack<YzxResponse<QrCode>>() { | |||||
| override fun onSuccess(response: Response<YzxResponse<QrCode>>?) { | |||||
| LogUtils.d(response) | |||||
| if (response?.isSuccessful == true) { | |||||
| mView?.onQrCodeSuccess(response.body().data) | |||||
| } | |||||
| } | |||||
| override fun onError(response: Response<YzxResponse<QrCode>>?) { | |||||
| super.onError(response) | |||||
| LogUtils.d(response) | |||||
| mView?.onQrCodeError(response?.body()?.msg ?: "") | |||||
| } | |||||
| }) | |||||
| } | |||||
| } | } | ||||
| @@ -81,4 +135,6 @@ interface VisitorView : IView { | |||||
| fun onListError(error: String) | fun onListError(error: String) | ||||
| fun onDetailSuccess(detail: Visitor) | fun onDetailSuccess(detail: Visitor) | ||||
| fun onDetailError(error: String) | fun onDetailError(error: String) | ||||
| fun onQrCodeSuccess(qrCode: QrCode) | |||||
| fun onQrCodeError(error: String) | |||||
| } | } | ||||
| @@ -3,7 +3,6 @@ package com.yzx.escreen.presenter.base; | |||||
| import android.content.Intent; | import android.content.Intent; | ||||
| import com.blankj.utilcode.util.ActivityUtils; | import com.blankj.utilcode.util.ActivityUtils; | ||||
| import com.blankj.utilcode.util.AppUtils; | |||||
| import com.blankj.utilcode.util.LogUtils; | import com.blankj.utilcode.util.LogUtils; | ||||
| import com.google.gson.stream.JsonReader; | import com.google.gson.stream.JsonReader; | ||||
| import com.lzy.okgo.callback.AbsCallback; | import com.lzy.okgo.callback.AbsCallback; | ||||
| @@ -17,7 +16,6 @@ import com.yzx.escreen.config.RefreshToken; | |||||
| import com.yzx.escreen.model.User; | import com.yzx.escreen.model.User; | ||||
| import com.yzx.escreen.utils.Monitor; | import com.yzx.escreen.utils.Monitor; | ||||
| import org.json.JSONArray; | import org.json.JSONArray; | ||||
| import org.json.JSONObject; | import org.json.JSONObject; | ||||
| @@ -183,7 +181,14 @@ public abstract class JsonCallBack<T> extends AbsCallback<T> { | |||||
| @Override | @Override | ||||
| public void onError(com.lzy.okgo.model.Response<T> response) { | public void onError(com.lzy.okgo.model.Response<T> response) { | ||||
| super.onError(response); | super.onError(response); | ||||
| sb.append("异常信息:").append(response.getException().getMessage()); | |||||
| Monitor.INSTANCE.postNetError(sb); | |||||
| String msg = response.getException().getMessage(); | |||||
| if(msg==null){ | |||||
| msg = ""; | |||||
| } | |||||
| //登录相关信息不上报 | |||||
| if(!msg.contains("错误代码:406") && !msg.contains("token信息不存在!")){ | |||||
| sb.append("异常信息:").append(msg); | |||||
| Monitor.INSTANCE.postNetError(sb); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -10,7 +10,6 @@ import com.lzy.okgo.callback.StringCallback | |||||
| import com.lzy.okgo.model.HttpHeaders | import com.lzy.okgo.model.HttpHeaders | ||||
| import com.lzy.okgo.model.Response | import com.lzy.okgo.model.Response | ||||
| import com.yzx.escreen.model.User | import com.yzx.escreen.model.User | ||||
| import java.lang.StringBuilder | |||||
| import java.text.SimpleDateFormat | import java.text.SimpleDateFormat | ||||
| import java.util.* | import java.util.* | ||||
| @@ -82,7 +81,7 @@ object Monitor { | |||||
| fun postNetError(errorInfo:StringBuilder){ | fun postNetError(errorInfo:StringBuilder){ | ||||
| val stringBuffer = StringBuffer() | val stringBuffer = StringBuffer() | ||||
| stringBuffer.append("墨水屏接口上报:").append("\n") | |||||
| stringBuffer.append("电子屏异常上报:").append("\n") | |||||
| stringBuffer.append("异常类型:").append("接口异常").append("\n") | stringBuffer.append("异常类型:").append("接口异常").append("\n") | ||||
| stringBuffer.append("系统信息:").append(AppUtils.getAppInfo().versionName).append("\n") | stringBuffer.append("系统信息:").append(AppUtils.getAppInfo().versionName).append("\n") | ||||
| val user = User.getUser() | val user = User.getUser() | ||||
| @@ -124,7 +123,7 @@ object Monitor { | |||||
| class MonitorInfo( | class MonitorInfo( | ||||
| val msgtype: String = "text", | val msgtype: String = "text", | ||||
| val text: MonitorText = MonitorText("墨水屏异常上报") | |||||
| val text: MonitorText = MonitorText("电子屏异常上报") | |||||
| ) | ) | ||||
| class MonitorText(val content: String = "") | class MonitorText(val content: String = "") | ||||
| @@ -19,6 +19,7 @@ import com.yzx.escreen.model.Visitor | |||||
| import com.yzx.escreen.utils.setSrc | import com.yzx.escreen.utils.setSrc | ||||
| import com.yzx.escreen.utils.toDay | import com.yzx.escreen.utils.toDay | ||||
| import com.yzx.escreen.utils.toTime | import com.yzx.escreen.utils.toTime | ||||
| import kotlinx.android.synthetic.main.dialog_visitor.view.* | |||||
| import org.greenrobot.eventbus.EventBus | import org.greenrobot.eventbus.EventBus | ||||
| import org.jetbrains.anko.find | import org.jetbrains.anko.find | ||||
| import org.jetbrains.anko.textColor | import org.jetbrains.anko.textColor | ||||
| @@ -37,7 +38,7 @@ class VisitorDialog( | |||||
| val adapter: VisitorDialogStepAdapter by lazy { | val adapter: VisitorDialogStepAdapter by lazy { | ||||
| VisitorDialogStepAdapter(mutableListOf()) | VisitorDialogStepAdapter(mutableListOf()) | ||||
| } | } | ||||
| var onCloseClick: (view:View) -> Unit = {} | |||||
| var onCloseClick: (view: View) -> Unit = {} | |||||
| init { | init { | ||||
| val view = LayoutInflater.from(context).inflate(R.layout.dialog_visitor, null) | val view = LayoutInflater.from(context).inflate(R.layout.dialog_visitor, null) | ||||
| @@ -50,7 +51,7 @@ class VisitorDialog( | |||||
| view.layoutParams = layoutParams | view.layoutParams = layoutParams | ||||
| addView(view) | addView(view) | ||||
| background = ContextCompat.getDrawable(context, R.color.dialog_bg) | background = ContextCompat.getDrawable(context, R.color.dialog_bg) | ||||
| setOnClickListener { } //阻止事件冒泡 | |||||
| setOnClickListener { } //阻止事件冒泡 | |||||
| } | } | ||||
| @SuppressLint("SetTextI18n") | @SuppressLint("SetTextI18n") | ||||
| @@ -68,19 +69,44 @@ class VisitorDialog( | |||||
| find<View>(R.id.face_img).visibility = View.GONE | find<View>(R.id.face_img).visibility = View.GONE | ||||
| } | } | ||||
| find<ImageView>(R.id.face_img).setOnClickListener { | find<ImageView>(R.id.face_img).setOnClickListener { | ||||
| EventBus.getDefault().post(ViewImage(detail.id,detail.face_identity,detail.face_key)) | |||||
| EventBus.getDefault().post(ViewImage(detail.id, detail.face_identity, detail.face_key)) | |||||
| } | } | ||||
| if (detail.health_code_key.isNotEmpty()) { | |||||
| val img = find<ImageView>(R.id.health_img) | |||||
| img.setSrc(detail.health_code_identity, detail.health_code_key) | |||||
| img.visibility = View.VISIBLE | |||||
| find<View>(R.id.health_empty).visibility = View.GONE | |||||
| } else { | |||||
| find<View>(R.id.health_empty).visibility = View.VISIBLE | |||||
| find<View>(R.id.health_img).visibility = View.GONE | |||||
| when { | |||||
| detail.health_code_status >= 0 -> { | |||||
| healthCodeStatusLayout.visibility = VISIBLE | |||||
| health_empty.visibility = GONE | |||||
| health_img.visibility = GONE | |||||
| when (detail.health_code_status) { | |||||
| 0 -> { | |||||
| healthCodeStatus.text = "状态:绿码" | |||||
| healthCodeStatus.textColor = Color.parseColor("#5DAD64") | |||||
| } | |||||
| 1 -> { | |||||
| healthCodeStatus.text = "状态:黄码" | |||||
| healthCodeStatus.textColor = Color.parseColor("#FCCF13") | |||||
| } | |||||
| 10 -> { | |||||
| healthCodeStatus.text = "状态:红码" | |||||
| healthCodeStatus.textColor = Color.parseColor("#FC0416") | |||||
| } | |||||
| } | |||||
| } | |||||
| detail.health_code_key.isNotEmpty() -> { | |||||
| healthCodeStatusLayout.visibility = GONE | |||||
| val img = find<ImageView>(R.id.health_img) | |||||
| img.setSrc(detail.health_code_identity, detail.health_code_key) | |||||
| img.visibility = View.VISIBLE | |||||
| find<View>(R.id.health_empty).visibility = View.GONE | |||||
| } | |||||
| else -> { | |||||
| healthCodeStatusLayout.visibility = GONE | |||||
| find<View>(R.id.health_empty).visibility = View.VISIBLE | |||||
| find<View>(R.id.health_img).visibility = View.GONE | |||||
| } | |||||
| } | } | ||||
| find<ImageView>(R.id.health_img).setOnClickListener { | find<ImageView>(R.id.health_img).setOnClickListener { | ||||
| EventBus.getDefault().post(ViewImage(detail.id,detail.health_code_identity,detail.health_code_key)) | |||||
| EventBus.getDefault() | |||||
| .post(ViewImage(detail.id, detail.health_code_identity, detail.health_code_key)) | |||||
| } | } | ||||
| if (detail.trip_code_key.isNotEmpty()) { | if (detail.trip_code_key.isNotEmpty()) { | ||||
| val img = find<ImageView>(R.id.trip_img) | val img = find<ImageView>(R.id.trip_img) | ||||
| @@ -92,7 +118,8 @@ class VisitorDialog( | |||||
| find<View>(R.id.trip_img).visibility = View.GONE | find<View>(R.id.trip_img).visibility = View.GONE | ||||
| } | } | ||||
| find<ImageView>(R.id.trip_img).setOnClickListener { | find<ImageView>(R.id.trip_img).setOnClickListener { | ||||
| EventBus.getDefault().post(ViewImage(detail.id,detail.trip_code_identity,detail.trip_code_key)) | |||||
| EventBus.getDefault() | |||||
| .post(ViewImage(detail.id, detail.trip_code_identity, detail.trip_code_key)) | |||||
| } | } | ||||
| find<TextView>(R.id.reception_user).text = "${detail.reception_user}" | find<TextView>(R.id.reception_user).text = "${detail.reception_user}" | ||||
| find<TextView>(R.id.visit_reason).text = "${detail.visit_reason}" | find<TextView>(R.id.visit_reason).text = "${detail.visit_reason}" | ||||
| @@ -101,12 +128,13 @@ class VisitorDialog( | |||||
| 0 -> "否" | 0 -> "否" | ||||
| else -> "--" | else -> "--" | ||||
| } | } | ||||
| if(detail.is_drive==1){ | |||||
| if (detail.is_drive == 1) { | |||||
| find<View>(R.id.carLayout).visibility = View.VISIBLE | find<View>(R.id.carLayout).visibility = View.VISIBLE | ||||
| find<View>(R.id.doorLayout).visibility = View.GONE | find<View>(R.id.doorLayout).visibility = View.GONE | ||||
| find<TextView>(R.id.license_plate).text = "${detail.license_plate}" | find<TextView>(R.id.license_plate).text = "${detail.license_plate}" | ||||
| find<TextView>(R.id.car_in_time).text = "${detail.car_in_time.toTime()} - ${detail.car_out_time.toTime()}" | |||||
| }else{ | |||||
| find<TextView>(R.id.car_in_time).text = | |||||
| "${detail.car_in_time.toTime()} - ${detail.car_out_time.toTime()}" | |||||
| } else { | |||||
| find<View>(R.id.carLayout).visibility = View.GONE | find<View>(R.id.carLayout).visibility = View.GONE | ||||
| find<View>(R.id.doorLayout).visibility = View.VISIBLE | find<View>(R.id.doorLayout).visibility = View.VISIBLE | ||||
| find<TextView>(R.id.audit_status_str).text = when (detail.audit_status) { | find<TextView>(R.id.audit_status_str).text = when (detail.audit_status) { | ||||
| @@ -123,7 +151,8 @@ class VisitorDialog( | |||||
| -1 -> Color.parseColor("#999999") | -1 -> Color.parseColor("#999999") | ||||
| else -> Color.parseColor("#333333") | else -> Color.parseColor("#333333") | ||||
| } | } | ||||
| find<TextView>(R.id.start_time).text = "${detail.start_time.toDay()} - ${detail.end_time.toDay()} 可进出${detail.in_out_num}次" | |||||
| find<TextView>(R.id.start_time).text = | |||||
| "${detail.start_time.toDay()} - ${detail.end_time.toDay()} 可进出${detail.in_out_num}次" | |||||
| } | } | ||||
| find<ImageView>(R.id.statusImg).setSrc(detail.getStatusImg()) | find<ImageView>(R.id.statusImg).setSrc(detail.getStatusImg()) | ||||
| @@ -140,6 +140,25 @@ | |||||
| android:gravity="center" | android:gravity="center" | ||||
| android:text="健康码" | android:text="健康码" | ||||
| android:textSize="@dimen/sp20"/> | android:textSize="@dimen/sp20"/> | ||||
| <LinearLayout | |||||
| android:id="@+id/healthCodeStatusLayout" | |||||
| android:layout_width="180dp" | |||||
| android:layout_height="222dp" | |||||
| android:orientation="vertical" | |||||
| android:gravity="center"> | |||||
| <TextView | |||||
| android:id="@+id/healthCodeStatus" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="状态:绿码" | |||||
| android:textSize="@dimen/d_20"/> | |||||
| <TextView | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="成都大数据中心提供" | |||||
| android:textColor="@color/gray_1" | |||||
| android:textSize="@dimen/d_15"/> | |||||
| </LinearLayout> | |||||
| <com.qmuiteam.qmui.widget.QMUIRadiusImageView | <com.qmuiteam.qmui.widget.QMUIRadiusImageView | ||||
| android:id="@+id/health_img" | android:id="@+id/health_img" | ||||
| android:layout_width="180dp" | android:layout_width="180dp" | ||||
| @@ -149,6 +149,16 @@ | |||||
| android:text="自动弹出请假单" | android:text="自动弹出请假单" | ||||
| android:textColor="#53a051" | android:textColor="#53a051" | ||||
| android:visibility="gone"/> | android:visibility="gone"/> | ||||
| <TextView | |||||
| android:id="@+id/codeBtn" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="@dimen/d_28" | |||||
| android:layout_gravity="center_vertical" | |||||
| android:layout_marginStart="@dimen/d_10" | |||||
| android:gravity="center" | |||||
| android:text="访客申请二维码" | |||||
| android:textColor="#3c7ef6"/> | |||||
| </androidx.appcompat.widget.LinearLayoutCompat> | </androidx.appcompat.widget.LinearLayoutCompat> | ||||
| <androidx.appcompat.widget.LinearLayoutCompat | <androidx.appcompat.widget.LinearLayoutCompat | ||||
| @@ -48,13 +48,31 @@ | |||||
| <FrameLayout | <FrameLayout | ||||
| style="@style/table_cell" | style="@style/table_cell" | ||||
| android:layout_weight="1"> | android:layout_weight="1"> | ||||
| <LinearLayout | |||||
| android:id="@+id/healthCodeStatusLayout" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:orientation="vertical"> | |||||
| <TextView | |||||
| android:id="@+id/healthCodeStatus" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="状态:绿码" | |||||
| android:textSize="@dimen/d_20"/> | |||||
| <TextView | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:text="成都大数据中心提供" | |||||
| android:textColor="@color/gray_1" | |||||
| android:textSize="@dimen/d_15"/> | |||||
| </LinearLayout> | |||||
| <com.qmuiteam.qmui.widget.QMUIRadiusImageView | <com.qmuiteam.qmui.widget.QMUIRadiusImageView | ||||
| android:id="@+id/healthCodeImg" | android:id="@+id/healthCodeImg" | ||||
| android:layout_width="@dimen/d_70" | android:layout_width="@dimen/d_70" | ||||
| android:layout_height="@dimen/d_70" | android:layout_height="@dimen/d_70" | ||||
| app:qmui_border_color="@color/white" | app:qmui_border_color="@color/white" | ||||
| app:qmui_corner_radius="@dimen/d_5" /> | |||||
| app:qmui_corner_radius="@dimen/d_5" | |||||
| android:visibility="gone"/> | |||||
| <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton | <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton | ||||
| android:id="@+id/healthCodeEmpty" | android:id="@+id/healthCodeEmpty" | ||||
| @@ -66,7 +84,8 @@ | |||||
| android:textColor="@color/white" | android:textColor="@color/white" | ||||
| app:qmui_backgroundColor="#ccc" | app:qmui_backgroundColor="#ccc" | ||||
| app:qmui_borderColor="#ccc" | app:qmui_borderColor="#ccc" | ||||
| app:qmui_radius="@dimen/d_5" /> | |||||
| app:qmui_radius="@dimen/d_5" | |||||
| android:visibility="gone"/> | |||||
| </FrameLayout> | </FrameLayout> | ||||
| <FrameLayout | <FrameLayout | ||||