【物料查看】时间字段格式化
This commit is contained in:
parent
423a89e038
commit
6ff89d1693
|
|
@ -304,6 +304,7 @@ public class MaterialMainVO implements Serializable {
|
|||
@ApiModelProperty(value = "变更审请人")
|
||||
private String updatedByUserCode;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime lastApplyTime;
|
||||
|
||||
/**
|
||||
|
|
@ -323,6 +324,7 @@ public class MaterialMainVO implements Serializable {
|
|||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/**
|
||||
|
|
@ -335,6 +337,7 @@ public class MaterialMainVO implements Serializable {
|
|||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime updatedTime;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ import java.math.RoundingMode;
|
|||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
|
|
@ -221,6 +222,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
|||
|
||||
if (result.size() > 0) {
|
||||
initMaterialAttrsMapForPageList(result, childList);
|
||||
formatTimeField(result);
|
||||
}
|
||||
|
||||
dataResult.setRecords(result);
|
||||
|
|
@ -237,6 +239,25 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
|||
return dataResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动格式化Map中的日期格式(jackson配置的时间格式不生效)
|
||||
* @param result
|
||||
*/
|
||||
private void formatTimeField(List<Map<String, Object>> result) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
result.forEach(item -> {
|
||||
if (ObjectUtil.isNotEmpty(item.get("createdTime"))) {
|
||||
item.put("createdTime", formatter.format((Timestamp) item.get("createdTime")));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(item.get("updatedTime"))) {
|
||||
item.put("updatedTime", formatter.format((Timestamp) item.get("updatedTime")));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(item.get("lastApplyTime"))) {
|
||||
item.put("lastApplyTime", formatter.format((Timestamp) item.get("lastApplyTime")));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取总页数
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue