NutzCN Logo
问答 EXCEL文件导出的问题
发布于 2578天前 作者 qq_09dec3d3 4221 次浏览 复制 上一个帖子 下一个帖子
标签:

导入EXCEL表,按照要求生成了数据库(用的NUTZ的J4E),现在想把修改的表重数据库中导出,单用J4E总体工的导出步骤报错:

public Object downloadfile(HttpSession session)
    {
        List<subpon> subPon = dao.query(subpon.class, null);  
 
      
      J4E.<subpon>toExcel(Files.createFileIfNoExists2("d:\\人员.xls"),subPon,null);  
        return "ok";
    }

报FILE不能转化成OUTPUTSTREAM,怎么玩?

75 回复

贴完整报错信息

是不是还缺了什么?

编译通不过啊

按ALT+ENTER,显示FILE不能转换成OUTPUTSTREAM

你用的不是快照版? 使用File参数的toExcel方法的名字, 原本是错误的"toExce", 在快照版中修正回toExcel

https://github.com/nutzam/nutzmore/commit/2f7ef692dae54471e822dfcb157d558d39b96051

就是上次你给我的连接啊

谢谢,修改一下网页的步骤说明吧

我参照网页的步骤做的

应该是版本问题,能否发个正确的版本给我,谢谢

谢谢,我的项目结题了,唉呀,可以睡觉了,谢谢

... 擦, 你这是通宵了?

差不多,不完成不罢休,老大的要求

晕啊,本以为万事大吉,结果出现啊了新问题:导出的表格我lock了ID和另外一个字段,但导出的表格中有这两个字段的标题,id字段为0,另外一个字段有标题无内容,要求不能有这两个字段,怎么玩?

在不

来自炫酷的 NutzCN

嗯, 需要找一下胖五

不导出的字段 上面加上 @J4EIgnore

谢谢,立马试试

来自炫酷的 NutzCN

这两个字段在原表中没有,只是为了在编程中方便,加入,我试了加这个参数,还是一样

来自炫酷的 NutzCN

pojo贴一下看看?

@Table("pongj.dbo.subpon")
@J4EName("第一页")
public class subpon {
@J4EName("管理区域")
private String glqy;
@J4EName("所属区域")
private String ssqy;
@J4EName("局向名称")
private String jxname;
@J4EName("局向编号")
private String jxbm;
@J4EName("分光器名称")
private String fgqname;
@J4EName("分光器编号")
private String fgqbm;
@J4EName("分光器地址")
private String fgqdz;
@J4EName("所属OLT设备")
private String oltname;
@J4EName("所属OLTPON端口")
private String oltpon;
@J4EName("业务号码")
private String ywhm;
@J4EName("客户名称")
private String khname;
@J4EName("装机地址")
private String address;
@J4EName("联系电话")
private String lxdh;
@J4EName("终端规格")
private String zdgg;
@J4EName("LOID")
private String loid;
@J4EName("PON端口")
private String pondk;
@J4EName("POS端口")
private String posdk;
@J4EName("节点设备名称")
private String jdsbname;
@J4EName("PON卡槽位端口")
private String ponkcwdk;
@J4EName("物理号码")
private String wlhm;
@J4EName("SVLAN")
private String oldsvlan;
@J4EName("CVLAN")
private String oldcvlan;
@J4EName("TID")
private String tid;
@J4EName("EID")
private String eid;
@J4EName("终端来源")
private String zdly;
@J4EName("OLT的IP地址")
private String oltip;
@J4EName("业务标准地址")
private String ywbzdz;
@J4EName("新PON口")
private String newponk;
@J4EName("新SVLAN")
private String newsvlan;
@J4EName("新CVLAN")
private String newcvlan;
@J4EName("新POS端口")
private String newposdk;
@J4EName("是否同步更新POS设备的所属PON口")
private String updatepon;
@J4EIgnore
@Id
private int id;
@J4EIgnore
public String gh;

ID和GH都在原表中无

我在做公司的割接EXCEL表的导入导出

手机的NUTCN打开的话题不自动更新,需刷新

用的是最新的jar包吗,需要最新版的

我下了.65的JAR

public Object downloadfile(HttpSession session)
    {
     SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddhhmmss");  
       
     String str=sdf.format(new Date());  
     String filename="d:\\PON口割接导出文件\\PON口割接_"+session.getAttribute("gh")+"_"+str+".xls";
    
     List<subpon> subPon =Daos.ext(dao, FieldFilter.locked(subpon.class, "^id|gh$")).query(subpon.class, Cnd.where("gh","=",session.getAttribute("gh")));  
    
      J4E.<subpon>toExcel(Files.createFileIfNoExists2(filename),subPon,null);  
        return "ok";
    }

是否同步更新POS设备的所属PON口 id gh
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0
否 0

下个最新的试试,@J4EIgnore这个之前不知为啥不被删了,前两天刚刚把逻辑加回来 最新的才行

万岁,万岁,可以了

我打赏了,不多,谢谢

两个都有,谢谢

有点奇怪,我想增加判断文件是否成功,吧这个语句J4E.toExcel(Files.createFileIfNoExists2(filename),subPon,null);的返回值用了一下,明明文件已成功得到,没有错,怎么返回FALSE,这个FALSE是指什么有问题?

那是是否新建的意思吧

应该不是,我在服务器上的文件是新建的,原来文件在客户端

来自炫酷的 NutzCN

你的意思是toExcel的返回值是false?导出失败?

导出是成功的,服务器对应的目录有文件,但这个函数返回false

来自炫酷的 NutzCN

翻了翻代码, 应该是IO错误才会返回false吧, debug一下?

你是不是总是写到同一个文件了??? 用我这种写法吧

try (OutputStream out = new FileOutputStream(Files.createFileIfNoExists2("/tmp/"+R.UU32()+".xls"))) {
    J4E.toExcel(out, people, null);  
}

是我搞错了,当导出数据为0条时报错,这个是正常的,谢谢

来自炫酷的 NutzCN

@wendal 大佬
controller方法的@OK 怎么写 然后那个文件 在哪找啊

@wendal 为什么 出来的格式不是我想要的 好像是json

@wendal

{"id":"03d1ae04547b4c46a63594b58eef715e","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:32","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"190734722038432e98fe478fc9a1e6c2","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:39","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"2027dc79bf4543628a9c222c62decc79","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":1.000000000,"fee":6.000000000,"playing_coins":594.000000000,"status":1,"remarks":"11","opby":"a629a849ec154e1c87614d5df06dcb21","opat":1536211648,"delflag":false,"create_time":"2018-09-05 15:38:40","app_time":"2018-09-05 16:12:12","submit_time":"2018-09-05 16:12:08","platform_uid":191625,"price":100.000000000,"statusstr":"待审核"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"2fda299240fa4fc1ad0fbefcb4e9bea9","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":2.000000000,"fee":12.000000000,"playing_coins":588.000000000,"status":0,"remarks":"1ss","opby":"a629a849ec154e1c87614d5df06dcb21","opat":1536211676,"delflag":false,"create_time":"2018-09-05 15:32:32","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"47bb751cf485403f8c365cc1c3d84ea3","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"494927b3c6fc44fea95a1e6c8c7b86a5","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:32","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"4cce0938880f41b69fe8002d8c0112fd","project_id":"b4a041cd74084113b36c4760464a1b90","project_name":"兑换usdt","buy_fee":800.000000000,"purchase_fee":0.800000000,"uid":100059,"coin_name":"USDT","coin_id":"15","currency":"BTC","currency_id":"2","fee_per":10.000000000,"fee":80.000000000,"playing_coins":720.000000000,"status":1,"remarks":null,"opby":"a5265a9b16a049efab926266474da49e","opat":1535790999,"delflag":false,"create_time":null,"app_time":"2018-09-01 16:39:54","submit_time":"2018-09-01 16:39:36","platform_uid":191625,"price":0.001000000,"statusstr":"待审核"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"4ee12a771abe4b44b7cb4d82a3d598b3","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:40","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"5ba63d3824b54629b8c5decbcf4f4596","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"5caaf8368e4f4b809024912b5466a95f","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:39","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"7473e7b1b33440cfba4cb4cbb9a7fab6","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"7a1d389f432c4456895965af751acdb3","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536133120,"delflag":false,"create_time":"2018-09-05 15:38:40","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"7c4ef92c06de45ec83e12e6cf46f6567","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:32","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"81da64a5a1204701b1f443d9ad84ec05","project_id":"1858e41517834ed583c897a3c082bdcb","project_name":"王磊测试01","buy_fee":2.000000000,"purchase_fee":20000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":9.800000000,"status":2,"remarks":null,"opby":"a5265a9b16a049efab926266474da49e","opat":1535706350,"delflag":false,"create_time":null,"app_time":null,"submit_time":null,"platform_uid":191625,"price":10000.000000000,"statusstr":"已审核"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"91aebc447bbc44c78f0da2f53ec942f5","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:39","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"97cfcbd513284c37a597a85d41336488","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:39","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"a0c8fdbe28514bde85a8a551a3c1665e","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536133120,"delflag":false,"create_time":"2018-09-05 15:38:40","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"a28a739e2a254e14a47e270a42cf7d7c","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"b2264e5800d74bef8ceca78222c1b559","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:39","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"b6904fae7efe4e83b5e86e571fabf799","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"b6a64b29324f47ae83a2dbbeffd46306","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"b74c3e1d923c4bb7a0a1ece1affa1250","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"bb6c59bfdd27425095952c43174e8526","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"bcc9c160230c46e691a2b43814f7ae31","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536132751,"delflag":false,"create_time":"2018-09-05 15:32:32","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"d41577d6c60046508fa73afbb8d1d004","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":6.000000000,"purchase_fee":6000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":5.800000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:40","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"d43469c3d2184b53ab4a99d1bfe76b04","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:40","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"dfb84194b06349f9835e4757244adba1","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":200.000000000,"purchase_fee":20000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":200.000000000,"status":1,"remarks":null,"opby":"a629a849ec154e1c87614d5df06dcb21","opat":1535965299,"delflag":false,"create_time":null,"app_time":"2018-09-01 17:09:11","submit_time":"2018-09-01 17:08:53","platform_uid":191625,"price":100.000000000,"statusstr":"待审核"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"e6e1860bc04a48bf93b8e1c9f8df1b32","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:39","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"f1c2b9d03c6640da9a15d027aa22f880","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":600.000000000,"purchase_fee":60000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":0E-9,"fee":0E-9,"playing_coins":600.000000000,"status":0,"remarks":null,"opby":"","opat":1536133119,"delflag":false,"create_time":"2018-09-05 15:38:40","app_time":null,"submit_time":null,"platform_uid":191625,"price":100.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]

导出来是这种形式的 我加那个注解了

你得自行生成xls文件, 例如用J4E等工具库, nutz本身是不会帮你转的

这句话不是生成xls么。

J4E.toExcel(out, t_ieo_playings, null);  

然后得把file对象作为返回值呀,上代码吧

  try (OutputStream out = new FileOutputStream(Files.createFileIfNoExists2("~/打币列表.xls"))) {
            J4E.toExcel(out, t_ieo_playings, null);
        }
        catch (Exception e){
            e.printStackTrace();
        }

w我就这么写的。

   File f = Files.createFileIfNoExists2("~/打币列表.xls");
  try (OutputStream out = new FileOutputStream(f)) {
            J4E.toExcel(out, t_ieo_playings, null);
        }
        catch (Exception e){
            e.printStackTrace();
        }
   return f;

@wendal 大佬啊 还有个问题 我前台是这样传过来的

 location.href="${base}/platform/ieo/playing/exportExcel"+param;

这样不会有问题么 我每次都是转到一个空白页

当前的入口方法是怎样的? 有没有进入口方法?

controller这样写的

 @At("/exportExcel1")
    @Ok("raw")
    @RequiresPermissions("ieo.order.index")
    public Object exportExcel1(@Param("name") String name,
                            @Param("status") String status,
                            @Param("coin_name") String coin_name,
                            @Param("beginDate") String beginDate,
                            @Param("endDate") String endDate,
                            @Param("currency") String currency,
                            @Param("start") int start,
                            @Param("::order") List<DataTableOrder> order,HttpServletResponse response) throws IOException {

进去了 也没报错 就是 转到空白页

有没有进入口方法?

有没有return file呀

这些不是DataTables的参数么? 用来下载文件??

  List<T_ieo_playing> t_ieo_playings =  tIeoPlayingService.exportExcel1(conditionStr);
        File f = Files.createFileIfNoExists2("~/打币列表.xls");
        try (OutputStream out = new FileOutputStream(f)) {
            J4E.toExcel(out, t_ieo_playings, null);
        }
        catch (Exception e){
            e.printStackTrace();
        }
        return f;

那些事条件查询带过来的 dao层 写的自定义sql

文件生成了没,内容对不对

文件生成了 但是 数据还是不对

  @J4EName("项目名称")
    private String project_name;

实体这么写 对么

map	keys
{"id":"81da64a5a1204701b1f443d9ad84ec05","project_id":"1858e41517834ed583c897a3c082bdcb","project_name":"王磊测试01","buy_fee":2.000000000,"purchase_fee":20000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":9.800000000,"status":2,"remarks":null,"opby":"a5265a9b16a049efab926266474da49e","opat":1535706350,"delflag":false,"create_time":null,"app_time":null,"submit_time":null,"platform_uid":191625,"price":10000.000000000,"statusstr":"已审核"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"4cce0938880f41b69fe8002d8c0112fd","project_id":"b4a041cd74084113b36c4760464a1b90","project_name":"兑换usdt","buy_fee":800.000000000,"purchase_fee":0.800000000,"uid":100059,"coin_name":"USDT","coin_id":"15","currency":"BTC","currency_id":"2","fee_per":10.000000000,"fee":80.000000000,"playing_coins":720.000000000,"status":1,"remarks":"111","opby":"a5265a9b16a049efab926266474da49e","opat":1536212330,"delflag":false,"create_time":null,"app_time":"2018-09-01 16:39:54","submit_time":"2018-09-01 16:39:36","platform_uid":191625,"price":0.001000000,"statusstr":"待审核"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"8e55bb5a863e472b846dc2e84654ac2c","project_id":"afc44cc7182d44f3bdefe29e568b57f0","project_name":"兑换111","buy_fee":2.000000000,"purchase_fee":200.000000000,"uid":100059,"coin_name":"USDT","coin_id":"15","currency":"CCC","currency_id":"13","fee_per":1.000000000,"fee":0.020000000,"playing_coins":1.980000000,"status":2,"remarks":null,"opby":"a5265a9b16a049efab926266474da49e","opat":1535959423,"delflag":false,"create_time":"2018-09-01 17:18:06","app_time":"2018-09-03 15:24:05","submit_time":"2018-09-03 15:24:11","platform_uid":191625,"price":100.000000000,"statusstr":"已审核"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"4d1300a855cd475b8c51a011b22123d2","project_id":"a900d7e99d5e42178fc378937e09a35f","project_name":"兑换BTC","buy_fee":2.000000000,"purchase_fee":2000.000000000,"uid":100059,"coin_name":"BTC","coin_id":"2","currency":"CCC","currency_id":"13","fee_per":10.000000000,"fee":0.200000000,"playing_coins":1.800000000,"status":0,"remarks":null,"opby":"","opat":1536217291,"delflag":false,"create_time":"2018-09-06 15:01:31","app_time":null,"submit_time":null,"platform_uid":191625,"price":1000.000000000,"statusstr":"新建"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]
{"id":"dfb84194b06349f9835e4757244adba1","project_id":"bf0a24475dca45b198cfc880fcbdcb06","project_name":"兑换专用2","buy_fee":200.000000000,"purchase_fee":20000.000000000,"uid":100059,"coin_name":"ETH","coin_id":"4","currency":"CCC","currency_id":"13","fee_per":20.000000000,"fee":40.000000000,"playing_coins":160.000000000,"status":2,"remarks":null,"opby":"a5265a9b16a049efab926266474da49e","opat":1535790988,"delflag":false,"create_time":null,"app_time":"2018-09-01 16:37:26","submit_time":"2018-09-01 17:28:47","platform_uid":191625,"price":100.000000000,"statusstr":"已审核"}	["id", "project_id", "project_name", "buy_fee", "purchase_fee", "uid", "coin_name", "coin_id", "currency", "currency_id", "fee_per", "fee", "playing_coins", "status", "remarks", "opby", "opat", "delflag", "create_time", "app_time", "submit_time", "platform_uid", "price", "statusstr"]

你贴的这堆json是什么来头

@wendal 这就是excel导出的内容 我从库里读出来是个List

添加回复
请先登陆
回到顶部