Ejemplo n.º 1
0
  private UserAccessInfo genUserAccessInfo(OrdersModel order) {
    UserAccessInfo accessInfo = new UserAccessInfo();
    accessInfo.setTm(DateUtils.formatDateTime(new Date()));
    Baby baby = babyService.getBabyByUidxUid(order.getUserid());
    accessInfo.setPreganancy(baby.getStatus());
    accessInfo.setBabyGender(baby.getGender());
    if (baby.getBirthday() != null) {
      accessInfo.setBabyBirthday(DateUtils.formatDate(baby.getBirthday()));
    }
    if (baby.getEdc() != null) {
      accessInfo.setEdc(DateUtils.formatDate(baby.getEdc()));
    }
    accessInfo.setUid(order.getUserid());
    accessInfo.setEvent("payreturn");
    accessInfo.setStatus(UserAccessInfo.STATUS_SUCCESS);

    List<OrderItemsModel> orderItems = orderItemsDAO.getListByOrderId(order.getId());
    accessInfo.setCartSelected(orderItems.size());
    int skuQuantity = 0;
    Set<Long> itemids = new HashSet<>();
    for (OrderItemsModel orderItem : orderItems) {
      itemids.add(orderItem.getItemid());
      skuQuantity += orderItem.getQuantity();
    }
    accessInfo.setItemQuantity(itemids.size());
    accessInfo.setSkuQuantity(skuQuantity);
    accessInfo.setOrderid(order.getId());
    accessInfo.setTotolFee(DecimalUtil.toStandard(order.getTotalfee()).doubleValue());
    accessInfo.setDeliveryFee(DecimalUtil.toStandard(order.getDeliveryfee()).doubleValue());
    return accessInfo;
  }
Ejemplo n.º 2
0
  @RequestMapping(value = "/flash/item/list/v2", method = RequestMethod.GET)
  @ResponseBody
  public JSONObject getFlashList(
      @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset,
      @RequestParam(value = "limit", required = false, defaultValue = "21") Integer limit,
      @RequestParam(value = "babystatus", required = false, defaultValue = "0") int babyStatus,
      @RequestParam(value = "gender", required = false, defaultValue = "0") int gender,
      @RequestParam(value = "edc", required = false) String edc,
      @RequestParam(value = "birthday", required = false) String birthday,
      @RequestParam(value = "isset", required = false, defaultValue = "true") boolean isset) {

    JSONObject jo =
        itemServiceApiV2Proxy.getFlashList(isset, babyStatus, gender, edc, birthday, offset, limit);
    UserAccessInfo userAccessInfo = HehuaRequestContext.getUserAccessInfo();
    userAccessInfo.setEvent("snap");
    int status = jo.containsKey("data") ? 0 : -1;
    userAccessInfo.setStatus(status);
    userAccessInfo.setPreganancy(babyStatus);
    userAccessInfo.setBabyGender(gender);
    userAccessInfo.setBabyBirthday(birthday);
    userAccessInfo.setEdc(edc);
    flumeEventLogger.info(userAccessInfo.toString());
    return jo;
  }