当前位置:网站首页>YYGH-BUG-05
YYGH-BUG-05
2022-07-02 11:52:00 【What about Xiao Zhao】
Integrate wechat payment



80 Line error null pointer exception
prove
Failure is always displayed here
When integrating wechat payment today, I encountered a bug, When updating the order status, we need to query the corresponding order according to the order number and change the order status to paid 
The certificate is not found orderinfo And then we found out getid It doesn't work. It should getOrderid
Restart the project after the change
And then we found out
Now the appointment is successful 
So why did we change here and pay successfully , No need to pay again is this .
1. Front-end call interface , Generate qr code , Return to one map

map The most important one is url Store QR code
2. Front end analysis map, Display QR code , At the same time, each 3 Check the payment status in seconds
3. Query payment status , Change the payment status of the project database when the payment is successful

4. Return the updated results to the front end , Automatically jump to the details page
// Update order status
@Override
public void paySuccess(String tradeNo, Map<String, String> resultMap) {
//1. Get the payment record according to the order number
QueryWrapper<PaymentInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("out_trade_no", tradeNo);
queryWrapper.eq("payment_type", PaymentTypeEnum.WEIXIN.getStatus());
PaymentInfo paymentInfo = baseMapper.selectOne(queryWrapper);
//2. Update payment information
paymentInfo.setPaymentStatus(PaymentStatusEnum.PAID.getStatus());
paymentInfo.setCallbackTime(new Date());
paymentInfo.setTradeNo(resultMap.get("transaction_id"));
paymentInfo.setCallbackContent(resultMap.toString());
baseMapper.updateById(paymentInfo);
//3. Get the order information according to the order number
log.info(String.valueOf(paymentInfo.getOrderId()));
OrderInfo orderInfo = orderService.getById(paymentInfo.getOrderId());
orderInfo.setOrderStatus(OrderStatusEnum.PAID.getStatus());
//4. Update order information
orderService.updateById(orderInfo);
//5. Call the hospital interface , Update payment information
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());
}
}
And we just got stuck in the first 4 Step when we finish modifying the code, the front end checks that we have updated , Previous payment operations have not been affected
Wechat refund

When writing the refund interface today, there is a bug The money is refunded, but the front end still shows that you have made an appointment ,

Through investigation, we found this Boolean There is a problem , Whether there is an error or not, it is returned false
边栏推荐
- HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
- Is it safe to open a stock account through the QR code of the securities manager? Or is it safe to open an account in a securities company?
- 亚马逊云科技 Community Builder 申请窗口开启
- php 根据经纬度查询距离
- 动态内存(进阶四)
- GGPlot Examples Best Reference
- Seriation in R: How to Optimally Order Objects in a Data Matrice
- K-Means Clustering Visualization in R: Step By Step Guide
- The position of the first underline selected by the vant tabs component is abnormal
- Redis exceeds the maximum memory error oom command not allowed when used memory & gt; ' maxmemory'
猜你喜欢

HOW TO EASILY CREATE BARPLOTS WITH ERROR BARS IN R

Seriation in R: How to Optimally Order Objects in a Data Matrice

可昇級合約的原理-DelegateCall

CTF record

Power Spectral Density Estimates Using FFT---MATLAB

How to Create a Nice Box and Whisker Plot in R

Map set assignment to database

Tdsql | difficult employment? Tencent cloud database micro authentication to help you

How to Add P-Values onto Horizontal GGPLOTS

H5,为页面添加遮罩层,实现类似于点击右上角在浏览器中打开
随机推荐
[visual studio 2019] create and import cmake project
Some problems encountered in introducing lvgl into esp32 Arduino
RPA进阶(二)Uipath应用实践
Principe du contrat évolutif - delegatecall
基于Hardhat和Openzeppelin开发可升级合约(一)
Develop scalable contracts based on hardhat and openzeppelin (II)
How to Easily Create Barplots with Error Bars in R
电脑无缘无故黑屏,无法调节亮度。
【2022 ACTF-wp】
制造业数字化转型和精益生产什么关系
HOW TO ADD P-VALUES ONTO A GROUPED GGPLOT USING THE GGPUBR R PACKAGE
What week is a date obtained by QT
【多线程】主线程等待子线程执行完毕在执行并获取执行结果的方式记录(有注解代码无坑)
Power Spectral Density Estimates Using FFT---MATLAB
A sharp tool for exposing data inconsistencies -- a real-time verification system
How to Create a Beautiful Plots in R with Summary Statistics Labels
BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
微信小程序利用百度api达成植物识别
基于Hardhat编写合约测试用例
Tdsql | difficult employment? Tencent cloud database micro authentication to help you