【物料查看】时间字段格式化

This commit is contained in:
10001392 2024-11-05 18:23:37 +08:00
parent 6ff89d1693
commit 8e97f53ffa
2 changed files with 3 additions and 24 deletions

View File

@ -62,7 +62,6 @@ 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;
@ -222,7 +221,6 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
if (result.size() > 0) {
initMaterialAttrsMapForPageList(result, childList);
formatTimeField(result);
}
dataResult.setRecords(result);
@ -239,25 +237,6 @@ 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")));
}
});
}
/**
* 获取总页数
*

View File

@ -81,13 +81,13 @@
`apply_user_code` AS applyUserCode,
`apply_dept_name` AS applyDeptName,
`updated_by_user_code` AS updatedByUserCode,
`last_apply_time` AS lastApplyTime,
DATE_FORMAT(last_apply_time,'%Y-%m-%d %H:%i:%s') AS lastApplyTime,
`replace_material_no` AS replaceMaterialNo,
`material_class` AS materialClass,
`created_by` AS createdBy,
`created_time` AS createdTime,
DATE_FORMAT(created_time,'%Y-%m-%d %H:%i:%s') AS createdTime,
`updated_by` AS updatedBy,
`updated_time` AS updatedTime,
DATE_FORMAT(updated_time,'%Y-%m-%d %H:%i:%s') AS updatedTime,
`oa_row_id` AS oaRowId ,
IF(reuse_of_once_state=1,'一次性','重复') as reuseOfOnceState,
(case process_state when 0 then '待提交' when 2 then '已驳回' when 5 then '变更申请中' when 10 then 'OA审核中' when 15 then