Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
88cb6cf1
Commit
88cb6cf1
authored
Nov 08, 2023
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备与门店房间绑定
parent
311de82d
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
174 additions
and
8 deletions
+174
-8
pom.xml
share-admin/pom.xml
+2
-0
DeviceController.java
...in/java/share/web/controller/system/DeviceController.java
+24
-0
SRoomController.java
...ain/java/share/web/controller/system/SRoomController.java
+24
-0
application-dev.yml
share-admin/src/main/resources/application-dev.yml
+14
-4
application-prod.yml
share-admin/src/main/resources/application-prod.yml
+8
-2
logback.xml
share-admin/src/main/resources/logback.xml
+1
-1
Device.java
share-system/src/main/java/share/system/domain/Device.java
+2
-0
DeviceMapper.java
...ystem/src/main/java/share/system/mapper/DeviceMapper.java
+4
-0
DeviceService.java
...tem/src/main/java/share/system/service/DeviceService.java
+1
-0
ISRoomService.java
...tem/src/main/java/share/system/service/ISRoomService.java
+5
-0
DeviceServiceImpl.java
...ain/java/share/system/service/impl/DeviceServiceImpl.java
+25
-0
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+23
-0
DeviceMapper.xml
...-system/src/main/resources/mapper/system/DeviceMapper.xml
+41
-1
No files found.
share-admin/pom.xml
View file @
88cb6cf1
...
...
@@ -75,6 +75,7 @@
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.5.15
</version>
<configuration>
<includeSystemScope>
true
</includeSystemScope>
<fork>
true
</fork>
<!-- 如果没有该配置,devtools不会生效 -->
</configuration>
<executions>
...
...
@@ -85,6 +86,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
...
...
share-admin/src/main/java/share/web/controller/system/DeviceController.java
View file @
88cb6cf1
...
...
@@ -132,4 +132,28 @@ public class DeviceController extends BaseController
return
toAjax
(
result
);
}
/**
* 查询设备信息列表
* 已绑定房间的设备
*/
@GetMapping
(
"/listByRoom"
)
public
TableDataInfo
listByRoom
(
Device
device
)
{
startPage
();
List
<
Device
>
list
=
deviceService
.
selectDeviceList
(
device
);
return
getDataTable
(
list
);
}
/**
* 查询设备信息列表
* 未绑定房间的设备
*/
@GetMapping
(
"/notRoomIdList"
)
public
TableDataInfo
notRoomIdList
(
Device
device
)
{
startPage
();
List
<
Device
>
list
=
deviceService
.
notRoomIdList
(
device
);
return
getDataTable
(
list
);
}
}
share-admin/src/main/java/share/web/controller/system/SRoomController.java
View file @
88cb6cf1
...
...
@@ -16,6 +16,7 @@ import share.common.annotation.Log;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.system.domain.Device
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.service.ISRoomService
;
...
...
@@ -102,4 +103,27 @@ public class SRoomController extends BaseController
{
return
toAjax
(
sRoomService
.
deleteSRoomByIds
(
ids
));
}
/**
* 添加房间设备
*/
@PreAuthorize
(
"@ss.hasPermi('system:room:edit')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/addRoomDevice"
)
public
AjaxResult
addRoomDevice
(
Long
roomId
,
String
[]
devIds
)
{
return
toAjax
(
sRoomService
.
addRoomDevice
(
roomId
,
devIds
));
}
/**
* 删除房间设备
*/
@PreAuthorize
(
"@ss.hasPermi('system:room:edit')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/deleteRoomDevice"
)
public
AjaxResult
deleteRoomDevice
(
@RequestBody
Device
device
)
{
return
toAjax
(
sRoomService
.
deleteRoomDevice
(
device
));
}
}
share-admin/src/main/resources/application-dev.yml
View file @
88cb6cf1
...
...
@@ -9,7 +9,7 @@ ruoyi:
# 实例演示开关
demoEnabled
:
true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile
:
/
home/gxpt
/uploadPath
profile
:
/
Users/workspace
/uploadPath
# 获取ip地址开关
addressEnabled
:
false
# 验证码类型 math 数字计算 char 字符验证
...
...
@@ -55,9 +55,12 @@ spring:
druid
:
# 主库数据源
master
:
url
:
jdbc:mysql://127.0.0.1:3306/xzdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
# url: jdbc:mysql://10.106.30.135:3306/xzdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
# username: root
# password: root
url
:
jdbc:mysql://129.211.46.84:3306/sharedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username
:
root
password
:
1234
password
:
whxz2019
# 从库数据源
slave
:
# 从数据源开关/默认关闭
...
...
@@ -117,7 +120,7 @@ spring:
# 数据库索引
database
:
0
# 密码
password
:
password
:
123456
# 连接超时时间
timeout
:
10s
lettuce
:
...
...
@@ -130,6 +133,13 @@ spring:
max-active
:
8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
mqtt
:
url
:
"
tcp://47.99.53.236:1883"
clientId
:
"
coujiao_sub"
username
:
"
coujiaomqtt"
password
:
"
Mqtt@2023cj"
defaultTopic
:
"
ydlink/#"
completion-timeout
:
15000
# token配置
token
:
...
...
share-admin/src/main/resources/application-prod.yml
View file @
88cb6cf1
...
...
@@ -9,7 +9,7 @@ ruoyi:
# 实例演示开关
demoEnabled
:
true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile
:
/
home/gxpt
/uploadPath
profile
:
/
Users/workspace
/uploadPath
# 获取ip地址开关
addressEnabled
:
false
# 验证码类型 math 数字计算 char 字符验证
...
...
@@ -130,7 +130,13 @@ spring:
max-active
:
8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
mqtt
:
url
:
"
tcp://47.99.53.236:1883"
clientId
:
"
coujiao_sub"
username
:
"
coujiaomqtt"
password
:
"
Mqtt@2023cj"
defaultTopic
:
"
ydlink/#"
completion-timeout
:
15000
# token配置
token
:
# 令牌自定义标识
...
...
share-admin/src/main/resources/logback.xml
View file @
88cb6cf1
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property
name=
"log.path"
value=
"/
home/gxpt/logs
"
/>
<property
name=
"log.path"
value=
"/
Users/liwenjun/logs/share
"
/>
<!-- 日志输出格式 -->
<property
name=
"log.pattern"
value=
"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"
/>
...
...
share-system/src/main/java/share/system/domain/Device.java
View file @
88cb6cf1
...
...
@@ -77,6 +77,8 @@ public class Device extends BaseEntity
@Excel
(
name
=
"信号值"
)
private
String
signalValue
;
/** 门店房间ID */
private
Long
roomId
;
@Override
public
String
toString
()
{
...
...
share-system/src/main/java/share/system/mapper/DeviceMapper.java
View file @
88cb6cf1
...
...
@@ -77,4 +77,8 @@ public interface DeviceMapper extends BaseMapper<Device>
Device
selectDeviceByDevId
(
String
devId
);
List
<
Device
>
notRoomIdList
(
Device
device
);
int
clearDeviceRoomId
(
Device
device
);
}
share-system/src/main/java/share/system/service/DeviceService.java
View file @
88cb6cf1
...
...
@@ -68,5 +68,6 @@ public interface DeviceService extends IService<Device>
*/
int
updateDeviceByDevId
(
Device
device
);
List
<
Device
>
notRoomIdList
(
Device
device
);
List
<
Device
>
selectDeviceListByIds
(
List
<
Long
>
collect
);
}
share-system/src/main/java/share/system/service/ISRoomService.java
View file @
88cb6cf1
...
...
@@ -3,6 +3,7 @@ package share.system.service;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.Device
;
import
share.system.domain.SPack
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.SRoomVo
;
...
...
@@ -88,4 +89,8 @@ public interface ISRoomService extends IService<SRoom>
List
<
SPack
>
getPackByRoomId
(
Long
id
);
SRoom
queryById
(
Long
id
);
int
addRoomDevice
(
Long
roomId
,
String
[]
devIds
);
int
deleteRoomDevice
(
Device
device
);
}
share-system/src/main/java/share/system/service/impl/DeviceServiceImpl.java
View file @
88cb6cf1
...
...
@@ -2,6 +2,7 @@ package share.system.service.impl;
import
java.util.List
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
share.common.utils.DateUtils
;
...
...
@@ -9,8 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
share.common.utils.SecurityUtils
;
import
share.system.domain.SPack
;
import
share.system.domain.SRoom
;
import
share.system.domain.SStore
;
import
share.system.mapper.DeviceMapper
;
import
share.system.domain.Device
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SStoreMapper
;
import
share.system.service.DeviceService
;
/**
...
...
@@ -23,6 +28,10 @@ import share.system.service.DeviceService;
public
class
DeviceServiceImpl
extends
ServiceImpl
<
DeviceMapper
,
Device
>
implements
DeviceService
{
@Autowired
private
DeviceMapper
deviceMapper
;
@Autowired
private
SStoreMapper
storeMapper
;
@Autowired
private
SRoomMapper
roomMapper
;
/**
* 查询设备信息
...
...
@@ -113,4 +122,20 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
return
deviceMapper
.
selectList
(
queryWrapper
);
}
@Override
public
List
<
Device
>
notRoomIdList
(
Device
device
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
device
.
getRoomId
());
if
(
room
!=
null
)
{
SStore
store
=
storeMapper
.
selectSStoreById
(
room
.
getStoreId
());
if
(
store
!=
null
)
{
device
.
setGroup
(
StrUtil
.
isNotBlank
(
store
.
getDeviceGroup
())
?
store
.
getDeviceGroup
()
:
"0"
);
}
else
{
device
.
setGroup
(
"0"
);
}
}
else
{
device
.
setGroup
(
"0"
);
}
return
deviceMapper
.
notRoomIdList
(
device
);
}
}
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
88cb6cf1
...
...
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.DeviceMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.service.*
;
...
...
@@ -36,6 +37,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
@Autowired
private
IRoomPackService
roomPackService
;
@Autowired
private
DeviceMapper
deviceMapper
;
/**
...
...
@@ -238,6 +241,26 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
return
room
;
}
@Override
public
int
addRoomDevice
(
Long
roomId
,
String
[]
devIds
)
{
if
(
devIds
!=
null
)
{
List
<
Device
>
list
=
new
ArrayList
<>();
for
(
String
devId
:
devIds
)
{
Device
device
=
new
Device
();
device
.
setDevId
(
devId
);
device
.
setRoomId
(
roomId
);
list
.
add
(
device
);
}
return
deviceMapper
.
updateBatch
(
list
);
}
return
0
;
}
@Override
public
int
deleteRoomDevice
(
Device
device
)
{
return
deviceMapper
.
clearDeviceRoomId
(
device
);
}
private
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
)
{
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
...
...
share-system/src/main/resources/mapper/system/DeviceMapper.xml
View file @
88cb6cf1
...
...
@@ -25,10 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"gatewayId"
column=
"gateway_id"
/>
<result
property=
"voltage"
column=
"voltage"
/>
<result
property=
"signalValue"
column=
"signal_value"
/>
<result
property=
"roomId"
column=
"room_id"
/>
</resultMap>
<sql
id=
"selectDeviceVo"
>
select id, dev_name, dev_mac, dev_id, dev_psw, dev_ver, dev_type, projt_id, projt_psw, `group`, status, create_by, create_time, update_by, update_time, remark, dev_position, gateway_id, voltage, signal_value from s_device
select id, dev_name, dev_mac, dev_id, dev_psw, dev_ver, dev_type, projt_id, projt_psw, `group`,
status, create_by, create_time, update_by, update_time, remark, dev_position, gateway_id,
voltage, signal_value, room_id from s_device
</sql>
<select
id=
"selectDeviceList"
parameterType=
"Device"
resultMap=
"DeviceResult"
>
...
...
@@ -48,6 +51,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"gatewayId != null and gatewayId != ''"
>
and gateway_id = #{gatewayId}
</if>
<if
test=
"voltage != null and voltage != ''"
>
and voltage = #{voltage}
</if>
<if
test=
"signalValue != null and signalValue != ''"
>
and signal_value = #{signalValue}
</if>
<if
test=
"roomId != null"
>
and room_id = #{roomId}
</if>
</where>
</select>
<select
id=
"notRoomIdList"
parameterType=
"Device"
resultMap=
"DeviceResult"
>
<include
refid=
"selectDeviceVo"
/>
<where>
room_id is null
<if
test=
"devName != null and devName != ''"
>
and dev_name like concat('%', #{devName}, '%')
</if>
<if
test=
"devMac != null and devMac != ''"
>
and dev_mac = #{devMac}
</if>
<if
test=
"devId != null and devId != ''"
>
and dev_id = #{devId}
</if>
<if
test=
"devPsw != null and devPsw != ''"
>
and dev_psw = #{devPsw}
</if>
<if
test=
"devVer != null and devVer != ''"
>
and dev_ver = #{devVer}
</if>
<if
test=
"devType != null and devType != ''"
>
and dev_type = #{devType}
</if>
<if
test=
"projtId != null and projtId != ''"
>
and projt_id = #{projtId}
</if>
<if
test=
"projtPsw != null and projtPsw != ''"
>
and projt_psw = #{projtPsw}
</if>
<if
test=
"group != null and group != ''"
>
and `group` = #{group}
</if>
<if
test=
"status != null and status != ''"
>
and status = #{status}
</if>
<if
test=
"devPosition != null and devPosition != ''"
>
and dev_position = #{devPosition}
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
and gateway_id = #{gatewayId}
</if>
<if
test=
"voltage != null and voltage != ''"
>
and voltage = #{voltage}
</if>
<if
test=
"signalValue != null and signalValue != ''"
>
and signal_value = #{signalValue}
</if>
</where>
</select>
...
...
@@ -82,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"gatewayId != null"
>
gateway_id,
</if>
<if
test=
"voltage != null"
>
voltage,
</if>
<if
test=
"signalValue != null"
>
signal_value,
</if>
<if
test=
"roomId != null"
>
room_id,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"devName != null"
>
#{devName},
</if>
...
...
@@ -103,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"gatewayId != null"
>
#{gatewayId},
</if>
<if
test=
"voltage != null"
>
#{voltage},
</if>
<if
test=
"signalValue != null"
>
#{signalValue},
</if>
<if
test=
"roomId != null"
>
#{roomId},
</if>
</trim>
</insert>
...
...
@@ -128,6 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"gatewayId != null"
>
gateway_id = #{gatewayId},
</if>
<if
test=
"voltage != null"
>
voltage = #{voltage},
</if>
<if
test=
"signalValue != null"
>
signal_value = #{signalValue},
</if>
<if
test=
"roomId != null"
>
room_id = #{roomId},
</if>
</trim>
where id = #{id}
</update>
...
...
@@ -154,6 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"gatewayId != null"
>
gateway_id = #{gatewayId},
</if>
<if
test=
"voltage != null"
>
voltage = #{voltage},
</if>
<if
test=
"signalValue != null"
>
signal_value = #{signalValue},
</if>
<if
test=
"roomId != null"
>
room_id = #{roomId},
</if>
</trim>
where dev_id = #{devId}
</update>
...
...
@@ -190,12 +219,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</foreach>
</trim>
<trim
prefix=
" room_id =case"
suffix=
"end,"
>
<foreach
collection=
"list"
item=
"i"
index=
"index"
>
<if
test=
"i.roomId!=null"
>
when dev_id=#{i.devId} then #{i.roomId}
</if>
</foreach>
</trim>
</trim>
where
<foreach
collection=
"list"
separator=
"or"
item=
"i"
index=
"index"
>
dev_id=#{i.devId}
</foreach>
</update>
<update
id=
"clearDeviceRoomId"
parameterType=
"Device"
>
update s_device
set room_id = null where dev_id=#{devId}
</update>
<delete
id=
"deleteDeviceById"
parameterType=
"Long"
>
delete from s_device where id = #{id}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment