yu.jie преди 3 години
родител
ревизия
055525b1b3

+ 5 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/autoWidget/utils/NumberUtils.java

@@ -173,7 +173,11 @@ public class NumberUtils {
 
         String s = getZeroPatternString(num);
         DecimalFormat decimalFormat = new DecimalFormat(s);
-        return decimalFormat.format(Double.parseDouble(doubleDistortion(string)));
+        String value = decimalFormat.format(Double.parseDouble(doubleDistortion(string)));
+        if(value.equals("-0.0")){
+            return "0.0";
+        }
+        return value;
     }
 
     public static String getDecimalPlace(int place) {

+ 12 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/hnstmain/contractorders/adapter/ContractPositionContentAdapter.java

@@ -233,9 +233,19 @@ public class ContractPositionContentAdapter extends RecyclerView.Adapter<Contrac
                     Profit = "--";
                 } else {
                     if (data.getBuyorsell().equals("1")) {//卖方向
-                        Profit = NumberUtils.roundNum(differencePrice * Double.parseDouble(data.getCurpositionqty()) * goodsInfo.getAgreeunit() * -1, 2);
+                        Profit = NumberUtils.roundNum(
+                                (quoteDayData.getPrice() * Double.parseDouble(data.getCurpositionqty())
+                                        * goodsInfo.getAgreeunit() - Double.parseDouble(data.getCurholderamount())) * -1,
+                                2
+                                );
+//                        Profit = NumberUtils.roundNum(differencePrice * Double.parseDouble(data.getCurpositionqty()) * goodsInfo.getAgreeunit() * -1, 2);
                     } else {
-                        Profit = NumberUtils.roundNum(differencePrice * Double.parseDouble(data.getCurpositionqty()) * goodsInfo.getAgreeunit(), 2);
+                        Profit = NumberUtils.roundNum(
+                                (quoteDayData.getPrice() * Double.parseDouble(data.getCurpositionqty())
+                                        * goodsInfo.getAgreeunit() - Double.parseDouble(data.getCurholderamount())),
+                                2
+                        );
+//                        Profit = NumberUtils.roundNum(differencePrice * Double.parseDouble(data.getCurpositionqty()) * goodsInfo.getAgreeunit(), 2);
                     }
                 }
             }

+ 9 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/tjmd/TjmdMarketFragment.kt

@@ -126,10 +126,15 @@ class TjmdMarketFragment : BaseFragment<TjmdMarketViewModel>(){
         super.onCreate(savedInstanceState)
         EventBus.getDefault().register(this)
 
-        Timer().schedule(4000) {
-            goodsSwapsUI.startSubscriptQuote()
-            purchaseOrderUI.endSubscriptQuote()
-        }
+//        Timer().schedule(4000) {
+
+//        }
+    }
+
+    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+        super.onViewCreated(view, savedInstanceState)
+        goodsSwapsUI.startSubscriptQuote()
+        purchaseOrderUI.endSubscriptQuote()
     }
 
     override fun onDestroy() {