feat(project): 增加 BG 字段并优化日志内容显示

- 在 ProjectInfoServiceImpl 中添加 BG_TYPE_DICT_TYPE 常量
- 更新项目信息变更日志,增加 BG 字段对比
- 修改产品新增和删除日志的生成逻辑,优化空列表处理- 在项目操作日志页面增加内容换行显示,提高可读性
master
chenhao 2025-06-06 16:10:32 +08:00
parent 06f48e6825
commit 5638e31c61
1 changed files with 7 additions and 3 deletions

View File

@ -54,6 +54,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
public static final String INDUSTRY_TYPE_DICT_TYPE = "industry_type";
public static final String BG_TYPE_DICT_TYPE = "bg_type";
public static final String PROJECT_STAGE_DICT_TYPE = "project_stage";
public static final String OPERATE_INSTITUTION_DICT_TYPE = "operate_institution";
@ -222,7 +223,10 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
int logIndex = 1;
// 比较项目信息字段差异
logIndex = compareField(logContent, logIndex, "项目名称", oldProjectInfo.getProjectName(), projectInfo.getProjectName());
logIndex = compareField(logContent, logIndex, "客户名称", oldProjectInfo.getCustomerName(), projectInfo.getCustomerName());
logIndex = compareField(logContent, logIndex, "最终客户", oldProjectInfo.getCustomerName(), projectInfo.getCustomerName());
logIndex = compareField(logContent, logIndex, "BG",
DictUtils.getDictLabel(BG_TYPE_DICT_TYPE, oldProjectInfo.getBgProperty()),
DictUtils.getDictLabel(BG_TYPE_DICT_TYPE, projectInfo.getBgProperty()));
logIndex = compareField(logContent, logIndex, "行业", DictUtils.getDictLabel(INDUSTRY_TYPE_DICT_TYPE, oldProjectInfo.getIndustryType())
, DictUtils.getDictLabel(INDUSTRY_TYPE_DICT_TYPE, projectInfo.getIndustryType()));
@ -321,13 +325,13 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
Map<Long, ProjectProductInfo> newMap = CollUtil.isEmpty(newList) ? new HashMap<>() : newList.stream()
.collect(Collectors.toMap(ProjectProductInfo::getId, product -> product));
//新增
List<String> addCode = newList.stream().filter(item -> item.getId() == null).map(ProjectProductInfo::getProductBomCode).collect(Collectors.toList());
List<String> addCode = CollUtil.isEmpty(newList) ? Collections.emptyList() : newList.stream().filter(item -> item.getId() == null).map(ProjectProductInfo::getProductBomCode).collect(Collectors.toList());
if (CollUtil.isNotEmpty(addCode)) {
logContent.append(index).append(".产品新增").append(type).append(":").append(String.join(",", addCode)).append("\n");
index++;
}
//删除
List<String> deleteCode = oldList.stream().filter(item -> !newMap.containsKey(item.getId())).map(ProjectProductInfo::getProductBomCode).collect(Collectors.toList());
List<String> deleteCode =CollUtil.isEmpty(oldList) ? Collections.emptyList() : oldList.stream().filter(item -> !newMap.containsKey(item.getId())).map(ProjectProductInfo::getProductBomCode).collect(Collectors.toList());
if (CollUtil.isNotEmpty(deleteCode)) {
logContent.append(index).append(".产品删除").append(type).append(":").append(String.join(",", deleteCode)).append("\n");
index++;