mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 18:46:10 +08:00 
			
		
		
		
	暂时去掉jackson代码,用于展示数据的代码放在客户端比较好些
This commit is contained in:
		
							
								
								
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							| @ -49,7 +49,6 @@ | |||||||
|     <slf4j.version>1.7.10</slf4j.version> |     <slf4j.version>1.7.10</slf4j.version> | ||||||
|     <logback.version>1.1.2</logback.version> |     <logback.version>1.1.2</logback.version> | ||||||
|     <jodd-http.version>3.6.7</jodd-http.version> |     <jodd-http.version>3.6.7</jodd-http.version> | ||||||
|     <jackson.version>2.8.0</jackson.version> |  | ||||||
|     <jedis.version>2.9.0</jedis.version> |     <jedis.version>2.9.0</jedis.version> | ||||||
|     <gson.version>2.7</gson.version> |     <gson.version>2.7</gson.version> | ||||||
|     <commons-lang3.version>3.4</commons-lang3.version> |     <commons-lang3.version>3.4</commons-lang3.version> | ||||||
| @ -106,11 +105,6 @@ | |||||||
|       <artifactId>commons-lang3</artifactId> |       <artifactId>commons-lang3</artifactId> | ||||||
|       <version>${commons-lang3.version}</version> |       <version>${commons-lang3.version}</version> | ||||||
|     </dependency> |     </dependency> | ||||||
|     <dependency> |  | ||||||
|       <groupId>com.fasterxml.jackson.core</groupId> |  | ||||||
|       <artifactId>jackson-databind</artifactId> |  | ||||||
|       <version>${jackson.version}</version> |  | ||||||
|     </dependency> |  | ||||||
|     <dependency> |     <dependency> | ||||||
|       <groupId>redis.clients</groupId> |       <groupId>redis.clients</groupId> | ||||||
|       <artifactId>jedis</artifactId> |       <artifactId>jedis</artifactId> | ||||||
|  | |||||||
| @ -6,8 +6,6 @@ import java.io.Serializable; | |||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | 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.io.IOUtils; | ||||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | import org.apache.commons.lang3.builder.ToStringBuilder; | ||||||
| import org.apache.commons.lang3.builder.ToStringStyle; | import org.apache.commons.lang3.builder.ToStringStyle; | ||||||
| @ -49,7 +47,6 @@ public class WxMpXmlMessage implements Serializable { | |||||||
|   private String fromUserName; |   private String fromUserName; | ||||||
|  |  | ||||||
|   @XStreamAlias("CreateTime") |   @XStreamAlias("CreateTime") | ||||||
|   @JsonSerialize(using = WxLongTimeJsonSerializer.class) |  | ||||||
|   private Long createTime; |   private Long createTime; | ||||||
|  |  | ||||||
|   @XStreamAlias("MsgType") |   @XStreamAlias("MsgType") | ||||||
|  | |||||||
| @ -1,11 +1,10 @@ | |||||||
| package me.chanjar.weixin.mp.bean.kefu.result; | 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.ToStringBuilder; | ||||||
| import org.apache.commons.lang3.builder.ToStringStyle; | import org.apache.commons.lang3.builder.ToStringStyle; | ||||||
|  |  | ||||||
|  | import com.google.gson.annotations.SerializedName; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Created by Binary Wang on 2016/7/18. |  * Created by Binary Wang on 2016/7/18. | ||||||
|  */ |  */ | ||||||
| @ -38,7 +37,6 @@ public class WxMpKfMsgRecord { | |||||||
|    * time	操作时间,unix时间戳 |    * time	操作时间,unix时间戳 | ||||||
|    */ |    */ | ||||||
|   @SerializedName("time") |   @SerializedName("time") | ||||||
|   @JsonSerialize(using = WxLongTimeJsonSerializer.class) |  | ||||||
|   private Long time; |   private Long time; | ||||||
|  |  | ||||||
|   @Override |   @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.Guice; | ||||||
| import org.testng.annotations.Test; | import org.testng.annotations.Test; | ||||||
|  |  | ||||||
| import com.fasterxml.jackson.core.JsonProcessingException; |  | ||||||
| import com.fasterxml.jackson.databind.ObjectMapper; |  | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
|  |  | ||||||
| import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||||
| @ -150,20 +148,20 @@ public class WxMpKefuServiceImplTest { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   public void testKfMsgList() throws WxErrorException, JsonProcessingException { |   public void testKfMsgList() throws WxErrorException { | ||||||
|     Date startTime = DateTime.now().minusDays(1).toDate(); |     Date startTime = DateTime.now().minusDays(1).toDate(); | ||||||
|     Date endTime = DateTime.now().minusDays(0).toDate(); |     Date endTime = DateTime.now().minusDays(0).toDate(); | ||||||
|     WxMpKfMsgList result = this.wxService.getKefuService().kfMsgList(startTime,endTime, 1L, 50); |     WxMpKfMsgList result = this.wxService.getKefuService().kfMsgList(startTime,endTime, 1L, 50); | ||||||
|     Assert.assertNotNull(result); |     Assert.assertNotNull(result); | ||||||
|     System.err.println(new ObjectMapper().writeValueAsString(result)); |     System.err.println(result); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   public void testKfMsgListAll() throws WxErrorException, JsonProcessingException { |   public void testKfMsgListAll() throws WxErrorException { | ||||||
|     Date startTime = DateTime.now().minusDays(1).toDate(); |     Date startTime = DateTime.now().minusDays(1).toDate(); | ||||||
|     Date endTime = DateTime.now().minusDays(0).toDate(); |     Date endTime = DateTime.now().minusDays(0).toDate(); | ||||||
|     WxMpKfMsgList result = this.wxService.getKefuService().kfMsgList(startTime,endTime); |     WxMpKfMsgList result = this.wxService.getKefuService().kfMsgList(startTime,endTime); | ||||||
|     Assert.assertNotNull(result); |     Assert.assertNotNull(result); | ||||||
|     System.err.println(new ObjectMapper().writeValueAsString(result)); |     System.err.println(result); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 BinaryWang
					BinaryWang