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日

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算