Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
This project
Loading...
Sign in
Toggle navigation
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 7e40c885
authored
Apr 25, 2021
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改错误提示
1 parent
a8d20993
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
src/main/java/com/glsx/smart/controller/UserDeviceController.java
src/main/java/com/glsx/smart/exception/ResultEnum.java
src/main/java/com/glsx/smart/service/impl/SmartUserDeviceServiceImpl.java
src/main/java/com/glsx/smart/controller/UserDeviceController.java
View file @
7e40c88
...
@@ -39,7 +39,7 @@ public class UserDeviceController {
...
@@ -39,7 +39,7 @@ public class UserDeviceController {
public
List
<
SmartUserDevice
>
getList
(
SmartUserDevice
req
)
{
public
List
<
SmartUserDevice
>
getList
(
SmartUserDevice
req
)
{
log
.
info
(
"$$$$ /userDevice/getList param: {}"
,
JSON
.
toJSONString
(
req
));
log
.
info
(
"$$$$ /userDevice/getList param: {}"
,
JSON
.
toJSONString
(
req
));
if
(
req
.
getUserId
()
==
null
)
{
if
(
req
.
getUserId
()
==
null
)
{
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
RROR
);
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
MPTY
,
"userId"
);
}
}
return
userDeviceService
.
getList
(
req
);
return
userDeviceService
.
getList
(
req
);
}
}
...
@@ -54,7 +54,7 @@ public class UserDeviceController {
...
@@ -54,7 +54,7 @@ public class UserDeviceController {
public
SmartUserDevice
getByDeviceId
(
SmartUserDevice
req
)
{
public
SmartUserDevice
getByDeviceId
(
SmartUserDevice
req
)
{
log
.
info
(
"$$$$ /userDevice/getByDeviceId param: {}"
,
JSON
.
toJSONString
(
req
));
log
.
info
(
"$$$$ /userDevice/getByDeviceId param: {}"
,
JSON
.
toJSONString
(
req
));
if
(
StringUtils
.
isBlank
(
req
.
getDeviceId
()))
{
if
(
StringUtils
.
isBlank
(
req
.
getDeviceId
()))
{
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
RROR
);
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
MPTY
,
"deviceId"
);
}
}
return
userDeviceService
.
getByDeviceId
(
req
);
return
userDeviceService
.
getByDeviceId
(
req
);
}
}
...
@@ -69,7 +69,7 @@ public class UserDeviceController {
...
@@ -69,7 +69,7 @@ public class UserDeviceController {
public
boolean
save
(
@RequestBody
SmartUserDevice
req
)
{
public
boolean
save
(
@RequestBody
SmartUserDevice
req
)
{
log
.
info
(
"$$$$ /userDevice/save param: {}"
,
JSON
.
toJSONString
(
req
));
log
.
info
(
"$$$$ /userDevice/save param: {}"
,
JSON
.
toJSONString
(
req
));
if
(
StringUtils
.
isBlank
(
req
.
getDeviceId
())
||
req
.
getChannel
()
==
null
)
{
if
(
StringUtils
.
isBlank
(
req
.
getDeviceId
())
||
req
.
getChannel
()
==
null
)
{
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
RROR
);
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
MPTY
,
"deviceId, channel"
);
}
}
return
userDeviceService
.
save
(
req
)
>
0
;
return
userDeviceService
.
save
(
req
)
>
0
;
}
}
...
@@ -84,7 +84,7 @@ public class UserDeviceController {
...
@@ -84,7 +84,7 @@ public class UserDeviceController {
public
boolean
deleteDevice
(
@RequestBody
SmartUserDevice
req
)
{
public
boolean
deleteDevice
(
@RequestBody
SmartUserDevice
req
)
{
log
.
info
(
"$$$$ /userDevice/deleteDevice param: {}"
,
JSON
.
toJSONString
(
req
));
log
.
info
(
"$$$$ /userDevice/deleteDevice param: {}"
,
JSON
.
toJSONString
(
req
));
if
(
StringUtils
.
isBlank
(
req
.
getDeviceId
())
||
req
.
getChannel
()
==
null
)
{
if
(
StringUtils
.
isBlank
(
req
.
getDeviceId
())
||
req
.
getChannel
()
==
null
)
{
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
RROR
);
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
MPTY
,
"deviceId, channel"
);
}
}
return
userDeviceService
.
deleteDevice
(
req
)
>
0
;
return
userDeviceService
.
deleteDevice
(
req
)
>
0
;
}
}
...
@@ -99,7 +99,7 @@ public class UserDeviceController {
...
@@ -99,7 +99,7 @@ public class UserDeviceController {
public
String
getUserBindKey
(
String
token
)
{
public
String
getUserBindKey
(
String
token
)
{
log
.
info
(
"$$$$ /userDevice/getUserBindKey param: {}"
,
token
);
log
.
info
(
"$$$$ /userDevice/getUserBindKey param: {}"
,
token
);
if
(
StringUtils
.
isBlank
(
token
))
{
if
(
StringUtils
.
isBlank
(
token
))
{
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
RROR
);
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
MPTY
,
"token"
);
}
}
return
userDeviceService
.
getUserBindKey
(
token
);
return
userDeviceService
.
getUserBindKey
(
token
);
}
}
...
...
src/main/java/com/glsx/smart/exception/ResultEnum.java
View file @
7e40c88
...
@@ -13,6 +13,7 @@ public enum ResultEnum {
...
@@ -13,6 +13,7 @@ public enum ResultEnum {
PARAM_ERROR
(
1001
,
"参数错误"
),
PARAM_ERROR
(
1001
,
"参数错误"
),
PARAM_ERROR_2
(
1001
,
"参数错误:%s"
),
PARAM_ERROR_2
(
1001
,
"参数错误:%s"
),
PARAM_EMPTY
(
1001
,
"参数错误:%s 不能为空"
),
ID_NOT_FOUND
(
1002
,
"ID不存在"
),
ID_NOT_FOUND
(
1002
,
"ID不存在"
),
PRODUCT_NOT_FOUND
(
2001
,
"产品ID不存在"
),
PRODUCT_NOT_FOUND
(
2001
,
"产品ID不存在"
),
...
...
src/main/java/com/glsx/smart/service/impl/SmartUserDeviceServiceImpl.java
View file @
7e40c88
...
@@ -70,7 +70,7 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
...
@@ -70,7 +70,7 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
SmartUserDevice
savedUserDevice
=
userDeviceMapper
.
selectOne
(
record
);
SmartUserDevice
savedUserDevice
=
userDeviceMapper
.
selectOne
(
record
);
if
(
savedUserDevice
==
null
)
{
if
(
savedUserDevice
==
null
)
{
if
(
StringUtils
.
isBlank
(
req
.
getUid
()))
{
if
(
StringUtils
.
isBlank
(
req
.
getUid
()))
{
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
RROR
);
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
MPTY
,
"uid"
);
}
}
SmartUserChannel
ucRecord
=
new
SmartUserChannel
();
SmartUserChannel
ucRecord
=
new
SmartUserChannel
();
ucRecord
.
setThirdId
(
req
.
getUid
());
ucRecord
.
setThirdId
(
req
.
getUid
());
...
@@ -84,7 +84,7 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
...
@@ -84,7 +84,7 @@ public class SmartUserDeviceServiceImpl extends BaseService implements SmartUser
rows
=
userDeviceMapper
.
insertSelective
(
req
);
rows
=
userDeviceMapper
.
insertSelective
(
req
);
}
else
{
}
else
{
if
(
StringUtils
.
isBlank
(
req
.
getDeviceName
()))
{
if
(
StringUtils
.
isBlank
(
req
.
getDeviceName
()))
{
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
RROR
);
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_E
MPTY
,
"deviceName"
);
}
}
savedUserDevice
.
setDeviceName
(
req
.
getDeviceName
());
savedUserDevice
.
setDeviceName
(
req
.
getDeviceName
());
savedUserDevice
.
setUpdateTime
(
now
);
savedUserDevice
.
setUpdateTime
(
now
);
...
...
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