2024-04-16 15:03:52 +08:00
|
|
|
package com.example.snailjob.customized;
|
2023-09-02 17:24:47 +08:00
|
|
|
|
2024-04-16 15:03:52 +08:00
|
|
|
import com.aizuda.snailjob.client.core.IdempotentIdGenerate;
|
|
|
|
import com.aizuda.snailjob.common.core.model.IdempotentIdContext;
|
|
|
|
import com.example.snailjob.vo.OrderVo;
|
2023-09-02 17:24:47 +08:00
|
|
|
|
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
|
|
|
|
|
|
|
|
|
public class OrderIdempotentIdGenerate implements IdempotentIdGenerate {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String idGenerate(IdempotentIdContext idempotentIdContext) throws Exception {
|
|
|
|
Object[] args = idempotentIdContext.getArgs();
|
|
|
|
OrderVo orderVo = (OrderVo) args[0];
|
|
|
|
return SecureUtil.md5(orderVo.getOrderId());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|