2016-02-24 commit
This commit is contained in:
parent
841b75ac7e
commit
df747e08f7
6
pom.xml
6
pom.xml
@ -88,6 +88,12 @@
|
|||||||
<version>2.4</version>
|
<version>2.4</version>
|
||||||
<classifier>jdk15</classifier>
|
<classifier>jdk15</classifier>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.caucho</groupId>
|
||||||
|
<artifactId>hessian</artifactId>
|
||||||
|
<version>4.0.38</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<finalName>useful-code</finalName>
|
<finalName>useful-code</finalName>
|
||||||
|
8
src/main/java/osc/git/eh3/readlogs/IReadLogs.java
Normal file
8
src/main/java/osc/git/eh3/readlogs/IReadLogs.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package osc.git.eh3.readlogs;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IReadLogs {
|
||||||
|
public String readFile(Date startDate, Date endDate, List<String> mapids);
|
||||||
|
}
|
38
src/main/java/osc/git/eh3/test/DirList.java
Normal file
38
src/main/java/osc/git/eh3/test/DirList.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package osc.git.eh3.test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FilenameFilter;
|
||||||
|
|
||||||
|
public class DirList {
|
||||||
|
/**
|
||||||
|
* @param args
|
||||||
|
* The file pattern that need to be matched.
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
File path = new File("D://");
|
||||||
|
String arg = "dsp_impclk_15";
|
||||||
|
String[] list;
|
||||||
|
if (arg.length() == 0)
|
||||||
|
list = path.list();
|
||||||
|
else
|
||||||
|
list = path.list(new DirFilter(arg));
|
||||||
|
for (int i = 0; i < list.length; ++i) {
|
||||||
|
System.out.println(list[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DirFilter implements FilenameFilter {
|
||||||
|
String afn;
|
||||||
|
|
||||||
|
DirFilter(String afn) {
|
||||||
|
this.afn = afn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean accept(File dir, String name) {
|
||||||
|
// Strip path information.
|
||||||
|
String f = new File(name).getName();
|
||||||
|
return f.indexOf(afn) != -1;
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,13 @@
|
|||||||
package osc.git.eh3.test;
|
package osc.git.eh3.test;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.ParsePosition;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import com.caucho.hessian.client.HessianProxyFactory;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
import osc.git.eh3.readlogs.IReadLogs;
|
||||||
|
|
||||||
public class TestCode {
|
public class TestCode {
|
||||||
|
|
||||||
@ -79,12 +75,26 @@ public class TestCode {
|
|||||||
// String str = "http://www.test.com";
|
// String str = "http://www.test.com";
|
||||||
// System.out.println(str.replace("http://www.", "").replace("www.", ""));
|
// System.out.println(str.replace("http://www.", "").replace("www.", ""));
|
||||||
|
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
|
// SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH");
|
// SimpleDateFormat sdf = new SimpleDateFormat("HH");
|
||||||
String str = "23:59:59";
|
// String str = "23:59:59";
|
||||||
System.out.println(sdf.format(formatter.parse(str)));
|
// System.out.println(sdf.format(formatter.parse(str)));
|
||||||
|
|
||||||
|
|
||||||
|
// Spring Hessian代理Servelet
|
||||||
|
// String url = "http://localhost:8080/sync-logs/remote/readlogs";
|
||||||
|
// HessianProxyFactory factory = new HessianProxyFactory();
|
||||||
|
//
|
||||||
|
// IReadLogs readLogs = (IReadLogs) factory.create(IReadLogs.class, url);
|
||||||
|
// JSONArray result = JSONArray.fromObject(readLogs.readFile("2016-02-22 15:00:00", "00000000000000"));
|
||||||
|
// System.out.println(result);
|
||||||
|
|
||||||
|
|
||||||
|
JSONArray jonsArr = new JSONArray();
|
||||||
|
JSONArray arr = new JSONArray();
|
||||||
|
jonsArr = JSONArray.fromObject("[ { 'category': 2, 'clks': 4, 'cost': 13, 'createtime': null, 'creativeid': 'cf0714f4-8b92-41f2-a843-19c94fe3af74', 'downloads': 0, 'flag': 0, 'imprs': 5, 'regists': 0, 'time': null } ]");
|
||||||
|
arr.addAll(JSONArray.toCollection(jonsArr));
|
||||||
|
System.out.println(arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Long parseDate(String s) {
|
public static Long parseDate(String s) {
|
||||||
|
Loading…
Reference in New Issue
Block a user