无关风月
2025-03-07 1d44c20eabc99e9970fb58d4dbd3a94d77e83e39
xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/service/impl/AppUserServiceImpl.java
@@ -18,6 +18,7 @@
import com.xinquan.common.core.utils.page.CollUtils;
import com.xinquan.common.security.service.TokenService;
import com.xinquan.common.security.utils.SecurityUtils;
import com.xinquan.meditation.api.feign.RemoteMeditationService;
import com.xinquan.system.api.RemoteUserService;
import com.xinquan.system.api.domain.SysUser;
import com.xinquan.system.api.feignClient.SysUserClient;
@@ -46,6 +47,8 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
/**
 * <p>
 * 用户信息表 服务实现类
@@ -63,6 +66,8 @@
    private final AppUserTreeService appUserTreeService;
    private final AppUserQuestionService appUserQuestionService;
    private final TagService tagService;
    @Resource
    private RemoteMeditationService remoteMeditationService;
    /**
     * 获取用户信息
     *
@@ -119,6 +124,7 @@
                .ne(AppUser::getUserStatus,3).oneOpt();
    }
    /**
     * app用户注册
     * @param appUserDTO
@@ -137,6 +143,7 @@
                String randomCode = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
                appUser.setCode("YH"+format+randomCode);
                this.save(appUser);
                remoteMeditationService.addHomeBackgroundMusicDefault(appUser.getId());
                initUserTree(appUser.getId());
                return appUser;
            }else{
@@ -157,6 +164,8 @@
        String randomCode = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
        appUser.setCode("YH"+format+randomCode);
        this.save(appUser);
        remoteMeditationService.addHomeBackgroundMusicDefault(appUser.getId());
        initUserTree(appUser.getId());
        return appUser;
    }
@@ -186,6 +195,8 @@
            if (appUser.getCellPhone()!=null){
                appLoginUser.setBindStatus(DisabledEnum.NO.getCode());
                appLoginUser.setCellPhone(appUser.getCellPhone());
            }else{
                appLoginUser.setBindStatus(DisabledEnum.YES.getCode());
            }
        } else {
            if (org.springframework.util.StringUtils.hasLength(body.getDevice())){
@@ -233,6 +244,8 @@
                    appUser.setLevelSettingId(TreeLevelEnum.SEED.getCode());
                    appLoginUser.setBindStatus(DisabledEnum.YES.getCode());
                    this.save(appUser);
                    remoteMeditationService.addHomeBackgroundMusicDefault(appUser.getId());
                    // 初始化用户树苗
                    initUserTree(appUser.getId());
                }
@@ -274,6 +287,8 @@
                appUser.setLevelSettingId(TreeLevelEnum.SEED.getCode());
                appLoginUser.setBindStatus(DisabledEnum.YES.getCode());
                this.save(appUser);
                remoteMeditationService.addHomeBackgroundMusicDefault(appUser.getId());
                // 初始化用户树苗
                initUserTree(appUser.getId());
            }
@@ -352,6 +367,8 @@
                    String randomCode = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
                    appUser.setCode("YH" + format + randomCode);
                    this.save(appUser);
                    remoteMeditationService.addHomeBackgroundMusicDefault(appUser.getId());
                    // 初始化用户树苗
                    initUserTree(appUser.getId());
                }
@@ -391,6 +408,8 @@
                String randomCode = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
                appUser.setCode("YH" + format + randomCode);
                this.save(appUser);
                remoteMeditationService.addHomeBackgroundMusicDefault(appUser.getId());
                // 初始化用户树苗
                initUserTree(appUser.getId());
            }
@@ -462,6 +481,7 @@
                        String randomCode = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
                        appUser.setCode("YH" + format + randomCode);
                        this.save(appUser);
                        remoteMeditationService.addHomeBackgroundMusicDefault(appUser.getId());
                        // 初始化用户树苗
                        initUserTree(appUser.getId());
                    }
@@ -500,6 +520,8 @@
                    String randomCode = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
                    appUser.setCode("YH" + format + randomCode);
                    this.save(appUser);
                    remoteMeditationService.addHomeBackgroundMusicDefault(appUser.getId());
                    // 初始化用户树苗
                    initUserTree(appUser.getId());
                }
@@ -518,6 +540,9 @@
     * @param appUserId 用户id
     */
    private void initUserTree(Long appUserId) {
        if (appUserTreeService.lambdaQuery().eq(AppUserTree::getSowAgain,2).eq(AppUserTree::getAppUserId,appUserId).one()!=null){
            return;
        }
        AppUserTree appUserTree = new AppUserTree();
        appUserTree.setAppUserId(appUserId);
        appUserTree.setTreeLevelType(TreeLevelEnum.SEED.getCode());