实现参数保存后自动触发项目重打标

This commit is contained in:
wkc
2026-03-19 09:06:21 +08:00
parent d922682d5a
commit f5dcbbf821
3 changed files with 77 additions and 5 deletions

View File

@@ -116,6 +116,7 @@ public class CcdiModelParamServiceImpl implements ICcdiModelParamService {
}
String username = SecurityUtils.getUsername();
int updatedCount = 0;
for (ModelParamSaveDTO.ParamValueItem item : saveDTO.getParams()) {
int updated = modelParamMapper.updateParamValue(
projectId,
@@ -126,9 +127,12 @@ public class CcdiModelParamServiceImpl implements ICcdiModelParamService {
);
if (updated == 0) {
log.warn("参数不存在或未更新paramCode={}", item.getParamCode());
continue;
}
updatedCount += updated;
}
submitAutoRebuildIfNeeded(projectId, updatedCount);
} catch (ServiceException e) {
// 业务异常,直接抛出
throw e;
@@ -218,11 +222,7 @@ public class CcdiModelParamServiceImpl implements ICcdiModelParamService {
if (!updateList.isEmpty()) {
modelParamMapper.batchUpdateParamValues(updateList);
log.info("批量更新参数成功, count={}", updateList.size());
if (projectId > 0) {
bankTagService.submitAutoRebuild(projectId, TriggerType.AUTO_PARAM_CHANGE);
log.info("项目参数保存成功,已触发流水自动重打标: projectId={}, updatedCount={}",
projectId, updateList.size());
}
submitAutoRebuildIfNeeded(projectId, updateList.size());
}
} catch (ServiceException e) {
throw e;
@@ -300,4 +300,13 @@ public class CcdiModelParamServiceImpl implements ICcdiModelParamService {
target.setUpdateBy(username);
return target;
}
private void submitAutoRebuildIfNeeded(Long projectId, int updatedCount) {
if (projectId == null || projectId <= 0 || updatedCount <= 0) {
return;
}
bankTagService.submitAutoRebuild(projectId, TriggerType.AUTO_PARAM_CHANGE);
log.info("项目参数保存成功,已触发流水自动重打标: projectId={}, updatedCount={}", projectId, updatedCount);
}
}