From 27ce5dbd577f5c5dbf7098b0f980d355a275266c Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期四, 11 五月 2023 19:09:06 +0800
Subject: [PATCH] DEMO初步完成

---
 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java |   46 ++++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java
index 91d33bc..a7325ff 100644
--- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java
+++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberServiceImpl.java
@@ -142,20 +142,25 @@
                 sysUser = new SysUser();
                 sysUser.setUserName(memberId);
                 sysUser.setUserType("03");
-                sysUser.setNickName("微信用户");
+                sysUser.setNickName("鸿瑞堂用户");
+                sysUser.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png");
                 String password = "hongruitang";
                 sysUser.setPassword(SecurityUtils.encryptPassword(password));
                 sysUser = sysUserService.registerUser(sysUser).getData();
-                log.info("sysUser1"+sysUser.toString());
+                log.info("sysUser1-----------------"+sysUser.toString());
                 member = new Member();
                 member.setUserId(sysUser.getUserId());
                 member.setDelFlag(0);
+                member.setNickName("鸿瑞堂用户");
+                member.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png");
                 member.setMemberId(memberId);
+                member.setRelationShopId(1L);
                 member.setWxUnionid(unionid);
                 member.setMiniOpenid(openid);
                 member.setBindingFlag(0);
                 member.setCreateTime(new Date());
-                this.save(member);
+                log.info("member-----------------"+member.toString());
+                this.saveOrUpdate(member);
 
             }else{
                 log.info("member2"+member.toString());
@@ -231,16 +236,22 @@
         } catch (Exception e) {
             e.printStackTrace();
         }
-        //更新用户手机信息
-        SysUser sysUser = new SysUser();
-        sysUser.setUserId(appUserAuthorizeDto.getUserId());
-        sysUser.setPhonenumber(mobile);
-        sysUserService.updateUserMobile(sysUser);
-        member.setMobile(mobile);
-        member.setRealName(sysUser.getNickName());
+
+        SysUser sysUser1 = sysUserService.getSysUserBYmobile(mobile).getData();
+        if(sysUser1!=null){
+            member.setUserId(sysUser1.getUserId());
+            member.setNickName(sysUser1.getNickName());
+        }else{
+            //更新用户手机信息
+            SysUser sysUser = new SysUser();
+            sysUser.setUserId(appUserAuthorizeDto.getUserId());
+            sysUser.setPhonenumber(mobile);
+            sysUserService.updateUserMobile(sysUser);
+            member.setNickName(sysUser.getNickName());
+        }
         this.saveOrUpdate(member);
         appUserAuthorizeVo.setMobile(mobile);
-        appUserAuthorizeVo.setNickName(sysUser.getNickName());
+        appUserAuthorizeVo.setNickName(member.getNickName());
         appUserAuthorizeVo.setOpenid(member.getMiniOpenid());
         appUserAuthorizeVo.setUnionid(member.getWxUnionid());
         return appUserAuthorizeVo;
@@ -308,7 +319,7 @@
         Member member = this.getByUserId(appEditUserDto.getUserId());
         switch (editType){
             case 1:
-                member.setRealName(editValue);
+                member.setNickName(editValue);
                 member.setUpdateTime(new Date());
                 member.setUpdateUserId(appEditUserDto.getUserId());
                 this.saveOrUpdate(member);
@@ -354,12 +365,12 @@
     @Override
     public MerMemberInfoVo getMerMemberInfo(Long userId){
         MerMemberInfoVo merMemberInfoVo = new MerMemberInfoVo();
-        SysUser sysUser = sysUserService.getSysUser(userId).getData();
         Member member = this.getByUserId(userId);
         merMemberInfoVo.setUserId(userId);
-        merMemberInfoVo.setNickName(sysUser.getNickName());
-        merMemberInfoVo.setPhonenumber(sysUser.getPhonenumber());
-        merMemberInfoVo.setAvatar(sysUser.getAvatar());
+        merMemberInfoVo.setNickName(member.getNickName());
+        merMemberInfoVo.setPhonenumber(member.getMobile());
+        merMemberInfoVo.setAvatar(member.getAvatar());
+        merMemberInfoVo.setBirthday(member.getBirthday());
         //未完成
 
         return merMemberInfoVo;
@@ -400,6 +411,9 @@
         MerMemberBasicFileVo merMemberBasicFileVo = new MerMemberBasicFileVo();
         Member member = this.getByUserId(userId);
         BeanUtils.copyProperties(member, merMemberBasicFileVo);
+        merMemberBasicFileVo.setNickName(member.getNickName());
+        merMemberBasicFileVo.setPhonenumber(member.getMobile());
+        merMemberBasicFileVo.setCreateTime(member.getCreateTime());
         List<MemberNurse> memberNurseList = memberNurseService.listByUserId(userId);
         List<String> valueList = memberNurseList.stream().map(k->k.getNurse()).collect(Collectors.toList());
         merMemberBasicFileVo.setMemberNurse(valueList);

--
Gitblit v1.7.1