Exemplo n.º 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";
  }
Exemplo n.º 2
0
  /**
   * 购买商品-填写收货信息
   *
   * @author zhliu
   * @date 2015年6月19日
   * @parm
   * @param request
   * @param response
   * @param prodId : 商品ID
   * @param count
   * @return
   */
  @RequestMapping("/buyProdIndex")
  public String buyProdIndex(
      HttpServletRequest request, HttpServletResponse response, Long skuId, Long count) {

    List<GoodsReceiptAddr> receiptAddrList = new ArrayList<GoodsReceiptAddr>(); // 收货地址
    User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER);
    SkuPublish skuPublish = new SkuPublish();
    ProductPublish productPublish = new ProductPublish();
    int stockType = 1; // 实体兑换券 需要填写 收货地址(1:实体兑换券2:电子兑换券)
    try {
      receiptAddrList = goodsReceiptAddrManager.getAddrByUserId(user.getObjectId());

      // 查询商品详细
      skuPublish =
          skuPublishManager.getSkuPublishPrice(
              FrameworkContextUtils.getCurrentUser().getCompanyId(), skuId);
      productPublish = publishManager.getByObjectId(skuPublish.getProductId());

      if (skuPublish.getType() == ProductConstants.PRODUCT_TYPE_MATERIAL_OBJECT
          || skuPublish.getType() == ProductConstants.PRODUCT_TYPE_MATERIAL_CARD) {
        stockType = 1;
      } else {
        stockType = 2;
      }
      // 初始化支付方式
      List<Dictionary> payWays = dictionaryManager.getDictionariesByDictionaryId(1403);
      request.setAttribute("payWays", payWays);
      // 初始化省份信息
      List<Area> provinces = areaManager.getRoot();
      request.setAttribute("provinces", provinces);

      request.setAttribute("receiptAddrList", receiptAddrList);
      request.setAttribute("count", count);
      request.setAttribute("skuPublish", skuPublish);
      request.setAttribute("productPublish", productPublish);
      request.setAttribute("stockType", stockType);

    } catch (Exception e) {
      logger.error(e.getMessage());
      e.printStackTrace();
    }

    return HOME_DIR + "/buyProdIndex";
  }
Exemplo n.º 3
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";
 }
Exemplo n.º 4
0
  /**
   * 购买福利-填写收货信息
   *
   * @author zhliu
   * @date 2015年6月19日
   * @parm
   * @param request
   * @param response
   * @param packageId : 套餐ID
   * @param count
   * @return
   */
  @RequestMapping("buyWelfareIndex")
  public String buyWelfareIndex(
      HttpServletRequest request, HttpServletResponse response, Long pakageId, Long count) {

    int stockType = 1; // 实体兑换券 需要填写 收货地址(1:实体兑换券2:电子兑换券)

    try {
      WelfarePackage welfarePackage = new WelfarePackage();
      User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER);

      List<GoodsReceiptAddr> receiptAddrList =
          goodsReceiptAddrManager.getAddrByUserId(user.getObjectId());
      welfarePackage =
          welfarePackageManager.getPackagePrice(
              FrameworkContextUtils.getCurrentUser().getCompanyId(), pakageId);

      if (welfarePackage.getStockType() == IBSConstants.WELFARE_PACKAGE_WP_STOCK_TYPE_ELECTRON) {
        stockType = 2;
      } else {
        stockType = 1;
      }

      // 初始化支付方式
      List<Dictionary> payWays = dictionaryManager.getDictionariesByDictionaryId(1403);
      request.setAttribute("payWays", payWays);

      // 初始化省份信息
      List<Area> provinces = areaManager.getRoot();
      request.setAttribute("provinces", provinces);

      request.setAttribute("receiptAddrList", receiptAddrList);
      request.setAttribute("welfarePackage", welfarePackage);
      request.setAttribute("count", count);
      request.setAttribute("stockType", stockType);

    } catch (Exception e) {
      e.printStackTrace();
      logger.error(e.getMessage());
    }
    return HOME_DIR + "/buyWelfareIndex";
  }
Exemplo n.º 5
0
  /**
   * 导出积分发放详细
   *
   * @author zhliu
   * @date 2015年7月8日
   * @parm
   * @return
   */
  @RequestMapping("exportPointsGrantDetail")
  public String exportPointsGrantDetail(
      HttpServletResponse response,
      HttpServletRequest request,
      Long distributeId,
      String staffName) {
    List<Object[]> datas = new ArrayList<Object[]>();
    String[] titles = {"工号", "姓名", "性别", "手机号码", "部门", "邮箱", "状态"};
    String excelName = "pointsGrantDetail.xls";
    try {
      // 查询性别字典信息
      List<Dictionary> dictionaryList =
          dictionaryManager.getDictionariesByDictionaryId(IBSConstants.SEX_CONSTANT);
      PageSearch page = preparePage(request);
      PageSearchInit.initcurrentPage(page, request);
      page.setPageSize(Integer.MAX_VALUE);

      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)));
      }
      List<PointDistrubuteStaff> PointDistrubuteStaffList =
          pointDistrubuteStaffManager.selectPointStaffList(page);

      for (PointDistrubuteStaff pointDis : PointDistrubuteStaffList) {
        String sex = ""; // 性别
        String status = ""; // 状态
        for (Dictionary dict : dictionaryList) {
          if (pointDis.getSex() != null && pointDis.getSex().equals(dict.getValue())) {
            sex = dict.getName();
            break;
          }
        }
        if (pointDis.getStatus() == 0) {
          status = "未领取";
        } else if (pointDis.getStatus() == 1) {
          status = "已领取";
        } else {
          status = "待确认";
        }

        Object[] arr = new Object[titles.length];
        arr[0] = pointDis.getWorkNo();
        arr[1] = pointDis.getStaffName();
        arr[2] = sex;
        arr[3] = pointDis.getTelephone();
        arr[4] = pointDis.getDeptName();
        arr[5] = pointDis.getEmail();
        arr[6] = status;
        datas.add(arr);
      }
      ExcelUtil excelUtil = new ExcelUtil();
      excelUtil.exportExcel(response, datas, titles, excelName);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }