Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzpay
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzpay
提交
36243e9d
提交
36243e9d
编写于
8月 28, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
zhouweidong@lab.ibiz5.com 发布系统代码
上级
0dbc5509
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
686 行增加
和
0 行删除
+686
-0
PayOpenAccessDTO.java
...pi/src/main/java/cn/ibizlab/api/dto/PayOpenAccessDTO.java
+183
-0
PayTradeDTO.java
...der-api/src/main/java/cn/ibizlab/api/dto/PayTradeDTO.java
+54
-0
PayOpenAccessMapping.java
...ain/java/cn/ibizlab/api/mapping/PayOpenAccessMapping.java
+16
-0
PayTradeMapping.java
...src/main/java/cn/ibizlab/api/mapping/PayTradeMapping.java
+16
-0
PayOpenAccessResource.java
.../main/java/cn/ibizlab/api/rest/PayOpenAccessResource.java
+159
-0
PayTradeResource.java
...i/src/main/java/cn/ibizlab/api/rest/PayTradeResource.java
+159
-0
SwaggerConfiguration.java
...rc/main/java/cn/ibizlab/swagger/SwaggerConfiguration.java
+99
-0
未找到文件。
ibzpay-provider/ibzpay-provider-api/src/main/java/cn/ibizlab/api/dto/PayOpenAccessDTO.java
0 → 100644
浏览文件 @
36243e9d
package
cn
.
ibizlab
.
api
.
dto
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.math.BigInteger
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
cn.ibizlab.util.domain.DTOBase
;
import
cn.ibizlab.util.domain.DTOClient
;
import
lombok.Data
;
/**
* 服务DTO对象[PayOpenAccessDTO]
*/
@Data
public
class
PayOpenAccessDTO
extends
DTOBase
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 属性 [ACCESSID]
*
*/
@JSONField
(
name
=
"id"
)
@JsonProperty
(
"id"
)
private
String
id
;
/**
* 属性 [ACCESSNAME]
*
*/
@JSONField
(
name
=
"name"
)
@JsonProperty
(
"name"
)
private
String
name
;
/**
* 属性 [OPEN_TYPE]
*
*/
@JSONField
(
name
=
"open_type"
)
@JsonProperty
(
"open_type"
)
private
String
openType
;
/**
* 属性 [ACCESS_KEY]
*
*/
@JSONField
(
name
=
"access_key"
)
@JsonProperty
(
"access_key"
)
private
String
accessKey
;
/**
* 属性 [SECRET_KEY]
*
*/
@JSONField
(
name
=
"secret_key"
)
@JsonProperty
(
"secret_key"
)
private
String
secretKey
;
/**
* 属性 [REGION_ID]
*
*/
@JSONField
(
name
=
"region_id"
)
@JsonProperty
(
"region_id"
)
private
String
regionId
;
/**
* 属性 [ACCESS_TOKEN]
*
*/
@JSONField
(
name
=
"access_token"
)
@JsonProperty
(
"access_token"
)
private
String
accessToken
;
/**
* 属性 [EXPIRES_TIME]
*
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
name
=
"expires_time"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"expires_time"
)
private
Timestamp
expiresTime
;
/**
* 属性 [DISABLED]
*
*/
@JSONField
(
name
=
"disabled"
)
@JsonProperty
(
"disabled"
)
private
Integer
disabled
;
/**
* 属性 [REDIRECT_URI]
*
*/
@JSONField
(
name
=
"redirect_uri"
)
@JsonProperty
(
"redirect_uri"
)
private
String
redirectUri
;
/**
* 设置 [ACCESSNAME]
*/
public
void
setName
(
String
name
){
this
.
name
=
name
;
this
.
modify
(
"accessname"
,
name
);
}
/**
* 设置 [OPEN_TYPE]
*/
public
void
setOpenType
(
String
openType
){
this
.
openType
=
openType
;
this
.
modify
(
"open_type"
,
openType
);
}
/**
* 设置 [ACCESS_KEY]
*/
public
void
setAccessKey
(
String
accessKey
){
this
.
accessKey
=
accessKey
;
this
.
modify
(
"access_key"
,
accessKey
);
}
/**
* 设置 [SECRET_KEY]
*/
public
void
setSecretKey
(
String
secretKey
){
this
.
secretKey
=
secretKey
;
this
.
modify
(
"secret_key"
,
secretKey
);
}
/**
* 设置 [REGION_ID]
*/
public
void
setRegionId
(
String
regionId
){
this
.
regionId
=
regionId
;
this
.
modify
(
"region_id"
,
regionId
);
}
/**
* 设置 [ACCESS_TOKEN]
*/
public
void
setAccessToken
(
String
accessToken
){
this
.
accessToken
=
accessToken
;
this
.
modify
(
"access_token"
,
accessToken
);
}
/**
* 设置 [EXPIRES_TIME]
*/
public
void
setExpiresTime
(
Timestamp
expiresTime
){
this
.
expiresTime
=
expiresTime
;
this
.
modify
(
"expires_time"
,
expiresTime
);
}
/**
* 设置 [DISABLED]
*/
public
void
setDisabled
(
Integer
disabled
){
this
.
disabled
=
disabled
;
this
.
modify
(
"disabled"
,
disabled
);
}
/**
* 设置 [REDIRECT_URI]
*/
public
void
setRedirectUri
(
String
redirectUri
){
this
.
redirectUri
=
redirectUri
;
this
.
modify
(
"redirect_uri"
,
redirectUri
);
}
}
ibzpay-provider/ibzpay-provider-api/src/main/java/cn/ibizlab/api/dto/PayTradeDTO.java
0 → 100644
浏览文件 @
36243e9d
package
cn
.
ibizlab
.
api
.
dto
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.math.BigInteger
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
cn.ibizlab.util.domain.DTOBase
;
import
cn.ibizlab.util.domain.DTOClient
;
import
lombok.Data
;
/**
* 服务DTO对象[PayTradeDTO]
*/
@Data
public
class
PayTradeDTO
extends
DTOBase
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 属性 [TRADEID]
*
*/
@JSONField
(
name
=
"tradeid"
)
@JsonProperty
(
"tradeid"
)
private
String
tradeid
;
/**
* 属性 [TRADENAME]
*
*/
@JSONField
(
name
=
"tradename"
)
@JsonProperty
(
"tradename"
)
private
String
tradename
;
/**
* 设置 [TRADENAME]
*/
public
void
setTradename
(
String
tradename
){
this
.
tradename
=
tradename
;
this
.
modify
(
"tradename"
,
tradename
);
}
}
ibzpay-provider/ibzpay-provider-api/src/main/java/cn/ibizlab/api/mapping/PayOpenAccessMapping.java
0 → 100644
浏览文件 @
36243e9d
package
cn
.
ibizlab
.
api
.
mapping
;
import
org.mapstruct.*
;
import
cn.ibizlab.core.pay.domain.PayOpenAccess
;
import
cn.ibizlab.api.dto.PayOpenAccessDTO
;
import
cn.ibizlab.util.domain.MappingBase
;
import
org.mapstruct.factory.Mappers
;
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
implementationName
=
"apiPayOpenAccessMapping"
,
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
public
interface
PayOpenAccessMapping
extends
MappingBase
<
PayOpenAccessDTO
,
PayOpenAccess
>
{
}
ibzpay-provider/ibzpay-provider-api/src/main/java/cn/ibizlab/api/mapping/PayTradeMapping.java
0 → 100644
浏览文件 @
36243e9d
package
cn
.
ibizlab
.
api
.
mapping
;
import
org.mapstruct.*
;
import
cn.ibizlab.core.pay.domain.PayTrade
;
import
cn.ibizlab.api.dto.PayTradeDTO
;
import
cn.ibizlab.util.domain.MappingBase
;
import
org.mapstruct.factory.Mappers
;
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
implementationName
=
"apiPayTradeMapping"
,
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
public
interface
PayTradeMapping
extends
MappingBase
<
PayTradeDTO
,
PayTrade
>
{
}
ibzpay-provider/ibzpay-provider-api/src/main/java/cn/ibizlab/api/rest/PayOpenAccessResource.java
0 → 100644
浏览文件 @
36243e9d
package
cn
.
ibizlab
.
api
.
rest
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PostAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.pay.domain.PayOpenAccess
;
import
cn.ibizlab.core.pay.service.IPayOpenAccessService
;
import
cn.ibizlab.core.pay.filter.PayOpenAccessSearchContext
;
import
cn.ibizlab.util.annotation.VersionCheck
;
@Slf4j
@Api
(
tags
=
{
"支付平台"
})
@RestController
(
"api-payopenaccess"
)
@RequestMapping
(
""
)
public
class
PayOpenAccessResource
{
@Autowired
public
IPayOpenAccessService
payopenaccessService
;
@Autowired
@Lazy
public
PayOpenAccessMapping
payopenaccessMapping
;
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Create-all')"
)
@ApiOperation
(
value
=
"新建支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"新建支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/payopenaccesses"
)
public
ResponseEntity
<
PayOpenAccessDTO
>
create
(
@RequestBody
PayOpenAccessDTO
payopenaccessdto
)
{
PayOpenAccess
domain
=
payopenaccessMapping
.
toDomain
(
payopenaccessdto
);
payopenaccessService
.
create
(
domain
);
PayOpenAccessDTO
dto
=
payopenaccessMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Create-all')"
)
@ApiOperation
(
value
=
"批量新建支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"批量新建支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/payopenaccesses/batch"
)
public
ResponseEntity
<
Boolean
>
createBatch
(
@RequestBody
List
<
PayOpenAccessDTO
>
payopenaccessdtos
)
{
payopenaccessService
.
createBatch
(
payopenaccessMapping
.
toDomain
(
payopenaccessdtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Update-all')"
)
@ApiOperation
(
value
=
"更新支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"更新支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/payopenaccesses/{payopenaccess_id}"
)
public
ResponseEntity
<
PayOpenAccessDTO
>
update
(
@PathVariable
(
"payopenaccess_id"
)
String
payopenaccess_id
,
@RequestBody
PayOpenAccessDTO
payopenaccessdto
)
{
PayOpenAccess
domain
=
payopenaccessMapping
.
toDomain
(
payopenaccessdto
);
domain
.
setId
(
payopenaccess_id
);
payopenaccessService
.
update
(
domain
);
PayOpenAccessDTO
dto
=
payopenaccessMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Update-all')"
)
@ApiOperation
(
value
=
"批量更新支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"批量更新支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/payopenaccesses/batch"
)
public
ResponseEntity
<
Boolean
>
updateBatch
(
@RequestBody
List
<
PayOpenAccessDTO
>
payopenaccessdtos
)
{
payopenaccessService
.
updateBatch
(
payopenaccessMapping
.
toDomain
(
payopenaccessdtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Remove-all')"
)
@ApiOperation
(
value
=
"删除支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"删除支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/payopenaccesses/{payopenaccess_id}"
)
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
"payopenaccess_id"
)
String
payopenaccess_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
payopenaccessService
.
remove
(
payopenaccess_id
));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Remove-all')"
)
@ApiOperation
(
value
=
"批量删除支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"批量删除支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/payopenaccesses/batch"
)
public
ResponseEntity
<
Boolean
>
removeBatch
(
@RequestBody
List
<
String
>
ids
)
{
payopenaccessService
.
removeBatch
(
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Get-all')"
)
@ApiOperation
(
value
=
"获取支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"获取支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/payopenaccesses/{payopenaccess_id}"
)
public
ResponseEntity
<
PayOpenAccessDTO
>
get
(
@PathVariable
(
"payopenaccess_id"
)
String
payopenaccess_id
)
{
PayOpenAccess
domain
=
payopenaccessService
.
get
(
payopenaccess_id
);
PayOpenAccessDTO
dto
=
payopenaccessMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"获取支付平台草稿"
,
tags
=
{
"支付平台"
},
notes
=
"获取支付平台草稿"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/payopenaccesses/getdraft"
)
public
ResponseEntity
<
PayOpenAccessDTO
>
getDraft
()
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
payopenaccessMapping
.
toDto
(
payopenaccessService
.
getDraft
(
new
PayOpenAccess
())));
}
@ApiOperation
(
value
=
"检查支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"检查支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/payopenaccesses/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKey
(
@RequestBody
PayOpenAccessDTO
payopenaccessdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
payopenaccessService
.
checkKey
(
payopenaccessMapping
.
toDomain
(
payopenaccessdto
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Save-all')"
)
@ApiOperation
(
value
=
"保存支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"保存支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/payopenaccesses/save"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
PayOpenAccessDTO
payopenaccessdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
payopenaccessService
.
save
(
payopenaccessMapping
.
toDomain
(
payopenaccessdto
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-Save-all')"
)
@ApiOperation
(
value
=
"批量保存支付平台"
,
tags
=
{
"支付平台"
},
notes
=
"批量保存支付平台"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/payopenaccesses/savebatch"
)
public
ResponseEntity
<
Boolean
>
saveBatch
(
@RequestBody
List
<
PayOpenAccessDTO
>
payopenaccessdtos
)
{
payopenaccessService
.
saveBatch
(
payopenaccessMapping
.
toDomain
(
payopenaccessdtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-searchDefault-all')"
)
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"支付平台"
}
,
notes
=
"获取数据集"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/payopenaccesses/fetchdefault"
)
public
ResponseEntity
<
List
<
PayOpenAccessDTO
>>
fetchDefault
(
PayOpenAccessSearchContext
context
)
{
Page
<
PayOpenAccess
>
domains
=
payopenaccessService
.
searchDefault
(
context
)
;
List
<
PayOpenAccessDTO
>
list
=
payopenaccessMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayOpenAccess-searchDefault-all')"
)
@ApiOperation
(
value
=
"查询数据集"
,
tags
=
{
"支付平台"
}
,
notes
=
"查询数据集"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/payopenaccesses/searchdefault"
)
public
ResponseEntity
<
Page
<
PayOpenAccessDTO
>>
searchDefault
(
@RequestBody
PayOpenAccessSearchContext
context
)
{
Page
<
PayOpenAccess
>
domains
=
payopenaccessService
.
searchDefault
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
payopenaccessMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
}
ibzpay-provider/ibzpay-provider-api/src/main/java/cn/ibizlab/api/rest/PayTradeResource.java
0 → 100644
浏览文件 @
36243e9d
package
cn
.
ibizlab
.
api
.
rest
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PostAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.pay.domain.PayTrade
;
import
cn.ibizlab.core.pay.service.IPayTradeService
;
import
cn.ibizlab.core.pay.filter.PayTradeSearchContext
;
import
cn.ibizlab.util.annotation.VersionCheck
;
@Slf4j
@Api
(
tags
=
{
"支付交易"
})
@RestController
(
"api-paytrade"
)
@RequestMapping
(
""
)
public
class
PayTradeResource
{
@Autowired
public
IPayTradeService
paytradeService
;
@Autowired
@Lazy
public
PayTradeMapping
paytradeMapping
;
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Create-all')"
)
@ApiOperation
(
value
=
"新建支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"新建支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/paytrades"
)
public
ResponseEntity
<
PayTradeDTO
>
create
(
@RequestBody
PayTradeDTO
paytradedto
)
{
PayTrade
domain
=
paytradeMapping
.
toDomain
(
paytradedto
);
paytradeService
.
create
(
domain
);
PayTradeDTO
dto
=
paytradeMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Create-all')"
)
@ApiOperation
(
value
=
"批量新建支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"批量新建支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/paytrades/batch"
)
public
ResponseEntity
<
Boolean
>
createBatch
(
@RequestBody
List
<
PayTradeDTO
>
paytradedtos
)
{
paytradeService
.
createBatch
(
paytradeMapping
.
toDomain
(
paytradedtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Update-all')"
)
@ApiOperation
(
value
=
"更新支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"更新支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/paytrades/{paytrade_id}"
)
public
ResponseEntity
<
PayTradeDTO
>
update
(
@PathVariable
(
"paytrade_id"
)
String
paytrade_id
,
@RequestBody
PayTradeDTO
paytradedto
)
{
PayTrade
domain
=
paytradeMapping
.
toDomain
(
paytradedto
);
domain
.
setTradeid
(
paytrade_id
);
paytradeService
.
update
(
domain
);
PayTradeDTO
dto
=
paytradeMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Update-all')"
)
@ApiOperation
(
value
=
"批量更新支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"批量更新支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/paytrades/batch"
)
public
ResponseEntity
<
Boolean
>
updateBatch
(
@RequestBody
List
<
PayTradeDTO
>
paytradedtos
)
{
paytradeService
.
updateBatch
(
paytradeMapping
.
toDomain
(
paytradedtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Remove-all')"
)
@ApiOperation
(
value
=
"删除支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"删除支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/paytrades/{paytrade_id}"
)
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
"paytrade_id"
)
String
paytrade_id
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
paytradeService
.
remove
(
paytrade_id
));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Remove-all')"
)
@ApiOperation
(
value
=
"批量删除支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"批量删除支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/paytrades/batch"
)
public
ResponseEntity
<
Boolean
>
removeBatch
(
@RequestBody
List
<
String
>
ids
)
{
paytradeService
.
removeBatch
(
ids
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Get-all')"
)
@ApiOperation
(
value
=
"获取支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"获取支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/paytrades/{paytrade_id}"
)
public
ResponseEntity
<
PayTradeDTO
>
get
(
@PathVariable
(
"paytrade_id"
)
String
paytrade_id
)
{
PayTrade
domain
=
paytradeService
.
get
(
paytrade_id
);
PayTradeDTO
dto
=
paytradeMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"获取支付交易草稿"
,
tags
=
{
"支付交易"
},
notes
=
"获取支付交易草稿"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/paytrades/getdraft"
)
public
ResponseEntity
<
PayTradeDTO
>
getDraft
()
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
paytradeMapping
.
toDto
(
paytradeService
.
getDraft
(
new
PayTrade
())));
}
@ApiOperation
(
value
=
"检查支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"检查支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/paytrades/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKey
(
@RequestBody
PayTradeDTO
paytradedto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
paytradeService
.
checkKey
(
paytradeMapping
.
toDomain
(
paytradedto
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Save-all')"
)
@ApiOperation
(
value
=
"保存支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"保存支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/paytrades/save"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
PayTradeDTO
paytradedto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
paytradeService
.
save
(
paytradeMapping
.
toDomain
(
paytradedto
)));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-Save-all')"
)
@ApiOperation
(
value
=
"批量保存支付交易"
,
tags
=
{
"支付交易"
},
notes
=
"批量保存支付交易"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/paytrades/savebatch"
)
public
ResponseEntity
<
Boolean
>
saveBatch
(
@RequestBody
List
<
PayTradeDTO
>
paytradedtos
)
{
paytradeService
.
saveBatch
(
paytradeMapping
.
toDomain
(
paytradedtos
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-searchDefault-all')"
)
@ApiOperation
(
value
=
"获取数据集"
,
tags
=
{
"支付交易"
}
,
notes
=
"获取数据集"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/paytrades/fetchdefault"
)
public
ResponseEntity
<
List
<
PayTradeDTO
>>
fetchDefault
(
PayTradeSearchContext
context
)
{
Page
<
PayTrade
>
domains
=
paytradeService
.
searchDefault
(
context
)
;
List
<
PayTradeDTO
>
list
=
paytradeMapping
.
toDto
(
domains
.
getContent
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzpay-PayTrade-searchDefault-all')"
)
@ApiOperation
(
value
=
"查询数据集"
,
tags
=
{
"支付交易"
}
,
notes
=
"查询数据集"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/paytrades/searchdefault"
)
public
ResponseEntity
<
Page
<
PayTradeDTO
>>
searchDefault
(
@RequestBody
PayTradeSearchContext
context
)
{
Page
<
PayTrade
>
domains
=
paytradeService
.
searchDefault
(
context
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
new
PageImpl
(
paytradeMapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
}
ibzpay-provider/ibzpay-provider-api/src/main/java/cn/ibizlab/swagger/SwaggerConfiguration.java
0 → 100644
浏览文件 @
36243e9d
package
cn
.
ibizlab
.
swagger
;
import
cn.ibizlab.util.security.SpringContextHolder
;
import
cn.ibizlab.util.web.IBZOperationParameterReader
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.plugin.core.PluginRegistry
;
import
org.springframework.plugin.core.PluginRegistrySupport
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spi.schema.EnumTypeDeterminer
;
import
springfox.documentation.spi.service.OperationBuilderPlugin
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.spring.web.readers.operation.OperationParameterReader
;
import
springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.List
;
@Configuration
@EnableSwagger2
@ConditionalOnExpression
(
"${swagger.enable:false}"
)
public
class
SwaggerConfiguration
{
@Bean
public
Docket
docket
()
{
Docket
docket
=
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
groupName
(
"DEFAULT"
)
.
pathMapping
(
"/"
)
.
apiInfo
(
new
ApiInfoBuilder
()
.
title
(
"DEFAULT"
)
.
build
()
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"cn.ibizlab"
))
//.paths(or(regex("/rest/.*")))
.
paths
(
PathSelectors
.
any
())
.
build
()
;
removeDefaultPlugin
();
return
docket
;
}
@Bean
public
Docket
apiDocket
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
groupName
(
"microservice"
)
.
pathMapping
(
"/"
)
.
apiInfo
(
new
ApiInfoBuilder
()
.
title
(
"microservice"
)
.
version
(
"1"
)
.
build
()
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"cn.ibizlab.api"
))
//.paths(or(regex("/rest/api/.*")))
.
paths
(
PathSelectors
.
any
())
.
build
()
;
}
private
void
removeDefaultPlugin
()
{
// 从spring容器中获取swagger插件注册表
PluginRegistry
<
OperationBuilderPlugin
,
DocumentationType
>
pluginRegistry
=
SpringContextHolder
.
getBean
(
"operationBuilderPluginRegistry"
);
// 插件集合
List
<
OperationBuilderPlugin
>
plugins
=
pluginRegistry
.
getPlugins
();
// 从spring容器中获取需要删除的插件
OperationParameterReader
operationParameterReader
=
SpringContextHolder
.
getBean
(
OperationParameterReader
.
class
);
if
(
operationParameterReader
==
null
)
return
;
// 原plugins集合不能修改,创建新集合,通过反射替换
if
(
pluginRegistry
.
contains
(
operationParameterReader
))
{
List
<
OperationBuilderPlugin
>
plugins_new
=
new
ArrayList
<
OperationBuilderPlugin
>(
plugins
);
plugins_new
.
remove
(
operationParameterReader
);
try
{
Field
field
=
PluginRegistrySupport
.
class
.
getDeclaredField
(
"plugins"
);
field
.
setAccessible
(
true
);
field
.
set
(
pluginRegistry
,
plugins_new
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
@Bean
public
IBZOperationParameterReader
iBZOperationParameterReader
(
ModelAttributeParameterExpander
expander
,
EnumTypeDeterminer
enumTypeDeterminer
){
IBZOperationParameterReader
iBZOperationParameterReader
=
new
IBZOperationParameterReader
(
expander
,
enumTypeDeterminer
)
;
return
iBZOperationParameterReader
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录