add - 参数配置页面,change - 传感器实时数据展示

main
wenjy 3 years ago
parent 6eabc5a1d7
commit 4bb93d081d

@ -1,12 +0,0 @@
#使用jdk8作为基础镜像
FROM java:8
#指定作者
MAINTAINER WenJY
#暴露容器的8088端口
EXPOSE 8089
#将复制指定的xxl-job-admin-2.1.0.jar为容器中的job.jar相当于拷贝到容器中取了个别名
ADD target/ruoyi-admin.jar /jrm-intelligent-iot.jar
#创建一个新的容器并在新的容器中运行命令
RUN bash -c 'touch /jrm-intelligent-iot.jar'
#相当于在容器中用cmd命令执行jar包 指定外部配置文件
ENTRYPOINT ["java","-jar","/jrm-intelligent-iot.jar"]

@ -0,0 +1,114 @@
package com.ruoyi.web.controller.base;
import java.util.List;
import com.alibaba.fastjson.JSONArray;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysParamConfig;
import com.ruoyi.system.service.ISysParamConfigService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author WenJY
* @date 2022-03-16
*/
@Controller
@RequestMapping("/base/sysParamConfig")
public class SysParamConfigController extends BaseController {
private String prefix = "base/sysParamConfig";
@Autowired private ISysParamConfigService sysParamConfigService;
@RequiresPermissions("base:sysParamConfig:view")
@GetMapping()
public String sysParamConfig() {
return prefix + "/sysParamConfig";
}
/** 查询传感器参数配置列表 */
@RequiresPermissions("base:sysParamConfig:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysParamConfig sysParamConfig) {
startPage();
List<SysParamConfig> list = sysParamConfigService.selectSysParamConfigList(sysParamConfig);
return getDataTable(list);
}
@PostMapping("/getParameter")
@ResponseBody
public String getParameter(String sensorTypeId) {
SysParamConfig sysParamConfig = new SysParamConfig();
sysParamConfig.setParamType(sensorTypeId);
List<SysParamConfig> sysParamConfigs =
sysParamConfigService.selectSysParamConfigList(sysParamConfig);
return JSONArray.toJSONString(sysParamConfigs);
}
/** 导出传感器参数配置列表 */
@RequiresPermissions("base:sysParamConfig:export")
@Log(title = "传感器参数配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysParamConfig sysParamConfig) {
List<SysParamConfig> list = sysParamConfigService.selectSysParamConfigList(sysParamConfig);
ExcelUtil<SysParamConfig> util = new ExcelUtil<SysParamConfig>(SysParamConfig.class);
return util.exportExcel(list, "传感器参数配置数据");
}
/** 新增传感器参数配置 */
@GetMapping("/add")
public String add() {
return prefix + "/add";
}
/** 新增保存传感器参数配置 */
@RequiresPermissions("base:sysParamConfig:add")
@Log(title = "传感器参数配置", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysParamConfig sysParamConfig) {
return toAjax(sysParamConfigService.insertSysParamConfig(sysParamConfig));
}
/** 修改传感器参数配置 */
@GetMapping("/edit/{ObjId}")
public String edit(@PathVariable("ObjId") Long ObjId, ModelMap mmap) {
SysParamConfig sysParamConfig = sysParamConfigService.selectSysParamConfigByObjId(ObjId);
mmap.put("sysParamConfig", sysParamConfig);
return prefix + "/edit";
}
/** 修改保存传感器参数配置 */
@RequiresPermissions("base:sysParamConfig:edit")
@Log(title = "传感器参数配置", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysParamConfig sysParamConfig) {
return toAjax(sysParamConfigService.updateSysParamConfig(sysParamConfig));
}
/** 删除传感器参数配置 */
@RequiresPermissions("base:sysParamConfig:remove")
@Log(title = "传感器参数配置", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids) {
return toAjax(sysParamConfigService.deleteSysParamConfigByObjIds(ids));
}
}

@ -1,9 +1,12 @@
package com.ruoyi.web.controller.iot;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.json.JsonUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.BaseSensorInfo;
import com.ruoyi.system.domain.BaseSensorType;
@ -11,22 +14,22 @@ import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
import com.ruoyi.system.service.IBaseSensorInfoService;
import com.ruoyi.system.service.IBaseSensorTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
*
*
* @author WenJY
* @date 20220105 9:21
*/
@ -34,138 +37,177 @@ import java.util.UUID;
@RequestMapping("/iot/sensorSummary")
public class SensorSummaryController extends BaseController {
@Autowired
private IBaseSensorTypeService baseSensorTypeService;
@Autowired private IBaseSensorTypeService baseSensorTypeService;
@Autowired
private IBaseSensorInfoService baseSensorInfoService;
@Autowired private IBaseSensorInfoService baseSensorInfoService;
@GetMapping()
public String sensorSummary()
{
return "iot-ui/sensorSummary";
}
@Autowired private StringRedisTemplate redisTemplate;
@GetMapping("/getSensorType")
@ResponseBody
public String getSensorType(){
List<BaseSensorType> baseSensorTypeList = baseSensorTypeService.selectBaseSensorTypeList(new BaseSensorType(null,null,0L));
@GetMapping()
public String sensorSummary() {
return "iot-ui/sensorSummary";
}
return JSONArray.toJSONString(baseSensorTypeList);
}
@GetMapping("/getSensorType")
@ResponseBody
public String getSensorType() {
List<BaseSensorType> baseSensorTypeList =
baseSensorTypeService.selectBaseSensorTypeList(new BaseSensorType(null, null, 0L));
@GetMapping("/getSensorInfo")
@ResponseBody
public String getSensorInfo(String sensorTypeId){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return JSONArray.toJSONString(baseSensorTypeList);
}
List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(sensorTypeId, 0L));
@PostMapping("/getSensorInfo")
@ResponseBody
public String getSensorInfo(String sensorTypeId) {
List<sensorTableModel> sensorTableModelList = new ArrayList<>();
for (int i =1;i<baseSensorInfoDtos.size();i++){
sensorTableModel sensor = new sensorTableModel();
sensor.setId(i);
sensor.setEdgeId(baseSensorInfoDtos.get(i).getEdgeId());
sensor.setSensorId(baseSensorInfoDtos.get(i).getSensorId());
List<Map<String, Object>> result = new ArrayList<>();
//生成随机数,带两位小数
double a=Math.random()*10;
DecimalFormat df = new DecimalFormat( "0.00" );
String str=df.format( a );
sensor.setSensorData(new BigDecimal(str));
List<BaseSensorInfoDto> baseSensorInfoDtos =
baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(sensorTypeId, 0L));
sensor.setRssi(new BigDecimal(str));
baseSensorInfoDtos.forEach(
x -> {
Map<String, Object> info = new HashMap<>();
sensor.setCollectTime(simpleDateFormat.format(new Date()));
sensor.setMonitorLocation(baseSensorInfoDtos.get(i).getSensorLocation());
sensorTableModelList.add(sensor);
}
Object jrm = redisTemplate.opsForHash().get(x.getSensorType(), x.getSensorId());
return JSONArray.toJSONString(sensorTableModelList);
}
if (jrm != null) {
JSONObject jsonObject = JSON.parseObject(jrm.toString());
Object param = jsonObject.get("param");
}
JSONObject data = JSON.parseObject(param.toString());
class sensorTableModel
{
private int id;
JSONObject datavalue = JSON.parseObject(data.get("datavalue").toString());
private String edgeId;
info = JsonUtils.JSONObjectToMap(datavalue);
private String sensorId;
info.put("datatype", data.get("datatype"));
}
private BigDecimal sensorData;
info.put("id", 1);
private BigDecimal rssi;
info.put("sensorId", x.getSensorId());
private BigDecimal voltage;
info.put("edgeId", x.getEdgeId());
private String collectTime;
info.put("sensorLocation", x.getSensorLocation());
private String monitorLocation;
result.add(info);
});
public int getId() {
return id;
}
String s = JSONArray.toJSONString(result);
System.out.println("传感器数据展示" + s);
public void setId(int id) {
this.id = id;
}
return s;
}
public String getEdgeId() {
return edgeId;
}
public void test() {
public void setEdgeId(String edgeId) {
this.edgeId = edgeId;
}
Map<String, Object> result = new HashMap<String, Object>();
public String getSensorId() {
return sensorId;
}
Object jrm = redisTemplate.opsForHash().get("temperature", "BYQ001-001");
JSONObject jsonObject = JSON.parseObject(jrm.toString());
public void setSensorId(String sensorId) {
this.sensorId = sensorId;
}
Object param = jsonObject.get("param");
public BigDecimal getSensorData() {
return sensorData;
}
JSONObject data = JSON.parseObject(param.toString());
public void setSensorData(BigDecimal sensorData) {
this.sensorData = sensorData;
}
// System.out.println("dataType取值:"+data.get("datatype"));
public BigDecimal getRssi() {
return rssi;
}
JSONObject datavalue = JSON.parseObject(data.get("datavalue").toString());
public void setRssi(BigDecimal rssi) {
this.rssi = rssi;
}
// System.out.println("datavalue:"+data.get("datavalue"));
public BigDecimal getVoltage() {
return voltage;
}
Map<String, Object> children = JsonUtils.JSONObjectToMap(datavalue);
public void setVoltage(BigDecimal voltage) {
this.voltage = voltage;
}
children.put("datatype", data.get("datatype"));
public String getCollectTime() {
return collectTime;
for (String item : children.keySet()) {
System.out.println("key为" + item + "值为:" + children.get(item));
}
}
}
public void setCollectTime(String collectTime) {
this.collectTime = collectTime;
}
class sensorTableModel {
private int id;
public String getMonitorLocation() {
return monitorLocation;
}
private String edgeId;
public void setMonitorLocation(String monitorLocation) {
this.monitorLocation = monitorLocation;
}
private String sensorId;
private BigDecimal sensorData;
private BigDecimal rssi;
private BigDecimal voltage;
private String collectTime;
private String monitorLocation;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEdgeId() {
return edgeId;
}
public void setEdgeId(String edgeId) {
this.edgeId = edgeId;
}
public String getSensorId() {
return sensorId;
}
public void setSensorId(String sensorId) {
this.sensorId = sensorId;
}
public BigDecimal getSensorData() {
return sensorData;
}
public void setSensorData(BigDecimal sensorData) {
this.sensorData = sensorData;
}
public BigDecimal getRssi() {
return rssi;
}
public void setRssi(BigDecimal rssi) {
this.rssi = rssi;
}
public BigDecimal getVoltage() {
return voltage;
}
public void setVoltage(BigDecimal voltage) {
this.voltage = voltage;
}
public String getCollectTime() {
return collectTime;
}
public void setCollectTime(String collectTime) {
this.collectTime = collectTime;
}
public String getMonitorLocation() {
return monitorLocation;
}
public void setMonitorLocation(String monitorLocation) {
this.monitorLocation = monitorLocation;
}
}

@ -69,6 +69,18 @@ spring:
restart:
# 热部署开关
enabled: true
#Redis配置
redis:
port: 6379
password: admin123
host: 127.0.0.1
jedis:
pool:
max-active: 8
max-wait: -1ms
max-idle: 8
min-idle: 0
timeout: 5000ms
# MyBatis
mybatis:

File diff suppressed because one or more lines are too long

@ -33,12 +33,19 @@ span{
border: 0px solid #7FFFD4;
width: 80.3%;
left: 18.5%;
position: absolute;
/*overflow-x: hidden;
overflow-y: auto;*/
}
/*.sensorHistoryData .fixed-table-container{
overflow-x: hidden;
overflow-y: auto;
position: absolute;
}
height: 90%;
border: 1px solid #7FFFD4;
}*/
.searchBox {
height: 4%;
top: 2%;
@ -76,11 +83,14 @@ span{
height: 88%;
top: 10%;
color: #ddd;
overflow-x: hidden;
overflow-y: auto;
}
#table{
height: 85%;
color: #03A6BE;
table-layout: fixed;
}
#table tbody tr td{
@ -106,10 +116,16 @@ span{
}
.float-right{
border: 0px solid #ddd;
/*border: 0px solid #ddd;
position: fixed;
margin-top: 30px;
right:15%;*/
border: 0px solid #ddd;
bottom: 3%;
right:1%;
display:table-cell;
vertical-align:middle;
text-align:center;
color:#03A6BE;
}
.fixed-table-pagination{

File diff suppressed because one or more lines are too long

@ -1,80 +1,116 @@
const sensorInfoList = function(sensorTypeId) {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
url: '/iot/sensorSummary/getSensorInfo?sensorTypeId='+sensorTypeId, // 表格数据来源
pageNumber: 1,
pagination: true,
sidePagination: 'client',
pageSize: 10,
pageList: [5, 10, 15, 20, 25, 50],
showRefresh: false,
columns: [{
field: 'id',
title: '序号',
align: 'center',
const sensorInfoList = function (sensorTypeId) {
}, {
field: 'edgeId',
title: '边设备ID',
align: 'center',
}, {
field: 'sensorId',
title: '传感器ID',
align: 'center',
}, {
field: 'sensorData',
title: '传感器数据',
align: 'center',
}, {
field: 'rssi',
title: 'RSSI',
align: 'center',
}, {
field: 'voltage',
title: '电压',
align: 'center',
}, {
field: 'collectTime',
title: '时间',
align: 'center',
}, {
field: 'monitorLocation',
title: '监测位置',
align: 'center',
}]
let formData = new FormData();
formData.append("sensorTypeId", sensorTypeId);
let sensorTypeArray = [];
$.ajax({
type: "post",
url: "/base/sysParamConfig/getParameter",
data: formData,
contentType: "application/json;charset=utf-8",
dataType: "json",
json: 'callback',
processData: false,
contentType: false,
success: function (json) {
sensorTypeArray = json;
},
error: function () {
alert("错误");
}
});
$.ajax({
type: "post",
url: "/iot/sensorSummary/getSensorInfo",
data: formData,
contentType: "application/json;charset=utf-8",
dataType: "json",
json: 'callback',
processData: false,
contentType: false,
success: function (json) {
const columnsArray = [];
columnsArray.push({field: "id", title: "序号", width: 60, colspan: 1, rowspan: 1, align: "center"});
columnsArray.push({field: "edgeId", title: "边设备ID", width: 145, colspan: 1, rowspan: 1, align: "center"});
columnsArray.push({field: "sensorId", title: "传感器ID", width: 145, colspan: 1, rowspan: 1, align: "center"});
columnsArray.push({
field: "sensorLocation",
title: "监测位置",
width: 145,
colspan: 1,
rowspan: 1,
align: "center"
});
if (json.length > 0) {
for (let i = 0; i < (Object.keys(json[0])).length; i++) {//Object.keys(obj) 获取key名称
let property = (Object.keys(json[0]))[i];
if (property != "id" && property != "edgeId" && property != "sensorId" && property != 'sensorLocation' && property != 'datatype') {
columnsArray.push({
field: property,
title: sensorTypeArray.find(array => array.paramTitle === property).paramText,
width: property === "imgstr" ? 500 : 160,
align: "center",
});
}
}
}
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
data: json,
pageNumber: 1,
pagination: true,
sidePagination: 'client',
pageSize: 10,
pageList: [5, 10, 15, 20, 25, 50],
showRefresh: false,
columns: columnsArray
});
columnsArray.push();
sensorTypeArray.push();
},
error: function () {
alert("错误");
}
})
}
const onSearchByMonitorLocation = function (obj) {
setTimeout(function(){
setTimeout(function () {
var storeId = document.getElementById('table');
var rowsLength = storeId.rows.length;
var key = obj.value;
var searchCol = 7;
for(var i=1;i<rowsLength;i++){
var searchCol = 3;
for (var i = 1; i < rowsLength; i++) {
var searchText = storeId.rows[i].cells[searchCol].innerHTML;
if(searchText.match(key)){
storeId.rows[i].style.display='';
}else{
storeId.rows[i].style.display='none';
if (searchText.match(key)) {
storeId.rows[i].style.display = '';
} else {
storeId.rows[i].style.display = 'none';
}
}
},500);
}, 500);
}
const onSearchBySensorId = function (obj) {
setTimeout(function(){
setTimeout(function () {
var storeId = document.getElementById('table');
var rowsLength = storeId.rows.length;
var key = obj.value;
var searchCol = 2;
for(var i=1;i<rowsLength;i++){
for (var i = 1; i < rowsLength; i++) {
var searchText = storeId.rows[i].cells[searchCol].innerHTML;
if(searchText.match(key)){
storeId.rows[i].style.display='';
}else{
storeId.rows[i].style.display='none';
if (searchText.match(key)) {
storeId.rows[i].style.display = '';
} else {
storeId.rows[i].style.display = 'none';
}
}
},500);
}, 500);
}

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增传感器参数配置')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-sysParamConfig-add">
<div class="form-group">
<label class="col-sm-3 control-label">参数类型:</label>
<div class="col-sm-8">
<input name="paramType" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">参数标题:</label>
<div class="col-sm-8">
<input name="paramTitle" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">参数说明:</label>
<div class="col-sm-8">
<input name="paramText" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
<div class="col-sm-8">
<select name="enableFlag" class="form-control m-b" th:with="type=${@dict.getType('enable_flag')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "base/sysParamConfig"
$("#form-sysParamConfig-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-sysParamConfig-add').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改传感器参数配置')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-sysParamConfig-edit" th:object="${sysParamConfig}">
<input name="ObjId" th:field="*{ObjId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">参数类型:</label>
<div class="col-sm-8">
<input name="paramType" th:field="*{paramType}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">参数标题:</label>
<div class="col-sm-8">
<input name="paramTitle" th:field="*{paramTitle}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">参数说明:</label>
<div class="col-sm-8">
<input name="paramText" th:field="*{paramText}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
<div class="col-sm-8">
<select name="enableFlag" class="form-control m-b" th:with="type=${@dict.getType('enable_flag')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{enableFlag}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "base/sysParamConfig";
$("#form-sysParamConfig-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-sysParamConfig-edit').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('传感器参数配置列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>参数类型:</label>
<input type="text" name="paramType"/>
</li>
<li>
<label>参数标题:</label>
<input type="text" name="paramTitle"/>
</li>
<li>
<label>参数说明:</label>
<input type="text" name="paramText"/>
</li>
<li>
<label>是否启用:</label>
<select name="enableFlag" th:with="type=${@dict.getType('enable_flag')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="base:sysParamConfig:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="base:sysParamConfig:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="base:sysParamConfig:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="base:sysParamConfig:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('base:sysParamConfig:edit')}]];
var removeFlag = [[${@permission.hasPermi('base:sysParamConfig:remove')}]];
var enableFlagDatas = [[${@dict.getType('enable_flag')}]];
var prefix = ctx + "base/sysParamConfig";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "传感器参数配置",
columns: [{
checkbox: true
},
{
field: 'ObjId',
title: '主键标识',
visible: false
},
{
field: 'paramType',
title: '参数类型'
},
{
field: 'paramTitle',
title: '参数标题'
},
{
field: 'paramText',
title: '参数说明'
},
{
field: 'enableFlag',
title: '是否启用',
formatter: function(value, row, index) {
return $.table.selectDictLabel(enableFlagDatas, value);
}
},
{
field: 'createBy',
title: '创建人'
},
{
field: 'createTime',
title: '创建时间'
},
{
field: 'updateBy',
title: '更新人'
},
{
field: 'updateTime',
title: '更新时间'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.ObjId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.ObjId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

@ -14,40 +14,43 @@
</style>
</head>
<body>
<!--传感器类型-->
<iframe id="sensorType" name="a_iframe" width="100%" height="100%" frameborder="1" align="middle"
scrolling="auto" src="about:blank" style="overflow-x: hidden;
<!--传感器类型-->
<iframe id="sensorType" name="a_iframe" width="100%" height="100%" frameborder="1" align="middle"
scrolling="auto" src="about:blank" style="overflow-x: hidden;
overflow-y: scroll;">
</iframe>
</iframe>
<!-- 搜索框 -->
<div class="sensorHistoryData searchBox" style="height:6%;top: 3%">
<form action="#" class="search-form">
<input id="sensorTypeId" type="hidden" name="sensorTypeId">
<div style="width: 90%;height: 100%;border: 0px solid red;">
<label class="search-label" style="padding-left: 0%;">监测位置:</label>
<input type="text" class="form-control" onkeydown="onSearchByMonitorLocation(this)" id="monitorLocation" name="monitorLocation" placeholder="请输入监测位置">
<!-- 搜索框 -->
<div class="sensorHistoryData searchBox" style="height:6%;top: 3%">
<form action="#" class="search-form">
<input id="sensorTypeId" type="hidden" name="sensorTypeId">
<div style="width: 90%;height: 100%;border: 0px solid red;">
<label class="search-label" style="padding-left: 0%;">监测位置:</label>
<input type="text" class="form-control" onkeydown="onSearchByMonitorLocation(this)" id="monitorLocation"
name="monitorLocation" placeholder="请输入监测位置">
<label class="search-label">传感器编号:</label>
<input type="text" class="form-control" onkeydown="onSearchBySensorId(this)" id="sensorId" name="sensorId" placeholder="请输入传感器编号">
<label class="search-label">传感器编号:</label>
<input type="text" class="form-control" onkeydown="onSearchBySensorId(this)" id="sensorId" name="sensorId"
placeholder="请输入传感器编号">
<!--<label class="search-label">传感器名称:</label>
<input type="text" class="form-control" id="sensor-name" name="sensor-name" placeholder="请输入传感器名称">-->
</div>
</form>
</div>
<!--<label class="search-label">传感器名称:</label>
<input type="text" class="form-control" id="sensor-name" name="sensor-name" placeholder="请输入传感器名称">-->
</div>
</form>
</div>
<div class="sensorHistoryData sensorDataTable">
<table id="table"></table>
</div>
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/Iot-ui/scrollTable.js}"></script>
<script th:src="@{/js/Iot-ui/bootstrap-table.js}"></script>
<script th:src="@{/js/Iot-ui/sensorTableList.js}"></script>
<script th:src="@{/js/Iot-ui/sensorSummary.js}"></script>
<script th:inline="javascript">
<div class="sensorHistoryData sensorDataTable">
<table id="table"></table>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/Iot-ui/scrollTable.js}"></script>
<script th:src="@{/js/Iot-ui/bootstrap-table.js}"></script>
<script th:src="@{/js/Iot-ui/sensorTableList.js}"></script>
<script th:src="@{/js/Iot-ui/sensorSummary.js}"></script>
<script th:inline="javascript">
</script>
</script>
</body>
</html>

@ -101,6 +101,23 @@
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-keyvalue</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.13.1.RELEASE</version>
</dependency>
<!--Redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,58 @@
package com.ruoyi.common.json;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* json
* @author WenJY
* @date 20220317 10:07
*/
public class JsonUtils {
/**
* jsonObject Map
* @author WenJY
* @date 2022/3/17 10:09
* @param datavalue
* @return java.util.Map<java.lang.String,java.lang.Object>
*/
public static Map<String, Object> JSONObjectToMap(com.alibaba.fastjson.JSONObject datavalue) {
Map<String, Object> result = new HashMap<String, Object>();
for (Object obj : datavalue.keySet()) {
if (datavalue.get(obj) instanceof JSONArray) {
List<Map<String, Object>> projectSiteList =
(List<Map<String, Object>>) JSONArray.parse(datavalue.get(obj).toString());
for (int i = 0; i < projectSiteList.size(); i++) {
Map<String, Object> map1 = projectSiteList.get(i);
for (String item : map1.keySet()) {
if (map1.get(item) instanceof JSONArray) {
JSONArray jsonArray = JSONArray.parseArray(map1.get(item).toString());
for (Object jsonObject : jsonArray) {
Map<String, Object> children =
JSONObjectToMap(JSONObject.parseObject(jsonObject.toString()));
children
.keySet()
.forEach(
x -> {
result.put(item + x, children.get(x));
});
}
continue;
}
result.put(obj + item, map1.get(item));
}
}
continue;
}
result.put(obj.toString(), datavalue.get(obj));
}
return result;
}
}

@ -0,0 +1,97 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sys_param_config
*
* @author WenJY
* @date 2022-03-16
*/
public class SysParamConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long ObjId;
/** 参数类型 */
@Excel(name = "参数类型")
private String paramType;
/** 参数标题 */
@Excel(name = "参数标题")
private String paramTitle;
/** 参数说明 */
@Excel(name = "参数说明")
private String paramText;
/** 是否启用 */
@Excel(name = "是否启用")
private Long enableFlag;
public void setObjId(Long ObjId)
{
this.ObjId = ObjId;
}
public Long getObjId()
{
return ObjId;
}
public void setParamType(String paramType)
{
this.paramType = paramType;
}
public String getParamType()
{
return paramType;
}
public void setParamTitle(String paramTitle)
{
this.paramTitle = paramTitle;
}
public String getParamTitle()
{
return paramTitle;
}
public void setParamText(String paramText)
{
this.paramText = paramText;
}
public String getParamText()
{
return paramText;
}
public void setEnableFlag(Long enableFlag)
{
this.enableFlag = enableFlag;
}
public Long getEnableFlag()
{
return enableFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("ObjId", getObjId())
.append("paramType", getParamType())
.append("paramTitle", getParamTitle())
.append("paramText", getParamText())
.append("enableFlag", getEnableFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysParamConfig;
/**
* Mapper
*
* @author WenJY
* @date 2022-03-16
*/
public interface SysParamConfigMapper
{
/**
*
*
* @param ObjId
* @return
*/
public SysParamConfig selectSysParamConfigByObjId(Long ObjId);
/**
*
*
* @param sysParamConfig
* @return
*/
public List<SysParamConfig> selectSysParamConfigList(SysParamConfig sysParamConfig);
/**
*
*
* @param sysParamConfig
* @return
*/
public int insertSysParamConfig(SysParamConfig sysParamConfig);
/**
*
*
* @param sysParamConfig
* @return
*/
public int updateSysParamConfig(SysParamConfig sysParamConfig);
/**
*
*
* @param ObjId
* @return
*/
public int deleteSysParamConfigByObjId(Long ObjId);
/**
*
*
* @param ObjIds
* @return
*/
public int deleteSysParamConfigByObjIds(String[] ObjIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysParamConfig;
/**
* Service
*
* @author WenJY
* @date 2022-03-16
*/
public interface ISysParamConfigService
{
/**
*
*
* @param ObjId
* @return
*/
public SysParamConfig selectSysParamConfigByObjId(Long ObjId);
/**
*
*
* @param sysParamConfig
* @return
*/
public List<SysParamConfig> selectSysParamConfigList(SysParamConfig sysParamConfig);
/**
*
*
* @param sysParamConfig
* @return
*/
public int insertSysParamConfig(SysParamConfig sysParamConfig);
/**
*
*
* @param sysParamConfig
* @return
*/
public int updateSysParamConfig(SysParamConfig sysParamConfig);
/**
*
*
* @param ObjIds
* @return
*/
public int deleteSysParamConfigByObjIds(String ObjIds);
/**
*
*
* @param ObjId
* @return
*/
public int deleteSysParamConfigByObjId(Long ObjId);
}

@ -0,0 +1,97 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysParamConfigMapper;
import com.ruoyi.system.domain.SysParamConfig;
import com.ruoyi.system.service.ISysParamConfigService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author WenJY
* @date 2022-03-16
*/
@Service
public class SysParamConfigServiceImpl implements ISysParamConfigService
{
@Autowired
private SysParamConfigMapper sysParamConfigMapper;
/**
*
*
* @param ObjId
* @return
*/
@Override
public SysParamConfig selectSysParamConfigByObjId(Long ObjId)
{
return sysParamConfigMapper.selectSysParamConfigByObjId(ObjId);
}
/**
*
*
* @param sysParamConfig
* @return
*/
@Override
public List<SysParamConfig> selectSysParamConfigList(SysParamConfig sysParamConfig)
{
return sysParamConfigMapper.selectSysParamConfigList(sysParamConfig);
}
/**
*
*
* @param sysParamConfig
* @return
*/
@Override
public int insertSysParamConfig(SysParamConfig sysParamConfig)
{
sysParamConfig.setCreateTime(DateUtils.getNowDate());
return sysParamConfigMapper.insertSysParamConfig(sysParamConfig);
}
/**
*
*
* @param sysParamConfig
* @return
*/
@Override
public int updateSysParamConfig(SysParamConfig sysParamConfig)
{
sysParamConfig.setUpdateTime(DateUtils.getNowDate());
return sysParamConfigMapper.updateSysParamConfig(sysParamConfig);
}
/**
*
*
* @param ObjIds
* @return
*/
@Override
public int deleteSysParamConfigByObjIds(String ObjIds)
{
return sysParamConfigMapper.deleteSysParamConfigByObjIds(Convert.toStrArray(ObjIds));
}
/**
*
*
* @param ObjId
* @return
*/
@Override
public int deleteSysParamConfigByObjId(Long ObjId)
{
return sysParamConfigMapper.deleteSysParamConfigByObjId(ObjId);
}
}

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysParamConfigMapper">
<resultMap type="SysParamConfig" id="SysParamConfigResult">
<result property="ObjId" column="ObjId" />
<result property="paramType" column="Param_Type" />
<result property="paramTitle" column="Param_Title" />
<result property="paramText" column="Param_Text" />
<result property="enableFlag" column="Enable_Flag" />
<result property="createBy" column="Create_By" />
<result property="createTime" column="Create_Time" />
<result property="updateBy" column="Update_By" />
<result property="updateTime" column="Update_Time" />
</resultMap>
<sql id="selectSysParamConfigVo">
select ObjId, Param_Type, Param_Title, Param_Text, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from sys_param_config
</sql>
<select id="selectSysParamConfigList" parameterType="SysParamConfig" resultMap="SysParamConfigResult">
<include refid="selectSysParamConfigVo"/>
<where>
<if test="paramType != null and paramType != ''"> and Param_Type = #{paramType}</if>
<if test="paramTitle != null and paramTitle != ''"> and Param_Title = #{paramTitle}</if>
<if test="paramText != null and paramText != ''"> and Param_Text = #{paramText}</if>
<if test="enableFlag != null "> and Enable_Flag = #{enableFlag}</if>
</where>
</select>
<select id="selectSysParamConfigByObjId" parameterType="Long" resultMap="SysParamConfigResult">
<include refid="selectSysParamConfigVo"/>
where ObjId = #{ObjId}
</select>
<insert id="insertSysParamConfig" parameterType="SysParamConfig" useGeneratedKeys="true" keyProperty="ObjId">
insert into sys_param_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="paramType != null">Param_Type,</if>
<if test="paramTitle != null">Param_Title,</if>
<if test="paramText != null">Param_Text,</if>
<if test="enableFlag != null">Enable_Flag,</if>
<if test="createBy != null">Create_By,</if>
<if test="createTime != null">Create_Time,</if>
<if test="updateBy != null">Update_By,</if>
<if test="updateTime != null">Update_Time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="paramType != null">#{paramType},</if>
<if test="paramTitle != null">#{paramTitle},</if>
<if test="paramText != null">#{paramText},</if>
<if test="enableFlag != null">#{enableFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysParamConfig" parameterType="SysParamConfig">
update sys_param_config
<trim prefix="SET" suffixOverrides=",">
<if test="paramType != null">Param_Type = #{paramType},</if>
<if test="paramTitle != null">Param_Title = #{paramTitle},</if>
<if test="paramText != null">Param_Text = #{paramText},</if>
<if test="enableFlag != null">Enable_Flag = #{enableFlag},</if>
<if test="createBy != null">Create_By = #{createBy},</if>
<if test="createTime != null">Create_Time = #{createTime},</if>
<if test="updateBy != null">Update_By = #{updateBy},</if>
<if test="updateTime != null">Update_Time = #{updateTime},</if>
</trim>
where ObjId = #{ObjId}
</update>
<delete id="deleteSysParamConfigByObjId" parameterType="Long">
delete from sys_param_config where ObjId = #{ObjId}
</delete>
<delete id="deleteSysParamConfigByObjIds" parameterType="String">
delete from sys_param_config where ObjId in
<foreach item="ObjId" collection="array" open="(" separator="," close=")">
#{ObjId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save