| | |
| | | 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.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.dto.vip.UserVIPLevel;
|
| | | import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | |
| | | 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.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | 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.invite.UserInviteService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.user.UserLevelUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | |
| | | @Resource
|
| | | private UserInviteSeparateService userInviteSeparateService;
|
| | |
|
| | | @Resource
|
| | | private SpreadImgService spreadImgService;
|
| | |
| | | @Resource
|
| | | private UserInviteValidRecordService userInviteValidRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserInviteValidNumService userInviteValidNumService;
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | 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 = false;
|
| | |
| | | // 添加是否为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();
|
| | |
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
|
| | | object.put("weiXinState", 1);
|
| | | object.put("weiXinTip", "点击提醒TA,系统会发送一封站内信,提醒其添加微信号。");
|
| | | object.put("weiXinTip", "点击提醒,系统会发送一封站内信,提醒其添加微信号。");
|
| | | } else {
|
| | | object.put("weiXinState", 2);
|
| | | object.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
|
| | |
| | | long count = 0;
|
| | | List<ThreeSale> listTeam = null;
|
| | | if (type == 1) {
|
| | | listTeam = threeSaleSerivce.listFirstTeamByUndeleted((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
|
| | | count = threeSaleSerivce.countFirstTeamByUndeleted(uid);
|
| | | listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
|
| | | count = threeSaleSerivce.countFirstTeam(uid);
|
| | | } else if (type == 2) {
|
| | | listTeam = threeSaleSerivce.listSecondTeamByUndeleted((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
|
| | | count = threeSaleSerivce.countSecondTeamByUndeleted(uid);
|
| | | 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) {
|
| | | validType = UserInviteValidRecord.TYPE_ONE;
|
| | | }
|
| | | |
| | | List<Long> listVid = userInviteValidRecordService.getValidWorkerIdsByUid(uid, listWid, validType);
|
| | |
|
| | | for (ThreeSale threeSale : list) {
|
| | | UserInfo worker = threeSale.getWorker();
|
| | | Long workerId = worker.getId();
|
| | |
|
| | | // 邀请状态
|
| | | Boolean state = threeSale.getState();
|
| | | if (type == 2) {
|
| | | if (state && threeSale.getStateSuper()) {
|
| | | state = true;
|
| | | } else {
|
| | | state = false;
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | // 邀请成功时间
|
| | | Long succeedTime = threeSale.getSucceedTime();
|
| | | if (succeedTime == null) {
|
| | |
| | |
|
| | | // 有效粉丝
|
| | | boolean validFans = false;
|
| | | if (state && listVid != null && listVid.size() > 0 && listVid.contains(workerId)) {
|
| | | if (listVid != null && listVid.size() > 0 && listVid.contains(workerId)) {
|
| | | validFans = true;
|
| | | }
|
| | |
|
| | | // 最近登录时间
|
| | | // 最近粉丝登录时间
|
| | | Date lastLoginTime = new Date(threeSale.getCreateTime());
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(workerId);
|
| | | if (userInfoExtra != null && userInfoExtra.getActiveTime() != null) {
|
| | |
| | | JSONArray array = new JSONArray();
|
| | | array.add(loginJson);
|
| | |
|
| | | // 等级
|
| | | UserInviteLevelEnum level = null;
|
| | | UserVIPLevel vipLevel = userInviteService.getVIPLevelByUid(uid);
|
| | | if (vipLevel != null) {
|
| | | if (vipLevel.getLevel() == UserVIPLevel.LEVEL_3) {
|
| | | level = UserInviteLevelEnum.actived;
|
| | | } else if (vipLevel.getLevel() == UserVIPLevel.LEVEL_7) {
|
| | | level = UserInviteLevelEnum.actived;
|
| | | } else if (vipLevel.getLevel() == UserVIPLevel.LEVEL_10) {
|
| | | level = UserInviteLevelEnum.actived;
|
| | | }
|
| | | // 查询粉丝等级
|
| | | UserLevelEnum level = null;
|
| | | UserVIPLevel vipLevel = userInviteService.getVIPLevelByUid(workerId);
|
| | | if (vipLevel != null && vipLevel.getLevel() != null) {
|
| | | level = UserLevelUtil.getByLevel(vipLevel.getLevel());
|
| | | }
|
| | | |
| | | if(level == null) {
|
| | | if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | level = UserInviteLevelEnum.noActive;
|
| | | } else {
|
| | | level = UserInviteLevelEnum.actived;
|
| | | }
|
| | | level = UserLevelEnum.daRen;
|
| | | }
|
| | | |
| | | level = UserLevelUtil.getShowLevel(level);
|
| | |
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("workerId", workerId);
|
| | |
| | | object.put("portrait", worker.getPortrait());
|
| | | object.put("inviteId", threeSale.getId());
|
| | | object.put("inviteTime", format.format(new Date(succeedTime)) + " 加入");
|
| | | object.put("state", state? 1 : 2);
|
| | | object.put("state", 1);
|
| | | object.put("recentMsg", array);
|
| | | object.put("level", level.name());
|
| | | object.put("validFans", validFans);
|
| | |
|
| | | |
| | | // 判断是否存在脱离关系队员
|
| | | if (vipLevel != null) {
|
| | | UserInviteSeparate separate = userInviteSeparateService.selectByWorkerIdAndBossId(workerId, uid);
|
| | | if (separate != null && separate.getEndTime() != null) {
|
| | | try {
|
| | | JSONObject contentJson1 = new JSONObject();
|
| | | contentJson1.put("color", "#888888");
|
| | | contentJson1.put("content", "将于");
|
| | |
|
| | | String dateDiff = DateUtil.dateDiff4(new Date(), separate.getEndTime());
|
| | | JSONObject contentJson2 = new JSONObject();
|
| | | contentJson2.put("color", "#F14242");
|
| | | contentJson2.put("content", dateDiff);
|
| | |
|
| | | JSONObject contentJson3 = new JSONObject();
|
| | | contentJson3.put("color", "#888888");
|
| | | contentJson3.put("content", "后脱离邀请关系");
|
| | | |
| | | JSONArray vipBreak = new JSONArray();
|
| | | vipBreak.add(contentJson1);
|
| | | vipBreak.add(contentJson2);
|
| | | vipBreak.add(contentJson3);
|
| | | object.put("vipBreakTime",vipBreak);
|
| | | |
| | | List<String> tips = new ArrayList<String>();
|
| | | tips.add("于"+ TimeUtil.formatDateDot(vipLevel.getSuccessTime()) + "升级为" + level.getName());
|
| | | if (type == 1) {
|
| | | tips.add("你需要在"+ dateDiff +"内升级为会员,否则按照邀请规则TA将与你脱离邀请关系。");
|
| | | tips.add("赶快加油升级为会员吧!");
|
| | | } else {
|
| | | tips.add("你需要辅助TA的邀请人"+ threeSale.getBoss().getNickName()+ "在"+dateDiff+"内升级为会员,否则这位间接粉丝" +worker.getNickName()+"将与你脱离邀请关系。");
|
| | | tips.add("赶快帮助TA升级为会员吧!");
|
| | | }
|
| | | object.put("vipBreakTip",tips);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | if (wxtip && type == 1 && threeSale.getState() != null && threeSale.getState()) {
|
| | | // 一级队员 查询昵称备注
|
| | | String memoName = null;
|
| | |
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
|
| | | object.put("weiXinState", 1);
|
| | | object.put("weiXinTip", "点击提醒TA,系统会发送一封站内信,提醒其添加微信号。");
|
| | | object.put("weiXinTip", "点击提醒,系统会发送一封站内信,提醒其添加微信号。");
|
| | | } else {
|
| | | object.put("weiXinState", 2);
|
| | | object.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | resultArray.add(object);
|
| | | }
|
| | | return resultArray;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | List<ThreeSale> listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, tid, 1);
|
| | | long count = threeSaleSerivce.countFirstTeam(tid, 1);
|
| | | List<ThreeSale> listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, tid);
|
| | | long count = threeSaleSerivce.countFirstTeam(tid);
|
| | |
|
| | | JSONObject result = new JSONObject();
|
| | | result.put("count", count);
|
| | |
| | | JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid));
|
| | | JSONObject resultData = new JSONObject();
|
| | |
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid);
|
| | | long countSecond = threeSaleSerivce.countSecondTeam(uid);
|
| | | resultData.put("boss", bossData);
|
| | | resultData.put("helpLink", configService.get(ConfigKeyEnum.teamHelpUrl.getKey()));
|
| | | resultData.put("firstTeam", firstTeam);
|
| | | resultData.put("firstTeamTotal", threeSaleSerivce.countFirstTeam(uid, null));
|
| | | resultData.put("secondTeam", threeSaleSerivce.countSecondTeam(uid, 1));
|
| | | resultData.put("secondTeamTotal", threeSaleSerivce.countSecondTeam(uid, null));
|
| | | resultData.put("firstTeamTotal", firstTeam);
|
| | | resultData.put("secondTeam", countSecond);
|
| | | resultData.put("secondTeamTotal", countSecond);
|
| | | resultData.put("helpLink", configService.get(ConfigKeyEnum.teamHelpUrl.getKey()));
|
| | |
|
| | | boolean hasTeam = true;
|
| | | if (firstTeam <= 0) {
|
| | |
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindBoss(boss.getId(), uid)) {
|
| | | bossData.put("weiXinState", 1);
|
| | | bossData.put("weiXinTip", "点击提醒TA,系统会发送一封站内信,提醒其添加微信号。");
|
| | | bossData.put("weiXinTip", "点击提醒,系统会发送一封站内信,提醒其添加微信号。");
|
| | | } else {
|
| | | bossData.put("weiXinState", 2);
|
| | | bossData.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 有效粉丝
|
| | | int doneFirst = 0;
|
| | | UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
|
| | | if (userInviteValidNum != null) {
|
| | | doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("num", threeSaleSerivce.countFirstTeam(uid, 1));
|
| | | data.put("num", doneFirst);
|
| | | data.put("limit", Constant.INVITE_CODRE_TAILOR_LIMIT);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | }
|