package cn.flightfeather.thirdappmodule.repository
|
|
import cn.flightfeather.thirdappmodule.bean.entity.Userinfo
|
import cn.flightfeather.thirdappmodule.common.net.ResponseBodyCallBack
|
import cn.flightfeather.thirdappmodule.common.net.ResultCallBack
|
import cn.flightfeather.thirdappmodule.common.net.ResultObserver
|
import cn.flightfeather.thirdappmodule.common.net.RetrofitFactory
|
import cn.flightfeather.thirdappmodule.httpservice.LedgerService
|
import cn.flightfeather.thirdappmodule.httpservice.UserInfoService
|
import cn.flightfeather.thirdappmodule.model.bean.LedgerRecord
|
import cn.flightfeather.thirdappmodule.model.bean.UserMap
|
|
/**
|
* @author riku
|
* Date: 2021/7/21
|
* 连接飞羽环境系统
|
* 台账相关数据接口
|
*/
|
class LedgerRepository private constructor(){
|
|
companion object {
|
@JvmStatic
|
val instance: LedgerRepository by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { LedgerRepository()}
|
}
|
|
private val retrofit = RetrofitFactory.instance.retrofit2
|
|
/**
|
* 获取用户某月台账记录
|
* @param userId (飞羽环境系统中)用户id
|
* @param sceneType (飞羽环境系统中)场景类型,与本系统不同,需要转换
|
* @param time 查询时间,yyyy-mm
|
*/
|
fun getLedgerRecord(userId: String, sceneType: Int, time: String, resultCallBack: ResultCallBack<List<LedgerRecord>>) {
|
val service = retrofit.create(LedgerService::class.java).getRecord(userId, sceneType, time)
|
|
RetrofitFactory.executeResult(service, object : ResultObserver<List<LedgerRecord>>() {
|
override fun onSuccess(result: List<LedgerRecord>?) {
|
resultCallBack.onSuccess(result)
|
}
|
|
override fun onFailure(e: Throwable, isNetWorkError: Boolean) {
|
resultCallBack.onFailure()
|
}
|
})
|
}
|
|
// fun getLedgerType(sceneType: Int, resultCallBack: ResultCallBack<List<LedgerRecord>>)
|
}
|