|
|
@@ -112,16 +112,18 @@ public class TransferAdapter extends RecyclerView.Adapter<TransferAdapter.ItemVi
|
|
|
GoodsInfo relateGoodsInfo = null;//关联商品实体
|
|
|
relateGoodsInfo = DataBase.Companion.getInstance().goodsInfoDao().getGoodsInfo(data.getRelatedgoodsid());//获取关联商品的商品详情
|
|
|
List<GoodsInfoAndQuotes> quotesList = GlobalDataCollection.Companion.getInstance().getGoodsInfoAndQuotesList();//获取盘面信息列表
|
|
|
- for (int j = 0;j < quotesList.size();j++){
|
|
|
- if (data.getOutgoodscode().equals(quotesList.get(j).getOutgoodscode())){
|
|
|
- quoteDayData = quotesList.get(j).getQuoteDayData();//赋值当前商品的盘面信息
|
|
|
+ for (int j = 0; j < quotesList.size(); j++) {
|
|
|
+ if (quotesList.get(j) != null) {
|
|
|
+ if (data.getGoodscode().equals(quotesList.get(j).getOutgoodscode())) {
|
|
|
+ quoteDayData = quotesList.get(j).getQuoteDayData();//赋值当前商品的盘面信息
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (quoteDayData != null){
|
|
|
+ if (quoteDayData != null) {
|
|
|
// 卖价取卖一价
|
|
|
QHjRightData askData = new QHjRightData();
|
|
|
- askData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getAsk())),2));
|
|
|
+ askData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getAsk())), 2));
|
|
|
askData.setColorType("3");
|
|
|
rightData.add(askData);
|
|
|
|
|
|
@@ -133,7 +135,7 @@ public class TransferAdapter extends RecyclerView.Adapter<TransferAdapter.ItemVi
|
|
|
|
|
|
//买价取买一价
|
|
|
QHjRightData bidData = new QHjRightData();
|
|
|
- bidData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getBid())),2));
|
|
|
+ bidData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getBid())), 2));
|
|
|
bidData.setColorType("3");
|
|
|
rightData.add(bidData);
|
|
|
|
|
|
@@ -145,73 +147,73 @@ public class TransferAdapter extends RecyclerView.Adapter<TransferAdapter.ItemVi
|
|
|
|
|
|
//最新价
|
|
|
QHjRightData newPriceData = new QHjRightData();
|
|
|
- newPriceData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getPrice())),2));
|
|
|
+ newPriceData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getPrice())), 2));
|
|
|
newPriceData.setColorType(quoteDayData.getColor());
|
|
|
rightData.add(newPriceData);
|
|
|
}
|
|
|
|
|
|
- if (quoteDayData != null){
|
|
|
+ if (quoteDayData != null) {
|
|
|
//涨跌幅
|
|
|
QHjRightData appliesData = new QHjRightData();
|
|
|
//涨跌
|
|
|
QHjRightData riseFallData = new QHjRightData();
|
|
|
//今开
|
|
|
QHjRightData openRightData = new QHjRightData();
|
|
|
- openRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getOpened())),2));
|
|
|
+ openRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getOpened())), 2));
|
|
|
double openRightDatColor = quoteDayData.getOpened() - quoteDayData.getPreclose();
|
|
|
- if (openRightDatColor > 0){
|
|
|
+ if (openRightDatColor > 0) {
|
|
|
openRightData.setColorType("3");
|
|
|
- }else if (openRightDatColor < 0){
|
|
|
+ } else if (openRightDatColor < 0) {
|
|
|
openRightData.setColorType("2");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
openRightData.setColorType("1");
|
|
|
}
|
|
|
//最高价
|
|
|
QHjRightData highRightData = new QHjRightData();
|
|
|
- highRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getHighest())),2));
|
|
|
+ highRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getHighest())), 2));
|
|
|
double highRightDatColor = quoteDayData.getHighest() - quoteDayData.getPreclose();
|
|
|
- if (highRightDatColor > 0){
|
|
|
+ if (highRightDatColor > 0) {
|
|
|
highRightData.setColorType("3");
|
|
|
- }else if (highRightDatColor < 0){
|
|
|
+ } else if (highRightDatColor < 0) {
|
|
|
highRightData.setColorType("2");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
highRightData.setColorType("1");
|
|
|
}
|
|
|
highRightData.setColorType("1");
|
|
|
//最低价
|
|
|
QHjRightData lowestRightData = new QHjRightData();
|
|
|
- lowestRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getLowest())),data.getDecimalplace()));
|
|
|
+ lowestRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getLowest())), data.getDecimalplace()));
|
|
|
double lowestRightDatColor = quoteDayData.getLowest() - quoteDayData.getPreclose();
|
|
|
- if (lowestRightDatColor > 0){
|
|
|
+ if (lowestRightDatColor > 0) {
|
|
|
lowestRightData.setColorType("3");
|
|
|
- }else if (lowestRightDatColor < 0){
|
|
|
+ } else if (lowestRightDatColor < 0) {
|
|
|
lowestRightData.setColorType("2");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
lowestRightData.setColorType("1");
|
|
|
}
|
|
|
lowestRightData.setColorType("1");
|
|
|
//昨收价
|
|
|
QHjRightData yesCloseRightData = new QHjRightData();
|
|
|
- yesCloseRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getPreclose())),data.getDecimalplace()));
|
|
|
+ yesCloseRightData.setValue(NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf(quoteDayData.getPreclose())), data.getDecimalplace()));
|
|
|
yesCloseRightData.setColorType("1");
|
|
|
|
|
|
if (quoteDayData.getLast() != 0 && quoteDayData.getPreclose() != 0) {
|
|
|
String textApplies = "";
|
|
|
- String textUpDown = NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf((quoteDayData.getPrice() - quoteDayData.getPresettle()))),2);//涨跌
|
|
|
- if (quoteDayData.getPresettle() == 0){
|
|
|
+ String textUpDown = NumberUtils.roundNum(NumberUtils.doubleDistortion(String.valueOf((quoteDayData.getPrice() - quoteDayData.getPresettle()))), 2);//涨跌
|
|
|
+ if (quoteDayData.getPresettle() == 0) {
|
|
|
textApplies = "--";
|
|
|
- }else {
|
|
|
- textApplies = NumberUtils.roundNum(String.valueOf((((quoteDayData.getPrice() - quoteDayData.getPresettle()) / quoteDayData.getPresettle()) * 100)),2);//涨跌幅
|
|
|
+ } else {
|
|
|
+ textApplies = NumberUtils.roundNum(String.valueOf((((quoteDayData.getPrice() - quoteDayData.getPresettle()) / quoteDayData.getPresettle()) * 100)), 2);//涨跌幅
|
|
|
}
|
|
|
riseFallData.setValue(textUpDown);
|
|
|
appliesData.setValue(textApplies + "%");
|
|
|
- if (Double.valueOf(textUpDown) > 0){
|
|
|
+ if (Double.valueOf(textUpDown) > 0) {
|
|
|
riseFallData.setColorType("3");
|
|
|
appliesData.setColorType("3");
|
|
|
- }else if (Double.valueOf(textUpDown) < 0){
|
|
|
+ } else if (Double.valueOf(textUpDown) < 0) {
|
|
|
riseFallData.setColorType("2");
|
|
|
appliesData.setColorType("2");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
riseFallData.setColorType("1");
|
|
|
appliesData.setColorType("1");
|
|
|
}
|
|
|
@@ -232,8 +234,8 @@ public class TransferAdapter extends RecyclerView.Adapter<TransferAdapter.ItemVi
|
|
|
}
|
|
|
ContractTradePositionData positionData = null;
|
|
|
List<ContractTradePositionData> positionDataList = GlobalDataCollection.Companion.getInstance().getContractTradePositionDataArrayList();
|
|
|
- for (int j = 0;j < positionDataList.size();j++){
|
|
|
- if (String.valueOf(data.getGoodsid()).equals(positionDataList.get(j).getGoodsid())){
|
|
|
+ for (int j = 0; j < positionDataList.size(); j++) {
|
|
|
+ if (String.valueOf(data.getGoodsid()).equals(positionDataList.get(j).getGoodsid())) {
|
|
|
positionData = positionDataList.get(j);
|
|
|
}
|
|
|
}
|
|
|
@@ -264,8 +266,8 @@ public class TransferAdapter extends RecyclerView.Adapter<TransferAdapter.ItemVi
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
Intent intent = new Intent();
|
|
|
- intent.putExtra("goodsId",String.valueOf(data.getGoodsid()));
|
|
|
- intent.putExtra("goodsCode",data.getGoodscode());
|
|
|
+ intent.putExtra("goodsId", String.valueOf(data.getGoodsid()));
|
|
|
+ intent.putExtra("goodsCode", data.getGoodscode());
|
|
|
intent.setClass(context, ContractBusinessHallActivity.class);
|
|
|
ActivityUtils.startActivity(intent);
|
|
|
}
|
|
|
@@ -278,13 +280,13 @@ public class TransferAdapter extends RecyclerView.Adapter<TransferAdapter.ItemVi
|
|
|
intent.putExtra("outGoodsCode", data.getOutgoodscode());
|
|
|
intent.putExtra("goodsCode", data.getGoodscode());
|
|
|
intent.putExtra("goodsId", String.valueOf(data.getGoodsid()));
|
|
|
- intent.putExtra("type","1");
|
|
|
+ intent.putExtra("type", "1");
|
|
|
intent.putExtra("marketId", data.getMarketid());
|
|
|
intent.setClass(context, YrdzChartActivity.class);
|
|
|
ActivityUtils.startActivity(intent);
|
|
|
}
|
|
|
});
|
|
|
- if (data.getPictureurl().isEmpty()){
|
|
|
+ if (data.getPictureurl().isEmpty()) {
|
|
|
itemViewHolder.platnum_details.setVisibility(View.GONE);
|
|
|
}
|
|
|
//详情点击
|
|
|
@@ -292,9 +294,9 @@ public class TransferAdapter extends RecyclerView.Adapter<TransferAdapter.ItemVi
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
Intent intent = new Intent();
|
|
|
- intent.putExtra("data",new OrderQuoteData());
|
|
|
- intent.putExtra("type","3");
|
|
|
- intent.putExtra("goodsId",data.getGoodsid());
|
|
|
+ intent.putExtra("data", new OrderQuoteData());
|
|
|
+ intent.putExtra("type", "3");
|
|
|
+ intent.putExtra("goodsId", data.getGoodsid());
|
|
|
intent.setClass(context, BusinessHallDetailsActivity.class);
|
|
|
ActivityUtils.startActivity(intent);
|
|
|
}
|