Jfinal开发代码碎片_导出报表_配置druid数据源_使用guava_获取当前操作系统_JDK版本_jfinal-utils_jfinal验证码
1.使用jfinal扩展包jfinal-ext-3.1.2.jar导出Excel报表,他需要依赖poi-3.12.jar
jai包下载地址:https://files.cnblogs.com/files/zhougaojun/jfinal-ext_poi.zip
导出Excel方法:
//导出Excel public void excel()throws Exception{ List<Record> list = Db.find("select * from activeaction_6_new"); PoiRender render = new PoiRender(list); String[] headers = {"ID","游戏ID","渠道ID","MAC","IP","设备版本","设备信息","IDFA","IDFV","激活时间","区域","用户ID","游戏版本号"}; String[] columns= {"id","gameId","channelId","mac","ip","deviceos","deviceinfo","idfa","idfv","actionTime","area","userid","gamever"}; render(render.headers(headers).columns(columns).sheetName("所有激活").fileName("adreport.doc")); }
2.使用guava-16.0.1.jar工具类
jar包下载地址: https://files.cnblogs.com/files/zhougaojun/guava-16.0.1.zip
使用实例:
List<Cat> list = Lists.newArrayList(new Cat("catA",5),new Cat("catB",10)
System.out.println(Strings.isNullOrEmpty(null)); System.out.println(Strings.nullToEmpty("aa"));
//一行一行读取日志文件封装成一个list
List<String> list50 = Files.readLines(new File("E:\\50_phoneadv.20150521.png\\50_phoneadv.zqgame.com.log_20150521.log"),Charset.defaultCharset());
3.jfinal使用druid数据源配置
下载地址:http://central.maven.org/maven2/com/alibaba/druid/1.0.4/
@Override public void configPlugin(Plugins me) { loadPropertyFile("dbconfig.properties"); DruidPlugin druidPlugin =new DruidPlugin(getProperty("main.jdbc.database"), getProperty("main.jdbc.user"), getProperty("main.jdbc.password"), getProperty("jdbc.driverClass")); druidPlugin.addFilter(new StatFilter()); druidPlugin.setValidationQuery("SELECT 1"); druidPlugin.setTestWhileIdle(true); druidPlugin.setTestOnBorrow(true); druidPlugin.setTestOnReturn(true); WallFilter wall = new WallFilter(); wall.setDbType("mysql"); druidPlugin.addFilter(wall); me.add(druidPlugin); ActiveRecordPlugin arp = new ActiveRecordPlugin(druidPlugin); mappingClass(arp); arp.setShowSql(false); SqlReporter.setLogger(true); me.add(arp); }
4.commons-validator
5.commons-lang3-3.4.jar 获取当前操作系统,JDK版本
6.jfinal-utils https://github.com/Dreampie/jfinal-utils,正则验证等
7.jfinal验证码,https://github.com/Dreampie/jfinal-captcha
8.jfinal插件合集,http://www.oschina.net/p/jfinal-dreampie
jfinal发邮件,https://github.com/Dreampie/jfinal-mailer