1. 程式人生 > >從WS查出的 RESULT 來進行資料 格式轉換 組裝成MAP

從WS查出的 RESULT 來進行資料 格式轉換 組裝成MAP

   IPoApplyWsProxy proxy = new IPoApplyWsProxy();
            String result = proxy.getCheckerConfigList(json.toString());

  JSONObject jsonObject = new JSONObject(result);

  String newOutput = commonResultLists(result, jsonObject.getString("checkerConfigList"),"AUDITER");

    private String commonResultLists(String output, String handler,String handlerName) throws AppException, JSONException
    {
        //把查詢出的資料封裝成map
        JSONArray array =new JSONArray();
        if (!"[]".equals(output.trim()))
        {
            List<Map<String, Object>> returnList = JsonUtil.jsonArrayToList(new JSONArray(handler));
            for(Map<String, Object> lists : returnList)
                {
//                    object.put("PRODUCT_LINE_NAME", (String)lists.get("PRODUCT_LINE_NAME"));
//                    object.put("PRODUCT_FAMILY_NAME", (String)lists.get("PRODUCT_FAMILY_NAME"));
//                    object.put("PRODUCT_NAME", (String)lists.get("PRODUCT_NAME"));
//                    object.put("PRODUCT_LINE", (String)lists.get("PRODUCT_LINE"));
//                    object.put("PRODUCT_FAMILY", (String)lists.get("PRODUCT_FAMILY"));
//                    object.put("PRODUCT", (String)lists.get("PRODUCT"));
//                    object.put("SECOND_HANDLER", fillAllUserInfoByW3((String)lists.get("SECOND_HANDLER")));
                    lists.put(handlerName, fillAllUserInfoByW3((String)lists.get(handlerName)));
                    array.put(lists);
                }
        }
       
        return array.toString();
    }