|
@@ -24,10 +24,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import java.math.BigInteger;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @Description: 免房券领取使用表
|
|
* @Description: 免房券领取使用表
|
|
@@ -43,14 +43,18 @@ public class BusMarketCouponsUsedServiceImpl extends ServiceImpl<BusMarketCoupon
|
|
|
@Resource
|
|
@Resource
|
|
|
private BusMarketCouponsMapper busMarketCouponsMapper;
|
|
private BusMarketCouponsMapper busMarketCouponsMapper;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 生成16位数字+prefix
|
|
|
|
|
+ * @param prefix
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
private String randomNumber(String prefix) {
|
|
private String randomNumber(String prefix) {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSSS");
|
|
|
|
|
- String number = sdf.format(System.currentTimeMillis());
|
|
|
|
|
-
|
|
|
|
|
- //补充一个三位随机数
|
|
|
|
|
- int x = (int) (Math.random() * 900) + 100;
|
|
|
|
|
- String serialNumber = prefix + number + x;
|
|
|
|
|
- return serialNumber;
|
|
|
|
|
|
|
+ int first = new Random(10).nextInt(8) + 1;
|
|
|
|
|
+ int hashCode = UUID.randomUUID().toString().hashCode();
|
|
|
|
|
+ if (hashCode < 0) {
|
|
|
|
|
+ hashCode = -hashCode;
|
|
|
|
|
+ }
|
|
|
|
|
+ return prefix + first + String.format("%015d", hashCode);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|