Kaynağa Gözat

Merge branch 'master' of http://47.101.159.18:3000/Muchinfo/MTP2.0_RMA

Simon Zhou 3 yıl önce
ebeveyn
işleme
99b41c895a
24 değiştirilmiş dosya ile 939 ekleme ve 34 silme
  1. 4 0
      RMA/.idea/misc.xml
  2. 0 1
      RMA/app/build.gradle
  3. 4 0
      RMA/app/src/main/AndroidManifest.xml
  4. 27 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/WarehouseManager.kt
  5. 2 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/MTPEnums.java
  6. 5 9
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/AccountData.kt
  7. 163 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/WrPreSaleInfoData.kt
  8. 21 3
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/chart/ChartTSData.kt
  9. 23 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/MainActivity.kt
  10. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt
  11. 1 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/chart/old/timeCharts/TimeChartView.java
  12. 2 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/HnstMainFragment.kt
  13. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tjmd/TjmdHomeFragment.kt
  14. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/tjmd/TjmdHomeViewModel.kt
  15. 5 7
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpHomeFragment.kt
  16. 219 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpNewGoodsFragment.kt
  17. 59 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpNewGoodsViewModel.kt
  18. 217 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpPreSaleActivity.kt
  19. 49 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpPreSaleDetailActivity.kt
  20. 104 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/viewholder/XhcpNewGoodsViewHolder.kt
  21. 12 7
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/chart/YrdzChartActivity.kt
  22. 17 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/swaps/listed/SwapsListedActivity.kt
  23. BIN
      RMA/app/src/main/res/mipmap-xhdpi/qianggoumiaosha.png
  24. BIN
      RMA/app/src/main/res/mipmap-xhdpi/qingjiashenqing.png

+ 4 - 0
RMA/.idea/misc.xml

@@ -19,6 +19,10 @@
         <entry key="..\:/Repo/MyGogs/Muchinfo/MTP2.0_RMA/RMA/chart/src/main/res/drawable/load_corners_submit_p.xml" value="0.4083333333333333" />
         <entry key="..\:/Repo/MyGogs/Muchinfo/MTP2.0_RMA/RMA/chart/src/main/res/drawable/load_corners_submit_un.xml" value="0.4083333333333333" />
         <entry key="..\:/Repo/MyGogs/Muchinfo/MTP2.0_RMA/RMA/chart/src/main/res/layout/chart_attorn.xml" value="0.3921875" />
+        <entry key="app/src/main/res/drawable/rma_item_normal_bg.xml" value="0.3671875" />
+        <entry key="app/src/main/res/layout/activity_chart.xml" value="0.35104166666666664" />
+        <entry key="app/src/main/res/layout/chart_info_layout.xml" value="0.35104166666666664" />
+        <entry key="app/src/main/res/layout/item_fresco.xml" value="0.35104166666666664" />
       </map>
     </option>
   </component>

+ 0 - 1
RMA/app/build.gradle

@@ -130,7 +130,6 @@ android {
 }
 
 dependencies {
-
     implementation 'androidx.core:core-ktx:1.2.0'
     implementation 'androidx.appcompat:appcompat:1.1.0'
     implementation 'com.google.android.material:material:1.1.0'

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

@@ -523,6 +523,10 @@
 
         <activity android:name=".view.base.home.commodity.modify.AddMiddleGoodsNameActivity"/>
 
+        <activity android:name=".view.base.home.xhcp.XhcpPreSaleDetailActivity"/>
+
+        <activity android:name=".view.base.home.xhcp.XhcpPreSaleActivity"/>
+
     </application>
 
 </manifest>

+ 27 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/WarehouseManager.kt

@@ -1238,5 +1238,32 @@ class WarehouseManager {
         )
     }
 
+    /**
+     * 查询新品发布
+     * @param params Map<String, String>
+     * @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<BusinessData>?, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun queryWrPreSaleInfo(
+        params: Map<String, String>,
+        responseBack: (isSuccess: Boolean, respData: List<WrPreSaleInfoData>?, error: Error?) -> Unit
+    ) {
+        MyOkHttpUtils().query(
+            URL = SPUtils.getInstance()
+                .getString(Constant.goCommonSearchUrl) + "/WrTrade2/QueryWrPreSaleInfo",
+            params = params,
+            type = "1",
+            callback = object : ResponseCallback<BaseResult<List<WrPreSaleInfoData>>>() {
+                override fun onResponse(
+                    response: BaseResult<List<WrPreSaleInfoData>>?,
+                    id: Int
+                ) {
+                    responseBack(true, response?.data, null)
+                }
 
+                override fun onError(call: Call?, e: Exception?, id: Int) {
+                    responseBack(false, null, Error(e?.message))
+                }
+            }
+        )
+    }
 }

+ 2 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/MTPEnums.java

@@ -28,6 +28,8 @@ public class MTPEnums {
 
     public final static int TRADEMODE_TRADESTOCKS = 29;  //港股交易模式
 
+    public final static int TRADEMODE_CDYS = 47; // 廣陈优品-仓单预售 新品发售
+
     /**
      * 期权类型
      */

+ 5 - 9
RMA/app/src/main/java/cn/muchinfo/rma/global/data/AccountData.kt

@@ -239,21 +239,17 @@ open class AccountData(
                     } else {
                         if (it.averageprice == "" || it.averageprice == "0") {
                             Profit = 0.0
-                        } else {
+                        } else {// 买方向 = (最新价)*持仓数量*合约单位-持仓总金额*方向(买【1】:卖【-1】)
                             if (it.buyorsell == "1") { //卖方向
                                 Profit = NumberUtils.roundNum(
-                                    (quoteDayData.getPrice().minus(
-                                        it.averageprice?.toDouble() ?: 0.0
-                                    )).times(it.curpositionqty?.toDouble() ?: 0.0)
-                                        .times(goodsInfo2.agreeunit).times(-1).toString(),
+                                    (quoteDayData.getPrice()).times(it.curpositionqty?.toDouble() ?: 0.0)
+                                        .times(goodsInfo2.agreeunit).minus((it.curholderamount?.toDouble() ?: 0.0).times(-1)).toString(),
                                     2
                                 ).toDouble()
                             } else {
                                 Profit = NumberUtils.roundNum(
-                                    (quoteDayData.getPrice().minus(
-                                        it.averageprice?.toDouble() ?: 0.0
-                                    )).times(it.curpositionqty?.toDouble() ?: 0.0)
-                                        .times(goodsInfo2.agreeunit).toString(),
+                                    (quoteDayData.getPrice()).times(it.curpositionqty?.toDouble() ?: 0.0)
+                                        .times(goodsInfo2.agreeunit).minus(it.curholderamount?.toDouble() ?: 0.0).toString(),
                                     2
                                 ).toDouble()
                             }

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

@@ -0,0 +1,163 @@
+package cn.muchinfo.rma.global.data
+
+import android.os.Parcel
+import android.os.Parcelable
+import com.google.gson.annotations.SerializedName
+
+/**
+ * 新品发布
+ */
+data class WrPreSaleInfoData(
+    @SerializedName("presaleapplyid")
+    val presaleapplyid: String? = "",   // 预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)
+    @SerializedName("selluserid")
+    val selluserid: String? = "",    // 发行方用户ID
+    @SerializedName("sellaccountid")
+    val sellaccountid: String? = "",    // 发行方资金账户ID
+    @SerializedName("deliverygoodsid")
+    val deliverygoodsid: String? = "",    // 现货品种ID
+    @SerializedName("warehouseid")
+    val warehouseid: String? = "",    // 仓库ID
+    @SerializedName("wrstandardid")
+    val wrstandardid: String? = "",    // 现货商品ID
+    @SerializedName("wrfactortypeid")
+    val wrfactortypeid: String? = "",    // 仓单要素类型ID - 根据现货商品\仓库生成
+    @SerializedName("wrstandardname")
+    val wrstandardname: String? = "",    // 现货商品名称
+    @SerializedName("unitid")
+    val unitid: String? = "",    // 单位ID
+    @SerializedName("unitprice")
+    val unitprice: String? = "",    // 商品单价
+    @SerializedName("presaleqty")
+    val presaleqty: String? = "",    // 预售总量
+    @SerializedName("baseqty")
+    val baseqty: String? = "",    // 中签基数
+    @SerializedName("maxbuyqty")
+    val maxbuyqty: String? = "",    // 单人最大申购量
+    @SerializedName("maxluckyqty")
+    val maxluckyqty: String? = "",    // 单人最大中签量
+    @SerializedName("startdate")
+    val startdate: String? = "",    // 预售开始日期
+    @SerializedName("enddate")
+    val enddate: String? = "",    // 预售结束日期
+    @SerializedName("takestartdate")
+    val takestartdate: String? = "",    // 提货开始日期
+    @SerializedName("thumurls")
+    val thumurls: String? = "",    // 缩略图片(1:1)(逗号分隔)
+    @SerializedName("pictureurls")
+    val pictureurls: String? = "",    // 详情图片(逗号分隔)
+    @SerializedName("bannerpicurl")
+    val bannerpicurl: String? = "",    // Banner图
+    @SerializedName("presalestatus")
+    val presalestatus: String? = "",    // 预售状态 - 1:未开始 2:进行中 3:已结束 4:已关闭
+    @SerializedName("lotteryflag")
+    val lotteryflag: String? = "",    // 摇号标识 - 0:未摇号 1:已摇号
+    @SerializedName("lotteryqty")
+    val lotteryqty: String? = "",    // 摇号总量
+    @SerializedName("luckyqty")
+    val luckyqty: String? = "",    // 已中签量
+    @SerializedName("placeqty")
+    val placeqty: String? = "",    // 已配售量
+    @SerializedName("marketid")
+    val marketid: String? = "",    // 市场ID
+    @SerializedName("sellwrtradeorderid")
+    val sellwrtradeorderid: String? = "",    // 发行方卖委托单ID
+    @SerializedName("createtime")
+    val createtime: String? = "",    // 创建时间
+    @SerializedName("tradedate")
+    val tradedate: String? = "",    // 交易日
+    @SerializedName("warehousecode")
+    val warehousecode: String? = "",    // 仓库代码(仓库简称)
+    @SerializedName("warehousename")
+    val warehousename: String? = "",    // 仓库名称
+    @SerializedName("username")
+    val username: String? = "",    // 发行方用户名称
+    @SerializedName("enumdicname")
+    val enumdicname: String? = ""    // 单位名称
+) : Parcelable{
+    constructor(parcel: Parcel) : this(
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString()
+    ) {}
+
+    override fun writeToParcel(parcel: Parcel, flags: Int) {
+        parcel.writeString(presaleapplyid)
+        parcel.writeString(selluserid)
+        parcel.writeString(sellaccountid)
+        parcel.writeString(deliverygoodsid)
+        parcel.writeString(warehouseid)
+        parcel.writeString(wrstandardid)
+        parcel.writeString(wrfactortypeid)
+        parcel.writeString(wrstandardname)
+        parcel.writeString(unitid)
+        parcel.writeString(unitprice)
+        parcel.writeString(presaleqty)
+        parcel.writeString(baseqty)
+        parcel.writeString(maxbuyqty)
+        parcel.writeString(maxluckyqty)
+        parcel.writeString(startdate)
+        parcel.writeString(enddate)
+        parcel.writeString(takestartdate)
+        parcel.writeString(thumurls)
+        parcel.writeString(pictureurls)
+        parcel.writeString(bannerpicurl)
+        parcel.writeString(presalestatus)
+        parcel.writeString(lotteryflag)
+        parcel.writeString(lotteryqty)
+        parcel.writeString(luckyqty)
+        parcel.writeString(placeqty)
+        parcel.writeString(marketid)
+        parcel.writeString(sellwrtradeorderid)
+        parcel.writeString(createtime)
+        parcel.writeString(tradedate)
+        parcel.writeString(warehousecode)
+        parcel.writeString(warehousename)
+        parcel.writeString(username)
+        parcel.writeString(enumdicname)
+    }
+
+    override fun describeContents(): Int {
+        return 0
+    }
+
+    companion object CREATOR : Parcelable.Creator<WrPreSaleInfoData> {
+        override fun createFromParcel(parcel: Parcel): WrPreSaleInfoData {
+            return WrPreSaleInfoData(parcel)
+        }
+
+        override fun newArray(size: Int): Array<WrPreSaleInfoData?> {
+            return arrayOfNulls(size)
+        }
+    }
+}

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

@@ -29,7 +29,7 @@ data class ChartTSData(
         val historyHashMap = hashMapOf<String, Double>()
         if(historyDatas != null && historyDatas.isNotEmpty()){
             historyDatas.forEach {
-                historyHashMap[it.getTime().toShowTime2()] = it.c!!.toDouble()
+                historyHashMap[it.getTime().toShowTimeNoT()] = it.c!!.toDouble()
             }
         }
         return timeList.map{
@@ -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", Locale.CHINA)
+        val sdf1 = SimpleDateFormat(format, Locale.CHINA)
+        timeString = sdf1.format(sdf.parse(this.replace("T"," ").replace("+08:00", ""))!!)
+
+//        }
+        return timeString
+    }
+
     @SuppressLint("SimpleDateFormat")
     fun String.toLongFormatTime(): Long{
         return SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).parse(this, ParsePosition(0)).time
@@ -157,7 +175,7 @@ data class ChartTSData(
         if(historyDatas != null && historyDatas.isNotEmpty()){
             // 这里提前处理一下historyData 方便查询
             historyDatas.forEach {
-                historyMap[it.getTime().toShowTime2()] = it
+                historyMap[it.getTime().toShowTimeNoT()] = it
             }
             // 这里不能循环historyData了  需要循环已经生成的 x 轴点数据
             // 这里生成一个history列表  列表里一部分数据来自historyData  另一部分则是默认历史数据

+ 23 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/MainActivity.kt

@@ -10,6 +10,7 @@ import android.widget.Toast
 import androidx.fragment.app.Fragment
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.MTPEnums
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.easyNavigationBar
 import cn.muchinfo.rma.view.base.BaseActivity
@@ -21,6 +22,7 @@ import cn.muchinfo.rma.view.base.hnstmain.HnstMainFragment
 import cn.muchinfo.rma.view.base.home.NewHomeFragment
 import cn.muchinfo.rma.view.base.home.tjmd.TjmdHomeFragment
 import cn.muchinfo.rma.view.base.home.xhcp.XhcpHomeFragment
+import cn.muchinfo.rma.view.base.home.xhcp.XhcpNewGoodsFragment
 import cn.muchinfo.rma.view.base.home.yrdz.YrdzHomeFragment
 import cn.muchinfo.rma.view.base.main.SeaKingMainFragment
 import cn.muchinfo.rma.view.base.platinumtreasure.PlatinumTreasureFragment
@@ -133,6 +135,11 @@ class MainActivity : BaseActivity<MainViewModel>() {
         YrdzDdjyFragment()
     }
 
+    /** 新会陈皮 新品发售 **/
+    private val xhcpNewGoodsFragment by lazy {
+        XhcpNewGoodsFragment()
+    }
+
     /** 华南顺通 我的 **/
     var hnstMainFragment: HnstMainFragment? = null
 
@@ -279,7 +286,15 @@ class MainActivity : BaseActivity<MainViewModel>() {
         if (SPUtils.getInstance().getString(Constant.oem) == "xhcp"){
             val tjmdMarketList = GlobalDataCollection.instance?.getTjmdShowMarketSectionList()
             tjmdMarketList?.forEach {
-
+                it.mlist?.forEach { item ->
+                    if (item.trademode?.toInt() == MTPEnums.TRADEMODE_CDYS) {
+                        // 新品发售
+                        newFragments.add(xhcpNewGoodsFragment)
+                        newTabText.add(it.marketsectionname ?: "")
+                        newNormalIcon.add(R.mipmap.qhj_sphg_tab_normal)
+                        newSelectIcon.add(R.mipmap.qhj_sphg_tab_select)
+                    }
+                }
             }
         }
 
@@ -435,7 +450,13 @@ class MainActivity : BaseActivity<MainViewModel>() {
 //                            if (position == 0){
 //                                homeFragment.refrashAccount()
 //                            }
-
+                            // fix bug 错误 #3422  下单和平仓之后资金没有及时刷新
+                            // 每次点击我的按钮时 刷新账户信息
+                            // fixme 这里处理一下bug 通过position去判断当前是不是我的  如果增加新的tab 需要调整此处
+                            if(position == 4) {
+                                // 通知刷新资金账户信息
+                                viewModel.getTaAccounts()
+                            }
                             return false
                         }
 

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

@@ -7,7 +7,7 @@ object Constant {
      * 获取基础url的接口
      */
 //    const val baseurl = "http://103.40.249.123:38280/cfg?key=mtp_20" // 天津麦顿模拟盘
-    const val baseurl = "http://47.104.141.54:38280/cfg?key=mtp_20" // 天津麦顿实盘
+//    const val baseurl = "http://47.104.141.54:38280/cfg?key=mtp_20" // 天津麦顿实盘
 //    const val baseurl = "http://103.40.249.123:28280/cfg?key=mtp_20"//云融大宗
 //    const val baseurl = "http://103.40.249.123:8280/cfg?key=mtp_20"//千海金外盘
 //    const val baseurl = "http://103.40.249.127:28280/cfg?key=mtp_20"
@@ -41,7 +41,7 @@ object Constant {
 //    const val baseurl = "http://218.17.158.45:21001/cfg?key=test_139"// 邓工139外网环境 2100000003/123456
 //    const val baseurl = "http://192.168.31.176:8080/cfg?key=test_176" // 邓工 新会陈皮
 //    const val baseurl = "http://192.168.31.139:8080/cfg?key=test_139" // 麦顿
-//    const val baseurl = "http://218.17.158.45:15203/cfg?key=test_176" // 邓工 新会陈皮 176外网
+    const val baseurl = "http://192.168.31.176/cfg?key=test_176" // 邓工 新会陈皮 176外网
 
     /**
      * 用sp存储基础url的key

+ 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())

+ 2 - 2
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, _ ->
@@ -182,7 +182,7 @@ class TjmdHomeViewModel : BaseViewModel(){
                 wrAverageTradePriceMax = 0f
                 // 计算历史走势图Y轴最小值与最大值
                 respData?.forEach {
-                    val s = it.s?.toDouble() ?: 0.0
+                    val s = it.c?.toDouble() ?: 0.0
                     if (s < wrAverageTradePriceMin) wrAverageTradePriceMin = s.toFloat()
                     if (s > wrAverageTradePriceMax) wrAverageTradePriceMax = s.toFloat()
                 }

+ 5 - 7
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpHomeFragment.kt

@@ -266,6 +266,10 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
 
                             itemView()
 
+//                            view {
+//                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+//                            }.lparams(matchParent, autoSize(20))
+
                             // 推广图片
                             viewModel.imageList.bindOptional(context) {
                                 it?.forEachIndexed { index, bannerData ->
@@ -273,18 +277,12 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
                                         if (bannerData.imagepath != null && bannerData.imagepath.isNotEmpty()) {
                                             showImage(SPUtils.getInstance().getString(Constant.uploadUrl).replace("/upload","") + bannerData.imagepath.substring(1))
                                         }
-                                    }.lparams(autoSize(72), autoSize(72)) {
-                                        gravity = Gravity.CENTER_HORIZONTAL
-                                    }
+                                    }.lparams(autoSize(360), autoSize(260))
                                 }
                             }
 
                             itemView()
 
-                            view {
-                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
-                            }.lparams(matchParent, autoSize(20))
-
                             tabSegment {
                                 segment = this
 

+ 219 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpNewGoodsFragment.kt

@@ -0,0 +1,219 @@
+package cn.muchinfo.rma.view.base.home.xhcp
+
+import android.content.Intent
+import android.net.Uri
+import android.os.Bundle
+import android.view.Gravity
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.LinearLayout
+import android.widget.TextView
+import androidx.cardview.widget.CardView
+import androidx.lifecycle.MutableLiveData
+import androidx.recyclerview.widget.StaggeredGridLayoutManager
+import cn.bingoogolapple.bgabanner.BGABanner
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.BannerData
+import cn.muchinfo.rma.global.data.SiteColumnDetailData
+import cn.muchinfo.rma.global.data.WrPreSaleInfoData
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.WebActivity
+import cn.muchinfo.rma.view.base.app.Constant
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.tjmd.TjmdHomeSonViewHolder
+import cn.muchinfo.rma.view.base.home.xhcp.viewholder.XhcpNewGoodsViewHolder
+import com.blankj.utilcode.util.ActivityUtils
+import com.blankj.utilcode.util.SPUtils
+import com.facebook.drawee.view.SimpleDraweeView
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import org.jetbrains.anko.*
+import org.jetbrains.anko.support.v4.UI
+
+/**
+ * 新会陈皮 新品发售
+ */
+class XhcpNewGoodsFragment: BaseFragment<XhcpNewGoodsViewModel>() {
+    companion object {
+        fun newInstance() = XhcpNewGoodsFragment()
+    }
+
+    // 下拉刷新
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    // 新品发售抢购中和发售历史列表 adapter
+    private val newGoodsAdapter: BaseAdapter<WrPreSaleInfoData, XhcpNewGoodsViewHolder> =
+        BaseAdapter { _, _ ->
+            XhcpNewGoodsViewHolder(
+                this.getAppCompatActivity(),
+                viewModel
+            )
+        }
+    private val newGoodsHistoryAdapter: BaseAdapter<WrPreSaleInfoData, XhcpNewGoodsViewHolder> =
+        BaseAdapter { _, _ ->
+            XhcpNewGoodsViewHolder(
+                this.getAppCompatActivity(),
+                viewModel
+            )
+        }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View {
+        return UI {
+            // 查询新品发售信息
+            viewModel.queryWrPreSaleInfo()
+
+            verticalLayout {
+                // 标题栏
+                linearLayout {
+                    background = resources.getDrawable(R.color.main_title_bg_color)
+                    verticalLayout {
+                        gravity = Gravity.CENTER
+                        textView {
+                            text = "新品发售"
+                            textColorInt = R.color.white
+                            textSizeAuto = 36
+                        }.lparams(wrapContent, wrapContent) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                        }
+                    }.lparams(autoSize(620), autoSize(90)) {
+                        marginStart = autoSize(140)
+                    }
+                }.lparams(matchParent, autoSize(120))
+
+                background = resources.getDrawable(R.color.white)
+                // 新品发布信息-未开始
+                inflateLayout<BGABanner>(R.layout.banner) {
+                    viewModel.wrPreSaleInfoNotStartedList.bindOptional(context) {
+                        setData(
+                            R.layout.item_fresco,
+                            it,
+                            null
+                        )
+                    }
+                    setDelegate { _, _, model, _ ->
+                        val data = model as BannerData
+                        val intent = Intent()
+                        intent.putExtra("url",data.url)
+                        intent.putExtra("title",data.title)
+                        intent.setClass(context, WebActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+
+                    setAdapter(object : BGABanner.Adapter<CardView, WrPreSaleInfoData> {
+                        override fun fillBannerItem(
+                            banner: BGABanner?,
+                            itemView: CardView?,
+                            model: WrPreSaleInfoData?,
+                            position: Int
+                        ) {
+                            val simpleDraweeView: SimpleDraweeView =
+                                itemView!!.findViewById(R.id.sdv_item_fresco_content)
+                            simpleDraweeView.setImageURI(
+                                Uri.parse(if (SPUtils.getInstance().getString(Constant.uploadUrl).contains("upload")){
+                                    SPUtils.getInstance().getString(Constant.uploadUrl).replace("/upload","") + model?.bannerpicurl?.substring(1)
+                                }else{
+                                    SPUtils.getInstance().getString(Constant.uploadUrl) + model?.bannerpicurl?.substring(1)
+                                }))
+                        }
+                    })
+                }.lparams(matchParent, autoSize(400))
+
+                // 页面内容
+                statusLayout(contentBlock = {
+                    statusLayout = this
+                    setRetryAction {
+
+                    }
+                    swipeToLoadLayout {
+                        swipeToLayout = this
+                        setEnableRefresh(true)
+                        setEnableLoadMore(false)
+                        setOnRefreshListener {
+
+                        }
+                        setEnableScrollContentWhenLoaded(false)
+                        setEnableLoadMoreWhenContentNotFull(false)
+
+                        relativeLayout {
+                            background = resources.getDrawable(R.color.white, null)
+                            nestedScrollView {
+                                verticalLayout {
+                                    // 正在抢购
+                                    linearLayout {
+                                        imageView {
+                                            imageResource = R.mipmap.qianggoumiaosha
+                                        }.lparams(wrapContent, wrapContent) {
+                                            leftMargin = autoSize(15)
+                                        }
+
+                                        textView {
+                                            text = "正在抢购"
+                                            textColorInt = R.color.black
+                                        }.lparams(wrapContent, wrapContent) {
+                                            marginStart = autoSize(10)
+                                        }
+                                    }.lparams(matchParent, wrapContent) {
+                                        topMargin = autoSize(10)
+                                    }
+                                    recyclerView {
+                                        background = resources.getDrawable(R.color.white, null)
+                                        val staggeredGridLayoutManager = StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
+                                        layoutManager = staggeredGridLayoutManager
+                                        adapter = newGoodsAdapter
+                                    }.lparams(matchParent, wrapContent) {
+                                        topMargin = autoSize(10)
+                                    }
+                                    viewModel.wrPreSaleInfoList.bindOptional(context){
+                                        newGoodsAdapter.setNewData(it)
+                                    }
+
+                                    // 发售历史
+                                    linearLayout {
+                                        imageView {
+                                            imageResource = R.mipmap.qingjiashenqing
+                                        }.lparams(wrapContent, wrapContent) {
+                                            leftMargin = autoSize(15)
+                                        }
+
+                                        textView {
+                                            text = "发售历史"
+                                            textColorInt = R.color.black
+                                        }.lparams(wrapContent, wrapContent) {
+                                            marginStart = autoSize(10)
+                                        }
+                                    }.lparams(matchParent, wrapContent) {
+                                        topMargin = autoSize(10)
+                                    }
+                                    recyclerView {
+                                        background = resources.getDrawable(R.color.white, null)
+                                        val staggeredGridLayoutManager = StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
+                                        layoutManager = staggeredGridLayoutManager
+                                        adapter = newGoodsHistoryAdapter
+                                    }.lparams(matchParent, wrapContent) {
+                                        topMargin = autoSize(10)
+                                    }
+                                    viewModel.wrPreSaleInfoHistoryList.bindOptional(context){
+                                        newGoodsHistoryAdapter.setNewData(it)
+                                    }
+                                }
+                            }.lparams(matchParent, matchParent)
+                        }
+                    }
+                }, emptyBlock = {
+                    emptyView(hint = resources.getString(R.string.now_no_data))
+                }).lparams(matchParent, matchParent)
+            }
+        }.view
+    }
+}

+ 59 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpNewGoodsViewModel.kt

@@ -0,0 +1,59 @@
+package cn.muchinfo.rma.view.base.home.xhcp
+
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.MTPEnums
+import cn.muchinfo.rma.global.data.WrPreSaleInfoData
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+class XhcpNewGoodsViewModel: BaseViewModel() {
+
+    /**
+     * 新品发布信息-未开始
+     */
+    val wrPreSaleInfoNotStartedList: MutableLiveData<List<WrPreSaleInfoData>> = MutableLiveData()
+
+    /**
+     * 新品发布信息-抢购中
+     */
+    val wrPreSaleInfoList: MutableLiveData<List<WrPreSaleInfoData>> = MutableLiveData()
+
+    /**
+     * 新品发布信息-发售历史
+     */
+    val wrPreSaleInfoHistoryList: MutableLiveData<List<WrPreSaleInfoData>> = MutableLiveData()
+
+    /**
+     * 查询新品发布
+     */
+    fun queryWrPreSaleInfo(){
+        val params = mutableMapOf<String,String>().apply {
+            // 新品发售市场ID
+            put("marketid", GlobalDataCollection.instance?.getMaketidByTrademode(MTPEnums.TRADEMODE_CDYS).toString())
+            put("presalestatus", "1,2,3,4")
+        }
+        MyApplication.getInstance()?.warehouseManager?.queryWrPreSaleInfo(params = params){ isSuccess, respData, error ->
+            if (isSuccess){
+                // 未开始
+                val notStartedList = ArrayList<WrPreSaleInfoData>()
+                // 抢购中
+                val list = ArrayList<WrPreSaleInfoData>()
+                // 发售历史
+                val historyList = ArrayList<WrPreSaleInfoData>()
+                respData?.forEach {
+                    if (it.presalestatus == "1") {
+                        notStartedList.add(it)
+                    } else if (it.presalestatus == "2") {
+                        list.add(it)
+                    } else if (it.presalestatus?.toInt() ?: 0 > 2) {
+                        historyList.add(it)
+                    }
+                }
+                wrPreSaleInfoNotStartedList.postValue(notStartedList)
+                wrPreSaleInfoList.postValue(list)
+                wrPreSaleInfoHistoryList.postValue(historyList)
+            }
+        }
+    }
+}

+ 217 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpPreSaleActivity.kt

@@ -0,0 +1,217 @@
+package cn.muchinfo.rma.view.base.home.xhcp
+
+import android.annotation.SuppressLint
+import android.os.Bundle
+import android.view.Gravity
+import android.widget.ImageView
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.WrPreSaleInfoData
+import cn.muchinfo.rma.global.toShowTime
+import cn.muchinfo.rma.global.toShowTime3
+import cn.muchinfo.rma.global.toTimeData
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.BaseViewModel
+import cn.muchinfo.rma.view.base.app.Constant
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.SPUtils
+import org.jetbrains.anko.*
+
+/**
+ * 新品发售商品详情(抢购中)
+ * @property data WrPreSaleInfoData
+ */
+class XhcpPreSaleActivity: BaseActivity<BaseViewModel>() {
+    private val data by lazy {
+        intent.getParcelableExtra<WrPreSaleInfoData>("data") as WrPreSaleInfoData
+    }
+
+    @SuppressLint("RtlHardcoded")
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+
+        verticalLayout {
+            topBar {
+                // 返回
+                commonLeftButton()
+                commonTitle {
+                    text = "商品详情"
+                }
+            }
+
+            scrollView {
+                verticalLayout {
+                    // ********** 商品信息 **********
+                    // 商品banner
+                    imageView {
+                        showImage(SPUtils.getInstance().getString(Constant.uploadUrl).
+                                            replace("/upload","") +
+                                            data.bannerpicurl?.substring(1))
+                    }.lparams(matchParent, autoSize(400))
+
+                    // 商品名称
+                    textView {
+                        textColorInt = R.color.rma_black_33
+                        textSizeAuto = 40
+                        text = data.wrstandardname
+                    }.lparams(wrapContent, wrapContent) {
+                        leftMargin = autoSize(20)
+                        topMargin = autoSize(10)
+                    }
+
+                    linearLayout {
+                        linearLayout {
+                            textView {
+                                textColorInt = R.color.rma_zhushi_text_color
+                                textSizeAuto = 31
+                                text = "发行价"
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                            textView {
+                                textColorInt = R.color.rma_black_33
+                                textSizeAuto = 31
+                                text = data.unitprice
+                                gravity = Gravity.RIGHT
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                        }.lparams(matchParent, wrapContent, 1F) {
+                            topMargin = autoSize(10)
+                            leftMargin = autoSize(20)
+                            rightMargin = autoSize(30)
+                        }
+                        linearLayout {
+                            textView {
+                                textColorInt = R.color.rma_zhushi_text_color
+                                textSizeAuto = 31
+                                text = "发行总量"
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                            textView {
+                                textColorInt = R.color.rma_black_33
+                                textSizeAuto = 31
+                                text = data.presaleqty
+                                gravity = Gravity.RIGHT
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                        }.lparams(matchParent, wrapContent, 1F) {
+                            topMargin = autoSize(10)
+                            leftMargin = autoSize(30)
+                            rightMargin = autoSize(20)
+                        }
+                    }
+                    linearLayout {
+                        linearLayout {
+                            textView {
+                                textColorInt = R.color.rma_zhushi_text_color
+                                textSizeAuto = 31
+                                text = "开始时间"
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                            textView {
+                                textColorInt = R.color.rma_black_33
+                                textSizeAuto = 31
+                                text = data.startdate?.toShowTime3() ?: "--"
+                                gravity = Gravity.RIGHT
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                        }.lparams(matchParent, wrapContent, 1F) {
+                            topMargin = autoSize(10)
+                            leftMargin = autoSize(20)
+                            rightMargin = autoSize(30)
+                        }
+                        linearLayout {
+                            textView {
+                                textColorInt = R.color.rma_zhushi_text_color
+                                textSizeAuto = 31
+                                text = "结束时间"
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                            textView {
+                                textColorInt = R.color.rma_black_33
+                                textSizeAuto = 31
+                                text = data.enddate?.toShowTime3() ?: "--"
+                                gravity = Gravity.RIGHT
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                        }.lparams(matchParent, wrapContent, 1F) {
+                            topMargin = autoSize(10)
+                            leftMargin = autoSize(30)
+                            rightMargin = autoSize(20)
+                        }
+                    }
+                    linearLayout {
+                        linearLayout {
+                            textView {
+                                textColorInt = R.color.rma_zhushi_text_color
+                                textSizeAuto = 31
+                                text = "仓库"
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                            textView {
+                                textColorInt = R.color.rma_black_33
+                                textSizeAuto = 31
+                                text = data.warehousename
+                                gravity = Gravity.RIGHT
+                            }.lparams(autoSize(0), wrapContent, 1F)
+                        }.lparams(matchParent, wrapContent, 1F) {
+                            topMargin = autoSize(10)
+                            leftMargin = autoSize(20)
+                            rightMargin = autoSize(30)
+                        }
+                        linearLayout {
+
+                        }.lparams(matchParent, wrapContent, 1F) {
+                            topMargin = autoSize(10)
+                            leftMargin = autoSize(30)
+                            rightMargin = autoSize(20)
+                        }
+                    }
+
+                    view { }.lparams(0, autoSize(10), 1f)
+                    itemView()
+
+                    // ********** 交互相关 **********
+                    relativeLayout {
+                        button {
+                            gravity = Gravity.CENTER
+                            text = "我要认购"
+                            textSizeAuto = 36
+                            textColorInt = R.color.white
+                            backgroundDrawable =
+                                createRoundRectDrawable("#2794FF", 10)
+                        }.lparams(autoSize(320), autoSize(100)) {
+                            gravity = Gravity.CENTER
+                        }
+                    }.lparams(matchParent, autoSize(200))
+
+                    // ********** 商品详情 **********
+                    linearLayout {
+                        view {
+                            background = resources.getDrawable(R.color.pickerview_bgColor_overlay, null)
+                        }.lparams(autoSize(0), autoSize(1), 1F) {
+                            gravity = Gravity.CENTER
+                            leftMargin = autoSize(100)
+                        }
+                        textView {
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 31
+                            text = "商品详情"
+                            gravity = Gravity.CENTER
+                        }.lparams(autoSize(200), wrapContent, 1F) {
+                            gravity = Gravity.CENTER
+                        }
+                        view {
+                            background = resources.getDrawable(R.color.pickerview_bgColor_overlay, null)
+                        }.lparams(autoSize(0), autoSize(1), 1F) {
+                            gravity = Gravity.CENTER
+                            rightMargin = autoSize(100)
+                        }
+                    }.lparams(matchParent, autoSize(40))
+                    scrollView {
+                        imageView {
+                            showImage(SPUtils.getInstance().getString(Constant.uploadUrl).
+                                                replace("/upload","") +
+                                                data.pictureurls?.substring(1))
+                            scaleType = ImageView.ScaleType.FIT_XY
+                            adjustViewBounds = true
+                        }.lparams(matchParent, wrapContent) {
+                            topMargin = autoSize(15)
+                        }
+                    }
+                }
+            }
+        }
+    }
+}

+ 49 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpPreSaleDetailActivity.kt

@@ -0,0 +1,49 @@
+package cn.muchinfo.rma.view.base.home.xhcp
+
+import android.os.Bundle
+import android.view.ViewGroup
+import android.widget.FrameLayout
+import android.widget.ImageView
+import cn.muchinfo.rma.global.data.WrPreSaleInfoData
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.BaseViewModel
+import cn.muchinfo.rma.view.base.app.Constant
+import com.blankj.utilcode.util.SPUtils
+import org.jetbrains.anko.*
+
+/**
+ * 新品发售商品详情(未开始、发售历史)
+ * @property data WrPreSaleInfoData
+ */
+class XhcpPreSaleDetailActivity: BaseActivity<BaseViewModel>() {
+
+    private val data by lazy {
+        intent.getParcelableExtra<WrPreSaleInfoData>("data") as WrPreSaleInfoData
+    }
+
+    lateinit var iv: ImageView
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+
+        verticalLayout {
+            topBar {
+                // 返回
+                commonLeftButton()
+                commonTitle {
+                    text = "商品详情"
+                }
+            }
+
+            scrollView {
+                imageView {
+                    iv = this
+                    showImage(SPUtils.getInstance().getString(Constant.uploadUrl).replace("/upload","") + data.pictureurls?.substring(1))
+                    scaleType = ImageView.ScaleType.FIT_XY
+                    adjustViewBounds = true
+                }.lparams(matchParent, wrapContent)
+            }
+        }
+    }
+}

+ 104 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/viewholder/XhcpNewGoodsViewHolder.kt

@@ -0,0 +1,104 @@
+package cn.muchinfo.rma.view.base.home.xhcp.viewholder
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.content.Intent
+import android.view.WindowManager
+import androidx.appcompat.app.AppCompatActivity
+import androidx.recyclerview.widget.RecyclerView
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.WrPreSaleInfoData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.app.Constant
+import cn.muchinfo.rma.view.base.home.xhcp.XhcpNewGoodsViewModel
+import cn.muchinfo.rma.view.base.home.xhcp.XhcpPreSaleActivity
+import cn.muchinfo.rma.view.base.home.xhcp.XhcpPreSaleDetailActivity
+import com.afollestad.materialdialogs.utils.MDUtil.getWidthAndHeight
+import com.blankj.utilcode.util.ActivityUtils
+import com.blankj.utilcode.util.SPUtils
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 新品发售ViewHolder
+ * @property activity AppCompatActivity
+ * @property viewModel XhcpNewGoodsViewModel
+ * @property itemSize IntArray
+ * @property recyclview RecyclerView
+ * @constructor
+ */
+class XhcpNewGoodsViewHolder(private val activity : AppCompatActivity, private val viewModel: XhcpNewGoodsViewModel): BaseViewHolder<WrPreSaleInfoData>(activity) {
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    lateinit var recyclview : RecyclerView
+
+    @SuppressLint("SetTextI18n")
+    override fun _FrameLayout.createContentView() {
+        // 屏幕大小
+        val size = (context.getSystemService(Context.WINDOW_SERVICE) as WindowManager).getWidthAndHeight()
+        val imageWidth = size.first/2 - 20
+
+        verticalLayout {
+            background = resources.getDrawable(R.color.segtabment_bg_color, null)
+
+            onThrottleFirstClick {
+                val intent = Intent()
+                intent.putExtra("data",data.value)
+                if (data.value?.presalestatus == "2") {
+                    // 抢购中
+                    intent.setClass(context, XhcpPreSaleActivity::class.java)
+                } else {
+                    // 未发售、发售历史
+                    intent.setClass(context, XhcpPreSaleDetailActivity::class.java)
+                }
+
+                ActivityUtils.startActivity(intent)
+            }
+
+            // 商品图片
+            imageView {
+                data.bindOptional(context) {
+                    showImage(SPUtils.getInstance().getString(Constant.uploadUrl).replace("/upload","") + it?.thumurls?.substring(1))
+                }
+            }.lparams(autoSize(imageWidth), autoSize(450)) {
+                leftMargin = autoSize(15)
+            }
+
+            // 商品名称
+            textView {
+                data.bindOptional(context) {
+                    text = it?.wrstandardname
+                }
+                textSizeAuto = 32
+                textColorInt = R.color.black
+            }.lparams(matchParent, wrapContent) {
+                topMargin = autoSize(10)
+                leftMargin = autoSize(20)
+            }
+
+            // 卖价
+            linearLayout {
+                textView {
+                    background = resources.getDrawable(R.color.qmui_config_color_50_blue, null)
+                    text = "卖价"
+                    textSizeAuto = 32
+                    textColorInt = R.color.white
+                }.lparams(wrapContent, wrapContent)
+                textView {
+                    data.bindOptional(context) {
+                        text = "¥ " + it?.unitprice
+                    }
+                    textSizeAuto = 32
+                    textColorInt = R.color.qmui_config_color_red
+                }.lparams(wrapContent, wrapContent) {
+                    leftMargin = autoSize(20)
+                }
+            }.lparams(matchParent, wrapContent) {
+                topMargin = autoSize(10)
+                leftMargin = autoSize(20)
+                bottomMargin = autoSize(20)
+            }
+        }.lparams(matchParent, wrapContent)
+    }
+}

+ 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)

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


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