PsDateTimeDeserializer.java 788 B

1234567891011121314151617181920212223
  1. package com.persagy.fm.common.serializer;
  2. import com.fasterxml.jackson.core.JsonParser;
  3. import com.fasterxml.jackson.core.JsonProcessingException;
  4. import com.fasterxml.jackson.databind.DeserializationContext;
  5. import com.fasterxml.jackson.databind.JsonDeserializer;
  6. import com.persagy.fm.common.lang.PsDateTime;
  7. import org.springframework.boot.jackson.JsonComponent;
  8. import java.io.IOException;
  9. /**
  10. * @Description 时间反序列化
  11. * @author Charlie Yu
  12. * @version 1.0 2021-04-08
  13. */
  14. @JsonComponent
  15. public class PsDateTimeDeserializer extends JsonDeserializer<PsDateTime> {
  16. @Override
  17. public PsDateTime deserialize(JsonParser p, DeserializationContext context) throws IOException, JsonProcessingException {
  18. return PsDateTime.parsePsDateTime(p.getLongValue());
  19. }
  20. }