| | |
| | | dto.getWxOpenId()) |
| | | .ne(AppUser::getUserStatus, AppUserStatusEnum.LOGOUT.getCode()).oneOpt(); |
| | | } |
| | | @Override |
| | | public Optional<AppUser> getUserByCondition1(AppUserDTO dto) { |
| | | return this.lambdaQuery() |
| | | .eq(AppUser::getCellPhone,dto.getCellPhone()) |
| | | .ne(AppUser::getUserStatus,3).oneOpt(); |
| | | } |
| | | |
| | | /** |
| | | * app用户注册 |
| | |
| | | appUser.setLevelSettingId(TreeLevelEnum.SEED.getCode()); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | String format = simpleDateFormat.format(new Date()); |
| | | appLoginUser.setBindStatus(DisabledEnum.YES.getCode()); |
| | | // 生成四位随机数字 |
| | | String randomCode = String.valueOf((int) ((Math.random() * 9 + 1) * 1000)); |
| | | appUser.setCode("YH" + format + randomCode); |
| | |
| | | List<AppUserQuestion> appUserQuestionList = BeanUtils.copyList( |
| | | dto.getUserAnswerOneDTOList(), AppUserQuestion.class); |
| | | // 查询用户已填写的答案 |
| | | List<AppUserQuestion> baseAppUserQuestionList = appUserQuestionService.lambdaQuery() |
| | | .eq(AppUserQuestion::getAppUserId, appUser.getUserId()) |
| | | .list(); |
| | | if (CollUtils.isNotEmpty(baseAppUserQuestionList)) { |
| | | // 根据类型更新答案 |
| | | for (AppUserQuestion appUserQuestion : appUserQuestionList) { |
| | | // 删除之前答案 |
| | | appUserQuestionService.lambdaUpdate().eq(AppUserQuestion::getAppUserId,userId).remove(); |
| | | |
| | | Optional<AppUserQuestion> baseAppUserQuestionOptional = baseAppUserQuestionList.stream() |
| | | .filter(baseAppUserQuestion -> baseAppUserQuestion.getType() |
| | | .equals(appUserQuestion.getType())).findFirst(); |
| | | baseAppUserQuestionOptional.ifPresent( |
| | | userQuestion -> appUserQuestion.setId(userQuestion.getId())); |
| | | appUserQuestion.setAppUserId(userId); |
| | | } |
| | | } |
| | | // 根据类型更新答案 |
| | | for (AppUserQuestion appUserQuestion : appUserQuestionList) { |
| | | appUserQuestion.setAppUserId(userId); |
| | | appUserQuestion.setAppUserId(userId); |
| | | } |
| | | appUserQuestionService.saveOrUpdateBatch(appUserQuestionList); |
| | | appUserQuestionService.saveBatch(appUserQuestionList); |
| | | // 筛选答案为是和偶尔有的问题,为用户设置对应的标签 |
| | | List<AppUserQuestion> appUserQuestionYesList = appUserQuestionList.stream() |
| | | .filter(appUserQuestion -> appUserQuestion.getAnswer().equals("1") |