yujian
2019-11-25 59bfbce44674e52aefbe883233ffaea93d750a8f
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -5,6 +5,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@@ -31,9 +32,11 @@
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.util.wx.WXLoginUtil;
@@ -67,6 +70,9 @@
   @Resource
   private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
   @Resource
   private UserVIPInfoService userVIPInfoService;
   /**
    * 邀请码验证
@@ -124,9 +130,11 @@
   /**
    * 微信激活
    *
    * @param acceptData
    * @param uid
    * @param key 验证返回的key
    * @param key
    *            验证返回的key
    * @param out
    */
   @RequestSerializableByKey(key = "'activeInviteWX-'+#uid")
@@ -154,8 +162,6 @@
      }
   }
   
   /**
    * 用户队员列表查询 1.5.3查询有效队员
    * 
@@ -180,8 +186,12 @@
         count = threeSaleSerivce.countSecondTeam(uid, 1);
      }
      boolean needVIPInfo = false;
      if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
         needVIPInfo = true;
      // 组织数据
      JSONObject resultData = organizeTeam(count, listTeam, uid, type);
      JSONObject resultData = organizeTeam(count, listTeam, uid, type,needVIPInfo);
      // 第一页判断是否激活 是否有队员
      if (type == 1 && page == 1) {
@@ -206,7 +216,7 @@
    * @param type
    * @return
    */
   private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type) {
   private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type, boolean needVipInfo) {
      JSONObject result = new JSONObject();
      JSONArray resultArray = new JSONArray();
@@ -215,6 +225,14 @@
      SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
      SimpleDateFormat formatYears = new SimpleDateFormat("yyyy");
      List<Long> workerIdList = new ArrayList<>();
      Map<Long, Boolean> vipMap = null;
      if (needVipInfo) {
         for (ThreeSale threeSale : list)
            workerIdList.add(threeSale.getWorker().getId());
         if (workerIdList.size() > 0)
            vipMap = userVIPInfoService.listByUids(workerIdList);
      }
      for (ThreeSale threeSale : list) {
         UserInfo worker = threeSale.getWorker();
         if (worker == null) {
@@ -230,6 +248,9 @@
         Date inviteTime = new Date(threeSale.getCreateTime());
         object.put("inviteTime", format.format(inviteTime) + " 加入");
         // 添加是否为VIP
         if (vipMap != null && vipMap.get(worker.getId()) != null)
            object.put("vip", vipMap.get(worker.getId()));
         String fontColor1 = "#888888";
         JSONArray array = new JSONArray();