コード例 #1
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;
 }
コード例 #2
0
  /**
   * 导出列表
   *
   * @return
   */
  @Action(
      value = "export",
      results = {
        @Result(
            type = "json",
            params = {"root", "entityMap", "contentType", "text/html"})
      })
  public String export() {
    PageUtil pageUtil = new PageUtil();
    pageUtil.setColumn3("export"); // 用于判断,sql是否分页
    try {
      MbnSmsOperationClass smsOperationClass =
          mbnSmsOperationClassService.findByCoding(operationId);
      pageUtil.setOperationId(smsOperationClass.getId());
      Users u = (Users) super.getSession().getAttribute(ApSmsConstants.SESSION_USER_INFO);
      pageUtil.setMerchantPin(u.getMerchantPin());
      // 设定只查询自己发送的信息
      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());
        }
      }
      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.extPortAll(pageUtil);
      if (page != null) {
        @SuppressWarnings("unchecked")
        List<MbnSmsHadSendVO> datas = (List<MbnSmsHadSendVO>) page.getData();
        entityMap = new HashMap<String, Object>();
        if (datas == null) {
          datas = new ArrayList<MbnSmsHadSendVO>();
        }
        String tunnelName = "";
        int size = datas.size();
        String[][] billsInArr = new String[size][7];
        for (int j = 0; j < size; j++) {
          MbnSmsHadSendVO mbnSmsHadSendVO = datas.get(j);
          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
          switch (mbnSmsHadSendVO.getTunnelType()) {
            case 1:
              tunnelName = "话机";
              break;
            case 3:
              tunnelName = "猫池";
              break;
            case 2:
              tunnelName = "移动";
              break;
            case 4:
              tunnelName = "联通";
              break;
            case 6:
              tunnelName = "电信";
              break;
            default:
              tunnelName = "无";
          }
          String smsStatus = "";
          switch (mbnSmsHadSendVO.getSendResult()) {
            case -1:
              smsStatus = "取消发送";
              break;
            case 0:
              smsStatus = "未发送";
              break;
            case 1:
              smsStatus = "已提交网关";
              break;
            case 2:
              smsStatus = "成功";
              break;
            case 3:
              smsStatus = "失败";
              break;
            default:
              smsStatus = "无";
              break;
          }
          billsInArr[j][0] = mbnSmsHadSendVO.getTosName(); // 用户名称
          billsInArr[j][1] = mbnSmsHadSendVO.getTos(); // 手机号码
          billsInArr[j][2] = mbnSmsHadSendVO.getTitle(); // 短信标题
          billsInArr[j][3] = mbnSmsHadSendVO.getContent(); //  短信内容
          billsInArr[j][4] = smsStatus;
          billsInArr[j][5] =
              (null == mbnSmsHadSendVO.getReadySendTime()
                  ? ""
                  : sdf.format(mbnSmsHadSendVO.getReadySendTime())); // 发送时间
          billsInArr[j][6] = tunnelName;
          // billsInArr[j][3] = ""+mbnSmsHadSendVO.getContent().length();	//短信长度
          // billsInArr[j][5] = ""+mbnSmsHadSendVO.getReplyCount();		//  回复
        }

        String[] cols = {"用户名称", "用户手机号码", "短信标题", "短信内容", "发送状态", "发送时间", "发送通道名称"};
        String downLoadPath =
            ExportUtil.exportToExcel(getRequest(), "SMS_HADSEND", cols, billsInArr);
        entityMap.put("fileName", downLoadPath);
        entityMap.put("message", "导出" + size + "条已发箱记录成功!");
        entityMap.put("resultcode", SUCCESS);
      }
    } catch (Exception e) {
      entityMap = new HashMap<String, Object>();
      entityMap.put("resultcode", ERROR);
      entityMap.put("message", "导出已发箱出错,请稍后再试");
      e.printStackTrace();
      return ERROR;
    }
    return SUCCESS;
  }
コード例 #3
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;
 }