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
Show 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-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/common/StaticController.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.mgr.ctrl.common
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
org.springframework.core.io.InputStreamResource
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.InputStream
;
/*
* 静态文件下载/预览 ctrl
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:08
*/
@Controller
public
class
StaticController
extends
CommonCtrl
{
/** 图片预览 **/
@GetMapping
(
"/api/anon/localOssFiles/**/*.*"
)
public
ResponseEntity
<?>
imgView
()
{
try
{
//查找图片文件
File
imgFile
=
new
File
(
mainConfig
.
getOssFile
().
getPublicPath
()
+
File
.
separator
+
request
.
getRequestURI
().
substring
(
24
));
if
(!
imgFile
.
isFile
()
||
!
imgFile
.
exists
())
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_FOUND
);
//输出文件流(图片格式)
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
// httpHeaders.setContentType(MediaType.IMAGE_JPEG); //图片格式
InputStream
inputStream
=
new
FileInputStream
(
imgFile
);
return
new
ResponseEntity
<>(
new
InputStreamResource
(
inputStream
),
httpHeaders
,
HttpStatus
.
OK
);
}
catch
(
FileNotFoundException
e
)
{
logger
.
error
(
"static file error"
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/config/MainChartController.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.mgr.ctrl.config
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.PayOrderService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* 首页统计类
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@Slf4j
@RestController
@RequestMapping
(
"api/mainChart"
)
public
class
MainChartController
extends
CommonCtrl
{
@Autowired
private
PayOrderService
payOrderService
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:18
* @describe: 周交易总金额
*/
@PreAuthorize
(
"hasAuthority('ENT_C_MAIN_PAY_AMOUNT_WEEK')"
)
@RequestMapping
(
value
=
"/payAmountWeek"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
payAmountWeek
()
{
return
ApiRes
.
ok
(
payOrderService
.
mainPageWeekCount
(
null
));
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:18
* @describe: 商户总数量、服务商总数量、总交易金额、总交易笔数
*/
@PreAuthorize
(
"hasAuthority('ENT_C_MAIN_NUMBER_COUNT')"
)
@RequestMapping
(
value
=
"/numCount"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
numCount
()
{
JSONObject
json
=
payOrderService
.
mainPageNumCount
(
null
);
//返回数据
return
ApiRes
.
ok
(
json
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:18
* @describe: 交易统计
*/
@PreAuthorize
(
"hasAuthority('ENT_C_MAIN_PAY_COUNT')"
)
@RequestMapping
(
value
=
"/payCount"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
payCount
()
{
// 获取传入参数
JSONObject
paramJSON
=
getReqParamJSON
();
String
createdStart
=
paramJSON
.
getString
(
"createdStart"
);
String
createdEnd
=
paramJSON
.
getString
(
"createdEnd"
);
List
<
Map
>
mapList
=
payOrderService
.
mainPagePayCount
(
null
,
createdStart
,
createdEnd
);
//返回数据
return
ApiRes
.
ok
(
mapList
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:18
* @describe: 支付方式统计
*/
@PreAuthorize
(
"hasAuthority('ENT_C_MAIN_PAY_TYPE_COUNT')"
)
@RequestMapping
(
value
=
"/payTypeCount"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
payWayCount
()
{
JSONObject
paramJSON
=
getReqParamJSON
();
// 开始、结束时间
String
createdStart
=
paramJSON
.
getString
(
"createdStart"
);
String
createdEnd
=
paramJSON
.
getString
(
"createdEnd"
);
ArrayList
arrayResult
=
payOrderService
.
mainPagePayTypeCount
(
null
,
createdStart
,
createdEnd
);
return
ApiRes
.
ok
(
arrayResult
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/config/SysConfigController.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.mgr.ctrl.config
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.SysConfig
;
import
com.jeequan.jeepay.core.utils.StringKit
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifySysConfig
;
import
com.jeequan.jeepay.service.impl.SysConfigService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 系统配置信息类
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@Slf4j
@RestController
@RequestMapping
(
"api/sysConfigs"
)
public
class
SysConfigController
extends
CommonCtrl
{
@Autowired
private
SysConfigService
sysConfigService
;
@Autowired
private
MqTopic4ModifySysConfig
mqTopic4ModifySysConfig
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:19
* @describe: 分组下的配置
*/
@PreAuthorize
(
"hasAuthority('ENT_SYS_CONFIG_INFO')"
)
@RequestMapping
(
value
=
"/{groupKey}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
getConfigs
(
@PathVariable
(
"groupKey"
)
String
groupKey
)
{
LambdaQueryWrapper
<
SysConfig
>
condition
=
SysConfig
.
gw
();
condition
.
orderByAsc
(
SysConfig:
:
getSortNum
);
if
(
StringUtils
.
isNotEmpty
(
groupKey
)){
condition
.
eq
(
SysConfig:
:
getGroupKey
,
groupKey
);
}
List
<
SysConfig
>
configList
=
sysConfigService
.
list
(
condition
);
//返回数据
return
ApiRes
.
ok
(
configList
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:19
* @describe: 系统配置修改
*/
@PreAuthorize
(
"hasAuthority('ENT_SYS_CONFIG_EDIT')"
)
@MethodLog
(
remark
=
"系统配置修改"
)
@RequestMapping
(
value
=
"/{groupKey}"
,
method
=
RequestMethod
.
PUT
)
public
ApiRes
update
(
@PathVariable
(
"groupKey"
)
String
groupKey
)
{
JSONObject
paramJSON
=
getReqParamJSON
();
Map
<
String
,
String
>
updateMap
=
JSONObject
.
toJavaObject
(
paramJSON
,
Map
.
class
);
int
update
=
sysConfigService
.
updateByConfigKey
(
updateMap
);
if
(
update
<=
0
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
,
"更新失败"
);
mqTopic4ModifySysConfig
.
push
(
groupKey
);
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/isv/IsvInfoController.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.mgr.ctrl.isv
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.IsvInfo
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyIsvInfo
;
import
com.jeequan.jeepay.service.impl.IsvInfoService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 服务商管理类
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@RestController
@RequestMapping
(
"/api/isvInfo"
)
public
class
IsvInfoController
extends
CommonCtrl
{
@Autowired
private
IsvInfoService
isvInfoService
;
@Autowired
private
MqTopic4ModifyIsvInfo
mqTopic4ModifyIsvInfo
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:12
* @describe: 查询服务商信息列表
*/
@PreAuthorize
(
"hasAuthority('ENT_ISV_INFO_LIST')"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
IsvInfo
isvInfo
=
getObject
(
IsvInfo
.
class
);
LambdaQueryWrapper
<
IsvInfo
>
wrapper
=
IsvInfo
.
gw
();
if
(
StringUtils
.
isNotEmpty
(
isvInfo
.
getIsvNo
()))
wrapper
.
eq
(
IsvInfo:
:
getIsvNo
,
isvInfo
.
getIsvNo
());
if
(
StringUtils
.
isNotEmpty
(
isvInfo
.
getIsvName
()))
wrapper
.
eq
(
IsvInfo:
:
getIsvName
,
isvInfo
.
getIsvName
());
if
(
isvInfo
.
getState
()
!=
null
)
wrapper
.
eq
(
IsvInfo:
:
getState
,
isvInfo
.
getState
());
wrapper
.
orderByDesc
(
IsvInfo:
:
getCreatedAt
);
IPage
<
IsvInfo
>
pages
=
isvInfoService
.
page
(
getIPage
(
true
),
wrapper
);
return
ApiRes
.
page
(
pages
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:13
* @describe: 新增服务商信息
*/
@PreAuthorize
(
"hasAuthority('ENT_ISV_INFO_ADD')"
)
@MethodLog
(
remark
=
"新增服务商"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
public
ApiRes
add
()
{
IsvInfo
isvInfo
=
getObject
(
IsvInfo
.
class
);
String
isvNo
=
"V"
+
DateUtil
.
currentSeconds
();
isvInfo
.
setIsvNo
(
isvNo
);
isvInfo
.
setCreatedUid
(
getCurrentUser
().
getSysUser
().
getSysUserId
());
isvInfo
.
setCreatedBy
(
getCurrentUser
().
getSysUser
().
getRealname
());
boolean
result
=
isvInfoService
.
save
(
isvInfo
);
if
(!
result
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_CREATE
);
return
ApiRes
.
ok
();
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:13
* @describe: 删除服务商信息
*/
@PreAuthorize
(
"hasAuthority('ENT_ISV_INFO_DEL')"
)
@MethodLog
(
remark
=
"删除服务商"
)
@RequestMapping
(
value
=
"/{isvNo}"
,
method
=
RequestMethod
.
DELETE
)
public
ApiRes
delete
(
@PathVariable
(
"isvNo"
)
String
isvNo
)
{
isvInfoService
.
removeByIsvNo
(
isvNo
);
mqTopic4ModifyIsvInfo
.
push
(
isvNo
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:13
* @describe: 更新服务商信息
*/
@PreAuthorize
(
"hasAuthority('ENT_ISV_INFO_EDIT')"
)
@MethodLog
(
remark
=
"更新服务商信息"
)
@RequestMapping
(
value
=
"/{isvNo}"
,
method
=
RequestMethod
.
PUT
)
public
ApiRes
update
(
@PathVariable
(
"isvNo"
)
String
isvNo
)
{
IsvInfo
isvInfo
=
getObject
(
IsvInfo
.
class
);
isvInfo
.
setIsvNo
(
isvNo
);
boolean
result
=
isvInfoService
.
updateById
(
isvInfo
);
mqTopic4ModifyIsvInfo
.
push
(
isvNo
);
// 推送mq到目前节点进行更新数据
if
(!
result
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
return
ApiRes
.
ok
();
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:13
* @describe: 查看服务商信息
*/
@PreAuthorize
(
"hasAnyAuthority('ENT_ISV_INFO_VIEW', 'ENT_ISV_INFO_EDIT')"
)
@RequestMapping
(
value
=
"/{isvNo}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
detail
(
@PathVariable
(
"isvNo"
)
String
isvNo
)
{
IsvInfo
isvInfo
=
isvInfoService
.
getById
(
isvNo
);
if
(
isvInfo
==
null
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
return
ApiRes
.
ok
(
isvInfo
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/isv/IsvPayInterfaceConfigController.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.mgr.ctrl.isv
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayInterfaceDefine
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyIsvInfo
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* 服务商支付接口管理类
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021-04-27 15:50
*/
@RestController
@RequestMapping
(
"/api/isv/payConfigs"
)
public
class
IsvPayInterfaceConfigController
extends
CommonCtrl
{
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
MqTopic4ModifyIsvInfo
mqTopic4ModifyIsvInfo
;
/**
* @Author: ZhuXiao
* @Description: 查询服务商支付接口配置列表
* @Date: 16:45 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_ISV_PAY_CONFIG_LIST')"
)
@GetMapping
public
ApiRes
list
()
{
List
<
PayInterfaceDefine
>
list
=
payInterfaceConfigService
.
selectAllPayIfConfigListByInfoId
(
CS
.
INFO_TYPE_ISV
,
getValStringRequired
(
"isvNo"
));
return
ApiRes
.
ok
(
list
);
}
/**
* @Author: ZhuXiao
* @Description: 根据 服务商号、接口类型 获取商户参数配置
* @Date: 17:03 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_ISV_PAY_CONFIG_VIEW')"
)
@GetMapping
(
"/{isvNo}/{ifCode}"
)
public
ApiRes
getByMchNo
(
@PathVariable
(
value
=
"isvNo"
)
String
isvNo
,
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_ISV
,
isvNo
,
ifCode
);
if
(
payInterfaceConfig
!=
null
&&
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
multiply
(
new
BigDecimal
(
"100"
)));
}
return
ApiRes
.
ok
(
payInterfaceConfig
);
}
/**
* @Author: ZhuXiao
* @Description: 服务商支付接口参数配置
* @Date: 16:45 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_ISV_PAY_CONFIG_ADD')"
)
@PostMapping
@MethodLog
(
remark
=
"更新服务商支付参数"
)
public
ApiRes
saveOrUpdate
()
{
String
infoId
=
getValStringRequired
(
"infoId"
);
String
ifCode
=
getValStringRequired
(
"ifCode"
);
PayInterfaceConfig
payInterfaceConfig
=
getObject
(
PayInterfaceConfig
.
class
);
payInterfaceConfig
.
setInfoType
(
CS
.
INFO_TYPE_ISV
);
// 存入真实费率
if
(
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
divide
(
new
BigDecimal
(
"100"
),
6
,
BigDecimal
.
ROUND_HALF_UP
));
}
//添加更新者信息
Long
userId
=
getCurrentUser
().
getSysUser
().
getSysUserId
();
String
realName
=
getCurrentUser
().
getSysUser
().
getRealname
();
payInterfaceConfig
.
setUpdatedUid
(
userId
);
payInterfaceConfig
.
setUpdatedBy
(
realName
);
//根据 服务商号、接口类型 获取商户参数配置
PayInterfaceConfig
dbRecoed
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_ISV
,
infoId
,
ifCode
);
//若配置存在,为saveOrUpdate添加ID,第一次配置添加创建者
if
(
dbRecoed
!=
null
)
{
payInterfaceConfig
.
setId
(
dbRecoed
.
getId
());
}
else
{
payInterfaceConfig
.
setCreatedUid
(
userId
);
payInterfaceConfig
.
setCreatedBy
(
realName
);
}
boolean
result
=
payInterfaceConfigService
.
saveOrUpdate
(
payInterfaceConfig
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
,
"配置失败"
);
}
mqTopic4ModifyIsvInfo
.
push
(
infoId
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchInfoController.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.mgr.ctrl.merchant
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.MchInfo
;
import
com.jeequan.jeepay.core.entity.SysUser
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.queue.MqQueue4ModifyMchUserRemove
;
import
com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchInfo
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.SysUserService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 商户管理类
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@RestController
@RequestMapping
(
"/api/mchInfo"
)
public
class
MchInfoController
extends
CommonCtrl
{
@Autowired
private
MchInfoService
mchInfoService
;
@Autowired
private
SysUserService
sysUserService
;
@Autowired
private
MqTopic4ModifyMchInfo
mqTopic4ModifyMchInfo
;
@Autowired
private
MqQueue4ModifyMchUserRemove
mqQueue4ModifyMchUserRemove
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:14
* @describe: 商户信息列表
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_INFO_LIST')"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
MchInfo
mchInfo
=
getObject
(
MchInfo
.
class
);
LambdaQueryWrapper
<
MchInfo
>
wrapper
=
MchInfo
.
gw
();
if
(
StringUtils
.
isNotEmpty
(
mchInfo
.
getMchNo
()))
wrapper
.
eq
(
MchInfo:
:
getMchNo
,
mchInfo
.
getMchNo
());
if
(
StringUtils
.
isNotEmpty
(
mchInfo
.
getIsvNo
()))
wrapper
.
eq
(
MchInfo:
:
getIsvNo
,
mchInfo
.
getIsvNo
());
if
(
StringUtils
.
isNotEmpty
(
mchInfo
.
getMchName
()))
wrapper
.
eq
(
MchInfo:
:
getMchName
,
mchInfo
.
getMchName
());
if
(
mchInfo
.
getType
()
!=
null
)
wrapper
.
eq
(
MchInfo:
:
getType
,
mchInfo
.
getType
());
if
(
mchInfo
.
getState
()
!=
null
)
wrapper
.
eq
(
MchInfo:
:
getState
,
mchInfo
.
getState
());
wrapper
.
orderByDesc
(
MchInfo:
:
getCreatedAt
);
IPage
<
MchInfo
>
pages
=
mchInfoService
.
page
(
getIPage
(),
wrapper
);
return
ApiRes
.
page
(
pages
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:14
* @describe: 新增商户信息
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_INFO_ADD')"
)
@MethodLog
(
remark
=
"新增商户"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
public
ApiRes
add
()
{
MchInfo
mchInfo
=
getObject
(
MchInfo
.
class
);
// 获取传入的商户登录名
String
loginUserName
=
getValStringRequired
(
"loginUserName"
);
mchInfo
.
setMchNo
(
"M"
+
DateUtil
.
currentSeconds
());
// 当前登录用户信息
SysUser
sysUser
=
getCurrentUser
().
getSysUser
();
mchInfo
.
setCreatedUid
(
sysUser
.
getSysUserId
());
mchInfo
.
setCreatedBy
(
sysUser
.
getRealname
());
mchInfoService
.
addMch
(
mchInfo
,
loginUserName
);
return
ApiRes
.
ok
();
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:14
* @describe: 删除商户信息
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_INFO_DEL')"
)
@MethodLog
(
remark
=
"删除商户"
)
@RequestMapping
(
value
=
"/{mchNo}"
,
method
=
RequestMethod
.
DELETE
)
public
ApiRes
delete
(
@PathVariable
(
"mchNo"
)
String
mchNo
)
{
List
<
Long
>
userIdList
=
mchInfoService
.
removeByMchNo
(
mchNo
);
// 推送mq删除redis用户缓存
mqQueue4ModifyMchUserRemove
.
push
(
StringUtils
.
join
(
userIdList
,
","
));
// 推送mq到目前节点进行更新数据
mqTopic4ModifyMchInfo
.
push
(
mchNo
);
return
ApiRes
.
ok
();
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:14
* @describe: 更新商户信息
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_INFO_EDIT')"
)
@MethodLog
(
remark
=
"更新商户信息"
)
@RequestMapping
(
value
=
"/{mchNo}"
,
method
=
RequestMethod
.
PUT
)
public
ApiRes
update
(
@PathVariable
(
"mchNo"
)
String
mchNo
)
{
MchInfo
mchInfo
=
getObject
(
MchInfo
.
class
);
mchInfo
.
setMchNo
(
mchNo
);
// 校验该商户是否为特邀商户
MchInfo
dbMchInfo
=
mchInfoService
.
getById
(
mchNo
);
if
(
dbMchInfo
==
null
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
// 如果为特邀商户则不允许修改服务商及商户类型
if
(
dbMchInfo
.
getType
()
==
CS
.
MCH_TYPE_ISVSUB
)
{
mchInfo
.
setType
(
dbMchInfo
.
getType
());
mchInfo
.
setIsvNo
(
dbMchInfo
.
getIsvNo
());
}
// 如果商户状态为禁用状态,清除该商户用户登录信息
if
(
mchInfo
.
getState
()
==
CS
.
NO
)
{
List
<
Long
>
userIdList
=
new
ArrayList
<>();
List
<
SysUser
>
userList
=
sysUserService
.
list
(
SysUser
.
gw
()
.
eq
(
SysUser:
:
getBelongInfoId
,
mchNo
)
.
eq
(
SysUser:
:
getSystem
,
CS
.
SYS_TYPE
.
MCH
)
);
if
(
userList
.
size
()
>
0
)
{
for
(
SysUser
user:
userList
)
{
userIdList
.
add
(
user
.
getSysUserId
());
}
}
// 推送mq删除redis用户缓存
mqQueue4ModifyMchUserRemove
.
push
(
StringUtils
.
join
(
userIdList
,
","
));
}
boolean
result
=
mchInfoService
.
updateById
(
mchInfo
);
mqTopic4ModifyMchInfo
.
push
(
mchNo
);
// 推送mq到目前节点进行更新数据
if
(!
result
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
return
ApiRes
.
ok
();
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:14
* @describe: 查询商户信息
*/
@PreAuthorize
(
"hasAnyAuthority('ENT_MCH_INFO_VIEW', 'ENT_MCH_INFO_EDIT')"
)
@RequestMapping
(
value
=
"/{mchNo}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
detail
(
@PathVariable
(
"mchNo"
)
String
mchNo
)
{
MchInfo
mchInfo
=
mchInfoService
.
getById
(
mchNo
);
if
(
mchInfo
==
null
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
SysUser
sysUser
=
sysUserService
.
getById
(
mchInfo
.
getInitUserId
());
if
(
sysUser
!=
null
)
mchInfo
.
addExt
(
"loginUserName"
,
sysUser
.
getLoginUsername
());
return
ApiRes
.
ok
(
mchInfo
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchPayInterfaceConfigController.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.mgr.ctrl.merchant
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayInterfaceDefine
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchInfo
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* 商户支付接口管理类
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021-04-27 15:50
*/
@RestController
@RequestMapping
(
"/api/mch/payConfigs"
)
public
class
MchPayInterfaceConfigController
extends
CommonCtrl
{
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
MqTopic4ModifyMchInfo
mqTopic4ModifyMchInfo
;
/**
* @Author: ZhuXiao
* @Description: 查询商户支付接口配置列表
* @Date: 15:50 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_CONFIG_LIST')"
)
@GetMapping
public
ApiRes
list
()
{
List
<
PayInterfaceDefine
>
list
=
payInterfaceConfigService
.
selectAllPayIfConfigListByInfoId
(
CS
.
INFO_TYPE_MCH
,
getValStringRequired
(
"mchNo"
));
return
ApiRes
.
ok
(
list
);
}
/**
* @Author: ZhuXiao
* @Description: 根据 商户号、接口类型 获取商户参数配置
* @Date: 17:03 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_CONFIG_VIEW')"
)
@GetMapping
(
"/{mchNo}/{ifCode}"
)
public
ApiRes
getByMchNo
(
@PathVariable
(
value
=
"mchNo"
)
String
mchNo
,
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
mchNo
,
ifCode
);
if
(
payInterfaceConfig
!=
null
&&
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
multiply
(
new
BigDecimal
(
"100"
)));
}
return
ApiRes
.
ok
(
payInterfaceConfig
);
}
/**
* @Author: ZhuXiao
* @Description: 商户支付接口配置
* @Date: 16:13 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_CONFIG_ADD')"
)
@PostMapping
@MethodLog
(
remark
=
"更新商户支付参数"
)
public
ApiRes
saveOrUpdate
()
{
String
infoId
=
getValStringRequired
(
"infoId"
);
String
ifCode
=
getValStringRequired
(
"ifCode"
);
PayInterfaceConfig
payInterfaceConfig
=
getObject
(
PayInterfaceConfig
.
class
);
payInterfaceConfig
.
setInfoType
(
CS
.
INFO_TYPE_MCH
);
// 存入真实费率
if
(
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
divide
(
new
BigDecimal
(
"100"
),
6
,
BigDecimal
.
ROUND_HALF_UP
));
}
//添加更新者信息
Long
userId
=
getCurrentUser
().
getSysUser
().
getSysUserId
();
String
realName
=
getCurrentUser
().
getSysUser
().
getRealname
();
payInterfaceConfig
.
setUpdatedUid
(
userId
);
payInterfaceConfig
.
setUpdatedBy
(
realName
);
//根据 商户号、接口类型 获取商户参数配置
PayInterfaceConfig
dbRecoed
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
infoId
,
ifCode
);
//若配置存在,为saveOrUpdate添加ID,第一次配置添加创建者
if
(
dbRecoed
!=
null
)
{
payInterfaceConfig
.
setId
(
dbRecoed
.
getId
());
}
else
{
payInterfaceConfig
.
setCreatedUid
(
userId
);
payInterfaceConfig
.
setCreatedBy
(
realName
);
}
boolean
result
=
payInterfaceConfigService
.
saveOrUpdate
(
payInterfaceConfig
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
,
"配置失败"
);
}
mqTopic4ModifyMchInfo
.
push
(
infoId
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchPayPassageConfigController.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.mgr.ctrl.merchant
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.MchInfo
;
import
com.jeequan.jeepay.core.entity.MchPayPassage
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayWay
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.MchPayPassageService
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
com.jeequan.jeepay.service.impl.PayWayService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
* 商户支付通道管理类
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021-04-27 15:30
*/
@RestController
@RequestMapping
(
"/api/mch/payPassages"
)
public
class
MchPayPassageConfigController
extends
CommonCtrl
{
@Autowired
private
MchPayPassageService
mchPayPassageService
;
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
PayWayService
payWayService
;
@Autowired
private
MchInfoService
mchInfoService
;
/**
* @Author: ZhuXiao
* @Description: 查询支付方式列表,并添加是否配置支付通道状态
* @Date: 15:31 2021/5/10
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_PASSAGE_LIST')"
)
@GetMapping
public
ApiRes
list
()
{
String
mchNo
=
getValStringRequired
(
"mchNo"
);
String
wayCode
=
getValString
(
"wayCode"
);
String
wayName
=
getValString
(
"wayName"
);
//支付方式集合
LambdaQueryWrapper
<
PayWay
>
wrapper
=
PayWay
.
gw
();
if
(
StrUtil
.
isNotBlank
(
wayCode
))
wrapper
.
eq
(
PayWay:
:
getWayCode
,
wayCode
);
if
(
StrUtil
.
isNotBlank
(
wayName
))
wrapper
.
like
(
PayWay:
:
getWayName
,
wayName
);
IPage
<
PayWay
>
payWayPage
=
payWayService
.
page
(
getIPage
(),
wrapper
);
if
(!
CollectionUtils
.
isEmpty
(
payWayPage
.
getRecords
()))
{
// 支付方式代码集合
List
<
String
>
wayCodeList
=
new
LinkedList
<>();
payWayPage
.
getRecords
().
stream
().
forEach
(
payWay
->
wayCodeList
.
add
(
payWay
.
getWayCode
()));
// 商户支付通道集合
List
<
MchPayPassage
>
mchPayPassageList
=
mchPayPassageService
.
list
(
MchPayPassage
.
gw
()
.
select
(
MchPayPassage:
:
getWayCode
,
MchPayPassage:
:
getState
)
.
eq
(
MchPayPassage:
:
getMchNo
,
mchNo
)
.
in
(
MchPayPassage:
:
getWayCode
,
wayCodeList
));
for
(
PayWay
payWay
:
payWayPage
.
getRecords
())
{
payWay
.
addExt
(
"passageState"
,
CS
.
NO
);
for
(
MchPayPassage
mchPayPassage
:
mchPayPassageList
)
{
// 某种支付方式多个通道的情况下,只要有一个通道状态为开启,则该支付方式对应为开启状态
if
(
payWay
.
getWayCode
().
equals
(
mchPayPassage
.
getWayCode
())
&&
mchPayPassage
.
getState
()
==
CS
.
YES
)
{
payWay
.
addExt
(
"passageState"
,
CS
.
YES
);
break
;
}
}
}
}
return
ApiRes
.
page
(
payWayPage
);
}
/**
* @Author: ZhuXiao
* @Description: 根据商户号、支付方式查询可用的支付接口列表
* @Date: 17:55 2021/5/8
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_PASSAGE_CONFIG')"
)
@GetMapping
(
"/availablePayInterface/{mchNo}/{wayCode}"
)
public
ApiRes
availablePayInterface
(
@PathVariable
(
"mchNo"
)
String
mchNo
,
@PathVariable
(
"wayCode"
)
String
wayCode
)
{
MchInfo
mchInfo
=
mchInfoService
.
getById
(
mchNo
);
if
(
mchInfo
==
null
||
mchInfo
.
getState
()
!=
CS
.
YES
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
// 根据支付方式查询可用支付接口列表
List
<
JSONObject
>
list
=
mchPayPassageService
.
selectAvailablePayInterfaceList
(
wayCode
,
mchNo
,
CS
.
INFO_TYPE_MCH
,
mchInfo
.
getType
());
return
ApiRes
.
ok
(
list
);
}
/**
* @Author: ZhuXiao
* @Description: 根据 商户号、接口类型 获取商户参数配置
* @Date: 17:03 2021/4/27
*/
@GetMapping
(
"/{mchNo}/{ifCode}"
)
public
ApiRes
getByMchNo
(
@PathVariable
(
value
=
"mchNo"
)
String
mchNo
,
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
mchNo
,
ifCode
);
if
(
payInterfaceConfig
!=
null
&&
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
multiply
(
new
BigDecimal
(
"100"
)));
}
return
ApiRes
.
ok
(
payInterfaceConfig
);
}
/**
* @Author: ZhuXiao
* @Description: 商户支付通道配置
* @Date: 17:36 2021/5/8
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_PASSAGE_ADD')"
)
@PostMapping
@MethodLog
(
remark
=
"更新商户支付通道"
)
public
ApiRes
saveOrUpdate
()
{
String
reqParams
=
getValStringRequired
(
"reqParams"
);
try
{
List
<
MchPayPassage
>
mchPayPassageList
=
JSONArray
.
parseArray
(
reqParams
,
MchPayPassage
.
class
);
mchPayPassageService
.
saveOrUpdateBatchSelf
(
mchPayPassageList
);
return
ApiRes
.
ok
();
}
catch
(
Exception
e
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
);
}
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/MchNotifyController.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.mgr.ctrl.order
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.MchNotifyRecord
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.MchNotifyRecordService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 商户通知类
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@RestController
@RequestMapping
(
"/api/mchNotify"
)
public
class
MchNotifyController
extends
CommonCtrl
{
@Autowired
private
MchNotifyRecordService
mchNotifyService
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:14
* @describe: 商户通知列表
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_NOTIFY_LIST')"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
MchNotifyRecord
mchNotify
=
getObject
(
MchNotifyRecord
.
class
);
JSONObject
paramJSON
=
getReqParamJSON
();
LambdaQueryWrapper
<
MchNotifyRecord
>
wrapper
=
MchNotifyRecord
.
gw
();
if
(
StringUtils
.
isNotEmpty
(
mchNotify
.
getOrderId
()))
wrapper
.
eq
(
MchNotifyRecord:
:
getOrderId
,
mchNotify
.
getOrderId
());
if
(
StringUtils
.
isNotEmpty
(
mchNotify
.
getMchNo
()))
wrapper
.
eq
(
MchNotifyRecord:
:
getMchNo
,
mchNotify
.
getMchNo
());
if
(
StringUtils
.
isNotEmpty
(
mchNotify
.
getIsvNo
()))
wrapper
.
eq
(
MchNotifyRecord:
:
getIsvNo
,
mchNotify
.
getIsvNo
());
if
(
StringUtils
.
isNotEmpty
(
mchNotify
.
getMchOrderNo
()))
wrapper
.
eq
(
MchNotifyRecord:
:
getMchOrderNo
,
mchNotify
.
getMchOrderNo
());
if
(
mchNotify
.
getOrderType
()
!=
null
)
wrapper
.
eq
(
MchNotifyRecord:
:
getOrderType
,
mchNotify
.
getOrderType
());
if
(
mchNotify
.
getState
()
!=
null
)
wrapper
.
eq
(
MchNotifyRecord:
:
getState
,
mchNotify
.
getState
());
if
(
paramJSON
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
paramJSON
.
getString
(
"createdStart"
)))
wrapper
.
ge
(
MchNotifyRecord:
:
getCreatedAt
,
paramJSON
.
getString
(
"createdStart"
));
if
(
StringUtils
.
isNotEmpty
(
paramJSON
.
getString
(
"createdEnd"
)))
wrapper
.
le
(
MchNotifyRecord:
:
getCreatedAt
,
paramJSON
.
getString
(
"createdEnd"
));
}
wrapper
.
orderByDesc
(
MchNotifyRecord:
:
getCreatedAt
);
IPage
<
MchNotifyRecord
>
pages
=
mchNotifyService
.
page
(
getIPage
(),
wrapper
);
return
ApiRes
.
page
(
pages
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:14
* @describe: 商户通知信息
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_NOTIFY_VIEW')"
)
@RequestMapping
(
value
=
"/{notifyId}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
detail
(
@PathVariable
(
"notifyId"
)
String
notifyId
)
{
MchNotifyRecord
mchNotify
=
mchNotifyService
.
getById
(
notifyId
);
if
(
mchNotify
==
null
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
return
ApiRes
.
ok
(
mchNotify
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/PayOrderController.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.mgr.ctrl.order
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.PayOrder
;
import
com.jeequan.jeepay.core.entity.PayWay
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.PayOrderService
;
import
com.jeequan.jeepay.service.impl.PayWayService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 支付订单类
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@RestController
@RequestMapping
(
"/api/payOrder"
)
public
class
PayOrderController
extends
CommonCtrl
{
@Autowired
private
PayOrderService
payOrderService
;
@Autowired
private
PayWayService
payWayService
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:15
* @describe: 订单信息列表
*/
@PreAuthorize
(
"hasAuthority('ENT_PAY_ORDER_LIST')"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
PayOrder
payOrder
=
getObject
(
PayOrder
.
class
);
JSONObject
paramJSON
=
getReqParamJSON
();
LambdaQueryWrapper
<
PayOrder
>
wrapper
=
PayOrder
.
gw
();
if
(
StringUtils
.
isNotEmpty
(
payOrder
.
getPayOrderId
()))
wrapper
.
eq
(
PayOrder:
:
getPayOrderId
,
payOrder
.
getPayOrderId
());
if
(
StringUtils
.
isNotEmpty
(
payOrder
.
getMchNo
()))
wrapper
.
eq
(
PayOrder:
:
getMchNo
,
payOrder
.
getMchNo
());
if
(
StringUtils
.
isNotEmpty
(
payOrder
.
getIsvNo
()))
wrapper
.
eq
(
PayOrder:
:
getIsvNo
,
payOrder
.
getIsvNo
());
if
(
payOrder
.
getMchType
()
!=
null
)
wrapper
.
eq
(
PayOrder:
:
getMchType
,
payOrder
.
getMchType
());
if
(
StringUtils
.
isNotEmpty
(
payOrder
.
getWayCode
()))
wrapper
.
eq
(
PayOrder:
:
getWayCode
,
payOrder
.
getWayCode
());
if
(
StringUtils
.
isNotEmpty
(
payOrder
.
getMchOrderNo
()))
wrapper
.
eq
(
PayOrder:
:
getMchOrderNo
,
payOrder
.
getMchOrderNo
());
if
(
payOrder
.
getState
()
!=
null
)
wrapper
.
eq
(
PayOrder:
:
getState
,
payOrder
.
getState
());
if
(
payOrder
.
getNotifyState
()
!=
null
)
wrapper
.
eq
(
PayOrder:
:
getNotifyState
,
payOrder
.
getNotifyState
());
if
(
paramJSON
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
paramJSON
.
getString
(
"createdStart"
)))
wrapper
.
ge
(
PayOrder:
:
getCreatedAt
,
paramJSON
.
getString
(
"createdStart"
));
if
(
StringUtils
.
isNotEmpty
(
paramJSON
.
getString
(
"createdEnd"
)))
wrapper
.
le
(
PayOrder:
:
getCreatedAt
,
paramJSON
.
getString
(
"createdEnd"
));
}
wrapper
.
orderByDesc
(
PayOrder:
:
getCreatedAt
);
IPage
<
PayOrder
>
pages
=
payOrderService
.
page
(
getIPage
(),
wrapper
);
// 得到所有支付方式
Map
<
String
,
String
>
payWayNameMap
=
new
HashMap
<>();
List
<
PayWay
>
payWayList
=
payWayService
.
list
();
for
(
PayWay
payWay:
payWayList
)
{
payWayNameMap
.
put
(
payWay
.
getWayCode
(),
payWay
.
getWayName
());
}
for
(
PayOrder
order:
pages
.
getRecords
())
{
// 存入支付方式名称
if
(
StringUtils
.
isNotEmpty
(
payWayNameMap
.
get
(
order
.
getWayCode
())))
{
order
.
addExt
(
"wayName"
,
payWayNameMap
.
get
(
order
.
getWayCode
()));
}
else
{
order
.
addExt
(
"wayName"
,
order
.
getWayCode
());
}
}
return
ApiRes
.
page
(
pages
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:15
* @describe: 支付订单信息
*/
@PreAuthorize
(
"hasAuthority('ENT_PAY_ORDER_VIEW')"
)
@RequestMapping
(
value
=
"/{payOrderId}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
detail
(
@PathVariable
(
"payOrderId"
)
String
payOrderId
)
{
PayOrder
payOrder
=
payOrderService
.
getById
(
payOrderId
);
if
(
payOrder
==
null
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
return
ApiRes
.
ok
(
payOrder
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/RefundOrderController.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.mgr.ctrl.order
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.RefundOrder
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.RefundOrderService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 退款订单类
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@RestController
@RequestMapping
(
"/api/refundOrder"
)
public
class
RefundOrderController
extends
CommonCtrl
{
@Autowired
private
RefundOrderService
refundOrderService
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:15
* @describe: 退款订单信息列表
*/
@PreAuthorize
(
"hasAuthority('ENT_REFUND_ORDER_LIST')"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
RefundOrder
refundOrder
=
getObject
(
RefundOrder
.
class
);
JSONObject
paramJSON
=
getReqParamJSON
();
LambdaQueryWrapper
<
RefundOrder
>
wrapper
=
RefundOrder
.
gw
();
if
(
StringUtils
.
isNotEmpty
(
refundOrder
.
getRefundOrderId
()))
wrapper
.
eq
(
RefundOrder:
:
getRefundOrderId
,
refundOrder
.
getRefundOrderId
());
if
(
StringUtils
.
isNotEmpty
(
refundOrder
.
getPayOrderId
()))
wrapper
.
eq
(
RefundOrder:
:
getPayOrderId
,
refundOrder
.
getPayOrderId
());
if
(
StringUtils
.
isNotEmpty
(
refundOrder
.
getChannelPayOrderNo
()))
wrapper
.
eq
(
RefundOrder:
:
getChannelPayOrderNo
,
refundOrder
.
getChannelPayOrderNo
());
if
(
StringUtils
.
isNotEmpty
(
refundOrder
.
getMchNo
()))
wrapper
.
eq
(
RefundOrder:
:
getMchNo
,
refundOrder
.
getMchNo
());
if
(
StringUtils
.
isNotEmpty
(
refundOrder
.
getIsvNo
()))
wrapper
.
eq
(
RefundOrder:
:
getIsvNo
,
refundOrder
.
getIsvNo
());
if
(
refundOrder
.
getMchType
()
!=
null
)
wrapper
.
eq
(
RefundOrder:
:
getMchType
,
refundOrder
.
getMchType
());
if
(
StringUtils
.
isNotEmpty
(
refundOrder
.
getMchRefundNo
()))
wrapper
.
eq
(
RefundOrder:
:
getMchRefundNo
,
refundOrder
.
getMchRefundNo
());
if
(
refundOrder
.
getState
()
!=
null
)
wrapper
.
eq
(
RefundOrder:
:
getState
,
refundOrder
.
getState
());
if
(
StringUtils
.
isNotEmpty
(
refundOrder
.
getChannelPayOrderNo
()))
wrapper
.
eq
(
RefundOrder:
:
getChannelPayOrderNo
,
refundOrder
.
getChannelPayOrderNo
());
if
(
refundOrder
.
getResult
()
!=
null
)
wrapper
.
eq
(
RefundOrder:
:
getResult
,
refundOrder
.
getResult
());
if
(
paramJSON
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
paramJSON
.
getString
(
"createdStart"
)))
wrapper
.
ge
(
RefundOrder:
:
getCreatedAt
,
paramJSON
.
getString
(
"createdStart"
));
if
(
StringUtils
.
isNotEmpty
(
paramJSON
.
getString
(
"createdEnd"
)))
wrapper
.
le
(
RefundOrder:
:
getCreatedAt
,
paramJSON
.
getString
(
"createdEnd"
));
}
wrapper
.
orderByDesc
(
RefundOrder:
:
getCreatedAt
);
IPage
<
RefundOrder
>
pages
=
refundOrderService
.
page
(
getIPage
(),
wrapper
);
return
ApiRes
.
page
(
pages
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:15
* @describe: 退款订单信息
*/
@PreAuthorize
(
"hasAuthority('ENT_REFUND_ORDER_VIEW')"
)
@RequestMapping
(
value
=
"/{refundOrderId}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
detail
(
@PathVariable
(
"refundOrderId"
)
String
refundOrderId
)
{
RefundOrder
refundOrder
=
refundOrderService
.
getById
(
refundOrderId
);
if
(
refundOrder
==
null
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
return
ApiRes
.
ok
(
refundOrder
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/payconfig/PayInterfaceDefineController.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.mgr.ctrl.payconfig
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayInterfaceDefine
;
import
com.jeequan.jeepay.core.entity.PayOrder
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
com.jeequan.jeepay.service.impl.PayInterfaceDefineService
;
import
com.jeequan.jeepay.service.impl.PayOrderService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 支付接口定义管理类
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021-04-27 15:50
*/
@RestController
@RequestMapping
(
"api/payIfDefines"
)
public
class
PayInterfaceDefineController
extends
CommonCtrl
{
@Autowired
private
PayInterfaceDefineService
payInterfaceDefineService
;
@Autowired
private
PayOrderService
payOrderService
;
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
/**
* @Author: ZhuXiao
* @Description: list
* @Date: 15:51 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_PC_IF_DEFINE_LIST')"
)
@GetMapping
public
ApiRes
list
()
{
List
<
PayInterfaceDefine
>
list
=
payInterfaceDefineService
.
list
(
PayInterfaceDefine
.
gw
()
.
orderByAsc
(
PayInterfaceDefine:
:
getCreatedAt
)
);
return
ApiRes
.
ok
(
list
);
}
/**
* @Author: ZhuXiao
* @Description: detail
* @Date: 15:51 2021/4/27
*/
@PreAuthorize
(
"hasAnyAuthority('ENT_PC_IF_DEFINE_VIEW', 'ENT_PC_IF_DEFINE_EDIT')"
)
@GetMapping
(
"/{ifCode}"
)
public
ApiRes
detail
(
@PathVariable
(
"ifCode"
)
String
ifCode
)
{
return
ApiRes
.
ok
(
payInterfaceDefineService
.
getById
(
ifCode
));
}
/**
* @Author: ZhuXiao
* @Description: add
* @Date: 15:51 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_PC_IF_DEFINE_ADD')"
)
@PostMapping
@MethodLog
(
remark
=
"新增支付接口"
)
public
ApiRes
add
()
{
PayInterfaceDefine
payInterfaceDefine
=
getObject
(
PayInterfaceDefine
.
class
);
JSONArray
jsonArray
=
new
JSONArray
();
String
[]
wayCodes
=
getValStringRequired
(
"wayCodeStrs"
).
split
(
","
);
for
(
String
wayCode
:
wayCodes
)
{
JSONObject
object
=
new
JSONObject
();
object
.
put
(
"wayCode"
,
wayCode
);
jsonArray
.
add
(
object
);
}
payInterfaceDefine
.
setWayCodes
(
jsonArray
);
boolean
result
=
payInterfaceDefineService
.
save
(
payInterfaceDefine
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_CREATE
);
}
return
ApiRes
.
ok
();
}
/**
* @Author: ZhuXiao
* @Description: update
* @Date: 15:51 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_PC_IF_DEFINE_EDIT')"
)
@PutMapping
(
"/{ifCode}"
)
@MethodLog
(
remark
=
"更新支付接口"
)
public
ApiRes
update
(
@PathVariable
(
"ifCode"
)
String
ifCode
)
{
PayInterfaceDefine
payInterfaceDefine
=
getObject
(
PayInterfaceDefine
.
class
);
payInterfaceDefine
.
setIfCode
(
ifCode
);
JSONArray
jsonArray
=
new
JSONArray
();
String
[]
wayCodes
=
getValStringRequired
(
"wayCodeStrs"
).
split
(
","
);
for
(
String
wayCode
:
wayCodes
)
{
JSONObject
object
=
new
JSONObject
();
object
.
put
(
"wayCode"
,
wayCode
);
jsonArray
.
add
(
object
);
}
payInterfaceDefine
.
setWayCodes
(
jsonArray
);
boolean
result
=
payInterfaceDefineService
.
updateById
(
payInterfaceDefine
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
}
return
ApiRes
.
ok
();
}
/**
* @Author: ZhuXiao
* @Description: delete
* @Date: 15:52 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_PC_IF_DEFINE_DEL')"
)
@DeleteMapping
(
"/{ifCode}"
)
@MethodLog
(
remark
=
"删除支付接口"
)
public
ApiRes
delete
(
@PathVariable
(
"ifCode"
)
String
ifCode
)
{
// 校验该支付方式是否有服务商或商户配置参数或者已有订单
if
(
payInterfaceConfigService
.
count
(
PayInterfaceConfig
.
gw
().
eq
(
PayInterfaceConfig:
:
getIfCode
,
ifCode
))
>
0
||
payOrderService
.
count
(
PayOrder
.
gw
().
eq
(
PayOrder:
:
getIfCode
,
ifCode
))
>
0
)
{
throw
new
BizException
(
"该支付接口已有服务商或商户配置参数或已发生交易,无法删除!"
);
}
boolean
result
=
payInterfaceDefineService
.
removeById
(
ifCode
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_DELETE
);
}
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/payconfig/PayWayController.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.mgr.ctrl.payconfig
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.MchPayPassage
;
import
com.jeequan.jeepay.core.entity.PayOrder
;
import
com.jeequan.jeepay.core.entity.PayWay
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.utils.StringKit
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.MchPayPassageService
;
import
com.jeequan.jeepay.service.impl.PayOrderService
;
import
com.jeequan.jeepay.service.impl.PayWayService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 支付方式管理类
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021-04-27 15:50
*/
@RestController
@RequestMapping
(
"api/payWays"
)
public
class
PayWayController
extends
CommonCtrl
{
@Autowired
PayWayService
payWayService
;
@Autowired
MchPayPassageService
mchPayPassageService
;
@Autowired
PayOrderService
payOrderService
;
/**
* @Author: ZhuXiao
* @Description: list
* @Date: 15:52 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_PC_WAY_LIST')"
)
@GetMapping
public
ApiRes
list
()
{
PayWay
queryObject
=
getObject
(
PayWay
.
class
);
LambdaQueryWrapper
<
PayWay
>
condition
=
PayWay
.
gw
();
if
(
StringUtils
.
isNotEmpty
(
queryObject
.
getWayCode
())){
condition
.
like
(
PayWay:
:
getWayCode
,
queryObject
.
getWayCode
());
}
if
(
StringUtils
.
isNotEmpty
(
queryObject
.
getWayName
())){
condition
.
like
(
PayWay:
:
getWayName
,
queryObject
.
getWayName
());
}
condition
.
orderByAsc
(
PayWay:
:
getWayCode
);
IPage
<
PayWay
>
pages
=
payWayService
.
page
(
getIPage
(
true
),
condition
);
return
ApiRes
.
page
(
pages
);
}
/**
* @Author: ZhuXiao
* @Description: detail
* @Date: 15:52 2021/4/27
*/
@PreAuthorize
(
"hasAnyAuthority('ENT_PC_WAY_VIEW', 'ENT_PC_WAY_EDIT')"
)
@GetMapping
(
"/{wayCode}"
)
public
ApiRes
detail
(
@PathVariable
(
"wayCode"
)
String
wayCode
)
{
return
ApiRes
.
ok
(
payWayService
.
getById
(
wayCode
));
}
/**
* @Author: ZhuXiao
* @Description: add
* @Date: 15:52 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_PC_WAY_ADD')"
)
@PostMapping
@MethodLog
(
remark
=
"新增支付方式"
)
public
ApiRes
add
()
{
PayWay
payWay
=
getObject
(
PayWay
.
class
);
if
(
payWayService
.
count
(
PayWay
.
gw
().
eq
(
PayWay:
:
getWayCode
,
payWay
.
getWayCode
()))
>
0
)
{
throw
new
BizException
(
"支付方式代码已存在"
);
}
payWay
.
setWayCode
(
payWay
.
getWayCode
().
toUpperCase
());
boolean
result
=
payWayService
.
save
(
payWay
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_CREATE
);
}
return
ApiRes
.
ok
();
}
/**
* @Author: ZhuXiao
* @Description: update
* @Date: 15:52 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_PC_WAY_EDIT')"
)
@PutMapping
(
"/{wayCode}"
)
@MethodLog
(
remark
=
"更新支付方式"
)
public
ApiRes
update
(
@PathVariable
(
"wayCode"
)
String
wayCode
)
{
PayWay
payWay
=
getObject
(
PayWay
.
class
);
payWay
.
setWayCode
(
wayCode
);
boolean
result
=
payWayService
.
updateById
(
payWay
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
}
return
ApiRes
.
ok
();
}
/**
* @Author: ZhuXiao
* @Description: delete
* @Date: 15:52 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_PC_WAY_DEL')"
)
@DeleteMapping
(
"/{wayCode}"
)
@MethodLog
(
remark
=
"删除支付方式"
)
public
ApiRes
delete
(
@PathVariable
(
"wayCode"
)
String
wayCode
)
{
// 校验该支付方式是否有商户已配置通道或者已有订单
if
(
mchPayPassageService
.
count
(
MchPayPassage
.
gw
().
eq
(
MchPayPassage:
:
getWayCode
,
wayCode
))
>
0
||
payOrderService
.
count
(
PayOrder
.
gw
().
eq
(
PayOrder:
:
getWayCode
,
wayCode
))
>
0
)
{
throw
new
BizException
(
"该支付方式已有商户配置通道或已发生交易,无法删除!"
);
}
boolean
result
=
payWayService
.
removeById
(
wayCode
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_DELETE
);
}
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/sysuser/SysEntController.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.mgr.ctrl.sysuser
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.jeequan.jeepay.core.entity.SysEntitlement
;
import
com.jeequan.jeepay.service.impl.SysEntitlementService
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.core.utils.TreeDataBuilder
;
import
java.util.List
;
/*
* 权限 菜单 管理
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:13
*/
@RestController
@RequestMapping
(
"api/sysEnts"
)
public
class
SysEntController
extends
CommonCtrl
{
@Autowired
SysEntitlementService
sysEntitlementService
;
/** getOne */
@PreAuthorize
(
"hasAnyAuthority( 'ENT_UR_ROLE_ENT_LIST' )"
)
@RequestMapping
(
value
=
"/bySystem"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
bySystem
()
{
return
ApiRes
.
ok
(
sysEntitlementService
.
getOne
(
SysEntitlement
.
gw
()
.
eq
(
SysEntitlement:
:
getEntId
,
getValStringRequired
(
"entId"
))
.
eq
(
SysEntitlement:
:
getSystem
,
getValStringRequired
(
"system"
)))
);
}
/** updateById */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_ROLE_ENT_EDIT')"
)
@MethodLog
(
remark
=
"更新资源权限"
)
@RequestMapping
(
value
=
"/{entId}"
,
method
=
RequestMethod
.
PUT
)
public
ApiRes
updateById
(
@PathVariable
(
"entId"
)
String
entId
)
{
SysEntitlement
queryObject
=
getObject
(
SysEntitlement
.
class
);
sysEntitlementService
.
update
(
queryObject
,
SysEntitlement
.
gw
().
eq
(
SysEntitlement:
:
getEntId
,
entId
).
eq
(
SysEntitlement:
:
getSystem
,
queryObject
.
getSystem
()));
return
ApiRes
.
ok
();
}
/** 查询权限集合 */
@PreAuthorize
(
"hasAnyAuthority( 'ENT_UR_ROLE_ENT_LIST', 'ENT_UR_ROLE_DIST' )"
)
@RequestMapping
(
value
=
"/showTree"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
showTree
()
{
//查询全部数据
List
<
SysEntitlement
>
list
=
sysEntitlementService
.
list
(
SysEntitlement
.
gw
().
eq
(
SysEntitlement:
:
getSystem
,
getValStringRequired
(
"system"
)));
//转换为json树状结构
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
toJSON
(
list
);
List
<
JSONObject
>
leftMenuTree
=
new
TreeDataBuilder
(
jsonArray
,
"entId"
,
"pid"
,
"children"
,
"entSort"
,
true
)
.
buildTreeObject
();
return
ApiRes
.
ok
(
leftMenuTree
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/sysuser/SysLogController.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.mgr.ctrl.sysuser
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.SysLog
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.SysLogService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
* 系统日志记录类
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@RestController
@RequestMapping
(
"api/sysLog"
)
public
class
SysLogController
extends
CommonCtrl
{
@Autowired
SysLogService
sysLogService
;
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:15
* @describe: 日志记录列表
*/
@PreAuthorize
(
"hasAuthority('ENT_SYS_LOG_LIST')"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
SysLog
sysLog
=
getObject
(
SysLog
.
class
);
JSONObject
paramJSON
=
getReqParamJSON
();
// 查询列表
LambdaQueryWrapper
<
SysLog
>
condition
=
SysLog
.
gw
();
condition
.
orderByDesc
(
SysLog:
:
getCreatedAt
);
if
(
sysLog
.
getUserId
()
!=
null
)
condition
.
eq
(
SysLog:
:
getUserId
,
sysLog
.
getUserId
());
if
(
sysLog
.
getUserName
()
!=
null
)
condition
.
eq
(
SysLog:
:
getUserName
,
sysLog
.
getUserName
());
if
(
StringUtils
.
isNotEmpty
(
sysLog
.
getSystem
()))
condition
.
eq
(
SysLog:
:
getSystem
,
sysLog
.
getSystem
());
if
(
paramJSON
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
paramJSON
.
getString
(
"createdStart"
)))
condition
.
ge
(
SysLog:
:
getCreatedAt
,
paramJSON
.
getString
(
"createdStart"
));
if
(
StringUtils
.
isNotEmpty
(
paramJSON
.
getString
(
"createdEnd"
)))
condition
.
le
(
SysLog:
:
getCreatedAt
,
paramJSON
.
getString
(
"createdEnd"
));
}
IPage
<
SysLog
>
pages
=
sysLogService
.
page
(
getIPage
(),
condition
);
return
ApiRes
.
page
(
pages
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:16
* @describe: 查看日志信息
*/
@PreAuthorize
(
"hasAuthority('ENT_SYS_LOG_VIEW')"
)
@RequestMapping
(
value
=
"/{sysLogId}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
detail
(
@PathVariable
(
"sysLogId"
)
String
sysLogId
)
{
SysLog
sysLog
=
sysLogService
.
getById
(
sysLogId
);
if
(
sysLog
==
null
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
return
ApiRes
.
ok
(
sysLog
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:16
* @describe: 删除日志信息
*/
@PreAuthorize
(
"hasAuthority('ENT_SYS_LOG_DEL')"
)
@MethodLog
(
remark
=
"删除日志信息"
)
@RequestMapping
(
value
=
"/{selectedIds}"
,
method
=
RequestMethod
.
DELETE
)
public
ApiRes
delete
(
@PathVariable
(
"selectedIds"
)
String
selectedIds
)
{
String
[]
ids
=
selectedIds
.
split
(
","
);
List
<
Long
>
idsList
=
new
LinkedList
<>();
for
(
String
id
:
ids
)
{
idsList
.
add
(
Long
.
valueOf
(
id
));
}
boolean
result
=
sysLogService
.
removeByIds
(
idsList
);
if
(!
result
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_DELETE
);
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/sysuser/SysRoleController.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.mgr.ctrl.sysuser
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.SysRole
;
import
com.jeequan.jeepay.core.entity.SysUserRoleRela
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.mgr.service.AuthService
;
import
com.jeequan.jeepay.service.impl.SysRoleEntRelaService
;
import
com.jeequan.jeepay.service.impl.SysRoleService
;
import
com.jeequan.jeepay.service.impl.SysUserRoleRelaService
;
import
com.jeequan.jeepay.core.utils.StringKit
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.tuple.MutablePair
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
/*
* 角色管理
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:13
*/
@RestController
@RequestMapping
(
"api/sysRoles"
)
public
class
SysRoleController
extends
CommonCtrl
{
@Autowired
SysRoleService
sysRoleService
;
@Autowired
SysUserRoleRelaService
sysUserRoleRelaService
;
@Autowired
private
AuthService
authService
;
@Autowired
private
SysRoleEntRelaService
sysRoleEntRelaService
;
/** list */
@PreAuthorize
(
"hasAnyAuthority( 'ENT_UR_ROLE_LIST', 'ENT_UR_USER_UPD_ROLE' )"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
SysRole
queryObject
=
getObject
(
SysRole
.
class
);
QueryWrapper
<
SysRole
>
condition
=
new
QueryWrapper
<>();
LambdaQueryWrapper
<
SysRole
>
lambdaCondition
=
condition
.
lambda
();
lambdaCondition
.
eq
(
SysRole:
:
getSystem
,
CS
.
SYS_TYPE
.
MGR
);
lambdaCondition
.
eq
(
SysRole:
:
getBelongInfoId
,
0
);
if
(
StringUtils
.
isNotEmpty
(
queryObject
.
getRoleName
())){
lambdaCondition
.
like
(
SysRole:
:
getRoleName
,
queryObject
.
getRoleName
());
}
if
(
StringUtils
.
isNotEmpty
(
queryObject
.
getRoleId
())){
lambdaCondition
.
like
(
SysRole:
:
getRoleId
,
queryObject
.
getRoleId
());
}
//是否有排序字段
MutablePair
<
Boolean
,
String
>
orderInfo
=
getSortInfo
();
if
(
orderInfo
!=
null
){
condition
.
orderBy
(
true
,
orderInfo
.
getLeft
(),
orderInfo
.
getRight
());
}
else
{
lambdaCondition
.
orderByDesc
(
SysRole:
:
getUpdatedAt
);
}
IPage
<
SysRole
>
pages
=
sysRoleService
.
page
(
getIPage
(
true
),
condition
);
return
ApiRes
.
page
(
pages
);
}
/** detail */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_ROLE_EDIT' )"
)
@RequestMapping
(
value
=
"/{recordId}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
detail
(
@PathVariable
(
"recordId"
)
String
recordId
)
{
return
ApiRes
.
ok
(
sysRoleService
.
getById
(
recordId
));
}
/** add */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_ROLE_ADD' )"
)
@MethodLog
(
remark
=
"添加角色信息"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
public
ApiRes
add
()
{
SysRole
SysRole
=
getObject
(
SysRole
.
class
);
String
roleId
=
"ROLE_"
+
StringKit
.
getUUID
(
6
);
SysRole
.
setRoleId
(
roleId
);
SysRole
.
setSystem
(
CS
.
SYS_TYPE
.
MGR
);
//后台系统
sysRoleService
.
save
(
SysRole
);
//权限信息集合
String
entIdListStr
=
getValString
(
"entIdListStr"
);
//如果包含: 可分配权限的权限 && entIdListStr 不为空
if
(
getCurrentUser
().
getAuthorities
().
contains
(
new
SimpleGrantedAuthority
(
"ENT_UR_ROLE_DIST"
))
&&
StringUtils
.
isNotEmpty
(
entIdListStr
)){
List
<
String
>
entIdList
=
JSONArray
.
parseArray
(
entIdListStr
,
String
.
class
);
sysRoleEntRelaService
.
resetRela
(
roleId
,
entIdList
);
}
return
ApiRes
.
ok
();
}
/** update */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_ROLE_EDIT' )"
)
@RequestMapping
(
value
=
"/{recordId}"
,
method
=
RequestMethod
.
PUT
)
@MethodLog
(
remark
=
"更新角色信息"
)
public
ApiRes
update
(
@PathVariable
(
"recordId"
)
String
recordId
)
{
SysRole
SysRole
=
getObject
(
SysRole
.
class
);
SysRole
.
setRoleId
(
recordId
);
sysRoleService
.
updateById
(
SysRole
);
//权限信息集合
String
entIdListStr
=
getValString
(
"entIdListStr"
);
//如果包含: 可分配权限的权限 && entIdListStr 不为空
if
(
getCurrentUser
().
getAuthorities
().
contains
(
new
SimpleGrantedAuthority
(
"ENT_UR_ROLE_DIST"
))
&&
StringUtils
.
isNotEmpty
(
entIdListStr
)){
List
<
String
>
entIdList
=
JSONArray
.
parseArray
(
entIdListStr
,
String
.
class
);
sysRoleEntRelaService
.
resetRela
(
recordId
,
entIdList
);
List
<
Long
>
sysUserIdList
=
new
ArrayList
<>();
sysUserRoleRelaService
.
list
(
SysUserRoleRela
.
gw
().
eq
(
SysUserRoleRela:
:
getRoleId
,
recordId
)).
stream
().
forEach
(
item
->
sysUserIdList
.
add
(
item
.
getUserId
()));
//查询到该角色的人员, 将redis更新
authService
.
refAuthentication
(
sysUserIdList
);
}
return
ApiRes
.
ok
();
}
/** delete */
@PreAuthorize
(
"hasAuthority('ENT_UR_ROLE_DEL')"
)
@MethodLog
(
remark
=
"删除角色"
)
@RequestMapping
(
value
=
"/{recordId}"
,
method
=
RequestMethod
.
DELETE
)
public
ApiRes
del
(
@PathVariable
(
"recordId"
)
String
recordId
)
{
if
(
sysUserRoleRelaService
.
count
(
SysUserRoleRela
.
gw
().
eq
(
SysUserRoleRela:
:
getRoleId
,
recordId
))
>
0
){
throw
new
BizException
(
"当前角色已分配到用户, 不可删除!"
);
}
sysRoleService
.
removeRole
(
recordId
);
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/sysuser/SysRoleEntRelaController.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.mgr.ctrl.sysuser
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.entity.SysRoleEntRela
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.service.AuthService
;
import
com.jeequan.jeepay.service.impl.SysRoleEntRelaService
;
import
com.jeequan.jeepay.service.impl.SysUserRoleRelaService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
/*
* 角色 权限管理
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:13
*/
@RestController
@RequestMapping
(
"api/sysRoleEntRelas"
)
public
class
SysRoleEntRelaController
extends
CommonCtrl
{
@Autowired
private
SysRoleEntRelaService
sysRoleEntRelaService
;
/** list */
@PreAuthorize
(
"hasAnyAuthority( 'ENT_UR_ROLE_ADD', 'ENT_UR_ROLE_DIST' )"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
SysRoleEntRela
queryObject
=
getObject
(
SysRoleEntRela
.
class
);
LambdaQueryWrapper
<
SysRoleEntRela
>
condition
=
SysRoleEntRela
.
gw
();
if
(
queryObject
.
getRoleId
()
!=
null
){
condition
.
eq
(
SysRoleEntRela:
:
getRoleId
,
queryObject
.
getRoleId
());
}
IPage
<
SysRoleEntRela
>
pages
=
sysRoleEntRelaService
.
page
(
getIPage
(
true
),
condition
);
return
ApiRes
.
page
(
pages
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/sysuser/SysUserController.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.mgr.ctrl.sysuser
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.SysUser
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.utils.StringKit
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.service.AuthService
;
import
com.jeequan.jeepay.service.impl.SysUserAuthService
;
import
com.jeequan.jeepay.service.impl.SysUserService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
/*
* 操作员列表
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:13
*/
@RestController
@RequestMapping
(
"api/sysUsers"
)
public
class
SysUserController
extends
CommonCtrl
{
@Autowired
private
SysUserService
sysUserService
;
@Autowired
private
SysUserAuthService
sysUserAuthService
;
@Autowired
private
AuthService
authService
;
/** list */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_USER_LIST' )"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
SysUser
queryObject
=
getObject
(
SysUser
.
class
);
LambdaQueryWrapper
<
SysUser
>
condition
=
SysUser
.
gw
();
condition
.
eq
(
SysUser:
:
getSystem
,
CS
.
SYS_TYPE
.
MGR
);
if
(
StringUtils
.
isNotEmpty
(
queryObject
.
getRealname
())){
condition
.
like
(
SysUser:
:
getRealname
,
queryObject
.
getRealname
());
}
if
(
queryObject
.
getSysUserId
()
!=
null
){
condition
.
eq
(
SysUser:
:
getSysUserId
,
queryObject
.
getSysUserId
());
}
condition
.
orderByDesc
(
SysUser:
:
getCreatedAt
);
//时间: 降序
IPage
<
SysUser
>
pages
=
sysUserService
.
page
(
getIPage
(),
condition
);
return
ApiRes
.
page
(
pages
);
}
/** detail */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_USER_EDIT' )"
)
@RequestMapping
(
value
=
"/{recordId}"
,
method
=
RequestMethod
.
GET
)
public
ApiRes
detail
(
@PathVariable
(
"recordId"
)
Integer
recordId
)
{
return
ApiRes
.
ok
(
sysUserService
.
getById
(
recordId
));
}
/** add */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_USER_ADD' )"
)
@MethodLog
(
remark
=
"添加管理员"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
public
ApiRes
add
()
{
SysUser
sysUser
=
getObject
(
SysUser
.
class
);
sysUser
.
setBelongInfoId
(
"0"
);
sysUserService
.
addSysUser
(
sysUser
,
CS
.
SYS_TYPE
.
MGR
);
return
ApiRes
.
ok
();
}
/** 修改操作员 登录认证信息 */
// @RequestMapping(value="/modifyPwd", method = RequestMethod.PUT)
// @MethodLog(remark = "修改操作员密码")
public
ApiRes
authInfo
()
{
Long
opSysUserId
=
getValLongRequired
(
"recordId"
);
//操作员ID
//更改密码, 验证当前用户信息
String
currentUserPwd
=
getValStringRequired
(
"originalPwd"
);
//当前用户登录密码
//验证当前密码是否正确
if
(!
sysUserAuthService
.
validateCurrentUserPwd
(
currentUserPwd
)){
throw
new
BizException
(
"原密码验证失败!"
);
}
String
opUserPwd
=
getValStringRequired
(
"confirmPwd"
);
// 验证原密码与新密码是否相同
if
(
opUserPwd
.
equals
(
currentUserPwd
))
{
throw
new
BizException
(
"新密码与原密码相同!"
);
}
sysUserAuthService
.
resetAuthInfo
(
opSysUserId
,
null
,
null
,
opUserPwd
,
CS
.
SYS_TYPE
.
MGR
);
return
ApiRes
.
ok
();
}
/** update */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_USER_EDIT' )"
)
@RequestMapping
(
value
=
"/{recordId}"
,
method
=
RequestMethod
.
PUT
)
@MethodLog
(
remark
=
"修改操作员信息"
)
public
ApiRes
update
(
@PathVariable
(
"recordId"
)
Long
recordId
)
{
SysUser
sysUser
=
getObject
(
SysUser
.
class
);
sysUser
.
setSysUserId
(
recordId
);
//判断是否自己禁用自己
if
(
recordId
.
equals
(
getCurrentUser
().
getSysUser
().
getSysUserId
())
&&
sysUser
.
getState
()
!=
null
&&
sysUser
.
getState
()
==
CS
.
PUB_DISABLE
){
throw
new
BizException
(
"系统不允许禁用当前登陆用户!"
);
}
sysUserService
.
updateSysUser
(
sysUser
);
//如果用户被禁用,需要更新redis数据
if
(
sysUser
.
getState
()
!=
null
&&
sysUser
.
getState
()
==
CS
.
PUB_DISABLE
){
authService
.
refAuthentication
(
Arrays
.
asList
(
recordId
));
}
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/sysuser/SysUserRoleRelaController.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.mgr.ctrl.sysuser
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.entity.SysUserRoleRela
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.service.AuthService
;
import
com.jeequan.jeepay.service.impl.SysUserRoleRelaService
;
import
com.jeequan.jeepay.service.impl.SysUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
import
java.util.List
;
/*
* 用户角色关联关系
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:13
*/
@RestController
@RequestMapping
(
"api/sysUserRoleRelas"
)
public
class
SysUserRoleRelaController
extends
CommonCtrl
{
@Autowired
private
SysUserRoleRelaService
sysUserRoleRelaService
;
@Autowired
private
SysUserService
sysUserService
;
@Autowired
private
AuthService
authService
;
/** list */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_USER_UPD_ROLE' )"
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
ApiRes
list
()
{
SysUserRoleRela
queryObject
=
getObject
(
SysUserRoleRela
.
class
);
LambdaQueryWrapper
<
SysUserRoleRela
>
condition
=
SysUserRoleRela
.
gw
();
if
(
queryObject
.
getUserId
()
!=
null
){
condition
.
eq
(
SysUserRoleRela:
:
getUserId
,
queryObject
.
getUserId
());
}
IPage
<
SysUserRoleRela
>
pages
=
sysUserRoleRelaService
.
page
(
getIPage
(
true
),
condition
);
return
ApiRes
.
page
(
pages
);
}
/** 重置用户角色关联信息 */
@PreAuthorize
(
"hasAuthority( 'ENT_UR_USER_UPD_ROLE' )"
)
@RequestMapping
(
value
=
"relas/{sysUserId}"
,
method
=
RequestMethod
.
POST
)
@MethodLog
(
remark
=
"更改用户角色信息"
)
public
ApiRes
relas
(
@PathVariable
(
"sysUserId"
)
Long
sysUserId
)
{
List
<
String
>
roleIdList
=
JSONArray
.
parseArray
(
getValStringRequired
(
"roleIdListStr"
),
String
.
class
);
sysUserService
.
saveUserRole
(
sysUserId
,
roleIdList
);
authService
.
refAuthentication
(
Arrays
.
asList
(
sysUserId
));
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/queue/MqQueue4ModifyMchUserRemove.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.mgr.mq.queue
;
import
com.jeequan.jeepay.core.constants.CS
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
/**
* 商户用户信息清除
*
* @author pangxiaoyu
* @site https://www.jeepay.vip
* @date 2021-06-07 07:15
*/
@Slf4j
@Component
public
class
MqQueue4ModifyMchUserRemove
extends
ActiveMQQueue
{
@Autowired
private
JmsTemplate
jmsTemplate
;
public
MqQueue4ModifyMchUserRemove
(){
super
(
CS
.
MQ
.
QUEUE_MODIFY_MCH_USER_REMOVE
);
}
/**
* @author: pangxiaoyu
* @date: 2021/6/7 16:16
* @describe: 推送消息到各个节点
*/
public
void
push
(
String
userIdStr
)
{
this
.
jmsTemplate
.
convertAndSend
(
this
,
userIdStr
);
}
}
Prev
1
2
3
4
5
6
7
8
9
…
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