From 05683f2b2bdbdbe21cf17ad523c21ab338bd1c54 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 19 七月 2022 21:49:55 +0800
Subject: [PATCH] 优化添加设备 功能

---
 service-user/src/main/java/com/java110/user/cmd/owner/DeleteOwnerCmd.java |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/service-user/src/main/java/com/java110/user/cmd/owner/DeleteOwnerCmd.java b/service-user/src/main/java/com/java110/user/cmd/owner/DeleteOwnerCmd.java
index c7f9beb..78a03fd 100644
--- a/service-user/src/main/java/com/java110/user/cmd/owner/DeleteOwnerCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/owner/DeleteOwnerCmd.java
@@ -3,14 +3,15 @@
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.dto.RoomDto;
 import com.java110.dto.owner.OwnerAppUserDto;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.owner.OwnerDto;
-import com.java110.intf.community.IOwnerV1InnerServiceSMO;
+import com.java110.intf.user.IOwnerV1InnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.user.IOwnerAppUserInnerServiceSMO;
 import com.java110.intf.user.IOwnerAppUserV1InnerServiceSMO;
@@ -21,12 +22,13 @@
 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 org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.List;
 
 @Java110Cmd(serviceCode = "owner.deleteOwner")
-public class DeleteOwnerCmd extends AbstractServiceCmdListener {
+public class DeleteOwnerCmd extends Cmd {
 
     @Autowired
     private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
@@ -87,9 +89,9 @@
     }
 
     @Override
+    @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
         JSONArray businesses = new JSONArray();
-
 
         JSONObject businessOwner = new JSONObject();
         businessOwner.put("memberId", reqJson.getString("memberId"));
@@ -101,16 +103,18 @@
         if (flag < 1) {
             throw new CmdException("鍒犻櫎澶辫触");
         }
-        OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
-        ownerAppUserDto.setMemberId(reqJson.getString("ownerId"));
-        //鏌ヨapp鐢ㄦ埛琛�
-        List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
-        if (ownerAppUserDtos != null && ownerAppUserDtos.size() > 0) {
-            for (OwnerAppUserDto ownerAppUser : ownerAppUserDtos) {
-                OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(ownerAppUser, OwnerAppUserPo.class);
-                flag = ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo);
-                if (flag < 1) {
-                    throw new CmdException("鍒犻櫎澶辫触");
+        if (reqJson.containsKey("ownerTypeCd") && !StringUtil.isEmpty(reqJson.getString("ownerTypeCd")) && reqJson.getString("ownerTypeCd").equals("1001")) {
+            OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
+            ownerAppUserDto.setMemberId(reqJson.getString("ownerId"));
+            //鏌ヨapp鐢ㄦ埛琛�
+            List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
+            if (ownerAppUserDtos != null && ownerAppUserDtos.size() > 0) {
+                for (OwnerAppUserDto ownerAppUser : ownerAppUserDtos) {
+                    OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(ownerAppUser, OwnerAppUserPo.class);
+                    flag = ownerAppUserV1InnerServiceSMOImpl.deleteOwnerAppUser(ownerAppUserPo);
+                    if (flag < 1) {
+                        throw new CmdException("鍒犻櫎澶辫触");
+                    }
                 }
             }
         }

--
Gitblit v1.8.0