Parcourir la source

增加用户时,自动绑定另一端同手机号用户

Yangzw il y a 10 mois
Parent
commit
4ca96c77a3

+ 4 - 1
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/dal/dataobject/user/MemberUserDO.java

@@ -188,5 +188,8 @@ public class MemberUserDO extends TenantBaseDO {
      * 累计消费金额(只算人民币,单位为分)
      */
     private Long cumulativeSpending;
-
+    /**
+     * 关联系统用户ID
+     */
+    private Long systemUsersId;
 }

+ 1 - 0
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/service/user/MemberUserService.java

@@ -187,4 +187,5 @@ public interface MemberUserService {
      */
     boolean updateUserPoint(Long userId, Integer point);
 
+    void updateUserByMobile(Long id, String mobile);
 }

+ 11 - 0
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/service/user/MemberUserServiceImpl.java

@@ -314,4 +314,15 @@ public class MemberUserServiceImpl implements MemberUserService {
         return true;
     }
 
+    @Override
+    public void updateUserByMobile(Long systemUserId, String mobile) {
+        if(StrUtil.isEmpty(mobile)){
+            return;
+        }
+
+        MemberUserDO memberUserDO = memberUserMapper.selectByMobile(mobile);
+        memberUserDO.setSystemUsersId(systemUserId);
+        memberUserMapper.updateById(memberUserDO);
+    }
+
 }

+ 6 - 0
feifan-module-system/feifan-module-system-biz/pom.xml

@@ -135,6 +135,12 @@
             <groupId>com.tencentcloudapi</groupId>
             <artifactId>tencentcloud-sdk-java-sms</artifactId> <!-- 短信(腾讯云) -->
         </dependency>
+        <dependency>
+            <groupId>cn.newfeifan.zx</groupId>
+            <artifactId>feifan-module-member-biz</artifactId>
+            <version>2.0.0-jdk8-snapshot</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
 </project>

+ 8 - 0
feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserServiceImpl.java

@@ -12,6 +12,7 @@ import cn.newfeifan.mall.framework.common.util.json.JsonUtils;
 import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 import cn.newfeifan.mall.framework.datapermission.core.util.DataPermissionUtils;
 import cn.newfeifan.mall.module.infra.api.file.FileApi;
+import cn.newfeifan.mall.module.member.service.user.MemberUserService;
 import cn.newfeifan.mall.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
 import cn.newfeifan.mall.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
 import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.*;
@@ -91,6 +92,9 @@ public class AdminUserServiceImpl implements AdminUserService {
     @Resource
     private StringRedisTemplate stringRedisTemplate;
 
+    @Resource
+    private MemberUserService memberUserService;
+
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -121,6 +125,10 @@ public class AdminUserServiceImpl implements AdminUserService {
         user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码
 
         userMapper.insert(user);
+
+        //绑定关联消费者
+        memberUserService.updateUserByMobile(user.getId(), user.getMobile());
+
         // 插入关联岗位
         if (CollectionUtil.isNotEmpty(user.getPostIds())) {
             userPostMapper.insertBatch(convertList(user.getPostIds(),