admin
2019-01-29 2d634416cc026d139d515d53b6fa56f73d253458
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -35,6 +35,7 @@
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.yeshi.fanli.dto.HongBaoDTO;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.AccountDetails;
import com.yeshi.fanli.entity.bus.user.AccountMessage;
@@ -71,6 +72,7 @@
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.AdminUserService;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemService;
import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
@@ -215,6 +217,9 @@
   @Resource
   private UserInfoExtraService userInfoExtraService;
   @Resource
   private AppVersionService appVersionService;
   private static final String PASSWORD_MAX_ERROR = "password_max_error";
   private static final String EXTRACT_MIN_MONEY = "extract_min_money";
@@ -504,11 +509,34 @@
      BigDecimal fanliHB = user.getTotalHongBao();
      user.setTotalHongBao(fanliHB);
      UserInfo filterForClientUser = UserUtil.filterForClientUser(user);
      // 1.5.0 版本之后返回新的等级
      String version = acceptData.getVersion();
      if (version != null && version.trim().length() > 0) {
         int versionCode = Integer.parseInt(version);
         String platform = acceptData.getPlatform();
         AppVersionInfo versionInfo = appVersionService.getByPlatformAndVersion(platform, "1.5.0");
         if (versionInfo != null) {
            int versionCode150 = versionInfo.getVersionCode();
            if (versionCode >= versionCode150) {
               UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());
               if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
                  String picture = userInfoExtra.getUserRank().getPicture();
                  String icon = userInfoExtra.getUserRank().getIcon();
                  filterForClientUser.setRankNamePicture(picture);
                  filterForClientUser.setRankIcon(icon);
               }
            }
         }
      }
      GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
      JSONObject data = new JSONObject();
      data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create()
            .toJson(UserUtil.filterForClientUser(user)));
      data.put("user",
            JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(filterForClientUser));
      data.put("first", 0);
      int spreadImgCount = spreadUserImgService.countUserSpreadImg(user.getId());
      long shareCount = userShareGoodsRecordService.countShareRecordByUid(user.getId());
@@ -1861,41 +1889,60 @@
    */
   @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
   public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
      try {
         long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
         long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
      long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
      long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
         long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
         long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
         JSONObject bossData = new JSONObject();
         ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
         if (threeSale != null) {
            UserInfo boss = threeSale.getBoss();
            if (boss != null) {
               bossData.put("nickName", boss.getNickName());
               bossData.put("portrait", boss.getPortrait());
            }
      long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
      long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
      JSONObject bossData = new JSONObject();
      ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
      if (threeSale != null) {
         UserInfo boss = threeSale.getBoss();
         if (boss != null) {
            bossData.put("nickName", boss.getNickName());
            bossData.put("portrait", boss.getPortrait());
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
            Long createTime = threeSale.getCreateTime();
            Date inviteTime = new Date(createTime);
            bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
         }
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
         Long createTime = threeSale.getCreateTime();
         Date inviteTime = new Date(createTime);
         bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
         JSONObject resultData = new JSONObject();
         String helpLink = configService.get("team_help_url");
         if (helpLink == null) {
            helpLink = "";
         }
         resultData.put("helpLink", helpLink);
         resultData.put("firstTeam", firstTeam);
         resultData.put("firstTeamTotal", firstTeamTotal);
         resultData.put("secondTeam", secondTeam);
         resultData.put("secondTeamTotal", secondTeamTotal);
         resultData.put("boss", bossData);
         boolean hasCode = false;
         String inviteCode = userInfoExtraService.getUserInviteCode(uid);
         if (inviteCode != null && inviteCode.trim().length() > 0) {
            hasCode = true;   // 已有邀请码
         } else {
            // 邀请激活链接
            resultData.put("activationlink", configService.get("invite_activation_url"));
         }
         resultData.put("hasCode", hasCode);
         out.print(JsonUtil.loadTrueResult(resultData));
      } catch (UserInfoExtraException e) {
         out.print(JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         out.print(JsonUtil.loadFalseResult("统计失败"));
         e.printStackTrace();
      }
      JSONObject resultData = new JSONObject();
      String helpLink = configService.get("team_help_url");
      if (helpLink == null) {
         helpLink = "";
      }
      resultData.put("helpLink", helpLink);
      resultData.put("firstTeam", firstTeam);
      resultData.put("firstTeamTotal", firstTeamTotal);
      resultData.put("secondTeam", secondTeam);
      resultData.put("secondTeamTotal", secondTeamTotal);
      resultData.put("boss", bossData);
      out.print(JsonUtil.loadTrueResult(resultData));
   }
   /**