| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.ruoyi.common.annotation.RepeatSubmit; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.JsonUtils; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.Duration; |
| | | import java.util.Collection; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 防止重复提交(参考美团GTIS防重系统) |
| | |
| | | |
| | | submitKey = SecureUtil.md5(submitKey + ":" + nowParams); |
| | | // 唯一标识(指定key + url + 消息头) |
| | | String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + url + submitKey; |
| | | String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey; |
| | | String key = RedisUtils.getCacheObject(cacheRepeatKey); |
| | | if (key == null) { |
| | | RedisUtils.setCacheObject(cacheRepeatKey, "", interval, TimeUnit.MILLISECONDS); |
| | | RedisUtils.setCacheObject(cacheRepeatKey, "", Duration.ofMillis(interval)); |
| | | KEY_CACHE.set(cacheRepeatKey); |
| | | } else { |
| | | String message = repeatSubmit.message(); |