Explorar el Código

解决部分bug

yu.jie hace 3 años
padre
commit
3c04a7663a

+ 19 - 1
RMA/app/src/main/java/cn/muchinfo/rma/global/data/chart/ChartTSData.kt

@@ -63,7 +63,7 @@ data class ChartTSData(
             var historyTimeEndLong = historyDatas.last().getTime().replace("T"," ").replace("+08:00", "").toLongFormatTime()  // 实际结束时间
             if(historyTimeStartLong == startTimeLong){  // 开始时间一致
                 historyDatas.forEach {
-                    list.add(it.getTime().toShowTime2())
+                    list.add(it.getTime().toShowTimeNoT())
                 }
             }
 
@@ -130,6 +130,24 @@ data class ChartTSData(
         return timeString
     }
 
+
+    @SuppressLint("SimpleDateFormat")
+    fun String.toShowTimeNoT(format : String = "yyyy-MM-dd HH:mm:ss") : String{
+        if (this.isNullOrEmpty()){
+            return "--"
+        }
+        var timeString = ""
+//        if (TimeUtils.isPm(this,SimpleDateFormat("yyyy-MM-dd HH:mm:ss"))){
+//            timeString = this
+//        }else{
+        val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss+08:00", Locale.CHINA)
+        val sdf1 = SimpleDateFormat(format, Locale.CHINA)
+        timeString = sdf1.format(sdf.parse(this.replace("T"," "))!!)
+//        }
+
+        return timeString
+    }
+
     @SuppressLint("SimpleDateFormat")
     fun String.toLongFormatTime(): Long{
         return SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).parse(this, ParsePosition(0)).time

+ 7 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/MainActivity.kt

@@ -435,7 +435,13 @@ class MainActivity : BaseActivity<MainViewModel>() {
 //                            if (position == 0){
 //                                homeFragment.refrashAccount()
 //                            }
-
+                            // fix bug 错误 #3422  下单和平仓之后资金没有及时刷新
+                            // 每次点击我的按钮时 刷新账户信息
+                            // fixme 这里处理一下bug 通过position去判断当前是不是我的  如果增加新的tab 需要调整此处
+                            if(position == 4) {
+                                // 通知刷新资金账户信息
+                                viewModel.getTaAccounts()
+                            }
                             return false
                         }
 

+ 1 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/chart/old/timeCharts/TimeChartView.java

@@ -154,6 +154,7 @@ public class TimeChartView extends FrameLayout implements ITouchEventResponse {
      */
     public void setLastPrice(String lastPrice, int priceColor) {
         // 最新的数据
+//        if(lastPrice == "31.01") return;
         lineChart.setTasLastPrice(lastPrice);
         lineChart.setNewPriceColor(priceColor);
         lineChart.invalidate();

+ 2 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/HnstMainFragment.kt

@@ -98,6 +98,8 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
                 GlobalDataCollection.instance?.contractTradePositionDataArrayList?.find { it.goodsid?.toInt() == goodid }
             if (goodsInfo?.goodsid.isNullOrEmpty().not()) {
                 viewModel.getUserAccount()
+                // resolve bug  #3429
+                viewModel.resetAccountData()
             }
         }
     }

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

@@ -547,7 +547,7 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
                                         .lineWidth(2f)
                                         .name("结算价")
                                         .step(true)
-                                        .data(list?.map { it.s?.toDouble() ?: 0.0 }!!.toTypedArray())
+                                        .data(list?.map { it.c?.toDouble() ?: 0.0 }!!.toTypedArray())
                                     aaChartModel.categories(list.map {
                                         // 时间格式化
                                         TimeUtils.covnDate3(it.getTime())

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

@@ -173,7 +173,7 @@ class TjmdHomeViewModel : BaseViewModel(){
         val params = mutableMapOf<String, String>().apply {
             put("goodsCode", goodsCode)
             put("cycleType", type)
-            put("count", "30")
+            put("count", "600")
 //            put("isAsc", "true")
         }
         MyApplication.getInstance()?.chartManager?.queryHistoryDatas(params = params) { isSuccess, respData, _ ->

+ 12 - 7
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/chart/YrdzChartActivity.kt

@@ -8,8 +8,6 @@ import android.view.ViewGroup
 import android.widget.ImageView
 import android.widget.ProgressBar
 import android.widget.RelativeLayout
-import com.google.android.material.tabs.TabLayout
-
 import android.widget.TextView
 import androidx.appcompat.app.AppCompatActivity
 import androidx.lifecycle.MutableLiveData
@@ -21,7 +19,6 @@ import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.ContractData
 import cn.muchinfo.rma.global.data.WrTradeOrderDetailData
 import cn.muchinfo.rma.global.data.chart.HistoryTikData
-import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.global.isZeroBlankString
 import cn.muchinfo.rma.global.toPercentage
 import cn.muchinfo.rma.lifecycle.bindOptional
@@ -37,7 +34,11 @@ import cn.muchinfo.rma.view.base.future.trade.GoodsTradeActivity
 import cn.muchinfo.rma.view.base.yrdzpurchase.dealdetails.YrdzDealDetailsActivity
 import cn.muchinfo.rma.view.base.yrdzpurchase.listed.PurchaseListedActivity
 import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
-import com.blankj.utilcode.util.*
+import com.blankj.utilcode.util.ActivityUtils
+import com.blankj.utilcode.util.ConvertUtils
+import com.blankj.utilcode.util.SPUtils
+import com.blankj.utilcode.util.TimeUtils
+import com.google.android.material.tabs.TabLayout
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
 import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
 import com.qmuiteam.qmui.widget.tab.QMUITabSegment
@@ -45,7 +46,10 @@ import mtp.polymer.com.autowidget.adapter.BaseAdapter
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
-import org.jetbrains.anko.*
+import org.jetbrains.anko._FrameLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.textColor
+import org.jetbrains.anko.verticalLayout
 
 /**
  * 图表相关
@@ -328,6 +332,8 @@ class YrdzChartActivity : BaseActivity<YrdzChartViewModel>() , View.OnClickListe
         tabLayout.addTab(tabLayout.newTab().setText("1 分").setTag(1))
         tabLayout.addTab(tabLayout.newTab().setText("5 分").setTag(2))
         tabLayout.addTab(tabLayout.newTab().setText("30 分").setTag(3))
+        tabLayout.addTab(tabLayout.newTab().setText("1 时").setTag(4))
+        tabLayout.addTab(tabLayout.newTab().setText("4 时").setTag(240))
 
         tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener{
             override fun onTabReselected(tab: TabLayout.Tab?) {
@@ -346,7 +352,7 @@ class YrdzChartActivity : BaseActivity<YrdzChartViewModel>() , View.OnClickListe
                         viewModel.queryTimeChart()
                         progressBar.visibility = View.VISIBLE
                     }
-                    1,2,3,11,12,13,14 -> {
+                    1,2,3,11,12,13,14,4,240 -> {
                         kChartView.visibility = View.VISIBLE
                         timeChartView.visibility = View.INVISIBLE
                         viewModel.queryKChart( tab.tag.toString())
@@ -396,7 +402,6 @@ class YrdzChartActivity : BaseActivity<YrdzChartViewModel>() , View.OnClickListe
             timeChartView.refreshDate(ChartDataAdapter().getHisTikData(viewModel.outGoodsCode))
             // 这里更新最新价
             viewModel.refreshTimePrice(timeChartView)
-
         }
     }
 

+ 17 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/swaps/listed/SwapsListedActivity.kt

@@ -31,6 +31,7 @@ import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.contract.verticalEmptyView
 import cn.muchinfo.rma.view.eventbus.EventConstent
 import cn.muchinfo.rma.view.eventbus.MessageEvent
+import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
 import com.blankj.utilcode.util.ConvertUtils
 import com.blankj.utilcode.util.ToastUtils
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
@@ -130,6 +131,22 @@ class SwapsListedActivity : BaseActivity<SwapsListedViewModel>() {
         }
     }
 
+    //行情推送通知
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
+        /** 行情推送过来的goodsid **/
+        quoteMessageEvent.goodsid.forEach { goodid ->
+            //找到相应商品信息
+            val goodsInfo =
+                GlobalDataCollection.instance?.contractTradePositionDataArrayList?.find { it.goodsid?.toInt() == goodid }
+            if (goodsInfo?.goodsid.isNullOrEmpty().not()) {
+                // resolve bug  #3429
+                viewModel.resetAccountData()
+                viewModel.getTaAccounts()
+            }
+        }
+    }
+
     override fun onDestroy() {
         super.onDestroy()
         viewModel.removeSubscriptQuote(thisTag)