vhbjknkm 2022-02-23 11:04 采纳率: 100%
浏览 129
已结题

这种情况要怎样将数据返回

这种情况下要怎么将数据返回给askbillBodyDataTable
protected void assembleDatatable() {
        askbillHeadDataTable.set(askbillhead1);
        askbillHeadDataTable.setSelect(new Integer[]{0});
        askbillBodyDataTable.set(askbillbodys1);
        askbillBodyDataTable.setTotalPages(1);//songpeng 增加物料规格和型号(根据物料id--product_id查询);产品描述(product_desc)、表体备注(bmemo);
        askbillBodyDataTable.setPageIndex(0);
        askbillBodyDataTable.setPageSize(1);
        priceDataTable.set(compareInfos1);//承兑价,现金价,报价说明,交货期
        priceDataTable.setTotalPages(1);
        priceDataTable.setPageIndex(0);
        priceDataTable.setPageSize(1);
        if (talksDataTable != null && quotationOffers1 != null) {
            talksDataTable.set(quotationOffers1.toArray(new QuotationOffer[0]));
            talksDataTable.setSelect(new Integer[]{0});
        }
        //上期成交价(含税)
        //askbillBodyDataTable-rows-data-extFields-historySupplyPrice- LASTPRICE
        Row[] rows = askbillBodyDataTable.getRows();
        for (Row str : rows) {
            Map < String, Field > data = str.getFields();
            Field extFields = data.get("extFields");
            HashMap value = (HashMap) extFields.getValue();
            HashMap historySupplyPrice = (HashMap) value.get("historySupplyPrice");
            Double lastprice1 = (java.lang.Double) historySupplyPrice.get("LASTPRICE");
            double d = lastprice1;
            int d2 = (int) d;
            String s1 = String.valueOf(d);
            if (s1.contains(".") && d2 != d) {
                int i = s1.indexOf(".");
                for (int j = i; j < s1.length() - 1; j++) {
                    int lastIndex = s1.charAt(s1.length() - 1);
                    int io = s1.lastIndexOf("0");
                    if (lastIndex == io) {
                        s1 = s1.substring(0, s1.length() - 1);
                    }
                }
            } else {
                s1 += "0";
            }
            logger.info("s1:" + s1);
        }

  • 写回答

8条回答 默认 最新

  • ilmss 2022-02-23 14:21
    关注

    将你这段代码封装在一个json数组里,然后返回

    
    for (Row str : rows) {
                Map < String, Field > data = str.getFields();
                Field extFields = data.get("extFields");
                HashMap value = (HashMap) extFields.getValue();
                HashMap historySupplyPrice = (HashMap) value.get("historySupplyPrice");
                Double lastprice1 = (java.lang.Double) historySupplyPrice.get("LASTPRICE");
                double d = lastprice1;
                int d2 = (int) d;
                String s1 = String.valueOf(d);
                if (s1.contains(".") && d2 != d) {
                    int i = s1.indexOf(".");
                    for (int j = i; j < s1.length() - 1; j++) {
                        int lastIndex = s1.charAt(s1.length() - 1);
                        int io = s1.lastIndexOf("0");
                        if (lastIndex == io) {
                            s1 = s1.substring(0, s1.length() - 1);
                        }
                    }
                } else {
                    s1 += "0";
                }
                logger.info("s1:" + s1);
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 3月3日
  • 已采纳回答 3月1日
  • 创建了问题 2月23日

悬赏问题

  • ¥30 seata使用出现报错,其他服务找不到seata
  • ¥35 引用csv数据文件(4列1800行),通过高斯-赛德尔法拟合曲线,在选取(每五十点取1点)数据,求该数据点的曲率中心。
  • ¥20 程序只发送0X01,串口助手显示不正确,配置看了没有问题115200-8-1-no,如何解决?
  • ¥15 Google speech command 数据集获取
  • ¥15 vue3+element-plus页面崩溃
  • ¥15 像这种代码要怎么跑起来?
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误