From 3b57dba4dc37c26150d64729e86de0d15b243ccf Mon Sep 17 00:00:00 2001 From: hy001 Date: Fri, 24 Apr 2026 14:58:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B3=BB=E7=BB=9F=E5=9B=BD?= =?UTF-8?q?=E5=AE=B6=E5=A4=A9=E5=81=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/api/SysCountryCodeClientApi.java | 9 ++-- .../app/sys/SysCountryCodeRestController.java | 43 +++++++++++++------ .../app/sys/SysCountryCodeServiceImpl.java | 19 +++++--- .../app/sys/SysCountryCodeService.java | 12 +++--- .../service/sys/SysCountryCodeService.java | 15 ++++--- .../sys/impl/SysCountryCodeServiceImpl.java | 15 ++++--- .../sys/SysCountryCodeClientEndpoint.java | 16 ++++--- .../sys/SysCountryCodeClientService.java | 15 ++++--- .../impl/SysCountryCodeClientServiceImpl.java | 13 ++++-- 9 files changed, 105 insertions(+), 52 deletions(-) diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/sys/api/SysCountryCodeClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/sys/api/SysCountryCodeClientApi.java index 0ea1cb50..cc428547 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/sys/api/SysCountryCodeClientApi.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/sys/api/SysCountryCodeClientApi.java @@ -79,6 +79,9 @@ public interface SysCountryCodeClientApi { ResultResponse> sysCountryCodePage( @RequestBody SysCountryCodePageQryCmd query); - @PostMapping("/updateCountryCode") - ResultResponse updateCountryCode(@RequestBody SysCountryCodeCmd cmd); -} + @PostMapping("/updateCountryCode") + ResultResponse updateCountryCode(@RequestBody SysCountryCodeCmd cmd); + + @PostMapping("/addCountryCode") + ResultResponse addCountryCode(@RequestBody SysCountryCodeCmd cmd); +} diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/sys/SysCountryCodeRestController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/sys/SysCountryCodeRestController.java index 25405957..95cdb34d 100644 --- a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/sys/SysCountryCodeRestController.java +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/sys/SysCountryCodeRestController.java @@ -10,12 +10,13 @@ import com.red.circle.other.inner.model.cmd.sys.SysCountryCodePageQryCmd; import com.red.circle.other.inner.model.dto.sys.SysCountryCodeDTO; import java.util.List; import lombok.RequiredArgsConstructor; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Caching; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Caching; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** @@ -56,10 +57,26 @@ public class SysCountryCodeRestController extends BaseController { @CacheEvict(value = ControllerRedisKeyConstant.COUNTRY, key = "'" + ControllerRedisKeyConstant.APP_COUNTRY_CODE + "'") }) - @PutMapping - public void updateCountryCode(@RequestBody SysCountryCodeCmd cmd) { - cmd.setUpdateUser(cmd.getReqUserId()); - sysCountryCodeService.updateCountryCode(cmd); - } - -} + @PutMapping + public void updateCountryCode(@RequestBody SysCountryCodeCmd cmd) { + cmd.setUpdateUser(cmd.getReqUserId()); + sysCountryCodeService.updateCountryCode(cmd); + } + + /** + * 新增国家列表. + */ + @Caching(evict = { + @CacheEvict(value = ControllerRedisKeyConstant.COUNTRY, key = "'" + + ControllerRedisKeyConstant.COUNTRY_TOP_SIX + "'"), + @CacheEvict(value = ControllerRedisKeyConstant.COUNTRY, key = "'" + + ControllerRedisKeyConstant.APP_COUNTRY_CODE + "'") + }) + @PostMapping + public void addCountryCode(@RequestBody SysCountryCodeCmd cmd) { + cmd.setCreateUser(cmd.getReqUserId()); + cmd.setUpdateUser(cmd.getReqUserId()); + sysCountryCodeService.addCountryCode(cmd); + } + +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/sys/SysCountryCodeServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/sys/SysCountryCodeServiceImpl.java index 3121a17e..80aa13d7 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/sys/SysCountryCodeServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/sys/SysCountryCodeServiceImpl.java @@ -36,12 +36,17 @@ public class SysCountryCodeServiceImpl implements SysCountryCodeService { } @Override - public void updateCountryCode(SysCountryCodeCmd cmd) { - countryCodeClient.updateCountryCode(cmd); - } - - @Override - public ResultResponse getSysCountryCodeById(Long id) { - return countryCodeClient.getById(id); + public void updateCountryCode(SysCountryCodeCmd cmd) { + countryCodeClient.updateCountryCode(cmd); + } + + @Override + public void addCountryCode(SysCountryCodeCmd cmd) { + countryCodeClient.addCountryCode(cmd); + } + + @Override + public ResultResponse getSysCountryCodeById(Long id) { + return countryCodeClient.getById(id); } } diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/sys/SysCountryCodeService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/sys/SysCountryCodeService.java index 44e46bd1..37479d48 100644 --- a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/sys/SysCountryCodeService.java +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/sys/SysCountryCodeService.java @@ -22,8 +22,10 @@ public interface SysCountryCodeService { PageResult sysCountryCodePage(SysCountryCodePageQryCmd query); - void updateCountryCode(SysCountryCodeCmd cmd); - - ResultResponse getSysCountryCodeById(Long id); - -} + void updateCountryCode(SysCountryCodeCmd cmd); + + void addCountryCode(SysCountryCodeCmd cmd); + + ResultResponse getSysCountryCodeById(Long id); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/SysCountryCodeService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/SysCountryCodeService.java index 01804869..861cc23c 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/SysCountryCodeService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/SysCountryCodeService.java @@ -63,8 +63,13 @@ public interface SysCountryCodeService extends BaseService { */ PageResult sysCountryCodePage(SysCountryCodePageQryCmd query); - /** - * 编辑国家资料 - */ - void updateCountryCode(SysCountryCode sysCountryCode); -} + /** + * 编辑国家资料 + */ + void updateCountryCode(SysCountryCode sysCountryCode); + + /** + * 新增国家资料 + */ + void addCountryCode(SysCountryCode sysCountryCode); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/SysCountryCodeServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/SysCountryCodeServiceImpl.java index c2acc7f5..83900195 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/SysCountryCodeServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/SysCountryCodeServiceImpl.java @@ -136,8 +136,13 @@ public class SysCountryCodeServiceImpl extends } @Override - public void updateCountryCode(SysCountryCode sysCountryCode) { - ResponseAssert.isTrue(CommonErrorCode.UPDATE_FAILURE, - updateSelectiveById(sysCountryCode)); - } -} + public void updateCountryCode(SysCountryCode sysCountryCode) { + ResponseAssert.isTrue(CommonErrorCode.UPDATE_FAILURE, + updateSelectiveById(sysCountryCode)); + } + + @Override + public void addCountryCode(SysCountryCode sysCountryCode) { + ResponseAssert.isTrue(CommonErrorCode.SAVE_FAILURE, save(sysCountryCode)); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/sys/SysCountryCodeClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/sys/SysCountryCodeClientEndpoint.java index 0225f9f5..751a8b34 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/sys/SysCountryCodeClientEndpoint.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/sys/SysCountryCodeClientEndpoint.java @@ -71,8 +71,14 @@ public class SysCountryCodeClientEndpoint implements SysCountryCodeClientApi { } @Override - public ResultResponse updateCountryCode(SysCountryCodeCmd cmd) { - sysCountryCodeClientService.updateCountryCode(cmd); - return ResultResponse.success(); - } -} + public ResultResponse updateCountryCode(SysCountryCodeCmd cmd) { + sysCountryCodeClientService.updateCountryCode(cmd); + return ResultResponse.success(); + } + + @Override + public ResultResponse addCountryCode(SysCountryCodeCmd cmd) { + sysCountryCodeClientService.addCountryCode(cmd); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/sys/SysCountryCodeClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/sys/SysCountryCodeClientService.java index eaadbee6..82eecf78 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/sys/SysCountryCodeClientService.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/sys/SysCountryCodeClientService.java @@ -67,8 +67,13 @@ public interface SysCountryCodeClientService { */ PageResult sysCountryCodePage(SysCountryCodePageQryCmd query); - /** - * 编辑国家资料 - */ - void updateCountryCode(SysCountryCodeCmd dto); -} + /** + * 编辑国家资料 + */ + void updateCountryCode(SysCountryCodeCmd dto); + + /** + * 新增国家资料 + */ + void addCountryCode(SysCountryCodeCmd dto); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/sys/impl/SysCountryCodeClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/sys/impl/SysCountryCodeClientServiceImpl.java index eeb8534c..605bab99 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/sys/impl/SysCountryCodeClientServiceImpl.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/sys/impl/SysCountryCodeClientServiceImpl.java @@ -72,7 +72,12 @@ public class SysCountryCodeClientServiceImpl implements SysCountryCodeClientServ } @Override - public void updateCountryCode(SysCountryCodeCmd dto) { - sysCountryCodeService.updateCountryCode(countryCodeInnerConvertor.toSysCountryCode(dto)); - } -} + public void updateCountryCode(SysCountryCodeCmd dto) { + sysCountryCodeService.updateCountryCode(countryCodeInnerConvertor.toSysCountryCode(dto)); + } + + @Override + public void addCountryCode(SysCountryCodeCmd dto) { + sysCountryCodeService.addCountryCode(countryCodeInnerConvertor.toSysCountryCode(dto)); + } +}