| | |
| | |
|
| | | @Resource
|
| | | private TeamEincomeRecordService teamEincomeRecordService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private PreviewInfoService previewInfoService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceOrderUserMapService teamDividentsSourceOrderUserMapService;
|
| | | |
| | |
|
| | | private Gson getGson() {
|
| | | GsonBuilder builder = new GsonBuilder();
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // VIP数据预览
|
| | | MoneyStatisticVO vo = null;
|
| | | String redisContent = previewInfoService.getRedisContent(uid, PreviewEnum.moneyInfo);
|
| | |
| | | vo.setMoneyArrivalDesc("订单已到账后提现时间和金额均不受限制");
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (vo == null) {
|
| | | vo = createMoneyStatistic(uid);
|
| | | }
|
| | | |
| | |
|
| | | Gson gson = getGson();
|
| | | out.print(JsonUtil.loadTrueResult(gson.toJson(vo)));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | public MoneyStatisticVO createMoneyStatistic(Long uid) {
|
| | | UserInfo user = userInfoService.getUserById(uid);
|
| | |
|
| | |
| | | vo.setMonthPredict(cratePredictVO(orderMoneyDailyCountService.query(uid, minDate, maxDate)));
|
| | | return vo;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @RequestMapping(value = "getUserMoneyInfo")
|
| | | public void getUserMoneyInfo(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
| | | predictVO.setMineNum(predictVO.getMineNum() + dailyCount.getOrderNum());
|
| | | if (dailyCount.getOrderNumTeam() != null)
|
| | | predictVO.setTeamNum(predictVO.getTeamNum() + dailyCount.getOrderNumTeam());
|
| | |
|
| | | if (dailyCount.getTeamDividentsOrderNum() != null)
|
| | | predictVO.setTotalNum(predictVO.getTotalNum() + dailyCount.getTeamDividentsOrderNum());
|
| | |
|
| | | if (dailyCount.getIncome() != null)
|
| | | predictVO.setMineMoney(predictVO.getMineMoney()
|
| | | .add(MoneyBigDecimalUtil.div(BigDecimal.valueOf(dailyCount.getIncome()), hundred)));
|
| | |
| | | .add(MoneyBigDecimalUtil.div(BigDecimal.valueOf(dailyCount.getIncomeTeam()), hundred)));
|
| | | }
|
| | | }
|
| | | predictVO.setTotalNum(predictVO.getTeamNum() + predictVO.getMineNum());
|
| | | predictVO.setTotalNum(predictVO.getTotalNum());
|
| | | predictVO.setTotalMoney(predictVO.getMineMoney().add(predictVO.getTeamMoney()));
|
| | | return predictVO;
|
| | | }
|
| | |
| | | String redisContent = previewInfoService.getRedisContent(uid, PreviewEnum.extractRecord);
|
| | | if (!StringUtil.isNullOrEmpty(redisContent)) {
|
| | | Gson gson = new Gson();
|
| | | list = gson.fromJson(redisContent, new TypeToken<ArrayList<Extract>>() {}.getType());
|
| | | list = gson.fromJson(redisContent, new TypeToken<ArrayList<Extract>>() {
|
| | | }.getType());
|
| | | }
|
| | | |
| | |
|
| | | // 查询真实
|
| | | long count = 0;
|
| | | if (list == null) {
|
| | | list = extractService.getExtractSucceedRecord(page, Constant.PAGE_SIZE, uid);
|
| | | count = extractService.countExtractSucceedRecord(uid);
|
| | | }
|
| | | |
| | |
|
| | | if (list == null)
|
| | | list = new ArrayList<>();
|
| | |
|
| | |
| | | }
|
| | |
|
| | | private TeamPredictVO crateTeamPredictVO(List<OrderMoneyDailyCount> list) {
|
| | | TeamPredictVO predictVO = new TeamPredictVO(BigDecimal.ZERO, 0, BigDecimal.ZERO, 0);
|
| | | TeamPredictVO predictVO = new TeamPredictVO(BigDecimal.ZERO, 0, BigDecimal.ZERO, 0, 0);
|
| | | if (list != null && list.size() > 0) {
|
| | | BigDecimal hundred = BigDecimal.valueOf(100);
|
| | | for (OrderMoneyDailyCount dailyCount : list) {
|
| | |
| | | predictVO.setSubsidy(predictVO.getSubsidy()
|
| | | .add(MoneyBigDecimalUtil.div(BigDecimal.valueOf(dailyCount.getTeamSubsidy()), hundred)));
|
| | |
|
| | | if (dailyCount.getTeamDividentsOrderNum() != null)
|
| | | predictVO.setTotalNum(predictVO.getTotalNum() + dailyCount.getTeamDividentsOrderNum());
|
| | |
|
| | | }
|
| | | }
|
| | | predictVO.setTotalNum(predictVO.getRewardNum() + predictVO.getSubsidyNum());
|
| | | predictVO.setTotalNum(predictVO.getTotalNum());
|
| | | predictVO.setTotalMoney(predictVO.getReward().add(predictVO.getSubsidy()));
|
| | | return predictVO;
|
| | | }
|
| | |
| | | int countNum = 7;
|
| | | Date day = TimeUtil.parseYYYYMMDD(date);
|
| | | for (int i = 0; i < countNum; i++) {
|
| | | TeamPredictVO predictVO = new TeamPredictVO(zero, 0, zero, 0);
|
| | | TeamPredictVO predictVO = new TeamPredictVO(zero, 0, zero, 0, 0);
|
| | | if (i == 0) {
|
| | | predictVO.setCountDate(formatDay.format(day));
|
| | | } else {
|
| | |
| | | int countNum = 3;
|
| | | Date day = TimeUtil.parseYYYYMMDD(DateUtil.getFirstDayOfMonth(date));
|
| | | for (int i = 0; i < countNum; i++) {
|
| | | TeamPredictVO predictVO = new TeamPredictVO(zero, 0, zero, 0);
|
| | | TeamPredictVO predictVO = new TeamPredictVO(zero, 0, zero, 0, 0);
|
| | | if (i == 0) {
|
| | | predictVO.setCountDate(formatMonth.format(day));
|
| | | } else {
|
| | |
| | | predictVO.setSubsidyNum(dailyCount.getTeamSubsidyNum());
|
| | | predictVO.setSubsidy(
|
| | | MoneyBigDecimalUtil.div(BigDecimal.valueOf(dailyCount.getTeamSubsidy()), hundred));
|
| | | predictVO.setTotalNum(dailyCount.getTeamDividentsOrderNum());
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | predictVO.setSubsidyNum(dailyCount.getTeamSubsidyNum());
|
| | | predictVO.setSubsidy(
|
| | | MoneyBigDecimalUtil.div(BigDecimal.valueOf(dailyCount.getTeamSubsidy()), hundred));
|
| | |
|
| | | predictVO.setTotalNum(dailyCount.getTeamDividentsOrderNum());
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | predictVO.setTotalNum(predictVO.getRewardNum() + predictVO.getSubsidyNum());
|
| | | predictVO.setTotalNum(predictVO.getTotalNum());
|
| | | predictVO.setTotalMoney(predictVO.getReward().add(predictVO.getSubsidy()));
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 分红详情
|
| | | *
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTeamDividendDetail")
|
| | | public void getTeamDividendDetail(String callback, AcceptData acceptData, Integer page, Long uid, |
| | | String date, Integer datetype, String key, PrintWriter out) {
|
| | | public void getTeamDividendDetail(String callback, AcceptData acceptData, Integer page, Long uid, String date,
|
| | | Integer datetype, String key, PrintWriter out) {
|
| | | if (uid == null || uid == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数不完整"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (page == null)
|
| | | page = 1;
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | |
|
| | | try {
|
| | | Date minDay = new Date();
|
| | |
| | | minDay = TimeUtil.parseYYYYMMDD(DateUtil.getFirstDayOfMonth(date));
|
| | | maxDay = TimeUtil.parseYYYYMMDD_HHMMSS(DateUtil.getLastDayOfMonth(date) + " 23:59:59");
|
| | | }
|
| | | List<TeamDividentsVO> list = teamDividentsSourceOrderUserMapService.listByDateAndTargetUid((page-1) * pageSize, pageSize, uid, minDay, maxDay, key);
|
| | | List<TeamDividentsVO> list = teamDividentsSourceOrderUserMapService
|
| | | .listByDateAndTargetUid((page - 1) * pageSize, pageSize, uid, minDay, maxDay, key);
|
| | | if (list == null) {
|
| | | list = new ArrayList<>();
|
| | | }
|
| | | long count = teamDividentsSourceOrderUserMapService.countByDateAndTargetUid(uid, minDay, maxDay, key);
|
| | | |
| | |
|
| | | GsonBuilder builder = new GsonBuilder();
|
| | | builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
| | | @Override
|
| | |
| | | return new JsonPrimitive("0.00");
|
| | | } else {
|
| | | // 保留3位小数
|
| | | value = value.setScale(3,RoundingMode.DOWN);
|
| | | value = value.setScale(3, RoundingMode.DOWN);
|
| | | return new JsonPrimitive(value.toString());
|
| | | }
|
| | | }
|
| | | });
|
| | | |
| | |
|
| | | Gson gson = builder.create();
|
| | | JSONObject object = new JSONObject();
|
| | |
|
| | | if (page == 1) {
|
| | | TeamDividentsVO teamDividentsVO = teamDividentsSourceOrderUserMapService.sumByDateAndTargetUid(uid, minDay, maxDay, key);
|
| | | TeamDividentsVO teamDividentsVO = teamDividentsSourceOrderUserMapService.sumByDateAndTargetUid(uid,
|
| | | minDay, maxDay, key);
|
| | | if (teamDividentsVO == null) {
|
| | | teamDividentsVO = new TeamDividentsVO();
|
| | | teamDividentsVO.setSubsidy(BigDecimal.ZERO);
|
| | | teamDividentsVO.setDividents(BigDecimal.ZERO);
|
| | | }
|
| | | object.put("subsidy", teamDividentsVO.getSubsidy().setScale(2,RoundingMode.DOWN).toString());
|
| | | object.put("subsidy", teamDividentsVO.getSubsidy().setScale(2, RoundingMode.DOWN).toString());
|
| | | object.put("dividents", teamDividentsVO.getDividents().setScale(2, RoundingMode.DOWN).toString());
|
| | | }
|
| | | |
| | |
|
| | | object.put("count", count);
|
| | | object.put("list", gson.toJson(list));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 订单统计-h5
|
| | | *
|
| | |
| | | @RequestMapping(value = "countTeamOrderNum")
|
| | | public void countTeamOrderNum(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | try {
|
| | | |
| | |
|
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | |
| | |
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | | |
| | |
|
| | | // 今日预估
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | minDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | OrderMoneyDailyCount todayRecord = createVO(orderMoneyDailyCountService.sumTeamOrderNumGroupByCountDay(uid, minDate, null));
|
| | | OrderMoneyDailyCount todayRecord = createVO(
|
| | | orderMoneyDailyCountService.sumTeamOrderNumGroupByCountDay(uid, minDate, null));
|
| | |
|
| | | // 昨日预估
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | maxDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | minDate = DateUtil.reduceDay(1, maxDate);
|
| | | OrderMoneyDailyCount yesterdayRecord = createVO(orderMoneyDailyCountService.sumTeamOrderNumGroupByCountDay(uid, minDate, maxDate));
|
| | | OrderMoneyDailyCount yesterdayRecord = createVO(
|
| | | orderMoneyDailyCountService.sumTeamOrderNumGroupByCountDay(uid, minDate, maxDate));
|
| | |
|
| | | // 本月预估
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | minDate = new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | OrderMoneyDailyCount monthRecord = createVO(orderMoneyDailyCountService.sumTeamOrderNumGroupByYearMonth(uid, minDate, maxDate));
|
| | | |
| | | OrderMoneyDailyCount monthRecord = createVO(
|
| | | orderMoneyDailyCountService.sumTeamOrderNumGroupByYearMonth(uid, minDate, maxDate));
|
| | |
|
| | | // 累计
|
| | | OrderMoneyDailyCount totalityRecord = createVO(orderMoneyDailyCountService.sumTeamOrderNumGroupByUid(uid, null, null));
|
| | | |
| | | OrderMoneyDailyCount totalityRecord = createVO(
|
| | | orderMoneyDailyCountService.sumTeamOrderNumGroupByUid(uid, null, null));
|
| | |
|
| | | JSONObject today = new JSONObject();
|
| | | today.put("direct", todayRecord.getDirectOrderNum());
|
| | | today.put("indirect", todayRecord.getInDirectOrderNum());
|
| | | today.put("beyond", todayRecord.getBeyondOrderNum());
|
| | | |
| | |
|
| | | JSONObject yesterday = new JSONObject();
|
| | | yesterday.put("direct", yesterdayRecord.getDirectOrderNum());
|
| | | yesterday.put("indirect", yesterdayRecord.getInDirectOrderNum());
|
| | | yesterday.put("beyond", yesterdayRecord.getBeyondOrderNum());
|
| | | |
| | |
|
| | | JSONObject month = new JSONObject();
|
| | | month.put("direct", monthRecord.getDirectOrderNum());
|
| | | month.put("indirect", monthRecord.getInDirectOrderNum());
|
| | | month.put("beyond", monthRecord.getBeyondOrderNum());
|
| | | |
| | |
|
| | | JSONObject totality = new JSONObject();
|
| | | totality.put("direct", totalityRecord.getDirectOrderNum());
|
| | | totality.put("indirect", totalityRecord.getInDirectOrderNum());
|
| | | totality.put("beyond", totalityRecord.getBeyondOrderNum());
|
| | | |
| | | |
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("today", today);
|
| | | json.put("yesterday", yesterday);
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | private OrderMoneyDailyCount createVO(List<OrderMoneyDailyCount> list) {
|
| | | OrderMoneyDailyCount totalityRecord = new OrderMoneyDailyCount(0,0,0);
|
| | | OrderMoneyDailyCount totalityRecord = new OrderMoneyDailyCount(0, 0, 0);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (OrderMoneyDailyCount record: list) {
|
| | | for (OrderMoneyDailyCount record : list) {
|
| | | totalityRecord.setDirectOrderNum(totalityRecord.getDirectOrderNum() + record.getDirectOrderNum());
|
| | | totalityRecord.setInDirectOrderNum(totalityRecord.getInDirectOrderNum() + record.getInDirectOrderNum());
|
| | | totalityRecord.setBeyondOrderNum(totalityRecord.getBeyondOrderNum() + record.getBeyondOrderNum());
|
| | | }
|
| | | } |
| | | }
|
| | | return totalityRecord;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 订单排行榜
|
| | | * @param callback
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数缺失"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | |
| | |
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | | |
| | |
|
| | | if (dateType == 1) {
|
| | | // 今日
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | |
| | | // 本月
|
| | | 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);
|
| | | }
|
| | | |
| | |
|
| | | List<OrderRankingVO> list = orderMoneyDailyCountService.getRankingByOrderNum(uid, minDate, maxDate);
|
| | | if (list.size() > 0) {
|
| | | for (int i = 0; i < list.size(); i ++) {
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | OrderRankingVO vo = list.get(i);
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(vo.getUid());
|
| | | if (user == null) {
|
| | |
| | | vo.setPortrait(user.getPortrait());
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("list", list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(json));
|
| | |
| | | |
| | | TeamEincomeRecord selectByUidAndPreRecieveTimeAndType(@Param("uid") Long uid, |
| | | @Param("preRecieveTime") Date preRecieveTime, @Param("type") int type); |
| | | |
| | | |
| | | TeamEincomeRecord selectByUidAndPreRecieveTimeAndTypeAndSourceType(@Param("uid") Long uid, |
| | | @Param("preRecieveTime") Date preRecieveTime, @Param("type") int type, @Param("sourceType") int sourceType); |
| | | |
| | | |
| | | |
| | | |
| | | TeamEincomeRecord selectByPrimaryKeyForUpdate(Long id); |
| | | |
| | |
| | | |
| | | List<UserOrderDailyStatisticDTO> listDividentsOrderByCreateTime(@Param("minTime") Date minTime, |
| | | @Param("maxTime") Date maxTime); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 统计团队分红(团队奖励与团队补贴)订单数量信息 |
| | | * @Title: listDividentsOrderCountByCreateTime |
| | | * @Description: |
| | | * @param minTime |
| | | * @param maxTime |
| | | * @return |
| | | * List<UserOrderDailyStatisticDTO> 返回类型 |
| | | * @throws |
| | | */ |
| | | List<UserOrderDailyStatisticDTO> listDividentsOrderCountByCreateTime(@Param("minTime") Date minTime, |
| | | @Param("maxTime") Date maxTime); |
| | | |
| | | } |
| | |
| | |
|
| | | private static String collectionName = "order_money_daily_count";
|
| | |
|
| | |
|
| | | /**
|
| | | * 选择更新
|
| | | *
|
| | |
| | | update.set("teamSubsidy", info.getTeamSubsidy());
|
| | | if (info.getTeamSubsidyNum() != null)
|
| | | update.set("teamSubsidyNum", info.getTeamSubsidyNum());
|
| | | if (info.getTeamDividentsOrderNum() != null)
|
| | | update.set("teamDividentsOrderNum", info.getTeamDividentsOrderNum());
|
| | | if (info.getDirectOrderNum() != null)
|
| | | update.set("directOrderNum", info.getDirectOrderNum());
|
| | | if (info.getInDirectOrderNum() != null)
|
| | |
| | | */
|
| | | public List<OrderMoneyDailyCount> sumGroupBySourceType(Long uid, Date minDate, Date maxDate) {
|
| | | List<OrderMoneyDailyCount> listDailyCount = new ArrayList<>();
|
| | | String reduce = "function(doc, aggr){"
|
| | | + " aggr.totalIncome += doc.income;"
|
| | | + " aggr.totalNum += doc.orderNum;" + "}";
|
| | | String reduce = "function(doc, aggr){" + " aggr.totalIncome += doc.income;" + " aggr.totalNum += doc.orderNum;"
|
| | | + "}";
|
| | |
|
| | | // 查询条件
|
| | | List<Criteria> list = new ArrayList<Criteria>();
|
| | |
| | | if (object == null || object.get("sourceType") == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | SourceTypeEnum sourceTypeEnum = null;
|
| | | for (int m = 0; m < arrayEnun.length; m++) {
|
| | | if (arrayEnun[m].name().equals(object.get("sourceType").toString())) {
|
| | |
| | | List<OrderMoneyDailyCount> listDailyCount = new ArrayList<>();
|
| | |
|
| | | // 统计方法
|
| | | String reduce = "function(doc, aggr){"
|
| | | + " aggr.totalIncome += doc.incomeTeam;"
|
| | | String reduce = "function(doc, aggr){" + " aggr.totalIncome += doc.incomeTeam;"
|
| | | + " aggr.totalNum += doc.orderNumTeam;" + "}";
|
| | |
|
| | | // 查询条件
|
| | |
| | | if (object == null || object.get("sourceType") == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | SourceTypeEnum sourceTypeEnum = null;
|
| | | for (int m = 0; m < arrayEnun.length; m++) {
|
| | | if (arrayEnun[m].name().equals(object.get("sourceType").toString())) {
|
| | |
| | | builder.append(" }");
|
| | | return builder.toString();
|
| | | }
|
| | | // private String getReduce2() {
|
| | | // 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();
|
| | | //}
|
| | |
|
| | | |
| | | // private String getReduce2() {
|
| | | // 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();
|
| | | // }
|
| | |
|
| | | /**
|
| | | * 统计每天订单收入、数量
|
| | |
| | | if (dbObject == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | Object object = dbObject.get("countDay");
|
| | | if (object == null) {
|
| | | continue;
|
| | |
| | | }
|
| | | return results;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 统计每月订单收入、数量
|
| | |
| | | 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()).intValue());
|
| | |
| | | }
|
| | | return results;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | private String getTeamReduce() {
|
| | | StringBuilder builder = new StringBuilder();
|
| | | builder.append("function(doc, aggr){ ");
|
| | |
| | | builder.append(" aggr.totalRewardNum += doc.teamRewardNum;");
|
| | | builder.append(" aggr.totalSubsidy += doc.teamSubsidy;");
|
| | | builder.append(" aggr.totalSubsidyNum += doc.teamSubsidyNum;");
|
| | | builder.append(" aggr.totalNum += doc.teamDividentsOrderNum;");
|
| | | builder.append(" }");
|
| | | return builder.toString();
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 统计每天订单收入、数量
|
| | | * @param uid
|
| | |
| | | if (dbObject == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | Object object = dbObject.get("countDay");
|
| | | if (object == null) {
|
| | | continue;
|
| | |
| | | map.put("totalRewardNum", 0);
|
| | | map.put("totalSubsidy", 0);
|
| | | map.put("totalSubsidyNum", 0);
|
| | | map.put("totalNum", 0);
|
| | | BasicDBObject initial = new BasicDBObject(map);
|
| | |
|
| | | // 进行按天、周、月分组
|
| | |
| | | if (dbObject == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | Object object = dbObject.get("yearMonth");
|
| | | if (object == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | OrderMoneyDailyCount dailyCount = new OrderMoneyDailyCount();
|
| | | dailyCount.setYearMonth(object.toString());
|
| | | dailyCount.setTeamReward(new BigDecimal(dbObject.get("totalReward").toString()).intValue());
|
| | | dailyCount.setTeamRewardNum(new BigDecimal(dbObject.get("totalRewardNum").toString()).intValue());
|
| | | dailyCount.setTeamSubsidy(new BigDecimal(dbObject.get("totalSubsidy").toString()).intValue());
|
| | | dailyCount.setTeamSubsidyNum(new BigDecimal(dbObject.get("totalSubsidyNum").toString()).intValue());
|
| | | dailyCount.setTeamDividentsOrderNum(new BigDecimal( dbObject.get("totalNum") .toString()).intValue());
|
| | | results.add(dailyCount);
|
| | | }
|
| | | }
|
| | | return results;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | private String getTeamOrderNumReduce() {
|
| | | StringBuilder builder = new StringBuilder();
|
| | | builder.append("function(doc, aggr){ ");
|
| | |
| | | builder.append(" }");
|
| | | return builder.toString();
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 统计每月订单收入、数量
|
| | | * @param uid
|
| | |
| | | // 进行按天、周、月分组
|
| | | BasicDBObject agg = new BasicDBObject("countDay", "");
|
| | | DBCollection collection = mongoTemplate.getCollection(collectionName);
|
| | | GroupCommand xx = new GroupCommand(collection, agg, query.getQueryObject(), initial, getTeamOrderNumReduce(), null);
|
| | | GroupCommand xx = new GroupCommand(collection, agg, query.getQueryObject(), initial, getTeamOrderNumReduce(),
|
| | | null);
|
| | | BasicDBList objects = (BasicDBList) collection.group(xx);
|
| | |
|
| | | List<OrderMoneyDailyCount> results = new ArrayList<>();
|
| | |
| | | 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.setDirectOrderNum(new BigDecimal(dbObject.get("directOrderNum").toString()).intValue());
|
| | | dailyCount.setInDirectOrderNum(new BigDecimal(dbObject.get("inDirectOrderNum").toString()).intValue());
|
| | | dailyCount.setInDirectOrderNum(
|
| | | new BigDecimal(dbObject.get("inDirectOrderNum").toString()).intValue());
|
| | | dailyCount.setBeyondOrderNum(new BigDecimal(dbObject.get("beyondOrderNum").toString()).intValue());
|
| | | results.add(dailyCount);
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | | return results;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计每月订单收入、数量
|
| | | * @param uid
|
| | |
| | | // 进行按天、周、月分组
|
| | | BasicDBObject agg = new BasicDBObject("yearMonth", "");
|
| | | DBCollection collection = mongoTemplate.getCollection(collectionName);
|
| | | GroupCommand xx = new GroupCommand(collection, agg, query.getQueryObject(), initial, getTeamOrderNumReduce(), null);
|
| | | GroupCommand xx = new GroupCommand(collection, agg, query.getQueryObject(), initial, getTeamOrderNumReduce(),
|
| | | null);
|
| | | BasicDBList objects = (BasicDBList) collection.group(xx);
|
| | |
|
| | | List<OrderMoneyDailyCount> results = new ArrayList<>();
|
| | |
| | | if (dbObject == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | Object object = dbObject.get("yearMonth");
|
| | | if (object == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | OrderMoneyDailyCount dailyCount = new OrderMoneyDailyCount();
|
| | | dailyCount.setYearMonth(object.toString());
|
| | | dailyCount.setDirectOrderNum(new BigDecimal(dbObject.get("directOrderNum").toString()).intValue());
|
| | | dailyCount.setInDirectOrderNum(new BigDecimal(dbObject.get("inDirectOrderNum").toString()).intValue());
|
| | | dailyCount.setBeyondOrderNum(new BigDecimal(dbObject.get("beyondOrderNum").toString()).intValue());
|
| | | |
| | |
|
| | | results.add(dailyCount);
|
| | | }
|
| | | }
|
| | | return results;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 统计每月订单收入、数量
|
| | | * @param uid
|
| | |
| | | // 进行按天、周、月分组
|
| | | BasicDBObject agg = new BasicDBObject("uid", "");
|
| | | DBCollection collection = mongoTemplate.getCollection(collectionName);
|
| | | GroupCommand xx = new GroupCommand(collection, agg, query.getQueryObject(), initial, getTeamOrderNumReduce(), null);
|
| | | GroupCommand xx = new GroupCommand(collection, agg, query.getQueryObject(), initial, getTeamOrderNumReduce(),
|
| | | null);
|
| | | BasicDBList objects = (BasicDBList) collection.group(xx);
|
| | |
|
| | | List<OrderMoneyDailyCount> results = new ArrayList<>();
|
| | |
| | | if (dbObject == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | Object object = dbObject.get("uid");
|
| | | if (object == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | OrderMoneyDailyCount dailyCount = new OrderMoneyDailyCount();
|
| | | dailyCount.setDirectOrderNum(new BigDecimal(dbObject.get("directOrderNum").toString()).intValue());
|
| | | dailyCount.setInDirectOrderNum(new BigDecimal(dbObject.get("inDirectOrderNum").toString()).intValue());
|
| | | dailyCount.setBeyondOrderNum(new BigDecimal(dbObject.get("beyondOrderNum").toString()).intValue());
|
| | | |
| | |
|
| | | results.add(dailyCount);
|
| | | }
|
| | | }
|
| | | return results;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 根据订单排行榜进行uid分组订单数量排序
|
| | | * @param uid
|
| | |
| | | * @return
|
| | | */
|
| | | public List<OrderRankingVO> getRankingByOrderNum(Long uid, Date minDate, Date maxDate) {
|
| | | LookupOperation lookupToLots = LookupOperation.newLookup().
|
| | | from("order_money_daily_count").//关联表名,多方
|
| | | localField("workerUid").// 主表关联字段
|
| | | foreignField("uid").// 次表字段关联字段
|
| | | as("orders"); // 次表的别名
|
| | | LookupOperation lookupToLots = LookupOperation.newLookup().from("order_money_daily_count").// 关联表名,多方
|
| | | localField("workerUid").// 主表关联字段
|
| | | foreignField("uid").// 次表字段关联字段
|
| | | as("orders"); // 次表的别名
|
| | |
|
| | | // 查询条件
|
| | | List<Criteria> list = new ArrayList<Criteria>();
|
| | |
| | | cas[i] = list.get(i);
|
| | | // 查询参数
|
| | | Criteria criteria = new Criteria().andOperator(cas);
|
| | | |
| | | |
| | | List<AggregationOperation> aggs = new ArrayList<>(); |
| | | // 左连接
|
| | | aggs.add(lookupToLots); |
| | | // 拆分子数组
|
| | | aggs.add(Aggregation.unwind("orders"));
|
| | | // 条件匹配
|
| | | aggs.add(Aggregation.match(criteria)); |
| | | // 需要返回的字段
|
| | | aggs.add(Aggregation.project().and("workerUid").as("workerUid").and("level").as("level")
|
| | | .and("orders.orderNum").as("number"));
|
| | | // 分组求和并返回
|
| | | aggs.add(Aggregation.group("workerUid").first("workerUid").as("workerUid").first("level").as("level")
|
| | | .sum("number").as("number")); |
| | | // 排序
|
| | | aggs.add(Aggregation.sort(new Sort(Sort.Direction.DESC, "number"))); |
| | | aggs.add(Aggregation.limit(10)); |
| | | |
| | | // 组织条件
|
| | | Aggregation agg = Aggregation.newAggregation(aggs); |
| | | // 执行查询
|
| | | AggregationResults<BasicDBObject> results = mongoTemplate.aggregate(agg, "threeSaleDetail", BasicDBObject.class);
|
| | | |
| | | // 返回结果处理
|
| | | List<BasicDBObject> livevideo = results.getMappedResults();
|
| | | |
| | | List<OrderRankingVO> resultList = new ArrayList<>();
|
| | | for (BasicDBObject obj : livevideo) {
|
| | |
|
| | | List<AggregationOperation> aggs = new ArrayList<>();
|
| | | // 左连接
|
| | | aggs.add(lookupToLots);
|
| | | // 拆分子数组
|
| | | aggs.add(Aggregation.unwind("orders"));
|
| | | // 条件匹配
|
| | | aggs.add(Aggregation.match(criteria));
|
| | | // 需要返回的字段
|
| | | aggs.add(Aggregation.project().and("workerUid").as("workerUid").and("level").as("level").and("orders.orderNum")
|
| | | .as("number"));
|
| | | // 分组求和并返回
|
| | | aggs.add(Aggregation.group("workerUid").first("workerUid").as("workerUid").first("level").as("level")
|
| | | .sum("number").as("number"));
|
| | | // 排序
|
| | | aggs.add(Aggregation.sort(new Sort(Sort.Direction.DESC, "number")));
|
| | | aggs.add(Aggregation.limit(10));
|
| | |
|
| | | // 组织条件
|
| | | Aggregation agg = Aggregation.newAggregation(aggs);
|
| | | // 执行查询
|
| | | AggregationResults<BasicDBObject> results = mongoTemplate.aggregate(agg, "threeSaleDetail",
|
| | | BasicDBObject.class);
|
| | |
|
| | | // 返回结果处理
|
| | | List<BasicDBObject> livevideo = results.getMappedResults();
|
| | |
|
| | | List<OrderRankingVO> resultList = new ArrayList<>();
|
| | | for (BasicDBObject obj : livevideo) {
|
| | | Object object = obj.get("workerUid");
|
| | | if (object == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | OrderRankingVO vo = new OrderRankingVO();
|
| | | vo.setUid(new BigDecimal(obj.get("workerUid").toString()).longValue());
|
| | | vo.setGrade(new BigDecimal(obj.get("level").toString()).intValue());
|
| | | vo.setNumber(new BigDecimal(obj.get("number").toString()).intValue());
|
| | | resultList.add(vo); |
| | | resultList.add(vo);
|
| | | }
|
| | | return resultList;
|
| | | return resultList;
|
| | | }
|
| | | }
|
| | |
| | | @Field
|
| | | private Integer orderNumTeam; // 订单数量-团队(二级内)
|
| | | @Field
|
| | | private Integer teamReward; // 团队奖励 X 100 |
| | | private Integer teamReward; // 团队奖励 X 100
|
| | | @Field
|
| | | private Integer teamRewardNum; // 团队奖励订单数量
|
| | | @Field
|
| | |
| | | @Field
|
| | | private Integer teamSubsidyNum; // 团队补贴订单数量
|
| | | @Field
|
| | | private Integer teamDividentsOrderNum;// 参与分红的订单数量
|
| | | @Field
|
| | | private Integer directOrderNum;// 直接订单数量
|
| | | @Field
|
| | | private Integer inDirectOrderNum;// 间接订单数量
|
| | | @Field
|
| | | private Integer beyondOrderNum;// 二级外订单数量
|
| | | |
| | | |
| | | public OrderMoneyDailyCount() {}
|
| | | |
| | |
|
| | | public OrderMoneyDailyCount() {
|
| | | }
|
| | |
|
| | | public OrderMoneyDailyCount(Integer directOrderNum, Integer inDirectOrderNum, Integer beyondOrderNum) {
|
| | | this.directOrderNum = directOrderNum;
|
| | | this.inDirectOrderNum = inDirectOrderNum;
|
| | | this.beyondOrderNum = beyondOrderNum;
|
| | | }
|
| | | |
| | |
|
| | | public Integer getDirectOrderNum() {
|
| | | return directOrderNum;
|
| | |
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public Integer getTeamDividentsOrderNum() {
|
| | | return teamDividentsOrderNum;
|
| | | }
|
| | |
|
| | | public void setTeamDividentsOrderNum(Integer teamDividentsOrderNum) {
|
| | | this.teamDividentsOrderNum = teamDividentsOrderNum;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.job.goods;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | */
|
| | | @XxlJob("updateJDOrderHandler")
|
| | | public ReturnT<String> updateJDSoonOrder(String param) throws Exception {
|
| | | if ("1".equalsIgnoreCase(param)) {//更新本小时内的单
|
| | | if ("1".equalsIgnoreCase(param)) {// 更新本小时内的单
|
| | | LogHelper.job("开始爬取京东订单");
|
| | | long now = System.currentTimeMillis();
|
| | |
|
| | |
| | | saveJDOrders(result.getOrderList());
|
| | | } else if ("1hour".equalsIgnoreCase(param)) {// 更新1小时内的订单
|
| | | updateUpdateOrder();
|
| | | } else if ("1day".equalsIgnoreCase(param)) {// 更新1小时内的订单
|
| | | updateLatestDayOrder(new Date(System.currentTimeMillis()));
|
| | | } else if ("3day".equalsIgnoreCase(param)) {// 更新最近3天更新的数据
|
| | | updateLatest3DayOrder();
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 更新最近一天的数据
|
| | | * |
| | | * @param date
|
| | | */
|
| | | public void updateLatestDayOrder(Date date) {
|
| | | Date now = new Date();
|
| | | List<JDOrder> orderList = new ArrayList<>();
|
| | | Date startTime = new Date(date.getTime() - 1000 * 60 * 60 * 24L);
|
| | | // 一个小时为一个步长
|
| | | for (int i = 0; i < 24; i++) {
|
| | | Date da = new Date(startTime.getTime() + 1000 * 60 * 60L * i);
|
| | | if (da.getTime() > now.getTime())
|
| | | break;
|
| | | List<JDOrder> tempOrderList = getHourOrder(da);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | saveJDOrders(orderList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 更新最近3天的订单(每天早上凌晨0点过10分,早上8点过10分)
|
| | | */
|
| | | public void updateLatest3DayOrder() {
|
| | |
| | |
|
| | | private static Logger userProtocolListenLog = Logger.getLogger("userProtocolListenLog");
|
| | |
|
| | | private static Logger teamLogger = Logger.getLogger("teamLog");
|
| | | |
| | |
|
| | | public static void userProtocolListen(Object obj) {
|
| | | userProtocolListenLog.info(obj);
|
| | |
| | | if (info != null)
|
| | | smsLogger.info(info);
|
| | | }
|
| | | |
| | |
|
| | | public static void teamInfo(String info) {
|
| | | if (info != null)
|
| | | teamLogger.info(info);
|
| | | }
|
| | |
|
| | | public static void requestTime(String url, Map<String, Object> params, long time) {
|
| | | String paramsStr = "";
|
| | |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_income where ti_uid = #{uid} and ti_type=#{type} |
| | | and ti_pre_recieve_time=#{preRecieveTime} |
| | | and ti_pre_recieve_time=#{preRecieveTime} |
| | | </select> |
| | | |
| | | <select id="selectByUidAndPreRecieveTimeAndTypeAndSourceType" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_income where ti_uid = #{uid} and ti_type=#{type} |
| | | and ti_pre_recieve_time=#{preRecieveTime} and ti_source_type=#{sourceType} |
| | | </select> |
| | | |
| | | |
| | |
| | | |
| | | <select id="sumRecieveByType" resultType="BigDecimal"> |
| | | SELECT SUM(ti_money) FROM yeshi_ec_team_income |
| | | WHERE ti_uid=#{uid} AND ti_type=#{type} AND ti_state=1 |
| | | WHERE ti_uid=#{uid} AND ti_type=#{type} AND ti_state=2 |
| | | </select> |
| | | |
| | | |
| | |
| | | <select id="listDividentsOrderByCreateTime" resultMap="BaseResultMap"> |
| | | SELECT |
| | | ou.`sou_target_uid` AS uid, DATE(tdo_create_time) AS |
| | | `day`,ou.`sou_type` AS `type`,SUM(TRUNCATE(ou.`sou_money`,2)) AS money,COUNT(*) AS |
| | | orderCount FROM `yeshi_ec_team_dividents_source_order_user` ou LEFT JOIN yeshi_ec_team_dividents_source_order o ON ou.`sou_source_order_id`=o.`tdo_id` WHERE |
| | | `day`,ou.`sou_type` AS `type`,SUM(TRUNCATE(ou.`sou_money`,2)) AS |
| | | money,COUNT(*) AS |
| | | orderCount FROM |
| | | `yeshi_ec_team_dividents_source_order_user` ou LEFT JOIN |
| | | yeshi_ec_team_dividents_source_order o ON |
| | | ou.`sou_source_order_id`=o.`tdo_id` WHERE |
| | | ou.`sou_state`!=4 AND tdo_create_time>=#{minTime} and |
| | | #{maxTime}>tdo_create_time |
| | | GROUP BY ou.`sou_target_uid`, |
| | | GROUP BY |
| | | ou.`sou_target_uid`, |
| | | DATE(tdo_create_time),ou.`sou_type` |
| | | </select> |
| | | |
| | | |
| | | <select id="listDividentsOrderCountByCreateTime" resultMap="BaseResultMap"> |
| | | SELECT |
| | | ou.`sou_target_uid` AS uid, DATE(tdo_create_time) AS |
| | | `day`,COUNT(DISTINCT(CONCAT(O.`tdo_order_no`,O.`tdo_source_type`))) AS |
| | | orderCount |
| | | FROM `yeshi_ec_team_dividents_source_order_user` ou |
| | | |
| | | LEFT JOIN yeshi_ec_team_dividents_source_order o ON |
| | | ou.`sou_source_order_id`=o.`tdo_id` |
| | | |
| | | WHERE |
| | | ou.`sou_state`!=4 AND tdo_create_time>=#{minTime} AND |
| | | #{maxTime}>tdo_create_time |
| | | GROUP BY ou.`sou_target_uid`, |
| | | DATE(tdo_create_time) |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | || record.getPreRecieveTime() == null)
|
| | | throw new ParamsException(1, "参数不完整");
|
| | |
|
| | | TeamEincomeRecord oldRecord = teamEincomeRecordMapper.selectByUidAndPreRecieveTimeAndType(record.getUid(),
|
| | | record.getPreRecieveTime(), record.getType());
|
| | | TeamEincomeRecord oldRecord = teamEincomeRecordMapper.selectByUidAndPreRecieveTimeAndTypeAndSourceType(record.getUid(),
|
| | | record.getPreRecieveTime(), record.getType(),record.getSourceType());
|
| | | if (oldRecord != null)
|
| | | throw new TeamEincomeRecordException(1, "已存在");
|
| | | if (record.getCreateTime() == null)
|
| | |
| | | import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg; |
| | | import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo; |
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | |
| | | import com.yeshi.fanli.entity.order.HongBaoOrder; |
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy; |
| | | import com.yeshi.fanli.entity.pdd.PDDOrder; |
| | | import com.yeshi.fanli.entity.suning.SuningOrderInfo; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; |
| | |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory; |
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName; |
| | | import com.yeshi.fanli.util.suning.SuningApiUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.util.user.UserLevelUtil; |
| | |
| | | List<Integer> listSource) throws CommonOrderException, Exception { |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | |
| | | |
| | | List<CommonOrderVO> listOrder = commonOrderMapper.listUserOrder((page - 1) * pageSize, pageSize, uid, state, |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource); |
| | | |
| | |
| | | return commonOrderList; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public List<CommonOrderAddResultDTO> addSuningOrder(List<SuningOrderInfo> suningOrderList, Long uid) |
| | | throws CommonOrderException { |
| | | List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>(); |
| | | // 判断所有的订单状态 |
| | | int invalidCount = 0; |
| | | for (SuningOrderInfo order : suningOrderList) { |
| | | if ("退款".equalsIgnoreCase(order.getOrderLineStatusDesc()) |
| | | || "订单已取消".equalsIgnoreCase(order.getOrderLineStatusDesc())) { |
| | | invalidCount++; |
| | | } |
| | | } |
| | | // 获取整体订单的状态 |
| | | int wholeOrderState = 0; |
| | | if (suningOrderList.size() == invalidCount) |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_SHIXIAO; |
| | | else if (invalidCount == 0) |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_YOUXIAO; |
| | | else |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO; |
| | | |
| | | for (SuningOrderInfo suningOrderInfo : suningOrderList) { |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(suningOrderInfo); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | cog.setGoodsId(suningOrderInfo.getGoodsNum() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_SUNING); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | newCommonOrder.setStateWholeOrder(wholeOrderState); |
| | | // 订单商品插入 |
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(), |
| | | cog.getGoodsType()); |
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品 |
| | | { |
| | | SuningGoodsInfo pddGoods = null; |
| | | // TODO 需要获取 |
| | | pddGoods = SuningApiUtil.getGoodsDetail(suningOrderInfo.getGoodsNum(), "00000000"); |
| | | if (pddGoods != null) { |
| | | cog = CommonOrderGoodsFactory.create(pddGoods); |
| | | } |
| | | cog.setCreateTime(new Date()); |
| | | cog.setUpdateTime(new Date()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | } else { |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | } |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | | } |
| | | |
| | | /** |
| | | * 添加订单 |
| | | * |
| | |
| | | List<Integer> listSource, boolean notBackSuVip) throws CommonOrderException, Exception { |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | |
| | | |
| | | List<CommonOrderVO> listOrder = commonOrderMapper.getOrderList((page - 1) * pageSize, pageSize, uid, state, |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource,notBackSuVip); |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource, notBackSuVip); |
| | | |
| | | // 订单信息为空 |
| | | if (listOrder == null || listOrder.size() == 0) { |
| | |
| | | |
| | | @Override |
| | | public long countOrderList(Long uid, Integer state, Integer type, Integer orderState, String orderNo, |
| | | String startTime, String endTime, Integer dateType, List<Integer> listSource, boolean notBackSuVip) throws CommonOrderException { |
| | | String startTime, String endTime, Integer dateType, List<Integer> listSource, boolean notBackSuVip) |
| | | throws CommonOrderException { |
| | | return commonOrderMapper.countOrderList(uid, state, type, orderState, orderNo, startTime, endTime, dateType, |
| | | listSource, notBackSuVip); |
| | | } |
| | |
| | | |
| | | if (record.getBeyondOrderNum() == null) |
| | | record.setBeyondOrderNum(0); |
| | | |
| | | if(record.getTeamDividentsOrderNum()==null) |
| | | record.setTeamDividentsOrderNum(0); |
| | | } |
| | | |
| | | @Override |
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if(hongBaoList.size()==0)
|
| | | return;
|
| | |
|
| | | String taskKey = getTaskKey(uid);
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if(hongBaoList.size()==0)
|
| | | return;
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if(hongBaoList.size()==0)
|
| | | return;
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | | String taskKey = getTaskKey(uid);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if(hongBaoList.size()==0)
|
| | | return;
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | | String taskKey = getTaskKey(uid);
|
| | |
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.suning.SuningOrderInfo;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.suning.SuningApiUtil;
|
| | | import com.yeshi.fanli.util.vipshop.VipShopUtil;
|
| | |
|
| | | @Service
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | // @Transactional(rollbackFor = Exception.class)
|
| | | public void fanliPreInvaite(Long uid, Date maxPreGetTime) {
|
| | | // 邀请赚到账
|
| | | try {
|
| | |
| | | order.setCreatetime(System.currentTimeMillis());
|
| | | order.setOrderId(vipShopOrder.getOrderSn() + "");
|
| | | order.setOrderType(Constant.SOURCE_TYPE_VIP);
|
| | | order.setState(invalidCount == vipShopOrder.getDetailList().size() ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU);
|
| | | order.setState(
|
| | | invalidCount == vipShopOrder.getDetailList().size() ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU);
|
| | | order.setUserInfo(new UserInfo(uid));
|
| | | order.setVersion(2);
|
| | | order.setThirdCreateTime(new Date(vipShopOrder.getOrderTime()));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理苏宁订单
|
| | | */
|
| | | @Override
|
| | | public void processSuningOrder(SuningOrderInfo suningOrder) {
|
| | | if (suningOrder == null)
|
| | | return;
|
| | | String uidStr = suningOrder.getChildAccountId();
|
| | | Long uid = null;
|
| | | if (!StringUtil.isNullOrEmpty(uidStr))
|
| | | uid = Long.parseLong(uidStr);
|
| | | String positionId = suningOrder.getPositionId();
|
| | | if (SuningApiUtil.PID_BUY.equalsIgnoreCase(positionId))// 返利订单
|
| | | {
|
| | | processFanLiSuningOrder(suningOrder, uid);
|
| | | lostOrderService.processSuceess(suningOrder.getOrderCode(), Constant.SOURCE_TYPE_SUNING);
|
| | | } else if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId)) {// 分享订单
|
| | | if (uid == null)// 分享订单不允许找回
|
| | | return;
|
| | | processShareSuningOrder(suningOrder, uid);
|
| | | } else {// 处理是否有订单找回的状态
|
| | | processFanLiSuningOrder(suningOrder, null);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理拼多多自购返利订单
|
| | | * |
| | | * @param pddOrder
|
| | | * @param uid
|
| | | */
|
| | | @Transactional
|
| | | private void processFanLiSuningOrder(SuningOrderInfo suningOrder, Long uid) {
|
| | | int orderState = 0;
|
| | |
|
| | | // 等待付款;支付完成;退款;订单已取消;确认收货
|
| | |
|
| | | if ("订单已取消".equalsIgnoreCase(suningOrder.getOrderLineStatusDesc())
|
| | | || "退款".equalsIgnoreCase(suningOrder.getOrderLineStatusDesc()))
|
| | | orderState = Order.STATE_SHIXIAO;
|
| | | else
|
| | | orderState = Order.STATE_YIZHIFU;
|
| | |
|
| | | BigDecimal totalMoney = new BigDecimal(suningOrder.getPayAmount());
|
| | |
|
| | | // 加入订单
|
| | | Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(suningOrder.getOrderCode(),
|
| | | Constant.SOURCE_TYPE_SUNING);
|
| | | if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("补单"))
|
| | | uid = oldOrder.getUserInfo().getId();
|
| | |
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | if (oldOrder == null)// 新增
|
| | | {
|
| | | Order order = new Order();
|
| | | order.setBeizhu("苏宁返利订单");
|
| | | order.setCreatetime(System.currentTimeMillis());
|
| | | order.setOrderId(suningOrder.getOrderCode());
|
| | | order.setOrderType(Constant.SOURCE_TYPE_SUNING);
|
| | | order.setState(orderState);
|
| | | order.setUserInfo(new UserInfo(uid));
|
| | | order.setVersion(2);
|
| | | order.setThirdCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(suningOrder.getOrderSubmitTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | order.setMoney(totalMoney);
|
| | | // 加入到订单表
|
| | | orderMapper.insertSelective(order);
|
| | | } else {
|
| | | Order updateOrder = new Order();
|
| | | updateOrder.setId(oldOrder.getId());
|
| | | updateOrder.setMoney(totalMoney);
|
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | | }
|
| | |
|
| | | try {
|
| | | List<SuningOrderInfo> pddOrderList = new ArrayList<>();
|
| | | pddOrderList.add(suningOrder);
|
| | | List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addSuningOrder(pddOrderList, uid);
|
| | | addHongBaoWithMQ(commonOrderList, suningOrder.getOrderCode(), uid, Constant.SOURCE_TYPE_SUNING,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | if (isCommonOrderAllAdd(commonOrderList)) {
|
| | | Order order = new Order();
|
| | | order.setOrderId(suningOrder.getOrderCode());
|
| | | order.setOrderType(Constant.SOURCE_TYPE_SUNING);
|
| | | order.setUserInfo(new UserInfo(uid));
|
| | | try {
|
| | | if (Constant.ENABLE_MQ)
|
| | | PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | | } catch (CommonOrderException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, "addPDDOrder或addHongBao出错", "订单号:" + suningOrder.getOrderCode());
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理拼多多分享订单
|
| | | * |
| | | * @param order
|
| | | * @param uid
|
| | | */
|
| | | @Transactional
|
| | | private void processShareSuningOrder(SuningOrderInfo suningOrder, Long uid) {
|
| | | try {
|
| | | List<SuningOrderInfo> suningOrderList = new ArrayList<>();
|
| | | suningOrderList.add(suningOrder);
|
| | | List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addSuningOrder(suningOrderList, uid);
|
| | | addHongBaoWithMQ(commonOrderList, suningOrder.getOrderCode(), uid, Constant.SOURCE_TYPE_SUNING,
|
| | | HongBaoV2.TYPE_SHARE_GOODS);
|
| | | if (isCommonOrderAllAdd(commonOrderList)) {
|
| | | Order order = new Order();
|
| | | order.setOrderId(suningOrder.getOrderCode());
|
| | | order.setOrderType(Constant.SOURCE_TYPE_SUNING);
|
| | | order.setUserInfo(new UserInfo(uid));
|
| | | try {
|
| | | if (Constant.ENABLE_MQ)
|
| | | PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | | } catch (CommonOrderException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + suningOrder.getOrderCode());
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void repairCommonOrderByByTaoBaoOrder(String orderId) {
|
| | | // 根据订单号查询淘宝订单
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleDetail;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | |
|
| | |
| | | @Override
|
| | | public void addByWorkerUid(Long workerUid) {
|
| | | List<ThreeSale> list = threeSaleSerivce.getMyBossDeepList(workerUid, 100);
|
| | | LogHelper.teamInfo(String.format("邀请详细信息: 用户ID:%s 上级数量:%s",workerUid+"",list.size()));
|
| | | int level = 0;
|
| | | for (ThreeSale tts : list) {
|
| | | level++;
|
| | |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.order.ESOrder; |
| | | import com.yeshi.fanli.entity.pdd.PDDOrder; |
| | | import com.yeshi.fanli.entity.suning.SuningOrderInfo; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder; |
| | | import com.yeshi.fanli.entity.vipshop.VipShopOrder; |
| | |
| | | * @throws |
| | | */ |
| | | public List<CommonOrderAddResultDTO> addVipShopOrder(VipShopOrder order, Long uid) throws CommonOrderException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加苏宁订单 |
| | | * @Title: addVipShopOrder |
| | | * @Description: |
| | | * @param order |
| | | * @param uid |
| | | * @return |
| | | * @throws CommonOrderException |
| | | * List<CommonOrderAddResultDTO> 返回类型 |
| | | * @throws |
| | | */ |
| | | public List<CommonOrderAddResultDTO> addSuningOrder(List<SuningOrderInfo> suningOrderList, Long uid) throws CommonOrderException; |
| | | |
| | | |
| | | /** |
| | | * 根据用户ID,订单状态,结算时间统计订单数量 |
| | |
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.suning.SuningOrderInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.entity.vipshop.VipShopOrder;
|
| | |
| | | /**
|
| | | * 处理唯品会订单
|
| | | *
|
| | | * @param pddOrder
|
| | | * @param vipShopOrder
|
| | | */
|
| | | public void processVipShopOrder(VipShopOrder vipShopOrder);
|
| | | |
| | | |
| | | /**
|
| | | * 处理苏宁订单
|
| | | * |
| | | * @param suningOrder
|
| | | */
|
| | | public void processSuningOrder(SuningOrderInfo suningOrder);
|
| | |
|
| | |
|
| | | /**
|
| | | * 根据淘宝订单的排序值修复常规订单的排序值
|
| | |
| | | public void syncDividents(Date minTime, Date maxTime) {
|
| | | List<UserOrderDailyStatisticDTO> list = userOrderDailyStatisticMapper.listDividentsOrderByCreateTime(minTime,
|
| | | maxTime);
|
| | |
|
| | | List<UserOrderDailyStatisticDTO> countList = userOrderDailyStatisticMapper
|
| | | .listDividentsOrderCountByCreateTime(minTime, maxTime);
|
| | | Map<String, Integer> countMap = new HashMap<>();
|
| | | for (UserOrderDailyStatisticDTO dto : countList) {
|
| | | countMap.put(dto.getDay() + "#" + dto.getUid(), dto.getOrderCount());
|
| | | }
|
| | |
|
| | | if (list != null)
|
| | | for (UserOrderDailyStatisticDTO dto : list) {
|
| | | OrderMoneyDailyCount count = new OrderMoneyDailyCount();
|
| | |
| | | count.setTeamSubsidyNum(dto.getOrderCount());
|
| | | }
|
| | |
|
| | | Integer totalCount = countMap.get(dto.getDay() + "#" + dto.getUid());
|
| | | if(totalCount!=null){
|
| | | count.setTeamDividentsOrderNum(totalCount);
|
| | | }
|
| | |
|
| | | count.setYearMonth(
|
| | | TimeUtil.getGernalTime(TimeUtil.convertToTimeTemp(dto.getDay(), "yyyy-MM-dd"), "yyyy-MM"));
|
| | | if(dto.getDay().equalsIgnoreCase("2020-05-03")&&dto.getUid()==389677L){
|
| | | if (dto.getDay().equalsIgnoreCase("2020-05-03") && dto.getUid() == 389677L) {
|
| | | System.out.println(dto);
|
| | | }
|
| | | |
| | |
|
| | | orderMoneyDailyCountService.saveDailyCount(count);
|
| | |
|
| | | }
|
| | |
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | | import org.yeshi.utils.tencentcloud.entity.COSInitParams;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.ad.DouYinDeviceActiveQueueDTO;
|
| | | import com.yeshi.fanli.dto.money.UserMoneyChangeDTO;
|
| | | import com.yeshi.fanli.dto.mq.UidDateDTO;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.entity.vipshop.VipShopOrder;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.vipshop.VipShopOrderService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | |
| | | import com.yeshi.fanli.util.cmq.order.PDDOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.order.PlaceOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.order.TeamOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.order.VipShopOrderCMQManager;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | /**
|
| | |
| | | @Resource
|
| | | private TeamEincomeManager teamEincomeManager;
|
| | |
|
| | | @Resource
|
| | | private VipShopOrderService vipShopOrderService;
|
| | | // @Resource
|
| | | // private VipShopOrderService vipShopOrderService;
|
| | |
|
| | | private static boolean isInited = false;
|
| | |
|
| | |
| | | doTaoBaoOrders();// 处理淘宝订单
|
| | | doTaoBaoNewOrders();// 处理淘宝订单(刚刚产生的)
|
| | | doOrderFanLiNew();// 新版返利
|
| | |
|
| | | doOrderShareFanLi();
|
| | | doWeiQuanOrder();// 处理维权订单
|
| | | doPushIOS();// 处理发送IOS消息
|
| | |
| | | doUpdateGoodsJob(); // 更新商品队列
|
| | | doJDOrderJob();// 京东订单处理
|
| | | doPDDOrderJob();// 拼多多订单处理
|
| | | doVipShopOrderJob();// 唯品会订单处理
|
| | | // doVipShopOrderJob();// 唯品会订单处理
|
| | | doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
|
| | | doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | // doPlaceOrderIntegralJob();// 下单赠送金币任务
|
| | |
| | | doOrderTeamIncomeFanLi();
|
| | | doDividentsJob();
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | TeamOrderCMQManager.getInstance().deleteTeamIncomePreMsg(handler);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, map.get(handler).toString(), "");
|
| | | LogHelper.errorDetailInfo(e,new Gson().toJson(map.get(handler)).toString(), "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public void doVipShopOrderJob() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | try {
|
| | | Map<String, String> map = VipShopOrderCMQManager.getInstance().consumeVipShopOrder(16);
|
| | | if (map != null) {
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | try {
|
| | | String orderId = map.get(key);
|
| | | if (!StringUtil.isNullOrEmpty(orderId)) {
|
| | | List<VipShopOrder> orderList = vipShopOrderService.listByOrderSn(orderId);
|
| | | if (orderList != null)
|
| | | for (VipShopOrder order : orderList)
|
| | | orderProcessService.processVipShopOrder(order);
|
| | | }
|
| | | VipShopOrderCMQManager.getInstance().deleteVipShopOrder(key);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("拼多多订单:" + e.getMessage());
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | | // public void doVipShopOrderJob() {
|
| | | // executor.execute(new Runnable() {
|
| | | // @Override
|
| | | // public void run() {
|
| | | // while (true) {
|
| | | // try {
|
| | | // Map<String, String> map = VipShopOrderCMQManager.getInstance().consumeVipShopOrder(16);
|
| | | // if (map != null) {
|
| | | // Iterator<String> its = map.keySet().iterator();
|
| | | // while (its.hasNext()) {
|
| | | // String key = its.next();
|
| | | // try {
|
| | | // String orderId = map.get(key);
|
| | | // if (!StringUtil.isNullOrEmpty(orderId)) {
|
| | | // List<VipShopOrder> orderList = vipShopOrderService.listByOrderSn(orderId);
|
| | | // if (orderList != null)
|
| | | // for (VipShopOrder order : orderList)
|
| | | // orderProcessService.processVipShopOrder(order);
|
| | | // }
|
| | | // VipShopOrderCMQManager.getInstance().deleteVipShopOrder(key);
|
| | | // } catch (Exception e) {
|
| | | // LogHelper.errorDetailInfo(e);
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // } catch (Exception e) {
|
| | | // LogHelper.error("拼多多订单:" + e.getMessage());
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // });
|
| | | //
|
| | | // }
|
| | |
|
| | | /**
|
| | | * 重要的淘宝商品信息更新
|
| | |
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
|
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | |
| | | return goods;
|
| | | }
|
| | |
|
| | | public static CommonOrderGoods create(SuningGoodsInfo suningGoods) {
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(suningGoods.getCommodityInfo().getCommodityCode());
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_SUNING);
|
| | | if (suningGoods.getCommodityInfo().getPictureUrl().size() > 0)
|
| | | goods.setPicture(suningGoods.getCommodityInfo().getPictureUrl().get(0).getPicUrl());
|
| | | goods.setPrice(new BigDecimal(suningGoods.getCommodityInfo().getCommodityPrice()));
|
| | | goods.setShopId(Long.parseLong(suningGoods.getCommodityInfo().getSupplierCode()));
|
| | | goods.setShopName(suningGoods.getCommodityInfo().getSupplierName());
|
| | | goods.setShopType("苏宁");
|
| | | goods.setState(0);
|
| | | goods.setTitle(suningGoods.getCommodityInfo().getCommodityName());
|
| | | return goods;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.suning.SuningOrderInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.vipshop.VipShopOrderDetail;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | commonOrder.setChildSourceType("唯品会");
|
| | | return commonOrder;
|
| | | }
|
| | |
|
| | | public static CommonOrder create(SuningOrderInfo order) {
|
| | | CommonOrder commonOrder = new CommonOrder();
|
| | | commonOrder.setCount(Integer.parseInt(order.getSaleNum()));
|
| | | commonOrder.setCreateTime(new Date());
|
| | | if ("确认收货".equalsIgnoreCase(order.getOrderLineStatusDesc())) {
|
| | | commonOrder.seteIncome(new BigDecimal(order.getPrePayCommission()));
|
| | | commonOrder.setSettlement(new BigDecimal(order.getPayAmount()));
|
| | | commonOrder.setSettleTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(order.getOrderLineStatusChangeTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | }
|
| | | commonOrder.setOrderNo(order.getOrderCode() + "");
|
| | | commonOrder.setPayment(new BigDecimal(order.getPayAmount()));
|
| | | commonOrder.setSourcePosition(order.getPositionId());
|
| | | commonOrder.setSourceType(Constant.SOURCE_TYPE_SUNING);
|
| | | int state = 0;
|
| | | if ("等待付款".equalsIgnoreCase(order.getOrderLineStatusDesc()))
|
| | | state = CommonOrder.STATE_FK;
|
| | | else if ("支付完成".equalsIgnoreCase(order.getOrderLineStatusDesc()))
|
| | | state = CommonOrder.STATE_FK;
|
| | | else if ("退款".equalsIgnoreCase(order.getOrderLineStatusDesc()))
|
| | | state = CommonOrder.STATE_SX;
|
| | | else if ("订单已取消".equalsIgnoreCase(order.getOrderLineStatusDesc()))
|
| | | state = CommonOrder.STATE_SX;
|
| | | else if ("确认收货".equalsIgnoreCase(order.getOrderLineStatusDesc()))
|
| | | state = CommonOrder.STATE_JS;
|
| | |
|
| | | commonOrder.setOrderBy(1);
|
| | | commonOrder.setState(state);
|
| | | commonOrder.setThirdCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(order.getOrderSubmitTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrder.setTradeId(order.getOrderLineNumber());
|
| | | commonOrder.setEstimate(new BigDecimal(order.getPrePayCommission()));
|
| | | commonOrder.setChildSourceType("苏宁");
|
| | | return commonOrder;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.jd.JDPingouInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsImg;
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
|
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | |
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
|
| | | import com.yeshi.fanli.util.suning.SuningUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoCouponUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.vipshop.VipShopUtil;
|
| | |
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | public static GoodsDetailVO convertSuningGoods(SuningGoodsInfo goods, ConfigParamsDTO params) {
|
| | | GoodsDetailVO goodsInfo = new GoodsDetailVO();
|
| | | goodsInfo.setBaoyou(true);
|
| | | goodsInfo.setGoodsType(Constant.SOURCE_TYPE_SUNING);
|
| | | goodsInfo.setGoodsId(Long.parseLong(goods.getCommodityInfo().getCommodityCode()));
|
| | | goodsInfo.setTitle(goods.getCommodityInfo().getCommodityName());
|
| | | goodsInfo.setSalesType(5); // 无销量
|
| | | goodsInfo.setPriceName("原价");
|
| | | if (goods.getCommodityInfo().getPictureUrl().size() > 0)
|
| | | goodsInfo.setPicUrl(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl()); // 缩略图
|
| | | goodsInfo.setZkPrice(
|
| | | MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getCommodityInfo().getCommodityPrice())));
|
| | | goodsInfo.setShopType(CommonGoods.SHOP_TYPE_SUNING);
|
| | |
|
| | | List<String> imgList = new ArrayList<>();
|
| | | for (SuningGoodsImg img : goods.getCommodityInfo().getPictureUrl()) {
|
| | | imgList.add(img.getPicUrl());
|
| | | }
|
| | |
|
| | | goodsInfo.setImgList(imgList);
|
| | | goodsInfo.setState(0);
|
| | | goodsInfo.setSalesCount(goods.getCommodityInfo().getMonthSales());
|
| | |
|
| | | // 券信息
|
| | | if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getBounsLimit()));
|
| | |
|
| | | if (goods.getCouponInfo().getCouponStartTime() != null) {
|
| | | coupon.setStartTime(goods.getCouponInfo().getCouponStartTime());
|
| | | }
|
| | |
|
| | | if (goods.getCouponInfo().getCouponEndTime() != null) {
|
| | | coupon.setEndTime(goods.getCouponInfo().getCouponEndTime());
|
| | | }
|
| | |
|
| | | if (goods.getCouponInfo().getCouponCount() != null)
|
| | | coupon.setTotalCount(Integer.parseInt(goods.getCouponInfo().getCouponCount()));
|
| | |
|
| | | if (goods.getCouponInfo().getCouponCount() != null)
|
| | | coupon.setLeftCount(Integer.parseInt(goods.getCouponInfo().getCouponCount()));
|
| | |
|
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | } else {
|
| | | goodsInfo.setHasCoupon(false);
|
| | | }
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | BigDecimal commission = SuningUtil.getGoodsFanLiMoney(goods, params.getFanLiRate());
|
| | | moneyInfoVO.setFanliMoney("¥" + commission);
|
| | | moneyInfoVO.setShareMoney("¥" + commission);
|
| | |
|
| | | BigDecimal baseCommisstion = null;
|
| | | if (params.getBaseFanliRate() != null)
|
| | | baseCommisstion = SuningUtil.getGoodsFanLiMoney(goods, params.getBaseFanliRate());
|
| | |
|
| | | if (params.getMaxRewardRate() != null)
|
| | | moneyInfoVO
|
| | | .setMaxMoney("¥" + commission.add(MoneyBigDecimalUtil.mul(commission, params.getMaxRewardRate())));
|
| | | else {
|
| | | BigDecimal price = new BigDecimal(goods.getCommodityInfo().getCommodityPrice());
|
| | | BigDecimal rate = MoneyBigDecimalUtil.div(commission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setRateInfo("返利比 " + rate + "%");
|
| | |
|
| | | BigDecimal maxCommission = SuningUtil.getGoodsFanLiMoney(goods, params.getVipFanLiRate());
|
| | | BigDecimal maxRate = MoneyBigDecimalUtil.div(maxCommission.multiply(new BigDecimal(100)), price);
|
| | | moneyInfoVO.setMaxRateInfo("返利比 " + maxRate + "%");
|
| | |
|
| | | moneyInfoVO.setMaxMoney("¥" + maxCommission);
|
| | |
|
| | | if (baseCommisstion != null) {
|
| | | String desc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | commission.subtract(baseCommisstion).setScale(2).toString());
|
| | | String maxDesc = String.format("佣金¥ %s+平台补贴¥ %s", baseCommisstion.setScale(2).toString(),
|
| | | maxCommission.subtract(baseCommisstion).setScale(2).toString());
|
| | | moneyInfoVO.setCompositionInfo(desc);
|
| | | moneyInfoVO.setMaxCompositionInfo(maxDesc);
|
| | | }
|
| | | }
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | |
|
| | | // 店铺信息
|
| | | String mallName = goods.getCommodityInfo().getSupplierName();
|
| | | if (!StringUtil.isMobile(mallName)) {
|
| | | ShopInfoVO shop = new ShopInfoVO();
|
| | | shop.setShopName(mallName);
|
| | | if (goods.getCommodityInfo().getSupplierCode() != null) {
|
| | | shop.setId(goods.getCommodityInfo().getSupplierCode());
|
| | | }
|
| | | shop.setUserType(30);
|
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.suning;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import org.yeshi.utils.BigDecimalUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | public class SuningUtil {
|
| | | public static BigDecimal getGoodsFanLiMoney(SuningGoodsInfo goods, BigDecimal rate) {
|
| | |
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | rate = MoneyBigDecimalUtil.div(rate, hundred);
|
| | |
|
| | | BigDecimal afterUseCouponPrice = new BigDecimal(goods.getCommodityInfo().getCommodityPrice());
|
| | | if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {
|
| | | // 有券
|
| | | BigDecimal startPrice = new BigDecimal(goods.getCouponInfo().getBounsLimit());
|
| | | if (afterUseCouponPrice.compareTo(startPrice) >= 0) {
|
| | | afterUseCouponPrice = afterUseCouponPrice.subtract(startPrice);
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal money = MoneyBigDecimalUtil.mul(afterUseCouponPrice, rate);
|
| | | return BigDecimalUtil.getWithNoZera(money).setScale(2);
|
| | | }
|
| | | }
|
| | |
| | | private BigDecimal subsidy; // 团队补贴 X 100
|
| | | private Integer subsidyNum; // 团队补贴订单数量
|
| | |
|
| | | public TeamPredictVO() {}
|
| | | |
| | | public TeamPredictVO(BigDecimal reward, Integer rewardNum, BigDecimal subsidy, Integer subsidyNum) {
|
| | | public TeamPredictVO() {
|
| | | }
|
| | |
|
| | | public TeamPredictVO(BigDecimal reward, Integer rewardNum, BigDecimal subsidy, Integer subsidyNum,
|
| | | Integer totalNum) {
|
| | | this.reward = reward;
|
| | | this.rewardNum = rewardNum;
|
| | | this.subsidy = subsidy;
|
| | | this.subsidyNum = subsidyNum;
|
| | | this.totalNum = totalNum;
|
| | | }
|
| | |
|
| | | public String getCountDate() {
|
| | |
| | | log4j.appender.weiQuanLog.layout=org.apache.log4j.PatternLayout
|
| | | log4j.appender.weiQuanLog.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n
|
| | |
|
| | | log4j.logger.teamLog=info,teamLog
|
| | | log4j.appender.teamLog=org.apache.log4j.DailyRollingFileAppender
|
| | | log4j.appender.teamLog.File=logs/team/teamLog.log
|
| | | log4j.appender.teamLog.MaxFileSize=20MB
|
| | | log4j.appender.teamLog.MaxBackupIndex=100
|
| | | log4j.appender.teamLog.layout=org.apache.log4j.PatternLayout
|
| | | log4j.appender.teamLog.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n |
| | |
|
| | |
|
| | | log4j.appender.mongodb=org.apache.log4j.ConsoleAppender
|
| | | log4j.appender.mongodb.Target=System.out
|