|
@@ -0,0 +1,949 @@
|
|
|
|
+package com.rc.httpcore.client.retrofit
|
|
|
|
+
|
|
|
|
+import android.util.Log
|
|
|
|
+import com.google.gson.Gson
|
|
|
|
+import com.rc.httpcore.HttpClient
|
|
|
|
+import com.rc.httpcore.HttpConfig
|
|
|
|
+import com.rc.httpcore.bean.DafactTreatmentBean
|
|
|
|
+import com.rc.httpcore.bean.NotifierBean
|
|
|
|
+import com.rc.httpcore.vo.UsageRecordBean
|
|
|
|
+import com.rc.httpcore.client.ChemicalClient
|
|
|
|
+import com.rc.httpcore.exception.NetException
|
|
|
|
+import com.rc.httpcore.vo.*
|
|
|
|
+import com.rc.httpcore.vo.request.*
|
|
|
|
+import com.rc.httpcore.vo.response.*
|
|
|
|
+import com.rc.httpcore.vo.response.CabinetBean
|
|
|
|
+import io.reactivex.Observable
|
|
|
|
+import okhttp3.MediaType
|
|
|
|
+import okhttp3.MultipartBody
|
|
|
|
+import okhttp3.RequestBody
|
|
|
|
+import java.io.File
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+class ChemicalRetrofit : ChemicalClient {
|
|
|
|
+
|
|
|
|
+ private val apiService by lazy {
|
|
|
|
+ HttpClient.createRetrofitApi(ApiService::class.java)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun twosTageList(): Observable<List<ChemicalLeftBean>> {
|
|
|
|
+ return apiService.twosTageList().map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getListNoPage(deptId: Int): Observable<List<ChemicalRightBean>> {
|
|
|
|
+ return apiService.getListNoPage(deptId).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getAppNoAuthList(
|
|
|
|
+ subId: Int,
|
|
|
|
+ cabinetName: String?,
|
|
|
|
+ searchValue:String?,
|
|
|
|
+ ): Observable<List<AppNoAuthList>> {
|
|
|
|
+ return apiService.getAppNoAuthList(subId, cabinetName,searchValue).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getAppList(map: Map<String, Any>): Observable<CommonListResponse<InventoryList>> {
|
|
|
|
+ return apiService.getAppList(map).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getDetailAppList(takeStockId: Int,searchValue:String?): Observable<CommonListResponse<InventoryList>> {
|
|
|
|
+ return apiService.getDetailAppList(takeStockId,searchValue,1,800).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getTypeChemicalShape(): Observable<List<InventoryList>> {
|
|
|
|
+ return apiService.typeChemicalShape.map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getChemicalList(map: Map<String, Any>): Observable<CommonListResponse<InventoryList>> {
|
|
|
|
+ return apiService.getChemicalList(map).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getAppLabelList(map: Map<String, Any>): Observable<CommonListResponse<InventoryList>> {
|
|
|
|
+ return apiService.getAppLabelList(map).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getHxpCabinetApp(subId: Int): Observable<CabinetBeans> {
|
|
|
|
+ return apiService.getHxpCabinetApp(subId).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getAppStockList(map: Map<String, String>): Observable<List<InventoryList>> {
|
|
|
|
+ return apiService.getAppStockList(map)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getHxpTakeStockCommit(param: InventorySubmissionVo): Observable<CommonResponse> {
|
|
|
|
+ return apiService.getHxpTakeStockCommit(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getSecurityAppList(map: Map<String, Any>): Observable<ExaminerInformationBean> {
|
|
|
|
+ val gson = Gson()
|
|
|
|
+ val toJson = gson.toJson(map)
|
|
|
|
+ val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.getSecurityAppList(body).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckClapAppAdd(randomClapBean: RandomClapBean): Observable<Boolean> {
|
|
|
|
+ val gson = Gson()
|
|
|
|
+ val toJson = gson.toJson(randomClapBean)
|
|
|
|
+ Log.d("okhttp=================", toJson)
|
|
|
|
+ val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.getCheckClapAppAdd(body).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckClapAppList(rectifyStatus: Int): Observable<HandManVo> {
|
|
|
|
+ return apiService.getCheckClapAppList(rectifyStatus,1,200).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckClapMylist(rectifyStatus: Int): Observable<HandManVo> {
|
|
|
|
+ return apiService.getCheckClapMylist(rectifyStatus).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getAppFindById(id: String, state: Int): Observable<HandManBean> {
|
|
|
|
+ return apiService.getAppFindById(id, state).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckClapClapApprove(data: HandManBean): Observable<Boolean> {
|
|
|
|
+ val gson = Gson()
|
|
|
|
+ val toJson = gson.toJson(data)
|
|
|
|
+ Log.d("okhttp=================", toJson)
|
|
|
|
+ val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.getCheckClapClapApprove(body).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getAppCheckHazardList(map: Map<String, Any>): Observable<ExaminerInformationBean> {
|
|
|
|
+// val gson = Gson()
|
|
|
|
+// val toJson = gson.toJson(map)
|
|
|
|
+// val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.getAppCheckHazardList(map).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getSubQuerys(subId: String): Observable<ExaminerInformationBean> {
|
|
|
|
+ return apiService.getSubQuerys(subId).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getConditionCollegeInfo(): Observable<List<InventoryList>> {
|
|
|
|
+ return apiService.conditionCollegeInfo.map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getAppHazardById(ids: String): Observable<DafactTreatmentBean> {
|
|
|
|
+ return apiService.getAppHazardById(ids)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun addOrApprove(checkHazardBean: CheckHazardBean): Observable<Boolean> {
|
|
|
|
+ val gson = Gson()
|
|
|
|
+ val toJson = gson.toJson(checkHazardBean)
|
|
|
|
+ Log.d("========t======", toJson)
|
|
|
|
+ val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.addOrApprove(body).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun addOrApprove(map: Map<String, Any>): Observable<Boolean> {
|
|
|
|
+ val gson = Gson()
|
|
|
|
+ val toJson = gson.toJson(map)
|
|
|
|
+ Log.d("========b======", toJson)
|
|
|
|
+ val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.addOrApprove(body).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getDepartmentsList(): Observable<List<AppNoAuthList>> {
|
|
|
|
+ return apiService.departmentsList
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun padPwdLogin(map: Map<String, String>): Observable<LearnLoginVo> {
|
|
|
|
+ val gson = Gson()
|
|
|
|
+ val toJson = gson.toJson(map)
|
|
|
|
+ val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.padPwdLogin(body).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ Log.d("login=============", response.data?.access_token)
|
|
|
|
+ HttpClient.token = response.data?.access_token
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun swipeCardLogin(map: Map<String, String>): Observable<LearnLoginVo> {
|
|
|
|
+ val gson = Gson()
|
|
|
|
+ val toJson = gson.toJson(map)
|
|
|
|
+ val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.swipeCardLogin(body).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ HttpClient.token = response.data?.access_token
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getListYmd(
|
|
|
|
+ pageNum: Int,
|
|
|
|
+ pageSize: Int,
|
|
|
|
+ isStart: Int,
|
|
|
|
+ ): Observable<CommonListResponse<CourseListBean>> {
|
|
|
|
+ return apiService.getListYmd(pageNum, pageSize, isStart).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCourseList(courseId: String): Observable<SchoolBeginsBean> {
|
|
|
|
+ return apiService.getCourseList(courseId)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getSinginCount(courseId: String): Observable<NotifierBean> {
|
|
|
|
+ return apiService.getSinginCount(courseId,"0")
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getSendSendMsg(courseId: String): Observable<CommonResponse> {
|
|
|
|
+ return apiService.getSendSendMsg(courseId).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ override fun getSingList(
|
|
|
|
+ courseId: String,
|
|
|
|
+ pageNum: Int,
|
|
|
|
+ pageSize: Int,
|
|
|
|
+ ): Observable<CommonListResponse<NumberOfCheckListBean>> {
|
|
|
|
+ return apiService.getSingList(courseId, 1, pageNum, pageSize)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getEditPad(map: Map<String, Any>): Observable<CommonResponse> {
|
|
|
|
+ val gson = Gson()
|
|
|
|
+ val toJson = gson.toJson(map)
|
|
|
|
+ val body = RequestBody.create(MediaType.parse("application/json"), toJson)
|
|
|
|
+ return apiService.getEditPad(body).map {
|
|
|
|
+ if (!it.isSuccess()) {
|
|
|
|
+ throw NetException(it.code, it.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map it
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getUseRecordByCode(id: Int): Observable<CommonListResponse<UsageRecordBean>> {
|
|
|
|
+ return apiService.getUseRecordByCode(id).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ override fun getApplyByCode(id: Int): Observable<CommonListResponse<UsageRecordBean>> {
|
|
|
|
+ return apiService.getApplyByCode(id).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询LOGO配置列表
|
|
|
|
+ */
|
|
|
|
+ override fun queryLogoConfInfo(): Observable<ConfLogo> {
|
|
|
|
+ return apiService.queryLogoConfInfo()
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询APK版本
|
|
|
|
+ *
|
|
|
|
+ * @param id 设备唯一编码
|
|
|
|
+ */
|
|
|
|
+ override fun apkVersion(id: String): Observable<ApkInfoResp> {
|
|
|
|
+ return apiService.apkVersion(id)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 上传APK更新状态
|
|
|
|
+ *
|
|
|
|
+ * @param state 0:升级失败; 1:升级成功; 2:升级中
|
|
|
|
+ */
|
|
|
|
+ override fun onepcApkUpdate(id: String, state: String): Observable<Boolean> {
|
|
|
|
+ return apiService.onepcApkUpdate(id, state)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckSetGentles(): Observable<UserIdentityBean> {
|
|
|
|
+ return apiService.getCheckSetGentles()
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCountAppList(flg: Int): Observable<CountAppBean> {
|
|
|
|
+ return apiService.getCountAppList(flg).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 用户端登录
|
|
|
|
+ *
|
|
|
|
+ * @param param 刷学生卡数据 userName
|
|
|
|
+ */
|
|
|
|
+ override fun learnLogin(param: LearnLoginReq): Observable<LearnLoginVo> {
|
|
|
|
+ Log.d("param:===========", "" + param.machineCode)
|
|
|
|
+ Log.d("param:===========", "" + param.userName)
|
|
|
|
+ Log.d("param:===========", "" + param.type)
|
|
|
|
+ Log.d("param:===========", "" + param.aioType)
|
|
|
|
+ return apiService.learnLogin(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ HttpClient.token = response.data?.access_token
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getAppFindCheckManage(id: String): Observable<SpecialInspectionBean> {
|
|
|
|
+ return apiService.getAppFindCheckManage(id).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckOptionList(searchValue: String?): Observable<List<CheckOptionBean>> {
|
|
|
|
+ if (searchValue == null) {
|
|
|
|
+ return apiService.checkOptionList.map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return apiService.getCheckOptionList(searchValue).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getHazardInfoByJoinIds(joinHazardId: String): Observable<List<CheckHazardInfoDto>> {
|
|
|
|
+ return apiService.getHazardInfoByJoinIds(joinHazardId).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCountHazardNum(subId: String,hazardCheckPro:String): Observable<String> {
|
|
|
|
+ return apiService.getCountHazardNum(subId,hazardCheckPro).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getFindByCheckPlanId(id: String): Observable<List<MaterialFileBean>> {
|
|
|
|
+ return apiService.getFindByCheckPlanId(id).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getHazardInfoBySubIds(map: Map<String, Any>): Observable<List<CheckHazardDto>> {
|
|
|
|
+ return apiService.getHazardInfoBySubIds(map).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckManageAppUpdate(bean: SpecialInspectionBean): Observable<CommonResponse> {
|
|
|
|
+ return apiService.getCheckManageAppUpdate(bean).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckManageApp(bean: SpecialInspectionBean): Observable<CommonResponse> {
|
|
|
|
+ return apiService.getCheckManageApp(bean).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getBuildBySubList(searchValue: String): Observable<List<InventoryList>> {
|
|
|
|
+ return apiService.getBuildBySubList(searchValue).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getCheckPlanBySubId(subId: String): Observable<List<Record>> {
|
|
|
|
+ return apiService.getCheckPlanBySubId(subId).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun getBuildingDate(): Observable<List<InventoryList>> {
|
|
|
|
+ return apiService.getBuildingDate(2).map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ return@map response.rows
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 退出登录
|
|
|
|
+ */
|
|
|
|
+ override fun loginOut(): Observable<Boolean> {
|
|
|
|
+ return apiService.loginOut()
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 人脸比对
|
|
|
|
+ */
|
|
|
|
+ override fun faceCompare(file: File): Observable<LearnLoginVo> {
|
|
|
|
+ val fileBody = RequestBody.create(MediaType.parse("multipart/form-data"), file)
|
|
|
|
+ val filePart = MultipartBody.Part.createFormData("file", file.name, fileBody)
|
|
|
|
+ return apiService.faceNewCompare(filePart)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+ HttpClient.token = response.data?.access_token
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询实验室机柜列表
|
|
|
|
+ */
|
|
|
|
+ override fun queryCabinetList(): Observable<List<CabinetBean>> {
|
|
|
|
+ return apiService.queryCabinetList(CabinetBean())
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询化学品
|
|
|
|
+ */
|
|
|
|
+ override fun queryChemicalList(param: ChemicalReq): Observable<CommonListResponse<ChemicalBean>> {
|
|
|
|
+ return apiService.queryChemicalList(param.pageNum, param.pageSize, param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询库存化学品
|
|
|
|
+ */
|
|
|
|
+ override fun queryChemicalByStock(param: ChemicalReq): Observable<CommonListResponse<ChemicalBean>> {
|
|
|
|
+ return apiService.queryChemicalByStock(param.pageNum, param.pageSize, param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 双人验证 刷卡识别身份权限
|
|
|
|
+ */
|
|
|
|
+ override fun userValidation(param: UserValidationVo): Observable<UserValidationVo> {
|
|
|
|
+ return apiService.userValidation(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ override fun addStock(param: ChemicalBean): Observable<ChemicalBean> {
|
|
|
|
+ return apiService.addStock(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取危化品安全技术说明书详细信息
|
|
|
|
+ */
|
|
|
|
+ override fun hazardBookDetail(id: String): Observable<HazardBook> {
|
|
|
|
+ return apiService.hazardBookDetail(id)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通过识别卡号或者二维码扫码查询已入库化学品
|
|
|
|
+ */
|
|
|
|
+ override fun queryByTagCode(param: TagCodeReq): Observable<Optional<ChemicalBean>> {
|
|
|
|
+ return apiService.queryByTagCode(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map Optional.ofNullable(response.data)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 领用化学品
|
|
|
|
+ */
|
|
|
|
+ override fun addUserecord(param: UseReq): Observable<Boolean> {
|
|
|
|
+ return apiService.addUserecord(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 归还时查询已领用化学品
|
|
|
|
+ */
|
|
|
|
+ override fun queryByUserecord(param: TagCodeReq): Observable<ChemicalBean> {
|
|
|
|
+ return apiService.queryByUserecord(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 归还化学品
|
|
|
|
+ */
|
|
|
|
+ override fun updateUserecord(param: RevertReq): Observable<Boolean> {
|
|
|
|
+ return apiService.updateUserecord(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 化学品出库
|
|
|
|
+ */
|
|
|
|
+ override fun outStock(param: OutputStockReq): Observable<Boolean> {
|
|
|
|
+ return apiService.outStock(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * RFID 标签更换
|
|
|
|
+ */
|
|
|
|
+ override fun updateStock(param: UpdateRfidReq): Observable<Boolean> {
|
|
|
|
+ return apiService.updateStock(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询使用记录
|
|
|
|
+ */
|
|
|
|
+ override fun queryRecordList(param: OperRecordReq): Observable<CommonListResponse<AioUserecordVo>> {
|
|
|
|
+ return apiService.queryRecordList(param.pageNum, param.pageSize, param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询报警记录列表
|
|
|
|
+ */
|
|
|
|
+ override fun queryAlarmRecordList(param: AlarmRecordReq): Observable<CommonListResponse<AioAlarmRecordVo>> {
|
|
|
|
+ return apiService.queryAlarmRecordList(param.pageNum, param.pageSize, param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询报警记录详情
|
|
|
|
+ */
|
|
|
|
+ override fun queryAlarmRecordDetail(id: String): Observable<AioAlarmRecordVo> {
|
|
|
|
+ return apiService.queryAlarmRecordDetail(id)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 检测类型报警记录手动处理
|
|
|
|
+ */
|
|
|
|
+ override fun updateAlarmRecord(param: UpdateAlarmRecordReq): Observable<Boolean> {
|
|
|
|
+ return apiService.updateAlarmRecord(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 判断当前登录人是否管理员
|
|
|
|
+ */
|
|
|
|
+ override fun authValidation(): Observable<Boolean> {
|
|
|
|
+ return apiService.authValidation()
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 终端登录查询实验室信息
|
|
|
|
+ */
|
|
|
|
+ override fun querySubInfo(): Observable<SubInfoVo> {
|
|
|
|
+ return apiService.querySubInfo()
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 人脸身份验证
|
|
|
|
+ */
|
|
|
|
+ override fun faceAuth(param: SubInfoVo): Observable<UserValidationVo> {
|
|
|
|
+ return apiService.faceAuth(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询机柜柜锁列表
|
|
|
|
+ */
|
|
|
|
+ override fun queryCabinetLockList(param: CabinetLockVo): Observable<List<CabinetLockVo>> {
|
|
|
|
+ return apiService.queryCabinetLockList(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 柜锁开锁
|
|
|
|
+ */
|
|
|
|
+ override fun openLock(param: CabinetLockVo): Observable<LockRespBean> {
|
|
|
|
+ return apiService.openLock(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 柜锁关锁
|
|
|
|
+ */
|
|
|
|
+ override fun closeLock(param: CabinetLockVo): Observable<LockRespBean> {
|
|
|
|
+ return apiService.closeLock(param)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 上传文件
|
|
|
|
+ */
|
|
|
|
+ override fun fileUpload(file: File): Observable<FileRespBean> {
|
|
|
|
+ val fileBody = RequestBody.create(MediaType.parse("application/octet-stream"), file)
|
|
|
|
+ val filePart = MultipartBody.Part.createFormData("file", file.name, fileBody)
|
|
|
|
+
|
|
|
|
+// return apiService.fileUpload(HttpConfig.API_BASE_UP_FILE_, filePart)
|
|
|
|
+// return apiService.fileUpload(HttpConfig.API_BASE_UP_FILE, filePart)
|
|
|
|
+ return apiService.fileUpload(HttpConfig.API_BASE_URL+"base/", filePart)
|
|
|
|
+ .map { response ->
|
|
|
|
+ if (!response.isSuccess()) {
|
|
|
|
+ throw NetException(response.code, response.msg)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return@map response.data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|