Browse Source

rf测试

erp、
ling li 1 year ago
parent
commit
9a58acebc8
  1. 6
      ruoyi-admin/pom.xml
  2. 41
      ruoyi-admin/src/main/java/com/ruoyi/rfMsg/controller/VnaRawDataController.java
  3. 46
      ruoyi-admin/src/main/resources/templates/rfMsg/vnaRawData/vnaRawData.html

6
ruoyi-admin/pom.xml

@ -45,6 +45,12 @@
<version>1.5.21</version> <version>1.5.21</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.16</version>
</dependency>
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId> <artifactId>swagger-models</artifactId>

41
ruoyi-admin/src/main/java/com/ruoyi/rfMsg/controller/VnaRawDataController.java

@ -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;
} }
/** /**

46
ruoyi-admin/src/main/resources/templates/rfMsg/vnaRawData/vnaRawData.html

@ -131,28 +131,16 @@
function initSubTable(index, row, $detail) { function initSubTable(index, row, $detail) {
var parentid = row.id; var parentid = row.id;
var cur_table = $detail.html('<table id="table_' + parentid + '"></table>').find('table'); var cur_table = $detail.html('<table id="table_' + parentid + '">' +
'<tbody id="tbody_' + parentid +'"></tbody>' +
'</table>').find('table');
getData(parentid) getData(parentid)
// confirm_income_list_sun: 子表的数据
var timu = 'nihao'
var timu2 = 'zg'
$(cur_table).bootstrapTable({ $(cur_table).bootstrapTable({
// data: confirm_income_list_sun, // data: confirm_income_list_sun,
pageSize: 10, pageSize: 10,
detailView: false, //是否显示父子表 detailView: false, //是否显示父子表
singleSelect: true, singleSelect: true,
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded"
columns: [
{
title: timu,
field: "detailData",
formatter: function (value, row, index) {
console.log(row.detailData)
row.detailData = timu2
return timu2
}
}
]
}); });
} }
@ -163,6 +151,32 @@
success: function (res) { success: function (res) {
console.log(id) console.log(id)
console.log(res) console.log(res)
console.log(res[0])
console.log(res[1])
var listKey = res[0]
var listValue = res[1]
var tableThead = "";
// for (var i = 0; i < listKey.length; i++) {
// tableThead = tableThead + "<th>" + listKey[i]
// + "</th>";
// }
//将动态生成的table添加的事先隐藏的div中.
// $("#thead_"+id).html(tableThead);
var tableTbody = "<tr>";
for (var i = 0; i < listKey.length; i++) {
tableTbody += "<td>" + listKey[i] + "</td>";
}
tableTbody += "</tr><tr>";
for (var i = 0; i < listValue.length; i++) {
tableTbody += "<td>" + listValue[i] + "</td>";
}
tableTbody += "</tr>";
// for (var j = 0; j < listValue.length; j++) {
// tableTbody = tableTbody + "<tr><td>" + listValue[j]
// + "</td></tr>";
// }
//将动态生成的table添加的事先隐藏的div中.
$("#tbody_"+id).html(tableTbody);
} }
}) })
} }

Loading…
Cancel
Save