Exemplo n.º 1
0
 /**
  * @param page,rows,...
  * @description 提供查询分页/模糊查询分页
  * @return entityMap
  * @type Json
  */
 @Action(
     value = "listBatchSendResult",
     results = {
       @Result(
           type = "json",
           params = {"root", "entityMap", "contentType", "text/html"})
     })
 public String listBatchSendResult() {
   if (!StringUtil.isEmpty(batchId)) {
     PageUtil pageUtil = new PageUtil();
     pageUtil.setStart(page);
     pageUtil.setPageSize(rows);
     pageUtil.setBatchId(Long.valueOf(batchId));
     try {
       Users u = (Users) super.getSession().getAttribute(ApSmsConstants.SESSION_USER_INFO);
       pageUtil.setMerchantPin(u.getMerchantPin());
       if (!StringUtil.isEmpty(searchBycontacts)) {
         pageUtil.setContactName(URLDecoder.decode(searchBycontacts, "UTF-8"));
       }
       if (!StringUtil.isEmpty(sendResult) && !sendResult.equals("4")) {
         pageUtil.setSendResult(Integer.valueOf(sendResult));
       }
       Page page = mbnSmsHadSendService.batchPage(pageUtil);
       if (page != null) {
         @SuppressWarnings("unchecked")
         List<MbnSmsHadSend> datas = (List<MbnSmsHadSend>) page.getData();
         entityMap = new HashMap<String, Object>();
         entityMap.put("total", page.getRecords());
         if (datas == null) {
           datas = new ArrayList<MbnSmsHadSend>();
         }
         entityMap.put("rows", datas);
         entityMap.put("totalrecords", page.getTotal());
         entityMap.put("currpage", page.getStart());
       }
     } catch (Exception e) {
       e.printStackTrace();
       return ERROR;
     }
   }
   return SUCCESS;
 }
Exemplo n.º 2
0
 /**
  * @param page,rows,...
  * @description 提供查询分页/模糊查询分页
  * @return entityMap
  * @type Json
  */
 @Action(
     value = "listHadSendSms",
     results = {
       @Result(
           type = "json",
           params = {"root", "entityMap", "contentType", "text/html"})
     })
 public String listHadSendSms() {
   PageUtil pageUtil = new PageUtil();
   pageUtil.setStart(page);
   pageUtil.setPageSize(rows);
   try {
     MbnSmsOperationClass smsOperationClass =
         mbnSmsOperationClassService.findByCoding(ApSmsConstants.SMS_OPERATION_CODE_HD);
     pageUtil.setOperationId(smsOperationClass.getId());
     Users u = (Users) super.getSession().getAttribute(ApSmsConstants.SESSION_USER_INFO);
     // 设定只查询自己发送的信息
     boolean isQuerySelf = false;
     if (!StringUtils.isBlank(
         WebUtils.getPropertyByName(com.leadtone.mas.admin.common.ApSmsConstants.QUERYSELFINFO))) {
       isQuerySelf =
           Boolean.valueOf(
               WebUtils.getPropertyByName(
                   com.leadtone.mas.admin.common.ApSmsConstants.QUERYSELFINFO));
       if (isQuerySelf
           && u.getUserType()
               == com.leadtone.mas.admin.common.ApSmsConstants.USER_TYPE_ENTERPRISE_NORMAL) {
         pageUtil.setCreateBy(u.getId());
       }
     }
     pageUtil.setMerchantPin(u.getMerchantPin());
     if (!StringUtil.isEmpty(searchBycontacts)) {
       pageUtil.setContactName(URLDecoder.decode(searchBycontacts, "UTF-8"));
     }
     if (!StringUtil.isEmpty(searchBySmsTitle)) {
       pageUtil.setSmsTitle(URLDecoder.decode(searchBySmsTitle, "UTF-8"));
     }
     if (!StringUtil.isEmpty(searchAct)) {
       Timestamp endDate = new Timestamp(System.currentTimeMillis());
       switch (Integer.valueOf(searchAct)) {
         case 1: // all
           break;
         case 2: // 一天内
           pageUtil.setEndDate(endDate);
           Date startDateDay = DateUtil.oneDayAgo(endDate);
           pageUtil.setStartDate(startDateDay);
           break;
         case 3: // 一周内 7天
           pageUtil.setEndDate(endDate);
           Date startDateWeek = DateUtil.oneWeekAgo(endDate);
           pageUtil.setStartDate(startDateWeek);
           break;
         case 4: // 一月内 30天
           pageUtil.setEndDate(endDate);
           Date startDateMonth = DateUtil.oneMonthAgo(endDate);
           pageUtil.setStartDate(startDateMonth);
           break;
         case 5: // 时间区间dateFrom
           SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
           if (!StringUtil.isEmpty(dateTo)) {
             pageUtil.setEndDate(format.parse(dateTo));
           }
           if (!StringUtil.isEmpty(dateFrom)) {
             pageUtil.setStartDate(format.parse(dateFrom));
           }
           break;
       }
     }
     Page page = mbnSmsHadSendService.pageVO(pageUtil);
     // List<GroupUtil> groupBy = smsStatusService.groupPage(pageUtil);
     if (page != null) {
       @SuppressWarnings("unchecked")
       List<MbnSmsHadSendVO> datas = (List<MbnSmsHadSendVO>) page.getData();
       entityMap = new HashMap<String, Object>();
       entityMap.put("total", page.getRecords());
       if (datas == null) {
         datas = new ArrayList<MbnSmsHadSendVO>();
       }
       entityMap.put("rows", datas);
       entityMap.put("totalrecords", page.getTotal());
       entityMap.put("currpage", page.getStart());
     }
   } catch (Exception e) {
     e.printStackTrace();
     return ERROR;
   }
   return SUCCESS;
 }
Exemplo n.º 3
0
 @Action(
     value = "getReplyInfo",
     results = {
       @Result(
           type = "json",
           params = {"root", "entityMap", "contentType", "text/html"})
     })
 public String replyInfo() {
   String result = SUCCESS;
   try {
     PageUtil pageUtil = new PageUtil();
     pageUtil.setStart(page);
     pageUtil.setBatchId(Long.parseLong(batchId));
     pageUtil.setPageSize(rows);
     if (!StringUtil.isEmpty(searchBycontacts)) {
       pageUtil.setContactName(searchBycontacts);
     }
     if (!StringUtil.isEmpty(searchAct)) {
       Timestamp endDate = new Timestamp(System.currentTimeMillis());
       switch (Integer.valueOf(searchAct)) {
         case 1: // all
           break;
         case 2: // 一天内
           pageUtil.setEndDate(endDate);
           Date startDateDay = DateUtil.oneDayAgo(endDate);
           pageUtil.setStartDate(startDateDay);
           break;
         case 3: // 一周内 7天
           pageUtil.setEndDate(endDate);
           Date startDateWeek = DateUtil.oneWeekAgo(endDate);
           pageUtil.setStartDate(startDateWeek);
           break;
         case 4: // 一月内 30天
           pageUtil.setEndDate(endDate);
           Date startDateMonth = DateUtil.oneMonthAgo(endDate);
           pageUtil.setStartDate(startDateMonth);
           break;
         case 5: // 时间区间dateFrom
           SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
           if (!StringUtil.isEmpty(dateTo)) {
             pageUtil.setEndDate(format.parse(dateTo));
           }
           if (!StringUtil.isEmpty(dateFrom)) {
             pageUtil.setStartDate(format.parse(dateFrom));
           }
           break;
       }
     }
     Page m = mbnSmsHadSendService.replyPage(pageUtil);
     if (m != null) {
       @SuppressWarnings("unchecked")
       List<MbnSmsHadSendVO> mshs = (List<MbnSmsHadSendVO>) m.getData();
       entityMap = new HashMap<String, Object>();
       entityMap.put("total", m.getRecords());
       if (mshs == null) {
         mshs = new ArrayList<MbnSmsHadSendVO>();
       }
       entityMap.put("rows", mshs);
       entityMap.put("totalrecords", m.getTotal());
       entityMap.put("currpage", m.getStart());
     }
   } catch (Exception e) {
     e.printStackTrace();
     result = ERROR;
   }
   return result;
 }
Exemplo n.º 4
0
  /**
   * 查询用户信息<未完成的,分页列表>
   *
   * @return
   * @throws Exception
   */
  @Action(
      value = "query",
      results = {
        @Result(
            type = "json",
            params = {"root", "entityMap", "contentType", "text/html"})
      })
  public String query() {
    try {
      PageUtil pageUtil = new PageUtil();
      pageUtil.setStart(page);
      pageUtil.setPageSize(rows);
      pageUtil.setMerchantPin(users.getMerchantPin());
      if (portalUser != null) {
        pageUtil.setAccount(portalUser.getAccount());
        pageUtil.setMobile(portalUser.getMobile());
        pageUtil.setEmail(portalUser.getEmail());
        // Integer activeFlag =
        //		portalUser.getActiveFlag()== -99 ? null : portalUser.getActiveFlag();
        pageUtil.setActiveFlag(portalUser.getActiveFlag());
        String roleId = request.getParameter("roleId");
        if (roleId != null && !"-99".equals(roleId)) pageUtil.setRoleId(Long.parseLong(roleId));
      }
      logger.info("role query portalUser:"******"role query pageUtil:" + pageUtil);

      // REX@20130112  判断登陆用户类型
      if (users.getUserType() == ApSmsConstants.USER_TYPE_SUPER_ADMIN) {
        // 在省、地市 管理员的时候,不需要pin码
        pageUtil.setMerchantPin(null);
        String[] provArray = null;
        List<Region> regionList = regionService.findProvinces();
        if (regionList != null) {
          provArray = new String[regionList.size()];
          for (int i = 0; i < regionList.size(); i++) {
            provArray[i] = String.valueOf(regionList.get(i).getId());
          }
        }
        // 增加全省列表
        pageUtil.setAreaRange(provArray);
        // 设置用户类型为省管理员
        pageUtil.setUserType(users.getUserType());
      } else if (users.getUserType() == ApSmsConstants.USER_TYPE_PROVINCE_ADMIN) {
        // 在省、地市 管理员的时候,不需要pin码
        pageUtil.setMerchantPin(null);
        Long provinceId = 0L;
        provinceId = Long.parseLong(users.getProvince());
        String[] cityArray = null;
        List<Region> regionList = regionService.findCityByProvinceId(provinceId);
        if (regionList != null) {
          cityArray = new String[regionList.size()];
          for (int i = 0; i < regionList.size(); i++) {
            cityArray[i] = String.valueOf(regionList.get(i).getId());
          }
        }
        // 增加地区列表
        pageUtil.setAreaRange(cityArray);
        // 设置用户类型为地市管理员
        pageUtil.setUserType(users.getUserType());
      } else if (users.getUserType() == ApSmsConstants.USER_TYPE_CITY_ADMIN) {
        pageUtil.setMerchantPin(null);
        // 增加地区列表
        pageUtil.setAreaRange(new String[] {users.getCity()});
        // 设置用户类型为企业管理员
        pageUtil.setUserType(users.getUserType());

      } else if (users.getUserType() == ApSmsConstants.USER_TYPE_ENTERPRISE_ADMIN) {
        // 设置用户类型为企业管理员

        pageUtil.setUserType(users.getUserType());

      } else {
        pageUtil.setUserType(users.getUserType());
      }
      Page page = userService.page(pageUtil);
      if (page != null) {
        @SuppressWarnings("unchecked")
        List<UserVO> datas = (List<UserVO>) page.getData();
        entityMap = new HashMap<String, Object>();
        entityMap.put("total", page.getRecords());
        if (datas == null) {
          datas = new ArrayList<UserVO>();
        }
        entityMap.put("rows", datas);
        entityMap.put("totalrecords", page.getTotal());
        entityMap.put("currpage", page.getStart());
      }
      logger.info("query user page: " + entityMap);
    } catch (Exception e) {
      e.printStackTrace();
      return ERROR;
    }
    return SUCCESS;
  }