Skip to content

Commit

Permalink
refactor(mumu): 变量重命名
Browse files Browse the repository at this point in the history
  • Loading branch information
conifercone committed Dec 25, 2024
1 parent 7cce530 commit b419197
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
public interface ClientObjectMapper {

@AfterMapping
default void convertToAccountTimezone(@MappingTarget BaseDataTransferObject baseClientObject) {
CommonUtil.convertToAccountZone(baseClientObject);
default void convertToAccountTimezone(
@MappingTarget BaseDataTransferObject baseDataTransferObject) {
CommonUtil.convertToAccountZone(baseDataTransferObject);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,19 @@ object CommonUtil {
fun convertToAccountZone(
baseDataTransferObject: BaseDataTransferObject
) {
Optional.ofNullable(baseDataTransferObject).ifPresent { baseCo ->
Optional.ofNullable(baseDataTransferObject).ifPresent { dataTransferObject ->
SecurityContextUtil.loginAccountTimezone.ifPresent { timezone ->
val targetZoneId = ZoneId.of(timezone)
Optional.ofNullable(baseCo.creationTime).ifPresent {
Optional.ofNullable(dataTransferObject.creationTime).ifPresent {
val creationTimeZonedDateTime =
baseCo.creationTime.atZoneSameInstant(targetZoneId)
baseCo.creationTime = creationTimeZonedDateTime.toOffsetDateTime()
dataTransferObject.creationTime.atZoneSameInstant(targetZoneId)
dataTransferObject.creationTime = creationTimeZonedDateTime.toOffsetDateTime()
}
Optional.ofNullable(baseCo.modificationTime).ifPresent {
Optional.ofNullable(dataTransferObject.modificationTime).ifPresent {
val modificationTimeZonedDateTime =
baseCo.modificationTime.atZoneSameInstant(targetZoneId)
baseCo.modificationTime = modificationTimeZonedDateTime.toOffsetDateTime()
dataTransferObject.modificationTime.atZoneSameInstant(targetZoneId)
dataTransferObject.modificationTime =
modificationTimeZonedDateTime.toOffsetDateTime()
}
}
}
Expand Down

0 comments on commit b419197

Please sign in to comment.