Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
fanxing3
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 20401a58
authored
Dec 09, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
<feat> 通道名称相同时加前缀
1 parent
8546da38
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
fanxing-ops/src/main/java/com/viontech/fanxing/ops/controller/web/ChannelController.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/impl/ChannelServiceImpl.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/controller/web/ChannelController.java
View file @
20401a5
...
@@ -58,7 +58,7 @@ public class ChannelController extends ChannelBaseController {
...
@@ -58,7 +58,7 @@ public class ChannelController extends ChannelBaseController {
return
JsonMessageUtil
.
getSuccessJsonMsg
(
channelService
.
add
(
channelVo
));
return
JsonMessageUtil
.
getSuccessJsonMsg
(
channelService
.
add
(
channelVo
));
}
catch
(
DuplicateKeyException
e
)
{
}
catch
(
DuplicateKeyException
e
)
{
log
.
error
(
""
,
e
);
log
.
error
(
""
,
e
);
return
JsonMessageUtil
.
getErrorJsonMsg
(
"设备编号
或名称
重复"
);
return
JsonMessageUtil
.
getErrorJsonMsg
(
"设备编号重复"
);
}
}
}
}
...
...
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/impl/ChannelServiceImpl.java
View file @
20401a5
package
com
.
viontech
.
fanxing
.
ops
.
service
.
impl
;
package
com
.
viontech
.
fanxing
.
ops
.
service
.
impl
;
import
cn.hutool.core.util.RandomUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.base.BaseExample
;
...
@@ -72,6 +73,15 @@ public class ChannelServiceImpl extends BaseServiceImpl<Channel> implements Chan
...
@@ -72,6 +73,15 @@ public class ChannelServiceImpl extends BaseServiceImpl<Channel> implements Chan
return
insertSelective
(
channelVo
);
return
insertSelective
(
channelVo
);
}
}
@Override
public
Channel
insertSelective
(
Channel
record
)
{
String
name
=
record
.
getName
();
while
(
duplicateName
(
record
.
getName
()))
{
record
.
setName
(
RandomUtil
.
randomString
(
6
)
+
name
);
}
return
super
.
insertSelective
(
record
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
ChannelVo
update
(
long
id
,
ChannelVo
vo
)
{
public
ChannelVo
update
(
long
id
,
ChannelVo
vo
)
{
...
@@ -213,6 +223,13 @@ public class ChannelServiceImpl extends BaseServiceImpl<Channel> implements Chan
...
@@ -213,6 +223,13 @@ public class ChannelServiceImpl extends BaseServiceImpl<Channel> implements Chan
return
false
;
return
false
;
}
}
private
boolean
duplicateName
(
String
name
)
{
ChannelExample
channelExample
=
new
ChannelExample
();
channelExample
.
createCriteria
().
andNameEqualTo
(
name
);
List
<
Channel
>
channels
=
selectByExample
(
channelExample
);
return
channels
.
size
()
>
0
;
}
/**
/**
* 拉取 nvs3000 视频资源
* 拉取 nvs3000 视频资源
*/
*/
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment