当前位置:网站首页>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
边栏推荐
- MySQL linked list data storage query sorting problem
- Log4j2
- [multithreading] the main thread waits for the sub thread to finish executing, and records the way to execute and obtain the execution result (with annotated code and no pit)
- excel表格中选中单元格出现十字带阴影的选中效果
- 揭露数据不一致的利器 —— 实时核对系统
- 基于Hardhat和Openzeppelin开发可升级合约(二)
- 动态内存(进阶四)
- HOW TO EASILY CREATE BARPLOTS WITH ERROR BARS IN R
- qt 仪表自定义控件
- How to Easily Create Barplots with Error Bars in R
猜你喜欢
BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
可昇級合約的原理-DelegateCall
GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL
File operation (detailed!)
Always report errors when connecting to MySQL database
How to Visualize Missing Data in R using a Heatmap
FLESH-DECT(MedIA 2021)——一个material decomposition的观点
GGHIGHLIGHT: EASY WAY TO HIGHLIGHT A GGPLOT IN R
Research on and off the Oracle chain
[visual studio 2019] create and import cmake project
随机推荐
Attribute acquisition method and operation notes of C # multidimensional array
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
Data analysis - Matplotlib sample code
GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
Bedtools tutorial
Is it safe to open a stock account online? I'm a novice, please guide me
揭露数据不一致的利器 —— 实时核对系统
YYGH-BUG-05
Homer forecast motif
CTF record
Redis exceeds the maximum memory error oom command not allowed when used memory & gt; ' maxmemory'
YYGH-BUG-04
RPA进阶(二)Uipath应用实践
The selected cells in Excel form have the selection effect of cross shading
行业的分析
Seriation in R: How to Optimally Order Objects in a Data Matrice
ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪
Principle of scalable contract delegatecall
From scratch, develop a web office suite (3): mouse events
How to Add P-Values onto Horizontal GGPLOTS