From 9ec0a61f90ac2464eebc643bfe2d93ac9ba6e569 Mon Sep 17 00:00:00 2001
From: cgf <2156125618@qq.com>
Date: 星期六, 23 八月 2025 10:59:18 +0800
Subject: [PATCH] 折扣已完成现有需求2025/08/09

---
 service-user/src/main/java/com/java110/user/cmd/login/PhoneWechatLoginCmd.java |   86 +++++++++++++++++++++++++-----------------
 1 files changed, 51 insertions(+), 35 deletions(-)

diff --git a/service-user/src/main/java/com/java110/user/cmd/login/PhoneWechatLoginCmd.java b/service-user/src/main/java/com/java110/user/cmd/login/PhoneWechatLoginCmd.java
index 26fe0dc..e13d79e 100644
--- a/service-user/src/main/java/com/java110/user/cmd/login/PhoneWechatLoginCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/login/PhoneWechatLoginCmd.java
@@ -39,6 +39,7 @@
 import org.apache.commons.net.util.Base64;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 
 import javax.crypto.Cipher;
 import javax.crypto.spec.IvParameterSpec;
@@ -151,9 +152,8 @@
         OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
         ownerAppUserDto.setUserId(userDtos.get(0).getUserId());
         ownerAppUserDto.setLink(userDtos.get(0).getTel());
-        ownerAppUserDto.setState(OwnerAppUserDto.STATE_AUDIT_SUCCESS);
         List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserV1InnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
-
+        LoginOwnerResDto loginOwnerResDto = new LoginOwnerResDto();
         if (ListUtil.isNull(ownerAppUserDtos)) {
             autoBindUserToOwner(userDtos.get(0), phoneNumber);
             communityId = smallWeChatDtos.get(0).getObjId();
@@ -173,7 +173,7 @@
 
         //todo 鐢熸垚鐧诲綍token
         String token = generatorLoginToken(tmpUserDto);
-        LoginOwnerResDto loginOwnerResDto = new LoginOwnerResDto();
+
 
         loginOwnerResDto.setCommunityId(communityDtos.get(0).getCommunityId());
         loginOwnerResDto.setCommunityName(communityDtos.get(0).getName());
@@ -184,44 +184,60 @@
         loginOwnerResDto.setOwnerTel(tmpUserDto.getTel());
         loginOwnerResDto.setToken(token);
         loginOwnerResDto.setKey(newKey);
+        //鏌ヨ璁よ瘉鍏崇郴
+        OwnerAppUserDto dto = new OwnerAppUserDto();
+        dto.setUserId(userDtos.get(0).getUserId());
+        dto.setLink(userDtos.get(0).getTel());
+        List<OwnerAppUserDto> dtos = ownerAppUserV1InnerServiceSMOImpl.queryOwnerAppUsers(dto);
+        if(!CollectionUtils.isEmpty(dtos)){
+
+        }
         context.setResponseEntity(ResultVo.createResponseEntity(loginOwnerResDto));
     }
 
     private void autoBindUserToOwner(UserDto userDto, String phoneNumber) {
-        // todo 鏌ヨ涓氫富鎴栨垚鍛�
-        OwnerDto ownerDto = new OwnerDto();
-        ownerDto.setLink(phoneNumber);
-        ownerDto.setPage(1);
-        ownerDto.setRow(1);
-        List<OwnerDto> ownerDtos = ownerV1InnerServiceSMOImpl.queryOwners(ownerDto);
+        //鏌ヨ鐢ㄦ埛鏄惁宸茬粡鏈夎璇佺姸鎬佽褰�
+        //todo 鏌ヨ涓氫富鏄惁 璁よ瘉浜嗭紝濡傛灉璁よ瘉浜嗚幏鍙栧皬鍖篒D
+        OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
+        ownerAppUserDto.setUserId(userDto.getUserId());
+        ownerAppUserDto.setLink(userDto.getTel());
+        List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserV1InnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
+        if(CollectionUtils.isEmpty(ownerAppUserDtos)){
+            // todo 鏌ヨ涓氫富鎴栨垚鍛�
+            OwnerDto ownerDto = new OwnerDto();
+            ownerDto.setLink(phoneNumber);
+            ownerDto.setPage(1);
+            ownerDto.setRow(1);
+            List<OwnerDto> ownerDtos = ownerV1InnerServiceSMOImpl.queryOwners(ownerDto);
 
-        // 璇存槑涓氫富涓嶅瓨鍦� 鐩存帴杩斿洖璺戝紓甯�
-        if (ListUtil.isNull(ownerDtos)) {
-            return;
-        }
-        CommunityDto communityDto = new CommunityDto();
-        communityDto.setCommunityId(ownerDtos.get(0).getCommunityId());
-        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
-        if (ListUtil.isNull(communityDtos)) {
-            return;
-        }
-        CommunityDto tmpCommunityDto = communityDtos.get(0);
+            // 璇存槑涓氫富涓嶅瓨鍦� 鐩存帴杩斿洖璺戝紓甯�
+            if (ListUtil.isNull(ownerDtos)) {
+                return;
+            }
+            CommunityDto communityDto = new CommunityDto();
+            communityDto.setCommunityId(ownerDtos.get(0).getCommunityId());
+            List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+            if (ListUtil.isNull(communityDtos)) {
+                return;
+            }
+            CommunityDto tmpCommunityDto = communityDtos.get(0);
 
-        OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo();
-        //鐘舵�佺被鍨嬶紝10000 瀹℃牳涓紝12000 瀹℃牳鎴愬姛锛�13000 瀹℃牳澶辫触
-        ownerAppUserPo.setState("12000");
-        ownerAppUserPo.setAppTypeCd("10010");
-        ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId));
-        ownerAppUserPo.setMemberId(ownerDtos.get(0).getMemberId());
-        ownerAppUserPo.setCommunityName(tmpCommunityDto.getName());
-        ownerAppUserPo.setCommunityId(ownerDtos.get(0).getCommunityId());
-        ownerAppUserPo.setAppUserName(ownerDtos.get(0).getName());
-        ownerAppUserPo.setIdCard(ownerDtos.get(0).getIdCard());
-        ownerAppUserPo.setAppType("WECHAT");
-        ownerAppUserPo.setLink(ownerDtos.get(0).getLink());
-        ownerAppUserPo.setUserId(userDto.getUserId());
-        ownerAppUserPo.setOpenId("-1");
-        ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo);
+            OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo();
+            //鐘舵�佺被鍨嬶紝10000 瀹℃牳涓紝 11000 寰呰璇� ,12000 瀹℃牳鎴愬姛锛�13000 瀹℃牳澶辫触
+            ownerAppUserPo.setState(OwnerAppUserDto.STATE_NOT_AUDIT);
+            ownerAppUserPo.setAppTypeCd("10010");
+            ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId));
+            ownerAppUserPo.setMemberId(ownerDtos.get(0).getMemberId());
+            ownerAppUserPo.setCommunityName(tmpCommunityDto.getName());
+            ownerAppUserPo.setCommunityId(ownerDtos.get(0).getCommunityId());
+            ownerAppUserPo.setAppUserName(ownerDtos.get(0).getName());
+            ownerAppUserPo.setIdCard(ownerDtos.get(0).getIdCard());
+            ownerAppUserPo.setAppType("WECHAT");
+            ownerAppUserPo.setLink(ownerDtos.get(0).getLink());
+            ownerAppUserPo.setUserId(userDto.getUserId());
+            ownerAppUserPo.setOpenId("-1");
+            ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo);
+        }
     }
 
     private void registerUser(String phoneNumber) {

--
Gitblit v1.8.0