public PageVo getByPage(int pageNum, int pageSize) {
PageVo pageVo = new PageVo();
System.out.println("web " + pageNum);
System.out.println("web " + pageSize);
List<Map<String, Object>> getCurrentiJDByPage = iSearchService.getCurrentiJDByPage(pageNum, pageSize);
List<Map<String ,Object>> newList =new ArrayList();
for (Map<String, Object> jdMap :getCurrentiJDByPage) {
Map<String, Object> content = (Map) JSON.parse((String) jdMap.get("content"));
Map<String, Object> map = new HashMap<>();
JSONObject obj = (JSONObject) content.get("workExec");
JSONObject education = (JSONObject) content.get("education");
JSONObject position = (JSONObject) content.get("position");
JSONObject monthScale = (JSONObject) content.get("monthScale");
JSONArray welfareArray = (JSONArray) content.get("welfare");
JSONObject skill = (JSONObject)content.get("skill");
for (int i = 0; i < welfareArray.size(); i++) {
JSONObject welfare = welfareArray.getJSONObject(i);
map.put("welfareName"+i, welfare.get("name"));
}
Map<String, String> params = JSONObject.parseObject(obj.toJSONString(), new TypeReference<Map<String, String>>() {
});
Map<String, Object> educationParam = JSONObject.parseObject(education.toJSONString(), new TypeReference<Map<String, Object>>() {
});
Map<String, Object> positionParam = JSONObject.parseObject(position.toJSONString(), new TypeReference<Map<String, Object>>() {
});
Map<String, String> monthScaleParam = JSONObject.parseObject(monthScale.toJSONString(), new TypeReference<Map<String, String>>() {
});
Map<String, String> skillParam = JSONObject.parseObject(skill.toJSONString(), new TypeReference<Map<String, String>>() {
});
String database = skillParam.get("database");
String devEnvironment = skillParam.get("devEnvironment");
String devFrame = skillParam.get("devFrame");
String importantDto = skillParam.get("importantDto"); JSONObject important = (JSONObject)JSONObject.parse(importantDto);
JSONArray devLanguage = (JSONArray) important.get("devLanguage");
JSONArray modelAlgo = (JSONArray) important.get("modelAlgo"); JSONArray parse = (JSONArray)JSONArray.parse(database);
JSONArray environment = (JSONArray)JSONArray.parse(devEnvironment);
JSONArray frame = (JSONArray)JSONArray.parse(devFrame);
for (int i = 0; i < environment.size(); i++) {
JSONObject json = environment.getJSONObject(i);
map.put("devEnvironment"+i, json.get("name"));
}
for (int i = 0; i < devLanguage.size(); i++) {
JSONObject json = devLanguage.getJSONObject(i); // 遍历 jsonarray 数组,把每一个对象转成 json 对象
map.put("devLanguage"+i, json.get("name"));
}
for (int i = 0; i < modelAlgo.size(); i++) {
JSONObject json = modelAlgo.getJSONObject(i); // 遍历 jsonarray 数组,把每一个对象转成 json 对象
map.put("modelAlgo"+i, json.get("name"));
}
for (int i = 0; i < frame.size(); i++) {
JSONObject json = frame.getJSONObject(i);
map.put("frame"+i, json.get("name"));
}
for (int i = 0; i < parse.size(); i++) {
JSONObject json = parse.getJSONObject(i);
map.put("database"+i, json.get("name"));
} Integer peopleSize = (Integer)jdMap.get("people_size");
Integer financeStep = (Integer)jdMap.get("finance_step");
switch (financeStep){
case 0 :
map.put("financeStep", ResumeScaleEnum.UNLIMITED.getMessage());
break;
case 1 :
map.put("financeStep", ResumeScaleEnum.PRE_A.getMessage());
break;
case 2 :
map.put("financeStep", ResumeScaleEnum.PRE_B.getMessage());
break;
case 3 :
map.put("financeStep", ResumeScaleEnum.PRE_C.getMessage());
break;
case 4 :
map.put("financeStep", ResumeScaleEnum.PRE_D.getMessage());
break;
case 5 :
map.put("financeStep", ResumeScaleEnum.PRE_ANGEL.getMessage());
break;
case 6 :
map.put("financeStep", ResumeScaleEnum.UN_FINANCE.getMessage());
break;
case 7 :
map.put("financeStep", ResumeScaleEnum.LISTED.getMessage());
break;
case 8 :
map.put("financeStep", ResumeScaleEnum.PRE_D_ABOVE.getMessage());
break;
}
switch (peopleSize){
case 0 :
map.put("peopleSize", ResumePeopleSizeEnum.UNLIMITED.getMessage());
break;
case 1 :
map.put("peopleSize", ResumePeopleSizeEnum.ONE.getMessage());
break;
case 2 :
map.put("peopleSize", ResumePeopleSizeEnum.TWO.getMessage());
break;
case 3 :
map.put("peopleSize", ResumePeopleSizeEnum.THREE.getMessage());
break;
case 4 :
map.put("peopleSize", ResumePeopleSizeEnum.FOUR.getMessage());
break;
case 5 :
map.put("peopleSize", ResumePeopleSizeEnum.FIVE.getMessage());
break;
}
String industryIds = (String) jdMap.get("industry_ids");
String[] industryIdsArr = industryIds.split(",");
String str = "";
if (industryIdsArr != null && industryIdsArr.length > 0) {
for (int i = 0; i < industryIdsArr.length; i++) {
Industry industry = resumeService.getIndustryById(industryIdsArr[i]);
str += industry.getName() + ",";
}
}
str = str.substring(0, str.length() - 1);
map.put("industryName",str);
map.put("id",jdMap.get("id"));
map.put("logoUrl", jdMap.get("logo_url"));
map.put("name", jdMap.get("name"));
map.put("companyId", jdMap.get("company_id"));
map.put("workAddress", content.get("workAddress"));
map.put("workExec", params.get("name"));
map.put("education", educationParam.get("name"));
map.put("position", positionParam.get("name"));
map.put("monthScaleSmall", monthScaleParam.get("small"));
map.put("monthScaleBig", monthScaleParam.get("big"));
newList.add(map);
}
pageVo.setList(newList);
pageVo.setPs(pageSize);
pageVo.setPn(pageNum);
return pageVo;
}

String类型转json 转JSONObject 转 JSONArray 以及 遍历的更多相关文章

  1. 将String类型的json数据转换为真正的json数据

    问题 在做JavaWeb项目的时候,我们经常需要将Java对象转化为Json数据格式响应到前台页面,但是转化完成之后,看着是Json类型的数据格式,但实际上是字符串类型,在这里说两个方法将String ...

  2. 工具请求接口参数为string类型的JSON字符串时需要加转义字符模拟测试

    例如postMan传String类型的json字符串请后台接口时,需要\转义

  3. json:JSONObject与JSONArray的使用

    1.JAR包简介 要使程序可以运行必须引入JSON-lib包,JSON-lib包同时依赖于以下的JAR包: commons-lang.jar commons-beanutils.jar commons ...

  4. 将String类型的json字符串转换成java对象

    1,import com.fasterxml.jackson.databind.ObjectMapper; ObjectMapper mapper = new ObjectMapper(); Mycl ...

  5. fastjson对json字符串JSONObject和JSONArray互相转换操作示例

    2017-03-25 直接上代码: package com.tapt.instance; import com.alibaba.fastjson.JSON; import com.alibaba.fa ...

  6. 前端String类型转JSON类型

    在js中通过ajax获取数据后,赋值给前端树形插件zTree中的zNodes,但一直失败如图: 浏览器端报错: 于是我将zNodes变量的值直接写死,并打印这两个的值,如图 再次运行成功.浏览器控制台 ...

  7. java解析复杂json:JSONObject 和 JSONArray的使用

    在正式解析之前,我们需要下载解析Json所需要的jar包,一共有7个. 下载地址如下:https://download.csdn.net/download/zai_xia/10374080 大家也可以 ...

  8. json、JSONObject、JSONArray的应用

    type.java package jiekou.duixiang; import java.text.ParseException;import java.text.SimpleDateFormat ...

  9. 011-JSON、JSONObject、JSONArray使用、JSON数组形式字符串转换为List<Map<String,String>>的8种方法

    一.JSON数据格式 1.1.常用JSON数据格式 1.对象方式:JSONObject的数据是用 { } 来表示的, 例如: { "id" : "123", & ...

随机推荐

  1. mysql数据具体操作

    1.建表操作 前面提到的是简单的建表,这里需要提到一下外键. create table userinfo2( id int auto_increment primary key, name ), ge ...

  2. 百度云同同步盘 mac版

    百度云同步盘

  3. SecureCRT乱码问题的解决

    == 安装后默认的设置是utf8,不是汉字乱码,是一块一块的看不清,OMG... 设置这两个页面就好了

  4. SSH管理

    Netcat, ProxyCommand, ssh config 之前一直使用密码登录,但是也是可以免密码登录的,只要你使用,在服务器端生产rsa加密密钥,再使用ssh-copy-id命令,把自己本地 ...

  5. RNN/LSTM/GRU/seq2seq公式推导

    概括:RNN 适用于处理序列数据用于预测,但却受到短时记忆的制约.LSTM 和 GRU 采用门结构来克服短时记忆的影响.门结构可以调节流经序列链的信息流.LSTM 和 GRU 被广泛地应用到语音识别. ...

  6. iOS 新浪微博-2.0 搜索框/标题带箭头/下拉菜单

    不管是搜索框还是下拉菜单,我们都需要对背景的图片进行拉伸.定义一个Category分类对图片进行操作. UIImage+Effect.h #import <UIKit/UIKit.h> @ ...

  7. Linux 重启nginx

    重启 1.验证nginx配置文件是否正确 方法一:进入nginx安装目录sbin下,输入命令./nginx -t 看到如下显示nginx.conf syntax is ok nginx.conf te ...

  8. 【网络设备】某防火墙基于IP地址的目的地址转换

    由于来自Internet的对政府,企业的网络攻击日益频繁,因此需要对内网中向外网提供访问服务的关键设备进行有效保护.采用目的地址NAT可以有效地将内部网络地址对外隐藏. 图中:公网中Internet用 ...

  9. CSU 1817 Bones’s Battery Submit(二分+Floyd)

    Bones's Battery Submit [题目链接]Bones's Battery Submit [题目类型]二分+Floyd &题意: 有n个点,m条边,从点ui到点vi的费电量是di ...

  10. C#6.0中10大新特性的应用和总结

    微软发布C#6.0.VS2015等系列产品也有一段时间了,但是网上的教程却不多,这里真对C#6.0给大家做了一些示例,分享给大家.   微软于2015年7月21日发布了Visual Studio 20 ...