| | |
| | | //静态住入到自己的类中 |
| | | private static RedisService redisService; |
| | | |
| | | //将静态属性以入参(形参)的方式传入一个方法中,然后将此方法通过 @Autowired 注入到Spring容器中 |
| | | @Autowired |
| | | //将静态属性以入参(形参)的方式传入一个方法中,然后将此方法通过 @Resource 注入到Spring容器中 |
| | | @Resource |
| | | public void setService(RedisService redisService) { |
| | | CodeFactoryUtil.redisService = redisService; |
| | | } |
| | |
| | | * 用户id和随机数总长度 |
| | | */ |
| | | |
| | | private static final int maxLength = 4; |
| | | private static final int MAX_LENGTH = 4; |
| | | |
| | | /** |
| | | * 更具id进行加密+加随机数组成固定长度编码 |
| | |
| | | */ |
| | | public static String getShopNo(Long shopId) { |
| | | String prefix = SHOP_PREFIX; |
| | | return toFillZeroCode(prefix, maxLength, shopId); |
| | | return toFillZeroCode(prefix, MAX_LENGTH, shopId); |
| | | } |
| | | |
| | | public static String getShopOrderNo() { |