Example #1
0
  /**
   * 积分发放记录
   *
   * @author zhliu
   * @date 2015年6月15日
   * @parm
   * @param request
   * @param response
   * @return
   */
  @RequestMapping(value = "")
  public String index(HttpServletRequest request) {
    try {
      User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER);
      PageSearch page = preparePage(request);
      PageSearchInit.initcurrentPage(page, request);

      /** 查询发放名目 */
      WelfareItem welfareItem = new WelfareItem();
      welfareItem.setItemType(IBSConstants.WELFAREITEM_TYPE_WELFARE);
      welfareItem.setItemGrade(IBSConstants.WELFAREITEM_GRADE_CLASSIFY);
      List<WelfareItem> welfareItems = welfareManager.getBySample(welfareItem);
      List<ActivityItem> acItemList =
          exActivityManager.queryActivityItemList(user.getCompanyId(), null);
      if (!UserUtils.isCompanyAdmin()) { // 非企业管理员
        page.getFilters()
            .add(
                new PropertyFilter(
                    "PointDistrubute", "EQL_userId", String.valueOf(user.getObjectId())));
      }
      page.getFilters()
          .add(
              new PropertyFilter(
                  "PointDistrubute", "EQL_companyId", String.valueOf(user.getCompanyId())));
      page.setSortProperty("createDate");
      page.setSortOrder("desc");

      page = pointDistrubuteManager.queryPointDistRelItem(page);
      // 查询发放对象字典信息
      List<Dictionary> dictionaryList =
          dictionaryManager.getDictionariesByDictionaryId(
              IBSConstants.POINTS_GRANT_OBJECT_CONSTANT);

      // 查询发放对象字典信息
      List<Dictionary> grantPointsStatusList =
          dictionaryManager.getDictionariesByDictionaryId(IBSConstants.GRANT_POINTS_STATUS);
      request.setAttribute("dictionaryList", dictionaryList);
      request.setAttribute("grantPointsStatusList", grantPointsStatusList);
      request.setAttribute("pageActivity", page);
      request.setAttribute("welfareItems", welfareItems);
      request.setAttribute("acItemList", acItemList);
      Date now = new Date();
      for (PointDistrubute distrubute : (List<PointDistrubute>) page.getList()) {
        // 借用字段
        distrubute.setUserId((long) distrubute.getDistributeDate().compareTo(now));
      }
    } catch (Exception e) {
      logger.error("index", e);
    }
    return HOME_DIR + "/listpointsGrant";
  }
Example #2
0
 /**
  * 查看发放详细
  *
  * @author zhliu
  * @date 2015年6月16日
  * @parm
  * @param request
  * @param distributeId :发放类目ID
  * @return
  */
 @RequestMapping("pointsGrantDetail")
 public String pointsGrantDetail(HttpServletRequest request, Long distributeId, String staffName) {
   try {
     PageSearch page = preparePage(request);
     PageSearchInit.initcurrentPage(page, request);
     PointDistrubute pointDistrubute = pointDistrubuteManager.getByObjectId(distributeId);
     String itemName = ""; // 发放名目
     if (pointDistrubute != null
         && pointDistrubute.getDistributeType() == IBSConstants.WELFAREITEM_TYPE_EXCITATION) {
       if (pointDistrubute.getItemType()
           == IBSConstants.ACTIVITY_ITEM_TYPE_RECOMMEND) { // 运营端推荐名目类的
         itemName = welfareManager.getByObjectId(pointDistrubute.getWelfareItemId()).getItemName();
       } else {
         itemName =
             activityItemManager
                 .getByObjectId(pointDistrubute.getWelfareItemId())
                 .getActivityName();
       }
     } else {
       itemName = welfareManager.getByObjectId(pointDistrubute.getWelfareItemId()).getItemName();
     }
     page.getFilters()
         .add(
             new PropertyFilter(
                 "PointDistrubute", "EQL_distributeId", String.valueOf(distributeId)));
     if (!org.apache.commons.lang3.StringUtils.isEmpty(staffName)) {
       page.getFilters()
           .add(new PropertyFilter("PointDistrubute", "EQS_staffName", String.valueOf(staffName)));
     }
     page = pointDistrubuteStaffManager.selectPointStaff(page);
     // 查询性别字典信息
     List<Dictionary> dictionaryList =
         dictionaryManager.getDictionariesByDictionaryId(IBSConstants.SEX_CONSTANT);
     request.setAttribute("dictionaryList", dictionaryList);
     request.setAttribute("staffName", staffName);
     request.setAttribute("pointDistrubute", pointDistrubute);
     request.setAttribute("pageActivity", page);
     request.setAttribute("distributeId", distributeId);
     request.setAttribute("itemName", itemName);
   } catch (Exception e) {
     logger.error("pointsGrantDetail", e);
   }
   return HOME_DIR + "/detailpointsGrant";
 }