当前位置:网站首页>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
边栏推荐
- FLESH-DECT(MedIA 2021)——一个material decomposition的观点
- BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
- Amazon cloud technology community builder application window opens
- GGHIGHLIGHT: EASY WAY TO HIGHLIGHT A GGPLOT IN R
- MySQL stored procedure cursor traversal result set
- Esp32 audio frame esp-adf add key peripheral process code tracking
- 动态内存(进阶四)
- Industry analysis
- A white hole formed by antineutrons produced by particle accelerators
- Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)
猜你喜欢

How to Create a Beautiful Plots in R with Summary Statistics Labels

Amazon cloud technology community builder application window opens

2022年遭“挤爆”的三款透明LED显示屏

RPA advanced (II) uipath application practice

制造业数字化转型和精益生产什么关系

pgsql 字符串转数组关联其他表,匹配 拼接后原顺序展示

抖音海外版TikTok:正与拜登政府敲定最终数据安全协议

亚马逊云科技 Community Builder 申请窗口开启

TDSQL|就业难?腾讯云数据库微认证来帮你

Three transparent LED displays that were "crowded" in 2022
随机推荐
Power Spectral Density Estimates Using FFT---MATLAB
MySql存储过程游标遍历结果集
QT meter custom control
R HISTOGRAM EXAMPLE QUICK REFERENCE
时间格式化显示
bedtools使用教程
ESP32存储配网信息+LED显示配网状态+按键清除配网信息(附源码)
TDSQL|就业难?腾讯云数据库微认证来帮你
Seriation in R: How to Optimally Order Objects in a Data Matrice
基于Hardhat编写合约测试用例
YYGH-9-预约下单
通讯录的实现(文件版本)
From scratch, develop a web office suite (3): mouse events
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
Flesh-dect (media 2021) -- a viewpoint of material decomposition
qt 仪表自定义控件
Liftover for genome coordinate conversion
mysql链表数据存储查询排序问题
6. Introduce you to LED soft film screen. LED soft film screen size | price | installation | application
The position of the first underline selected by the vant tabs component is abnormal