示例#1
0
  public void queryMsgCenter() {

    PrintWriter out = null;
    JSONObject json = new JSONObject();
    try {
      request.setCharacterEncoding("utf-8");
      response.setContentType("text/json");
      response.setCharacterEncoding("utf-8");
      out = response.getWriter();
      String serialnumid = request.getParameter("serialnumid");

      Serialnumber serialnumber = serialNumService.Find(serialnumid);
      if (serialnumber == null) {
        json.put("state", 2);
        json.put("info", "找不到此序列号的信息");
        json.put("serialnumid", serialnumid);

        out.print(json);
        out.close();

        return;
      }

      JSONArray locfecnce = this.getElcInfoJson(serialnumber.getSerialnumber());
      JSONArray detach = this.getDetachJson(serialnumber.getSerialnumber());
      JSONArray fee = this.getFeeBalanceJson(serialnumid);
      JSONArray battery = this.getBatteryJson(serialnumber.getSerialnumber());

      JsonConfig jsonSerialNumConfig = Jsonconf.getSertialNumJsonConf(request);
      jsonSerialNumConfig.setExcludes(
          new String[] {"floglastip", "fphonetime", "fqrcode", "id", "fislostinfo", "fislosttime"});

      json.put("state", 1);
      json.put("info", "成功查询");

      json.put("serialNumber", JSONArray.fromObject(serialnumber, jsonSerialNumConfig));
      json.put("notifyFecnce", locfecnce);
      json.put("nofityDetach", detach);
      json.put("notifyFee", fee);
      json.put("notifyBattery", battery);

    } catch (Exception e) {
      json.put("state", -1);
      json.put("info", e.getMessage());
      json.put("serialNumber", null);
      json.put("notifyFecnce", null);
      json.put("nofityDetach", null);
      json.put("notifyFee", null);
      json.put("notifyBattery", null);
    } finally {
      out.print(json);
      out.close();
    }
  }
示例#2
0
  private JSONArray getBatteryJson(String serialNumber) {

    JSONArray arrayObj = null;

    LocationInfo battery = liDao.findBySeriaNumber(serialNumber);

    JsonConfig jconfig = Jsonconf.getCommonJsonConf();
    jconfig.setExcludes(new String[] {"location", "text", "lng", "lat", "id", "faddtime"});

    arrayObj = JSONArray.fromObject(battery, jconfig);

    return arrayObj;
  }
示例#3
0
  // 手表脱落最新
  private JSONArray getDetachJson(String serialNumber) {
    JSONArray arrayObj = null;
    HashMap<String, String> mapSerial = new HashMap<String, String>();
    mapSerial.put("FSNID", serialNumber);

    List<SerialnumberDetach> listDetach = serialNumService.ListSerialnumberDetach(0, 1, mapSerial);

    JsonConfig jconfig = Jsonconf.getCommonJsonConf();
    jconfig.setExcludes(
        new String[] {"fincreaseid", "ffieldstatus", "fsnid", "fuserid", "fdetachid"});

    arrayObj = JSONArray.fromObject(listDetach, jconfig);

    return arrayObj;
  }
示例#4
0
  private JSONArray getFeeBalanceJson(String serialnumid) {
    JSONArray arrayObj = null;
    HashMap<String, String> mapSerial = new HashMap<String, String>();
    mapSerial.put("FSNID", serialnumid);

    List<SerialnumberFee> listFee = serialNumService.ListSerialnumberFee(0, 1, mapSerial);

    JsonConfig jconfig = Jsonconf.getCommonJsonConf();
    jconfig.setExcludes(
        new String[] {
          "fincreaseid",
          "freltable",
          "frelval",
          "foperator",
          "foperatestate",
          "foperatetime",
          "ffieldstatus"
        });

    arrayObj = JSONArray.fromObject(listFee, jconfig);
    return arrayObj;
  }