11
This commit is contained in:
1 parent
d49adeda3a
commit
4b289e52ce
6 files changed
+42
-30
No files matched your search
+6
-1
@@ -6,8 +6,13 @@ import lombok.Data;
|
||||
public class PayGetWalletInfoDto {
|
||||
|
||||
/**
|
||||
* sm4加密后的手机号
|
||||
* sm4加密后的手机号(优先级userId>signPhone)
|
||||
*/
|
||||
private String signPhone;
|
||||
|
||||
/**
|
||||
* 用户id(优先级userId>signPhone)
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
+31
-12
@@ -2,6 +2,8 @@ package com.bsd.pjcloud.thirdparty.service.impl.pay;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.hard.api.feign.RemoteHardOrderService;
|
||||
import com.bsd.pjcloud.hard.api.feign.RemoteHardThirdPayService;
|
||||
import com.bsd.pjcloud.thirdparty.constant.pay.ThirdPayApiBizTypeEnum;
|
||||
@@ -43,6 +45,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
private final ThirdKeyManageService keyManageService;
|
||||
private final ThirdPayLogService payLogService;
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteWalletService walletService;
|
||||
private final RemoteHardOrderService hardOrderService;
|
||||
private final RemoteHardThirdPayService hardThirdPayService;
|
||||
@@ -171,7 +174,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
return baseVo;
|
||||
}
|
||||
PayGetWalletInfoDto dto = JSONUtil.toBean(json, PayGetWalletInfoDto.class);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
if (ObjectUtil.isEmpty(dto) || ObjectUtil.isAllEmpty(dto.getSignPhone(), dto.getUserId())) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.PARAMS_ERROR);
|
||||
// 日志
|
||||
logObj.setRes(JSONUtil.toJsonStr(baseVo));
|
||||
@@ -179,18 +182,34 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
payLogService.save(logObj);
|
||||
return baseVo;
|
||||
}
|
||||
// 手机号解密
|
||||
String phone = LbRetailSignUtils.sm4Decrypt(dto.getSignPhone(), keySetting.getFieldKey());
|
||||
if (ObjectUtil.isEmpty(phone)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.PARAMS_ERROR);
|
||||
baseVo.setMessage("手机号解析失败");
|
||||
// 日志
|
||||
logObj.setRes(JSONUtil.toJsonStr(baseVo));
|
||||
logObj.setTimeConsuming(Long.toString(System.currentTimeMillis() - startTime));
|
||||
payLogService.save(logObj);
|
||||
return baseVo;
|
||||
String userPhone = null;
|
||||
// 判断是根据手机号查询还是根据用户id查询
|
||||
if (ObjectUtil.isNotEmpty(dto.getUserId())) {
|
||||
UserInfo userInfo = userService.getByUserId(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.USER_EXIST);
|
||||
// 日志
|
||||
logObj.setRes(JSONUtil.toJsonStr(baseVo));
|
||||
logObj.setTimeConsuming(Long.toString(System.currentTimeMillis() - startTime));
|
||||
payLogService.save(logObj);
|
||||
return baseVo;
|
||||
}
|
||||
userPhone = userInfo.getSysUser().getPhone();
|
||||
}
|
||||
WalletManageVo userWallet = walletService.getWalletByUserPhone(phone, WalletTypeEnum.PAY).getData();
|
||||
if (ObjectUtil.isNotEmpty(dto.getSignPhone()) && ObjectUtil.isEmpty(dto.getUserId())) {
|
||||
// 手机号解密
|
||||
userPhone = LbRetailSignUtils.sm4Decrypt(dto.getSignPhone(), keySetting.getFieldKey());
|
||||
if (ObjectUtil.isEmpty(userPhone)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.PARAMS_ERROR);
|
||||
baseVo.setMessage("手机号解析失败");
|
||||
// 日志
|
||||
logObj.setRes(JSONUtil.toJsonStr(baseVo));
|
||||
logObj.setTimeConsuming(Long.toString(System.currentTimeMillis() - startTime));
|
||||
payLogService.save(logObj);
|
||||
return baseVo;
|
||||
}
|
||||
}
|
||||
WalletManageVo userWallet = walletService.getWalletByUserPhone(userPhone, WalletTypeEnum.PAY).getData();
|
||||
if (ObjectUtil.isEmpty(userWallet)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.USER_EXIST);
|
||||
// 日志
|
||||
|
||||
Binary file not shown.
+3
-2
@@ -29,8 +29,8 @@ import java.util.Map;
|
||||
@SpringBootTest(classes = ThirdPartyApp.class)
|
||||
public class PayTest {
|
||||
|
||||
private final String baseUrl = "http://123.156.230.15:8089/api";
|
||||
// private final String baseUrl = "http://127.0.0.1:9999";
|
||||
// private final String baseUrl = "http://123.156.230.15:8089/api";
|
||||
private final String baseUrl = "http://127.0.0.1:9999";
|
||||
|
||||
private final String walletInfoUrl = "/third/third-pay-api/user-wallet";
|
||||
|
||||
@@ -63,6 +63,7 @@ public class PayTest {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("signPhone", LbRetailSignUtils.sm4Encrypt("17683843141", config.getFieldKey()));
|
||||
// paramsMap.put("userId", 1875049673022279681L);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletInfoUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
|
||||
+1
-14
@@ -2,9 +2,7 @@ package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
|
||||
@@ -47,16 +45,5 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
|
||||
|
||||
List<MchManageVo> scopeList(@Param("dto") MchManageDto dto, DataScope dataScope);
|
||||
|
||||
Page<MchManageVo> scopePageList(Page page, @Param("dto") MchManageDto dto, DataScope dataScope);
|
||||
|
||||
default List<MchManageEntity> scopeList(MchManageDto dto) {
|
||||
LambdaQueryWrapper<MchManageEntity> wrapper = new LambdaQueryWrapper<MchManageEntity>()
|
||||
.like(ObjectUtil.isNotEmpty(dto.getName()), MchManageEntity::getName, dto.getName())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds())
|
||||
.orderByDesc(MchManageEntity::getSort)
|
||||
.orderByDesc(MchManageEntity::getCreateTime)
|
||||
.orderByDesc(MchManageEntity::getId);
|
||||
return selectListByScope(wrapper, DataScope.of());
|
||||
}
|
||||
Page<MchManageVo> scopePageList(@Param("dto") MchManageDto dto, Page page, DataScope dataScope);
|
||||
}
|
||||
+1
-1
@@ -215,7 +215,7 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
|
||||
@Override
|
||||
public Page<MchManageVo> scopePageList(Page page, MchManageDto dto, DataScope dataScope) {
|
||||
Page<MchManageVo> list = baseMapper.scopePageList(page, dto, dataScope);
|
||||
Page<MchManageVo> list = baseMapper.scopePageList(dto, page, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(MchManageVo::getDeptId).distinct().toList();
|
||||
|
||||
Reference in new issue
Block a user