当前位置:网站首页>YYGH-BUG-05
YYGH-BUG-05
2022-07-02 09:41:00 【小赵呢】
整合微信支付
80行报错空指针异常
证明
这里一直显示失败
今天在整合微信支付的时候遇到一个bug,更新订单状态的时候我们需要根据订单号查询相对应的订单同时更改订单的状态为已支付
证明没有查到orderinfo这时我们发现getid是不行的应该getOrderid
改完之后重启项目
这时我们发现
现在已经是预约成功了
那么为什么我们改了这里就支付成功了呢,无需再次支付是这样的.
1.前端调用接口,生成二维码,返回一个map
map里面最重要的就是一个url存放二维码
2.前端解析map,显示二维码,同时前端每3秒检查支付状态
3.查询支付状态,当支付成功时更改项目数据库的支付状态
4.将更新完成的结果返回给前端,自动跳转详情页面
//更新订单状态
@Override
public void paySuccess(String tradeNo, Map<String, String> resultMap) {
//1.根据订单编号得到支付记录
QueryWrapper<PaymentInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("out_trade_no", tradeNo);
queryWrapper.eq("payment_type", PaymentTypeEnum.WEIXIN.getStatus());
PaymentInfo paymentInfo = baseMapper.selectOne(queryWrapper);
//2.更新支付信息
paymentInfo.setPaymentStatus(PaymentStatusEnum.PAID.getStatus());
paymentInfo.setCallbackTime(new Date());
paymentInfo.setTradeNo(resultMap.get("transaction_id"));
paymentInfo.setCallbackContent(resultMap.toString());
baseMapper.updateById(paymentInfo);
//3.根据订单号得到订单信息
log.info(String.valueOf(paymentInfo.getOrderId()));
OrderInfo orderInfo = orderService.getById(paymentInfo.getOrderId());
orderInfo.setOrderStatus(OrderStatusEnum.PAID.getStatus());
//4.更新订单信息
orderService.updateById(orderInfo);
//5.调用医院接口,更新支付信息
hospApi(orderInfo);
}
private void hospApi(OrderInfo orderInfo) {
SignInfoVo signInfoVo = hospitalFeignClient.getSignInfoVo(orderInfo.getHoscode());
if (null == signInfoVo) {
throw new YyghException(ResultCodeEnum.PARAM_ERROR);
}
Map<String, Object> reqMap = new HashMap<>();
reqMap.put("hoscode", orderInfo.getHoscode());
reqMap.put("hosRecordId", orderInfo.getHosRecordId());
reqMap.put("timestamp", HttpRequestHelper.getTimestamp());
String sign = HttpRequestHelper.getSign(reqMap, signInfoVo.getSignKey());
reqMap.put("sign", sign);
JSONObject result = HttpRequestHelper.sendRequest(reqMap, signInfoVo.getApiUrl() + "/order/updatePayStatus");
if (result.getInteger("code") != 200) {
throw new YyghException(result.getString("message"), ResultCodeEnum.FAIL.getCode());
}
}
而我们刚刚卡在了第4步当我们修改完代码前端检查到我们已经更新完的时候,之前的支付操作没有收到影响
微信退款
今天在写退款接口的时候有一个bug款退了但是前端还是显示已预约,
通过调查发现这个Boolean有问题,不管出错与否都是返回false
边栏推荐
猜你喜欢
The selected cells in Excel form have the selection effect of cross shading
MySQL comparison operator in problem solving
R HISTOGRAM EXAMPLE QUICK REFERENCE
文件操作(详解!)
JS -- take a number randomly from the array every call, and it cannot be the same as the last time
[cloud native] 2.5 kubernetes core practice (Part 2)
Webauthn - official development document
GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL
微信小程序利用百度api达成植物识别
CTF record
随机推荐
MTK full dump grab
How to Create a Nice Box and Whisker Plot in R
Fabric.js 3个api设置画布宽高
A white hole formed by antineutrons produced by particle accelerators
Tdsql | difficult employment? Tencent cloud database micro authentication to help you
The difference between SQL left join main table restrictions written after on and where
liftOver进行基因组坐标转换
Wechat applet uses Baidu API to achieve plant recognition
基于 Openzeppelin 的可升级合约解决方案的注意事项
6方面带你认识LED软膜屏 LED软膜屏尺寸|价格|安装|应用
JS——每次调用从数组里面随机取一个数,且不能与上一次为同一个
The selected cells in Excel form have the selection effect of cross shading
What are the methods of adding elements to arrays in JS
Jinshanyun - 2023 Summer Internship
[cloud native] 2.5 kubernetes core practice (Part 2)
bedtools使用教程
On April 17, 2022, the five heart matchmaker team received double good news
Cluster Analysis in R Simplified and Enhanced
Attribute acquisition method and operation notes of C # multidimensional array
Develop scalable contracts based on hardhat and openzeppelin (I)