微信刷脸模块

This commit is contained in:
张雪 2025-06-09 17:36:17 +08:00
parent ab05bf79ce
commit 9c09e8f004
1 changed files with 43 additions and 30 deletions

View File

@ -76,7 +76,9 @@ public class WxFacePayController {
* @throws Exception
*/
@RequestMapping(value = "/doFacePay", method = RequestMethod.POST)
public Result<WxFacePayAuthinfoResp> doFacePay(@RequestBody WxFaceOrderVo wxFaceOrderVo) throws Exception {
public Result<String> doFacePay(@RequestBody WxFaceOrderVo wxFaceOrderVo) throws Exception {
Result<String> result = new Result<>();
try {
//1 初始化
this.initWxpayface();
@ -103,8 +105,10 @@ public class WxFacePayController {
WxFacePayResp updFacePayResp = this.updateWxpayfacePayResult(wxFacePayResp0);
if (ObjUtil.isNotEmpty(updFacePayResp) && WxConstant.STATE_SUCCESS.equals(updFacePayResp.getReturn_code())) {
//向后端发起更新订单进行相应的操作
//11向后端发起更新订单进行相应的操作
this.updatePayResult(micropayResult);
result = Result.ok("微信刷脸成功!", micropayResult.getOutTradeNo());
}
} else { //查询失败或者长时间未有结果
//7撤销交易reverse
@ -112,9 +116,17 @@ public class WxFacePayController {
reverseRequest.setTransactionId(micropayResult.getTransactionId());
reverseRequest.setOutTradeNo(micropayResult.getOutTradeNo());
WxPayOrderReverseResult reverseResult = this.toReverseOrder(reverseRequest);
result = Result.error("微信刷脸失败后已经撤销订单!");
}
} else {
result = Result.error("获取人脸识别支付凭证为空值");
}
return Result.ok(authinfoResp);
} catch (Exception e) {
e.printStackTrace();
log.info("[WxFacePayController][doFacePay][84][微信刷脸完成流程出错] {}", e.getMessage());
result = Result.error("微信刷脸完成流程出错:" + e.getMessage());
}
return result;
}
@ -255,6 +267,7 @@ public class WxFacePayController {
* 查询微信刷脸订单状态
* 30秒
* 调用步骤6
*
* @param micropayResult
* @return
*/