feat:打包排除文档
This commit is contained in:
1 parent
fb703a956d
commit
ef1194ee0b
10 files changed
+75
-38
No files matched your search
+6
-2
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.hard.api.feign;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.PayDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.RefundDto;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayBaseVo;
|
||||
@@ -10,18 +11,21 @@ import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(contextId = "remoteHardThirdPayService", value = ServiceNameConstants.HARDWARE_SERVICE)
|
||||
public interface RemoteHardThirdPayService {
|
||||
/**
|
||||
* 第三方支付
|
||||
*/
|
||||
@PostMapping("/hard-third-pay/wallet-refund")
|
||||
PayBaseVo<PayVo> walletPay(@RequestBody PayDto dto, WalletTypeEnum walletType);
|
||||
@NoToken
|
||||
@PostMapping("/hard-third-pay/wallet-pay")
|
||||
PayBaseVo<PayVo> walletPay(@RequestBody PayDto dto, @RequestParam WalletTypeEnum walletType);
|
||||
|
||||
/**
|
||||
* 第三方退款
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/hard-third-pay/wallet-refund")
|
||||
PayBaseVo<RefundVo> walletRefund(@RequestBody RefundDto dto);
|
||||
|
||||
|
||||
+2
-5
@@ -14,10 +14,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@@ -32,7 +29,7 @@ public class HardThirdPayController {
|
||||
@PostMapping("/wallet-pay")
|
||||
@SysLog("第三方支付")
|
||||
@Operation(summary = "第三方支付")
|
||||
public PayBaseVo<PayVo> walletPay(@RequestBody PayDto dto, WalletTypeEnum walletType) {
|
||||
public PayBaseVo<PayVo> walletPay(@RequestBody PayDto dto, @RequestParam WalletTypeEnum walletType) {
|
||||
return hardThirdPayService.walletPay(dto, walletType);
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.pay;
|
||||
|
||||
import com.bsd.pjcloud.thirdparty.constant.pay.ThirdPaySoureBizTypeEnum;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -11,16 +12,19 @@ public class PayDto {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 第三方订单唯一id
|
||||
* 第三方唯一流水id
|
||||
*/
|
||||
@NotEmpty(message = "第三方唯一流水id不能为空")
|
||||
private String thirdOrderId;
|
||||
|
||||
/**
|
||||
* 扣款金额(分)
|
||||
*/
|
||||
@NotNull(message = "扣款金额不能为空")
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package com.bsd.pjcloud.thirdparty.vo.pay;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PayGetWalletInfoVo {
|
||||
|
||||
/**
|
||||
* sm4加密后的手机号
|
||||
*/
|
||||
private String signPhone;
|
||||
|
||||
/**
|
||||
* 用户真实姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户余额(分)
|
||||
*/
|
||||
private int balance;
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ public class PayWalletInfoVo {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* sm4加密后的手机号
|
||||
|
||||
@@ -145,6 +145,14 @@
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources/doc</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.wps</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
+7
-2
@@ -20,12 +20,15 @@ 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 jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.Validation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 第三方支付
|
||||
@@ -64,6 +67,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
return baseVo;
|
||||
}
|
||||
PayDto dto = JSONUtil.toBean(json, PayDto.class);
|
||||
Set<ConstraintViolation<PayDto>> validate = Validation.buildDefaultValidatorFactory().getValidator().validate(dto);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.PARAMS_ERROR);
|
||||
// 日志
|
||||
@@ -182,7 +186,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
payLogService.save(logObj);
|
||||
return baseVo;
|
||||
}
|
||||
WalletManageVo userWallet = walletService.getWalletByUserPhone(phone, WalletTypeEnum.EAT).getData();
|
||||
WalletManageVo userWallet = walletService.getWalletByUserPhone(phone, WalletTypeEnum.PAY).getData();
|
||||
if (ObjectUtil.isEmpty(userWallet)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.USER_EXIST);
|
||||
// 日志
|
||||
@@ -191,7 +195,8 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
payLogService.save(logObj);
|
||||
return baseVo;
|
||||
}
|
||||
PayGetWalletInfoVo result = new PayGetWalletInfoVo();
|
||||
PayWalletInfoVo result = new PayWalletInfoVo();
|
||||
result.setUserId(userWallet.getUserId());
|
||||
result.setSignPhone(dto.getSignPhone());
|
||||
result.setBalance(userWallet.getBalance());
|
||||
result.setName(userWallet.getUsername());
|
||||
|
||||
Binary file not shown.
+45
-1
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.admin;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bsd.pjcloud.thirdparty.ThirdPartyApp;
|
||||
@@ -7,6 +8,8 @@ import com.bsd.pjcloud.thirdparty.constant.ThirdKeyTypeEnum;
|
||||
import com.bsd.pjcloud.thirdparty.entity.ThirdKeyManageEntity;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdKeyManageService;
|
||||
import com.bsd.pjcloud.thirdparty.utils.lb.tool.LbRetailSignUtils;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayBaseVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayWalletInfoVo;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
@@ -33,17 +36,58 @@ public class PayTest {
|
||||
@Resource
|
||||
private ThirdKeyManageService keyManageService;
|
||||
|
||||
// 查询钱包信息
|
||||
@Test
|
||||
public void walletInfo() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("signPhone", LbRetailSignUtils.sm4Encrypt("17683843144", config.getFieldKey()));
|
||||
paramsMap.put("signPhone", LbRetailSignUtils.sm4Encrypt("17683843141", config.getFieldKey()));
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletInfoUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
PayBaseVo baseVo = JSONUtil.toBean(res, PayBaseVo.class);
|
||||
if (ObjectUtil.isNotEmpty(baseVo)) {
|
||||
PayWalletInfoVo walletInfo = JSONUtil.toBean(String.valueOf(baseVo.getData()), PayWalletInfoVo.class);
|
||||
baseVo.setData(walletInfo);
|
||||
}
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
// 扣款(没有购物车)
|
||||
@Test
|
||||
public void walletPay() throws Exception {
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("userId", 1875049673022279681L);
|
||||
paramsMap.put("thirdOrderId", "1");
|
||||
paramsMap.put("price", 100);
|
||||
paramsMap.put("products", null);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
// 扣款(有购物车)
|
||||
@Test
|
||||
public void walletCarPay() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
// 退款
|
||||
@Test
|
||||
public void walletRefund() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletRefundUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
private ThirdKeyManageEntity getLbConfig() {
|
||||
return keyManageService.get(ThirdKeyTypeEnum.LB);
|
||||
|
||||
Reference in new issue
Block a user