yujian
2019-03-07 e6cb7c27384f22b39ccee584028e23b56c30e9ee
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.impl.user;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -10,7 +11,6 @@
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.user.UserInfoExtraMapper;
import com.yeshi.fanli.dao.mybatis.user.UserRankRecordMapper;
@@ -140,8 +140,11 @@
      if (userInfoExtra != null && userInfoExtra.getId() != null) {
         // 判断当月是否已更新
         Date rankUpdateTime = userInfoExtra.getRankUpdateTime();
         if (rankUpdateTime != null && DateUtil.isSameMonth(rankUpdateTime, new Date())) {
            isupdateRank = false;
         if (rankUpdateTime != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
            if (sdf.format(rankUpdateTime).equals(sdf.format(new Date()))) {
               isupdateRank = false;
            }
         } 
      } else {
         userInfoExtra = new UserInfoExtra();
@@ -290,6 +293,14 @@
         throw new UserInfoExtraException(1, "用户id、邀请码不能为空");
      }
      
      UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
      if (extra != null) {
         String inviteCodeHas = extra.getInviteCode();
         if (inviteCodeHas != null && inviteCodeHas.trim().length() > 0) {
            throw new UserInfoExtraException(1, "已存在邀请码,请刷新页面");
         }
      }
      // 被邀请人信息
      UserInfo invitee = userInfoService.selectByPKey(uid);
      if (invitee == null) {
@@ -381,4 +392,11 @@
      return inviteCode;
   }
   
   @Override
   public long countByRankId(Long rankId) {
      return userInfoExtraMapper.countByRankId(rankId);
   }
}