|
|
@@ -119,7 +119,7 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
//生成商家id
|
|
|
String merchantId = generateMerchantId(fsStore.getBusinessCode());
|
|
|
//生成店铺id
|
|
|
- String sequence = generateStoreSequence(merchantId, fsStore.getBusinessCode());
|
|
|
+ String sequence = generateStoreSequence();
|
|
|
fsStore.setMerchantId(merchantId);
|
|
|
fsStore.setStoreSeq(sequence);
|
|
|
fsStoreMapper.insertFsStore(fsStore);
|
|
|
@@ -157,29 +157,37 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
|
|
|
* 格式:202510180001
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public String generateStoreSequence(String merchantId, String businessCode) {
|
|
|
+ public String generateStoreSequence() {
|
|
|
String datePart = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
|
|
|
|
|
- // 检查是否是新商家(根据营业执照是否已存在)
|
|
|
- boolean isNewMerchant = false;
|
|
|
- if (businessCode != null && !businessCode.trim().isEmpty()) {
|
|
|
- String existingMerchantId = fsStoreMapper.findMerchantIdByBusinessCode(businessCode);
|
|
|
- isNewMerchant = (existingMerchantId == null);
|
|
|
- } else {
|
|
|
- // 如果没有营业执照,检查商家ID是否已存在
|
|
|
- Integer existingStoreCount = fsStoreMapper.countStoresByMerchant(merchantId);
|
|
|
- isNewMerchant = (existingStoreCount == null || existingStoreCount == 0);
|
|
|
- }
|
|
|
-
|
|
|
- if (isNewMerchant) {
|
|
|
- // 新商家,店铺序列从1开始
|
|
|
- return datePart + "0001";
|
|
|
- } else {
|
|
|
- // 现有商家,获取当前商家的店铺数量+1
|
|
|
- Integer storeCount = fsStoreMapper.countStoresByMerchant(merchantId);
|
|
|
- Long sequence = (storeCount == null) ? 1L : storeCount + 1L;
|
|
|
- return datePart + String.format("%04d", sequence);
|
|
|
- }
|
|
|
+// // 检查是否是新商家(根据营业执照是否已存在)
|
|
|
+// boolean isNewMerchant = false;
|
|
|
+// if (businessCode != null && !businessCode.trim().isEmpty()) {
|
|
|
+// String existingMerchantId = fsStoreMapper.findMerchantIdByBusinessCode(businessCode);
|
|
|
+// isNewMerchant = (existingMerchantId == null);
|
|
|
+// } else {
|
|
|
+// // 如果没有营业执照,检查商家ID是否已存在
|
|
|
+// Integer existingStoreCount = fsStoreMapper.countStoresByMerchant(merchantId);
|
|
|
+// isNewMerchant = (existingStoreCount == null || existingStoreCount == 0);
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (isNewMerchant) {
|
|
|
+// // 新商家,店铺序列从1开始
|
|
|
+// return datePart + "0001";
|
|
|
+// } else {
|
|
|
+// // 现有商家,获取当前商家的店铺数量+1
|
|
|
+// Integer storeCount = fsStoreMapper.countStoresByMerchant(merchantId);
|
|
|
+// Long sequence = (storeCount == null) ? 1L : storeCount + 1L;
|
|
|
+// return datePart + String.format("%04d", sequence);
|
|
|
+// }
|
|
|
+
|
|
|
+ // 获取当天已生成的店铺数量
|
|
|
+ Long todayStoreCount = fsStoreMapper.countByStoreSeqPrefix(datePart);
|
|
|
+
|
|
|
+ // 序号从1开始,每天重置
|
|
|
+ Long sequence = (todayStoreCount == null) ? 1L : todayStoreCount + 1L;
|
|
|
+
|
|
|
+ return datePart + String.format("%04d", sequence);
|
|
|
}
|
|
|
|
|
|
/**
|