Simon Zhou 3 yıl önce
ebeveyn
işleme
7f5a684a08

+ 0 - 17
RMA/.idea/deploymentTargetDropDown.xml

@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="deploymentTargetDropDown">
-    <runningDeviceTargetSelectedWithDropDown>
-      <Target>
-        <type value="RUNNING_DEVICE_TARGET" />
-        <deviceKey>
-          <Key>
-            <type value="SERIAL_NUMBER" />
-            <value value="9HQDU19321012176" />
-          </Key>
-        </deviceKey>
-      </Target>
-    </runningDeviceTargetSelectedWithDropDown>
-    <timeTargetWasSelectedWithDropDown value="2022-03-03T07:13:28.801450900Z" />
-  </component>
-</project>

+ 2 - 2
RMA/app/build.gradle

@@ -19,8 +19,8 @@ android {
         applicationId "cn.muchinfo.rma"
         applicationId "cn.muchinfo.rma"
         minSdkVersion 24
         minSdkVersion 24
         targetSdkVersion 30
         targetSdkVersion 30
-        versionCode 50050
-        versionName "5.0.50"
+        versionCode 50051
+        versionName "5.0.51"
         multiDexEnabled true
         multiDexEnabled true
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         //指定room.schemaLocation生成的文件路径
         //指定room.schemaLocation生成的文件路径

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

@@ -34,6 +34,8 @@ import kotlin.math.pow
  */
  */
 class FutureManager {
 class FutureManager {
 
 
+    // 所有商品盘面信息
+    var quoteDayList: List<QuoteDayData> = ArrayList()
 
 
     /**
     /**
      * 查询期货子账户
      * 查询期货子账户

+ 0 - 2
RMA/app/src/main/java/cn/muchinfo/rma/business/swaps/SwapsManager.kt

@@ -19,8 +19,6 @@ import java.lang.Exception
  * 掉期相关manager
  * 掉期相关manager
  */
  */
 class SwapsManager {
 class SwapsManager {
-
-
     /**
     /**
      * 按单平仓操作
      * 按单平仓操作
      */
      */

+ 48 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/MainViewModel.kt

@@ -89,7 +89,14 @@ class MainViewModel : BaseViewModel() {
                 if (isSuccess) {
                 if (isSuccess) {
                     GlobalDataCollection.instance?.accountDataList = respData
                     GlobalDataCollection.instance?.accountDataList = respData
                     getUserAccount()//请求成功就继续请求用户账号信息
                     getUserAccount()//请求成功就继续请求用户账号信息
-                    isSuccess(true)
+                    // 查询所有商品盘面
+                    queryQuoteDay(false) {
+                        if (it) {
+                            isSuccess(true)
+                        } else {
+                            loadingDialogStatus.postValue(TaskUiModel.idel())
+                        }
+                    }
                 } else {
                 } else {
                     loadingDialogStatus.postValue(TaskUiModel.idel())
                     loadingDialogStatus.postValue(TaskUiModel.idel())
                 }
                 }
@@ -104,6 +111,7 @@ class MainViewModel : BaseViewModel() {
 
 
         if (SPUtils.getInstance().getString(Constant.oem) == "yrdz" || SPUtils.getInstance().getString(Constant.oem) == "tjmd"){
         if (SPUtils.getInstance().getString(Constant.oem) == "yrdz" || SPUtils.getInstance().getString(Constant.oem) == "tjmd"){
             queryWrMarketTradeConfig()
             queryWrMarketTradeConfig()
+
         }
         }
 
 
         queryUserFavoriteGoodses()
         queryUserFavoriteGoodses()
@@ -166,6 +174,45 @@ class MainViewModel : BaseViewModel() {
     }
     }
 
 
     /**
     /**
+     * 请求盘面信息
+     * @param first Int
+     * @param last Int
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryQuoteDay(
+        isShowLoading: Boolean,
+        callback: (isCompleted: Boolean) -> Unit
+    ) {
+        if (isShowLoading) {
+            loadingDialogStatus.postValue(TaskUiModel.inFlight())
+        }
+        // 查所有
+        val params = mutableMapOf<String, String>()
+        MyApplication.getInstance()?.futureManager?.queryQuoteDay(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                if (respData?.isEmpty()?.not() == true) {
+                    MyApplication.getInstance()?.futureManager?.quoteDayList = respData
+                }
+                if (isShowLoading) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "数据请求成功"))
+                }
+                callback(true)
+            } else {
+                if (isShowLoading) {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = "数据请求失败"
+                            )
+                        )
+                    )
+                }
+                callback(false)
+            }
+        }
+    }
+
+    /**
      * 查询我的自选
      * 查询我的自选
      */
      */
     fun queryUserFavoriteGoodses() {
     fun queryUserFavoriteGoodses() {

+ 31 - 15
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/account/RydzAccountActivity.kt

@@ -556,23 +556,39 @@ class MoneyInfoUI(
                             GlobalDataCollection.instance?.getSystemParamsValue(
                             GlobalDataCollection.instance?.getSystemParamsValue(
                                 "087"
                                 "087"
                             )
                             )
-                        var worth = 0.0
-                        if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
-                            worth = it?.currentbalance?.plus(
-                                it.valueOfposition
-                            )?.plus(it.valueOfposition_keep_watch_profit_and_loss)
-                                ?.minus(it.otherfreezemargin)
-                                ?.minus(it.outamountfreeze) ?: 0.0
-
-
-                        } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
-                            worth = it?.currentbalance?.plus(it.valueOfposition_keep_watch_profit_and_loss)
-                                ?.minus(it.otherfreezemargin)
-                                ?.minus(it.outamountfreeze) ?: 1.0
-                        }
+//                        var worth = 0.0
+//                        if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
+//                            worth = it?.currentbalance?.plus(
+//                                it.valueOfposition
+//                            )?.plus(it.valueOfposition_keep_watch_profit_and_loss)
+//                                ?.minus(it.otherfreezemargin)
+//                                ?.minus(it.outamountfreeze) ?: 0.0
+//
+//
+//                        } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
+//                            worth = it?.currentbalance?.plus(it.valueOfposition_keep_watch_profit_and_loss)
+//                                ?.minus(it.otherfreezemargin)
+//                                ?.minus(it.outamountfreeze) ?: 1.0
+//                        }
+                        val worth: Double
+                        worth =
+                            if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
+                                it?.currentbalance?.plus(
+                                    it.valueOfposition
+                                )
+                                    ?.plus(it.valueOfposition_keep_watch_profit_and_loss)
+                                    ?.minus(it.otherfreezemargin)
+                                    ?.minus(it.outamountfreeze) ?: 0.0
+
+
+                            } else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
+                                it?.currentbalance?.plus(it.valueOfposition_keep_watch_profit_and_loss)
+                                    ?.minus(it.otherfreezemargin)
+                                    ?.minus(it.outamountfreeze) ?: 1.0
+                            }
 
 
                         var risk = 0.0
                         var risk = 0.0
-                        if (it?.valueOfposition != 0.0) {
+                        if (worth != 0.0) {
                             risk = it?.usedmargin?.div(worth) ?: 0.0
                             risk = it?.usedmargin?.div(worth) ?: 0.0
                         }
                         }
                         text =
                         text =

+ 8 - 9
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/swaps/delisting/SwapsDelistingActivity.kt

@@ -106,6 +106,9 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
         }else if (data.pricemode == "2"){
         }else if (data.pricemode == "2"){
             priceType.postValue(2)//挂牌单为固定价是,摘牌类型只能为限价
             priceType.postValue(2)//挂牌单为固定价是,摘牌类型只能为限价
         }
         }
+
+        // 先尝试从缓存中获取盘面信息
+        viewModel.getQuoteDay(quoteGoodsListData.refgoodscode ?: "")
         viewModel.queryQuoteDay(
         viewModel.queryQuoteDay(
             tag = thisTag,
             tag = thisTag,
             goodsCodes = quoteGoodsListData.refgoodscode ?: "",
             goodsCodes = quoteGoodsListData.refgoodscode ?: "",
@@ -536,15 +539,11 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
                                     val numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
                                     val numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
                                     if (priceType.value == 1){//市价计算
                                     if (priceType.value == 1){//市价计算
                                         val money = viewModel.quoteDayData.value?.getPrice()?.times(numberInput)?.times(goodsInfo.agreeunit)
                                         val money = viewModel.quoteDayData.value?.getPrice()?.times(numberInput)?.times(goodsInfo.agreeunit)
-                                        if (money == null) {
-                                            LogUtils.e("aaaaa", viewModel.quoteDayData.value?.getPrice().toString())
-                                            LogUtils.e("aaaaa", numberInput.toString())
-
-                                            ToastUtils.showLong("初始化数据异常,请重试")
-                                            finish()
-
-                                            return@bindOptional
-                                        }
+//                                        if (money == null) {
+//                                            ToastUtils.showLong("初始化数据异常,请重试")
+//                                            finish()
+//                                            return@bindOptional
+//                                        }
                                         text = NumberUtils.roundNum(money ?: 0.0,2) + "  需履约保证金 :" + infoc?.getMargainValue(amout = viewModel.quoteDayData.value?.getPrice()?.times(numberInput)?.times(goodsInfo.agreeunit) ?: 0.0,number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
                                         text = NumberUtils.roundNum(money ?: 0.0,2) + "  需履约保证金 :" + infoc?.getMargainValue(amout = viewModel.quoteDayData.value?.getPrice()?.times(numberInput)?.times(goodsInfo.agreeunit) ?: 0.0,number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
                                     }else{//限价计算
                                     }else{//限价计算
                                         if (limit_price_edittext.text.toString().isNullOrEmpty()){
                                         if (limit_price_edittext.text.toString().isNullOrEmpty()){

+ 13 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/swaps/delisting/SwapsDelistingViewModel.kt

@@ -79,7 +79,6 @@ class SwapsDelistingViewModel : BaseViewModel(){
         }
         }
     }
     }
 
 
-
     /**
     /**
      * 查询当前选择资金账号的持仓汇总单据
      * 查询当前选择资金账号的持仓汇总单据
      * @param accountid String 当前资金账号
      * @param accountid String 当前资金账号
@@ -203,6 +202,19 @@ class SwapsDelistingViewModel : BaseViewModel(){
 
 
     }
     }
 
 
+    /**
+     * 从缓存中获取般面信息
+     */
+    fun getQuoteDay(goodsCodes: String) {
+        val quoteDayList = MyApplication.getInstance()?.futureManager?.quoteDayList
+        if (quoteDayList?.isEmpty()?.not() == true) {
+            quoteDayList.forEach {
+                if (it.goodscode == goodsCodes) {
+                    quoteDayData.postValue(it)
+                }
+            }
+        }
+    }
 
 
     /**
     /**
      * 请求盘面信息
      * 请求盘面信息