예제 #1
0
 @SuppressWarnings("unchecked")
 public static SataMap sataMapGetSubSataMap(SataMap sataMap) {
   SataMap tempSataMap = new SataMapImpl();
   for (Iterator<Map.Entry<String, Object>> it = sataMap.entrySet().iterator(); it.hasNext(); ) {
     Entry<String, Object> entry = it.next();
     if (entry.getValue() instanceof SataList) {
       String key = entry.getKey();
       SataList sataList = (SataList) entry.getValue();
       for (int i = 0; i < sataList.size(); i++) {
         if (sataList.get(i) instanceof SataMap) {
           SataMap map = (SataMap) sataList.get(i);
           if (map.containsKey("PARA_ID")) {
             String para_id = map.getString("PARA_ID").toUpperCase();
             String para_value = map.getString("PARA_VALUE");
             tempSataMap.put(para_id, para_value);
           }
         }
       }
       // sataMap.remove(key);
     } else {
       tempSataMap.put(entry.getKey(), entry.getValue());
     }
   }
   return tempSataMap;
 }
예제 #2
0
 /** @Author:LZY @Date:2015/2/26 @Fuction:JSONObject SataMap 互转 */
 @SuppressWarnings("unchecked")
 public static SataMap json2SataMap(JSONObject json) {
   SataMap sataMap = new SataMapImpl();
   for (Iterator<Entry<String, Object>> it = json.entrySet().iterator(); it.hasNext(); ) {
     Entry<String, Object> entry = it.next();
     if (entry.getValue() instanceof JSONArray) {
       SataList list = getSubSataList((JSONArray) entry.getValue());
       sataMap.put(entry.getKey(), list);
     } else {
       sataMap.put(entry.getKey(), entry.getValue());
     }
   }
   return sataMap;
 }
예제 #3
0
  @SuppressWarnings("unchecked")
  public static SataMap sataMap2SataMap(SataMap subSataMap) {
    SataMap sataMap = new SataMapImpl();
    for (Iterator<Map.Entry<String, Object>> it = subSataMap.entrySet().iterator();
        it.hasNext(); ) {
      Entry<String, Object> entry = it.next();
      if (entry.getValue() instanceof SataList) {
        SataList sataList = (SataList) entry.getValue();
        for (int i = 0; i < sataList.size(); i++) {
          if (sataList.get(i) instanceof SataMap) {
            sataMap.putAll(sataMap2SataMap((SataMap) sataList.get(i)));
          }
        }
      } else {

        sataMap.put(entry.getKey().toString(), entry.getValue());
      }
    }
    return sataMap;
  }
예제 #4
0
 // 将data里面指定的值除以100
 public static void div100(SataMap data, String key) {
   if (key == null || key.equals("")) key = "0";
   data.put(key, div100(data.getString(key)));
 }