mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-21 02:58:09 +08:00
暂时去掉jackson代码,用于展示数据的代码放在客户端比较好些
This commit is contained in:
@@ -6,8 +6,6 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import me.chanjar.weixin.mp.util.json.WxLongTimeJsonSerializer;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@@ -49,7 +47,6 @@ public class WxMpXmlMessage implements Serializable {
|
||||
private String fromUserName;
|
||||
|
||||
@XStreamAlias("CreateTime")
|
||||
@JsonSerialize(using = WxLongTimeJsonSerializer.class)
|
||||
private Long createTime;
|
||||
|
||||
@XStreamAlias("MsgType")
|
||||
|
@@ -1,11 +1,10 @@
|
||||
package me.chanjar.weixin.mp.bean.kefu.result;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import me.chanjar.weixin.mp.util.json.WxLongTimeJsonSerializer;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by Binary Wang on 2016/7/18.
|
||||
*/
|
||||
@@ -38,7 +37,6 @@ public class WxMpKfMsgRecord {
|
||||
* time 操作时间,unix时间戳
|
||||
*/
|
||||
@SerializedName("time")
|
||||
@JsonSerialize(using = WxLongTimeJsonSerializer.class)
|
||||
private Long time;
|
||||
|
||||
@Override
|
||||
|
@@ -1,25 +0,0 @@
|
||||
package me.chanjar.weixin.mp.util.json;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.Format;
|
||||
|
||||
import org.apache.commons.lang3.time.FastDateFormat;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
/**
|
||||
* Created by Binary Wang on 2016/7/13.
|
||||
*/
|
||||
public class WxLongTimeJsonSerializer extends JsonSerializer<Long> {
|
||||
private static Format DF = FastDateFormat.getInstance(
|
||||
"yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public void serialize(Long value, JsonGenerator gen,
|
||||
SerializerProvider serializers)
|
||||
throws IOException {
|
||||
gen.writeString(DF.format(value * 1000));
|
||||
}
|
||||
}
|
@@ -9,8 +9,6 @@ import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
@@ -150,20 +148,20 @@ public class WxMpKefuServiceImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKfMsgList() throws WxErrorException, JsonProcessingException {
|
||||
public void testKfMsgList() throws WxErrorException {
|
||||
Date startTime = DateTime.now().minusDays(1).toDate();
|
||||
Date endTime = DateTime.now().minusDays(0).toDate();
|
||||
WxMpKfMsgList result = this.wxService.getKefuService().kfMsgList(startTime,endTime, 1L, 50);
|
||||
Assert.assertNotNull(result);
|
||||
System.err.println(new ObjectMapper().writeValueAsString(result));
|
||||
System.err.println(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKfMsgListAll() throws WxErrorException, JsonProcessingException {
|
||||
public void testKfMsgListAll() throws WxErrorException {
|
||||
Date startTime = DateTime.now().minusDays(1).toDate();
|
||||
Date endTime = DateTime.now().minusDays(0).toDate();
|
||||
WxMpKfMsgList result = this.wxService.getKefuService().kfMsgList(startTime,endTime);
|
||||
Assert.assertNotNull(result);
|
||||
System.err.println(new ObjectMapper().writeValueAsString(result));
|
||||
System.err.println(result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user