feat:宁波银行权限校验
This commit is contained in:
1 parent
26de11e567
commit
68419fe9ac
15 files changed
+155
-27
No files matched your search
+6
-6
@@ -149,10 +149,10 @@ public class HardOrderTotalController {
|
||||
}
|
||||
|
||||
@Operation(summary = "设备交易记录导出", description = "设备交易记录导出")
|
||||
@GetMapping("/export-sb")
|
||||
@PostMapping("/export-sb")
|
||||
@SysLog("设备交易记录导出")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardTotal_export_sb')")
|
||||
public void exportSb(HttpServletResponse response, HardOrderDto dto) throws IOException {
|
||||
public void exportSb(HttpServletResponse response, @RequestBody HardOrderDto dto) throws IOException {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
List<HardOrderSbVo> list = hardOrderTotalService.listSb(dto);
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream("file/设备交易金额汇总.xlsx")).build()) {
|
||||
@@ -223,10 +223,10 @@ public class HardOrderTotalController {
|
||||
|
||||
|
||||
@Operation(summary = "商户交易记录导出", description = "商户交易记录导出")
|
||||
@GetMapping("/export-cs")
|
||||
@PostMapping("/export-cs")
|
||||
@SysLog("商户交易记录导出")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardTotal_export_cs')")
|
||||
public void exportTk(HttpServletResponse response, HardOrderDto dto) throws IOException {
|
||||
public void exportTk(HttpServletResponse response, @RequestBody HardOrderDto dto) throws IOException {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
// 查询商户和下面的子商户
|
||||
List<Long> mchDtoIds = new ArrayList<>();
|
||||
@@ -308,10 +308,10 @@ public class HardOrderTotalController {
|
||||
}
|
||||
|
||||
@Operation(summary = "支付方式交易记录", description = "支付方式交易记录")
|
||||
@GetMapping("/export-payType")
|
||||
@PostMapping("/export-payType")
|
||||
@SysLog("支付方式交易记录")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardTotal_export_payType')")
|
||||
public void exportPayType(HttpServletResponse response, HardOrderDto dto) throws IOException {
|
||||
public void exportPayType(HttpServletResponse response, @RequestBody HardOrderDto dto) throws IOException {
|
||||
List<HardOrderPayTypeVo> list = hardOrderTotalService.listPayType(dto);
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream("file/支付方式交易汇总.xlsx")).build()) {
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ public enum ThirdPayVoStatusEnum {
|
||||
|
||||
SUCCESS(200, "成功"),
|
||||
SIGN_ERROR(400, "签名验证失败"),
|
||||
PARAMS_ERROR(500, "参数错误"),
|
||||
USER_EXIST(501, "用户不存在"),
|
||||
ORDER_EXIST(502, "订单不存在"),
|
||||
BALANCE_NOT_ENOUGH(505, "用户余额不足"),
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.bsd.pjcloud.thirdparty.vo.pay;
|
||||
|
||||
import com.bsd.pjcloud.thirdparty.constant.pay.ThirdPayVoStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PayBaseVo<T> {
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
private T data;
|
||||
|
||||
public void set(ThirdPayVoStatusEnum type) {
|
||||
code = type.getType();
|
||||
message = type.getDescription();
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@ public class PayGetWalletInfoVo {
|
||||
/**
|
||||
* 用户真实姓名
|
||||
*/
|
||||
private String username;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户余额(分)
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.bsd.pjcloud.thirdparty.vo.pay;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PayWalletInfoVo {
|
||||
|
||||
/**
|
||||
* sm4加密后的手机号
|
||||
*/
|
||||
private String signPhone;
|
||||
|
||||
/**
|
||||
* 用户真实姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户余额(分)
|
||||
*/
|
||||
private Integer balance;
|
||||
|
||||
}
|
||||
+10
-3
@@ -2,9 +2,12 @@ package com.bsd.pjcloud.thirdparty.controller.pay;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.PayGetWalletInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdPayApiService;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdPayLogService;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayBaseVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayWalletInfoVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -28,12 +31,16 @@ public class ThirdPayApiController {
|
||||
|
||||
private final ThirdPayApiService thirdPayApiService;
|
||||
|
||||
@Inner(value = false)
|
||||
@Operation(summary = "通过手机号查询用户钱包信息", description = "通过手机号查询用户钱包信息")
|
||||
@GetMapping("/user-wallet")
|
||||
public R getWalletInfo(HttpEntity<String> httpEntity, @RequestHeader Map<String, String> headers) {
|
||||
@PostMapping("/user-wallet")
|
||||
public PayBaseVo<PayWalletInfoVo> getWalletInfo(HttpEntity<String> httpEntity, @RequestHeader Map<String, String> headers) {
|
||||
String body = httpEntity.getBody();
|
||||
return R.ok(thirdPayApiService.getWalletInfo(body, headers));
|
||||
return thirdPayApiService.getWalletInfo(body, headers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+2
-4
@@ -4,9 +4,7 @@ package com.bsd.pjcloud.thirdparty.service;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.PayDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.PayGetWalletInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.RefundDto;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayGetWalletInfoVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.RefundVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -25,5 +23,5 @@ public interface ThirdPayApiService {
|
||||
/**
|
||||
* 根据加密的手机号查询用户钱包信息
|
||||
*/
|
||||
PayGetWalletInfoVo getWalletInfo(String json, Map<String, String> headers);
|
||||
PayBaseVo<PayWalletInfoVo> getWalletInfo(String json, Map<String, String> headers);
|
||||
}
|
||||
+34
-8
@@ -2,7 +2,9 @@ package com.bsd.pjcloud.thirdparty.service.impl.pay;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.thirdparty.constant.pay.ThirdPayApiBizTypeEnum;
|
||||
import com.bsd.pjcloud.thirdparty.constant.pay.ThirdPayVoStatusEnum;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.PayDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.PayGetWalletInfoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.RefundDto;
|
||||
@@ -12,9 +14,10 @@ import com.bsd.pjcloud.thirdparty.service.ThirdKeyManageService;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdPayApiService;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdPayLogService;
|
||||
import com.bsd.pjcloud.thirdparty.utils.lb.tool.LbRetailSignUtils;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayGetWalletInfoVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.RefundVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.*;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -37,6 +40,8 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
private final ThirdKeyManageService keyManageService;
|
||||
private final ThirdPayLogService payLogService;
|
||||
|
||||
private final RemoteWalletService remoteWalletService;
|
||||
|
||||
/**
|
||||
* 扣款
|
||||
*/
|
||||
@@ -83,17 +88,38 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
* 根据加密的手机号查询用户钱包信息
|
||||
*/
|
||||
@Override
|
||||
public PayGetWalletInfoVo getWalletInfo(String json, Map<String, String> headers) {
|
||||
public PayBaseVo<PayWalletInfoVo> getWalletInfo(String json, Map<String, String> headers) {
|
||||
PayBaseVo baseVo = new PayBaseVo<PayWalletInfoVo>();
|
||||
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
|
||||
if (ObjectUtil.isEmpty(keySetting)) {
|
||||
|
||||
return null;
|
||||
baseVo.set(ThirdPayVoStatusEnum.SIGN_ERROR);
|
||||
return baseVo;
|
||||
}
|
||||
PayGetWalletInfoDto dto = JSONUtil.toBean(json, PayGetWalletInfoDto.class);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.PARAMS_ERROR);
|
||||
return baseVo;
|
||||
}
|
||||
// 手机号解密
|
||||
String phone = LbRetailSignUtils.sm4Decrypt(dto.getSignPhone(), keySetting.getFieldKey());
|
||||
|
||||
return null;
|
||||
if (ObjectUtil.isEmpty(phone)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.PARAMS_ERROR);
|
||||
baseVo.setMessage("手机号解迷失败");
|
||||
return baseVo;
|
||||
}
|
||||
WalletManageVo userWallet = remoteWalletService.getWalletByUserPhone(phone, WalletTypeEnum.EAT).getData();
|
||||
if (ObjectUtil.isEmpty(userWallet)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.USER_EXIST);
|
||||
return baseVo;
|
||||
}
|
||||
PayGetWalletInfoVo result = new PayGetWalletInfoVo();
|
||||
result.setSignPhone(dto.getSignPhone());
|
||||
result.setBalance(userWallet.getBalance());
|
||||
result.setName(userWallet.getUsername());
|
||||
// 返回成功的参数
|
||||
baseVo.set(ThirdPayVoStatusEnum.SUCCESS);
|
||||
baseVo.setData(result);
|
||||
return baseVo;
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -54,6 +54,13 @@ public interface RemoteUserService {
|
||||
@GetMapping("/user/info/{username}")
|
||||
R<UserInfo> info(@PathVariable("username") String username);
|
||||
|
||||
/**
|
||||
* 根据手机号查询用户
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/inner/phone")
|
||||
R<UserInfo> getInnerByPhone(@RequestParam String phone);
|
||||
|
||||
/**
|
||||
* 通过用户id查询用户、角色信息
|
||||
*/
|
||||
|
||||
+14
-3
@@ -121,6 +121,16 @@ public class SysUserController {
|
||||
return R.ok(userService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号查询用户
|
||||
*/
|
||||
@GetMapping("/user/inner/phone")
|
||||
R<UserInfo> getInnerByPhone(@RequestParam String phone) {
|
||||
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getPhone, phone));
|
||||
if (user == null) return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERINFO_EMPTY, phone));
|
||||
return R.ok(userService.findUserInfo(user));
|
||||
}
|
||||
|
||||
@GetMapping("/get-by-user-id")
|
||||
public R getByUserId(@RequestParam Long userId) {
|
||||
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUserId, userId));
|
||||
@@ -361,14 +371,15 @@ public class SysUserController {
|
||||
|
||||
/**
|
||||
* 根据部门id查询用户列表
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
// @Inner
|
||||
@GetMapping("/getUserIdListByDeptId")
|
||||
public R<List<SimpleUserListVO>> getUserIdListByDeptId(@RequestParam("deptId")Long deptId,
|
||||
@RequestParam(value = "name",required = false) String name) {
|
||||
return R.ok(userService.listUserIdByDeptId(deptId,name));
|
||||
public R<List<SimpleUserListVO>> getUserIdListByDeptId(@RequestParam("deptId") Long deptId,
|
||||
@RequestParam(value = "name", required = false) String name) {
|
||||
return R.ok(userService.listUserIdByDeptId(deptId, name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
@@ -32,6 +32,10 @@ public interface RemoteWalletService {
|
||||
@GetMapping("/wallet-manage/get-wallet-by-id")
|
||||
R<WalletManageVo> getWalletById(@RequestParam Long walletId);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/wallet-manage/get-wallet-by-phone")
|
||||
R<WalletManageVo> getWalletByUserPhone(@RequestParam String phone, @RequestParam WalletTypeEnum walletTypeCode);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/wallet-manage/get-wallet-by-card-number")
|
||||
R<WalletManageEntity> getWalletByCardNumber(@RequestParam String cardNumber);
|
||||
|
||||
+7
-1
@@ -89,12 +89,18 @@ public class WalletManageController {
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-wallet-by-id")
|
||||
public R getWalletById(@RequestParam Long walletId) {
|
||||
public R<WalletManageVo> getWalletById(@RequestParam Long walletId) {
|
||||
WalletManageVo wallet = walletManageMapper.join(walletId);
|
||||
if (ObjectUtil.isEmpty(wallet)) return R.failed("用户钱包不存在");
|
||||
return R.ok(wallet);
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-wallet-by-phone")
|
||||
public R<WalletManageVo> getWalletByUserPhone(@RequestParam String phone, @RequestParam WalletTypeEnum walletTypeCode) {
|
||||
return R.ok(walletManageService.getWalletByPhone(phone, walletTypeCode));
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-wallet-by-card-number")
|
||||
public R getWalletByCardNumber(@RequestParam String cardNumber) {
|
||||
|
||||
+1
@@ -173,6 +173,7 @@ public class WalletTransactionController {
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')")
|
||||
public void exportCz(HttpServletResponse response, @RequestBody WalletTransactionDto dto) {
|
||||
dto.setBizTypes(WalletBizEnum.getTopUpCodes());
|
||||
dto.setType(WalletTransactionDto.TYPE_INCOME);
|
||||
List<WalletTransactionVo> list = walletTransactionService.scopeList(dto, DataScope.of());
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人充值明细.xlsx", list);
|
||||
}
|
||||
|
||||
+5
@@ -52,6 +52,11 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
*/
|
||||
WalletManageEntity getWallet(@NotNull Long walletId);
|
||||
|
||||
/**
|
||||
* 根据手机号获取钱包
|
||||
*/
|
||||
WalletManageVo getWalletByPhone(String phone, WalletTypeEnum walletTypeCode);
|
||||
|
||||
/**
|
||||
* 根据用户id删除用户钱包
|
||||
*/
|
||||
|
||||
+20
-1
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
@@ -56,7 +57,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -181,6 +181,25 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
return baseMapper.selectById(walletId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号获取钱包
|
||||
*/
|
||||
@Override
|
||||
public WalletManageVo getWalletByPhone(String phone, WalletTypeEnum walletTypeCode) {
|
||||
// 查询用户
|
||||
UserInfo userInfo = userService.getInnerByPhone(phone).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) return null;
|
||||
Long userId = userInfo.getSysUser().getUserId();
|
||||
WalletManageEntity wallet = getWallet(userId, walletTypeCode);
|
||||
WalletManageVo result = BeanUtil.toBean(wallet, WalletManageVo.class);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (ObjectUtil.isNotEmpty(userInfo)) {
|
||||
DataUtil.convertUser(result, userInfo.getSysUser());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delWalletByUserIds(List<@NotNull Long> userIds) {
|
||||
if (ObjectUtil.isEmpty(userIds)) return false;
|
||||
|
||||
Reference in new issue
Block a user