diff --git a/auth-center/src/main/java/com/jmsoftware/maf/authcenter/user/service/impl/UserServiceImpl.java b/auth-center/src/main/java/com/jmsoftware/maf/authcenter/user/service/impl/UserServiceImpl.java index 5b0f96f8..3fbcd77c 100644 --- a/auth-center/src/main/java/com/jmsoftware/maf/authcenter/user/service/impl/UserServiceImpl.java +++ b/auth-center/src/main/java/com/jmsoftware/maf/authcenter/user/service/impl/UserServiceImpl.java @@ -118,7 +118,7 @@ public LoginResponse login(@Valid LoginPayload payload) throws SecurityException } val jwt = this.jwtService.createJwt(payload.getRememberMe(), user.getId(), user.getUsername(), null, null); val response = new LoginResponse(); - response.setGreeting(this.messageSource.getMessage(("greeting"), null, LocaleContextHolder.getLocale())); + response.setGreeting(this.messageSource.getMessage("greeting", null, LocaleContextHolder.getLocale())); response.setJwt(jwt); return response; } diff --git a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/controller/WriteResourceController.java b/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/controller/WriteResourceController.java index 5875082a..d8999d23 100644 --- a/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/controller/WriteResourceController.java +++ b/oss-center/src/main/java/com/jmsoftware/maf/osscenter/write/controller/WriteResourceController.java @@ -7,6 +7,8 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; +import org.springframework.context.MessageSource; +import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -28,12 +30,14 @@ @Api(tags = {"Write resource API"}) public class WriteResourceController { private final WriteResourceService writeResourceService; + private final MessageSource messageSource; @PostMapping("/upload/single") @SneakyThrows({IOException.class, BizException.class}) @ApiOperation(value = "Upload single resource", notes = "Upload single resource") public ResponseBodyBean uploadSingleResource(@RequestParam("file") MultipartFile multipartFile) { return ResponseBodyBean.ofSuccess(this.writeResourceService.uploadSingleResource(multipartFile), - "Succeed to upload"); + this.messageSource.getMessage("uploaded", null, + LocaleContextHolder.getLocale())); } } diff --git a/oss-center/src/main/resources/messages.properties b/oss-center/src/main/resources/messages.properties index 39490033..bea17b13 100644 --- a/oss-center/src/main/resources/messages.properties +++ b/oss-center/src/main/resources/messages.properties @@ -1 +1,2 @@ greeting=Hello! +uploaded=Upload single resource successfully diff --git a/oss-center/src/main/resources/messages_zh_CN.properties b/oss-center/src/main/resources/messages_zh_CN.properties index 75f72bdd..99b80f47 100644 --- a/oss-center/src/main/resources/messages_zh_CN.properties +++ b/oss-center/src/main/resources/messages_zh_CN.properties @@ -1 +1,2 @@ greeting=你好! +uploaded=成功上传单个资源