Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
szpt
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
以墨为白
szpt
Commits
cf0d8e66
Commit
cf0d8e66
authored
Jan 10, 2025
by
以墨为白
🎧
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://192.168.168.218/wcyuee/szpt
# Conflicts: # src/test/java/com/zksy/szpt/TestHttpUtil.java
parents
7cc870f4
167f70dd
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
857 additions
and
306 deletions
+857
-306
src/main/java/com/zksy/szpt/controller/SzptClockInController.java
.../java/com/zksy/szpt/controller/SzptClockInController.java
+3
-2
src/main/java/com/zksy/szpt/controller/SzptClockInRulesController.java
.../com/zksy/szpt/controller/SzptClockInRulesController.java
+3
-2
src/main/java/com/zksy/szpt/controller/SzptXyzhXyxxController.java
...java/com/zksy/szpt/controller/SzptXyzhXyxxController.java
+3
-2
src/main/java/com/zksy/szpt/domain/dto/CommonDelIntDTO.java
src/main/java/com/zksy/szpt/domain/dto/CommonDelIntDTO.java
+37
-0
src/main/java/com/zksy/szpt/domain/dto/SzptGdYjDTO.java
src/main/java/com/zksy/szpt/domain/dto/SzptGdYjDTO.java
+16
-0
src/main/java/com/zksy/szpt/service/IndexService.java
src/main/java/com/zksy/szpt/service/IndexService.java
+1
-1
src/main/java/com/zksy/szpt/service/SzptClockInRulesService.java
...n/java/com/zksy/szpt/service/SzptClockInRulesService.java
+3
-2
src/main/java/com/zksy/szpt/service/SzptClockInService.java
src/main/java/com/zksy/szpt/service/SzptClockInService.java
+3
-2
src/main/java/com/zksy/szpt/service/SzptFwxxService.java
src/main/java/com/zksy/szpt/service/SzptFwxxService.java
+2
-1
src/main/java/com/zksy/szpt/service/SzptGdCsyjhldxService.java
...ain/java/com/zksy/szpt/service/SzptGdCsyjhldxService.java
+1
-1
src/main/java/com/zksy/szpt/service/SzptGdRyxxService.java
src/main/java/com/zksy/szpt/service/SzptGdRyxxService.java
+1
-1
src/main/java/com/zksy/szpt/service/SzptGdSbxxService.java
src/main/java/com/zksy/szpt/service/SzptGdSbxxService.java
+3
-2
src/main/java/com/zksy/szpt/service/SzptGdXxService.java
src/main/java/com/zksy/szpt/service/SzptGdXxService.java
+2
-1
src/main/java/com/zksy/szpt/service/SzptGdYjService.java
src/main/java/com/zksy/szpt/service/SzptGdYjService.java
+1
-1
src/main/java/com/zksy/szpt/service/SzptQyxxService.java
src/main/java/com/zksy/szpt/service/SzptQyxxService.java
+1
-1
src/main/java/com/zksy/szpt/service/SzptXyzhDkxxService.java
src/main/java/com/zksy/szpt/service/SzptXyzhDkxxService.java
+1
-1
src/main/java/com/zksy/szpt/service/SzptXyzhKqmbService.java
src/main/java/com/zksy/szpt/service/SzptXyzhKqmbService.java
+1
-1
src/main/java/com/zksy/szpt/service/SzptXyzhMbdhService.java
src/main/java/com/zksy/szpt/service/SzptXyzhMbdhService.java
+1
-1
src/main/java/com/zksy/szpt/service/SzptXyzhXyxxService.java
src/main/java/com/zksy/szpt/service/SzptXyzhXyxxService.java
+3
-2
src/test/java/com/zksy/szpt/MainTest.java
src/test/java/com/zksy/szpt/MainTest.java
+32
-272
src/test/java/com/zksy/szpt/MainTestX.java
src/test/java/com/zksy/szpt/MainTestX.java
+738
-9
src/test/java/com/zksy/szpt/TestHttpUtil.java
src/test/java/com/zksy/szpt/TestHttpUtil.java
+1
-1
No files found.
src/main/java/com/zksy/szpt/controller/SzptClockInController.java
View file @
cf0d8e66
package
com
.
zksy
.
szpt
.
controller
;
package
com
.
zksy
.
szpt
.
controller
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelIntDTO
;
import
com.zksy.szpt.domain.dto.SzptClockInDTO
;
import
com.zksy.szpt.domain.dto.SzptClockInDTO
;
import
com.zksy.szpt.service.SzptClockInService
;
import
com.zksy.szpt.service.SzptClockInService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -33,8 +34,8 @@ public class SzptClockInController {
...
@@ -33,8 +34,8 @@ public class SzptClockInController {
@ApiOperation
(
value
=
"删除szpt_clock_in数据"
)
@ApiOperation
(
value
=
"删除szpt_clock_in数据"
)
@PostMapping
(
"/deleteSzptClockIn"
)
@PostMapping
(
"/deleteSzptClockIn"
)
public
Integer
deleteSzptClockIn
(
@RequestBody
CommonDel
DTO
commonDel
DTO
)
{
public
Integer
deleteSzptClockIn
(
@RequestBody
CommonDel
IntDTO
commonDelInt
DTO
)
{
return
szptClockInService
.
deleteSzptClockIn
(
commonDelDTO
);
return
szptClockInService
.
deleteSzptClockIn
(
commonDel
Int
DTO
);
}
}
...
...
src/main/java/com/zksy/szpt/controller/SzptClockInRulesController.java
View file @
cf0d8e66
package
com
.
zksy
.
szpt
.
controller
;
package
com
.
zksy
.
szpt
.
controller
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelIntDTO
;
import
com.zksy.szpt.domain.dto.SzptClockInRulesDTO
;
import
com.zksy.szpt.domain.dto.SzptClockInRulesDTO
;
import
com.zksy.szpt.service.SzptClockInRulesService
;
import
com.zksy.szpt.service.SzptClockInRulesService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -33,7 +34,7 @@ public class SzptClockInRulesController {
...
@@ -33,7 +34,7 @@ public class SzptClockInRulesController {
@ApiOperation
(
value
=
"删除SzptClockInRules数据"
)
@ApiOperation
(
value
=
"删除SzptClockInRules数据"
)
@PostMapping
(
"/deleteSzptClockInRules"
)
@PostMapping
(
"/deleteSzptClockInRules"
)
public
Integer
deleteSzptClockInRules
(
@RequestBody
@Validated
CommonDel
DTO
commonDel
DTO
)
{
public
Integer
deleteSzptClockInRules
(
@RequestBody
@Validated
CommonDel
IntDTO
commonDelInt
DTO
)
{
return
szptClockInRulesService
.
deleteSzptClockInRules
(
commonDelDTO
);
return
szptClockInRulesService
.
deleteSzptClockInRules
(
commonDel
Int
DTO
);
}
}
}
}
src/main/java/com/zksy/szpt/controller/SzptXyzhXyxxController.java
View file @
cf0d8e66
package
com
.
zksy
.
szpt
.
controller
;
package
com
.
zksy
.
szpt
.
controller
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelIntDTO
;
import
com.zksy.szpt.domain.dto.SzptXyzhXyxxDTO
;
import
com.zksy.szpt.domain.dto.SzptXyzhXyxxDTO
;
import
com.zksy.szpt.service.SzptXyzhXyxxService
;
import
com.zksy.szpt.service.SzptXyzhXyxxService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -35,7 +36,7 @@ public class SzptXyzhXyxxController {
...
@@ -35,7 +36,7 @@ public class SzptXyzhXyxxController {
@ApiOperation
(
value
=
"删除校园信息"
)
@ApiOperation
(
value
=
"删除校园信息"
)
@PostMapping
(
"/deleteSzptXyzhXyxx"
)
@PostMapping
(
"/deleteSzptXyzhXyxx"
)
public
Integer
deleteSzptXyzhXyxx
(
@RequestBody
@Validated
CommonDel
DTO
commonDel
DTO
)
{
public
Integer
deleteSzptXyzhXyxx
(
@RequestBody
@Validated
CommonDel
IntDTO
commonDelInt
DTO
)
{
return
szptXyzhXyxxService
.
deleteSzptXyzhXyxx
(
commonDelDTO
);
return
szptXyzhXyxxService
.
deleteSzptXyzhXyxx
(
commonDel
Int
DTO
);
}
}
}
}
src/main/java/com/zksy/szpt/domain/dto/CommonDelIntDTO.java
0 → 100644
View file @
cf0d8e66
package
com
.
zksy
.
szpt
.
domain
.
dto
;
import
javax.validation.constraints.NotEmpty
;
import
java.util.List
;
public
class
CommonDelIntDTO
{
/**
* 账户ID
*/
@NotEmpty
(
message
=
"账户ID不能为空"
)
private
List
<
Integer
>
ids
;
/**
* 数据所属单位
*/
@NotEmpty
(
message
=
"数据归属单位不能为空"
)
private
String
sjgsdwdm
;
public
List
<
Integer
>
getIds
()
{
return
ids
;
}
public
void
setIds
(
List
<
Integer
>
ids
)
{
this
.
ids
=
ids
;
}
public
String
getSjgsdwdm
()
{
return
sjgsdwdm
;
}
public
void
setSjgsdwdm
(
String
sjgsdwdm
)
{
this
.
sjgsdwdm
=
sjgsdwdm
;
}
}
src/main/java/com/zksy/szpt/domain/dto/SzptGdYjDTO.java
View file @
cf0d8e66
package
com
.
zksy
.
szpt
.
domain
.
dto
;
package
com
.
zksy
.
szpt
.
domain
.
dto
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
...
@@ -7,6 +9,12 @@ import javax.validation.constraints.NotEmpty;
...
@@ -7,6 +9,12 @@ import javax.validation.constraints.NotEmpty;
import
java.util.Date
;
import
java.util.Date
;
public
class
SzptGdYjDTO
{
public
class
SzptGdYjDTO
{
/**
* 预警ID
*/
@NotBlank
(
message
=
"预警ID不能为空"
)
private
String
id
;
/**
/**
* 工地ID
* 工地ID
*/
*/
...
@@ -73,6 +81,14 @@ public class SzptGdYjDTO {
...
@@ -73,6 +81,14 @@ public class SzptGdYjDTO {
private
String
clrxm
;
private
String
clrxm
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getCsid
()
{
public
String
getCsid
()
{
return
csid
;
return
csid
;
}
}
...
...
src/main/java/com/zksy/szpt/service/IndexService.java
View file @
cf0d8e66
...
@@ -30,7 +30,7 @@ public class IndexService {
...
@@ -30,7 +30,7 @@ public class IndexService {
public
Integer
deleteXxRwwcqk
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteXxRwwcqk
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
XxRwwcqk
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
XxRwwcqk
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
XxRwwcqk:
:
getRwid
,
commonDelDTO
);
wrapper
.
in
(
XxRwwcqk:
:
getRwid
,
commonDelDTO
.
getIds
()
);
return
xxRwwcqkMapper
.
delete
(
wrapper
);
return
xxRwwcqkMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptClockInRulesService.java
View file @
cf0d8e66
...
@@ -3,6 +3,7 @@ package com.zksy.szpt.service;
...
@@ -3,6 +3,7 @@ package com.zksy.szpt.service;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelIntDTO
;
import
com.zksy.szpt.domain.dto.SzptClockInRulesDTO
;
import
com.zksy.szpt.domain.dto.SzptClockInRulesDTO
;
import
com.zksy.szpt.domain.po.SzptClockInRules
;
import
com.zksy.szpt.domain.po.SzptClockInRules
;
import
com.zksy.szpt.mapper.SzptClockInRulesMapper
;
import
com.zksy.szpt.mapper.SzptClockInRulesMapper
;
...
@@ -28,9 +29,9 @@ public class SzptClockInRulesService {
...
@@ -28,9 +29,9 @@ public class SzptClockInRulesService {
return
szptClockInRulesMapper
.
update
(
szptClockInRules
,
wrapper
);
return
szptClockInRulesMapper
.
update
(
szptClockInRules
,
wrapper
);
}
}
public
Integer
deleteSzptClockInRules
(
CommonDel
DTO
commonDel
DTO
)
{
public
Integer
deleteSzptClockInRules
(
CommonDel
IntDTO
commonDelInt
DTO
)
{
LambdaQueryWrapper
<
SzptClockInRules
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptClockInRules
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptClockInRules:
:
getId
,
commonDel
DTO
);
wrapper
.
in
(
SzptClockInRules:
:
getId
,
commonDel
IntDTO
.
getIds
()
);
return
szptClockInRulesMapper
.
delete
(
wrapper
);
return
szptClockInRulesMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptClockInService.java
View file @
cf0d8e66
...
@@ -3,6 +3,7 @@ package com.zksy.szpt.service;
...
@@ -3,6 +3,7 @@ package com.zksy.szpt.service;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelIntDTO
;
import
com.zksy.szpt.domain.dto.SzptClockInDTO
;
import
com.zksy.szpt.domain.dto.SzptClockInDTO
;
import
com.zksy.szpt.domain.po.SzptClockIn
;
import
com.zksy.szpt.domain.po.SzptClockIn
;
import
com.zksy.szpt.mapper.SzptClockInMapper
;
import
com.zksy.szpt.mapper.SzptClockInMapper
;
...
@@ -28,9 +29,9 @@ public class SzptClockInService {
...
@@ -28,9 +29,9 @@ public class SzptClockInService {
return
szptClockInMapper
.
update
(
szptClockIn
,
wrapper
);
return
szptClockInMapper
.
update
(
szptClockIn
,
wrapper
);
}
}
public
Integer
deleteSzptClockIn
(
CommonDel
DTO
commonDel
DTO
)
{
public
Integer
deleteSzptClockIn
(
CommonDel
IntDTO
commonDelInt
DTO
)
{
LambdaQueryWrapper
<
SzptClockIn
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptClockIn
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptClockIn:
:
getId
,
commonDel
DTO
);
wrapper
.
in
(
SzptClockIn:
:
getId
,
commonDel
IntDTO
.
getIds
()
);
return
szptClockInMapper
.
delete
(
wrapper
);
return
szptClockInMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptFwxxService.java
View file @
cf0d8e66
...
@@ -32,7 +32,8 @@ public class SzptFwxxService {
...
@@ -32,7 +32,8 @@ public class SzptFwxxService {
public
Integer
deleteSzptFwxx
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptFwxx
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptFwxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptFwxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptFwxx:
:
getQyid
,
commonDelDTO
);
wrapper
.
in
(
SzptFwxx:
:
getQyid
,
commonDelDTO
.
getIds
());
wrapper
.
eq
(
SzptFwxx:
:
getSjgsdwdm
,
commonDelDTO
.
getSjgsdwdm
());
return
szptFwxxMapper
.
delete
(
wrapper
);
return
szptFwxxMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptGdCsyjhldxService.java
View file @
cf0d8e66
...
@@ -30,7 +30,7 @@ public class SzptGdCsyjhldxService {
...
@@ -30,7 +30,7 @@ public class SzptGdCsyjhldxService {
public
Integer
deleteSzptGdCsyjhldx
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptGdCsyjhldx
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptGdCsyjhldx
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptGdCsyjhldx
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptGdCsyjhldx:
:
getId
,
commonDelDTO
);
wrapper
.
in
(
SzptGdCsyjhldx:
:
getId
,
commonDelDTO
.
getIds
()
);
return
szptGdCsyjhldxMapper
.
delete
(
wrapper
);
return
szptGdCsyjhldxMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptGdRyxxService.java
View file @
cf0d8e66
...
@@ -30,7 +30,7 @@ public class SzptGdRyxxService {
...
@@ -30,7 +30,7 @@ public class SzptGdRyxxService {
public
Integer
deleteSzptGdRyxx
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptGdRyxx
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptGdRyxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptGdRyxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptGdRyxx:
:
getRkbm
,
commonDelDTO
);
wrapper
.
in
(
SzptGdRyxx:
:
getRkbm
,
commonDelDTO
.
getIds
()
);
return
szptGdRyxxMapper
.
delete
(
wrapper
);
return
szptGdRyxxMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptGdSbxxService.java
View file @
cf0d8e66
...
@@ -24,14 +24,15 @@ public class SzptGdSbxxService {
...
@@ -24,14 +24,15 @@ public class SzptGdSbxxService {
public
Integer
updateSzptGdSbxx
(
SzptGdSbxxDTO
szptGdSbxxDTO
)
{
public
Integer
updateSzptGdSbxx
(
SzptGdSbxxDTO
szptGdSbxxDTO
)
{
SzptGdSbxx
szptGdSbxx
=
BeanMapperUtil
.
map
(
szptGdSbxxDTO
,
SzptGdSbxx
.
class
);
SzptGdSbxx
szptGdSbxx
=
BeanMapperUtil
.
map
(
szptGdSbxxDTO
,
SzptGdSbxx
.
class
);
LambdaUpdateWrapper
<
SzptGdSbxx
>
wrapper
=
new
LambdaUpdateWrapper
<>();
LambdaUpdateWrapper
<
SzptGdSbxx
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
eq
(
SzptGdSbxx:
:
get
Id
,
szptGdSbxx
.
getId
());
wrapper
.
eq
(
SzptGdSbxx:
:
get
Sbbh
,
szptGdSbxx
.
getSbbh
());
wrapper
.
eq
(
SzptGdSbxx:
:
getSjgsdwdm
,
szptGdSbxx
.
getSjgsdwdm
());
wrapper
.
eq
(
SzptGdSbxx:
:
getSjgsdwdm
,
szptGdSbxx
.
getSjgsdwdm
());
return
szptGdSbxxMapper
.
update
(
szptGdSbxx
,
wrapper
);
return
szptGdSbxxMapper
.
update
(
szptGdSbxx
,
wrapper
);
}
}
public
Integer
deleteSzptGdSbxx
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptGdSbxx
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptGdSbxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptGdSbxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptGdSbxx:
:
getId
,
commonDelDTO
);
wrapper
.
in
(
SzptGdSbxx:
:
getSbbh
,
commonDelDTO
.
getIds
());
wrapper
.
eq
(
SzptGdSbxx:
:
getSjgsdwdm
,
commonDelDTO
.
getSjgsdwdm
());
return
szptGdSbxxMapper
.
delete
(
wrapper
);
return
szptGdSbxxMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptGdXxService.java
View file @
cf0d8e66
...
@@ -31,7 +31,8 @@ public class SzptGdXxService {
...
@@ -31,7 +31,8 @@ public class SzptGdXxService {
public
Integer
deleteSzptGdXx
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptGdXx
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptGdXx
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptGdXx
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptGdXx:
:
getId
,
commonDelDTO
);
wrapper
.
in
(
SzptGdXx:
:
getId
,
commonDelDTO
.
getIds
());
wrapper
.
eq
(
SzptGdXx:
:
getSjgsdwdm
,
commonDelDTO
.
getSjgsdwdm
());
return
szptGdXxMapper
.
delete
(
wrapper
);
return
szptGdXxMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptGdYjService.java
View file @
cf0d8e66
...
@@ -29,7 +29,7 @@ public class SzptGdYjService {
...
@@ -29,7 +29,7 @@ public class SzptGdYjService {
public
Integer
deleteSzptGdYj
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptGdYj
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptGdYj
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptGdYj
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptGdYj:
:
getId
,
commonDelDTO
);
wrapper
.
in
(
SzptGdYj:
:
getId
,
commonDelDTO
.
getIds
()
);
return
szptGdYjMapper
.
delete
(
wrapper
);
return
szptGdYjMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptQyxxService.java
View file @
cf0d8e66
...
@@ -30,7 +30,7 @@ public class SzptQyxxService {
...
@@ -30,7 +30,7 @@ public class SzptQyxxService {
public
Integer
deleteSzptQyxx
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptQyxx
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptQyxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptQyxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptQyxx:
:
getId
,
commonDelDTO
);
wrapper
.
in
(
SzptQyxx:
:
getId
,
commonDelDTO
.
getIds
()
);
return
szptQyxxMapper
.
delete
(
wrapper
);
return
szptQyxxMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptXyzhDkxxService.java
View file @
cf0d8e66
...
@@ -30,7 +30,7 @@ public class SzptXyzhDkxxService {
...
@@ -30,7 +30,7 @@ public class SzptXyzhDkxxService {
public
Integer
deleteSzptXyzhDkxx
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptXyzhDkxx
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptXyzhDkxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptXyzhDkxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptXyzhDkxx:
:
getDklsid
,
commonDelDTO
);
wrapper
.
in
(
SzptXyzhDkxx:
:
getDklsid
,
commonDelDTO
.
getIds
()
);
return
szptXyzhDkxxMapper
.
delete
(
wrapper
);
return
szptXyzhDkxxMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptXyzhKqmbService.java
View file @
cf0d8e66
...
@@ -32,7 +32,7 @@ public class SzptXyzhKqmbService {
...
@@ -32,7 +32,7 @@ public class SzptXyzhKqmbService {
public
Integer
deleteSzptXyzhKqmb
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptXyzhKqmb
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptXyzhKqmb
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptXyzhKqmb
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptXyzhKqmb:
:
getId
,
commonDelDTO
);
wrapper
.
in
(
SzptXyzhKqmb:
:
getId
,
commonDelDTO
.
getIds
()
);
return
szptXyzhKqmbMapper
.
delete
(
wrapper
);
return
szptXyzhKqmbMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptXyzhMbdhService.java
View file @
cf0d8e66
...
@@ -32,7 +32,7 @@ public class SzptXyzhMbdhService {
...
@@ -32,7 +32,7 @@ public class SzptXyzhMbdhService {
public
Integer
deleteSzptXyzhMbdh
(
CommonDelDTO
commonDelDTO
)
{
public
Integer
deleteSzptXyzhMbdh
(
CommonDelDTO
commonDelDTO
)
{
LambdaQueryWrapper
<
SzptXyzhMbdh
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptXyzhMbdh
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptXyzhMbdh:
:
getId
,
commonDelDTO
);
wrapper
.
in
(
SzptXyzhMbdh:
:
getId
,
commonDelDTO
.
getIds
()
);
return
szptXyzhMbdhMapper
.
delete
(
wrapper
);
return
szptXyzhMbdhMapper
.
delete
(
wrapper
);
}
}
}
}
src/main/java/com/zksy/szpt/service/SzptXyzhXyxxService.java
View file @
cf0d8e66
...
@@ -3,6 +3,7 @@ package com.zksy.szpt.service;
...
@@ -3,6 +3,7 @@ package com.zksy.szpt.service;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelDTO
;
import
com.zksy.szpt.domain.dto.CommonDelIntDTO
;
import
com.zksy.szpt.domain.dto.SzptXyzhMbdhDTO
;
import
com.zksy.szpt.domain.dto.SzptXyzhMbdhDTO
;
import
com.zksy.szpt.domain.dto.SzptXyzhXyxxDTO
;
import
com.zksy.szpt.domain.dto.SzptXyzhXyxxDTO
;
import
com.zksy.szpt.domain.po.SzptXyzhMbdh
;
import
com.zksy.szpt.domain.po.SzptXyzhMbdh
;
...
@@ -30,9 +31,9 @@ public class SzptXyzhXyxxService {
...
@@ -30,9 +31,9 @@ public class SzptXyzhXyxxService {
return
szptXyzhXyxxMapper
.
update
(
szptXyzhXyxx
,
wrapper
);
return
szptXyzhXyxxMapper
.
update
(
szptXyzhXyxx
,
wrapper
);
}
}
public
Integer
deleteSzptXyzhXyxx
(
CommonDel
DTO
commonDel
DTO
)
{
public
Integer
deleteSzptXyzhXyxx
(
CommonDel
IntDTO
commonDelInt
DTO
)
{
LambdaQueryWrapper
<
SzptXyzhXyxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SzptXyzhXyxx
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
SzptXyzhXyxx:
:
getId
,
commonDel
DTO
);
wrapper
.
in
(
SzptXyzhXyxx:
:
getId
,
commonDel
IntDTO
.
getIds
()
);
return
szptXyzhXyxxMapper
.
delete
(
wrapper
);
return
szptXyzhXyxxMapper
.
delete
(
wrapper
);
}
}
}
}
src/test/java/com/zksy/szpt/MainTest.java
View file @
cf0d8e66
...
@@ -29,8 +29,6 @@ public class MainTest {
...
@@ -29,8 +29,6 @@ public class MainTest {
String
nonce
=
"2"
;
String
nonce
=
"2"
;
String
timestampStr
=
"21"
;
String
timestampStr
=
"21"
;
String
appId
=
"1872576325743943682"
;
String
appId
=
"1872576325743943682"
;
String
appSecret
=
"2"
;
@Resource
@Resource
private
ObjectMapper
objectMapper
;
private
ObjectMapper
objectMapper
;
...
@@ -41,47 +39,18 @@ public class MainTest {
...
@@ -41,47 +39,18 @@ public class MainTest {
/**
/**
* 任务完成情况
* 任务完成情况
*/
*/
//
@Test
@Test
@DisplayName
(
"任务完成情况"
)
@DisplayName
(
"任务完成情况"
)
public
void
xxRwwcqkTest
()
{
public
void
xxRwwcqkTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
UUID
.
randomUUID
().
toString
();
// String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
appSecret
=
DigestUtil
.
md5Hex
(
appSecret
);
Assertions
.
assertNotNull
(
appId
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
//请求参数
XxRwwcqkDTO
xxRwwcqkDTO
=
new
XxRwwcqkDTO
();
XxRwwcqkDTO
xxRwwcqkDTO
=
new
XxRwwcqkDTO
();
xxRwwcqkDTO
.
setRwid
(
"1234"
);
xxRwwcqkDTO
.
setRwid
(
"1234
5678
"
);
xxRwwcqkDTO
.
setXxyid
(
"12345"
);
xxRwwcqkDTO
.
setXxyid
(
"12345
6785
"
);
xxRwwcqkDTO
.
setShrid
(
"12345"
);
xxRwwcqkDTO
.
setShrid
(
"12345
6785
"
);
xxRwwcqkDTO
.
setWczt
(
"1"
);
xxRwwcqkDTO
.
setWczt
(
"1"
);
xxRwwcqkDTO
.
setBmzt
(
"1"
);
xxRwwcqkDTO
.
setBmzt
(
"1"
);
String
json
=
null
;
// TestHttpUtil.signatureAndRequest("/rest/index/addXxRwwcqk", xxRwwcqkDTO, XxRwwcqkDTO.class);
try
{
TestHttpUtil
.
signatureAndRequest
(
"/rest/index/updateXxRwwcqk"
,
xxRwwcqkDTO
,
XxRwwcqkDTO
.
class
);
json
=
objectMapper
.
writeValueAsString
(
xxRwwcqkDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
appSecret
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/addXxRwwcqk"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
xxRwwcqkDTO
),
XxRwwcqkDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
/**
/**
...
@@ -90,43 +59,14 @@ public class MainTest {
...
@@ -90,43 +59,14 @@ public class MainTest {
@Test
@Test
@DisplayName
(
"账户信息"
)
@DisplayName
(
"账户信息"
)
public
void
zhxxtest
()
{
public
void
zhxxtest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
UUID
.
randomUUID
().
toString
();
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey);
//请求参数
//请求参数
XxZhxxDTO
dto
=
new
XxZhxxDTO
();
XxZhxxDTO
dto
=
new
XxZhxxDTO
();
dto
.
setZhid
(
"1234"
);
dto
.
setZhid
(
"1234
5678
"
);
dto
.
setXxyid
(
"11"
);
dto
.
setXxyid
(
"11"
);
dto
.
setZt
(
"2"
);
dto
.
setZt
(
"2"
);
dto
.
setClbz
(
"2"
);
dto
.
setClbz
(
"2"
);
String
json
=
null
;
// TestHttpUtil.signatureAndRequest("/rest/xxZhxx/add", dto, XxZhxxDTO.class);
try
{
TestHttpUtil
.
signatureAndRequest
(
"/rest/xxZhxx/update"
,
dto
,
XxZhxxDTO
.
class
);
json
=
objectMapper
.
writeValueAsString
(
dto
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/xxZhxx/add"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
dto
),
XxZhxxDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
/**
/**
...
@@ -135,43 +75,14 @@ public class MainTest {
...
@@ -135,43 +75,14 @@ public class MainTest {
@Test
@Test
@DisplayName
(
"账户积分变更"
)
@DisplayName
(
"账户积分变更"
)
public
void
test1
()
{
public
void
test1
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
UUID
.
randomUUID
().
toString
();
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey);
//请求参数
//请求参数
XxZhjfbgDTO
dto
=
new
XxZhjfbgDTO
();
XxZhjfbgDTO
dto
=
new
XxZhjfbgDTO
();
// dto.setZhid("1234");
// dto.setZhid("1234
5678
");
dto
.
setDhid
(
"1234"
);
dto
.
setDhid
(
"1234
5678
"
);
dto
.
setQbid
(
"2"
);
dto
.
setQbid
(
"2"
);
dto
.
setBgsj
(
new
Date
());
dto
.
setBgsj
(
new
Date
());
String
json
=
null
;
// TestHttpUtil.signatureAndRequest("/rest/xxZhjfbg/add", dto, XxZhjfbgDTO.class);
try
{
TestHttpUtil
.
signatureAndRequest
(
"/rest/xxZhjfbg/update"
,
dto
,
XxZhjfbgDTO
.
class
);
json
=
objectMapper
.
writeValueAsString
(
dto
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/xxZhjfbg/add"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
dto
),
XxZhjfbgDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
...
@@ -224,46 +135,17 @@ public class MainTest {
...
@@ -224,46 +135,17 @@ public class MainTest {
@Test
@Test
@DisplayName
(
"义警任务"
)
@DisplayName
(
"义警任务"
)
public
void
test4
()
{
public
void
test4
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
UUID
.
randomUUID
().
toString
();
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey);
//请求参数
//请求参数
XxYjrwDTO
dto
=
new
XxYjrwDTO
();
XxYjrwDTO
dto
=
new
XxYjrwDTO
();
// dto.setZhid("1234");
// dto.setZhid("1234
5678
");
dto
.
setRwid
(
"123456"
);
dto
.
setRwid
(
"123456
7856
"
);
dto
.
setRwbt
(
"1"
);
dto
.
setRwbt
(
"1"
);
dto
.
setRwnr
(
"11111"
);
dto
.
setRwnr
(
"11111"
);
dto
.
setGzrs
(
1L
);
dto
.
setGzrs
(
1L
);
dto
.
setSfsh
(
1
);
dto
.
setSfsh
(
1
);
dto
.
setWcrs
(
1L
);
dto
.
setWcrs
(
1L
);
String
json
=
null
;
// TestHttpUtil.signatureAndRequest("/rest/xxYjrw/add", dto, XxYjrwDTO.class);
try
{
TestHttpUtil
.
signatureAndRequest
(
"/rest/xxYjrw/update"
,
dto
,
XxYjrwDTO
.
class
);
json
=
objectMapper
.
writeValueAsString
(
dto
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/xxYjrw/update"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
dto
),
XxYjrwDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
/**
/**
...
@@ -272,179 +154,57 @@ public class MainTest {
...
@@ -272,179 +154,57 @@ public class MainTest {
@Test
@Test
@DisplayName
(
"义警队伍代码"
)
@DisplayName
(
"义警队伍代码"
)
public
void
test5
()
{
public
void
test5
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
UUID
.
randomUUID
().
toString
();
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey);
//请求参数
//请求参数
XxYjdwdmDTO
dto
=
new
XxYjdwdmDTO
();
XxYjdwdmDTO
dto
=
new
XxYjdwdmDTO
();
// dto.setZhid("1234");
// dto.setZhid("1234
5678
");
dto
.
setDwlx
(
Integer
.
valueOf
(
1
));
dto
.
setDwlx
(
Integer
.
valueOf
(
1
));
dto
.
setId
(
"1234"
);
dto
.
setId
(
"1234
5678
"
);
dto
.
setMchid
(
"11111"
);
dto
.
setMchid
(
"11111"
);
dto
.
setZt
(
"1"
);
dto
.
setZt
(
"1"
);
dto
.
setYjdwmc
(
"test"
);
dto
.
setYjdwmc
(
"test"
);
String
json
=
null
;
// TestHttpUtil.signatureAndRequest("/rest/xxYjdwdm/add", dto, XxYjdwdmDTO.class);
try
{
TestHttpUtil
.
signatureAndRequest
(
"/rest/xxYjdwdm/update"
,
dto
,
XxYjdwdmDTO
.
class
);
json
=
objectMapper
.
writeValueAsString
(
dto
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/xxYjdwdm/add"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
dto
),
XxYjdwdmDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
@Test
@Test
@DisplayName
(
"社会信息员队伍"
)
@DisplayName
(
"社会信息员队伍"
)
public
void
test6
()
{
public
void
test6
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
UUID
.
randomUUID
().
toString
();
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
XxShxxyDwDTO
dto
=
new
XxShxxyDwDTO
();
XxShxxyDwDTO
dto
=
new
XxShxxyDwDTO
();
dto
.
setId
(
"1234"
);
dto
.
setId
(
"12345678"
);
dto
.
setDwdm
(
"1234"
);
dto
.
setDwdm
(
"12345678"
);
dto
.
setShxxyid
(
"1234"
);
dto
.
setShxxyid
(
"12345678"
);
String
json
=
null
;
// TestHttpUtil.signatureAndRequest("/rest/xxShxxyDw/add", dto, XxShxxyDwDTO.class);
try
{
TestHttpUtil
.
signatureAndRequest
(
"/rest/xxShxxyDw/update"
,
dto
,
XxShxxyDwDTO
.
class
);
json
=
objectMapper
.
writeValueAsString
(
dto
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/xxShxxyDw/add"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
dto
),
XxShxxyDw
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
@Test
@Test
@DisplayName
(
"社会信息员"
)
@DisplayName
(
"社会信息员"
)
public
void
test7
()
{
public
void
test7
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
UUID
.
randomUUID
().
toString
();
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
XxShxxyDTO
dto
=
new
XxShxxyDTO
();
XxShxxyDTO
dto
=
new
XxShxxyDTO
();
dto
.
setXxyid
(
"1234"
);
dto
.
setXxyid
(
"1234
5678
"
);
dto
.
setZt
(
"1"
);
dto
.
setZt
(
"1"
);
dto
.
setSbfszt
(
"1"
);
dto
.
setSbfszt
(
"1"
);
dto
.
setShrid
(
"1"
);
dto
.
setShrid
(
"1"
);
String
json
=
null
;
// TestHttpUtil.signatureAndRequest("/rest/xxShxxy/add", dto, XxShxxyDTO.class);
try
{
TestHttpUtil
.
signatureAndRequest
(
"/rest/xxShxxy/update"
,
dto
,
XxShxxyDTO
.
class
);
json
=
objectMapper
.
writeValueAsString
(
dto
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/xxShxxy/add"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
dto
),
XxShxxyDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
@Test
@Test
@DisplayName
(
"删除服务"
)
@DisplayName
(
"删除服务"
)
public
void
testdelete
()
{
public
void
testdelete
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
UUID
.
randomUUID
().
toString
();
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
String
json
=
null
;
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
"1234"
);
ids
.
add
(
"1234
5678
"
);
ids
.
add
(
"12345"
);
ids
.
add
(
"12345
6785
"
);
CommonDelParamDTO
dto
=
new
CommonDelParamDTO
();
CommonDelParamDTO
dto
=
new
CommonDelParamDTO
();
dto
.
setIds
(
ids
);
dto
.
setIds
(
ids
);
try
{
json
=
objectMapper
.
writeValueAsString
(
dto
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
String
json1
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json1
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
// String url="xxShxxyDw/delete";
// String url="xxShxxyDw/delete";
// String url="xxShxxy/delete";
// String url="xxShxxy/delete";
// String url="xxYjdwdm/delete";
// String url="xxYjdwdm/delete";
// String url="xxYjrw/delete";
// String url="xxYjrw/delete";
//
// String url="xxZhjfbg/delete";
// String url="xxZhjfbg/delete";
//
String
url
=
"xxZhxx/delete"
;
String
url
=
"xxZhxx/delete"
;
TestHttpUtil
.
signatureAndRequest
(
"/rest/"
+
url
,
dto
,
CommonDelParamDTO
.
class
);
String
response
=
webClient
.
post
().
uri
(
"/rest/"
+
url
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
dto
),
CommonDelDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
}
}
src/test/java/com/zksy/szpt/MainTestX.java
View file @
cf0d8e66
...
@@ -3,8 +3,7 @@ package com.zksy.szpt;
...
@@ -3,8 +3,7 @@ package com.zksy.szpt;
import
cn.hutool.crypto.digest.DigestUtil
;
import
cn.hutool.crypto.digest.DigestUtil
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.zksy.szpt.domain.dto.SzptClockInDTO
;
import
com.zksy.szpt.domain.dto.*
;
import
com.zksy.szpt.domain.dto.SzptFwxxDTO
;
import
com.zksy.szpt.service.AppStoreService
;
import
com.zksy.szpt.service.AppStoreService
;
import
com.zksy.szpt.util.EncryptUtil
;
import
com.zksy.szpt.util.EncryptUtil
;
import
com.zksy.szpt.util.SignatureUtil
;
import
com.zksy.szpt.util.SignatureUtil
;
...
@@ -16,7 +15,9 @@ import org.springframework.web.reactive.function.client.WebClient;
...
@@ -16,7 +15,9 @@ import org.springframework.web.reactive.function.client.WebClient;
import
reactor.core.publisher.Mono
;
import
reactor.core.publisher.Mono
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@SpringBootTest
()
@SpringBootTest
()
public
class
MainTestX
{
public
class
MainTestX
{
...
@@ -32,10 +33,10 @@ public class MainTestX {
...
@@ -32,10 +33,10 @@ public class MainTestX {
private
AppStoreService
appStoreService
;
private
AppStoreService
appStoreService
;
/**
/**
*
任务完成情况
*
===================================================考勤===================================================
*/
*/
@Test
@Test
@DisplayName
(
"考勤"
)
@DisplayName
(
"考勤
--新增、更新
"
)
public
void
szptClockInTest
()
{
public
void
szptClockInTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
...
@@ -49,13 +50,11 @@ public class MainTestX {
...
@@ -49,13 +50,11 @@ public class MainTestX {
szptClockInDTO
.
setXbqt
(
"123456"
);
szptClockInDTO
.
setXbqt
(
"123456"
);
szptClockInDTO
.
setXcqk
(
"1"
);
szptClockInDTO
.
setXcqk
(
"1"
);
szptClockInDTO
.
setSbsj
(
"1"
);
szptClockInDTO
.
setSbsj
(
"1"
);
szptClockInDTO
.
setSbr
(
"123456"
);
szptClockInDTO
.
setSbr
(
"123456"
);
szptClockInDTO
.
setQdr
(
"123456"
);
szptClockInDTO
.
setQdr
(
"123456"
);
szptClockInDTO
.
setQdrlxdh
(
"123456"
);
szptClockInDTO
.
setQdrlxdh
(
"123456"
);
szptClockInDTO
.
setQddkdd
(
"1"
);
szptClockInDTO
.
setQddkdd
(
"1"
);
szptClockInDTO
.
setQddkzp
(
"1"
);
szptClockInDTO
.
setQddkzp
(
"1"
);
szptClockInDTO
.
setQtdkdd
(
"1"
);
szptClockInDTO
.
setQtdkdd
(
"1"
);
szptClockInDTO
.
setQtdkzp
(
"1"
);
szptClockInDTO
.
setQtdkzp
(
"1"
);
szptClockInDTO
.
setGkdj
(
"1"
);
szptClockInDTO
.
setGkdj
(
"1"
);
...
@@ -87,9 +86,144 @@ public class MainTestX {
...
@@ -87,9 +86,144 @@ public class MainTestX {
System
.
out
.
println
(
response
);
System
.
out
.
println
(
response
);
}
}
@Test
@DisplayName
(
"考勤--删除"
)
public
void
deleteClockInTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List
<
Integer
>
ids
=
new
ArrayList
<>();
ids
.
add
(
14
);
ids
.
add
(
15
);
CommonDelIntDTO
commonDelIntDTO
=
new
CommonDelIntDTO
();
commonDelIntDTO
.
setIds
(
ids
);
commonDelIntDTO
.
setSjgsdwdm
(
"330102"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
commonDelIntDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/deleteSzptClockIn"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
commonDelIntDTO
),
CommonDelIntDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
/**
* ===================================================考勤规则===================================================
*/
@Test
@DisplayName
(
"考勤规则--新增、更新"
)
public
void
szptClockInRulesTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptClockInRulesDTO
szptClockInRulesDTO
=
new
SzptClockInRulesDTO
();
szptClockInRulesDTO
.
setId
(
100
);
szptClockInRulesDTO
.
setName
(
"123456"
);
szptClockInRulesDTO
.
setCsid
(
"123456"
);
szptClockInRulesDTO
.
setChockInTime
(
"123456"
);
szptClockInRulesDTO
.
setClockInScope
(
"1"
);
szptClockInRulesDTO
.
setQrCode
(
"1"
);
szptClockInRulesDTO
.
setCslx
(
"123456"
);
szptClockInRulesDTO
.
setBz
(
"123456"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
szptClockInRulesDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
// String response = webClient.post().uri("/rest/index/addSzptClockInRules")
String
response
=
webClient
.
post
().
uri
(
"/rest/index/updateSzptClockInRules"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
szptClockInRulesDTO
),
SzptClockInRulesDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
@Test
@DisplayName
(
"考勤规则--删除"
)
public
void
deleteClockInRulesTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List
<
Integer
>
ids
=
new
ArrayList
<>();
ids
.
add
(
4
);
ids
.
add
(
100
);
CommonDelIntDTO
commonDelIntDTO
=
new
CommonDelIntDTO
();
commonDelIntDTO
.
setIds
(
ids
);
commonDelIntDTO
.
setSjgsdwdm
(
"330102"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
commonDelIntDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/deleteSzptClockInRules"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
commonDelIntDTO
),
CommonDelIntDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
/**
* ===================================================房屋信息===================================================
*/
@Test
@Test
@DisplayName
(
"房屋信息"
)
@DisplayName
(
"房屋信息
--新增、更新
"
)
public
void
szptFwxxTest
()
{
public
void
szptFwxxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
...
@@ -97,7 +231,7 @@ public class MainTestX {
...
@@ -97,7 +231,7 @@ public class MainTestX {
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
//请求参数
SzptFwxxDTO
szptFwxxDTO
=
new
SzptFwxxDTO
();
SzptFwxxDTO
szptFwxxDTO
=
new
SzptFwxxDTO
();
szptFwxxDTO
.
setQyid
(
"
2
"
);
szptFwxxDTO
.
setQyid
(
"
5
"
);
szptFwxxDTO
.
setCsid
(
"123456"
);
szptFwxxDTO
.
setCsid
(
"123456"
);
szptFwxxDTO
.
setFwjc
(
"123456"
);
szptFwxxDTO
.
setFwjc
(
"123456"
);
szptFwxxDTO
.
setJzqk
(
"1"
);
szptFwxxDTO
.
setJzqk
(
"1"
);
...
@@ -132,7 +266,7 @@ public class MainTestX {
...
@@ -132,7 +266,7 @@ public class MainTestX {
szptFwxxDTO
.
setFkdjzdsh
(
"1"
);
szptFwxxDTO
.
setFkdjzdsh
(
"1"
);
szptFwxxDTO
.
setQtfwyt
(
"1"
);
szptFwxxDTO
.
setQtfwyt
(
"1"
);
szptFwxxDTO
.
setJkmhysj
(
new
Date
());
szptFwxxDTO
.
setJkmhysj
(
new
Date
());
szptFwxxDTO
.
setSjgsdwdm
(
"3
4
0102"
);
szptFwxxDTO
.
setSjgsdwdm
(
"3
3
0102"
);
szptFwxxDTO
.
setSjgsdwmc
(
"1"
);
szptFwxxDTO
.
setSjgsdwmc
(
"1"
);
szptFwxxDTO
.
setFzzjzp
(
"1"
);
szptFwxxDTO
.
setFzzjzp
(
"1"
);
String
json
=
null
;
String
json
=
null
;
...
@@ -162,4 +296,599 @@ public class MainTestX {
...
@@ -162,4 +296,599 @@ public class MainTestX {
.
block
();
.
block
();
System
.
out
.
println
(
response
);
System
.
out
.
println
(
response
);
}
}
@Test
@DisplayName
(
"房屋信息--删除"
)
public
void
deleteSzptFwxxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
"5"
);
CommonDelDTO
commonDelDTO
=
new
CommonDelDTO
();
commonDelDTO
.
setIds
(
ids
);
commonDelDTO
.
setSjgsdwdm
(
"330102"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
commonDelDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
String
json1
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json1
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/deleteSzptFwxx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
commonDelDTO
),
CommonDelDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
/**
* ===================================================场所预警忽略对象===================================================
*/
@Test
@DisplayName
(
"场所预警忽略对象--新增、更新"
)
public
void
szptGdCsyjhldxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdCsyjhldxDTO
szptGdCsyjhldxDTO
=
new
SzptGdCsyjhldxDTO
();
szptGdCsyjhldxDTO
.
setId
(
"5"
);
szptGdCsyjhldxDTO
.
setCsid
(
"123456123456"
);
szptGdCsyjhldxDTO
.
setYjlx
(
"1"
);
szptGdCsyjhldxDTO
.
setYjzlx
(
"1"
);
szptGdCsyjhldxDTO
.
setYwid
(
"1"
);
szptGdCsyjhldxDTO
.
setYwms
(
"1"
);
szptGdCsyjhldxDTO
.
setBz
(
"123456"
);
szptGdCsyjhldxDTO
.
setZt
(
"1"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
szptGdCsyjhldxDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
// String response = webClient.post().uri("/rest/index/addSzptGdCsyjhldx")
String
response
=
webClient
.
post
().
uri
(
"/rest/index/updateSzptGdCsyjhldx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
szptGdCsyjhldxDTO
),
SzptGdCsyjhldxDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
@Test
@DisplayName
(
"场所预警忽略对象--删除"
)
public
void
deleteSzptGdCsyjhldxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
"5"
);
CommonDelDTO
commonDelDTO
=
new
CommonDelDTO
();
commonDelDTO
.
setIds
(
ids
);
commonDelDTO
.
setSjgsdwdm
(
"330102"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
commonDelDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
String
json1
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json1
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/deleteSzptGdCsyjhldx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
commonDelDTO
),
CommonDelDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
/**
* ===================================================工地人员信息===================================================
*/
@Test
@DisplayName
(
"工地人员信息--新增、更新"
)
public
void
szptGdRyxxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdRyxxDTO
szptGdRyxxDTO
=
new
SzptGdRyxxDTO
();
szptGdRyxxDTO
.
setId
(
"7"
);
szptGdRyxxDTO
.
setRkbm
(
"1234561234561"
);
szptGdRyxxDTO
.
setCsid
(
"1123111111111111"
);
szptGdRyxxDTO
.
setCjrlid
(
"1"
);
szptGdRyxxDTO
.
setXm
(
"1"
);
szptGdRyxxDTO
.
setXb
(
"1"
);
szptGdRyxxDTO
.
setLxdh
(
"123456"
);
szptGdRyxxDTO
.
setCyzjdm
(
"1"
);
szptGdRyxxDTO
.
setZjhm
(
"5"
);
szptGdRyxxDTO
.
setNl
(
"1"
);
szptGdRyxxDTO
.
setUrl
(
"1"
);
szptGdRyxxDTO
.
setMd5
(
"1"
);
szptGdRyxxDTO
.
setZjcxts
(
1
);
szptGdRyxxDTO
.
setZcxts
(
1
);
szptGdRyxxDTO
.
setYsrczjts
(
1
);
szptGdRyxxDTO
.
setYsrcbz
(
"1"
);
szptGdRyxxDTO
.
setYsrczts
(
5
);
szptGdRyxxDTO
.
setCkbz
(
"1"
);
szptGdRyxxDTO
.
setLkbz
(
"1"
);
szptGdRyxxDTO
.
setHjdzDzmc
(
"1"
);
szptGdRyxxDTO
.
setHjdzXzqhdm
(
"1"
);
szptGdRyxxDTO
.
setHjdzPcsmc
(
"1"
);
szptGdRyxxDTO
.
setHjdzPcsdm
(
"123456"
);
szptGdRyxxDTO
.
setXzdDzmc
(
"1"
);
szptGdRyxxDTO
.
setXzdXzqhdm
(
"5"
);
szptGdRyxxDTO
.
setXzdPcsmc
(
"123456123456"
);
szptGdRyxxDTO
.
setXzdPcsdm
(
"1"
);
szptGdRyxxDTO
.
setZt
(
"1"
);
szptGdRyxxDTO
.
setJcsj
(
new
Date
());
szptGdRyxxDTO
.
setTcsj
(
new
Date
());
szptGdRyxxDTO
.
setYjtcsj
(
new
Date
());
szptGdRyxxDTO
.
setZjzpsj
(
new
Date
());
szptGdRyxxDTO
.
setSfglry
(
"5"
);
szptGdRyxxDTO
.
setDjzt
(
1
);
szptGdRyxxDTO
.
setQyid
(
"1"
);
szptGdRyxxDTO
.
setQymc
(
"1"
);
szptGdRyxxDTO
.
setRylb
(
"1"
);
szptGdRyxxDTO
.
setRylx
(
"1"
);
szptGdRyxxDTO
.
setLkbdsj
(
new
Date
());
szptGdRyxxDTO
.
setCkbdsj
(
new
Date
());
szptGdRyxxDTO
.
setDatasource
(
"1"
);
szptGdRyxxDTO
.
setOrderid
(
"1"
);
szptGdRyxxDTO
.
setSjrzrs
(
"123456"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
szptGdRyxxDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
// String response = webClient.post().uri("/rest/index/addSzptGdRyxx")
String
response
=
webClient
.
post
().
uri
(
"/rest/index/updateSzptGdRyxx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
szptGdRyxxDTO
),
SzptGdRyxxDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
@Test
@DisplayName
(
"工地人员信息--删除"
)
public
void
deleteSzptGdRyxxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
"1234561234561"
);
CommonDelDTO
commonDelDTO
=
new
CommonDelDTO
();
commonDelDTO
.
setIds
(
ids
);
commonDelDTO
.
setSjgsdwdm
(
"330102"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
commonDelDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
String
json1
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json1
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/deleteSzptGdRyxx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
commonDelDTO
),
CommonDelDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
/**
* ===================================================设备信息===================================================
*/
@Test
@DisplayName
(
"设备信息--新增、更新"
)
public
void
szptGdSbxxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdSbxxDTO
szptGdSbxxDTO
=
new
SzptGdSbxxDTO
();
szptGdSbxxDTO
.
setId
(
"7"
);
szptGdSbxxDTO
.
setSbsn
(
"1"
);
szptGdSbxxDTO
.
setSbmc
(
"1"
);
szptGdSbxxDTO
.
setSbbh
(
"1"
);
szptGdSbxxDTO
.
setSbms
(
"1"
);
szptGdSbxxDTO
.
setMac
(
"1"
);
szptGdSbxxDTO
.
setIp
(
"123456"
);
szptGdSbxxDTO
.
setNetmask
(
"1"
);
szptGdSbxxDTO
.
setGw
(
"5"
);
szptGdSbxxDTO
.
setCsid
(
"1"
);
szptGdSbxxDTO
.
setYxzt
(
"1"
);
szptGdSbxxDTO
.
setZtgxsj
(
new
Date
());
szptGdSbxxDTO
.
setCj
(
"1"
);
szptGdSbxxDTO
.
setXh
(
"1"
);
szptGdSbxxDTO
.
setQyid
(
"1"
);
szptGdSbxxDTO
.
setQymc
(
"1"
);
szptGdSbxxDTO
.
setSbcs
(
"1"
);
szptGdSbxxDTO
.
setSblb
(
"1"
);
szptGdSbxxDTO
.
setZt
(
"1"
);
szptGdSbxxDTO
.
setSjgsdwdm
(
"330102"
);
szptGdSbxxDTO
.
setSjgsdwmc
(
"1"
);
szptGdSbxxDTO
.
setCreateGajgjgdm
(
"123"
);
szptGdSbxxDTO
.
setCreateGajgmc
(
"123"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
szptGdSbxxDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
// String response = webClient.post().uri("/rest/index/addSzptGdSbxx")
String
response
=
webClient
.
post
().
uri
(
"/rest/index/updateSzptGdSbxx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
szptGdSbxxDTO
),
SzptGdSbxxDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
@Test
@DisplayName
(
"设备信息--删除"
)
public
void
deleteSzptGdSbxxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
"4"
);
ids
.
add
(
"5"
);
ids
.
add
(
"6"
);
CommonDelDTO
commonDelDTO
=
new
CommonDelDTO
();
commonDelDTO
.
setIds
(
ids
);
commonDelDTO
.
setSjgsdwdm
(
"330102"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
commonDelDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
String
json1
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json1
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/deleteSzptGdSbxx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
commonDelDTO
),
CommonDelDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
/**
* ===================================================工地信息===================================================
*/
@Test
@DisplayName
(
"工地信息--新增、更新"
)
public
void
szptGdXxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdXxDTO
szptGdXxDTO
=
new
SzptGdXxDTO
();
szptGdXxDTO
.
setId
(
"7"
);
szptGdXxDTO
.
setCslx
(
"1"
);
szptGdXxDTO
.
setCsmc
(
"1111111111111111111"
);
szptGdXxDTO
.
setCsms
(
"1"
);
szptGdXxDTO
.
setLxdz
(
"1"
);
szptGdXxDTO
.
setLxr
(
"1"
);
szptGdXxDTO
.
setLxdh
(
"123456"
);
szptGdXxDTO
.
setSgdw
(
"1"
);
szptGdXxDTO
.
setSgxkz
(
"5"
);
szptGdXxDTO
.
setKgrq
(
new
Date
());
szptGdXxDTO
.
setYjjgrq
(
new
Date
());
szptGdXxDTO
.
setLng
(
"120.3"
);
szptGdXxDTO
.
setLat
(
"30"
);
szptGdXxDTO
.
setCustomlng
(
"1"
);
szptGdXxDTO
.
setCustomlat
(
"1"
);
szptGdXxDTO
.
setZrrxm
(
"1"
);
szptGdXxDTO
.
setZrrlxdh
(
"1"
);
szptGdXxDTO
.
setFrxm
(
"1"
);
szptGdXxDTO
.
setFrlxdh
(
"1"
);
szptGdXxDTO
.
setShxydm
(
"330102"
);
szptGdXxDTO
.
setZcdz
(
"1"
);
szptGdXxDTO
.
setAdminzh
(
"123"
);
szptGdXxDTO
.
setSfzcs
(
"1"
);
szptGdXxDTO
.
setFcsid
(
"1"
);
szptGdXxDTO
.
setBz
(
"1"
);
szptGdXxDTO
.
setCjsj
(
new
Date
());
szptGdXxDTO
.
setZt
(
"1"
);
szptGdXxDTO
.
setJhsj
(
new
Date
());
szptGdXxDTO
.
setLocation
(
"1"
);
szptGdXxDTO
.
setSjlyXtmc
(
"340102"
);
szptGdXxDTO
.
setZxsj
(
new
Date
());
szptGdXxDTO
.
setSqdm
(
"123"
);
szptGdXxDTO
.
setSqmc
(
"123"
);
szptGdXxDTO
.
setMdlx
(
"1"
);
szptGdXxDTO
.
setMdjyzt
(
"1"
);
szptGdXxDTO
.
setSjgsdwdm
(
"330102"
);
szptGdXxDTO
.
setSjgsdwmc
(
"1"
);
szptGdXxDTO
.
setCreateGajgjgdm
(
"1"
);
szptGdXxDTO
.
setCreateGajgmc
(
"1"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
szptGdXxDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
// String response = webClient.post().uri("/rest/index/addSzptGdXx")
String
response
=
webClient
.
post
().
uri
(
"/rest/index/updateSzptGdXx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
szptGdXxDTO
),
SzptGdXxDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
@Test
@DisplayName
(
"工地信息--删除"
)
public
void
deleteSzptGdXxTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
"1872956891413839873"
);
ids
.
add
(
"1872957357501657089"
);
ids
.
add
(
"1874652891924905986"
);
CommonDelDTO
commonDelDTO
=
new
CommonDelDTO
();
commonDelDTO
.
setIds
(
ids
);
commonDelDTO
.
setSjgsdwdm
(
"330102"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
commonDelDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
String
json1
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json1
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/deleteSzptGdXx"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
commonDelDTO
),
CommonDelDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
/**
* ===================================================工地预警流水表===================================================
*/
@Test
@DisplayName
(
"工地预警流水表--新增、更新"
)
public
void
szptGdYjTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdYjDTO
szptGdYjDTO
=
new
SzptGdYjDTO
();
szptGdYjDTO
.
setId
(
"1"
);
szptGdYjDTO
.
setCsid
(
"1"
);
szptGdYjDTO
.
setYjrq
(
"1"
);
szptGdYjDTO
.
setYjlx
(
"1"
);
szptGdYjDTO
.
setYjzlx
(
"1"
);
szptGdYjDTO
.
setYjnr
(
"1"
);
szptGdYjDTO
.
setYwid
(
"123456"
);
szptGdYjDTO
.
setYwcs
(
"1"
);
szptGdYjDTO
.
setYjzt
(
"5"
);
szptGdYjDTO
.
setClsj
(
new
Date
());
szptGdYjDTO
.
setCljg
(
"123"
);
szptGdYjDTO
.
setClrid
(
"120.3"
);
szptGdYjDTO
.
setClrxm
(
"30"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
szptGdYjDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
// String response = webClient.post().uri("/rest/index/addSzptGdYj")
String
response
=
webClient
.
post
().
uri
(
"/rest/index/updateSzptGdYj"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
szptGdYjDTO
),
SzptGdYjDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
@Test
@DisplayName
(
"工地预警流水表--删除"
)
public
void
deleteSzptGdYjTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
"1874653022954954754"
);
ids
.
add
(
"1876882297523142657"
);
ids
.
add
(
"1876882403576119297"
);
ids
.
add
(
"1876882723429670913"
);
ids
.
add
(
"1876883035569774594"
);
ids
.
add
(
"1876887147652833281"
);
CommonDelDTO
commonDelDTO
=
new
CommonDelDTO
();
commonDelDTO
.
setIds
(
ids
);
commonDelDTO
.
setSjgsdwdm
(
"330102"
);
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
commonDelDTO
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
//请求体加密
String
json1
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
secretKey
);
//签名appId+nonce+timestampStr+aes(body)
String
data
=
String
.
format
(
"%s%s%s%s"
,
appId
,
nonce
,
timestampStr
,
json1
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
//请求
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/deleteSzptGdYj"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
commonDelDTO
),
CommonDelDTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
System
.
out
.
println
(
response
);
}
}
}
src/test/java/com/zksy/szpt/TestHttpUtil.java
View file @
cf0d8e66
...
@@ -61,7 +61,7 @@ public class TestHttpUtil {
...
@@ -61,7 +61,7 @@ public class TestHttpUtil {
Assertions
.
assertNotNull
(
path
,
"path不能为空"
);
Assertions
.
assertNotNull
(
path
,
"path不能为空"
);
Assertions
.
assertNotNull
(
source
,
"请求参数不能为空"
);
Assertions
.
assertNotNull
(
source
,
"请求参数不能为空"
);
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
());
String
json
=
null
;
String
json
=
null
;
try
{
try
{
json
=
objectMapper
.
writeValueAsString
(
source
);
json
=
objectMapper
.
writeValueAsString
(
source
);
...
...
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