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