fastjson 转 map

    @SuppressWarnings({ "rawtypes", "unchecked" })
    public void resultProc(ResponseMessage rspMsg, String jsonData) {
        if (rspMsg.getStatusCode() == 200) {
            String resultContent = rspMsg.getContent();
            // 序列化方法使用Jackson为底包,可自行封装
            Map<String, Object> resultMap = JSON.parseObject(resultContent,
                    new TypeReference<Map<String, Object>>() {
                    });
            if ((Integer) resultMap.get("code") == 0) {
                List<CompanyVO> list = JSON.parseArray(jsonData,
                        CompanyVO.class);
                List<Integer> historyIds = new ArrayList<Integer>();
                for (CompanyVO link : list) {
                    historyIds.add(link.getHistoryId());
                }
                Map<String, Object> params = new HashMap<String, Object>();
                String msg = (String) resultMap.get("msg");
                params.put("historyIds", historyIds);
                params.put("msg", msg);
                companyService.upSynFlag(params);
            }
        }

    }

posted @ 2017-05-05 17:55  albert_think  阅读(300)  评论(0编辑  收藏  举报