Beispiel #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";
  }
Beispiel #2
0
 @RequestMapping("saveActivity")
 public String saveActivity(
     HttpServletRequest request, HttpServletResponse response, Infomation t) {
   User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER);
   t.setType(IBSConstants.HR_NOTICE);
   t.setCreatedOn(new Date());
   t.setCreatedBy(user.getObjectId());
   t.setCompanyId(user.getCompanyId());
   if (IBSConstants.USER_TYPE_COMPANY_ADMIN != user.getType()) {
     t.setOrganizationId(user.getOrganizationId());
   }
   t.setTitle(t.getTitle().trim());
   t.setContent(UeditorUtils.convertSpace(t.getContent()));
   if (IBSConstants.PLATFORM_NOTICE_ALL_USER.equals(t.getFaceMember())) {
     t.setFacePeople(IBSConstants.STATUS_YES);
   } else {
     t.setFacePeople(IBSConstants.STATUS_NO);
   }
   t = infomationManager.save(t);
   InfomationNotice delInfomationNotice = new InfomationNotice();
   delInfomationNotice.setInfomationId(t.getObjectId());
   infomationNoticeManager.deleteBySample(delInfomationNotice);
   if (IBSConstants.PLATFORM_NOTICE_ALL_USER.equals(t.getFaceMember())) {
     InfomationNotice infomationNotice = new InfomationNotice();
     infomationNotice.setInfomationId(t.getObjectId());
     infomationNotice.setAllUser(IBSConstants.PLATFORM_NOTICE_ALL_USER);
     infomationNotice.setCompanyId(user.getCompanyId());
     infomationNoticeManager.save(infomationNotice);
   } else {
     String[] members = request.getParameterValues("userId");
     for (String memberId : members) {
       InfomationNotice infomationNotice = new InfomationNotice();
       infomationNotice.setUserId(Long.parseLong(memberId));
       infomationNotice.setInfomationId(t.getObjectId());
       infomationNotice.setCompanyId(user.getCompanyId());
       infomationNoticeManager.save(infomationNotice);
     }
   }
   return "redirect:listNotice";
 }