From 3219ee5eb2c7de1e1401bd94cb4dc4d37195b244 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 13 四月 2022 11:04:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/xinghong-dev'

---
 service-user/src/main/java/com/java110/user/cmd/owner/OwnerRegisterCmd.java |   42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/service-user/src/main/java/com/java110/user/cmd/owner/OwnerRegisterCmd.java b/service-user/src/main/java/com/java110/user/cmd/owner/OwnerRegisterCmd.java
index 9c420ce..ec4e4f4 100644
--- a/service-user/src/main/java/com/java110/user/cmd/owner/OwnerRegisterCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/owner/OwnerRegisterCmd.java
@@ -29,7 +29,7 @@
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.java110.core.log.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.List;
@@ -116,21 +116,34 @@
         }
         //娣诲姞灏忓尯妤�
         addOwnerAppUser(reqJson, ownerDtos);
-        registerUser(reqJson);
+        registerUser(reqJson, ownerDtos);
 
         cmdDataFlowContext.setResponseEntity(ResultVo.success());
     }
 
     private void addOwnerAppUser(JSONObject paramInJson, List<OwnerDto> ownerDtos) {
+        List<CommunityDto> communityDtos = null;
+        CommunityDto tmpCommunityDto = null;
+        String communityName = "鏃�";
+
         if (ownerDtos == null || ownerDtos.size() < 1) {
+            CommunityDto communityDto = new CommunityDto();
+            communityDto.setState("1100");
+            communityDto.setCommunityId(paramInJson.getString("defaultCommunityId"));
+            communityDto.setPage(1);
+            communityDto.setRow(1);
+            communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+            if (communityDtos != null && communityDtos.size() > 0) {
+                communityName = communityDtos.get(0).getName();
+            }
             OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(paramInJson, OwnerAppUserPo.class);
             //鐘舵�佺被鍨嬶紝10000 瀹℃牳涓紝12000 瀹℃牳鎴愬姛锛�13000 瀹℃牳澶辫触
             ownerAppUserPo.setState("12000");
             ownerAppUserPo.setAppTypeCd("10010");
             ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId));
             ownerAppUserPo.setMemberId("-1");
-            ownerAppUserPo.setCommunityName("-1");
-            ownerAppUserPo.setCommunityId("鏃�");
+            ownerAppUserPo.setCommunityName(communityName);
+            ownerAppUserPo.setCommunityId(paramInJson.getString("defaultCommunityId"));
             ownerAppUserPo.setAppUserName("娓稿");
             ownerAppUserPo.setIdCard("鏃�");
 
@@ -140,15 +153,16 @@
             }
             return;
         }
-        List<CommunityDto> communityDtos = null;
-        CommunityDto tmpCommunityDto = null;
+
         OwnerAppUserPo ownerAppUserPo = null;
         for (OwnerDto ownerDto : ownerDtos) {
             CommunityDto communityDto = new CommunityDto();
             communityDto.setState("1100");
             communityDto.setCommunityId(ownerDto.getCommunityId());
             communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
-            Assert.listOnlyOne(communityDtos, "鎵嬫満鍙峰搴斾笟涓绘湭鏌ヨ鍒板皬鍖轰俊鎭紝璇疯仈绯荤墿涓�");
+            if (communityDtos == null || communityDtos.size() < 1) {
+                continue;
+            }
             tmpCommunityDto = communityDtos.get(0);
             ownerAppUserPo = BeanConvertUtil.covertBean(paramInJson, OwnerAppUserPo.class);
             //鐘舵�佺被鍨嬶紝10000 瀹℃牳涓紝12000 瀹℃牳鎴愬姛锛�13000 瀹℃牳澶辫触
@@ -173,10 +187,8 @@
      *
      * @param paramObj
      */
-    public void registerUser(JSONObject paramObj) {
-        Assert.jsonObjectHaveKey(paramObj, "name", "璇锋眰鍙傛暟涓湭鍖呭惈name 鑺傜偣锛岃纭");
-        Assert.jsonObjectHaveKey(paramObj, "tel", "璇锋眰鍙傛暟涓湭鍖呭惈tel 鑺傜偣锛岃纭");
-        Assert.jsonObjectHaveKey(paramObj, "password", "璇锋眰鍙傛暟涓湭鍖呭惈password 鑺傜偣锛岃纭");
+    public void registerUser(JSONObject paramObj, List<OwnerDto> ownerDtos) {
+
         if (paramObj.containsKey("email") && !StringUtil.isEmpty(paramObj.getString("email"))) {
             Assert.isEmail(paramObj, "email", "涓嶆槸鏈夋晥鐨勯偖绠辨牸寮�");
         }
@@ -187,8 +199,14 @@
         userPassword = AuthenticationFactory.passwdMd5(userPassword);
         paramObj.put("password", userPassword);
 
-
+        String tel = paramObj.getString("link");
+        String name = tel;
+        if (ownerDtos != null && ownerDtos.size() > 0) {
+            name = ownerDtos.get(0).getName();
+        }
         UserPo userPo = BeanConvertUtil.covertBean(paramObj, UserPo.class);
+        userPo.setName(name);
+        userPo.setTel(tel);
         int flag = userV1InnerServiceSMOImpl.saveUser(userPo);
         if (flag < 1) {
             throw new CmdException("娉ㄥ唽澶辫触");

--
Gitblit v1.8.0