diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java index 2dcf06d..fc7b8db 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java @@ -168,21 +168,6 @@ public class MyController extends BaseController { } } - Integer point = 0; - // 信息是否已完善 - if (StringUtils.isNotBlank(userInfoUpdateDto.getBirthDay()) - && StringUtils.isNotBlank(userInfoUpdateDto.getNickName()) - && !Objects.isNull(userInfoUpdateDto.getSex()) - && StringUtils.isNotBlank(userInfoUpdateDto.getBirthDay()) - ) { - point = userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_INFORMATION, authorization); - } - - if (StringUtils.isNotBlank(userInfoUpdateDto.getInvitationCode()) && StringUtils.isBlank(user.getInvitationUserId())) { - // 只有没有被邀请过的才会触发,再次修改无效 - userInfoService.bindInvitationCode(user, userInfoUpdateDto.getInvitationCode()); - } - if (!StringTools.isEmpty(nickName)) { user.setNickName(nickName); rabbitTemplate.convertAndSend("userInfoCommentCache", userLoginDto.getUserId()); @@ -201,9 +186,25 @@ public class MyController extends BaseController { if (null != userInfoUpdateDto.getSex()) { user.setSex(userInfoUpdateDto.getSex()); } + user.setModifyTime(new Date()); userInfoService.update(user); + Integer point = 0; + // 信息是否已完善 + if (user.getBirthday() != null + && StringUtils.isNotBlank(user.getNickName()) + && !Objects.isNull(user.getSex()) + && StringUtils.isNotBlank(user.getSignature()) + ) { + point = userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_INFORMATION, authorization); + } + + if (StringUtils.isNotBlank(userInfoUpdateDto.getInvitationCode()) && StringUtils.isBlank(user.getInvitationUserId())) { + // 只有没有被邀请过的才会触发,再次修改无效 + userInfoService.bindInvitationCode(user, userInfoUpdateDto.getInvitationCode()); + } + return Result.success(point > 0 ? "更新成功,获得" + point + "积分" : "更新成功"); } diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java index 28befd6..49b16d8 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java @@ -2,22 +2,13 @@ package com.luoo.user.service; import api.PageResult; import client.vo.SimpleUser; -import com.luoo.user.dao.UserBankDao; -import com.luoo.user.dao.UserInfoDao; -import com.luoo.user.dao.UserPointLogDao; -import com.luoo.user.dao.UserRealNameDao; -import com.luoo.user.dao.WithdrawDao; -import com.luoo.user.dto.UserInfoUpdateDto; +import com.luoo.user.dao.*; import com.luoo.user.dto.UserQueryReq; import com.luoo.user.dto.UserRealNameCheckDto; import com.luoo.user.dto.UserRealNameFormDto; import com.luoo.user.dto.bank.UserBankAddDto; import com.luoo.user.dto.request.LoginReq; -import com.luoo.user.pojo.UserBank; -import com.luoo.user.pojo.UserInfo; -import com.luoo.user.pojo.UserPointLog; -import com.luoo.user.pojo.UserRealName; -import com.luoo.user.pojo.Withdraw; +import com.luoo.user.pojo.*; import com.luoo.user.util.NickNameUtil; import com.luoo.user.util.NickNameUtil2; import constants.Constants; @@ -31,7 +22,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.RandomStringUtils; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -303,22 +293,22 @@ public class UserInfoService { userInfoDaoByInvitationCode.getId()); userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.NEW_USER_INVITE, userInfo.getId()); - } - List list = userPointLogDao.findUserPointLogsByUserIdAndTaskPointId( - userInfoDaoByInvitationCode.getId(), TaskPointIdConstants.NEW_USER_INVITE); - if (list.size() == 3) { - userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_3, - userInfoDaoByInvitationCode.getId()); - } else if (list.size() == 6) { - userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_6, - userInfoDaoByInvitationCode.getId()); - } else if (list.size() == 10) { - userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_10, - userInfoDaoByInvitationCode.getId()); - } else if (list.size() == 20) { - userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_20, - userInfoDaoByInvitationCode.getId()); + List list = userPointLogDao.findUserPointLogsByUserIdAndTaskPointId( + userInfoDaoByInvitationCode.getId(), TaskPointIdConstants.NEW_USER_INVITE); + if (list.size() == 3) { + userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_3, + userInfoDaoByInvitationCode.getId()); + } else if (list.size() == 6) { + userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_6, + userInfoDaoByInvitationCode.getId()); + } else if (list.size() == 10) { + userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_10, + userInfoDaoByInvitationCode.getId()); + } else if (list.size() == 20) { + userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_20, + userInfoDaoByInvitationCode.getId()); + } } }