admin
2020-07-14 eec7e789a87863c25d92c10ad5dfc22ad80c448d
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/InviteController.java
@@ -9,10 +9,10 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.dto.WXMPAcceptData;
@@ -22,14 +22,12 @@
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
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;
@@ -56,9 +54,6 @@
   private UserVIPInfoService userVIPInfoService;
   @Resource
   private UserInviteSeparateService userInviteSeparateService;
   @Resource
   private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
   
   @Resource
@@ -75,7 +70,6 @@
    * 
    * @param acceptData
    * @param uid
    * @param inviteId
    * @param out
    */
   @RequestMapping(value = "tailorCode")
@@ -108,7 +102,7 @@
      
      JSONObject data = new JSONObject();
      data.put("desc", array);
      data.put("num", threeSaleSerivce.countFirstTeam(uid, 1));
      data.put("num", threeSaleSerivce.countFirstTeam(uid));
      data.put("limit", Constant.INVITE_CODRE_TAILOR_LIMIT);
      
      out.print(JsonUtil.loadTrueResult(data));
@@ -118,17 +112,13 @@
    * 用户队员统计 1.4.1
    * 
    * @param acceptData
    * @param id
    * @param out
    */
   @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
   public void countMyTeam(WXMPAcceptData acceptData, long uid, PrintWriter out) {
      try {
         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 firstTeam = threeSaleSerivce.countFirstTeam(uid);
         long secondTeam = threeSaleSerivce.countSecondTeam(uid);
         JSONObject bossData = new JSONObject();
         ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
         if (threeSale != null) {
@@ -146,15 +136,15 @@
         JSONObject resultData = new JSONObject();
         String helpLink = configService.get(ConfigKeyEnum.teamHelpUrl.getKey());
         String helpLink = configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(),acceptData.getSystem());
         if (helpLink == null) {
            helpLink = "";
         }
         resultData.put("helpLink", helpLink);
         resultData.put("firstTeam", firstTeam);
         resultData.put("firstTeamTotal", firstTeamTotal);
         resultData.put("firstTeamTotal", firstTeam);
         resultData.put("secondTeam", secondTeam);
         resultData.put("secondTeamTotal", secondTeamTotal);
         resultData.put("secondTeamTotal", secondTeam);
         resultData.put("boss", bossData);
         boolean hasCode = false;
@@ -163,7 +153,7 @@
            hasCode = true; // 已有邀请码
         } else {
            // 邀请激活链接
            resultData.put("activationlink", configService.get(ConfigKeyEnum.inviteActivationUrl.getKey()));
            resultData.put("activationlink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(),acceptData.getSystem()));
         }
         resultData.put("hasCode", hasCode);
@@ -178,7 +168,6 @@
   /**
    * 
    * @param acceptData
    * @param id
    * @param out
    */
   @RequestMapping(value = "listMyTeam")
@@ -191,11 +180,11 @@
      long count = 0;
      List<ThreeSale> listTeam = null;
      if (type == 1) {
         listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, 1);
         count = threeSaleSerivce.countFirstTeam(uid, 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, 1);
         count = threeSaleSerivce.countSecondTeam(uid, 1);
         listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
         count = threeSaleSerivce.countSecondTeam(uid);
      }
      boolean needVIPInfo = true;
@@ -261,35 +250,6 @@
         // 添加是否为VIP
         if (vipMap != null && vipMap.get(worker.getId()) != null) {
            object.put("vip", vipMap.get(worker.getId()));
            if (vipMap.get(worker.getId())) {
               UserInviteSeparate separate = userInviteSeparateService.selectByWorkerIdAndBossId(worker.getId(),
                     uid);
               if (separate != null && separate.getEndTime() != null) {
                  try {
                     JSONObject contentJson1 = new JSONObject();
                     contentJson1.put("color", "#888888");
                     contentJson1.put("content", "将于");
                     JSONObject contentJson2 = new JSONObject();
                     contentJson2.put("color", "#F14242");
                     contentJson2.put("content", DateUtil.dateDiff4(new Date(), separate.getEndTime()));
                     JSONObject contentJson3 = new JSONObject();
                     contentJson3.put("color", "#888888");
                     contentJson3.put("content", "后脱离邀请关系");
                     JSONArray array = new JSONArray();
                     array.add(contentJson1);
                     array.add(contentJson2);
                     array.add(contentJson3);
                     object.put("vipBreakTime", array);
                  } catch (Exception e) {
                     e.printStackTrace();
                  }
               }
            }
         }
         String fontColor1 = "#888888";
         JSONArray array = new JSONArray();
@@ -359,7 +319,7 @@
         out.print(JsonUtil.loadFalseResult("用户未登录"));
         return;
      }
      JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid));
      JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid),acceptData.getSystem());
      out.print(JsonUtil.loadTrueResult(bossData));
   }
   
@@ -368,7 +328,6 @@
    * 
    * @param acceptData
    * @param uid
    * @param inviteId
    * @param out
    */
   @RequestMapping(value = "remindBossAddWX")
@@ -425,7 +384,7 @@
      try {
         List<String> listIOS = new ArrayList<String>();
         List<String> listAndroid = new ArrayList<String>();
         pushService.pushZNX(remindId, title, content, listIOS, listAndroid);
         pushService.pushZNX(remindId, title, content, listIOS, listAndroid,acceptData.getSystem());
         userSystemMsgService.addUserSystemMsg(remindId, UserSystemMsgTypeEnum.common, title, content,
               UserSystemMsg.TIME_TAG_COMMON, null);
@@ -463,12 +422,11 @@
   /**
    * 上级信息组织
    * 
    * @param acceptData
    * @param uid
    * @param threeSale
    * @return
    */
   private JSONObject getBossInfo(long uid, ThreeSale threeSale) {
   private JSONObject getBossInfo(long uid, ThreeSale threeSale, SystemEnum system) {
      JSONObject bossData = new JSONObject();
      if (threeSale != null && threeSale.getBoss() != null) {
         UserInfo boss = threeSale.getBoss();
@@ -497,7 +455,7 @@
         bossData.put("inviteTime", "你于 " + sdf.format(inviteTime) + "接受了TA的邀请");
      } else {
         bossData.put("hasBoss", false);
         bossData.put("helpLink", configService.get(ConfigKeyEnum.inviteCodeHlepLink.getKey()));
         bossData.put("helpLink", configService.getValue(ConfigKeyEnum.inviteCodeHlepLink.getKey(),system));
         bossData.put("weiXinTip", "恭喜你,我们的优质用户;\r\n你并没有邀请人,但你的邀请激活功能是被默认开启的;\r\n你拥有独特的无邀请人激活码。");
      }
      return bossData;