Bladeren bron

风险管理3月11日提交代码-liu.bolan-期货交易请求

Liu.bolan 4 jaren geleden
bovenliggende
commit
253c0898bd
31 gewijzigde bestanden met toevoegingen van 1406 en 344 verwijderingen
  1. 4 0
      RMA/app/src/main/AndroidManifest.xml
  2. 38 14
      RMA/app/src/main/java/cn/muchinfo/rma/business/future/FutureManager.kt
  3. 46 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/StringUtils.kt
  4. 39 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/ViewEnumUtils.kt
  5. 14 11
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/GGConvertConfigData.kt
  6. 95 24
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/futureOrders/DealOrderData.kt
  7. 74 8
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/futureOrders/FutureEntrustData.kt
  8. 22 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/MyApplication.kt
  9. 33 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/FutrueCommonView.kt
  10. 84 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostDetailsActivity.kt
  11. 17 10
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostListFragment.kt
  12. 44 125
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostViewModel.kt
  13. 73 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/deals/DealDetailsActivity.kt
  14. 6 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/deals/DealViewModel.kt
  15. 20 14
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/entrusts/EntrustChildViewModel.kt
  16. 65 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/entrusts/EntrustDetailsActivity.kt
  17. 12 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/entrusts/EntrustDetailsViewModel.kt
  18. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/holds/HoldViewModel.kt
  19. 7 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/trade/GoodsTradeActivity.kt
  20. 26 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/trade/GoodsTradeViewModel.kt
  21. 103 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/CommodityFutureViewHolder.kt
  22. 16 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/CommodityInformationViewModel.kt
  23. 109 87
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/FuturesVarietiesUI.kt
  24. 157 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tradingquery/EntrustHistoryViewHolder.kt
  25. 58 15
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tradingquery/TradingHistoryViewHolder.kt
  26. 134 25
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tradingquery/TradingQueryActivity.kt
  27. 97 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tradingquery/TradingQueryViewModel.kt
  28. 8 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/eventbus/QuoteMessageEvent.kt
  29. 1 0
      RMA/app/src/main/res/layout/cost_list_item.xml
  30. 1 1
      RMA/app/src/main/res/layout/entrust_fragment.xml
  31. 1 1
      RMA/app/src/main/res/layout/entrust_item.xml

+ 4 - 0
RMA/app/src/main/AndroidManifest.xml

@@ -171,6 +171,10 @@
             android:screenOrientation="portrait"/>
 
         <activity android:name=".view.base.future.SearchActivity"/>
+
+        <activity android:name=".view.base.future.costs.CostDetailsActivity"/>
+
+        <activity android:name=".view.base.future.deals.DealDetailsActivity"/>
     </application>
 
 </manifest>

+ 38 - 14
RMA/app/src/main/java/cn/muchinfo/rma/business/future/FutureManager.kt

@@ -5,9 +5,7 @@ import cn.muchinfo.rma.business.contract.adapter.ContractAdapter
 import cn.muchinfo.rma.business.future.adapter.ChannelOrderReqData
 import cn.muchinfo.rma.business.future.adapter.FutureAdapter
 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.QuoteDayData
+import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
 import cn.muchinfo.rma.global.data.futureOrders.DealOrderData
 import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData
@@ -230,19 +228,19 @@ class FutureManager {
      * @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<FutureDetailsData>?, [@kotlin.ParameterName] Error?, Unit>
      */
     fun queryErmcpHisEntrustDetails(
+        params: Map<String, String>,
         responseBack: (isSuccess: Boolean, respData: List<FutureEntrustData>?, error: Error?) -> Unit
     ) {
         val params = mutableMapOf<String, String>()
         params["accountID"] = SPUtils.getInstance().getLong(Constant.SELECT_ACCOUNT_ID).toString()
+    ){
         MyOkHttpUtils().query(
-            URL = SPUtils.getInstance()
-                .getString(Constant.goCommonSearchUrl) + "/Ermcp/QueryErmcpHisOrderDetails",
+            URL = SPUtils.getInstance().getString(Constant.goCommonSearchUrl) + "/Ermcp/QueryErmcpHisOrderDetails",
             params = params,
             type = "1",
-            callback = object : ResponseCallback<BaseResult<List<FutureEntrustData>>>() {
+            callback = object : ResponseCallback<BaseResult<List<FutureEntrustData>>>(){
                 override fun onResponse(response: BaseResult<List<FutureEntrustData>>?, id: Int) {
-                    GlobalDataCollection.instance?.futureHisEntrustData =
-                        response?.data as ArrayList<FutureEntrustData>?
+                    GlobalDataCollection.instance?.futureHisEntrustData = response?.data as ArrayList<FutureEntrustData>?
                     responseBack(true, response?.data, null)
                 }
 
@@ -262,15 +260,14 @@ class FutureManager {
      */
     fun queryErmcpHisTradeDetails(
         params: Map<String, String>,
-        responseBack: (isSuccess: Boolean, respData: List<FutureDetailsData>?, error: Error?) -> Unit
-    ) {
+        responseBack: (isSuccess: Boolean, respData: List<DealOrderData>?, error: Error?) -> Unit
+    ){
         MyOkHttpUtils().query(
-            URL = SPUtils.getInstance()
-                .getString(Constant.goCommonSearchUrl) + "/Ermcp/QueryErmcpHisTradeDetails",
+            URL = SPUtils.getInstance().getString(Constant.goCommonSearchUrl) + "/Ermcp/QueryErmcpHisTradeDetails",
             params = params,
             type = "1",
-            callback = object : ResponseCallback<BaseResult<List<FutureDetailsData>>>() {
-                override fun onResponse(response: BaseResult<List<FutureDetailsData>>?, id: Int) {
+            callback = object : ResponseCallback<BaseResult<List<DealOrderData>>>(){
+                override fun onResponse(response: BaseResult<List<DealOrderData>>?, id: Int) {
                     responseBack(true, response?.data, null)
                 }
 
@@ -408,5 +405,32 @@ class FutureManager {
 
     }
 
+    /**
+     * 资金流水查询(当前)
+     * @param params Map<String, String>
+     * @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<AmountLogData>?, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryAmountLog(
+        params: Map<String, String>,
+        responseBack: (isSuccess: Boolean, respData: List<AmountLogData>?, error: Error?) -> Unit
+    ){
+        MyOkHttpUtils().query(
+            URL = SPUtils.getInstance().getString(Constant.goCommonSearchUrl) + "/TaAccount/QueryAmountLog",
+            params = params,
+            type = "1",
+            callback = object : ResponseCallback<BaseResult<List<AmountLogData>>>(){
+                override fun onResponse(response: BaseResult<List<AmountLogData>>?, id: Int) {
+                    responseBack(true, response?.data, null)
+                }
+
+                override fun onError(call: Call?, e: Exception?, id: Int) {
+                    responseBack(false, null, Error(e?.message))
+                }
+
+            }
+        )
+    }
+
+
 
 }

+ 46 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/StringUtils.kt

@@ -59,6 +59,11 @@ fun String.channelbuildtype() : String{
     return  if (this == "1"){"建仓"} else{"平仓"}
 }
 
+/**
+ * 和isShowTimeString的接收时间格式不同
+ * @receiver String
+ * @return String
+ */
 fun String.toShowTime() : String{
     if (this.isNullOrEmpty()){
         return "--"
@@ -68,4 +73,45 @@ fun String.toShowTime() : String{
     return sdf1.format(sdf.parse(this))
 }
 
+/**
+ * 历史委托单的状态
+ */
+fun String.channelinnerorderstatus() : String{
+    if (this.isNullOrEmpty()){
+        return "--"
+    }
+    var str = ""
+    when {
+        this == "1" -> {
+            str = "委托请求"
+        }
+        this == "2" -> {
+            str = "冻结成功"
+        }
+        this == "3" -> {
+            str = "委托失败"
+        }
+        this == "4" -> {
+            str = "委托部成部失败"
+        }
+        this == "5" -> {
+            str = "委托成功"
+        }
+        this == "6" -> {
+            str = "全部撤销"
+        }
+        this == "7" -> {
+            str = "部成部撤"
+        }
+        this == "8" -> {
+            str = "部成部撤部失败"
+        }
+        this == "9" -> {
+            str = "全部成交"
+        }
+    }
+
+    return str
+}
+
 

+ 39 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/ViewEnumUtils.kt

@@ -145,4 +145,43 @@ object ViewEnumUtils {
         }
     }
 
+    /**
+     * 期货成交单单据类型
+     * buyOrSell 方向 - 0:买 1:卖
+     * channelbuildtype 委托单据类型 0:无 1:建仓 2:平仓
+     */
+    fun getDealOrderType(buyOrSell : String,channelbuildtype : String) : String{
+        var str = ""
+        if (buyOrSell == "0"){
+            if (channelbuildtype == "1"){
+                str = "买多"
+            }else{
+                str = "平买"
+            }
+        }else{
+            if (channelbuildtype == "1"){
+                str = "卖空"
+            }else{
+                str = "平卖"
+            }
+        }
+
+        return str
+    }
+
+    /**
+     * 期货成交单成交类型
+     */
+    fun getchanneloperatetype(channeloperatetype : String) : String{
+        var str = ""
+        if (channeloperatetype == "1"){
+            str = "正常委托"
+        }else if (channeloperatetype == "2"){
+            str = "斩仓委托"
+        }else if(channeloperatetype == "3"){
+            str = "强平委托"
+        }
+        return str
+    }
+
 }

+ 14 - 11
RMA/app/src/main/java/cn/muchinfo/rma/global/data/GGConvertConfigData.kt

@@ -16,15 +16,18 @@ package cn.muchinfo.rma.global.data
  * @constructor
  */
 data class GGConvertConfigData(
-    val convertratio : String? = "",
-    val destgoodsgroupid : String? = "",
-    val dstcode : String? = "",
-    val dstname : String? = "",
-    val dstunitid : String? = "",
-    val dstunitidname : String? = "",
-    val srccode : String? = "",
-    val srcgoodsgroupid : String? = "",
-    val srcname : String? = "",
-    val srcunitid : String? = "",
-    val srcunitidname : String? = ""
+    val convertratio : String? = "",//折算系数
+    val destgoodsgroupid : String? = "",//目标品种ID
+    val dstcode : String? = "",//目录品种代码
+    val dstexchangecode : String? = "",//目标期货交易所
+    val dstname : String? = "",//目标品种名称
+    val dstunitid : String? = "",//目标品种单位ID
+    val dstunitidname : String? = "",//目标品种单位名称
+    val modifytime : String? = "",//修改时间
+    val srccode : String? = "",//源品种代码
+    val srcexchangecode : String? = "",//源期货交易所
+    val srcgoodsgroupid : String? = "",//源品种ID
+    val srcname : String? = "",//源品种名称
+    val srcunitid : String? = "",//源品种单位ID
+    val srcunitidname : String? = ""//源品种单位名称
 )

+ 95 - 24
RMA/app/src/main/java/cn/muchinfo/rma/global/data/futureOrders/DealOrderData.kt

@@ -1,29 +1,100 @@
 package cn.muchinfo.rma.global.data.futureOrders
 
+import android.os.Parcel
+import android.os.Parcelable
+
 /***成交单实体 */
 data class DealOrderData(
-    val accountid: String = "",//账户ID
-    val buyorsell: String = "",//买卖 - 0:买 1:卖
-    val channelbuildtype: String = "",//开平标志 - 0:无 1:建仓 2:平仓
-    val channelinnerorderstatus: String = "",//委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败 5:委托成功 6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交
-    val channeloperatetype: String = "",//操作类型 - 1:正常委托 2:斩仓委托 3:强平委托
-    val closetype: String = "",//平仓方式 - 0:无 1:平今 2:平昨
-    val curexchangerate: String = "",//当前汇率
-    val exchangefullname: String = "",//外部交易所全称
-    val goodscode: String = "",//商品代码(内部)
-    val goodsid: String = "",//商品ID
-    val goodsname: String = "",//商品名称
-    val marketid: String = "",//市场ID
-    val openfreezemargin: String = "",//冻结保证金(冻结交易金额)
-
-    val orderid: String = "",//委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
-    val orderprice: String = "",//委托价格(账户)
-    val orderqty: String = "",//委托数量
-    val ordertime: String = "",//委托时间
-    val pricemode: String = "",//取价方式 - 1:市价 2: 限价
-    val tradedate: String = "",//交易日(yyyyMMdd)
-    val tradeqty: String = "",//成交数量
-    val tradetime : String = "",//成交时间
-    val tradeprice : String = "",//成交价格
+    val accountid: String? = "",//账户ID
+    val buyorsell: String? = "",//买卖 - 0:买 1:卖
+    val channelbuildtype: String? = "",//开平标志 - 0:无 1:建仓 2:平仓
+    val channelinnerorderstatus: String? = "",//委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败 5:委托成功 6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交
+    val channeloperatetype: String? = "",//操作类型 - 1:正常委托 2:斩仓委托 3:强平委托
+    val closetype: String? = "",//平仓方式 - 0:无 1:平今 2:平昨
+    val curexchangerate: String? = "",//当前汇率
+    val exchangefullname: String? = "",//外部交易所全称
+    val goodscode: String? = "",//商品代码(内部)
+    val goodsid: String? = "",//商品ID
+    val goodsname: String? = "",//商品名称
+    val marketid: String? = "",//市场ID
+    val openfreezemargin: String? = "",//冻结保证金(冻结交易金额)
+
+    val orderid: String? = "",//委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+    val orderprice: String? = "",//委托价格(账户)
+    val orderqty: String? = "",//委托数量
+    val ordertime: String? = "",//委托时间
+    val pricemode: String? = "",//取价方式 - 1:市价 2: 限价
+    val tradedate: String? = "",//交易日(yyyyMMdd)
+    val tradeqty: String? = "",//成交数量
+    val tradetime: String? = "",//成交时间
+    val tradeprice: String? = "",//成交价格
     var select: Boolean = false
-)
+) : Parcelable{
+    constructor(parcel: Parcel) : this(
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readByte() != 0.toByte()
+    ) {
+    }
+
+    override fun writeToParcel(parcel: Parcel, flags: Int) {
+        parcel.writeString(accountid)
+        parcel.writeString(buyorsell)
+        parcel.writeString(channelbuildtype)
+        parcel.writeString(channelinnerorderstatus)
+        parcel.writeString(channeloperatetype)
+        parcel.writeString(closetype)
+        parcel.writeString(curexchangerate)
+        parcel.writeString(exchangefullname)
+        parcel.writeString(goodscode)
+        parcel.writeString(goodsid)
+        parcel.writeString(goodsname)
+        parcel.writeString(marketid)
+        parcel.writeString(openfreezemargin)
+        parcel.writeString(orderid)
+        parcel.writeString(orderprice)
+        parcel.writeString(orderqty)
+        parcel.writeString(ordertime)
+        parcel.writeString(pricemode)
+        parcel.writeString(tradedate)
+        parcel.writeString(tradeqty)
+        parcel.writeString(tradetime)
+        parcel.writeString(tradeprice)
+        parcel.writeByte(if (select) 1 else 0)
+    }
+
+    override fun describeContents(): Int {
+        return 0
+    }
+
+    companion object CREATOR : Parcelable.Creator<DealOrderData> {
+        override fun createFromParcel(parcel: Parcel): DealOrderData {
+            return DealOrderData(parcel)
+        }
+
+        override fun newArray(size: Int): Array<DealOrderData?> {
+            return arrayOfNulls(size)
+        }
+    }
+
+}

+ 74 - 8
RMA/app/src/main/java/cn/muchinfo/rma/global/data/futureOrders/FutureEntrustData.kt

@@ -1,5 +1,8 @@
 package cn.muchinfo.rma.global.data.futureOrders
 
+import android.os.Parcel
+import android.os.Parcelable
+
 /**
  * 委托单
  */
@@ -11,19 +14,82 @@ data class FutureEntrustData(
     var channeloperatetype: Int = 0, // 操作类型 - 1:正常委托 2:斩仓委托 3:强平委托
     var closetype: Int = 0, // 平仓方式 - 0:无 1:平今 2:平昨
     var curexchangerate: Double = 0.0, // 当前汇率
-    var exchangefullname: String = "", // 外部交易所全称
-    var goodscode: String = "", // 商品代码(内部)
+    var exchangefullname: String? = "", // 外部交易所全称
+    var goodscode: String? = "", // 商品代码(内部)
     var goodsid: Int = 0, // 商品ID
-    var goodsname: String = "", // 商品名称
+    var goodsname: String? = "", // 商品名称
     var marketid: Int = 0, // 市场ID
     var openfreezemargin: Double = 0.0, // 冻结保证金(冻结交易金额)
-    var orderid: String = "", // 委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+    var orderid: String? = "", // 委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
     var orderprice: Double = 0.0, // 委托价格(账户)
     var orderqty: Int = 0, // 委托数量
-    var ordertime: String = "", // 委托时间
+    var ordertime: String? = "", // 委托时间
     var pricemode: Int = 0, // 取价方式 - 1:市价 2: 限价
-    var tradedate: String = "", // 交易日(yyyyMMdd)
+    var tradedate: String? = "", // 交易日(yyyyMMdd)
     var tradeqty: Int = 0, // 成交数量
-
     var selected: Boolean = false
-)
+) : Parcelable{
+    constructor(parcel: Parcel) : this(
+        parcel.readLong(),
+        parcel.readInt(),
+        parcel.readInt(),
+        parcel.readInt(),
+        parcel.readInt(),
+        parcel.readInt(),
+        parcel.readDouble(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readInt(),
+        parcel.readString(),
+        parcel.readInt(),
+        parcel.readDouble(),
+        parcel.readString(),
+        parcel.readDouble(),
+        parcel.readInt(),
+        parcel.readString(),
+        parcel.readInt(),
+        parcel.readString(),
+        parcel.readInt(),
+        parcel.readByte() != 0.toByte()
+    ) {
+    }
+
+    override fun writeToParcel(parcel: Parcel, flags: Int) {
+        parcel.writeLong(accountid)
+        parcel.writeInt(buyorsell)
+        parcel.writeInt(channelbuildtype)
+        parcel.writeInt(channelinnerorderstatus)
+        parcel.writeInt(channeloperatetype)
+        parcel.writeInt(closetype)
+        parcel.writeDouble(curexchangerate)
+        parcel.writeString(exchangefullname)
+        parcel.writeString(goodscode)
+        parcel.writeInt(goodsid)
+        parcel.writeString(goodsname)
+        parcel.writeInt(marketid)
+        parcel.writeDouble(openfreezemargin)
+        parcel.writeString(orderid)
+        parcel.writeDouble(orderprice)
+        parcel.writeInt(orderqty)
+        parcel.writeString(ordertime)
+        parcel.writeInt(pricemode)
+        parcel.writeString(tradedate)
+        parcel.writeInt(tradeqty)
+        parcel.writeByte(if (selected) 1 else 0)
+    }
+
+    override fun describeContents(): Int {
+        return 0
+    }
+
+    companion object CREATOR : Parcelable.Creator<FutureEntrustData> {
+        override fun createFromParcel(parcel: Parcel): FutureEntrustData {
+            return FutureEntrustData(parcel)
+        }
+
+        override fun newArray(size: Int): Array<FutureEntrustData?> {
+            return arrayOfNulls(size)
+        }
+    }
+
+}

+ 22 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/MyApplication.kt

@@ -38,6 +38,8 @@ import cn.muchinfo.rma.protobuf.classNumber.ClassNumber
 import cn.muchinfo.rma.protobuf.funcode.FunCode
 import cn.muchinfo.rma.view.base.BaseApplication
 import cn.muchinfo.rma.view.base.app.Constant
+import cn.muchinfo.rma.view.eventbus.EventConstent
+import cn.muchinfo.rma.view.eventbus.MessageEvent
 import com.blankj.utilcode.util.AppUtils
 import com.blankj.utilcode.util.LogUtils
 import com.blankj.utilcode.util.SPUtils
@@ -50,6 +52,9 @@ import com.tencent.smtt.sdk.QbSdk.PreInitCallback
 import com.zhy.http.okhttp.OkHttpUtils
 import com.zhy.http.okhttp.https.HttpsUtils
 import okhttp3.OkHttpClient
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
 
 
 class MyApplication : BaseApplication() {
@@ -144,6 +149,8 @@ class MyApplication : BaseApplication() {
             .sslSocketFactory(sslParams.sSLSocketFactory, sslParams.trustManager) //其他配置
             .build()
         OkHttpUtils.initClient(okHttpClient)
+        //注册eventbus
+        EventBus.getDefault().register(this)
 
         Utils.init(instance)
         Fresco.initialize(this)
@@ -152,6 +159,20 @@ class MyApplication : BaseApplication() {
         initsqData()
     }
 
+    override fun onTerminate() {
+        super.onTerminate()
+        EventBus.getDefault().unregister(this)
+    }
+
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMessageEvent(messageEvent : MessageEvent) {
+        if (messageEvent.messageType == EventConstent.USERACCOUNTCHANGE){
+
+        }
+    }
+
+
     /**
      * 对本地数据进行插入数据库操作,只在第一次启动app时有此操作
      */
@@ -256,6 +277,7 @@ class MyApplication : BaseApplication() {
                         val goodsQuoteTiks = QuoteAdapter.splitQuoteGoods(data.content)
                         // 写入盘面
                         val goodsIDs = futureManager?.updateQuoteInfo(goodsQuoteTiks!!)
+
                         // TODO: - 计算持仓盈亏和资金账户
                     }
                 }

+ 33 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/FutrueCommonView.kt

@@ -0,0 +1,33 @@
+package cn.muchinfo.rma.view.base.future
+
+import android.graphics.Color
+import android.view.Gravity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import org.jetbrains.anko.*
+
+fun _LinearLayout.detailsView(title: String, content: String, contentColor: Int = R.color.rma_black_33) {
+    linearLayout {
+        gravity = Gravity.CENTER_VERTICAL
+        textView {
+            text = title
+            textSizeAuto = 31
+            textColorInt = R.color.rma_black_33
+        }.lparams(wrapContent, wrapContent) {
+            marginStart = autoSize(36)
+        }
+
+        emptyView()
+
+        textView {
+            text = content
+            textSizeAuto = 31
+            textColorInt = contentColor
+        }.lparams(wrapContent, wrapContent) {
+            marginEnd = autoSize(36)
+        }
+    }.lparams(matchParent, autoSize(100))
+}

+ 84 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostDetailsActivity.kt

@@ -0,0 +1,84 @@
+package cn.muchinfo.rma.view.base.future.costs
+
+import android.os.Bundle
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.AmountLogData
+import cn.muchinfo.rma.view.autoWidget.commonLeftButton
+import cn.muchinfo.rma.view.autoWidget.commonTitle
+import cn.muchinfo.rma.view.autoWidget.topBar
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.future.detailsView
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import kotlinx.android.synthetic.main.layout_item_content.view.*
+import org.jetbrains.anko.verticalLayout
+
+/**
+ * 资金流水详情页面
+ */
+class CostDetailsActivity : BaseActivity<CostViewModel>(){
+
+    val data by lazy {
+        intent.getParcelableExtra<AmountLogData>("data") as AmountLogData
+    }
+
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            //头部标题
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "流水详情"
+                }
+            }
+
+            detailsView(title = "操作类型",content = data.OPERATETYPENAME ?: "")
+
+            itemView()
+
+            detailsView(title = "合约名称",content = data.dgoodsname ?: "")
+
+            itemView()
+
+            detailsView(title = "合约代码",content = data.dgoodscode ?: "")
+
+            itemView()
+
+            detailsView(title = "变动前金额",content = data.balance ?: "")
+
+            itemView()
+
+            when {
+                data.amount?.toDouble() ?: 0.0 < 0.0 -> {
+                    detailsView(title = "变动金额",content = data.amount ?: "",contentColor = R.color.rma_green_color)
+                }
+                data.amount?.toDouble() ?: 0.0 > 0.0 -> {
+                    detailsView(title = "变动金额",content = data.amount ?: "",contentColor = R.color.rma_red_color)
+                }
+                data.amount?.toDouble() ?: 0.0 == 0.0 -> {
+                    detailsView(title = "变动金额",content = data.amount ?: "")
+                }
+            }
+
+            itemView()
+
+            detailsView(title = "变动后金额",content = data.currentbalance ?: "")
+
+            itemView()
+
+            detailsView(title = "币种",content = data.currencyid ?: "")
+
+            itemView()
+
+            detailsView(title = "关联单号",content = data.relationorderid ?: "")
+
+            itemView()
+
+            detailsView(title = "时间",content = data.createtime ?: "")
+
+            itemView()
+        }
+    }
+
+}

+ 17 - 10
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostListFragment.kt

@@ -7,7 +7,10 @@ import android.view.ViewGroup
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.toArrayList
 import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.future.deals.DealViewModel
 
 /**
  * 资金流水
@@ -35,17 +38,21 @@ class CostListFragment(type: String?) : BaseFragment<CostViewModel>() {
 
     private fun initViews() {
         idCostList = _view?.findViewById(R.id.id_cost_list)
-        val costList: ArrayList<CostListData>? = ArrayList() // 资金流水
-        for (a in 1..10) {
-            val temp = CostListData()
-            temp.setTime("10:10:$a")
-            temp.setOperateType("结算盈亏")
-            temp.setAm("10$a")
-            costList?.add(temp)
-        }
+         val adapter = viewModel.getCostListAdapter()
         val layoutManager = LinearLayoutManager(context)
         idCostList?.layoutManager = layoutManager
-        viewModel.costList = costList
-        idCostList?.adapter = viewModel.getCostListAdapter()
+        viewModel.costList.bindOptional(context!!) { data ->
+            (idCostList?.adapter as CostViewModel.CostListAdapter).update(data?.toArrayList())
+        }
+        idCostList?.adapter = adapter
+    }
+
+    override fun onResume() {
+        super.onResume()
+        viewModel.queryAmountLog()
+    }
+    //主动更新数据
+    fun onRefresh(){
+        viewModel.queryAmountLog()
     }
 }

+ 44 - 125
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostViewModel.kt

@@ -1,158 +1,66 @@
 package cn.muchinfo.rma.view.base.future.costs
 
 import android.content.Context
+import android.content.Intent
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import android.widget.TextView
+import androidx.constraintlayout.widget.ConstraintLayout
+import androidx.lifecycle.MutableLiveData
 import androidx.recyclerview.widget.RecyclerView
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.AmountLogData
+import cn.muchinfo.rma.global.data.futureOrders.DealOrderData
+import cn.muchinfo.rma.global.isBlankNumber
+import cn.muchinfo.rma.global.toShowTime
+import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.autoWidget.DetailItem
+import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
 import cn.muchinfo.rma.view.base.BaseViewModel
+import com.blankj.utilcode.util.ActivityUtils
 
 class CostViewModel : BaseViewModel() {
     private var costInfoList: ArrayList<CostInfoData>? = ArrayList() // 资金信息
-    var costList: ArrayList<CostListData>? = ArrayList() // 资金流水
-    var type: String? = null
-
-//region cost info 资金信息
-    /**
-     * 组装数据
-     */
-    fun makeCostInfo() {
-        costInfoList?.clear()
-        val paddingLeft = 250 // 右侧的文字,距离左侧的距离
-        val leftTextPadding = 0 // 左侧的文字,距离左侧的距离
-
-        var m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_currency))
-        m.setRightText("USD")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_current_equity))
-        m.setRightText("1000.01")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_available_am))
-        m.setRightText("55522.02")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_occupation_amount))
-        m.setRightText("5522.29")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_freezing_of_funds))
-        m.setRightText("599.45")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_position_profit_loss))
-        m.setRightText("955.66")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_close_profit_loss))
-        m.setRightText("1485.34")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_in_am))
-        m.setRightText("72222.1")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_out_am))
-        m.setRightText("985.25")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-
-        m = CostInfoData()
-        m.setLeftText(context?.getString(R.string.str_rate_of_use))
-        m.setRightText("10.5%")
-        m.setRightTextPadding(paddingLeft)
-        m.setLeftTextPadding(leftTextPadding)
-        costInfoList?.add(m)
-    }
+//    var costList: ArrayList<CostListData>? = ArrayList() // 资金流水
 
     /**
-     * 获取配置器。
+     * 资金流水数据
      */
-    fun getCostInfoAdapter(): RecyclerView.Adapter<CostInfoAdapter.CostInfoHolder> {
-        return CostInfoAdapter(context, costInfoList)
-    }
+    val costList : MutableLiveData<List<AmountLogData>> = MutableLiveData()
 
-    /**
-     * 资金信息的适配器。
-     */
-    class CostInfoAdapter(context: Context?, list: ArrayList<CostInfoData>?) : RecyclerView.Adapter<CostInfoAdapter.CostInfoHolder>() {
-        private var list: ArrayList<CostInfoData>? = null
-        private var inflater: LayoutInflater? = null
-        private var context: Context? = null
-        init {
-            this.list = list
-            this.inflater = LayoutInflater.from(context)
-            this.context = context
-        }
-
-        override fun getItemCount(): Int {
-            return list?.size ?: 0
-        }
+    var type: String? = null
 
-        class CostInfoHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {
-            var detailItem = itemView?.findViewById<DetailItem>(R.id.id_item)
-        }
+//region cost info 资金信息
 
-        override fun onBindViewHolder(holder: CostInfoHolder, position: Int) {
-            holder.detailItem?.setLeftText(list?.get(position)?.getLeftText().toString())
-            holder.detailItem?.setRightText(list?.get(position)?.getRightText().toString())
-            list?.get(position)?.getRightTextPadding()?.let { holder.detailItem?.setRightValuePadding(it) }
-            list?.get(position)?.getLeftTextPadding()?.let { holder.detailItem?.setLeftValuePadding(it) }
-            holder.detailItem?.showLine(true)
-        }
+    fun queryAmountLog(){
+        val params = mutableMapOf<String, String>()
+        params["accountID"] = GlobalDataCollection.instance?.accountId.toString()
+        MyApplication.getInstance()?.futureManager?.queryAmountLog(params) { isSuccess, respData, _ ->
+            if (isSuccess && !respData!!.isNullOrEmpty()) {
+                costList.value = respData
+            } else {
+                // 没有数据或者接口返回错误的时候,通知界面没有获取到数据
 
-        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CostInfoHolder {
-            return CostInfoHolder(inflater?.inflate(R.layout.cost_info_item, parent, false))
+            }
         }
-
     }
-//endregion
 
 //region cost list 资金流水
 
     fun getCostListAdapter(): RecyclerView.Adapter<CostListAdapter.CostListHolder> {
-        return CostListAdapter(context, costList)
+        return CostListAdapter(context)
     }
 
     /**
      * 资金流水适配器
      */
-    class CostListAdapter(context: Context?, list: ArrayList<CostListData>?): RecyclerView.Adapter<CostListAdapter.CostListHolder>() {
-        private var list: ArrayList<CostListData>? = null
+    class CostListAdapter(context: Context?): RecyclerView.Adapter<CostListAdapter.CostListHolder>() {
+        private var list: ArrayList<AmountLogData>? = null
         private var inflater: LayoutInflater? = null
         private var context: Context? = null
         init {
-            this.list = list
             this.inflater = LayoutInflater.from(context)
             this.context = context
         }
@@ -169,20 +77,31 @@ class CostViewModel : BaseViewModel() {
             return list?.size ?: 0
         }
 
+
+        fun update(list: ArrayList<AmountLogData>?) {
+            this.list = list
+            notifyDataSetChanged()
+        }
+
         override fun onBindViewHolder(holder: CostListHolder, position: Int) {
-            holder.idTime?.text = list?.get(position)?.getTime()
-            holder.idOperateType?.text = list?.get(position)?.getOperateType()
-            holder.idAm?.text = list?.get(position)?.getAm()
+            holder.idTime?.text = list?.get(position)?.createtime?.toShowTime()
+            holder.idOperateType?.text = list?.get(position)?.OPERATETYPENAME
+            holder.idAm?.text = list?.get(position)?.currentbalance?.isBlankNumber()
+            holder.all_view?.onThrottleFirstClick {
+                val intent = Intent()
+                intent.putExtra("data",list?.get(position))
+                intent.setClass(context!!,CostDetailsActivity::class.java)
+                ActivityUtils.startActivity(intent)
+            }
         }
 
         class CostListHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {
             var idOperateType = itemView?.findViewById<TextView>(R.id.id_operate_type) // 操作类型
             var idAm = itemView?.findViewById<TextView>(R.id.id_am) // 资金
             var idTime = itemView?.findViewById<TextView>(R.id.id_time) // 时间
+            var all_view = itemView?.findViewById<ConstraintLayout>(R.id.all_view)
         }
 
     }
 
-
-//endregion
 }

+ 73 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/deals/DealDetailsActivity.kt

@@ -0,0 +1,73 @@
+package cn.muchinfo.rma.view.base.future.deals
+
+import android.os.Bundle
+import cn.muchinfo.rma.global.ViewEnumUtils
+import cn.muchinfo.rma.global.data.futureOrders.DealOrderData
+import cn.muchinfo.rma.view.autoWidget.commonLeftButton
+import cn.muchinfo.rma.view.autoWidget.commonTitle
+import cn.muchinfo.rma.view.autoWidget.topBar
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.future.detailsView
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import org.jetbrains.anko.verticalLayout
+
+class DealDetailsActivity : BaseActivity<DealViewModel>(){
+
+    val data by lazy {
+        intent.getParcelableExtra<DealOrderData>("data") as DealOrderData
+     }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            //头部标题
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "订单详情(成交)"
+                }
+            }
+
+            detailsView(title = "合约名称",content = data.goodsname ?: "")
+
+            itemView()
+
+            detailsView(title = "订单类型",content = ViewEnumUtils.getDealOrderType(data.buyorsell ?: "",data.channelbuildtype ?: ""))
+
+            itemView()
+
+            detailsView(title = "成交类型",content = ViewEnumUtils.getchanneloperatetype(data?.channeloperatetype ?: ""))
+
+            itemView()
+
+            detailsView(title = "成交数量",content = data.tradeqty ?: "")
+
+            itemView()
+
+            detailsView(title = "成交价格(CNY)",content = data.tradeprice ?: "")
+
+            itemView()
+
+//            detailsView(title = "手续费(CNY)",content = "")
+
+            detailsView(title = "成交时间",content = data.tradetime ?: "")
+
+            itemView()
+
+            detailsView(title = "参考汇率",content = data.curexchangerate ?: "")
+
+            itemView()
+
+            detailsView(title = "交易所",content = data.exchangefullname ?: "")
+
+            itemView()
+
+            detailsView(title = "订单号",content = data.orderid ?: "")
+
+//            detailsView(title = "委托人",content = "")
+
+        }
+    }
+
+
+}

+ 6 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/deals/DealViewModel.kt

@@ -1,6 +1,7 @@
 package cn.muchinfo.rma.view.base.future.deals
 
 import android.content.Context
+import android.content.Intent
 import android.graphics.drawable.Drawable
 import android.view.LayoutInflater
 import android.view.View
@@ -18,6 +19,7 @@ import cn.muchinfo.rma.global.toShowTime
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.future.interfaces.OnItemClickListener
+import com.blankj.utilcode.util.ActivityUtils
 import org.jetbrains.anko.backgroundColor
 
 class DealViewModel : BaseViewModel() {
@@ -94,7 +96,10 @@ class DealViewModel : BaseViewModel() {
 
             }
             holder.idEntrustDetail?.setOnClickListener {
-
+                val intent = Intent()
+                intent.putExtra("data",list?.get(position))
+                intent.setClass(context!!,DealDetailsActivity::class.java)
+                ActivityUtils.startActivity(intent)
             }
 
             if (list?.get(position)?.select == true) {

+ 20 - 14
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/entrusts/EntrustChildViewModel.kt

@@ -11,6 +11,8 @@ import cn.muchinfo.rma.R
 import cn.muchinfo.rma.business.future.FutureManager
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData
+import cn.muchinfo.rma.global.isBlankString
+import cn.muchinfo.rma.view.autoWidget.textColorInt
 import cn.muchinfo.rma.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.future.enums.CustomerEnums
 import cn.muchinfo.rma.view.base.future.interfaces.OnItemClickListener
@@ -69,7 +71,7 @@ class EntrustChildViewModel : BaseViewModel() {
             var idGoodsName = itemView?.findViewById<TextView>(R.id.id_goods_name)
             var idStatus = itemView?.findViewById<TextView>(R.id.id_status)
             var idDate = itemView?.findViewById<TextView>(R.id.id_date)
-            var idEntrustType = itemView?.findViewById<TextView>(R.id.id_entrust_type)
+            var idEntrustType = itemView?.findViewById<TextView>(R.id.id_entrust_type)//类型
             var idEntrustNum = itemView?.findViewById<TextView>(R.id.id_entrust_num)
             var idEntrustPrice = itemView?.findViewById<TextView>(R.id.id_entrust_price)
             var idEntrustPl = itemView?.findViewById<TextView>(R.id.id_entrust_pl)
@@ -81,19 +83,24 @@ class EntrustChildViewModel : BaseViewModel() {
 
         override fun onBindViewHolder(entrust: EntrustHolder, position: Int) {
             entrust.itemView.tag = list?.get(position)
-
-            entrust.idGoodsName?.text = list?.get(position)?.goodsname
+            val itemData = list?.get(position)
+            entrust.idGoodsName?.text = itemData?.goodsname
 //            entrust.idStatus?.text = list?.get(position)?.status
-            entrust.idEntrustType?.text = getType(list?.get(position)!!)
-            entrust.idDate?.text = getTime(list?.get(position)!!)
-            entrust.idEntrustPrice?.text = list?.get(position)?.orderprice.toString()
-            entrust.idEntrustNum?.text = list?.get(position)?.orderqty.toString()
-//            entrust.idEntrustPl?.text = list?.get(position)?.pl.toString()
+            entrust.idEntrustType?.text = getType(itemData!!)
+            if (itemData.buyorsell == 0){
+                entrust.idEntrustType?.textColorInt = R.color.rma_red_color
+            }else{
+                entrust.idEntrustType?.textColorInt = R.color.rma_green_color
+            }
+            entrust.idDate?.text = getTime(itemData)
+            entrust.idEntrustPrice?.text = itemData.orderprice.toString()
+            entrust.idEntrustNum?.text = itemData.orderqty.toString()
+            entrust.idEntrustPl?.text = list?.get(position)?.tradeqty.toString().isBlankString()
 
             // 下面三个按钮的点击事件
-            entrust.idChart?.tag = list?.get(position)
-            entrust.idEntrustDetail?.tag = list?.get(position)
-            entrust.idCancel?.tag = list?.get(position)
+            entrust.idChart?.tag = itemData
+            entrust.idEntrustDetail?.tag = itemData
+            entrust.idCancel?.tag = itemData
             entrust.idChart?.setOnClickListener {
 
             }
@@ -126,13 +133,12 @@ class EntrustChildViewModel : BaseViewModel() {
 
         fun getType(_data: FutureEntrustData): String {
             val buyOrSell = _data.buyorsell
-            val channelBuildType = _data.channelbuildtype
-            return ""
+            return if (buyOrSell == 0){"买多"}else{"卖空"}
         }
 
         fun getTime(_data: FutureEntrustData): String {
             val sdf = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss+08:00", Locale.CHINA)
-            val sdf1 = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA)
+            val sdf1 = SimpleDateFormat("HH:mm:ss", Locale.CHINA)
             return sdf1.format(sdf.parse(_data.ordertime)!!)
         }
 

+ 65 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/entrusts/EntrustDetailsActivity.kt

@@ -0,0 +1,65 @@
+package cn.muchinfo.rma.view.base.future.entrusts
+
+import android.os.Bundle
+import android.view.Gravity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.nestedScrollView
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.BaseActivity
+import org.jetbrains.anko.*
+
+/**
+ * 委托单详情
+ */
+class EntrustDetailsActivity : BaseActivity<EntrustDetailsViewModel>(){
+
+    /**
+     * type 1 可撤销 2不可撤销
+     */
+    val type by lazy {
+        intent.getStringExtra("type")
+    }
+
+    val data by lazy {
+        intent.getParcelableExtra<FutureEntrustData>("data") as FutureEntrustData
+    }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+
+            frameLayout {
+
+                nestedScrollView{
+                    verticalLayout {
+
+                    }
+                }
+
+
+                linearLayout {
+                    background = resources.getDrawable(R.color.white)
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        gravity = Gravity.CENTER
+                        backgroundResource = R.mipmap.rma_save_info_bg
+                        text = "撤单"
+                        textSizeAuto = 38
+                        textColorInt = R.color.rma_star_color
+                    }.lparams(matchParent, autoSize(119)) {
+                        marginEnd = autoSize(36)
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(matchParent, autoSize(144)) {
+                    gravity = Gravity.BOTTOM
+                }
+
+            }.lparams(matchParent,matchParent)
+
+        }
+    }
+
+}

+ 12 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/entrusts/EntrustDetailsViewModel.kt

@@ -0,0 +1,12 @@
+package cn.muchinfo.rma.view.base.future.entrusts
+
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 委托单详情的viewmodel
+ */
+class EntrustDetailsViewModel : BaseViewModel(){
+
+
+
+}

+ 2 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/holds/HoldViewModel.kt

@@ -111,10 +111,10 @@ class HoldViewModel : BaseViewModel() {
             holder.idHoldAveragePrice?.text =
                 itemData?.positionaverageprice.toString()//持仓均价【头寸变化更新】= 持仓成本 / 期末头寸 / 合约单位
             holder.idZPl?.text =
-                itemData?.positionpl.toString()//盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 卖期末头寸 * 合约单位
+                NumberUtils.roundNum(itemData?.positionpl.toString(),2)//盯市浮盈【实时行情更新】(MTP:浮动盈亏、持仓盈亏) 买方向 = (最新价 - 持仓均价) * 买期末头寸 * 合约单位;卖方向 = (持仓均价 - 最新价) * 卖期末头寸 * 合约单位
             holder.idPlp?.text = itemData?.positionplrate.toString()//持仓盈亏比例【实时行情更新】 = 持仓盈亏 / 开仓成本
             holder.id_pl?.text =
-                itemData?.openpl.toString()//逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向 = (开仓均价 - 最新价) * 卖期末头寸 * 合约单位
+                NumberUtils.roundNum(itemData?.openpl.toString(),2)//逐笔浮盈【实时行情更新】(MTP:开仓盈亏、平仓盈亏) 买方向 = (最新价 - 开仓均价) * 买期末头寸 * 合约单位;卖方向 = (开仓均价 - 最新价) * 卖期末头寸 * 合约单位
             holder.idMargin?.text = itemData?.usedmargin.toString()//占用保证金
             if (list?.get(position)?.buyorsell == 0) {
                 holder.idTransDirection?.text = context?.resources?.getString(R.string.str_buy)

+ 7 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/trade/GoodsTradeActivity.kt

@@ -237,6 +237,7 @@ class GoodsTradeActivity : BaseActivity<GoodsTradeViewModel>() {
          * 页面ui
          */
         initData(goodsId = goodsId ?: "0", outGoodsCode = outGoodsCode ?: "")
+        viewModel.calculateMoney()
         EventBus.getDefault().register(this)
         verticalLayout {
             loadingDialog = createLoadingDialog(hintStr = "请求中")
@@ -298,14 +299,18 @@ class GoodsTradeActivity : BaseActivity<GoodsTradeViewModel>() {
                 background = resources.getDrawable(R.color.rma_details_status)
                 emptyView()
                 textView {
-                    text = "权益:1279817249"
+                    viewModel.allWorth.bindOptional(context){
+                        text = "权益:$it"
+                    }
                     textSizeAuto = 31
                     textColorInt = R.color.rma_yellow_text_color
                 }.lparams(wrapContent, wrapContent)
 
                 emptyView()
                 textView {
-                    text = "可用:1279817249"
+                    viewModel.canUseWorth.bindOptional(context){
+                        text = "可用:" + NumberUtils.roundNum(it,2)
+                    }
                     textSizeAuto = 31
                     textColorInt = R.color.rma_yellow_text_color
                 }.lparams(wrapContent, wrapContent)

+ 26 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/trade/GoodsTradeViewModel.kt

@@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.business.future.adapter.ChannelOrderReqData
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AccountData
+import cn.muchinfo.rma.global.data.AccountShowData
 import cn.muchinfo.rma.global.data.QuoteDayData
 import cn.muchinfo.rma.global.data.futureOrders.FutureHoldData
 import cn.muchinfo.rma.netManage.base.InteractiveException
@@ -44,6 +45,16 @@ class GoodsTradeViewModel : BaseViewModel() {
     val usedAccountData : MutableLiveData<AccountData> = MutableLiveData()
 
     /**
+     * 权益
+     */
+    val allWorth : MutableLiveData<String> = MutableLiveData()
+
+    /**
+     * 可用
+     */
+    val canUseWorth : MutableLiveData<String> = MutableLiveData()
+
+    /**
      * 请求盘面信息
      * @param first Int
      * @param last Int
@@ -82,6 +93,21 @@ class GoodsTradeViewModel : BaseViewModel() {
     }
 
     /**
+     * 获取资金信息
+     */
+    fun calculateMoney(){
+        val accountData = GlobalDataCollection.instance?.accountData
+        val showAccountData = AccountShowData()
+        showAccountData.setNormalData()
+        canUseWorth.postValue(accountData?.currentbalance?.minus(accountData.usedmargin)?.minus(
+            accountData.freezecharge
+        )?.minus(
+            accountData.freezemargin
+        )?.minus(accountData.otherfreezemargin).toString())
+        allWorth.postValue(accountData?.currentbalance?.plus(showAccountData.keep_watch_profit_and_loss.toDouble()).toString())
+    }
+
+    /**
      * 交易下单请求
      * @param data ChannelOrderReqData
      * @param isSuccess Function1<[@kotlin.ParameterName] Boolean, Unit>

+ 103 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/CommodityFutureViewHolder.kt

@@ -0,0 +1,103 @@
+package cn.muchinfo.rma.view.base.home.commodity
+
+import android.annotation.SuppressLint
+import android.content.Intent
+import android.graphics.Typeface
+import android.view.Gravity
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.GGConvertConfigData
+import cn.muchinfo.rma.global.data.WrStandardData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.ActivityUtils
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 期货品种适配器
+ * @property activity AppCompatActivity
+ * @property viewModel CommodityInformationViewModel
+ * @property itemSize IntArray
+ * status 0 停用 1正常
+ * @constructor
+ */
+class CommodityFutureViewHolder(
+    private val activity: AppCompatActivity,
+    private val viewModel: CommodityInformationViewModel
+) : BaseViewHolder<GGConvertConfigData>(activity) {
+
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    @SuppressLint("SetTextI18n")
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                verticalLayout {
+                    gravity = Gravity.LEFT
+                    textView {
+                        data.bindOptional(context) {
+                            text = it?.srcexchangecode + "/" + it?.srcname + "/"
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(20)
+                        marginStart = autoSize(36)
+                    }
+                    textView {
+                        data.bindOptional(context) {
+                            text = it?.srccode + "/" + it?.srcunitidname + "/"
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(autoSize(300), autoSize(97))
+
+                verticalLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        data.bindOptional(context) {
+                            text = it?.convertratio
+                        }
+
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(300), autoSize(97))
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    textView {
+                        data.bindOptional(context) {
+                            text = it?.dstexchangecode + "/" + it?.dstname + "/"
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(20)
+                        marginStart = autoSize(36)
+                    }
+                    textView {
+                        data.bindOptional(context) {
+                            text = it?.dstcode + "/" + it?.dstname + "/"
+                        }
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        marginEnd = autoSize(36)
+                    }
+                }.lparams(autoSize(300), autoSize(97))
+            }.lparams(matchParent, autoSize(97))
+        }
+    }
+
+}

+ 16 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/CommodityInformationViewModel.kt

@@ -102,6 +102,11 @@ class CommodityInformationViewModel : BaseViewModel() {
      */
     val changeLogDataList : MutableLiveData<List<ChangeLogData>> = MutableLiveData()
 
+    /**
+     * 期货品种信息列表展示
+     */
+    val showGgConvertConfigDataList : MutableLiveData<List<GGConvertConfigData>> = MutableLiveData()
+
 
     /**
      * 新增套保品种时的套保品种名称选择
@@ -161,13 +166,21 @@ class CommodityInformationViewModel : BaseViewModel() {
      * 选择套保品种后的期货品种信息
      * @param goodsgroupid String
      */
-    fun queryGGConvertConfig(goodsgroupid: String) {
+    fun queryGGConvertConfig(goodsgroupid: String = "") {
+
         val params = mutableMapOf<String, String>().apply {
-            put("goodsgroupid", goodsgroupid)
+            if (goodsgroupid.isNotEmpty()){
+                put("goodsgroupid", goodsgroupid)
+            }
         }
         MyApplication.getInstance()?.commodityManager?.queryGGConvertConfig(params = params) { isSuccess, respData, _ ->
             if (isSuccess) {
-                ggConvertConfigDataList.postValue(respData)
+                if (goodsgroupid.isNotEmpty()){
+                    ggConvertConfigDataList.postValue(respData)
+                }else{
+                    showGgConvertConfigDataList.postValue(respData)
+                }
+
             }
         }
     }

+ 109 - 87
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/FuturesVarietiesUI.kt

@@ -1,21 +1,21 @@
 package cn.muchinfo.rma.view.base.home.commodity
 
+import android.view.Gravity
 import android.view.View
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
 import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.GGConvertConfigData
 import cn.muchinfo.rma.global.data.WrStandardData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import com.blankj.utilcode.util.ConvertUtils
 import com.qmuiteam.qmui.widget.tab.QMUITabSegment
 import mtp.polymer.com.autowidget.adapter.BaseAdapter
-import org.jetbrains.anko._FrameLayout
-import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.*
 import org.jetbrains.anko.support.v4.viewPager
-import org.jetbrains.anko.verticalLayout
-import org.jetbrains.anko.view
 
 
 /**
@@ -25,98 +25,118 @@ import org.jetbrains.anko.view
  * @property root _FrameLayout
  * @constructor
  */
-class FuturesVarietiesUI(private val activity : AppCompatActivity, private val viewModel : CommodityInformationViewModel){
-
-    lateinit var segment: QMUITabSegment
-    var selectedTabIndex: Int = 0
-    private lateinit var viewPager: ViewPager
-
-    private val tabsArray: List<String> by lazy {
-        arrayListOf(
-            "正常", "停用"
-        )
-    }
-    private val futuresVarietiesNormalUI by lazy { FuturesVarietiesNormalUI(activity, viewModel) }
-    val futuresVarietiesStopUI by lazy { FuturesVarietiesStopUI(activity, viewModel) }
-
-    private val pagerAdapter: PagerAdapter by lazy {
-        object : PagerAdapter() {
-
-            override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
-
-            override fun instantiateItem(container: ViewGroup, position: Int): Any {
-                when (position) {
-                    0 -> {
-                        return futuresVarietiesNormalUI.root.apply {
-                            container.addView(
-                                this,
-                                ViewGroup.LayoutParams(matchParent, matchParent)
-                            )
-                        }
-                    }
-                    1 -> {
-                        return futuresVarietiesStopUI.root.apply {
-                            container.addView(
-                                this,
-                                ViewGroup.LayoutParams(matchParent, matchParent)
-                            )
-                        }
-                    }
-                    else -> return super.instantiateItem(container, position)
-                }
-            }
+class FuturesVarietiesUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: CommodityInformationViewModel
+) {
 
-            override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
-                (`object` as? View)?.let { container.removeView(it) }
-            }
 
-            override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
 
-            override fun getCount(): Int = tabsArray.size
+    private val spotVarietiesNormalAdapter: BaseAdapter<GGConvertConfigData, CommodityFutureViewHolder> =
+        BaseAdapter { _, _ -> CommodityFutureViewHolder(activity, viewModel) }
 
-        }
+    init {
+        viewModel.queryGGConvertConfig()
     }
 
     /**
-     * 每次回到页面就刷新下
+     * 外层主动刷新
      */
     fun refrashData(){
-
+        viewModel.queryGGConvertConfig()
     }
 
     val root = _FrameLayout(activity).apply {
-        tabSegment {
-            segment = this
-            background = resources.getDrawable(R.color.segtabment_bg_color)
-            addOnTabSelectedListener(object :
-                QMUITabSegment.OnTabSelectedListener {
-                override fun onDoubleTap(index: Int) {}
-                override fun onTabReselected(index: Int) {}
-                override fun onTabUnselected(index: Int) {}
-                override fun onTabSelected(index: Int) {
-                    selectedTabIndex = index
+        verticalLayout {
+            linearLayout {
+                verticalLayout {
+                    gravity = Gravity.LEFT
+                    textView {
+                        text = "源期货交易所/品种/"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(20)
+                        marginStart = autoSize(36)
+                    }
+                    textView {
+                        text = "代码/单位"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(autoSize(300), autoSize(97))
+
+                verticalLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        text = "期货品种系数"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(300), autoSize(97))
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    textView {
+                        text = "源期货交易所/品种/"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(20)
+                        marginStart = autoSize(36)
+                    }
+                    textView {
+                        text = "代码/单位"
+                        textSizeAuto = 24
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent) {
+                        marginEnd = autoSize(36)
+                    }
+                }.lparams(autoSize(300), autoSize(97))
+            }.lparams(matchParent, autoSize(97))
+
+            view {
+                background = resources.getDrawable(R.color.line_hint_color)
+            }.lparams(matchParent, autoSize(1))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        viewModel.queryGGConvertConfig()
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = spotVarietiesNormalAdapter
+                    }.lparams(matchParent, matchParent)
                 }
-            })
-            setIndicator(null)
-            setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
-        }.lparams(matchParent, autoSize(100))
-
-        view {
-            background = resources.getDrawable(R.color.main_hit_bg_color)
-        }.lparams(matchParent, autoSize(1)) {
-            marginStart = autoSize(32)
-            marginEnd = autoSize(32)
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.showGgConvertConfigDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    spotVarietiesNormalAdapter.setNewData(it)
+                }
+            }
         }
-        viewPager {
-            background = resources.getDrawable(R.color.white)
-            viewPager = this
-            adapter = pagerAdapter
-        }.lparams(matchParent, matchParent)
-
-        segment.setupWithViewPager(viewPager)
-        segment.selectTab(selectedTabIndex)
     }
-
 }
 
 /**
@@ -128,15 +148,16 @@ class FuturesVarietiesUI(private val activity : AppCompatActivity, private val v
 class FuturesVarietiesNormalUI(
     private val activity: AppCompatActivity,
     private val viewModel: CommodityInformationViewModel
-){
+) {
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val spotVarietiesNormalAdapter: BaseAdapter<WrStandardData, CommodityViewHolder> = BaseAdapter { _, _ -> CommodityViewHolder(activity, viewModel,status = "") }
+    private val spotVarietiesNormalAdapter: BaseAdapter<WrStandardData, CommodityViewHolder> =
+        BaseAdapter { _, _ -> CommodityViewHolder(activity, viewModel, status = "") }
 
     val root = _FrameLayout(activity).apply {
         verticalLayout {
-            creatSpotVarietiesHeadUI(text1 = "现货品种",text2 = "代码",text3 = "单位",text4 = "状态")
+            creatSpotVarietiesHeadUI(text1 = "现货品种", text2 = "代码", text3 = "单位", text4 = "状态")
 
             view {
                 background = resources.getDrawable(R.color.line_hint_color)
@@ -179,15 +200,16 @@ class FuturesVarietiesNormalUI(
 class FuturesVarietiesStopUI(
     private val activity: AppCompatActivity,
     private val viewModel: CommodityInformationViewModel
-){
+) {
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val spotVarietiesNormalAdapter: BaseAdapter<WrStandardData, CommodityViewHolder> = BaseAdapter { _, _ -> CommodityViewHolder(activity, viewModel,"") }
+    private val spotVarietiesNormalAdapter: BaseAdapter<WrStandardData, CommodityViewHolder> =
+        BaseAdapter { _, _ -> CommodityViewHolder(activity, viewModel, "") }
 
     val root = _FrameLayout(activity).apply {
         verticalLayout {
-            creatSpotVarietiesHeadUI(text1 = "现货品种",text2 = "代码",text3 = "单位",text4 = "状态")
+            creatSpotVarietiesHeadUI(text1 = "现货品种", text2 = "代码", text3 = "单位", text4 = "状态")
 
             view {
                 background = resources.getDrawable(R.color.line_hint_color)

+ 157 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tradingquery/EntrustHistoryViewHolder.kt

@@ -0,0 +1,157 @@
+package cn.muchinfo.rma.view.base.home.tradingquery
+
+import android.view.Gravity
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.ViewEnumUtils
+import cn.muchinfo.rma.global.channelinnerorderstatus
+import cn.muchinfo.rma.global.data.futureOrders.DealOrderData
+import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData
+import cn.muchinfo.rma.global.isBlankString
+import cn.muchinfo.rma.global.isShowTimeString
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 交易查询历史的viewholder
+ * @property activity AppCompatActivity
+ * @property viewModel TradingQueryViewModel
+ * @property itemSize IntArray
+ * type 1是历史委托 2是历史成交
+ * @constructor
+ */
+class EntrustHistoryViewHolder(
+    private val activity: AppCompatActivity,
+    private val viewModel: TradingQueryViewModel
+) : BaseViewHolder<FutureEntrustData>(activity) {
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            onThrottleFirstClick {
+                viewModel.clickItemEntrust(dataIndex)
+            }
+            data.bindOptional(context) {
+                if (it?.selected == false) {
+                    backgroundResource = R.color.white
+                } else if (it?.selected == true) {
+                    backgroundResource = R.color.rma_list_select_color
+                }
+            }
+            linearLayout {
+                verticalLayout {
+                    gravity = Gravity.LEFT
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.goodsname
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                        marginStart = autoSize(36)
+                    }
+                    textView {
+                        data.bindOptional(context){
+                            text = ViewEnumUtils.getDealOrderType(it?.buyorsell.toString() ?: "",it?.channelbuildtype.toString() ?: "")
+                            textColorInt = if (it?.buyorsell == 0){
+                                R.color.rma_red_color
+                            }else{
+                                R.color.rma_green_color
+                            }
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.rma_star_color
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(autoSize(300), autoSize(100))
+
+                verticalLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.orderqty.toString()
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent)
+                    textView {
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.orderprice.toString(),2)
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(300), autoSize(100))
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    /** 状态 **/
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.channelinnerorderstatus.toString().channelinnerorderstatus()
+                        }
+                        text= ""
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                        marginEnd = autoSize(36)
+                    }
+                    /** 时间 **/
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.ordertime?.isShowTimeString("yyyy-MM-dd mm:HH:ss")
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        marginEnd = autoSize(36)
+                    }
+                }.lparams(autoSize(300), autoSize(100))
+            }.lparams(matchParent, autoSize(100))
+
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                data.bindOptional(context) {
+                    if (it?.selected == true) {
+                        visibility = View.VISIBLE
+                    } else if (it?.selected == false) {
+                        visibility = View.GONE
+                    }
+                }
+                emptyView()
+
+                textView {
+                    backgroundResource = R.drawable.rma_item_click_bg
+                    gravity = Gravity.CENTER
+                    text = "图表"
+                    textColorInt = R.color.rma_item_click_color
+                    textSizeAuto = 26
+                }.lparams(autoSize(120), autoSize(48)) {
+                    marginEnd = autoSize(36)
+                }
+
+                textView {
+                    backgroundResource = R.drawable.rma_item_click_bg
+                    gravity = Gravity.CENTER
+                    text = "详情"
+                    textColorInt = R.color.rma_item_click_color
+                    textSizeAuto = 26
+                }.lparams(autoSize(120), autoSize(48)) {
+                    marginEnd = autoSize(36)
+                }
+            }.lparams(matchParent, autoSize(90))
+        }.lparams(matchParent, wrapContent)
+    }
+
+}

+ 58 - 15
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tradingquery/TradingHistoryViewHolder.kt

@@ -1,11 +1,18 @@
 package cn.muchinfo.rma.view.base.home.tradingquery
 
 import android.view.Gravity
+import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.ViewEnumUtils
+import cn.muchinfo.rma.global.data.futureOrders.DealOrderData
+import cn.muchinfo.rma.global.isShowTimeString
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
 import cn.muchinfo.rma.view.autoWidget.textColorInt
 import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
 import org.jetbrains.anko.*
@@ -15,40 +22,69 @@ import org.jetbrains.anko.*
  * @property activity AppCompatActivity
  * @property viewModel TradingQueryViewModel
  * @property itemSize IntArray
+ * type 1是历史委托 2是历史成交
  * @constructor
  */
 class TradingHistoryViewHolder(
     private val activity: AppCompatActivity,
     private val viewModel: TradingQueryViewModel
-) : BaseViewHolder<String>(activity) {
+) : BaseViewHolder<DealOrderData>(activity) {
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
     override fun _FrameLayout.createContentView() {
         verticalLayout {
+            onThrottleFirstClick {
+                viewModel.clickItemDeal(dataIndex)
+            }
+            data.bindOptional(context) {
+                if (it?.select == false) {
+                    backgroundResource = R.color.white
+                } else if (it?.select == true) {
+                    backgroundResource = R.color.rma_list_select_color
+                }
+            }
             linearLayout {
                 verticalLayout {
                     gravity = Gravity.LEFT
                     textView {
-                        text = "PT789"
+                        data.bindOptional(context){
+                            text = it?.goodsname
+                        }
                         textSizeAuto = 29
                         textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                        marginStart = autoSize(36)
+                    }
                     textView {
-                        text = "买多"
+                        data.bindOptional(context){
+                            text = ViewEnumUtils.getDealOrderType(it?.buyorsell ?: "",it?.channelbuildtype ?: "")
+                            textColorInt = if (it?.buyorsell == "0"){
+                                R.color.rma_red_color
+                            }else{
+                                R.color.rma_green_color
+                            }
+                        }
                         textSizeAuto = 22
                         textColorInt = R.color.rma_star_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(36)
+                    }
                 }.lparams(autoSize(300), autoSize(100))
 
                 verticalLayout {
                     gravity = Gravity.CENTER
                     textView {
-                        text = "2"
+                        data.bindOptional(context){
+                            text = it?.tradeqty
+                        }
                         textSizeAuto = 29
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent)
                     textView {
-                        text = "4500"
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.tradeprice,2)
+                        }
                         textSizeAuto = 22
                         textColorInt = R.color.hint_text_color
                     }.lparams(wrapContent, wrapContent)
@@ -56,22 +92,29 @@ class TradingHistoryViewHolder(
 
                 verticalLayout {
                     gravity = Gravity.RIGHT
+
                     textView {
-                        text = "全部成交"
-                        textSizeAuto = 29
-                        textColorInt = R.color.rma_black_33
-                    }.lparams(wrapContent, wrapContent)
-                    textView {
-                        text = "2019-09-09 10:10:10"
+                        data.bindOptional(context){
+                            text = it?.tradetime?.isShowTimeString("yyyy-MM-dd mm:HH:ss")
+                        }
                         textSizeAuto = 22
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(30)
+                        marginEnd = autoSize(36)
+                    }
                 }.lparams(autoSize(300), autoSize(100))
             }.lparams(matchParent, autoSize(100))
 
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
-
+                data.bindOptional(context) {
+                    if (it?.select == true) {
+                        visibility = View.VISIBLE
+                    } else if (it?.select == false) {
+                        visibility = View.GONE
+                    }
+                }
                 emptyView()
 
                 textView {

+ 134 - 25
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tradingquery/TradingQueryActivity.kt

@@ -8,11 +8,15 @@ import android.view.View
 import android.view.ViewGroup
 import androidx.annotation.RequiresApi
 import androidx.appcompat.app.AppCompatActivity
+import androidx.lifecycle.MutableLiveData
 import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AmountLogData
+import cn.muchinfo.rma.global.data.futureOrders.DealOrderData
+import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData
+import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
@@ -163,11 +167,27 @@ class HistoryCommissionedUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val historyCommissionedAdapter: BaseAdapter<String, TradingHistoryViewHolder> =
-        BaseAdapter { _, _ -> TradingHistoryViewHolder(activity, viewModel) }
+    val startTime : MutableLiveData<String> = MutableLiveData()//历史委托查询起始日期
+    val endTime : MutableLiveData<String> = MutableLiveData()//历史委托查询结束日期
+
+    /**
+     * 初始化查询起始和结束日期
+     */
+    fun initTime(){
+        startTime.postValue(GlobalDataCollection.instance?.oneMonth() ?: "")
+        endTime.postValue(TimeUtils.getNowString(SimpleDateFormat("yyyy-MM-dd")))
+    }
+
+    init {
+        initTime()
+    }
+
+    private val historyCommissionedAdapter: BaseAdapter<FutureEntrustData, EntrustHistoryViewHolder> =
+        BaseAdapter { _, _ -> EntrustHistoryViewHolder(activity, viewModel) }
 
     val root = _FrameLayout(activity).apply {
         verticalLayout {
+            viewModel.queryErmcpHisEntrustDetails(startDate = startTime.value ?: "",endDate = endTime.value ?: "")
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
                 //起始日期选择
@@ -175,6 +195,9 @@ class HistoryCommissionedUI(
                     backgroundResource = R.drawable.rma_time_click_bg
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
+                        startTime.bindOptional(context){
+                            text = it
+                        }
                         text = "起始日期"
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
@@ -197,6 +220,9 @@ class HistoryCommissionedUI(
                     backgroundResource = R.drawable.rma_time_click_bg
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
+                        endTime.bindOptional(context){
+                            text = it
+                        }
                         text = "结束日期"
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
@@ -233,12 +259,17 @@ class HistoryCommissionedUI(
                         text = "名称"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                        marginStart = autoSize(36)
+                    }
                     textView {
                         text = "类型"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(36)
+                    }
                 }.lparams(autoSize(300), autoSize(97))
 
                 verticalLayout {
@@ -261,12 +292,17 @@ class HistoryCommissionedUI(
                         text = "状态"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                        marginEnd = autoSize(36)
+                    }
                     textView {
                         text = "时间"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        marginEnd = autoSize(36)
+                    }
                 }.lparams(autoSize(300), autoSize(97))
             }.lparams(matchParent, autoSize(97))
 
@@ -278,7 +314,7 @@ class HistoryCommissionedUI(
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-
+                        viewModel.queryErmcpHisEntrustDetails(startDate = startTime.value ?: "",endDate = endTime.value ?: "")
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -290,6 +326,18 @@ class HistoryCommissionedUI(
             }, emptyBlock = {
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
+
+            viewModel.entrustOrderHistoryList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    historyCommissionedAdapter.setNewData(it)
+                }
+            }
         }
     }
 }
@@ -309,18 +357,43 @@ class HistoryDealUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    private val historyCommissionedAdapter: BaseAdapter<String, TradingHistoryViewHolder> =
+    val startTime : MutableLiveData<String> = MutableLiveData()//历史成交查询起始日期
+    val endTime : MutableLiveData<String> = MutableLiveData()//历史成交查询结束日期
+
+    private val historyCommissionedAdapter: BaseAdapter<DealOrderData, TradingHistoryViewHolder> =
         BaseAdapter { _, _ -> TradingHistoryViewHolder(activity, viewModel) }
 
+    /**
+     * 初始化查询起始和结束日期
+     */
+    fun initTime(){
+        startTime.postValue(GlobalDataCollection.instance?.oneMonth() ?: "")
+        endTime.postValue(TimeUtils.getNowString(SimpleDateFormat("yyyy-MM-dd")))
+    }
+
+    init {
+        initTime()
+    }
+
+    @RequiresApi(Build.VERSION_CODES.N)
     val root = _FrameLayout(activity).apply {
         verticalLayout {
+            viewModel.queryErmcpHisTradeDetails(startDate = startTime.value ?: "",endDate = endTime.value ?: "")
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
                 //起始日期选择
                 linearLayout {
+                    onThrottleFirstClick {
+                        activity.showDataSelectDialog {
+                            startTime.postValue(this)
+                        }
+                    }
                     backgroundResource = R.drawable.rma_time_click_bg
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
+                        startTime.bindOptional(context){
+                            text = it
+                        }
                         text = "起始日期"
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
@@ -340,9 +413,17 @@ class HistoryDealUI(
 
                 //结束日期选择
                 linearLayout {
+                    onThrottleFirstClick {
+                        activity.showDataSelectDialog {
+                            endTime.postValue(this)
+                        }
+                    }
                     backgroundResource = R.drawable.rma_time_click_bg
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
+                        endTime.bindOptional(context){
+                            text = it
+                        }
                         text = "结束日期"
                         textColorInt = R.color.rma_hint_text_color_ccc
                         textSizeAuto = 31
@@ -379,12 +460,17 @@ class HistoryDealUI(
                         text = "名称"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(20)
+                        marginStart = autoSize(36)
+                    }
                     textView {
                         text = "类型"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(36)
+                    }
                 }.lparams(autoSize(300), autoSize(97))
 
                 verticalLayout {
@@ -403,16 +489,15 @@ class HistoryDealUI(
 
                 verticalLayout {
                     gravity = Gravity.RIGHT
+
                     textView {
-                        text = "状态"
+                        text = "成交时间"
                         textSizeAuto = 24
                         textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
-                    textView {
-                        text = "时间"
-                        textSizeAuto = 24
-                        textColorInt = R.color.hint_text_color
-                    }.lparams(wrapContent, wrapContent)
+                    }.lparams(wrapContent, wrapContent){
+                        marginEnd = autoSize(36)
+                        topMargin = autoSize(30)
+                    }
                 }.lparams(autoSize(300), autoSize(97))
             }.lparams(matchParent, autoSize(97))
 
@@ -424,7 +509,7 @@ class HistoryDealUI(
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-
+                        viewModel.queryErmcpHisTradeDetails(startDate = startTime.value ?: "",endDate = endTime.value ?: "")
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -436,6 +521,18 @@ class HistoryDealUI(
             }, emptyBlock = {
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
+
+            viewModel.dealOrderHistoryList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    historyCommissionedAdapter.setNewData(it)
+                }
+            }
         }
     }
 }
@@ -454,9 +551,20 @@ class MoneyFlowingUI(
     private lateinit var swipeToLayout: SwipeToLoadLayout
     private lateinit var statusLayout: StatusLayout
 
-    var startTime: String = GlobalDataCollection.instance?.oneMonth() ?: ""//历史资金流水查询起始日期
-    var endTime: String = TimeUtils.getNowString(SimpleDateFormat("yyyy-MM-dd"))//历史资金流水查询结束日期
+    val startTime : MutableLiveData<String> = MutableLiveData()//历史资金流水查询起始日期
+    val endTime : MutableLiveData<String> = MutableLiveData()//历史资金流水查询结束日期
 
+    /**
+     * 初始化查询起始和结束日期
+     */
+    fun initTime(){
+        startTime.postValue(GlobalDataCollection.instance?.oneMonth() ?: "")
+        endTime.postValue(TimeUtils.getNowString(SimpleDateFormat("yyyy-MM-dd")))
+    }
+
+    init {
+        initTime()
+    }
 
     private val moneyFlowingdAdapter: BaseAdapter<AmountLogData, MoneyFlowingViewHolder> =
         BaseAdapter { _, _ -> MoneyFlowingViewHolder(activity, viewModel) }
@@ -464,14 +572,15 @@ class MoneyFlowingUI(
     @RequiresApi(Build.VERSION_CODES.N)
     val root = _FrameLayout(activity).apply {
         verticalLayout {
+
             linearLayout {
-                viewModel.queryHisAmountLog(startDate = startTime,endDate = endTime)
+                viewModel.queryHisAmountLog(startDate = startTime.value ?: "",endDate = endTime.value ?: "")
                 gravity = Gravity.CENTER_VERTICAL
                 //起始日期选择
                 linearLayout {
                     onThrottleFirstClick {
                         activity.showDataSelectDialog {
-                            startTime = this
+                            startTime.postValue(this)
                         }
                     }
                     backgroundResource = R.drawable.rma_time_click_bg
@@ -498,7 +607,7 @@ class MoneyFlowingUI(
                 linearLayout {
                     onThrottleFirstClick {
                         activity.showDataSelectDialog {
-                            endTime = this
+                            endTime.postValue(this)
                         }
                     }
                     backgroundResource = R.drawable.rma_time_click_bg
@@ -522,7 +631,7 @@ class MoneyFlowingUI(
 
                 textView {
                     onThrottleFirstClick {
-                        viewModel.queryHisAmountLog(startDate = startTime, endDate = endTime)
+                        viewModel.queryHisAmountLog(startDate = startTime.value ?: "", endDate = endTime.value ?: "")
                     }
                     gravity = Gravity.CENTER
                     backgroundDrawable = createCommonBottomRoundBg(color = "#2481DD", corner = 5)
@@ -581,7 +690,7 @@ class MoneyFlowingUI(
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-                        viewModel.queryHisAmountLog(startDate = startTime, endDate = endTime)
+                        viewModel.queryHisAmountLog(startDate = startTime.value ?: "", endDate = endTime.value ?: "")
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)

+ 97 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tradingquery/TradingQueryViewModel.kt

@@ -3,6 +3,9 @@ package cn.muchinfo.rma.view.base.home.tradingquery
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AmountLogData
+import cn.muchinfo.rma.global.data.FinancialManageData
+import cn.muchinfo.rma.global.data.futureOrders.DealOrderData
+import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
 
@@ -14,7 +17,49 @@ class TradingQueryViewModel : BaseViewModel(){
     val hisAmountLogDataList : MutableLiveData<List<AmountLogData>> = MutableLiveData()
 
     /**
-     * 查询历史流水
+     * 历史成交单数据
+     */
+    val dealOrderHistoryList : MutableLiveData<List<DealOrderData>> = MutableLiveData()
+
+    /**
+     * 历史委托数据
+     */
+    val entrustOrderHistoryList : MutableLiveData<List<FutureEntrustData>> = MutableLiveData()
+
+    /**
+     * 历史成交单的点击展开事件
+     * @param index Int
+     */
+    fun clickItemDeal(index: Int){
+        val datanewlist = arrayListOf<DealOrderData>()
+        dealOrderHistoryList.value?.forEach {
+            if (index == dealOrderHistoryList.value?.indexOf(it)) {
+                datanewlist.add(it.copy(select = it.select.not()))
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        dealOrderHistoryList.postValue(datanewlist)
+    }
+
+    /**
+     * 历史成交单的点击展开事件
+     * @param index Int
+     */
+    fun clickItemEntrust(index: Int){
+        val datanewlist = arrayListOf<FutureEntrustData>()
+        entrustOrderHistoryList.value?.forEach {
+            if (index == entrustOrderHistoryList.value?.indexOf(it)) {
+                datanewlist.add(it.copy(selected = it.selected.not()))
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        entrustOrderHistoryList.postValue(datanewlist)
+    }
+
+    /**
+     * 查询资金流水
      * @param startDate String 开始时间 闭区间,格式:yyyy-MM-dd
      * @param endDate String 结束时间 闭区间,格式:yyyy-MM-dd
      */
@@ -36,4 +81,55 @@ class TradingQueryViewModel : BaseViewModel(){
         }
 
     }
+
+    /**
+     * 查询历史成交
+     * @param startDate String 开始时间 闭区间,格式:yyyy-MM-dd
+     * @param endDate String 结束时间 闭区间,格式:yyyy-MM-dd
+     */
+    fun queryErmcpHisTradeDetails(startDate : String = "",endDate : String = ""){
+        val params = mutableMapOf<String, String>().apply {
+            put("accountID", GlobalDataCollection.instance?.accountId.toString())
+            if (startDate.isNotEmpty()){
+                put("startDate", startDate)
+            }
+            if (endDate.isNotEmpty()){
+                put("endDate",endDate)
+            }
+        }
+
+        MyApplication.getInstance()?.futureManager?.queryErmcpHisTradeDetails(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                dealOrderHistoryList.postValue(respData)
+            }
+        }
+
+    }
+
+    /**
+     * 查询历史委托
+     * @param startDate String 开始时间 闭区间,格式:yyyy-MM-dd
+     * @param endDate String 结束时间 闭区间,格式:yyyy-MM-dd
+     */
+    fun queryErmcpHisEntrustDetails(startDate : String = "",endDate : String = ""){
+        val params = mutableMapOf<String, String>().apply {
+            put("accountID", GlobalDataCollection.instance?.accountId.toString())
+            if (startDate.isNotEmpty()){
+                put("startDate", startDate)
+            }
+            if (endDate.isNotEmpty()){
+                put("endDate",endDate)
+            }
+        }
+
+        MyApplication.getInstance()?.futureManager?.queryErmcpHisEntrustDetails(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                entrustOrderHistoryList.postValue(respData)
+            }
+        }
+
+    }
+
+
+
 }

+ 8 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/eventbus/QuoteMessageEvent.kt

@@ -0,0 +1,8 @@
+package cn.muchinfo.rma.view.eventbus
+
+/**
+ * 用于行情更新的eventbus
+ * @property goodsid Int
+ * @constructor
+ */
+class QuoteMessageEvent(var goodsid: Set<Int>)

+ 1 - 0
RMA/app/src/main/res/layout/cost_list_item.xml

@@ -3,6 +3,7 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:padding="15dp"
+    android:id="@id/all_view"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
     <!--    时间-->

+ 1 - 1
RMA/app/src/main/res/layout/entrust_fragment.xml

@@ -53,7 +53,7 @@
     <TextView
         android:id="@+id/id_pl_plp"
         android:layout_width="0dp"
-        android:text="@string/str_pl"
+        android:text="成交数量"
         android:gravity="end"
         style="@style/HoldHeadTextStyle"
         android:paddingEnd="15dp"

+ 1 - 1
RMA/app/src/main/res/layout/entrust_item.xml

@@ -80,7 +80,7 @@
         app:layout_constraintTop_toBottomOf="@+id/id_entrust_num"
         app:layout_constraintEnd_toEndOf="@+id/id_entrust_num"
         android:layout_height="wrap_content"/>
-<!--    盈亏-->
+<!--    成交数量 -->
     <TextView
         android:layout_width="0dp"
         android:text="100.00"