| | |
| | | import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.TeamFansInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleDetail;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.TeamDailyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.TeamFansInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleDetailService;
|
| | | 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.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.user.UserLevelUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | | import com.yeshi.fanli.vo.order.OrderRankingVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private TeamDailyRecordService teamDailyRecordService;
|
| | | |
| | | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleDetailService threeSaleDetailService;
|
| | |
|
| | | /**
|
| | | * 邀请码验证
|
| | |
| | | listId.add(focusInfo.getWorkerId());
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (listId != null && listId.size() > 0) {
|
| | | if (type == 1) {
|
| | | listTeam = threeSaleSerivce.listFirstTeam(0, Constant.PAGE_SIZE, uid, listId);
|
| | |
| | | countSecond = teamFansInfoService.count(2, uid, focus);
|
| | | }
|
| | | JSONArray array = organizeTeamNew(acceptData, listTeam, uid, type, true);
|
| | | |
| | |
|
| | | long count = (type == 1) ? firstTeam : countSecond;
|
| | | |
| | |
|
| | | JSONObject result = new JSONObject();
|
| | | result.put("firstTeam", firstTeam);
|
| | | result.put("secondTeam", countSecond);
|
| | | result.put("count", count);
|
| | | result.put("list", array);
|
| | | |
| | |
|
| | | // 统计H5链接
|
| | | if (page == 1) {
|
| | | result.put("link", configService.get(ConfigKeyEnum.teamStatisticsLink.getKey()));
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 验证是否存在筛选条件
|
| | | * |
| | | * @param focus
|
| | | * @return
|
| | | */
|
| | | private boolean existScreen(ThreeSaleFocusDTO focus) {
|
| | | if (focus.getStateValid() != null || focus.getTaobaoBind() != null || focus.getWeixinBind() != null
|
| | | || focus.getMinFansNum() != null || focus.getMinFansNum() != null
|
| | | || focus.getMinActiveTime() != null || focus.getMaxActiveTime() != null
|
| | | || focus.getMinIncome() != null || focus.getMaxIncome() != null |
| | | || focus.getMinFansNum() != null || focus.getMinFansNum() != null || focus.getMinActiveTime() != null
|
| | | || focus.getMaxActiveTime() != null || focus.getMinIncome() != null || focus.getMaxIncome() != null
|
| | | || focus.getMinJoinTime() != null || focus.getMaxJoinTime() != null
|
| | | || !StringUtil.isNullOrEmpty(focus.getKey()) || !StringUtil.isNullOrEmpty(focus.getLevel()))
|
| | | return true;
|
| | | |
| | | return true;
|
| | |
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | highVIP.put("total", statistic.getHighFirstCount() + statistic.getHighSecondCount());
|
| | | superVIP.put("total", statistic.getSuperFirstCount() + statistic.getSuperSecondCount());
|
| | | }
|
| | | |
| | |
|
| | | int darenToday = 0;
|
| | | int highVIPToday = 0;
|
| | |
| | | String createId = teamDailyRecordService.createId(uid, new Date());
|
| | | TeamDailyRecord record = teamDailyRecordService.getById(createId);
|
| | | if (record != null) {
|
| | | if (record.getFirstDaRen() != null) |
| | | if (record.getFirstDaRen() != null)
|
| | | darenToday += record.getFirstDaRen();
|
| | | if (record.getSecondDaRen() != null)
|
| | | darenToday += record.getSecondDaRen(); |
| | | darenToday += record.getSecondDaRen();
|
| | | if (record.getFirstHighVIP() != null)
|
| | | highVIPToday += record.getFirstHighVIP();
|
| | | if (record.getSecondHighVIP() != null)
|
| | |
| | | if (record.getSecondSuperVIP() != null)
|
| | | superVIPToday += record.getSecondSuperVIP();
|
| | | }
|
| | | |
| | | |
| | | // 获取当月第一天和最后一天 |
| | |
|
| | | // 获取当月第一天和最后一天
|
| | | Calendar cale = Calendar.getInstance();
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String firstday, lastday; |
| | | // 获取前月的第一天 |
| | | cale = Calendar.getInstance(); |
| | | cale.add(Calendar.MONTH, 0); |
| | | cale.set(Calendar.DAY_OF_MONTH, 1); |
| | | firstday = format.format(cale.getTime()); |
| | | // 获取前月的最后一天 |
| | | cale = Calendar.getInstance(); |
| | | cale.add(Calendar.MONTH, 1); |
| | | cale.set(Calendar.DAY_OF_MONTH, 0); |
| | | lastday = format.format(cale.getTime()); |
| | | |
| | | int darenMonth = 0;
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
| | | String firstday, lastday;
|
| | | // 获取前月的第一天
|
| | | cale = Calendar.getInstance();
|
| | | cale.add(Calendar.MONTH, 0);
|
| | | cale.set(Calendar.DAY_OF_MONTH, 1);
|
| | | firstday = format.format(cale.getTime());
|
| | | // 获取前月的最后一天
|
| | | cale = Calendar.getInstance();
|
| | | cale.add(Calendar.MONTH, 1);
|
| | | cale.set(Calendar.DAY_OF_MONTH, 0);
|
| | | lastday = format.format(cale.getTime());
|
| | |
|
| | | int darenMonth = 0;
|
| | | int highVIPMonth = 0;
|
| | | int superVIPMonth = 0;
|
| | | Date date = new Date();
|
| | | Date minTime = TimeUtil.parseYYYYMMDD(firstday);
|
| | | Date maxTime = TimeUtil.parseYYYYMMDD_HHMMSS(lastday + " 23:59:59");
|
| | | List<TeamDailyRecord> listMonth = teamDailyRecordService.sumGroupByYearMonth(uid, minTime, maxTime);
|
| | | if (listMonth != null && listMonth.size() > 0) {
|
| | | TeamDailyRecord teamRecord = listMonth.get(0);
|
| | | if (teamRecord.getFirstDaRen() != null) |
| | | if (teamRecord.getFirstDaRen() != null)
|
| | | darenMonth += teamRecord.getFirstDaRen();
|
| | | if (teamRecord.getSecondDaRen() != null)
|
| | | darenMonth += teamRecord.getSecondDaRen(); |
| | | darenMonth += teamRecord.getSecondDaRen();
|
| | | if (teamRecord.getFirstHighVIP() != null)
|
| | | highVIPMonth += teamRecord.getFirstHighVIP();
|
| | | if (teamRecord.getSecondHighVIP() != null)
|
| | |
| | | // 高级会会员
|
| | | highVIP.put("today", highVIPToday);
|
| | | highVIP.put("month", highVIPMonth);
|
| | | // 统计超级会员数量
|
| | | // 统计超级会员数量
|
| | | superVIP.put("today", superVIPToday);
|
| | | superVIP.put("month", superVIPMonth);
|
| | | |
| | |
|
| | | json.put("daren", daren);
|
| | | json.put("highVIP", highVIP);
|
| | | json.put("superVIP", superVIP);
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 上级
|
| | | UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId());
|
| | | |
| | | |
| | | // 非直接邀请关系
|
| | | String bossNickName = null;
|
| | | if (uid.longValue() != threeSale.getBoss().getId().longValue()) {
|
| | | UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId());
|
| | | if (boss != null) {
|
| | | bossNickName = boss.getNickName();
|
| | | }
|
| | | }
|
| | |
|
| | | JSONArray tagArray = new JSONArray();
|
| | | String memoName = user.getNickName();
|
| | | Long succeedTime = threeSale.getSucceedTime();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | data.put("bossNickName", boss.getNickName());
|
| | | data.put("bossNickName", bossNickName);
|
| | | data.put("nickName", user.getNickName());
|
| | | data.put("phone", phone);
|
| | | data.put("phoneCopy", phoneCopy);
|
| | |
| | | weixin = userInfoExtra.getWeiXin();
|
| | | activeTime = userInfoExtra.getActiveTime();
|
| | | }
|
| | | |
| | |
|
| | | if (activeTime == null) {
|
| | | activeTime = new Date(user.getCreatetime());
|
| | | }
|
| | | |
| | |
|
| | | data.put("weixin", StringUtil.isNullOrEmpty(weixin) ? "" : weixin);
|
| | | data.put("loginTime", TimeUtil.formatDate(activeTime));
|
| | |
|
| | |
| | | data.put("taobao", false);
|
| | | }
|
| | |
|
| | | String levelName = null;
|
| | | UserVIPPreInfo userVIPPreInfo = userVIPPreInfoService.getLatestProcessInfo(workerId);
|
| | | if (userVIPPreInfo != null) {
|
| | | String levelName = null;
|
| | | Integer process = userVIPPreInfo.getProcess();
|
| | | if (process == UserVIPPreInfo.PROCESS_1) {
|
| | | levelName = "快省达人";
|
| | | } else if (process == UserVIPPreInfo.PROCESS_2) {
|
| | | if (process == UserVIPPreInfo.PROCESS_2) {
|
| | | levelName = "高级会员";
|
| | | } else if (process == UserVIPPreInfo.PROCESS_3) {
|
| | | levelName = "超级会员";
|
| | |
| | | }
|
| | |
|
| | | Integer sourceType = userVIPPreInfo.getSourceType();
|
| | | if (sourceType != null) {
|
| | | if (sourceType != null && levelName != null) {
|
| | | if (sourceType == UserVIPPreInfo.SOURCE_TYPE_ORDER) {
|
| | | levelName += "(自购分享型)";
|
| | | } else {
|
| | | levelName += "(邀请团队型)";
|
| | | data.put("level", levelName += "(自购分享型)");
|
| | | } else if (sourceType == UserVIPPreInfo.SOURCE_TYPE_TEAM) {
|
| | | data.put("level", levelName += "(邀请团队型)");
|
| | | }
|
| | | }
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(levelName)) {
|
| | | levelName = "快省达人";
|
| | | }
|
| | | data.put("level", levelName);
|
| | |
|
| | | // 粉丝统计
|
| | | long indirectNum = 0;
|
| | |
| | | if (directNum > 0) {
|
| | | indirectNum = threeSaleSerivce.countSecondTeam(workerId);
|
| | | }
|
| | | data.put("fansNum", "直接粉丝: " + directNum + "人\n" + "间接粉丝: " + indirectNum + "人");
|
| | | |
| | | // 订单统计
|
| | | long countTB = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_TAOBAO, 60);
|
| | | long countJD = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_JD, 60);
|
| | | long countPDD = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_PDD, 60);
|
| | |
|
| | | data.put("fansNum", "直接粉丝: "+directNum+"人\n" + "间接粉丝: "+indirectNum+"人");
|
| | | data.put("orderInfo", "淘宝 ("+countTB+"笔)\n" + "京东 ("+countJD+"笔)\n" + "拼多多 ("+countPDD+"笔)");
|
| | | |
| | | StringBuilder builder = new StringBuilder();
|
| | | builder.append("淘宝 (" + countTB + "笔)");
|
| | | builder.append("\n京东 (" + countJD + "笔)");
|
| | | builder.append("\n拼多多 (" + countPDD + "笔)");
|
| | | if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | long countVip = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_VIP, 60);
|
| | | long countSL = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_SUNING, 60);
|
| | | builder.append("\n唯品会 (" + countVip + "笔)");
|
| | | builder.append("\n苏宁 (" + countSL + "笔)");
|
| | | }
|
| | | data.put("orderInfo", builder.toString());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取粉丝信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param workerId
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "fansSearch")
|
| | | public void fansSearch(String callback, AcceptData acceptData, Long uid, String key, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请输入筛选信息"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<TeamFansInfo> listfocus = teamFansInfoService.queryByUserInfo(key);
|
| | | if (listfocus == null || listfocus.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "暂无相关信息"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Long fansId = null;
|
| | | for (TeamFansInfo teamFansInfo : listfocus) {
|
| | | Long workerId = teamFansInfo.getWorkerId();
|
| | | ThreeSaleDetail threeDetail = threeSaleDetailService.getByBossUidAndWorkerUid(uid, workerId);
|
| | | if (threeDetail != null) {
|
| | | fansId = workerId;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (fansId == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "暂无相关信息"));
|
| | | return;
|
| | | }
|
| | |
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerId(fansId);
|
| | | if (threeSale == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "暂无相关信息"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo user = userInfoService.selectByPKey(fansId);
|
| | | if (user == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "暂无相关信息"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | JSONObject inviteBoss = getInviteBoss(threeSale.getBoss().getId());
|
| | | data.put("boss", inviteBoss);
|
| | |
|
| | | String phone = user.getPhone();
|
| | | boolean phoneCopy = true;
|
| | | if (StringUtil.isNullOrEmpty(phone)) {
|
| | | phone = "";
|
| | | } else {
|
| | | if (!userCustomSettingsService.validateDisplayPhoneByUid(fansId)) {
|
| | | phoneCopy = false;
|
| | | phone = phone.substring(0, 7) + "****";
|
| | | }
|
| | | }
|
| | |
|
| | | data.put("fansId", fansId);
|
| | | data.put("nickName", user.getNickName());
|
| | | data.put("portrait", user.getPortrait());
|
| | | data.put("phone", phone);
|
| | | data.put("phoneCopy", phoneCopy);
|
| | | data.put("joinTime", TimeUtil.formatDate(threeSale.getSucceedTime() == null ? threeSale.getCreateTime() : threeSale.getSucceedTime()));
|
| | |
|
| | | Date activeTime = null;
|
| | | String weixin = null;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(fansId);
|
| | | if (userInfoExtra != null) {
|
| | | weixin = userInfoExtra.getWeiXin();
|
| | | activeTime = userInfoExtra.getActiveTime();
|
| | | }
|
| | |
|
| | | if (activeTime == null) {
|
| | | activeTime = new Date(user.getCreatetime());
|
| | | }
|
| | | |
| | | String inviteCode = "";
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
|
| | | inviteCode = userInfoExtra.getInviteCode();
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip()))
|
| | | inviteCode = userInfoExtra.getInviteCodeVip();
|
| | | |
| | | data.put("inviteCode", inviteCode);
|
| | | data.put("weixin", StringUtil.isNullOrEmpty(weixin) ? "" : weixin);
|
| | | data.put("loginTime", TimeUtil.formatDate(activeTime));
|
| | |
|
| | | UserExtraTaoBaoInfo userExtraTaoBaoInfo = userExtraTaoBaoInfoService.getByUid(fansId);
|
| | | if (userExtraTaoBaoInfo != null && !StringUtil.isNullOrEmpty(userExtraTaoBaoInfo.getRelationId())
|
| | | && !StringUtil.isNullOrEmpty(userExtraTaoBaoInfo.getSpecialId())) {
|
| | | data.put("taobao", true);
|
| | | } else {
|
| | | data.put("taobao", false);
|
| | | }
|
| | |
|
| | | // 当前等级
|
| | | UserLevelEnum level = null;
|
| | | UserVIPLevel vipLevel = userInviteService.getVIPLevelByUid(fansId);
|
| | | if (vipLevel != null && vipLevel.getLevel() != null) {
|
| | | level = UserLevelUtil.getByLevel(vipLevel.getLevel());
|
| | | }
|
| | | if (level == null) {
|
| | | level = UserLevelEnum.daRen;
|
| | | }
|
| | | data.put("level", UserLevelUtil.getShowLevel(level));
|
| | |
|
| | | // 粉丝统计
|
| | | long indirectNum = 0;
|
| | | long directNum = threeSaleSerivce.countFirstTeam(fansId);
|
| | | if (directNum > 0) {
|
| | | indirectNum = threeSaleSerivce.countSecondTeam(fansId);
|
| | | }
|
| | | data.put("fansNum", "直接粉丝: " + directNum + "人\n" + "间接粉丝: " + indirectNum + "人");
|
| | |
|
| | | // 订单统计
|
| | | long countTB = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_TAOBAO, 60);
|
| | | long countJD = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_JD, 60);
|
| | | long countPDD = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_PDD, 60);
|
| | |
|
| | | StringBuilder builder = new StringBuilder();
|
| | | builder.append("淘宝 (" + countTB + "笔)");
|
| | | builder.append("\n京东 (" + countJD + "笔)");
|
| | | builder.append("\n拼多多 (" + countPDD + "笔)");
|
| | | if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | long countVip = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_VIP, 60);
|
| | | long countSL = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_SUNING, 60);
|
| | | builder.append("\n唯品会 (" + countVip + "笔)");
|
| | | builder.append("\n苏宁 (" + countSL + "笔)");
|
| | | }
|
| | | data.put("orderInfo", builder.toString());
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | private JSONObject getInviteBoss(Long bossId) {
|
| | | UserInfo userInfo = userInfoService.selectByPKey(bossId);
|
| | | boolean phoneCopy = true;
|
| | | String phone = userInfo.getPhone();
|
| | | if (StringUtil.isNullOrEmpty(phone)) {
|
| | | phone = "";
|
| | | } else {
|
| | | if (!userCustomSettingsService.validateDisplayPhoneByUid(bossId)) {
|
| | | phoneCopy = false;
|
| | | phone = phone.substring(0, 7) + "****";
|
| | | }
|
| | | }
|
| | |
|
| | | // 微信号
|
| | | String weixin = "";
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(bossId);
|
| | | if (extra != null) {
|
| | | weixin = StringUtil.isNullOrEmpty(extra.getWeiXin()) ? "" : extra.getWeiXin();
|
| | | }
|
| | |
|
| | | // 当前等级
|
| | | UserLevelEnum level = null;
|
| | | UserVIPLevel vipLevel = userInviteService.getVIPLevelByUid(bossId);
|
| | | if (vipLevel != null && vipLevel.getLevel() != null) {
|
| | | level = UserLevelUtil.getByLevel(vipLevel.getLevel());
|
| | | }
|
| | | if (level == null) {
|
| | | level = UserLevelEnum.daRen;
|
| | | }
|
| | | level = UserLevelUtil.getShowLevel(level);
|
| | |
|
| | | JSONObject bossObject = new JSONObject();
|
| | | bossObject.put("nickName", userInfo.getNickName());
|
| | | bossObject.put("portrait", userInfo.getPortrait());
|
| | | bossObject.put("phone", phone);
|
| | | bossObject.put("phoneCopy", phoneCopy);
|
| | | bossObject.put("weixin", weixin);
|
| | | bossObject.put("level", level.name());
|
| | | return bossObject;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存粉丝信息
|
| | | *
|
| | | * @param acceptData
|
| | | * @param uid
|
| | |
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 用户队员统计-h5
|
| | | * 队员数量统计
|
| | | *
|
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "countTeamH5")
|
| | | public void countTeamH5(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | @RequestMapping(value = "countTeamNum")
|
| | | public void countTeamNum(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | try {
|
| | | Date now = new Date();
|
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM");
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | // 今日
|
| | | String todayStr = sdf.format(now);
|
| | | // 昨日
|
| | | Date reduceDay = DateUtil.reduceDay(1, now);
|
| | | // 本月
|
| | | String monthStr = sdf1.format(now);
|
| | | |
| | | TeamDailyRecord todayRecord = new TeamDailyRecord(0,0,0);
|
| | | TeamDailyRecord yesterdayRecord = new TeamDailyRecord(0,0,0);
|
| | | TeamDailyRecord monthRecord = new TeamDailyRecord(0,0,0);
|
| | | TeamDailyRecord totalityRecord = new TeamDailyRecord(0,0,0);
|
| | | |
| | | List<TeamDailyRecord> list = teamDailyRecordService.getByUid(uid);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (TeamDailyRecord record: list) {
|
| | | Date statisticDay = record.getCountDay();
|
| | | if (todayStr.equals(sdf.format(statisticDay))) {
|
| | | todayRecord = record;
|
| | | }
|
| | | |
| | | if (sdf.format(reduceDay).equals(sdf.format(statisticDay))) {
|
| | | yesterdayRecord = record;
|
| | | }
|
| | | |
| | | if (monthStr.equals(sdf1.format(statisticDay))) {
|
| | | monthRecord.setFirstNum(monthRecord.getFirstNum() + record.getFirstNum());
|
| | | monthRecord.setSecondNum(monthRecord.getSecondNum() + record.getSecondNum());
|
| | | monthRecord.setBeyondNum(monthRecord.getBeyondNum() + record.getBeyondNum());
|
| | | }
|
| | | |
| | | totalityRecord.setFirstNum(totalityRecord.getFirstNum() + record.getFirstNum());
|
| | | totalityRecord.setSecondNum(totalityRecord.getSecondNum() + record.getSecondNum());
|
| | | totalityRecord.setBeyondNum(totalityRecord.getBeyondNum() + record.getBeyondNum());
|
| | | }
|
| | | } |
| | | |
| | | |
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | |
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | |
|
| | | // 今日预估
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | minDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | TeamDailyRecord todayRecord = createVO(
|
| | | teamDailyRecordService.sumTeamNumGroupByCountDay(uid, minDate, null));
|
| | |
|
| | | // 昨日预估
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | maxDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | minDate = DateUtil.reduceDay(1, maxDate);
|
| | | TeamDailyRecord yesterdayRecord = createVO(
|
| | | teamDailyRecordService.sumTeamNumGroupByCountDay(uid, minDate, maxDate));
|
| | |
|
| | | // 本月预估
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | TeamDailyRecord monthRecord = createVO(
|
| | | teamDailyRecordService.sumTeamNumGroupByYearMonth(uid, minDate, maxDate));
|
| | |
|
| | | // 累计
|
| | | TeamDailyRecord totalityRecord = createVO(teamDailyRecordService.sumTeamNumGroupByUid(uid, null, null));
|
| | |
|
| | | JSONObject today = new JSONObject();
|
| | | today.put("direct", todayRecord.getFirstNum());
|
| | | today.put("indirect", todayRecord.getSecondNum());
|
| | | today.put("beyond", todayRecord.getBeyondNum());
|
| | | |
| | |
|
| | | JSONObject yesterday = new JSONObject();
|
| | | yesterday.put("direct", yesterdayRecord.getFirstNum());
|
| | | yesterday.put("indirect", yesterdayRecord.getSecondNum());
|
| | | yesterday.put("beyond", yesterdayRecord.getBeyondNum());
|
| | | |
| | |
|
| | | JSONObject month = new JSONObject();
|
| | | month.put("direct", monthRecord.getFirstNum());
|
| | | month.put("indirect", monthRecord.getSecondNum());
|
| | | month.put("beyond", monthRecord.getBeyondNum());
|
| | | |
| | |
|
| | | JSONObject totality = new JSONObject();
|
| | | totality.put("direct", totalityRecord.getFirstNum());
|
| | | totality.put("indirect", totalityRecord.getSecondNum());
|
| | | totality.put("beyond", totalityRecord.getBeyondNum());
|
| | | |
| | | |
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("today", today);
|
| | | json.put("yesterday", yesterday);
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private TeamDailyRecord createVO(List<TeamDailyRecord> list) {
|
| | | TeamDailyRecord totalityRecord = new TeamDailyRecord(0, 0, 0);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (TeamDailyRecord record : list) {
|
| | | totalityRecord.setFirstNum(totalityRecord.getFirstNum() + record.getFirstNum());
|
| | | totalityRecord.setSecondNum(totalityRecord.getSecondNum() + record.getSecondNum());
|
| | | totalityRecord.setBeyondNum(totalityRecord.getBeyondNum() + record.getBeyondNum());
|
| | | }
|
| | | }
|
| | | return totalityRecord;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请排行榜
|
| | | * |
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param dateType
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRanking")
|
| | | public void getRanking(String callback, AcceptData acceptData, Long uid, Integer dateType, PrintWriter out) {
|
| | | if (uid == null || dateType == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数缺失"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | |
|
| | | if (dateType == 1) {
|
| | | // 今日
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | minDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | } else if (dateType == 2) {
|
| | | // 昨日
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | maxDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | minDate = DateUtil.reduceDay(1, maxDate);
|
| | | } else {
|
| | | // 本月
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | }
|
| | |
|
| | | List<OrderRankingVO> list = teamDailyRecordService.getRankingByFirstNum(uid, minDate, maxDate);
|
| | | if (list.size() > 0) {
|
| | | for (OrderRankingVO vo : list) {
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(vo.getUid());
|
| | | vo.setNickName(user.getNickName());
|
| | | vo.setPortrait(user.getPortrait());
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("list", list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(json));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|