Commit 2f376401 authored by 赵啸非's avatar 赵啸非

修改部分需求

parent 550cd1c6
ALTER TABLE mortals_xhx_device ADD COLUMN `skinId` bigint (20) COMMENT '皮肤id' AFTER productName; ALTER TABLE mortals_xhx_device ADD COLUMN `skinId` bigint (20) COMMENT '皮肤id' AFTER productName;
ALTER TABLE mortals_xhx_device ADD COLUMN `skinName` varchar (512) COMMENT '皮肤名称' AFTER skinId; ALTER TABLE mortals_xhx_device ADD COLUMN `skinName` varchar (512) COMMENT '皮肤名称' AFTER skinId;
ALTER TABLE mortals_xhx_device ADD COLUMN `homeUrl` varchar (512) COMMENT '首页地址' AFTER skinName; ALTER TABLE mortals_xhx_device ADD COLUMN `homeUrl` varchar (512) COMMENT '首页地址' AFTER skinName;
ALTER TABLE mortals_xhx_device ADD COLUMN `deviceSN` varchar (512) COMMENT '设备SN码' AFTER deviceCode;
ALTER TABLE mortals_xhx_product ADD COLUMN `skinId` bigint (20) COMMENT '皮肤id' AFTER productCode; ALTER TABLE mortals_xhx_product ADD COLUMN `skinId` bigint (20) COMMENT '皮肤id' AFTER productCode;
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
DROP TABLE IF EXISTS `mortals_xhx_device`; DROP TABLE IF EXISTS `mortals_xhx_device`;
CREATE TABLE mortals_xhx_device( CREATE TABLE mortals_xhx_device(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`deviceName` varchar(20) COMMENT '设备名称', `deviceName` varchar(20) NOT NULL COMMENT '设备名称',
`deviceCode` varchar(256) NOT NULL COMMENT '设备编码,SN码等,默认为MAC地址', `deviceCode` varchar(256) COMMENT '设备编码,默认为MAC地址',
`deviceSN` varchar(256) COMMENT '设备SN码',
`deviceMac` varchar(64) COMMENT '设备的MAC地址', `deviceMac` varchar(64) COMMENT '设备的MAC地址',
`siteId` bigint(20) COMMENT '站点Id,来源基础服务平台', `siteId` bigint(20) COMMENT '站点Id,来源基础服务平台',
`siteCode` varchar(256) COMMENT '站点编号,来源基础服务平台', `siteCode` varchar(256) COMMENT '站点编号,来源基础服务平台',
...@@ -14,6 +15,9 @@ CREATE TABLE mortals_xhx_device( ...@@ -14,6 +15,9 @@ CREATE TABLE mortals_xhx_device(
`platformName` varchar(256) COMMENT '平台系统名称', `platformName` varchar(256) COMMENT '平台系统名称',
`productId` bigint(20) COMMENT '产品Id', `productId` bigint(20) COMMENT '产品Id',
`productName` varchar(256) COMMENT '产品名称', `productName` varchar(256) COMMENT '产品名称',
`skinId` bigint(20) NOT NULL COMMENT '皮肤id',
`skinName` varchar(20) NOT NULL COMMENT '皮肤名称',
`homeUrl` varchar(512) COMMENT '首页地址',
`deviceFirmId` bigint(20) COMMENT '设备生产厂商ID', `deviceFirmId` bigint(20) COMMENT '设备生产厂商ID',
`deviceFirmname` varchar(20) COMMENT '设备生产厂商名称', `deviceFirmname` varchar(20) COMMENT '设备生产厂商名称',
`deviceSrc` tinyint(2) COMMENT '设备来源(0.子设备,1.网关设备,2.直连设备)', `deviceSrc` tinyint(2) COMMENT '设备来源(0.子设备,1.网关设备,2.直连设备)',
...@@ -23,8 +27,8 @@ CREATE TABLE mortals_xhx_device( ...@@ -23,8 +27,8 @@ CREATE TABLE mortals_xhx_device(
`deviceInBuilding` tinyint(2) COMMENT '所属楼栋', `deviceInBuilding` tinyint(2) COMMENT '所属楼栋',
`deviceInFloor` tinyint(2) COMMENT '所属楼层', `deviceInFloor` tinyint(2) COMMENT '所属楼层',
`defectsLiabilityPeriod` datetime COMMENT '保修期至', `defectsLiabilityPeriod` datetime COMMENT '保修期至',
`leadingOfficial` varchar(10) COMMENT '负责人', `leadingOfficial` varchar(64) COMMENT '负责人',
`leadingOfficialTelephone` varchar(11) COMMENT '联系电话', `leadingOfficialTelephone` varchar(64) COMMENT '联系电话',
`isReceiveMess` tinyint(2) COMMENT '是否接收异常短(0.否,1.是)', `isReceiveMess` tinyint(2) COMMENT '是否接收异常短(0.否,1.是)',
`devicePhotoPath` varchar(256) COMMENT '设备图片', `devicePhotoPath` varchar(256) COMMENT '设备图片',
`ip` varchar(64) COMMENT '设备访问ip', `ip` varchar(64) COMMENT '设备访问ip',
...@@ -38,7 +42,7 @@ CREATE TABLE mortals_xhx_device( ...@@ -38,7 +42,7 @@ CREATE TABLE mortals_xhx_device(
`onlineTime` datetime COMMENT '最近上线时间', `onlineTime` datetime COMMENT '最近上线时间',
`offlineTime` datetime COMMENT '最近离线时间', `offlineTime` datetime COMMENT '最近离线时间',
`deleted` tinyint(2) COMMENT '是否删除(0.否,1.是)', `deleted` tinyint(2) COMMENT '是否删除(0.否,1.是)',
`source` tinyint(2) COMMENT '收不来源(0.旧设备,1.新设备)', `source` tinyint(2) COMMENT '设备来源(0.旧设备,1.新设备)',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户', `updateUserId` bigint(20) COMMENT '更新用户',
...@@ -46,6 +50,8 @@ CREATE TABLE mortals_xhx_device( ...@@ -46,6 +50,8 @@ CREATE TABLE mortals_xhx_device(
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备';
-- ---------------------------- -- ----------------------------
-- 平台系统表 -- 平台系统表
-- ---------------------------- -- ----------------------------
......
...@@ -202,9 +202,9 @@ ins,a { ...@@ -202,9 +202,9 @@ ins,a {
} }
} }
.is-active{ // .is-active{
background-color: red; // background-color: red;
} // }
.mobile-table-card{ .mobile-table-card{
margin: 10px auto; margin: 10px auto;
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
clearTimeout(this.loadingTimer); clearTimeout(this.loadingTimer);
}, },
methods: { methods: {
test(){ test() {
console.log("test") console.log("test")
}, },
// 开启、关闭 // 开启、关闭
...@@ -255,6 +255,21 @@ export default { ...@@ -255,6 +255,21 @@ export default {
handleSortChange() { handleSortChange() {
}, },
// 自定义索引号
handleIndexMethod(index) {
//prePageResult 每页条数
let size = this.tableData.pageInfo.prePageResult;
let page = this.tableData.pageInfo.currPage;
let count = parseInt(size) * (parseInt(page) - 1)
return count + index + 1;
},
// 自定义表格选择行是否能勾选
handleSelectableMethod(row, index) {
return true;
},
// 设置单元行样式 // 设置单元行样式
tableRowClassName() { }, tableRowClassName() { },
// 批量删除 // 批量删除
...@@ -363,6 +378,8 @@ export default { ...@@ -363,6 +378,8 @@ export default {
tableRowClassName: this.tableRowClassName, tableRowClassName: this.tableRowClassName,
handleSpanMethod: this.handleSpanMethod, handleSpanMethod: this.handleSpanMethod,
handleSortChange: this.handleSortChange, handleSortChange: this.handleSortChange,
handleIndexMethod: this.handleIndexMethod,
handleSelectableMethod: this.handleSelectableMethod,
edit: this.toEdit, edit: this.toEdit,
add: this.toAdd, add: this.toAdd,
del: this.toBatchDel, del: this.toBatchDel,
......
...@@ -32,8 +32,7 @@ instance.interceptors.request.use(config => { ...@@ -32,8 +32,7 @@ instance.interceptors.request.use(config => {
// config.headers.timestamp = Math.floor(new Date().getTime() / 1000) // config.headers.timestamp = Math.floor(new Date().getTime() / 1000)
// console.log("sessionStorage",window.sessionStorage) // console.log("sessionStorage",window.sessionStorage)
config.headers.Authorization = window.sessionStorage.getItem('token') || '' config.headers.Authorization = window.sessionStorage.getItem('token') || ''
//console.log("request config and session",config,window.sessionStorage);
console.log("request config and session",config,window.sessionStorage);
return config; return config;
}, err => { }, err => {
return Promise.reject(err); return Promise.reject(err);
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
<el-table <el-table
size='small' size='small'
:data="tableData" :data="tableData"
:row-key="handleRowKeyMethod"
:span-method="handleSpanMethod" :span-method="handleSpanMethod"
:toggleRowSelection="toggleRowSelection"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@sort-change="handleSortChange" @sort-change="handleSortChange"
@row-click="handleRowClick" @row-click="handleRowClick"
...@@ -14,6 +16,8 @@ ...@@ -14,6 +16,8 @@
v-for='column in columns' v-for='column in columns'
:key='column.prop' :key='column.prop'
:type="column.type" :type="column.type"
:index="handleIndexMethod"
:selectable="handleSelectableMethod"
:prop="column.prop" :prop="column.prop"
:label="column.label" :label="column.label"
:width="column.width" :width="column.width"
...@@ -21,6 +25,7 @@ ...@@ -21,6 +25,7 @@
:show-overflow-tooltip="column.tooltip" :show-overflow-tooltip="column.tooltip"
:align="column.align || 'left'" :align="column.align || 'left'"
:formatter='column.formatter' :formatter='column.formatter'
:reserve-selection='column.reserveSelection'
:subColumns='column.subColumns' :subColumns='column.subColumns'
> >
...@@ -44,6 +49,21 @@ ...@@ -44,6 +49,21 @@
export default { export default {
props: { props: {
handleRowKeyMethod: {
type: Function,
required: false,
default: row => { return row.id }
},
handleSelectableMethod: {
type: Function,
required: false,
default: () => {}
},
handleIndexMethod: {
type: Function,
required: false,
default: () => {}
},
handleSpanMethod: { handleSpanMethod: {
type: Function, type: Function,
required: false, required: false,
...@@ -90,6 +110,8 @@ export default { ...@@ -90,6 +110,8 @@ export default {
return (!this.loading && !this.tableData.length) ? '暂无数据' : '加载中...' return (!this.loading && !this.tableData.length) ? '暂无数据' : '加载中...'
}, },
}, },
methods:{
},
data() { data() {
return {} return {}
} }
......
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
<div class="layout-menu flex flex-1"> <div class="layout-menu flex flex-1">
<!-- logo --> <!-- logo -->
<div class="layout-logo flex"> <div class="layout-logo flex">
<i class="el-icon-menu" @click='showMobileMenu=!showMobileMenu'></i> <i class="el-icon-menu" @click='showMobileMenu=!showMobileMenu'> </i>
<router-link to="/"> <router-link to="/">
<img src="../assets/images/logo.png" height="40" alt=""> <img src="../assets/images/logo.png" style="margin-bottom:5px" height="40" alt="">
<b style="color:white;font-size:18px;">&nbsp;&nbsp;&nbsp; AIOT智慧边缘物联网系统 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>
</router-link> </router-link>
</div> </div>
<!-- 一级菜单 --> <!-- 一级菜单 -->
<ul class="menu-list flex"> <ul class="menu-list flex">
...@@ -206,7 +208,7 @@ export default { ...@@ -206,7 +208,7 @@ export default {
color: #eee; color: #eee;
background: #1848c8; background: #1848c8;
.layout-logo{ .layout-logo{
width: 80px;
height: 50px; height: 50px;
.el-icon-menu{display: none} .el-icon-menu{display: none}
a{ a{
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
<span style="font-size: 18px" <span style="font-size: 18px"
><b>{{ info.siteName }}</b></span ><b>{{ info.siteName }}</b></span
> >
<el-button <el-button
type="text" type="text"
size="mini" size="mini"
...@@ -146,26 +145,20 @@ export default { ...@@ -146,26 +145,20 @@ export default {
methods: { methods: {
formatterDate, formatterDate,
contentRender(h, params){ contentRender(h, params){
//console.log(params.extData.extData.productId)
let value="el-icon-location-information" let value="el-icon-location-information"
let style="font-size:40px,color-red" let style="font-size:40px,color-red"
return (<i class={value} style="font-size:40px;color:deepskyblue" />) return (<i class={value} style="font-size:40px;color:deepskyblue" />)
}, },
getDeviceDetial(){ getDeviceDetial(){
this.$emit("choose", this.info, (val) => { this.$emit("choose", this.info, (val) => {
//data = val;
console.log("callback:" + val); console.log("callback:" + val);
}); });
}, },
refresh(data) { refresh(data) {
console.log("刷新数据", data); // console.log("刷新数据", data);
this.markersData = data; this.markersData = data;
this.markersData.map((item) => { this.markersData.map((item) => {
// console.log("marker", item);
this.setMarker(item); this.setMarker(item);
}); });
}, },
...@@ -185,11 +178,12 @@ export default { ...@@ -185,11 +178,12 @@ export default {
extData: item, extData: item,
events: { events: {
click: (e) => { click: (e) => {
console.log("getExtData", e.target.getExtData()); // console.log("getExtData", e.target.getExtData());
let exData = e.target.getExtData(); let exData = e.target.getExtData();
this.info = exData.extData; this.info = exData.extData;
this.window.position = exData.position; this.window.position = exData.position;
this.window.visible = false;
this.$nextTick(() => { this.$nextTick(() => {
this.window.visible = true; //点击点坐标,出现信息窗体 this.window.visible = true; //点击点坐标,出现信息窗体
}); });
......
...@@ -40,9 +40,6 @@ export default { ...@@ -40,9 +40,6 @@ export default {
console.log("query",query) console.log("query",query)
this.currPage = parseInt(query['page']) || 1; this.currPage = parseInt(query['page']) || 1;
this.currSize = parseInt(query['size']) || this.prePageResult; this.currSize = parseInt(query['size']) || this.prePageResult;
console.log("this.currPage",this.currPage,this.currSize)
}, },
changeHash(key, val) { changeHash(key, val) {
let {path, query} = this.$route; let {path, query} = this.$route;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<Breadcrumb /> <Breadcrumb />
</slot> --> </slot> -->
<div class="buttons"> <div class="buttons">
<el-row>
<slot name="table-head-left"></slot> <slot name="table-head-left"></slot>
<slot name="table-head-center"> <slot name="table-head-center">
<el-button <el-button
...@@ -64,6 +65,11 @@ ...@@ -64,6 +65,11 @@
></el-button> ></el-button>
</slot> </slot>
<slot name="table-head-left2"></slot> <slot name="table-head-left2"></slot>
</el-row>
<el-row>
<slot name="table-head-row2-left"></slot>
</el-row>
</div> </div>
</div> </div>
...@@ -155,6 +161,8 @@ ...@@ -155,6 +161,8 @@
:tableRowClassName="config.methods.tableRowClassName" :tableRowClassName="config.methods.tableRowClassName"
:handleSpanMethod="config.methods.handleSpanMethod" :handleSpanMethod="config.methods.handleSpanMethod"
:handleSortChange="config.methods.handleSortChange" :handleSortChange="config.methods.handleSortChange"
:handleIndexMethod="config.methods.handleIndexMethod"
:handleSelectableMethod="config.methods.handleSelectableMethod"
:handleSelectionChange="config.methods.handleSelectionChange" :handleSelectionChange="config.methods.handleSelectionChange"
:handleRowClick="config.methods.handleRowClick" :handleRowClick="config.methods.handleRowClick"
/> />
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:gutter="10" :gutter="10"
> >
<el-button type="text" size="mini" <el-button type="text" size="mini"
>数据更新:{{ formatterDate(statData.updateTime) }}</el-button >数据更新:{{ formatterDate(statData.updateTime) }} 2分钟后自动更新</el-button
> >
<el-button <el-button
icon="el-icon-refresh" icon="el-icon-refresh"
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
></el-row ></el-row
> >
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button icon="el-icon-mobile" size="mini" type="text" <i class="el-icon-mobile customIcon"> 设备总数</i>
>设备总数</el-button
>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
...@@ -75,9 +73,7 @@ ...@@ -75,9 +73,7 @@
></el-row ></el-row
> >
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button icon="el-icon-place" size="mini" type="text" <i class="el-icon-place customIcon"> 监控站点数</i>
>监控站点数</el-button
>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
...@@ -97,9 +93,7 @@ ...@@ -97,9 +93,7 @@
></el-row ></el-row
> >
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button icon="el-icon-data-line" size="mini" type="text" <i class="el-icon-data-line customIcon"> 在线设备</i>
>在线设备</el-button
>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
...@@ -117,9 +111,7 @@ ...@@ -117,9 +111,7 @@
></el-row ></el-row
> >
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button icon="el-icon-data-board" size="mini" type="text" <i class="el-icon-data-board customIcon"> 离线设备</i>
>离线设备</el-button
>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
...@@ -137,9 +129,7 @@ ...@@ -137,9 +129,7 @@
></el-row ></el-row
> >
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button icon="el-icon-data-board" size="mini" type="text" <i class="el-icon-data-board customIcon">停用设备</i>
>停用设备</el-button
>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
...@@ -165,9 +155,7 @@ ...@@ -165,9 +155,7 @@
></el-row ></el-row
> >
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button icon="el-icon-data-board" size="mini" type="text" <i class="el-icon-data-board customIcon"> 今日告警次数</i>
>今日告警次数</el-button
>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
...@@ -195,9 +183,7 @@ ...@@ -195,9 +183,7 @@
> >
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button icon="el-icon-data-board" size="mini" type="text" <i class="el-icon-data-board customIcon"> 今日消息推送</i>
>今日消息推送</el-button
>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="3" type="flex" style="height: 100%"> <el-col :span="3" type="flex" style="height: 100%">
...@@ -214,9 +200,7 @@ ...@@ -214,9 +200,7 @@
></el-row ></el-row
> >
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-button icon="el-icon-data-board" size="mini" type="text" <i class="el-icon-data-board customIcon"> 数据获取</i>
>数据获取</el-button
>
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
...@@ -264,6 +248,12 @@ export default { ...@@ -264,6 +248,12 @@ export default {
return this.$store.state.userData.currUserName; return this.$store.state.userData.currUserName;
}, },
}, },
mounted() {
this.timer = setInterval(this.syncDeviceStat, 1000 * 120);
},
beforeDestroy() {
clearInterval(this.timer);
},
created() { created() {
let today = new Date(); let today = new Date();
let query = { let query = {
...@@ -294,8 +284,6 @@ export default { ...@@ -294,8 +284,6 @@ export default {
this.findDeviceAlarm(beforeday); this.findDeviceAlarm(beforeday);
this.findDevicePush(beforeday); this.findDevicePush(beforeday);
console.log("process", process.env);
}, },
methods: { methods: {
syncDeviceStat() { syncDeviceStat() {
...@@ -549,11 +537,7 @@ export default { ...@@ -549,11 +537,7 @@ export default {
legend: { legend: {
data: ["在线率", "离线率"], data: ["在线率", "离线率"],
}, },
toolbox: {
feature: {
saveAsImage: {},
},
},
grid: { grid: {
left: "3%", left: "3%",
right: "4%", right: "4%",
...@@ -570,14 +554,14 @@ export default { ...@@ -570,14 +554,14 @@ export default {
yAxis: [ yAxis: [
{ {
type: "value", type: "value",
max: 2, max: 1,
}, },
], ],
series: [ series: [
{ {
name: "在线率", name: "在线率",
type: "line", type: "line",
stack: "Total", stack: "online",
smooth: true, smooth: true,
lineStyle: { lineStyle: {
width: 0, width: 0,
...@@ -588,11 +572,11 @@ export default { ...@@ -588,11 +572,11 @@ export default {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ {
offset: 0, offset: 0,
color: "rgb(255, 0, 135)", color: "rgb(128, 255, 165)",
}, },
{ {
offset: 1, offset: 1,
color: "rgb(135, 0, 157)", color: "rgb(1, 191, 236)",
}, },
]), ]),
}, },
...@@ -604,18 +588,18 @@ export default { ...@@ -604,18 +588,18 @@ export default {
{ {
name: "离线率", name: "离线率",
type: "line", type: "line",
stack: "Total", stack: "offline",
smooth: true, smooth: true,
lineStyle: { lineStyle: {
width: 0, width: 0,
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ {
offset: 0, offset: 0,
color: "rgb(0, 221, 255)", color: "rgb(255,99,71)",
}, },
{ {
offset: 1, offset: 1,
color: "rgb(77, 119, 255)", color: "rgb(255, 0, 0)",
}, },
]), ]),
}, },
...@@ -653,11 +637,6 @@ export default { ...@@ -653,11 +637,6 @@ export default {
legend: { legend: {
data: ["告警次数"], data: ["告警次数"],
}, },
toolbox: {
feature: {
saveAsImage: {},
},
},
grid: { grid: {
left: "3%", left: "3%",
right: "4%", right: "4%",
...@@ -728,7 +707,12 @@ export default { ...@@ -728,7 +707,12 @@ export default {
legend: { legend: {
data: ["告警次数"], data: ["告警次数"],
}, },
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: [ xAxis: [
{ {
type: "category", type: "category",
...@@ -755,6 +739,7 @@ export default { ...@@ -755,6 +739,7 @@ export default {
}, },
data() { data() {
return { return {
timer: "",
loading: false, loading: false,
indexStatInfo: {}, indexStatInfo: {},
recordListLoading: false, recordListLoading: false,
...@@ -790,6 +775,11 @@ export default { ...@@ -790,6 +775,11 @@ export default {
.warn { .warn {
color: rgb(215, 25, 25); color: rgb(215, 25, 25);
} }
.customIcon {
font-size: 13px;
margin-top: 5px;
color: dodgerblue;
}
.homeIndex { .homeIndex {
display: inline-block; display: inline-block;
......
...@@ -12,19 +12,19 @@ ...@@ -12,19 +12,19 @@
>导出</el-button >导出</el-button
> >
<el-tag slot="table-head-left2" size="mini" style="margin-left: 20px" <el-tag slot="table-head-row2-left" size="mini"
>告警次数:{{ tableData.totalCount }}</el-tag >告警次数:{{ tableData.totalCount }}</el-tag
> >
<el-tag slot="table-head-left2" size="mini" style="margin: 5px" type="danger" <el-tag slot="table-head-row2-left" size="mini" style="margin: 5px" type="danger"
>危险:{{ tableData.dangerCount }}</el-tag >危险:{{ tableData.dangerCount }}</el-tag
> >
<el-tag slot="table-head-left2" size="mini" style="margin: 5px" type="warning" <el-tag slot="table-head-row2-left" size="mini" style="margin: 5px" type="warning"
>次要:{{ tableData.subCount }}</el-tag >次要:{{ tableData.subCount }}</el-tag
> >
<el-tag slot="table-head-left2" size="mini" style="margin: 5px" type="info" <el-tag slot="table-head-row2-left" size="mini" style="margin: 5px" type="info"
>一般:{{ tableData.normalCount }}</el-tag >一般:{{ tableData.normalCount }}</el-tag
> >
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
created() { created() {
console.log("queryIn:", this.queryIn); console.log("queryIn:", this.queryIn);
if (this.queryIn.alarmDevice) { if (this.queryIn&&this.queryIn.alarmDevice) {
this.query={} this.query={}
this.query["alarmDevice"] = this.queryIn.alarmDevice; this.query["alarmDevice"] = this.queryIn.alarmDevice;
} }
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
], ],
columns: [ columns: [
{type: "selection", width: 60,label:"全选"}, {type: "selection",reserveSelection:true, width: 60,label:"全选"},
{ {
type: "index", type: "index",
label: "序号", label: "序号",
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
v-model="form.deviceName" v-model="form.deviceName"
placeholder="请输入设备名称" placeholder="请输入设备名称"
/> />
<Field <!-- <Field
label="设备编码" label="设备编码"
prop="deviceCode" prop="deviceCode"
v-model="form.deviceCode" v-model="form.deviceCode"
placeholder="请输入设备编码码" placeholder="请输入设备编码码"
/> /> -->
<Field <Field
label="MAC地址" label="MAC地址"
prop="deviceMac" prop="deviceMac"
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
v-model="form.productId" v-model="form.productId"
type="select" type="select"
:enumData="dict.productId" :enumData="dict.productId"
@change="changeProduct"
placeholder="请选择产品类型" placeholder="请选择产品类型"
/> />
<Field <Field
...@@ -76,7 +77,7 @@ ...@@ -76,7 +77,7 @@
prop="skinId" prop="skinId"
v-model="form.skinId" v-model="form.skinId"
@change="skinSelect" @change="skinSelect"
:enumData="dict.skinProductCodeMap[form.productCode]" :enumData="!form.productCode?{0:'无'}:dict.skinProductCodeMap[form.productCode]"
type="select" type="select"
placeholder="选择首页" placeholder="选择首页"
/> />
...@@ -184,6 +185,9 @@ export default { ...@@ -184,6 +185,9 @@ export default {
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
direction: "rtl", direction: "rtl",
urls: {
saveUrl: '/device/save',
},
toString: [ toString: [
"deviceFirmId", "deviceFirmId",
"platformId", "platformId",
...@@ -208,6 +212,10 @@ export default { ...@@ -208,6 +212,10 @@ export default {
deviceCode: [ deviceCode: [
{ required: true, message: "请输入设备编码", trigger: "blur" }, { required: true, message: "请输入设备编码", trigger: "blur" },
], ],
deviceMac: [
{ required: true, message: "请输入Mac地址", trigger: "blur" },
],
platformId: [ platformId: [
{ required: true, message: "请选择平台", trigger: "blur" }, { required: true, message: "请选择平台", trigger: "blur" },
], ],
...@@ -217,6 +225,10 @@ export default { ...@@ -217,6 +225,10 @@ export default {
}, },
methods: { methods: {
changeProduct(val){
console.log("val",val)
this.form.productCode= this.dict.productCode[val];
},
skinSelect(val) { skinSelect(val) {
this.form.skinName = this.form.skinName =
this.dict.skinProductCodeMap[this.form.productCode][val]; this.dict.skinProductCodeMap[this.form.productCode][val];
...@@ -225,7 +237,7 @@ export default { ...@@ -225,7 +237,7 @@ export default {
edit(row) { edit(row) {
this.reset(); this.reset();
this.query = { id: row.id }; this.query = { id: row.id };
this.urls.currUrl = this.pageInfo.editUrl; this.urls.currUrl = "/device/edit";
this.siteName = row.siteName; this.siteName = row.siteName;
this.siteCode = row.siteCode; this.siteCode = row.siteCode;
this.getData(); this.getData();
...@@ -235,7 +247,7 @@ export default { ...@@ -235,7 +247,7 @@ export default {
/** 新增 */ /** 新增 */
add(row) { add(row) {
this.reset(); this.reset();
this.urls.currUrl = this.pageInfo.addUrl; this.urls.currUrl = "/device/add";
this.pageInfo.type = "add"; this.pageInfo.type = "add";
this.form.siteId = row.siteId; this.form.siteId = row.siteId;
this.siteName = row.siteName; this.siteName = row.siteName;
...@@ -248,7 +260,7 @@ export default { ...@@ -248,7 +260,7 @@ export default {
view(row) { view(row) {
this.reset(); this.reset();
this.query = { id: row.id }; this.query = { id: row.id };
this.urls.currUrl = this.pageInfo.viewUrl; this.urls.currUrl = "/device/view";
this.getData(); this.getData();
this.pageInfo.type = "view"; this.pageInfo.type = "view";
this.title = "设备详细"; this.title = "设备详细";
...@@ -259,13 +271,12 @@ export default { ...@@ -259,13 +271,12 @@ export default {
}, },
/**获取数据后弹框 */ /**获取数据后弹框 */
afterRender(data) { afterRender(data) {
console.log(data)
this.open = true; this.open = true;
if (this.pageInfo.type == "add" || this.pageInfo.type == "edit") { if (this.pageInfo.type == "add" || this.pageInfo.type == "edit") {
this.form.siteName = this.siteName; this.form.siteName = this.siteName;
this.form.siteCode = this.siteCode; this.form.siteCode = this.siteCode;
} }
console.log("form:", this.form);
}, },
afterSubmit(data) { afterSubmit(data) {
......
...@@ -62,6 +62,7 @@ export default { ...@@ -62,6 +62,7 @@ export default {
"deviceStatus", "deviceStatus",
"enabled", "enabled",
"deviceFirmId", "deviceFirmId",
"source"
], ],
// 表单校验 // 表单校验
rules: { rules: {
......
...@@ -39,12 +39,12 @@ ...@@ -39,12 +39,12 @@
:disabled="isExport" :disabled="isExport"
>导出</el-button >导出</el-button
> >
<el-tag slot="table-head-left2" size="mini" style="margin-left: 20px" <el-tag slot="table-head-row2-left" size="mini"
>设备总数:{{ tableData.totalCount }}</el-tag >设备总数:{{ tableData.totalCount }}</el-tag
> >
<el-tag <el-tag
slot="table-head-left2" slot="table-head-row2-left"
size="mini" size="mini"
style="margin: 5px" style="margin: 5px"
type="success" type="success"
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
> >
<el-tag <el-tag
slot="table-head-left2" slot="table-head-row2-left"
size="mini" size="mini"
style="margin: 5px" style="margin: 5px"
type="danger" type="danger"
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
> >
<el-tag <el-tag
slot="table-head-left2" slot="table-head-row2-left"
size="mini" size="mini"
style="margin: 5px" style="margin: 5px"
type="danger" type="danger"
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
> >
<el-tag <el-tag
slot="table-head-left2" slot="table-head-row2-left"
size="mini" size="mini"
style="margin: 5px" style="margin: 5px"
type="danger" type="danger"
...@@ -197,7 +197,7 @@ export default { ...@@ -197,7 +197,7 @@ export default {
this.$message.error(error.message); this.$message.error(error.message);
}); });
this.$router.push({ query: {siteId:this.siteId } }); // this.$router.push({ query: {siteId:this.siteId } });
}, },
methods: { methods: {
switchMap(){ switchMap(){
...@@ -380,6 +380,7 @@ export default { ...@@ -380,6 +380,7 @@ export default {
/> />
); );
}, },
}, },
data() { data() {
return { return {
...@@ -430,7 +431,8 @@ export default { ...@@ -430,7 +431,8 @@ export default {
], ],
columns: [ columns: [
{ type: "selection", width: 60 }, { type: "selection",reserveSelection:true, width: 60 },
{ type: "index", label: "序号",align:"center", width: 50 },
{ label: "设备名称", prop: "deviceName" }, { label: "设备名称", prop: "deviceName" },
...@@ -471,7 +473,7 @@ export default { ...@@ -471,7 +473,7 @@ export default {
{ {
label: "操作", label: "操作",
width: 280, width: 240,
formatter: (row) => { formatter: (row) => {
return ( return (
<div> <div>
...@@ -497,18 +499,7 @@ export default { ...@@ -497,18 +499,7 @@ export default {
) : ( ) : (
"" ""
)} )}
<span> </span>
<el-button
size="mini"
type="text"
icon="el-icon-map-location"
onClick={() => {
this.updateSite(row);
}}
>
编辑站点
</el-button>
</div> </div>
); );
}, },
......
...@@ -21,6 +21,13 @@ ...@@ -21,6 +21,13 @@
> >
{{ form.deviceCode }} {{ form.deviceCode }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item
label="设备SN码"
label-class-name="labelClass"
content-class-name="contentClass"
>
{{ form.deviceSN }}
</el-descriptions-item>
<el-descriptions-item <el-descriptions-item
label="设备的MAC地址" label="设备的MAC地址"
label-class-name="labelClass" label-class-name="labelClass"
...@@ -28,13 +35,13 @@ ...@@ -28,13 +35,13 @@
> >
{{ form.deviceMac }} {{ form.deviceMac }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item <!-- <el-descriptions-item
label="站点Id" label="站点Id"
label-class-name="labelClass" label-class-name="labelClass"
content-class-name="contentClass" content-class-name="contentClass"
> >
{{ form.siteId }} {{ form.siteId }}
</el-descriptions-item> </el-descriptions-item> -->
<el-descriptions-item <el-descriptions-item
label="站点编号" label="站点编号"
label-class-name="labelClass" label-class-name="labelClass"
...@@ -87,7 +94,7 @@ ...@@ -87,7 +94,7 @@
> >
{{ util_formatters("deviceDataSourceWay", form.deviceDataSourceWay) }} {{ util_formatters("deviceDataSourceWay", form.deviceDataSourceWay) }}
</el-descriptions-item> </el-descriptions-item>
<!-- <el-descriptions-item <el-descriptions-item
label="经度" label="经度"
label-class-name="labelClass" label-class-name="labelClass"
content-class-name="contentClass" content-class-name="contentClass"
...@@ -100,7 +107,7 @@ ...@@ -100,7 +107,7 @@
content-class-name="contentClass" content-class-name="contentClass"
> >
{{ form.lati }} {{ form.lati }}
</el-descriptions-item> --> </el-descriptions-item>
<el-descriptions-item <el-descriptions-item
label="所属楼栋" label="所属楼栋"
label-class-name="labelClass" label-class-name="labelClass"
......
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
}, },
], ],
columns: [ columns: [
{type: "selection", width: 60}, { type: "selection",reserveSelection:true, width: 60 },
{type: "index",label: "序号",width: 50}, { type: "index", label: "序号",align:"center", width: 50 },
{label: "设备生产厂商名称", prop: "firmName"}, {label: "设备生产厂商名称", prop: "firmName"},
......
...@@ -40,9 +40,8 @@ ...@@ -40,9 +40,8 @@
search: [ search: [
], ],
columns: [ columns: [
{type: "selection", width: 60}, { type: "selection",reserveSelection:true, width: 60 },
{ type: "index", label: "序号",align:"center", width: 50 },
{type: "index",label: "序号",width: 50},
{label: "平台名称,名称唯一", prop: "platformName"}, {label: "平台名称,名称唯一", prop: "platformName"},
......
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
search: [], search: [],
columns: [ columns: [
// {type: "selection", width: 60}, // {type: "selection", width: 60},
{ type: "index", label: "序号", width: 50 }, { type: "index", label: "序号",align:"center", width: 50 },
{ label: "关联平台", prop: "platformId", formatter: this.formatter }, { label: "关联平台", prop: "platformId", formatter: this.formatter },
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<span <span
><b class="cardTitle">站点分布</b></span ><b class="cardTitle">站点分布</b></span
> >
<el-button <el-button
style="float: right; " style="float: right; "
@click="switchStat" @click="switchStat"
...@@ -119,11 +118,11 @@ export default { ...@@ -119,11 +118,11 @@ export default {
}, },
/** 重写查看方法 */ /** 重写查看方法 */
toView(row) { toView(row) {
console.log(row) //console.log(row)
//进入设备列表页面 //进入设备列表页面
this.$router.push({ this.$router.push({
path: "/device/list", path: "/device/list",
query: row, query: {sitestatId:row.id,siteId:row.siteId},
}); });
}, },
...@@ -142,9 +141,13 @@ export default { ...@@ -142,9 +141,13 @@ export default {
// this.siteMatterTable.siteId = node.id; // this.siteMatterTable.siteId = node.id;
//this.getSiteMatterTableData(); //this.getSiteMatterTableData();
if (node.id.search(",")) { console.log(node.id.search(",")>-1)
//this.query = { siteId: node.id.split(",")[0] ,siteIdList:node.id.split(",")};
this.query = { siteIdList: parseInt(node.id.split(",")) }; if (node.id.search(",")>-1) {
console.log(node.id)
//this.query = { siteId: node.id.split(",")[0] ,siteIdList:node.id.split(",")}
this.query = { siteIdList:node.id.split(",").map(i=>parseInt(i)) };
} else { } else {
this.query = { siteId: node.id }; this.query = { siteId: node.id };
} }
...@@ -165,7 +168,8 @@ export default { ...@@ -165,7 +168,8 @@ export default {
}, },
], ],
columns: [ columns: [
{ type: "selection", width: 60 }, { type: "selection",reserveSelection:true, width: 60 },
{ type: "index", label: "序号",align:"center", width: 50 },
{ label: "站点名称", prop: "siteName" }, { label: "站点名称", prop: "siteName" },
......
...@@ -178,12 +178,23 @@ export default { ...@@ -178,12 +178,23 @@ export default {
created() { created() {
console.log("route", this.$route); console.log("route", this.$route);
let { siteId } = this.$route.query; let { siteId } = this.$route.query;
this.info = this.$route.query; let { sitestatId } = this.$route.query;
//this.$router.push({ query: {} });
this.query = { siteId, siteId }; this.$get("/sitestat/info", { id: sitestatId })
.then(({ data }) => {
console.log(data);
this.info = data;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.map.relocate(this.info); this.$refs.map.relocate(this.info);
}); });
})
.catch((error) => {
console.error(error);
this.$message.error(error.message);
});
//this.info = this.$route.query;
this.query = {sitestatId:sitestatId, siteId, siteId };
}, },
methods: { methods: {
formatterDate, formatterDate,
...@@ -208,7 +219,6 @@ export default { ...@@ -208,7 +219,6 @@ export default {
row.siteId = this.info.siteId; row.siteId = this.info.siteId;
row.siteName = this.info.siteName; row.siteName = this.info.siteName;
row.siteCode = this.info.siteCode; row.siteCode = this.info.siteCode;
this.$refs.drawerform.add(row); this.$refs.drawerform.add(row);
}, },
switchList() { switchList() {
...@@ -217,6 +227,7 @@ export default { ...@@ -217,6 +227,7 @@ export default {
path: "/device/list", path: "/device/list",
query: { query: {
siteId: this.info.siteId, siteId: this.info.siteId,
sitestatId:this.info.id
}, },
}); });
}, },
......
<template> <template>
<div> <div>
<Map ref="map" :markersData="originData" @choose="getDetailData"> <Map ref="map" :markersData="originData" @choose="getDetailData">
<el-row :gutter="20" slot="leftTop"> <el-row :gutter="20" slot="leftTop" class="mytree">
<el-card> <el-card>
<div slot="header"> <div slot="header">
<span><b class="cardTitle">站点分布</b></span> <span><b class="cardTitle">站点分布</b></span>
...@@ -46,8 +46,6 @@ export default { ...@@ -46,8 +46,6 @@ export default {
mixins: [table, tree], mixins: [table, tree],
mounted() { mounted() {
console.log(this.pageInfo); console.log(this.pageInfo);
// console.log(2222222,this.$route.path)
//this.$route.path='/sitestat/list'
this.pageInfo.list = "/sitestat/list"; this.pageInfo.list = "/sitestat/list";
}, },
...@@ -55,15 +53,6 @@ export default { ...@@ -55,15 +53,6 @@ export default {
this.pageInfo.list = "/sitestat/list"; this.pageInfo.list = "/sitestat/list";
this.$get("/sitestat/maplist", {}).then(({ data }) => { this.$get("/sitestat/maplist", {}).then(({ data }) => {
this.originData = data; this.originData = data;
// this.originData = data.data.map((i) => {
// let obj = {};
// obj.lng = i.longitude;
// obj.lat = i.latitude;
// obj.address = i.siteName;
// obj.siteId = i.id;
// return obj;
// });
//console.log(data)
this.$refs.map.refresh(this.originData); this.$refs.map.refresh(this.originData);
}); });
...@@ -105,8 +94,8 @@ export default { ...@@ -105,8 +94,8 @@ export default {
console.log("info:", info); console.log("info:", info);
this.$router.push({ this.$router.push({
path: "/sitestat/mapDetail", path: "/sitestat/mapDetail",
query: info, // query: info,
// query: {id:info.id}, query: {sitestatId:info.id,siteId:info.siteId},
}); });
}, },
......
...@@ -130,10 +130,8 @@ export default { ...@@ -130,10 +130,8 @@ export default {
}, },
], ],
columns: [ columns: [
{ { type: "selection",reserveSelection:true, width: 60 },
type: 'selection', { type: "index", label: "序号",align:"center", width: 50 },
width: 60,
},
{ {
width: 60, width: 60,
formatter: row => { formatter: row => {
......
...@@ -37,10 +37,8 @@ export default { ...@@ -37,10 +37,8 @@ export default {
}, },
], ],
columns: [ columns: [
{ { type: "selection",reserveSelection:true, width: 60 },
type: 'selection', { type: "index", label: "序号",align:"center", width: 50 },
width: 60,
},
{ {
prop: 'name', prop: 'name',
label: '参数名称', label: '参数名称',
......
...@@ -451,10 +451,8 @@ export default { ...@@ -451,10 +451,8 @@ export default {
], ],
columns: [ columns: [
{ { type: "selection",reserveSelection:true, width: 60 },
type: "selection", { type: "index", label: "序号",align:"center", width: 50 },
width: 60,
},
{ {
prop: "name", prop: "name",
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<profiles.redis.database>7</profiles.redis.database> <profiles.redis.database>7</profiles.redis.database>
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers> <profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.queue.type>rabbitmq</profiles.queue.type> <profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.rabbitmq.host>192.168.0.98</profiles.rabbitmq.host> <profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username> <profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password> <profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
...@@ -133,6 +133,11 @@ ...@@ -133,6 +133,11 @@
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-bus</artifactId>-->
<!-- <version>3.1.2</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
......
...@@ -9,6 +9,7 @@ import java.util.Map; ...@@ -9,6 +9,7 @@ import java.util.Map;
* @author zxfei * @author zxfei
*/ */
public enum DeviceStatusEnum { public enum DeviceStatusEnum {
全部(null, "全部"),
未激活(0, "未激活"), 未激活(0, "未激活"),
离线(1, "离线"), 离线(1, "离线"),
在线(2, "在线"); 在线(2, "在线");
......
...@@ -8,10 +8,7 @@ import com.mortals.framework.exception.AppException; ...@@ -8,10 +8,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.common.code.DeviceStatusEnum; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.code.LogTypeEnum;
import com.mortals.xhx.common.code.SendStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
...@@ -69,6 +66,7 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService { ...@@ -69,6 +66,7 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
/** /**
* 统计设备 * 统计设备
* 全部设备-》激活设备与未激活-》启用与停用设备-》离线与在线设备
*/ */
private void doDeviceStat() { private void doDeviceStat() {
//查询当天统计,如果有 则更新统计结果,否则新增 //查询当天统计,如果有 则更新统计结果,否则新增
...@@ -114,17 +112,28 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService { ...@@ -114,17 +112,28 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
} }
//在线数量 //在线数量
Long deviceOnlineCount = deviceList.parallelStream().filter(f -> f.getDeviceStatus() == DeviceStatusEnum.在线.getValue()).count(); Long deviceOnlineCount = deviceList.parallelStream()
.filter(f->f.getDeviceStatus()>DeviceStatusEnum.未激活.getValue())
.filter(f->f.getEnabled()== EnabledEnum.启用.getValue())
.filter(f -> f.getDeviceStatus() == DeviceStatusEnum.在线.getValue())
.count();
deviceStatEntity.setDeviceOnlineCount(deviceOnlineCount.intValue()); deviceStatEntity.setDeviceOnlineCount(deviceOnlineCount.intValue());
deviceStatEntity.setDeviceOnlineRatio(new BigDecimal(deviceOnlineCount).divide(new BigDecimal(deviceList.size()),ROUND_HALF_DOWN).setScale(2)); deviceStatEntity.setDeviceOnlineRatio(new BigDecimal(deviceOnlineCount).divide(new BigDecimal(deviceList.size()),ROUND_HALF_DOWN).setScale(2));
//离线数量 //离线数量
Long deviceOfflineCount = deviceList.parallelStream().filter(f -> f.getDeviceStatus() == DeviceStatusEnum.离线.getValue()).count(); Long deviceOfflineCount = deviceList.parallelStream()
.filter(f->f.getDeviceStatus()>DeviceStatusEnum.未激活.getValue())
.filter(f->f.getEnabled()== EnabledEnum.启用.getValue())
.filter(f -> f.getDeviceStatus() == DeviceStatusEnum.离线.getValue())
.count();
deviceStatEntity.setDeviceOfflineCount(deviceOfflineCount.intValue()); deviceStatEntity.setDeviceOfflineCount(deviceOfflineCount.intValue());
deviceStatEntity.setDeviceOfflineRatio(new BigDecimal(deviceOfflineCount).divide(new BigDecimal(deviceList.size()),ROUND_HALF_DOWN).setScale(2)); deviceStatEntity.setDeviceOfflineRatio(new BigDecimal(deviceOfflineCount).divide(new BigDecimal(deviceList.size()),ROUND_HALF_DOWN).setScale(2));
//停用数量 //停用数量
Long deviceStopCount = deviceList.parallelStream().filter(f -> f.getEnabled() == YesNoEnum.NO.getValue()).count(); Long deviceStopCount = deviceList.parallelStream()
.filter(f->f.getDeviceStatus()>DeviceStatusEnum.未激活.getValue())
.filter(f -> f.getEnabled() == YesNoEnum.NO.getValue())
.count();
deviceStatEntity.setDeviceStopCount(deviceStopCount.intValue()); deviceStatEntity.setDeviceStopCount(deviceStopCount.intValue());
deviceStatEntity.setDeviceStopRatio(new BigDecimal(deviceStopCount).divide(new BigDecimal(deviceList.size()),ROUND_HALF_DOWN).setScale(2)); deviceStatEntity.setDeviceStopRatio(new BigDecimal(deviceStopCount).divide(new BigDecimal(deviceList.size()),ROUND_HALF_DOWN).setScale(2));
......
...@@ -25,7 +25,7 @@ import org.springframework.stereotype.Service; ...@@ -25,7 +25,7 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/** /**
* 同步用户 * 同步用户,唯一标识为用户名。
*/ */
@Slf4j @Slf4j
@Service("SyncUserTask") @Service("SyncUserTask")
......
...@@ -27,8 +27,15 @@ public class DeviceEntity extends DeviceVo { ...@@ -27,8 +27,15 @@ public class DeviceEntity extends DeviceVo {
*/ */
@Excel(name = "设备名称") @Excel(name = "设备名称")
private String deviceName; private String deviceName;
/** /**
* 设备编码,SN码等,默认为MAC地址 * 设备SN码
*/
@Excel(name = "设备SN码")
private String deviceSN;
/**
* 设备编码,默认为MAC地址
*/ */
@Excel(name = "设备编码") @Excel(name = "设备编码")
private String deviceCode; private String deviceCode;
...@@ -700,6 +707,14 @@ public class DeviceEntity extends DeviceVo { ...@@ -700,6 +707,14 @@ public class DeviceEntity extends DeviceVo {
this.homeUrl = homeUrl; this.homeUrl = homeUrl;
} }
public String getDeviceSN() {
return deviceSN;
}
public void setDeviceSN(String deviceSN) {
this.deviceSN = deviceSN;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -762,6 +777,8 @@ public class DeviceEntity extends DeviceVo { ...@@ -762,6 +777,8 @@ public class DeviceEntity extends DeviceVo {
this.deviceCode = ""; this.deviceCode = "";
this.deviceSN = "";
this.deviceMac = ""; this.deviceMac = "";
this.siteId = null; this.siteId = null;
......
...@@ -248,8 +248,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -248,8 +248,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
PlatformEntity platformEntity = platformService.get(entity.getPlatformId()); PlatformEntity platformEntity = platformService.get(entity.getPlatformId());
ProductEntity productEntity = productService.get(entity.getProductId()); ProductEntity productEntity = productService.get(entity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//注册rabbmit相关队列与绑定 //注册rabbmit相关队列与绑定 激活后才註冊綁定隊列
registerRabbitQueue(entity, platformEntity, productEntity); // registerRabbitQueue(entity, platformEntity, productEntity);
} else { } else {
throw new AppException("产品或平台不存在!"); throw new AppException("产品或平台不存在!");
} }
...@@ -330,6 +330,11 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -330,6 +330,11 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
return this.getDao(); return this.getDao();
} }
/**
* 全部设备-》激活设备与未激活-》启用与停用设备-》离线与在线设备
*
* @param context
*/
@Override @Override
public void deviceStat(Context context) { public void deviceStat(Context context) {
//查询当天统计,如果有 则更新统计结果,否则新增 //查询当天统计,如果有 则更新统计结果,否则新增
...@@ -375,17 +380,28 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -375,17 +380,28 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
} }
//在线数量 //在线数量
Long deviceOnlineCount = deviceList.parallelStream().filter(f -> f.getDeviceStatus() == DeviceStatusEnum.在线.getValue()).count(); Long deviceOnlineCount = deviceList.parallelStream()
.filter(f -> f.getDeviceStatus() > DeviceStatusEnum.未激活.getValue())
.filter(f -> f.getEnabled() == EnabledEnum.启用.getValue())
.filter(f -> f.getDeviceStatus() == DeviceStatusEnum.在线.getValue())
.count();
deviceStatEntity.setDeviceOnlineCount(deviceOnlineCount.intValue()); deviceStatEntity.setDeviceOnlineCount(deviceOnlineCount.intValue());
deviceStatEntity.setDeviceOnlineRatio(new BigDecimal(deviceOnlineCount).divide(new BigDecimal(deviceList.size()), ROUND_HALF_DOWN).setScale(2)); deviceStatEntity.setDeviceOnlineRatio(new BigDecimal(deviceOnlineCount).divide(new BigDecimal(deviceList.size()), ROUND_HALF_DOWN).setScale(2));
//离线数量 //离线数量
Long deviceOfflineCount = deviceList.parallelStream().filter(f -> f.getDeviceStatus() == DeviceStatusEnum.离线.getValue()).count(); Long deviceOfflineCount = deviceList.parallelStream()
.filter(f -> f.getDeviceStatus() > DeviceStatusEnum.未激活.getValue())
.filter(f -> f.getEnabled() == EnabledEnum.启用.getValue())
.filter(f -> f.getDeviceStatus() == DeviceStatusEnum.离线.getValue())
.count();
deviceStatEntity.setDeviceOfflineCount(deviceOfflineCount.intValue()); deviceStatEntity.setDeviceOfflineCount(deviceOfflineCount.intValue());
deviceStatEntity.setDeviceOfflineRatio(new BigDecimal(deviceOfflineCount).divide(new BigDecimal(deviceList.size()), ROUND_HALF_DOWN).setScale(2)); deviceStatEntity.setDeviceOfflineRatio(new BigDecimal(deviceOfflineCount).divide(new BigDecimal(deviceList.size()), ROUND_HALF_DOWN).setScale(2));
//停用数量 //停用数量
Long deviceStopCount = deviceList.parallelStream().filter(f -> f.getEnabled() == YesNoEnum.NO.getValue()).count(); Long deviceStopCount = deviceList.parallelStream()
.filter(f -> f.getDeviceStatus() > DeviceStatusEnum.未激活.getValue())
.filter(f -> f.getEnabled() == YesNoEnum.NO.getValue())
.count();
deviceStatEntity.setDeviceStopCount(deviceStopCount.intValue()); deviceStatEntity.setDeviceStopCount(deviceStopCount.intValue());
deviceStatEntity.setDeviceStopRatio(new BigDecimal(deviceStopCount).divide(new BigDecimal(deviceList.size()), ROUND_HALF_DOWN).setScale(2)); deviceStatEntity.setDeviceStopRatio(new BigDecimal(deviceStopCount).divide(new BigDecimal(deviceList.size()), ROUND_HALF_DOWN).setScale(2));
...@@ -423,7 +439,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -423,7 +439,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceStatService.update(deviceStatEntity); deviceStatService.update(deviceStatEntity);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("统计异常", e); log.error("统计异常", e);
throw new AppException("统计异常!"); throw new AppException("统计异常!");
......
...@@ -84,6 +84,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -84,6 +84,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
private UploadService uploadService; private UploadService uploadService;
@Autowired @Autowired
private ISkinBaseFeign skinBaseFeign; private ISkinBaseFeign skinBaseFeign;
@Autowired
private ISiteFeign siteFeign;
public DeviceController() { public DeviceController() {
super.setModuleDesc("设备"); super.setModuleDesc("设备");
...@@ -93,13 +95,15 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -93,13 +95,15 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "platformId", platformService.find(new PlatformEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getPlatformName()))); this.addDict(model, "platformId", platformService.find(new PlatformEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getPlatformName())));
this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName()))); this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())));
this.addDict(model, "productCode", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductCode())));
this.addDict(model, "deviceFirmId", firmService.find(new FirmEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getFirmName()))); this.addDict(model, "deviceFirmId", firmService.find(new FirmEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getFirmName())));
this.addDict(model, "deviceSrc", paramService.getParamBySecondOrganize("Device", "deviceSrc")); this.addDict(model, "deviceSrc", paramService.getParamBySecondOrganize("Device", "deviceSrc"));
this.addDict(model, "deviceDataSourceWay", paramService.getParamBySecondOrganize("Device", "deviceDataSourceWay")); this.addDict(model, "deviceDataSourceWay", paramService.getParamBySecondOrganize("Device", "deviceDataSourceWay"));
this.addDict(model, "isReceiveMess", paramService.getParamBySecondOrganize("Device", "isReceiveMess")); this.addDict(model, "isReceiveMess", paramService.getParamBySecondOrganize("Device", "isReceiveMess"));
this.addDict(model, "deviceStatus", paramService.getParamBySecondOrganize("Device", "deviceStatus"));
this.addDict(model, "deviceStatus", DeviceStatusEnum.getEnumMap());
this.addDict(model, "enabled", paramService.getParamBySecondOrganize("Device", "enabled")); this.addDict(model, "enabled", paramService.getParamBySecondOrganize("Device", "enabled"));
this.addDict(model, "source", DeviceSourceEnum.getEnumMap()); this.addDict(model, "source", DeviceSourceEnum.getEnumMap());
...@@ -121,6 +125,18 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -121,6 +125,18 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
@Override
protected int viewAfter(Long id, Map<String, Object> model, DeviceEntity entity, Context context) throws AppException {
if(ObjectUtils.isEmpty(entity.getLon())){
Rest<SitePdu> resp = siteFeign.info(entity.getSiteId());
if(resp.getCode()==YesNoEnum.YES.getValue()){
entity.setLon(entity.getLon());
entity.setLati(entity.getLati());
}
}
return super.viewAfter(id, model, entity, context);
}
/** /**
* 设备激活 * 设备激活
*/ */
......
...@@ -84,6 +84,8 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si ...@@ -84,6 +84,8 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
sitestatEntity.setLng(m.getLongitude()); sitestatEntity.setLng(m.getLongitude());
sitestatEntity.setLat(m.getLatitude()); sitestatEntity.setLat(m.getLatitude());
sitestatEntity.setAddress(m.getDetailAddress()); sitestatEntity.setAddress(m.getDetailAddress());
sitestatEntity.setLeadingOfficial(m.getLeadingOfficial());
sitestatEntity.setLeadingOfficialTelephone(m.getLeadingOfficialTelephone());
return sitestatEntity; return sitestatEntity;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return list.stream(); return list.stream();
...@@ -131,19 +133,9 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si ...@@ -131,19 +133,9 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
@Override @Override
public String getSiteTree(Context context) { public String getSiteTree(Context context) {
//
// UserPdu userPdu = new UserPdu();
// userPdu.setLoginName("admin");
// userPdu.setPassword("admin");
// userPdu.setSecurityCode("8888");
// String loginResp = userFeign.portalLogin(userPdu);
// JSONObject loginRespJson = JSON.parseObject(loginResp);
// String token = loginRespJson.getJSONObject("data").getString("token");
String token = context.getUser().getToken(); String token = context.getUser().getToken();
if (!ObjectUtils.isEmpty(token)) { if (!ObjectUtils.isEmpty(token)) {
String resp = siteFeign.siteTree(token); String resp = siteFeign.siteTree(token);
log.info("treeResp:" + resp);
return resp; return resp;
} }
return JSON.toJSONString(Rest.fail(ErrorCode.ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT)); return JSON.toJSONString(Rest.fail(ErrorCode.ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT));
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.IAuthTokenService; import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
...@@ -42,16 +43,8 @@ import java.util.stream.Collectors; ...@@ -42,16 +43,8 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class SitestatController extends BaseCRUDJsonBodyMappingController<SitestatService, SitestatEntity, Long> { public class SitestatController extends BaseCRUDJsonBodyMappingController<SitestatService, SitestatEntity, Long> {
@Autowired
private IAuthTokenService authTokenService;
@Autowired
private DeviceService deviceService;
@Autowired @Autowired
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Autowired
private IUserFeign userFeign;
public SitestatController() { public SitestatController() {
super.setModuleDesc("站点统计"); super.setModuleDesc("站点统计");
...@@ -61,32 +54,22 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest ...@@ -61,32 +54,22 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
super.init(model, context); super.init(model, context);
}
//todo 模拟登陆鉴权
// UserPdu userPdu = new UserPdu();
// userPdu.setLoginName("admin");
// userPdu.setPassword("admin");
// userPdu.setSecurityCode("8888");
// String loginResp = userFeign.portalLogin(userPdu);
// JSONObject loginRespJson = JSON.parseObject(loginResp);
// String token = loginRespJson.getJSONObject("data").getString("token");
// log.info("token:{}", token);
// // String token = authTokenService.getToken(request);
// String resp = siteFeign.siteTree(token);
//
// log.info("siteTree:{}", resp);
// JSONObject jsonObject = JSON.parseObject(resp);
//
// Integer code = jsonObject.getInteger("code");
// if (code == YesNoEnum.YES.getValue()) {
// JSONArray siteTreeArray = jsonObject.getJSONObject("data").getJSONArray("siteTree");
// model.put("siteTree", siteTreeArray);
// }
@Override
protected int infoAfter(Long id, Map<String, Object> model, SitestatEntity entity, Context context) throws AppException {
Rest<SitePdu> resp = siteFeign.info(entity.getSiteId());
if(resp.getCode()==YesNoEnum.YES.getValue()){
entity.setLng(resp.getData().getLongitude());
entity.setLat(resp.getData().getLatitude());
entity.setAddress(resp.getData().getDetailAddress());
entity.setLeadingOfficial(resp.getData().getLeadingOfficial());
entity.setLeadingOfficialTelephone(resp.getData().getLeadingOfficialTelephone());
}
return super.infoAfter(id, model, entity, context);
} }
/** /**
* 构建站点树 * 构建站点树
......
...@@ -49,6 +49,11 @@ spring: ...@@ -49,6 +49,11 @@ spring:
group: ${spring.cloud.nacos.discovery.group} group: ${spring.cloud.nacos.discovery.group}
namespace: ${spring.cloud.nacos.discovery.namespace} # Nacos 命名空间 dev 的编号 namespace: ${spring.cloud.nacos.discovery.namespace} # Nacos 命名空间 dev 的编号
file-extension: yaml file-extension: yaml
rabbitmq:
host: @profiles.rabbitmq.host@
port: @profiles.rabbitmq.port@
username: @profiles.rabbitmq.username@
password: @profiles.rabbitmq.password@
dao: dao:
exceptiontranslation: exceptiontranslation:
enabled: false enabled: false
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" /> <result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime" />
<result property="deviceSN" column="deviceSN" />
</resultMap> </resultMap>
...@@ -184,23 +185,26 @@ ...@@ -184,23 +185,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime, a.updateTime,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceSN') or colPickMode == 1 and data.containsKey('deviceSN')))">
a.deviceSN,
</if>
</trim> </trim>
</sql> </sql>
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="DeviceEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="DeviceEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_device insert into mortals_xhx_device
(deviceName,deviceCode,deviceMac,siteId,siteCode,siteName,platformId,platformName,productId,productName,skinId,skinName,homeUrl,deviceFirmId,deviceFirmname,deviceSrc,deviceDataSourceWay,lon,lati,deviceInBuilding,deviceInFloor,defectsLiabilityPeriod,leadingOfficial,leadingOfficialTelephone,isReceiveMess,devicePhotoPath,ip,centernum,port,deviceTopic,deviceStatus,enabled,deviceAuthCode,deviceRemark,onlineTime,offlineTime,deleted,source,createUserId,createTime,updateUserId,updateTime) (deviceName,deviceCode,deviceMac,siteId,siteCode,siteName,platformId,platformName,productId,productName,skinId,skinName,homeUrl,deviceFirmId,deviceFirmname,deviceSrc,deviceDataSourceWay,lon,lati,deviceInBuilding,deviceInFloor,defectsLiabilityPeriod,leadingOfficial,leadingOfficialTelephone,isReceiveMess,devicePhotoPath,ip,centernum,port,deviceTopic,deviceStatus,enabled,deviceAuthCode,deviceRemark,onlineTime,offlineTime,deleted,source,createUserId,createTime,updateUserId,updateTime,deviceSN)
VALUES VALUES
(#{deviceName},#{deviceCode},#{deviceMac},#{siteId},#{siteCode},#{siteName},#{platformId},#{platformName},#{productId},#{productName},#{skinId},#{skinName},#{homeUrl},#{deviceFirmId},#{deviceFirmname},#{deviceSrc},#{deviceDataSourceWay},#{lon},#{lati},#{deviceInBuilding},#{deviceInFloor},#{defectsLiabilityPeriod},#{leadingOfficial},#{leadingOfficialTelephone},#{isReceiveMess},#{devicePhotoPath},#{ip},#{centernum},#{port},#{deviceTopic},#{deviceStatus},#{enabled},#{deviceAuthCode},#{deviceRemark},#{onlineTime},#{offlineTime},#{deleted},#{source},#{createUserId},#{createTime},#{updateUserId},#{updateTime}) (#{deviceName},#{deviceCode},#{deviceMac},#{siteId},#{siteCode},#{siteName},#{platformId},#{platformName},#{productId},#{productName},#{skinId},#{skinName},#{homeUrl},#{deviceFirmId},#{deviceFirmname},#{deviceSrc},#{deviceDataSourceWay},#{lon},#{lati},#{deviceInBuilding},#{deviceInFloor},#{defectsLiabilityPeriod},#{leadingOfficial},#{leadingOfficialTelephone},#{isReceiveMess},#{devicePhotoPath},#{ip},#{centernum},#{port},#{deviceTopic},#{deviceStatus},#{enabled},#{deviceAuthCode},#{deviceRemark},#{onlineTime},#{offlineTime},#{deleted},#{source},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{deviceSN})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_device insert into mortals_xhx_device
(deviceName,deviceCode,deviceMac,siteId,siteCode,siteName,platformId,platformName,productId,productName,skinId,skinName,homeUrl,deviceFirmId,deviceFirmname,deviceSrc,deviceDataSourceWay,lon,lati,deviceInBuilding,deviceInFloor,defectsLiabilityPeriod,leadingOfficial,leadingOfficialTelephone,isReceiveMess,devicePhotoPath,ip,centernum,port,deviceTopic,deviceStatus,enabled,deviceAuthCode,deviceRemark,onlineTime,offlineTime,deleted,source,createUserId,createTime,updateUserId,updateTime) (deviceName,deviceCode,deviceMac,siteId,siteCode,siteName,platformId,platformName,productId,productName,skinId,skinName,homeUrl,deviceFirmId,deviceFirmname,deviceSrc,deviceDataSourceWay,lon,lati,deviceInBuilding,deviceInFloor,defectsLiabilityPeriod,leadingOfficial,leadingOfficialTelephone,isReceiveMess,devicePhotoPath,ip,centernum,port,deviceTopic,deviceStatus,enabled,deviceAuthCode,deviceRemark,onlineTime,offlineTime,deleted,source,createUserId,createTime,updateUserId,updateTime,deviceSN)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.deviceName},#{item.deviceCode},#{item.deviceMac},#{item.siteId},#{item.siteCode},#{item.siteName},#{item.platformId},#{item.platformName},#{item.productId},#{item.productName},#{item.skinId},#{item.skinName},#{item.homeUrl},#{item.deviceFirmId},#{item.deviceFirmname},#{item.deviceSrc},#{item.deviceDataSourceWay},#{item.lon},#{item.lati},#{item.deviceInBuilding},#{item.deviceInFloor},#{item.defectsLiabilityPeriod},#{item.leadingOfficial},#{item.leadingOfficialTelephone},#{item.isReceiveMess},#{item.devicePhotoPath},#{item.ip},#{item.centernum},#{item.port},#{item.deviceTopic},#{item.deviceStatus},#{item.enabled},#{item.deviceAuthCode},#{item.deviceRemark},#{item.onlineTime},#{item.offlineTime},#{item.deleted},#{item.source},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime}) (#{item.deviceName},#{item.deviceCode},#{item.deviceMac},#{item.siteId},#{item.siteCode},#{item.siteName},#{item.platformId},#{item.platformName},#{item.productId},#{item.productName},#{item.skinId},#{item.skinName},#{item.homeUrl},#{item.deviceFirmId},#{item.deviceFirmname},#{item.deviceSrc},#{item.deviceDataSourceWay},#{item.lon},#{item.lati},#{item.deviceInBuilding},#{item.deviceInFloor},#{item.defectsLiabilityPeriod},#{item.leadingOfficial},#{item.leadingOfficialTelephone},#{item.isReceiveMess},#{item.devicePhotoPath},#{item.ip},#{item.centernum},#{item.port},#{item.deviceTopic},#{item.deviceStatus},#{item.enabled},#{item.deviceAuthCode},#{item.deviceRemark},#{item.onlineTime},#{item.offlineTime},#{item.deleted},#{item.source},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.deviceSN})
</foreach> </foreach>
</insert> </insert>
...@@ -384,6 +388,9 @@ ...@@ -384,6 +388,9 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))"> <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime}, a.updateTime=#{data.updateTime},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('deviceSN')) or (colPickMode==1 and !data.containsKey('deviceSN'))">
a.deviceSN=#{data.deviceSN},
</if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
...@@ -770,6 +777,13 @@ ...@@ -770,6 +777,13 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="deviceSN=(case" suffix="ELSE deviceSN end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('deviceSN')) or (colPickMode==1 and !item.containsKey('deviceSN'))">
when a.id=#{item.id} then #{item.deviceSN}
</if>
</foreach>
</trim>
</trim> </trim>
where id in where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")"> <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
...@@ -1618,6 +1632,21 @@ ...@@ -1618,6 +1632,21 @@
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''"> <if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if> </if>
<if test="conditionParamRef.containsKey('deviceSN')">
<if test="conditionParamRef.deviceSN != null and conditionParamRef.deviceSN != ''">
${_conditionType_} a.deviceSN like #{${_conditionParam_}.deviceSN}
</if>
<if test="conditionParamRef.deviceSN == null">
${_conditionType_} a.deviceSN is null
</if>
</if>
<if test="conditionParamRef.containsKey('deviceSNList')">
${_conditionType_} a.deviceSN in
<foreach collection="conditionParamRef.deviceSNList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql> </sql>
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
...@@ -1846,6 +1875,11 @@ ...@@ -1846,6 +1875,11 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if> <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('deviceSN')">
a.deviceSN
<if test='orderCol.deviceSN != null and "DESC".equalsIgnoreCase(orderCol.deviceSN)'>DESC</if>
,
</if>
</trim> </trim>
</if> </if>
</sql> </sql>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment