Parcourir la source

风险管理6月13日提交代码-liu.bolan-企业风管-期货报表明细

Liu.bolan il y a 4 ans
Parent
commit
a07ea63cf4

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

@@ -48,7 +48,8 @@ data class FutureDataReportData(
     val todaymiddlegoodsqty : String? = "",//套保品种变化量 (= 交易品种变化量*期货品种折算系数)
     val todayopenamount : String? = "",//今开仓额
     val todayopenqty : String? = "",//今开仓量
-    val userid : String? = ""//账户所属用户ID
+    val userid : String? = "",//账户所属用户ID
+    var rightData : List<String?>? = arrayListOf()//组装的右侧数据
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
         parcel.readString(),
@@ -92,7 +93,8 @@ data class FutureDataReportData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
-        parcel.readString()
+        parcel.readString(),
+        parcel.createStringArrayList()
     ) {
     }
 
@@ -139,6 +141,7 @@ data class FutureDataReportData(
         parcel.writeString(todayopenamount)
         parcel.writeString(todayopenqty)
         parcel.writeString(userid)
+        parcel.writeStringList(rightData)
     }
 
     override fun describeContents(): Int {

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

@@ -10,12 +10,12 @@ object Constant {
 //    const val baseurl = "http://192.168.30.125:8080/cfg?key=test_125"
 //    const val baseurl = "http://192.168.31.114:8080/cfg?key=test_114" // shenzhen01  123123
 //    const val baseurl = "http://192.168.31.220:8080/cfg?key=test_220"//李倩
-//      const val baseurl = "http://192.168.30.211:8080/cfg?key=test_211"// 瑶姐
+      const val baseurl = "http://192.168.30.211:8080/cfg?key=test_211"// 瑶姐
 //    const val baseurl = "http://192.168.31.175:8080/cfg?key=test_175" // 8888  123123
 //    const val baseurl = "http://192.168.31.223:8080/cfg?key=test_223"
 //    const val baseurl = "http://192.168.31.174:8080/cfg?key=test_174"// 邓工
 
-     const val baseurl = "http://192.168.31.176:8080/cfg?key=test_176" // 9999  123123  黄老板千海金
+//     const val baseurl = "http://192.168.31.176:8080/cfg?key=test_176" // 9999  123123  黄老板千海金
 
     /**
      * 用sp存储基础url的key
@@ -212,6 +212,22 @@ object Constant {
     /** 报表-库存报表-(仓库维度)_周月报表明细 **/
     const val table_mobile_report_warehousestock_weekmonthdetail = "table_mobile_report_warehousestock_weekmonthdetail"
 
+    //-----------------------------------------期货报表----------------------------
+    /** 敞口-期货变动量明细——日报表 ***/
+    const val table_mobile_report_expose_futures_day = "table_mobile_report_expose_futures_day"
+
+    /** 敞口-期货变动量明细-月周报表 **/
+    const val table_mobile_report_expose_futures_weekmonth = "table_mobile_report_expose_futures_weekmonth"
+
+    /** 期货报表 **/
+    const val table_mobile_report_futures = "table_mobile_report_futures"
+
+    /** 报表-期货报表_账户明细-日报表- **/
+    const val table_mobile_report_futures_daydetail = "table_mobile_report_futures_daydetail"
+
+    /** 报表-期货报表_账户明细-周月报表 **/
+    const val table_mobile_report_futures_weekmonthdetail = "table_mobile_report_futures_weekmonthdetail"
+
     /**--------------------------------------------------------------------------------------**/
 
     const val FISTOPENAPP = "first_open_app"
@@ -247,5 +263,5 @@ object Constant {
     const val SUCCESS_ADD_CUSTOMER = "SUCCESS_ADD_CUSTOMER"
 
     //是否是千海金
-    const val IS_QHJ = true
+    const val IS_QHJ = false
 }

+ 4 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/InventoryRecordAdapter.java

@@ -30,6 +30,7 @@ import cn.muchinfo.rma.global.data.AreaStockReportData;
 import cn.muchinfo.rma.global.data.AreaSumPLData;
 import cn.muchinfo.rma.global.data.ExposureReportData;
 import cn.muchinfo.rma.global.data.FinanceReportData;
+import cn.muchinfo.rma.global.data.FutureDataReportData;
 import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
 import cn.muchinfo.rma.view.base.app.Constant;
 import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.InventoryDetailsActivity;
@@ -158,8 +159,6 @@ public class InventoryRecordAdapter extends RecyclerView.Adapter<InventoryRecord
             }else {
                 itemViewHolder.place_the_order.setVisibility(View.GONE);
             }
-            itemViewHolder.futures_subsidiary.setVisibility(View.VISIBLE);
-            itemViewHolder.place_the_order.setVisibility(View.VISIBLE);
         } else {
             if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_report","client_report_warehousestock","client_report_warehousestock_stock")){//库存明细
                 itemViewHolder.inventory_details.setVisibility(View.VISIBLE);
@@ -187,6 +186,7 @@ public class InventoryRecordAdapter extends RecyclerView.Adapter<InventoryRecord
                 intent.putExtra("tabtitle", Constant.table_mobile_report_warehousestock_weekmonthdetail);
                 intent.putExtra("time", data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaStockReportData", data);
             intent.putExtra("AreaSumPLData", new AreaSumPLData());
             intent.putExtra("AreaSpotplReportData", new AreaSpotplReportData());
@@ -209,6 +209,7 @@ public class InventoryRecordAdapter extends RecyclerView.Adapter<InventoryRecord
                 intent.putExtra("tabtitle", Constant.table_mobile_report_wrstandstock_warehouse_weekmonthdetail);
                 intent.putExtra("time", data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaStockReportData", data);
             intent.putExtra("AreaSumPLData", new AreaSumPLData());
             intent.putExtra("AreaSpotplReportData", new AreaSpotplReportData());
@@ -231,6 +232,7 @@ public class InventoryRecordAdapter extends RecyclerView.Adapter<InventoryRecord
                 intent.putExtra("tabtitle", Constant.table_mobile_report_wrstandstock_brand_weekmonthdetail);
                 intent.putExtra("time", data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaStockReportData", data);
             intent.putExtra("AreaSumPLData", new AreaSumPLData());
             intent.putExtra("AreaSpotplReportData", new AreaSpotplReportData());

+ 288 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/ReportQueryActivity.kt

@@ -24,10 +24,7 @@ import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.app.Constant
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.financial.InvoiceRegisterActivity
-import cn.muchinfo.rma.view.base.home.reportquery.adapter.ExposureReportContentAdapter
-import cn.muchinfo.rma.view.base.home.reportquery.adapter.FanacelReportContentAdapter
-import cn.muchinfo.rma.view.base.home.reportquery.adapter.SpotReportContentAdapter
-import cn.muchinfo.rma.view.base.home.reportquery.adapter.SummaryReportContentAdapter
+import cn.muchinfo.rma.view.base.home.reportquery.adapter.*
 import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
 import com.blankj.utilcode.util.*
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
@@ -55,6 +52,9 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
     /** 财务报表 **/
     private val financialReportUI by lazy { FinancialReportUI(this, viewModel) }
 
+    /** 期货报表 **/
+    private val futureReportUI by lazy { FutureReportUI(this, viewModel) }
+
     /** 敞口报表 **/
     private val exposureReportUI by lazy { ExposureReportUI(this, viewModel) }
 
@@ -89,6 +89,10 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
             newTabsArray.add("敞口报表")
             uiList.add(exposureReportUI.root)
         }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_futures") == true){
+            newTabsArray.add("期货报表")
+            uiList.add(futureReportUI.root)
+        }
         if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_spot") == true){
             newTabsArray.add("现货报表")
             uiList.add(spotReportUI.root)
@@ -479,6 +483,286 @@ class FinancialReportUI(
     }
 }
 
+
+/**
+ * 财务报表页面
+ * @property activity AppCompatActivity
+ * @property viewModel ReportQueryViewModel
+ * @constructor
+ */
+class FutureReportUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: ReportQueryViewModel
+) : FutureReportContentAdapter.OnContentScrollListener {
+
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    lateinit var horScrollview: CustomHorizontalScrollView
+    lateinit var recyclerView: RecyclerView
+
+    val topAdapter by lazy {
+        TopTabAdpater(activity)
+    }
+
+    val contentAdapter by lazy {
+        FutureReportContentAdapter(
+            activity,
+            "6"
+        )
+    }
+
+    /**
+     * 选择的报表周期类型
+     */
+    val dateType : MutableLiveData<SelectData> = MutableLiveData()
+
+    /**
+     * 查询所用的date 注意(页面显示时间规则yyyy-MM-dd,而接口请求规则yyyyMMdd,简直无fuck可说)
+     */
+    var tradedate: String = TimeUtils.millis2String(
+        TimeUtils.getNowMills().minus(86400000),
+        SimpleDateFormat("yyyy-MM-dd")
+    )
+
+    /** 查询时间textview **/
+    lateinit var tradedatetextview: TextView
+
+    override fun onScroll(event: MotionEvent?) {
+        //处理单个item滚动时,顶部tab需要联动
+        if (null != horScrollview) horScrollview.onTouchEvent(event)
+    }
+
+    init {
+        viewModel.queryTradingAccMgrLoginUserByFuture(tradedate = tradedate)
+        dateType.postValue(SelectData(id = "1",value = "日报表"))
+    }
+
+    @RequiresApi(Build.VERSION_CODES.N)
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+//            viewModel.qryReportDayExposure(tradedate = tradedate.replace("-",""))
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                linearLayout {
+                    onThrottleFirstClick {
+                        activity.creatBottomSheetDialog("请选择报表周期", viewModel.getSelectDateType()) {
+                            dateType.postValue(this)
+                            contentAdapter.setTimeType(this.id)//item设置时间类型
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        dateType.bindOptional(context){
+                            text = it?.value
+                        }
+                        text = "日报表"
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                        textSizeAuto = 31
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(18)
+                    }
+                    emptyView()
+
+                }.lparams(0, autoSize(67),1f) {
+                    marginStart = autoSize(36)
+                }
+
+                linearLayout {
+                    onThrottleFirstClick {
+                        activity.showDataSelectDialog(type = dateType.value?.id ?: "1") {
+                            tradedate = this
+                            tradedatetextview.text = this
+                            contentAdapter.setTime(this)
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        tradedatetextview = this
+                        text = TimeUtils.millis2String(
+                            TimeUtils.getNowMills().minus(86400000),
+                            SimpleDateFormat("yyyy-MM-dd")
+                        )
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                        textSizeAuto = 31
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(18)
+                    }
+
+                    emptyView()
+
+                    imageView {
+                        imageResource = R.mipmap.rma_search_by_time
+                    }.lparams(autoSize(38), autoSize(38))
+                }.lparams(0, autoSize(67),1f) {
+                    marginStart = autoSize(36)
+                    marginEnd = autoSize(36)
+                }
+
+            }.lparams(matchParent, autoSize(100))
+
+
+            linearLayout {
+                textView {
+                    backgroundResource = R.drawable.rma_time_click_bg
+                    onThrottleFirstClick {
+                        activity.creatBottomSheetDialog("请选择指定交易用户", viewModel.getCanSelectTradingAccount()) {
+                            viewModel.futureSelectTransactionUser.postValue(this)
+
+                        }
+                    }
+                    viewModel.futureSelectTransactionUser.bindOptional(context){
+                        text = it?.value
+                        contentAdapter.setTransaction(it?.value)
+                        contentAdapter.setTransactionUserid(it?.id)
+                    }
+                    gravity = Gravity.CENTER
+                    text = "请选择交易用户"
+                    textColorInt = R.color.rma_black_33
+                    textSizeAuto = 31
+                }.lparams(0, autoSize(67),1f){
+                    marginStart = autoSize(36)
+                }
+                textView {
+                    backgroundDrawable = createCommonBottomRoundBg(color = "#2481DD", corner = 5)
+                    onThrottleFirstClick {
+                        if (dateType.value?.id == "1"){//日报表
+                            viewModel.qryFutureReport(tradedate = tradedate.replace("-", ""),querytype = "1",userid = viewModel.futureSelectTransactionUser.value?.id ?: GlobalDataCollection.instance?.loginRsp?.userID.toString(),cycletype = "0",isFrashByUser = true)
+                        }else if (dateType.value?.id == "2"){//月报表
+                            viewModel.qryFutureReport(tradedate = tradedate.replace("-", ""),querytype = "1",userid = viewModel.futureSelectTransactionUser.value?.id ?: GlobalDataCollection.instance?.loginRsp?.userID.toString(),cycletype = "1",isFrashByUser = true)
+                        }else if (dateType.value?.id == "3"){//周报表
+                            viewModel.qryFutureReport(tradedate = tradedate.replace("-", ""),querytype = "1",userid = viewModel.futureSelectTransactionUser.value?.id ?: GlobalDataCollection.instance?.loginRsp?.userID.toString(),cycletype = "4",isFrashByUser = true)
+                        }
+
+                    }
+                    gravity = Gravity.CENTER
+                    text = "查询"
+                    textColorInt = R.color.white
+                    textSizeAuto = 31
+                }.lparams(0, autoSize(67),1f){
+                    marginStart = autoSize(36)
+                    marginEnd = autoSize(36)
+                }
+
+            }.lparams(matchParent, autoSize(100))
+
+//            viewModel.queryTitle(tableKey = Constant.table_mobile_report_expose, cycletime = tradedate.replace("-", ""),cycletype = "",userid = selectTransactionUser.value?.id ?: "",querytype = "1")
+            contentAdapter.setOnContentScrollListener(this@FutureReportUI)
+            linearLayout {
+                linearLayout {
+                    gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                    textView {//待点价头部左侧数据
+                        viewModel.futureReportTitleData.bindOptional(context) {
+                            text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
+                        }
+                        textColorStr = "#AAAAAA"
+                        textSizeAuto = 24
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(30)
+                    }
+                }.lparams(autoSize(SizeUtils.dp2px(135f)), autoSize(100))
+
+                inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
+                    horScrollview = this
+                    setOnCustomScrollChangeListener { _, scrollX, _, _, _ ->
+                        contentAdapter.offestX = scrollX
+                        val viewHolderCacheList: List<FutureReportContentAdapter.ItemViewHolder> =
+                            contentAdapter.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.futureReportTitleData.bindOptional(context) {
+                            val titleStringList = arrayListOf<String>()
+                            it?.subList(1, it.size)?.forEach { data ->
+                                titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
+                            }
+                            topAdapter.setDatas(titleStringList)
+                        }
+                    }
+                }.lparams(matchParent, matchParent)
+            }.lparams(matchParent, autoSize(100))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(false)
+                    setEnableLoadMore(true)
+                    setOnRefreshListener {
+                        /**
+                         * 下拉刷新
+                         */
+                        if (dateType.value?.id == "1"){//日报表
+                            viewModel.qryFutureReport(tradedate = tradedate.replace("-", ""),querytype = "1",userid = viewModel.futureSelectTransactionUser.value?.id ?: GlobalDataCollection.instance?.loginRsp?.userID.toString(),cycletype = "0",isFrashByUser = true)
+                        }else if (dateType.value?.id == "2"){//月报表
+                            viewModel.qryFutureReport(tradedate = tradedate.replace("-", ""),querytype = "1",userid = viewModel.futureSelectTransactionUser.value?.id ?: GlobalDataCollection.instance?.loginRsp?.userID.toString(),cycletype = "1",isFrashByUser = true)
+                        }else if (dateType.value?.id == "3"){//周报表
+                            viewModel.qryFutureReport(tradedate = tradedate.replace("-", ""),querytype = "1",userid = viewModel.futureSelectTransactionUser.value?.id ?: GlobalDataCollection.instance?.loginRsp?.userID.toString(),cycletype = "4",isFrashByUser = true)
+                        }
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+
+                    recyclerView {//待点价列表
+                        background = resources.getDrawable(R.color.white)
+                        adapter = contentAdapter
+                        addOnScrollListener(object : RecyclerView.OnScrollListener() {
+                            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
+                                super.onScrolled(recyclerView, dx, dy)
+                                val viewHolderCacheList: List<FutureReportContentAdapter.ItemViewHolder> =
+                                    contentAdapter.viewHolderCacheList
+                                if (null != viewHolderCacheList) {
+                                    val size = viewHolderCacheList.size
+                                    for (i in 0 until size) {
+                                        viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                            contentAdapter.getOffestX(),
+                                            0
+                                        )
+                                    }
+                                }
+                            }
+                        })
+                    }
+
+
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.futureReportDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+//                        mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
+                    }
+                    statusLayout.showSuccess()
+                    contentAdapter.setDatas(it)
+                }
+            }
+        }
+    }
+}
+
 /**
  * 敞口报表页面
  * @property activity AppCompatActivity

+ 117 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/ReportQueryViewModel.kt

@@ -47,6 +47,17 @@ class ReportQueryViewModel : BaseViewModel(){
     val financialReportTitleData : MutableLiveData<FinancialReportData> = MutableLiveData()
 
     /**
+     * 期货报表头部数据
+     */
+    val futureReportTitleData : MutableLiveData<List<ColumnsData>> = MutableLiveData()
+
+    /**
+     * 期货报表数据
+     */
+    val futureReportDataList : MutableLiveData<List<FutureDataReportData>> = MutableLiveData()
+
+
+    /**
      * 财务报表选择的日报表还是月报表 1为日报表 2为月报表
      */
     val isselectFinancialMonthOrDay : MutableLiveData<String> = MutableLiveData<String>().apply { value = "1" }
@@ -191,6 +202,9 @@ class ReportQueryViewModel : BaseViewModel(){
     /** 现货报表报表选择的交易用户 **/
     val spotSelectTransactionUser : MutableLiveData<SelectData> = MutableLiveData()
 
+    /** 期货报表报表选择的交易用户 **/
+    val futureSelectTransactionUser : MutableLiveData<SelectData> = MutableLiveData()
+
     /** 库存报表报表选择的交易用户 **/
 //    val inventorySelectTransactionUser : MutableLiveData<SelectData> = MutableLiveData()
 
@@ -352,6 +366,30 @@ class ReportQueryViewModel : BaseViewModel(){
     }
 
     /**
+     * 报表第三步查询日报表
+     */
+    fun qryFutureReport(tradedate: String,userid : String,querytype : String,cycletype : String,isFrashByUser : Boolean = false){
+        if (isFrashByUser){
+            loadingDialogStatus.postValue(TaskUiModel.inFlight())
+        }
+        val params = mutableMapOf<String, String>().apply {
+            put("userid", userid)
+            put("querytype",querytype)
+            put("cycletype",cycletype)
+            put("cycletime",tradedate)
+        }
+
+        MyApplication.getInstance()?.reportManager?.qryTaFutureDataReport(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                if (isFrashByUser){
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "数据请求成功..."))
+                }
+                futureReportDataList.postValue(getFutureExposureRightData(respData ?: arrayListOf()))
+            }
+        }
+    }
+
+    /**
      * querytype 查询类型 1-报表, 这个接口只查报表;明细的字段完全不同,另有接口
      * 敞口报表第三步先查询日报表(进入页面默认查询日报表)
      * cycletype 周期类型 - 0:日 1:月 2:季 3:年 4:周 5:全报表【原值】
@@ -468,6 +506,30 @@ class ReportQueryViewModel : BaseViewModel(){
 
     }
 
+
+    /**
+     * 期货报表第一步也是查询交易用户
+     */
+    fun queryTradingAccMgrLoginUserByFuture(tradedate : String){
+        if (tradingAccountManagerList.value.isNullOrEmpty()){
+            val params = mutableMapOf<String, String>().apply {
+                put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+                put("querytype", "2")
+            }
+            MyApplication.getInstance()?.accountManager?.queryAccMgrLoginUser(params = params){isSuccess, respData, error ->
+                if (isSuccess){
+                    tradingAccountManagerList.postValue(respData)
+                    futureSelectTransactionUser.postValue(resetTradingAccMgrLoginUser(respData ?: arrayListOf()))
+                    queryFutureTitle(tableKey = Constant.table_mobile_report_futures,cycletime = tradedate.replace("-", ""),userid = resetTradingAccMgrLoginUser(respData ?: arrayListOf()).id,cycletype = "0",querytype = "1")
+                }
+            }
+        }else{
+            futureSelectTransactionUser.postValue(resetTradingAccMgrLoginUser(tradingAccountManagerList.value ?: arrayListOf()))
+            queryFutureTitle(tableKey = Constant.table_mobile_report_futures,cycletime = tradedate.replace("-", ""),userid = financialSelectTransactionUser.value?.id ?: "",cycletype = "0",querytype = "1")
+        }
+
+    }
+
     /**
      * 财务报表第一步也是查询交易用户
      */
@@ -624,6 +686,26 @@ class ReportQueryViewModel : BaseViewModel(){
     }
 
     /**
+     * 期货报表第二部查询列头
+     */
+    fun queryFutureTitle(tableKey: String,cycletime: String,cycletype : String,userid : String,querytype : String){
+        val params = mutableMapOf<String, String>().apply {
+            put("tableKey", tableKey)
+            put("tableType", "3")
+        }
+        MyApplication.getInstance()?.commonManager?.queryTableDefine(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                val newlist = respData?.get(0)?.columns?.toArrayList()
+                newlist?.sortWith(Comparator { t1, t2 ->
+                    t1.orderindex?.toInt()?.minus(t2.orderindex?.toInt() ?: 0) ?: 0
+                })
+                futureReportTitleData.postValue(newlist)
+                qryFutureReport(tradedate = cycletime,userid = userid,querytype = querytype,cycletype = cycletype)
+            }
+        }
+    }
+
+    /**
      * 敞口报表第二步先查询列头
      * 敞口报表列表头部数据
      * @param tableKey String
@@ -698,6 +780,41 @@ class ReportQueryViewModel : BaseViewModel(){
     }
 
     /**
+     * 期货报表组装右侧数据
+     */
+    fun getFutureExposureRightData(respData: List<FutureDataReportData>) : List<FutureDataReportData>{
+        val newList = arrayListOf<FutureDataReportData>()
+        respData.forEach {
+            val newRightData = arrayListOf<String>()
+            //'交易合约/\n 方向 '
+            newRightData.add(it.goodsname  + "\n" + if (it.buyorsell == "0"){"买"}else{"卖"})
+            //'期初持仓量/\n 期末持仓量 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.oriholdqty),2) +it.enumdicname  + "\n" + NumberUtils.roundNum(it.holdqty,2) + it.enumdicname )
+            //'今开仓量/\n 今平仓量 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.todayopenqty),2) +it.enumdicname  + "\n" + NumberUtils.roundNum(it.todaycloseqty,2)+ it.enumdicname  )
+            //'期初开仓额/\n 期末开仓额 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.oriopenamount),2)   + "\n" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it.openamount),2) )
+            //'期初持仓额/\n 期末持仓额 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.oriholdamount),2)  + "\n" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it.holdamount),2) )
+            //''今开仓额/\n 今平仓额 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.todayopenamount),2)  + "\n" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it.todaycloseamount),2) )
+            //'开仓均价/\n 平仓均价 ' TODO 缺少'开仓均价/\n 平仓均价 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.todayopenamount),2)  + "\n" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it.todaycloseamount),2) )
+            //'结算价/\n 结算持仓额 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.reckonprice),2)  + "\n" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it.reckonholdamount),2) )
+            //'平仓损益/\n 结算损益 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.closepl),2)  + "\n" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it.reckonpl),2) )
+            //'手续费/\n 交易品种期末量 '
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.charge),2)  + "\n" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it.goodsgroupspotqty),2) + it.enumdicname )
+            //'套保品种/\n 套保品种变动量 ' TODO 缺少套保品种
+            newRightData.add(NumberUtils.roundNum(NumberUtils.doubleDistortion(it.charge),2)  + "\n" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it.todaymiddlegoodsqty),2) + it.enumdicname )
+            val newData = it.copy(rightData = newRightData)
+            newList.add(newData)
+        }
+        return newList
+    }
+
+    /**
      * 财务报表组装右侧数据
      */
     fun getFincialExposureRightData(respData: List<FinanceReportData>) : List<FinanceReportData>{

+ 22 - 9
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/adapter/ExposureReportContentAdapter.java

@@ -27,6 +27,7 @@ import cn.muchinfo.rma.global.data.AreaStockReportData;
 import cn.muchinfo.rma.global.data.AreaSumPLData;
 import cn.muchinfo.rma.global.data.ExposureReportData;
 import cn.muchinfo.rma.global.data.FinanceReportData;
+import cn.muchinfo.rma.global.data.FutureDataReportData;
 import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
 import cn.muchinfo.rma.view.base.app.Constant;
 import cn.muchinfo.rma.view.base.home.reportquery.reportdetail.ReportCommonDetailsActivity;
@@ -188,6 +189,7 @@ public class ExposureReportContentAdapter extends RecyclerView.Adapter<ExposureR
                 intent.putExtra("tabtitle",Constant.table_mobile_report_expose_spotcontract_weekmonth);
                 intent.putExtra("time",data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaStockReportData",new AreaStockReportData());
             intent.putExtra("AreaSumPLData",new AreaSumPLData());
             intent.putExtra("AreaSpotplReportData",new AreaSpotplReportData());
@@ -211,15 +213,25 @@ public class ExposureReportContentAdapter extends RecyclerView.Adapter<ExposureR
         });
         //期货明细
         itemViewHolder.settlement_of_registration.setOnClickListener(view -> {
-//            Intent intent = new Intent();
-//            intent.putExtra("title","期货明细");
-//            intent.putExtra("time",this.time);
-//            intent.putExtra("transaction",this.transaction);
-//            intent.putExtra("tabtitle",this.tabtitle);
-//            intent.putExtra("timeType",this.timeType);
-//            intent.putExtra("transactionUserid",this.transactionUserid);
-//            intent.setClass(context, ReportCommonDetailsActivity.class);
-//            ActivityUtils.startActivity(intent);
+            Intent intent = new Intent();
+            intent.putExtra("title","期货变动量明细");
+            intent.putExtra("transaction",this.transaction);
+            if (data.getCycletype().equals("0")){
+                intent.putExtra("tabtitle", Constant.table_mobile_report_expose_futures_day);
+                intent.putExtra("time",data.getReckondate());
+            }else {
+                intent.putExtra("tabtitle",Constant.table_mobile_report_expose_futures_weekmonth);
+                intent.putExtra("time",data.getBegindate() + "~" + data.getEnddate());
+            }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
+            intent.putExtra("AreaStockReportData",new AreaStockReportData());
+            intent.putExtra("AreaSumPLData",new AreaSumPLData());
+            intent.putExtra("AreaSpotplReportData",new AreaSpotplReportData());
+            intent.putExtra("ExposureReportData",data);
+            intent.putExtra("transactionUserid",this.transactionUserid);
+            intent.putExtra("FinanceReportData",new FinanceReportData());
+            intent.setClass(context, ReportCommonDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
         });
         //套保计划明细
         itemViewHolder.payment_registration.setOnClickListener(view -> {
@@ -233,6 +245,7 @@ public class ExposureReportContentAdapter extends RecyclerView.Adapter<ExposureR
                 intent.putExtra("tabtitle",Constant.table_mobile_report_expose_hedgeplan_weekmonth);
                 intent.putExtra("time",data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaStockReportData",new AreaStockReportData());
             intent.putExtra("AreaSumPLData",new AreaSumPLData());
             intent.putExtra("AreaSpotplReportData",new AreaSpotplReportData());

+ 3 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/adapter/FanacelReportContentAdapter.java

@@ -28,6 +28,7 @@ import cn.muchinfo.rma.global.data.AreaStockReportData;
 import cn.muchinfo.rma.global.data.AreaSumPLData;
 import cn.muchinfo.rma.global.data.ExposureReportData;
 import cn.muchinfo.rma.global.data.FinanceReportData;
+import cn.muchinfo.rma.global.data.FutureDataReportData;
 import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
 import cn.muchinfo.rma.view.base.app.Constant;
 import cn.muchinfo.rma.view.base.home.reportquery.reportdetail.ReportCommonDetailsActivity;
@@ -183,6 +184,7 @@ public class FanacelReportContentAdapter extends RecyclerView.Adapter<FanacelRep
                 intent.putExtra("tabtitle",Constant.table_mobile_report_fincial_brand_weekmonthdetail);
                 intent.putExtra("time",data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaSpotplReportData",new AreaSpotplReportData());
             intent.putExtra("AreaStockReportData",new AreaStockReportData());
             intent.putExtra("AreaSumPLData",new AreaSumPLData());
@@ -205,6 +207,7 @@ public class FanacelReportContentAdapter extends RecyclerView.Adapter<FanacelRep
                 intent.putExtra("tabtitle",Constant.table_mobile_report_fincial_wrstandard_weekmonthdetail);
                 intent.putExtra("time",data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaSpotplReportData",new AreaSpotplReportData());
             intent.putExtra("AreaStockReportData",new AreaStockReportData());
             intent.putExtra("AreaSumPLData",new AreaSumPLData());

+ 266 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/adapter/FutureReportContentAdapter.java

@@ -0,0 +1,266 @@
+package cn.muchinfo.rma.view.base.home.reportquery.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.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.blankj.utilcode.util.ActivityUtils;
+
+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.AreaSpotplReportData;
+import cn.muchinfo.rma.global.data.AreaStockReportData;
+import cn.muchinfo.rma.global.data.AreaSumPLData;
+import cn.muchinfo.rma.global.data.ExposureReportData;
+import cn.muchinfo.rma.global.data.FinanceReportData;
+import cn.muchinfo.rma.global.data.FutureDataReportData;
+import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
+import cn.muchinfo.rma.view.base.app.Constant;
+import cn.muchinfo.rma.view.base.home.reportquery.reportdetail.ReportCommonDetailsActivity;
+import cn.muchinfo.rma.view.base.procurement.RightScrollAdapter;
+
+/**
+ * 财务报表adapter
+ */
+public class FutureReportContentAdapter extends RecyclerView.Adapter<FutureReportContentAdapter.ItemViewHolder> {
+
+    private Context context;
+    private List<FutureDataReportData> datas;
+    private String listType;
+    private int index = -1;
+    private int position = -1;
+    private List<ItemViewHolder> mViewHolderList = new ArrayList<>();
+    public int offestX = 0;
+    private OnContentScrollListener onContentScrollListener;
+    //1是财务报表,2是敞口报表 3是现货报表 4是库存报表 5是汇总损益表 6是期货明细
+    private String type;
+
+    //---------------往下级传的参数----------------
+    private String time;//时间日期
+    private String timeType = "1";//日明细,周/月明细 默认是日
+    private String transaction;//交易用户名称
+    private String transactionUserid;//选择的交易用户id
+    private String tabtitle;//列头
+
+    public void setTime(String time){
+        this.time = time;
+    }
+
+    public void setTimeType(String timeType){
+        this.timeType = timeType;
+    }
+
+    public void setTransaction(String transaction){
+        this.transaction = transaction;
+    }
+
+    public void setTransactionUserid(String transactionUserid){
+        this.transactionUserid = transactionUserid;
+    }
+
+    public void setTabtitle(String tabtitle){
+        this.tabtitle = tabtitle;
+    }
+
+
+    public interface OnContentScrollListener {
+        void onScroll(MotionEvent event);
+    }
+
+    public void setOnContentScrollListener(OnContentScrollListener onContentScrollListener) {
+        this.onContentScrollListener = onContentScrollListener;
+    }
+
+
+    public FutureReportContentAdapter(Context context, String type) {
+        this.context = context;
+        this.listType = listType;
+        this.type = type;
+    }
+
+    public void setDatas(List<FutureDataReportData> 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.exposure_report_layout_item_content, viewGroup, false);
+        return new ItemViewHolder(view);
+    }
+
+    @SuppressLint("SetTextI18n")
+    @Override
+    public void onBindViewHolder(@NonNull final ItemViewHolder itemViewHolder, int i) {
+        this.index = i;
+        FutureDataReportData data = datas.get(i);
+
+        if (datas.get(i).getCurrencyid().isEmpty()){
+            itemViewHolder.tvLeftTitle.setText("--");
+        }else {
+            itemViewHolder.tvLeftTitle.setText(datas.get(i).getCurrencyid());
+        }
+
+//        itemViewHolder.tv_left_bottom_title.setText(datas.get(i).getMiddlegoodscode());
+        //右边滑动部分
+        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
+        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
+        itemViewHolder.rvItemRight.setLayoutManager(linearLayoutManager);
+        itemViewHolder.rvItemRight.setHasFixedSize(true);
+        RightScrollAdapter rightScrollAdapter = new RightScrollAdapter(context);
+        rightScrollAdapter.setDatas(datas.get(i).getRightData());
+        itemViewHolder.rvItemRight.setAdapter(rightScrollAdapter);
+        //缓存当前holder
+        if (!mViewHolderList.contains(itemViewHolder)) {
+            mViewHolderList.add(itemViewHolder);
+        }
+        itemViewHolder.allView.setVisibility(View.GONE);
+
+        if (i == this.position) {
+            itemViewHolder.roots_view.setBackgroundColor(context.getResources().getColor(R.color.rma_list_select_color));
+            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(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                setPosition(i);
+            }
+        });
+        if (type.equals("6")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_report","client_report_finance","client_report_futures_account")){//账户明细
+                itemViewHolder.future_details.setVisibility(View.VISIBLE);
+            }else {
+                itemViewHolder.future_details.setVisibility(View.GONE);
+            }
+        }
+        //财务明细 品牌明细
+        itemViewHolder.future_details.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("title","账户明细");
+            intent.putExtra("transaction",this.transaction);
+            if (data.getCycletype().equals("0")){
+                intent.putExtra("tabtitle", Constant.table_mobile_report_futures_daydetail);
+                intent.putExtra("time",data.getReckondate());
+            }else {
+                intent.putExtra("tabtitle",Constant.table_mobile_report_futures_weekmonthdetail);
+                intent.putExtra("time",data.getBegindate() + "~" + data.getEnddate());
+            }
+            intent.putExtra("FutureDataReportData",data);
+            intent.putExtra("AreaSpotplReportData",new AreaSpotplReportData());
+            intent.putExtra("AreaStockReportData",new AreaStockReportData());
+            intent.putExtra("AreaSumPLData",new AreaSumPLData());
+            intent.putExtra("ExposureReportData",new ExposureReportData());
+            intent.putExtra("transactionUserid",this.transactionUserid);
+            intent.putExtra("FinanceReportData",new FinanceReportData());
+            intent.setClass(context, ReportCommonDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+
+        itemViewHolder.horItemScrollview.setEventListener(new CustomHorizontalScrollView.EventListener() {
+            @Override
+            public void onEvent(MotionEvent event) {
+                if (null != onContentScrollListener) onContentScrollListener.onScroll(event);
+            }
+        });
+        //由于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);
+                }
+            }
+        });
+    }
+
+    @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 details;//详情
+        TextView invoice_register;//现货合同明细
+        TextView midpoints_registration;//参数调整明细
+        TextView settlement_of_registration;//期货明细
+        TextView payment_registration;//套保计划明细
+        TextView warehouse_register;//财务明细 品牌明细
+        TextView fanacel_register;//财务 品类明细
+        TextView future_details;//账户明细
+        ImageView load_more;//更多
+        LinearLayout allView;//隐藏的底部操作空间
+        LinearLayout all_click_View;//item左侧点击控件
+        TextView tvLeftTitle;//左边销售方字段
+        TextView tv_left_bottom_title;//合同编号
+        RecyclerView rvItemRight;//右方的列表
+        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);
+            midpoints_registration = itemView.findViewById(R.id.midpoints_registration);
+            future_details = itemView.findViewById(R.id.future_details);
+            settlement_of_registration = itemView.findViewById(R.id.settlement_of_registration);
+            payment_registration = itemView.findViewById(R.id.payment_registration);
+            warehouse_register = itemView.findViewById(R.id.warehouse_register);
+            fanacel_register = itemView.findViewById(R.id.fanacel_register);
+            load_more = itemView.findViewById(R.id.load_more);
+            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);
+            tv_left_bottom_title = itemView.findViewById(R.id.tv_left_bottom_title);
+            all_click_View = itemView.findViewById(R.id.all_click_View);
+            invoice_register = itemView.findViewById(R.id.invoice_register);
+
+            roots_view = itemView.findViewById(R.id.roots_view);
+        }
+    }
+}

+ 2 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/adapter/SpotReportContentAdapter.java

@@ -28,6 +28,7 @@ import cn.muchinfo.rma.global.data.AreaStockReportData;
 import cn.muchinfo.rma.global.data.AreaSumPLData;
 import cn.muchinfo.rma.global.data.ExposureReportData;
 import cn.muchinfo.rma.global.data.FinanceReportData;
+import cn.muchinfo.rma.global.data.FutureDataReportData;
 import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
 import cn.muchinfo.rma.view.base.app.Constant;
 import cn.muchinfo.rma.view.base.home.reportquery.reportdetail.ReportCommonDetailsActivity;
@@ -178,6 +179,7 @@ public class SpotReportContentAdapter extends RecyclerView.Adapter<SpotReportCon
                 intent.putExtra("tabtitle",Constant.table_mobile_report_spot_weekmonthdetail);
                 intent.putExtra("time",data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaStockReportData",new AreaStockReportData());
             intent.putExtra("AreaSumPLData",new AreaSumPLData());
             intent.putExtra("AreaSpotplReportData",data);

+ 2 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/adapter/SummaryReportContentAdapter.java

@@ -28,6 +28,7 @@ import cn.muchinfo.rma.global.data.AreaStockReportData;
 import cn.muchinfo.rma.global.data.AreaSumPLData;
 import cn.muchinfo.rma.global.data.ExposureReportData;
 import cn.muchinfo.rma.global.data.FinanceReportData;
+import cn.muchinfo.rma.global.data.FutureDataReportData;
 import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
 import cn.muchinfo.rma.view.base.app.Constant;
 import cn.muchinfo.rma.view.base.home.reportquery.reportdetail.ReportCommonDetailsActivity;
@@ -175,6 +176,7 @@ public class SummaryReportContentAdapter extends RecyclerView.Adapter<SummaryRep
                 intent.putExtra("tabtitle",Constant.table_mobile_report_sumprofit_weekmonthdetail);
                 intent.putExtra("time",data.getBegindate() + "~" + data.getEnddate());
             }
+            intent.putExtra("FutureDataReportData",new FutureDataReportData());
             intent.putExtra("AreaStockReportData",new AreaStockReportData());
             intent.putExtra("AreaSumPLData",data);
             intent.putExtra("AreaSpotplReportData",new AreaSpotplReportData());

+ 5 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/reportdetail/ReportCommonDetailsActivity.kt

@@ -73,6 +73,11 @@ class ReportCommonDetailsActivity : BaseActivity<ReportCommonDetailsViewModel>()
      */
     private val areaStockReportData by lazy { intent.getParcelableExtra<AreaStockReportData>("AreaStockReportData") as AreaStockReportData }
 
+    /***
+     * 期货报表传入的实体数据
+     */
+    private val futureDataReportData by lazy { intent.getParcelableExtra<FutureDataReportData>("FutureDataReportData") as FutureDataReportData }
+
     //列表头部表头adapter
     val topAdapter by lazy {
         TopTabAdpater(this)

+ 167 - 15
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/reportquery/reportdetail/ReportCommonDetailsViewModel.kt

@@ -30,7 +30,8 @@ class ReportCommonDetailsViewModel : BaseViewModel(){
      * @param tabName String
      */
     fun queryTitle(tabName : String,userid : String = "",financeReportData : FinanceReportData = FinanceReportData(),exposureReportData : ExposureReportData = ExposureReportData(),
-                   areaSpotplReportData : AreaSpotplReportData = AreaSpotplReportData(),areaSumPLData : AreaSumPLData = AreaSumPLData(),areaStockReportData : AreaStockReportData = AreaStockReportData()
+                   areaSpotplReportData : AreaSpotplReportData = AreaSpotplReportData(),areaSumPLData : AreaSumPLData = AreaSumPLData(),areaStockReportData : AreaStockReportData = AreaStockReportData(),
+                   futureDataReportData : FutureDataReportData = FutureDataReportData()
     ){
         val params = mutableMapOf<String, String>().apply {
             put("tableKey", tabName)
@@ -44,13 +45,14 @@ class ReportCommonDetailsViewModel : BaseViewModel(){
                 })
                 exposureReportTitle.postValue(newlist)
                 //TODO 根据不同的tabName进行不同的接口调用
-                queryListByTabName(tabName, userid, financeReportData,exposureReportData,areaSpotplReportData,areaSumPLData,areaStockReportData)
+                queryListByTabName(tabName, userid, financeReportData,exposureReportData,areaSpotplReportData,areaSumPLData,areaStockReportData,futureDataReportData)
             }
         }
     }
 
     fun queryListByTabName(tabName : String,userid : String = "",financeReportData : FinanceReportData = FinanceReportData(),exposureReportData : ExposureReportData = ExposureReportData()
-    ,areaSpotplReportData : AreaSpotplReportData = AreaSpotplReportData(),areaSumPLData : AreaSumPLData = AreaSumPLData(),areaStockReportData : AreaStockReportData = AreaStockReportData()){
+    ,areaSpotplReportData : AreaSpotplReportData = AreaSpotplReportData(),areaSumPLData : AreaSumPLData = AreaSumPLData(),areaStockReportData : AreaStockReportData = AreaStockReportData(),
+                           futureDataReportData : FutureDataReportData = FutureDataReportData()){
         if (tabName == Constant.table_mobile_report_fincial_brand_daydetail){// 报表-财务报表-品牌日报表明细
             val params = mutableMapOf<String, String>().apply {
                 put("userid", userid)
@@ -335,7 +337,157 @@ class ReportCommonDetailsViewModel : BaseViewModel(){
                     exposureReportDataList.postValue(resetreport_wrstandstock_brand_weekmonthdetail(respData ?: arrayListOf()))
                 }
             }
+        }else if (tabName == Constant.table_mobile_report_futures_daydetail){//报表-期货报表_账户明细-日报表-
+            val params = mutableMapOf<String, String>().apply {
+                put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+                put("querytype","2")
+                put("cycletype",futureDataReportData.cycletype ?: "")
+                put("cycletime",futureDataReportData.cycletime ?: "")
+                put("currencyid",futureDataReportData.currencyid ?: "")
+                put("goodsgroupid",futureDataReportData.goodsgroupid ?: "")
+                put("goodsid",futureDataReportData.goodsid ?: "")
+                put("buyorsell",futureDataReportData.buyorsell ?: "")
+            }
+            MyApplication.getInstance()?.reportManager?.qryTaFutureDataReport(params = params) { isSuccess, respData, error ->
+                if (isSuccess) {
+                    exposureReportDataList.postValue(resettable_mobile_report_futures_daydetail(respData ?: arrayListOf()))
+                }
+            }
+        }else if (tabName == Constant.table_mobile_report_futures_weekmonthdetail){//报表-期货报表_账户明细-周月报表
+            val params = mutableMapOf<String, String>().apply {
+                put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+                put("querytype","2")
+                put("cycletype",futureDataReportData.cycletype ?: "")
+                put("cycletime",futureDataReportData.cycletime ?: "")
+                put("currencyid",futureDataReportData.currencyid ?: "")
+                put("goodsgroupid",futureDataReportData.goodsgroupid ?: "")
+                put("goodsid",futureDataReportData.goodsid ?: "")
+                put("buyorsell",futureDataReportData.buyorsell ?: "")
+            }
+            MyApplication.getInstance()?.reportManager?.qryTaFutureDataReport(params = params) { isSuccess, respData, error ->
+                if (isSuccess) {
+                    exposureReportDataList.postValue(resettable_mobile_report_futures_weekmonthdetail(respData ?: arrayListOf()))
+                }
+            }
+        }else if (tabName == Constant.table_mobile_report_expose_futures_day){//敞口-期货变动量明细——日报表
+            val params = mutableMapOf<String, String>().apply {
+                put("userid", userid)
+                put("middlegoodsid", exposureReportData.middlegoodsid ?: "")
+                put("cycletype",exposureReportData.cycletype ?: "")
+                if (exposureReportData.cycletype == "0"){
+                    put("cycletime",exposureReportData.reckondate ?: "")
+                }else{
+                    put("cycletime",exposureReportData.cycletime ?: "")
+                }
+            }
+            MyApplication.getInstance()?.reportManager?.qryAreaExpourseFutuDetail(params = params) { isSuccess, respData, error ->
+                if (isSuccess) {
+                    exposureReportDataList.postValue(resettable_mobile_report_expose_futures_day(respData ?: arrayListOf()))
+                }
+            }
+        }else if (tabName == Constant.table_mobile_report_expose_futures_weekmonth){//敞口-期货变动量明细-月周报表
+            val params = mutableMapOf<String, String>().apply {
+                put("userid", userid)
+                put("middlegoodsid", exposureReportData.middlegoodsid ?: "")
+                put("cycletype",exposureReportData.cycletype ?: "")
+                if (exposureReportData.cycletype == "0"){
+                    put("cycletime",exposureReportData.reckondate ?: "")
+                }else{
+                    put("cycletime",exposureReportData.cycletime ?: "")
+                }
+            }
+            MyApplication.getInstance()?.reportManager?.qryAreaExpourseFutuDetail(params = params) { isSuccess, respData, error ->
+                if (isSuccess) {
+                    exposureReportDataList.postValue(resettable_mobile_report_expose_futures_weekmonth(respData ?: arrayListOf()))
+                }
+            }
+        }
+    }
+
+    //敞口-期货变动量明细-月周报表
+    fun resettable_mobile_report_expose_futures_weekmonth(dataList : List<ExpourseFutuDetailData>) : List<ReportCommonDetailData>{
+        val newList = arrayListOf<ReportCommonDetailData>()
+        dataList.forEach {
+            val data = ReportCommonDetailData()
+            val newRightData = arrayListOf<String>()
+            data.leftContent = it.tradedate ?: ""//日期
+            newRightData.add(it.accountname + "\n" +it.goodsname) //'交易账户/\n 交易品种 ' TODO 交易品种
+            newRightData.add(it.goodsname + "\n" + if (it.buyorsell == "0"){ "买" }else{ "卖" })//'交易合约/\n 方向 '
+            newRightData.add(NumberUtils.roundNum(it.oriholdqty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.holdqty,2) + it.enumdicname)//'期初持仓量/\n 期末持仓量 '
+            newRightData.add(NumberUtils.roundNum(it.todayopenqty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.todaycloseqty,2) + it.enumdicname)//'今开仓量/\n 今平仓量 '
+            newRightData.add(NumberUtils.roundNum(it.difftradeqty,2) + it.enumdicname )//'交易品种今变化量 '
+            newRightData.add(it.middlegoodsname + "\n" + NumberUtils.roundNum(it.diffmgqty,2) + it.enumdicname)//'套保品种/\n套保品种今变化量 '
+            data.rightData = newRightData
+            newList.add(data)
+        }
+        return newList
+    }
+
+    //敞口-期货变动量明细——日报表
+    fun resettable_mobile_report_expose_futures_day(dataList : List<ExpourseFutuDetailData>) : List<ReportCommonDetailData>{
+        val newList = arrayListOf<ReportCommonDetailData>()
+        dataList.forEach {
+            val data = ReportCommonDetailData()
+            val newRightData = arrayListOf<String>()
+            data.leftContent = it.accountname + "\n" +it.goodsname //'交易账户/\n 交易品种 ' TODO 交易品种
+            newRightData.add(it.goodsname + "\n" + if (it.buyorsell == "0"){ "买" }else{ "卖" })//'交易合约/\n 方向 '
+            newRightData.add(NumberUtils.roundNum(it.oriholdqty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.holdqty,2) + it.enumdicname)//'期初持仓量/\n 期末持仓量 '
+            newRightData.add(NumberUtils.roundNum(it.todayopenqty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.todaycloseqty,2) + it.enumdicname)//'今开仓量/\n 今平仓量 '
+            newRightData.add(NumberUtils.roundNum(it.difftradeqty,2) + it.enumdicname )//'交易品种今变化量 '
+            newRightData.add(it.middlegoodsname + "\n" + NumberUtils.roundNum(it.diffmgqty,2) + it.enumdicname)//'套保品种/\n套保品种今变化量 '
+            data.rightData = newRightData
+            newList.add(data)
+        }
+        return newList
+    }
+
+    //查询报表-库存报表-(品类维度)_品牌日报表明细
+    fun resettable_mobile_report_futures_weekmonthdetail(dataList : List<FutureDataReportData>) : List<ReportCommonDetailData>{
+        val newList = arrayListOf<ReportCommonDetailData>()
+        dataList.forEach {
+            val data = ReportCommonDetailData()
+            val newRightData = arrayListOf<String>()
+            data.leftContent = it.reckondate ?: ""//日期
+            newRightData.add(it.accountname + "\n" + it.currencyid)//'交易账户/\n 结算币种 '
+            newRightData.add(it.goodsgroupname  + "\n" + it.goodsname + "/" + if (it.buyorsell == "0") {"买"}else{"卖"})//'交易品种/\n 交易合约/方向 '
+            newRightData.add(NumberUtils.roundNum(it.oriholdqty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.holdqty,2) + it.enumdicname)//''期初持仓量/\n 期末持仓量 '
+            newRightData.add(NumberUtils.roundNum(it.todayopenqty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.todaycloseqty,2) + it.enumdicname)//''今开仓量/\n 今平仓量 '
+            newRightData.add(NumberUtils.roundNum(it.oriopenamount,2) + "\n" + NumberUtils.roundNum(it.openamount,2))//'期初开仓额/\n 期末开仓额 '
+            newRightData.add(NumberUtils.roundNum(it.oriholdamount,2) + "\n" + NumberUtils.roundNum(it.holdamount,2))//'期初持仓额/\n 期末持仓额 '
+            newRightData.add(NumberUtils.roundNum(it.todayopenamount,2) + "\n" + NumberUtils.roundNum(it.todaycloseamount,2))//'今开仓额/\n 今平仓额 '
+            newRightData.add(NumberUtils.roundNum(it.todayopenamount,2) + "\n" + NumberUtils.roundNum(it.todaycloseamount,2))//'开仓均价/\n 平仓均价 ' TODO 缺少
+            newRightData.add(NumberUtils.roundNum(it.reckonprice,2) + "\n" + NumberUtils.roundNum(it.reckonholdamount,2))//'结算价/\n 结算持仓额 ',
+            newRightData.add(NumberUtils.roundNum(it.closepl,2) + "\n" + NumberUtils.roundNum(it.reckonpl,2))//'平仓损益/\n 结算损益 '
+            newRightData.add(NumberUtils.roundNum(it.charge,2) + "\n" + NumberUtils.roundNum(it.goodsgroupspotqty,2))//'续费/\n 交易品种期末量 '
+            newRightData.add(it.middlegoodsqty + "\n" + NumberUtils.roundNum(it.todaymiddlegoodsqty,2) + it.enumdicname)//'套保品种/\n 套保品种变动量 'TODO 缺少套保品种
+            data.rightData = newRightData
+            newList.add(data)
         }
+        return newList
+    }
+
+    //查询报表-库存报表-(品类维度)_品牌日报表明细
+    fun resettable_mobile_report_futures_daydetail(dataList : List<FutureDataReportData>) : List<ReportCommonDetailData>{
+        val newList = arrayListOf<ReportCommonDetailData>()
+        dataList.forEach {
+            val data = ReportCommonDetailData()
+            val newRightData = arrayListOf<String>()
+            data.leftContent = it.accountname + "\n" + it.currencyid//'交易账户/\n 结算币种 '
+            newRightData.add(it.goodsgroupname  + "\n" + it.goodsname + "/" + if (it.buyorsell == "0") {"买"}else{"卖"})//'交易品种/\n 交易合约/方向 '
+            newRightData.add(NumberUtils.roundNum(it.oriholdqty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.holdqty,2) + it.enumdicname)//''期初持仓量/\n 期末持仓量 '
+            newRightData.add(NumberUtils.roundNum(it.todayopenqty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.todaycloseqty,2) + it.enumdicname)//''今开仓量/\n 今平仓量 '
+            newRightData.add(NumberUtils.roundNum(it.oriopenamount,2) + "\n" + NumberUtils.roundNum(it.openamount,2))//'期初开仓额/\n 期末开仓额 '
+            newRightData.add(NumberUtils.roundNum(it.oriholdamount,2) + "\n" + NumberUtils.roundNum(it.holdamount,2))//'期初持仓额/\n 期末持仓额 '
+            newRightData.add(NumberUtils.roundNum(it.todayopenamount,2) + "\n" + NumberUtils.roundNum(it.todaycloseamount,2))//'今开仓额/\n 今平仓额 '
+            newRightData.add(NumberUtils.roundNum(it.todayopenamount,2) + "\n" + NumberUtils.roundNum(it.todaycloseamount,2))//'开仓均价/\n 平仓均价 ' TODO 缺少
+            newRightData.add(NumberUtils.roundNum(it.reckonprice,2) + "\n" + NumberUtils.roundNum(it.reckonholdamount,2))//'结算价/\n 结算持仓额 ',
+            newRightData.add(NumberUtils.roundNum(it.closepl,2) + "\n" + NumberUtils.roundNum(it.reckonpl,2))//'平仓损益/\n 结算损益 '
+            newRightData.add(NumberUtils.roundNum(it.charge,2) + "\n" + NumberUtils.roundNum(it.goodsgroupspotqty,2))//'续费/\n 交易品种期末量 '
+            newRightData.add(it.middlegoodsqty + "\n" + NumberUtils.roundNum(it.todaymiddlegoodsqty,2) + it.enumdicname)//'套保品种/\n 套保品种变动量 'TODO 缺少套保品种
+            data.rightData = newRightData
+            newList.add(data)
+        }
+        return newList
     }
 
     //查询报表-库存报表-(品类维度)_品牌周月报表明细
@@ -661,12 +813,12 @@ class ReportCommonDetailsViewModel : BaseViewModel(){
             val data = ReportCommonDetailData()
             val newRightData = arrayListOf<String>()
             data.leftContent = it.tradedate//日期//
-            newRightData.add(it.deliverygoodsname + "\n" + it.middlegoodsname)//'现货品种/\n 套保品种 '
-            newRightData.add(it.wrstandardname + "\n" + if (it.contracttype == "1"){ "套保" }else{ "套利" })//'现货品类/\n 业务类型 '
-            newRightData.add(NumberUtils.roundNum(it.qty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.qty,2) + it.enumdicname)//采购量/\n 销售量 '// TODO 缺少 采购量  销售量
-            newRightData.add(NumberUtils.roundNum(it.qty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.qty,2) + it.enumdicname)//'采购计划套保量/\n 销售计划套保量 '// TODO 缺少 采购计划套保量  销售计划套保量
-            newRightData.add(NumberUtils.roundNum(it.qty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.diffqty,2) + it.enumdicname)//'合计变动量/\n 套保品种变动量 ' // TODO 缺少合计变动量
-            newRightData.add(it.convertratio)//'数量折算系数 '
+            newRightData.add(it.contractno + "\n" + if (it.contracttype == "1"){ "采购" }else{ "销售" })//'合同编号/\n 合同类型 '
+            newRightData.add(it.buyusername + "\n" + it.sellusername)//'采购方/\n 销售方 '
+            newRightData.add(it.deliverygoodsname + "\n" + it.wrstandardname)//'现货品种/\n 现货品类 '
+            newRightData.add(it.deliverygoodsname + "\n" + NumberUtils.roundNum(it.todaypricedqty,2) + it.enumdicname)//'期现用途/\n 今定价量 ' TODO缺少期现用途
+            newRightData.add(it.middlegoodsname + "\n" + NumberUtils.roundNum(it.diffhedgeqty,2) + it.enumdicname)//'套保品种/\n 套保变动量 ' //
+            newRightData.add(NumberUtils.roundNum(it.diffneedhedgeqty,2) + it.enumdicname)//'应套保变动量 ',
             data.rightData = newRightData
             newList.add(data)
         }
@@ -679,12 +831,12 @@ class ReportCommonDetailsViewModel : BaseViewModel(){
         dataList.forEach {
             val data = ReportCommonDetailData()
             val newRightData = arrayListOf<String>()
-            data.leftContent = it.deliverygoodsname + "\n" + it.middlegoodsname//'现货品种/\n 套保品种 '
-            newRightData.add(it.wrstandardname + "\n" + if (it.contracttype == "1"){ "套保" }else{ "套利" })//'现货品类/\n 业务类型 '
-            newRightData.add(NumberUtils.roundNum(it.qty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.qty,2) + it.enumdicname)//采购量/\n 销售量 '// TODO 缺少 采购量  销售量
-            newRightData.add(NumberUtils.roundNum(it.qty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.qty,2) + it.enumdicname)//'采购计划套保量/\n 销售计划套保量 '// TODO 缺少 采购计划套保量  销售计划套保量
-            newRightData.add(NumberUtils.roundNum(it.qty,2) + it.enumdicname + "\n" + NumberUtils.roundNum(it.diffqty,2) + it.enumdicname)//'合计变动量/\n 套保品种变动量 ' // TODO 缺少合计变动量
-            newRightData.add(it.convertratio)//'数量折算系数 '
+            data.leftContent = it.contractno + "\n" + if (it.contracttype == "1"){ "采购" }else{ "销售" }//'合同编号/\n 合同类型 '
+            newRightData.add(it.buyusername + "\n" + it.sellusername)//'采购方/\n 销售方 '
+            newRightData.add(it.deliverygoodsname + "\n" + it.wrstandardname)//'现货品种/\n 现货品类 '
+            newRightData.add(it.deliverygoodsname + "\n" + NumberUtils.roundNum(it.todaypricedqty,2) + it.enumdicname)//'期现用途/\n 今定价量 ' TODO缺少期现用途
+            newRightData.add(it.middlegoodsname + "\n" + NumberUtils.roundNum(it.diffhedgeqty,2) + it.enumdicname)//'套保品种/\n 套保变动量 ' //
+            newRightData.add(NumberUtils.roundNum(it.diffneedhedgeqty,2) + it.enumdicname)//'应套保变动量 ',
             data.rightData = newRightData
             newList.add(data)
         }

+ 12 - 0
RMA/app/src/main/res/layout/exposure_report_layout_item_content.xml

@@ -175,6 +175,18 @@
 
         <TextView
             android:visibility="gone"
+            android:id="@+id/future_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"/>
+
+        <TextView
+            android:visibility="gone"
             android:id="@+id/details"
             android:layout_marginEnd="10dp"
             android:gravity="center"