|
@@ -6,10 +6,15 @@ import java.time.LocalTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.util.Date;
|
|
|
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.apache.commons.lang3.builder.ToStringBuilder;
|
|
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
|
import com.ruoyi.common.annotation.Excel;
|
|
|
import com.ruoyi.common.core.domain.BaseEntity;
|
|
|
+import org.springframework.format.annotation.DateTimeFormat;
|
|
|
|
|
|
import javax.validation.constraints.*;
|
|
|
|
|
@@ -31,9 +36,12 @@ public class EntranceBatch extends BaseEntity
|
|
|
private Long supplierId;
|
|
|
|
|
|
/** 进场时间 */
|
|
|
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
+ @JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
|
|
+ @JsonSerialize(using = LocalDateTimeSerializer.class)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
@Excel(name = "进场时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
|
|
- private Date entranceTime;
|
|
|
+ private LocalDateTime entranceTime;
|
|
|
|
|
|
/** 产地:三选一:1-本市、2-市外、3-省外,默认本市 */
|
|
|
@Excel(name = "产地:三选一:1-本市、2-市外、3-省外,默认本市")
|
|
@@ -143,29 +151,29 @@ public class EntranceBatch extends BaseEntity
|
|
|
return supplierId;
|
|
|
}
|
|
|
|
|
|
- public void setEntranceTime(Date entranceTime)
|
|
|
+ public void setEntranceTime(LocalDateTime entranceTime)
|
|
|
{
|
|
|
this.entranceTime = entranceTime;
|
|
|
}
|
|
|
|
|
|
public void entranceTimeAdapter() {
|
|
|
if(entranceTime != null) {
|
|
|
- LocalDateTime realTime = entranceTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ LocalDateTime realTime = entranceTime;
|
|
|
if((realTime.getHour() == 0) && (realTime.getMinute() == 0) && (realTime.getSecond() == 0)) {
|
|
|
LocalTime nowTime = LocalTime.now();
|
|
|
realTime = realTime.withHour(nowTime.getHour())
|
|
|
.withMinute(nowTime.getMinute())
|
|
|
.minusSeconds(nowTime.getSecond())
|
|
|
.withNano(nowTime.getNano());
|
|
|
- entranceTime = Date.from(realTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
+ entranceTime = realTime;
|
|
|
}
|
|
|
}else {
|
|
|
- this.entranceTime = new Date();
|
|
|
+ this.entranceTime = LocalDateTime.now();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@NotNull(message = "进场时间不能为空")
|
|
|
- public Date getEntranceTime()
|
|
|
+ public LocalDateTime getEntranceTime()
|
|
|
{
|
|
|
return entranceTime;
|
|
|
}
|
|
@@ -392,11 +400,13 @@ public class EntranceBatch extends BaseEntity
|
|
|
return animalEartags;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public void setRemark(String remark)
|
|
|
{
|
|
|
this.remark = remark;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
@Size(min = 0, max = 50, message = "备注输入超出最大长度限制(50位)")
|
|
|
public String getRemark()
|
|
|
{
|