Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
dd534fb2
Commit
dd534fb2
authored
Feb 25, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备添加产品编码字段,并添加同步更新产品编码字段
parent
32d7a444
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1624 additions
and
290 deletions
+1624
-290
device-manager/db/add.sql
device-manager/db/add.sql
+4
-0
device-manager/db/module.sql
device-manager/db/module.sql
+50
-48
device-manager/pom.xml
device-manager/pom.xml
+1
-10
device-manager/src/main/java/com/mortals/xhx/busiz/web/TestSendMsgController.java
...java/com/mortals/xhx/busiz/web/TestSendMsgController.java
+45
-2
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceEntity.java
...ava/com/mortals/xhx/module/device/model/DeviceEntity.java
+23
-8
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceQuery.java
...java/com/mortals/xhx/module/device/model/DeviceQuery.java
+1099
-115
device-manager/src/main/resources/sqlmap/module/device/DeviceMapper.xml
.../src/main/resources/sqlmap/module/device/DeviceMapper.xml
+402
-107
doc/设备管理系统.docx
doc/设备管理系统.docx
+0
-0
No files found.
device-manager/db/add.sql
View file @
dd534fb2
...
...
@@ -16,3 +16,7 @@ ALTER TABLE mortals_xhx_product ADD COLUMN `eventUrl` varchar (512) COMMENT
-- ----------------------------
ALTER
TABLE
mortals_xhx_device
ADD
COLUMN
`deviceVersion`
varchar
(
64
)
COMMENT
'设备版本'
AFTER
deleted
;
-- ----------------------------
2023
-
02
-
2
-- ----------------------------
ALTER
TABLE
mortals_xhx_device
ADD
COLUMN
`productCode`
varchar
(
64
)
default
''
COMMENT
'产品编码'
AFTER
productId
;
\ No newline at end of file
device-manager/db/module.sql
View file @
dd534fb2
...
...
@@ -4,58 +4,60 @@ use
-- 设备表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_device`
;
CREATE
TABLE
`mortals_xhx_device`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`deviceName`
varchar
(
20
)
NOT
NULL
COMMENT
'设备名称'
,
`deviceCode`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'设备编码'
,
`deviceSN`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'设备SN码'
,
`deviceMac`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'设备的MAC地址'
,
`siteId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'站点Id,来源基础服务平台'
,
`siteCode`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'站点编号,来源基础服务平台'
,
`siteName`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'站点名称'
,
`platformId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'平台系统Id'
,
`platformName`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'平台系统名称'
,
`productId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'产品Id'
,
`productName`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'产品名称'
,
`skinId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'皮肤id'
,
`skinName`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'皮肤名称'
,
`homeUrl`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'首页地址'
,
`deviceFirmId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'设备生产厂商ID'
,
`deviceFirmname`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'设备生产厂商名称'
,
`deviceSrc`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'设备来源(0.子设备,1.网关设备,2.直连设备)'
,
`deviceDataSourceWay`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'数据获取方式(0.主动上报,1被动拉取)'
,
`lon`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'经度'
,
`lati`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'经度'
,
`deviceInBuilding`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'所属楼栋'
,
`deviceInFloor`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'所属楼层'
,
`defectsLiabilityPeriod`
datetime
DEFAULT
NULL
COMMENT
'保修期至'
,
`leadingOfficial`
varchar
(
10
)
DEFAULT
NULL
COMMENT
'负责人'
,
`leadingOfficialTelephone`
varchar
(
11
)
DEFAULT
NULL
COMMENT
'联系电话'
,
`isReceiveMess`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'是否接收异常短(0.否,1.是)'
,
`ip`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'设备访问ip'
,
`centernum`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'中心设备编码'
,
`port`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'端口'
,
`deviceTopic`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'设备topic信息'
,
`deviceStatus`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'设备状态 (0.未激活,1.离线,2.在线)'
,
`enabled`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'启用状态 (0.停止,1.启用)'
,
`deviceAuthCode`
varchar
(
255
)
DEFAULT
NULL
,
`deviceRemark`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'备注'
,
`onlineTime`
datetime
DEFAULT
NULL
COMMENT
'最近上线时间'
,
`offlineTime`
datetime
DEFAULT
NULL
COMMENT
'最近离线时间'
,
`devicePhotoPath`
varchar
(
255
)
DEFAULT
NULL
,
`deleted`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'是否删除,(0.否,1.是)'
,
`deviceVersion`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'设备版本'
,
`source`
tinyint
(
2
)
DEFAULT
NULL
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'更新用户'
,
`updateTime`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
CREATE
TABLE
mortals_xhx_device
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`deviceName`
varchar
(
20
)
NOT
NULL
COMMENT
'设备名称'
,
`deviceCode`
varchar
(
256
)
COMMENT
'设备编码,SN码等,默认为MAC地址'
,
`deviceMac`
varchar
(
64
)
COMMENT
'设备的MAC地址'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`siteCode`
varchar
(
256
)
COMMENT
'站点编号,来源基础服务平台'
,
`siteName`
varchar
(
256
)
COMMENT
'站点名称'
,
`platformId`
bigint
(
20
)
COMMENT
'平台系统Id'
,
`platformName`
varchar
(
256
)
COMMENT
'平台系统名称'
,
`productId`
bigint
(
20
)
COMMENT
'产品Id'
,
`productName`
varchar
(
256
)
COMMENT
'产品名称'
,
`skinId`
bigint
(
20
)
NOT
NULL
COMMENT
'皮肤id'
,
`skinName`
varchar
(
20
)
NOT
NULL
COMMENT
'皮肤名称'
,
`homeUrl`
varchar
(
512
)
COMMENT
'首页地址'
,
`deviceFirmId`
bigint
(
20
)
COMMENT
'设备生产厂商ID'
,
`deviceFirmname`
varchar
(
20
)
COMMENT
'设备生产厂商名称'
,
`deviceSrc`
tinyint
(
2
)
DEFAULT
'2'
COMMENT
'设备来源(0.子设备,1.网关设备,2.直连设备)'
,
`deviceDataSourceWay`
tinyint
(
2
)
DEFAULT
'0'
COMMENT
'数据获取方式(0.主动上报,1.被动拉取)'
,
`lon`
varchar
(
32
)
COMMENT
'经度'
,
`lati`
varchar
(
32
)
COMMENT
'经度'
,
`deviceInBuilding`
tinyint
(
2
)
COMMENT
'所属楼栋'
,
`deviceInFloor`
tinyint
(
2
)
COMMENT
'所属楼层'
,
`defectsLiabilityPeriod`
datetime
COMMENT
'保修期至'
,
`leadingOfficial`
varchar
(
64
)
COMMENT
'负责人'
,
`leadingOfficialTelephone`
varchar
(
64
)
COMMENT
'联系电话'
,
`isReceiveMess`
tinyint
(
2
)
DEFAULT
'0'
COMMENT
'是否接收异常短(0.否,1.是)'
,
`devicePhotoPath`
varchar
(
256
)
COMMENT
'设备图片'
,
`ip`
varchar
(
64
)
COMMENT
'设备访问ip'
,
`centernum`
varchar
(
64
)
COMMENT
'中心设备编码'
,
`port`
varchar
(
64
)
COMMENT
'端口'
,
`deviceTopic`
varchar
(
100
)
COMMENT
'设备topic信息'
,
`deviceStatus`
tinyint
(
2
)
DEFAULT
'0'
COMMENT
'设备状态 (0.未激活,1.离线,2.在线)'
,
`enabled`
tinyint
(
2
)
DEFAULT
'0'
COMMENT
'启用状态 (0.停止,1.启用)'
,
`deviceAuthCode`
varchar
(
512
)
COMMENT
'设备授权码'
,
`deviceRemark`
varchar
(
256
)
COMMENT
'备注'
,
`onlineTime`
datetime
COMMENT
'最近上线时间'
,
`offlineTime`
datetime
COMMENT
'最近离线时间'
,
`deleted`
tinyint
(
2
)
DEFAULT
'0'
COMMENT
'是否删除(0.否,1.是)'
,
`source`
tinyint
(
2
)
DEFAULT
'1'
COMMENT
'设备来源(0.旧设备,1.新设备)'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
`deviceSN`
varchar
(
256
)
COMMENT
'设备SN码'
,
`deviceVersion`
varchar
(
64
)
COMMENT
'设备版本'
,
`productCode`
varchar
(
256
)
COMMENT
'产品编码'
,
PRIMARY
KEY
(
`id`
)
KEY
`productCode`
(
`productCode`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备'
;
-- ----------------------------
-- 平台系统表
-- ----------------------------
...
...
device-manager/pom.xml
View file @
dd534fb2
...
...
@@ -215,16 +215,7 @@
<groupId>
io.jsonwebtoken
</groupId>
<artifactId>
jjwt
</artifactId>
</dependency>
<dependency>
<groupId>
net.sourceforge.tess4j
</groupId>
<artifactId>
tess4j
</artifactId>
<version>
5.6.0
</version>
</dependency>
<dependency>
<groupId>
p6spy
</groupId>
<artifactId>
p6spy
</artifactId>
<version>
3.9.1
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/TestSendMsgController.java
View file @
dd534fb2
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.service.ILogService
;
import
com.mortals.framework.service.impl.FileLogServiceImpl
;
import
com.mortals.xhx.busiz.req.TestReq
;
...
...
@@ -12,14 +13,23 @@ import com.mortals.xhx.busiz.rsp.ApiResp;
import
com.mortals.xhx.busiz.rsp.DeviceResp
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
com.mortals.xhx.common.utils.ImgUtils
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceQuery
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.File
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 设备
...
...
@@ -33,6 +43,10 @@ import java.io.File;
public
class
TestSendMsgController
{
@Autowired
protected
ILogService
logService
=
FileLogServiceImpl
.
getInstance
();
@Autowired
private
ProductService
productService
;
@Autowired
private
DeviceService
deviceService
;
/**
* 发送日志消息
...
...
@@ -52,6 +66,35 @@ public class TestSendMsgController {
}
@PostMapping
(
"reDeviceProductCode"
)
@UnAuth
public
String
reDeviceProductCode
()
{
log
.
info
(
"刷新设备的产品编码"
);
ApiResp
<
DeviceResp
>
rsp
=
new
ApiResp
<>();
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
List
<
DeviceEntity
>
updateProductCodeList
=
deviceService
.
find
(
new
DeviceQuery
()).
stream
().
map
(
deviceEntity
->
{
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
.
getProductCode
())
&&
!
ObjectUtils
.
isEmpty
(
deviceEntity
.
getProductId
()))
{
ProductEntity
cache
=
productService
.
getCache
(
deviceEntity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
cache
))
{
deviceEntity
.
setProductCode
(
cache
.
getProductCode
());
DeviceEntity
temp
=
new
DeviceEntity
();
temp
.
setId
(
deviceEntity
.
getId
());
temp
.
setProductCode
(
cache
.
getProductCode
());
temp
.
setUpdateTime
(
new
Date
());
return
temp
;
}
}
return
null
;
}).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
updateProductCodeList
))
{
log
.
info
(
"更新设备产品列表,size:{}"
,
updateProductCodeList
.
size
());
deviceService
.
update
(
updateProductCodeList
,
null
);
}
return
JSON
.
toJSONString
(
rsp
);
}
public
static
void
main
(
String
[]
args
)
{
String
resp
=
HttpUtil
.
get
(
"http://59.225.206.13:8331/oauth-pro/admin-pro/sys/randomImage/1675827431800?_t=1675827431"
);
...
...
@@ -61,10 +104,10 @@ public class TestSendMsgController {
log
.
info
(
"result:{}"
,
jsonObject
.
get
(
"result"
));
String
OriginalImg
=
"F:\\pics\\2.jpg"
;
String
ocrResult
=
"F:\\pics\\2-1.jpg"
;
Base64
.
decodeToFile
(
StrUtil
.
replace
(
jsonObject
.
get
(
"result"
).
toString
(),
"data:image/jpg;base64,"
,
""
),
new
File
(
OriginalImg
));
Base64
.
decodeToFile
(
StrUtil
.
replace
(
jsonObject
.
get
(
"result"
).
toString
(),
"data:image/jpg;base64,"
,
""
),
new
File
(
OriginalImg
));
ImgUtils
.
removeBackground
(
OriginalImg
,
ocrResult
);
// log.info(code);
// log.info(code);
/*
//原始验证码地址
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceEntity.java
View file @
dd534fb2
package
com.mortals.xhx.module.device.model
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.ArrayList
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.mortals.framework.annotation.Excel
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.base.framework.CustomJsonDateDeserializer
;
import
com.mortals.xhx.module.device.model.vo.DeviceVo
;
import
java.util.Date
;
/**
* 设备实体对象
*
...
...
@@ -68,6 +62,11 @@ public class DeviceEntity extends DeviceVo {
* 产品Id
*/
private
Long
productId
;
/**
* 产品编码
*/
@Excel
(
name
=
"产品类型"
,
cacheDict
=
"productDict"
,
type
=
Excel
.
Type
.
IMPORT
)
private
String
productCode
;
/**
* 产品名称
*/
...
...
@@ -322,6 +321,20 @@ public class DeviceEntity extends DeviceVo {
public
void
setProductId
(
Long
productId
){
this
.
productId
=
productId
;
}
/**
* 获取 产品编码
* @return String
*/
public
String
getProductCode
(){
return
productCode
;
}
/**
* 设置 产品编码
* @param productCode
*/
public
void
setProductCode
(
String
productCode
)
{
this
.
productCode
=
productCode
;
}
/**
* 获取 产品名称
* @return String
...
...
@@ -806,6 +819,8 @@ public class DeviceEntity extends DeviceVo {
this
.
productId
=
null
;
this
.
productCode
=
""
;
this
.
productName
=
""
;
this
.
deviceFirmId
=
null
;
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceQuery.java
View file @
dd534fb2
This diff is collapsed.
Click to expand it.
device-manager/src/main/resources/sqlmap/module/device/DeviceMapper.xml
View file @
dd534fb2
This diff is collapsed.
Click to expand it.
doc/设备管理系统.docx
View file @
dd534fb2
No preview for this file type
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