|
@@ -6,7 +6,9 @@ import cn.muchinfo.rma.global.data.*
|
|
|
import cn.muchinfo.rma.netManage.base.InteractiveException
|
|
import cn.muchinfo.rma.netManage.base.InteractiveException
|
|
|
import cn.muchinfo.rma.view.MyApplication
|
|
import cn.muchinfo.rma.view.MyApplication
|
|
|
import cn.muchinfo.rma.view.autoWidget.remove
|
|
import cn.muchinfo.rma.view.autoWidget.remove
|
|
|
|
|
+import cn.muchinfo.rma.view.autoWidget.toArrayList
|
|
|
import cn.muchinfo.rma.view.base.BaseViewModel
|
|
import cn.muchinfo.rma.view.base.BaseViewModel
|
|
|
|
|
+import com.blankj.utilcode.util.TimeUtils
|
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
|
import kotlinx.coroutines.GlobalScope
|
|
import kotlinx.coroutines.GlobalScope
|
|
|
import kotlinx.coroutines.launch
|
|
import kotlinx.coroutines.launch
|
|
@@ -65,7 +67,11 @@ class SpotMarketPriceViewModel : BaseViewModel(){
|
|
|
|
|
|
|
|
MyApplication.getInstance()?.spotManager?.querySpotGoodsPrice(params = params) { isSuccess, respData, error ->
|
|
MyApplication.getInstance()?.spotManager?.querySpotGoodsPrice(params = params) { isSuccess, respData, error ->
|
|
|
if (isSuccess) {
|
|
if (isSuccess) {
|
|
|
- spotMarketPriceDataList.postValue(respData?.remove { it.isvalid == "0" })
|
|
|
|
|
|
|
+ val newDataList = respData?.remove { it.isvalid == "0" }?.toArrayList()
|
|
|
|
|
+ newDataList?.sortWith(Comparator { t1, t2 ->
|
|
|
|
|
+ (TimeUtils.string2Millis(t1.operatetime) - TimeUtils.string2Millis(t2.operatetime)).toInt()
|
|
|
|
|
+ })
|
|
|
|
|
+ spotMarketPriceDataList.postValue(newDataList)
|
|
|
} else {
|
|
} else {
|
|
|
ToastUtils.showLong("数据请求失败")
|
|
ToastUtils.showLong("数据请求失败")
|
|
|
}
|
|
}
|
|
@@ -87,7 +93,7 @@ class SpotMarketPriceViewModel : BaseViewModel(){
|
|
|
newDataList.add(it.copy(isClick = 0))
|
|
newDataList.add(it.copy(isClick = 0))
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
- newDataList.add(it)
|
|
|
|
|
|
|
+ newDataList.add(it.copy(isClick = 0))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
spotMarketPriceDataList.postValue(newDataList)
|
|
spotMarketPriceDataList.postValue(newDataList)
|
|
@@ -97,10 +103,12 @@ class SpotMarketPriceViewModel : BaseViewModel(){
|
|
|
* 查询现货市价详情(现货市价/详情)
|
|
* 查询现货市价详情(现货市价/详情)
|
|
|
* @param wrstandardid String
|
|
* @param wrstandardid String
|
|
|
*/
|
|
*/
|
|
|
- fun querySpotGoodsPriceLog(deliverygoodsid : String){
|
|
|
|
|
|
|
+ fun querySpotGoodsPriceLog(deliverygoodsid : String,wrstandardid : String,brandid : String){
|
|
|
val params = mutableMapOf<String, String>().apply {
|
|
val params = mutableMapOf<String, String>().apply {
|
|
|
put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
put("deliverygoodsid",deliverygoodsid)
|
|
put("deliverygoodsid",deliverygoodsid)
|
|
|
|
|
+ put("brandid",brandid)
|
|
|
|
|
+ put("wrstandardid",wrstandardid)
|
|
|
}
|
|
}
|
|
|
MyApplication.getInstance()?.spotManager?.querySpotGoodsPriceLog(params = params) { isSuccess, respData, error ->
|
|
MyApplication.getInstance()?.spotManager?.querySpotGoodsPriceLog(params = params) { isSuccess, respData, error ->
|
|
|
if (isSuccess) {
|
|
if (isSuccess) {
|
|
@@ -158,7 +166,8 @@ class SpotMarketPriceViewModel : BaseViewModel(){
|
|
|
*/
|
|
*/
|
|
|
fun queryDeliveryGoods(){
|
|
fun queryDeliveryGoods(){
|
|
|
val params = mutableMapOf<String, String>().apply {
|
|
val params = mutableMapOf<String, String>().apply {
|
|
|
- put("areauserid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
|
|
|
|
+ put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
|
|
+ put("usertype",GlobalDataCollection.instance?.userAccountData?.usertype?.toString() ?: "")
|
|
|
}
|
|
}
|
|
|
MyApplication.getInstance()?.commodityManager?.queryDeliveryGoods(params = params) { isSuccess, respData, error ->
|
|
MyApplication.getInstance()?.commodityManager?.queryDeliveryGoods(params = params) { isSuccess, respData, error ->
|
|
|
if (isSuccess) {
|
|
if (isSuccess) {
|
|
@@ -174,7 +183,8 @@ class SpotMarketPriceViewModel : BaseViewModel(){
|
|
|
*/
|
|
*/
|
|
|
fun queryDeliveryGoodsDetails(deliverygoodsid : String){
|
|
fun queryDeliveryGoodsDetails(deliverygoodsid : String){
|
|
|
val params = mutableMapOf<String, String>().apply {
|
|
val params = mutableMapOf<String, String>().apply {
|
|
|
- put("areauserid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
|
|
|
|
+ put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
|
|
+ put("usertype",GlobalDataCollection.instance?.userAccountData?.usertype?.toString() ?: "")
|
|
|
put("deliverygoodsid",deliverygoodsid)
|
|
put("deliverygoodsid",deliverygoodsid)
|
|
|
}
|
|
}
|
|
|
MyApplication.getInstance()?.commodityManager?.queryDeliveryGoodsDetail(params = params) { isSuccess, respData, error ->
|
|
MyApplication.getInstance()?.commodityManager?.queryDeliveryGoodsDetail(params = params) { isSuccess, respData, error ->
|
|
@@ -191,7 +201,8 @@ class SpotMarketPriceViewModel : BaseViewModel(){
|
|
|
*/
|
|
*/
|
|
|
fun queryGoodsWrstandard(){
|
|
fun queryGoodsWrstandard(){
|
|
|
val params = mutableMapOf<String, String>().apply {
|
|
val params = mutableMapOf<String, String>().apply {
|
|
|
- put("areauserid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
|
|
|
|
+ put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
|
|
+ put("usertype",GlobalDataCollection.instance?.userAccountData?.usertype?.toString() ?: "")
|
|
|
}
|
|
}
|
|
|
MyApplication.getInstance()?.commodityManager?.queryGoodsWrstandard(params = params) { isSuccess, respData, error ->
|
|
MyApplication.getInstance()?.commodityManager?.queryGoodsWrstandard(params = params) { isSuccess, respData, error ->
|
|
|
if (isSuccess) {
|
|
if (isSuccess) {
|
|
@@ -207,7 +218,8 @@ class SpotMarketPriceViewModel : BaseViewModel(){
|
|
|
*/
|
|
*/
|
|
|
fun queryGoodsbrand(){
|
|
fun queryGoodsbrand(){
|
|
|
val params = mutableMapOf<String, String>().apply {
|
|
val params = mutableMapOf<String, String>().apply {
|
|
|
- put("areauserid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
|
|
|
|
+ put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
|
|
|
|
|
+ put("usertype",GlobalDataCollection.instance?.userAccountData?.usertype?.toString() ?: "")
|
|
|
}
|
|
}
|
|
|
MyApplication.getInstance()?.commodityManager?.queryGoodsbrand(params = params) { isSuccess, respData, error ->
|
|
MyApplication.getInstance()?.commodityManager?.queryGoodsbrand(params = params) { isSuccess, respData, error ->
|
|
|
if (isSuccess) {
|
|
if (isSuccess) {
|