Пример #1
0
  private List<Long> mergeIds(
      List<Long> pgcList,
      List<DcPromotionAwardDTO> hisAwardList,
      List<DcPromotionItemDTO>... allPromotionItemList) {
    List<Long> mergeIdList = new ArrayList<Long>();

    if (CollectionUtils.isNotEmpty(pgcList)) {
      mergeIdList.addAll(pgcList);
    }

    for (List<DcPromotionItemDTO> promotionItemList : allPromotionItemList) {
      if (CollectionUtils.isNotEmpty(promotionItemList)) {
        for (DcPromotionItemDTO pi : promotionItemList) {
          mergeIdList.add(pi.getItemId());
        }
      }
    }

    if (CollectionUtils.isNotEmpty(hisAwardList)) {
      for (DcPromotionAwardDTO pa : hisAwardList) {
        mergeIdList.add(pa.getItemId());
      }
    }

    return mergeIdList;
  }
  /**
   * 更新审核状态
   *
   * @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;
  }