导出xlsx表格,设置自定义字段

@Override
    public void exportFashionable(HttpServletResponse response, PlatformConsumeStaticsParam param) {
        List<String> columnList = new ArrayList<>();
        List<List<String>> dataList = new ArrayList<>();
        List<String> data = null;
        //设置字段
        columnList.add("序号");
        columnList.add("订单id");
        columnList.add("用户id");
        columnList.add("姓名");
        columnList.add("产品");
        columnList.add("分期期数");
        columnList.add("总租金");
        columnList.add("市场价");
        columnList.add("商户ID");
        columnList.add("商户名称");
        columnList.add("分账流水号/分账类型/金额");
        columnList.add("分账流水号/类型/金额(平台)");
        columnList.add("分账时间");
        columnList.add("分账前金额");
        columnList.add("分账后金额");
        columnList.add("支付流水单号");
        columnList.add("支付金额");
        columnList.add("创建时间");
        columnList.add("支付完成时间");

        BfqzUser user = new BfqzUser();
        user.setReal(true);
        List<BfqzUser> users = userService.listAll(user);
        String uname = null;
        List<FashionableInfo> fashionableInfos = accountFundBalanceMapper.exportPage(param);
        List<FashionableVo> fashionableVos = switch2Fashionable(fashionableInfos);

        for (FashionableVo info : fashionableVos) {
            uname = "";
            data = new ArrayList<>();
            data.add(null == info.getOrderId() ? "" : info.getOrderId().toString());
            data.add(null == info.getUserId() ? "" : info.getUserId().toString());
            for (BfqzUser u : users) {
                if (null != info.getUserId() && u.getId().longValue() == info.getUserId().longValue()) {
                    uname = (info.getUserName() + "(" + u.getAlipayLogonId() + ")");
                    break;
                }
            }
            if (StringUtils.isNotBlank(uname)) {
                data.add(uname);
            } else {
                data.add(info.getUserName());
            }
            data.add(null == info.getGoodsContent() ? "" : info.getGoodsContent());
            data.add(null == info.getSplitNum() ? "" : info.getSplitNum().toString());
            data.add(null == info.getPrice() ? "0" : info.getPrice().toString());
            data.add(null == info.getMarketPrice() ? "0" : info.getMarketPrice().toString());
            data.add(info.getCompanyId().toString());
            data.add(info.getLabel());
            data.add(null == info.getConpanyAccount() ? "" : info.getConpanyAccount());
            data.add(null == info.getPlatformAccount() ? "" : info.getPlatformAccount());
            data.add(info.getBalanceTime().toString().replace("T", " "));
            data.add(null == info.getBeforeBalanceAmount() ? "0" : info.getBeforeBalanceAmount().toString());
            data.add(null == info.getAfterBalanceAmount() ? "0" : info.getAfterBalanceAmount().toString());
            data.add(info.getTradeNo());
            data.add(null == info.getAmount() ? "0" : info.getAmount().toString());
            data.add(info.getCreateDate().toString().replace("T", " "));
            data.add(info.getPayTime().toString().replace("T", " "));
            dataList.add(data);
        }
        ExcelUtil.exportExcel(response, param.getFileName(), columnList, dataList);
    }
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值