feat:饭卡支付判断饭卡是否冻结

This commit is contained in:
dzc committed 2025-05-29 10:16:34 +08:00
1 parent 90bfb4121f
commit 1b19520f41
5 files changed
+97 -76

No files matched your search

@@ -5,6 +5,7 @@ import com.bsd.pjcloud.admin.api.dto.UserInfo;
import com.bsd.pjcloud.admin.api.entity.SysUser;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
import com.bsd.pjcloud.hard.api.vo.android.HardAdUserVo;
import com.bsd.pjcloud.hard.service.HardApiService;
@@ -67,6 +68,10 @@ public class HardApiServiceImpl implements HardApiService {
// 查询钱包
WalletManageEntity wallet = remoteWalletService.getWalletByCardNumber(card).getData();
if (ObjectUtil.isEmpty(wallet)) return null;
// 判断钱包是否冻结
if (ObjectUtil.equals(wallet.getIsFreeze(), YesNoEnum.YES.getCode())) {
throw new RuntimeException("钱包已冻结");
}
// 查询用户
UserInfo user = userService.getInnerByUserId(wallet.getUserId()).getData();
if (ObjectUtil.isEmpty(user)) return null;
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
@@ -21,100 +22,106 @@ import java.time.LocalDateTime;
public class ThirdPayLogEntity extends Model<ThirdPayLogEntity> {
/**
* 主键
*/
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="主键")
@Schema(description = "主键")
private Long id;
/**
* 支付发起方类型id
*/
@Schema(description="支付发起方类型id")
/**
* 支付发起方类型id
*/
@Schema(description = "支付发起方类型id")
private String paySourceType;
/**
* 支付类型
*/
@Schema(description="支付类型")
/**
* 支付类型
*/
@Schema(description = "支付类型")
private String bizType;
/**
* 支付类型id
*/
@Schema(description="支付类型id")
/**
* 支付类型id
*/
@Schema(description = "支付类型id")
private String bizId;
/**
* api-url
*/
@Schema(description="api-url")
/**
* api-url
*/
@Schema(description = "api-url")
private String apiUrl;
/**
* res
*/
@Schema(description="res")
/**
* header
*/
@Schema(description = "header")
private String header;
/**
* res
*/
@Schema(description = "res")
private String res;
/**
* req
*/
@Schema(description="req")
/**
* req
*/
@Schema(description = "req")
private String req;
/**
* 调用错误
*/
@Schema(description="调用错误")
/**
* 调用错误
*/
@Schema(description = "调用错误")
private String error;
/**
* 耗时(毫秒)
*/
@Schema(description="耗时(毫秒)")
/**
* 耗时(毫秒)
*/
@Schema(description = "耗时(毫秒)")
private String timeConsuming;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新人")
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "更新人")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
/**
* 删除时间
*/
/**
* 删除时间
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="删除时间")
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除时间")
private String delFlag;
/**
* tenantId
*/
@Schema(description="tenantId")
/**
* tenantId
*/
@Schema(description = "tenantId")
private Long tenantId;
}
@@ -22,7 +22,6 @@ import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -54,7 +53,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
@Override
public PayBaseVo<PayVo> walletPay(String json, Map<String, String> headers) {
long startTime = System.currentTimeMillis();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/wallet-pay").bizType(ThirdPayApiBizTypeEnum.PAY.getType()).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).req(json).build();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/wallet-pay").bizType(ThirdPayApiBizTypeEnum.PAY.getType()).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).header(JSONUtil.toJsonStr(headers)).req(json).build();
// 开始处理
PayBaseVo baseVo = new PayBaseVo<PayVo>();
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
@@ -106,7 +105,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
@Override
public PayBaseVo<RefundVo> walletRefund(String json, Map<String, String> headers) {
long startTime = System.currentTimeMillis();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/wallet-refund").bizType(ThirdPayApiBizTypeEnum.REFUND.getType()).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).req(json).build();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/wallet-refund").bizType(ThirdPayApiBizTypeEnum.REFUND.getType()).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).req(json).header(JSONUtil.toJsonStr(headers)).build();
// 开始处理
PayBaseVo baseVo = new PayBaseVo<RefundVo>();
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
@@ -159,7 +158,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
public PayBaseVo<PayWalletInfoVo> getWalletInfo(String json, Map<String, String> headers) {
// 日志
long startTime = System.currentTimeMillis();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/user-wallet").bizType(ThirdPayApiBizTypeEnum.WALLET_INFO.getType()).req(json).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/user-wallet").bizType(ThirdPayApiBizTypeEnum.WALLET_INFO.getType()).req(json).header(JSONUtil.toJsonStr(headers)).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
// 开始处理
PayBaseVo baseVo = new PayBaseVo<PayWalletInfoVo>();
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
@@ -222,7 +221,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
public PayBaseVo<List<PayWaterVo>> water(String json, Map<String, String> headers) {
// 日志
long startTime = System.currentTimeMillis();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/water").bizType(ThirdPayApiBizTypeEnum.WATER.getType()).req(json).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/water").bizType(ThirdPayApiBizTypeEnum.WATER.getType()).req(json).header(JSONUtil.toJsonStr(headers)).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
// 开始处理
PayBaseVo baseVo = new PayBaseVo<PayWalletInfoVo>();
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
@@ -273,7 +272,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
public PayBaseVo<PayWaterVo> detail(String json, Map<String, String> headers) {
// 日志
long startTime = System.currentTimeMillis();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/detail").bizType(ThirdPayApiBizTypeEnum.DETAIL.getType()).req(json).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/detail").bizType(ThirdPayApiBizTypeEnum.DETAIL.getType()).req(json).header(JSONUtil.toJsonStr(headers)).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
// 开始处理
PayBaseVo baseVo = new PayBaseVo<PayWaterVo>();
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
@@ -30,6 +30,7 @@ import java.util.Map;
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 walletInfoUrl = "/third/third-pay-api/user-wallet";
@@ -78,7 +79,7 @@ public class PayTest {
public void walletPay() throws Exception {
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("userId", 1875049673022279681L);
paramsMap.put("thirdOrderId", "5");
paramsMap.put("thirdOrderId", System.currentTimeMillis());
paramsMap.put("price", 100);
paramsMap.put("products", null);
String body = JSONUtil.toJsonStr(paramsMap);
@@ -159,6 +160,13 @@ public class PayTest {
log.info(res);
}
@Test
public void test() {
String headers = "{\"X-Forwarded-Prefix\":\"/third\",\"sign\":\"c668f17f92907fed5ea62e899c1782c5\",\"User-Agent\":\"okhttp/3.14.9\",\"Accept-Encoding\":\"gzip\",\"UniqueFlowNo\":\"OPENAPI01-20250529100755-437087\",\"Content-Encoding\":\"UTF-8\",\"host\":\"192.168.0.192:6061\",\"X-B3-Sampled\":\"0\",\"X-B3-TraceId\":\"9590477961c17418\",\"Content-Length\":\"75\",\"X-Real-IP\":\"221.12.37.146\",\"timestamp\":\"1748484475\",\"Content-Type\":\"application/json\",\"Accept\":\"*/*\",\"X-B3-ParentSpanId\":\"9590477961c17418\",\"X-Forwarded-Host\":\"123.156.230.15:8089\",\"X-Forwarded-Proto\":\"http,http\",\"app-key\":\"HB0llhHmc56AW9yw\",\"X-Forwarded-Port\":\"8089\",\"x-client-token\":\"eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJqaW5oZmgtbWhzaC1zZXJ2aWNlIiwidXNlcklkIjoiNDA4MyIsIm5hbWUiOiJqaW5oZmgtbWhzaC1zZXJ2aWNlIiwiZXhwIjoyMDYzODQ0MDAwfQ.Woq4L0kiCCbVYFt8PwFj71eBx-u2S3mlX13dq7lEZwR8ILSxJNeLuK6JPoV72YLW82G9hRQHHncMZL3O4UnvmP2CWRIet3ekfW-61_PW82sgEIiKXK3bS5nBiQmk5vEChYG8VQ5Ze6lGkxL0baPujqA-CPV9KiQ0HNXLFKFec0w\",\"NEBULA-DST-SERVICE\":\"iobp-itfin-api\",\"X-B3-SpanId\":\"a9fd27f63a83ff9c\",\"biz-type\":\"10\",\"traceparent\":\"00-4f690c2f2e5c5784a6415a740b5fb80a-d33a2abbf42c407c-01\",\"Forwarded\":\"proto=http;host=\\\"123.156.230.15:8089\\\";for=\\\"127.0.0.1:52440\\\"\",\"X-Forwarded-For\":\"221.12.37.146,127.0.0.1\",\"REQUEST-START-TIME\":\"1748484466443\"}";
String params = "{\"price\":1,\"thirdOrderId\":\"202505260000001\",\"userId\":\"1875049673022279681\"}";
keyManageService.checkSignAndReturnConfig(params, JSONUtil.toBean(headers, Map.class));
}
private ThirdKeyManageEntity getLbConfig() {
return keyManageService.get(ThirdKeyTypeEnum.LB);
}
@@ -121,9 +121,11 @@ public class MchManageController {
PjcloudUser user = SecurityUtils.getUser();
dto.setVisibleMobile(YesNoEnum.YES.getCode());
// 如果是食堂判断用户是否能查看到所有食堂
boolean isConsumeUser = mchManageService.getIsConsumeUser(user.getId());
if (isConsumeUser) {
dto.setCanteenIsOpen(YesNoEnum.YES.getCode());
if (ObjectUtil.equals(dto.getType(), MerchantTypeEnum.CANTEEN.getType())) {
boolean isConsumeUser = mchManageService.getIsConsumeUser(user.getId());
if (isConsumeUser) {
dto.setCanteenIsOpen(YesNoEnum.YES.getCode());
}
}
return R.ok(mchManageService.pageJoin(page, dto));
}