yujian
2020-05-06 a338d86bcaf17f2ba9296a601cdbda4d3e9baae0
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -199,7 +199,7 @@
   }
   /**
    * 用户队员列表查询 1.5.3查询有效队员
    * 用户队员列表查询
    * 
    * @param acceptData
    * @param id
@@ -212,29 +212,33 @@
         return;
      }
      
      if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
         getMyTeamNew(acceptData, page, uid, type, out);
         return;
      }
      List<Long> listId = new ArrayList<Long>();
      long count = 0;
      List<ThreeSale> listTeam = null;
      if (type == 1) {
         listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
         listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, listId);
         count = threeSaleSerivce.countFirstTeam(uid);
      } else if (type == 2) {
         listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
         listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, listId);
         count = threeSaleSerivce.countSecondTeam(uid);
      }
      boolean needVIPInfo = false;
      if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
         needVIPInfo = true;
      // 组织数据
      JSONObject resultData = organizeTeam(count, listTeam, uid, type,needVIPInfo);
      // 第一页判断是否激活 是否有队员
      // 数据加工
      JSONArray array = null;
      if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
         array = organizeTeamNew(listTeam, uid, type, true);
      } else {
         boolean needVIPInfo = false;
         if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
            needVIPInfo = true;
         array =  organizeTeam(listTeam, uid, type,needVIPInfo);
      }
      JSONObject result = new JSONObject();
      result.put("count", count);
      result.put("list", array);
      if (type == 1 && page == 1) {
         boolean hasCode = false;
         UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
@@ -242,10 +246,10 @@
            if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
               hasCode = true;
         }
         resultData.put("hasCode", hasCode);
         resultData.put("hasTeam", count > 0 ? true : false);
         result.put("hasCode", hasCode);
         result.put("hasTeam", count > 0 ? true : false);
      }
      out.print(JsonUtil.loadTrueResult(resultData));
      out.print(JsonUtil.loadTrueResult(result));
   }
   /**
@@ -257,10 +261,8 @@
    * @param type
    * @return
    */
   private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type, boolean needVipInfo) {
      JSONObject result = new JSONObject();
   private JSONArray organizeTeam(List<ThreeSale> list, Long uid, int type, boolean needVipInfo) {
      JSONArray resultArray = new JSONArray();
      Date todayTime = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm");
      SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
@@ -343,46 +345,9 @@
         object.put("recentMsg", array);
         resultArray.add(object);
      }
      result.put("count", count);
      result.put("list", resultArray);
      return result;
      return resultArray;
   }
   
   private void getMyTeamNew(AcceptData acceptData, long page, long uid, int type, PrintWriter out) {
      if (type != 1 && type != 2) {
         out.print(JsonUtil.loadFalseResult("粉丝类型不正确"));
         return;
      }
      long count = 0;
      List<ThreeSale> listTeam = null;
      if (type == 1) {
         listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
         count = threeSaleSerivce.countFirstTeam(uid);
      } else if (type == 2) {
         listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
         count = threeSaleSerivce.countSecondTeam(uid);
      }
      JSONObject result = new JSONObject();
      result.put("count", count);
      result.put("list", organizeTeamNew(count, listTeam, uid, type, true));
      // 第一页判断是否激活 是否有队员
      if (type == 1 && page == 1) {
         boolean hasCode = false;
         UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
         if (userInfoExtra != null) {
            if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
               hasCode = true;
         }
         result.put("hasCode", hasCode);
         result.put("hasTeam", count > 0 ? true : false);
      }
      out.print(JsonUtil.loadTrueResult(result));
   }
   
   /**
    *  加工数据
@@ -393,7 +358,7 @@
    * @param wxtip 是需要微信提示
    * @return
    */
   private JSONArray organizeTeamNew(long count, List<ThreeSale> list, Long uid, int type, boolean wxtip) {
   private JSONArray organizeTeamNew(List<ThreeSale> list, Long uid, int type, boolean wxtip) {
      JSONArray resultArray = new JSONArray();
      if (list == null || list.size() == 0) {
         return resultArray;
@@ -524,7 +489,7 @@
      JSONObject result = new JSONObject();
      result.put("count", count);
      result.put("list", organizeTeamNew(count, listTeam, tid, 1, false));
      result.put("list", organizeTeamNew(listTeam, tid, 1, false));
      out.print(JsonUtil.loadTrueResult(result));
   }