From 92cd2a4474d33cee339f5da9d2ea51fd32b3f74a Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期二, 10 三月 2026 16:01:21 +0800
Subject: [PATCH] 新增智能电表、空调管理
---
server/system_service/src/main/java/com/doumee/core/utils/Constants.java | 13
server/system_timer/src/main/resources/bootstrap-dev.yml | 6
server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml | 6
server/visits/dmvisit_service/src/main/resources/application-dev.yml | 4
admin/src/components/business/OperaDianbiaoDataListWindow.vue | 177 +++++
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceDataCloudController.java | 45 +
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/DeviceDataMapper.java | 12
server/visits/dmvisit_admin/src/main/resources/bootstrap.yml | 2
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/DeviceData.java | 95 ++
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceDataService.java | 98 ++
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceDataServiceImpl.java | 161 ++++
server/system_gateway/src/main/resources/application-test.yml | 6
server/system_timer/src/main/resources/application-pro.yml | 3
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java | 293 +++++++
server/visits/admin_timer/src/main/resources/bootstrap-test.yml | 6
admin/src/api/business/deviceData.js | 8
server/system_gateway/src/main/resources/bootstrap-dev.yml | 6
server/system_gateway/src/main/resources/application-dev.yml | 4
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceCloudController.java | 49 +
admin/.env.development | 11
server/system_timer/src/main/resources/bootstrap-test.yml | 6
server/visits/admin_timer/src/main/resources/bootstrap-dev.yml | 6
server/visits/dmvisit_service/src/main/java/com/doumee/core/device/WaterElectricityUtil.java | 600 +++++++++++++++++
admin/src/components/business/OperaDeviceDianbiaoWindow.vue | 147 ++++
server/visits/dmvisit_service/src/main/resources/application-test.yml | 6
server/system_timer/src/main/resources/bootstrap.yml | 2
server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml | 6
admin/src/views/business/deviceDianbiao.vue | 211 ++++++
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java | 19
server/system_timer/src/main/resources/application-test.yml | 6
admin/src/views/roomStatus/index.vue | 6
server/system_timer/src/main/resources/application-dev.yml | 6
server/system_gateway/src/main/resources/bootstrap-test.yml | 6
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Device.java | 26
admin/src/api/business/device.js | 36 +
35 files changed, 1,986 insertions(+), 108 deletions(-)
diff --git a/admin/.env.development b/admin/.env.development
index 831b3c0..53d536a 100644
--- a/admin/.env.development
+++ b/admin/.env.development
@@ -3,13 +3,6 @@
# 椤圭洰涓婁笅鏂囪矾寰�
VUE_APP_CONTEXT_PATH = './'
-#VUE_APP_API_URL = 'http://localhost:10010'
+VUE_APP_API_URL = 'http://localhost:10010'
-# VUE_APP_API_URL = 'http://192.168.0.143:10010'
-
-# VUE_APP_API_URL = 'https://dmtest.ahapp.net/fn_admin'
-
-# VUE_APP_API_URL = 'http://10.50.250.253:8088/gateway_interface'
-
-
-VUE_APP_API_URL = 'https://zhcg.fnwtzx.com/gateway_interface'
+#VUE_APP_API_URL = 'https://zhcg.fnwtzx.com/gateway_interface'
diff --git a/admin/src/api/business/device.js b/admin/src/api/business/device.js
index 207ca0b..09d3528 100644
--- a/admin/src/api/business/device.js
+++ b/admin/src/api/business/device.js
@@ -12,9 +12,13 @@
return request.post('/visitsAdmin/cloudService/business/hksync/syncDevices', data)
}
+
// 鑾峰彇闂ㄧ闆嗗悎-鎻愪緵缁欓棬绂佺粍
export function getList (data) {
return request.post('/visitsAdmin/cloudService/business/device/getList', data)
+}
+export function allList (data) {
+ return request.post('/visitsAdmin/cloudService/business/device/list', data)
}
export function getDeviceRoleList (data) {
return request.post('/visitsAdmin/cloudService/business/deviceRole/list', data)
@@ -24,12 +28,44 @@
export function updateById (data) {
return request.post('/visitsAdmin/cloudService/business/device/updateById', data)
}
+export function create (data) {
+ return request.post('/visitsAdmin/cloudService/business/device/create', data)
+}
+export function dianbiaoData(data) {
+ return request.post('/visitsAdmin/cloudService/business/device/dianbiaoData', data)
+}
// 淇敼鏄惁闂ㄧ鍏ュ彛
export function updateEntranceById (data) {
return request.post('/visitsAdmin/cloudService/business/device/updateEntranceById', data)
}
+export function updateUsedById (data) {
+ return request.post('/visitsAdmin/cloudService/business/device/updateUsedById', data)
+}
+export function duanluqiCmd (data) {
+ return request.post('/visitsAdmin/cloudService/business/device/duanluqiCmd', data)
+}
+export function dianbaoCmd (data) {
+ return request.post('/visitsAdmin/cloudService/business/device/dianbaoCmd', data)
+}
// 鍙戠敓led灞忓唴瀹�
export function setLedContent (data) {
return request.post('/visitsAdmin/cloudService/business/hksync/setLedContent', data)
}
+export function sendBobao (data) {
+ return request.post('/visitsAdmin/cloudService/business/hksync/sendBobao', data)
+}
+
+// 鍒犻櫎
+export function deleteById (id) {
+ return request.get(`/visitsAdmin/cloudService/business/device/delete/${id}`)
+}
+
+// 鎵归噺鍒犻櫎
+export function deleteByIdInBatch (ids) {
+ return request.get('/visitsAdmin/cloudService/business/device/delete/batch', {
+ params: {
+ ids
+ }
+ })
+}
diff --git a/admin/src/api/business/deviceData.js b/admin/src/api/business/deviceData.js
new file mode 100644
index 0000000..c337434
--- /dev/null
+++ b/admin/src/api/business/deviceData.js
@@ -0,0 +1,8 @@
+import request from '../../utils/request'
+
+// 鏌ヨ
+export function fetchList (data) {
+ return request.post('/visitsAdmin/cloudService/business/deviceData/page', data, {
+ trim: true
+ })
+}
diff --git a/admin/src/components/business/OperaDeviceDianbiaoWindow.vue b/admin/src/components/business/OperaDeviceDianbiaoWindow.vue
new file mode 100644
index 0000000..0a22a1a
--- /dev/null
+++ b/admin/src/components/business/OperaDeviceDianbiaoWindow.vue
@@ -0,0 +1,147 @@
+<template>
+ <GlobalWindow
+ :title="title"
+ :visible.sync="visible"
+ width="65%"
+ :confirm-working="isWorking"
+ @confirm="confirm"
+ >
+ <el-form :model="form" ref="form" :rules="rules">
+ <p class="tip-header" >鍩烘湰淇℃伅</p>
+ <el-form-item label="璁惧鍚嶇О" prop="name">
+ <el-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�" v-trim/>
+ </el-form-item>
+ <el-form-item label="璁惧鍦板潃鍩�" prop="no">
+ <el-input v-model="form.no" placeholder="璇疯緭鍏ヨ澶囨爣璇嗙" v-trim/>
+ </el-form-item>
+ <el-form-item label="璁惧鍙�" prop="doorNo">
+ <el-input v-model="form.doorNo" placeholder="璇疯緭鍏ュ簭鍒楀彿" v-trim/>
+ </el-form-item>
+ <el-form-item label="鍘傚晢" prop="manufature">
+ <el-input v-model="form.manufature" placeholder="璇疯緭鍏ュ巶鍟�" v-trim/>
+ </el-form-item>
+ <el-form-item label="瀹夎浣嶇疆" prop="regionPathName">
+ <el-input v-model="form.regionPathName" placeholder="璇疯緭鍏ヨ澶囦綅缃�" v-trim/>
+ </el-form-item>
+ <el-form-item label="杩炴帴IP" prop="ip">
+ <el-input v-model="form.ip" placeholder="璇疯緭鍏ヨ澶囪繛鎺P鍦板潃" v-trim/>
+ </el-form-item>
+ <el-form-item label="杩炴帴绔彛" prop="port">
+ <el-input v-model="form.port" placeholder="璇疯緭鍏ヨ繛鎺ョ鍙�" v-trim/>
+ </el-form-item>
+ <el-form-item label="鐢垫祦姣�" prop="channelNo">
+ <el-input v-model="form.channelNo" type="number" placeholder="璇疯緭鍏ョ數娴佹瘮" v-trim>
+ <template slot="append">/5A</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="瀵嗙爜绛夌骇" prop="pwdLevel">
+ <el-input v-model="form.doorNameObj.pwdLevel" placeholder="璇疯緭鍏ュ瘑鐮佺瓑绾�" v-trim/>
+ </el-form-item>
+ <el-form-item label="瀵嗙爜" prop="pwd">
+ <el-input v-model="form.doorNameObj.pwd" placeholder="璇疯緭鍏ヨ繛鎺ュ瘑鐮�" v-trim/>
+ </el-form-item>
+ <el-form-item label="鎿嶄綔鑰呬唬鐮�" prop="userCode">
+ <el-input v-model="form.doorNameObj.userCode" placeholder="璇疯緭鍏ヨ澶囨搷浣滆�呬唬鐮�" v-trim/>
+ </el-form-item>
+ </el-form>
+ </GlobalWindow>
+</template>
+<script>
+import BaseOpera from '@/components/base/BaseOpera'
+import GlobalWindow from '@/components/common/GlobalWindow'
+export default {
+ name: 'OperaDeviceDuanluqiWindow',
+ extends: BaseOpera,
+ components: { GlobalWindow },
+ data () {
+ return {
+ // 琛ㄥ崟鏁版嵁
+ form: {
+ id: null,
+ name: '',
+ regionPathName: '',
+ doorNo: '',
+ no: '',
+ type: 6,
+ ip: '',
+ port: '',
+ level: '',
+ doorName: '',
+ doorId: '',
+ doorNameObj: {
+ pwdLevel: '',
+ pwd: '',
+ userCode: ''
+ },
+ channelInfo: '',
+ manufature: '',
+ channelNo: ''
+ },
+ // 楠岃瘉瑙勫垯
+ rules: {
+ name: [
+ { required: true, message: '璇疯緭鍏ヨ澶囧悕绉�' }
+ ],
+ doorName: [
+ { required: true, message: '璇疯緭鍏ヨ澶囪繛鎺ュ瘑鐮�' }
+ ],
+ channelNo: [
+ { required: true, message: '璇疯緭鍏ュ紑鍏冲簭鍙�' }
+ ],
+ doorNo: [
+ { required: true, message: '璇疯緭鍏ヨ澶囧彿' }
+ ],
+ no: [
+ { required: true, message: '璇疯緭鍏ヨ澶囨爣璇嗙' }
+ ]
+ }
+ }
+ },
+ created () {
+ this.config({
+ api: '/business/device',
+ 'field.id': 'id'
+ })
+ },
+ methods: {
+ open (title, target) {
+ this.title = title
+ this.visible = true
+ this.form.doorName = ''
+ this.form.doorNameObj = {
+ userCode: '',
+ pwd: '',
+ pwdLevel: ''
+ }
+ // debugger
+ // 鏂板缓
+ if (target == null) {
+ this.$nextTick(() => {
+ this.$refs.form.resetFields()
+ this.form[this.configData['field.id']] = null
+ })
+ if(!this.form.doorNameObj){
+ this.form.doorNameObj = {
+ pwdLevel: '',
+ pwd: '',
+ userCode: ''
+ }
+ }
+ return
+ }
+ // 缂栬緫
+ this.$nextTick(async () => {
+ if(!target.doorNameObj){
+ target.doorNameObj={
+ pwdLevel: '',
+ pwd: '',
+ userCode: ''}
+ }
+ for (const key in this.form) {
+ this.form[key] = target[key]
+ }
+ })
+ }
+ }
+}
+</script>
diff --git a/admin/src/components/business/OperaDianbiaoDataListWindow.vue b/admin/src/components/business/OperaDianbiaoDataListWindow.vue
new file mode 100644
index 0000000..802bc8f
--- /dev/null
+++ b/admin/src/components/business/OperaDianbiaoDataListWindow.vue
@@ -0,0 +1,177 @@
+<template>
+ <GlobalWindow
+ :title="title"
+ width="100%"
+ :visible.sync="visible"
+ >
+ <TableLayout >
+ <!-- 鎼滅储琛ㄥ崟 -->
+ <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
+ <div style="display: block;margin-bottom: 60px;padding: 20px; border: 1px solid #f2f2f2;">
+ <div style="display: block;font-size: 16px;font-weight: 600;margin-bottom: 20px;">璁惧淇℃伅</div>
+ <div style="display: flex;">
+ <div style="flex: 1"><span class="label">鍚嶇О锛�</span>{{model.name ||''}}</div>
+ <div style="flex: 1"><span class="label">鍦板潃鍩燂細</span>{{model.no ||''}}</div>
+ <div style="flex: 1"><span class="label">璁惧鍙凤細</span>{{model.doorNo ||'-'}}</div>
+ </div>
+ <div style="display: flex;margin-top: 20px;">
+ <div style="flex: 1"><span class="label">IP锛�</span>{{ model.ip ||'' }}</div>
+ <div style="flex: 1"><span class="label">绔彛锛�</span>{{ model.port ||''}}</div>
+ <div style="flex: 3">
+ <span class="label">鏈�杩戞帶鍒舵搷浣滐細</span>
+ <span class="orange" >{{model.remark||''}}</span>
+ </div>
+ </div>
+ </div>
+ <div class="platgroup_tabs">
+ <div class="tab" :class="{ active: activeGroup === item.id }" @click="groupClick(item)"
+ v-for="(item, i) in groupList" :key="i">
+ {{ item.name }}
+ </div>
+ </div>
+ </el-form>
+ <!-- 琛ㄦ牸鍜屽垎椤� -->
+ <template v-slot:table-wrap>
+ <el-table
+ v-if="activeGroup===0"
+ v-loading="isWorking.search"
+ :data="tableData.list"
+ stripe>
+ <el-table-column prop="happenTime" label="璇诲彇鏃堕棿" min-width="150px"></el-table-column>
+ <el-table-column prop="val1" label="鐢佃兘锛圞WH锛�" min-width="120px"></el-table-column>
+ <el-table-column prop="val2" label="鐘舵��" min-width="120px">
+ <template slot-scope="{row}">
+ <span v-if=" row.val2 === '0000'" class="green">鍚堥椄</span>
+ <span v-else-if=" row.val2 === '0050'" class="red">鍒嗛椄</span>
+ <span v-else>-</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="val3" label="鐢佃〃鏃堕棿" min-width="120px"></el-table-column>
+ </el-table>
+ <el-table
+ v-if="activeGroup===1"
+ v-loading="isWorking.search"
+ :data="tableData.list"
+ stripe>
+ <el-table-column prop="createDate" label="鎿嶄綔鏃堕棿" min-width="150px"></el-table-column>
+ <el-table-column prop="val4" label="鎿嶄綔浜�" min-width="100px" ></el-table-column>
+ <el-table-column prop="val3" label="鎿嶄綔鍐呭" min-width="100px">
+ <template slot-scope="{row}">
+ <span v-if=" row.val3 === '銆愬悎闂搞��'" class="green">{{row.val3||''}}</span>
+ <span v-else-if=" row.val3 === '銆愬垎闂搞��'" class="red">{{row.val3||''}}</span>
+ <span v-else>{{row.val3||''}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="val2" label="鍐呭" min-width="300px" show-overflow-tooltip></el-table-column>
+ </el-table>
+ <pagination
+ @size-change="handleSizeChange"
+ @current-change="handlePageChange"
+ :pagination="tableData.pagination"
+ >
+ </pagination>
+ </template>
+ </TableLayout>
+ <template v-slot:footer>
+ <el-button @click="visible=false">杩斿洖</el-button>
+ </template>
+ </GlobalWindow>
+</template>
+
+<script>
+import BaseTable from '@/components/base/BaseTable'
+import TableLayout from '@/layouts/TableLayout'
+import Pagination from '@/components/common/Pagination'
+import GlobalWindow from '@/components/common/GlobalWindow'
+export default {
+ name: 'OperaJkSketchCustomerWindow',
+ extends: BaseTable,
+ components: { GlobalWindow, TableLayout, Pagination },
+ data () {
+ return {
+ // 琛ㄥ崟鏁版嵁
+ visible: false,
+ title: '',
+ activeGroup:0,
+ model:{doorNameObj:{}},
+ groupList: [{ id: 0, name: '鏁版嵁涓婃姤璁板綍', type: 0 }, { id: 1, name: '杩滅▼鎺у埗璁板綍', type: 1 }],
+ searchForm: {
+ deviceId: null,
+ val1: '',
+ dataType:0
+ }
+ }
+ },
+ created () {
+ this.config({
+ module: '璁惧鏁版嵁淇℃伅琛�',
+ api: '/business/deviceData',
+ 'field.id': 'id',
+ 'field.main': 'id'
+ })
+ this.search()
+ },
+ methods: {
+ groupClick (item) {
+ this.activeGroup = item.id
+ this.searchForm.val1 = ''
+ this.searchForm.dataType = item.type
+ this.search()
+ },
+ open (title, row) {
+ this.title = title +' 銆�'+ (row.name)+'銆�'
+ this.searchForm.deviceId = row.id
+ if(!row.doorNameObj) {
+ row.doorNameObj = {}
+ }
+ this.model=row
+ this.visible = true
+ this.tableData = {
+ // 宸查�変腑鐨勬暟鎹�
+ selectedRows: [],
+ // 鎺掑簭鐨勫瓧娈�
+ sorts: [],
+ // 褰撳墠椤垫暟鎹�
+ list: [],
+ // 鍒嗛〉
+ pagination: {
+ pageIndex: 1,
+ pageSize: 10,
+ total: 0
+ }
+ }
+ this.groupClick(this.groupList[0])
+ }
+ }
+}
+</script>
+<style>
+.platgroup_tabs {
+ flex: 1;
+ display: flex;
+ border-bottom: 1px solid #dfe2e8;
+ margin-bottom:30px;
+
+ .tab {
+ color: #666666;
+ margin-right: 40px;
+ cursor: pointer;
+ padding-bottom: 18px;
+ border-bottom: 2px solid #fff;
+ }
+
+ .active {
+ font-weight: 500;
+ font-size: 15px;
+ color: #2080f7;
+ border-bottom: 2px solid $primary-color;
+ }
+}
+.label{
+/* width: 80px;
+ text-align: right;*/
+ color: rgb(102, 102, 102);
+ display: inline-block;
+
+}
+</style>
diff --git a/admin/src/views/business/deviceDianbiao.vue b/admin/src/views/business/deviceDianbiao.vue
new file mode 100644
index 0000000..e6a91d5
--- /dev/null
+++ b/admin/src/views/business/deviceDianbiao.vue
@@ -0,0 +1,211 @@
+<template>
+ <TableLayout :permissions="['business:device:query']">
+ <!-- 鎼滅储琛ㄥ崟 -->
+ <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
+ <el-form-item title="鍚嶇О" prop="name">
+ <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ュ悕绉�" @keypress.enter.native="search"></el-input>
+ </el-form-item>
+ <el-form-item title="鏍囪瘑绗�" prop="no">
+ <el-input v-model="searchForm.no" placeholder="璇疯緭鍏ヨ澶囨爣璇嗙" @keypress.enter.native="search"></el-input>
+ </el-form-item>
+ <el-form-item title="璁惧鍙�" prop="doorNo">
+ <el-input v-model="searchForm.doorNo" placeholder="璇疯緭鍏ヨ澶囧彿" @keypress.enter.native="search"></el-input>
+ </el-form-item>
+ <section>
+ <el-button type="primary" @click="search">鎼滅储</el-button>
+ <el-button @click="reset">閲嶇疆</el-button>
+ </section>
+ </el-form>
+ <!-- 琛ㄦ牸鍜屽垎椤� -->
+ <template v-slot:table-wrap>
+ <ul class="toolbar" v-permissions="['business:device:create', 'business:device:delete']">
+ <li><el-button type="primary" @click="$refs.operaDeviceWindow.open('鏂板缓鐢佃〃')" icon="el-icon-plus" v-permissions="['business:device:create']">鏂板缓</el-button></li>
+ <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:device:delete']">鍒犻櫎</el-button></li>
+ </ul>
+ <el-table
+ v-loading="isWorking.search"
+ :data="tableData.list"
+ stripe >
+ <el-table-column type="selection" width="55"></el-table-column>
+ <el-table-column prop="name" label="鍚嶇О" fixed min-width="150" align="center"></el-table-column>
+ <el-table-column prop="no" label="鐢佃〃鍦板潃鍩�" min-width="100" align="center" ></el-table-column>
+ <el-table-column prop="doorNo" label="璁惧鍙�" min-width="120" align="center" show-overflow-tooltip></el-table-column>
+<!--
+ <el-table-column prop="channelNo" label="寮�鍏冲簭鍙�" align="center" min-width="100"></el-table-column>
+-->
+ <el-table-column prop="manufature" label="鍘傚晢" align="center" min-width="100" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="regionPathName" align="center" min-width="100" label="鎵�鍦ㄤ綅缃�"></el-table-column>
+ <el-table-column prop="ip" label="IP" min-width="150" align="center" show-overflow-tooltip ></el-table-column>
+ <el-table-column prop="port" label="绔彛" align="center" ></el-table-column>
+ <el-table-column prop="isUsed" label="鏄惁浣跨敤">
+ <template slot-scope="{row}">
+ <el-switch @change="changeUsed($event, row)" v-model="row.isUsed" active-color="#13ce66"
+ inactive-color="#ff4949" :active-value="0" :inactive-value="1">
+ </el-switch>
+ </template>
+ </el-table-column>
+ <el-table-column prop="doorNameObj.pwdLevel" label="瀵嗙爜绛夌骇" align="center" min-width="150"></el-table-column>
+ <el-table-column prop="doorNameObj.pwd" label="瀵嗙爜" align="center">
+ <template slot-scope="{row}">
+ <span :class=" 'blue'">{{row.showPwd?row.doorNameObj.pwd:'******'}}</span>
+ <el-button style="margin-left: 10px" v-if="row.doorNameObj.pwd!=null"
+ @click.native.p.prevent="showPassward(row)" type="text">
+ <i class="el-icon-view" :class="row.showPwd?'red':'blue'" :title="row.showPwd?'闅愯棌':'鏄剧ず'"></i>
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column prop="doorNameObj.userCode" label="鎿嶄綔鑰呬唬鐮�" align="center" min-width="150"></el-table-column>
+ <el-table-column prop="editDate" label="鏈�杩戞洿鏂版椂闂�" align="center" min-width="150"></el-table-column>
+ <el-table-column
+ label="鎿嶄綔"
+ align="center"
+ min-width="280"
+ fixed="right"
+ >
+ <template slot-scope="{row}">
+ <el-button type="text" @click="$refs.operaDeviceWindow.open('缂栬緫鐢佃〃', row)" icon="el-icon-edit" v-permissions="['business:device:update']">缂栬緫</el-button>
+ <el-button type="text" @click="$refs.operaDeviceDataWindow.open('鏌ョ湅鐢佃〃鏁版嵁', row)" icon="el-icon-view" v-permissions="['business:device:update']">鏁版嵁</el-button>
+ <el-button type="text" @click="send(row,1)" icon="el-icon-circle-check" v-permissions="['business:device:update']">寮�闂�</el-button>
+ <el-button type="text" class="red" @click="send(row,0)" icon="el-icon-circle-close" v-permissions="['business:device:update']">鍏抽椄</el-button>
+ <el-button type="text" class="red" @click="readData(row)" icon="el-icon-circle-close" v-permissions="['business:device:update']">璇诲彇鏁版嵁</el-button>
+ <el-button type="text" class="red" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:device:delete']">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination
+ @size-change="handleSizeChange"
+ @current-change="handlePageChange"
+ :pagination="tableData.pagination" >
+ </pagination>
+ </template>
+ <el-dialog
+ :visible.sync="visibleSend"
+ style="z-index: 100000"
+ append-to-body
+ width="50%"
+ height="50%"
+ :title="'鎺у埗鐢佃〃-銆�'+ form.name+'銆�'"
+ >
+ <el-form :model="form" ref="form" :rules="rules">
+ <el-form-item label="鎵ц鎿嶄綔锛�" >
+ <b class="green" v-if="form.status ===1">寮�闂�</b>
+ <b class="red" v-else>鍏抽椄</b>
+ </el-form-item>
+ <el-form-item label="鏈夋晥鏃堕棿" prop="cmdDate">
+ <el-date-picker type="datetime" v-model="form.cmdDate" value-format="yyyy-MM-dd HH:mm:ss"
+ placeholder="璇烽�夋嫨鏈夋晥鏃堕棿" />
+ </el-form-item>
+<!--
+ <p class="tip-warn" style="width: 100%;"><i class="el-icon-warning"></i></p>
+-->
+ </el-form>
+ <template v-slot:footer >
+ <el-button @click="sendAction(0)" type="primary" v-if="form.status === 1" :loading="isWorkSending">纭寮�闂�</el-button>
+ <el-button @click="sendAction(1)" type="danger" v-if="form.status !== 1" :loading="isWorkSending">纭鍏抽椄</el-button>
+ <el-button @click="sendClose()">杩斿洖</el-button>
+ </template>
+ </el-dialog>
+ <!-- 鏂板缓/淇敼 -->
+ <OperaDeviceDianbiaoWindow ref="operaDeviceWindow" @success="handlePageChange"/>
+ <OperaDeviceDataListWindow ref="operaDeviceDataWindow" @success="handlePageChange"/>
+ </TableLayout>
+</template>
+<script>
+import BaseTable from '@/components/base/BaseTable'
+import TableLayout from '@/layouts/TableLayout'
+import Pagination from '@/components/common/Pagination'
+import OperaDeviceDataListWindow from '@/components/business/OperaDianbiaoDataListWindow'
+import OperaDeviceDianbiaoWindow from '@/components/business/OperaDeviceDianbiaoWindow'
+export default {
+ name: 'DeviceDuanluqi',
+ extends: BaseTable,
+ components: { TableLayout, Pagination, OperaDeviceDianbiaoWindow, OperaDeviceDataListWindow },
+ data () {
+ return {
+ // 鎼滅储
+ searchForm: {
+ doorNo: '',
+ no: '',
+ name: '',
+ type: 6
+ },
+ isWorkSending: false,
+ form: {
+ id: '',
+ status: null,
+ name:null,
+ cmdDate: null
+ },
+ visibleSend: false,
+ options: [],
+ rules: {
+ cmdDate: [{ required: true, message: '璇烽�夋嫨鎿嶄綔鏈夋晥鏃堕棿' }]
+ }
+ }
+ },
+ created () {
+ this.config({
+ module: '璁惧淇℃伅琛�',
+ api: '/business/device',
+ 'field.id': 'id',
+ 'field.main': 'id'
+ })
+ this.search()
+ },
+ methods: {
+ changeUsed (e, row) {
+ this.api.updateUsedById({
+ id: row.id,
+ isUsed: e
+ })
+ },
+ showPassward (row) {
+ if (!row.showPwd) {
+ this.$set(row, 'showPwd', true)
+ } else {
+ this.$set(row, 'showPwd', false)
+ }
+ },
+ sendAction (status) {
+ this.form.status = status
+ this.$dialog.actionConfirm('纭杩涜鐢佃〃銆�' + (this.form.status === 1 ? '寮�闂�' : '鍏抽椄') + '銆戞搷浣滃悧锛�', '鎿嶄綔纭鎻愰啋')
+ .then(() => {
+ console.log(this.form)
+ this.isWorkSending = true
+ this.api.dianbaoCmd(this.form)
+ .then(res => {
+ this.$tip.apiSuccess(res || '璇锋眰鎴愬姛')
+ this.handlePageChange()
+ })
+ .catch(e => {
+ })
+ .finally(() => {
+ this.isWorkSending = false
+ })
+ })
+ .catch(() => {})
+ },
+ readData (row) {
+ this.api.dianbiaoData({ id: row.id })
+ .then(res => {
+ this.$tip.apiSuccess(res || '璇锋眰鎴愬姛')
+ this.handlePageChange()
+ })
+ .catch(e => {
+ })
+ .finally(() => {
+ this.isWorkSending = false
+ })
+ },
+ send (row, type) {
+ this.visibleSend = true
+ this.form = { id: row.id, name: row.name, cmdDate: null, status: type}
+ },
+ sendClose () {
+ this.visibleSend = false
+ this.isWorkSending = false
+ this.form = { id: '', name: '', status: '', cmdDate: '' }
+ }
+ }
+}
+</script>
diff --git a/admin/src/views/roomStatus/index.vue b/admin/src/views/roomStatus/index.vue
index 0bdccb2..df81122 100644
--- a/admin/src/views/roomStatus/index.vue
+++ b/admin/src/views/roomStatus/index.vue
@@ -288,7 +288,7 @@
</div>
</div>
<div class="xm_house_list_right">
- <template v-for="(child, i) in item.roomsList" :key="i">
+ <template v-for="(child, i) in item.roomsList" >
<div class="xm_house_list_right_row" v-for="(childThree, a) in child" :key="a" :style="{ width: childThree.width + 'px', backgroundColor: ifBackground(childThree.roomStatus) }">
<div class="ft">
<span>{{childThree.roomCode}}</span>
@@ -305,7 +305,6 @@
<div class="xm_house_list_right_row_day" v-if="childThree.roomStatus === 0">鏈嚭绉燂綔绌虹疆{{childThree.freeDayAmount}}澶�</div>
</div>
</template>
-
</div>
</div>
</div>
@@ -498,7 +497,7 @@
<el-table
:data="tableData"
border
- v-lading="loading"
+ v-loading="loading"
style="width: 100%">
<el-table-column
prop="categoryName"
@@ -687,6 +686,7 @@
label: '榛勯噾绯�'
}],
value: '',
+ ids:[],
form: {
name: '',
status: '',
diff --git a/server/system_gateway/src/main/resources/application-dev.yml b/server/system_gateway/src/main/resources/application-dev.yml
index ce8c115..dc9c91c 100644
--- a/server/system_gateway/src/main/resources/application-dev.yml
+++ b/server/system_gateway/src/main/resources/application-dev.yml
@@ -1,9 +1,9 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://112.26.66.25:3306/funingyunwei?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+ url: jdbc:mysql://192.168.0.211:3306/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
username: root
- password: Doumee@168&QWERT
+ password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
diff --git a/server/system_gateway/src/main/resources/application-test.yml b/server/system_gateway/src/main/resources/application-test.yml
index cc9c87d..2e7c89c 100644
--- a/server/system_gateway/src/main/resources/application-test.yml
+++ b/server/system_gateway/src/main/resources/application-test.yml
@@ -1,9 +1,9 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://sh-cdb-aiskr3vy.sql.tencentcdb.com:62443/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
- username: doumee
- password: rtjgfEr@&0c0m
+ url: jdbc:mysql://192.168.0.211:3306/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+ username: root
+ password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
diff --git a/server/system_gateway/src/main/resources/bootstrap-dev.yml b/server/system_gateway/src/main/resources/bootstrap-dev.yml
index 2066005..a4c7cd6 100644
--- a/server/system_gateway/src/main/resources/bootstrap-dev.yml
+++ b/server/system_gateway/src/main/resources/bootstrap-dev.yml
@@ -1,13 +1,13 @@
spring:
cloud:
nacos:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
discovery:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
# namespace: dmvisit
- namespace: dev_renkang
+ namespace: funingyunwei_dev
username: nacos
password: nacos
gateway:
diff --git a/server/system_gateway/src/main/resources/bootstrap-test.yml b/server/system_gateway/src/main/resources/bootstrap-test.yml
index 351bfe7..4ccd298 100644
--- a/server/system_gateway/src/main/resources/bootstrap-test.yml
+++ b/server/system_gateway/src/main/resources/bootstrap-test.yml
@@ -1,12 +1,12 @@
spring:
cloud:
nacos:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
discovery:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
- namespace: funing_test
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ namespace: funingyunwei_test
# namespace: dev_renkang
username: nacos
password: nacos
diff --git a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
index 500de9d..528e092 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -50,6 +50,8 @@
public static final String HK_HOST ="HK_HOST" ;
public static final String HK_APPKEY ="HK_APPKEY" ;
public static final String LOGIN_OUT_URL ="LOGIN_OUT" ;
+
+ public static boolean DEALING_DUANLUQI_CLOSE = false;
public static final String HK_APPSECRET ="HK_APPSECRET" ;
public static final String HK_HTTPS ="HK_HTTPS" ;
public static final String HK_PUSH_URL = "HK_PUSH_URL";
@@ -108,7 +110,16 @@
public static final String INTERVAL = "INTERVAL";
public static final String USE_CAR_TAKE_CARE = "USE_CAR_TAKE_CARE";
-
+ //绫诲瀷 0闂ㄧ 1杞﹀簱 2LED 3骞挎挱鐐� 4骞挎挱璁惧 5鏂矾鍣ㄧ┖寮� 6鐢佃〃
+ public interface DEVICE_TYPE{
+ public static final int door = 0;
+ public static final int park = 1;
+ public static final int led = 2;
+ public static final int broadcaset = 3;
+ public static final int broadcasetChannel = 4;
+ public static final int duanluqi = 5;
+ public static final int dianbiao = 6;
+ }
// 鍔冲姟鏉ヨ閰嶇疆
diff --git a/server/system_timer/src/main/resources/application-dev.yml b/server/system_timer/src/main/resources/application-dev.yml
index 5ad7897..938c527 100644
--- a/server/system_timer/src/main/resources/application-dev.yml
+++ b/server/system_timer/src/main/resources/application-dev.yml
@@ -1,9 +1,9 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://sh-cdb-aiskr3vy.sql.tencentcdb.com:62443/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
- username: doumee
- password: rtjgfEr@&0c0m
+ url: jdbc:mysql://192.168.0.211:3306/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+ username: root
+ password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
redis:
diff --git a/server/system_timer/src/main/resources/application-pro.yml b/server/system_timer/src/main/resources/application-pro.yml
index ee05abc..9ef34e8 100644
--- a/server/system_timer/src/main/resources/application-pro.yml
+++ b/server/system_timer/src/main/resources/application-pro.yml
@@ -11,10 +11,7 @@
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
-
-
debug_model: false
-
captcha_check: true
# Swagger閰嶇疆
diff --git a/server/system_timer/src/main/resources/application-test.yml b/server/system_timer/src/main/resources/application-test.yml
index 55107e2..9d47502 100644
--- a/server/system_timer/src/main/resources/application-test.yml
+++ b/server/system_timer/src/main/resources/application-test.yml
@@ -1,9 +1,9 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://sh-cdb-aiskr3vy.sql.tencentcdb.com:62443/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
- username: doumee
- password: rtjgfEr@&0c0m
+ url: jdbc:mysql://192.168.0.211:3306/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+ username: root
+ password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
redis:
diff --git a/server/system_timer/src/main/resources/bootstrap-dev.yml b/server/system_timer/src/main/resources/bootstrap-dev.yml
index 53c54ce..21ef2c5 100644
--- a/server/system_timer/src/main/resources/bootstrap-dev.yml
+++ b/server/system_timer/src/main/resources/bootstrap-dev.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
- namespace: dev_renkang
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ namespace: funingyunwei_dev
username: nacos
password: nacos
\ No newline at end of file
diff --git a/server/system_timer/src/main/resources/bootstrap-test.yml b/server/system_timer/src/main/resources/bootstrap-test.yml
index 13e1c1c..4e04742 100644
--- a/server/system_timer/src/main/resources/bootstrap-test.yml
+++ b/server/system_timer/src/main/resources/bootstrap-test.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
- namespace: funing_test
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ namespace: funingyunwei_test
username: nacos
password: nacos
\ No newline at end of file
diff --git a/server/system_timer/src/main/resources/bootstrap.yml b/server/system_timer/src/main/resources/bootstrap.yml
index 05a83ce..107b53b 100644
--- a/server/system_timer/src/main/resources/bootstrap.yml
+++ b/server/system_timer/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@
spring:
profiles:
- active: pro
+ active: dev
application:
name: systemTimer
# 瀹夊叏閰嶇疆
diff --git a/server/visits/admin_timer/src/main/resources/bootstrap-dev.yml b/server/visits/admin_timer/src/main/resources/bootstrap-dev.yml
index 700974a..0c21840 100644
--- a/server/visits/admin_timer/src/main/resources/bootstrap-dev.yml
+++ b/server/visits/admin_timer/src/main/resources/bootstrap-dev.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
- namespace: dev_renkang
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ namespace: funingyunwei_dev
username: nacos
password: nacos
diff --git a/server/visits/admin_timer/src/main/resources/bootstrap-test.yml b/server/visits/admin_timer/src/main/resources/bootstrap-test.yml
index dd58dce..d5944e2 100644
--- a/server/visits/admin_timer/src/main/resources/bootstrap-test.yml
+++ b/server/visits/admin_timer/src/main/resources/bootstrap-test.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
- namespace: funing_test
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ namespace: funingyunwei_test
username: nacos
password: nacos
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceCloudController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceCloudController.java
index 43cf1d2..8cf21fe 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceCloudController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceCloudController.java
@@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+
/**
* @author 姹熻箘韫�
* @date 2023/11/30 15:33
@@ -36,25 +37,55 @@
@PostMapping("/create")
@CloudRequiredPermission("business:device:create")
public ApiResponse create(@RequestBody Device device,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ device.setLoginUserInfo(this.getLoginUser(token));
return ApiResponse.success(deviceService.create(device));
}
@ApiOperation("鏍规嵁ID鍒犻櫎")
@GetMapping("/delete/{id}")
@CloudRequiredPermission("business:device:delete")
- public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
- deviceService.deleteById(id);
+ public ApiResponse deleteById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ deviceService.deleteById(id,this.getLoginUser(token));
return ApiResponse.success(null);
}
@ApiOperation("淇敼鏄惁闂ㄧ鍏ュ彛")
@PostMapping("/updateEntranceById")
- @CloudRequiredPermission("business:company:update")
+ @CloudRequiredPermission("business:device:update")
public ApiResponse updateStatusById(@RequestBody Device param,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
Device d = new Device();
d.setId(param.getId());
d.setEditDate(new Date());
d.setIsEntrance(Constants.formatIntegerNum(param.getIsEntrance()));
+ d.setLoginUserInfo(this.getLoginUser(token));
deviceService.updateById(d);
+ return ApiResponse.success(null);
+ }
+ @ApiOperation("淇敼鏄惁绯荤粺浣跨敤")
+ @PostMapping("/updateUsedById")
+ @CloudRequiredPermission("business:device:update")
+ public ApiResponse updateUsedById(@RequestBody Device param,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ Device d = new Device();
+ d.setId(param.getId());
+ d.setEditDate(new Date());
+ d.setLoginUserInfo(this.getLoginUser(token));
+ d.setIsUsed(Constants.formatIntegerNum(param.getIsUsed()));
+ deviceService.updateUsedById(d);
+ return ApiResponse.success(null);
+ }
+ @ApiOperation("鎵ц鐢佃〃寮�鍏抽椄鎿嶄綔")
+ @PostMapping("/dianbaoCmd")
+ @CloudRequiredPermission("business:device:update")
+ public ApiResponse dianbaoCmd(@RequestBody Device param,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ param.setLoginUserInfo(this.getLoginUser(token));
+ deviceService.dianbaoCmd(param);
+ return ApiResponse.success(null);
+ }
+ @ApiOperation("璇诲彇鐢佃〃鏁版嵁锛堢數鑳姐�佹椂闂村拰鐘舵�侊級")
+ @PostMapping("/dianbiaoData")
+ @CloudRequiredPermission("business:device:update")
+ public ApiResponse dianbiaoData(@RequestBody Device param,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ param.setLoginUserInfo(this.getLoginUser(token));
+ deviceService.dianbiaoData(param);
return ApiResponse.success(null);
}
@@ -67,7 +98,7 @@
for (String id : idArray) {
idList.add(Integer.valueOf(id));
}
- deviceService.deleteByIdInBatch(idList);
+ deviceService.deleteByIdInBatch(idList,this.getLoginUser(token));
return ApiResponse.success(null);
}
@@ -75,6 +106,8 @@
@PostMapping("/updateById")
@CloudRequiredPermission("business:device:update")
public ApiResponse updateById(@RequestBody Device device,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+
+ device.setLoginUserInfo(this.getLoginUser(token));
deviceService.updateById(device);
return ApiResponse.success(null);
}
@@ -82,9 +115,15 @@
@ApiOperation("鍒嗛〉鏌ヨ")
@PostMapping("/page")
@CloudRequiredPermission("business:device:query")
- public ApiResponse<PageData<Device>> findPage (@RequestBody PageWrap<Device> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ public ApiResponse<PageData<Device>> findPage (@RequestBody PageWrap<Device> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){
return ApiResponse.success(deviceService.findPage(pageWrap));
}
+ @ApiOperation("鏌ヨ鍏ㄩ儴")
+ @PostMapping("/list")
+ @CloudRequiredPermission("business:device:query")
+ public ApiResponse<List<Device>> findPage (@RequestBody Device model,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ return ApiResponse.success(deviceService.findList(model));
+ }
@ApiOperation("瀵煎嚭Excel")
@PostMapping("/exportExcel")
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceDataCloudController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceDataCloudController.java
new file mode 100644
index 0000000..94bfd89
--- /dev/null
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/DeviceDataCloudController.java
@@ -0,0 +1,45 @@
+package com.doumee.cloud.admin;
+
+import com.doumee.api.BaseController;
+import com.doumee.config.annotation.CloudRequiredPermission;
+import com.doumee.core.annotation.excel.ExcelExporter;
+import com.doumee.core.utils.Constants;
+import com.doumee.dao.business.model.DeviceData;
+import com.doumee.service.business.DeviceDataService;
+import com.doumee.core.model.ApiResponse;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2023/11/30 15:33
+ */
+@Api(tags = "璁惧鏁版嵁淇℃伅琛�")
+@RestController
+@RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/deviceData")
+public class DeviceDataCloudController extends BaseController {
+
+ @Autowired
+ private DeviceDataService deviceDataService;
+
+
+ @ApiOperation("鍒嗛〉鏌ヨ")
+ @PostMapping("/page")
+ @CloudRequiredPermission("business:device:query")
+ public ApiResponse<PageData<DeviceData>> findPage (@RequestBody PageWrap<DeviceData> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ return ApiResponse.success(deviceDataService.findPage(pageWrap));
+ }
+
+ @ApiOperation("瀵煎嚭Excel")
+ @PostMapping("/exportExcel")
+ @CloudRequiredPermission("business:device:exportExcel")
+ public void exportExcel (@RequestBody PageWrap<DeviceData> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){
+ ExcelExporter.build(DeviceData.class).export(deviceDataService.findPage(pageWrap).getRecords(), "璁惧淇℃伅琛�", response);
+ }
+}
diff --git a/server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml b/server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml
index d9853fc..96054ed 100644
--- a/server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml
+++ b/server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,9 +22,9 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
# namespace: dmvisit
- namespace: dev_renkang
+ namespace: funingyunwei_dev
username: nacos
password: nacos
# swagger閰嶇疆
diff --git a/server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml b/server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml
index ab2c361..385cbc6 100644
--- a/server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml
+++ b/server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://175.27.187.84:8848 #閰嶇疆Nacos鍦板潃
- namespace: funing_test
+ server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ namespace: funingyunwei_test
username: nacos
password: nacos
\ No newline at end of file
diff --git a/server/visits/dmvisit_admin/src/main/resources/bootstrap.yml b/server/visits/dmvisit_admin/src/main/resources/bootstrap.yml
index 2df12af..9dc10e9 100644
--- a/server/visits/dmvisit_admin/src/main/resources/bootstrap.yml
+++ b/server/visits/dmvisit_admin/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@
spring:
profiles:
- active: pro
+ active: dev
application:
name: visitsAdmin
# 瀹夊叏閰嶇疆
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/core/device/WaterElectricityUtil.java b/server/visits/dmvisit_service/src/main/java/com/doumee/core/device/WaterElectricityUtil.java
new file mode 100644
index 0000000..682394d
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/core/device/WaterElectricityUtil.java
@@ -0,0 +1,600 @@
+package com.doumee.core.device;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+public class WaterElectricityUtil {
+
+
+ private static double parseBcdToDouble(byte[] bcdBytes) {
+ StringBuilder sb = new StringBuilder();
+ for (byte b : bcdBytes) {
+ sb.append(String.format("%02X", b));
+ }
+ try {
+ return Double.parseDouble(sb.toString());
+ } catch (NumberFormatException e) {
+ return 0.0;
+ }
+ }
+
+ private static byte[] reverseAddress(String address) {
+ byte[] result = new byte[6];
+ for (int i = 0; i < 6; i++) {
+ if (i * 2 + 1 < address.length()) {
+ String hex = address.substring(i * 2, Math.min((i + 1) * 2, address.length()));
+ result[i] = (byte) Integer.parseInt(hex, 16);
+ }
+ }
+ return result;
+ }
+
+ private static byte calculateChecksum(byte[] data, int offset, int length) {
+ int sum = 0;
+ for (int i = offset; i < offset + length; i++) {
+ sum += data[i] & 0xFF;
+ }
+ return (byte) (sum & 0xFF);
+ }
+
+ private static byte[] hexStringToByteArray(String hex) {
+ int len = hex.length();
+ byte[] data = new byte[len / 2];
+ for (int i = 0; i < len; i += 2) {
+ data[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4) + Character.digit(hex.charAt(i + 1), 16));
+ }
+ return data;
+ }
+
+ public static byte calcCS(byte[] data) {
+ int sum = 0;
+ for (byte b : data) {
+ sum += b & 0xFF;
+ }
+ return (byte) (sum & 0xFF);
+ }
+
+
+ public static byte[] getRequestParam(int feCount, byte[] address, byte control, byte[] data) throws IOException {
+
+ ///FEFEFE 68 999999999999 68 01 02 65 F3C1 16
+// byte b = (byte) 0xFE;
+// byte[] msg = {(byte) 0xFE,0x68};
+ ByteArrayOutputStream frame = new ByteArrayOutputStream();
+ for (int i = 0; i < feCount; i++) {
+ frame.write(0xFE);
+ }
+ // 2. 甯ц捣濮嬬
+ frame.write(0x68);
+ // 3. 鍦板潃鍩�
+ frame.write(address);
+ // 4. 鍐嶆甯ц捣濮嬬
+ frame.write(0x68);
+ // 5. 鎺у埗鐮�
+ frame.write(control);
+ // 6. 鏁版嵁闀垮害
+ frame.write(data.length);
+ // 7. 鏁版嵁鍩�
+ frame.write(data);
+ // 8. 璁$畻 CS锛堜粠绗竴涓� 68 寮�濮嬶級
+ byte[] csData = frame.toByteArray();
+ int start = feCount; // 绗竴涓� 68 鐨勪綅缃�
+ byte cs = calcCS(Arrays.copyOfRange(csData, start, csData.length));
+ frame.write(cs);
+ // 9. 缁撴潫绗�
+ frame.write(0x16);
+ return frame.toByteArray();
+ }
+
+
+ private static byte[] readDeviceData(String ip, int port, byte[] data) {
+ Socket socket = null;
+ try {
+ socket = new Socket(ip, port);
+ socket.setSoTimeout(5000);
+ java.io.OutputStream out = socket.getOutputStream();
+ java.io.InputStream in = socket.getInputStream();
+ out.write(data);
+ out.flush();
+ // 璇诲彇鍝嶅簲
+ byte[] buffer = new byte[2048];
+ int bytesRead = in.read(buffer);
+ byte[] response = Arrays.copyOf(buffer, bytesRead);
+ // 瑙f瀽鍝嶅簲鏁版嵁
+ return response;
+ } catch (Exception e) {
+// e.printStackTrace();
+ throw new RuntimeException("Failed to read from device", e);
+ } finally {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ private static String bytesToHex(byte[] bytes) {
+ StringBuilder hexString = new StringBuilder();
+ for (byte b : bytes) {
+ String hex = String.format("%02X", b & 0xFF);
+ hexString.append(hex);
+ }
+ return hexString.toString();
+ }
+
+ /**
+ * 灏�12浣嶅崄杩涘埗鍦板潃杞崲涓�6瀛楄妭BCD灏忕搴忓湴鍧�
+ *
+ * @param decimalAddress 12浣嶅崄杩涘埗鍦板潃瀛楃涓�
+ * @return 6瀛楄妭鐨凚CD鍦板潃锛堝皬绔簭锛�
+ */
+ private static byte[] convertToBCDAddress(String decimalAddress) {
+ // 1. 楠岃瘉杈撳叆
+ if (decimalAddress == null || decimalAddress.length() != 12) {
+ throw new IllegalArgumentException("鍦板潃蹇呴』鏄�12浣嶅崄杩涘埗鏁�");
+ }
+ if (!decimalAddress.matches("\\d{12}")) {
+ throw new IllegalArgumentException("鍦板潃蹇呴』鍏ㄩ儴鏄暟瀛�");
+ }
+ // 2. 鍑嗗缁撴灉鏁扮粍锛�6瀛楄妭锛�
+ byte[] result = new byte[6];
+ // 3. 浠庡彸鍚戝乏姣�2浣嶄竴缁勫鐞嗭紙灏忕搴忥級
+ for (int i = 0; i < 6; i++) {
+ // 璁$畻鍦ㄥ瓧绗︿覆涓殑浣嶇疆锛堜粠鍙冲悜宸︼級
+ int strIndex = 10 - (i * 2); // 鍥犱负瑕佸彇涓や綅锛屾墍浠ユ槸10,8,6,4,2,0
+ String twoDigits = decimalAddress.substring(strIndex, strIndex + 2);
+ // 灏嗕袱浣嶅崄杩涘埗鏁拌浆鎹负BCD瀛楄妭
+ // 渚嬪锛�"25" -> 0x25
+ result[i] = (byte) Integer.parseInt(twoDigits, 16);
+ }
+ // 娉ㄦ剰锛氫笂闈㈢殑寰幆椤哄簭宸茬粡鏄皬绔簭锛宺esult[0]瀛樼殑鏄渶浣庝袱浣�
+ return result;
+ }
+
+
+ private static String subByte(String value, byte sub) {
+ byte b = (byte) Integer.parseInt(value, 16);
+ int result = (b & 0xFF) - (sub & 0xFF);
+ // 纭繚缁撴灉鍦�0-255鑼冨洿鍐咃紙澶勭悊璐熸暟锛�
+ if (result < 0) {
+ result += 256;
+ }
+ String hexResult = String.format("%02X", result & 0xFF);
+ return hexResult;
+
+ }
+ private static String addByte(String value, byte add) {
+ byte b = (byte) Integer.parseInt(value, 16);
+ int result = (b & 0xFF) + (add & 0xFF);
+ // 纭繚缁撴灉鍦�0-255鑼冨洿鍐咃紙澶勭悊璐熸暟锛�
+ if (result < 0) {
+ result += 256;
+ }
+ String hexResult = String.format("%02X", result & 0xFF);
+ return hexResult;
+
+ }
+
+
+ private static String[] parseSub33Reverse(String msg, int n) {
+ //33333333 3333
+ String[] nArr = new String[n];
+
+ byte _33 = 0x33;
+ for (int i = 0; i < n; i++) {
+ int index = i * 2;
+ String twoDigits = msg.substring(index, index + 2);
+ String hexResult = subByte(twoDigits, _33);
+ // 鍙嶅悜瀛樺偍锛歯Arr[n - i - 1] 瀹炵幇鍙嶈浆
+ nArr[n - i - 1] = hexResult;
+ }
+ return nArr;
+ }
+
+
+ public static Map<String, Object> water(String ip, int port, String address) throws IOException {
+ byte[] address_buf = convertToBCDAddress(address);
+ byte control = 0x01;
+ byte[] data = {0x43, (byte) 0xC3};
+ byte[] bufReq = getRequestParam(3, address_buf, control, data);
+ byte[] resp = readDeviceData(ip, port, bufReq);
+ String hex = bytesToHex(resp);
+
+ //FEFEFE6899254652010068810843C3333433333333E916
+// System.out.println(hex);
+ String msg = hex.substring(30, 30 + 8 + 4);
+
+ String[] nArr = parseSub33Reverse(msg, 4);
+ Double total = strArrNum(nArr);
+ Map<String, Object> r = new HashMap<>();
+ r.put("total", total);
+
+ msg = hex.substring(40, 40 + 2);
+ byte sub = 0x33;
+ String hexResult = subByte(msg, sub);
+ String v = hexToBinary(hexResult);
+ /**
+ * Y0.B0銆�瀛樺偍鍣ㄧ姸鎬� (1:鏁呴殰,0:姝e父)锛�
+ * Y0.B1銆�闃�闂ㄧ姸鎬� (1:鏁呴殰,0:姝e父)锛�
+ * Y0.B2銆�淇″彿鐘舵�� (1:鏁呴殰,0:姝e父)锛�
+ * Y0.B3銆�鐢垫睜鐘舵�� (1:鏁呴殰,0:姝e父)锛�
+ * Y0.B4銆�淇濈暀锛�
+ * Y0.B5銆�淇濈暀锛�
+ * Y0.B6銆�姘磋〃閫氳鐘舵�侊紙 1:鏁呴殰,0:姝e父锛夛紱
+ * Y0.B7銆�闃�闂ㄥ紑鍏崇姸鎬� (1: 鍚�,0:寮�)锛�
+ * 娉ㄦ剰锛氱姸鎬佷綅鏃犳椂涓� 0锛堟甯革級
+ * 绾㈣壊锛氭棤璁板繂鐩磋琛ㄧ殑鐘舵��
+ */
+
+ r.put("status", v);
+ return r;
+ }
+
+
+ private static void electricityTotal(String ip, int port, byte[] addressBuf, Map<String, Object> map) throws IOException {
+ byte control = 0x11;
+ byte[] data = {0x33, 0x33, 0x33, 0x33};
+
+ byte[] bufReq = getRequestParam(4, addressBuf, control, data);
+ byte[] respBuf = readDeviceData(ip, port, bufReq);
+ String resp = bytesToHex(respBuf);
+ String msg = resp.substring(28 + 8, 28 + 8 + 8);
+ String[] nArr = parseSub33Reverse(msg, 4);
+ Double total = strArrNum(nArr);
+ map.put("total", total);
+ }
+
+ /**
+ * 鐢佃〃璺抽椄銆佸悎闂�
+ * @param ip
+ * @param port
+ * @param addressBuf
+ * @param type 锛�0璺抽椄 1鍚堥椄锛�
+ * @param date 鏈夋晥鎴鏃堕棿
+ * @throws IOException
+ */
+ private static boolean electricityControl(String ip, int port, byte[] addressBuf,int type, String date) {
+ /**
+ * N1涓烘帶鍒跺懡浠ょ被鍨嬶紝N1=1AH浠h〃璺抽椄4D锛孨1=1BH浠h〃鍚堥椄4F鍏佽N2淇濈暀
+ * 鏉冮檺瀵嗙爜鎿嶄綔浠g爜锛歅AP2P1P0C3C2C1C0(02/223203/111111H)
+ * 4F
+ * TCP/IP鐩存帴鍚堥椄鎸囦护[2026骞�03鏈�09鏃� 10:57:39]
+ * Tx ->FEFEFEFE68615121010000681C1035366555776655444F33568843433659E016
+ * TCP/IP鐩存帴鍚堥椄鎸囦护[2026骞�03鏈�09鏃� 10:57:40]
+ * Rx <-FEFEFEFE68615121010000689C004016
+ * 鐩存帴鍚堥椄鎵ц鎴愬姛锛� 9C
+ */
+ try {
+ byte control = 0x1C;
+ byte n1 = 0x4D;
+ if(type==1){
+ n1 = 0x4F;
+ }
+// byte[] data0 = {0x02, 0x03, 0x32, 0x22,0x44,0x33,0x22,0x11};
+ byte[] data = {0x35, 0x36, 0x65, 0x55,0x77,0x66,0x55,0x44,n1,0x33,0,0,0,0,0,0};
+ byte[] data2 = getDateBytes(date);
+ for (int i = 0; i < data2.length; i++) {
+ data[10+i]=data2[i];
+ }
+ byte[] bufReq = getRequestParam(4, addressBuf, control, data);
+ String reqt = bytesToHex(bufReq);
+ System.out.println(reqt);
+ byte[] respBuf = readDeviceData(ip, port, bufReq);
+ String resp = bytesToHex(respBuf);
+ System.out.println(resp);
+ //FEFEFEFE68379707010000689C004216
+ String msg = resp.substring(24, 26);
+ return msg.equals("9C");
+ }catch (Exception e){
+
+ }
+ return false;
+ }
+
+ private static byte[] getDateBytes(String dateStr) {
+// String dateStr = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
+ dateStr = dateStr.substring(2);
+ // 1. 楠岃瘉杈撳叆
+ if (dateStr == null || dateStr.length() != 12) {
+ throw new IllegalArgumentException("鏃堕棿蹇呴』鏄�12浣嶅崄杩涘埗鏁�");
+ }
+ if (!dateStr.matches("\\d{12}")) {
+ throw new IllegalArgumentException("鏃堕棿蹇呴』鍏ㄩ儴鏄暟瀛�");
+ }
+ // 2. 鍑嗗缁撴灉鏁扮粍锛�6瀛楄妭锛�
+ byte[] result = new byte[6];
+ // 3. 浠庡彸鍚戝乏姣�2浣嶄竴缁勫鐞嗭紙灏忕搴忥級
+ byte add = 0x33;
+ for (int i = 0; i < 6; i++) {
+ // 璁$畻鍦ㄥ瓧绗︿覆涓殑浣嶇疆锛堜粠鍙冲悜宸︼級
+ int strIndex = 10 - (i * 2); // 鍥犱负瑕佸彇涓や綅锛屾墍浠ユ槸10,8,6,4,2,0
+ String twoDigits = dateStr.substring(strIndex, strIndex + 2);
+ // 灏嗕袱浣嶅崄杩涘埗鏁拌浆鎹负BCD瀛楄妭
+ // 渚嬪锛�"25" -> 0x25
+ int t = Integer.parseInt(twoDigits, 16);
+ int t1 = ( t& 0xFF) + (add & 0xFF);
+ System.out.println(t1+":");
+ result[i] =(byte) t1 ;
+ }
+ // 娉ㄦ剰锛氫笂闈㈢殑寰幆椤哄簭宸茬粡鏄皬绔簭锛宺esult[0]瀛樼殑鏄渶浣庝袱浣�
+ return result;
+ }
+
+
+ private static void electricityStatus(String ip, int port, byte[] addressBuf, Map<String, Object> map) throws IOException {
+ byte control = 0x11;
+ byte[] data = {0x36, 0x38, 0x33, 0x37};
+ byte[] bufReq = getRequestParam(4, addressBuf, control, data);
+ byte[] respBuf = readDeviceData(ip, port, bufReq);
+ String resp = bytesToHex(respBuf);
+ String msg = resp.substring(36, 36 + 4);
+ System.out.println(resp);
+ String[] nArr = parseSub33Reverse(msg, 2);
+ String status = hexToBinary1(nArr);
+// String resp = "FEFEFEFE 68 615121010000 68 91 06 36383337 3333 7916";
+ map.put("status", status);
+ }
+
+ private static void electricityTime(String ip, int port, byte[] addressBuf, Map<String, Object> map) throws IOException {
+ byte control = 0x11;
+ byte[] data = {0x3F, 0x34, 0x33, 0x37};
+ byte[] bufReq = getRequestParam(4, addressBuf, control, data);
+ byte[] respBuf = readDeviceData(ip, port, bufReq);
+ String resp = bytesToHex(respBuf);
+ String msg = resp.substring(36, 36 + 14);
+// System.out.println(msg);
+ String[] nArr = parseSub33Reverse(msg, 7);
+ String ts = hexToBinary1(nArr);
+ String time = "20"+ts.substring(0,6)+ts.substring(8);
+ Date date = getDateByStr(time);
+ System.out.println( formatData(date));
+// String resp = "FEFEFEFE 68 615121010000 68 91 06 36383337 3333 7916";
+ map.put("time", date);
+// map.put("currentTime", formatData(date));
+ }
+ public static Date getDateByStr(String date) {
+ TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
+ if(date!=null ){
+ int i = date.indexOf("+");
+ if(i >0){
+ date = date.substring(0,i);
+ }
+ }
+ DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
+ df.setTimeZone(tz);
+ Date dates = null;
+ try {
+ dates = df.parse(date);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return dates;
+ }
+ public static String formatData(Date date) {
+ DateFormat df = new SimpleDateFormat("yyyy骞碝M鏈坉d鏃H鏃秏m鍒唖s绉�");
+ try {
+ return df.format(date);
+ } catch (Exception e) {
+ }
+ return null;
+ }
+
+ public static Map<String, Object> electricityData(String ip, int port, String address) throws IOException {
+ Map<String, Object> r = new HashMap<>();
+ byte[] addressBuf = convertToBCDAddress(address);
+ electricityTotal(ip, port, addressBuf, r);
+ electricityStatus(ip, port, addressBuf, r);
+ electricityTime(ip, port, addressBuf, r);
+ return r;
+ }
+ public static boolean electricityAct(String ip, int port, String address,int type,String dateStr) {
+ Map<String, Object> r = new HashMap<>();
+ byte[] addressBuf = convertToBCDAddress(address);
+ return electricityControl(ip,port,addressBuf,type,dateStr);
+ }
+ private static String hexToBinary(String hex) {
+ StringBuilder sb = new StringBuilder();
+ for (char c : hex.toCharArray()) {
+ int val = Integer.parseInt(String.valueOf(c), 16);
+ sb.append(String.format("%4s", Integer.toBinaryString(val)).replace(' ', '0'));
+ }
+ return sb.toString();
+ }
+
+ private static String hexToBinary(String[] hexArr) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < hexArr.length; i++) {
+ sb.append(hexToBinary(hexArr[i]));
+ }
+ return sb.toString();
+ }
+ private static String hexToBinary1(String[] hexArr) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < hexArr.length; i++) {
+ sb.append(hexArr[i]);
+ }
+ return sb.toString();
+ }
+
+ private static String addHex(String hex1, String hex2) {
+ int num1 = Integer.parseInt(hex1.replace("0x", ""), 16);
+ int num2 = Integer.parseInt(hex2.replace("0x", ""), 16);
+ int sum = num1 + num2;
+ return "0x" + Integer.toHexString(sum).toUpperCase();
+ }
+
+ private static void testWater() throws IOException {
+ //"00000152462599"; 000152462599
+ //FEFEFE 68 999999999999 68 01(C) 02(L) 65(DI0) F3(DI1) C1(CS鏍¢獙鐮�) 16(缁撴潫绗�)
+ //FEFEFE6899254652010068010243C33016
+ //FEFEFE6899254652010068810843C3333333333333E816
+
+// FEFEFE6899254652010068810843C3333333333333E816
+ String ip = "192.168.1.78";
+ int port = 1030;
+// DeviceData d = readDeviceData(ip, port, "00000152462599");
+// System.out.println(d);
+// String address = "000152462599";
+ String address = "000152462599";
+ //00000152462599
+ byte[] address_buf = convertToBCDAddress(address);
+// byte[] address_buf = hexStringToByteArray(address);
+// System.out.println(buf);
+ /**
+ *
+ * FEFEFE 68 000152462599 68010243C33016
+ * FEFEFE 68 992546520100 68010243C33016
+ */
+ byte control = 0x01;
+ byte[] data = {0x43, (byte) 0xC3};
+ byte[] datas = getRequestParam(3, address_buf, control, data);
+ System.out.println(bytesToHex(datas));
+ System.out.println("FEFEFE6899254652010068010243C33016");
+// datas = hexStringToByteArray("FEFEFE6899254652010068010243C33016");
+ byte[] resp = readDeviceData(ip, port, datas);
+ String r = bytesToHex(resp);
+ System.out.println(r);
+
+ /**
+ *
+ * FEFEFE 68 992546520100 68 01 02 43C3 30 16
+ * FEFEFE 68 992546520100 68 81 08 43C3 33333333 3333 E8 16
+ */
+// String r = "FEFEFE6899254652010068810843C3333333333333E816";
+ String msg = r.substring(30, 30 + 8 + 4);
+ System.out.println(msg);
+ String[] nArr = parseSub33Reverse(msg, 4);
+ System.out.println(strArrNum(nArr));
+// byte d10 = 0x10;
+// byte add = 0x33;
+// String hex = String.format("%02X", (d10 + add) & 0xFF);
+// System.out.println(hex);
+
+// r = addHex("0x10", "0x33");
+// System.out.println(r);
+//
+// r = addHex("0x90", "0x33");
+// System.out.println(r);
+ msg = r.substring(40, 40 + 2);
+ System.out.println(msg);
+
+ byte sub = 0x33;
+ String hexResult = subByte(msg, sub);
+ String v = hexToBinary(hexResult);
+ System.out.println(v);
+ }
+
+
+ /**
+ * 鏈�鍚庝竴浣嶆槸灏忔暟鐐�
+ *
+ * @param nArr
+ * @return
+ */
+ private static Double strArrNum(String[] nArr) {
+ if (nArr == null || nArr.length == 0) {
+ return 0.0;
+ }
+ // 灏嗘墍鏈夐儴鍒嗘嫾鎺ヨ捣鏉�
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < nArr.length; i++) {
+ sb.append(nArr[i]);
+ }
+
+ // 鍦ㄩ�傚綋浣嶇疆鎻掑叆灏忔暟鐐�
+ String combined = sb.toString();
+ int totalLength = combined.length();
+ int decimalLength = nArr[nArr.length - 1].length();
+ // 鎻掑叆灏忔暟鐐�
+ String numberStr = combined.substring(0, totalLength - decimalLength) + "." + combined.substring(totalLength - decimalLength);
+ return Double.parseDouble(numberStr);
+ }
+
+
+ public static void electricityTest() throws IOException {
+ //000001215161
+// FEFEFEFE 68 615121010000 68 11 04 33333333 8516
+// FEFEFEFE6861512101000068910833333333A93333334B16
+// FEFEFEFE6861512101000068910833333333AC3333334E16
+ String ip = "192.168.1.78";
+ int port = 1030;
+
+ String address = "000001215161";
+ byte[] addressBuf = convertToBCDAddress(address);
+
+// byte control = 0x11;
+// byte[] data = {0x33, 0x33, 0x33, 0x33};
+////
+// byte[] bufReq = getRequestParam(4, addressBuf, control, data);
+//// String req = bytesToHex(bufReq);
+////// String param = "FEFEFE68615121010000681104333333338516";
+//// System.out.println(req);
+////// System.out.println(param);
+//// byte[] buf = hexStringToByteArray(param);
+// byte[] respBuf = readDeviceData(ip, port, bufReq);
+// String hex = bytesToHex(respBuf);
+//// System.out.println(hex);
+// String resp = "FEFEFEFE6861512101000068910833333333AC3333334E16";
+//// FEFEFEFE68615121010000 68 91 08 33333333 A9 333333 4B16
+//
+// String msg = resp.substring(28, 28 + 8);
+// System.out.println(msg);
+//
+// String[] nArr = parseSub33Reverse(msg, 4);
+// System.out.println(strArrNum(nArr));
+// msg = resp.substring(28 + 8, 28 + 8 + 8);
+// System.out.println(msg);
+//
+// nArr = parseSub33Reverse(msg, 4);
+//// parseSub33Reverse
+// System.out.println(strArrNum(nArr));
+
+
+// String msgStatus = "FEFEFEFE 68 379707010000 68 11 04 36383337 9316";
+// String msgStatus = "FEFEFEFE68379707010000681104363833379316";
+// byte control = 0x11;
+// byte[] data = {0x36, 0x38, 0x33, 0x37};
+// byte[] bufReq = getRequestParam(4, addressBuf, control, data);
+// String req = bytesToHex(bufReq);
+// System.out.println(req);
+// System.out.println(msgStatus);
+// byte[] respBuf = readDeviceData(ip, port, bufReq);
+// String resp = bytesToHex(respBuf);
+// System.out.println(resp);
+// FEFEFEFE 68 615121010000 68 91 06 36383337 3333 79 16
+// FEFEFEFE 68 615121010000 68 91 06 36383337 3333 79 16
+ String resp = "FEFEFEFE686151210100006891063638333733337916";
+ String msg = resp.substring(36, 36 + 4);
+ System.out.println(msg);
+ String[] nArr = parseSub33Reverse(msg, 2);
+// System.out.println(strArrNum(nArr));
+ String v = hexToBinary(nArr);
+ v="0000000000010000";
+ System.out.println(v);
+ System.out.println(v.charAt(11));
+
+
+ }
+
+
+ public static void main(String[] args) throws IOException {
+// testWater();
+// electricityTest();
+// water("192.168.1.78",1030,"000152462599");
+// Map<String, Object> map = electricityData("192.168.1.78", 1030, "000001215161");
+// System.out.println(JSONObject.toJSONString(map));
+ electricityAct("192.168.1.78", 1030, "000001215161",0,"20260309162655");
+// FEFEFE6899254652010068810 843C3333433333333 E9 16
+// FEFEFE6899254652010068810 84 3C3333433333333E916
+
+// Map<String, Object> map1 = water("192.168.1.78", 1030, "000152462599");
+// System.out.println(JSONObject.toJSONString(map1));
+ }
+
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/DeviceDataMapper.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/DeviceDataMapper.java
new file mode 100644
index 0000000..4818344
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/DeviceDataMapper.java
@@ -0,0 +1,12 @@
+package com.doumee.dao.business;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.doumee.dao.business.model.DeviceData;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2025/12/25 10:04
+ */
+public interface DeviceDataMapper extends BaseMapper<DeviceData> {
+
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Device.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Device.java
index 1209387..ab0f1e4 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Device.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Device.java
@@ -1,5 +1,7 @@
package com.doumee.dao.business.model;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.doumee.core.model.LoginUserModel;
import io.swagger.annotations.ApiModel;
@@ -8,9 +10,9 @@
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import java.util.Date;
+
import java.math.BigDecimal;
+import java.util.Date;
/**
* 璁惧淇℃伅琛�
@@ -71,8 +73,8 @@
@ExcelColumn(name="鎺掑簭鐮�")
private Integer sortnum;
- @ApiModelProperty(value = "绫诲瀷 0闂ㄧ 1杞﹀簱 2LED 3骞挎挱", example = "1")
- @ExcelColumn(name="绫诲瀷 0闂ㄧ 1杞﹀簱 2LED 3骞挎挱")
+ @ApiModelProperty(value = "绫诲瀷 0闂ㄧ 1杞﹀簱 2LED 3骞挎挱鐐� 4骞挎挱璁惧 5鏂矾鍣ㄧ┖寮� 6娴峰悍鐢佃〃", example = "1")
+ @ExcelColumn(name="绫诲瀷 0闂ㄧ 1杞﹀簱 2LED 3骞挎挱鐐� 4骞挎挱璁惧 5鏂矾鍣ㄧ┖寮� 6娴峰悍鐢佃〃")
private Integer type;
@ApiModelProperty(value = "鏄惁鍥尯鍑哄叆鍙� 0涓嶆槸 1鏄�", example = "1")
@ExcelColumn(name="鏄惁鍥尯鍑哄叆鍙� 0涓嶆槸 1鏄�")
@@ -154,12 +156,14 @@
@ApiModelProperty(value = "闂ㄧ鐐瑰悕绉�")
@ExcelColumn(name="闂ㄧ鐐瑰悕绉�")
private String doorName;
-
-
-
-
-
-
-
+ @ApiModelProperty(value = "鎾姤鍐呭")
+ @TableField(exist = false)
+ private String sendInfo;
+ @ApiModelProperty(value = "杩滅▼鎿嶄綔鏃堕棿鍙傛暟")
+ @TableField(exist = false)
+ private Date cmdDate;
+ @ApiModelProperty(value = "閰嶇疆鍙傛暟")
+ @TableField(exist = false)
+ private JSONObject doorNameObj;
}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/DeviceData.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/DeviceData.java
new file mode 100644
index 0000000..f9498d8
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/DeviceData.java
@@ -0,0 +1,95 @@
+package com.doumee.dao.business.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.doumee.core.annotation.excel.ExcelColumn;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 闂ㄧ浜嬩欢鎺ㄩ�佽褰曡〃
+ * @author 姹熻箘韫�
+ * @date 2025/12/25 10:04
+ */
+@Data
+@ApiModel("闂ㄧ浜嬩欢鎺ㄩ�佽褰曡〃")
+@TableName("`device_data`")
+public class DeviceData {
+
+ @TableId(type = IdType.AUTO)
+ @ApiModelProperty(value = "涓婚敭", example = "1")
+ @ExcelColumn(name="涓婚敭")
+ private Integer id;
+
+ @ApiModelProperty(value = "鍒涘缓浜虹紪鐮�", example = "1")
+ @ExcelColumn(name="鍒涘缓浜虹紪鐮�")
+ private Integer creator;
+
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+ @ExcelColumn(name="鍒涘缓鏃堕棿")
+ private Date createDate;
+
+ @ApiModelProperty(value = "鏇存柊浜虹紪鐮�", example = "1")
+ @ExcelColumn(name="鏇存柊浜虹紪鐮�")
+ private Integer editor;
+
+ @ApiModelProperty(value = "鏇存柊鏃堕棿")
+ @ExcelColumn(name="鏇存柊鏃堕棿")
+ private Date editDate;
+
+ @ApiModelProperty(value = "鏄惁鍒犻櫎0鍚� 1鏄�", example = "1")
+ @ExcelColumn(name="鏄惁鍒犻櫎0鍚� 1鏄�")
+ private Integer isdeleted;
+
+ @ApiModelProperty(value = "澶囨敞")
+ @ExcelColumn(name="澶囨敞")
+ private String remark;
+
+ @ApiModelProperty(value = "鏁版嵁json瀵硅薄", example = "1")
+ @ExcelColumn(name="鏁版嵁json瀵硅薄")
+ private String dataJson;
+
+ @ApiModelProperty(value = "璁惧缂栫爜锛堝叧鑱攄evice)")
+ @ExcelColumn(name="璁惧缂栫爜锛堝叧鑱攄evice)")
+ private String deviceId;
+
+ @ApiModelProperty(value = "鍙戠敓鏃堕棿")
+ @ExcelColumn(name="鍙戠敓鏃堕棿")
+ private String happenTime;
+
+ @ApiModelProperty(value = "灞炴�у��1")
+ @ExcelColumn(name="灞炴�у��1")
+ private String val1;
+
+ @ApiModelProperty(value = "灞炴�у��2")
+ @ExcelColumn(name="灞炴�у��2")
+ private String val2;
+
+ @ApiModelProperty(value = "灞炴�у��3")
+ @ExcelColumn(name="灞炴�у��3")
+ private String val3;
+
+ @ApiModelProperty(value = "灞炴�у��4")
+ @ExcelColumn(name="灞炴�у��4")
+ private String val4;
+
+ @ApiModelProperty(value = "灞炴�у��5")
+ @ExcelColumn(name="灞炴�у��5")
+ private String val5;
+
+ @ApiModelProperty(value = "灞炴�у��6")
+ @ExcelColumn(name="灞炴�у��6")
+ private String val6;
+ @ApiModelProperty(value = "灞炴�у��7")
+ @ExcelColumn(name="灞炴�у��7")
+ private String val7;
+
+ @ApiModelProperty(value = "鏁版嵁鏉ユ簮 0mqtt涓婃姤缁煎悎鐘舵�� 1杩滅▼鎺у埗 2TCP璇诲彇鏁版嵁 ", example = "1")
+ @ExcelColumn(name="鏁版嵁鏉ユ簮 0mqtt涓婃姤缁煎悎鐘舵�� 1杩滅▼鎺у埗 2TCP璇诲彇鏁版嵁")
+ private Integer dataType;
+
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceDataService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceDataService.java
new file mode 100644
index 0000000..34df45e
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceDataService.java
@@ -0,0 +1,98 @@
+package com.doumee.service.business;
+
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.model.DeviceData;
+
+import java.util.List;
+
+/**
+ * 闂ㄧ浜嬩欢鎺ㄩ�佽褰曡〃Service瀹氫箟
+ * @author 姹熻箘韫�
+ * @date 2025/12/25 10:04
+ */
+public interface DeviceDataService {
+
+ /**
+ * 鍒涘缓
+ *
+ * @param deviceData 瀹炰綋瀵硅薄
+ * @return Integer
+ */
+ Integer create(DeviceData deviceData);
+
+ /**
+ * 涓婚敭鍒犻櫎
+ *
+ * @param id 涓婚敭
+ */
+ void deleteById(Integer id);
+
+ /**
+ * 鍒犻櫎
+ *
+ * @param deviceData 瀹炰綋瀵硅薄
+ */
+ void delete(DeviceData deviceData);
+
+ /**
+ * 鎵归噺涓婚敭鍒犻櫎
+ *
+ * @param ids 涓婚敭闆�
+ */
+ void deleteByIdInBatch(List<Integer> ids);
+
+ /**
+ * 涓婚敭鏇存柊
+ *
+ * @param deviceData 瀹炰綋瀵硅薄
+ */
+ void updateById(DeviceData deviceData);
+
+ /**
+ * 鎵归噺涓婚敭鏇存柊
+ *
+ * @param deviceDatas 瀹炰綋闆�
+ */
+ void updateByIdInBatch(List<DeviceData> deviceDatas);
+
+ /**
+ * 涓婚敭鏌ヨ
+ *
+ * @param id 涓婚敭
+ * @return DeviceData
+ */
+ DeviceData findById(Integer id);
+
+ /**
+ * 鏉′欢鏌ヨ鍗曟潯璁板綍
+ *
+ * @param deviceData 瀹炰綋瀵硅薄
+ * @return DeviceData
+ */
+ DeviceData findOne(DeviceData deviceData);
+
+ /**
+ * 鏉′欢鏌ヨ
+ *
+ * @param deviceData 瀹炰綋瀵硅薄
+ * @return List<DeviceData>
+ */
+ List<DeviceData> findList(DeviceData deviceData);
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ *
+ * @param pageWrap 鍒嗛〉瀵硅薄
+ * @return PageData<DeviceData>
+ */
+ PageData<DeviceData> findPage(PageWrap<DeviceData> pageWrap);
+
+ /**
+ * 鏉′欢缁熻
+ *
+ * @param deviceData 瀹炰綋瀵硅薄
+ * @return long
+ */
+ long count(DeviceData deviceData);
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java
index f752fd9..8c1ed4a 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java
@@ -1,11 +1,12 @@
package com.doumee.service.business;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
import com.doumee.core.haikang.model.param.request.TransparentChannelSingleRequest;
+import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Device;
+import org.eclipse.paho.client.mqttv3.MqttMessage;
+
import java.util.List;
/**
@@ -15,9 +16,10 @@
*/
public interface DeviceService {
+
/**
* 鍒涘缓
- *
+ *
* @param device 瀹炰綋瀵硅薄
* @return Integer
*/
@@ -28,7 +30,7 @@
*
* @param id 涓婚敭
*/
- void deleteById(Integer id);
+ void deleteById(Integer id, LoginUserInfo userInfo);
/**
* 鍒犻櫎
@@ -42,7 +44,7 @@
*
* @param ids 涓婚敭闆�
*/
- void deleteByIdInBatch(List<Integer> ids);
+ void deleteByIdInBatch(List<Integer> ids, LoginUserInfo userInfo);
/**
* 涓婚敭鏇存柊
@@ -106,4 +108,11 @@
long count(Device device);
void setLedContent(TransparentChannelSingleRequest body);
+
+ void setBroadcaseBobao(Device body);
+
+ void updateUsedById(Device d);
+
+ void dianbaoCmd(Device param);
+ void dianbiaoData(Device param);
}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceDataServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceDataServiceImpl.java
new file mode 100644
index 0000000..f1a4754
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceDataServiceImpl.java
@@ -0,0 +1,161 @@
+package com.doumee.service.business.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.DeviceDataMapper;
+import com.doumee.dao.business.model.DeviceData;
+import com.doumee.service.business.DeviceDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+/**
+ * 闂ㄧ浜嬩欢鎺ㄩ�佽褰曡〃Service瀹炵幇
+ * @author 姹熻箘韫�
+ * @date 2025/12/25 10:04
+ */
+@Service
+public class DeviceDataServiceImpl implements DeviceDataService {
+
+ @Autowired
+ private DeviceDataMapper deviceDataMapper;
+
+ @Override
+ public Integer create(DeviceData deviceData) {
+ deviceDataMapper.insert(deviceData);
+ return deviceData.getId();
+ }
+
+ @Override
+ public void deleteById(Integer id) {
+ deviceDataMapper.deleteById(id);
+ }
+
+ @Override
+ public void delete(DeviceData deviceData) {
+ UpdateWrapper<DeviceData> deleteWrapper = new UpdateWrapper<>(deviceData);
+ deviceDataMapper.delete(deleteWrapper);
+ }
+
+ @Override
+ public void deleteByIdInBatch(List<Integer> ids) {
+ if (CollectionUtils.isEmpty(ids)) {
+ return;
+ }
+ deviceDataMapper.deleteBatchIds(ids);
+ }
+
+ @Override
+ public void updateById(DeviceData deviceData) {
+ deviceDataMapper.updateById(deviceData);
+ }
+
+ @Override
+ public void updateByIdInBatch(List<DeviceData> deviceDatas) {
+ if (CollectionUtils.isEmpty(deviceDatas)) {
+ return;
+ }
+ for (DeviceData deviceData: deviceDatas) {
+ this.updateById(deviceData);
+ }
+ }
+
+ @Override
+ public DeviceData findById(Integer id) {
+ return deviceDataMapper.selectById(id);
+ }
+
+ @Override
+ public DeviceData findOne(DeviceData deviceData) {
+ QueryWrapper<DeviceData> wrapper = new QueryWrapper<>(deviceData);
+ return deviceDataMapper.selectOne(wrapper);
+ }
+
+ @Override
+ public List<DeviceData> findList(DeviceData deviceData) {
+ QueryWrapper<DeviceData> wrapper = new QueryWrapper<>(deviceData);
+ return deviceDataMapper.selectList(wrapper);
+ }
+
+ @Override
+ public PageData<DeviceData> findPage(PageWrap<DeviceData> pageWrap) {
+ IPage<DeviceData> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+ QueryWrapper<DeviceData> queryWrapper = new QueryWrapper<>();
+ Utils.MP.blankToNull(pageWrap.getModel());
+ if (pageWrap.getModel().getId() != null) {
+ queryWrapper.lambda().eq(DeviceData::getId, pageWrap.getModel().getId());
+ }
+ if (pageWrap.getModel().getCreator() != null) {
+ queryWrapper.lambda().eq(DeviceData::getCreator, pageWrap.getModel().getCreator());
+ }
+ if (pageWrap.getModel().getCreateDate() != null) {
+ queryWrapper.lambda().ge(DeviceData::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
+ queryWrapper.lambda().le(DeviceData::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
+ }
+ if (pageWrap.getModel().getEditor() != null) {
+ queryWrapper.lambda().eq(DeviceData::getEditor, pageWrap.getModel().getEditor());
+ }
+ if (pageWrap.getModel().getEditDate() != null) {
+ queryWrapper.lambda().ge(DeviceData::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
+ queryWrapper.lambda().le(DeviceData::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
+ }
+ if (pageWrap.getModel().getIsdeleted() != null) {
+ queryWrapper.lambda().eq(DeviceData::getIsdeleted, pageWrap.getModel().getIsdeleted());
+ }
+ if (pageWrap.getModel().getRemark() != null) {
+ queryWrapper.lambda().eq(DeviceData::getRemark, pageWrap.getModel().getRemark());
+ }
+ if (pageWrap.getModel().getDataJson() != null) {
+ queryWrapper.lambda().eq(DeviceData::getDataJson, pageWrap.getModel().getDataJson());
+ }
+ if (pageWrap.getModel().getDeviceId() != null) {
+ queryWrapper.lambda().eq(DeviceData::getDeviceId, pageWrap.getModel().getDeviceId());
+ }
+ if (pageWrap.getModel().getHappenTime() != null) {
+ queryWrapper.lambda().eq(DeviceData::getHappenTime, pageWrap.getModel().getHappenTime());
+ }
+ if (pageWrap.getModel().getVal1() != null) {
+ queryWrapper.lambda().eq(DeviceData::getVal1, pageWrap.getModel().getVal1());
+ }
+ if (pageWrap.getModel().getVal2() != null) {
+ queryWrapper.lambda().eq(DeviceData::getVal2, pageWrap.getModel().getVal2());
+ }
+ if (pageWrap.getModel().getVal3() != null) {
+ queryWrapper.lambda().eq(DeviceData::getVal3, pageWrap.getModel().getVal3());
+ }
+ if (pageWrap.getModel().getVal4() != null) {
+ queryWrapper.lambda().eq(DeviceData::getVal4, pageWrap.getModel().getVal4());
+ }
+ if (pageWrap.getModel().getVal5() != null) {
+ queryWrapper.lambda().eq(DeviceData::getVal5, pageWrap.getModel().getVal5());
+ }
+ if (pageWrap.getModel().getVal6() != null) {
+ queryWrapper.lambda().eq(DeviceData::getVal6, pageWrap.getModel().getVal6());
+ }
+ if (pageWrap.getModel().getDataType() != null) {
+ queryWrapper.lambda().eq(DeviceData::getDataType, pageWrap.getModel().getDataType());
+ }
+ queryWrapper.lambda().orderByDesc(DeviceData::getHappenTime);
+ for(PageWrap.SortData sortData: pageWrap.getSorts()) {
+ if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
+ queryWrapper.orderByDesc(sortData.getProperty());
+ } else {
+ queryWrapper.orderByAsc(sortData.getProperty());
+ }
+ }
+ return PageData.from(deviceDataMapper.selectPage(page, queryWrapper));
+ }
+
+ @Override
+ public long count(DeviceData deviceData) {
+ QueryWrapper<DeviceData> wrapper = new QueryWrapper<>(deviceData);
+ return deviceDataMapper.selectCount(wrapper);
+ }
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
index 57eeaa2..2845622 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
@@ -2,29 +2,36 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.doumee.biz.system.SystemDictDataBiz;
-import com.doumee.core.constants.ResponseStatus;
-import com.doumee.core.exception.BusinessException;
-import com.doumee.core.haikang.model.HKConstants;
-import com.doumee.core.haikang.model.param.BaseResponse;
-import com.doumee.core.haikang.model.param.request.*;
-import com.doumee.core.model.PageData;
-import com.doumee.core.model.PageWrap;
-import com.doumee.core.utils.Constants;
-import com.doumee.core.utils.Utils;
-import com.doumee.dao.business.DeviceMapper;
-import com.doumee.dao.business.PlatformBroadcastLogMapper;
-import com.doumee.dao.business.model.Device;
-import com.doumee.dao.business.model.PlatformBroadcastLog;
-import com.doumee.service.business.DeviceService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.doumee.biz.system.SystemDictDataBiz;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.device.WaterElectricityUtil;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.haikang.model.HKConstants;
+import com.doumee.core.haikang.model.param.BaseResponse;
+import com.doumee.core.haikang.model.param.request.CustomBroadcastRequest;
+import com.doumee.core.haikang.model.param.request.TransparentChannelSingleRequest;
+import com.doumee.core.haikang.service.HKService;
+import com.doumee.core.model.LoginUserInfo;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
+import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.*;
+import com.doumee.dao.business.model.Device;
+import com.doumee.dao.business.model.DeviceData;
+import com.doumee.dao.business.model.PlatformBroadcastLog;
+import com.doumee.service.business.DeviceService;
import com.doumee.service.business.impl.hksync.HkSyncPushServiceImpl;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
@@ -35,25 +42,54 @@
* @date 2023/11/30 15:33
*/
@Service
+@Slf4j
public class DeviceServiceImpl implements DeviceService {
@Autowired
private DeviceMapper deviceMapper;
@Autowired
+ private DeviceDataMapper deviceDataMapper;
+ @Autowired
+ private PlatformMapper platformMapper;
+ @Autowired
+ private PlatformDeviceMapper platformDeviceMapper;
+ @Autowired
private SystemDictDataBiz systemDictDataBiz;
@Autowired
private PlatformBroadcastLogMapper platformBroadcastLogMapper;
+ @Autowired
+ private InterfaceLogMapper interfaceLogMapper;
@Override
- public Integer create(Device device) {
- deviceMapper.insert(device);
- return device.getId();
+ public Integer create(Device model) {
+ model.setCreator(model.getLoginUserInfo().getId()+"");
+ model.setEdirot(model.getCreator());
+ model.setIsdeleted(Constants.ZERO);
+ model.setEditDate(new Date());
+ model.setCreateDate(model.getEditDate());
+ if(model.getDoorNameObj()!=null &&
+ (Constants.equalsInteger(model.getType(),Constants.DEVICE_TYPE.duanluqi)
+ ||Constants.equalsInteger(model.getType(),Constants.DEVICE_TYPE.dianbiao))){
+ model.setDoorName(JSONObject.toJSONString(model.getDoorNameObj()));
+ if(StringUtils.isNotBlank(model.getLevel())){
+ if(getNumberByStr(model.getLevel()) <300){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鎺у埗鏃堕暱蹇呴』澶т簬绛変簬300绉�");
+ }
+ }
+ }
+ deviceMapper.insert(model);
+ return model.getId();
}
@Override
- public void deleteById(Integer id) {
- deviceMapper.deleteById(id);
+ public void deleteById(Integer id, LoginUserInfo userInfo) {
+ Device update = new Device();
+ update.setEdirot(userInfo.getId()+"");
+ update.setEditDate(new Date());
+ update.setIsdeleted(Constants.ONE);
+ update.setId(id);
+ deviceMapper.updateById(update);
}
@Override
@@ -63,16 +99,30 @@
}
@Override
- public void deleteByIdInBatch(List<Integer> ids) {
+ public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo userInfo) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
- deviceMapper.deleteBatchIds(ids);
+ for(Integer id :ids){
+ deleteById(id,userInfo);
+ }
}
@Override
public void updateById(Device device) {
+ device.setEdirot(device.getLoginUserInfo().getId()+"");
+ device.setEditDate(new Date());
+ if(device.getDoorNameObj()!=null &&
+ (Constants.equalsInteger(device.getType(),Constants.DEVICE_TYPE.duanluqi)
+ ||Constants.equalsInteger(device.getType(),Constants.DEVICE_TYPE.dianbiao))){
+ device.setDoorName(JSONObject.toJSONString(device.getDoorNameObj()));
+ }
+ Device model = deviceMapper.selectById(device.getId());
+ if(model ==null){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
deviceMapper.updateById(device);
+
}
@Override
@@ -87,7 +137,16 @@
@Override
public Device findById(Integer id) {
- return deviceMapper.selectById(id);
+ Device d = deviceMapper.selectById(id);
+ if(StringUtils.isNotBlank(d.getDoorName()) &&Constants.equalsInteger(d.getType(),Constants.DEVICE_TYPE.duanluqi)){
+ try {
+ //鏂矾鍣ㄨ澶囧弬鏁�
+ d.setDoorNameObj(JSONObject.parseObject(d.getDoorName()));
+ }catch (Exception e){
+
+ }
+ }
+ return d;
}
@Override
@@ -98,6 +157,7 @@
@Override
public List<Device> findList(Device device) {
+ device.setIsdeleted(Constants.ZERO);
QueryWrapper<Device> wrapper = new QueryWrapper<>(device);
return deviceMapper.selectList(wrapper);
}
@@ -107,12 +167,25 @@
LambdaQueryWrapper<Device> wrapper = new LambdaQueryWrapper<>(param);
wrapper.select(Device::getId, Device::getName, Device::getDoorName,Device::getRegionPathName, Device::getRegionName);
wrapper.eq(null != param.getType(),Device::getType,param.getType())
- .eq(null !=param.getIsdeleted(),Device::getIsdeleted,param.getIsdeleted())
- .eq(Objects.isNull(param.getIsdeleted()),Device::getIsdeleted,Constants.ZERO)
- .eq(null != param.getHkStatus(),Device::getHkStatus,param.getHkStatus());
- return deviceMapper.selectList(wrapper);
+ .eq(null !=param.getIsdeleted(),Device::getIsdeleted,param.getIsdeleted())
+ .eq(Objects.isNull(param.getIsdeleted()),Device::getIsdeleted,Constants.ZERO)
+ .eq(null != param.getHkStatus(),Device::getHkStatus,param.getHkStatus());
+ List<Device> list = deviceMapper.selectList(wrapper);
+ if(list!=null){
+ for(Device d : list){
+ if(StringUtils.isNotBlank(d.getDoorName()) &&Constants.equalsInteger(d.getType(),Constants.DEVICE_TYPE.duanluqi)){
+ try {
+ //鏂矾鍣ㄨ澶囧弬鏁�
+ d.setDoorNameObj(JSONObject.parseObject(d.getDoorName()));
+ }catch (Exception e){
+
+ }
+ }
+ }
+ }
+ return list;
}
-
+
@Override
public PageData<Device> findPage(PageWrap<Device> pageWrap) {
IPage<Device> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
@@ -147,6 +220,12 @@
}
if (pageWrap.getModel().getName() != null) {
queryWrapper.lambda().like(Device::getName, pageWrap.getModel().getName());
+ }
+ if (pageWrap.getModel().getDoorNo() != null) {
+ queryWrapper.lambda().like(Device::getDoorNo, pageWrap.getModel().getDoorNo());
+ }
+ if (pageWrap.getModel().getNo() != null) {
+ queryWrapper.lambda().like(Device::getNo, pageWrap.getModel().getNo());
}
if (pageWrap.getModel().getDoorName() != null) {
queryWrapper.lambda().like(Device::getDoorName, pageWrap.getModel().getDoorName());
@@ -219,7 +298,22 @@
queryWrapper.orderByAsc(sortData.getProperty());
}
}
- return PageData.from(deviceMapper.selectPage(page, queryWrapper));
+ IPage<Device> result = deviceMapper.selectPage(page, queryWrapper);
+ if(result!=null){
+ for(Device d : result.getRecords()){
+ if(StringUtils.isNotBlank(d.getDoorName())
+ && (Constants.equalsInteger(d.getType(),Constants.DEVICE_TYPE.duanluqi)||
+ Constants.equalsInteger(d.getType(),Constants.DEVICE_TYPE.dianbiao))){
+ try {
+ //鏂矾鍣ㄨ澶囧弬鏁�
+ d.setDoorNameObj(JSONObject.parseObject(d.getDoorName()));
+ }catch (Exception e){
+
+ }
+ }
+ }
+ }
+ return PageData.from(result);
}
@Override
@@ -227,6 +321,123 @@
QueryWrapper<Device> wrapper = new QueryWrapper<>(device);
return deviceMapper.selectCount(wrapper);
}
+
+ @Override
+ public void setBroadcaseBobao(Device model){
+ List<String> ids = new ArrayList<>();
+ ids.add(model.getHkId());
+ CustomBroadcastRequest request = new CustomBroadcastRequest();
+ request.setAudioPointIndexCode(ids);
+ request.setPlayDuration(15);//鍗曚綅绉�
+ request.setBroadCastMode("tts");
+ request.setPriority(1);
+ request.setState(1);//鎾斁/鍋滄鏍囪瘑 1-鎾斁锛�0-鍋滄
+ request.setPlayTtsContent(model.getSendInfo());
+ BaseResponse response = HKService.customBroadcast(request);
+ if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
+ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"鍙戦�佸け璐ワ細"+ JSONObject.toJSONString(response));
+ }
+ }
+
+ @Override
+ public void updateUsedById(Device param){
+ Device model = deviceMapper.selectById(param.getId());
+ if(model ==null && Constants.equalsInteger(param.getType(),Constants.DEVICE_TYPE.duanluqi)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+
+ this.updateById(param);
+ }
+
+ @Override
+ public void dianbaoCmd(Device param){
+ Device model = deviceMapper.selectById(param.getId());
+ if(model ==null && Constants.equalsInteger(param.getType(),Constants.DEVICE_TYPE.dianbiao)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if (param.getStatus() == null || param.getCmdDate() == null
+ ||param.getCmdDate().getTime() <= System.currentTimeMillis()) {
+ //濡傛灉鏄紑闂�
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ boolean r ;
+ String date = DateUtil.formatDate(new Date(),"yyyyMMddHHmmss");
+ if(Constants.equalsInteger(param.getStatus(),Constants.ONE)) {
+ //濡傛灉鏄紑闂�
+ r = WaterElectricityUtil.electricityAct(param.getIp(),Integer.parseInt(param.getPort()),param.getNo(),0,date);
+ }else {
+ //濡傛灉鏄悎闂�
+ r = WaterElectricityUtil.electricityAct(param.getIp(),Integer.parseInt(param.getPort()),param.getNo(),1,date);
+ }
+ if(!r){
+ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"杩滅▼鎺у埗鐢佃〃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+ }
+ String curremak = "銆�"+param.getLoginUserInfo().getRealname()
+ +"銆戜簬"+ DateUtil.getPlusTime2(new Date()) +"杩涜浜�"+(Constants.equalsInteger(param.getStatus(),Constants.ONE)?"銆愬悎闂搞��":"銆愬垎闂搞��")+"鎿嶄綔,寮�鍏炽��"+param.getChannelNo()+"銆戯紱";
+ deviceMapper.update(null,new UpdateWrapper<Device>().lambda()
+ .set(Device::getRemark,curremak)
+ .set(Device::getEditDate,new Date())
+ .set(Device::getEdirot,param.getLoginUserInfo().getId())
+ .eq(Device::getId,param.getId()));
+ DeviceData data = new DeviceData();
+ data.setCreateDate(new Date());
+ data.setEditDate(new Date());
+ data.setCreator(param.getLoginUserInfo().getId());
+ data.setEditor(param.getLoginUserInfo().getId());
+ data.setDeviceId(param.getId()+"");
+ data.setDataType(Constants.ONE);//
+ data.setVal1("杩滅▼鎺у埗");
+ data.setVal2(curremak);
+ data.setHappenTime(DateUtil.getPlusTime2(data.getCreateDate()));
+ data.setVal3((Constants.equalsInteger(param.getStatus(),Constants.ONE)?"銆愬悎闂搞��":"銆愬垎闂搞��"));
+ data.setVal4(param.getLoginUserInfo().getRealname());
+ data.setVal5(param.getChannelNo());
+ deviceDataMapper.insert(data);
+
+ }
+ @Override
+ @Transactional
+ public void dianbiaoData(Device param){
+ Device model = deviceMapper.selectById(param.getId());
+ if(model ==null && Constants.equalsInteger(param.getType(),Constants.DEVICE_TYPE.dianbiao)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ try {
+ Map<String, Object> readData= WaterElectricityUtil.electricityData(model.getIp(),Integer.parseInt(model.getPort()),model.getNo());
+ if(readData!=null){
+ String curremak = "銆�"+param.getLoginUserInfo().getRealname()
+ +"銆戜簬"+ DateUtil.getPlusTime2(new Date()) +"杩涜浜嗘暟鎹鍙栨搷浣�";
+ Date time =(Date) readData.get("time");
+ String total = (Double) readData.get("total")+"";
+ String status = (String) readData.get("status");
+ model.setHkDate(new Date());//鏈�杩戝悓姝ユ椂闂�
+ model.setOnline(Constants.ONE);//鏍囪瘑璁惧鍦ㄧ嚎
+ model.setRemark(curremak);
+
+ DeviceData data = new DeviceData();
+ data.setCreateDate(new Date());
+ data.setEditDate(new Date());
+ data.setCreator(param.getLoginUserInfo().getId());
+ data.setEditor(param.getLoginUserInfo().getId());
+ data.setDeviceId(param.getId()+"");
+ data.setDataType(Constants.ZERO);//
+ data.setVal1(total);
+ data.setVal2(status);
+ data.setHappenTime(DateUtil.getPlusTime2(data.getCreateDate()));
+ data.setVal3(DateUtil.getPlusTime2(time));
+ data.setVal4(param.getLoginUserInfo().getRealname());
+ data.setVal5(param.getNo());//鍦板潃鍩�
+ deviceDataMapper.insert(data);
+ deviceMapper.updateById(model);
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ log.error("鐢佃〃鏁版嵁璇诲彇澶辫触锛�"+e.getMessage());
+ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"璇诲彇鐢佃〃鏁版嵁澶辫触锛�");
+ }
+ }
+
@Override
public void setLedContent(TransparentChannelSingleRequest model) {
@@ -250,4 +461,28 @@
throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵逛笉璧凤紝灞忓箷鍐呭璁剧疆澶辫触"+(log!=null?log.getHkInfo():""));
}
}
+
+
+ private DeviceData getLastDataByVal1(String b, List<DeviceData> dataList,double limit) {
+ List<DeviceData> list = new ArrayList<>();
+ for(DeviceData d :dataList){
+ if(StringUtils.equals(d.getVal1(),b)){
+ if(limit <= getNumberByStr(d.getVal2())){
+ //濡傛灉鏈夊疄鏃剁數娴佸�煎ぇ浜庣┖闂查槇鍊硷紝鍒欒〃绀哄伐浣滀腑锛屼笉鍋氬鐞�
+ return null;
+ }
+ list.add(d);
+ }
+ }
+ return list.size()>0?list.get(0):null;
+ }
+
+ private double getNumberByStr(String level) {
+ try {
+ return Double.parseDouble(level);
+ }catch (Exception e){
+
+ }
+ return 0;
+ }
}
diff --git a/server/visits/dmvisit_service/src/main/resources/application-dev.yml b/server/visits/dmvisit_service/src/main/resources/application-dev.yml
index 7e535db..57baaf0 100644
--- a/server/visits/dmvisit_service/src/main/resources/application-dev.yml
+++ b/server/visits/dmvisit_service/src/main/resources/application-dev.yml
@@ -1,9 +1,9 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://112.26.66.25:3306/funingyunwei?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+ url: jdbc:mysql://192.168.0.211:3306/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
username: root
- password: Doumee@168&QWERT
+ password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
redis:
diff --git a/server/visits/dmvisit_service/src/main/resources/application-test.yml b/server/visits/dmvisit_service/src/main/resources/application-test.yml
index 5e192c8..c85d9ec 100644
--- a/server/visits/dmvisit_service/src/main/resources/application-test.yml
+++ b/server/visits/dmvisit_service/src/main/resources/application-test.yml
@@ -1,9 +1,9 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://sh-cdb-aiskr3vy.sql.tencentcdb.com:62443/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
- username: doumee
- password: rtjgfEr@&0c0m
+ url: jdbc:mysql://192.168.0.211:3306/funingyunwei?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+ username: root
+ password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
redis:
--
Gitblit v1.9.3