From ab09384db315eafa5c88caeb029494833f01972a Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期日, 17 九月 2023 12:49:45 +0800
Subject: [PATCH] 优化代码

---
 service-user/src/main/java/com/java110/user/cmd/owner/SaveOwnerCmd.java |   65 +++++---------------------------
 1 files changed, 10 insertions(+), 55 deletions(-)

diff --git a/service-user/src/main/java/com/java110/user/cmd/owner/SaveOwnerCmd.java b/service-user/src/main/java/com/java110/user/cmd/owner/SaveOwnerCmd.java
index ffbe013..bb39e3a 100644
--- a/service-user/src/main/java/com/java110/user/cmd/owner/SaveOwnerCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/owner/SaveOwnerCmd.java
@@ -31,7 +31,9 @@
 import com.java110.po.owner.OwnerPo;
 import com.java110.po.owner.OwnerRoomRelPo;
 import com.java110.po.user.UserPo;
+import com.java110.user.bmo.owner.IGeneratorOwnerUserBMO;
 import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.MappingConstant;
 import com.java110.utils.constant.UserLevelConstant;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.lock.DistributedLock;
@@ -53,7 +55,8 @@
         url = "http://{ip}:{port}/app/owner.saveOwner",
         resource = "userDoc",
         author = "鍚村鏂�",
-        serviceCode = "owner.saveOwner"
+        serviceCode = "owner.saveOwner",
+        seq = 9
 )
 
 @Java110ParamsDoc(params = {
@@ -123,12 +126,7 @@
     private IPhotoSMO photoSMOImpl;
 
     @Autowired
-    private IOwnerAppUserV1InnerServiceSMO ownerAppUserV1InnerServiceSMOImpl;
-
-    @Autowired
-    private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
-    @Autowired
-    private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
+    private IGeneratorOwnerUserBMO generatorOwnerUserBMOImpl;
 
 
     @Override
@@ -153,7 +151,7 @@
             smsDto.setTel(reqJson.getString("link"));
             smsDto.setCode(reqJson.getString("msgCode"));
             smsDto = smsInnerServiceSMOImpl.validateCode(smsDto);
-            if (!smsDto.isSuccess() && "ON".equals(MappingCache.getValue(SendSmsFactory.SMS_SEND_SWITCH))) {
+            if (!smsDto.isSuccess() && "ON".equals(MappingCache.getValue(MappingConstant.SMS_DOMAIN,SendSmsFactory.SMS_SEND_SWITCH))) {
                 throw new IllegalArgumentException(smsDto.getMsg());
             }
         }
@@ -185,6 +183,7 @@
         }
         //鐢熸垚memberId
         generateMemberId(reqJson);
+
         JSONObject businessOwner = new JSONObject();
         businessOwner.putAll(reqJson);
         businessOwner.put("state", "2000");
@@ -213,56 +212,12 @@
                 reqJson.getString("memberId"),
                 reqJson.getString("communityId"),
                 "10000");
+
         dealOwnerAttr(reqJson, cmdDataFlowContext);
 
 
-
-
-        String autoUser = MappingCache.getValue("OWNER", "AUTO_GENERATOR_OWNER_USER");
-
-        if (!"ON".equals(autoUser)) {
-            return;
-        }
-
-        CommunityDto communityDto = new CommunityDto();
-        communityDto.setCommunityId(ownerPo.getCommunityId());
-        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
-        Assert.listNotNull(communityDtos, "鏈寘鍚皬鍖轰俊鎭�");
-        CommunityDto tmpCommunityDto = communityDtos.get(0);
-
-        UserPo userPo = new UserPo();
-        userPo.setUserId(GenerateCodeFactory.getUserId());
-        userPo.setName(ownerPo.getName());
-        userPo.setTel(ownerPo.getLink());
-        userPo.setPassword(AuthenticationFactory.passwdMd5(ownerPo.getLink()));
-        userPo.setLevelCd(UserLevelConstant.USER_LEVEL_ORDINARY);
-        userPo.setAge(ownerPo.getAge());
-        userPo.setAddress(ownerPo.getAddress());
-        userPo.setSex(ownerPo.getSex());
-        flag = userV1InnerServiceSMOImpl.saveUser(userPo);
-        if (flag < 1) {
-            throw new CmdException("娉ㄥ唽澶辫触");
-        }
-
-        OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo();
-        //鐘舵�佺被鍨嬶紝10000 瀹℃牳涓紝12000 瀹℃牳鎴愬姛锛�13000 瀹℃牳澶辫触
-        ownerAppUserPo.setState("12000");
-        ownerAppUserPo.setAppTypeCd("10010");
-        ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId));
-        ownerAppUserPo.setMemberId(ownerPo.getMemberId());
-        ownerAppUserPo.setCommunityName(tmpCommunityDto.getName());
-        ownerAppUserPo.setCommunityId(ownerPo.getCommunityId());
-        ownerAppUserPo.setAppUserName(ownerPo.getName());
-        ownerAppUserPo.setIdCard(ownerPo.getIdCard());
-        ownerAppUserPo.setAppType("WECHAT");
-        ownerAppUserPo.setLink(ownerPo.getLink());
-        ownerAppUserPo.setUserId(userPo.getUserId());
-        ownerAppUserPo.setOpenId("-1");
-
-        flag = ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo);
-        if (flag < 1) {
-            throw new CmdException("娣诲姞鐢ㄦ埛涓氫富鍏崇郴澶辫触");
-        }
+        //todo 鐢熸垚鐧诲綍璐﹀彿
+        generatorOwnerUserBMOImpl.generator(ownerPo);
     }
 
 

--
Gitblit v1.8.0