From a01432ea868f2bb9cfef2f42b64d008259c5aff3 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 27 Feb 2026 12:14:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=96=B0=E5=A2=9E=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=A8=E6=88=B7=E8=AE=BE=E5=A4=87=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/user/api/UserExpandClientApi.java | 7 ++++++ .../UpdateUserExpandDeviceListBlockCmd.java | 25 +++++++++++++++++++ .../inner/model/dto/user/UserExpandDTO.java | 5 ++++ .../app/user/UserExpandRestController.java | 16 ++++++++++++ .../app/user/UserExpandServiceImpl.java | 10 ++++++++ .../user/UserExpandDeviceListBlockCmd.java | 23 +++++++++++++++++ .../service/app/user/UserExpandService.java | 7 ++++++ .../user/user/UserExpandClientEndpoint.java | 7 ++++++ .../user/user/UserExpandClientService.java | 6 +++++ .../impl/UserExpandClientServiceImpl.java | 14 +++++++++++ 10 files changed, 120 insertions(+) create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/user/UpdateUserExpandDeviceListBlockCmd.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/cmd/app/user/UserExpandDeviceListBlockCmd.java diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/user/user/api/UserExpandClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/user/user/api/UserExpandClientApi.java index bc212065..5e0f4b96 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/user/user/api/UserExpandClientApi.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/user/user/api/UserExpandClientApi.java @@ -2,6 +2,7 @@ package com.red.circle.other.inner.endpoint.user.user.api; import com.red.circle.framework.dto.PageResult; import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd; import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd; import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO; import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO; @@ -69,4 +70,10 @@ public interface UserExpandClientApi { */ @GetMapping("/getByUserId") ResultResponse getByUserId(@RequestParam("userId") Long userId); + + /** + * 修改用户设备名单标记 + */ + @PostMapping("/updateDeviceListBlock") + ResultResponse updateDeviceListBlock(@RequestBody UpdateUserExpandDeviceListBlockCmd cmd); } diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/user/UpdateUserExpandDeviceListBlockCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/user/UpdateUserExpandDeviceListBlockCmd.java new file mode 100644 index 00000000..3c241406 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/user/UpdateUserExpandDeviceListBlockCmd.java @@ -0,0 +1,25 @@ +package com.red.circle.other.inner.model.cmd.user; + +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 修改用户设备名单标记. + */ +@Data +@Accessors(chain = true) +public class UpdateUserExpandDeviceListBlockCmd { + + /** + * 用户id. + */ + @NotNull + private Long userId; + + /** + * 设备名单标记: true-黑名单 false-白名单 null-不限制. + */ + private Boolean deviceListBlock; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserExpandDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserExpandDTO.java index 6e178681..2f6044e6 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserExpandDTO.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserExpandDTO.java @@ -61,5 +61,10 @@ public class UserExpandDTO implements Serializable { */ private String registerCountryCode; + /** + * 设备名单标记: true-黑名单 false-白名单 null-不限制. + */ + private Boolean deviceListBlock; + } diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/user/UserExpandRestController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/user/UserExpandRestController.java index b7114e31..4498f3c5 100644 --- a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/user/UserExpandRestController.java +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/user/UserExpandRestController.java @@ -1,11 +1,15 @@ package com.red.circle.console.adapter.app.user; +import com.red.circle.console.app.dto.cmd.app.user.UserExpandDeviceListBlockCmd; import com.red.circle.console.app.service.app.user.UserExpandService; import com.red.circle.framework.web.controller.BaseController; import com.red.circle.other.inner.model.dto.user.UserExpandDTO; import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -32,4 +36,16 @@ public class UserExpandRestController extends BaseController { return userExpandService.getById(userId); } + /** + * 修改用户设备名单标记. + * @eo.name 修改设备名单标记 + * @eo.url /updateDeviceListBlock + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/updateDeviceListBlock") + public void updateDeviceListBlock(@RequestBody @Validated UserExpandDeviceListBlockCmd cmd) { + userExpandService.updateDeviceListBlock(cmd); + } + } diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserExpandServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserExpandServiceImpl.java index f0a7f8a0..39b30e86 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserExpandServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserExpandServiceImpl.java @@ -1,6 +1,8 @@ package com.red.circle.console.app.service.app.user; import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.console.app.dto.cmd.app.user.UserExpandDeviceListBlockCmd; +import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd; import com.red.circle.other.inner.model.dto.user.UserExpandDTO; import com.red.circle.other.inner.endpoint.user.user.UserExpandClient; import lombok.RequiredArgsConstructor; @@ -27,4 +29,12 @@ public class UserExpandServiceImpl implements public UserExpandDTO getById(Long userId) { return ResponseAssert.requiredSuccess(userExpandClient.getByUserId(userId)); } + + @Override + public void updateDeviceListBlock(UserExpandDeviceListBlockCmd cmd) { + UpdateUserExpandDeviceListBlockCmd innerCmd = new UpdateUserExpandDeviceListBlockCmd() + .setUserId(cmd.getUserId()) + .setDeviceListBlock(cmd.getDeviceListBlock()); + ResponseAssert.requiredSuccess(userExpandClient.updateDeviceListBlock(innerCmd)); + } } diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/cmd/app/user/UserExpandDeviceListBlockCmd.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/cmd/app/user/UserExpandDeviceListBlockCmd.java new file mode 100644 index 00000000..86522426 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/cmd/app/user/UserExpandDeviceListBlockCmd.java @@ -0,0 +1,23 @@ +package com.red.circle.console.app.dto.cmd.app.user; + +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * 修改用户设备名单标记. + */ +@Data +public class UserExpandDeviceListBlockCmd { + + /** + * 用户id. + */ + @NotNull + private Long userId; + + /** + * 设备名单标记: true-黑名单 false-白名单 null-不限制. + */ + private Boolean deviceListBlock; + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/user/UserExpandService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/user/UserExpandService.java index 6b74384c..ac2b6347 100644 --- a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/user/UserExpandService.java +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/user/UserExpandService.java @@ -1,5 +1,6 @@ package com.red.circle.console.app.service.app.user; +import com.red.circle.console.app.dto.cmd.app.user.UserExpandDeviceListBlockCmd; import com.red.circle.other.inner.model.dto.user.UserExpandDTO; /** @@ -20,5 +21,11 @@ public interface UserExpandService { */ UserExpandDTO getById(Long userId); + /** + * 修改用户设备名单标记. + * + * @param cmd 命令 + */ + void updateDeviceListBlock(UserExpandDeviceListBlockCmd cmd); } diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/user/user/UserExpandClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/user/user/UserExpandClientEndpoint.java index 992f4181..49dd420f 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/user/user/UserExpandClientEndpoint.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/user/user/UserExpandClientEndpoint.java @@ -2,6 +2,7 @@ package com.red.circle.other.app.inner.endpoint.user.user; import com.red.circle.framework.dto.PageResult; import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd; import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd; import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO; import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO; @@ -63,4 +64,10 @@ public class UserExpandClientEndpoint implements UserExpandClientApi { public ResultResponse getByUserId(Long userId) { return ResultResponse.success(userExpandClientService.getById(userId)); } + + @Override + public ResultResponse updateDeviceListBlock(UpdateUserExpandDeviceListBlockCmd cmd) { + userExpandClientService.updateDeviceListBlock(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/user/user/UserExpandClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/UserExpandClientService.java index 71b47ec3..5b2b38ee 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/UserExpandClientService.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/UserExpandClientService.java @@ -1,6 +1,7 @@ package com.red.circle.other.app.inner.service.user.user; import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd; import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd; import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO; import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO; @@ -54,4 +55,9 @@ public interface UserExpandClientService { * 获取用户拓展信息 */ UserExpandDTO getById(Long userId); + + /** + * 修改用户设备名单标记 + */ + void updateDeviceListBlock(UpdateUserExpandDeviceListBlockCmd cmd); } diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/UserExpandClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/UserExpandClientServiceImpl.java index 922d70db..b1c1c27d 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/UserExpandClientServiceImpl.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/UserExpandClientServiceImpl.java @@ -4,6 +4,8 @@ import com.red.circle.framework.dto.PageResult; import com.red.circle.other.infra.database.rds.service.user.user.CheckInLogService; import com.red.circle.other.infra.database.rds.service.user.user.ExpandService; import com.red.circle.other.app.inner.convertor.user.UserProfileInnerConvertor; +import com.red.circle.other.infra.database.rds.entity.user.user.UserExpand; +import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd; import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd; import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO; import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO; @@ -63,4 +65,16 @@ public class UserExpandClientServiceImpl implements UserExpandClientService { .map(userProfileInnerConvertor::toUserExpandDTO) .orElse(null); } + + @Override + public void updateDeviceListBlock(UpdateUserExpandDeviceListBlockCmd cmd) { + UserExpand userExpand = expandService.getById(cmd.getUserId()); + if (userExpand == null) { + expandService.init(cmd.getUserId(), "en"); + } + expandService.update() + .set(UserExpand::getDeviceListBlock, cmd.getDeviceListBlock()) + .eq(UserExpand::getUserId, cmd.getUserId()) + .execute(); + } }