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
fdc91f98
Commit
fdc91f98
authored
Jul 16, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试存储型xss
parent
f92d2851
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
AlarmReadServiceImpl.java
...ot/sixiang/license/service/impl/AlarmReadServiceImpl.java
+4
-2
AlarmServiceImpl.java
...va/iot/sixiang/license/service/impl/AlarmServiceImpl.java
+3
-1
CommonUtil.java
...se/src/main/java/iot/sixiang/license/util/CommonUtil.java
+17
-0
No files found.
license/src/main/java/iot/sixiang/license/service/impl/AlarmReadServiceImpl.java
View file @
fdc91f98
...
...
@@ -8,10 +8,12 @@ import iot.sixiang.license.mapper.AlarmMapper;
import
iot.sixiang.license.mapper.AlarmReadMapper
;
import
iot.sixiang.license.model.vo.AlarmVo
;
import
iot.sixiang.license.service.AlarmReadService
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -38,8 +40,8 @@ public class AlarmReadServiceImpl extends ServiceImpl<AlarmReadMapper, AlarmRead
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
List
<
AlarmVo
>
alarmList
=
alarmMapper
.
getAlarmList
(
userId
);
for
(
AlarmVo
alarm:
alarmL
ist
)
{
List
<
AlarmVo
>
list
=
CommonUtil
.
dealWithAccessControl
(
alarmList
,
List
.
class
);
for
(
AlarmVo
alarm:
l
ist
)
{
if
(
alarm
.
getReadFlag
()
==
0
)
{
int
alarmId
=
alarm
.
getId
();
int
typeId
=
alarm
.
getTypeId
();
...
...
license/src/main/java/iot/sixiang/license/service/impl/AlarmServiceImpl.java
View file @
fdc91f98
...
...
@@ -7,6 +7,7 @@ import iot.sixiang.license.handler.IotLicenseException;
import
iot.sixiang.license.mapper.AlarmMapper
;
import
iot.sixiang.license.model.vo.AlarmVo
;
import
iot.sixiang.license.service.AlarmService
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.owasp.esapi.ESAPI
;
import
org.springframework.stereotype.Service
;
...
...
@@ -30,7 +31,8 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
if
(
uI
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
List
<
AlarmVo
>
alarmVos
=
alarmMapper
.
getAlarmList
(
uI
);
List
<
AlarmVo
>
list
=
alarmMapper
.
getAlarmList
(
uI
);
List
<
AlarmVo
>
alarmVos
=
CommonUtil
.
dealWithAccessControl
(
list
,
List
.
class
);
alarmVos
=
alarmVos
.
stream
().
sorted
(
Comparator
.
comparing
(
AlarmVo:
:
getCreateTime
,
Comparator
.
reverseOrder
())).
collect
(
Collectors
.
toList
());
if
(
alarmVos
!=
null
&&
!
alarmVos
.
isEmpty
())
{
for
(
AlarmVo
alarmVo
:
alarmVos
)
{
...
...
license/src/main/java/iot/sixiang/license/util/CommonUtil.java
View file @
fdc91f98
package
iot
.
sixiang
.
license
.
util
;
import
iot.sixiang.license.consts.Consts
;
import
iot.sixiang.license.model.ResResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.boot.system.ApplicationHome
;
...
...
@@ -11,6 +12,7 @@ import java.security.NoSuchAlgorithmException;
import
java.security.SecureRandom
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Locale
;
@Slf4j
public
class
CommonUtil
{
...
...
@@ -139,4 +141,19 @@ public class CommonUtil {
return
res
;
}
// 用于测试存储型xss
public
static
Object
reverseData
(
Object
obj
,
Class
clazz
)
{
HashMap
<
String
,
Object
>
resMap
=
new
HashMap
<
String
,
Object
>();
resMap
.
put
(
"data"
,
obj
);
return
ResResult
.
success
().
goRecord
(
resMap
);
}
public
static
<
T
>
T
dealWithAccessControl
(
Object
obj
,
Class
<
T
>
clazz
)
{
ResResult
actionResult
=
(
ResResult
)
reverseData
(
obj
,
clazz
);
HashMap
<
String
,
Object
>
resMap
=
(
HashMap
<
String
,
Object
>)
actionResult
.
getRecord
();
return
(
T
)
resMap
.
get
(
"data"
);
}
}
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