5个文件已删除
4 文件已重命名
18个文件已修改
1个文件已添加
| | |
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | @RequestMapping(value = "getMsgList", method = RequestMethod.POST)
|
| | | public void getMsgList(AcceptData acceptData, Long uid, int page, String type, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | |
| | | params.put("orderNo", detail.getOrderId());
|
| | | if (detail.getType() == MsgTypeOrderTypeEnum.invite || detail.getType() == MsgTypeOrderTypeEnum.orderInvite)
|
| | | params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId()));
|
| | | list.add(UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"),
|
| | | params));
|
| | | |
| | | UserMsgVO msgVO = UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"), params);
|
| | | msgVO.setType(MSG_TYPE_ORDER);
|
| | | list.add(msgVO);
|
| | | }
|
| | | break;
|
| | | case MSG_TYPE_MONEY:
|
| | |
| | | List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
|
| | | count = msgMoneyDetailService.countMsgMoneyDetail(uid);
|
| | | if (detailList1 != null)
|
| | | for (MsgMoneyDetail detail : detailList1)
|
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | for (MsgMoneyDetail detail : detailList1) {
|
| | | UserMsgVO msgVO = UserMsgVOFactory.create(detail);
|
| | | msgVO.setType(MSG_TYPE_MONEY);
|
| | | list.add(msgVO);
|
| | | }
|
| | | break;
|
| | | case MSG_TYPE_ACCOUNT:
|
| | | userMsgReadStateService.readAccountMsg(uid);
|
| | | List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
|
| | | count = msgAccountDetailService.countMsgAccountDetail(uid);
|
| | | if (detailList2 != null)
|
| | | for (MsgAccountDetail detail : detailList2)
|
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | for (MsgAccountDetail detail : detailList2) {
|
| | | UserMsgVO msgVO = UserMsgVOFactory.create(detail);
|
| | | msgVO.setType(MSG_TYPE_ACCOUNT);
|
| | | list.add(msgVO);
|
| | | }
|
| | | break;
|
| | | case MSG_TYPE_INVITE:
|
| | | userMsgReadStateService.readInviteMsg(uid);
|
| | |
| | | if (detailList3 != null)
|
| | | for (MsgInviteDetail detail : detailList3) {
|
| | | UserMsgVO vo = UserMsgVOFactory.create(detail);
|
| | | if (vo != null)
|
| | | if (vo != null) {
|
| | | vo.setType(MSG_TYPE_INVITE);
|
| | | list.add(vo);
|
| | | else
|
| | | } else {
|
| | | count--;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case MSG_TYPE_OTHER:
|
| | |
| | | if (detailList4 != null)
|
| | | for (MsgOtherDetail detail : detailList4) {
|
| | | UserMsgVO vo = UserMsgVOFactory.create(detail);
|
| | | if (vo != null)
|
| | | if (vo != null) {
|
| | | vo.setType(MSG_TYPE_OTHER);
|
| | | list.add(vo);
|
| | | else
|
| | | } else {
|
| | | count--;
|
| | | }
|
| | | }
|
| | | break;
|
| | | }
|
| | |
| | | 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.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.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.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;
|
| | |
| | | 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;
|
| | |
|
| | |
| | | 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);
|
| | |
|
| | |
| | |
|
| | | 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();
|
| | | }
|
| | | }
|
| | | // TODO 统计高级会员数量
|
| | | 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);
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 上级
|
| | | UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId());
|
| | | |
| | | |
| | | JSONArray tagArray = new JSONArray();
|
| | | String memoName = user.getNickName();
|
| | | Long succeedTime = threeSale.getSucceedTime();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | data.put("bossNickName", boss.getNickName());
|
| | | data.put("nickName", user.getNickName());
|
| | | data.put("phone", phone);
|
| | | data.put("phoneCopy", phoneCopy);
|
| | |
| | | threeSaleExtraInfoSerivce.insertSelective(saleExtraInfo);
|
| | | }
|
| | |
|
| | | threeSaleFocusInfoService.updateTags(workerId, type, tags);
|
| | | teamFansInfoService.updateTags(workerId, type, tags);
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | }
|
| | |
|
| | |
| | | List<TeamDailyRecord> list = teamDailyRecordService.getbyUid(uid);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (TeamDailyRecord record: list) {
|
| | | Date statisticDay = record.getStatisticDay();
|
| | | Date statisticDay = record.getCountDay();
|
| | | if (todayStr.equals(sdf.format(statisticDay))) {
|
| | | todayRecord = record;
|
| | | }
|
| | |
|
| | | if (reduceDay.equals(sdf.format(statisticDay))) {
|
| | | if (sdf.format(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());
|
| | | monthRecord.setFirstNum(monthRecord.getFirstNum() + record.getFirstNum());
|
| | | monthRecord.setSecondNum(monthRecord.getSecondNum() + record.getSecondNum());
|
| | | monthRecord.setBeyondNum(monthRecord.getBeyondNum() + record.getBeyondNum());
|
| | | }
|
| | |
|
| | | totalityRecord.setFirstCount(totalityRecord.getFirstCount() + record.getFirstCount());
|
| | | totalityRecord.setSecondCount(totalityRecord.getSecondCount() + record.getSecondCount());
|
| | | totalityRecord.setSecondBeyond(totalityRecord.getSecondBeyond() + record.getSecondBeyond());
|
| | | totalityRecord.setFirstNum(totalityRecord.getFirstNum() + record.getFirstNum());
|
| | | totalityRecord.setSecondNum(totalityRecord.getSecondNum() + record.getSecondNum());
|
| | | totalityRecord.setBeyondNum(totalityRecord.getBeyondNum() + record.getBeyondNum());
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | 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();
|
| | |
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.math.RoundingMode;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | |
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.GsonBuilder;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount;
|
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount.SourceTypeEnum;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.vo.money.IncomeDetailVO;
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private OrderMoneyDailyCountService orderMoneyDailyCountService;
|
| | | |
| | |
|
| | | |
| | | /**
|
| | | * 用户资金统计
|
| | | *
|
| | |
| | | return;
|
| | | }
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | | |
| | |
|
| | | MoneyStatisticVO vo = new MoneyStatisticVO();
|
| | | vo.setLink(configService.get(ConfigKeyEnum.autoExtractHelpUrl.getKey()));
|
| | | vo.setBalanceMoney(user.getMyHongBao());
|
| | | vo.setExtractDesc("提现金额就是已成功转账到提现支付宝的资金。");
|
| | | vo.setMoneyArrivalDesc("资金已到账后提现时间不受限制、金额受限制。");
|
| | | |
| | |
|
| | | // 获取提现中的信息
|
| | | BigDecimal extractingMoney = extractService.sumVerifyingMoney(uid);
|
| | | if (extractingMoney.compareTo(new BigDecimal(0)) > 0)
|
| | | vo.setExtractingMoneyInfo("提现中:¥" + extractingMoney.setScale(2, RoundingMode.HALF_UP));
|
| | | |
| | |
|
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | List<UserMoneyDetailTypeEnum> typeList = new ArrayList<>();
|
| | | |
| | |
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | | |
| | | |
| | |
|
| | | typeList.clear();
|
| | | typeList.add(UserMoneyDetailTypeEnum.extract);
|
| | | typeList.add(UserMoneyDetailTypeEnum.extractNew);
|
| | |
| | | typeList.add(UserMoneyDetailTypeEnum.extractVerifyNew);
|
| | | typeList.add(UserMoneyDetailTypeEnum.extractReject);
|
| | | typeList.add(UserMoneyDetailTypeEnum.extractAutoWX);
|
| | | |
| | |
|
| | | // 本月提现
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | vo.setMonthExtractMoney(userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate, 1).abs());
|
| | | vo.setMonthExtractMoney(
|
| | | userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate, 1).abs());
|
| | |
|
| | | |
| | | // 上月提现
|
| | | maxDate = new Date(TimeUtil.convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | maxDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | vo.setLastMonthExtractMoney(userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate, 1).abs());
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | vo.setLastMonthExtractMoney(
|
| | | userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate, 1).abs());
|
| | |
|
| | | minDate = new Date(0L);
|
| | | maxDate = new Date(timeStamp);
|
| | | // 累计成功提现
|
| | | vo.setTotalExtractMoney(
|
| | | userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate, 1).abs());
|
| | | |
| | |
|
| | | // 累计自购返利
|
| | | typeList.clear();
|
| | | typeList.add(UserMoneyDetailTypeEnum.fanli);
|
| | |
| | | typeList.add(UserMoneyDetailTypeEnum.share);
|
| | | typeList.add(UserMoneyDetailTypeEnum.shareNew);
|
| | | typeList.add(UserMoneyDetailTypeEnum.shareWeiQuan);
|
| | | vo.setTotalShareMoney(userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate).abs());
|
| | | vo.setTotalShareMoney(
|
| | | userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate).abs());
|
| | |
|
| | | // 累计邀请赚
|
| | | typeList.clear();
|
| | |
| | | typeList.add(UserMoneyDetailTypeEnum.inviteAndShare);
|
| | | typeList.add(UserMoneyDetailTypeEnum.subsidy);
|
| | | typeList.add(UserMoneyDetailTypeEnum.teamReward);
|
| | | vo.setTotalInviteMoney(userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate).abs());
|
| | | vo.setTotalInviteMoney(
|
| | | userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate).abs());
|
| | |
|
| | | |
| | | // 本月收货
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | vo.setMonthSettleMoney(hongBaoV2CountService.sumMoneyBySettleTimeAndUid(uid, minDate, maxDate));
|
| | | |
| | |
|
| | | // 上月收货
|
| | | maxDate = new Date(TimeUtil.convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | maxDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | vo.setLastMonthSettleMoney(hongBaoV2CountService.sumMoneyBySettleTimeAndUid(uid, minDate, maxDate));
|
| | | |
| | |
|
| | | // 待确认收货(180天内)
|
| | | vo.setNotSettleMoney(hongBaoV2CountService.sumMoneyByANotSettleAndUid(uid));
|
| | | |
| | | |
| | |
|
| | | // 今日预估
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | minDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | vo.setTodayPredict(cratePredictVO(orderMoneyDailyCountService.query(uid, minDate, null)));
|
| | | |
| | |
|
| | | // 本月预估
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | vo.setMonthPredict(cratePredictVO(orderMoneyDailyCountService.query(uid, minDate, maxDate)));
|
| | | |
| | | |
| | |
|
| | | GsonBuilder builder = new GsonBuilder();
|
| | | builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
| | | @Override
|
| | |
| | | out.print(JsonUtil.loadTrueResult(builder.create().toJson(vo)));
|
| | | }
|
| | |
|
| | | |
| | | private MoneyPredictVO cratePredictVO(List<OrderMoneyDailyCount> list) {
|
| | | MoneyPredictVO predictVO = new MoneyPredictVO();
|
| | | predictVO.setMineNum(0);
|
| | | predictVO.setTeamNum(0);
|
| | | predictVO.setMineMoney(BigDecimal.valueOf(0));
|
| | | predictVO.setTeamMoney(BigDecimal.valueOf(0));
|
| | | |
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | for (OrderMoneyDailyCount dailyCount: list) {
|
| | | for (OrderMoneyDailyCount dailyCount : list) {
|
| | | if (dailyCount.getOrderNum() != null) {
|
| | | predictVO.setMineNum(predictVO.getMineNum() + dailyCount.getOrderNum());
|
| | | }
|
| | | |
| | |
|
| | | if (dailyCount.getOrderNumTeam() != null) {
|
| | | predictVO.setTeamNum(predictVO.getTeamNum() + dailyCount.getOrderNumTeam());
|
| | | }
|
| | | |
| | |
|
| | | if (dailyCount.getIncome() != null) {
|
| | | predictVO.setMineMoney(predictVO.getMineMoney().add(dailyCount.getIncome()));
|
| | | }
|
| | | |
| | |
|
| | | if (dailyCount.getIncomeTeam() != null) {
|
| | | predictVO.setTeamMoney(predictVO.getTeamMoney().add(dailyCount.getIncomeTeam()));
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | predictVO.setTotalNum(predictVO.getTeamNum() + predictVO.getMineNum());
|
| | | predictVO.setTotalMoney(predictVO.getMineMoney().add(predictVO.getTeamMoney()));
|
| | | return predictVO;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 历史详情
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param datetype 1-天 - 2月
|
| | | * @param out
|
| | | */
|
| | |
|
| | | /**
|
| | | * 历史详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param datetype 1-天 - 2月
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHistoryDetail")
|
| | | public void getHistoryDetail(AcceptData acceptData, Long uid, Integer datetype, PrintWriter out) {
|
| | | public void getHistoryDetail(AcceptData acceptData, Long uid, String date, Integer datetype, PrintWriter out) {
|
| | | if (uid == null || uid == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (datetype == null) {
|
| | | datetype = 1;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(date) || datetype == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "参数不完整"));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | MoneyPredictVO predictVO = new MoneyPredictVO();
|
| | | predictVO.setMineNum(0);
|
| | | predictVO.setTeamNum(0);
|
| | | predictVO.setMineMoney(BigDecimal.valueOf(0));
|
| | | predictVO.setTeamMoney(BigDecimal.valueOf(0));
|
| | | predictVO.setTotalNum(predictVO.getTeamNum() + predictVO.getMineNum());
|
| | | predictVO.setTotalMoney(predictVO.getMineMoney().add(predictVO.getTeamMoney()));
|
| | | predictVO.setCountDate("2020年05月09日");
|
| | | |
| | | MoneyPredictVO predictVO2 = new MoneyPredictVO();
|
| | | predictVO2.setMineNum(0);
|
| | | predictVO2.setTeamNum(0);
|
| | | predictVO2.setMineMoney(BigDecimal.valueOf(0));
|
| | | predictVO2.setTeamMoney(BigDecimal.valueOf(0));
|
| | | predictVO2.setTotalNum(predictVO.getTeamNum() + predictVO.getMineNum());
|
| | | predictVO2.setTotalMoney(predictVO.getMineMoney().add(predictVO.getTeamMoney()));
|
| | | predictVO2.setCountDate("2020年05月08日");
|
| | | |
| | | List<MoneyPredictVO> list = new ArrayList<>();
|
| | | list.add(predictVO);
|
| | | list.add(predictVO2);
|
| | | |
| | | GsonBuilder builder = new GsonBuilder();
|
| | | builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
| | | @Override
|
| | | public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | // 保留2位小数
|
| | | value = value.setScale(2);
|
| | | return new JsonPrimitive(value.toString());
|
| | |
|
| | | try {
|
| | | Date minDay = new Date();
|
| | | Date maxDay = new Date();
|
| | | BigDecimal zero = new BigDecimal(0);
|
| | | List<OrderMoneyDailyCount> listDailyCount = null;
|
| | | List<MoneyPredictVO> list = new ArrayList<>();
|
| | | SimpleDateFormat formatMonth = new SimpleDateFormat("yyyy年MM月");
|
| | | SimpleDateFormat formatDay = new SimpleDateFormat("yyyy年MM月dd日");
|
| | | if (datetype == 1) {
|
| | | // 后退7个月
|
| | | int countNum = 7;
|
| | | Date day = TimeUtil.parseYYYYMMDD(date);
|
| | | for (int i = 0; i < countNum; i++) {
|
| | | MoneyPredictVO predictVO = new MoneyPredictVO(zero, 0, zero, 0);
|
| | | if (i == 0) {
|
| | | predictVO.setCountDate(formatDay.format(day));
|
| | | } else {
|
| | | predictVO.setCountDate(formatDay.format(DateUtil.reduceDay(i, day)));
|
| | | }
|
| | | list.add(predictVO);
|
| | |
|
| | | if (i == countNum - 1) {
|
| | | minDay = DateUtil.reduceDay(i, day);
|
| | | }
|
| | | }
|
| | | maxDay = TimeUtil.parseYYYYMMDD_HHMMSS(date + " 23:59:59");
|
| | | listDailyCount = orderMoneyDailyCountService.sumGroupByCountDay(uid, minDay, maxDay);
|
| | | } else if (datetype == 2) {
|
| | | // 后退3个月
|
| | | int countNum = 3;
|
| | | Date day = TimeUtil.parseYYYYMMDD(DateUtil.getFirstDayOfMonth(date));
|
| | | for (int i = 0; i < countNum; i++) {
|
| | | MoneyPredictVO predictVO = new MoneyPredictVO(zero, 0, zero, 0);
|
| | | if (i == 0) {
|
| | | predictVO.setCountDate(formatMonth.format(day));
|
| | | } else {
|
| | | predictVO.setCountDate(formatMonth.format(DateUtil.reduceMonth(day, i)));
|
| | | }
|
| | | list.add(predictVO);
|
| | |
|
| | | if (i == countNum - 1) {
|
| | | minDay = DateUtil.reduceMonth(day, i);
|
| | | }
|
| | | }
|
| | | maxDay = TimeUtil.parseYYYYMMDD_HHMMSS(DateUtil.getLastDayOfMonth(date) + " 23:59:59");
|
| | | listDailyCount = orderMoneyDailyCountService.sumGroupByYearMonth(uid, minDay, maxDay);
|
| | | }
|
| | | });
|
| | | |
| | | JSONObject object = new JSONObject();
|
| | | object.put("count", list.size());
|
| | | object.put("list", builder.create().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(object));
|
| | |
|
| | | for (MoneyPredictVO predictVO : list) {
|
| | | String countDate = predictVO.getCountDate();
|
| | |
|
| | | if (listDailyCount != null && listDailyCount.size() > 0) {
|
| | | for (OrderMoneyDailyCount dailyCount : listDailyCount) {
|
| | | Date countDay = dailyCount.getCountDay();
|
| | | if (datetype == 1 && countDay != null && countDate.equals(formatDay.format(countDay))) {
|
| | | predictVO.setMineNum(dailyCount.getOrderNum());
|
| | | predictVO.setMineMoney(dailyCount.getIncome());
|
| | | predictVO.setTeamNum(dailyCount.getOrderNumTeam());
|
| | | predictVO.setTeamMoney(dailyCount.getIncomeTeam());
|
| | | break;
|
| | | }
|
| | |
|
| | | String yearMonth = dailyCount.getYearMonth();
|
| | | if (datetype == 2 && !StringUtil.isNullOrEmpty(yearMonth)
|
| | | && countDate.equals(formatMonth.format(TimeUtil.parseYYYYMMDD(DateUtil.getFirstDayOfMonth(yearMonth))))) {
|
| | | predictVO.setMineNum(dailyCount.getOrderNum());
|
| | | predictVO.setMineMoney(dailyCount.getIncome());
|
| | | predictVO.setTeamNum(dailyCount.getOrderNumTeam());
|
| | | predictVO.setTeamMoney(dailyCount.getIncomeTeam());
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | predictVO.setTotalNum(predictVO.getTeamNum() + predictVO.getMineNum());
|
| | | predictVO.setTotalMoney(predictVO.getMineMoney().add(predictVO.getTeamMoney()));
|
| | | }
|
| | |
|
| | | GsonBuilder builder = new GsonBuilder();
|
| | | builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
| | | @Override
|
| | | public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("0.00");
|
| | | } else {
|
| | | // 保留2位小数
|
| | | value = value.setScale(2);
|
| | | return new JsonPrimitive(value.toString());
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("count", list.size());
|
| | | object.put("list", builder.create().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(object));
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 收益详情
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param datetype
|
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | /**
|
| | | * 收益详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param datetype
|
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getIncomeDetail")
|
| | | public void getIncomeDetail(AcceptData acceptData, Long uid, Integer datetype, int type, PrintWriter out) {
|
| | | public void getIncomeDetail(AcceptData acceptData, Long uid, String date, Integer datetype, Integer type,
|
| | | PrintWriter out) {
|
| | | if (uid == null || uid == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | IncomeDetailVO detailVO = new IncomeDetailVO();
|
| | | detailVO.setIcon("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=%E5%9B%BE%E6%A0%87&hs=2&pn=4&spn=0&di=140910&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=1127089551%2C1776911506&os=1048215048%2C2112739689&simid=3430760525%2C458613076&adpicid=0&lpn=0&ln=30&fr=ala&fm=&sme=&cg=&bdtype=0&oriquery=%E5%9B%BE%E6%A0%87&objurl=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F16%2F08%2F20%2F2357b8781a8b798.jpg!%2Ffwfh%2F804x804%2Fquality%2F90%2Funsharp%2Ftrue%2Fcompress%2Ftrue&fromurl=ippr_z2C%24qAzdH3FAzdH3Flafij3t_z%26e3Bv54AzdH3Ff7vwtAzdH3F8clm90md_z%26e3Bip4s&gsm=5&islist=&querylist=");
|
| | | detailVO.setNum(0);
|
| | | detailVO.setMoney(BigDecimal.valueOf(0));
|
| | | |
| | | IncomeDetailVO detailVO2 = new IncomeDetailVO();
|
| | | detailVO2.setIcon("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=%E5%9B%BE%E6%A0%87&hs=2&pn=5&spn=0&di=63690&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2705540191%2C3386342097&os=1154083183%2C368350028&simid=3434290922%2C367349849&adpicid=0&lpn=0&ln=30&fr=ala&fm=&sme=&cg=&bdtype=0&oriquery=%E5%9B%BE%E6%A0%87&objurl=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Ffe2a5be541f3c011972f74d3b50b96578116a92c2f63-tK5HwY_fw658&fromurl=ippr_z2C%24qAzdH3FAzdH3Fi7wkwg_z%26e3Bv54AzdH3FrtgfAzdH3F8ca0l0acmdAzdH3F&gsm=5&islist=&querylist=");
|
| | | detailVO2.setNum(0);
|
| | | detailVO2.setMoney(BigDecimal.valueOf(0));
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(date) || datetype == null || type == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "参数不完整"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Date minDay = new Date();
|
| | | Date maxDay = new Date();
|
| | | if (datetype == 1) {
|
| | | minDay = TimeUtil.parseYYYYMMDD(date);
|
| | | maxDay = TimeUtil.parseYYYYMMDD_HHMMSS(date + " 23:59:59");
|
| | | } else if (datetype == 2) {
|
| | | String firstDay = DateUtil.getFirstDayOfMonth(date);
|
| | | String lastDay = DateUtil.getLastDayOfMonth(date);
|
| | | minDay = TimeUtil.parseYYYYMMDD(firstDay);
|
| | | maxDay = TimeUtil.parseYYYYMMDD_HHMMSS(lastDay + " 23:59:59");
|
| | | }
|
| | |
|
| | | List<OrderMoneyDailyCount> listDailyCount = null;
|
| | | if (type == 1) {
|
| | | listDailyCount = orderMoneyDailyCountService.sumGroupBySourceType(uid, minDay, maxDay);
|
| | | } else if (type == 1) {
|
| | | listDailyCount = orderMoneyDailyCountService.sumTeamGroupBySourceType(uid, minDay, maxDay);
|
| | | }
|
| | |
|
| | | BigDecimal zero = new BigDecimal(0);
|
| | | List<IncomeDetailVO> list = new ArrayList<>();
|
| | | list.add(detailVO);
|
| | | list.add(detailVO2);
|
| | | |
| | |
|
| | | SourceTypeEnum[] arrayEnun = SourceTypeEnum.values();
|
| | | for (int m = 0; m < arrayEnun.length; m++) {
|
| | | SourceTypeEnum typeEnum = arrayEnun[m];
|
| | | IncomeDetailVO detail = new IncomeDetailVO(typeEnum.getIcon(), 0, zero);
|
| | | if (listDailyCount != null && listDailyCount.size() > 0) {
|
| | | for (OrderMoneyDailyCount dailyCount : listDailyCount) {
|
| | | if (dailyCount.getSourceType() == typeEnum) {
|
| | | detail.setNum(detail.getNum() + dailyCount.getOrderNum());
|
| | | detail.setMoney(detail.getMoney().add(dailyCount.getIncome()));
|
| | | }
|
| | | }
|
| | | }
|
| | | list.add(detail);
|
| | | }
|
| | |
|
| | | GsonBuilder builder = new GsonBuilder();
|
| | | builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
| | | @Override
|
| | | public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | return new JsonPrimitive("0.00");
|
| | | } else {
|
| | | // 保留2位小数
|
| | | value = value.setScale(2);
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | |
| | |
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("count", list.size());
|
| | | object.put("list", builder.create().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(object));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @RequestMapping(value = "getExtractRecord")
|
| | | public void getExtractRecord(AcceptData acceptData, Integer page, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<Extract> list = extractService.getExtractSucceedRecord(page, Constant.PAGE_SIZE, uid);
|
| | | if (list == null) {
|
| | | list = new ArrayList<>();
|
| | | }
|
| | | |
| | |
|
| | | JSONArray JSONArray = new JSONArray();
|
| | | for (Extract extract: list) {
|
| | | for (Extract extract : list) {
|
| | | Date receiveTime = extract.getReceiveTime();
|
| | | if (receiveTime == null) {
|
| | | receiveTime = new Date(extract.getExtractTime());
|
| | | receiveTime = new Date(extract.getExtractTime());
|
| | | }
|
| | | String account = "支付宝:" + UserUtil.filterAlipayAccount(extract.getAccount());
|
| | | account = account + "-姓名:"+ UserUtil.filterAlipayName(extract.getName());
|
| | | |
| | | String account = "支付宝:" + UserUtil.filterAlipayAccount(extract.getAccount());
|
| | | account = account + "-姓名:" + UserUtil.filterAlipayName(extract.getName());
|
| | |
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("title", "你于"+ TimeUtil.formatDate(receiveTime) +"提现成功");
|
| | | object.put("title", "你于" + TimeUtil.formatDate(receiveTime) + "提现成功");
|
| | | object.put("account", account);
|
| | | object.put("money","¥" + extract.getMoney().setScale(2).toString());
|
| | | object.put("money", "¥" + extract.getMoney().setScale(2).toString());
|
| | | JSONArray.add(object);
|
| | | }
|
| | | |
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("count", extractService.countExtractSucceedRecord(uid));
|
| | | json.put("list", JSONArray);
|
| | | out.print(JsonUtil.loadTrueResult(json));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.dao.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Locale;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.mongodb.DBObject;
|
| | | import com.mongodb.GroupCommand;
|
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount;
|
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount.SourceTypeEnum;
|
| | |
|
| | | @Repository
|
| | | public class OrderMoneyDailyCountDao {
|
| | |
|
| | | private static String collectionName = "order_money_daily_count";
|
| | |
|
| | | @Resource
|
| | | private MongoTemplate mongoTemplate;
|
| | |
| | | return mongoTemplate.find(query, OrderMoneyDailyCount.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计我的金额订单数量-- 来源分组统计
|
| | | * |
| | | * @param uid
|
| | | * @param minDate
|
| | | * @param maxDate
|
| | | * @return
|
| | | */
|
| | | public List<OrderMoneyDailyCount> sumGroupBySourceType(Long uid, Date minDate, Date maxDate) {
|
| | | String collectionName = "order_money_daily_count";
|
| | | List<OrderMoneyDailyCount> listDailyCount = new ArrayList<>();
|
| | |
|
| | | // 统计方法
|
| | | String reduce = "function(doc, aggr){"
|
| | | + " aggr.totalIncome += parseFloat((Math.round((doc.income)*100)/100).toFixed(2));"
|
| | | + " aggr.totalNum += doc.orderNum;" + "}";
|
| | |
|
| | | // 查询条件
|
| | | List<Criteria> list = new ArrayList<Criteria>();
|
| | | list.add(Criteria.where("uid").is(uid));
|
| | | if (minDate != null)
|
| | | list.add(Criteria.where("countDay").gte(minDate));
|
| | | if (maxDate != null)
|
| | | list.add(Criteria.where("countDay").lte(maxDate));
|
| | |
|
| | | Query query = new Query();
|
| | | if (list.size() > 0) {
|
| | | Criteria[] cas = new Criteria[list.size()];
|
| | | for (int i = 0; i < list.size(); i++)
|
| | | cas[i] = list.get(i);
|
| | | query.addCriteria(new Criteria().andOperator(cas));
|
| | | }
|
| | |
|
| | | BasicDBObject agg = new BasicDBObject("sourceType", "");
|
| | |
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | map.put("totalIncome", 0);
|
| | | map.put("totalNum", 0);
|
| | | BasicDBObject dbObject = new BasicDBObject(map);
|
| | | // BasicDBObject basicDBObject2 = new BasicDBObject("total", 0);
|
| | |
|
| | | DBObject result = mongoTemplate.getCollection(collectionName).group(agg, query.getQueryObject(), dbObject,
|
| | | reduce);
|
| | | Map<String, BasicDBObject> mapResult = result.toMap();
|
| | | if (mapResult.size() > 0) {
|
| | | SourceTypeEnum[] arrayEnun = SourceTypeEnum.values();
|
| | |
|
| | | for (int i = 0; i < mapResult.size(); i++) {
|
| | | BasicDBObject object = mapResult.get(i + "");
|
| | | SourceTypeEnum sourceTypeEnum = null;
|
| | | for (int m = 0; m < arrayEnun.length; m++) {
|
| | | if (arrayEnun[m].name().equals(object.get("sourceType").toString())) {
|
| | | sourceTypeEnum = arrayEnun[m];
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | OrderMoneyDailyCount dailyCount = new OrderMoneyDailyCount();
|
| | | dailyCount.setSourceType(sourceTypeEnum);
|
| | | dailyCount.setIncome(new BigDecimal(object.get("totalIncome").toString()));
|
| | | dailyCount.setOrderNum(new BigDecimal(object.get("totalNum").toString()).intValue());
|
| | | listDailyCount.add(dailyCount);
|
| | | }
|
| | | }
|
| | | return listDailyCount;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计团队金额订单数量-- 来源分组统计
|
| | | * |
| | | * @param uid
|
| | | * @param minDate
|
| | | * @param maxDate
|
| | | * @return
|
| | | */
|
| | | public List<OrderMoneyDailyCount> sumTeamGroupBySourceType(Long uid, Date minDate, Date maxDate) {
|
| | | String collectionName = "order_money_daily_count";
|
| | | List<OrderMoneyDailyCount> listDailyCount = new ArrayList<>();
|
| | |
|
| | | // 统计方法
|
| | | String reduce = "function(doc, aggr){"
|
| | | + " aggr.totalIncome += parseFloat((Math.round((doc.incomeTeam)*100)/100).toFixed(2));"
|
| | | + " aggr.totalNum += doc.orderNumTeam;" + "}";
|
| | |
|
| | | // 查询条件
|
| | | List<Criteria> list = new ArrayList<Criteria>();
|
| | | list.add(Criteria.where("uid").is(uid));
|
| | | if (minDate != null)
|
| | | list.add(Criteria.where("countDay").gte(minDate));
|
| | | if (maxDate != null)
|
| | | list.add(Criteria.where("countDay").lte(maxDate));
|
| | |
|
| | | Query query = new Query();
|
| | | if (list.size() > 0) {
|
| | | Criteria[] cas = new Criteria[list.size()];
|
| | | for (int i = 0; i < list.size(); i++)
|
| | | cas[i] = list.get(i);
|
| | | query.addCriteria(new Criteria().andOperator(cas));
|
| | | }
|
| | |
|
| | | BasicDBObject agg = new BasicDBObject("sourceType", "");
|
| | |
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | map.put("totalIncome", 0);
|
| | | map.put("totalNum", 0);
|
| | | BasicDBObject dbObject = new BasicDBObject(map);
|
| | | // BasicDBObject basicDBObject2 = new BasicDBObject("total", 0);
|
| | |
|
| | | DBObject result = mongoTemplate.getCollection(collectionName).group(agg, query.getQueryObject(), dbObject,
|
| | | reduce);
|
| | | Map<String, BasicDBObject> mapResult = result.toMap();
|
| | | if (mapResult.size() > 0) {
|
| | | SourceTypeEnum[] arrayEnun = SourceTypeEnum.values();
|
| | | for (int i = 0; i < mapResult.size(); i++) {
|
| | | BasicDBObject object = mapResult.get(i + "");
|
| | | OrderMoneyDailyCount dailyCount = new OrderMoneyDailyCount();
|
| | |
|
| | | SourceTypeEnum sourceTypeEnum = null;
|
| | | for (int m = 0; m < arrayEnun.length; m++) {
|
| | | if (arrayEnun[m].name().equals(object.get("sourceType").toString())) {
|
| | | sourceTypeEnum = arrayEnun[m];
|
| | | break;
|
| | | }
|
| | | }
|
| | | dailyCount.setSourceType(sourceTypeEnum);
|
| | | dailyCount.setIncome(new BigDecimal(object.get("totalIncome").toString()));
|
| | | dailyCount.setOrderNum(new BigDecimal(object.get("totalNum").toString()).intValue());
|
| | | listDailyCount.add(dailyCount);
|
| | | }
|
| | | }
|
| | | return listDailyCount;
|
| | | }
|
| | |
|
| | |
|
| | | // |
| | | // public List<PlaybackEntity> queryPlaybackRecord(FunctionUseQueryEntity queryEntity) {
|
| | | // Criteria criteria = Criteria.where("createTime").gte(queryEntity.getStartTime()).lte(queryEntity.getEndTime())
|
| | | // .and("status").is(1);
|
| | | // Query query = Query.query(criteria);
|
| | | //
|
| | | // BasicDBObject initial = new BasicDBObject();
|
| | | // initial.put("playbackNum", 0);
|
| | | //
|
| | | // String reduce = getReduce();
|
| | | // // 进行按天、周、月分组
|
| | | // String keyf = getKeyf(queryEntity);
|
| | | //
|
| | | // DBCollection collection = mongoTemplate.getCollection(COLLNAME);
|
| | | //
|
| | | // GroupCommand xx = new GroupCommand(collection, keyf, query.getQueryObject(), initial, reduce, null);
|
| | | //
|
| | | // BasicDBList objects = (BasicDBList) collection.group(xx);
|
| | | //
|
| | | // List<PlaybackEntity> results = new ArrayList<PlaybackEntity>();
|
| | | // if (objects != null) {
|
| | | // for (int i = 0; i < objects.size(); i++) {
|
| | | // PlaybackEntity play = new PlaybackEntity();
|
| | | // DBObject obj = (DBObject) objects.get(i);
|
| | | // play.setFormateTime((String) obj.get("strData"));
|
| | | // play.setPlaybackNum((Double) obj.get("playbackNum"));
|
| | | // results.add(play);
|
| | | // }
|
| | | // }
|
| | | // return results;
|
| | | // }
|
| | | //
|
| | | // private String getKeyf(FunctionUseQueryEntity queryEntity) {
|
| | | // StringBuilder keyfBuilder = new StringBuilder();
|
| | | // keyfBuilder.append("function(doc){ ").append(" var date = new Date(doc.createTime); ");
|
| | | // if (DateTypeEnum.DATE.getValue().equals(queryEntity.getType())) {
|
| | | // keyfBuilder.append(
|
| | | // " var dateKey = '' + date.getFullYear()+ '-' + (date.getMonth()+1) + '-' + date.getDate();");
|
| | | // } else if (DateTypeEnum.MONTH.getValue().equals(queryEntity.getType())) {
|
| | | // keyfBuilder.append(" var dateKey = '' + date.getFullYear()+ '-' + (date.getMonth()+1);");
|
| | | // }
|
| | | // keyfBuilder.append(" return {'strData':dateKey}; ").append(" }");
|
| | | // return keyfBuilder.toString();
|
| | | // }
|
| | | //
|
| | | // private String getReduce() {
|
| | | // StringBuilder reduceBuilder = new StringBuilder();
|
| | | // reduceBuilder.append("function Reduce(doc, out) { ").append(" out.playbackNum += 1; ").append(" }");
|
| | | // return reduceBuilder.toString();
|
| | | // }
|
| | |
|
| | | /**
|
| | | * 统计每天订单收入、数量
|
| | | * @param uid
|
| | | * @param minDate
|
| | | * @param maxDate
|
| | | * @return
|
| | | */
|
| | | public List<OrderMoneyDailyCount> sumGroupByCountDay(Long uid, Date minDate, Date maxDate) {
|
| | | // 查询条件
|
| | | List<Criteria> list = new ArrayList<Criteria>();
|
| | | list.add(Criteria.where("uid").is(uid));
|
| | | if (minDate != null)
|
| | | list.add(Criteria.where("countDay").gte(minDate));
|
| | | if (maxDate != null)
|
| | | list.add(Criteria.where("countDay").lte(maxDate));
|
| | |
|
| | | Query query = new Query();
|
| | | if (list.size() > 0) {
|
| | | Criteria[] cas = new Criteria[list.size()];
|
| | | for (int i = 0; i < list.size(); i++)
|
| | | cas[i] = list.get(i);
|
| | | query.addCriteria(new Criteria().andOperator(cas));
|
| | | }
|
| | |
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | map.put("totalIncome", 0);
|
| | | map.put("totalNum", 0);
|
| | | map.put("totalIncomeTeam", 0);
|
| | | map.put("totalNumTeam", 0);
|
| | | BasicDBObject initial = new BasicDBObject(map);
|
| | |
|
| | | // 进行按天、周、月分组
|
| | | BasicDBObject agg = new BasicDBObject("countDay", "");
|
| | | DBCollection collection = mongoTemplate.getCollection(collectionName);
|
| | | GroupCommand xx = new GroupCommand(collection, agg, query.getQueryObject(), initial, getReduce(), null);
|
| | | BasicDBList objects = (BasicDBList) collection.group(xx);
|
| | |
|
| | | List<OrderMoneyDailyCount> results = new ArrayList<>();
|
| | | if (objects != null) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US);
|
| | | for (int i = 0; i < objects.size(); i++) {
|
| | | BasicDBObject dbObject = (BasicDBObject) objects.get(i);
|
| | | if (dbObject == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | Object object = dbObject.get("countDay");
|
| | | if (object == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | try {
|
| | | String date = object.toString();
|
| | | Date dtime = sdf.parse(date);
|
| | | OrderMoneyDailyCount dailyCount = new OrderMoneyDailyCount();
|
| | | dailyCount.setCountDay(dtime);
|
| | | dailyCount.setIncome(new BigDecimal(dbObject.get("totalIncome").toString()));
|
| | | dailyCount.setOrderNum(new BigDecimal(dbObject.get("totalNum").toString()).intValue());
|
| | | dailyCount.setIncomeTeam(new BigDecimal(dbObject.get("totalIncomeTeam").toString()));
|
| | | dailyCount.setOrderNumTeam(new BigDecimal(dbObject.get("totalNumTeam").toString()).intValue());
|
| | | results.add(dailyCount);
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | continue;
|
| | | }
|
| | | }
|
| | | }
|
| | | return results;
|
| | | }
|
| | |
|
| | | |
| | | private String getReduce() {
|
| | | StringBuilder builder = new StringBuilder();
|
| | | builder.append("function(doc, aggr){ ");
|
| | | builder.append(" aggr.totalIncome += parseFloat((Math.round((doc.income)*100)/100).toFixed(2));");
|
| | | builder.append(" aggr.totalNum += doc.orderNum;");
|
| | | builder.append(" aggr.totalIncomeTeam += parseFloat((Math.round((doc.incomeTeam)*100)/100).toFixed(2));");
|
| | | builder.append(" aggr.totalNumTeam += doc.orderNumTeam;");
|
| | | builder.append(" }");
|
| | | return builder.toString();
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 统计每月订单收入、数量
|
| | | * @param uid
|
| | | * @param minDate
|
| | | * @param maxDate
|
| | | * @return
|
| | | */
|
| | | public List<OrderMoneyDailyCount> sumGroupByYearMonth(Long uid, Date minDate, Date maxDate) {
|
| | | // 查询条件
|
| | | List<Criteria> list = new ArrayList<Criteria>();
|
| | | list.add(Criteria.where("uid").is(uid));
|
| | | if (minDate != null)
|
| | | list.add(Criteria.where("countDay").gte(minDate));
|
| | | if (maxDate != null)
|
| | | list.add(Criteria.where("countDay").lte(maxDate));
|
| | |
|
| | | Query query = new Query();
|
| | | if (list.size() > 0) {
|
| | | Criteria[] cas = new Criteria[list.size()];
|
| | | for (int i = 0; i < list.size(); i++)
|
| | | cas[i] = list.get(i);
|
| | | query.addCriteria(new Criteria().andOperator(cas));
|
| | | }
|
| | |
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | map.put("totalIncome", 0);
|
| | | map.put("totalNum", 0);
|
| | | map.put("totalIncomeTeam", 0);
|
| | | map.put("totalNumTeam", 0);
|
| | | BasicDBObject initial = new BasicDBObject(map);
|
| | |
|
| | | // 进行按天、周、月分组
|
| | | BasicDBObject agg = new BasicDBObject("yearMonth", "");
|
| | | DBCollection collection = mongoTemplate.getCollection(collectionName);
|
| | | GroupCommand xx = new GroupCommand(collection, agg, query.getQueryObject(), initial, getReduce(), null);
|
| | | BasicDBList objects = (BasicDBList) collection.group(xx);
|
| | |
|
| | | List<OrderMoneyDailyCount> results = new ArrayList<>();
|
| | | if (objects != null) {
|
| | | for (int i = 0; i < objects.size(); i++) {
|
| | | BasicDBObject dbObject = (BasicDBObject) objects.get(i);
|
| | | if (dbObject == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | Object object = dbObject.get("yearMonth");
|
| | | if (object == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | OrderMoneyDailyCount dailyCount = new OrderMoneyDailyCount();
|
| | | dailyCount.setYearMonth(object.toString());
|
| | | dailyCount.setIncome(new BigDecimal(dbObject.get("totalIncome").toString()));
|
| | | dailyCount.setOrderNum(new BigDecimal(dbObject.get("totalNum").toString()).intValue());
|
| | | dailyCount.setIncomeTeam(new BigDecimal(dbObject.get("totalIncomeTeam").toString()));
|
| | | dailyCount.setOrderNumTeam(new BigDecimal(dbObject.get("totalNumTeam").toString()).intValue());
|
| | | results.add(dailyCount);
|
| | | }
|
| | | }
|
| | | return results;
|
| | | }
|
| | |
|
| | | }
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/dao/user/vip/TeamDailyRecordDao.java |
| | |
| | | package com.yeshi.fanli.dao.user.vip;
|
| | | package com.yeshi.fanli.dao.user.invite;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/dao/user/ThreeSaleFocusInfoDao.java |
| | |
| | | package com.yeshi.fanli.dao.user;
|
| | | package com.yeshi.fanli.dao.user.invite;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | |
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dto.user.ThreeSaleFocusDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleFocusInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.TeamFansInfo;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Repository
|
| | | public class ThreeSaleFocusInfoDao {
|
| | | public class TeamFansInfoDao {
|
| | |
|
| | | @Resource
|
| | | private MongoTemplate mongoTemplate;
|
| | |
| | | *
|
| | | * @param record
|
| | | */
|
| | | public void save(ThreeSaleFocusInfo record) {
|
| | | public void save(TeamFansInfo record) {
|
| | | if (record == null) {
|
| | | return;
|
| | | }
|
| | |
| | | } else {
|
| | | update = Update.update("memoNameSup", memoName);
|
| | | }
|
| | | mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateFirst(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | } else {
|
| | | update = Update.update("tagsSup", tags);
|
| | | }
|
| | | mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateFirst(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerId").is(workerId));
|
| | | Update update = Update.update("nickName", nickName);
|
| | | mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateFirst(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerId").is(workerId));
|
| | | Update update = Update.update("stateValid", stateValid);
|
| | | mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateFirst(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerId").is(workerId));
|
| | | Update update = Update.update("taobaoBind", taobaoBind);
|
| | | mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateFirst(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerId").is(workerId));
|
| | | Update update = Update.update("weixinBind", weixinBind);
|
| | | mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateFirst(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerId").is(workerId));
|
| | | Update update = Update.update("activeTime", activeTime);
|
| | | mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateFirst(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerId").is(workerId));
|
| | | Update update = Update.update("fansNum", fansNum);
|
| | | mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateFirst(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerId").is(workerId));
|
| | | Update update = Update.update("income", income).set("incomeTime", new Date());
|
| | | mongoTemplate.updateMulti(query, update, ThreeSaleFocusInfo.class);
|
| | | mongoTemplate.updateMulti(query, update, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public ThreeSaleFocusInfo getbyWorkerId(Long workerId) {
|
| | | public TeamFansInfo getbyWorkerId(Long workerId) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerId").is(workerId));
|
| | | return mongoTemplate.findOne(query, ThreeSaleFocusInfo.class);
|
| | | return mongoTemplate.findOne(query, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public List<ThreeSaleFocusInfo> query(int start, int count, int type, Long uid, ThreeSaleFocusDTO focusDTO) {
|
| | | public List<TeamFansInfo> query(int start, int count, int type, Long uid, ThreeSaleFocusDTO focusDTO) {
|
| | | Query query = createQuery(type, uid, focusDTO);
|
| | | query.skip(start).limit(count);
|
| | | query.with(new Sort(Sort.Direction.DESC, "weight"));
|
| | | return mongoTemplate.find(query, ThreeSaleFocusInfo.class);
|
| | | return mongoTemplate.find(query, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | public long count(int type, Long uid, ThreeSaleFocusDTO focusDTO) {
|
| | | Query query = createQuery(type, uid, focusDTO);
|
| | | return mongoTemplate.count(query, ThreeSaleFocusInfo.class);
|
| | | return mongoTemplate.count(query, TeamFansInfo.class);
|
| | | }
|
| | |
|
| | | private Query createQuery(int type, Long uid, ThreeSaleFocusDTO focusDTO) {
|
| | |
| | | list.add(Criteria.where("level").is(focusDTO.getLevel()));
|
| | |
|
| | | if (focusDTO.getMinFansNum() != null)
|
| | | list.add(Criteria.where("fansNum").lte(focusDTO.getMinFansNum()));
|
| | | list.add(Criteria.where("fansNum").gte(focusDTO.getMinFansNum()));
|
| | |
|
| | | if (focusDTO.getMaxFansNum() != null)
|
| | | list.add(Criteria.where("fansNum").gte(focusDTO.getMaxFansNum()));
|
| | | list.add(Criteria.where("fansNum").lte(focusDTO.getMaxFansNum()));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(focusDTO.getMinJoinTime()))
|
| | | list.add(Criteria.where("joinTime").lte(focusDTO.getMinJoinTime()));
|
| | | list.add(Criteria.where("joinTime").gte(focusDTO.getMinJoinTime()));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(focusDTO.getMaxJoinTime()))
|
| | | list.add(Criteria.where("joinTime").gte(focusDTO.getMaxJoinTime()));
|
| | | list.add(Criteria.where("joinTime").lte(focusDTO.getMaxJoinTime()));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(focusDTO.getMinActiveTime()))
|
| | | list.add(Criteria.where("activeTime").lte(focusDTO.getMinActiveTime()));
|
| | | list.add(Criteria.where("activeTime").gte(focusDTO.getMinActiveTime()));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(focusDTO.getMaxActiveTime()))
|
| | | list.add(Criteria.where("activeTime").gte(focusDTO.getMaxActiveTime()));
|
| | | list.add(Criteria.where("activeTime").lte(focusDTO.getMaxActiveTime()));
|
| | |
|
| | | if (focusDTO.getMinIncome() != null)
|
| | | list.add(Criteria.where("income").lte(focusDTO.getMinIncome()));
|
| | | list.add(Criteria.where("income").gte(focusDTO.getMinIncome()));
|
| | |
|
| | | if (focusDTO.getMaxIncome() != null)
|
| | | list.add(Criteria.where("income").gte(focusDTO.getMaxIncome()));
|
| | | list.add(Criteria.where("income").lte(focusDTO.getMaxIncome()));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(focusDTO.getKey())) {
|
| | | if (type == 1) {
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSaleFocusInfo.java |
| | |
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | |
|
| | | @Document(collection = "three_sale_focus_info")
|
| | | public class ThreeSaleFocusInfo {
|
| | | @Document(collection = "team_fans_info")
|
| | | public class TeamFansInfo {
|
| | |
|
| | | @Id
|
| | | @Field("id")
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Document(collection = "team_daily_record")
|
| | | @Document(collection = "team_daily_Record")
|
| | | public class TeamDailyRecord {
|
| | |
|
| | | @Id
|
| | |
| | | @Indexed
|
| | | private Long uid;
|
| | | @Field
|
| | | private Integer firstCount; // 一级
|
| | | private Date countDay; // 统计日期: 年-月-日
|
| | | @Field
|
| | | private Integer secondCount; // 二级
|
| | | private String yearMonth; // 统计日期: 年-月
|
| | | @Field
|
| | | private Integer secondBeyond; // 二级以外
|
| | | private Integer firstNum; // 一级
|
| | | @Field
|
| | | private Date statisticDay; // 统计日期: 年-月-日
|
| | | private Integer firstDaRen;
|
| | | @Field
|
| | | private Date updateTime;
|
| | | private Integer firstHighVIP;
|
| | | @Field
|
| | | private Integer firstSuperVIP;
|
| | | @Field
|
| | | private Integer secondNum; // 二级
|
| | | @Field
|
| | | private Integer secondDaRen;
|
| | | @Field
|
| | | private Integer secondHighVIP;
|
| | | @Field
|
| | | private Integer secondSuperVIP;
|
| | | @Field
|
| | | private Integer beyondNum; // 二级以外
|
| | | @Field
|
| | | private Integer beyondDaRen;
|
| | | @Field
|
| | | private Integer beyondHighVIP;
|
| | | @Field
|
| | | private Integer beyondSuperVIP;
|
| | |
|
| | | public TeamDailyRecord() {}
|
| | |
|
| | | public TeamDailyRecord(Integer firstCount, Integer secondCount, Integer secondBeyond) {
|
| | | this.firstCount = firstCount;
|
| | | this.secondCount = secondCount;
|
| | | this.secondBeyond = secondBeyond;
|
| | | public TeamDailyRecord(Integer firstNum, Integer secondNum, Integer beyondNum) {
|
| | | this.firstNum = firstNum;
|
| | | this.secondNum = secondNum;
|
| | | this.beyondNum = beyondNum;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | |
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Integer getFirstCount() {
|
| | | return firstCount;
|
| | | public Date getCountDay() {
|
| | | return countDay;
|
| | | }
|
| | |
|
| | | public void setFirstCount(Integer firstCount) {
|
| | | this.firstCount = firstCount;
|
| | | public void setCountDay(Date countDay) {
|
| | | this.countDay = countDay;
|
| | | }
|
| | |
|
| | | public Integer getSecondCount() {
|
| | | return secondCount;
|
| | | public String getYearMonth() {
|
| | | return yearMonth;
|
| | | }
|
| | |
|
| | | public void setSecondCount(Integer secondCount) {
|
| | | this.secondCount = secondCount;
|
| | | public void setYearMonth(String yearMonth) {
|
| | | this.yearMonth = yearMonth;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | public Integer getFirstNum() {
|
| | | return firstNum;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | public void setFirstNum(Integer firstNum) {
|
| | | this.firstNum = firstNum;
|
| | | }
|
| | |
|
| | | public Integer getSecondBeyond() {
|
| | | return secondBeyond;
|
| | | public Integer getFirstDaRen() {
|
| | | return firstDaRen;
|
| | | }
|
| | |
|
| | | public void setSecondBeyond(Integer secondBeyond) {
|
| | | this.secondBeyond = secondBeyond;
|
| | | public void setFirstDaRen(Integer firstDaRen) {
|
| | | this.firstDaRen = firstDaRen;
|
| | | }
|
| | |
|
| | | public Date getStatisticDay() {
|
| | | return statisticDay;
|
| | | public Integer getFirstHighVIP() {
|
| | | return firstHighVIP;
|
| | | }
|
| | |
|
| | | public void setStatisticDay(Date statisticDay) {
|
| | | this.statisticDay = statisticDay;
|
| | | public void setFirstHighVIP(Integer firstHighVIP) {
|
| | | this.firstHighVIP = firstHighVIP;
|
| | | }
|
| | |
|
| | | public Integer getFirstSuperVIP() {
|
| | | return firstSuperVIP;
|
| | | }
|
| | |
|
| | | public void setFirstSuperVIP(Integer firstSuperVIP) {
|
| | | this.firstSuperVIP = firstSuperVIP;
|
| | | }
|
| | |
|
| | | public Integer getSecondNum() {
|
| | | return secondNum;
|
| | | }
|
| | |
|
| | | public void setSecondNum(Integer secondNum) {
|
| | | this.secondNum = secondNum;
|
| | | }
|
| | |
|
| | | public Integer getSecondDaRen() {
|
| | | return secondDaRen;
|
| | | }
|
| | |
|
| | | public void setSecondDaRen(Integer secondDaRen) {
|
| | | this.secondDaRen = secondDaRen;
|
| | | }
|
| | |
|
| | | public Integer getSecondHighVIP() {
|
| | | return secondHighVIP;
|
| | | }
|
| | |
|
| | | public void setSecondHighVIP(Integer secondHighVIP) {
|
| | | this.secondHighVIP = secondHighVIP;
|
| | | }
|
| | |
|
| | | public Integer getSecondSuperVIP() {
|
| | | return secondSuperVIP;
|
| | | }
|
| | |
|
| | | public void setSecondSuperVIP(Integer secondSuperVIP) {
|
| | | this.secondSuperVIP = secondSuperVIP;
|
| | | }
|
| | |
|
| | | public Integer getBeyondNum() {
|
| | | return beyondNum;
|
| | | }
|
| | |
|
| | | public void setBeyondNum(Integer beyondNum) {
|
| | | this.beyondNum = beyondNum;
|
| | | }
|
| | |
|
| | | public Integer getBeyondDaRen() {
|
| | | return beyondDaRen;
|
| | | }
|
| | |
|
| | | public void setBeyondDaRen(Integer beyondDaRen) {
|
| | | this.beyondDaRen = beyondDaRen;
|
| | | }
|
| | |
|
| | | public Integer getBeyondHighVIP() {
|
| | | return beyondHighVIP;
|
| | | }
|
| | |
|
| | | public void setBeyondHighVIP(Integer beyondHighVIP) {
|
| | | this.beyondHighVIP = beyondHighVIP;
|
| | | }
|
| | |
|
| | | public Integer getBeyondSuperVIP() {
|
| | | return beyondSuperVIP;
|
| | | }
|
| | |
|
| | | public void setBeyondSuperVIP(Integer beyondSuperVIP) {
|
| | | this.beyondSuperVIP = beyondSuperVIP;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | @Document(collection = "order_money_daily_count")
|
| | | public class OrderMoneyDailyCount {
|
| | | |
| | | public enum SourceTypeEnum {
|
| | | taobao("淘宝", "http://img.flqapp.com/resource/icon/source_type_tb.png"),
|
| | | tmall("天猫", "http://img.flqapp.com/resource/icon/source_type_tm.png"),
|
| | | tmallGlobal("天猫国际", "http://img.flqapp.com/resource/icon/source_type_tb.png"),
|
| | | juHuaSuan("聚划算", "http://img.flqapp.com/resource/icon/source_type_tb.png"),
|
| | | elme("饿了么", "http://img.flqapp.com/resource/icon/source_type_elme.png"),
|
| | | jingDong("京东", "http://img.flqapp.com/resource/icon/source_type_jd.png"),
|
| | | pinDuoDuo("拼多多", "http://img.flqapp.com/resource/icon/source_type_pdd.png");
|
| | | |
| | | private final String desc;
|
| | | private final String icon;
|
| | | |
| | | private SourceTypeEnum(String desc, String icon) {
|
| | | this.desc = desc;
|
| | | this.icon = icon;
|
| | | }
|
| | |
|
| | | public String getDesc() {
|
| | | return desc;
|
| | | }
|
| | |
|
| | | public String getIcon() {
|
| | | return icon;
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Id
|
| | | @Field("id")
|
| | | private String id;
|
| | |
| | | private Long uid; // 上级id
|
| | |
|
| | | @Field("sourceType")
|
| | | private String sourceType; // 来源类型
|
| | | private SourceTypeEnum sourceType; // 来源类型
|
| | | |
| | | @Field("yearMonth")
|
| | | private String yearMonth; // 统计日期-字符串
|
| | |
|
| | | @Field("countDay")
|
| | | private Date countDay; // 统计日期
|
| | |
| | |
|
| | | @Field("updateTime")
|
| | | private Date updateTime; // 更新时间
|
| | | |
| | | |
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | |
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public String getSourceType() {
|
| | | public SourceTypeEnum getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(String sourceType) {
|
| | | public void setSourceType(SourceTypeEnum sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | public String getYearMonth() {
|
| | | return yearMonth;
|
| | | }
|
| | |
|
| | | public void setYearMonth(String yearMonth) {
|
| | | this.yearMonth = yearMonth;
|
| | | }
|
| | | }
|
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private ImgInfo uploadOriginalPicture(MultipartFile file) { |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | String contentType = file.getContentType(); |
| | | String type = contentType.substring(contentType.indexOf("/") + 1); |
| | | String filePath = FilePathEnum.goodsEvaluate.getPath() + UUID.randomUUID().toString().replace("-", "") + "."+ type; |
| | | |
| | | BufferedImage sourceImg = ImageIO.read(inputStream); |
| | | ImgInfo info = new ImgInfo(); |
| | | int width = sourceImg.getWidth(); |
| | | int height = sourceImg.getHeight(); |
| | | String picLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl(); |
| | | |
| | | info.setH(height); |
| | | info.setW(width); |
| | | info.setUrl(picLink); |
| | | return info; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | private String uploadPicture(File file, String contentType) throws Exception { |
| | | InputStream inputStream = new FileInputStream(file); |
| | |
| | | for (int i = 0; i < 9; i++) { |
| | | MultipartFile file = fileRequest.getFile("file" + i); |
| | | if (file != null) { |
| | | ImgInfo info = uploadVideoPicture(file); |
| | | ImgInfo info = uploadOriginalPicture(file); |
| | | ImgInfo imgInfo0 = new ImgInfo(); |
| | | imgInfo0.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | imgInfo0.setLarge(false); |
| | |
| | | package com.yeshi.fanli.service.impl.order; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @Override |
| | | @RequestSerializableByKeyService(key = "#record.uid") |
| | | public void saveDailyCount(OrderMoneyDailyCount record) { |
| | | if (record.getUid() == null || record.getCountDay() == null || StringUtil.isNullOrEmpty(record.getSourceType())) { |
| | | if (record.getUid() == null || record.getCountDay() == null || record.getSourceType() == null) { |
| | | return; // 参数不全 |
| | | } |
| | | String gernalTime = TimeUtil.getGernalTime(record.getCountDay().getTime()); |
| | | String id = StringUtil.Md5(record.getUid() + record.getSourceType() + gernalTime); |
| | | String id = StringUtil.Md5(record.getUid() + record.getSourceType().name() + gernalTime); |
| | | |
| | | // id |
| | | record.setId(id); |
| | | // 统计日期-年月日 |
| | | record.setCountDay(new Date(TimeUtil.convertDateToTemp(gernalTime))); |
| | | |
| | | SimpleDateFormat formatMonth = new SimpleDateFormat("yyyy-MM"); |
| | | record.setYearMonth(formatMonth.format(record.getCountDay()) ); |
| | | |
| | | OrderMoneyDailyCount dailyCount = orderMoneyDailyCountDao.getById(id); |
| | | if (dailyCount == null) { |
| | |
| | | return orderMoneyDailyCountDao.query(uid, minDay, maxDay); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderMoneyDailyCount> sumGroupBySourceType(Long uid, Date minDay, Date maxDay) { |
| | | return orderMoneyDailyCountDao.sumGroupBySourceType(uid, minDay, maxDay); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderMoneyDailyCount> sumTeamGroupBySourceType(Long uid, Date minDay, Date maxDay) { |
| | | return orderMoneyDailyCountDao.sumTeamGroupBySourceType(uid, minDay, maxDay); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderMoneyDailyCount> sumGroupByCountDay(Long uid, Date minDay, Date maxDay) { |
| | | return orderMoneyDailyCountDao.sumGroupByCountDay(uid, minDay, maxDay); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderMoneyDailyCount> sumGroupByYearMonth(Long uid, Date minDay, Date maxDay) { |
| | | return orderMoneyDailyCountDao.sumGroupByYearMonth(uid, minDay, maxDay); |
| | | } |
| | | } |
| | |
| | |
|
| | | userActivedRecordService.add(new UserActivedRecord(uid));
|
| | |
|
| | | // if (!Constant.IS_TEST) { // 发送激活成功消息
|
| | | if (!Constant.IS_TEST) { // 发送激活成功消息
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteCodeActive,
|
| | | new InviteCodeActiveMQMsg(uid, new Date()));
|
| | | producer.send(message);
|
| | | // }
|
| | | }
|
| | |
|
| | | return inviteCode;
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user.invite; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.user.invite.TeamFansInfoDao; |
| | | import com.yeshi.fanli.dto.user.ThreeSaleFocusDTO; |
| | | import com.yeshi.fanli.entity.bus.user.TeamFansInfo; |
| | | import com.yeshi.fanli.service.inter.user.invite.TeamFansInfoService; |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; |
| | | |
| | | @Service |
| | | public class TeamFansInfoServiceImpl implements TeamFansInfoService { |
| | | |
| | | @Resource |
| | | private TeamFansInfoDao teamFansInfoDao; |
| | | |
| | | @Resource |
| | | private ThreeSaleSerivce threeSaleSerivce; |
| | | |
| | | @Override |
| | | public void save(TeamFansInfo record) { |
| | | teamFansInfoDao.save(record); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateMemoName(Long workerId, int type, String memoName) { |
| | | teamFansInfoDao.updateMemoName(workerId, type, memoName); |
| | | } |
| | | |
| | | @Override |
| | | public void updateTags(Long workerId, int type, String tags) { |
| | | teamFansInfoDao.updateTags(workerId, type, tags); |
| | | } |
| | | |
| | | @Override |
| | | public void updateNickName(Long workerId, String nickName) { |
| | | teamFansInfoDao.updateNickName(workerId, nickName); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateStateValid(Long workerId, boolean stateValid) { |
| | | teamFansInfoDao.updateStateValid(workerId, stateValid); |
| | | } |
| | | |
| | | @Override |
| | | public void updateTaobaoBind(Long workerId, boolean taobaoBind) { |
| | | teamFansInfoDao.updateTaobaoBind(workerId, taobaoBind); |
| | | } |
| | | |
| | | @Override |
| | | public void updateWeixinBind(Long workerId, boolean weixinBind) { |
| | | teamFansInfoDao.updateWeixinBind(workerId, weixinBind); |
| | | } |
| | | |
| | | @Override |
| | | public void updateActiveTime(Long workerId, Date activeTime) { |
| | | teamFansInfoDao.updateActiveTime(workerId, activeTime); |
| | | } |
| | | |
| | | @Override |
| | | public void updateFansNum(Long workerId) { |
| | | long firstTeam = threeSaleSerivce.countFirstTeam(workerId); |
| | | long secondTeam = threeSaleSerivce.countSecondTeam(workerId); |
| | | int fansNum = (int) (firstTeam + secondTeam); |
| | | teamFansInfoDao.updateFansNum(workerId, fansNum); |
| | | } |
| | | |
| | | @Override |
| | | public void updateIncome(Long workerId, BigDecimal income) { |
| | | teamFansInfoDao.updateIncome(workerId, income); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<TeamFansInfo> query(int start, int count, int type, Long uid, ThreeSaleFocusDTO focusDTO) { |
| | | return teamFansInfoDao.query(start, count, type, uid, focusDTO); |
| | | } |
| | | |
| | | @Override |
| | | public long count(int type, Long uid, ThreeSaleFocusDTO focusDTO) { |
| | | return teamFansInfoDao.count(type, uid, focusDTO); |
| | | } |
| | | |
| | | @Override |
| | | public TeamFansInfo getbyWorkerId(Long workerId) { |
| | | return teamFansInfoDao.getbyWorkerId(workerId); |
| | | } |
| | | } |
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.vip.TeamDailyRecordDao;
|
| | | import com.yeshi.fanli.dao.user.invite.TeamDailyRecordDao;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamDailyRecord;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.vip.TeamDailyRecordService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | |
|
| | | @Service
|
| | | public class TeamDailyRecordServiceImpl implements TeamDailyRecordService {
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | public void addDailyRecord(Long uid) {
|
| | | // 重新统计队员等级数量
|
| | | recountRecord(uid);
|
| | |
| | | String time = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
|
| | | String id = StringUtil.Md5(uid + "#" + time);
|
| | | TeamDailyRecord record = TeamDailyRecordDao.getById(id);
|
| | | if (record == null) {
|
| | | record = new TeamDailyRecord();
|
| | | } else if (record.getSecondCount() != null) {
|
| | | secondBeyond = record.getSecondCount();
|
| | | }
|
| | |
|
| | | record.setId(id);
|
| | | record.setUid(uid);
|
| | | record.setFirstCount(firstCount);
|
| | | record.setSecondCount(secondCount);
|
| | | record.setSecondBeyond(secondBeyond);
|
| | | record.setStatisticDay(TimeUtil.parse(time));
|
| | | record.setUpdateTime(new Date());
|
| | | // if (record == null) {
|
| | | // record = new TeamDailyRecord();
|
| | | // } else if (record.getSecondCount() != null) {
|
| | | // secondBeyond = record.getSecondCount();
|
| | | // }
|
| | | //
|
| | | // record.setId(id);
|
| | | // record.setUid(uid);
|
| | | // record.setFirstCount(firstCount);
|
| | | // record.setSecondCount(secondCount);
|
| | | // record.setSecondBeyond(secondBeyond);
|
| | | // record.setStatisticDay(TimeUtil.parse(time));
|
| | | // record.setUpdateTime(new Date());
|
| | | TeamDailyRecordDao.save(record);
|
| | | } catch (Exception e) {
|
| | | e.getSuppressed();
|
| | |
| | | * @param record |
| | | */ |
| | | public void saveDailyCount(OrderMoneyDailyCount record); |
| | | |
| | | |
| | | /** |
| | | * 根据来源渠道进行分组统计数据 |
| | | * @param uid |
| | | * @param minDay |
| | | * @param maxDay |
| | | * @return |
| | | */ |
| | | public List<OrderMoneyDailyCount> sumGroupBySourceType(Long uid, Date minDay, Date maxDay); |
| | | |
| | | /** |
| | | * 根据来源分组统计团队信息 |
| | | * @param uid |
| | | * @param minDay |
| | | * @param maxDay |
| | | * @return |
| | | */ |
| | | public List<OrderMoneyDailyCount> sumTeamGroupBySourceType(Long uid, Date minDay, Date maxDay); |
| | | |
| | | |
| | | /** |
| | | * 统计每天 |
| | | * @param uid |
| | | * @param minDay |
| | | * @param maxDay |
| | | * @return |
| | | */ |
| | | public List<OrderMoneyDailyCount> sumGroupByCountDay(Long uid, Date minDay, Date maxDay); |
| | | |
| | | /** |
| | | * 统计每月 |
| | | * @param uid |
| | | * @param minDay |
| | | * @param maxDay |
| | | * @return |
| | | */ |
| | | public List<OrderMoneyDailyCount> sumGroupByYearMonth(Long uid, Date minDay, Date maxDay); |
| | | |
| | | } |
File was renamed from fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleFocusInfoService.java |
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.user.ThreeSaleFocusDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleFocusInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.TeamFansInfo;
|
| | |
|
| | | public interface ThreeSaleFocusInfoService {
|
| | | public interface TeamFansInfoService {
|
| | |
|
| | | /**
|
| | | * 查询
|
| | |
| | | * @param focusDTO
|
| | | * @return
|
| | | */
|
| | | public List<ThreeSaleFocusInfo> query(int start, int count, int type, Long uid, ThreeSaleFocusDTO focusDTO);
|
| | | public List<TeamFansInfo> query(int start, int count, int type, Long uid, ThreeSaleFocusDTO focusDTO);
|
| | |
|
| | | public long count(int type, Long uid, ThreeSaleFocusDTO focusDTO);
|
| | |
|
| | |
| | | * @param workerId
|
| | | * @return
|
| | | */
|
| | | public ThreeSaleFocusInfo getbyWorkerId(Long workerId);
|
| | | public TeamFansInfo getbyWorkerId(Long workerId);
|
| | |
|
| | | public void updateMemoName(Long workerId, int type, String memoName);
|
| | |
|
| | |
| | | * 添加
|
| | | * @param record
|
| | | */
|
| | | public void save(ThreeSaleFocusInfo record);
|
| | | public void save(TeamFansInfo record);
|
| | |
|
| | | }
|
| | |
| | | date = sdf.parse(st);
|
| | | return date.getTime();
|
| | | } catch (Exception e) {
|
| | | // e.printStackTrace();
|
| | | e.printStackTrace();
|
| | | return 0;
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | public static Date parseYYYYMM(String st) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
| | | try {
|
| | | return sdf.parse(st);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | return null;
|
| | | }
|
| | | }
|
| | | |
| | | public static Date parseYYYYMMDD_HHMMSS(String st) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | try {
|
| | | return sdf.parse(st);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | return null;
|
| | | }
|
| | | }
|
| | | |
| | | public static Date parseYYYYMMDD(String st) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | try {
|
| | | return sdf.parse(st);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | return null;
|
| | | }
|
| | | }
|
| | | |
| | | public static long convertAllTimeToTemp(String st) {
|
| | | Date date = new Date();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
| | |
| | | import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserMoneyChangeMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleFocusInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamLevelDailyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.TeamFansInfoService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | public class UserTeamMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleFocusInfoService threeSaleFocusInfoService;
|
| | | private TeamFansInfoService teamFansInfoService;
|
| | |
|
| | | @Resource
|
| | | private TeamLevelDailyRecordService teamLevelDailyRecordService;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
| | | UserActiveMQMsg userActiveMQMsg = new Gson().fromJson(json.toString(),UserActiveMQMsg.class);
|
| | | if (userActiveMQMsg != null) {
|
| | | // 更改用户活跃时间
|
| | | threeSaleFocusInfoService.updateActiveTime(userActiveMQMsg.getUid(), userActiveMQMsg.getCreateTime());
|
| | | teamFansInfoService.updateActiveTime(userActiveMQMsg.getUid(), userActiveMQMsg.getCreateTime());
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userInfoUpdate.name())) {// 用户信息更新
|
| | | JSONObject json = JSONObject.fromObject(new String(message.getBody()));
|
| | | UserInfoUpdateMQMsg mqMsg = new Gson().fromJson(json.toString(),UserInfoUpdateMQMsg.class);
|
| | | if (mqMsg != null) {
|
| | | if (UserInfoUpdateTypeEnum.nickName == mqMsg.getType()) { // 更改昵称
|
| | | threeSaleFocusInfoService.updateNickName(mqMsg.getUid(), mqMsg.getValue());
|
| | | teamFansInfoService.updateNickName(mqMsg.getUid(), mqMsg.getValue());
|
| | | } else if (UserInfoUpdateTypeEnum.wxId == mqMsg.getType()) { // 微信号绑定
|
| | | threeSaleFocusInfoService.updateWeixinBind(mqMsg.getUid(), true);
|
| | | teamFansInfoService.updateWeixinBind(mqMsg.getUid(), true);
|
| | | }
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.taobaoBindSuccess.name())) {// 淘宝绑定成功
|
| | |
| | | TaoBaoBindSuccessMQMsg mqMsg = new Gson().fromJson(json.toString(),TaoBaoBindSuccessMQMsg.class);
|
| | | if (mqMsg != null) {
|
| | | // 更新淘宝绑定
|
| | | threeSaleFocusInfoService.updateWeixinBind(mqMsg.getUid(), true);
|
| | | teamFansInfoService.updateWeixinBind(mqMsg.getUid(), true);
|
| | | Long fromUid = mqMsg.getFromUid();
|
| | | if (fromUid != null) { // 淘宝被解绑
|
| | | threeSaleFocusInfoService.updateWeixinBind(fromUid, false);
|
| | | teamFansInfoService.updateWeixinBind(fromUid, false);
|
| | | }
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {// 邀请成功
|
| | |
| | | JSONObject json = JSONObject.fromObject(new String(message.getBody()));
|
| | | UserInviteMQMsg mqMsg = new Gson().fromJson(json.toString(),UserInviteMQMsg.class);
|
| | | if (mqMsg != null) {
|
| | | threeSaleFocusInfoService.updateFansNum(mqMsg.getBossId());
|
| | | teamFansInfoService.updateFansNum(mqMsg.getBossId());
|
| | |
|
| | | // 重新统计粉丝等级数量
|
| | | teamLevelDailyRecordService.addStatisticByUid(mqMsg.getBossId());
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userMoneyAdd.name())) {// 资金到账
|
| | | // 更新近60天到账
|
| | | JSONObject json = JSONObject.fromObject(new String(message.getBody()));
|
| | | UserMoneyChangeMQMsg mqMsg = new Gson().fromJson(json.toString(),UserMoneyChangeMQMsg.class);
|
| | | if (mqMsg != null) {
|
| | | threeSaleFocusInfoService.updateIncome(mqMsg.getUid(), mqMsg.getChangeMoney());
|
| | | teamFansInfoService.updateIncome(mqMsg.getUid(), mqMsg.getChangeMoney());
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.becomeValidUser.name())) {// 成为有效用户
|
| | | // 有效用户标识
|
| | |
| | | BeComeValidUserMQMsg mqMsg = new Gson().fromJson(json.toString(),BeComeValidUserMQMsg.class);
|
| | | if (mqMsg != null) {
|
| | | // 更新成为有效粉丝
|
| | | threeSaleFocusInfoService.updateStateValid(mqMsg.getUid(), true);
|
| | | teamFansInfoService.updateStateValid(mqMsg.getUid(), true);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | 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.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserActiveLogService userActiveLogService;
|
| | | |
| | | @Resource
|
| | | private TeamLevelDailyRecordService teamLevelDailyRecordService;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | teamUserLevelStatisticService.initData(boss.getId());
|
| | | }
|
| | |
|
| | | // 重新统计粉丝等级数量
|
| | | teamLevelDailyRecordService.addStatisticByUid(boss.getId());
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.threeSaleSeparate.name())) {// 邀请关系脱离
|
| | |
| | | private Integer num; // 订单数量
|
| | | private BigDecimal money;// 金额
|
| | |
|
| | | public IncomeDetailVO() {}
|
| | | |
| | | |
| | | public IncomeDetailVO(String icon) {
|
| | | this.icon = icon;
|
| | | }
|
| | | |
| | | public IncomeDetailVO(String icon, Integer num, BigDecimal money) {
|
| | | this.icon = icon;
|
| | | this.num = num;
|
| | | this.money = money;
|
| | | }
|
| | | |
| | | public String getIcon() {
|
| | | return icon;
|
| | | }
|
| | |
| | | private BigDecimal teamMoney;// 累计提现
|
| | | private Integer teamNum;// 累计提现
|
| | |
|
| | | private String countDate; // 统计日期
|
| | | private String countDate; // 统计日期
|
| | | |
| | | |
| | | public MoneyPredictVO() {}
|
| | | |
| | | |
| | | public MoneyPredictVO(BigDecimal mineMoney, Integer mineNum, BigDecimal teamMoney,Integer teamNum) {
|
| | | this.mineMoney = mineMoney;
|
| | | this.mineNum = mineNum;
|
| | | this.teamMoney = teamMoney;
|
| | | this.teamNum = teamNum;
|
| | | }
|
| | | |
| | | |
| | |
|
| | |
|
| | | public BigDecimal getTotalMoney() {
|
| | |
| | | dateInfo.setSecond(second);
|
| | | return dateInfo;
|
| | | }
|
| | | |
| | |
|
| | | public static String dateDiff4(Date startTime, Date endTime) throws Exception {
|
| | |
|
| | | String datatime = "0分";
|
| | |
| | | long hour = diff % nd / nh;// 计算差多少小时
|
| | | long min = diff % nd % nh / nm;// 计算差多少分钟
|
| | | long second = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60); // 计算差多少秒
|
| | | |
| | |
|
| | | String datatime = "";
|
| | | if (day > 0) {
|
| | | datatime = day + "天";
|
| | |
| | | datatime = hour + "小时";
|
| | | } else if (min > 0) {
|
| | | datatime = min + "分钟";
|
| | | } else if(second > 0) {
|
| | | } else if (second > 0) {
|
| | | datatime = second + "秒";
|
| | | }
|
| | | return datatime;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | public static long dateDiffMin(Date startTime, Date endTime) throws Exception {
|
| | | long nm = 1000 * 60;// 一分钟的毫秒数
|
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数
|
| | |
| | | long diff = endTime.getTime() - startTime.getTime();
|
| | | long day = diff / nd;// 计算差多少天
|
| | | long hour = diff % nd / nh;// 计算差多少小时
|
| | | long min = diff % nd % nh / nm + day * 24 * 60 + hour * 60;// 计算差多少分钟
|
| | | long min = diff % nd % nh / nm + day * 24 * 60 + hour * 60;// 计算差多少分钟
|
| | | return min;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 通过时间秒毫秒数判断两个时间的间隔
|
| | | *
|
| | |
| | |
|
| | | return format.format(ca.getTime());
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 指定日期加上天数后的日期
|
| | | *
|
| | |
| | | return format.format(ca.getTime());
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 指定日期加上天数后的日期
|
| | | *
|
| | |
| | | ca.add(Calendar.DATE, num);
|
| | | return ca.getTime();
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 加上月份
|
| | | * |
| | | * @param currdate
|
| | | * @param num
|
| | | * @return
|
| | |
| | | ca.add(Calendar.MONTH, num);
|
| | | return ca.getTime();
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 加上年份
|
| | | * |
| | | * @param currdate
|
| | | * @param num
|
| | | * @return
|
| | |
| | | return ca.getTime();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 减去月份
|
| | | * |
| | | * @param currdate
|
| | | * @param num
|
| | | * @return
|
| | | */
|
| | | public static Date reduceMonth(Date currdate, int num) {
|
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(currdate);
|
| | | ca.add(Calendar.MONTH, -num);
|
| | | return ca.getTime();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 指定日期减去天数后的日期
|
| | |
| | |
|
| | | return format.format(ca.getTime());
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 指定日期减去天数后的日期
|
| | | *
|
| | |
| | | * 计算两时间月差
|
| | | *
|
| | | * @param startDate <String>
|
| | | * @param endDate <String>
|
| | | * @param endDate <String>
|
| | | * @return int
|
| | | * @throws ParseException
|
| | | */
|
| | | public static int getMonthSpace(String startDate, String endDate) throws ParseException {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
| | | return getMonthSpace(sdf.parse(startDate), sdf.parse(endDate));
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
| | | return getMonthSpace(sdf.parse(startDate), sdf.parse(endDate));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 计算两时间月差
|
| | | *
|
| | | * @param startDate <String>
|
| | | * @param endDate <String>
|
| | | * @param endDate <String>
|
| | | * @return int
|
| | | * @throws ParseException
|
| | | */
|
| | |
| | | start.setTime(startDate);
|
| | | end.setTime(endDate);
|
| | | int result = end.get(Calendar.MONTH) - start.get(Calendar.MONTH);
|
| | | int month = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * 12;
|
| | | int month = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * 12;
|
| | | return Math.abs(month + result);
|
| | | }
|
| | | |
| | |
|
| | | public static Date getTodayStartTime() {
|
| | | Calendar todayStart = Calendar.getInstance();
|
| | | todayStart.set(Calendar.HOUR_OF_DAY,0);
|
| | | todayStart.set(Calendar.MINUTE,0);
|
| | | todayStart.set(Calendar.SECOND,0);
|
| | | todayStart.set(Calendar.MILLISECOND,0);
|
| | | todayStart.set(Calendar.HOUR_OF_DAY, 0);
|
| | | todayStart.set(Calendar.MINUTE, 0);
|
| | | todayStart.set(Calendar.SECOND, 0);
|
| | | todayStart.set(Calendar.MILLISECOND, 0);
|
| | | return todayStart.getTime();
|
| | | }
|
| | | |
| | |
|
| | | public static Date getTodayEndTime() {
|
| | | Calendar todayEnd = Calendar.getInstance();
|
| | | todayEnd.set(Calendar.HOUR_OF_DAY,23);
|
| | | todayEnd.set(Calendar.MINUTE,59);
|
| | | todayEnd.set(Calendar.SECOND,59);
|
| | | todayEnd.set(Calendar.MILLISECOND,999);
|
| | | todayEnd.set(Calendar.HOUR_OF_DAY, 23);
|
| | | todayEnd.set(Calendar.MINUTE, 59);
|
| | | todayEnd.set(Calendar.SECOND, 59);
|
| | | todayEnd.set(Calendar.MILLISECOND, 999);
|
| | | return todayEnd.getTime();
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 获取指定年月的第一天
|
| | | * |
| | | * @param yearMonth
|
| | | * @return
|
| | | */
|
| | | public static String getFirstDayOfMonth(String yearMonth) {
|
| | | int year = Integer.parseInt(yearMonth.split("-")[0]); // 年
|
| | | int month = Integer.parseInt(yearMonth.split("-")[1]); // 月
|
| | | return getFirstDayOfMonth(year, month);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取指定年月的第一天
|
| | | * |
| | | * @param year
|
| | | * @param month
|
| | | * @return
|
| | | */
|
| | | public static String getFirstDayOfMonth(int year, int month) {
|
| | | Calendar cal = Calendar.getInstance();
|
| | | // 设置年份
|
| | | cal.set(Calendar.YEAR, year);
|
| | | // 设置月份
|
| | | cal.set(Calendar.MONTH, month - 1);
|
| | | // 获取某月最小天数
|
| | | int firstDay = cal.getMinimum(Calendar.DATE);
|
| | | // 设置日历中月份的最小天数
|
| | | cal.set(Calendar.DAY_OF_MONTH, firstDay);
|
| | | // 格式化日期
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | return sdf.format(cal.getTime());
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取指定年月的最后一天
|
| | | * |
| | | * @param yearMonth
|
| | | * @return
|
| | | */
|
| | | public static String getLastDayOfMonth(String yearMonth) {
|
| | | int year = Integer.parseInt(yearMonth.split("-")[0]); // 年
|
| | | int month = Integer.parseInt(yearMonth.split("-")[1]); // 月
|
| | | return getLastDayOfMonth(year, month);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取指定年月的最后一天
|
| | | * |
| | | * @param year
|
| | | * @param month
|
| | | * @return
|
| | | */
|
| | | public static String getLastDayOfMonth(int year, int month) {
|
| | | Calendar cal = Calendar.getInstance();
|
| | | // 设置年份
|
| | | cal.set(Calendar.YEAR, year);
|
| | | // 设置月份
|
| | | cal.set(Calendar.MONTH, month - 1);
|
| | | // 获取某月最大天数
|
| | | int lastDay = cal.getActualMaximum(Calendar.DATE);
|
| | | // 设置日历中月份的最大天数
|
| | | cal.set(Calendar.DAY_OF_MONTH, lastDay);
|
| | | // 格式化日期
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | return sdf.format(cal.getTime());
|
| | | }
|
| | |
|
| | | public static void main(String[] args) throws ParseException {
|
| | | System.out.println(getMonthSpace("2012-02", "2012-02")); |
| | | }
|
| | | System.out.println(getMonthSpace("2012-02", "2012-02"));
|
| | | }
|
| | |
|
| | | } |