Browse Source

风险管理5月12日提交代码-liu.bolan

Liu.bolan 4 years ago
parent
commit
eb4bb18144
24 changed files with 1062 additions and 200 deletions
  1. 4 0
      RMA/app/src/main/AndroidManifest.xml
  2. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/business/account/AccountManager.kt
  3. 58 3
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/AccMgrLoginUserData.kt
  4. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt
  5. 65 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeFragment.kt
  6. 59 51
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/AccountManagerActivity.kt
  7. 97 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/AccountManagerViewModel.kt
  8. 8 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/accountviewholder/AccountManagerViewHolder.kt
  9. 34 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/accountviewholder/AccountUserViewHolder.kt
  10. 46 25
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/bussinessaccount/TradingManagerViewHolder.kt
  11. 40 6
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/bussinessaccount/TradingUserViewHolder.kt
  12. 17 18
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/futureaccount/AddFutureAccountActivity.kt
  13. 9 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/futureaccount/AddFutureSonAccountActivity.kt
  14. 70 7
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/futureaccount/AddTransactionUserActivity.kt
  15. 54 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/futureaccount/FutureAccountViewModel.kt
  16. 14 18
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/manageaccount/ManagerAccountViewHolder.kt
  17. 27 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/manageaccount/ManagerUserViewHolder.kt
  18. 3 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/NewCommodityInformationActivity.kt
  19. 36 10
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/AddLoginRoleActivity.kt
  20. 8 6
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/AddRoleActivity.kt
  21. 38 30
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/AddTradingLoginRoleActivity.kt
  22. 261 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/ResetAccountPasswordActivity.kt
  23. 85 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/ResetAccountPasswordViewModel.kt
  24. 25 5
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/RoleSetViewModel.kt

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

@@ -261,6 +261,10 @@
         <activity android:name=".view.base.home.spotmarket.SpotMarketDetailsActivity"/>
 
         <activity android:name=".view.base.home.accountmanager.futureaccount.AddTransactionUserActivity"/>
+
+        <activity android:name=".view.base.home.rolemanagement.AddTradingLoginRoleActivity"/>
+
+        <activity android:name=".view.base.home.rolemanagement.ResetAccountPasswordActivity"/>
     </application>
 
 </manifest>

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

@@ -651,9 +651,9 @@ class AccountManager {
             trademargintmpid,
             tradefeetmpid,
             maxsubaccouts,
+            relateduserid,
             fcid,
-            accountid,
-            relateduserid
+            accountid
         )
 
         tradeSocketManager.send(

+ 58 - 3
RMA/app/src/main/java/cn/muchinfo/rma/global/data/AccMgrLoginUserData.kt

@@ -12,13 +12,19 @@ data class AccMgrLoginUserData(
     val userlist : List<Userlist>? = arrayListOf(),//用户列表
     val usertype : String? = "",//用户类型 2-机构 7-企业成员(云平台)
     var isSelect : Int = 0, //是否展开
-    val roleid : String? = ""//角色id
+    val roleid : String? = "",//角色id
+    val accountstatus : String? = "",//账户的状态 - 1:待激活 2:待审核 3:待复审 4:正常 5:审核拒绝 6:停用(注销) 7:注销(删除)
+    val mobile : String? = "",//手机号
+    val querytype : String? = ""//查询类型 1-业务账户 2-交易账户 3-管理账户
 ): Parcelable{
     constructor(parcel: Parcel) : this(
         parcel.readString(),
         parcel.createTypedArrayList(Userlist),
         parcel.readString(),
         parcel.readInt(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
         parcel.readString()
     ) {
     }
@@ -29,6 +35,9 @@ data class AccMgrLoginUserData(
         parcel.writeString(usertype)
         parcel.writeInt(isSelect)
         parcel.writeString(roleid)
+        parcel.writeString(accountstatus)
+        parcel.writeString(mobile)
+        parcel.writeString(querytype)
     }
 
     override fun describeContents(): Int {
@@ -45,6 +54,7 @@ data class AccMgrLoginUserData(
         }
     }
 
+
 }
 
 data class Userlist(
@@ -60,7 +70,11 @@ data class Userlist(
     val roletype: String? = "",//角色类型(逗号隔开,如22,23), 22:业务员 23:跟单员 24:交易员
     val userid: String? = "",//用户id
     val usertype: String? = "",//用户类型 - 1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户 7:企业成员(云平台)
-    var isSelect: Int = 0//是否点击展开
+    var isSelect: Int = 0,//是否点击展开
+    val mobile : String? = "",//手机号码
+    val logincode : String? = "",//登录代码
+    val acclist : List<Acclist>? = arrayListOf(),
+    val loginname : String? = ""
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
         parcel.readString(),
@@ -75,7 +89,11 @@ data class Userlist(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
-        parcel.readInt()
+        parcel.readInt(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.createTypedArrayList(Acclist),
+        parcel.readString()
     ) {
     }
 
@@ -93,6 +111,10 @@ data class Userlist(
         parcel.writeString(userid)
         parcel.writeString(usertype)
         parcel.writeInt(isSelect)
+        parcel.writeString(mobile)
+        parcel.writeString(logincode)
+        parcel.writeTypedList(acclist)
+        parcel.writeString(loginname)
     }
 
     override fun describeContents(): Int {
@@ -109,6 +131,39 @@ data class Userlist(
         }
     }
 
+
+}
+
+data class FutureData(
+    val accountid : String? = "",
+    val accountname : String? = ""
+) : Parcelable{
+    constructor(parcel: Parcel) : this(
+        parcel.readString(),
+        parcel.readString()
+    ) {
+    }
+
+    override fun writeToParcel(parcel: Parcel, flags: Int) {
+        parcel.writeString(accountid)
+        parcel.writeString(accountname)
+    }
+
+    override fun describeContents(): Int {
+        return 0
+    }
+
+    companion object CREATOR : Parcelable.Creator<FutureData> {
+        override fun createFromParcel(parcel: Parcel): FutureData {
+            return FutureData(parcel)
+        }
+
+        override fun newArray(size: Int): Array<FutureData?> {
+            return arrayOfNulls(size)
+        }
+    }
+
+
 }
 
 

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

@@ -11,9 +11,9 @@ object Constant {
 //    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.31.175:8080/cfg?key=test_175" // 8888  123123
+//    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.174:8080/cfg?key=test_174"// 邓工
 
     /**
      * 用sp存储基础url的key

+ 65 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeFragment.kt

@@ -537,7 +537,11 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
             verticalLayout {
                 linearLayout {
                     relativeLayout {
-
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_customer") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -594,6 +598,11 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
 
 
                     verticalLayout {
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_deliverygoods") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         onThrottleFirstClick {
                             val intent = Intent()
                             intent.setClass(
@@ -619,6 +628,11 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
                     }.lparams(0, matchParent, 1f)
 
                     relativeLayout {
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_spotcontract") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -676,6 +690,11 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
                     }.lparams(0, matchParent, 1f)
 
                     relativeLayout {
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_hedgeplan") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -736,6 +755,11 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
                 }
 
                 linearLayout {
+                    if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_business") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     relativeLayout {
                         verticalLayout {
                             onThrottleFirstClick {
@@ -794,6 +818,11 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
                     }.lparams(0, matchParent, 1f)
 
                     relativeLayout {
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_finance") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -851,6 +880,11 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
                     }.lparams(0, matchParent, 1f)
 
                     verticalLayout {
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_tradeflow") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         onThrottleFirstClick {
                             val intent = Intent()
                             intent.setClass(
@@ -875,6 +909,11 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
                         }
                     }.lparams(0, matchParent, 1f)
                     verticalLayout {
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_report") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         onThrottleFirstClick {
                             val intent = Intent()
                             intent.setClass(
@@ -919,7 +958,11 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
             verticalLayout {
                 linearLayout {
                     relativeLayout {
-
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_warehouse") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -973,6 +1016,11 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
 
 
                     relativeLayout {
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_stock_aduit") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -1027,6 +1075,11 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
                     }.lparams(0, matchParent, 1f)
 
                     relativeLayout {
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_stock_manage") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -1081,7 +1134,11 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
                     }.lparams(0, matchParent, 1f)
 
                     relativeLayout {
-
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_accountmanage") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -1140,7 +1197,11 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
 
                 linearLayout {
                     relativeLayout {
-
+                        if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_spotmarketprice") == true){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()

+ 59 - 51
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/AccountManagerActivity.kt

@@ -11,6 +11,7 @@ import androidx.lifecycle.MutableLiveData
 import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AccMgrLoginUserData
 import cn.muchinfo.rma.global.data.AccMgrRoleData
 import cn.muchinfo.rma.global.data.AccMgrTaaccountData
@@ -47,12 +48,6 @@ class AccountManagerActivity : BaseActivity<AccountManagerViewModel>() {
     var selectedTabIndex: Int = 0
     private lateinit var viewPager: ViewPager
 
-    private val tabsArray: List<String> by lazy {
-        arrayListOf(
-            "业务账户", "交易账户", "管理账户", "期货账户"
-        )
-    }
-
     /**
      * 业务账户
      */
@@ -75,46 +70,43 @@ class AccountManagerActivity : BaseActivity<AccountManagerViewModel>() {
 
     val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
 
-    private val pagerAdapter: PagerAdapter by lazy {
-        object : PagerAdapter() {
 
-            override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
+    //viewpager的适配器
+    private var newPagerAdapter : PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray : ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList : ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initMenuData(){
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_business") == true){
+            newTabsArray.add("业务账户")
+            uiList.add(loginAccountManager.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_trade") == true){
+            newTabsArray.add("交易账户")
+            uiList.add(tradingAccountManager.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage") == true){
+            newTabsArray.add("管理账户")
+            uiList.add(managerAccountUI.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_ta") == true){
+            newTabsArray.add("期货账户")
+            uiList.add(futuresAccountManager.root)
+        }
+        newPagerAdapter = object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
 
             override fun instantiateItem(container: ViewGroup, position: Int): Any {
-                when (position) {
-                    0 -> {
-                        return loginAccountManager.root.apply {
-                            container.addView(
-                                this,
-                                ViewGroup.LayoutParams(matchParent, matchParent)
-                            )
-                        }
-                    }
-                    1 -> {
-                        return tradingAccountManager.root.apply {
-                            container.addView(
-                                this,
-                                ViewGroup.LayoutParams(matchParent, matchParent)
-                            )
-                        }
-                    }
-                    2 -> {
-                        return managerAccountUI.root.apply {
-                            container.addView(
-                                this,
-                                ViewGroup.LayoutParams(matchParent, matchParent)
-                            )
-                        }
-                    }
-                    3 -> {
-                        return futuresAccountManager.root.apply {
-                            container.addView(
-                                this,
-                                ViewGroup.LayoutParams(matchParent, matchParent)
-                            )
-                        }
-                    }
-                    else -> return super.instantiateItem(container, position)
+                return uiList.get(position).apply {
+                    container.addView(
+                        this,
+                        ViewGroup.LayoutParams(matchParent, matchParent)
+                    )
                 }
             }
 
@@ -124,14 +116,17 @@ class AccountManagerActivity : BaseActivity<AccountManagerViewModel>() {
 
             override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
 
-            override fun getCount(): Int = tabsArray.size
+            override fun getCount(): Int = newTabsArray.size
 
         }
+
     }
 
 
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
+        initMenuData()
         verticalLayout {
             dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
             topBar {
@@ -139,11 +134,10 @@ class AccountManagerActivity : BaseActivity<AccountManagerViewModel>() {
                 commonTitle {
                     text = "账户管理"
                 }
-                commonMenuButton(R.mipmap.add_new) {
-
-                }
+//                commonMenuButton(R.mipmap.add_new) {
+//
+//                }
             }
-            val collectInfo = DeviceInfoManager.getCollectInfo(context)
             tabSegment {
                 segment = this
                 background = resources.getDrawable(R.color.segtabment_bg_color)
@@ -175,7 +169,7 @@ class AccountManagerActivity : BaseActivity<AccountManagerViewModel>() {
             viewPager {
                 background = resources.getDrawable(R.color.white)
                 viewPager = this
-                adapter = pagerAdapter
+                adapter = newPagerAdapter
             }.lparams(matchParent, matchParent)
 
             segment.setupWithViewPager(viewPager)
@@ -366,8 +360,6 @@ class TradingAccountManager(
 
                 emptyView()
 
-
-
             }.lparams(matchParent, autoSize(96))
 
             statusLayout(contentBlock = {
@@ -479,6 +471,11 @@ class ManagerAccountUI(
                 emptyView()
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage",threeCode = "client_accountmanage_roleset") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     onThrottleFirstClick {
                         val intent = Intent()
                         intent.setClass(context, RoleSetActivity::class.java)
@@ -494,6 +491,11 @@ class ManagerAccountUI(
                 }
 
                 imageView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage",threeCode = "client_accountmanage_add") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     onThrottleFirstClick {
                         val intent = Intent()
                         intent.putExtra("type", "1")
@@ -617,6 +619,7 @@ class FuturesAccountManager(
                 emptyView()
 
                 textView {
+                    visibility = View.GONE//三期后期被要求去掉
                     onThrottleFirstClick {
                         val intent = Intent()
                         intent.setClass(context, FutureSetActivity::class.java)
@@ -632,6 +635,11 @@ class FuturesAccountManager(
                 }
 
                 imageView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_ta",threeCode = "client_accountmanage_ta_mainadd") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     onThrottleFirstClick {
                         val intent = Intent()
                         intent.putExtra("type", "1")

+ 97 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/AccountManagerViewModel.kt

@@ -172,7 +172,7 @@ class AccountManagerViewModel : BaseViewModel(){
 
 
     /**
-     * 账户管理-登录账户的item点击展开
+     * 账户管理-业务账户的item点击展开
      * @param index Int
      */
     fun setOnLoginAccountHedgeClick(index: Int){
@@ -220,6 +220,102 @@ class AccountManagerViewModel : BaseViewModel(){
 
 
     /**
+     * 账户管理-交易账户的item点击展开
+     * @param index Int
+     */
+    fun setOnTradingAccountHedgeClick(index: Int){
+        val datanewList = arrayListOf<AccMgrLoginUserData>()
+        tradingAccountManagerList.value?.forEach {
+            if (index == tradingAccountManagerList.value?.indexOf(it)) {
+                if (it.isSelect == 0) {
+                    datanewList.add(it.copy(isSelect = 1))
+                } else {
+                    datanewList.add(it.copy(isSelect = 0))
+                }
+            } else {
+                datanewList.add(it)
+            }
+        }
+        tradingAccountManagerList.postValue(datanewList)
+    }
+
+
+    //账户管理-登录账户的item的子item展开隐藏点击事件
+    fun setOnTradingSonItemClick(index: Int, sonIndex: Int) {
+        val datanewlist = arrayListOf<AccMgrLoginUserData>()
+        val oldList = tradingAccountManagerList.value
+        tradingAccountManagerList.value?.forEach {
+            if (index == oldList?.indexOf(it)) {
+                val newHedgeList = arrayListOf<Userlist>()
+                oldList.get(index).userlist?.forEach { data ->
+                    if (sonIndex == oldList.get(index).userlist?.indexOf(data)) {
+                        if (data.isSelect == 0) {
+                            newHedgeList.add(data.copy(isSelect = 1))
+                        } else {
+                            newHedgeList.add(data.copy(isSelect = 0))
+                        }
+                    } else {
+                        newHedgeList.add(data)
+                    }
+                }
+                datanewlist.add(it.copy(userlist = newHedgeList))
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        tradingAccountManagerList.postValue(datanewlist)
+    }
+
+
+    /**
+     * 账户管理-管理账户的item点击展开
+     * @param index Int
+     */
+    fun setOnManagerAccountHedgeClick(index: Int){
+        val datanewList = arrayListOf<AccMgrLoginUserData>()
+        managerAccountManagerList.value?.forEach {
+            if (index == managerAccountManagerList.value?.indexOf(it)) {
+                if (it.isSelect == 0) {
+                    datanewList.add(it.copy(isSelect = 1))
+                } else {
+                    datanewList.add(it.copy(isSelect = 0))
+                }
+            } else {
+                datanewList.add(it)
+            }
+        }
+        managerAccountManagerList.postValue(datanewList)
+    }
+
+
+    //账户管理-登录账户的item的子item展开隐藏点击事件
+    fun setOnManagerSonItemClick(index: Int, sonIndex: Int) {
+        val datanewlist = arrayListOf<AccMgrLoginUserData>()
+        val oldList = managerAccountManagerList.value
+        managerAccountManagerList.value?.forEach {
+            if (index == oldList?.indexOf(it)) {
+                val newHedgeList = arrayListOf<Userlist>()
+                oldList.get(index).userlist?.forEach { data ->
+                    if (sonIndex == oldList.get(index).userlist?.indexOf(data)) {
+                        if (data.isSelect == 0) {
+                            newHedgeList.add(data.copy(isSelect = 1))
+                        } else {
+                            newHedgeList.add(data.copy(isSelect = 0))
+                        }
+                    } else {
+                        newHedgeList.add(data)
+                    }
+                }
+                datanewlist.add(it.copy(userlist = newHedgeList))
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        managerAccountManagerList.postValue(datanewlist)
+    }
+
+
+    /**
      * 登录账户操作请求报文装箱
      * @param operatetype Int 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码
      * @param userid Long 用户ID(新增成功接口返回的userid)

+ 8 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/accountviewholder/AccountManagerViewHolder.kt

@@ -6,6 +6,7 @@ import android.view.Gravity
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AccMgrLoginUserData
 import cn.muchinfo.rma.global.data.Userlist
 import cn.muchinfo.rma.lifecycle.bindOptional
@@ -63,12 +64,17 @@ class AccountManagerViewHolder(
                 emptyView()
 
                 imageView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_business",threeCode = "client_accountmanage_business_add") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     onThrottleFirstClick {
                         if (data.value?.usertype == "2"){// usertype 2-机构 7-企业成员(云平台
                             val intent = Intent()
                             intent.putExtra("type","1")
                             intent.putExtra("data",data.value)
-                            intent.putExtra("data1",AccMgrLoginUserData())
+                            intent.putExtra("data1",Userlist())
                             intent.putExtra("seletType", viewModel.getPassRoleList() as Serializable)
                             intent.setClass(context,AddRoleActivity::class.java)
                             ActivityUtils.startActivity(intent)
@@ -76,7 +82,7 @@ class AccountManagerViewHolder(
                             val intent = Intent()
                             intent.putExtra("type","1")
                             intent.putExtra("data",data.value)
-                            intent.putExtra("data1",AccMgrLoginUserData())
+                            intent.putExtra("data1",Userlist())
                             intent.putExtra("seletType", viewModel.getPassRoleList() as Serializable)
                             intent.setClass(context,AddLoginRoleActivity::class.java)
                             ActivityUtils.startActivity(intent)

+ 34 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/accountviewholder/AccountUserViewHolder.kt

@@ -6,6 +6,7 @@ import android.view.Gravity
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AccMgrLoginUserData
 import cn.muchinfo.rma.global.data.Userlist
 import cn.muchinfo.rma.global.loginstatus
@@ -16,7 +17,9 @@ import cn.muchinfo.rma.view.autoWidget.textColorInt
 import cn.muchinfo.rma.view.autoWidget.textSizeAuto
 import cn.muchinfo.rma.view.base.home.accountmanager.AccountManagerViewModel
 import cn.muchinfo.rma.view.base.home.contract.emptyView
+import cn.muchinfo.rma.view.base.home.rolemanagement.AddLoginRoleActivity
 import cn.muchinfo.rma.view.base.home.rolemanagement.AddRoleActivity
+import cn.muchinfo.rma.view.base.home.rolemanagement.ResetAccountPasswordActivity
 import com.blankj.utilcode.util.ActivityUtils
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
 import org.jetbrains.anko.*
@@ -38,7 +41,6 @@ class AccountUserViewHolder(
     override fun _FrameLayout.createContentView() {
         verticalLayout {
             data.bindOptional(context) {
-
                 if (it?.loginstatus == "1") {
                     backgroundResource = R.drawable.rma_list_item_bg
                 } else if (it?.loginstatus == "2") {
@@ -99,7 +101,7 @@ class AccountUserViewHolder(
                         intent.putExtra("data", AccMgrLoginUserData())
                         intent.putExtra("seletType", arrayListOf<AccMgrLoginUserData>() as Serializable)
                         intent.putExtra("type","2")
-                        intent.setClass(context,AddRoleActivity::class.java)
+                        intent.setClass(context,AddLoginRoleActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
@@ -112,6 +114,11 @@ class AccountUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_business",threeCode = "client_accountmanage_business_update") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -125,7 +132,7 @@ class AccountUserViewHolder(
                         intent.putExtra("data", AccMgrLoginUserData())
                         intent.putExtra("seletType", arrayListOf<AccMgrLoginUserData>() as Serializable)
                         intent.putExtra("type","3")
-                        intent.setClass(context,AddRoleActivity::class.java)
+                        intent.setClass(context,AddLoginRoleActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
@@ -138,6 +145,11 @@ class AccountUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_business",threeCode = "client_accountmanage_business_resetpwd") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -146,7 +158,10 @@ class AccountUserViewHolder(
                         }
                     }
                     onThrottleFirstClick {
-
+                        val intent = Intent()
+                        intent.putExtra("logincode",data.value?.logincode)
+                        intent.setClass(context,ResetAccountPasswordActivity::class.java)
+                        ActivityUtils.startActivity(intent)
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
                     gravity = Gravity.CENTER
@@ -158,6 +173,11 @@ class AccountUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_business",threeCode = "client_accountmanage_business_lock") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -184,6 +204,11 @@ class AccountUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_business",threeCode = "client_accountmanage_business_close") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -209,6 +234,11 @@ class AccountUserViewHolder(
                     marginEnd = autoSize(24)
                 }
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_business",threeCode = "client_accountmanage_business_unlock") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "2"){
                             visibility = View.VISIBLE

+ 46 - 25
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/bussinessaccount/TradingManagerViewHolder.kt

@@ -6,16 +6,19 @@ import android.view.Gravity
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AccMgrLoginUserData
 import cn.muchinfo.rma.global.data.Userlist
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.home.accountmanager.AccountManagerViewModel
+import cn.muchinfo.rma.view.base.home.accountmanager.futureaccount.AddTransactionUserActivity
 import cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge.HedgeFutureContractViewHolder
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.rolemanagement.AddLoginRoleActivity
 import cn.muchinfo.rma.view.base.home.rolemanagement.AddRoleActivity
+import cn.muchinfo.rma.view.base.home.rolemanagement.AddTradingLoginRoleActivity
 import com.blankj.utilcode.util.ActivityUtils
 import mtp.polymer.com.autowidget.adapter.BaseAdapter
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
@@ -35,9 +38,6 @@ class TradingManagerViewHolder(
 ) : BaseViewHolder<AccMgrLoginUserData>(activity) {
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
-    //期货合约
-    private val accountUserAdapter: BaseAdapter<Userlist, TradingUserViewHolder> =
-        BaseAdapter { _, _ -> TradingUserViewHolder(activity, viewModel,dataIndex) }
 
 
     override fun _FrameLayout.createContentView() {
@@ -46,7 +46,7 @@ class TradingManagerViewHolder(
                 gravity = Gravity.CENTER_VERTICAL
                 imageView {
                     onThrottleFirstClick {
-                        viewModel.setOnLoginAccountHedgeClick(dataIndex)
+                        viewModel.setOnTradingAccountHedgeClick(dataIndex)
                     }
                     imageResource = R.mipmap.second_list_floding
                 }.lparams(autoSize(43), autoSize(43))
@@ -60,27 +60,42 @@ class TradingManagerViewHolder(
                 }.lparams(wrapContent, wrapContent) {
                     marginStart = autoSize(20)
                 }
+
+                //修改
+                imageView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_trade",threeCode = "client_accountmanage_trade_userupdate") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
+                    onThrottleFirstClick {
+                        val intent = Intent()
+                        intent.putExtra("type","2")
+                        intent.putExtra("data",data.value)
+                        intent.setClass(context, AddTransactionUserActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+                    imageResource = R.drawable.ic_rma_change_img
+                }.lparams(autoSize(43), autoSize(43)){
+                    marginStart = autoSize(37)
+                }
                 emptyView()
 
                 imageView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_trade",threeCode = "client_accountmanage_trade_add") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     onThrottleFirstClick {
-                        if (data.value?.usertype == "2"){// usertype 2-机构 7-企业成员(云平台
-                            val intent = Intent()
-                            intent.putExtra("type","1")
-                            intent.putExtra("data",data.value)
-                            intent.putExtra("data1",AccMgrLoginUserData())
-                            intent.putExtra("seletType", viewModel.getPassRoleList() as Serializable)
-                            intent.setClass(context,AddRoleActivity::class.java)
-                            ActivityUtils.startActivity(intent)
-                        }else{
-                            val intent = Intent()
-                            intent.putExtra("type","1")
-                            intent.putExtra("data",data.value)
-                            intent.putExtra("data1",AccMgrLoginUserData())
-                            intent.putExtra("seletType", viewModel.getPassRoleList() as Serializable)
-                            intent.setClass(context,AddLoginRoleActivity::class.java)
-                            ActivityUtils.startActivity(intent)
-                        }
+                        val intent = Intent()
+                        intent.putExtra("type","1")
+                        intent.putExtra("data",data.value)
+                        intent.putExtra("rolename",data.value?.rolename)
+                        intent.putExtra("data1",Userlist())
+                        intent.putExtra("seletType", viewModel.getPassRoleList() as Serializable)
+                        intent.setClass(context,AddTradingLoginRoleActivity::class.java)
+                        ActivityUtils.startActivity(intent)
                     }
                     imageResource = R.mipmap.rma_account_add
                 }.lparams(autoSize(43), autoSize(43)){
@@ -100,13 +115,19 @@ class TradingManagerViewHolder(
                         visibility = View.VISIBLE
                     }
                 }
+
                 background = resources.getDrawable(R.color.white)
-                adapter = accountUserAdapter
+
+                data.bindOptional(context){
+                    //期货合约
+                    val accountUserAdapter: BaseAdapter<Userlist, TradingUserViewHolder> =
+                        BaseAdapter { _, _ -> TradingUserViewHolder(activity, viewModel,dataIndex,it?.rolename ?: "") }
+                    adapter = accountUserAdapter
+                    accountUserAdapter.setNewData(it?.userlist)
+                }
             }.lparams(matchParent, wrapContent)
 
-            data.bindOptional(context){
-                accountUserAdapter.setNewData(it?.userlist)
-            }
+
         }
     }
 

+ 40 - 6
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/bussinessaccount/TradingUserViewHolder.kt

@@ -6,6 +6,7 @@ import android.view.Gravity
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AccMgrLoginUserData
 import cn.muchinfo.rma.global.data.Userlist
 import cn.muchinfo.rma.global.loginstatus
@@ -17,6 +18,8 @@ import cn.muchinfo.rma.view.autoWidget.textSizeAuto
 import cn.muchinfo.rma.view.base.home.accountmanager.AccountManagerViewModel
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.rolemanagement.AddRoleActivity
+import cn.muchinfo.rma.view.base.home.rolemanagement.AddTradingLoginRoleActivity
+import cn.muchinfo.rma.view.base.home.rolemanagement.ResetAccountPasswordActivity
 import com.blankj.utilcode.util.ActivityUtils
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
 import org.jetbrains.anko.*
@@ -31,7 +34,8 @@ import java.io.Serializable
 class TradingUserViewHolder(
     private val activity: AppCompatActivity,
     private val viewModel: AccountManagerViewModel,
-    private val index : Int
+    private val index : Int,
+    private val rolename : String//所属的交易用户
 ) : BaseViewHolder<Userlist>(activity) {
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
@@ -49,14 +53,14 @@ class TradingUserViewHolder(
             }
 
             onThrottleFirstClick {
-                viewModel.setOnLoginSonItemClick(index = index,sonIndex = dataIndex)
+                viewModel.setOnTradingSonItemClick(index = index,sonIndex = dataIndex)
             }
 
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
                 textView {
                     data.bindOptional(context) {
-                        text = it?.rolename
+                        text = it?.logincode + "       " +  it?.userid
                     }
                     textColorInt = R.color.rma_black_33
                     textSizeAuto = 31
@@ -96,10 +100,11 @@ class TradingUserViewHolder(
                     onThrottleFirstClick {
                         val intent = Intent()
                         intent.putExtra("data1",data.value)
+                        intent.putExtra("rolename",rolename)
                         intent.putExtra("data", AccMgrLoginUserData())
                         intent.putExtra("seletType", arrayListOf<AccMgrLoginUserData>() as Serializable)
                         intent.putExtra("type","2")
-                        intent.setClass(context,AddRoleActivity::class.java)
+                        intent.setClass(context, AddTradingLoginRoleActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
@@ -112,6 +117,11 @@ class TradingUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_trade_add",threeCode = "client_accountmanage_trade_update") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -122,10 +132,11 @@ class TradingUserViewHolder(
                     onThrottleFirstClick {
                         val intent = Intent()
                         intent.putExtra("data1",data.value)
+                        intent.putExtra("rolename",rolename)
                         intent.putExtra("data", AccMgrLoginUserData())
                         intent.putExtra("seletType", arrayListOf<AccMgrLoginUserData>() as Serializable)
                         intent.putExtra("type","3")
-                        intent.setClass(context,AddRoleActivity::class.java)
+                        intent.setClass(context,AddTradingLoginRoleActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
@@ -138,6 +149,11 @@ class TradingUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_trade_add",threeCode = "client_accountmanage_trade_resetpwd") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -146,7 +162,10 @@ class TradingUserViewHolder(
                         }
                     }
                     onThrottleFirstClick {
-
+                        val intent = Intent()
+                        intent.putExtra("logincode",data.value?.logincode)
+                        intent.setClass(context, ResetAccountPasswordActivity::class.java)
+                        ActivityUtils.startActivity(intent)
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
                     gravity = Gravity.CENTER
@@ -158,6 +177,11 @@ class TradingUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_trade_add",threeCode = "client_accountmanage_trade_lock") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -184,6 +208,11 @@ class TradingUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_trade_add",threeCode = "client_accountmanage_trade_close") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -209,6 +238,11 @@ class TradingUserViewHolder(
                     marginEnd = autoSize(24)
                 }
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_trade_add",threeCode = "client_accountmanage_trade_unlock") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "2"){
                             visibility = View.VISIBLE

+ 17 - 18
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/futureaccount/AddFutureAccountActivity.kt

@@ -8,6 +8,7 @@ import android.view.inputmethod.EditorInfo
 import android.widget.EditText
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
@@ -313,9 +314,9 @@ class AddFutureAccountActivity : BaseActivity<FutureAccountViewModel>(){
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
-                    creatBottomSheetDialog("请选择指定交易用户", viewModel.getCanSelectTradingAccount()) {
-                        viewModel.selectTradingAccountData.postValue(this)
-                    }
+//                    creatBottomSheetDialog("请选择指定交易用户", viewModel.getCanSelectTradingAccount()) {
+//                        viewModel.selectTradingAccountData.postValue(this)
+//                    }
                 }
                 textView {
                     text = "指定交易用户"
@@ -326,26 +327,24 @@ class AddFutureAccountActivity : BaseActivity<FutureAccountViewModel>(){
                 }
 
                 textView {
-                    viewModel.selectTradingAccountData.bindOptional(context){
-                        text = it?.value
-                        textColorInt = R.color.rma_black_33
-                    }
-                    text = "请选择指定交易用户"
+                    text = GlobalDataCollection.instance?.userAccountData?.accountname
+                    textColorInt = R.color.rma_black_33
                     textSizeAuto = 31
-                    textColorInt = R.color.rma_hint_text_color_ccc
                 }.lparams(wrapContent, wrapContent){
                     marginStart = autoSize(110)
                 }
 
                 emptyView()
 
-                imageView {
-                    imageResource = R.mipmap.rma_more
-                }.lparams(autoSize(43), autoSize(43))
+//                imageView {
+//                    imageResource = R.mipmap.rma_more
+//                }.lparams(autoSize(43), autoSize(43))
 
                 imageView {
+                    visibility = View.GONE
                     onThrottleFirstClick {
                         val intent = Intent()
+                        intent.putExtra("type","1")
                         intent.setClass(context,AddTransactionUserActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
@@ -398,7 +397,7 @@ class AddFutureAccountActivity : BaseActivity<FutureAccountViewModel>(){
                             hedgeaccountpwd = password.text.toString(),
                             hedgeaccountcode = login_account.text.toString(),
                             fcid = viewModel.selectFuturesCompany.value?.id?.toLong() ?: 0,
-                            relateduserid = viewModel.selectTradingAccountData.value?.id?.toLong() ?: 0
+                            relateduserid = GlobalDataCollection.instance?.loginRsp?.userID?.toLong() ?: 0
                         ){
                             finish()
                         }
@@ -428,7 +427,7 @@ class AddFutureAccountActivity : BaseActivity<FutureAccountViewModel>(){
                             hedgeaccountpwd = password.text.toString(),
                             hedgeaccountcode = login_account.text.toString(),
                             fcid = viewModel.selectFuturesCompany.value?.id?.toLong() ?: 0,
-                            relateduserid = viewModel.selectTradingAccountData.value?.id?.toLong() ?: 0
+                            relateduserid = GlobalDataCollection.instance?.loginRsp?.userID?.toLong() ?: 0
                         ){
                             finish()
                         }
@@ -472,10 +471,10 @@ class AddFutureAccountActivity : BaseActivity<FutureAccountViewModel>(){
             return false
         }
 
-        if (viewModel.selectTradingAccountData.value?.id.isNullOrEmpty()){
-            ToastUtils.showLong("请选择交易用户")
-            return false
-        }
+//        if (viewModel.selectTradingAccountData.value?.id.isNullOrEmpty()){
+//            ToastUtils.showLong("请选择交易用户")
+//            return false
+//        }
 //        if (authorization_code.text.toString().isNullOrEmpty()){
 //            ToastUtils.showLong("请输入授权码")
 //            return false

+ 9 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/futureaccount/AddFutureSonAccountActivity.kt

@@ -283,6 +283,7 @@ class AddFutureSonAccountActivity : BaseActivity<FutureAccountViewModel>() {
                 imageView {
                     onThrottleFirstClick {
                         val intent = Intent()
+                        intent.putExtra("type","1")
                         intent.setClass(context,AddTransactionUserActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
@@ -316,7 +317,8 @@ class AddFutureSonAccountActivity : BaseActivity<FutureAccountViewModel>() {
                                 parentaccountid = data.parentaccountid?.toLong() ?: 0,
                                 tradefeetmpid = viewModel.select_forward_commission.value?.id?.toLong() ?: 0,
                                 trademargintmpid = viewModel.select_futures_margin.value?.id?.toLong() ?: 0,
-                                fromaccountid = data.parentaccountid?.toLong() ?: 0
+                                fromaccountid = data.parentaccountid?.toLong() ?: 0,
+                                relateduserid = viewModel.selectTradingAccountData.value?.id?.toLong() ?: 0
                             ){
                                 finish()
                             }
@@ -328,7 +330,8 @@ class AddFutureSonAccountActivity : BaseActivity<FutureAccountViewModel>() {
                                 tradefeetmpid = viewModel.select_forward_commission.value?.id?.toLong() ?: 0,
                                 trademargintmpid = viewModel.select_futures_margin.value?.id?.toLong() ?: 0,
                                 fromaccountid = data.parentaccountid?.toLong() ?: 0,
-                                accountid = dataSon.accountid?.toLong() ?: 0
+                                accountid = dataSon.accountid?.toLong() ?: 0,
+                                relateduserid = viewModel.selectTradingAccountData.value?.id?.toLong() ?: 0
                             ){
                                 finish()
                             }
@@ -364,6 +367,10 @@ class AddFutureSonAccountActivity : BaseActivity<FutureAccountViewModel>() {
             ToastUtils.showLong("请输入名称")
             return false
         }
+        if (viewModel.selectTradingAccountData.value?.id.isNullOrEmpty()){
+            ToastUtils.showLong("请选择交易用户")
+            return false
+        }
         return true
     }
 }

+ 70 - 7
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/futureaccount/AddTransactionUserActivity.kt

@@ -6,31 +6,51 @@ import android.view.View
 import android.view.inputmethod.EditorInfo
 import android.widget.EditText
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.AccMgrLoginUserData
+import cn.muchinfo.rma.global.data.AccMgrTaaccountData
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.jetbrains.anko.*
 
 /**
  * 创建交易用户
  */
-class AddTransactionUserActivity : BaseActivity<FutureAccountViewModel>(){
+class AddTransactionUserActivity : BaseActivity<FutureAccountViewModel>() {
+
+    //1是新增 2是修改
+    private val type by lazy { intent.getStringExtra("type") }
+
+    //用于修改时的数据回填
+    private val data by lazy { intent.getParcelableExtra<AccMgrLoginUserData>("data") as AccMgrLoginUserData }
 
     /** 用户名称 **/
-    lateinit var user_name : EditText
+    lateinit var user_name: EditText
 
     /** 手机号码 **/
-    lateinit var phone_number : EditText
+    lateinit var phone_number: EditText
+
+    val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
+
         verticalLayout {
+            dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
             background = resources.getDrawable(R.color.main_hit_bg_color)
             //页面标题
             topBar {
                 commonLeftButton()
                 commonTitle {
-                    text = "创建交易用户"
+                    if (type == "1") {
+                        text = "创建交易用户"
+                    } else {
+                        text = "修改交易用户"
+                    }
+
                 }
             }
 
@@ -55,8 +75,11 @@ class AddTransactionUserActivity : BaseActivity<FutureAccountViewModel>(){
                 }
 
                 editText {
+                    if (type == "2") {
+                        setText(data.rolename)
+                    }
                     user_name = this
-                    hint = "请输入账户名称"
+                    hint = "请输入户名称"
                     background = null
                     inputType = EditorInfo.TYPE_CLASS_TEXT
 //                    setDecimalInputType()
@@ -91,8 +114,11 @@ class AddTransactionUserActivity : BaseActivity<FutureAccountViewModel>(){
                 }
 
                 editText {
+                    if (type == "2") {
+                        setText(data.mobile)
+                    }
                     phone_number = this
-                    hint = "请输入期货登录账户"
+                    hint = "请输入手机号码"
                     background = null
                     inputType = EditorInfo.TYPE_CLASS_TEXT
 //                    setDecimalInputType()
@@ -107,7 +133,7 @@ class AddTransactionUserActivity : BaseActivity<FutureAccountViewModel>(){
 
             view {
 
-            }.lparams(autoSize(1),0,1f)
+            }.lparams(autoSize(1), 0, 1f)
 
             linearLayout {
                 background = resources.getDrawable(R.color.white)
@@ -115,6 +141,29 @@ class AddTransactionUserActivity : BaseActivity<FutureAccountViewModel>(){
 
                 textView {
                     onThrottleFirstClick {
+                        if (check().not()) {
+                            return@onThrottleFirstClick
+                        }
+                        if (type == "1") {
+                            viewModel.LoginaccountOperateReq(
+                                operatetype = 1,
+                                accountname = user_name.text.toString(),
+                                mobile = phone_number.text.toString(),
+                                roleids = arrayListOf(24)
+                            ) {
+                                finish()
+                            }
+                        } else {
+                            viewModel.LoginaccountOperateReq(
+                                operatetype = 13,
+                                userid = data.roleid?.toLong() ?: 0,
+                                accountname = user_name.text.toString(),
+                                mobile = phone_number.text.toString(),
+                                roleids = arrayListOf()
+                            ) {
+                                finish()
+                            }
+                        }
 
                     }
                     gravity = Gravity.CENTER
@@ -130,4 +179,18 @@ class AddTransactionUserActivity : BaseActivity<FutureAccountViewModel>(){
         }
     }
 
+
+    fun check(): Boolean {
+        if (user_name.text.toString().isNullOrEmpty()) {
+            ToastUtils.showLong("请输入用户名称")
+            return false
+        }
+
+        if (phone_number.text.toString().isNullOrEmpty()) {
+            ToastUtils.showLong("请输入手机号码")
+            return false
+        }
+        return true
+    }
+
 }

+ 54 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/futureaccount/FutureAccountViewModel.kt

@@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.netManage.base.InteractiveException
+import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI2
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
 import kotlinx.coroutines.GlobalScope
@@ -360,4 +361,57 @@ class FutureAccountViewModel : BaseViewModel(){
             }
         }
     }
+
+    /**
+     * 登录账户操作请求报文装箱
+     * @param operatetype Int 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码
+     * @param userid Long 用户ID(新增成功接口返回的userid)
+     * @param loginid Long 登录ID(新增成功接口返回的loginid)
+     * @param logincode String 登录账号
+     * @param accountname String 账户名称
+     * @param password String 登录密码(明文)
+     * @param mobile String 手机号码(明文)
+     * @param roleids List<Long> 账号角色
+     * @param logintaaccounts List<LoginTaaccount> 期货账户(勾选交易员必填)
+     * @return Packet50
+     */
+    fun LoginaccountOperateReq(
+        operatetype : Int,
+        userid : Long = 0,
+        loginid : Long = 0,
+        logincode : String = "",
+        accountname : String = "",
+        password : String = "",
+        mobile : String = "",
+        roleids : List<Long>,
+        logintaaccounts : List<ManageServiceMI2.LoginTaaccount> = arrayListOf(),
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.accountManager?.LoginaccountOperateReq(
+                operatetype = operatetype,
+                logincode = logincode,
+                userid = userid,
+                accountname = accountname,
+                password = password,
+                mobile = mobile,
+                roleids = roleids
+            ){ isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
 }

+ 14 - 18
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/manageaccount/ManagerAccountViewHolder.kt

@@ -6,6 +6,7 @@ import android.view.Gravity
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AccMgrLoginUserData
 import cn.muchinfo.rma.global.data.Userlist
 import cn.muchinfo.rma.lifecycle.bindOptional
@@ -46,7 +47,7 @@ class ManagerAccountViewHolder(
                 gravity = Gravity.CENTER_VERTICAL
                 imageView {
                     onThrottleFirstClick {
-                        viewModel.setOnLoginAccountHedgeClick(dataIndex)
+                        viewModel.setOnManagerAccountHedgeClick(dataIndex)
                     }
                     imageResource = R.mipmap.second_list_floding
                 }.lparams(autoSize(43), autoSize(43))
@@ -63,24 +64,19 @@ class ManagerAccountViewHolder(
                 emptyView()
 
                 imageView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage",threeCode = "client_accountmanage_add") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     onThrottleFirstClick {
-                        if (data.value?.usertype == "2"){// usertype 2-机构 7-企业成员(云平台
-                            val intent = Intent()
-                            intent.putExtra("type","1")
-                            intent.putExtra("data",data.value)
-                            intent.putExtra("data1",AccMgrLoginUserData())
-                            intent.putExtra("seletType", viewModel.getPassRoleList() as Serializable)
-                            intent.setClass(context,AddRoleActivity::class.java)
-                            ActivityUtils.startActivity(intent)
-                        }else{
-                            val intent = Intent()
-                            intent.putExtra("type","1")
-                            intent.putExtra("data",data.value)
-                            intent.putExtra("data1",AccMgrLoginUserData())
-                            intent.putExtra("seletType", viewModel.getPassRoleList() as Serializable)
-                            intent.setClass(context,AddLoginRoleActivity::class.java)
-                            ActivityUtils.startActivity(intent)
-                        }
+                        val intent = Intent()
+                        intent.putExtra("type","1")
+                        intent.putExtra("data",data.value)
+                        intent.putExtra("data1",Userlist())
+                        intent.putExtra("seletType", viewModel.getPassRoleList() as Serializable)
+                        intent.setClass(context,AddRoleActivity::class.java)
+                        ActivityUtils.startActivity(intent)
                     }
                     imageResource = R.mipmap.rma_account_add
                 }.lparams(autoSize(43), autoSize(43)){

+ 27 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/accountmanager/manageaccount/ManagerUserViewHolder.kt

@@ -6,6 +6,7 @@ import android.view.Gravity
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.AccMgrLoginUserData
 import cn.muchinfo.rma.global.data.Userlist
 import cn.muchinfo.rma.global.loginstatus
@@ -49,7 +50,7 @@ class ManagerUserViewHolder(
             }
 
             onThrottleFirstClick {
-                viewModel.setOnLoginSonItemClick(index = index,sonIndex = dataIndex)
+                viewModel.setOnManagerSonItemClick(index = index,sonIndex = dataIndex)
             }
 
             linearLayout {
@@ -112,6 +113,11 @@ class ManagerUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage",threeCode = "client_accountmanage_update") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -138,6 +144,11 @@ class ManagerUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage",threeCode = "client_accountmanage_resetpwd") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -158,6 +169,11 @@ class ManagerUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage",threeCode = "client_accountmanage_lock") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -184,6 +200,11 @@ class ManagerUserViewHolder(
                 }
 
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage",threeCode = "client_accountmanage_close") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "1"){
                             visibility = View.VISIBLE
@@ -209,6 +230,11 @@ class ManagerUserViewHolder(
                     marginEnd = autoSize(24)
                 }
                 textView {
+                    if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_accountmanage",secondCode = "client_accountmanage_manage",threeCode = "client_accountmanage_unlock") == true){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                     data.bindOptional(context){
                         if (it?.loginstatus == "2"){
                             visibility = View.VISIBLE

+ 3 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/NewCommodityInformationActivity.kt

@@ -66,7 +66,7 @@ class NewCommodityInformationActivity : BaseActivity<NewCommodityInformationView
         }
         if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_deliverygoods",secondCode = "client_deliverygoods_hedge") == true){
             newTabsArray.add("现货品种")
-            uiList.add(newSpotVarietiesUI.root)
+            uiList.add(newHedgeSpeciesUI.root)
         }
         newPagerAdapter = object : PagerAdapter() {
 
@@ -203,7 +203,7 @@ class NewCommodityInformationActivity : BaseActivity<NewCommodityInformationView
                                 if (selectedTabIndex == 0){
                                      onThrottleFirstClick {
                                         showPopups(context = context,textString = "1,品类对应的是标仓系数,是非标商品转换成现货品种的系数;\n现货品种数量=现货品类数量*标仓系数。\n2,套保品种对应的是套保系数,是现货品中转换成套保品种的系数;\n" +
-                                                "套保品种数量=现货品种数量*套保系统\n3,期货品种对应的是期货品种系数,是期货品种转换成套保品种的系数。\n套保品种数量=期货品种数量*期货品种系数。",v = this,weight = 400)
+                                                "套保品种数量=现货品种数量*套保系统\n3,期货品种对应的是期货品种系数,是期货品种转换成套保品种的系数。\n套保品种数量=期货品种数量*期货品种系数。",v = this,weight = 350)
                                     }
                                 }
                             }
@@ -228,7 +228,7 @@ class NewCommodityInformationActivity : BaseActivity<NewCommodityInformationView
                                     onThrottleFirstClick {
                                         showPopups(context = context,textString = "1,品类对应的是标仓系数,是非标商品转换成现货品种的系数;\n现货品种数量=现货品类数量*标仓系数。\n2,套保品种对应的是套保系数,是现货品中转换成套保品种的系数;\n" +
                                                 "套保品种数量=现货品种数量*套保系统\n3,期货品种对应的是期货品种系数,是期货品种转换成套保品种的系数。\n套保品种数量=期货品种数量*期货品种系数。\n" +
-                                                "4,期货合约对应的是期货合约乘数,是期货合约转换成期货品种的系数;\n期货品种数量=期货合约手数*期货合约乘数。",v = this,weight = 400)
+                                                "4,期货合约对应的是期货合约乘数,是期货合约转换成期货品种的系数;\n期货品种数量=期货合约手数*期货合约乘数。",v = this,weight = 350)
                                     }
                                 }
                             }

+ 36 - 10
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/AddLoginRoleActivity.kt

@@ -37,7 +37,7 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
     /**
      * 1 新增 2 详情 3 修改 4 锁定 5 注销
      */
-    val type by lazy { intent.getSerializableExtra("type") }
+    val type by lazy { intent.getStringExtra("type") }
 
     /**
      * 传入的可供选择的账户角色类型
@@ -97,10 +97,22 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
      */
     fun init() {
         if (type == "1") {
-            viewModel.queryAccMgrTaaccount()
+            viewModel.queryAccMgrTaaccount("1",data1)
             isSalesman.postValue(SelectData(id = "0", value = "业务员"))
             isMerchandiser.postValue(SelectData(id = "0", value = "跟单员"))
             isTraders.postValue(SelectData(id = "0", value = "交易员"))
+        } else  {
+            if (data1.roletype?.contains("22") == true){
+                isSalesman.postValue(SelectData(id = "22", value = "业务员"))
+            }
+            if (data1.roletype?.contains("23") == true){
+                isMerchandiser.postValue(SelectData(id = "23", value = "跟单员"))
+            }
+            if (data1.roletype?.contains("24") == true){
+                isTraders.postValue(SelectData(id = "24", value = data1.rolename ?: ""))
+            }else{
+                isTraders.postValue(SelectData(id = "0", value = "交易员"))
+            }
         }
     }
 
@@ -153,9 +165,9 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                             }
 
                             editText {
-                                isEnabled = type == "1" || type == "3"
+                                isEnabled = type == "1"
                                 if (type != "1") {
-                                    setText(data1.rolename)
+                                    setText(data1.logincode)
                                 }
                                 login_account = this
                                 hint = "请输入登录账号"
@@ -213,6 +225,11 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                         itemView()
 
                         linearLayout {
+                            if (type == "3"){
+                                visibility = View.GONE
+                            }else{
+                                visibility = View.VISIBLE
+                            }
                             background = resources.getDrawable(R.color.white)
                             gravity = Gravity.CENTER_VERTICAL
 
@@ -256,6 +273,7 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
 
 
                         linearLayout {
+
                             background = resources.getDrawable(R.color.white)
                             gravity = Gravity.CENTER_VERTICAL
 
@@ -279,7 +297,7 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                                 phone_number = this
                                 isEnabled = type == "1" || type == "3"
                                 if (type != "1") {
-                                    setText("")
+                                    setText(data1.mobile)
                                 }
                                 hint = "非必填,用于找回密码"
                                 background = null
@@ -335,7 +353,7 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                                             imageResource = R.mipmap.rma_select_click
                                         }
                                     }
-
+                                    imageResource = R.mipmap.rma_normal_click
                                 }.lparams(autoSize(25), autoSize(25)) {
                                     marginStart = autoSize(80)
                                 }
@@ -376,6 +394,7 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                                             imageResource = R.mipmap.rma_select_click
                                         }
                                     }
+                                    imageResource = R.mipmap.rma_normal_click
                                 }.lparams(autoSize(25), autoSize(25)) {
                                     marginStart = autoSize(20)
                                 }
@@ -425,6 +444,7 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                         linearLayout {
                             background = resources.getDrawable(R.color.white)
                             gravity = Gravity.CENTER_VERTICAL
+                            visibility = View.GONE
                             isTraders.bindOptional(context) {
                                 if (it?.id == "0") {
                                     visibility = View.GONE
@@ -480,7 +500,11 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                 linearLayout {
                     background = resources.getDrawable(R.color.white)
                     gravity = Gravity.CENTER_VERTICAL
-
+                    if (type == "2"){
+                        visibility = View.GONE
+                    }else{
+                        visibility = View.VISIBLE
+                    }
 
                     textView {
                         onThrottleFirstClick {
@@ -502,9 +526,8 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                             } else if (type == "3") {//修改
                                 viewModel.LoginaccountOperateReq(
                                     operatetype = 2,
-                                    logincode = login_account.text.toString(),
+                                    userid = data1.userid?.toLong() ?: 0,
                                     accountname = account_name.text.toString(),
-                                    password = login_password.text.toString(),
                                     mobile = phone_number.text.toString(),
                                     roleids = getSelectDataList(),
                                     logintaaccounts = getSelectFuture()
@@ -576,10 +599,13 @@ class AddLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
             ToastUtils.showLong("请输入账户名称")
             return false
         }
-        if (login_password.text.toString().isNullOrEmpty()) {
+        if (type == "1"){
+              if (login_password.text.toString().isNullOrEmpty()) {
             ToastUtils.showLong("请输入登录密码")
             return false
         }
+        }
+
         if (isSalesman.value?.id == "0" && isMerchandiser.value?.id == "0" && isTraders.value?.id == "0"){
             ToastUtils.showLong("请选择角色")
             return false

+ 8 - 6
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/AddRoleActivity.kt

@@ -33,7 +33,7 @@ class AddRoleActivity : BaseActivity<RoleSetViewModel>() {
     /**
      * 1 新增 2 详情 3 修改 4 锁定 5 注销
      */
-    val type by lazy { intent.getSerializableExtra("type") }
+    val type by lazy { intent.getStringExtra("type") }
 
     /**
      * 传入的可供选择的账户角色类型
@@ -81,8 +81,8 @@ class AddRoleActivity : BaseActivity<RoleSetViewModel>() {
     fun init() {
         roleTypeSelectData.postValue(
             SelectData(
-                id = data.roleid ?: "",
-                value = data.rolename ?: ""
+                id = data1.roletype ?: "",
+                value = data1.rolename ?: ""
             )
         )
     }
@@ -257,8 +257,10 @@ class AddRoleActivity : BaseActivity<RoleSetViewModel>() {
                 editText {
                     phone_number = this
                     isEnabled = type == "1" || type == "3"
-                    if (type != "1"){
+                    if (type == "1"){
                         setText("")
+                    }else{
+                        setText(data1.mobile)
                     }
                     hint = "非必填,用于找回密码"
                     background = null
@@ -278,7 +280,7 @@ class AddRoleActivity : BaseActivity<RoleSetViewModel>() {
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
-                    if (type == "1"){
+                    if (type == "2"){
                         return@onThrottleFirstClick
                     }
                     creatBottomSheetDialog("请选择合同类型", getSelectDataList()) {
@@ -387,7 +389,7 @@ class AddRoleActivity : BaseActivity<RoleSetViewModel>() {
 //        }
         selectList.add(SelectData(id = "22",value = "业务员"))
         selectList.add(SelectData(id = "23",value = "跟单员"))
-        selectList.add(SelectData(id = "24",value = "交易员"))
+//        selectList.add(SelectData(id = "24",value = "交易员"))
         return selectList
     }
 

+ 38 - 30
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/AddTradingLoginRoleActivity.kt

@@ -8,10 +8,7 @@ import android.widget.EditText
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.MTPEnums
-import cn.muchinfo.rma.global.data.AccMgrLoginUserData
-import cn.muchinfo.rma.global.data.AccMgrRoleMenuData
-import cn.muchinfo.rma.global.data.AccMgrTaaccountSonData
-import cn.muchinfo.rma.global.data.Userlist
+import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI2
 import cn.muchinfo.rma.view.autoWidget.*
@@ -37,9 +34,13 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
     /**
      * 1 新增 2 详情 3 修改 4 锁定 5 注销
      */
-    val type by lazy { intent.getSerializableExtra("type") }
+    val type by lazy { intent.getStringExtra("type") }
 
     /**
+     *  rolename
+     */
+    val rolename by lazy { intent.getStringExtra("rolename") }
+    /**
      * 传入的可供选择的账户角色类型
      */
     val seletType by lazy { intent.getSerializableExtra("seletType") as List<AccMgrLoginUserData> }
@@ -96,11 +97,11 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
      * 页面数据的初始化
      */
     fun init() {
+        viewModel.queryAccMgrTaaccount(type ?: "",data = data1)
         if (type == "1") {
-            viewModel.queryAccMgrTaaccount()
-            isSalesman.postValue(SelectData(id = "0", value = "业务员"))
-            isMerchandiser.postValue(SelectData(id = "0", value = "跟单员"))
-            isTraders.postValue(SelectData(id = "0", value = "交易员"))
+            isTraders.postValue(SelectData(id = "24", value = "交易员"))
+        }else{
+//            isTraders.postValue(SelectData(id = "0", value = "交易员"))
         }
     }
 
@@ -118,9 +119,9 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                     if (type == "1") {
                         text = "新增交易员"
                     } else if (type == "2") {
-                        text = "登录账户详情"
+                        text = "交易员账户详情"
                     } else if (type == "3") {
-                        text = "修改账户"
+                        text = "修改交易员"
                     } else if (type == "4") {
                         text = "锁定"
                     } else if (type == "5") {
@@ -144,6 +145,7 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                             }.lparams(wrapContent, wrapContent) {
                                 marginStart = autoSize(37)
                             }
+
                             textView {
                                 text = "所属用户"
                                 textSizeAuto = 31
@@ -153,7 +155,8 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                             }
 
                             textView {
-                                text = "所属用户"
+                                gravity = Gravity.CENTER_VERTICAL
+                                text = rolename ?: ""
                                 textColorInt = R.color.rma_black_33
                                 textSizeAuto = 31
                             }.lparams(matchParent, autoSize(132)) {
@@ -226,7 +229,7 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                                 account_name = this
                                 isEnabled = type == "1" || type == "3"
                                 if (type != "1") {
-                                    setText(data1.accountname)
+                                    setText(data1.loginname)
                                 }
                                 hint = "请输入账户名称"
                                 background = null
@@ -245,7 +248,11 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                         linearLayout {
                             background = resources.getDrawable(R.color.white)
                             gravity = Gravity.CENTER_VERTICAL
-
+                            if (type == "3"){
+                                visibility = View.GONE
+                            }else{
+                                visibility = View.VISIBLE
+                            }
                             textView {
                                 visibility = View.INVISIBLE
                                 text = "*"
@@ -278,13 +285,10 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                             }.lparams(matchParent, autoSize(132)) {
                                 marginStart = autoSize(80)
                             }
-
-
                         }.lparams(matchParent, autoSize(132))
 
                         itemView()
 
-
                         linearLayout {
                             background = resources.getDrawable(R.color.white)
                             gravity = Gravity.CENTER_VERTICAL
@@ -309,7 +313,7 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                                 phone_number = this
                                 isEnabled = type == "1" || type == "3"
                                 if (type != "1") {
-                                    setText("")
+                                    setText(data1.mobile)
                                 }
                                 hint = "非必填,用于找回密码"
                                 background = null
@@ -459,7 +463,11 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                                 if (it?.id == "0") {
                                     visibility = View.GONE
                                 } else {
-                                    visibility = View.VISIBLE
+                                    if (type == "2"){
+                                        visibility = View.GONE
+                                    }else{
+                                        visibility = View.VISIBLE
+                                    }
                                 }
                             }
                             textView {
@@ -510,16 +518,21 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                 linearLayout {
                     background = resources.getDrawable(R.color.white)
                     gravity = Gravity.CENTER_VERTICAL
-
+                    if (type == "2"){
+                        visibility = View.GONE
+                    }else{
+                        visibility = View.VISIBLE
+                    }
 
                     textView {
                         onThrottleFirstClick {
                             if (check().not()) {
                                 return@onThrottleFirstClick
                             }
-                            if (type == "1") {// 1 新增 2 详情 3 修改 4 锁定 5 注销
+                            if (type == "1") {//  operatetype 1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码 10:新增登录帐号 11:停用用户 12:恢复用户 13:修改用户信息
                                 viewModel.LoginaccountOperateReq(
-                                    operatetype = 1,
+                                    operatetype = 10,
+                                    userid = data.roleid?.toLong() ?: 0,
                                     logincode = login_account.text.toString(),
                                     accountname = account_name.text.toString(),
                                     password = login_password.text.toString(),
@@ -529,12 +542,13 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
                                 ) {
                                     finish()
                                 }
-                            } else if (type == "3") {//修改
+                            } else if (type == "3") {//修改 operatetype 1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码 10:新增登录帐号 11:停用用户 12:恢复用户 13:修改用户信息
                                 viewModel.LoginaccountOperateReq(
                                     operatetype = 2,
+                                    userid = data1.userid?.toLong() ?: 0,
+                                    loginid = data1.loginid?.toLong() ?: 0,
                                     logincode = login_account.text.toString(),
                                     accountname = account_name.text.toString(),
-                                    password = login_password.text.toString(),
                                     mobile = phone_number.text.toString(),
                                     roleids = getSelectDataList(),
                                     logintaaccounts = getSelectFuture()
@@ -565,12 +579,6 @@ class AddTradingLoginRoleActivity : BaseActivity<RoleSetViewModel>() {
      */
     fun getSelectDataList(): List<Long> {
         val newDataList = arrayListOf<Long>()
-        if (isSalesman.value?.id != "0") {
-            newDataList.add(isSalesman.value?.id?.toLong() ?: 22)
-        }
-        if (isMerchandiser.value?.id != "0") {
-            newDataList.add(isMerchandiser.value?.id?.toLong() ?: 23)
-        }
         if (isTraders.value?.id != "0"){
             newDataList.add(isTraders.value?.id?.toLong() ?: 24)
         }

+ 261 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/ResetAccountPasswordActivity.kt

@@ -0,0 +1,261 @@
+package cn.muchinfo.rma.view.base.home.rolemanagement
+
+import android.os.Bundle
+import android.view.Gravity
+import android.view.View
+import android.view.inputmethod.EditorInfo
+import android.widget.EditText
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
+import org.jetbrains.anko.*
+
+/**
+ * 用户重置密码
+ */
+class ResetAccountPasswordActivity : BaseActivity<ResetAccountPasswordViewModel>(){
+
+    val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
+
+    private val logincode by lazy { intent.getStringExtra("logincode") }
+
+    /**
+     * 输入的原密码
+     */
+    lateinit var old_password : EditText
+
+    /**
+     * 输入的新密码
+     */
+    lateinit var new_password : EditText
+
+    /**
+     * 再次输入的新密码
+     */
+    lateinit var new_again_password : EditText
+
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        viewModel.loginidQuery(account = logincode ?: "")
+        verticalLayout {
+            dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
+            background = resources.getDrawable(R.color.main_hit_bg_color)
+            //页面标题
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "重置登录密码"
+                }
+            }
+
+            linearLayout {
+                background = resources.getDrawable(R.color.white)
+                gravity = Gravity.CENTER_VERTICAL
+
+                textView {
+                    visibility = View.INVISIBLE
+                    text = "*"
+                    textColorInt = R.color.rma_star_color
+                    textSizeAuto = 31
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(37)
+                }
+                textView {
+                    text = "登录账号:"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(10)
+                }
+
+                emptyView()
+
+                textView {
+                    text = logincode
+                    textColorInt = R.color.rma_black_33
+                    textSizeAuto = 31
+                }.lparams(wrapContent, wrapContent){
+                    marginEnd = autoSize(36)
+                }
+            }.lparams(matchParent, autoSize(132))
+
+            itemView()
+
+            linearLayout {
+                background = resources.getDrawable(R.color.white)
+                gravity = Gravity.CENTER_VERTICAL
+
+                textView {
+                    text = "*"
+                    textColorInt = R.color.rma_star_color
+                    textSizeAuto = 31
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(37)
+                }
+                textView {
+                    text = "原密码"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(10)
+                }
+
+                editText {
+                    gravity = Gravity.RIGHT
+                    old_password = this
+                    hint = "请输入原密码"
+                    background = null
+                    inputType = EditorInfo.TYPE_CLASS_TEXT
+//                    setDecimalInputType()
+                    hintColorStr = "#CCCCCC"
+                    textSizeAuto = 31
+                    textColorStr = "#333333"
+                }.lparams(matchParent, autoSize(132)) {
+                    marginStart = autoSize(80)
+                    marginEnd = autoSize(36)
+                }
+            }.lparams(matchParent, autoSize(132))
+
+            itemView()
+
+            linearLayout {
+                background = resources.getDrawable(R.color.white)
+                gravity = Gravity.CENTER_VERTICAL
+
+                textView {
+                    text = "*"
+                    textColorInt = R.color.rma_star_color
+                    textSizeAuto = 31
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(37)
+                }
+                textView {
+                    text = "新密码"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(10)
+                }
+
+                editText {
+                    gravity = Gravity.RIGHT
+                    new_password = this
+                    hint = "请输入8-20个字符的新密码"
+                    background = null
+                    inputType = EditorInfo.TYPE_CLASS_TEXT
+//                    setDecimalInputType()
+                    hintColorStr = "#CCCCCC"
+                    textSizeAuto = 31
+                    textColorStr = "#333333"
+                }.lparams(matchParent, autoSize(132)) {
+                    marginStart = autoSize(80)
+                    marginEnd = autoSize(36)
+                }
+            }.lparams(matchParent, autoSize(132))
+
+            itemView()
+
+            linearLayout {
+                background = resources.getDrawable(R.color.white)
+                gravity = Gravity.CENTER_VERTICAL
+
+                textView {
+                    text = "*"
+                    textColorInt = R.color.rma_star_color
+                    textSizeAuto = 31
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(37)
+                }
+                textView {
+                    text = "确认新密码"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(10)
+                }
+
+                editText {
+                    gravity = Gravity.RIGHT
+                    new_password = this
+                    hint = "请再次确认新密码"
+                    background = null
+                    inputType = EditorInfo.TYPE_CLASS_TEXT
+//                    setDecimalInputType()
+                    hintColorStr = "#CCCCCC"
+                    textSizeAuto = 31
+                    textColorStr = "#333333"
+                }.lparams(matchParent, autoSize(132)) {
+                    marginStart = autoSize(80)
+                    marginEnd = autoSize(36)
+                }
+            }.lparams(matchParent, autoSize(132))
+
+            linearLayout {
+                    background = resources.getDrawable(R.color.white)
+                    gravity = Gravity.CENTER_VERTICAL
+
+                    textView {
+                        onThrottleFirstClick {
+                            if (check().not()){
+                                return@onThrottleFirstClick
+                            }
+
+                            viewModel.LoginaccountOperateReq(
+                                operatetype = 1,
+                                loginid = viewModel.loginInfoAccount.value?.toLong() ?: 0,
+                                password = new_password.text.toString()
+                            ) {
+                                finish()
+                            }
+
+                        }
+                        gravity = Gravity.CENTER
+                        backgroundResource = R.mipmap.rma_submit_bg
+                        text = "提交"
+                        textColorInt = R.color.white
+                        textSizeAuto = 38
+                    }.lparams(matchParent, autoSize(119)) {
+                        marginStart = autoSize(60)
+                        marginEnd = autoSize(60)
+                    }
+                 }.lparams(matchParent, autoSize(144)) {
+                    gravity = Gravity.BOTTOM
+                }
+        }
+    }
+
+    /**
+     * 数据提交前的校验
+     * @return Boolean
+     */
+    fun check() : Boolean{
+        if (old_password.text.toString().isNullOrEmpty()){
+            ToastUtils.showLong("请输入原密码")
+            return false
+        }
+
+        if (new_password.text.toString().isNullOrEmpty()){
+            ToastUtils.showLong("请输入新密码")
+            return false
+        }
+
+        if (new_password.text.toString().length < 8 || new_password.text.toString().length > 20){
+            ToastUtils.showLong("请输入8-20个字符的新密码")
+            return false
+        }
+
+        if (new_password.text.toString() != new_again_password.text.toString()){
+            ToastUtils.showLong("两次新密码输入不一致")
+            return false
+        }
+
+        return true
+    }
+
+}

+ 85 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/ResetAccountPasswordViewModel.kt

@@ -0,0 +1,85 @@
+package cn.muchinfo.rma.view.base.home.rolemanagement
+
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.netManage.base.InteractiveException
+import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI2
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.base.BaseViewModel
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import mtp.polymer.com.autowidget.utils.TaskUiModel
+
+class ResetAccountPasswordViewModel : BaseViewModel(){
+
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
+
+    val loginInfoAccount : MutableLiveData<String> = MutableLiveData<String>().apply { "0" }
+
+    /**
+     * 通过输入的账号查询loginid
+     * @param account String
+     */
+    fun loginidQuery(account : String){
+        MyApplication.getInstance()?.accountManager?.queryLoginID(code = account){ isCompleted, err, loginID ->
+            if (isCompleted){
+//                loadingDialogStatus.value = TaskUiModel.success()
+                loginInfoAccount.value = loginID
+            }
+        }
+    }
+
+    /**
+     * 登录账户操作请求报文装箱
+     * @param operatetype Int 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码
+     * @param userid Long 用户ID(新增成功接口返回的userid)
+     * @param loginid Long 登录ID(新增成功接口返回的loginid)
+     * @param logincode String 登录账号
+     * @param accountname String 账户名称
+     * @param password String 登录密码(明文)
+     * @param mobile String 手机号码(明文)
+     * @param roleids List<Long> 账号角色
+     * @param logintaaccounts List<LoginTaaccount> 期货账户(勾选交易员必填)
+     * @return Packet50
+     */
+    fun LoginaccountOperateReq(
+        operatetype : Int,
+        userid : Long = 0,
+        loginid : Long = 0,
+        logincode : String = "",
+        accountname : String = "",
+        password : String = "",
+        mobile : String = "",
+        roleids : List<Long> = arrayListOf(),
+        logintaaccounts : List<ManageServiceMI2.LoginTaaccount> = arrayListOf(),
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.accountManager?.LoginaccountOperateReq(
+                userid = userid,
+                operatetype = operatetype,
+                loginid = loginid,
+                logincode = logincode,
+                accountname = accountname,
+                password = password,
+                mobile = mobile,
+                roleids = roleids,
+                logintaaccounts = logintaaccounts
+            ){ isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+}

+ 25 - 5
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/rolemanagement/RoleSetViewModel.kt

@@ -8,6 +8,7 @@ import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI2
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.autoWidget.toArrayList
 import cn.muchinfo.rma.view.base.BaseViewModel
+import com.blankj.utilcode.util.LogUtils
 import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.launch
 import mtp.polymer.com.autowidget.utils.TaskUiModel
@@ -47,13 +48,13 @@ class RoleSetViewModel : BaseViewModel(){
     /**
      * 查询账户管理/期货账户
      */
-    fun queryAccMgrTaaccount(){
+    fun queryAccMgrTaaccount(type : String,data :Userlist ){
         val params = mutableMapOf<String, String>().apply {
             put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
         }
         MyApplication.getInstance()?.accountManager?.queryAccMgrTaaccount(params = params){isSuccess, respData, error ->
             if (isSuccess){
-                resetAccMgrTaaccount(respData ?: arrayListOf())
+                resetAccMgrTaaccount(respData ?: arrayListOf(),type,data)
             }
         }
     }
@@ -61,7 +62,7 @@ class RoleSetViewModel : BaseViewModel(){
     /**
      * 对期货账户的主列表和子列表进行合并
      */
-    fun resetAccMgrTaaccount(oldList : List<AccMgrTaaccountData>){
+    fun resetAccMgrTaaccount(oldList : List<AccMgrTaaccountData> , type: String,data :Userlist){
         val newDataList = arrayListOf<AccMgrTaaccountSonData>()
         oldList.forEach {
             newDataList.add(it.mainAcc ?: AccMgrTaaccountSonData())
@@ -70,6 +71,22 @@ class RoleSetViewModel : BaseViewModel(){
             }
         }
         futureDataList.postValue(newDataList)
+        if (type != "1"){
+            val newFutureList = arrayListOf<AccMgrTaaccountSonData>()
+            newDataList?.forEach { result ->
+                LogUtils.eTag("dasdadsadasd",result.accountid)
+                val findData = data.acclist?.find {
+                    it.accountid == result.accountid
+                }
+                if (findData?.accountid.isNullOrEmpty()){
+                    newFutureList.add(result)
+
+                }else{
+                    newFutureList.add(result.copy(isSelect = 1))
+                }
+            }
+            futureDataList.postValue(newFutureList)
+        }
     }
 
     /**
@@ -343,19 +360,22 @@ class RoleSetViewModel : BaseViewModel(){
         accountname : String = "",
         password : String = "",
         mobile : String = "",
-        roleids : List<Long>,
+        roleids : List<Long> = arrayListOf(),
         logintaaccounts : List<ManageServiceMI2.LoginTaaccount> = arrayListOf(),
         isSuccess: (isCompleted: Boolean) -> Unit
     ){
         loadingDialogStatus.value = TaskUiModel.inFlight()
         GlobalScope.launch {
             MyApplication.getInstance()?.accountManager?.LoginaccountOperateReq(
+                userid = userid,
                 operatetype = operatetype,
+                loginid = loginid,
                 logincode = logincode,
                 accountname = accountname,
                 password = password,
                 mobile = mobile,
-                roleids = roleids
+                roleids = roleids,
+                logintaaccounts = logintaaccounts
             ){ isCompleted, err ->
                 if (isCompleted) {
                     loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))