|
|
@@ -3,11 +3,10 @@ package cn.muchinfo.rma.business.future
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
import cn.muchinfo.rma.global.data.FutureDetailsData
|
|
|
import cn.muchinfo.rma.global.data.GoodsInfoAndQuotes
|
|
|
-import cn.muchinfo.rma.global.data.MiddleGoodsDetail
|
|
|
import cn.muchinfo.rma.global.data.QuoteDayData
|
|
|
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
|
+import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData
|
|
|
import cn.muchinfo.rma.global.database.AppDatabase
|
|
|
-import cn.muchinfo.rma.global.database.UserDatabase
|
|
|
import cn.muchinfo.rma.global.room.Builder
|
|
|
import cn.muchinfo.rma.netManage.base.ResponseCallback
|
|
|
import cn.muchinfo.rma.netManage.utils.MyOkHttpUtils
|
|
|
@@ -17,6 +16,7 @@ import cn.muchinfo.rma.view.base.app.ServiceFunApi
|
|
|
import com.blankj.utilcode.util.SPUtils
|
|
|
import okhttp3.Call
|
|
|
import java.lang.Exception
|
|
|
+import java.util.ArrayList
|
|
|
|
|
|
/**
|
|
|
* 期货管理类
|
|
|
@@ -28,12 +28,12 @@ class FutureManager {
|
|
|
*/
|
|
|
fun queryGoodsList(callback: (isCompleted: Boolean, err: Error?) -> Unit) {
|
|
|
// 查询最大goodsId
|
|
|
- var goodsId = "0"
|
|
|
+ var lastUpdateTime = "0"
|
|
|
var params = mutableMapOf<String, String>()
|
|
|
if (SPUtils.getInstance().getString(Constant.GOODS_UPDATE_TIME).isNotEmpty()){
|
|
|
- goodsId = SPUtils.getInstance().getString(Constant.GOODS_UPDATE_TIME)
|
|
|
+ lastUpdateTime = SPUtils.getInstance().getString(Constant.GOODS_UPDATE_TIME)
|
|
|
}
|
|
|
-// params["lastUpdateTime"] = goodsId
|
|
|
+ params["lastUpdateTime"] = lastUpdateTime
|
|
|
// 对接接口
|
|
|
MyOkHttpUtils().query(
|
|
|
URL = SPUtils.getInstance()
|
|
|
@@ -101,12 +101,15 @@ class FutureManager {
|
|
|
val goodsInfoAndQuotesList = GlobalDataCollection.instance?.goodsInfoAndQuotesList
|
|
|
quoteList?.forEach {data ->
|
|
|
val goodsInfoAndQuotes = goodsInfoAndQuotesList?.find {
|
|
|
- data.goodscode == it.outgoodscode
|
|
|
+ if (it != null) {
|
|
|
+ data.goodscode == it.outgoodscode
|
|
|
+ } else {
|
|
|
+ false
|
|
|
+ }
|
|
|
}
|
|
|
- val newInfoAndQuotes = goodsInfoAndQuotes
|
|
|
goodsInfoAndQuotesList?.remove(goodsInfoAndQuotes)
|
|
|
- newInfoAndQuotes?.quoteDayData = data
|
|
|
- goodsInfoAndQuotesList?.add(newInfoAndQuotes)
|
|
|
+ goodsInfoAndQuotes?.quoteDayData = data
|
|
|
+ goodsInfoAndQuotesList?.add(goodsInfoAndQuotes)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -115,16 +118,17 @@ class FutureManager {
|
|
|
* @param params Map<String, String> accountID/资金账户ID startDate/ 开始时间 - 闭区间,格式:yyyy-MM-dd endDate / 结束时间 - 闭区间,格式:yyyy-MM-dd
|
|
|
* @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<FutureDetailsData>?, [@kotlin.ParameterName] Error?, Unit>
|
|
|
*/
|
|
|
- fun queryErmcpHisOrderDetails(
|
|
|
+ fun queryErmcpHisEntrustDetails(
|
|
|
params: Map<String, String>,
|
|
|
- responseBack: (isSuccess: Boolean, respData: List<FutureDetailsData>?, error: Error?) -> Unit
|
|
|
+ responseBack: (isSuccess: Boolean, respData: List<FutureEntrustData>?, error: Error?) -> Unit
|
|
|
){
|
|
|
MyOkHttpUtils().query(
|
|
|
URL = SPUtils.getInstance().getString(Constant.goCommonSearchUrl) + "/Ermcp/QueryErmcpHisOrderDetails",
|
|
|
params = params,
|
|
|
type = "1",
|
|
|
- callback = object : ResponseCallback<BaseResult<List<FutureDetailsData>>>(){
|
|
|
- override fun onResponse(response: BaseResult<List<FutureDetailsData>>?, id: Int) {
|
|
|
+ callback = object : ResponseCallback<BaseResult<List<FutureEntrustData>>>(){
|
|
|
+ override fun onResponse(response: BaseResult<List<FutureEntrustData>>?, id: Int) {
|
|
|
+ GlobalDataCollection.instance?.futureEntrustData = response?.data as ArrayList<FutureEntrustData>?
|
|
|
responseBack(true, response?.data, null)
|
|
|
}
|
|
|
|
|
|
@@ -169,16 +173,17 @@ class FutureManager {
|
|
|
* @param params Map<String, String> accountID/资金账户ID
|
|
|
* @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<FutureDetailsData>?, [@kotlin.ParameterName] Error?, Unit>
|
|
|
*/
|
|
|
- fun queryErmcpOrderDetails(
|
|
|
- params: Map<String, String>,
|
|
|
- responseBack: (isSuccess: Boolean, respData: List<FutureDetailsData>?, error: Error?) -> Unit
|
|
|
+ fun queryErmcpEntrustDetails(responseBack: (isSuccess: Boolean, respData: List<FutureEntrustData>?, error: Error?) -> Unit
|
|
|
){
|
|
|
+ val params = mutableMapOf<String, String>()
|
|
|
+ params["accountID"] = SPUtils.getInstance().getString(Constant.SELECT_ACCOUNT_ID,
|
|
|
+ GlobalDataCollection.instance?.currentAccountId)
|
|
|
MyOkHttpUtils().query(
|
|
|
URL = SPUtils.getInstance().getString(Constant.goCommonSearchUrl) + "/Ermcp/QueryErmcpOrderDetails",
|
|
|
params = params,
|
|
|
type = "1",
|
|
|
- callback = object : ResponseCallback<BaseResult<List<FutureDetailsData>>>(){
|
|
|
- override fun onResponse(response: BaseResult<List<FutureDetailsData>>?, id: Int) {
|
|
|
+ callback = object : ResponseCallback<BaseResult<List<FutureEntrustData>>>(){
|
|
|
+ override fun onResponse(response: BaseResult<List<FutureEntrustData>>?, id: Int) {
|
|
|
responseBack(true, response?.data, null)
|
|
|
}
|
|
|
|
|
|
@@ -192,7 +197,8 @@ class FutureManager {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 获取企业风管期货成交单信息
|
|
|
+ *
|
|
|
+ * 获取企业风管期货历史成交单信息
|
|
|
* @param params Map<String, String> accountID/资金账户ID goodsID/商品ID buyOrSell/买卖方向,0:买 1:卖
|
|
|
* @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<FutureDetailsData>?, [@kotlin.ParameterName] Error?, Unit>
|
|
|
*/
|