package com.grkj.iscs.util import com.grkj.iscs.BusinessManager import com.grkj.iscs.MyApplication import com.grkj.iscs.model.Token import com.grkj.iscs.model.UrlConsts import com.grkj.iscs.model.vo.FileStreamReqParam import com.grkj.iscs.model.vo.card.CardInfoRespVO import com.grkj.iscs.model.vo.characteristic.CharacteristicPageRespVO import com.grkj.iscs.model.vo.dept.DeptListRespVO import com.grkj.iscs.model.vo.dict.CommonDictRespVO import com.grkj.iscs.model.vo.finger.LoginCharacteristicRespVO import com.grkj.iscs.model.vo.hardware.JobCardExDTO import com.grkj.iscs.model.vo.hardware.KeyExDTO import com.grkj.iscs.model.vo.hardware.LockExDTO import com.grkj.iscs.model.vo.key.KeyInfoRespVO import com.grkj.iscs.model.vo.lock.LockInfoRespVO import com.grkj.iscs.model.vo.lock.LockTakeUpdateReqVO import com.grkj.iscs.model.vo.machinery.MachineryDetailRespVO import com.grkj.iscs.model.vo.machinery.MachineryPageRespVO import com.grkj.iscs.model.vo.map.MapInfoRespVO import com.grkj.iscs.model.vo.map.MapPointPageRespVO import com.grkj.iscs.model.vo.sop.SopInfoRespVO import com.grkj.iscs.model.vo.sop.SopPageRespVO import com.grkj.iscs.model.vo.system.SystemAttributePageRespVO import com.grkj.iscs.model.vo.ticket.LockPointUpdateReqVO import com.grkj.iscs.model.vo.ticket.LotoMapRespVO import com.grkj.iscs.model.vo.ticket.StepDetailRespVO import com.grkj.iscs.model.vo.ticket.TicketDetailMonitorRespVO import com.grkj.iscs.model.vo.ticket.TicketDetailRespVO import com.grkj.iscs.model.vo.ticket.TicketPageRespVO import com.grkj.iscs.model.vo.ticket.TicketTypeRespVO import com.grkj.iscs.model.vo.ticket.TicketUserReqVO import com.grkj.iscs.model.vo.ticket.WorkstationTicketListRespVO import com.grkj.iscs.model.vo.user.RoleListRespVO import com.grkj.iscs.model.vo.user.UserInfoRespVO import com.grkj.iscs.model.vo.user.UserListRespVO import com.grkj.iscs.util.log.LogUtil import java.text.SimpleDateFormat import java.util.Calendar import java.util.Locale /** * 网络请求 */ object NetApi { /** * 登录 */ fun login(username: String, password: String, callBack: (Boolean?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.SIGN_IN, false, mapOf( "username" to username, "password" to password ), { res, _, _ -> res?.let { val newToken = it.toBean(Token::class.java) newToken.saveToSp(MyApplication.instance!!.applicationContext) callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = false ) } /** * 退出登录 */ fun logout() { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOGOUT, false, mapOf(), { res, _, _ -> SPUtils.clearLoginUser(MyApplication.instance!!.applicationContext) Token.clear(MyApplication.instance!!.applicationContext) }, isGet = true, isAuth = false ) } /** * 刷卡登录 */ fun cardLogin(cardNfc: String, callBack: (Boolean?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOGIN_CARD, false, mapOf( "cardNfc" to cardNfc ), { res, _, _ -> res?.let { val token: String? = getRefBean(it) Token(token!!, 0).saveToSp(MyApplication.instance!!.applicationContext) callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = false ) } /** * 获取SOP分页 */ fun getSopPage( pages: Int, size: Int, machineryId: Long, sopType: Int, callBack: (SopPageRespVO?) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.SOP_PAGE, false, mapOf( "pages" to pages, "size" to size, "machineryId" to machineryId, "sopType" to sopType ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 获取工作票类型 */ @Deprecated("不使用") fun getTicketType(callBack: (MutableList?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.TICKET_TYPE, false, mapOf(), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 获取一个自动编号 */ @Deprecated("不使用") fun getAutoCode(type: String, callBack: (String?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.AUTO_CODE + "/" + type, false, mapOf(), { res, _, _ -> res?.let { callBack.invoke(it.toString()) } }, isGet = true, isAuth = true ) } /** * 获取SOP详情 */ @Deprecated("不使用") fun getSopInfo(sopId: Long, callBack: (SopInfoRespVO?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.SOP_INFO, false, mapOf( "sopId" to sopId ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 获取用户列表 * * @param unitId 9:玛氏内部 * @param roleId 3:上锁人 4:共锁人 */ fun getUserList( pageNum: Int, pageSize: Int, workstationId: Long? = null, roleId: Long? = null, unitId: Long? = null, callBack: (UserListRespVO?) -> Unit ) { val map: MutableMap = mutableMapOf("pageNum" to pageNum, "pageSize" to pageSize) workstationId?.let { map["workstationId"] = it } roleId?.let { map["roleId"] = it } unitId?.let { map["unitId"] = it } NetHttpManager.getInstance().doRequestNet( UrlConsts.USER_LIST, false, map, { res, _, _ -> res?.let { callBack.invoke(it.toBean(UserListRespVO::class.java)) } }, isGet = true, isAuth = true ) } /** * 获取部门列表 */ @Deprecated("不使用") fun getDeptList(pageNum: Int, pageSize: Int, callBack: (MutableList?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.DEPT_LIST, false, mapOf( "pageNum" to pageNum, "pageSize" to pageSize ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 创建工作票 * * @return 工作票ID */ fun createTicket(sopId: Long, callBack: (Long?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.CREATE_TICKET, false, mapOf( "sopId" to sopId ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = false, isAuth = true ) } /** * 获取工作票分页 */ @Deprecated("不使用") fun getTicketPage( pageNum: Int, pageSize: Int, userId: Long, ticketStatus: Int?, callBack: (TicketPageRespVO?) -> Unit ) { val map = mutableMapOf( "pageNum" to pageNum, "pageSize" to pageSize, "userId" to userId ) if (ticketStatus != null) { map["ticketStatus"] = ticketStatus } NetHttpManager.getInstance().doRequestNet( UrlConsts.PAGE_TICKET, false, map, { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 根据登录用户获取刷卡信息 */ // fun getCardInfoByLoginUser(callBack: (CardInfoRespVO?) -> Unit) { // NetHttpManager.getInstance().doRequestNet( // UrlConsts.CARD_INFO_BY_LOGIN_USER, // false, // mapOf(), // { res, _, _ -> // res?.let { // callBack.invoke(getRefBean(it)) // } // }, isGet = true, isAuth = true // ) // } /** * 根据nfc编号获取刷卡信息 */ fun getCardInfoByNfc(cardNfc: String, callBack: (CardInfoRespVO?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.CARD_INFO_BY_CARD_NFC, false, mapOf("cardNfc" to cardNfc), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } ?: run { callBack.invoke(null) } }, isGet = true, isAuth = true ) } /** * 通过nfc编号获取key信息 */ fun getKeyInfo(keyNfc: String, callBack: (KeyInfoRespVO?) -> Unit) { val loginUser = SPUtils.getLoginUser(MyApplication.instance?.applicationContext!!) NetHttpManager.getInstance().doRequestNet( if (loginUser == null) { UrlConsts.KEY_INFO_BY_NFC_WITHOUT_AUTH } else { UrlConsts.KEY_INFO_BY_NFC }, false, mapOf("nfc" to keyNfc), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = loginUser != null ) } /** * 通过nfc编号获取lock信息,暂时用来判断是否是公司的锁 */ fun getLockInfo(lockNfc: String, callBack: (LockInfoRespVO?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOCK_INFO_BY_NFC, false, mapOf("nfc" to lockNfc), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } ?: let { callBack.invoke(null) } }, isGet = true, isAuth = true ) } /** * 归还挂锁时更新数据 */ fun updateLockReturn(lockNfc: String, serialNumber: String, callBack: (Boolean?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOCK_RETURN_UPDATE, false, mapOf( "lockNfc" to lockNfc, "serialNumber" to serialNumber ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } // TODO isAuth需要配置 }, isGet = false, isAuth = BusinessManager.NEED_AUTH ) } /** * 取出挂锁时更新数据 */ fun updateLockTake(list: MutableList, callBack: (Boolean?) -> Unit) { LogUtil.i("updateLockTake : $list") NetHttpManager.getInstance().doRequestNet( UrlConsts.LOCK_TAKE_UPDATE, false, mapOf( "list" to list ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } ?: run { callBack.invoke(false) } // TODO isAuth需要配置 }, isGet = false, isAuth = BusinessManager.NEED_AUTH ) } /** * 挂锁上锁时更新数据,更新挂锁和哪个隔离点进行了绑定 */ fun updateLockPoint( ticketId: Long, lockNfc: String, pointNfc: String, callBack: (Boolean?) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOCK_POINT_UPDATE, false, mapOf( "ticketId" to ticketId, "lockNfc" to lockNfc, "pointNfc" to pointNfc ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = false, isAuth = true ) } /** * 获取作业票和关联数据 */ fun getTicketDetail(ticketId: Long, callBack: (TicketDetailRespVO?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.TICKET_EQUIP_DETAIL, false, mapOf("ticketId" to ticketId), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 取出钥匙 */ fun updateKeyTake( ticketId: Long, keyNfc: String, serialNumber: String, callBack: (Boolean) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.KEY_TAKE_UPDATE, false, mapOf( "ticketId" to ticketId, "keyNfc" to keyNfc, "serialNumber" to serialNumber ), { res, _, _ -> callBack.invoke(res != null) }, isGet = false, isAuth = true ) } /** * 归还钥匙 */ fun updateKeyReturn( ticketId: Long, keyNfc: String, serialNumber: String, retryCount: Int = 3, callBack: (Boolean, String) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.KEY_RETURN_UPDATE, false, mapOf( "ticketId" to ticketId, "keyNfc" to keyNfc, "serialNumber" to serialNumber ), { res, msg, _ -> res?.let { callBack(true, msg?:"") } ?: let { if (retryCount > 0) { Executor.delayOnIO(500) { updateKeyReturn( ticketId, keyNfc, serialNumber, retryCount - 1, callBack ) } } else { callBack.invoke(false, msg?:"") } } // TODO isAuth需要配置 }, isGet = false, isAuth = BusinessManager.NEED_AUTH ) } /** * 更新作业票进度 */ fun updateTicketProgress(ticketId: Long, userId: Long, callBack: (Boolean) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.TICKET_UPDATE_PROGRESS, false, mapOf( "ticketId" to ticketId, "userId" to userId ), { res, _, _ -> callBack.invoke(res != null) }, isGet = false, isAuth = true ) } /** * 批量更新作业票下隔离点的上锁解锁状况 */ fun updateLockPointBatch( list: MutableList, retryCount: Int = 3, callBack: (Boolean) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOCK_POINT_UPDATE_BATCH, false, mapOf( "list" to list ), { res, _, _ -> res?.let { callBack(true) } ?: let { if (retryCount > 0) { Executor.delayOnIO(500) { updateLockPointBatch(list, retryCount - 1, callBack) } } else { callBack.invoke(false) } } }, isGet = false, isAuth = true ) } /** * 根据角色获取人员列表 */ @Deprecated("不使用") fun getRoleList( pageNum: Int, pageSize: Int, roleKey: String, callBack: (RoleListRespVO?) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.ROLE_LIST, false, mapOf( "pageNum" to pageNum, "pageSize" to pageSize, "roleKey" to roleKey ), { res, _, _ -> res?.let { callBack.invoke(it.toBean(RoleListRespVO::class.java)) } }, isGet = true, isAuth = true ) } /** * 正在进行中的作业票列表 */ fun getWorkstationTicketList( pages: Int, size: Int, callBack: (MutableList?) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.WORKSTATION_TICKET_LIST, false, mapOf( "pages" to pages, "size" to size ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 获取工艺分页 */ fun getMachineryPage( pages: Int, size: Int, workstationId: Long, callBack: (MachineryPageRespVO?) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.MACHINERY_PAGE, false, mapOf( "pages" to pages, "size" to size, "workstationId" to workstationId, "machineryType" to "工艺" ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 获取八大步骤详细 */ fun getStepDetail(ticketId: Long, callBack: (MutableList?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.TICKET_STEP, false, mapOf( "ticketId" to ticketId ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 获取设备工艺详细信息 */ fun getMachineryDetail(machineryId: Long, callBack: (MachineryDetailRespVO?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.MACHINERY_DETAIL, false, mapOf( "machineryId" to machineryId ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 获取电柜map解析数据 */ fun getLotoMapData(lotoId: Long, callBack: (MutableList?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOTO_MAP, false, mapOf( "lotoId" to lotoId ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 取消作业票 */ fun cancelTicket(ticketId: Long, callBack: (Boolean) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.CANCEL_TICKET, false, mapOf( "ticketId" to ticketId ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true ) } /** * 结束作业票 */ fun finishTicket(ticketId: Long, callBack: (Boolean) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.FINISH_TICKET, false, mapOf( "ticketId" to ticketId ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true ) } /** * 新增/更新作业票人员 */ fun updateTicketUser( ticketId: Long, userList: MutableList, callBack: (Boolean) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.UPDATE_TICKET_USER, false, mapOf( "ticketId" to ticketId, "ticketUserDTOList" to userList ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true ) } /** * 作业票详情监控 */ fun getTicketDetailMonitor(ticketId: Long, callBack: (TicketDetailMonitorRespVO?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.TICKET_DETAIL_MONITOR, false, mapOf( "ticketId" to ticketId ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 八大步骤执行 */ fun updateStep(stepId: Long, stepStatus: String, callBack: (Boolean) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.UPDATE_STEP, false, mapOf( "stepId" to stepId, "stepStatus" to stepStatus ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true ) } /** * 共锁人上锁/解锁 */ fun updateColockerStatus( ticketId: Long, cardNfc: String, jobStatus: String, callBack: (Boolean) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.UPDATE_COLOCKER_STATUS, false, mapOf( "ticketId" to ticketId, "cardNfc" to cardNfc, "jobStatus" to jobStatus ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true ) } /** * 获取用户信息 */ fun getUserInfo(callBack: (UserInfoRespVO?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.GET_USER_INFO, false, mapOf(), { res, _, _ -> res?.let { callBack.invoke(it.toBean(UserInfoRespVO::class.java)) } }, isGet = true, isAuth = true ) } /** * 获取地图参数详细信息 * * @param id 机柜固定首页传1,锁定站传2,物资柜固定传4 */ fun getMapInfo(id: Long, callBack: (MapInfoRespVO?) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.MAP_INFO, false, mapOf( "id" to id ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 查询地图点位数据-分页 * * @param mapId 机柜固定传1,物资柜固定传4 */ fun getMapPointPage( pages: Int, size: Int, mapId: Long, callBack: (MapPointPageRespVO?) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.MAP_POINT_PAGE, false, mapOf( "pages" to pages, "size" to size, "mapId" to mapId ), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 新增指纹录入-指纹图片转成dat存储 */ fun insertFinger( userName: String, fileList: MutableList?, callBack: (Boolean) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.INSERT_FINGER, false, mapOf( "userName" to userName ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true, fileList = fileList ) } /** * 系统用户登录-指纹验证登录dat */ fun loginByFingerprint(fileList: MutableList, callBack: (Boolean) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOGIN_FINGERPRINT, false, mapOf(), { res, _, _ -> res?.let { val resp: LoginCharacteristicRespVO? = it.toBean(LoginCharacteristicRespVO::class.java) Token(resp?.token!!, 0).saveToSp(MyApplication.instance!!.applicationContext) callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = false, fileList = fileList ) } /** * 查询用户特征(指纹、面部)-分页 * * @param type 1-指纹,2-面部 */ fun getUserCharacteristicPage( pages: Int, size: Int, type: String, userId: Long, callBack: (CharacteristicPageRespVO?) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.USER_CHARACTERISTIC_PAGE, false, mapOf( "pages" to pages, "size" to size, "type" to type, "userId" to userId ), { res, _, _ -> res?.let { callBack(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 删除用户特征(指纹、面部) */ fun deleteUserCharacteristic(recordIds: String, callBack: (Boolean) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.REMOVE_USER_CHARACTERISTIC, false, mapOf( "recordIds" to recordIds ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = true, isAuth = true ) } /** * 新增异常记录 * * @param exceptionCategory 异常种类(0-锁控柜 1-物资柜) */ fun insertException( exceptionCategory: String, exceptionDescription: String?, exceptionLevel: String, exceptionType: String, raiser: Long, sourceName: String, callBack: (Boolean) -> Unit ) { val map = mutableMapOf( "exceptionCategory" to exceptionCategory, "exceptionLevel" to exceptionLevel, "exceptionType" to exceptionType, "raiser" to raiser, "sourceName" to sourceName, "raiseTime" to SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format( Calendar.getInstance().time ) ) exceptionDescription?.let { map["exceptionDescription"] = it } NetHttpManager.getInstance().doRequestNet( UrlConsts.INSERT_EXCEPTION, false, map, { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true ) } /** * 查询字典 */ fun getDictData(url: String, callBack: (MutableList?) -> Unit) { NetHttpManager.getInstance().doRequestNet( url, false, mapOf(), { res, _, _ -> res?.let { callBack.invoke(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 新增人脸录入-人脸识别后裁剪存储-arcsoft */ fun insertFace( userName: String, fileList: MutableList?, callBack: (Boolean) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.INSERT_FACE, false, mapOf( "userName" to userName ), { res, _, _ -> callBack.invoke(res != null) }, isGet = false, isAuth = true, fileList = fileList ) } /** * 系统用户登录-face登录-arcsoft */ fun loginByFace(fileList: MutableList, callBack: (Boolean) -> Unit) { NetHttpManager.getInstance().doRequestNet( UrlConsts.LOGIN_FACE, false, mapOf(), { res, _, _ -> res?.let { val resp: LoginCharacteristicRespVO? = it.toBean(LoginCharacteristicRespVO::class.java) Token(resp?.token!!, 0).saveToSp(MyApplication.instance!!.applicationContext) callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = false, fileList = fileList ) } /** * 查询基础数据-分页 */ fun getSystemAttributePage( pages: Int, size: Int, callBack: (SystemAttributePageRespVO?) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.SYSTEM_ATTRIBUTE_PAGE, false, mapOf( "pages" to pages, "size" to size ), { res, _, _ -> res?.let { callBack(getRefBean(it)) } }, isGet = true, isAuth = true ) } /** * 上锁、解锁取钥匙前检查 */ fun checkBeforeAction(ticketId: Long, isLock: Boolean, callBack: (Boolean) -> Unit) { NetHttpManager.getInstance().doRequestNet( if (isLock) UrlConsts.CHECK_BEFORE_LOCKING else UrlConsts.CHECK_BEFORE_UNLOCKING, false, mapOf( "ticketId" to ticketId ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = true, isAuth = true ) } /** * 批量更新硬件状态 */ fun updateHardwareEsStatus( jobCardExDTOList: List, keyExDTOList: List, lockExDTOList: List, callBack: (Boolean) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.UPDATE_HARDWARE_ES_STATUS, false, mapOf( "jobCardExDTOList" to jobCardExDTOList, "keyExDTOList" to keyExDTOList, "lockExDTOList" to lockExDTOList ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true ) } /** * 重合点位数据解锁 */ fun updateCoincideToUnLock( noUnlockTicketPointsVOSet: List, callBack: (Boolean) -> Unit ) { NetHttpManager.getInstance().doRequestNet( UrlConsts.UPDATE_COINCIDE_TO_UNLOCK, false, mapOf( "noUnlockTicketPointsVOSet" to noUnlockTicketPointsVOSet ), { res, _, _ -> res?.let { callBack.invoke(true) } ?: run { callBack.invoke(false) } }, isGet = false, isAuth = true ) } }