package com.hzs.scm.pub.component;

import com.hzs.common.core.constant.MagicNumberConstants;
import com.hzs.common.core.constant.msg.MemberMsgConstants;
import com.hzs.common.core.service.RedisService;
import com.hzs.common.core.utils.CommonUtil;
import com.hzs.common.core.utils.TransactionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @description: 供应链公共的组件工具库
 * @author: sui q
 * @time: 2023/11/22 10:40
 * @classname: PubUtilTool
 * @package_name: com.hzs.scm.pub.component
 * version 1.0.0
 */
@Component
public class ScmPubUtilTool {

    @Autowired
    private RedisService redisService;

    /**
     * @param orderPrefix 订单前缀
     * @return 订单号
     */
//    public String createOrderCode(String orderPrefix) {
//        for (int i = 0; i < MagicNumberConstants.RETRY_COUNT; i++) {
//            String orderCode = CommonUtil.createSerialNumber(orderPrefix);
//            if (redisService.lockKeyOnce(orderCode)) {
//                return orderCode;
//            }
//        }
//        throw new RuntimeException(TransactionUtils.getContent(MemberMsgConstants.MEMBER_IS_OPERATION));
//    }
}
