public String updateSendStatus() {
    if (IDUtils.isNotCorrect(id)) {
      json.setCode(JsonModel.CODE_ILL_ARGS);
      json.setDetail("dcome.promotion.award.id.required");
      return SUCCESS;
    }

    DcPromotionAwardSendStatusEnums statusEnums =
        DcPromotionAwardSendStatusEnums.getInstance(status);

    if (statusEnums == DcPromotionAwardSendStatusEnums.UNKNOWN) {
      json.setCode(JsonModel.CODE_ILL_ARGS);
      json.setDetail("dcome.promotion.award.status.required");
      return SUCCESS;
    }

    try {
      int effectCount = dcPromotionAwardService.updateSendStatusById(id, statusEnums);
      if (effectCount > 0) {}

      json.setCode(JsonModel.CODE_SUCCESS);
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      json.setCode(JsonModel.CODE_FAIL);
      json.setDetail(e.getMessage());
    }

    return SUCCESS;
  }
  /**
   * 更新审核状态
   *
   * @return
   */
  public String updateReviewStatus() {

    if (IDUtils.isNotCorrect(id)) {
      json.setCode(JsonModel.CODE_ILL_ARGS);
      json.setDetail("dcome.promotion.award.id.required");
      return SUCCESS;
    }

    DcPromotionAwardReviewStatusEnums statusEnums =
        DcPromotionAwardReviewStatusEnums.getInstance(status);

    if (statusEnums == DcPromotionAwardReviewStatusEnums.UNKNOWN) {
      json.setCode(JsonModel.CODE_ILL_ARGS);
      json.setDetail("dcome.promotion.award.status.required");
      return SUCCESS;
    }
    try {
      int effectCount = dcPromotionAwardService.updateReviewStatusById(id, statusEnums);
      if (effectCount > 0) {
        // 更新该会员的未读消息
        DcPromotionAwardDTO awardDO = dcPromotionAwardService.getAwardById(id);
        if (awardDO != null) {
          Long userId = awardDO.getUserId();
          if (IDUtils.isCorrect(userId)) {
            dcUserService.incrUnreadMsgCountByUser(userId, 1); // 添加一条未读消息
          }
        }
      }
      json.setCode(JsonModel.CODE_SUCCESS);
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      json.setCode(JsonModel.CODE_FAIL);
      json.setDetail(e.getMessage());
    }

    return SUCCESS;
  }
Пример #3
0
  @Override
  public String execute() throws Exception {

    promotion = getPromotion();

    if (promotion != null) {

      Long promotionId = promotion.getId();

      // 活动商品
      DcPromotionItemSearchCondition promotionCondition = new DcPromotionItemSearchCondition();
      promotionCondition.setPromotionId(promotionId);

      // 历史获奖
      DcPromotionAwardCondition awardCondition = new DcPromotionAwardCondition();
      awardCondition.setPromotionType(DcPromotionTypeEnum.PK.getType());
      awardCondition.setReviewStatus(DcPromotionAwardReviewStatusEnums.SUCCESS.getStatus());
      awardHisList =
          dcPromotionAwardService.getAwardsNoPagination(awardCondition, new Pagination(1, 15));
    }

    // 取出所有ID的商品
    List<Long> idList = mergeIds(null, awardHisList);

    DcPromotionItemDTO myPromotionItem = getMyPromotionItem();
    if (myPromotionItem != null) {
      idList.add(myPromotionItem.getItemId());
    }

    List<DcItemDTO> itemList = dcItemService.getItemsByIds(idList);
    itemMap = new HashMap<Long, DcItemDTO>();
    for (DcItemDTO dto : itemList) {
      itemMap.put(dto.getId(), dto);
    }

    return SUCCESS;
  }