示例#1
0
  public static Map<String, Object> getPagerPreferenceInfo(DispatchContext ctx, Map<?, ?> context) {
    String id = (String) context.get("id");
    try {
      Map<String, Object> valueMap = new HashMap<String, Object>();
      Map<String, Object> retMap = ServiceUtil.returnSuccess();
      if (id == null) {
        valueMap.put("id", "");
        valueMap.put("value", Assistant.getPagerDial("message"));
        retMap.put("result", valueMap);
        return retMap;
      } else {
        // Map value = (Map) Config.getConfigByName("_additionalPager");

        Map<String, Object> value =
            (Map<String, Object>)
                (ctx.getDispatcher()
                        .runSync("getConfigByName", UtilMisc.toMap("attrName", "_additionalPager")))
                    .get("result");

        Iterator it = value.values().iterator();
        String mapString = "";
        boolean flag = true;
        while (it.hasNext()) {
          String ls = (String) it.next();
          String[] temple = ls.split("_");
          for (int i = 1; i < temple.length; i++) {
            String tem = "id=" + id;
            String tem1 = "id=" + id + " ";
            if (tem.equals(temple[i]) || (tem1.equals(temple[i]))) {
              flag = false;
              break;
            }
          }
          mapString = ls;
          if (flag == false) {
            break;
          }
        }
        Map map = BaseClass.stringToMap(mapString);
        valueMap.put("id", id);
        valueMap.put("value", Assistant.getPagerDial1(map));
        retMap.put("result", valueMap);
        return retMap;
      }
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
  }
示例#2
0
 public static Map<String, Object> updateRangSchedule(DispatchContext ctx, Map<?, ?> context) {
   try {
     String id = (String) context.get("id");
     String name = (String) context.get("name");
     Map map = Assistant.ScheduleOperate(context);
     String timeV =
         "_id=" + id + " _name=" + name + " _schedule=" + (String) map.get("timeString");
     ctx.getDispatcher()
         .runSync("updateAbsoluteScheduleV", UtilMisc.toMap("value", timeV, "id", id));
     return ServiceUtil.returnSuccess();
   } catch (Exception e) {
     return ServiceUtil.returnFailure(e.getMessage());
   }
 }
示例#3
0
  public static Map<String, Object> saveRangSchedule(DispatchContext ctx, Map<?, ?> context) {
    try {
      String name = (String) context.get("name");
      Map map = Assistant.ScheduleOperate(context);
      if ((Boolean) map.get("sodier") == false) {
        throw new Exception("ʱ¼ä¸ñʽ´íÎó"); // message.getMessage(??);
      } else {
        Map<String, Object> mapV = new HashMap<String, Object>();
        mapV.put("_name", name);
        mapV.put("_schedule", (String) map.get("timeString"));

        ctx.getDispatcher().runSync("saveRangScheduleV", UtilMisc.toMap("value", mapV));
      }
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
    return ServiceUtil.returnSuccess();
  }
示例#4
0
  public static Map<String, Object> saveAddPagerSetting(DispatchContext ctx, Map<?, ?> context) {
    try {
      String id = (String) context.get("id");
      if (id != null && ("".equals(id) == false)) {
        String _name =
            ((String) context.get("additionalPagerName") == null)
                ? ""
                : (String) context.get("additionalPagerName");
        String _disabled = ((String) context.get("disabled") == null) ? "" : "CHECKED";
        String _pagerAlphaPIN =
            ((String) context.get("pagerAlphaPIN") == null)
                ? ""
                : (String) context.get("pagerAlphaPIN");
        String _pagerAlphaPhone =
            ((String) context.get("pagerAlphaPhone") == null)
                ? ""
                : (String) context.get("pagerAlphaPhone");
        String _pagerCustom =
            ((String) context.get("pagerCustom") == null)
                ? ""
                : (String) context.get("pagerCustom");
        String _pagerDirectPhone =
            ((String) context.get("pagerDirectPhone") == null)
                ? ""
                : (String) context.get("pagerDirectPhone");
        String _pagerOption =
            ((String) context.get("pagerOption") == null)
                ? ""
                : (String) context.get("pagerOption");
        String _pagerOptionPhone =
            ((String) context.get("pagerOptionPhone") == null)
                ? ""
                : (String) context.get("pagerOptionPhone");
        String _pagerSpeed =
            ((String) context.get("pagerSpeed") == null) ? "" : (String) context.get("pagerSpeed");
        String _pagerType =
            ((String) context.get("pagerType") == null) ? "" : (String) context.get("pagerType");
        Map time = Assistant.ScheduleOperate(context);
        String timeValue = (String) time.get("timeString");

        String pagerValue =
            " _id="
                + id
                + " _name="
                + _name
                + " _disabled="
                + _disabled
                + " _pagerAlphaPIN="
                + _pagerAlphaPIN
                + " _pagerAlphaPhone="
                + _pagerAlphaPhone
                + " _pagerCustom="
                + _pagerCustom
                + " _pagerDirectPhone="
                + _pagerDirectPhone
                + " _pagerOption="
                + _pagerOption
                + " _pagerOptionPhone="
                + _pagerOptionPhone
                + " _pagerSpeed="
                + _pagerSpeed
                + " _pagerType="
                + _pagerType
                + " _schedule="
                + timeValue;
        Map value = (Map) Config.getConfigByName("_additionalPager");
        Iterator it = value.values().iterator();
        long idx = 0;
        boolean flag = true;
        while (it.hasNext()) {
          String ls = (String) it.next();
          String[] temple = ls.split("_");
          for (int i = 1; i < temple.length; i++) {
            String tem = "id=" + id;
            String tem1 = "id=" + id + " ";
            if (tem.equals(temple[i]) || (tem1.equals(temple[i]))) {
              flag = false;
              break;
            }
          }
          idx++;
          if (flag == false) {
            break;
          }
        }
        ctx.getDispatcher()
            .runSync("UpdateAddPagerSetting", UtilMisc.toMap("idx", idx, "pagerValue", pagerValue));
        return ServiceUtil.returnSuccess();
      } else {
        Map<String, Object> value = new HashMap<String, Object>();

        value.put(
            "_name",
            ((String) context.get("additionalPagerName") == null)
                ? ""
                : (String) context.get("additionalPagerName"));
        value.put("_disabled", ((String) context.get("disabled") == null) ? "" : "CHECKED");
        value.put(
            "_pagerAlphaPIN",
            ((String) context.get("pagerAlphaPIN") == null)
                ? ""
                : (String) context.get("pagerAlphaPIN"));
        value.put(
            "_pagerAlphaPhone",
            ((String) context.get("pagerAlphaPhone") == null)
                ? ""
                : (String) context.get("pagerAlphaPhone"));
        value.put(
            "_pagerCustom",
            ((String) context.get("pagerCustom") == null)
                ? ""
                : (String) context.get("pagerCustom"));
        value.put(
            "_pagerDirectPhone",
            ((String) context.get("pagerDirectPhone") == null)
                ? ""
                : (String) context.get("pagerDirectPhone"));
        value.put(
            "_pagerOption",
            ((String) context.get("pagerOption") == null)
                ? ""
                : (String) context.get("pagerOption"));
        value.put(
            "_pagerOptionPhone",
            ((String) context.get("pagerOptionPhone") == null)
                ? ""
                : (String) context.get("pagerOptionPhone"));
        value.put(
            "_pagerSpeed",
            ((String) context.get("pagerSpeed") == null) ? "" : (String) context.get("pagerSpeed"));
        value.put(
            "_pagerType",
            ((String) context.get("pagerType") == null) ? "" : (String) context.get("pagerType"));
        Map time = Assistant.ScheduleOperate(context);

        value.put(
            "_schedule",
            ((String) time.get("timeString") == null) ? "" : (String) time.get("timeString"));

        ctx.getDispatcher().runSync("saveAddPagerSettingValue", UtilMisc.toMap("value", value));
        return ServiceUtil.returnSuccess();
      }
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
  }