@@ -45,7 +45,7 @@ public HoldStockGroupTableView(String tabName) {
4545 int rowHeight = stockTable .getRowHeight ();
4646 stockTable .setRowHeight (rowHeight * 2 );
4747 for (String columnName : getColumnNames ()) {
48- stockTable .getColumn (columnName ).setCellRenderer (new MultiLineTableCellRenderer (Lists .newArrayList (1 , 4 ), Lists .newArrayList ( 1 , 3 , 4 )));
48+ stockTable .getColumn (columnName ).setCellRenderer (new MultiLineTableCellRenderer (Lists .newArrayList (1 , 4 ), Lists .newArrayList (1 , 3 , 4 )));
4949 }
5050 TableColumn idColumn = stockTable .getColumnModel ().getColumn (0 );
5151 // 从视图中移除,模型仍保留
@@ -149,7 +149,7 @@ protected Vector<Object> toTableData(RealStockInfo realStockInfo) {
149149
150150 //今日收益计算 (当前价-上一日收盘价)*持仓数量
151151 BigDecimal yesterdayPrice = new BigDecimal (realStockInfo .getYesterdayPrice ());
152- BigDecimal increaseRate = new BigDecimal (realStockInfo .getIncreaseRate ()). divide ( new BigDecimal ( "100" ), 5 , RoundingMode . CEILING ) ;
152+ BigDecimal increaseRate = new BigDecimal (realStockInfo .getIncreaseRate ());
153153 BigDecimal todayProfit = currentPrice .subtract (yesterdayPrice ).multiply (countDecimal ).setScale (4 , RoundingMode .CEILING );
154154
155155 //表格数据
@@ -161,15 +161,15 @@ protected Vector<Object> toTableData(RealStockInfo realStockInfo) {
161161 //持仓盈亏
162162 String PLRatePrefix = PLRate .compareTo (BigDecimal .ZERO ) > 0 ? "+" : "" ;
163163 String PLPrefix = PL .compareTo (BigDecimal .ZERO ) > 0 ? "+" : "" ;
164- vector .add (new String []{PLPrefix + NumberFormatUtil .format (PL ), PLRatePrefix + NumberFormatUtil .formatRate (PLRate )});
164+ vector .add (new String []{PLPrefix + NumberFormatUtil .format (PL ), PLRatePrefix + NumberFormatUtil .formatRate (PLRate , false )});
165165 //持仓数量
166166 vector .add (count );
167167 //现价/成本
168168 vector .add (new String []{realStockInfo .getCurrentPrice (), cost .setScale (3 , RoundingMode .CEILING ).toString ()});
169169 //今日收益
170170 String todayProfitPrefix = todayProfit .compareTo (BigDecimal .ZERO ) > 0 ? "+" : "" ;
171171 String profitRatePrefix = increaseRate .compareTo (BigDecimal .ZERO ) > 0 ? "+" : "" ;
172- vector .add (new String []{todayProfitPrefix + NumberFormatUtil .format (todayProfit ), profitRatePrefix + NumberFormatUtil .formatRate (increaseRate )});
172+ vector .add (new String []{todayProfitPrefix + NumberFormatUtil .format (todayProfit ), profitRatePrefix + NumberFormatUtil .formatRate (increaseRate , true )});
173173 return vector ;
174174 }
175175
0 commit comments