Explorar el Código

风险管理8月15日提交代码-liu.bolan-云融大宗

Liu.bolan hace 4 años
padre
commit
4e0423149e
Se han modificado 25 ficheros con 1519 adiciones y 17 borrados
  1. 2 2
      RMA/app/build.gradle
  2. 2 0
      RMA/app/src/main/AndroidManifest.xml
  3. 2 1
      RMA/app/src/main/java/cn/muchinfo/rma/business/account/AccountManager.kt
  4. 2 1
      RMA/app/src/main/java/cn/muchinfo/rma/update/check/CheckUpdate.java
  5. 13 7
      RMA/app/src/main/java/cn/muchinfo/rma/view/MainActivity.kt
  6. 8 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/HnstMainFragment.kt
  7. 313 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/delivery/DeliveryActivity.kt
  8. 101 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/delivery/DeliveryViewHolder.kt
  9. 25 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/delivery/DeliveryViewModel.kt
  10. 2 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/transfer/ContractTransferActivity.kt
  11. 2 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeMenuUtils.kt
  12. 2 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/NewHomeFragment.kt
  13. 0 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/ListedData.kt
  14. 33 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/BasePriceFragment.kt
  15. 11 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/BasePriceViewMoldel.kt
  16. 254 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/PurchaseOrderFragment.kt
  17. 102 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/PurchaseOrderViewModel.kt
  18. 152 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/YrdzDdjyFragment.kt
  19. 11 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/YrdzDdjyViewModel.kt
  20. 368 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/adapter/TransferAdapter.java
  21. 112 0
      RMA/app/src/main/res/layout/layout_item_transfer_content.xml
  22. BIN
      RMA/app/src/main/res/mipmap-xhdpi/yrdz_ddjy_normal.png
  23. BIN
      RMA/app/src/main/res/mipmap-xhdpi/yrdz_ddjy_select.png
  24. BIN
      RMA/app/src/main/res/mipmap-xhdpi/yrdz_reference_prices.png
  25. 2 0
      RMA/app/src/main/res/values/colors.xml

+ 2 - 2
RMA/app/build.gradle

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

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

@@ -416,6 +416,8 @@
             android:screenOrientation="portrait"
             android:windowSoftInputMode="adjustPan"/>
 
+        <activity android:name=".view.base.hnstmain.contractorders.delivery.DeliveryActivity"/>
+
     </application>
 
 </manifest>

+ 2 - 1
RMA/app/src/main/java/cn/muchinfo/rma/business/account/AccountManager.kt

@@ -430,7 +430,8 @@ class AccountManager {
                 it.code == "client_mobile_hnstxhcx" ||
                 it.code == "client_mobile_hnsthycx" ||
                 it.code == "client_mobile_hnstlygl" ||
-                it.code == "client_mobile_hnstcztx"
+                it.code == "client_mobile_hnstcztx" ||
+                it.code == "client_mobile_hnstckhq"
             ) {
                 newList.add(it)
             }

+ 2 - 1
RMA/app/src/main/java/cn/muchinfo/rma/update/check/CheckUpdate.java

@@ -15,6 +15,7 @@ import org.json.JSONObject;
 import java.nio.charset.StandardCharsets;
 
 
+import cn.muchinfo.rma.BuildConfig;
 import cn.muchinfo.rma.R;
 import cn.muchinfo.rma.update.DownLoadConstants;
 import cn.muchinfo.rma.update.FunUpDataService;
@@ -88,7 +89,7 @@ class CheckUpdate {
                             for (int i = 0; i < jsonArray.length(); i++) {
                                 jsonObject = jsonArray.getJSONObject(i);
                                 String akg = jsonObject.optString("pkg");
-                                if (akg != null && akg.equals(FunUpDataService.apk_package)) {
+                                if (akg != null && akg.equals(BuildConfig.APPLICATION_ID)) {
                                     break;
                                 }
                             }

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

@@ -26,6 +26,7 @@ import cn.muchinfo.rma.view.base.qhjhome.QhjHomeFragment
 import cn.muchinfo.rma.view.base.recycling.RecyclingFragment
 import cn.muchinfo.rma.view.base.sale.SaleFragment
 import cn.muchinfo.rma.view.base.warehousereceipt.WarehouseReceiptFragment
+import cn.muchinfo.rma.view.base.yrdzpurchase.YrdzDdjyFragment
 import cn.muchinfo.rma.view.eventbus.EventConstent
 import cn.muchinfo.rma.view.eventbus.MessageEvent
 import com.blankj.utilcode.util.AppUtils
@@ -98,6 +99,11 @@ class MainActivity : BaseActivity<MainViewModel>() {
         HnstcdysFragment()
     }
 
+    /** 云融大宗 订单交易 ***/
+    val yrdzDdjyFragment by lazy {
+        YrdzDdjyFragment()
+    }
+
     /** 华南顺通 我的 **/
     var hnstMainFragment: HnstMainFragment? = null
 
@@ -201,13 +207,13 @@ class MainActivity : BaseActivity<MainViewModel>() {
             newSelectIcon.add(R.mipmap.yrdz_yscd_select)
         }
 
-//        if(GlobalDataCollection.instance?.getFirstLevelMenu("client_mobile_hnsthyjy") == true){
-//            //华南顺通 仓单预售
-//            newFragments.add(warehouseReceiptFragment)
-//            newTabText.add("合约交易")
-//            newNormalIcon.add(R.mipmap.warehous_recepit_normal)
-//            newSelectIcon.add(R.mipmap.warehous_recepit_celect)
-//        }
+        if(GlobalDataCollection.instance?.getFirstLevelMenu("client_mobile_hnsthyjy") == true){
+            //华南顺通 订单交易
+            newFragments.add(yrdzDdjyFragment)
+            newTabText.add("订单交易")
+            newNormalIcon.add(R.mipmap.yrdz_ddjy_normal)
+            newSelectIcon.add(R.mipmap.yrdz_ddjy_select)
+        }
 
         if (GlobalDataCollection.instance?.getFirstLevelMenu("client_mobile_hnstmine") == true) {
             if (hnstMainFragment == null) {

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

@@ -15,6 +15,7 @@ import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.BankAccountSignData
 import cn.muchinfo.rma.global.data.BrokerApplyData
+import cn.muchinfo.rma.global.data.ContractTradePositionData
 import cn.muchinfo.rma.global.data.OrderQuoteData
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
@@ -25,6 +26,7 @@ import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.hnstmain.account.RydzAccountActivity
 import cn.muchinfo.rma.view.base.hnstmain.bookingwarehouse.BookingWarehouseActivity
 import cn.muchinfo.rma.view.base.hnstmain.contractorders.ContractOrdersActivity
+import cn.muchinfo.rma.view.base.hnstmain.contractorders.delivery.DeliveryActivity
 import cn.muchinfo.rma.view.base.hnstmain.finance.FinanceManagementActivity
 import cn.muchinfo.rma.view.base.hnstmain.performance.PerformanceInformationActivity
 import cn.muchinfo.rma.view.base.hnstmain.spotwarehouse.SpotWareHouseActivity
@@ -370,8 +372,13 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
                             //资金流水
                             verticalLayout {
                                 onThrottleFirstClick {
+//                                    val intent = Intent()
+//                                    intent.setClass(context, ContractOrdersActivity::class.java)
+//                                    ActivityUtils.startActivity(intent)
+
                                     val intent = Intent()
-                                    intent.setClass(context, ContractOrdersActivity::class.java)
+                                    intent.putExtra("data", ContractTradePositionData())
+                                    intent.setClass(context, DeliveryActivity::class.java)
                                     ActivityUtils.startActivity(intent)
                                 }
                                 gravity = Gravity.CENTER_HORIZONTAL

+ 313 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/delivery/DeliveryActivity.kt

@@ -0,0 +1,313 @@
+package cn.muchinfo.rma.view.base.hnstmain.contractorders.delivery
+
+import android.annotation.SuppressLint
+import android.os.Bundle
+import android.view.Gravity
+import android.view.View
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.ContractTradePositionData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import org.jetbrains.anko.*
+
+class DeliveryActivity : BaseActivity<DeliveryViewModel>(){
+
+    // 下拉刷新
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    //合约汇总实体
+    val data by lazy { intent.getParcelableExtra<ContractTradePositionData>("data") as ContractTradePositionData }
+
+    private val deliveryAdapter: BaseAdapter<String, DeliveryViewHolder> =
+        BaseAdapter { _, _ ->
+            DeliveryViewHolder(
+                this,
+                viewModel
+            )
+        }
+
+
+    @SuppressLint("SetTextI18n")
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            background = resources.getDrawable(R.color.segtabment_bg_color)
+            viewModel.getDeliveryList()
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "交收"
+                }
+            }
+
+            frameLayout {
+                verticalLayout {
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        background = resources.getDrawable(R.color.yrdz_delivery_title_bg_color)
+                        textView {
+                            text = "合约:" + data.goodscode + data.goodsname
+                            textSizeAuto = 32
+                            textColorInt = R.color.qhj_blue_text_color
+                        }.lparams(wrapContent, wrapContent){
+                            marginStart = autoSize(36)
+                        }
+
+                        textView {
+                            text = "合约数量:" + data.enableqty
+                            textSizeAuto = 32
+                            textColorInt = R.color.qhj_blue_text_color
+                        }.lparams(wrapContent, wrapContent){
+                            marginStart = autoSize(80)
+                        }
+                    }.lparams(matchParent, autoSize(84))
+
+                    linearLayout {
+                        background = resources.getDrawable(R.color.white)
+                        gravity = Gravity.CENTER_VERTICAL
+                        textView {
+                            text = "点选仓单"
+                            textSizeAuto = 32
+                            textColorInt = R.color.rma_gray_color
+                        }.lparams(wrapContent, wrapContent){
+                            marginStart = autoSize(36)
+                        }
+
+                        emptyView()
+
+                        textView {
+                            text = "可交收数量" + data.enableqty + data.agreeunit
+                            textSizeAuto = 32
+                            textColorInt = R.color.buy_hall_color
+                        }.lparams(wrapContent, wrapContent){
+                            marginEnd = autoSize(36)
+                        }
+                    }.lparams(matchParent, autoSize(92))
+
+                    itemView()
+
+                    linearLayout {
+                        background = resources.getDrawable(R.color.white)
+
+                        linearLayout {
+                            gravity = Gravity.CENTER_VERTICAL
+                            textView {
+                                text = "持有人/商品/仓库"
+                                textSizeAuto = 29
+                                textColorInt = R.color.rma_gray_color
+                            }.lparams(wrapContent, wrapContent){
+                                marginStart = autoSize(36)
+                            }
+                        }.lparams(0, autoSize(88),1.5f)
+
+                        linearLayout {
+                            gravity = Gravity.CENTER
+                            textView {
+                                text = "升贴水/数量"
+                                textSizeAuto = 29
+                                textColorInt = R.color.rma_gray_color
+                            }.lparams(wrapContent, wrapContent)
+                        }.lparams(0, autoSize(88),1f)
+
+                        linearLayout {
+                            gravity = Gravity.CENTER_VERTICAL or Gravity.RIGHT
+                            textView {
+                                text = "选择数量"
+                                textSizeAuto = 29
+                                textColorInt = R.color.rma_gray_color
+                            }.lparams(wrapContent, wrapContent){
+                                marginEnd = autoSize(36)
+                            }
+                        }.lparams(0, autoSize(88),1f)
+                    }.lparams(matchParent, autoSize(88))
+
+                    statusLayout(contentBlock = {
+                        statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                        setRetryAction {
+
+                        }
+                        swipeToLoadLayout {
+                            swipeToLayout = this
+                            setEnableRefresh(false)
+                            setEnableLoadMore(false)
+                            setOnRefreshListener {
+
+                            }
+                            setEnableScrollContentWhenLoaded(false)
+                            setEnableLoadMoreWhenContentNotFull(false)
+
+                            // 未提交列表
+                            recyclerView {
+                                background = resources.getDrawable(R.color.segtabment_bg_color)
+                                adapter = deliveryAdapter
+                            }.lparams(matchParent, matchParent)
+                        }
+                    }, emptyBlock = {
+                        emptyView(hint = resources.getString(R.string.now_no_data))
+                    }).lparams(matchParent, matchParent)
+
+                    viewModel.deliveryDataList.bindOptional(context) {
+                        if (it?.isEmpty() == true || it?.size == 0) {
+                            statusLayout.showEmpty()
+                        } else {
+                            if (swipeToLayout.getIsRefreshing()) {
+                                swipeToLayout.finishRefresh()
+                            }
+                            statusLayout.showSuccess()
+                            deliveryAdapter.setNewData(it)
+                        }
+                    }
+                }
+
+                verticalLayout {
+                    background = resources.getDrawable(R.color.white)
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        textView {
+                            text = "已点选数量"
+                            textSizeAuto = 29
+                            textColorInt = R.color.rma_gray_color
+                        }.lparams(wrapContent, wrapContent){
+                            marginStart = autoSize(36)
+                        }
+                        textView {
+                            text = "40吨"
+                            textSizeAuto = 29
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent)
+
+                        textView {
+                            text = ",需合约数量"
+                            textSizeAuto = 29
+                            textColorInt = R.color.rma_gray_color
+                        }
+
+                        textView {
+                            text = "8"
+                            textSizeAuto = 29
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent)
+
+                        emptyView()
+
+                        textView {
+                            text = "升贴水"
+                            textSizeAuto = 29
+                            textColorInt = R.color.rma_gray_color
+                        }.lparams(wrapContent, wrapContent)
+
+                        textView {
+                            text = "1100"
+                            textSizeAuto = 29
+                            textColorInt = R.color.yrdz_red_color
+                        }.lparams(wrapContent, wrapContent){
+                            marginEnd = autoSize(36)
+                        }
+                    }.lparams(matchParent, autoSize(90))
+
+                    itemView()
+
+                    linearLayout {
+                        visibility = View.GONE
+                        gravity = Gravity.CENTER_VERTICAL
+                        textView {
+                            onThrottleFirstClick {
+
+                            }
+                            text = "交收"
+                            gravity = Gravity.CENTER
+                            textSizeAuto = 36
+                            textColorInt = R.color.white
+                            backgroundResource = R.drawable.rydz_main_red_bg
+                        }.lparams(matchParent, autoSize(96)){
+                            marginStart = autoSize(36)
+                            marginEnd = autoSize(36)
+                        }
+                    }.lparams(matchParent, autoSize(144))
+
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        verticalLayout {
+                            linearLayout {
+                                textView {
+                                    text = "点价合约"
+                                    textSizeAuto = 29
+                                    textColorInt = R.color.rma_gray_color
+                                }.lparams(wrapContent, wrapContent){
+                                    marginStart = autoSize(36)
+                                }
+                                textView {
+                                    text = data.goodscode
+                                    textSizeAuto = 29
+                                    textColorInt = R.color.qhj_blue_text_color
+                                }.lparams(wrapContent, wrapContent)
+                            }.lparams(matchParent, wrapContent){
+                                topMargin = autoSize(28)
+                            }
+
+                            textView {
+                                text = "1312.00"
+                                textSizeAuto = 34
+                                textColorInt = R.color.rma_red_color
+                            }.lparams(wrapContent, wrapContent){
+                                topMargin = autoSize(10)
+                                marginStart = autoSize(36)
+                            }
+
+                        }.lparams(0, autoSize(144),1.5f)
+
+                        verticalLayout {
+                            gravity = Gravity.RIGHT
+                            textView {
+                                text = "预估货款"
+                                textSizeAuto = 29
+                                textColorInt = R.color.rma_gray_color
+                            }.lparams(wrapContent, wrapContent){
+                                marginEnd = autoSize(18)
+                                topMargin = autoSize(28)
+                            }
+
+                            textView {
+                                text = "71000"
+                                textSizeAuto = 34
+                                textColorInt = R.color.rma_black_33
+                            }.lparams(wrapContent, wrapContent){
+                                marginEnd = autoSize(18)
+                                topMargin = autoSize(10)
+                            }
+                        }.lparams(0, autoSize(144),1f)
+
+                        verticalLayout {
+                            gravity = Gravity.CENTER_VERTICAL
+                            textView {
+                                onThrottleFirstClick {
+
+                                }
+                                text = "交收"
+                                gravity = Gravity.CENTER
+                                textSizeAuto = 36
+                                textColorInt = R.color.white
+                                backgroundResource = R.drawable.rydz_main_red_bg
+                            }.lparams(matchParent, autoSize(96)){
+                                marginStart = autoSize(18)
+                                marginEnd = autoSize(18)
+                            }
+                        }.lparams(0, autoSize(144),1.5f)
+
+                    }.lparams(matchParent, autoSize(144))
+
+                }.lparams(matchParent, wrapContent){
+                    gravity = Gravity.BOTTOM
+                }
+            }.lparams(matchParent, matchParent)
+
+        }
+    }
+
+}

+ 101 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/delivery/DeliveryViewHolder.kt

@@ -0,0 +1,101 @@
+package cn.muchinfo.rma.view.base.hnstmain.contractorders.delivery
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class DeliveryViewHolder(private val activity : AppCompatActivity,private val viewModel: DeliveryViewModel) : BaseViewHolder<String>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                imageView {
+                    imageResource = R.mipmap.ic_check_normal
+                    imageResource = R.mipmap.ic_check_select
+                }.lparams(autoSize(43), autoSize(43)){
+                    marginStart = autoSize(23)
+                }
+
+                textView {
+                    text = "南**业"
+                    textSizeAuto = 34
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent){
+                    marginStart = autoSize(28)
+                }
+            }.lparams(matchParent, autoSize(76))
+
+            itemView()
+
+            linearLayout {
+                verticalLayout {
+                    textView {
+                        text = "铜杆-12mm-江铜"
+                        textSizeAuto = 32
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(25)
+                        marginStart = autoSize(20)
+                    }
+
+                    textView {
+                        text = "蛇口仓库"
+                        textSizeAuto = 32
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(20)
+                        topMargin = autoSize(10)
+                    }
+                }.lparams(0, autoSize(139),1.3f)
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        text = "1"
+                        textSizeAuto = 34
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent)
+
+                    emptyView()
+
+                    textView {
+                        text = "5吨"
+                        textSizeAuto = 34
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        marginEnd = autoSize(23)
+                    }
+                }.lparams(0, autoSize(139),1f)
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    numberEditText {
+                        text = "0"
+                        setOnTextChangeListener { view, value ->
+                            if (value.isNullOrEmpty().not()) {
+
+                            }
+                        }
+                        setTextColor(R.color.buy_hall_color)
+                    }.lparams(0, autoSize(72), 1f) {
+                        marginStart = autoSize(23)
+                        marginEnd = autoSize(23)
+                    }
+                }.lparams(0, autoSize(139),1f)
+            }.lparams(matchParent, autoSize(139))
+        }.lparams(matchParent, autoSize(216)){
+            marginStart = autoSize(25)
+            marginEnd = autoSize(25)
+            topMargin = autoSize(24)
+        }
+    }
+}

+ 25 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/delivery/DeliveryViewModel.kt

@@ -0,0 +1,25 @@
+package cn.muchinfo.rma.view.base.hnstmain.contractorders.delivery
+
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 交收viewmodel
+ */
+class DeliveryViewModel : BaseViewModel(){
+
+    /**
+     * 交收页面
+     */
+    val deliveryDataList : MutableLiveData<List<String>> = MutableLiveData()
+
+    /**
+     * 获取可交收列表
+     */
+    fun getDeliveryList(){
+        deliveryDataList.postValue(arrayListOf("1","2","3","4","5"))
+    }
+
+
+
+}

+ 2 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/transfer/ContractTransferActivity.kt

@@ -49,6 +49,7 @@ class ContractTransferActivity : BaseActivity<ContractTransferViewModel>(){
         super.onCreate(savedInstanceState)
         verticalLayout {
             createLoadingDialog(hintStr = "").bindTaskStatus(context, viewModel.loadingDialogStatus)
+
             topBar {
                 commonLeftButton()
                 commonTitle {
@@ -59,6 +60,7 @@ class ContractTransferActivity : BaseActivity<ContractTransferViewModel>(){
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
                 linearLayout {
+                    background = resources.getDrawable(R.color.white)
                     textView {
                         text = "合        约"
                         textSizeAuto = 34
@@ -76,10 +78,6 @@ class ContractTransferActivity : BaseActivity<ContractTransferViewModel>(){
 
                 emptyView()
 
-                imageView {
-                    imageResource = R.mipmap.rma_more
-                }.lparams(autoSize(36), autoSize(36))
-
             }.lparams(matchParent, autoSize(143))
 
             itemView()

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

@@ -50,6 +50,8 @@ fun String.getMenuIcon() : Int{
         returnString = R.mipmap.main_business_5
     }else if (this == "client_mobile_hnstcztx"){
         returnString = R.mipmap.qhj_withdrawal
+    }else if (this == "client_mobile_hnstckhq"){
+        returnString = R.mipmap.yrdz_reference_prices
     }
 
     return returnString

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

@@ -770,6 +770,8 @@ fun jumpActivity(context : Context,code : String){
 
     }else if (code == "client_mobile_hnstcztx"){//华南顺通-充值提现
 
+    }else if (code == "client_mobile_hnstckhq"){//华南顺通-参考行情
+
     }
     ActivityUtils.startActivity(intent)
 }

+ 0 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/warehousereceipt/dialog/ListedData.kt

@@ -54,7 +54,6 @@ data class ListedData(
                 if (data.isSelect == 1){
                     FactoryItems.setDGFactoryItemID(data.dgfactoryitemid?.toLong() ?: 0)
                 }
-
             }
             FactoryItems.setItemTypeMode(1)
             factoryItemsList.add(FactoryItems.build())

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

@@ -0,0 +1,33 @@
+package cn.muchinfo.rma.view.base.yrdzpurchase
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.future.markets.FutureMarket
+import org.jetbrains.anko.support.v4.UI
+import org.jetbrains.anko.verticalLayout
+
+/**
+ * 云融大宗-订单交易-基差点价页面
+ */
+class BasePriceFragment : BaseFragment<BasePriceViewMoldel>(){
+
+    companion object {
+        fun getInstance() = BasePriceFragment()
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        return UI {
+            verticalLayout {
+
+            }
+        }.view
+    }
+
+}

+ 11 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/BasePriceViewMoldel.kt

@@ -0,0 +1,11 @@
+package cn.muchinfo.rma.view.base.yrdzpurchase
+
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 云融大宗-订单交易-基差点价viewMoldel
+ */
+class BasePriceViewMoldel : BaseViewModel(){
+
+
+}

+ 254 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/PurchaseOrderFragment.kt

@@ -0,0 +1,254 @@
+package cn.muchinfo.rma.view.base.yrdzpurchase
+
+import android.os.Bundle
+import android.view.*
+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.*
+
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.platinumtreasure.adapter.PlatnumTreasureAdapter
+import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
+import cn.muchinfo.rma.view.base.yrdzpurchase.adapter.TransferAdapter
+import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
+import com.blankj.utilcode.util.LogUtils
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import org.jetbrains.anko.*
+
+import org.jetbrains.anko.support.v4.UI
+
+/**
+ * 云融-订单交易-挂牌转让页面
+ */
+class PurchaseOrderFragment : BaseFragment<PurchaseOrderViewModel>() ,TransferAdapter.OnContentScrollListener{
+
+    companion object {
+        fun getInstance() = PurchaseOrderFragment()
+    }
+
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    lateinit var horScrollview: CustomHorizontalScrollView
+    lateinit var recyclerView: RecyclerView
+
+    lateinit var dataRecyclerview : RecyclerView
+
+    var fistShow: Int = 0
+    var lastShow: Int = 0
+
+    val thisTag by lazy {
+        this.tag
+    }
+
+    //标题头部
+    val topAdapter by lazy {
+        TopTabAdpater(activity)
+    }
+
+    val transferAdapter by lazy {
+        TransferAdapter(activity)
+    }
+
+    //注册eventbus
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        EventBus.getDefault().register(this)
+    }
+
+    override fun onDestroy() {
+        super.onDestroy()
+        EventBus.getDefault().unregister(this)
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
+        /** 行情推送过来的goodsid **/
+        quoteMessageEvent.goodsid.forEach { goodid ->
+            LogUtils.eTag("dadafafsjhdkjahkjdhak",goodid)
+            //找到相应商品信息
+            val goodsInfo = viewModel.transferDataList.value?.find { it.goodsid == goodid }
+            viewModel.transferDataList.value?.indexOf(goodsInfo)?.let {
+                if (it != -1) {//刷新相应item
+                    dataRecyclerview.adapter?.notifyItemChanged(it)
+                }
+            }
+        }
+
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        return UI {
+            viewModel.initData(tag = thisTag ?: ""){isCompleted, err ->
+                if (isCompleted){
+                    transferAdapter.notifyDataSetChanged()
+                }
+            }
+            verticalLayout {
+
+                linearLayout {
+                    linearLayout {
+                        gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                        textView {//待点价头部左侧数据
+//                            viewModel.titleList.bindOptional(context) {
+//                                text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
+//                            }
+                            text = "合约"
+                            textColorStr = "#AAAAAA"
+                            textSizeAuto = 31
+                        }.lparams(wrapContent, wrapContent){
+                            marginStart = autoSize(30)
+                        }
+                    }.lparams(autoSize(250), autoSize(100))
+                    transferAdapter.setOnContentScrollListener(this@PurchaseOrderFragment)
+                    inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
+                        horScrollview = this
+                        setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY -> //代码重复,可以抽取/////
+                            transferAdapter.offestX = scrollX
+                            val viewHolderCacheList: List<TransferAdapter.ItemViewHolder> =
+                                transferAdapter.viewHolderCacheList
+                            if (null != viewHolderCacheList) {
+                                val size = viewHolderCacheList.size
+                                for (i in 0 until size) {
+                                    viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                        scrollX,
+                                        0
+                                    )
+                                }
+                            }
+                        }
+                        relativeLayout {
+                            recyclerView {//待点价头部右侧数据
+                                val linearLayoutManager = LinearLayoutManager(context)
+                                linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
+                                layoutManager = linearLayoutManager
+                                background = resources.getDrawable(R.color.white)
+                                adapter = topAdapter
+                            }
+//                            viewModel.titleList.bindOptional(context) {
+//                                val titleStringList = arrayListOf<String>()
+//                                it?.subList(1, it.size)?.forEach { data ->
+//                                    titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
+//                                }
+//                                topAdapter.setDatas(titleStringList)
+//                            }
+                            topAdapter.setDatas(arrayListOf("卖价","卖量","买价","买量","最新价","涨跌","幅度","今开","昨收","最低","最高"))
+                        }
+                    }.lparams(matchParent, matchParent)
+                }.lparams(matchParent, autoSize(100))
+
+                statusLayout(contentBlock = {
+                    statusLayout = this
+                    setRetryAction {
+
+                    }
+//                bindTaskStatus(viewModule.status)
+                    swipeToLoadLayout {
+                        swipeToLayout = this
+                        setEnableRefresh(true)
+                        setEnableLoadMore(false)
+                        setOnRefreshListener {
+                            viewModel.queryQuoteDay(
+                                tag = thisTag ?: "",
+                                first = fistShow,
+                                last = lastShow,
+                                list = viewModel.transferDataList.value ?: arrayListOf()
+                            ) { isCompleted, err ->
+                                if (isCompleted) {
+                                    if (swipeToLayout.getIsRefreshing()) {
+                                        swipeToLayout.finishRefresh()
+                                    }
+                                    dataRecyclerview.adapter?.notifyItemRangeChanged(fistShow, lastShow)
+                                }
+                            }
+                        }
+                        setEnableScrollContentWhenLoaded(false)
+                        setEnableLoadMoreWhenContentNotFull(false)
+
+                        recyclerView {//待点价列表
+                            dataRecyclerview = this
+                            background = resources.getDrawable(R.color.white)
+                            adapter = transferAdapter
+                            addOnScrollListener(object : RecyclerView.OnScrollListener() {
+                                override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
+                                    super.onScrolled(recyclerView, dx, dy)
+                                    val viewHolderCacheList: List<TransferAdapter.ItemViewHolder> =
+                                        transferAdapter.viewHolderCacheList
+                                    if (null != viewHolderCacheList) {
+                                        val size = viewHolderCacheList.size
+                                        for (i in 0 until size) {
+                                            viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                                transferAdapter.getOffestX(),
+                                                0
+                                            )
+                                        }
+                                    }
+                                }
+                            })
+
+                            addOnScrollListener(object : RecyclerView.OnScrollListener() {
+                                override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
+                                    super.onScrollStateChanged(recyclerView, newState)
+                                    // DES: 找出当前可视Item位置
+                                    val linearLayoutManager = dataRecyclerview!!.layoutManager as LinearLayoutManager
+                                    if (newState == RecyclerView.SCROLL_STATE_IDLE) {// 这个判断是当recyclerview不滚动时
+                                        fistShow = linearLayoutManager.findFirstVisibleItemPosition()//获取第一个显示条目
+                                        lastShow = linearLayoutManager.findLastVisibleItemPosition()//获取最后一个显示条目
+                                        if (fistShow != -1 && lastShow != -1) {
+                                            viewModel.queryQuoteDay(
+                                                tag = thisTag ?: "",
+                                                first = fistShow,
+                                                last = lastShow,
+                                                list = viewModel.transferDataList.value ?: arrayListOf()
+                                            ) { isCompleted, err ->
+                                                if (isCompleted) {
+                                                    dataRecyclerview.adapter?.notifyItemRangeChanged(fistShow, lastShow)
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            })
+                        }
+
+
+                    }
+                }, emptyBlock = {
+                    emptyView(hint = resources.getString(R.string.now_no_data))
+                }).lparams(matchParent, matchParent)
+
+                viewModel.transferDataList.bindOptional(context) {
+                    if (it?.size ?: 0 > 10){
+                        lastShow = 10
+                    }else{
+                        lastShow = it?.size ?: 0
+                    }
+                    if (it?.isEmpty() == true || it?.size == 0) {
+                        statusLayout.showEmpty()
+                    } else {
+                        if (swipeToLayout.getIsRefreshing()) {
+                            swipeToLayout.finishRefresh()
+//                        mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
+                        }
+                        statusLayout.showSuccess()
+                        transferAdapter.setDatas(it)
+                    }
+                }
+            }
+        }.view
+    }
+
+    override fun onScroll(event: MotionEvent?) {
+        //处理单个item滚动时,顶部tab需要联动
+        if (null != horScrollview) horScrollview.onTouchEvent(event)
+    }
+
+}
+

+ 102 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/PurchaseOrderViewModel.kt

@@ -0,0 +1,102 @@
+package cn.muchinfo.rma.view.base.yrdzpurchase
+
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
+import cn.muchinfo.rma.global.database.DataBase
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.base.BaseViewModel
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+
+/**
+ * 云融-订单交易-挂牌转让viewmodel
+ */
+class PurchaseOrderViewModel : BaseViewModel(){
+
+    //挂牌转让数据列表
+    val transferDataList : MutableLiveData<List<GoodsInfo>> = MutableLiveData()
+
+    /**
+     * 初始化列表
+     * @param tag String
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun initData(tag: String,callback: (isCompleted: Boolean, err: Error?) -> Unit){
+        val list = arrayListOf<GoodsInfo>()
+        val allList = DataBase.getInstance().goodsInfoDao().all
+        val goodsExList = GlobalDataCollection.instance?.goodsExInfoDataArrayList
+        allList.forEach {data ->
+            if (data.trademode == 69 && data.goodsstatus == 3){
+                val goodsExData = goodsExList?.find { it?.goodsid == data.goodsid.toString() }
+                if (goodsExData?.goodsid.isNullOrEmpty().not()){
+                    list.add(data)
+                }
+            }
+        }
+        transferDataList.postValue(list)
+        if (list.size > 10){
+            queryQuoteDay(tag,0,10,list){isCompleted, err ->
+                callback(isCompleted, err)
+            }
+        }else{
+            queryQuoteDay(tag,0,list.size,list){isCompleted, err ->
+                callback(isCompleted, err)
+            }
+        }
+    }
+
+    /**
+     * 请求盘面信息
+     * @param first Int
+     * @param last Int
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryQuoteDay(
+        tag: String,
+        first: Int,
+        last: Int,
+        list : List<GoodsInfo> = arrayListOf(),
+        callback: (isCompleted: Boolean, err: Error?) -> Unit
+    ) {
+        val goodsCodes = getgoodsCodes(first, last,list)
+        val params = mutableMapOf<String, String>().apply {
+            put("goodsCodes", goodsCodes)
+        }
+        MyApplication.getInstance()?.futureManager?.queryQuoteDay(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                callback(true, null)
+            } else {
+                callback(false, error)
+            }
+        }
+
+        transferDataList.value?.subList(first, last)?.let { addSubscriptQuote(tag = tag, goodsInfoList = it) }
+    }
+
+    //获取本商品的盘面信息的同时,还要获取关联商品的盘面信息
+    fun getgoodsCodes(first: Int, last: Int,list : List<GoodsInfo>): String {
+        var goodsCodes = ""
+        val newList = list.subList(first, last)
+        newList.forEach {
+            goodsCodes = goodsCodes + it.goodscode + ","
+        }
+        return goodsCodes
+    }
+
+    /**
+     * 订阅行情
+     * @param tag String
+     * @param goodsInfoList List<GoodsInfo>
+     */
+    fun addSubscriptQuote(tag: String, goodsInfoList: List<GoodsInfo>) {
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.addSubscriptQuote(
+                tag = tag, goodsCodeSet = goodsInfoList.map { it.goodscode }.toSet()
+            ) { isCompleted, err ->
+
+            }
+        }
+    }
+
+}

+ 152 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/YrdzDdjyFragment.kt

@@ -0,0 +1,152 @@
+package cn.muchinfo.rma.view.base.yrdzpurchase
+
+import android.app.Dialog
+import android.os.Bundle
+import android.view.Gravity
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.annotation.NonNull
+import androidx.annotation.Nullable
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentPagerAdapter
+import androidx.viewpager.widget.ViewPager
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.tabSegment
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.future.deals.DealFragment
+import cn.muchinfo.rma.view.base.future.entrusts.EntrustFragment
+import cn.muchinfo.rma.view.base.future.holds.HoldFragment
+import com.blankj.utilcode.util.ConvertUtils
+import com.blankj.utilcode.util.LogUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import org.jetbrains.anko.*
+import org.jetbrains.anko.support.v4.UI
+import org.jetbrains.anko.support.v4.viewPager
+
+/**
+ * 云融大宗订单交易页面
+ */
+class YrdzDdjyFragment : BaseFragment<YrdzDdjyViewModel>() {
+
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //挂牌转让
+    private val purchaseOrderFragment by lazy {
+        PurchaseOrderFragment.getInstance()
+    }
+
+    //基差点价
+    private val basePriceFragment by lazy {
+        BasePriceFragment.getInstance()
+    }
+
+    //viewpager的适配器
+    private var newPagerAdapter: FragmentPagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray: ArrayList<String> = arrayListOf()
+
+    //viewpager绑定的页面集合
+    private val newTabFragment: ArrayList<Fragment> = arrayListOf()
+
+    fun initMenuData() {
+        newTabsArray.add("挂牌转让")
+        newTabFragment.add(purchaseOrderFragment)
+
+        newTabsArray.add("基差点价")
+        newTabFragment.add(basePriceFragment)
+
+        newPagerAdapter = object : FragmentPagerAdapter(
+            getAppCompatActivity().supportFragmentManager,
+            BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
+        ) {
+            @NonNull
+            override fun getItem(position: Int): Fragment {
+                return newTabFragment[position]
+            }
+
+            override fun getCount(): Int {
+                return newTabFragment.size
+            }
+
+            @Nullable
+            override fun getPageTitle(position: Int): CharSequence? {
+                return newTabsArray[position]
+            }
+        }
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        initMenuData()
+        return UI {
+            verticalLayout {
+                linearLayout {
+                    background = resources.getDrawable(R.color.main_title_bg_color)
+                    gravity = Gravity.CENTER
+
+                    textView {
+                        text = "订单交易"
+                        textColorInt = R.color.white
+                        textSizeAuto = 43
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(matchParent, autoSize(120))
+
+                tabSegment {
+                    // 设置
+                    segment = this
+                    background = resources.getDrawable(R.color.white)
+                    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
+                        }
+                    })
+                    setIndicator(
+                        QMUITabIndicator(
+                            QMUIDisplayHelper.dp2px(context, 2),
+                            false,
+                            true
+                        )
+                    )
+
+                    setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(19f))
+                }.lparams(matchParent, autoSize(80))
+
+                view {
+                    background = resources.getDrawable(R.color.main_hit_bg_color)
+                }.lparams(matchParent, autoSize(1)) {
+                    marginStart = autoSize(32)
+                    marginEnd = autoSize(32)
+                }
+                viewPager {
+                    id = R.id.view_pager
+                    background = resources.getDrawable(R.color.white)
+                    viewPager = this
+                    adapter = newPagerAdapter
+                }.lparams(matchParent, matchParent)
+                //真的是,不搞个id就不行
+//                findViewById<ViewPager>(R.id.view_pager).adapter = newPagerAdapter
+                segment.setupWithViewPager(viewPager)
+                segment.selectTab(0)
+            }
+        }.view
+    }
+
+}

+ 11 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/YrdzDdjyViewModel.kt

@@ -0,0 +1,11 @@
+package cn.muchinfo.rma.view.base.yrdzpurchase
+
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 云融大宗-订单交易viewmodel
+ */
+class YrdzDdjyViewModel : BaseViewModel(){
+
+
+}

+ 368 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/adapter/TransferAdapter.java

@@ -0,0 +1,368 @@
+package cn.muchinfo.rma.view.base.yrdzpurchase.adapter;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.Intent;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.blankj.utilcode.util.ActivityUtils;
+import com.blankj.utilcode.util.ToastUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cn.muchinfo.rma.R;
+import cn.muchinfo.rma.global.GlobalDataCollection;
+import cn.muchinfo.rma.global.data.ContractTradePositionData;
+import cn.muchinfo.rma.global.data.GoodsInfoAndQuotes;
+import cn.muchinfo.rma.global.data.QuoteDayData;
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo;
+import cn.muchinfo.rma.global.database.DataBase;
+import cn.muchinfo.rma.global.utils.TimeUtils;
+import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils;
+import cn.muchinfo.rma.view.base.chart.ChartActivity;
+import cn.muchinfo.rma.view.base.platinumtreasure.PlatinumTrasureDetailsActivity;
+import cn.muchinfo.rma.view.base.platinumtreasure.adapter.QHjRightData;
+import cn.muchinfo.rma.view.base.platinumtreasure.adapter.QhjRightScrollAdapter;
+import cn.muchinfo.rma.view.base.platinumtreasure.trade.PlatinumTradeActivity;
+
+/**
+ * 用于千海金铂金宝页面额adapter
+ */
+public class TransferAdapter extends RecyclerView.Adapter<TransferAdapter.ItemViewHolder> {
+
+
+    private Context context;
+    private List<GoodsInfo> datas;
+    private int index = -1;
+    private int position = -1;
+    private List<ItemViewHolder> mViewHolderList = new ArrayList<>();
+    public int offestX = 0;
+    private OnContentScrollListener onContentScrollListener;
+
+
+    public interface OnContentScrollListener {
+        void onScroll(MotionEvent event);
+    }
+
+    public void setOnContentScrollListener(OnContentScrollListener onContentScrollListener) {
+        this.onContentScrollListener = onContentScrollListener;
+    }
+
+    public TransferAdapter(Context context) {
+        this.context = context;
+    }
+
+    public void setDatas(List<GoodsInfo> datas) {
+        this.datas = datas;
+        notifyDataSetChanged();
+    }
+
+    private void setPosition(int position) {
+        if (this.position == position) {
+            this.position = -1;
+            notifyItemChanged(index);
+        } else {
+            this.position = position;
+            notifyItemChanged(position);
+        }
+    }
+
+    @NonNull
+    @Override
+    public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
+        View view = LayoutInflater.from(context).inflate(R.layout.layout_item_transfer_content, viewGroup, false);
+        return new ItemViewHolder(view);
+    }
+
+    //回购 买一价  销售 卖一价
+    @SuppressLint("SetTextI18n")
+    @Override
+    public void onBindViewHolder(@NonNull final ItemViewHolder itemViewHolder, int i) {
+        this.index = i;
+        GoodsInfo data = datas.get(i);
+        itemViewHolder.tvLeftTitle.setText(datas.get(i).getGoodsname());
+        //右边滑动部分
+        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
+        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
+        itemViewHolder.rvItemRight.setLayoutManager(linearLayoutManager);
+        itemViewHolder.rvItemRight.setHasFixedSize(true);
+        QhjRightScrollAdapter qhjRightScrollAdapter = new QhjRightScrollAdapter(context);
+        List<QHjRightData> rightData = new ArrayList<>();
+        //获取盘面信息
+        QuoteDayData quoteDayData = null;//当前商品的盘面信息(有用的只有买一卖一价即回购销售价,其他信息用关联商品的)
+
+        GoodsInfo relateGoodsInfo = null;//关联商品实体
+        relateGoodsInfo = DataBase.Companion.getInstance().goodsInfoDao().getGoodsInfo(data.getRelatedgoodsid());//获取关联商品的商品详情
+        List<GoodsInfoAndQuotes> quotesList = GlobalDataCollection.Companion.getInstance().getGoodsInfoAndQuotesList();//获取盘面信息列表
+        for (int j = 0;j < quotesList.size();j++){
+            if (data.getOutgoodscode().equals(quotesList.get(j).getOutgoodscode())){
+                quoteDayData = quotesList.get(j).getQuoteDayData();//赋值当前商品的盘面信息
+            }
+        }
+
+        if (quoteDayData != null){
+            QHjRightData bidData = new QHjRightData();
+            bidData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getBid())),2));//加入回购价买一价
+            bidData.setColorType("1");
+            rightData.add(bidData);
+
+            QHjRightData askData = new QHjRightData();
+            askData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getAsk())),2));//加入销售价卖一价
+            askData.setColorType("1");
+            rightData.add(askData);
+        }
+
+        if (quoteDayData != null){
+            //涨跌幅
+            QHjRightData appliesData = new QHjRightData();
+            //涨跌
+            QHjRightData riseFallData = new QHjRightData();
+            //今开
+            QHjRightData openRightData = new QHjRightData();
+            openRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getOpened())),2));
+            double openRightDatColor = quoteDayData.getOpened() - quoteDayData.getPreclose();
+            if (openRightDatColor > 0){
+                openRightData.setColorType("3");
+            }else if (openRightDatColor < 0){
+                openRightData.setColorType("2");
+            }else {
+                openRightData.setColorType("1");
+            }
+            //最高价
+            QHjRightData highRightData = new QHjRightData();
+            highRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getHighest())),2));
+            double highRightDatColor = quoteDayData.getHighest() - quoteDayData.getPreclose();
+            if (highRightDatColor > 0){
+                highRightData.setColorType("3");
+            }else if (highRightDatColor < 0){
+                highRightData.setColorType("2");
+            }else {
+                highRightData.setColorType("1");
+            }
+            highRightData.setColorType("1");
+            //最低价
+            QHjRightData lowestRightData = new QHjRightData();
+            lowestRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getLowest())),data.getDecimalplace()));
+            double lowestRightDatColor = quoteDayData.getLowest() - quoteDayData.getPreclose();
+            if (lowestRightDatColor > 0){
+                lowestRightData.setColorType("3");
+            }else if (lowestRightDatColor < 0){
+                lowestRightData.setColorType("2");
+            }else {
+                lowestRightData.setColorType("1");
+            }
+            lowestRightData.setColorType("1");
+            //昨收价
+            QHjRightData yesCloseRightData = new QHjRightData();
+            yesCloseRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getPreclose())),data.getDecimalplace()));
+            yesCloseRightData.setColorType("1");
+            //行情时间
+            QHjRightData timeRightData = new QHjRightData();
+            if (quoteDayData.getLasttime().isEmpty()){
+                timeRightData.setValue("--");
+            }else {
+                timeRightData.setValue(TimeUtils.formatTime2(quoteDayData.getLasttime(),"HH:mm:ss"));
+            }
+            timeRightData.setColorType("1");
+            if (quoteDayData.getLast() != 0 && quoteDayData.getPreclose() != 0) {
+                String textApplies = "";
+                String textUpDown = NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf((quoteDayData.getPrice() - quoteDayData.getPresettle()))),2);//涨跌
+                if (quoteDayData.getPresettle() == 0){
+                    textApplies = "--";
+                }else {
+                    textApplies = NumberUtils.roundNum(String.valueOf((((quoteDayData.getPrice() - quoteDayData.getPresettle()) / quoteDayData.getPresettle()) * 100)),2);//涨跌幅
+                }
+                riseFallData.setValue(textUpDown);
+                appliesData.setValue(textApplies + "%");
+                if (Double.valueOf(textUpDown) > 0){
+                    riseFallData.setColorType("3");
+                    appliesData.setColorType("3");
+                }else if (Double.valueOf(textUpDown) < 0){
+                    riseFallData.setColorType("2");
+                    appliesData.setColorType("2");
+                }else {
+                    riseFallData.setColorType("1");
+                    appliesData.setColorType("1");
+                }
+            } else {
+                appliesData.setValue("--");
+                appliesData.setColorType("1");
+                riseFallData.setValue("--");
+                riseFallData.setColorType("1");
+            }
+            rightData.add(appliesData);//涨跌幅
+            rightData.add(riseFallData);//涨跌
+            rightData.add(openRightData);//今开
+            rightData.add(highRightData);//最高
+            rightData.add(lowestRightData);//最低
+            rightData.add(yesCloseRightData);//昨收
+            rightData.add(timeRightData);//时间
+        }
+        ContractTradePositionData positionData = null;
+        List<ContractTradePositionData> positionDataList = GlobalDataCollection.Companion.getInstance().getContractTradePositionDataArrayList();
+        for (int j = 0;j < positionDataList.size();j++){
+            if (String.valueOf(data.getGoodsid()).equals(positionDataList.get(j).getGoodsid())){
+                positionData = positionDataList.get(j);
+            }
+        }
+
+        qhjRightScrollAdapter.setDatas(rightData);
+        itemViewHolder.rvItemRight.setAdapter(qhjRightScrollAdapter);
+        //缓存当前holder
+        if (!mViewHolderList.contains(itemViewHolder)) {
+            mViewHolderList.add(itemViewHolder);
+        }
+        if (i == this.position) {
+            itemViewHolder.roots_view.setBackgroundColor(context.getResources().getColor(R.color.qhj_click_bg));
+            itemViewHolder.allView.setVisibility(View.VISIBLE);
+        } else {
+            itemViewHolder.roots_view.setBackgroundColor(context.getResources().getColor(R.color.white));
+            itemViewHolder.allView.setVisibility(View.GONE);
+        }
+
+        itemViewHolder.all_click_View.setOnClickListener(view -> setPosition(i));
+        itemViewHolder.horItemScrollview.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                setPosition(i);
+            }
+        });
+        //买入点击
+        itemViewHolder.transfer_buy.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                Intent intent = new Intent();
+                intent.putExtra("goodsId",String.valueOf(data.getGoodsid()));
+                intent.putExtra("outGoodsCode",data.getGoodscode());
+                intent.putExtra("index",0);
+                intent.setClass(context, PlatinumTradeActivity.class);
+                ActivityUtils.startActivity(intent);
+            }
+        });
+        //图表点击
+        itemViewHolder.platnum_chart.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                GoodsInfo goodsInfo = DataBase.Companion.getInstance().goodsInfoDao().getGoodsInfo(data.getRelatedgoodsid());
+                Intent intent = new Intent();
+                intent.putExtra("outGoodsCode", goodsInfo.getOutgoodscode());
+                intent.putExtra("goodsCode", goodsInfo.getGoodscode());
+                intent.putExtra("goodsId", String.valueOf(goodsInfo.getGoodsid()));
+//                intent.putExtra("goodsGroupId", list?.get(position)?.goodsgroupid)
+                intent.putExtra("marketId", String.valueOf(goodsInfo.getMarketid()));
+                intent.setClass(context, ChartActivity.class);
+                ActivityUtils.startActivity(intent);
+            }
+        });
+        if (data.getPictureurl().isEmpty()){
+            itemViewHolder.platnum_details.setVisibility(View.GONE);
+        }
+        //详情点击
+        itemViewHolder.platnum_details.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                Intent intent = new Intent();
+                intent.putExtra("goodsname",data.getGoodsname());
+                intent.putExtra("imageString",data.getPictureurl());
+                intent.setClass(context, PlatinumTrasureDetailsActivity.class);
+                ActivityUtils.startActivity(intent);
+            }
+        });
+        itemViewHolder.rvItemRight.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                ToastUtils.showLong("ahhahahha");
+            }
+        });
+
+
+        itemViewHolder.horItemScrollview.setEventListener(new CustomHorizontalScrollView.EventListener() {
+            @Override
+            public void onEvent(MotionEvent ev) {
+
+                if (null != onContentScrollListener) onContentScrollListener.onScroll(ev);
+
+            }
+        });
+        //由于viewHolder的缓存,在1级缓存取出来是2个viewholder,并且不会被重新赋值,所以这里需要处理缓存的viewholder的位移
+        itemViewHolder.horItemScrollview.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+            @Override
+            public void onGlobalLayout() {
+                if (!itemViewHolder.isLayoutFinish()) {
+                    itemViewHolder.horItemScrollview.scrollTo(offestX, 0);
+                    itemViewHolder.setLayoutFinish(true);
+                }
+            }
+        });
+    }
+
+    float start, end;
+    float distance = 0;
+    boolean isclick = false;
+    boolean isFirst = false;
+
+    @Override
+    public int getItemCount() {
+        return null == datas ? 0 : datas.size();
+    }
+
+    public List<ItemViewHolder> getViewHolderCacheList() {
+        return mViewHolderList;
+    }
+
+    public int getOffestX() {
+        return offestX;
+    }
+
+    public static class ItemViewHolder extends RecyclerView.ViewHolder {
+        LinearLayout roots_view;//根部布局
+        TextView transfer_buy;//买卖大厅
+        TextView platnum_chart;//图表
+        TextView platnum_details;//详情
+        LinearLayout allView;//隐藏的底部操作空间
+        LinearLayout all_click_View;//item左侧点击控件
+        RelativeLayout item_onclick;
+        TextView tvLeftTitle;//左边销售方字段
+        RecyclerView rvItemRight;//右方的列表
+        ImageView click_icon;//图标
+        public CustomHorizontalScrollView horItemScrollview;//右方的滑动控件
+        private boolean isLayoutFinish;//自定义字段,用于标记layout
+
+        public boolean isLayoutFinish() {
+            return isLayoutFinish;
+        }
+
+        public void setLayoutFinish(boolean layoutFinish) {
+            isLayoutFinish = layoutFinish;
+        }
+
+        public ItemViewHolder(@NonNull View itemView) {
+            super(itemView);
+            item_onclick = itemView.findViewById(R.id.item_onclick);
+            click_icon = itemView.findViewById(R.id.click_icon);
+            transfer_buy = itemView.findViewById(R.id.transfer_buy);
+            platnum_chart = itemView.findViewById(R.id.platnum_chart);
+            platnum_details = itemView.findViewById(R.id.platnum_details);
+            tvLeftTitle = itemView.findViewById(R.id.tv_left_title);
+            rvItemRight = itemView.findViewById(R.id.rv_item_right);
+            horItemScrollview = itemView.findViewById(R.id.hor_item_scrollview);
+            allView = itemView.findViewById(R.id.all_view);
+            all_click_View = itemView.findViewById(R.id.all_click_View);
+            roots_view = itemView.findViewById(R.id.roots_view);
+        }
+    }
+}

+ 112 - 0
RMA/app/src/main/res/layout/layout_item_transfer_content.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:id="@+id/roots_view"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:id="@+id/all_click_View"
+        android:layout_width="match_parent"
+        android:orientation="horizontal"
+        android:layout_height="35dp">
+
+        <LinearLayout
+            android:layout_width="120dp"
+            android:orientation="horizontal"
+            android:layout_height="match_parent">
+            <LinearLayout
+                android:gravity="center_vertical"
+                android:orientation="vertical"
+                android:layout_width="90dp"
+                android:layout_height="match_parent">
+
+                <TextView
+                    android:layout_marginLeft="5dp"
+                    android:layout_gravity="center"
+                    android:layout_marginStart="7dp"
+                    android:id="@+id/tv_left_title"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="13sp"
+                    android:textColor="#333333" />
+
+            </LinearLayout>
+            <ImageView
+                android:id="@+id/click_icon"
+                android:layout_gravity="center_vertical"
+                android:layout_width="15dp"
+                android:layout_height="15dp"
+                android:src="@mipmap/rma_down"/>
+
+        </LinearLayout>
+
+        <cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView
+            android:id="@+id/hor_item_scrollview"
+            android:overScrollMode="never"
+            android:scrollbars="none"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+
+            <RelativeLayout
+                android:id="@+id/item_onclick"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
+
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/rv_item_right"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:overScrollMode="never"
+                    android:scrollbars="none">
+
+                </androidx.recyclerview.widget.RecyclerView>
+            </RelativeLayout>
+        </cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView>
+    </LinearLayout>
+
+    <LinearLayout
+        android:visibility="gone"
+        android:id="@+id/all_view"
+        android:layout_width="match_parent"
+        android:layout_height="40dp"
+        android:gravity="end|center_vertical"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/transfer_buy"
+            android:layout_marginEnd="10dp"
+            android:gravity="center"
+            android:textSize="12sp"
+            android:layout_width="70dp"
+            android:layout_height="25dp"
+            android:text="买卖大厅"
+            android:textColor="@color/rma_blue_color"
+            android:background="@drawable/rma_item_click_bg"/>
+
+        <TextView
+            android:id="@+id/platnum_chart"
+            android:layout_marginEnd="10dp"
+            android:gravity="center"
+            android:textSize="12sp"
+            android:layout_width="70dp"
+            android:layout_height="25dp"
+            android:text="图表"
+            android:textColor="@color/rma_blue_color"
+            android:background="@drawable/rma_item_click_bg"/>
+
+        <TextView
+            android:id="@+id/platnum_details"
+            android:layout_marginEnd="10dp"
+            android:gravity="center"
+            android:textSize="12sp"
+            android:layout_width="70dp"
+            android:layout_height="25dp"
+            android:text="详情"
+            android:textColor="@color/rma_blue_color"
+            android:background="@drawable/rma_item_click_bg"/>
+
+
+    </LinearLayout>
+
+</LinearLayout>

BIN
RMA/app/src/main/res/mipmap-xhdpi/yrdz_ddjy_normal.png


BIN
RMA/app/src/main/res/mipmap-xhdpi/yrdz_ddjy_select.png


BIN
RMA/app/src/main/res/mipmap-xhdpi/yrdz_reference_prices.png


+ 2 - 0
RMA/app/src/main/res/values/colors.xml

@@ -112,4 +112,6 @@
     <color name="sell_title_bg_color">#1DC089</color>
     <color name="buy_color_bg">#F5E0C7</color>
     <color name="buy_title_bg_color">#FC9618</color>
+    <color name="yrdz_red_color">#FF1414</color>
+    <color name="yrdz_delivery_title_bg_color">#DDF0FF</color>
 </resources>