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
70ef5110
Commit
70ef5110
authored
Dec 30, 2024
by
wangjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增服务
parent
29d98378
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
607 additions
and
29 deletions
+607
-29
src/main/java/com/zksy/szpt/controller/IndexController.java
src/main/java/com/zksy/szpt/controller/IndexController.java
+12
-0
src/main/java/com/zksy/szpt/domain/dto/XxZhjfbgDTO.java
src/main/java/com/zksy/szpt/domain/dto/XxZhjfbgDTO.java
+163
-0
src/main/java/com/zksy/szpt/domain/dto/XxZhxxDTO.java
src/main/java/com/zksy/szpt/domain/dto/XxZhxxDTO.java
+311
-0
src/main/java/com/zksy/szpt/domain/po/XxZhjfbg.java
src/main/java/com/zksy/szpt/domain/po/XxZhjfbg.java
+8
-0
src/main/java/com/zksy/szpt/domain/po/XxZhxx.java
src/main/java/com/zksy/szpt/domain/po/XxZhxx.java
+8
-0
src/main/java/com/zksy/szpt/handler/SzptMetaObjectHandler.java
...ain/java/com/zksy/szpt/handler/SzptMetaObjectHandler.java
+1
-0
src/main/java/com/zksy/szpt/mapper/XxZhjfbgMapper.java
src/main/java/com/zksy/szpt/mapper/XxZhjfbgMapper.java
+4
-2
src/main/java/com/zksy/szpt/mapper/XxZhxxMapper.java
src/main/java/com/zksy/szpt/mapper/XxZhxxMapper.java
+3
-2
src/main/java/com/zksy/szpt/service/IndexService.java
src/main/java/com/zksy/szpt/service/IndexService.java
+38
-14
src/test/java/com/zksy/szpt/MainTest.java
src/test/java/com/zksy/szpt/MainTest.java
+59
-11
No files found.
src/main/java/com/zksy/szpt/controller/IndexController.java
View file @
70ef5110
...
...
@@ -70,4 +70,16 @@ public class IndexController {
public
Integer
addSzptGdXx
(
@RequestBody
@Validated
SzptGdXxDTO
szptGdXxDTO
){
return
indexService
.
addSzptGdXx
(
szptGdXxDTO
);
}
@ApiOperation
(
value
=
"新增账号信息数据"
)
@PostMapping
(
"/addXxZhxx"
)
public
Integer
addXxZhxx
(
@RequestBody
@Validated
XxZhxxDTO
xxZhxxDTO
){
return
indexService
.
addXxZhxx
(
xxZhxxDTO
);
}
@ApiOperation
(
value
=
"新增账户积分变更信息数据"
)
@PostMapping
(
"/addXxZhjfbg"
)
public
Integer
addXxZhjfbg
(
@RequestBody
@Validated
XxZhjfbgDTO
dto
){
return
indexService
.
addXxZhjfbg
(
dto
);
}
}
src/main/java/com/zksy/szpt/domain/dto/XxZhjfbgDTO.java
0 → 100644
View file @
70ef5110
package
com
.
zksy
.
szpt
.
domain
.
dto
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
public
class
XxZhjfbgDTO
{
/**
* 兑换ID
*/
@NotBlank
(
message
=
"兑换ID不能为空"
)
private
String
dhid
;
/**
* 账户ID
*/
private
String
zhid
;
/**
* 情报ID
*/
@NotBlank
(
message
=
"情报ID不能为空"
)
private
String
qbid
;
/**
* 情报奖励ID
*/
private
String
qbjlid
;
/**
* 变更类型;cslb=1019
*/
private
String
bglx
;
/**
* 变更积分
*/
private
Long
bgjf
;
/**
* 变更前积分
*/
private
Long
bgqjf
;
/**
* 变更后积分
*/
private
Long
bghjf
;
/**
* 变更时间
*/
@NotNull
(
message
=
"情报ID不能为空"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
bgsj
;
/**
* 备注
*/
private
String
bz
;
/**
* 更新时间
*/
private
Date
gxsj
;
public
String
getDhid
()
{
return
dhid
;
}
public
void
setDhid
(
String
dhid
)
{
this
.
dhid
=
dhid
==
null
?
null
:
dhid
.
trim
();
}
public
String
getZhid
()
{
return
zhid
;
}
public
void
setZhid
(
String
zhid
)
{
this
.
zhid
=
zhid
==
null
?
null
:
zhid
.
trim
();
}
public
String
getQbid
()
{
return
qbid
;
}
public
void
setQbid
(
String
qbid
)
{
this
.
qbid
=
qbid
==
null
?
null
:
qbid
.
trim
();
}
public
String
getQbjlid
()
{
return
qbjlid
;
}
public
void
setQbjlid
(
String
qbjlid
)
{
this
.
qbjlid
=
qbjlid
==
null
?
null
:
qbjlid
.
trim
();
}
public
String
getBglx
()
{
return
bglx
;
}
public
void
setBglx
(
String
bglx
)
{
this
.
bglx
=
bglx
==
null
?
null
:
bglx
.
trim
();
}
public
Long
getBgjf
()
{
return
bgjf
;
}
public
void
setBgjf
(
Long
bgjf
)
{
this
.
bgjf
=
bgjf
;
}
public
Long
getBgqjf
()
{
return
bgqjf
;
}
public
void
setBgqjf
(
Long
bgqjf
)
{
this
.
bgqjf
=
bgqjf
;
}
public
Long
getBghjf
()
{
return
bghjf
;
}
public
void
setBghjf
(
Long
bghjf
)
{
this
.
bghjf
=
bghjf
;
}
public
Date
getBgsj
()
{
return
bgsj
;
}
public
void
setBgsj
(
Date
bgsj
)
{
this
.
bgsj
=
bgsj
;
}
public
String
getBz
()
{
return
bz
;
}
public
void
setBz
(
String
bz
)
{
this
.
bz
=
bz
==
null
?
null
:
bz
.
trim
();
}
public
Date
getGxsj
()
{
return
gxsj
;
}
public
void
setGxsj
(
Date
gxsj
)
{
this
.
gxsj
=
gxsj
;
}
}
\ No newline at end of file
src/main/java/com/zksy/szpt/domain/dto/XxZhxxDTO.java
0 → 100644
View file @
70ef5110
package
com
.
zksy
.
szpt
.
domain
.
dto
;
import
javax.validation.constraints.NotBlank
;
import
java.util.Date
;
public
class
XxZhxxDTO
{
/**
* 账户ID
*/
@NotBlank
(
message
=
"账户ID不能为空"
)
private
String
zhid
;
/**
* 账户类型;cslb=1004
*/
private
String
zhlx
;
/**
* 社会信息员ID
*/
private
String
xxyid
;
/**
* 姓名
*/
private
String
xm
;
/**
* 身份证号
*/
private
String
sfzh
;
/**
* 联系电话
*/
private
String
lxdh
;
/**
* OPENID
*/
private
String
openid
;
/**
* 昵称
*/
private
String
nc
;
/**
* UNIONID
*/
private
String
unionid
;
/**
* 发送情报数
*/
private
String
fsqbs
;
/**
* 小程序ID
*/
private
String
accountid
;
/**
* 前端权限,默认空,支持多个,逗号分隔
*/
private
String
roles
;
/**
* 邀请码
*/
private
String
yqm
;
/**
* 邀请码ID
*/
private
String
yqmid
;
/**
* 处理标志;cslb=1017
*/
@NotBlank
(
message
=
"处理标志不能为空"
)
private
String
clbz
;
/**
* 处理时间
*/
private
Date
clsj
;
/**
* 处理结果
*/
private
String
cljg
;
/**
* 返回时间
*/
private
Date
fhsj
;
/**
* OCUUID
*/
private
String
ocuuid
;
/**
* 帐号参数JSON
*/
private
String
zhcs
;
/**
* 运营商户ID
*/
private
String
mchid
;
/**
* 状态;cslb=1008
*/
@NotBlank
(
message
=
"状态不能为空"
)
private
String
zt
;
/**
* 头像
*/
private
String
avatar
;
public
String
getZhid
()
{
return
zhid
;
}
public
void
setZhid
(
String
zhid
)
{
this
.
zhid
=
zhid
==
null
?
null
:
zhid
.
trim
();
}
public
String
getZhlx
()
{
return
zhlx
;
}
public
void
setZhlx
(
String
zhlx
)
{
this
.
zhlx
=
zhlx
==
null
?
null
:
zhlx
.
trim
();
}
public
String
getXxyid
()
{
return
xxyid
;
}
public
void
setXxyid
(
String
xxyid
)
{
this
.
xxyid
=
xxyid
==
null
?
null
:
xxyid
.
trim
();
}
public
String
getXm
()
{
return
xm
;
}
public
void
setXm
(
String
xm
)
{
this
.
xm
=
xm
==
null
?
null
:
xm
.
trim
();
}
public
String
getSfzh
()
{
return
sfzh
;
}
public
void
setSfzh
(
String
sfzh
)
{
this
.
sfzh
=
sfzh
==
null
?
null
:
sfzh
.
trim
();
}
public
String
getLxdh
()
{
return
lxdh
;
}
public
void
setLxdh
(
String
lxdh
)
{
this
.
lxdh
=
lxdh
==
null
?
null
:
lxdh
.
trim
();
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
==
null
?
null
:
openid
.
trim
();
}
public
String
getNc
()
{
return
nc
;
}
public
void
setNc
(
String
nc
)
{
this
.
nc
=
nc
==
null
?
null
:
nc
.
trim
();
}
public
String
getUnionid
()
{
return
unionid
;
}
public
void
setUnionid
(
String
unionid
)
{
this
.
unionid
=
unionid
==
null
?
null
:
unionid
.
trim
();
}
public
String
getFsqbs
()
{
return
fsqbs
;
}
public
void
setFsqbs
(
String
fsqbs
)
{
this
.
fsqbs
=
fsqbs
==
null
?
null
:
fsqbs
.
trim
();
}
public
String
getAccountid
()
{
return
accountid
;
}
public
void
setAccountid
(
String
accountid
)
{
this
.
accountid
=
accountid
==
null
?
null
:
accountid
.
trim
();
}
public
String
getRoles
()
{
return
roles
;
}
public
void
setRoles
(
String
roles
)
{
this
.
roles
=
roles
==
null
?
null
:
roles
.
trim
();
}
public
String
getYqm
()
{
return
yqm
;
}
public
void
setYqm
(
String
yqm
)
{
this
.
yqm
=
yqm
==
null
?
null
:
yqm
.
trim
();
}
public
String
getYqmid
()
{
return
yqmid
;
}
public
void
setYqmid
(
String
yqmid
)
{
this
.
yqmid
=
yqmid
==
null
?
null
:
yqmid
.
trim
();
}
public
String
getClbz
()
{
return
clbz
;
}
public
void
setClbz
(
String
clbz
)
{
this
.
clbz
=
clbz
==
null
?
null
:
clbz
.
trim
();
}
public
Date
getClsj
()
{
return
clsj
;
}
public
void
setClsj
(
Date
clsj
)
{
this
.
clsj
=
clsj
;
}
public
String
getCljg
()
{
return
cljg
;
}
public
void
setCljg
(
String
cljg
)
{
this
.
cljg
=
cljg
==
null
?
null
:
cljg
.
trim
();
}
public
Date
getFhsj
()
{
return
fhsj
;
}
public
void
setFhsj
(
Date
fhsj
)
{
this
.
fhsj
=
fhsj
;
}
public
String
getOcuuid
()
{
return
ocuuid
;
}
public
void
setOcuuid
(
String
ocuuid
)
{
this
.
ocuuid
=
ocuuid
==
null
?
null
:
ocuuid
.
trim
();
}
public
String
getZhcs
()
{
return
zhcs
;
}
public
void
setZhcs
(
String
zhcs
)
{
this
.
zhcs
=
zhcs
==
null
?
null
:
zhcs
.
trim
();
}
public
String
getMchid
()
{
return
mchid
;
}
public
void
setMchid
(
String
mchid
)
{
this
.
mchid
=
mchid
==
null
?
null
:
mchid
.
trim
();
}
public
String
getZt
()
{
return
zt
;
}
public
void
setZt
(
String
zt
)
{
this
.
zt
=
zt
==
null
?
null
:
zt
.
trim
();
}
public
String
getAvatar
()
{
return
avatar
;
}
public
void
setAvatar
(
String
avatar
)
{
this
.
avatar
=
avatar
==
null
?
null
:
avatar
.
trim
();
}
}
\ No newline at end of file
src/main/java/com/zksy/szpt/domain/po/XxZhjfbg.java
View file @
70ef5110
package
com
.
zksy
.
szpt
.
domain
.
po
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.util.Date
;
public
class
XxZhjfbg
{
/**
* IID
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
private
Long
iid
;
/**
...
...
@@ -61,11 +67,13 @@ public class XxZhjfbg {
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
cjsj
;
/**
* 更新时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
gxsj
;
public
Long
getIid
()
{
...
...
src/main/java/com/zksy/szpt/domain/po/XxZhxx.java
View file @
70ef5110
package
com
.
zksy
.
szpt
.
domain
.
po
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.util.Date
;
public
class
XxZhxx
{
/**
* IID
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
private
Long
iid
;
/**
...
...
@@ -121,11 +127,13 @@ public class XxZhxx {
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
cjsj
;
/**
* 更新时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
gxsj
;
/**
...
...
src/main/java/com/zksy/szpt/handler/SzptMetaObjectHandler.java
View file @
70ef5110
...
...
@@ -22,6 +22,7 @@ public class SzptMetaObjectHandler implements MetaObjectHandler {
List
<
StrictFill
>
fields
=
Arrays
.
asList
(
StrictFill
.
of
(
"createTime"
,
Date
.
class
,
new
Date
()),
StrictFill
.
of
(
"cjsj"
,
Date
.
class
,
new
Date
()),
StrictFill
.
of
(
"gxsj"
,
Date
.
class
,
new
Date
()),
StrictFill
.
of
(
"updateTime"
,
Date
.
class
,
new
Date
()),
StrictFill
.
of
(
"sjgsdwdm"
,
String
.
class
,
"1"
),
StrictFill
.
of
(
"sjgsdwmc"
,
String
.
class
,
"1"
),
...
...
src/main/java/com/zksy/szpt/mapper/XxZhjfbgMapper.java
View file @
70ef5110
package
com
.
zksy
.
szpt
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zksy.szpt.domain.po.XxZhjfbg
;
import
com.zksy.szpt.domain.po.XxZhjfbgExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
XxZhjfbgMapper
{
public
interface
XxZhjfbgMapper
extends
BaseMapper
<
XxZhjfbg
>
{
long
countByExample
(
XxZhjfbgExample
example
);
int
deleteByExample
(
XxZhjfbgExample
example
);
int
deleteByPrimaryKey
(
Long
iid
);
int
insert
(
XxZhjfbg
record
);
//
int insert(XxZhjfbg record);
int
insertSelective
(
XxZhjfbg
record
);
...
...
src/main/java/com/zksy/szpt/mapper/XxZhxxMapper.java
View file @
70ef5110
package
com
.
zksy
.
szpt
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zksy.szpt.domain.po.XxZhxx
;
import
com.zksy.szpt.domain.po.XxZhxxExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
XxZhxxMapper
{
public
interface
XxZhxxMapper
extends
BaseMapper
<
XxZhxx
>
{
long
countByExample
(
XxZhxxExample
example
);
int
deleteByExample
(
XxZhxxExample
example
);
int
deleteByPrimaryKey
(
Long
iid
);
int
insert
(
XxZhxx
record
);
//
int insert(XxZhxx record);
int
insertSelective
(
XxZhxx
record
);
...
...
src/main/java/com/zksy/szpt/service/IndexService.java
View file @
70ef5110
...
...
@@ -21,50 +21,74 @@ public class IndexService {
@Resource
private
SzptClockInMapper
szptClockInMapper
;
public
Integer
addSzptClockIn
(
SzptClockInDTO
szptClockInDTO
){
SzptClockIn
szptClockIn
=
BeanMapperUtil
.
map
(
szptClockInDTO
,
SzptClockIn
.
class
);
public
Integer
addSzptClockIn
(
SzptClockInDTO
szptClockInDTO
)
{
SzptClockIn
szptClockIn
=
BeanMapperUtil
.
map
(
szptClockInDTO
,
SzptClockIn
.
class
);
return
szptClockInMapper
.
insert
(
szptClockIn
);
}
@Resource
private
SzptClockInRulesMapper
szptClockInRulesMapper
;
public
Integer
addSzptClockInRules
(
SzptClockInRulesDTO
szptClockInRulesDTO
){
SzptClockInRules
szptClockInRules
=
BeanMapperUtil
.
map
(
szptClockInRulesDTO
,
SzptClockInRules
.
class
);
public
Integer
addSzptClockInRules
(
SzptClockInRulesDTO
szptClockInRulesDTO
)
{
SzptClockInRules
szptClockInRules
=
BeanMapperUtil
.
map
(
szptClockInRulesDTO
,
SzptClockInRules
.
class
);
return
szptClockInRulesMapper
.
insert
(
szptClockInRules
);
}
@Resource
private
SzptFwxxMapper
szptFwxxMapper
;
public
Integer
addSzptFwxx
(
SzptFwxxDTO
szptFwxxDTO
){
SzptFwxx
szptFwxx
=
BeanMapperUtil
.
map
(
szptFwxxDTO
,
SzptFwxx
.
class
);
public
Integer
addSzptFwxx
(
SzptFwxxDTO
szptFwxxDTO
)
{
SzptFwxx
szptFwxx
=
BeanMapperUtil
.
map
(
szptFwxxDTO
,
SzptFwxx
.
class
);
return
szptFwxxMapper
.
insert
(
szptFwxx
);
}
@Resource
private
SzptGdCsyjhldxMapper
szptGdCsyjhldxMapper
;
public
Integer
addSzptGdCsyjhldx
(
SzptGdCsyjhldxDTO
szptGdCsyjhldxDTO
){
SzptGdCsyjhldx
szptGdCsyjhldx
=
BeanMapperUtil
.
map
(
szptGdCsyjhldxDTO
,
SzptGdCsyjhldx
.
class
);
public
Integer
addSzptGdCsyjhldx
(
SzptGdCsyjhldxDTO
szptGdCsyjhldxDTO
)
{
SzptGdCsyjhldx
szptGdCsyjhldx
=
BeanMapperUtil
.
map
(
szptGdCsyjhldxDTO
,
SzptGdCsyjhldx
.
class
);
return
szptGdCsyjhldxMapper
.
insert
(
szptGdCsyjhldx
);
}
@Resource
private
SzptGdRyxxMapper
szptGdRyxxMapper
;
public
Integer
addSzptGdRyxx
(
SzptGdRyxxDTO
szptGdRyxxDTO
){
SzptGdRyxx
szptGdRyxx
=
BeanMapperUtil
.
map
(
szptGdRyxxDTO
,
SzptGdRyxx
.
class
);
public
Integer
addSzptGdRyxx
(
SzptGdRyxxDTO
szptGdRyxxDTO
)
{
SzptGdRyxx
szptGdRyxx
=
BeanMapperUtil
.
map
(
szptGdRyxxDTO
,
SzptGdRyxx
.
class
);
return
szptGdRyxxMapper
.
insert
(
szptGdRyxx
);
}
@Resource
private
SzptGdSbxxMapper
szptGdSbxxMapper
;
public
Integer
addSzptGdSbxx
(
SzptGdSbxxDTO
szptGdSbxxDTO
){
SzptGdSbxx
szptGdSbxx
=
BeanMapperUtil
.
map
(
szptGdSbxxDTO
,
SzptGdSbxx
.
class
);
public
Integer
addSzptGdSbxx
(
SzptGdSbxxDTO
szptGdSbxxDTO
)
{
SzptGdSbxx
szptGdSbxx
=
BeanMapperUtil
.
map
(
szptGdSbxxDTO
,
SzptGdSbxx
.
class
);
return
szptGdSbxxMapper
.
insert
(
szptGdSbxx
);
}
@Resource
private
SzptGdXxMapper
szptGdXxMapper
;
public
Integer
addSzptGdXx
(
SzptGdXxDTO
szptGdXxDTO
){
SzptGdXx
szptGdXx
=
BeanMapperUtil
.
map
(
szptGdXxDTO
,
SzptGdXx
.
class
);
public
Integer
addSzptGdXx
(
SzptGdXxDTO
szptGdXxDTO
)
{
SzptGdXx
szptGdXx
=
BeanMapperUtil
.
map
(
szptGdXxDTO
,
SzptGdXx
.
class
);
return
szptGdXxMapper
.
insert
(
szptGdXx
);
}
@Resource
private
XxZhxxMapper
xxZhxxMapper
;
public
Integer
addXxZhxx
(
XxZhxxDTO
xxZhxxDTO
)
{
XxZhxx
xxZhxx
=
BeanMapperUtil
.
map
(
xxZhxxDTO
,
XxZhxx
.
class
);
return
xxZhxxMapper
.
insert
(
xxZhxx
);
}
@Resource
private
XxZhjfbgMapper
xxZhjfbgMapper
;
public
Integer
addXxZhjfbg
(
XxZhjfbgDTO
dto
)
{
XxZhjfbg
xxZhjfbg
=
BeanMapperUtil
.
map
(
dto
,
XxZhjfbg
.
class
);
return
xxZhjfbgMapper
.
insert
(
xxZhjfbg
);
}
}
src/test/java/com/zksy/szpt/MainTest.java
View file @
70ef5110
...
...
@@ -3,18 +3,22 @@ package com.zksy.szpt;
import
cn.hutool.crypto.digest.DigestUtil
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.zksy.szpt.domain.dto.XxRwwcqkDTO
;
import
com.zksy.szpt.domain.dto.XxZhjfbgDTO
;
import
com.zksy.szpt.domain.dto.XxZhxxDTO
;
import
com.zksy.szpt.service.AppStoreService
;
import
com.zksy.szpt.util.EncryptUtil
;
import
com.zksy.szpt.util.SignatureUtil
;
import
org.junit.jupiter.api.Assertions
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
org.junit.platform.commons.util.StringUtils
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.web.reactive.function.client.WebClient
;
import
reactor.core.publisher.Mono
;
import
javax.annotation.Resource
;
import
java.sql.Struct
;
import
java.util.Date
;
/**
* A simple unit test
...
...
@@ -22,7 +26,7 @@ import javax.annotation.Resource;
@SpringBootTest
()
public
class
MainTest
{
String
nonce
=
"2"
;
String
nonce
=
"2
121
"
;
String
timestampStr
=
"21"
;
String
appId
=
"1"
;
...
...
@@ -40,20 +44,64 @@ public class MainTest {
@DisplayName
(
"任务完成情况"
)
public
void
xxRwwcqkTest
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey);
//请求参数
XxZhxxDTO
dto
=
new
XxZhxxDTO
();
// dto.setZhid("123456");
dto
.
setXxyid
(
"123456"
);
dto
.
setZt
(
"1"
);
dto
.
setClbz
(
"1"
);
String
json
=
null
;
try
{
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/index/addXxZhxx"
)
.
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
);
}
/**
* 任务完成情况
*/
@Test
@DisplayName
(
"任务完成情况"
)
public
void
test1
()
{
timestampStr
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
nonce
=
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
String
secretKey
=
this
.
appStoreService
.
getAppSecretByAppKey
(
appId
);
Assertions
.
assertNotNull
(
secretKey
,
"appId不存在"
);
//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey);
//请求参数
XxRwwcqkDTO
xxRwwcqkDTO
=
new
XxRwwcqkDTO
();
xxRwwcqkDTO
.
setRwid
(
"123456"
);
xxRwwcqkDTO
.
setXxyid
(
"123456"
);
xxRwwcqkDTO
.
setShrid
(
"123456"
);
xxRwwcqkDTO
.
setWczt
(
"1"
);
xxRwwcqkDTO
.
setBmzt
(
"1"
);
XxZhjfbgDTO
dto
=
new
XxZhjfbgDTO
();
// dto.setZhid("123456");
dto
.
setDhid
(
"123456"
);
dto
.
setQbid
(
"1"
);
dto
.
setBgsj
(
new
Date
());
String
json
=
null
;
try
{
json
=
objectMapper
.
writeValueAsString
(
xxRwwcqkDTO
);
json
=
objectMapper
.
writeValueAsString
(
dto
);
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
}
...
...
@@ -67,12 +115,12 @@ public class MainTest {
.
baseUrl
(
"http://localhost:8086"
)
.
defaultHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
String
response
=
webClient
.
post
().
uri
(
"/rest/index/addXx
Rwwcqk
"
)
String
response
=
webClient
.
post
().
uri
(
"/rest/index/addXx
Zhjfbg
"
)
.
header
(
SignatureUtil
.
APPID
,
appId
)
.
header
(
SignatureUtil
.
NONCE
,
nonce
)
.
header
(
SignatureUtil
.
TIMESTAMP
,
timestampStr
)
.
header
(
SignatureUtil
.
SIGNATURE
,
generatedSignature
)
.
body
(
Mono
.
just
(
xxRwwcqkDTO
),
XxRwwcqk
DTO
.
class
)
.
body
(
Mono
.
just
(
dto
),
XxZhjfbg
DTO
.
class
)
.
retrieve
()
.
bodyToMono
(
String
.
class
)
.
block
();
...
...
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