|
@ -1,5 +1,7 @@ |
|
|
package com.ruoyi.rfMsg.controller; |
|
|
package com.ruoyi.rfMsg.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import com.ruoyi.common.annotation.Log; |
|
|
import com.ruoyi.common.annotation.Log; |
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
@ -14,7 +16,10 @@ import org.springframework.stereotype.Controller; |
|
|
import org.springframework.ui.ModelMap; |
|
|
import org.springframework.ui.ModelMap; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* rf测试历史结果Controller |
|
|
* rf测试历史结果Controller |
|
@ -53,14 +58,44 @@ public class VnaRawDataController extends BaseController |
|
|
|
|
|
|
|
|
@PostMapping("/getDataById/{id}") |
|
|
@PostMapping("/getDataById/{id}") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public String getDataById(@PathVariable("id") Long id) |
|
|
public List getDataById(@PathVariable("id") Long id) |
|
|
{ |
|
|
{ |
|
|
startPage(); |
|
|
startPage(); |
|
|
VnaRawData vnaRawData = vnaRawDataService.selectVnaRawDataById(id); |
|
|
VnaRawData vnaRawData = vnaRawDataService.selectVnaRawDataById(id); |
|
|
String frequency = vnaRawData.getFrequency(); |
|
|
String frequency = vnaRawData.getFrequency(); |
|
|
// JSONObject jsonObject = (JSONObject) JSONValue.parse(frequency.toJs());
|
|
|
|
|
|
System.out.println(frequency); |
|
|
System.out.println(frequency); |
|
|
return frequency; |
|
|
Map mapObj = JSONObject.parseObject(frequency,Map.class); |
|
|
|
|
|
List listKey = new ArrayList(); |
|
|
|
|
|
List listValue = new ArrayList(); |
|
|
|
|
|
List listValueList = new ArrayList(); |
|
|
|
|
|
// System.out.println("这个是用JSONObject的parseObject方法并执行返回类型来解析JSON字符串!!!");
|
|
|
|
|
|
// for (Object map: mapObj.entrySet()){
|
|
|
|
|
|
// System.out.println(((Map.Entry)map).getKey()+":"+((Map.Entry)map).getValue());
|
|
|
|
|
|
// listKey.add(((Map.Entry)map).getKey());
|
|
|
|
|
|
// listValue.add(((Map.Entry)map).getValue());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// LinkedHashMap<String, String> map = JSONUtil.toBean(frequency, new TypeReference<LinkedHashMap<String, String>>() {}, true);
|
|
|
|
|
|
// for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
|
|
|
// System.out.println(entry.getKey() + ": " + entry.getValue());
|
|
|
|
|
|
// listKey.add((entry.getKey()));
|
|
|
|
|
|
// listValue.add((entry.getValue()));
|
|
|
|
|
|
// }
|
|
|
|
|
|
try { |
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
com.fasterxml.jackson.core.type.TypeReference<LinkedHashMap<String, Double>> typeRef = new com.fasterxml.jackson.core.type.TypeReference<LinkedHashMap<String, Double>>() {}; |
|
|
|
|
|
LinkedHashMap<String, Double> map = objectMapper.readValue(frequency, typeRef); |
|
|
|
|
|
for (Map.Entry<String, Double> entry : map.entrySet()) { |
|
|
|
|
|
System.out.println(entry.getKey() + ": " + entry.getValue()); |
|
|
|
|
|
listKey.add((entry.getKey())); |
|
|
|
|
|
listValue.add((entry.getValue())); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
System.out.println("序列化出错"); |
|
|
|
|
|
} |
|
|
|
|
|
listValueList.add(listKey); |
|
|
|
|
|
listValueList.add(listValue); |
|
|
|
|
|
System.out.println(listValueList); |
|
|
|
|
|
return listValueList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|