feat(app): 添加重新生成应用配置文件功能

- 在AppController中新增regenerateConfigFile接口
- 在AppService中实现重新生成配置文件的业务逻辑
- 记录重新生成配置文件的操作日志
- 在前端API中添加重新生成功能调用方法
- 在应用详情页面添加重新生成按钮和确认对话框
- 实现重新生成配置文件的前端交互逻辑
这个提交包含在:
XuqmGroup 2026-06-02 17:43:36 +08:00
父节点 596927c1c6
当前提交 e3d7fbd591
共有 2 个文件被更改,包括 19 次插入0 次删除

查看文件

@ -182,6 +182,13 @@ public class AppController {
.body(encrypted.getBytes(java.nio.charset.StandardCharsets.UTF_8)); .body(encrypted.getBytes(java.nio.charset.StandardCharsets.UTF_8));
} }
@PostMapping("/{appKey}/config-file/regenerate")
public ResponseEntity<ApiResponse<Void>> regenerateConfigFile(@PathVariable String appKey,
@AuthenticationPrincipal String tenantId) {
appService.regenerateConfigFile(appKey, tenantId);
return ResponseEntity.ok(ApiResponse.ok());
}
/** /**
* Parse an uploaded config file and return its decrypted contents. * Parse an uploaded config file and return its decrypted contents.
* Used by the security center to verify config file information. * Used by the security center to verify config file information.

查看文件

@ -100,6 +100,18 @@ public class AppService {
return content; return content;
} }
@Transactional
public String regenerateConfigFile(String appKey, String tenantId) {
AppEntity app = getByAppKey(appKey, tenantId);
String content = generateConfigFileContent(app);
app.setConfigFileContent(content);
appRepository.save(app);
operationLogService.record(tenantId, "APP", "APP", appKey, "REGENERATE_CONFIG",
"重新生成应用「" + app.getName() + "」的 Config 文件",
Map.of("name", app.getName()));
return content;
}
public AppEntity update(String appKey, String tenantId, CreateAppRequest req) { public AppEntity update(String appKey, String tenantId, CreateAppRequest req) {
AppEntity app = getByAppKey(appKey, tenantId); AppEntity app = getByAppKey(appKey, tenantId);
Map<String, Object> before = new LinkedHashMap<>(); Map<String, Object> before = new LinkedHashMap<>();