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
453
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 453+
files are displayed.
Plain diff
Email patch
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/DBApplicationConfig.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
cn.hutool.core.util.URLUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.utils.JeepayKit
;
import
lombok.Data
;
import
java.io.Serializable
;
/*
* 系统应用配置项定义Bean
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:35
*/
@Data
public
class
DBApplicationConfig
implements
Serializable
{
/** 运营系统地址 **/
private
String
mgrSiteUrl
;
/** 商户系统地址 **/
private
String
mchSiteUrl
;
/** 支付网关地址 **/
private
String
paySiteUrl
;
/** oss公共读文件地址 **/
private
String
ossPublicSiteUrl
;
/** 生成 【jsapi统一收银台跳转地址】 **/
public
String
genUniJsapiPayUrl
(
String
payOrderId
){
return
getPaySiteUrl
()
+
"/cashier/index.html#/hub/"
+
JeepayKit
.
aesEncode
(
payOrderId
);
}
/** 生成 【jsapi统一收银台】oauth2获取用户ID回调地址 **/
public
String
genOauth2RedirectUrlEncode
(
String
payOrderId
){
return
URLUtil
.
encode
(
getPaySiteUrl
()
+
"/cashier/index.html#/oauth2Callback/"
+
JeepayKit
.
aesEncode
(
payOrderId
));
}
/** 生成 【商户获取渠道用户ID接口】oauth2获取用户ID回调地址 **/
public
String
genMchChannelUserIdApiOauth2RedirectUrlEncode
(
JSONObject
param
){
return
URLUtil
.
encode
(
getPaySiteUrl
()
+
"/api/channelUserId/oauth2Callback/"
+
JeepayKit
.
aesEncode
(
param
.
toJSONString
()));
}
/** 生成 【jsapi统一收银台二维码图片地址】 **/
public
String
genScanImgUrl
(
String
url
){
return
getPaySiteUrl
()
+
"/api/scan/imgs/"
+
JeepayKit
.
aesEncode
(
url
)
+
".png"
;
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/OriginalRes.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
lombok.AllArgsConstructor
;
import
lombok.Data
;
/*
* 返回原始数据
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:37
*/
@Data
@AllArgsConstructor
public
class
OriginalRes
{
/** 返回数据 **/
private
Object
data
;
public
static
OriginalRes
ok
(
Object
data
){
return
new
OriginalRes
(
data
);
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/OssFileConfig.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
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.*
;
/*
* 定义文件上传的配置信息
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:38
*/
@Data
@AllArgsConstructor
public
class
OssFileConfig
{
/** 用户头像 **/
interface
BIZ_TYPE
{
String
AVATAR
=
"avatar"
;
/** 用户头像 **/
String
IF_BG
=
"ifBG"
;
/** 接口类型卡片背景图片 **/
String
CERT
=
"cert"
;
/** 接口参数 **/
}
/** 图片类型后缀格式 **/
public
static
final
Set
IMG_SUFFIX
=
new
HashSet
(
Arrays
.
asList
(
"jpg"
,
"png"
,
"jpeg"
,
"gif"
));
/** 全部后缀格式的文件标识符 **/
public
static
final
String
ALL_SUFFIX_FLAG
=
"*"
;
/** 不校验文件大小标识符 **/
public
static
final
Long
ALL_MAX_SIZE
=
-
1L
;
/** 允许上传的最大文件大小的默认值 **/
public
static
final
Long
DEFAULT_MAX_SIZE
=
5
*
1024
*
1024L
;
private
static
final
Map
<
String
,
OssFileConfig
>
ALL_BIZ_TYPE_MAP
=
new
HashMap
<>();
static
{
ALL_BIZ_TYPE_MAP
.
put
(
BIZ_TYPE
.
AVATAR
,
new
OssFileConfig
(
true
,
IMG_SUFFIX
,
DEFAULT_MAX_SIZE
)
);
ALL_BIZ_TYPE_MAP
.
put
(
BIZ_TYPE
.
IF_BG
,
new
OssFileConfig
(
true
,
IMG_SUFFIX
,
DEFAULT_MAX_SIZE
)
);
ALL_BIZ_TYPE_MAP
.
put
(
BIZ_TYPE
.
CERT
,
new
OssFileConfig
(
false
,
new
HashSet
<>(
Arrays
.
asList
(
ALL_SUFFIX_FLAG
)),
DEFAULT_MAX_SIZE
)
);
}
/** 是否允许公共读 **/
private
boolean
allowPublicRead
=
false
;
/** 允许的文件后缀, 默认全部类型 **/
private
Set
<
String
>
allowFileSuffix
=
new
HashSet
<>(
Arrays
.
asList
(
ALL_SUFFIX_FLAG
));
/** 允许的文件大小, 单位: Byte **/
private
Long
maxSize
=
DEFAULT_MAX_SIZE
;
/** 是否在允许的文件类型后缀内 **/
public
boolean
isAllowFileSuffix
(
String
fixSuffix
){
if
(
this
.
allowFileSuffix
.
contains
(
ALL_SUFFIX_FLAG
)){
//允许全部
return
true
;
}
return
this
.
allowFileSuffix
.
contains
(
StringUtils
.
defaultIfEmpty
(
fixSuffix
,
""
).
toLowerCase
());
}
/** 是否在允许的大小范围内 **/
public
boolean
isMaxSizeLimit
(
Long
fileSize
){
if
(
ALL_MAX_SIZE
.
equals
(
this
.
maxSize
)){
//允许全部大小
return
true
;
}
return
this
.
maxSize
>=
(
fileSize
==
null
?
0L
:
fileSize
);
}
public
static
OssFileConfig
getOssFileConfigByBizType
(
String
bizType
){
return
ALL_BIZ_TYPE_MAP
.
get
(
bizType
);
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/IsvParams.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.params
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.model.params.alipay.AlipayIsvParams
;
import
com.jeequan.jeepay.core.model.params.wxpay.WxpayIsvParams
;
import
com.jeequan.jeepay.core.model.params.ysf.YsfpayIsvParams
;
/*
* 抽象类 isv参数定义
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:33
*/
public
abstract
class
IsvParams
{
public
static
IsvParams
factory
(
String
ifCode
,
String
paramsStr
){
if
(
CS
.
IF_CODE
.
WXPAY
.
equals
(
ifCode
)){
return
JSONObject
.
parseObject
(
paramsStr
,
WxpayIsvParams
.
class
);
}
else
if
(
CS
.
IF_CODE
.
ALIPAY
.
equals
(
ifCode
)){
return
JSONObject
.
parseObject
(
paramsStr
,
AlipayIsvParams
.
class
);
}
else
if
(
CS
.
IF_CODE
.
YSFPAY
.
equals
(
ifCode
)){
return
JSONObject
.
parseObject
(
paramsStr
,
YsfpayIsvParams
.
class
);
}
return
null
;
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/IsvsubMchParams.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.params
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.model.params.alipay.AlipayIsvsubMchParams
;
import
com.jeequan.jeepay.core.model.params.wxpay.WxpayIsvsubMchParams
;
import
com.jeequan.jeepay.core.model.params.ysf.YsfpayIsvsubMchParams
;
/*
* 抽象类 特约商户参数定义
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:33
*/
public
abstract
class
IsvsubMchParams
{
public
static
IsvsubMchParams
factory
(
String
ifCode
,
String
paramsStr
){
if
(
CS
.
IF_CODE
.
WXPAY
.
equals
(
ifCode
)){
return
JSONObject
.
parseObject
(
paramsStr
,
WxpayIsvsubMchParams
.
class
);
}
else
if
(
CS
.
IF_CODE
.
ALIPAY
.
equals
(
ifCode
)){
return
JSONObject
.
parseObject
(
paramsStr
,
AlipayIsvsubMchParams
.
class
);
}
else
if
(
CS
.
IF_CODE
.
YSFPAY
.
equals
(
ifCode
)){
return
JSONObject
.
parseObject
(
paramsStr
,
YsfpayIsvsubMchParams
.
class
);
}
return
null
;
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/NormalMchParams.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.params
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.model.params.alipay.AlipayNormalMchParams
;
import
com.jeequan.jeepay.core.model.params.wxpay.WxpayNormalMchParams
;
/*
* 抽象类 普通商户参数定义
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:33
*/
public
abstract
class
NormalMchParams
{
public
static
NormalMchParams
factory
(
String
ifCode
,
String
paramsStr
){
if
(
CS
.
IF_CODE
.
WXPAY
.
equals
(
ifCode
)){
return
JSONObject
.
parseObject
(
paramsStr
,
WxpayNormalMchParams
.
class
);
}
else
if
(
CS
.
IF_CODE
.
ALIPAY
.
equals
(
ifCode
)){
return
JSONObject
.
parseObject
(
paramsStr
,
AlipayNormalMchParams
.
class
);
}
return
null
;
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/alipay/AlipayConfig.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.params.alipay
;
import
lombok.Data
;
/*
* 支付宝, 通用配置信息
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:32
*/
@Data
public
class
AlipayConfig
{
public
static
final
String
SIGN_TYPE_RSA
=
"RSA"
;
public
static
final
String
SIGN_TYPE_RSA2
=
"RSA2"
;
/** 网关地址 */
public
static
String
PROD_SERVER_URL
=
"https://openapi.alipay.com/gateway.do"
;
public
static
String
SANDBOX_SERVER_URL
=
"https://openapi.alipaydev.com/gateway.do"
;
public
static
String
PROD_OAUTH_URL
=
"https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=%s&scope=auth_base&state=&redirect_uri=%s"
;
public
static
String
SANDBOX_OAUTH_URL
=
"https://openauth.alipaydev.com/oauth2/publicAppAuthorize.htm?app_id=%s&scope=auth_base&state=&redirect_uri=%s"
;
public
static
String
FORMAT
=
"json"
;
public
static
String
CHARSET
=
"UTF-8"
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/alipay/AlipayIsvParams.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.params.alipay
;
import
com.jeequan.jeepay.core.model.params.IsvParams
;
import
lombok.Data
;
/*
* 支付宝 isv参数定义
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:34
*/
@Data
public
class
AlipayIsvParams
extends
IsvParams
{
/** 是否沙箱环境 */
private
Byte
sandbox
;
/** pid */
private
String
pid
;
/** appId */
private
String
appId
;
/** privateKey */
private
String
privateKey
;
/** alipayPublicKey */
private
String
alipayPublicKey
;
/** 签名方式 **/
private
String
signType
;
/** 是否使用证书方式 **/
private
Byte
useCert
;
/** app 证书 **/
private
String
appPublicCert
;
/** 支付宝公钥证书(.crt格式) **/
private
String
alipayPublicCert
;
/** 支付宝根证书 **/
private
String
alipayRootCert
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/alipay/AlipayIsvsubMchParams.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.params.alipay
;
import
com.jeequan.jeepay.core.model.params.IsvsubMchParams
;
import
lombok.Data
;
/*
* 支付宝 特约商户参数定义
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:33
*/
@Data
public
class
AlipayIsvsubMchParams
extends
IsvsubMchParams
{
private
String
appAuthToken
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/alipay/AlipayNormalMchParams.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.params.alipay
;
import
com.jeequan.jeepay.core.model.params.NormalMchParams
;
import
lombok.Data
;
/*
* 支付宝 普通商户参数定义
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:33
*/
@Data
public
class
AlipayNormalMchParams
extends
NormalMchParams
{
/** 是否沙箱环境 */
private
Byte
sandbox
;
/** appId */
private
String
appId
;
/** privateKey */
private
String
privateKey
;
/** alipayPublicKey */
private
String
alipayPublicKey
;
/** 签名方式 **/
private
String
signType
;
/** 是否使用证书方式 **/
private
Byte
useCert
;
/** app 证书 **/
private
String
appPublicCert
;
/** 支付宝公钥证书(.crt格式) **/
private
String
alipayPublicCert
;
/** 支付宝根证书 **/
private
String
alipayRootCert
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/wxpay/WxpayIsvParams.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.params.wxpay
;
import
com.jeequan.jeepay.core.model.params.IsvParams
;
import
lombok.Data
;
/*
* 微信官方支付 配置参数
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021/6/8 18:02
*/
@Data
public
class
WxpayIsvParams
extends
IsvParams
{
/** 应用App ID */
private
String
appId
;
/** 应用AppSecret */
private
String
appSecret
;
/** 微信支付商户号 */
private
String
mchId
;
/** oauth2地址 */
private
String
oauth2Url
;
/** API密钥 */
private
String
key
;
/** 签名方式 **/
private
String
signType
;
/** 微信支付API版本 **/
private
String
apiVersion
;
/** API V3秘钥 **/
private
String
apiV3Key
;
/** 序列号 **/
private
String
serialNo
;
/** API证书(.p12格式)**/
private
String
cert
;
/** 私钥文件(.pem格式) **/
private
String
apiClientKey
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/wxpay/WxpayIsvsubMchParams.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.params.wxpay
;
import
com.jeequan.jeepay.core.model.params.IsvsubMchParams
;
import
lombok.Data
;
/*
* 微信官方支付 配置参数
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021/6/8 18:02
*/
@Data
public
class
WxpayIsvsubMchParams
extends
IsvsubMchParams
{
/** 子商户ID **/
private
String
subMchId
;
/** 子账户appID **/
private
String
subMchAppId
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/wxpay/WxpayNormalMchParams.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.params.wxpay
;
import
com.jeequan.jeepay.core.model.params.NormalMchParams
;
import
lombok.Data
;
/*
* 微信官方支付 配置参数
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021/6/8 18:02
*/
@Data
public
class
WxpayNormalMchParams
extends
NormalMchParams
{
/** 应用App ID */
private
String
appId
;
/** 应用AppSecret */
private
String
appSecret
;
/** 微信支付商户号 */
private
String
mchId
;
/** oauth2地址 */
private
String
oauth2Url
;
/** API密钥 */
private
String
key
;
/** 微信支付API版本 **/
private
String
apiVersion
;
/** API V3秘钥 **/
private
String
apiV3Key
;
/** 序列号 **/
private
String
serialNo
;
/** API证书(.p12格式)**/
private
String
cert
;
/** 私钥文件(.pem格式) **/
private
String
apiClientKey
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/ysf/YsfpayConfig.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.params.ysf
;
import
lombok.Data
;
/*
* 云闪付 通用配置信息
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/8 18:02
*/
@Data
public
class
YsfpayConfig
{
/** 网关地址 */
public
static
String
PROD_SERVER_URL
=
"https://partner.95516.com"
;
public
static
String
SANDBOX_SERVER_URL
=
"http://ysf.bcbip.cn:10240"
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/ysf/YsfpayIsvParams.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.params.ysf
;
import
com.jeequan.jeepay.core.model.params.IsvParams
;
import
lombok.Data
;
/*
* 云闪付 配置信息
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/8 18:02
*/
@Data
public
class
YsfpayIsvParams
extends
IsvParams
{
/** 是否沙箱环境 */
private
Byte
sandbox
;
/** serProvId **/
private
String
serProvId
;
/** isvPrivateCertFile 证书 **/
private
String
isvPrivateCertFile
;
/** isvPrivateCertPwd **/
private
String
isvPrivateCertPwd
;
/** ysfpayPublicKey **/
private
String
ysfpayPublicKey
;
/** acqOrgCodeList 支付机构号 **/
private
String
acqOrgCode
;
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/params/ysf/YsfpayIsvsubMchParams.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.params.ysf
;
import
com.jeequan.jeepay.core.model.params.IsvsubMchParams
;
import
lombok.Data
;
/*
* 云闪付 配置信息
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021/6/8 18:02
*/
@Data
public
class
YsfpayIsvsubMchParams
extends
IsvsubMchParams
{
private
String
merId
;
// 商户编号
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/model/security/JeeUserDetails.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.security
;
import
com.jeequan.jeepay.core.entity.SysUser
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
java.util.ArrayList
;
import
java.util.Collection
;
/*
* 实现Spring Security的UserDetails接口
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:34
*/
@Slf4j
@Data
public
class
JeeUserDetails
implements
UserDetails
{
/** 系统用户信息 **/
private
SysUser
sysUser
;
/** 密码 **/
private
String
credential
;
/** 角色+权限 集合 (角色必须以: ROLE_ 开头) **/
private
Collection
<
SimpleGrantedAuthority
>
authorities
=
new
ArrayList
<>();
/** 缓存标志 **/
private
String
cacheKey
;
/** 登录IP **/
private
String
loginIp
;
//此处的无参构造,为json反序列化提供
public
JeeUserDetails
()
{
}
public
JeeUserDetails
(
SysUser
sysUser
,
String
credential
)
{
this
.
setSysUser
(
sysUser
);
this
.
setCredential
(
credential
);
//TODO ....
//做一些初始化操作
}
/** spring-security 需要验证的密码 **/
@Override
public
String
getPassword
()
{
return
getCredential
();
}
/** spring-security 登录名 **/
@Override
public
String
getUsername
()
{
return
getSysUser
().
getSysUserId
()
+
""
;
}
/** 账户是否过期 **/
@Override
public
boolean
isAccountNonExpired
()
{
return
true
;
}
/** 账户是否已解锁 **/
@Override
public
boolean
isAccountNonLocked
()
{
return
true
;
}
/** 密码是否过期 **/
@Override
public
boolean
isCredentialsNonExpired
()
{
return
true
;
}
/** 账户是否开启 **/
@Override
public
boolean
isEnabled
()
{
return
true
;
}
/** 获取权限集合 **/
@Override
public
Collection
<?
extends
GrantedAuthority
>
getAuthorities
()
{
return
authorities
;
}
public
static
JeeUserDetails
getCurrentUserDetails
()
{
Authentication
authentication
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
if
(
authentication
==
null
)
return
null
;
try
{
return
(
JeeUserDetails
)
authentication
.
getPrincipal
();
}
catch
(
Exception
e
)
{
return
null
;
}
}
}
xx
pay-co
mmon
/src/main/java/
org/xx
pay/co
mmon
/util/AmountUtil.java
→
jee
pay-co
re
/src/main/java/
com/jeequan/jee
pay/co
re
/util
s
/AmountUtil.java
View file @
de3de82d
package
org.xxpay.common.util
;
/*
* 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.utils
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.FieldPosition
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* @Description: 金额工具类
...
...
@@ -68,6 +86,18 @@ public class AmountUtil {
+
"."
+
s
.
substring
(
s
.
length
()
-
2
)));
}
/**
* 将Long "分"转换成"元"(长格式),如:100分被转换为1.00元。
* @param s
* @return
*/
public
static
String
convertCent2Dollar
(
Long
s
){
if
(
s
==
null
)
return
""
;
return
new
BigDecimal
(
s
).
divide
(
new
BigDecimal
(
100
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
* 将字符串"分"转换成"元"(短格式),如:100分被转换为1元。
* @param s
...
...
@@ -84,4 +114,16 @@ public class AmountUtil {
return
ss
;
}
/**
* 判断金额为2位小数
* @param str
* @return
*/
public
static
boolean
isAmount
(
String
str
){
if
(
str
==
null
)
return
false
;
Pattern
pattern
=
Pattern
.
compile
(
"^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$"
);
// 判断小数点后2位的数字的正则表达式
Matcher
match
=
pattern
.
matcher
(
str
);
return
match
.
matches
();
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/utils/ApiResBodyAdviceKit.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.utils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.model.OriginalRes
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
org.springframework.core.io.InputStreamResource
;
import
java.util.Collection
;
/*
* 自定义springMVC的controller的返回值
* 功能:
* 1. 自动添加ApiRes.ok();
* 2. 处理model的扩展字段 (只需要在model中设置[ext]参数, 可以实现json自动转换为外层字段。 )
* 比如 model为 {id:1, ext:{abc:222}} 则自动转换为: {id:1, abc:222}
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:49
*/
public
class
ApiResBodyAdviceKit
{
/** 扩展字段的key名称 **/
private
static
final
String
API_EXTEND_FIELD_NAME
=
"ext"
;
public
static
Object
beforeBodyWrite
(
Object
body
)
{
//空的情况 不处理
if
(
body
==
null
)
return
null
;
if
(
body
instanceof
OriginalRes
){
return
((
OriginalRes
)
body
).
getData
();
}
//返回文件流不处理
if
(
body
instanceof
InputStreamResource
){
return
body
;
}
//返回二进制文件不处理
if
(
body
instanceof
byte
[]){
return
body
;
}
//如果为ApiRes类型则仅处理扩展字段
if
(
body
instanceof
ApiRes
)
{
return
procAndConvertJSON
(
body
);
}
else
{
//ctrl返回其他非[ApiRes]认为处理成功, 先转换为成功状态, 在处理字段
return
procAndConvertJSON
(
ApiRes
.
ok
(
body
));
}
}
/** 处理扩展字段 and 转换为json格式 **/
private
static
Object
procAndConvertJSON
(
Object
object
){
Object
json
=
JSON
.
toJSON
(
object
);
//转换为JSON格式
if
(
json
instanceof
JSONObject
){
//对象类型
processExtFieldByJSONObject
((
JSONObject
)
json
);
return
json
;
}
if
(
json
instanceof
Collection
){
//数组类型
JSONArray
result
=
new
JSONArray
();
for
(
Object
itemObj
:
(
Collection
)
json
)
{
result
.
add
(
procAndConvertJSON
(
itemObj
));
}
return
result
;
}
return
json
;
}
/** 处理jsonObject格式 **/
private
static
void
processExtFieldByJSONObject
(
JSONObject
jsonObject
){
//如果包含字段, 则赋值到外层然后删除该字段
if
(
jsonObject
.
containsKey
(
API_EXTEND_FIELD_NAME
)){
JSONObject
exFieldMap
=
jsonObject
.
getJSONObject
(
API_EXTEND_FIELD_NAME
);
if
(
exFieldMap
!=
null
){
//包含字段
for
(
String
s
:
exFieldMap
.
keySet
())
{
//遍历赋值到外层
jsonObject
.
put
(
s
,
exFieldMap
.
get
(
s
));
}
}
jsonObject
.
remove
(
API_EXTEND_FIELD_NAME
);
//删除字段
}
//处理所有值
for
(
String
key
:
jsonObject
.
keySet
())
{
jsonObject
.
put
(
key
,
procAndConvertJSON
(
jsonObject
.
get
(
key
)));
}
}
}
jeepay-core/src/main/java/com/jeequan/jeepay/core/utils/DateKit.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.utils
;
import
cn.hutool.core.date.DateUtil
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.Date
;
/*
* 时间工具类
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 16:58
*/
public
class
DateKit
{
/** 获取参数时间当天的开始时间 **/
public
static
Date
getBegin
(
Date
date
){
if
(
date
==
null
)
return
null
;
return
DateUtil
.
beginOfDay
(
date
).
toJdkDate
();
}
/** 获取参数时间当天的结束时间 **/
public
static
Date
getEnd
(
Date
date
){
if
(
date
==
null
)
return
null
;
return
DateUtil
.
endOfDay
(
date
).
toJdkDate
();
}
/**
* 获取自定义查询时间
* today|0 -- 今天
* yesterday|0 -- 昨天
* near2now|7 -- 近xx天, 到今天
* near2yesterday|30 -- 近xx天, 到昨天
* customDate|2020-01-01,N -- 自定义日期格式 N表示为空, 占位使用
* customDateTime|2020-01-01 23:00:00,2020-01-01 23:00:00 -- 自定义日期时间格式
*
* @return
*/
public
static
Date
[]
getQueryDateRange
(
String
queryParamVal
){
//查询全部
if
(
StringUtils
.
isEmpty
(
queryParamVal
)){
return
new
Date
[]{
null
,
null
};
}
//根据 | 分割
String
[]
valArray
=
queryParamVal
.
split
(
"\\|"
);
if
(
valArray
.
length
!=
2
){
//参数有误
throw
new
BizException
(
"查询时间参数有误"
);
}
String
dateType
=
valArray
[
0
];
//时间类型
String
dateVal
=
valArray
[
1
];
//搜索时间值
Date
nowDateTime
=
new
Date
();
//当前时间
if
(
"today"
.
equals
(
dateType
)){
//今天
return
new
Date
[]{
getBegin
(
nowDateTime
),
getEnd
(
nowDateTime
)};
}
else
if
(
"yesterday"
.
equals
(
dateType
)){
//昨天
Date
yesterdayDateTime
=
DateUtil
.
offsetDay
(
nowDateTime
,
-
1
).
toJdkDate
();
//昨天
return
new
Date
[]{
getBegin
(
yesterdayDateTime
),
getEnd
(
yesterdayDateTime
)};
}
else
if
(
"near2now"
.
equals
(
dateType
)){
//近xx天, xx天之前 ~ 当前时间
Integer
offsetDay
=
1
-
Integer
.
parseInt
(
dateVal
);
//获取时间偏移量
Date
offsetDayDate
=
DateUtil
.
offsetDay
(
nowDateTime
,
offsetDay
).
toJdkDate
();
return
new
Date
[]{
getBegin
(
offsetDayDate
),
getEnd
(
nowDateTime
)};
}
else
if
(
"near2yesterday"
.
equals
(
dateType
)){
//近xx天, xx天之前 ~ 昨天
Date
yesterdayDateTime
=
DateUtil
.
offsetDay
(
nowDateTime
,
-
1
).
toJdkDate
();
//昨天
Integer
offsetDay
=
1
-
Integer
.
parseInt
(
dateVal
);
//获取时间偏移量
Date
offsetDayDate
=
DateUtil
.
offsetDay
(
yesterdayDateTime
,
offsetDay
).
toJdkDate
();
return
new
Date
[]{
getBegin
(
offsetDayDate
),
getEnd
(
yesterdayDateTime
)};
}
else
if
(
"customDate"
.
equals
(
dateType
)
||
"customDateTime"
.
equals
(
dateType
)){
//自定义格式
String
[]
timeArray
=
dateVal
.
split
(
","
);
//以逗号分割
if
(
timeArray
.
length
!=
2
)
throw
new
BizException
(
"查询自定义时间参数有误"
);
String
timeStr1
=
"N"
.
equalsIgnoreCase
(
timeArray
[
0
])
?
null
:
timeArray
[
0
]
;
//开始时间,
String
timeStr2
=
"N"
.
equalsIgnoreCase
(
timeArray
[
1
])
?
null
:
timeArray
[
1
];
//结束时间, N表示为空, 占位使用
Date
time1
=
null
;
Date
time2
=
null
;
if
(
StringUtils
.
isNotEmpty
(
timeStr1
)){
time1
=
DateUtil
.
parseDateTime
(
"customDate"
.
equals
(
dateType
)
?
(
timeStr1
+
" 00:00:00"
)
:
timeStr1
);
}
if
(
StringUtils
.
isNotEmpty
(
timeStr2
)){
time2
=
DateUtil
.
parseDateTime
(
"customDate"
.
equals
(
dateType
)
?
(
timeStr2
+
" 23:59:59"
)
:
timeStr2
);
}
return
new
Date
[]{
time1
,
time2
};
}
else
{
throw
new
BizException
(
"查询时间参数有误"
);
}
}
}
Prev
1
2
3
4
5
6
7
…
23
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