Browse Source

1、行情item进入图表界面
2、委托单接入

ProGo 4 năm trước cách đây
mục cha
commit
5b3820c4e0

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

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

+ 22 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/BaseGlobalData.java

@@ -12,6 +12,7 @@ import cn.muchinfo.rma.global.data.account.LoginQueryData;
 import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo;
 import cn.muchinfo.rma.global.data.database.EnumDicEntity;
 import cn.muchinfo.rma.global.data.database.ErrorCodeEntity;
+import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData;
 import cn.muchinfo.rma.protobuf.protoclasses.SystemMI1;
 
 public class BaseGlobalData {
@@ -77,6 +78,8 @@ public class BaseGlobalData {
      */
     private ArrayList<FutureDetailsData> tradePositionList;
 
+    private ArrayList<FutureEntrustData> futureEntrustData;
+
 
     public ArrayList<FutureDetailsData> getTradePositionList() {
         if (tradePositionList == null){
@@ -154,6 +157,10 @@ public class BaseGlobalData {
         this.enumDicEntityList = enumDicEntityList;
     }
 
+    /**
+     * 统一查询
+     * @return
+     */
     public LoginQueryData getLoginQueryData() {
         if (loginQueryData == null) {
             loginQueryData = new LoginQueryData();
@@ -164,4 +171,19 @@ public class BaseGlobalData {
     public void setLoginQueryData(LoginQueryData loginQueryData) {
         this.loginQueryData = loginQueryData;
     }
+
+    /**
+     * 委托单
+     * @return
+     */
+    public ArrayList<FutureEntrustData> getFutureEntrustData() {
+        if (futureEntrustData == null) {
+            futureEntrustData = new ArrayList<>();
+        }
+        return futureEntrustData;
+    }
+
+    public void setFutureEntrustData(ArrayList<FutureEntrustData> futureEntrustData) {
+        this.futureEntrustData = futureEntrustData;
+    }
 }

+ 8 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/GlobalDataCollection.kt

@@ -110,6 +110,14 @@ class GlobalDataCollection : BaseGlobalData() {
     }
 
     /**
+     * 当前的账号
+     */
+    var currentAccountId: String? = null
+        get() {
+            return field ?: loginRsp.accountIDsList[0].toString()
+        }
+
+    /**
      * 获取商品信息最后更新时间
      * @return
      */

+ 2 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/data/FutureDetailsData.kt

@@ -17,6 +17,7 @@ data class FutureDetailsData(
     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 = "",//委托数量
@@ -29,6 +30,7 @@ data class FutureDetailsData(
     val opencharge: String = "",//建仓手续费(账户)
     val opencharge2: String = "",//建仓手续费(商品)
     val tradeamount: String = "",//成交金额(账户)
+
     val tradeid: String = "",//成交单号(108+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
     val tradeprice: String = "",//成交价格
     val tradetime: String = "",//成交时间

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

@@ -0,0 +1,29 @@
+package cn.muchinfo.rma.global.data.futureOrders
+
+/**
+ * 委托单
+ */
+data class FutureEntrustData(
+    var accountid: Int = 0, // 账户ID
+    var buyorsell: Int = 0, // 买卖 - 0:买 1:卖
+    var channelbuildtype: Int = 0, // 开平标志 - 0:无 1:建仓 2:平仓
+    var channelinnerorderstatus: Int = 0, // 委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败 5:委托成功 6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交
+    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 goodsid: Int = 0, // 商品ID
+    var goodsname: String = "", // 商品名称
+    var marketid: Int = 0, // 市场ID
+    var openfreezemargin: Double = 0.0, // 冻结保证金(冻结交易金额)
+    var orderid: String = "", // 委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+    var orderprice: Double = 0.0, // 委托价格(账户)
+    var orderqty: Int = 0, // 委托数量
+    var ordertime: String = "", // 委托时间
+    var pricemode: Int = 0, // 取价方式 - 1:市价 2: 限价
+    var tradedate: String = "", // 交易日(yyyyMMdd)
+    var tradeqty: Int = 0, // 成交数量
+
+    var selected: Boolean = false
+)

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt

@@ -11,7 +11,7 @@ object Constant {
      */
 //    const val baseurl = "http://103.40.249.127:28280/cfg?key=mtp_20"
 //    const val baseurl = "http://192.168.30.125:8080/cfg?key=test_125"
-    const val baseurl = "http://192.168.31.114:8080/cfg?key=test_114"
+    const val baseurl = "http://192.168.31.114:8080/cfg?key=test_114" // shenzhen01  123123
 //    const val baseurl = "http://192.168.31.220:8080/cfg?key=test_220"//李倩
 
     /**

+ 12 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/chart/ChartActivity.kt

@@ -1,10 +1,22 @@
 package cn.muchinfo.rma.view.base.chart;
 
+import android.content.Context
+import android.content.Intent
 import android.os.Bundle
 import cn.muchinfo.rma.view.base.BaseActivity
 
 class ChartActivity : BaseActivity<ChartViewModel>() {
 
+    companion object {
+        // 启动页面
+        fun start(goodsId: Int = 0, context: Context) {
+            val intent = Intent()
+            intent.setClass(context, ChartActivity::class.java)
+            intent.putExtra("goodsId", goodsId)
+            context.startActivity(intent)
+        }
+    }
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         buildView()

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

@@ -8,7 +8,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.view.base.BaseFragment
-import cn.muchinfo.rma.view.base.future.entrusts.EntrustData
 
 /**
  * 成交单

+ 60 - 27
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/entrusts/EntrustChildFragment.kt

@@ -4,10 +4,22 @@ import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import androidx.lifecycle.MutableLiveData
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 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.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseFragment
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.utils.TaskUiModel
+import org.jetbrains.anko.linearLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.UI
+import java.util.ArrayList
 
 /**
  * 今日委托和今日可撤
@@ -19,7 +31,8 @@ class EntrustChildFragment(type: String) : BaseFragment<EntrustChildViewModel>()
         fun getInstance(type: String) = EntrustChildFragment(type)
     }
 
-    private var _view: View? = null
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
     private var idEntrustList: RecyclerView? = null // 委托单列表
 
     override fun onCreateView(
@@ -27,33 +40,53 @@ class EntrustChildFragment(type: String) : BaseFragment<EntrustChildViewModel>()
         container: ViewGroup?,
         savedInstanceState: Bundle?
     ): View? {
-        _view = inflater.inflate(R.layout.entrust_child, container, false)
-        initViews()
-        return _view
+        return UI {
+            linearLayout {
+                statusLayout(contentBlock = {
+                    statusLayout = this
+                    swipeToLoadLayout {
+                        swipeToLayout = this
+                        setEnableRefresh(true)
+                        setEnableLoadMore(false)
+                        setOnRefreshListener {
+                            viewModel.queryOrder()
+                        }
+                        setEnableScrollContentWhenLoaded(false)
+                        setEnableLoadMoreWhenContentNotFull(false)
+                        recyclerView {
+                            idEntrustList = this
+                            background = resources.getDrawable(R.color.white, context.theme)
+                            adapter = viewModel.getAdapter()
+                        }.lparams(matchParent, matchParent)
+                    }
+                }, emptyBlock = {
+                    emptyView(hint = resources.getString(R.string.now_no_data))
+                }).lparams(matchParent, matchParent)
+            }
+
+            // 有数据来了,就通知刷新
+            viewModel.entrustLiveData.bindOptional(context!!) {
+                idEntrustList?.adapter?.notifyDataSetChanged()
+            }
+            // 没有数据,就显示无数据
+            viewModel.noDataLiveData.bindOptional(context!!) {
+                statusLayout.showEmpty()
+            }
+
+        }.view
+    }
+
+    override fun onResume() {
+        super.onResume()
+        viewModel.queryOrder()
     }
 
-    private fun initViews() {
-        idEntrustList = _view?.findViewById(R.id.id_entrust_list)
-        val list: ArrayList<EntrustData>? = ArrayList()
-        for (a in 1..5) {
-            val m = EntrustData()
-            m.goodsName = "铁矿石" + (2105 + a)
-            m.goodsCode = "I" + (2105 + a)
-            m.lastPrice = 998.0 + a
-            m.entrustPrice = 1000.0 + a
-            m.entrustType = "买多"
-            m.entrustNum = 50.0 + a
-            m.time = "10:10:10"
-            m.goodsId = a
-            m.pl = 1001.0
-            m.status = "已报"
-            m.direction = a
-            list?.add(m)
-        }
-
-        val layoutManager = LinearLayoutManager(context)
-        idEntrustList?.layoutManager = layoutManager
-        viewModel.list = list
-        idEntrustList?.adapter = viewModel.getAdapter()
+    override fun onHiddenChanged(hidden: Boolean) {
+        super.onHiddenChanged(hidden)
+        if (!hidden) viewModel.queryOrder()
     }
+
+//region
+
+//endregion
 }

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

@@ -1,15 +1,20 @@
 package cn.muchinfo.rma.view.base.future.entrusts
 
 import android.content.Context
-import android.graphics.drawable.Drawable
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import android.widget.TextView
+import androidx.lifecycle.MutableLiveData
 import androidx.recyclerview.widget.RecyclerView
 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.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.future.interfaces.OnItemClickListener
+import com.blankj.utilcode.util.LogUtils
+import mtp.polymer.com.autowidget.utils.TaskUiModel
 import org.jetbrains.anko.backgroundColor
 
 /**
@@ -17,30 +22,34 @@ import org.jetbrains.anko.backgroundColor
  */
 class EntrustChildViewModel : BaseViewModel() {
 
-    var list: ArrayList<EntrustData>? = null // 数据
+    val entrustLiveData: MutableLiveData<List<FutureEntrustData>> = MutableLiveData() // 加载状态控制
+    val noDataLiveData: MutableLiveData<Boolean> = MutableLiveData() // 如果没有数据
+
+    var list: ArrayList<FutureEntrustData>? = null // 数据
     var onItemClickListener: OnItemClickListener? = null // item点击事件
-    var currentEntrustData: EntrustData? = null // 当前选择的item对应的数据
+    var currentEntrustData: FutureEntrustData? = null // 当前选择的item对应的数据
+
+
     /**
      * 获取配置器。
      */
     fun getAdapter(): RecyclerView.Adapter<HoldAdapter.EntrustHolder> {
-        return HoldAdapter(context, list)
+        return HoldAdapter(context)
     }
 
-    /**
-     * 通用的适配器。
+    /**     * 通用的适配器。
      */
-    inner class HoldAdapter(context: Context?, list: ArrayList<EntrustData>?) : RecyclerView.Adapter<HoldAdapter.EntrustHolder>() {
-        private var list: ArrayList<EntrustData>? = null
+    inner class HoldAdapter(context: Context?) : RecyclerView.Adapter<HoldAdapter.EntrustHolder>() {
+        private var list: ArrayList<FutureEntrustData>? = null
         private var inflater: LayoutInflater? = null
         private var context: Context? = null
-        private var selectColor: Int = 0
+        private var selectedColor: Int = 0
 
         init {
             this.list = list
             this.inflater = LayoutInflater.from(context)
             this.context = context
-            selectColor = context?.getColor(R.color.p_select_bg_color)!!
+            selectedColor = context?.getColor(R.color.p_select_bg_color)!!
         }
 
         override fun getItemCount(): Int {
@@ -64,13 +73,13 @@ class EntrustChildViewModel : BaseViewModel() {
         override fun onBindViewHolder(entrust: EntrustHolder, position: Int) {
             entrust.itemView.tag = list?.get(position)
 
-            entrust.idGoodsName?.text = list?.get(position)?.goodsName
-            entrust.idStatus?.text = list?.get(position)?.status
-            entrust.idEntrustType?.text = list?.get(position)?.entrustType
-            entrust.idDate?.text = list?.get(position)?.time
-            entrust.idEntrustPrice?.text = list?.get(position)?.entrustPrice.toString()
-            entrust.idEntrustNum?.text = list?.get(position)?.entrustNum.toString()
-            entrust.idEntrustPl?.text = list?.get(position)?.pl.toString()
+            entrust.idGoodsName?.text = list?.get(position)?.goodsname
+//            entrust.idStatus?.text = list?.get(position)?.status
+//            entrust.idEntrustType?.text = list?.get(position)?.entrustType
+            entrust.idDate?.text = list?.get(position)?.ordertime
+            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.idChart?.tag = list?.get(position)
@@ -86,12 +95,12 @@ class EntrustChildViewModel : BaseViewModel() {
 
             }
 
-            if (list?.get(position)?.select == true) {
+            if (list?.get(position)?.selected == true) {
                 entrust.idChart?.visibility = View.VISIBLE
                 entrust.idEntrustDetail?.visibility = View.VISIBLE
                 entrust.idCancel?.visibility = View.VISIBLE
-                entrust.itemView.backgroundColor = selectColor
-            } else if(list?.get(position)?.select == false) {
+                entrust.itemView.backgroundColor = selectedColor
+            } else if(list?.get(position)?.selected == false) {
                 entrust.idChart?.visibility = View.GONE
                 entrust.idEntrustDetail?.visibility = View.GONE
                 entrust.idCancel?.visibility = View.GONE
@@ -111,14 +120,14 @@ class EntrustChildViewModel : BaseViewModel() {
         }
 
         private fun clickItem(view: View) {
-            currentEntrustData = view.tag as EntrustData? // 临时存储当前点击item
+            currentEntrustData = view.tag as FutureEntrustData? // 临时存储当前点击item
 
-            // 选择
+            // 选择i
             list?.forEach { itemValue ->
-                if (itemValue.goodsId == currentEntrustData?.goodsId) {
-                    itemValue.select = !itemValue.select
+                if (itemValue.goodsid == currentEntrustData?.goodsid) {
+                    itemValue.selected = !itemValue.selected
                 } else {
-                    itemValue.select = false
+                    itemValue.selected = false
                 }
             }
 
@@ -126,4 +135,21 @@ class EntrustChildViewModel : BaseViewModel() {
             notifyDataSetChanged()
         }
     }
+
+    //region 网络请求
+
+    /**
+     * 查询
+     */
+    fun queryOrder() {
+        FutureManager().queryErmcpEntrustDetails { isSuccess, respData, _ ->
+            if (isSuccess && !respData!!.isNullOrEmpty()) { // 查询成功
+                entrustLiveData.value = respData
+            } else { // 查询失败
+                noDataLiveData.value = true
+            }
+        }
+    }
+
+    //endregion
 }

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

@@ -1,31 +0,0 @@
-package cn.muchinfo.rma.view.base.future.entrusts
-
-import java.io.Serializable
-
-class EntrustData : Serializable {
-    // 商品名称
-    var goodsName = ""
-    // 商品代码
-    var goodsCode = ""
-    // 商品id
-    var goodsId: Int = 0
-    // 最新价格
-    var lastPrice: Double = 0.0
-    // 盈亏
-    var pl: Double = 0.0
-    // 方向
-    var direction: Int = 0
-    // 类型
-    var entrustType: String = ""
-    // 委托价格
-    var entrustPrice: Double = 0.0
-    // 时间
-    var time: String = ""
-    // 状态
-    var status: String = ""
-    // 委托数量
-    var entrustNum: Double = 0.0
-
-    var select: Boolean = false
-
-}

+ 0 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/markets/FutureMarket.kt

@@ -63,10 +63,6 @@ class FutureMarket : BaseFragment<FutureMarketModel>() {
         val builder = BaseFutureModel().qmuiTabSegmentConfig(idFutureTab, 14, context!!)
 
         // 加载数据
-//        for (cat in tabs) {
-//            val item = builder?.setText(cat)?.build(context)
-//            idFutureTab?.addTab(item)
-//        }
         tabsData?.forEach {data ->
             val goodsgroupid = GlobalDataCollection.instance?.loginQueryData?.goodsgroups?.find {
                 it.goodsgroupid == data.autoid

+ 8 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/markets/MarketBaseModel.kt

@@ -15,6 +15,7 @@ import cn.muchinfo.rma.global.data.AvaildGoodsGroupData
 import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
+import cn.muchinfo.rma.view.base.chart.ChartActivity
 import com.blankj.utilcode.util.ToastUtils
 
 class MarketBaseModel : BaseViewModel() {
@@ -167,14 +168,17 @@ class MarketBaseModel : BaseViewModel() {
 
 
             // 是否自选的
-//            if (list?.get(position)?.isChoose == true) {
             holder.idIsChoose?.setImageDrawable(choose)
-//            } else {
-//                holder.idIsChoose?.setImageDrawable(unChoose)
-//            }
             holder.idChoose?.setOnClickListener {
                 ToastUtils.showShort(list?.get(position)?.goodsname)
             }
+
+            // 点击item
+            holder.itemView.tag = list?.get(position)?.goodsid
+            holder.itemView.setOnClickListener {
+                val goodsId: Int = it.tag as Int
+                ChartActivity.start(goodsId, context!!)
+            }
         }
 
         override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MarketHolder {

+ 5 - 6
RMA/app/src/main/res/layout/entrust_child.xml

@@ -1,13 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout
+<cn.muchinfo.rma.view.autoWidget.StatusLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
+    android:id="@+id/id_area"
     android:layout_height="match_parent"
-    xmlns:app="http://schemas.android.com/apk/res-auto">
+    >
     <androidx.recyclerview.widget.RecyclerView
         android:layout_width="match_parent"
-        app:layout_constraintTop_toTopOf="parent"
         android:id="@+id/id_entrust_list"
-        app:layout_constraintBottom_toBottomOf="parent"
-        android:layout_height="0dp"/>
-</androidx.constraintlayout.widget.ConstraintLayout>
+        android:layout_height="match_parent"/>
+</cn.muchinfo.rma.view.autoWidget.StatusLayout>