From 4d4640a1050dbcc285206455d4c3146324178787 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 23 Apr 2026 14:37:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BD=E5=AE=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 9cf8cabbabcd656fe9bbe2bfdfcbb1fe463fb23f) --- .../app/room/LiveVoiceRoomRestController.java | 14 ++++++++ .../room/query/RoomCountryListQryExe.java | 36 +++++++++++++++++++ .../room/LiveVoiceRoomServiceImpl.java | 8 +++++ .../app/dto/clientobject/room/CountryCO.java | 27 ++++++++++++++ .../service/room/LiveVoiceRoomService.java | 3 ++ 5 files changed, 88 insertions(+) create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomCountryListQryExe.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/room/CountryCO.java diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/room/LiveVoiceRoomRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/room/LiveVoiceRoomRestController.java index 88e695ac..25430328 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/room/LiveVoiceRoomRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/room/LiveVoiceRoomRestController.java @@ -3,6 +3,7 @@ package com.red.circle.other.adapter.app.room; import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd; import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.app.dto.clientobject.room.CountryCO; import com.red.circle.other.app.dto.clientobject.room.EntryRoomResponseCO; import com.red.circle.other.app.dto.clientobject.room.RoomOnlineUserCO; import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO; @@ -172,4 +173,17 @@ public class LiveVoiceRoomRestController extends BaseController { return liveVoiceRoomService.explore(cmd); } + /** + * 国家列表. + * + * @eo.name 国家列表. + * @eo.url /country + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/country") + public List listCountry() { + return liveVoiceRoomService.listRoomCountry(); + } + } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomCountryListQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomCountryListQryExe.java new file mode 100644 index 00000000..364d0531 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomCountryListQryExe.java @@ -0,0 +1,36 @@ +package com.red.circle.other.app.command.room.query; + +import com.red.circle.other.app.dto.clientobject.room.CountryCO; +import com.red.circle.other.infra.database.rds.entity.sys.SysCountryCode; +import com.red.circle.other.infra.database.rds.service.sys.SysCountryCodeService; +import com.red.circle.tool.core.text.StringUtils; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 房间国家列表查询. + * + * @author tf + */ +@Component +@RequiredArgsConstructor +public class RoomCountryListQryExe { + + private final SysCountryCodeService sysCountryCodeService; + + public List execute() { + List countries = sysCountryCodeService.listOpenCountry(); + return countries.stream().map(this::toCountryCO).toList(); + } + + private CountryCO toCountryCO(SysCountryCode entity) { + CountryCO co = new CountryCO(); + co.setCountryId(entity.getId()); + co.setCountryCode(entity.getAlphaTwo()); + co.setCountryName(StringUtils.isBlankOrElse(entity.getAliasName(), entity.getCountryName())); + co.setNationalFlag(entity.getNationalFlag()); + return co; + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/room/LiveVoiceRoomServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/room/LiveVoiceRoomServiceImpl.java index 8a4f518b..456292af 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/room/LiveVoiceRoomServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/room/LiveVoiceRoomServiceImpl.java @@ -6,6 +6,7 @@ import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd; import com.red.circle.other.app.command.room.LiveVoicePublicRoomCreateCmdExe; import com.red.circle.other.app.command.room.LiveVoiceRoomCreateCmdExe; import com.red.circle.other.app.command.room.RoomEnterCmdExe; +import com.red.circle.other.app.command.room.query.RoomCountryListQryExe; import com.red.circle.other.app.command.room.query.RoomLatestCreateQryExe; import com.red.circle.other.app.command.room.query.RoomOnlineUserFlowQryExe; import com.red.circle.other.app.command.room.query.RoomVoiceDiscoverQryExe; @@ -13,6 +14,7 @@ import com.red.circle.other.app.command.room.query.RoomVoiceExploreQryExe; import com.red.circle.other.app.command.room.query.RoomVoiceProfileByRoomAccountQryExe; import com.red.circle.other.app.command.room.query.SearchRegionRoomQryExe; import com.red.circle.other.app.command.room.query.UserCurrentLocationRoomQryExe; +import com.red.circle.other.app.dto.clientobject.room.CountryCO; import com.red.circle.other.app.dto.clientobject.room.EntryRoomResponseCO; import com.red.circle.other.app.dto.clientobject.room.RoomOnlineUserCO; import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO; @@ -42,6 +44,7 @@ public class LiveVoiceRoomServiceImpl implements LiveVoiceRoomService { private final RoomLatestCreateQryExe roomLatestCreateQryExe; private final RoomVoiceDiscoverQryExe roomVoiceDiscoverQryExe; private final RoomVoiceExploreQryExe roomVoiceExploreQryExe; + private final RoomCountryListQryExe roomCountryListQryExe; private final RoomOnlineUserFlowQryExe roomOnlineUserFlowQryExe; private final LiveVoiceRoomCreateCmdExe liveVoiceRoomCreateCmdExe; private final UserCurrentLocationRoomQryExe userCurrentLocationRoomQryExe; @@ -95,6 +98,11 @@ public class LiveVoiceRoomServiceImpl implements LiveVoiceRoomService { return roomVoiceExploreQryExe.execute(cmd); } + @Override + public List listRoomCountry() { + return roomCountryListQryExe.execute(); + } + @Override public String createPublicRoomByRegion(AppExtCommand cmd) { return liveVoicePublicRoomCreateCmdExe.execute(cmd); diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/room/CountryCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/room/CountryCO.java new file mode 100644 index 00000000..fb02106e --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/room/CountryCO.java @@ -0,0 +1,27 @@ +package com.red.circle.other.app.dto.clientobject.room; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 国家信息. + * + * @author tf + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class CountryCO extends ClientObject { + + @JsonSerialize(using = ToStringSerializer.class) + private Long countryId; + + private String countryCode; + + private String countryName; + + private String nationalFlag; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/room/LiveVoiceRoomService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/room/LiveVoiceRoomService.java index 4582a544..06f4fab8 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/room/LiveVoiceRoomService.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/room/LiveVoiceRoomService.java @@ -2,6 +2,7 @@ package com.red.circle.other.app.service.room; import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd; +import com.red.circle.other.app.dto.clientobject.room.CountryCO; import com.red.circle.other.app.dto.clientobject.room.EntryRoomResponseCO; import com.red.circle.other.app.dto.clientobject.room.RoomOnlineUserCO; import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO; @@ -39,5 +40,7 @@ public interface LiveVoiceRoomService { List explore(RoomExploreQryCmd cmd); + List listRoomCountry(); + String createPublicRoomByRegion(AppExtCommand cmd); }