feat(周报功能重构):空值处理
This commit is contained in:
parent
e6413d1efe
commit
1354a2b7a0
|
@ -692,13 +692,22 @@ public class PmsProjectIssuesService {
|
|||
}
|
||||
|
||||
public void enrichProjectInfo(JSONObject inputJson) {
|
||||
if (inputJson == null) {
|
||||
return;
|
||||
}
|
||||
// 遍历最外层 key
|
||||
for (String projectIdStr : inputJson.keySet()) {
|
||||
Long projectId = Long.valueOf(projectIdStr); // 转换为 Long
|
||||
|
||||
Long projectId;
|
||||
try {
|
||||
projectId = Long.valueOf(projectIdStr); // 转换为 Long
|
||||
} catch (NumberFormatException e) {
|
||||
// 非数字字符串跳过处理
|
||||
continue;
|
||||
}
|
||||
// 查询项目信息
|
||||
PmsProjectDetailVo project = pmsProjectService.selectPmsProjectById(projectId);
|
||||
|
||||
JSONObject innerData = inputJson.getJSONObject(projectIdStr);
|
||||
if (project != null) {
|
||||
// 将项目信息转换为 JSONObject
|
||||
JSONObject projectInfo = new JSONObject();
|
||||
|
@ -707,18 +716,18 @@ public class PmsProjectIssuesService {
|
|||
projectInfo.put("enterpriseId", project.getPmsEnterpriseId());
|
||||
projectInfo.put("createdTime", project.getCreateTime());
|
||||
// 将 projectInfo 插入到原 JSON 的对应层级中
|
||||
JSONObject innerData = inputJson.getJSONObject(projectIdStr);
|
||||
|
||||
innerData.put("project_info", projectInfo);
|
||||
}
|
||||
|
||||
// 统计新建迭代数
|
||||
inputJson.put("this_week_new_sprint_count", pmsProjectSprintMapper.selectNewSprintCurrentNaturalWeekCount(projectId));
|
||||
innerData.put("this_week_new_sprint_count", pmsProjectSprintMapper.selectNewSprintCurrentNaturalWeekCount(projectId));
|
||||
// 统计完成迭代数
|
||||
inputJson.put("this_week_complete_sprint_count", pmsProjectSprintMapper.selectCompleteSprintCurrentNaturalWeekCount(projectId));
|
||||
innerData.put("this_week_complete_sprint_count", pmsProjectSprintMapper.selectCompleteSprintCurrentNaturalWeekCount(projectId));
|
||||
// 统计新建测试单数
|
||||
inputJson.put("this_week_new_test_sheet_count", pmsProjectTestsheetMapper.selectNewTestSheetCurrentNaturalWeekCount(projectId));
|
||||
innerData.put("this_week_new_test_sheet_count", pmsProjectTestsheetMapper.selectNewTestSheetCurrentNaturalWeekCount(projectId));
|
||||
// 统计完成测试单数
|
||||
inputJson.put("this_week_complete_test_sheet_count", pmsProjectTestsheetMapper.selectCompleteTestSheetCurrentNaturalWeekCount(projectId));
|
||||
innerData.put("this_week_complete_test_sheet_count", pmsProjectTestsheetMapper.selectCompleteTestSheetCurrentNaturalWeekCount(projectId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue