Commit 687772a1 by 丁伟峰

Merge branch 'feature-dingwf-0715' into develop

2 parents 3ffb881d 8b5bd969
package com.dituhui.pea.order.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
@Configuration
public class JacksonConfig {
@Bean
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
// 日期和时间格式化
JavaTimeModule javaTimeModule = new JavaTimeModule();
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
objectMapper.registerModule(javaTimeModule);
return objectMapper;
}
}
package com.dituhui.pea.order.dto; package com.dituhui.pea.order.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -65,12 +70,16 @@ public class EngineersGanttRespDTO { ...@@ -65,12 +70,16 @@ public class EngineersGanttRespDTO {
/** /**
* 开始时间 * 开始时间
*/ */
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startTime; private LocalDateTime startTime;
/** /**
* 结束时间 * 结束时间
*/ */
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTime; private LocalDateTime endTime;
/** /**
* 鼠标悬停提示 * 鼠标悬停提示
......
package com.dituhui.pea.order.dto; package com.dituhui.pea.order.dto;
import com.dituhui.pea.order.config.OrderConfig; import com.dituhui.pea.order.config.OrderConfig;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate; import java.time.LocalDate;
...@@ -18,7 +23,10 @@ public class OrderChangeListReqDTO { ...@@ -18,7 +23,10 @@ public class OrderChangeListReqDTO {
private String levelValue; private String levelValue;
private int page = OrderConfig.DEFAULT_PAGE_INDEX; private int page = OrderConfig.DEFAULT_PAGE_INDEX;
private int size = OrderConfig.DEFAULT_PAGE_SIZE; private int size = OrderConfig.DEFAULT_PAGE_SIZE;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDate date = LocalDate.now(); private LocalDate date = LocalDate.now();
/** /**
* 排序 * 排序
......
package com.dituhui.pea.order.dto; package com.dituhui.pea.order.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@lombok.Data @lombok.Data
...@@ -39,6 +45,9 @@ public class OrderChangeListRespDTO { ...@@ -39,6 +45,9 @@ public class OrderChangeListRespDTO {
/** /**
* 更新时间 * 更新时间
*/ */
private String updateTime; @JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
} }
} }
...@@ -59,7 +59,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -59,7 +59,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
.setOperator(e.getOperator()) .setOperator(e.getOperator())
.setDescription(e.getContent()) .setDescription(e.getContent())
.setMemo(e.getMemo()) .setMemo(e.getMemo())
.setUpdateTime(e.getUpdateTime().toString()); .setUpdateTime(e.getUpdateTime());
contents.add(content); contents.add(content);
} }
OrderChangeListRespDTO respDTO = new OrderChangeListRespDTO(); OrderChangeListRespDTO respDTO = new OrderChangeListRespDTO();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!