From 45102fc13900aad6d117b00a4feeeafe9c3f5fee Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 27 五月 2025 21:04:09 +0800
Subject: [PATCH] 优化查询业主成员
---
service-user/src/main/java/com/java110/user/cmd/owner/DeleteAppUserBindingOwnerCmd.java | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/service-user/src/main/java/com/java110/user/cmd/owner/DeleteAppUserBindingOwnerCmd.java b/service-user/src/main/java/com/java110/user/cmd/owner/DeleteAppUserBindingOwnerCmd.java
index ef5b736..8da3585 100644
--- a/service-user/src/main/java/com/java110/user/cmd/owner/DeleteAppUserBindingOwnerCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/owner/DeleteAppUserBindingOwnerCmd.java
@@ -5,15 +5,21 @@
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.owner.OwnerAppUserDto;
import com.java110.intf.user.IOwnerAppUserV1InnerServiceSMO;
+import com.java110.intf.user.IUserV1InnerServiceSMO;
import com.java110.po.owner.OwnerAppUserPo;
+import com.java110.po.user.UserPo;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.constant.MappingConstant;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
@Java110Cmd(serviceCode = "owner.deleteAppUserBindingOwner")
public class DeleteAppUserBindingOwnerCmd extends Cmd {
@@ -21,11 +27,14 @@
@Autowired
private IOwnerAppUserV1InnerServiceSMO ownerAppUserV1InnerServiceSMOImpl;
+ @Autowired
+ private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
+
@Override
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
Assert.hasKeyAndValue(reqJson, "appUserId", "缁戝畾ID涓嶈兘涓虹┖");
- String env = MappingCache.getValue(MappingConstant.ENV_DOMAIN,"HC_ENV");
+ String env = MappingCache.getValue(MappingConstant.ENV_DOMAIN, "HC_ENV");
if ("DEV".equals(env) || "TEST".equals(env)) {
throw new IllegalArgumentException("婕旂ず鐜涓嶈兘瑙g粦锛岃В缁戝悗婕旂ず璐﹀彿鎵嬫満绔棤娉曠櫥闄�");
@@ -34,11 +43,33 @@
@Override
public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+ // todo 鏌ヨ 缁戝畾淇℃伅
+
+ OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
+ ownerAppUserDto.setAppUserId(reqJson.getString("appUserId"));
+ List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserV1InnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
+
+ Assert.listOnlyOne(ownerAppUserDtos, "缁戝畾淇℃伅涓嶅瓨鍦�");
+
+ // 鍒犻櫎缁戝畾淇℃伅
OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(reqJson, OwnerAppUserPo.class);
int flag = ownerAppUserV1InnerServiceSMOImpl.deleteOwnerAppUser(ownerAppUserPo);
if (flag < 1) {
throw new CmdException("鍒犻櫎澶辫触");
}
+
+ if (StringUtil.isEmpty(ownerAppUserDtos.get(0).getUserId())) {
+ return;
+ }
+ if (ownerAppUserDtos.get(0).getUserId().startsWith("-")) {
+ return;
+ }
+ // todo 鍒犻櫎鐢ㄦ埛淇℃伅
+ UserPo userPo = new UserPo();
+ userPo.setUserId(ownerAppUserDtos.get(0).getUserId());
+ userV1InnerServiceSMOImpl.deleteUser(userPo);
+
cmdDataFlowContext.setResponseEntity(ResultVo.success());
}
}
--
Gitblit v1.8.0