| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
|
| | | 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.ThreeSaleExtraInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleFocusInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | 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.TeamDailyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamLevelDailyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.invite.TeamDailyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | 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.ThreeSaleExtraInfoSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleFocusInfoService;
|
| | | 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.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamDailyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamLevelDailyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TearcherService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | |
| | | 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;
|
| | |
| | | private CommonOrderCountService commonOrderCountService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleFocusInfoService threeSaleFocusInfoService;
|
| | | private TeamFansInfoService teamFansInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserCustomSettingsService userCustomSettingsService;
|
| | |
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | @Resource
|
| | | private TeamLevelDailyRecordService teamLevelDailyRecordService;
|
| | | |
| | | @Resource
|
| | | private TeamDailyRecordService teamDailyRecordService;
|
| | |
|
| | |
| | | object.put("level", level.name());
|
| | | object.put("validFans", validFans);
|
| | |
|
| | | if (wxtip && type == 1 && threeSale.getState() != null && threeSale.getState()) {
|
| | | if (wxtip) {
|
| | | // 一级队员 查询昵称备注
|
| | | String memoName = null;
|
| | | ThreeSaleExtraInfo threeSaleExtraInfo = threeSale.getThreeSaleExtraInfo();
|
| | |
| | | }
|
| | | object.put("memoName", memoName);
|
| | |
|
| | | if (!VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (type == 1 && !VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | // 添加微信信息
|
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
|
| | | object.put("weiXin", userInfoExtra.getWeiXin());
|
| | |
| | | countSecond = threeSaleSerivce.countSecondTeam(uid);
|
| | | } else { // 筛选条件
|
| | | List<Long> listId = null;
|
| | | List<ThreeSaleFocusInfo> listfocus = threeSaleFocusInfoService.query((page - 1) * Constant.PAGE_SIZE,
|
| | | List<TeamFansInfo> listfocus = teamFansInfoService.query((page - 1) * Constant.PAGE_SIZE,
|
| | | Constant.PAGE_SIZE, type, uid, focus);
|
| | | if (listfocus != null && listfocus.size() > 0) {
|
| | | listId = new ArrayList<Long>();
|
| | | for (ThreeSaleFocusInfo focusInfo : listfocus) {
|
| | | for (TeamFansInfo focusInfo : listfocus) {
|
| | | listId.add(focusInfo.getWorkerId());
|
| | | }
|
| | | }
|
| | |
| | | listTeam = threeSaleSerivce.listSecondTeam(0, Constant.PAGE_SIZE, uid, listId);
|
| | | }
|
| | | }
|
| | | firstTeam = threeSaleFocusInfoService.count(1, uid, focus);
|
| | | countSecond = threeSaleFocusInfoService.count(2, uid, focus);
|
| | | firstTeam = teamFansInfoService.count(1, uid, focus);
|
| | | countSecond = teamFansInfoService.count(2, uid, focus);
|
| | | }
|
| | | JSONArray array = organizeTeamNew(acceptData, listTeam, uid, type, true);
|
| | |
|
| | |
| | | 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));
|
| | | }
|
| | |
|
| | |
| | | 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 || !StringUtil.isNullOrEmpty(focus.getKey()))
|
| | | || focus.getMinIncome() != null || focus.getMaxIncome() != null |
| | | || focus.getMinJoinTime() != null || focus.getMaxJoinTime() != null |
| | | || !StringUtil.isNullOrEmpty(focus.getKey()) || !StringUtil.isNullOrEmpty(focus.getLevel()))
|
| | | return true;
|
| | |
|
| | | return false;
|
| | |
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "countMyTeamV2", method = RequestMethod.POST)
|
| | | public void countMyTeamV2(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | @RequestMapping(value = "countMyTeamV2")
|
| | | public void countMyTeamV2(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | try {
|
| | | JSONObject bossObject = new JSONObject();
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
|
| | |
| | | tearcherObject.put("phone", tearcherInfo.getPhone());
|
| | | tearcherObject.put("weixin", tearcherInfo.getWxID());
|
| | | tearcherObject.put("level", UserLevelEnum.tearcher);
|
| | |
|
| | | json.put("tearcher", tearcherInfo);
|
| | | json.put("tearcher", tearcherObject);
|
| | | }
|
| | |
|
| | | JSONObject daren = new JSONObject();
|
| | |
| | | highVIP.put("total", statistic.getHighFirstCount() + statistic.getHighSecondCount());
|
| | | superVIP.put("total", statistic.getSuperFirstCount() + statistic.getSuperSecondCount());
|
| | | }
|
| | | // 统计达人
|
| | | long darenToday = threeSaleSerivce.countFirstTeamByDate(uid, 1) + threeSaleSerivce.countSecondTeamByDate(uid, 1);
|
| | | long darenMonth = threeSaleSerivce.countFirstTeamByDate(uid, 2) + threeSaleSerivce.countSecondTeamByDate(uid, 2);
|
| | | |
| | |
|
| | | int darenToday = 0;
|
| | | int highVIPToday = 0;
|
| | | int superVIPToday = 0;
|
| | | String createId = teamDailyRecordService.createId(uid, new Date());
|
| | | TeamDailyRecord record = teamDailyRecordService.getById(createId);
|
| | | if (record != null) {
|
| | | if (record.getFirstDaRen() != null) |
| | | darenToday += record.getFirstDaRen();
|
| | | if (record.getSecondDaRen() != null)
|
| | | darenToday += record.getSecondDaRen(); |
| | | if (record.getFirstHighVIP() != null)
|
| | | highVIPToday += record.getFirstHighVIP();
|
| | | if (record.getSecondHighVIP() != null)
|
| | | highVIPToday += record.getSecondHighVIP();
|
| | | if (record.getFirstSuperVIP() != null)
|
| | | superVIPToday += record.getFirstSuperVIP();
|
| | | 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;
|
| | | 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) |
| | | darenMonth += teamRecord.getFirstDaRen();
|
| | | if (teamRecord.getSecondDaRen() != null)
|
| | | darenMonth += teamRecord.getSecondDaRen(); |
| | | if (teamRecord.getFirstHighVIP() != null)
|
| | | highVIPMonth += teamRecord.getFirstHighVIP();
|
| | | if (teamRecord.getSecondHighVIP() != null)
|
| | | highVIPMonth += teamRecord.getSecondHighVIP();
|
| | | if (teamRecord.getFirstSuperVIP() != null)
|
| | | superVIPMonth += teamRecord.getFirstSuperVIP();
|
| | | if (teamRecord.getSecondSuperVIP() != null)
|
| | | superVIPMonth += teamRecord.getSecondSuperVIP();
|
| | | }
|
| | | // 达人
|
| | | daren.put("today", darenToday);
|
| | | daren.put("month", darenMonth);
|
| | |
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
|
| | | String today = sd.format(new Date());
|
| | | // 当月1号
|
| | | Calendar calendar1 = Calendar.getInstance();
|
| | | calendar1.set(Calendar.DAY_OF_MONTH, 1);
|
| | | Date minTime = sd.parse(sd.format(calendar1.getTime()));
|
| | |
|
| | | int highVIPToday = 0;
|
| | | int highVIPMonth = 0;
|
| | | List<TeamLevelDailyRecord> list = teamLevelDailyRecordService.getbyUidAndType(uid, UserLevelEnum.highVIP, minTime);
|
| | | if (list == null || list.size() > 0) {
|
| | | for (TeamLevelDailyRecord record: list) {
|
| | | if (today.equals(sd.format(record.getUpdateTime()))) {
|
| | | highVIPToday = record.getFirstCount() + record.getSecondCount();
|
| | | }
|
| | | highVIPMonth = highVIPMonth + record.getFirstCount() + record.getSecondCount();
|
| | | }
|
| | | }
|
| | | // 高级会会员
|
| | | highVIP.put("today", highVIPToday);
|
| | | highVIP.put("month", highVIPMonth);
|
| | | |
| | | |
| | | int superVIPToday = 0;
|
| | | int superVIPMonth = 0;
|
| | | List<TeamLevelDailyRecord> listSuper = teamLevelDailyRecordService.getbyUidAndType(uid, UserLevelEnum.superVIP, minTime);
|
| | | if (listSuper == null || listSuper.size() > 0) {
|
| | | for (TeamLevelDailyRecord record: listSuper) {
|
| | | if (today.equals(sd.format(record.getUpdateTime()))) {
|
| | | superVIPToday = record.getFirstCount() + record.getSecondCount();
|
| | | }
|
| | | superVIPMonth = superVIPMonth + record.getFirstCount() + record.getSecondCount();
|
| | | }
|
| | | }
|
| | | // 统计超级会员数量
|
| | | superVIP.put("today", superVIPToday);
|
| | | superVIP.put("month", superVIPMonth);
|
| | |
|
| | | json.put("daren", daren);
|
| | | json.put("highVIP", highVIP);
|
| | | json.put("superVIP", superVIP);
|
| | | out.print(JsonUtil.loadTrueResult(json));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(json));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("统计失败"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 非直接邀请关系
|
| | | 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", 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 == null ? userInfoExtra.getCreateTime() : activeTime));
|
| | | data.put("loginTime", TimeUtil.formatDate(activeTime));
|
| | |
|
| | | UserExtraTaoBaoInfo userExtraTaoBaoInfo = userExtraTaoBaoInfoService.getByUid(workerId);
|
| | | if (userExtraTaoBaoInfo != null && !StringUtil.isNullOrEmpty(userExtraTaoBaoInfo.getRelationId())
|
| | |
| | | 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;
|
| | | long directNum = threeSaleSerivce.countFirstTeam(workerId);
|
| | | if (directNum > 0) {
|
| | | indirectNum = threeSaleSerivce.countSecondTeam(workerId);
|
| | | }
|
| | | data.put("directNum", directNum);
|
| | | data.put("indirectNum", 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("orderTB", countTB);
|
| | | data.put("orderJD", countJD);
|
| | | data.put("orderPDD", countPDD);
|
| | | |
| | | data.put("fansNum", "直接粉丝: "+directNum+"人\n" + "间接粉丝: "+indirectNum+"人");
|
| | | data.put("orderInfo", "淘宝 ("+countTB+"笔)\n" + "京东 ("+countJD+"笔)\n" + "拼多多 ("+countPDD+"笔)");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | |
|
| | | int type = 1;
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerId(workerId);
|
| | | if (threeSale == null) {
|
| | | if (threeSale != null && threeSale.getBoss().getId() != uid) {
|
| | | type = 2;
|
| | | }
|
| | |
|
| | |
| | | threeSaleExtraInfoSerivce.insertSelective(saleExtraInfo);
|
| | | }
|
| | |
|
| | | threeSaleFocusInfoService.updateTags(workerId, type, tags);
|
| | | // 更新粉丝记录信息
|
| | | teamFansInfoService.updateTags(workerId, type, tags);
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 用户队员统计-h5
|
| | | * 队员数量统计
|
| | | *
|
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "countTeamH5", method = RequestMethod.POST)
|
| | | public void countTeamH5(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);
|
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | |
|
| | | 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);
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | |
|
| | | List<TeamDailyRecord> list = teamDailyRecordService.getbyUid(uid);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (TeamDailyRecord record: list) {
|
| | | Date statisticDay = record.getStatisticDay();
|
| | | if (todayStr.equals(sdf.format(statisticDay))) {
|
| | | todayRecord = record;
|
| | | }
|
| | | |
| | | if (reduceDay.equals(sdf.format(statisticDay))) {
|
| | | yesterdayRecord = record;
|
| | | }
|
| | | |
| | | if (monthStr.equals(sdf1.format(statisticDay))) {
|
| | | monthRecord.setFirstCount(monthRecord.getFirstCount() + record.getFirstCount());
|
| | | monthRecord.setSecondCount(monthRecord.getSecondCount() + record.getSecondCount());
|
| | | monthRecord.setSecondBeyond(monthRecord.getSecondBeyond() + record.getSecondBeyond());
|
| | | }
|
| | | |
| | | totalityRecord.setFirstCount(totalityRecord.getFirstCount() + record.getFirstCount());
|
| | | totalityRecord.setSecondCount(totalityRecord.getSecondCount() + record.getSecondCount());
|
| | | totalityRecord.setSecondBeyond(totalityRecord.getSecondBeyond() + record.getSecondBeyond());
|
| | | }
|
| | | } |
| | | // 今日预估
|
| | | 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.getFirstCount());
|
| | | today.put("indirect", todayRecord.getSecondCount());
|
| | | today.put("beyond", todayRecord.getSecondBeyond());
|
| | | today.put("direct", todayRecord.getFirstNum());
|
| | | today.put("indirect", todayRecord.getSecondNum());
|
| | | today.put("beyond", todayRecord.getBeyondNum());
|
| | |
|
| | | JSONObject yesterday = new JSONObject();
|
| | | yesterday.put("direct", yesterdayRecord.getFirstCount());
|
| | | yesterday.put("indirect", yesterdayRecord.getSecondCount());
|
| | | yesterday.put("beyond", yesterdayRecord.getSecondBeyond());
|
| | | yesterday.put("direct", yesterdayRecord.getFirstNum());
|
| | | yesterday.put("indirect", yesterdayRecord.getSecondNum());
|
| | | yesterday.put("beyond", yesterdayRecord.getBeyondNum());
|
| | |
|
| | | JSONObject month = new JSONObject();
|
| | | month.put("direct", monthRecord.getFirstCount());
|
| | | month.put("indirect", monthRecord.getSecondCount());
|
| | | month.put("beyond", monthRecord.getSecondBeyond());
|
| | | month.put("direct", monthRecord.getFirstNum());
|
| | | month.put("indirect", monthRecord.getSecondNum());
|
| | | month.put("beyond", monthRecord.getBeyondNum());
|
| | |
|
| | | JSONObject totality = new JSONObject();
|
| | | totality.put("direct", totalityRecord.getFirstCount());
|
| | | totality.put("indirect", totalityRecord.getSecondCount());
|
| | | totality.put("beyond", totalityRecord.getSecondBeyond());
|
| | | totality.put("direct", totalityRecord.getFirstNum());
|
| | | totality.put("indirect", totalityRecord.getSecondNum());
|
| | | totality.put("beyond", totalityRecord.getBeyondNum());
|
| | |
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | |
| | | json.put("yesterday", yesterday);
|
| | | json.put("month", month);
|
| | | json.put("totality", totality);
|
| | | out.print(JsonUtil.loadTrueResult(json));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(json));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("统计失败"));
|
| | | 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();
|
| | | }
|
| | | }
|
| | | |
| | | }
|