报表导出日期没有转换bug修复

This commit is contained in:
JeeLowCode
2025-02-06 10:47:32 +08:00
parent 91e015fb96
commit 9b720723bb
3 changed files with 16 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ public interface IReportService extends IService<ReportEntity> {
WebConfigVo getWebConfig(String reportCode);
//回显字典
void dictView(Long reportId,List<Map<String, Object>> records);
void formatDataList(Long reportId,List<Map<String, Object>> records);
//初始化增强插件
void initEnhancePluginManager();

View File

@@ -661,8 +661,8 @@ public class FrameServiceImpl implements IFrameService {
Map<String, JeeLowCodeFieldTypeEnum> fieldTypeEnumMap = dbFormService.getReportFieldCodeAndTypeEnum(reportEntity.getId());
Func.handlePlusDataList(dataList, fieldTypeEnumMap);
//处理字典回显
reportService.dictView(reportEntity.getId(), dataList);
//处理字典、日期等值回显
reportService.formatDataList(reportEntity.getId(), dataList);
//返回结果
return ResultDataModel.fomat(total, dataList);
}

View File

@@ -50,6 +50,7 @@ import com.jeelowcode.framework.utils.model.JeeLowCodeDict;
import com.jeelowcode.framework.utils.params.JeeLowCodeDictParam;
import com.jeelowcode.framework.utils.tool.spring.SpringUtils;
import com.jeelowcode.framework.utils.utils.FuncBase;
import com.jeelowcode.framework.utils.utils.JeeLowCodeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
@@ -211,7 +212,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, ReportEntity> i
//回显字典
@Override
public void dictView(Long reportId, List<Map<String, Object>> records) {
public void formatDataList(Long reportId, List<Map<String, Object>> records) {
//获取字典code
LambdaQueryWrapper<ReportFieldEntity> fieldWrapper = new LambdaQueryWrapper<>();
fieldWrapper.isNotNull(ReportFieldEntity::getDictCode);
@@ -250,6 +251,17 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, ReportEntity> i
}
//遍历数据
for (Map<String, Object> dataMap : records) {
// 转换并格式化所有值
Map<String, String> formattedMap = dataMap.entrySet().stream()
.collect(Collectors.toMap(
Map.Entry::getKey,
entry -> JeeLowCodeUtils.formatDate(entry.getValue())
));
// 使用格式化后的映射替换原始映射
dataMap.clear();
dataMap.putAll(formattedMap);
Set<Map.Entry<String, Map<String, String>>> entries = field2DictMap.entrySet();
Iterator<Map.Entry<String, Map<String, String>>> iterator = entries.iterator();