/**
   * 查看给点店铺开启的方案作用于给定订单后可以得到的结果
   *
   * @param shopId
   * @param tid
   * @return
   */
  @RequestMapping(value = "/{shopId}/{tid}")
  @ResponseBody
  public ControlerResult test(
      @PathVariable("shopId") final String shopId, @PathVariable("tid") final Long tid) {
    try {
      final RuleEngineSession session = sessionRepository.getSession(shopId);
      final Fact fact = factResolver.resolve(tid);
      if (fact != null) {
        session.execute(fact);
        final FactResult result = fact.getResult();
        if (result.getHits() == 0) {
          return ControlerResult.newSuccess("没有匹配的规则!", fact);
        } else {
          final PlanGroup planGroup = planGroupService.planGroupOfShop(shopId);
          final List<Rule> matchedRules = new ArrayList<Rule>();
          for (final RuleHitDetail detail : result.getHitDetails()) {
            final Rule rule = ruleService.getRule(detail.getRuleId());
            matchedRules.add(rule);
          }

          final String remark = remarkContentBuilder.buildMemoContent(planGroup, matchedRules);
          return ControlerResult.newSuccess(remark, fact);
        }

      } else {
        return ControlerResult.newError("获取订单失败!");
      }
    } catch (final RuleCenterBusinessException e) {
      e.printStackTrace();
      return ControlerResult.newError(e.getMessage());
    } catch (final Exception e) {
      e.printStackTrace();
      return ControlerResult.newError(e.getMessage());
    }
  }
  @ResponseBody
  @RequestMapping(
      value = "/autoBuyerStatistic",
      method = RequestMethod.GET,
      produces = "application/json; charset=utf-8")
  public ControlerResult urpaySummaryList(String dp_id, String end_date, Integer day_num) {
    final Map<String, Object> result = Maps.newHashMap();
    try {
      Date staticEndDate = new Date();
      if (end_date != null) {
        staticEndDate = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss").parse(end_date);
      }
      int days = 3;
      if (day_num != null) {
        days = day_num;
      }
      buyerStatisticService.staticBuyerInteraction(dp_id, days, staticEndDate);
      return ControlerResult.newSuccess(result);
    } catch (final Exception e) {
      logger.info("买家交互信息统计失败 : [{}]", e);
    }
    result.clear();

    result.put("errordesc", "买家交互信息统计成功!");
    return ControlerResult.newSuccess(result);
  }
 @RequestMapping(value = "/customer/{shopId}/{nick}")
 @ResponseBody
 public ControlerResult customer(
     @PathVariable("shopId") final String shopId, @PathVariable("nick") final String nick) {
   final Customer customer = factResolver.getCustomer(nick, shopId);
   final User user = factResolver.getTaobaoUserObject(nick, shopId);
   final Map<String, Object> map = new HashMap<String, Object>();
   map.put("customer", customer);
   map.put("user", user);
   return ControlerResult.newSuccess(map);
 }