Browse Source

no message

FengChaoYu 6 months ago
parent
commit
77aee66e5d

+ 16 - 14
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/user/UserLogic.java

@@ -349,6 +349,7 @@ public class UserLogic {
         List<UserWait> list = userWaitService.lambdaQuery()
                 .eq(UserWait::getMobile, mobile)
                 .eq(UserWait::getCompanyWechatId, currentCompanyWechat.getCurrentCompanyWechatId())
+                .eq(UserWait::getIsAdd, false)
                 .list();
         if (CollectionUtils.isEmpty(list)) {
             return;
@@ -388,6 +389,11 @@ public class UserLogic {
         user.setApplyType(userTypeEnum.getKey());
         user.setType(userTypeEnum.getKey());
         user.updateById();
+
+        userWaitService.lambdaUpdate()
+                .set(UserWait::getIsAdd, true)
+                .in(UserWait::getId, list.stream().map(UserWait::getId).collect(Collectors.toList()))
+                .update();
     }
 
 //    public User userToService(User user,CurrentCompanyWechat currentCompanyWechat){
@@ -1304,21 +1310,19 @@ public class UserLogic {
     }
 
     private User initAppUser(AdminCompanyWechat wechat, String mobile) throws Exception {
-        UserWait userWait = userWaitService.lambdaQuery()
-                .eq(UserWait::getMobile, mobile)
-                .eq(UserWait::getUserType, UserTypeEnum.WORKER.getKey())
+        User user = userService.lambdaQuery()
+                .eq(User::getMobile, mobile)
+                .eq(User::getType, UserTypeEnum.WORKER.getKey())
                 .last("limit 1")
-                .one();
-
-        User user = null;
-        if (Objects.isNull(userWait)) {
-            user = userService.lambdaQuery()
-                    .eq(User::getMobile, mobile)
-                    .eq(User::getType, UserTypeEnum.WORKER.getKey())
+                .one();;
+        if (Objects.isNull(user)) {
+            UserWait userWait = userWaitService.lambdaQuery()
+                    .eq(UserWait::getMobile, mobile)
+                    .eq(UserWait::getUserType, UserTypeEnum.WORKER.getKey())
                     .last("limit 1")
                     .one();
 
-            if (Objects.isNull(user)) {
+            if (Objects.isNull(userWait)) {
                 throw new RemoteServiceException("无师傅信息");
             }
         }
@@ -1351,9 +1355,7 @@ public class UserLogic {
                 user.updateById();
             }
 
-            if (Objects.nonNull(userWait)) {
-                this.userTypeInit2(user);
-            }
+            this.userTypeInit2(user);
 
             return user;
         } finally {