Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
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
zengtianlai3
ioc_sixiang_license
Commits
0d3cc3a0
Commit
0d3cc3a0
authored
Nov 27, 2022
by
马33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上报错误处理
parent
d8adfd43
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
15 deletions
+49
-15
TerminalDeviceController.java
.../sixiang/license/controller/TerminalDeviceController.java
+3
-1
PmsUseService.java
.../main/java/iot/sixiang/license/service/PmsUseService.java
+2
-0
TerminalDeviceService.java
...va/iot/sixiang/license/service/TerminalDeviceService.java
+3
-1
PmsUseServiceImpl.java
...a/iot/sixiang/license/service/impl/PmsUseServiceImpl.java
+12
-5
TerminalDeviceServiceImpl.java
...xiang/license/service/impl/TerminalDeviceServiceImpl.java
+28
-8
PmsUseLogMapper.xml
license/src/main/resources/mapper/PmsUseLogMapper.xml
+1
-0
No files found.
license/src/main/java/iot/sixiang/license/controller/TerminalDeviceController.java
View file @
0d3cc3a0
...
...
@@ -11,6 +11,8 @@ import iot.sixiang.license.service.TerminalDeviceService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/iot_license/terminal_device"
)
@Api
(
value
=
"终端设备模块"
,
tags
=
{
"终端设备模块"
})
...
...
@@ -26,7 +28,7 @@ public class TerminalDeviceController {
@PostMapping
(
"/report_error_msg"
)
@ApiOperation
(
value
=
"终端设备上报错误信息"
,
notes
=
"终端设备上报错误信息"
)
public
BaseResult
reportErrorMsg
(
@RequestBody
ReportErrorMsgDTO
reportErrorMsgDTO
)
{
public
BaseResult
reportErrorMsg
(
@RequestBody
List
<
ReportErrorMsgDTO
>
reportErrorMsgDTO
)
{
return
terminalDeviceService
.
reportErrorMsg
(
reportErrorMsgDTO
);
}
...
...
license/src/main/java/iot/sixiang/license/service/PmsUseService.java
View file @
0d3cc3a0
...
...
@@ -19,4 +19,6 @@ public interface PmsUseService {
PageInfoModel
<
PmsUseLog
>
getPmsUseLogList
(
int
pageNo
,
int
pageSize
,
String
sn
,
Integer
status
);
boolean
reportErrorMsg
(
ReportErrorMsgDTO
reportErrorMsgDTO
);
boolean
deletePmsUseLogById
(
Integer
id
);
}
license/src/main/java/iot/sixiang/license/service/TerminalDeviceService.java
View file @
0d3cc3a0
...
...
@@ -6,10 +6,12 @@ import iot.sixiang.license.model.dto.GetTerminalDeviceTokenDTO;
import
iot.sixiang.license.model.dto.ReportErrorMsgDTO
;
import
iot.sixiang.license.model.dto.TerminalDevieBindDTO
;
import
java.util.List
;
public
interface
TerminalDeviceService
{
ResResult
getToken
(
GetTerminalDeviceTokenDTO
getTerminalDeviceTokenDTO
);
BaseResult
reportErrorMsg
(
ReportErrorMsgDTO
reportErrorMsgDTO
);
BaseResult
reportErrorMsg
(
List
<
ReportErrorMsgDTO
>
reportErrorMsgDTO
);
BaseResult
terminalDevieBind
(
TerminalDevieBindDTO
terminalDevieBindDTO
);
}
license/src/main/java/iot/sixiang/license/service/impl/PmsUseServiceImpl.java
View file @
0d3cc3a0
...
...
@@ -76,11 +76,18 @@ public class PmsUseServiceImpl implements PmsUseService {
pmsUseLog
.
setMessage
(
errorMsg
);
pmsUseLog
.
setUpdateTime
(
new
Date
());
int
res
=
pmsUseLogMapper
.
updateById
(
pmsUseLog
);
if
(
res
>=
0
)
{
return
true
;
}
else
{
return
false
;
}
return
res
>
0
;
}
@Override
public
boolean
deletePmsUseLogById
(
Integer
id
)
{
PmsUseLog
pmsUseLog
=
new
PmsUseLog
();
pmsUseLog
.
setId
(
id
);
pmsUseLog
.
setStatus
(
0
);
pmsUseLog
.
setUpdateTime
(
new
Date
());
pmsUseLog
.
setDeleted
(
0
);
int
res
=
pmsUseLogMapper
.
updateById
(
pmsUseLog
);
return
res
>
0
;
}
private
PmsUseLog
getPmsUseLog
(
String
sn
)
{
...
...
license/src/main/java/iot/sixiang/license/service/impl/TerminalDeviceServiceImpl.java
View file @
0d3cc3a0
...
...
@@ -17,6 +17,9 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Comparator
;
import
java.util.List
;
@Slf4j
@Service
public
class
TerminalDeviceServiceImpl
implements
TerminalDeviceService
{
...
...
@@ -54,17 +57,34 @@ public class TerminalDeviceServiceImpl implements TerminalDeviceService {
}
@Override
public
BaseResult
reportErrorMsg
(
ReportErrorMsgDTO
reportErrorMsgDTO
)
{
Integer
id
=
reportErrorMsgDTO
.
getId
();
log
.
info
(
"============ 上报错误信息, id : {},errorCode: {}, msg: {} ================="
,
id
,
reportErrorMsgDTO
.
getErrorCode
(),
reportErrorMsgDTO
.
getErrorMsg
());
if
(
id
==
null
||
id
==
0
)
{
public
BaseResult
reportErrorMsg
(
List
<
ReportErrorMsgDTO
>
reportErrorMsgDTOs
)
{
if
(
reportErrorMsgDTOs
==
null
||
reportErrorMsgDTOs
.
size
()
==
0
)
{
return
BaseResult
.
validate_failed
();
}
boolean
res
=
pmsUseService
.
reportErrorMsg
(
reportErrorMsgDTO
);
if
(
res
)
{
return
BaseResult
.
success
();
reportErrorMsgDTOs
.
sort
(
Comparator
.
comparingInt
(
ReportErrorMsgDTO:
:
getId
));
for
(
int
i
=
0
;
i
<
reportErrorMsgDTOs
.
size
()
-
1
;
i
++)
{
ReportErrorMsgDTO
reportErrorMsgDTO
=
reportErrorMsgDTOs
.
get
(
i
);
Integer
id
=
reportErrorMsgDTO
.
getId
();
if
(
id
==
null
||
id
==
0
)
{
return
BaseResult
.
validate_failed
();
}
pmsUseService
.
deletePmsUseLogById
(
id
);
}
ReportErrorMsgDTO
reportErrorMsgDTO
=
reportErrorMsgDTOs
.
get
(
reportErrorMsgDTOs
.
size
()
-
1
);
if
(
reportErrorMsgDTO
.
getId
()
==
null
||
reportErrorMsgDTO
.
getId
()
==
0
||
reportErrorMsgDTO
.
getErrorCode
()
==
null
)
{
return
BaseResult
.
validate_failed
();
}
else
{
return
BaseResult
.
failed
();
if
(
"0"
.
equals
(
reportErrorMsgDTO
.
getErrorCode
()))
{
pmsUseService
.
success
(
reportErrorMsgDTO
.
getId
());
return
BaseResult
.
success
();
}
else
{
boolean
res
=
pmsUseService
.
reportErrorMsg
(
reportErrorMsgDTO
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
failed
();
}
}
}
}
...
...
license/src/main/resources/mapper/PmsUseLogMapper.xml
View file @
0d3cc3a0
...
...
@@ -10,6 +10,7 @@
<if
test=
"null != status"
>
and status = #{status}
</if>
and deleted = 0
order by create_time desc
</select>
</mapper>
\ No newline at end of file
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