当前位置:网站首页>How to prevent repeated submission of new orders
How to prevent repeated submission of new orders
2022-07-01 19:54:00 【Ink stained with frost】
The last article wrote idempotent anti shake to prevent repeated submissions , It can effectively prevent continuous click submission , But now there is a situation , The submitted data processing return timeout is caused by the slow network or background server , Wait a little bit 1 Submit minutes or even minutes later , Idempotent anti shake does not work , Order generation multiple times .
To solve this problem , When I entered the order page, I requested a UUID, Unless you re-enter the page UUID It won't change , Then submit with this UUID To request , If REIDS Should be UUID If there is a duplicate request , There is no such thing as the background will receive UUID Deposit in REDIS in , If the processing fails, you still need to remove this KEY.
The reference codes are as follows :
String key= MessageFormat.format("INSERT:HYKCZD:{0}:{1}",vo.getTenantId(),vo.getDjbh());
if(redisService.haskey(key)) throw new BusinessException(" This page request has been processed , Do not submit again ");
redisService.setCacheObject(key,vo.getZdr()+"-"+getDateTime(),7, TimeUnit.DAYS);
PosVipCzsz czsz=czszMapper.selectById(vo.getCzszId());
if(czsz.getType()==0){
vo.setJe1(czsz.getJe2());
vo.setJe2(czsz.getJe());
vo.setJe3(czsz.getJe1());
}else{
validObjectParam(vo, VpczdVO.class, "je2","je3");
Double je1=add(vo.getJe2(), vo.getJe3());
vo.setJe1(je1);
}
String host=getHost(),url="pos/vpczd/cz",json= JSON.toJSONString(vo);
JsonResult jsonResult= doGetJsonResult$post(host, url, json);
if(!jsonResult.isSuccess()) {
redisService.deleteObject(key);
throw new DataIntefaceException(jsonResult.getMsg());
}
return 1;边栏推荐
- EasyCVR集群视频广场页面切换时,请求流未能终止的问题优化
- HLS4ML报错The board_part definition was not found for tul.com.tw:pynq-z2:part0:1.0.
- Example explanation: move graph explorer to jupyterlab
- Using win7 vulnerability to crack the system login password
- Linux下安装Redis,并配置环境
- Redis installation and startup in Windows environment (background startup)
- How to use console Log print text?
- Win11暂停更新点不了怎么办?Win11暂停更新是灰色的如何解决?
- The large list set is divided into multiple small list sets in equal proportion
- 自定义插入页面标签以及实现类似通讯录的首字母搜索
猜你喜欢

Why must we move from Devops to bizdevops?

开发那些事儿:EasyCVR集群设备管理页面功能展示优化

JVM内存模型

How to use console Log print text?
![[research materials] Huawei Technology ICT 2021: at the beginning of the](/img/83/f21f148103815691796f87a95c687f.jpg)
[research materials] Huawei Technology ICT 2021: at the beginning of the "Yuan" year, the industry is "new" -- download attached

servlet知识点

Technology T3 domestic platform! Successfully equipped with "Yihui domestic real-time system sylixos"
![[research data] observation on the differences of health preservation concepts among people in 2022 - Download attached](/img/50/926cc5bce83f8b195b3e2072b656bf.jpg)
[research data] observation on the differences of health preservation concepts among people in 2022 - Download attached

Cookie和Session的相关概念

对象的创建
随机推荐
Detailed configuration of network security "Splunk" in national vocational college skills competition
How to correctly use vertx to operate redis (3.9.4 with source code analysis)
Win11快捷键切换输入法无反应怎么办?快捷键切换输入法没有反应
A quietly rising domestic software, low-key and powerful!
Transaction isolation level gap lock deadlock
利用win7漏洞进行系统登录密码破解
Understand the structure in C language in one article
Example explanation: move graph explorer to jupyterlab
较真儿学源码系列-InheritableThreadLocal(逐行源码带你分析作者思路)
Install redis under Linux and configure the environment
DDR4 test-2
Process steps of vibrating wire acquisition module for measuring vibrating wire sensor
Anaconda installs the virtual environment to the specified path
解决VSCode下载慢或下载失败的问题
SwiftUI 4 新功能大全之 Toggle与 Mixed Toggle 多个绑定组件
【C语言】详解 memset() 函数用法
JS ternary expression complex condition judgment
Bind this of the current scope for callback functions in other cases such as timers and delayers
JDBC中如何添加事务
[research materials] Huawei Technology ICT 2021: at the beginning of the "Yuan" year, the industry is "new" -- download attached