fix: 修改代码生成器问题

This commit is contained in:
bunny 2025-04-09 09:51:00 +08:00
parent a8c2684fcc
commit fb1edaddb3
3 changed files with 16 additions and 21 deletions

View File

@ -5,7 +5,6 @@
<groupId>cn.bunny</groupId>
<artifactId>auth-server-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>generator-code</artifactId>

View File

@ -17,7 +17,6 @@ import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.Map;
@ -40,9 +39,9 @@ public class I18nController {
@Operation(summary = "获取多语言内容", description = "获取多语言内容")
@GetMapping("getI18n")
public Mono<Result<Map<String, Object>>> getI18n() {
public Result<Map<String, Object>> getI18n() {
Map<String, Object> vo = i18nService.getI18n();
return Mono.just(Result.success(vo));
return Result.success(vo);
}
@Operation(summary = "获取管理多语言列", description = "获取管理多语言列")

View File

@ -155,26 +155,23 @@ public class I18nServiceImpl extends ServiceImpl<I18nMapper, I18n> implements I1
@Override
public ResponseEntity<byte[]> downloadI18n() {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputStream);
try (ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputStream)) {
// 查找默认语言内容
List<I18n> i18nList = list();
HashMap<String, Object> hashMap = I18nUtil.getMap(i18nList);
// 查找默认语言内容
List<I18n> i18nList = list();
HashMap<String, Object> hashMap = I18nUtil.getMap(i18nList);
hashMap.forEach((k, v) -> {
try {
ZipEntry zipEntry = new ZipEntry(k + ".json");
zipOutputStream.putNextEntry(zipEntry);
hashMap.forEach((k, v) -> {
try {
ZipEntry zipEntry = new ZipEntry(k + ".json");
zipOutputStream.putNextEntry(zipEntry);
zipOutputStream.write(JSON.toJSONString(v).getBytes(StandardCharsets.UTF_8));
zipOutputStream.closeEntry();
} catch (IOException e) {
throw new RuntimeException(e);
}
});
try {
zipOutputStream.close();
zipOutputStream.write(JSON.toJSONString(v).getBytes(StandardCharsets.UTF_8));
zipOutputStream.closeEntry();
} catch (IOException e) {
throw new RuntimeException(e);
}
});
} catch (IOException e) {
throw new RuntimeException(e);
}