Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Jeepay
Commits
de3de82d
Commit
de3de82d
authored
Jun 09, 2021
by
dingzhiwei
Browse files
初始化Jeepay项目
parent
40dcaf4a
Changes
896
Show whitespace changes
Inline
Side-by-side
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/PayInterfaceConfig.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jeequan.jeepay.core.model.BaseModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* <p>
* 支付接口配置参数表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_pay_interface_config"
)
public
class
PayInterfaceConfig
extends
BaseModel
implements
Serializable
{
public
static
final
LambdaQueryWrapper
<
PayInterfaceConfig
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* ID
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 账号类型:1-服务商 2-商户
*/
private
Byte
infoType
;
/**
* 服务商或商户No
*/
private
String
infoId
;
/**
* 支付接口代码
*/
private
String
ifCode
;
/**
* 接口配置参数,json字符串
*/
private
String
ifParams
;
/**
* 支付接口费率
*/
private
BigDecimal
ifRate
;
/**
* 状态: 0-停用, 1-启用
*/
private
Byte
state
;
/**
* 备注
*/
private
String
remark
;
/**
* 创建者用户ID
*/
private
Long
createdUid
;
/**
* 创建者姓名
*/
private
String
createdBy
;
/**
* 创建时间
*/
private
Date
createdAt
;
/**
* 更新者用户ID
*/
private
Long
updatedUid
;
/**
* 更新者姓名
*/
private
String
updatedBy
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/PayInterfaceDefine.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler
;
import
com.jeequan.jeepay.core.model.BaseModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 支付接口定义表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"t_pay_interface_define"
,
autoResultMap
=
true
)
public
class
PayInterfaceDefine
extends
BaseModel
implements
Serializable
{
public
static
final
LambdaQueryWrapper
<
PayInterfaceDefine
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 接口代码 全小写 wxpay alipay
*/
@TableId
private
String
ifCode
;
/**
* 接口名称
*/
private
String
ifName
;
/**
* 是否支持普通商户模式: 0-不支持, 1-支持
*/
private
Byte
isMchMode
;
/**
* 是否支持服务商子商户模式: 0-不支持, 1-支持
*/
private
Byte
isIsvMode
;
/**
* ISV接口配置定义描述,json字符串
*/
private
String
isvParams
;
/**
* 特约商户接口配置定义描述,json字符串
*/
private
String
isvsubMchParams
;
/**
* 普通商户接口配置定义描述,json字符串
*/
private
String
normalMchParams
;
/**
* 支持的支付方式 ["wxpay_jsapi", "wxpay_bar"]
*/
@TableField
(
typeHandler
=
FastjsonTypeHandler
.
class
)
private
JSONArray
wayCodes
;
/**
* 页面展示:卡片-图标
*/
private
String
icon
;
/**
* 页面展示:卡片-背景色
*/
private
String
bgColor
;
/**
* 状态: 0-停用, 1-启用
*/
private
Byte
state
;
/**
* 备注
*/
private
String
remark
;
/**
* 创建时间
*/
private
Date
createdAt
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/PayOrder.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jeequan.jeepay.core.model.BaseModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 支付订单表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_pay_order"
)
public
class
PayOrder
extends
BaseModel
implements
Serializable
{
public
static
final
LambdaQueryWrapper
<
PayOrder
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
byte
STATE_INIT
=
0
;
//订单生成
public
static
final
byte
STATE_ING
=
1
;
//支付中
public
static
final
byte
STATE_SUCCESS
=
2
;
//支付成功
public
static
final
byte
STATE_FAIL
=
3
;
//支付失败
public
static
final
byte
STATE_CANCEL
=
4
;
//已撤销
public
static
final
byte
STATE_REFUND
=
5
;
//已退款
public
static
final
byte
STATE_CLOSED
=
6
;
//订单关闭
/**
* 支付订单号
*/
@TableId
private
String
payOrderId
;
/**
* 商户号
*/
private
String
mchNo
;
/**
* 服务商号
*/
private
String
isvNo
;
/**
* 商户名称
*/
private
String
mchName
;
/**
* 类型: 1-普通商户, 2-特约商户(服务商模式)
*/
private
Byte
mchType
;
/**
* 商户订单号
*/
private
String
mchOrderNo
;
/**
* 支付接口代码
*/
private
String
ifCode
;
/**
* 支付方式代码
*/
private
String
wayCode
;
/**
* 支付金额,单位分
*/
private
Long
amount
;
/**
* 三位货币代码,人民币:cny
*/
private
String
currency
;
/**
* 支付状态: 0-订单生成, 1-支付中, 2-支付成功, 3-支付失败, 4-已撤销, 5-已退款, 6-订单关闭
*/
private
Byte
state
;
/**
* 向下游回调状态, 0-未发送, 1-已发送
*/
private
Byte
notifyState
;
/**
* 客户端IP
*/
private
String
clientIp
;
/**
* 商品标题
*/
private
String
subject
;
/**
* 商品描述信息
*/
private
String
body
;
/**
* 特定渠道发起额外参数
*/
private
String
channelExtra
;
/**
* 渠道用户标识,如微信openId,支付宝账号
*/
private
String
channelUser
;
/**
* 渠道订单号
*/
private
String
channelOrderNo
;
/**
* 退款次数
*/
private
Integer
refundTimes
;
/**
* 退款总金额,单位分
*/
private
Long
refundAmount
;
/**
* 订单分账标志:0-否 1-是
*/
private
Byte
divisionFlag
;
/**
* 预计分账发起时间
*/
private
Date
divisionTime
;
/**
* 渠道支付错误码
*/
private
String
errCode
;
/**
* 渠道支付错误描述
*/
private
String
errMsg
;
/**
* 商户扩展参数
*/
private
String
extParam
;
/**
* 异步通知地址
*/
private
String
notifyUrl
;
/**
* 页面跳转地址
*/
private
String
returnUrl
;
/**
* 订单失效时间
*/
private
Date
expiredTime
;
/**
* 订单支付成功时间
*/
private
Date
successTime
;
/**
* 创建时间
*/
private
Date
createdAt
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/PayWay.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jeequan.jeepay.core.model.BaseModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 支付方式表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_pay_way"
)
public
class
PayWay
extends
BaseModel
implements
Serializable
{
public
static
final
LambdaQueryWrapper
<
PayWay
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 支付方式代码 例如: wxpay_jsapi
*/
@TableId
private
String
wayCode
;
/**
* 支付方式名称
*/
private
String
wayName
;
/**
* 创建时间
*/
private
Date
createdAt
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/RefundOrder.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jeequan.jeepay.core.model.BaseModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 退款订单表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_refund_order"
)
public
class
RefundOrder
extends
BaseModel
implements
Serializable
{
public
static
final
LambdaQueryWrapper
<
RefundOrder
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 退款订单号
*/
@TableId
private
String
refundOrderId
;
/**
* 支付订单号
*/
private
String
payOrderId
;
/**
* 渠道支付单号
*/
private
String
channelPayOrderNo
;
/**
* 商户号
*/
private
String
mchNo
;
/**
* 类型: 1-普通商户, 2-特约商户(服务商模式)
*/
private
Byte
mchType
;
/**
* 商户退款单号
*/
private
String
mchRefundNo
;
/**
* 服务商号
*/
private
String
isvNo
;
/**
* 支付方式代码
*/
private
String
wayCode
;
/**
* 支付接口代码
*/
private
String
ifCode
;
/**
* 支付金额,单位分
*/
private
Long
payAmount
;
/**
* 退款金额,单位分
*/
private
Long
refundAmount
;
/**
* 三位货币代码,人民币:cny
*/
private
String
currency
;
/**
* 退款状态:0-订单生成,1-退款中,2-退款成功,3-退款失败
*/
private
Byte
state
;
/**
* 退款结果:0-不确认结果,1-等待手动处理,2-确认成功,3-确认失败
*/
private
Byte
result
;
/**
* 客户端IP
*/
private
String
clientIp
;
/**
* 备注
*/
private
String
remark
;
/**
* 渠道订单号
*/
private
String
channelOrderNo
;
/**
* 渠道错误码
*/
private
String
channelErrCode
;
/**
* 渠道错误描述
*/
private
String
channelErrMsg
;
/**
* 特定渠道发起时额外参数
*/
private
String
channelExtra
;
/**
* 通知地址
*/
private
String
notifyUrl
;
/**
* 扩展参数
*/
private
String
extParam
;
/**
* 订单退款成功时间
*/
private
Date
successTime
;
/**
* 创建时间
*/
private
Date
createdAt
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/SysConfig.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jeequan.jeepay.core.model.BaseModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 系统配置表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-23
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_sys_config"
)
public
class
SysConfig
extends
BaseModel
implements
Serializable
{
//gw
public
static
final
LambdaQueryWrapper
<
SysConfig
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 配置KEY
*/
@TableId
(
value
=
"config_key"
,
type
=
IdType
.
INPUT
)
private
String
configKey
;
/**
* 配置名称
*/
private
String
configName
;
/**
* 描述信息
*/
private
String
configDesc
;
/**
* 分组key
*/
private
String
groupKey
;
/**
* 分组名称
*/
private
String
groupName
;
/**
* 配置内容项
*/
private
String
configVal
;
/**
* 类型: text-输入框, textarea-多行文本, uploadImg-上传图片, switch-开关
*/
private
String
type
;
/**
* 显示顺序
*/
private
Long
sortNum
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/SysEntitlement.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jeequan.jeepay.core.model.BaseModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
* <p>
* 系统权限表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-23
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_sys_entitlement"
)
public
class
SysEntitlement
extends
BaseModel
{
//gw
public
static
final
LambdaQueryWrapper
<
SysEntitlement
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 权限ID[ENT_功能模块_子模块_操作], eg: ENT_ROLE_LIST_ADD
*/
@TableId
private
String
entId
;
/**
* 权限名称
*/
private
String
entName
;
/**
* 菜单图标
*/
private
String
menuIcon
;
/**
* 菜单uri/路由地址
*/
private
String
menuUri
;
/**
* 组件Name(前后端分离使用)
*/
private
String
componentName
;
/**
* 权限类型 ML-左侧显示菜单, MO-其他菜单, PB-页面/按钮
*/
private
String
entType
;
/**
* 快速开始菜单 0-否, 1-是
*/
private
Byte
quickJump
;
/**
* 状态 0-停用, 1-启用
*/
private
Byte
state
;
/**
* 父ID
*/
private
String
pid
;
/**
* 排序字段, 规则:正序
*/
private
Integer
entSort
;
/**
* 所属系统: MGR-运营平台, MCH-商户中心
*/
private
String
system
;
/**
* 创建时间
*/
private
Date
createdAt
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/SysLog.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 系统操作日志表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_sys_log"
)
public
class
SysLog
implements
Serializable
{
public
static
final
LambdaQueryWrapper
<
SysLog
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* id
*/
@TableId
(
value
=
"sys_log_id"
,
type
=
IdType
.
AUTO
)
private
Integer
sysLogId
;
/**
* 系统用户ID
*/
private
Long
userId
;
/**
* 用户姓名
*/
private
String
userName
;
/**
* 用户IP
*/
private
String
userIp
;
/**
* 所属系统: MGR-运营平台, MCH-商户中心
*/
private
String
system
;
/**
* 方法名
*/
private
String
methodName
;
/**
* 方法描述
*/
private
String
methodRemark
;
/**
* 请求地址
*/
private
String
reqUrl
;
/**
* 操作请求参数
*/
private
String
optReqParam
;
/**
* 操作响应结果
*/
private
String
optResInfo
;
/**
* 创建时间
*/
private
Date
createdAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/SysRole.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 系统角色表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-23
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_sys_role"
)
public
class
SysRole
implements
Serializable
{
//gw
public
static
final
LambdaQueryWrapper
<
SysRole
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 角色ID, ROLE_开头
*/
@TableId
private
String
roleId
;
/**
* 角色名称
*/
private
String
roleName
;
/**
* 所属系统: MGR-运营平台, MCH-商户中心
*/
private
String
system
;
/**
* 所属商户ID / 0(平台)
*/
private
String
belongInfoId
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/SysRoleEntRela.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* <p>
* 系统角色权限关联表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-23
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_sys_role_ent_rela"
)
public
class
SysRoleEntRela
implements
Serializable
{
//gw
public
static
final
LambdaQueryWrapper
<
SysRoleEntRela
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 角色ID
*/
private
String
roleId
;
/**
* 权限ID
*/
private
String
entId
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/SysUser.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jeequan.jeepay.core.model.BaseModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
* <p>
* 系统用户表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-23
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_sys_user"
)
public
class
SysUser
extends
BaseModel
{
//gw
public
static
final
LambdaQueryWrapper
<
SysUser
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 系统用户ID
*/
@TableId
(
value
=
"sys_user_id"
,
type
=
IdType
.
AUTO
)
private
Long
sysUserId
;
/**
* 登录用户名
*/
private
String
loginUsername
;
/**
* 真实姓名
*/
private
String
realname
;
/**
* 手机号
*/
private
String
telphone
;
/**
* 性别 0-未知, 1-男, 2-女
*/
private
Byte
sex
;
/**
* 头像地址
*/
private
String
avatarUrl
;
/**
* 员工编号
*/
private
String
userNo
;
/**
* 是否超管(超管拥有全部权限) 0-否 1-是
*/
private
Byte
isAdmin
;
/**
* 状态 0-停用 1-启用
*/
private
Byte
state
;
/**
* 所属系统: MGR-运营平台, MCH-商户中心
*/
private
String
system
;
/**
* 所属商户ID / 0(平台)
*/
private
String
belongInfoId
;
/**
* 创建时间
*/
private
Date
createdAt
;
/**
* 更新时间
*/
private
Date
updatedAt
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/SysUserAuth.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* <p>
* 系统用户认证表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-23
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_sys_user_auth"
)
public
class
SysUserAuth
implements
Serializable
{
//gw
public
static
final
LambdaQueryWrapper
<
SysUserAuth
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* ID
*/
@TableId
(
value
=
"auth_id"
,
type
=
IdType
.
AUTO
)
private
Long
authId
;
/**
* user_id
*/
private
Long
userId
;
/**
* 登录类型 1-昵称 2-手机号 3-邮箱 10-微信 11-QQ 12-支付宝 13-微博
*/
private
Byte
identityType
;
/**
* 认证标识 ( 用户名 | open_id )
*/
private
String
identifier
;
/**
* 密码凭证
*/
private
String
credential
;
/**
* salt
*/
private
String
salt
;
/**
* 所属系统: MGR-运营平台, MCH-商户中心
*/
private
String
system
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/SysUserRoleRela.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* <p>
* 操作员<->角色 关联表
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-23
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"t_sys_user_role_rela"
)
public
class
SysUserRoleRela
implements
Serializable
{
//gw
public
static
final
LambdaQueryWrapper
<
SysUserRoleRela
>
gw
(){
return
new
LambdaQueryWrapper
<>();
}
private
static
final
long
serialVersionUID
=
1L
;
/**
* 用户ID
*/
private
Long
userId
;
/**
* 角色ID
*/
private
String
roleId
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/exception/BizException.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.exception
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
lombok.Getter
;
/*
* 自定义业务异常
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:33
*/
@Getter
public
class
BizException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
private
ApiRes
apiRes
;
/** 业务自定义异常 **/
public
BizException
(
String
msg
)
{
super
(
msg
);
this
.
apiRes
=
ApiRes
.
customFail
(
msg
);
}
public
BizException
(
ApiCodeEnum
apiCodeEnum
,
String
...
params
)
{
super
();
apiRes
=
ApiRes
.
fail
(
apiCodeEnum
,
params
);
}
public
BizException
(
ApiRes
apiRes
)
{
super
(
apiRes
.
getMsg
());
this
.
apiRes
=
apiRes
;
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/exception/BizExceptionResolver.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.exception
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/*
* 异常信息自定义返回数据
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:30
*/
@Configuration
public
class
BizExceptionResolver
implements
HandlerExceptionResolver
{
private
Logger
logger
=
LogManager
.
getLogger
(
BizExceptionResolver
.
class
);
@Override
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
{
// 是否包含ss框架
boolean
hasSpringSecurity
=
false
;
try
{
hasSpringSecurity
=
Class
.
forName
(
"org.springframework.security.access.AccessDeniedException"
)
!=
null
;
}
catch
(
Exception
e
)
{
}
String
outPutJson
;
//业务异常
if
(
ex
instanceof
BizException
)
{
logger
.
error
(
"公共捕捉[Biz]异常:{}"
,
ex
.
getMessage
());
outPutJson
=
((
BizException
)
ex
).
getApiRes
().
toJSONString
();
}
else
if
(
ex
instanceof
DataAccessException
){
logger
.
error
(
"公共捕捉[DataAccessException]异常:"
,
ex
);
outPutJson
=
ApiRes
.
fail
(
ApiCodeEnum
.
DB_ERROR
).
toJSONString
();
}
else
if
(
hasSpringSecurity
&&
ex
instanceof
org
.
springframework
.
security
.
access
.
AccessDeniedException
)
{
logger
.
error
(
"公共捕捉[AccessDeniedException]异常:"
,
ex
);
outPutJson
=
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_PERMISSION_ERROR
,
ex
.
getMessage
()).
toJSONString
();
}
else
{
logger
.
error
(
"公共捕捉[Exception]异常:"
,
ex
);
outPutJson
=
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
,
ex
.
getMessage
()).
toJSONString
();
}
try
{
this
.
outPutJson
(
response
,
outPutJson
);
}
catch
(
IOException
e
)
{
logger
.
error
(
"输出错误信息异常:"
,
e
);
}
return
new
ModelAndView
();
}
public
void
outPutJson
(
HttpServletResponse
res
,
String
jsonStr
)
throws
IOException
{
res
.
setContentType
(
"text/json;charset=utf-8"
);
res
.
getWriter
().
write
(
jsonStr
);
res
.
getWriter
().
flush
();
res
.
getWriter
().
close
();
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/exception/ResponseException.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.exception
;
import
lombok.Getter
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
/*
* 响应异常, 一般用于支付接口回调函数
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:31
*/
@Getter
public
class
ResponseException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
private
ResponseEntity
responseEntity
;
/** 业务自定义异常 **/
public
ResponseException
(
ResponseEntity
resp
)
{
super
();
this
.
responseEntity
=
resp
;
}
/** 生成文本类型的响应 **/
public
static
ResponseException
buildText
(
String
text
){
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
setContentType
(
MediaType
.
TEXT_HTML
);
ResponseEntity
entity
=
new
ResponseEntity
(
text
,
httpHeaders
,
HttpStatus
.
OK
);
return
new
ResponseException
(
entity
);
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/jwt/JWTPayload.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.jwt
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.model.security.JeeUserDetails
;
import
lombok.Data
;
import
java.util.Map
;
/*
* JWT payload 载体
* 格式:
{
"sysUserId": "10001",
"created": "1568250147846",
"cacheKey": "KEYKEYKEYKEY",
}
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 18:01
*/
@Data
public
class
JWTPayload
{
private
Long
sysUserId
;
//登录用户ID
private
Long
created
;
//创建时间, 格式:13位时间戳
private
String
cacheKey
;
//redis保存的key
protected
JWTPayload
(){}
public
JWTPayload
(
JeeUserDetails
jeeUserDetails
){
this
.
setSysUserId
(
jeeUserDetails
.
getSysUser
().
getSysUserId
());
this
.
setCreated
(
System
.
currentTimeMillis
());
this
.
setCacheKey
(
jeeUserDetails
.
getCacheKey
());
}
/** toMap **/
public
Map
<
String
,
Object
>
toMap
(){
JSONObject
json
=
(
JSONObject
)
JSONObject
.
toJSON
(
this
);
return
json
.
toJavaObject
(
Map
.
class
);
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/jwt/JWTUtils.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.jwt
;
import
io.jsonwebtoken.Claims
;
import
io.jsonwebtoken.Jwts
;
import
io.jsonwebtoken.SignatureAlgorithm
;
/*
* JWT工具包
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:32
*/
public
class
JWTUtils
{
/** 生成token **/
public
static
String
generateToken
(
JWTPayload
jwtPayload
,
String
jwtSecret
)
{
return
Jwts
.
builder
()
.
setClaims
(
jwtPayload
.
toMap
())
//过期时间 = 当前时间 + (设置过期时间[单位 :s ] ) token放置redis 过期时间无意义
//.setExpiration(new Date(System.currentTimeMillis() + (jwtExpiration * 1000) ))
.
signWith
(
SignatureAlgorithm
.
HS512
,
jwtSecret
)
.
compact
();
}
/** 根据token与秘钥 解析token并转换为 JWTPayload **/
public
static
JWTPayload
parseToken
(
String
token
,
String
secret
){
try
{
Claims
claims
=
Jwts
.
parser
().
setSigningKey
(
secret
).
parseClaimsJws
(
token
).
getBody
();
JWTPayload
result
=
new
JWTPayload
();
result
.
setSysUserId
(
claims
.
get
(
"sysUserId"
,
Long
.
class
));
result
.
setCreated
(
claims
.
get
(
"created"
,
Long
.
class
));
result
.
setCacheKey
(
claims
.
get
(
"cacheKey"
,
String
.
class
));
return
result
;
}
catch
(
Exception
e
)
{
return
null
;
//解析失败
}
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/ApiRes.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.model
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.utils.JeepayKit
;
import
com.jeequan.jeepay.core.utils.JsonKit
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
/*
* 接口返回对象
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:35
*/
@Data
@AllArgsConstructor
public
class
ApiRes
{
/** 业务响应码 **/
private
Integer
code
;
/** 业务响应信息 **/
private
String
msg
;
/** 数据对象 **/
private
Object
data
;
/** 签名值 **/
private
String
sign
;
/** 输出json格式字符串 **/
public
String
toJSONString
(){
return
JSON
.
toJSONString
(
this
);
}
/** 业务处理成功 **/
public
static
ApiRes
ok
(){
return
ok
(
null
);
}
/** 业务处理成功 **/
public
static
ApiRes
ok
(
Object
data
){
return
new
ApiRes
(
ApiCodeEnum
.
SUCCESS
.
getCode
(),
ApiCodeEnum
.
SUCCESS
.
getMsg
(),
data
,
null
);
}
/** 业务处理成功, 自动签名 **/
public
static
ApiRes
okWithSign
(
Object
data
,
String
mchKey
){
if
(
data
==
null
){
return
new
ApiRes
(
ApiCodeEnum
.
SUCCESS
.
getCode
(),
ApiCodeEnum
.
SUCCESS
.
getMsg
(),
null
,
null
);
}
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
data
);
String
sign
=
JeepayKit
.
getSign
(
jsonObject
,
mchKey
);
return
new
ApiRes
(
ApiCodeEnum
.
SUCCESS
.
getCode
(),
ApiCodeEnum
.
SUCCESS
.
getMsg
(),
data
,
sign
);
}
/** 业务处理成功, 返回简单json格式 **/
public
static
ApiRes
ok4newJson
(
String
key
,
Object
val
){
return
ok
(
JsonKit
.
newJson
(
key
,
val
));
}
/** 业务处理成功, 封装分页数据, 仅返回必要参数 **/
public
static
ApiRes
page
(
IPage
iPage
){
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"records"
,
iPage
.
getRecords
());
//记录明细
result
.
put
(
"total"
,
iPage
.
getTotal
());
//总条数
result
.
put
(
"current"
,
iPage
.
getCurrent
());
//当前页码
result
.
put
(
"hasNext"
,
iPage
.
getPages
()
>
iPage
.
getCurrent
()
);
//是否有下一页
return
ok
(
result
);
}
/** 业务处理失败 **/
public
static
ApiRes
fail
(
ApiCodeEnum
apiCodeEnum
,
String
...
params
){
if
(
params
==
null
||
params
.
length
<=
0
){
return
new
ApiRes
(
apiCodeEnum
.
getCode
(),
apiCodeEnum
.
getMsg
(),
null
,
null
);
}
return
new
ApiRes
(
apiCodeEnum
.
getCode
(),
String
.
format
(
apiCodeEnum
.
getMsg
(),
params
),
null
,
null
);
}
/** 自定义错误信息, 原封不用的返回输入的错误信息 **/
public
static
ApiRes
customFail
(
String
customMsg
){
return
new
ApiRes
(
ApiCodeEnum
.
CUSTOM_FAIL
.
getCode
(),
customMsg
,
null
,
null
);
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/BaseModel.java
0 → 100644
View file @
de3de82d
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.core.model
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
java.io.Serializable
;
/*
* BaseModel 封装公共处理函数
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:49
*/
public
class
BaseModel
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** ext参数, 用作扩展参数, 会在转换为api数据时自动将ext全部属性放置在对象的主属性上, 并且不包含ext属性 **/
/** api接口扩展字段, 当包含该字段时 将自动填充到实体对象属性中如{id:1, ext:{abc:222}} 则自动转换为: {id:1, abc:222},
* 需配合ResponseBodyAdvice使用
* **/
@TableField
(
exist
=
false
)
private
JSONObject
ext
;
//获取的时候设置默认值
public
JSONObject
getExt
()
{
return
ext
;
}
//设置扩展字段
public
BaseModel
addExt
(
String
key
,
Object
val
)
{
if
(
ext
==
null
)
ext
=
new
JSONObject
();
ext
.
put
(
key
,
val
);
return
this
;
}
/** get ext value 可直接使用JSONObject对象的函数 **/
public
JSONObject
extv
()
{
return
ext
==
null
?
new
JSONObject
()
:
ext
;
}
}
Prev
1
2
3
4
5
6
…
45
Next
Write
Preview
Supports
Markdown
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