yujian
2019-02-25 8b37d2f16d4aa7c7ce19829b74307ae0072b127f
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -590,6 +590,15 @@
      final UserInfo uuser = user;
      ThreadUtil.run(new Runnable() {
         public void run() {
            try {
               // 获取邀请码:若无邀请码且存在有效的队员关系 则自动生成邀请码
               userInfoExtraService.getUserInviteCode(uuser.getId());
            } catch (UserInfoExtraException e) {
               e.printStackTrace();
            }
            LogHelper.userInfo(GsonUtil.toJsonExpose(uuser));
            uuser.setLastLoginIp(remotIP);
            uuser.setLastLoginTime(java.lang.System.currentTimeMillis());
@@ -881,7 +890,7 @@
      }
      String minMoney = configService.get(EXTRACT_MIN_MONEY); // 单笔提现的最小金额
      String maxMoney = configService.get(EXTRACT_MAX_MONEY); // 单笔提现的最大金额
      String maxDayMoney = configService.get("extract_money_day"); // 每日最大提现金额
      int maxDayCount = Integer.parseInt(configService.get("extract_count_day"));
      ExtractRecord extractRecord = extractRecordService.getExtractRecordByUid(uid);
      boolean canExtract = true;
@@ -890,9 +899,9 @@
         canExtract = false;
         errorMsg = String.format("每日最多提现%s次", maxDayCount + "");
      } else if (extractRecord != null
            && extractRecord.getMoney().add(money).compareTo(new BigDecimal(maxMoney)) > 0) {
            && extractRecord.getMoney().add(money).compareTo(new BigDecimal(maxDayMoney)) > 0) {
         canExtract = false;
         errorMsg = String.format("每日最多提现%s元", maxMoney);
         errorMsg = String.format("每日最多提现%s元", maxDayMoney);
      } else if (new BigDecimal(minMoney).compareTo(money) > 0) {
         canExtract = false;
         errorMsg = String.format("每次最低提现%s元", minMoney);
@@ -1832,52 +1841,71 @@
   @RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
   public void getMyTeam(AcceptData acceptData, long page, long uid, long type, PrintWriter out) {
      int pageSize = Constant.PAGE_SIZE;
      try {
         int pageSize = Constant.PAGE_SIZE;
      JSONObject resultData = new JSONObject();
      if (type == 1) {
         resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
      } else if (type == 2) {
         resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
      }
         JSONObject resultData = new JSONObject();
         if (type == 1) {
            resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
         } else if (type == 2) {
            resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
         }
      // 安卓系统返回所有数据
      String platform = acceptData.getPlatform();
      if ("android".equalsIgnoreCase(platform)) {
         long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
         long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
         // 安卓系统返回所有数据
         String platform = acceptData.getPlatform();
         if ("android".equalsIgnoreCase(platform)) {
            long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
            long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
         long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
         long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
            long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
            long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
         JSONObject bossData = null;
         ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
         if (threeSale != null) {
            bossData = new JSONObject();
            UserInfo boss = threeSale.getBoss();
            if (boss != null) {
               bossData.put("nickName", boss.getNickName());
               bossData.put("portrait", boss.getPortrait());
            JSONObject bossData = null;
            ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
            if (threeSale != null) {
               bossData = new JSONObject();
               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));
         }
            String helpLink = configService.get("team_help_url");
            if (helpLink == null) {
               helpLink = "";
            }
         String helpLink = configService.get("team_help_url");
         if (helpLink == null) {
            helpLink = "";
            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);
            resultData.put("helpLink", helpLink);
            resultData.put("firstTeam", firstTeam);
            resultData.put("firstTeamTotal", firstTeamTotal);
            resultData.put("secondTeam", secondTeam);
            resultData.put("secondTeamTotal", secondTeamTotal);
            resultData.put("boss", bossData);
         }
         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));
      } catch (UserInfoExtraException e) {
         out.print(JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         out.print(JsonUtil.loadFalseResult("统计失败"));
         e.printStackTrace();
      }
      out.print(JsonUtil.loadTrueResult(resultData));
   }
   /**
@@ -1922,12 +1950,11 @@
         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;   // 已有邀请码
            hasCode = true; // 已有邀请码
         } else {
            // 邀请激活链接
            resultData.put("activationlink", configService.get("invite_activation_url"));
@@ -1935,14 +1962,14 @@
         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();
      }
   }
   /**