当前位置:网站首页>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
边栏推荐
- Writing contract test cases based on hardhat
- 基于Hardhat和Openzeppelin开发可升级合约(二)
- 预言机链上链下调研
- A white hole formed by antineutrons produced by particle accelerators
- Power Spectral Density Estimates Using FFT---MATLAB
- How to Create a Beautiful Plots in R with Summary Statistics Labels
- Introduction to interface debugging tools
- HOW TO EASILY CREATE BARPLOTS WITH ERROR BARS IN R
- 抖音海外版TikTok:正与拜登政府敲定最终数据安全协议
- MySQL stored procedure cursor traversal result set
猜你喜欢
RPA advanced (II) uipath application practice
Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)
R HISTOGRAM EXAMPLE QUICK REFERENCE
基于Hardhat和Openzeppelin开发可升级合约(一)
Mmrotate rotation target detection framework usage record
HOW TO EASILY CREATE BARPLOTS WITH ERROR BARS IN R
VS2019代码中包含中文内容导致的编译错误和打印输出乱码问题
GGHIGHLIGHT: EASY WAY TO HIGHLIGHT A GGPLOT IN R
HOW TO ADD P-VALUES TO GGPLOT FACETS
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
随机推荐
Native method merge word
基于Hardhat和Openzeppelin开发可升级合约(二)
Order by注入
ROS lacks catkin_ pkg
to_bytes与from_bytes简单示例
Principe du contrat évolutif - delegatecall
Functional interfaces and method references
map集合赋值到数据库
The computer screen is black for no reason, and the brightness cannot be adjusted.
Cluster Analysis in R Simplified and Enhanced
PHP query distance according to longitude and latitude
微信小程序利用百度api达成植物识别
PLC-Recorder快速监控多个PLC位的技巧
Esp32 audio frame esp-adf add key peripheral process code tracking
Principle of scalable contract delegatecall
Redis exceeds the maximum memory error oom command not allowed when used memory & gt; ' maxmemory'
Homer预测motif
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
STM32 single chip microcomputer programming learning
Is it safe to open a stock account online? I'm a novice, please guide me